From 1faf201e8608dfa4d7af3460fd3d1fc7ebec398b Mon Sep 17 00:00:00 2001 From: talasila Date: Tue, 7 Feb 2017 11:47:55 -0500 Subject: Initial OpenECOMP Portal SDK commit Change-Id: I66a3491600a4b9ea241128dc29267eed6a78ed76 Signed-off-by: talasila --- .gitreview | 4 + .idea/ecompsdkos.iml | 9 + .idea/misc.xml | 19 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + .idea/workspace.xml | 328 + ecomp-sdk/LICENSE.txt | 19 + ecomp-sdk/README.md | 15 + ecomp-sdk/pom.xml | 249 + ecomp-sdk/quantum/.gitignore | 1 + ecomp-sdk/quantum/README.md | 11 + ecomp-sdk/quantum/pom.xml | 330 + .../org/openecomp/portalsdk/core/FusionObject.java | 113 + .../portalsdk/core/command/LoginBean.java | 196 + .../portalsdk/core/command/PostDroolsBean.java | 51 + .../portalsdk/core/command/PostSearchBean.java | 374 + .../portalsdk/core/command/UserRowBean.java | 85 + .../portalsdk/core/command/support/SearchBase.java | 268 + .../core/command/support/SearchResult.java | 58 + .../openecomp/portalsdk/core/conf/AppConfig.java | 301 + .../portalsdk/core/conf/AppInitializer.java | 69 + .../portalsdk/core/conf/Configurable.java | 38 + .../core/conf/HibernateConfiguration.java | 155 + .../core/conf/HibernateMappingLocatable.java | 28 + .../controller/AdminAuthGenericController.java | 134 + .../core/controller/AngularAdminController.java | 50 + .../core/controller/BroadcastController.java | 130 + .../core/controller/BroadcastListController.java | 142 + .../core/controller/CacheAdminController.java | 252 + .../core/controller/CollaborateListController.java | 84 + .../core/controller/CollaborationController.java | 47 + .../core/controller/ElementModelController.java | 91 + .../core/controller/ExternalLoginController.java | 121 + .../core/controller/FavoritesController.java | 117 + .../core/controller/FnMenuController.java | 224 + .../core/controller/FuncMenuController.java | 174 + .../core/controller/FusionBaseController.java | 135 + .../core/controller/LogoutController.java | 110 + .../core/controller/MenuListController.java | 245 + .../core/controller/PostSearchController.java | 219 + .../core/controller/ProfileController.java | 349 + .../core/controller/ProfileSearchController.java | 149 + .../core/controller/RestrictedBaseController.java | 50 + .../RestrictedRESTfulBaseController.java | 50 + .../portalsdk/core/controller/RoleController.java | 332 + .../controller/RoleFunctionListController.java | 184 + .../core/controller/RoleListController.java | 179 + .../core/controller/SingleSignOnController.java | 232 + .../controller/UnRestrictedBaseController.java | 40 + .../core/controller/UsageListController.java | 163 + .../openecomp/portalsdk/core/dao/AbstractDao.java | 62 + .../openecomp/portalsdk/core/dao/ProfileDao.java | 29 + .../portalsdk/core/dao/ProfileDaoImpl.java | 50 + .../core/dao/hibernate/ModelOperationsCommon.java | 453 + .../portalsdk/core/dao/support/FusionDao.java | 35 + .../org/openecomp/portalsdk/core/domain/App.java | 206 + .../openecomp/portalsdk/core/domain/AuditLog.java | 79 + .../portalsdk/core/domain/BroadcastMessage.java | 123 + .../openecomp/portalsdk/core/domain/DomainVo.java | 177 + .../openecomp/portalsdk/core/domain/FnMenu.java | 142 + .../openecomp/portalsdk/core/domain/FusionVo.java | 27 + .../openecomp/portalsdk/core/domain/LoginBean.java | 187 + .../openecomp/portalsdk/core/domain/Lookup.java | 85 + .../openecomp/portalsdk/core/domain/LuCountry.java | 86 + .../openecomp/portalsdk/core/domain/LuState.java | 68 + .../portalsdk/core/domain/LuTimeZone.java | 77 + .../org/openecomp/portalsdk/core/domain/Menu.java | 160 + .../openecomp/portalsdk/core/domain/MenuData.java | 61 + .../openecomp/portalsdk/core/domain/Profile.java | 96 + .../org/openecomp/portalsdk/core/domain/Role.java | 174 + .../portalsdk/core/domain/RoleFunction.java | 69 + .../portalsdk/core/domain/UrlsAccessible.java | 83 + .../portalsdk/core/domain/UrlsAccessibleKey.java | 90 + .../org/openecomp/portalsdk/core/domain/User.java | 585 + .../openecomp/portalsdk/core/domain/UserApp.java | 108 + .../openecomp/portalsdk/core/domain/UserAppId.java | 88 + .../core/domain/sessionmgt/TimeoutVO.java | 63 + .../portalsdk/core/domain/support/Attribute.java | 62 + .../core/domain/support/CollaborateList.java | 56 + .../portalsdk/core/domain/support/Container.java | 331 + .../portalsdk/core/domain/support/Domain.java | 259 + .../portalsdk/core/domain/support/DomainVo.java | 179 + .../portalsdk/core/domain/support/Element.java | 161 + .../core/domain/support/ElementDetails.java | 68 + .../core/domain/support/FusionCommand.java | 39 + .../portalsdk/core/domain/support/Layout.java | 991 + .../portalsdk/core/domain/support/NameValueId.java | 94 + .../portalsdk/core/domain/support/Position.java | 40 + .../portalsdk/core/domain/support/Size.java | 40 + .../portalsdk/core/drools/DroolsRuleService.java | 27 + .../core/drools/DroolsRuleServiceImpl.java | 58 + .../core/exception/FusionExceptionResolver.java | 50 + .../core/exception/SessionExpiredException.java | 34 + .../exception/UrlAccessRestrictedException.java | 34 + .../core/exception/support/FusionException.java | 24 + .../exception/support/FusionRuntimeException.java | 36 + .../core/interceptor/ResourceInterceptor.java | 164 + .../interceptor/SessionTimeoutInterceptor.java | 103 + .../core/interfaces/SecurityInterface.java | 24 + .../core/listener/ApplicationContextListener.java | 43 + .../listener/CollaborateListBindingListener.java | 61 + .../core/listener/UserSessionListener.java | 62 + .../portalsdk/core/logging/aspect/AuditLog.java | 32 + .../core/logging/aspect/EELFLoggerAdvice.java | 193 + .../core/logging/aspect/EELFLoggerAspect.java | 88 + .../portalsdk/core/logging/aspect/MetricsLog.java | 32 + .../core/logging/format/AlarmSeverityEnum.java | 28 + .../core/logging/format/AppMessagesEnum.java | 249 + .../logging/format/ApplicationCodes.properties | 221 + .../core/logging/format/AuditLogFormatter.java | 106 + .../core/logging/format/ErrorCodesEnum.java | 87 + .../core/logging/format/ErrorSeverityEnum.java | 27 + .../core/logging/format/ErrorTypeEnum.java | 29 + .../core/logging/logic/EELFLoggerDelegate.java | 323 + .../openecomp/portalsdk/core/menu/MenuBuilder.java | 164 + .../portalsdk/core/menu/MenuProperties.java | 114 + .../core/objectcache/AbstractCacheManager.java | 60 + .../core/objectcache/jcs/JCSCacheEventHandler.java | 60 + .../core/objectcache/jcs/JCSCacheManager.java | 186 + .../objectcache/support/FusionCacheManager.java | 36 + .../core/onboarding/client/AppContextManager.java | 45 + .../client/OnBoardingApiServiceImpl.java | 316 + .../core/onboarding/session/TestClass.java | 24 + .../portalsdk/core/onboarding/sso/TestClass.java | 24 + .../core/restful/client/HttpStatusAndResponse.java | 42 + .../core/restful/client/PortalRestClientBase.java | 171 + .../restful/client/SharedContextRestClient.java | 330 + .../portalsdk/core/scheduler/CoreRegister.java | 95 + .../portalsdk/core/scheduler/CronRegistry.java | 124 + .../portalsdk/core/scheduler/Registerable.java | 30 + .../portalsdk/core/service/AppService.java | 61 + .../portalsdk/core/service/AppServiceImpl.java | 106 + .../portalsdk/core/service/AuditService.java | 36 + .../portalsdk/core/service/AuditServiceImpl.java | 50 + .../portalsdk/core/service/BroadcastService.java | 37 + .../core/service/BroadcastServiceImpl.java | 248 + .../portalsdk/core/service/DataAccessService.java | 80 + .../core/service/DataAccessServiceImpl.java | 592 + .../portalsdk/core/service/ElementLinkService.java | 269 + .../portalsdk/core/service/ElementMapService.java | 915 + .../portalsdk/core/service/FnMenuService.java | 46 + .../portalsdk/core/service/FnMenuServiceImpl.java | 145 + .../portalsdk/core/service/LdapService.java | 31 + .../portalsdk/core/service/LdapServiceImpl.java | 269 + .../portalsdk/core/service/LoginService.java | 36 + .../portalsdk/core/service/LoginServiceImpl.java | 190 + .../portalsdk/core/service/PostDroolsService.java | 34 + .../core/service/PostDroolsServiceImpl.java | 179 + .../portalsdk/core/service/PostSearchService.java | 30 + .../core/service/PostSearchServiceImpl.java | 203 + .../portalsdk/core/service/ProfileService.java | 36 + .../portalsdk/core/service/ProfileServiceImpl.java | 72 + .../portalsdk/core/service/RoleService.java | 50 + .../portalsdk/core/service/RoleServiceImpl.java | 171 + .../core/service/RoleServiceNonSpringImpl.java | 122 + .../portalsdk/core/service/UserProfileService.java | 36 + .../core/service/UserProfileServiceImpl.java | 210 + .../core/service/WebServiceCallService.java | 26 + .../core/service/WebServiceCallServiceImpl.java | 189 + .../core/service/support/FusionService.java | 27 + .../core/service/support/ServiceLocator.java | 27 + .../core/service/support/ServiceLocatorImpl.java | 74 + .../portalsdk/core/util/CacheManager.java | 43 + .../openecomp/portalsdk/core/util/CipherUtil.java | 125 + .../portalsdk/core/util/EncDecUtilTest.java | 112 + .../org/openecomp/portalsdk/core/util/EncTest.java | 39 + .../openecomp/portalsdk/core/util/JSONUtil.java | 56 + .../portalsdk/core/util/SystemProperties.java | 279 + .../openecomp/portalsdk/core/util/UsageUtils.java | 92 + .../openecomp/portalsdk/core/util/YamlUtils.java | 69 + .../core/web/socket/PeerBroadcastSocket.java | 104 + .../portalsdk/core/web/socket/WebRTCSocket.java | 143 + .../portalsdk/core/web/support/AppUtils.java | 195 + .../core/web/support/ControllerProperties.java | 41 + .../core/web/support/FeedbackMessage.java | 80 + .../portalsdk/core/web/support/JsonMessage.java | 118 + .../portalsdk/core/web/support/MessagesList.java | 93 + .../portalsdk/core/web/support/UserUtils.java | 373 + .../core/MockApplicationContextTestSuite.java | 127 + .../core/MockHibernateMappingLocations.java | 20 + .../sessionmgt/PortalCommunicationTest.java | 56 + ecomp-sdk/sdk-analytics/.gitignore | 2 + ecomp-sdk/sdk-analytics/README.md | 8 + ecomp-sdk/sdk-analytics/pom.xml | 160 + .../openecomp/portalsdk/analytics/AntBuild.java | 89 + .../portalsdk/analytics/RaptorObject.java | 44 + .../portalsdk/analytics/config/ConfigLoader.java | 196 + .../portalsdk/analytics/controller/Action.java | 89 + .../analytics/controller/ActionHandler.java | 2417 ++ .../analytics/controller/ActionMapping.java | 34 + .../portalsdk/analytics/controller/Controller.java | 124 + .../analytics/controller/ErrorHandler.java | 112 + .../analytics/controller/WizardProcessor.java | 2354 ++ .../analytics/controller/WizardSequence.java | 189 + .../controller/WizardSequenceCrossTab.java | 43 + .../controller/WizardSequenceDashboard.java | 38 + .../analytics/controller/WizardSequenceLinear.java | 45 + .../controller/WizardSequenceSQLBasedCrossTab.java | 42 + .../controller/WizardSequenceSQLBasedHive.java | 44 + .../controller/WizardSequenceSQLBasedLinear.java | 45 + .../WizardSequenceSQLBasedLinearDatamining.java | 44 + .../portalsdk/analytics/error/RaptorException.java | 35 + .../analytics/error/RaptorRuntimeException.java | 36 + .../analytics/error/RaptorSchedularException.java | 36 + .../analytics/error/ReportSQLException.java | 51 + .../analytics/error/UserAccessException.java | 34 + .../analytics/error/UserDefinedException.java | 35 + .../analytics/error/ValidationException.java | 42 + .../portalsdk/analytics/gmap/line/Line.java | 86 + .../analytics/gmap/line/LineCollection.java | 158 + .../portalsdk/analytics/gmap/line/LineInfo.java | 190 + .../analytics/gmap/map/ColorProperties.java | 119 + .../analytics/gmap/map/GMapProperties.java | 46 + .../analytics/gmap/map/GeoCoordinate.java | 25 + .../portalsdk/analytics/gmap/map/MapConstant.java | 44 + .../portalsdk/analytics/gmap/map/NovaMap.java | 504 + .../analytics/gmap/map/layer/SwingLayer.java | 234 + .../portalsdk/analytics/gmap/node/Node.java | 178 + .../analytics/gmap/node/NodeCollection.java | 188 + .../portalsdk/analytics/gmap/node/NodeInfo.java | 210 + .../portalsdk/analytics/gmap/utils/MapUtils.java | 62 + .../analytics/gmap/utils/SwingWorker.java | 155 + .../portalsdk/analytics/model/DataCache.java | 524 + .../portalsdk/analytics/model/ReportHandler.java | 6605 +++ .../portalsdk/analytics/model/ReportLoader.java | 1061 + .../portalsdk/analytics/model/SearchHandler.java | 490 + .../analytics/model/base/ChartSeqComparator.java | 49 + .../analytics/model/base/IdNameColLookup.java | 35 + .../portalsdk/analytics/model/base/IdNameList.java | 183 + .../analytics/model/base/IdNameLookup.java | 198 + .../portalsdk/analytics/model/base/IdNameSql.java | 400 + .../analytics/model/base/IdNameValue.java | 100 + .../analytics/model/base/NameComparator.java | 32 + .../analytics/model/base/OrderBySeqComparator.java | 37 + .../analytics/model/base/OrderSeqComparator.java | 37 + .../analytics/model/base/ReportSecurity.java | 407 + .../analytics/model/base/ReportWrapper.java | 5719 +++ .../analytics/model/definition/DBColumnInfo.java | 76 + .../model/definition/DrillDownParamDef.java | 111 + .../analytics/model/definition/Marker.java | 79 + .../model/definition/ReportDefinition.java | 1465 + .../analytics/model/definition/ReportLogEntry.java | 89 + .../analytics/model/definition/ReportMap.java | 82 + .../analytics/model/definition/ReportSchedule.java | 1407 + .../analytics/model/definition/SecurityEntry.java | 44 + .../analytics/model/definition/TableJoin.java | 67 + .../analytics/model/definition/TableSource.java | 101 + .../portalsdk/analytics/model/pdf/PageEvent.java | 256 + .../portalsdk/analytics/model/pdf/PdfBean.java | 242 + .../analytics/model/pdf/PdfReportHandler.java | 1890 + .../analytics/model/runtime/BarChartOptions.java | 75 + .../analytics/model/runtime/CategoryAxisJSON.java | 24 + .../analytics/model/runtime/ChartD3Helper.java | 4064 ++ .../analytics/model/runtime/ChartGen.java | 73 + .../analytics/model/runtime/ChartJSON.java | 448 + .../analytics/model/runtime/ChartJSONHelper.java | 1550 + .../analytics/model/runtime/ChartWebRuntime.java | 420 + .../model/runtime/CommonChartOptions.java | 81 + .../analytics/model/runtime/ErrorJSONRuntime.java | 43 + .../model/runtime/FlexTimeSeriesChartOptions.java | 38 + .../analytics/model/runtime/FormField.java | 2111 + .../analytics/model/runtime/FormatProcessor.java | 375 + .../portalsdk/analytics/model/runtime/Item.java | 54 + .../analytics/model/runtime/LookupDBInfo.java | 89 + .../analytics/model/runtime/RangeAxisJSON.java | 93 + .../analytics/model/runtime/ReportFormFields.java | 366 + .../analytics/model/runtime/ReportJSONRuntime.java | 694 + .../model/runtime/ReportParamDateValueParser.java | 194 + .../analytics/model/runtime/ReportParamValues.java | 370 + .../runtime/ReportParamValuesForPDFExcel.java | 419 + .../analytics/model/runtime/ReportRuntime.java | 3618 ++ .../model/runtime/TimeSeriesChartOptions.java | 62 + .../analytics/model/runtime/VisualManager.java | 68 + .../analytics/model/search/ReportSearchResult.java | 84 + .../model/search/ReportSearchResultJSON.java | 251 + .../analytics/model/search/SearchResult.java | 213 + .../analytics/model/search/SearchResultColumn.java | 254 + .../analytics/model/search/SearchResultField.java | 212 + .../analytics/model/search/SearchResultJSON.java | 80 + .../analytics/model/search/SearchResultRow.java | 92 + .../analytics/scheduler/SchedulerUtil.java | 369 + .../portalsdk/analytics/scheduler/SendEmail.java | 415 + .../analytics/scheduler/SendNotifications.java | 460 + .../portalsdk/analytics/system/AppUtils.java | 333 + .../analytics/system/ConnectionUtils.java | 69 + .../portalsdk/analytics/system/DbUtils.java | 1298 + .../portalsdk/analytics/system/ExecuteQuery.java | 60 + .../portalsdk/analytics/system/Globals.java | 2282 + .../portalsdk/analytics/system/IAppUtils.java | 175 + .../portalsdk/analytics/system/IDbUtils.java | 35 + .../portalsdk/analytics/system/RDbUtils.java | 36 + .../portalsdk/analytics/system/RemDbUtils.java | 200 + .../analytics/system/fusion/AntBuild.java | 66 + .../analytics/system/fusion/AppUtils.java | 363 + .../portalsdk/analytics/system/fusion/DbUtils.java | 75 + .../analytics/system/fusion/RemoteDbUtils.java | 50 + .../adapter/AdapterSessionFactoryContainer.java | 39 + .../analytics/system/fusion/adapter/DateUtils.java | 287 + .../system/fusion/adapter/FusionAdapter.java | 135 + .../analytics/system/fusion/adapter/IdName.java | 59 + .../analytics/system/fusion/adapter/Item.java | 55 + .../analytics/system/fusion/adapter/Lookup.java | 85 + .../system/fusion/adapter/RaptorAdapter.java | 368 + .../system/fusion/adapter/SpringContext.java | 37 + .../fusion/controller/FileServletController.java | 206 + .../analytics/system/fusion/domain/CR_Report.java | 306 + .../analytics/system/fusion/domain/QuickLink.java | 61 + .../system/fusion/domain/RaptorSearch.java | 188 + .../analytics/system/fusion/domain/ReportInfo.java | 159 + .../system/fusion/service/RaptorService.java | 36 + .../system/fusion/service/RaptorServiceImpl.java | 163 + .../system/fusion/web/RaptorController.java | 191 + .../system/fusion/web/RaptorControllerAsync.java | 410 + .../fusion/web/ReportsSearchListController.java | 74 + .../portalsdk/analytics/util/AppConstants.java | 658 + .../portalsdk/analytics/util/DataSet.java | 177 + .../portalsdk/analytics/util/ExcelColorDef.java | 68 + .../portalsdk/analytics/util/HtmlStripper.java | 155 + .../openecomp/portalsdk/analytics/util/Log.java | 40 + .../portalsdk/analytics/util/RemDbInfo.java | 93 + .../portalsdk/analytics/util/SQLCorrector.java | 343 + .../portalsdk/analytics/util/Scheduler.java | 91 + .../openecomp/portalsdk/analytics/util/Utils.java | 378 + .../portalsdk/analytics/util/XSSFilter.java | 90 + .../analytics/util/upgrade/SystemUpgrade.java | 125 + .../portalsdk/analytics/view/ColumnHeader.java | 239 + .../portalsdk/analytics/view/ColumnHeaderRow.java | 100 + .../portalsdk/analytics/view/ColumnVisual.java | 74 + .../analytics/view/CrossTabColumnValues.java | 75 + .../analytics/view/CrossTabOrderManager.java | 98 + .../analytics/view/CrossTabTotalValue.java | 56 + .../portalsdk/analytics/view/DataRow.java | 169 + .../portalsdk/analytics/view/DataValue.java | 359 + .../portalsdk/analytics/view/HtmlFormatter.java | 205 + .../analytics/view/ReportColumnHeaderRows.java | 71 + .../portalsdk/analytics/view/ReportData.java | 812 + .../portalsdk/analytics/view/ReportDataRows.java | 72 + .../analytics/view/ReportRowHeaderCols.java | 71 + .../portalsdk/analytics/view/RowHeader.java | 119 + .../portalsdk/analytics/view/RowHeaderCol.java | 156 + .../analytics/xmlobj/ChartAdditionalOptions.java | 1178 + .../analytics/xmlobj/ChartDrillFormfield.java | 86 + .../analytics/xmlobj/ChartDrillOptions.java | 207 + .../portalsdk/analytics/xmlobj/ColFilterList.java | 94 + .../portalsdk/analytics/xmlobj/ColFilterType.java | 298 + .../analytics/xmlobj/CustomReportType.java | 2011 + .../analytics/xmlobj/DashboardEditorList.java | 94 + .../analytics/xmlobj/DashboardEditorReport.java | 172 + .../analytics/xmlobj/DashboardReports.java | 94 + .../analytics/xmlobj/DashboardReportsNew.java | 148 + .../portalsdk/analytics/xmlobj/DataColumnList.java | 96 + .../portalsdk/analytics/xmlobj/DataColumnType.java | 1455 + .../portalsdk/analytics/xmlobj/DataSourceList.java | 94 + .../portalsdk/analytics/xmlobj/DataSourceType.java | 281 + .../analytics/xmlobj/DataminingOptions.java | 167 + .../portalsdk/analytics/xmlobj/FormFieldList.java | 121 + .../portalsdk/analytics/xmlobj/FormFieldType.java | 610 + .../portalsdk/analytics/xmlobj/FormatList.java | 96 + .../portalsdk/analytics/xmlobj/FormatType.java | 366 + .../analytics/xmlobj/JavascriptItemType.java | 144 + .../portalsdk/analytics/xmlobj/JavascriptList.java | 94 + .../portalsdk/analytics/xmlobj/Marker.java | 167 + .../portalsdk/analytics/xmlobj/ObjectFactory.java | 305 + .../analytics/xmlobj/PDFAdditionalOptions.java | 340 + .../analytics/xmlobj/PredefinedValueList.java | 94 + .../portalsdk/analytics/xmlobj/ReportMap.java | 445 + .../portalsdk/analytics/xmlobj/Reports.java | 113 + .../portalsdk/analytics/xmlobj/SemaphoreList.java | 94 + .../portalsdk/analytics/xmlobj/SemaphoreType.java | 227 + ecomp-sdk/sdk-app/.gitignore | 1 + ecomp-sdk/sdk-app/README.md | 14 + .../EcompSdkDDLMySql_1610_Complete_OS.sql | 1402 + .../EcompSdkDMLMySql_1610_Complete_OS.sql | 2891 ++ ecomp-sdk/sdk-app/distribution.xml | 21 + ecomp-sdk/sdk-app/pom.xml | 351 + .../portalapp/conf/ExternalAppConfig.java | 188 + .../portalapp/conf/ExternalAppInitializer.java | 60 + .../portalapp/conf/HibernateMappingLocations.java | 37 + .../controller/AngularSinglePageController.java | 48 + .../portalapp/controller/CallflowController.java | 44 + .../controller/ElasticSearchController.java | 128 + .../portalapp/controller/LeafletMapContoller.java | 43 + .../portalapp/controller/PostDroolsController.java | 138 + .../controller/UserProfileController.java | 72 + .../portalapp/controller/WelcomeController.java | 43 + .../java/org/openecomp/portalapp/model/Result.java | 37 + .../org/openecomp/portalapp/scheduler/LogJob.java | 47 + .../openecomp/portalapp/scheduler/LogRegistry.java | 57 + .../openecomp/portalapp/scheduler/Register.java | 82 + .../portalapp/scheduler/RegistryAdapter.java | 108 + .../portalapp/service/AdminAuthExtension.java | 34 + .../portalapp/uebhandler/InitUebHandler.java | 73 + .../portalapp/uebhandler/MainUebHandler.java | 104 + .../uebhandler/WidgetNotificationHandler.java | 46 + .../portalapp/util/CustomLoggingFilter.java | 54 + ecomp-sdk/sdk-app/src/main/resources/att-rules.drl | 16 + ecomp-sdk/sdk-app/src/main/resources/cache.ccf | 30 + ecomp-sdk/sdk-app/src/main/resources/logback.xml | 370 + .../src/main/resources/mchange-log.properties | 23 + .../sdk-app/src/main/resources/portal.properties | 69 + .../sdk-app/src/main/resources/state-rules.drl | 38 + .../src/main/webapp/WEB-INF/conf/quartz.properties | 30 + .../src/main/webapp/WEB-INF/conf/raptor.properties | 187 + .../WEB-INF/conf/raptor_app_fusion.properties | 39 + .../WEB-INF/conf/raptor_db_fusion.properties | 19 + .../main/webapp/WEB-INF/conf/raptor_pdf.properties | 49 + .../src/main/webapp/WEB-INF/conf/sql.properties | 322 + .../src/main/webapp/WEB-INF/conf/system.properties | 86 + .../src/main/webapp/WEB-INF/defs/definitions.xml | 22 + .../webapp/WEB-INF/fusion/conf/fusion.properties | 61 + .../webapp/WEB-INF/fusion/defs/definitions.xml | 240 + .../src/main/webapp/WEB-INF/fusion/jsp/.gitignore | 0 .../main/webapp/WEB-INF/fusion/jsp/broadcast.jsp | 137 + .../webapp/WEB-INF/fusion/jsp/broadcast_list.jsp | 201 + .../webapp/WEB-INF/fusion/jsp/collaborateList.jsp | 146 + .../main/webapp/WEB-INF/fusion/jsp/data_out.jsp | 20 + .../webapp/WEB-INF/fusion/jsp/ebz/ebz_footer.jsp | 46 + .../webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp | 799 + .../WEB-INF/fusion/jsp/ebz/loginSnippet.html | 120 + .../webapp/WEB-INF/fusion/jsp/ebz_template.jsp | 45 + .../fusion/jsp/ebz_template_noheader_nofooter.jsp | 35 + .../fusion/jsp/ebz_template_report_embedded.jsp | 48 + .../webapp/WEB-INF/fusion/jsp/es_search_demo.jsp | 97 + .../webapp/WEB-INF/fusion/jsp/es_suggest_demo.jsp | 97 + .../webapp/WEB-INF/fusion/jsp/frame_insert.jsp | 44 + .../src/main/webapp/WEB-INF/fusion/jsp/include.jsp | 30 + .../main/webapp/WEB-INF/fusion/jsp/jcs_admin.jsp | 144 + .../src/main/webapp/WEB-INF/fusion/jsp/meta.jsp | 36 + .../webapp/WEB-INF/fusion/jsp/popup_modal.html | 324 + .../WEB-INF/fusion/jsp/popup_modal_role.html | 274 + .../fusion/jsp/popup_modal_rolefunction.html | 87 + .../main/webapp/WEB-INF/fusion/jsp/post_search.jsp | 356 + .../src/main/webapp/WEB-INF/fusion/jsp/profile.jsp | 442 + .../webapp/WEB-INF/fusion/jsp/profile_search.jsp | 104 + .../src/main/webapp/WEB-INF/fusion/jsp/role.jsp | 286 + .../WEB-INF/fusion/jsp/role_function_list.jsp | 213 + .../main/webapp/WEB-INF/fusion/jsp/role_list.jsp | 139 + .../main/webapp/WEB-INF/fusion/jsp/usage_list.jsp | 87 + .../WEB-INF/fusion/jsp/webrtc/collaboration.jsp | 492 + .../main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml | 352 + .../fusion/orm/RNoteBookIntegration.hbm.xml | 44 + .../webapp/WEB-INF/fusion/orm/Workflow.hbm.xml | 48 + .../fusion/raptor/custom_header_include.jsp | 135 + .../WEB-INF/fusion/raptor/custom_js_include.jsp | 31 + .../fusion/raptor/date_end_field_run_sql.jsp | 38 + .../fusion/raptor/date_start_field_run_sql.jsp | 39 + .../fusion/raptor/default_field_run_sql.jsp | 39 + .../webapp/WEB-INF/fusion/raptor/disclaimer.jsp | 38 + .../webapp/WEB-INF/fusion/raptor/error_include.jsp | 58 + .../webapp/WEB-INF/fusion/raptor/error_page.jsp | 229 + .../main/webapp/WEB-INF/fusion/raptor/footer.jsp | 25 + .../fusion/raptor/popup_drill_down_report.jsp | 601 + .../fusion/raptor/popup_import_semaphore.jsp | 80 + .../WEB-INF/fusion/raptor/popup_semaphore.jsp | 419 + .../webapp/WEB-INF/fusion/raptor/popup_sql.jsp | 55 + .../WEB-INF/fusion/raptor/popup_table_cols.jsp | 171 + .../WEB-INF/fusion/raptor/popup_testrun_sql.jsp | 103 + .../WEB-INF/fusion/raptor/report_download_csv.jsp | 89 + .../WEB-INF/fusion/raptor/report_download_pdf.jsp | 40 + .../WEB-INF/fusion/raptor/report_download_xls.jsp | 64 + .../webapp/WEB-INF/fusion/raptor/report_ebz.jsp | 179 + .../webapp/WEB-INF/fusion/raptor/report_import.jsp | 69 + .../webapp/WEB-INF/fusion/raptor/report_sample.jsp | 40 + .../webapp/WEB-INF/fusion/raptor/report_search.jsp | 2432 ++ .../webapp/WEB-INF/fusion/raptor/report_wizard.jsp | 309 + .../WEB-INF/fusion/raptor/test_field_run_sql.jsp | 39 + .../webapp/WEB-INF/fusion/raptor/test_run_sql.jsp | 38 + .../fusion/raptor/wizard_adhoc_schedule.jsp | 733 + .../webapp/WEB-INF/fusion/raptor/wizard_chart.jsp | 1335 + .../fusion/raptor/wizard_columns_add_multi.jsp | 96 + .../WEB-INF/fusion/raptor/wizard_columns_edit.jsp | 1127 + .../WEB-INF/fusion/raptor/wizard_columns_list.jsp | 157 + .../fusion/raptor/wizard_columns_order_all.jsp | 88 + .../fusion/raptor/wizard_data_forecasting.jsp | 184 + .../WEB-INF/fusion/raptor/wizard_definition.jsp | 1122 + .../WEB-INF/fusion/raptor/wizard_filters_edit.jsp | 320 + .../WEB-INF/fusion/raptor/wizard_filters_list.jsp | 115 + .../fusion/raptor/wizard_form_fields_edit.jsp | 771 + .../fusion/raptor/wizard_form_fields_list.jsp | 107 + .../WEB-INF/fusion/raptor/wizard_javascript.jsp | 167 + .../webapp/WEB-INF/fusion/raptor/wizard_log.jsp | 109 + .../webapp/WEB-INF/fusion/raptor/wizard_map.jsp | 424 + .../webapp/WEB-INF/fusion/raptor/wizard_run.jsp | 74 + .../WEB-INF/fusion/raptor/wizard_schedule.jsp | 376 + .../raptor/wizard_schedule_formfield_include.jsp | 754 + .../fusion/raptor/wizard_schedule_multiple.jsp | 157 + .../WEB-INF/fusion/raptor/wizard_schedule_only.jsp | 172 + .../raptor/wizard_schedule_only_from_search.jsp | 173 + .../WEB-INF/fusion/raptor/wizard_sorting_edit.jsp | 86 + .../WEB-INF/fusion/raptor/wizard_sorting_list.jsp | 116 + .../fusion/raptor/wizard_sorting_order_all.jsp | 112 + .../WEB-INF/fusion/raptor/wizard_sql_def.jsp | 226 + .../WEB-INF/fusion/raptor/wizard_tables_edit.jsp | 369 + .../WEB-INF/fusion/raptor/wizard_tables_list.jsp | 85 + .../WEB-INF/fusion/raptor/wizard_user_access.jsp | 184 + .../sdk-app/src/main/webapp/WEB-INF/jsp/error.jsp | 20 + .../src/main/webapp/WEB-INF/jsp/leafletMap.jsp | 288 + .../src/main/webapp/WEB-INF/jsp/login_external.jsp | 154 + .../src/main/webapp/WEB-INF/jsp/net_map.jsp | 38 + .../src/main/webapp/WEB-INF/jsp/user_profile.jsp | 84 + .../src/main/webapp/WEB-INF/jsp/welcome.jsp | 630 + ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/web.xml | 17 + .../fusion/external/angular-1.5/angular-animate.js | 4121 ++ .../external/angular-1.5/angular-animate.min.js | 56 + .../angular-1.5/angular-animate.min.js.map | 8 + .../fusion/external/angular-1.5/angular-aria.js | 398 + .../external/angular-1.5/angular-aria.min.js | 14 + .../external/angular-1.5/angular-aria.min.js.map | 8 + .../fusion/external/angular-1.5/angular-cookies.js | 322 + .../external/angular-1.5/angular-cookies.min.js | 9 + .../angular-1.5/angular-cookies.min.js.map | 8 + .../fusion/external/angular-1.5/angular-csp.css | 20 + .../fusion/external/angular-1.5/angular-loader.js | 484 + .../external/angular-1.5/angular-loader.min.js | 10 + .../external/angular-1.5/angular-loader.min.js.map | 8 + .../external/angular-1.5/angular-message-format.js | 980 + .../angular-1.5/angular-message-format.min.js | 26 + .../angular-1.5/angular-message-format.min.js.map | 8 + .../external/angular-1.5/angular-messages.js | 687 + .../external/angular-1.5/angular-messages.min.js | 12 + .../angular-1.5/angular-messages.min.js.map | 8 + .../fusion/external/angular-1.5/angular-mocks.js | 2842 ++ .../external/angular-1.5/angular-resource.js | 768 + .../external/angular-1.5/angular-resource.min.js | 15 + .../angular-1.5/angular-resource.min.js.map | 8 + .../fusion/external/angular-1.5/angular-route.js | 1016 + .../external/angular-1.5/angular-route.min.js | 15 + .../external/angular-1.5/angular-route.min.js.map | 8 + .../external/angular-1.5/angular-sanitize.js | 717 + .../external/angular-1.5/angular-sanitize.min.js | 15 + .../angular-1.5/angular-sanitize.min.js.map | 8 + .../external/angular-1.5/angular-scenario.js | 41849 +++++++++++++++++++ .../fusion/external/angular-1.5/angular-touch.js | 729 + .../external/angular-1.5/angular-touch.min.js | 14 + .../external/angular-1.5/angular-touch.min.js.map | 8 + .../app/fusion/external/angular-1.5/angular.js | 30428 ++++++++++++++ .../app/fusion/external/angular-1.5/angular.min.js | 307 + .../fusion/external/angular-1.5/angular.min.js.map | 8 + .../app/fusion/external/angular-1.5/errors.json | 1 + .../app/fusion/external/angular-1.5/version.json | 1 + .../app/fusion/external/angular-1.5/version.txt | 1 + .../angular-ui/ui-bootstrap-tpls-1.1.2.min.js | 10 + .../angular-ui/ui-bootstrap-tpls-1.2.4.min.js | 10 + .../webapp/app/fusion/external/bootstrap/bs.css | 678 + .../webapp/app/fusion/external/d3/css/nv.d3.css | 656 + .../main/webapp/app/fusion/external/d3/js/cie.js | 155 + .../app/fusion/external/d3/js/colorbrewer.js | 302 + .../main/webapp/app/fusion/external/d3/js/core.js | 122 + .../app/fusion/external/d3/js/crossfilter.js | 1180 + .../app/fusion/external/d3/js/crossfilter.min.js | 1 + .../webapp/app/fusion/external/d3/js/d3.geom.js | 816 + .../main/webapp/app/fusion/external/d3/js/d3.js | 5 + .../app/fusion/external/d3/js/d3.layout.cloud.js | 433 + .../webapp/app/fusion/external/d3/js/d3.layout.js | 908 + .../main/webapp/app/fusion/external/d3/js/d3.v2.js | 7037 ++++ .../webapp/app/fusion/external/d3/js/d3.v2.min.js | 4 + .../webapp/app/fusion/external/d3/js/d3.v3.min.js | 1 + .../webapp/app/fusion/external/d3/js/fisheye.js | 86 + .../main/webapp/app/fusion/external/d3/js/hive.js | 80 + .../webapp/app/fusion/external/d3/js/horizon.js | 192 + .../app/fusion/external/d3/js/interactiveLayer.js | 251 + .../main/webapp/app/fusion/external/d3/js/intro.js | 1 + .../app/fusion/external/d3/js/models/axis-min.js | 1 + .../app/fusion/external/d3/js/models/axis.js | 470 + .../app/fusion/external/d3/js/models/axis.min.js | 1 + .../fusion/external/d3/js/models/backup/bullet.js | 250 + .../external/d3/js/models/backup/bulletChart.js | 349 + .../fusion/external/d3/js/models/boilerplate.js | 104 + .../app/fusion/external/d3/js/models/bullet.js | 385 + .../fusion/external/d3/js/models/bulletChart.js | 343 + .../external/d3/js/models/cumulativeLineChart.js | 782 + .../fusion/external/d3/js/models/discreteBar.js | 349 + .../external/d3/js/models/discreteBarChart.js | 333 + .../fusion/external/d3/js/models/distribution.js | 148 + .../fusion/external/d3/js/models/historicalBar.js | 331 + .../external/d3/js/models/historicalBarChart.js | 419 + .../fusion/external/d3/js/models/indentedTree.js | 337 + .../app/fusion/external/d3/js/models/legend.js | 270 + .../app/fusion/external/d3/js/models/line.js | 284 + .../app/fusion/external/d3/js/models/lineChart.js | 465 + .../external/d3/js/models/linePlusBarChart.js | 433 + .../d3/js/models/linePlusBarWithFocusChart.js | 658 + .../external/d3/js/models/lineWithFisheye.js | 200 + .../external/d3/js/models/lineWithFisheyeChart.js | 297 + .../external/d3/js/models/lineWithFocusChart.js | 574 + .../app/fusion/external/d3/js/models/multiBar.js | 461 + .../fusion/external/d3/js/models/multiBarChart.js | 524 + .../external/d3/js/models/multiBarHorizontal.js | 424 + .../d3/js/models/multiBarHorizontalChart.js | 434 + .../external/d3/js/models/multiBarTimeSeries.js | 384 + .../d3/js/models/multiBarTimeSeriesChart.js | 405 + .../app/fusion/external/d3/js/models/multiChart.js | 452 + .../app/fusion/external/d3/js/models/ohlcBar.js | 380 + .../external/d3/js/models/parallelCoordinates.js | 239 + .../webapp/app/fusion/external/d3/js/models/pie.js | 400 + .../app/fusion/external/d3/js/models/pieChart.js | 292 + .../app/fusion/external/d3/js/models/scatter.js | 674 + .../fusion/external/d3/js/models/scatterChart.js | 628 + .../external/d3/js/models/scatterPlusLineChart.js | 620 + .../app/fusion/external/d3/js/models/sparkline.js | 194 + .../fusion/external/d3/js/models/sparklinePlus.js | 295 + .../fusion/external/d3/js/models/stackedArea.js | 368 + .../external/d3/js/models/stackedAreaChart.js | 629 + .../main/webapp/app/fusion/external/d3/js/nv.d3.js | 13097 ++++++ .../webapp/app/fusion/external/d3/js/nv.d3.min.js | 1 + .../main/webapp/app/fusion/external/d3/js/outro.js | 1 + .../webapp/app/fusion/external/d3/js/sankey.js | 292 + .../webapp/app/fusion/external/d3/js/tooltip.js | 490 + .../main/webapp/app/fusion/external/d3/js/utils.js | 152 + .../external/ebz/angular_js/angular-animate.js | 3721 ++ .../external/ebz/angular_js/angular-cookies.js | 206 + .../external/ebz/angular_js/angular-route.js | 911 + .../external/ebz/angular_js/angular-route.min.js | 14 + .../external/ebz/angular_js/angular-sanitize.js | 647 + .../external/ebz/angular_js/angular-touch.js | 628 + .../app/fusion/external/ebz/angular_js/angular.js | 22024 ++++++++++ .../app/fusion/external/ebz/angular_js/app.js | 6 + .../external/ebz/angular_js/checklist-model.js | 99 + .../external/ebz/angular_js/checklist-model.min.js | 1 + .../app/fusion/external/ebz/angular_js/gestures.js | 1495 + .../app/fusion/external/ebz/angular_js/ng_base.js | 4 + .../external/ebz/angular_js/ui-charts-tpls.js | 3909 ++ .../app/fusion/external/ebz/ebz_header/footer.css | 311 + .../app/fusion/external/ebz/ebz_header/header.css | 1866 + .../external/ebz/ebz_header/portal_ebz_header.css | 63 + .../main/webapp/app/fusion/external/ebz/fn-ebz.css | 1614 + .../external/ebz/images/no_favorites_star.png | Bin 0 -> 2794 bytes .../app/fusion/external/ebz/js/attHeaderSnippet.js | 210 + .../webapp/app/fusion/external/ebz/js/footer.js | 110 + .../fusion/external/ebz/sandbox/att-abs-tpls.js | 20451 +++++++++ .../external/ebz/sandbox/att-abs-tpls.min.js | 22 + .../fusion/external/ebz/sandbox/styles/base.css | 1 + .../app/fusion/external/ebz/sandbox/styles/btn.css | 1 + .../fusion/external/ebz/sandbox/styles/demo.css | 2 + .../fusion/external/ebz/sandbox/styles/dtpk.css | 9 + .../fusion/external/ebz/sandbox/styles/frms.css | 1 + .../ebz/sandbox/styles/ie/backgroundsize.min.htc | 12 + .../ebz/sandbox/styles/images/upanddown.png | Bin 0 -> 1033 bytes .../ebz/sandbox/styles/pages/iconography.css | 2 + .../fusion/external/ebz/sandbox/styles/sldr.css | 1 + .../fusion/external/ebz/sandbox/styles/style.css | 1 + .../app/fusion/external/ebz/sandbox/styles/tbs.css | 1 + .../app/fusion/external/ionicons-2.0.1/.gitignore | 4 + .../app/fusion/external/ionicons-2.0.1/LICENSE | 21 + .../app/fusion/external/ionicons-2.0.1/bower.json | 31 + .../fusion/external/ionicons-2.0.1/component.json | 19 + .../fusion/external/ionicons-2.0.1/composer.json | 36 + .../external/ionicons-2.0.1/css/ionicons.css | 1480 + .../external/ionicons-2.0.1/css/ionicons.min.css | 11 + .../external/ionicons-2.0.1/fonts/ionicons.eot | Bin 0 -> 120724 bytes .../external/ionicons-2.0.1/fonts/ionicons.svg | 2230 + .../external/ionicons-2.0.1/fonts/ionicons.ttf | Bin 0 -> 188508 bytes .../external/ionicons-2.0.1/fonts/ionicons.woff | Bin 0 -> 67904 bytes .../ionicons-2.0.1/less/_ionicons-font.less | 27 + .../ionicons-2.0.1/less/_ionicons-icons.less | 1473 + .../ionicons-2.0.1/less/_ionicons-variables.less | 747 + .../external/ionicons-2.0.1/less/ionicons.less | 3 + .../ionicons-2.0.1/png/512/alert-circled.png | Bin 0 -> 2551 bytes .../external/ionicons-2.0.1/png/512/alert.png | Bin 0 -> 766 bytes .../ionicons-2.0.1/png/512/android-add-contact.png | Bin 0 -> 3279 bytes .../ionicons-2.0.1/png/512/android-add.png | Bin 0 -> 240 bytes .../ionicons-2.0.1/png/512/android-alarm.png | Bin 0 -> 6428 bytes .../ionicons-2.0.1/png/512/android-archive.png | Bin 0 -> 1628 bytes .../ionicons-2.0.1/png/512/android-arrow-back.png | Bin 0 -> 1218 bytes .../png/512/android-arrow-down-left.png | Bin 0 -> 1451 bytes .../png/512/android-arrow-down-right.png | Bin 0 -> 1462 bytes .../png/512/android-arrow-forward.png | Bin 0 -> 1191 bytes .../png/512/android-arrow-up-left.png | Bin 0 -> 1499 bytes .../png/512/android-arrow-up-right.png | Bin 0 -> 1482 bytes .../ionicons-2.0.1/png/512/android-battery.png | Bin 0 -> 238 bytes .../ionicons-2.0.1/png/512/android-book.png | Bin 0 -> 3746 bytes .../ionicons-2.0.1/png/512/android-calendar.png | Bin 0 -> 849 bytes .../ionicons-2.0.1/png/512/android-call.png | Bin 0 -> 4766 bytes .../ionicons-2.0.1/png/512/android-camera.png | Bin 0 -> 3871 bytes .../ionicons-2.0.1/png/512/android-chat.png | Bin 0 -> 3577 bytes .../ionicons-2.0.1/png/512/android-checkmark.png | Bin 0 -> 1846 bytes .../ionicons-2.0.1/png/512/android-clock.png | Bin 0 -> 5268 bytes .../ionicons-2.0.1/png/512/android-close.png | Bin 0 -> 2156 bytes .../ionicons-2.0.1/png/512/android-contact.png | Bin 0 -> 3658 bytes .../ionicons-2.0.1/png/512/android-contacts.png | Bin 0 -> 4299 bytes .../ionicons-2.0.1/png/512/android-data.png | Bin 0 -> 4808 bytes .../ionicons-2.0.1/png/512/android-developer.png | Bin 0 -> 4115 bytes .../ionicons-2.0.1/png/512/android-display.png | Bin 0 -> 4909 bytes .../ionicons-2.0.1/png/512/android-download.png | Bin 0 -> 4890 bytes .../ionicons-2.0.1/png/512/android-drawer.png | Bin 0 -> 190 bytes .../ionicons-2.0.1/png/512/android-dropdown.png | Bin 0 -> 777 bytes .../ionicons-2.0.1/png/512/android-earth.png | Bin 0 -> 6517 bytes .../ionicons-2.0.1/png/512/android-folder.png | Bin 0 -> 1688 bytes .../ionicons-2.0.1/png/512/android-forums.png | Bin 0 -> 1739 bytes .../ionicons-2.0.1/png/512/android-friends.png | Bin 0 -> 4868 bytes .../ionicons-2.0.1/png/512/android-hand.png | Bin 0 -> 4650 bytes .../ionicons-2.0.1/png/512/android-image.png | Bin 0 -> 1433 bytes .../ionicons-2.0.1/png/512/android-inbox.png | Bin 0 -> 3018 bytes .../ionicons-2.0.1/png/512/android-information.png | Bin 0 -> 3370 bytes .../ionicons-2.0.1/png/512/android-keypad.png | Bin 0 -> 1055 bytes .../ionicons-2.0.1/png/512/android-lightbulb.png | Bin 0 -> 3515 bytes .../ionicons-2.0.1/png/512/android-locate.png | Bin 0 -> 5003 bytes .../ionicons-2.0.1/png/512/android-location.png | Bin 0 -> 3067 bytes .../ionicons-2.0.1/png/512/android-mail.png | Bin 0 -> 3455 bytes .../ionicons-2.0.1/png/512/android-microphone.png | Bin 0 -> 3267 bytes .../ionicons-2.0.1/png/512/android-mixer.png | Bin 0 -> 2727 bytes .../ionicons-2.0.1/png/512/android-more.png | Bin 0 -> 224 bytes .../ionicons-2.0.1/png/512/android-note.png | Bin 0 -> 249 bytes .../ionicons-2.0.1/png/512/android-playstore.png | Bin 0 -> 3165 bytes .../ionicons-2.0.1/png/512/android-printer.png | Bin 0 -> 1721 bytes .../ionicons-2.0.1/png/512/android-promotion.png | Bin 0 -> 2374 bytes .../ionicons-2.0.1/png/512/android-reminder.png | Bin 0 -> 2890 bytes .../ionicons-2.0.1/png/512/android-remove.png | Bin 0 -> 160 bytes .../ionicons-2.0.1/png/512/android-search.png | Bin 0 -> 4232 bytes .../ionicons-2.0.1/png/512/android-send.png | Bin 0 -> 2079 bytes .../ionicons-2.0.1/png/512/android-settings.png | Bin 0 -> 3883 bytes .../ionicons-2.0.1/png/512/android-share.png | Bin 0 -> 3212 bytes .../ionicons-2.0.1/png/512/android-social-user.png | Bin 0 -> 3644 bytes .../ionicons-2.0.1/png/512/android-social.png | Bin 0 -> 3849 bytes .../ionicons-2.0.1/png/512/android-sort.png | Bin 0 -> 197 bytes .../png/512/android-stair-drawer.png | Bin 0 -> 209 bytes .../ionicons-2.0.1/png/512/android-star.png | Bin 0 -> 2926 bytes .../ionicons-2.0.1/png/512/android-stopwatch.png | Bin 0 -> 5225 bytes .../ionicons-2.0.1/png/512/android-storage.png | Bin 0 -> 233 bytes .../ionicons-2.0.1/png/512/android-system-back.png | Bin 0 -> 1796 bytes .../ionicons-2.0.1/png/512/android-system-home.png | Bin 0 -> 1107 bytes .../png/512/android-system-windows.png | Bin 0 -> 202 bytes .../ionicons-2.0.1/png/512/android-timer.png | Bin 0 -> 3904 bytes .../ionicons-2.0.1/png/512/android-trash.png | Bin 0 -> 2865 bytes .../ionicons-2.0.1/png/512/android-user-menu.png | Bin 0 -> 3568 bytes .../ionicons-2.0.1/png/512/android-volume.png | Bin 0 -> 6022 bytes .../ionicons-2.0.1/png/512/android-wifi.png | Bin 0 -> 4868 bytes .../external/ionicons-2.0.1/png/512/aperture.png | Bin 0 -> 9500 bytes .../external/ionicons-2.0.1/png/512/archive.png | Bin 0 -> 2445 bytes .../ionicons-2.0.1/png/512/arrow-down-a.png | Bin 0 -> 1173 bytes .../ionicons-2.0.1/png/512/arrow-down-b.png | Bin 0 -> 1307 bytes .../ionicons-2.0.1/png/512/arrow-down-c.png | Bin 0 -> 1966 bytes .../ionicons-2.0.1/png/512/arrow-expand.png | Bin 0 -> 2498 bytes .../png/512/arrow-graph-down-left.png | Bin 0 -> 2478 bytes .../png/512/arrow-graph-down-right.png | Bin 0 -> 2545 bytes .../ionicons-2.0.1/png/512/arrow-graph-up-left.png | Bin 0 -> 2440 bytes .../png/512/arrow-graph-up-right.png | Bin 0 -> 2440 bytes .../ionicons-2.0.1/png/512/arrow-left-a.png | Bin 0 -> 1260 bytes .../ionicons-2.0.1/png/512/arrow-left-b.png | Bin 0 -> 1608 bytes .../ionicons-2.0.1/png/512/arrow-left-c.png | Bin 0 -> 1662 bytes .../external/ionicons-2.0.1/png/512/arrow-move.png | Bin 0 -> 1948 bytes .../ionicons-2.0.1/png/512/arrow-resize.png | Bin 0 -> 1266 bytes .../ionicons-2.0.1/png/512/arrow-return-left.png | Bin 0 -> 1082 bytes .../ionicons-2.0.1/png/512/arrow-return-right.png | Bin 0 -> 1124 bytes .../ionicons-2.0.1/png/512/arrow-right-a.png | Bin 0 -> 1317 bytes .../ionicons-2.0.1/png/512/arrow-right-b.png | Bin 0 -> 1671 bytes .../ionicons-2.0.1/png/512/arrow-right-c.png | Bin 0 -> 1657 bytes .../ionicons-2.0.1/png/512/arrow-shrink.png | Bin 0 -> 2594 bytes .../external/ionicons-2.0.1/png/512/arrow-swap.png | Bin 0 -> 1521 bytes .../external/ionicons-2.0.1/png/512/arrow-up-a.png | Bin 0 -> 1115 bytes .../external/ionicons-2.0.1/png/512/arrow-up-b.png | Bin 0 -> 1343 bytes .../external/ionicons-2.0.1/png/512/arrow-up-c.png | Bin 0 -> 2002 bytes .../external/ionicons-2.0.1/png/512/asterisk.png | Bin 0 -> 4023 bytes .../fusion/external/ionicons-2.0.1/png/512/at.png | Bin 0 -> 5852 bytes .../fusion/external/ionicons-2.0.1/png/512/bag.png | Bin 0 -> 3665 bytes .../ionicons-2.0.1/png/512/battery-charging.png | Bin 0 -> 1897 bytes .../ionicons-2.0.1/png/512/battery-empty.png | Bin 0 -> 1019 bytes .../ionicons-2.0.1/png/512/battery-full.png | Bin 0 -> 982 bytes .../ionicons-2.0.1/png/512/battery-half.png | Bin 0 -> 1320 bytes .../ionicons-2.0.1/png/512/battery-low.png | Bin 0 -> 1342 bytes .../external/ionicons-2.0.1/png/512/beaker.png | Bin 0 -> 3931 bytes .../external/ionicons-2.0.1/png/512/beer.png | Bin 0 -> 4559 bytes .../external/ionicons-2.0.1/png/512/bluetooth.png | Bin 0 -> 2909 bytes .../external/ionicons-2.0.1/png/512/bonfire.png | Bin 0 -> 4852 bytes .../external/ionicons-2.0.1/png/512/bookmark.png | Bin 0 -> 1102 bytes .../external/ionicons-2.0.1/png/512/briefcase.png | Bin 0 -> 1475 bytes .../fusion/external/ionicons-2.0.1/png/512/bug.png | Bin 0 -> 4736 bytes .../external/ionicons-2.0.1/png/512/calculator.png | Bin 0 -> 1315 bytes .../external/ionicons-2.0.1/png/512/calendar.png | Bin 0 -> 2577 bytes .../external/ionicons-2.0.1/png/512/camera.png | Bin 0 -> 4190 bytes .../external/ionicons-2.0.1/png/512/card.png | Bin 0 -> 1494 bytes .../external/ionicons-2.0.1/png/512/cash.png | Bin 0 -> 3435 bytes .../ionicons-2.0.1/png/512/chatbox-working.png | Bin 0 -> 2301 bytes .../external/ionicons-2.0.1/png/512/chatbox.png | Bin 0 -> 1870 bytes .../external/ionicons-2.0.1/png/512/chatboxes.png | Bin 0 -> 2562 bytes .../ionicons-2.0.1/png/512/chatbubble-working.png | Bin 0 -> 3028 bytes .../external/ionicons-2.0.1/png/512/chatbubble.png | Bin 0 -> 2579 bytes .../ionicons-2.0.1/png/512/chatbubbles.png | Bin 0 -> 3751 bytes .../ionicons-2.0.1/png/512/checkmark-circled.png | Bin 0 -> 3687 bytes .../ionicons-2.0.1/png/512/checkmark-round.png | Bin 0 -> 2367 bytes .../external/ionicons-2.0.1/png/512/checkmark.png | Bin 0 -> 2134 bytes .../ionicons-2.0.1/png/512/chevron-down.png | Bin 0 -> 1689 bytes .../ionicons-2.0.1/png/512/chevron-left.png | Bin 0 -> 1769 bytes .../ionicons-2.0.1/png/512/chevron-right.png | Bin 0 -> 1831 bytes .../external/ionicons-2.0.1/png/512/chevron-up.png | Bin 0 -> 1677 bytes .../external/ionicons-2.0.1/png/512/clipboard.png | Bin 0 -> 2593 bytes .../external/ionicons-2.0.1/png/512/clock.png | Bin 0 -> 5866 bytes .../ionicons-2.0.1/png/512/close-circled.png | Bin 0 -> 3809 bytes .../ionicons-2.0.1/png/512/close-round.png | Bin 0 -> 2177 bytes .../external/ionicons-2.0.1/png/512/close.png | Bin 0 -> 2244 bytes .../ionicons-2.0.1/png/512/closed-captioning.png | Bin 0 -> 3665 bytes .../external/ionicons-2.0.1/png/512/cloud.png | Bin 0 -> 2067 bytes .../ionicons-2.0.1/png/512/code-download.png | Bin 0 -> 2423 bytes .../ionicons-2.0.1/png/512/code-working.png | Bin 0 -> 2433 bytes .../external/ionicons-2.0.1/png/512/code.png | Bin 0 -> 1720 bytes .../external/ionicons-2.0.1/png/512/coffee.png | Bin 0 -> 3205 bytes .../external/ionicons-2.0.1/png/512/compass.png | Bin 0 -> 7318 bytes .../external/ionicons-2.0.1/png/512/compose.png | Bin 0 -> 4296 bytes .../ionicons-2.0.1/png/512/connection-bars.png | Bin 0 -> 214 bytes .../external/ionicons-2.0.1/png/512/contrast.png | Bin 0 -> 4087 bytes .../external/ionicons-2.0.1/png/512/cube.png | Bin 0 -> 3265 bytes .../external/ionicons-2.0.1/png/512/disc.png | Bin 0 -> 4935 bytes .../ionicons-2.0.1/png/512/document-text.png | Bin 0 -> 1918 bytes .../external/ionicons-2.0.1/png/512/document.png | Bin 0 -> 1914 bytes .../external/ionicons-2.0.1/png/512/drag.png | Bin 0 -> 178 bytes .../external/ionicons-2.0.1/png/512/earth.png | Bin 0 -> 6476 bytes .../external/ionicons-2.0.1/png/512/edit.png | Bin 0 -> 2741 bytes .../fusion/external/ionicons-2.0.1/png/512/egg.png | Bin 0 -> 4234 bytes .../external/ionicons-2.0.1/png/512/eject.png | Bin 0 -> 3209 bytes .../external/ionicons-2.0.1/png/512/email.png | Bin 0 -> 3125 bytes .../ionicons-2.0.1/png/512/eye-disabled.png | Bin 0 -> 3558 bytes .../fusion/external/ionicons-2.0.1/png/512/eye.png | Bin 0 -> 3297 bytes .../external/ionicons-2.0.1/png/512/female.png | Bin 0 -> 2779 bytes .../external/ionicons-2.0.1/png/512/filing.png | Bin 0 -> 2349 bytes .../ionicons-2.0.1/png/512/film-marker.png | Bin 0 -> 2645 bytes .../external/ionicons-2.0.1/png/512/fireball.png | Bin 0 -> 3325 bytes .../external/ionicons-2.0.1/png/512/flag.png | Bin 0 -> 2337 bytes .../external/ionicons-2.0.1/png/512/flame.png | Bin 0 -> 3012 bytes .../external/ionicons-2.0.1/png/512/flash-off.png | Bin 0 -> 5437 bytes .../external/ionicons-2.0.1/png/512/flash.png | Bin 0 -> 1965 bytes .../external/ionicons-2.0.1/png/512/flask.png | Bin 0 -> 2939 bytes .../external/ionicons-2.0.1/png/512/folder.png | Bin 0 -> 1689 bytes .../external/ionicons-2.0.1/png/512/fork-repo.png | Bin 0 -> 3236 bytes .../external/ionicons-2.0.1/png/512/fork.png | Bin 0 -> 3007 bytes .../external/ionicons-2.0.1/png/512/forward.png | Bin 0 -> 2142 bytes .../external/ionicons-2.0.1/png/512/funnel.png | Bin 0 -> 3354 bytes .../ionicons-2.0.1/png/512/game-controller-a.png | Bin 0 -> 2548 bytes .../ionicons-2.0.1/png/512/game-controller-b.png | Bin 0 -> 3623 bytes .../external/ionicons-2.0.1/png/512/gear-a.png | Bin 0 -> 3806 bytes .../external/ionicons-2.0.1/png/512/gear-b.png | Bin 0 -> 2756 bytes .../external/ionicons-2.0.1/png/512/grid.png | Bin 0 -> 1066 bytes .../external/ionicons-2.0.1/png/512/hammer.png | Bin 0 -> 2493 bytes .../external/ionicons-2.0.1/png/512/happy.png | Bin 0 -> 5732 bytes .../external/ionicons-2.0.1/png/512/headphone.png | Bin 0 -> 4082 bytes .../ionicons-2.0.1/png/512/heart-broken.png | Bin 0 -> 4007 bytes .../external/ionicons-2.0.1/png/512/heart.png | Bin 0 -> 2322 bytes .../external/ionicons-2.0.1/png/512/help-buoy.png | Bin 0 -> 5824 bytes .../ionicons-2.0.1/png/512/help-circled.png | Bin 0 -> 3940 bytes .../external/ionicons-2.0.1/png/512/help.png | Bin 0 -> 2678 bytes .../external/ionicons-2.0.1/png/512/home.png | Bin 0 -> 1275 bytes .../external/ionicons-2.0.1/png/512/icecream.png | Bin 0 -> 2317 bytes .../png/512/icon-social-google-plus-outline.png | Bin 0 -> 4071 bytes .../png/512/icon-social-google-plus.png | Bin 0 -> 3888 bytes .../external/ionicons-2.0.1/png/512/image.png | Bin 0 -> 2952 bytes .../external/ionicons-2.0.1/png/512/images.png | Bin 0 -> 5073 bytes .../ionicons-2.0.1/png/512/information-circled.png | Bin 0 -> 3300 bytes .../ionicons-2.0.1/png/512/information.png | Bin 0 -> 2236 bytes .../external/ionicons-2.0.1/png/512/ionic.png | Bin 0 -> 5541 bytes .../ionicons-2.0.1/png/512/ios7-alarm-outline.png | Bin 0 -> 5769 bytes .../external/ionicons-2.0.1/png/512/ios7-alarm.png | Bin 0 -> 3922 bytes .../ionicons-2.0.1/png/512/ios7-albums-outline.png | Bin 0 -> 231 bytes .../ionicons-2.0.1/png/512/ios7-albums.png | Bin 0 -> 226 bytes .../png/512/ios7-americanfootball-outline.png | Bin 0 -> 5767 bytes .../png/512/ios7-americanfootball.png | Bin 0 -> 5675 bytes .../png/512/ios7-analytics-outline.png | Bin 0 -> 5847 bytes .../ionicons-2.0.1/png/512/ios7-analytics.png | Bin 0 -> 4406 bytes .../ionicons-2.0.1/png/512/ios7-arrow-back.png | Bin 0 -> 881 bytes .../ionicons-2.0.1/png/512/ios7-arrow-down.png | Bin 0 -> 1451 bytes .../ionicons-2.0.1/png/512/ios7-arrow-forward.png | Bin 0 -> 898 bytes .../ionicons-2.0.1/png/512/ios7-arrow-left.png | Bin 0 -> 1550 bytes .../ionicons-2.0.1/png/512/ios7-arrow-right.png | Bin 0 -> 1537 bytes .../png/512/ios7-arrow-thin-down.png | Bin 0 -> 1632 bytes .../png/512/ios7-arrow-thin-left.png | Bin 0 -> 1258 bytes .../png/512/ios7-arrow-thin-right.png | Bin 0 -> 1235 bytes .../ionicons-2.0.1/png/512/ios7-arrow-thin-up.png | Bin 0 -> 1647 bytes .../ionicons-2.0.1/png/512/ios7-arrow-up.png | Bin 0 -> 1482 bytes .../ionicons-2.0.1/png/512/ios7-at-outline.png | Bin 0 -> 4303 bytes .../external/ionicons-2.0.1/png/512/ios7-at.png | Bin 0 -> 4153 bytes .../png/512/ios7-barcode-outline.png | Bin 0 -> 233 bytes .../ionicons-2.0.1/png/512/ios7-barcode.png | Bin 0 -> 219 bytes .../png/512/ios7-baseball-outline.png | Bin 0 -> 6676 bytes .../ionicons-2.0.1/png/512/ios7-baseball.png | Bin 0 -> 5565 bytes .../png/512/ios7-basketball-outline.png | Bin 0 -> 6200 bytes .../ionicons-2.0.1/png/512/ios7-basketball.png | Bin 0 -> 6525 bytes .../ionicons-2.0.1/png/512/ios7-bell-outline.png | Bin 0 -> 3615 bytes .../external/ionicons-2.0.1/png/512/ios7-bell.png | Bin 0 -> 2769 bytes .../ionicons-2.0.1/png/512/ios7-bolt-outline.png | Bin 0 -> 2384 bytes .../external/ionicons-2.0.1/png/512/ios7-bolt.png | Bin 0 -> 1892 bytes .../png/512/ios7-bookmarks-outline.png | Bin 0 -> 2454 bytes .../ionicons-2.0.1/png/512/ios7-bookmarks.png | Bin 0 -> 2172 bytes .../ionicons-2.0.1/png/512/ios7-box-outline.png | Bin 0 -> 1602 bytes .../external/ionicons-2.0.1/png/512/ios7-box.png | Bin 0 -> 1032 bytes .../png/512/ios7-briefcase-outline.png | Bin 0 -> 1359 bytes .../ionicons-2.0.1/png/512/ios7-briefcase.png | Bin 0 -> 1316 bytes .../png/512/ios7-browsers-outline.png | Bin 0 -> 372 bytes .../ionicons-2.0.1/png/512/ios7-browsers.png | Bin 0 -> 357 bytes .../png/512/ios7-calculator-outline.png | Bin 0 -> 1785 bytes .../ionicons-2.0.1/png/512/ios7-calculator.png | Bin 0 -> 1500 bytes .../png/512/ios7-calendar-outline.png | Bin 0 -> 236 bytes .../ionicons-2.0.1/png/512/ios7-calendar.png | Bin 0 -> 230 bytes .../ionicons-2.0.1/png/512/ios7-camera-outline.png | Bin 0 -> 3582 bytes .../ionicons-2.0.1/png/512/ios7-camera.png | Bin 0 -> 3099 bytes .../ionicons-2.0.1/png/512/ios7-cart-outline.png | Bin 0 -> 2861 bytes .../external/ionicons-2.0.1/png/512/ios7-cart.png | Bin 0 -> 2200 bytes .../png/512/ios7-chatboxes-outline.png | Bin 0 -> 901 bytes .../ionicons-2.0.1/png/512/ios7-chatboxes.png | Bin 0 -> 512 bytes .../png/512/ios7-chatbubble-outline.png | Bin 0 -> 3640 bytes .../ionicons-2.0.1/png/512/ios7-chatbubble.png | Bin 0 -> 2259 bytes .../png/512/ios7-checkmark-empty.png | Bin 0 -> 920 bytes .../png/512/ios7-checkmark-outline.png | Bin 0 -> 4706 bytes .../ionicons-2.0.1/png/512/ios7-checkmark.png | Bin 0 -> 3080 bytes .../ionicons-2.0.1/png/512/ios7-circle-filled.png | Bin 0 -> 6478 bytes .../ionicons-2.0.1/png/512/ios7-circle-outline.png | Bin 0 -> 4120 bytes .../ionicons-2.0.1/png/512/ios7-clock-outline.png | Bin 0 -> 4320 bytes .../external/ionicons-2.0.1/png/512/ios7-clock.png | Bin 0 -> 2762 bytes .../ionicons-2.0.1/png/512/ios7-close-empty.png | Bin 0 -> 1204 bytes .../ionicons-2.0.1/png/512/ios7-close-outline.png | Bin 0 -> 4999 bytes .../external/ionicons-2.0.1/png/512/ios7-close.png | Bin 0 -> 3426 bytes .../png/512/ios7-cloud-download-outline.png | Bin 0 -> 3953 bytes .../ionicons-2.0.1/png/512/ios7-cloud-download.png | Bin 0 -> 2782 bytes .../ionicons-2.0.1/png/512/ios7-cloud-outline.png | Bin 0 -> 3339 bytes .../png/512/ios7-cloud-upload-outline.png | Bin 0 -> 3927 bytes .../ionicons-2.0.1/png/512/ios7-cloud-upload.png | Bin 0 -> 2815 bytes .../external/ionicons-2.0.1/png/512/ios7-cloud.png | Bin 0 -> 2082 bytes .../png/512/ios7-cloudy-night-outline.png | Bin 0 -> 3814 bytes .../ionicons-2.0.1/png/512/ios7-cloudy-night.png | Bin 0 -> 2870 bytes .../ionicons-2.0.1/png/512/ios7-cloudy-outline.png | Bin 0 -> 2280 bytes .../ionicons-2.0.1/png/512/ios7-cloudy.png | Bin 0 -> 1572 bytes .../ionicons-2.0.1/png/512/ios7-cog-outline.png | Bin 0 -> 8008 bytes .../external/ionicons-2.0.1/png/512/ios7-cog.png | Bin 0 -> 6029 bytes .../png/512/ios7-compose-outline.png | Bin 0 -> 1584 bytes .../ionicons-2.0.1/png/512/ios7-compose.png | Bin 0 -> 2061 bytes .../png/512/ios7-contact-outline.png | Bin 0 -> 4846 bytes .../ionicons-2.0.1/png/512/ios7-contact.png | Bin 0 -> 4218 bytes .../ionicons-2.0.1/png/512/ios7-copy-outline.png | Bin 0 -> 927 bytes .../external/ionicons-2.0.1/png/512/ios7-copy.png | Bin 0 -> 782 bytes .../png/512/ios7-download-outline.png | Bin 0 -> 1163 bytes .../ionicons-2.0.1/png/512/ios7-download.png | Bin 0 -> 1135 bytes .../external/ionicons-2.0.1/png/512/ios7-drag.png | Bin 0 -> 165 bytes .../ionicons-2.0.1/png/512/ios7-email-outline.png | Bin 0 -> 2592 bytes .../external/ionicons-2.0.1/png/512/ios7-email.png | Bin 0 -> 4167 bytes .../ionicons-2.0.1/png/512/ios7-expand.png | Bin 0 -> 485 bytes .../ionicons-2.0.1/png/512/ios7-eye-outline.png | Bin 0 -> 4381 bytes .../external/ionicons-2.0.1/png/512/ios7-eye.png | Bin 0 -> 2973 bytes .../png/512/ios7-fastforward-outline.png | Bin 0 -> 2726 bytes .../ionicons-2.0.1/png/512/ios7-fastforward.png | Bin 0 -> 2158 bytes .../ionicons-2.0.1/png/512/ios7-filing-outline.png | Bin 0 -> 2041 bytes .../ionicons-2.0.1/png/512/ios7-filing.png | Bin 0 -> 1933 bytes .../ionicons-2.0.1/png/512/ios7-film-outline.png | Bin 0 -> 772 bytes .../external/ionicons-2.0.1/png/512/ios7-film.png | Bin 0 -> 722 bytes .../ionicons-2.0.1/png/512/ios7-flag-outline.png | Bin 0 -> 1928 bytes .../external/ionicons-2.0.1/png/512/ios7-flag.png | Bin 0 -> 1483 bytes .../ionicons-2.0.1/png/512/ios7-folder-outline.png | Bin 0 -> 1606 bytes .../ionicons-2.0.1/png/512/ios7-folder.png | Bin 0 -> 1640 bytes .../png/512/ios7-football-outline.png | Bin 0 -> 6266 bytes .../ionicons-2.0.1/png/512/ios7-football.png | Bin 0 -> 5391 bytes .../ionicons-2.0.1/png/512/ios7-gear-outline.png | Bin 0 -> 5721 bytes .../external/ionicons-2.0.1/png/512/ios7-gear.png | Bin 0 -> 3445 bytes .../png/512/ios7-glasses-outline.png | Bin 0 -> 3597 bytes .../ionicons-2.0.1/png/512/ios7-glasses.png | Bin 0 -> 2350 bytes .../ionicons-2.0.1/png/512/ios7-heart-outline.png | Bin 0 -> 3097 bytes .../external/ionicons-2.0.1/png/512/ios7-heart.png | Bin 0 -> 2078 bytes .../ionicons-2.0.1/png/512/ios7-help-empty.png | Bin 0 -> 1669 bytes .../ionicons-2.0.1/png/512/ios7-help-outline.png | Bin 0 -> 5608 bytes .../external/ionicons-2.0.1/png/512/ios7-help.png | Bin 0 -> 3587 bytes .../ionicons-2.0.1/png/512/ios7-home-outline.png | Bin 0 -> 1710 bytes .../external/ionicons-2.0.1/png/512/ios7-home.png | Bin 0 -> 1518 bytes .../png/512/ios7-infinite-outline.png | Bin 0 -> 3028 bytes .../ionicons-2.0.1/png/512/ios7-infinite.png | Bin 0 -> 2989 bytes .../png/512/ios7-information-empty.png | Bin 0 -> 837 bytes .../png/512/ios7-information-outline.png | Bin 0 -> 4563 bytes .../ionicons-2.0.1/png/512/ios7-information.png | Bin 0 -> 2959 bytes .../ionicons-2.0.1/png/512/ios7-ionic-outline.png | Bin 0 -> 5780 bytes .../ionicons-2.0.1/png/512/ios7-keypad-outline.png | Bin 0 -> 7485 bytes .../ionicons-2.0.1/png/512/ios7-keypad.png | Bin 0 -> 7505 bytes .../png/512/ios7-lightbulb-outline.png | Bin 0 -> 3791 bytes .../ionicons-2.0.1/png/512/ios7-lightbulb.png | Bin 0 -> 2696 bytes .../png/512/ios7-location-outline.png | Bin 0 -> 4116 bytes .../ionicons-2.0.1/png/512/ios7-location.png | Bin 0 -> 2767 bytes .../ionicons-2.0.1/png/512/ios7-locked-outline.png | Bin 0 -> 2640 bytes .../ionicons-2.0.1/png/512/ios7-locked.png | Bin 0 -> 2674 bytes .../ionicons-2.0.1/png/512/ios7-loop-strong.png | Bin 0 -> 4101 bytes .../external/ionicons-2.0.1/png/512/ios7-loop.png | Bin 0 -> 4270 bytes .../ionicons-2.0.1/png/512/ios7-medkit-outline.png | Bin 0 -> 1386 bytes .../ionicons-2.0.1/png/512/ios7-medkit.png | Bin 0 -> 1373 bytes .../ionicons-2.0.1/png/512/ios7-mic-off.png | Bin 0 -> 7597 bytes .../ionicons-2.0.1/png/512/ios7-mic-outline.png | Bin 0 -> 3550 bytes .../external/ionicons-2.0.1/png/512/ios7-mic.png | Bin 0 -> 3878 bytes .../ionicons-2.0.1/png/512/ios7-minus-empty.png | Bin 0 -> 153 bytes .../ionicons-2.0.1/png/512/ios7-minus-outline.png | Bin 0 -> 4137 bytes .../external/ionicons-2.0.1/png/512/ios7-minus.png | Bin 0 -> 2520 bytes .../png/512/ios7-monitor-outline.png | Bin 0 -> 225 bytes .../ionicons-2.0.1/png/512/ios7-monitor.png | Bin 0 -> 230 bytes .../ionicons-2.0.1/png/512/ios7-moon-outline.png | Bin 0 -> 2566 bytes .../external/ionicons-2.0.1/png/512/ios7-moon.png | Bin 0 -> 1784 bytes .../ionicons-2.0.1/png/512/ios7-more-outline.png | Bin 0 -> 1598 bytes .../external/ionicons-2.0.1/png/512/ios7-more.png | Bin 0 -> 1700 bytes .../ionicons-2.0.1/png/512/ios7-musical-note.png | Bin 0 -> 1521 bytes .../ionicons-2.0.1/png/512/ios7-musical-notes.png | Bin 0 -> 2124 bytes .../png/512/ios7-navigate-outline.png | Bin 0 -> 4901 bytes .../ionicons-2.0.1/png/512/ios7-navigate.png | Bin 0 -> 3333 bytes .../ionicons-2.0.1/png/512/ios7-paper-outline.png | Bin 0 -> 1361 bytes .../external/ionicons-2.0.1/png/512/ios7-paper.png | Bin 0 -> 1197 bytes .../png/512/ios7-paperplane-outline.png | Bin 0 -> 2952 bytes .../ionicons-2.0.1/png/512/ios7-paperplane.png | Bin 0 -> 4805 bytes .../png/512/ios7-partlysunny-outline.png | Bin 0 -> 4823 bytes .../ionicons-2.0.1/png/512/ios7-partlysunny.png | Bin 0 -> 4052 bytes .../ionicons-2.0.1/png/512/ios7-pause-outline.png | Bin 0 -> 227 bytes .../external/ionicons-2.0.1/png/512/ios7-pause.png | Bin 0 -> 213 bytes .../ionicons-2.0.1/png/512/ios7-paw-outline.png | Bin 0 -> 6318 bytes .../external/ionicons-2.0.1/png/512/ios7-paw.png | Bin 0 -> 4119 bytes .../ionicons-2.0.1/png/512/ios7-people-outline.png | Bin 0 -> 5295 bytes .../ionicons-2.0.1/png/512/ios7-people.png | Bin 0 -> 3439 bytes .../ionicons-2.0.1/png/512/ios7-person-outline.png | Bin 0 -> 3189 bytes .../ionicons-2.0.1/png/512/ios7-person.png | Bin 0 -> 2046 bytes .../png/512/ios7-personadd-outline.png | Bin 0 -> 3246 bytes .../ionicons-2.0.1/png/512/ios7-personadd.png | Bin 0 -> 2110 bytes .../ionicons-2.0.1/png/512/ios7-photos-outline.png | Bin 0 -> 234 bytes .../ionicons-2.0.1/png/512/ios7-photos.png | Bin 0 -> 226 bytes .../ionicons-2.0.1/png/512/ios7-pie-outline.png | Bin 0 -> 4549 bytes .../external/ionicons-2.0.1/png/512/ios7-pie.png | Bin 0 -> 3646 bytes .../ionicons-2.0.1/png/512/ios7-play-outline.png | Bin 0 -> 1474 bytes .../external/ionicons-2.0.1/png/512/ios7-play.png | Bin 0 -> 1216 bytes .../ionicons-2.0.1/png/512/ios7-plus-empty.png | Bin 0 -> 204 bytes .../ionicons-2.0.1/png/512/ios7-plus-outline.png | Bin 0 -> 4415 bytes .../external/ionicons-2.0.1/png/512/ios7-plus.png | Bin 0 -> 2970 bytes .../png/512/ios7-pricetag-outline.png | Bin 0 -> 3007 bytes .../ionicons-2.0.1/png/512/ios7-pricetag.png | Bin 0 -> 2593 bytes .../png/512/ios7-pricetags-outline.png | Bin 0 -> 3563 bytes .../ionicons-2.0.1/png/512/ios7-pricetags.png | Bin 0 -> 3219 bytes .../png/512/ios7-printer-outline.png | Bin 0 -> 1764 bytes .../ionicons-2.0.1/png/512/ios7-printer.png | Bin 0 -> 1456 bytes .../ionicons-2.0.1/png/512/ios7-pulse-strong.png | Bin 0 -> 3326 bytes .../external/ionicons-2.0.1/png/512/ios7-pulse.png | Bin 0 -> 2955 bytes .../ionicons-2.0.1/png/512/ios7-rainy-outline.png | Bin 0 -> 3346 bytes .../external/ionicons-2.0.1/png/512/ios7-rainy.png | Bin 0 -> 2567 bytes .../png/512/ios7-recording-outline.png | Bin 0 -> 4926 bytes .../ionicons-2.0.1/png/512/ios7-recording.png | Bin 0 -> 3762 bytes .../ionicons-2.0.1/png/512/ios7-redo-outline.png | Bin 0 -> 3094 bytes .../external/ionicons-2.0.1/png/512/ios7-redo.png | Bin 0 -> 2054 bytes .../ionicons-2.0.1/png/512/ios7-refresh-empty.png | Bin 0 -> 2685 bytes .../png/512/ios7-refresh-outline.png | Bin 0 -> 6021 bytes .../ionicons-2.0.1/png/512/ios7-refresh.png | Bin 0 -> 4579 bytes .../ionicons-2.0.1/png/512/ios7-reload.png | Bin 0 -> 4195 bytes .../png/512/ios7-reverse-camera-outline.png | Bin 0 -> 3404 bytes .../ionicons-2.0.1/png/512/ios7-reverse-camera.png | Bin 0 -> 3019 bytes .../ionicons-2.0.1/png/512/ios7-rewind-outline.png | Bin 0 -> 2898 bytes .../ionicons-2.0.1/png/512/ios7-rewind.png | Bin 0 -> 2362 bytes .../ionicons-2.0.1/png/512/ios7-search-strong.png | Bin 0 -> 3329 bytes .../ionicons-2.0.1/png/512/ios7-search.png | Bin 0 -> 3361 bytes .../png/512/ios7-settings-strong.png | Bin 0 -> 1714 bytes .../ionicons-2.0.1/png/512/ios7-settings.png | Bin 0 -> 2160 bytes .../ionicons-2.0.1/png/512/ios7-shrink.png | Bin 0 -> 490 bytes .../png/512/ios7-skipbackward-outline.png | Bin 0 -> 1890 bytes .../ionicons-2.0.1/png/512/ios7-skipbackward.png | Bin 0 -> 1533 bytes .../png/512/ios7-skipforward-outline.png | Bin 0 -> 1827 bytes .../ionicons-2.0.1/png/512/ios7-skipforward.png | Bin 0 -> 1556 bytes .../external/ionicons-2.0.1/png/512/ios7-snowy.png | Bin 0 -> 3775 bytes .../png/512/ios7-speedometer-outline.png | Bin 0 -> 4678 bytes .../ionicons-2.0.1/png/512/ios7-speedometer.png | Bin 0 -> 5748 bytes .../ionicons-2.0.1/png/512/ios7-star-half.png | Bin 0 -> 3431 bytes .../ionicons-2.0.1/png/512/ios7-star-outline.png | Bin 0 -> 3572 bytes .../external/ionicons-2.0.1/png/512/ios7-star.png | Bin 0 -> 2463 bytes .../png/512/ios7-stopwatch-outline.png | Bin 0 -> 4823 bytes .../ionicons-2.0.1/png/512/ios7-stopwatch.png | Bin 0 -> 3451 bytes .../ionicons-2.0.1/png/512/ios7-sunny-outline.png | Bin 0 -> 2669 bytes .../external/ionicons-2.0.1/png/512/ios7-sunny.png | Bin 0 -> 2506 bytes .../png/512/ios7-telephone-outline.png | Bin 0 -> 3779 bytes .../ionicons-2.0.1/png/512/ios7-telephone.png | Bin 0 -> 2352 bytes .../png/512/ios7-tennisball-outline.png | Bin 0 -> 5535 bytes .../ionicons-2.0.1/png/512/ios7-tennisball.png | Bin 0 -> 6356 bytes .../png/512/ios7-thunderstorm-outline.png | Bin 0 -> 3053 bytes .../ionicons-2.0.1/png/512/ios7-thunderstorm.png | Bin 0 -> 2492 bytes .../ionicons-2.0.1/png/512/ios7-time-outline.png | Bin 0 -> 5875 bytes .../external/ionicons-2.0.1/png/512/ios7-time.png | Bin 0 -> 4136 bytes .../ionicons-2.0.1/png/512/ios7-timer-outline.png | Bin 0 -> 4578 bytes .../external/ionicons-2.0.1/png/512/ios7-timer.png | Bin 0 -> 6013 bytes .../ionicons-2.0.1/png/512/ios7-toggle-outline.png | Bin 0 -> 5660 bytes .../ionicons-2.0.1/png/512/ios7-toggle.png | Bin 0 -> 4825 bytes .../ionicons-2.0.1/png/512/ios7-trash-outline.png | Bin 0 -> 4497 bytes .../external/ionicons-2.0.1/png/512/ios7-trash.png | Bin 0 -> 2760 bytes .../ionicons-2.0.1/png/512/ios7-undo-outline.png | Bin 0 -> 3114 bytes .../external/ionicons-2.0.1/png/512/ios7-undo.png | Bin 0 -> 1954 bytes .../png/512/ios7-unlocked-outline.png | Bin 0 -> 2580 bytes .../ionicons-2.0.1/png/512/ios7-unlocked.png | Bin 0 -> 2605 bytes .../ionicons-2.0.1/png/512/ios7-upload-outline.png | Bin 0 -> 1128 bytes .../ionicons-2.0.1/png/512/ios7-upload.png | Bin 0 -> 1085 bytes .../png/512/ios7-videocam-outline.png | Bin 0 -> 2038 bytes .../ionicons-2.0.1/png/512/ios7-videocam.png | Bin 0 -> 2715 bytes .../ionicons-2.0.1/png/512/ios7-volume-high.png | Bin 0 -> 2977 bytes .../ionicons-2.0.1/png/512/ios7-volume-low.png | Bin 0 -> 956 bytes .../png/512/ios7-wineglass-outline.png | Bin 0 -> 2527 bytes .../ionicons-2.0.1/png/512/ios7-wineglass.png | Bin 0 -> 2013 bytes .../ionicons-2.0.1/png/512/ios7-world-outline.png | Bin 0 -> 7420 bytes .../external/ionicons-2.0.1/png/512/ios7-world.png | Bin 0 -> 10031 bytes .../external/ionicons-2.0.1/png/512/ipad.png | Bin 0 -> 1356 bytes .../external/ionicons-2.0.1/png/512/iphone.png | Bin 0 -> 1651 bytes .../external/ionicons-2.0.1/png/512/ipod.png | Bin 0 -> 3207 bytes .../fusion/external/ionicons-2.0.1/png/512/jet.png | Bin 0 -> 2856 bytes .../fusion/external/ionicons-2.0.1/png/512/key.png | Bin 0 -> 2722 bytes .../external/ionicons-2.0.1/png/512/knife.png | Bin 0 -> 1822 bytes .../external/ionicons-2.0.1/png/512/laptop.png | Bin 0 -> 2474 bytes .../external/ionicons-2.0.1/png/512/leaf.png | Bin 0 -> 3440 bytes .../external/ionicons-2.0.1/png/512/levels.png | Bin 0 -> 2431 bytes .../external/ionicons-2.0.1/png/512/lightbulb.png | Bin 0 -> 2474 bytes .../external/ionicons-2.0.1/png/512/link.png | Bin 0 -> 2306 bytes .../external/ionicons-2.0.1/png/512/load-a.png | Bin 0 -> 3941 bytes .../external/ionicons-2.0.1/png/512/load-b.png | Bin 0 -> 5473 bytes .../external/ionicons-2.0.1/png/512/load-c.png | Bin 0 -> 4337 bytes .../external/ionicons-2.0.1/png/512/load-d.png | Bin 0 -> 6618 bytes .../external/ionicons-2.0.1/png/512/location.png | Bin 0 -> 2739 bytes .../external/ionicons-2.0.1/png/512/locked.png | Bin 0 -> 2494 bytes .../external/ionicons-2.0.1/png/512/log-in.png | Bin 0 -> 1460 bytes .../external/ionicons-2.0.1/png/512/log-out.png | Bin 0 -> 1637 bytes .../external/ionicons-2.0.1/png/512/loop.png | Bin 0 -> 3794 bytes .../external/ionicons-2.0.1/png/512/magnet.png | Bin 0 -> 4495 bytes .../external/ionicons-2.0.1/png/512/male.png | Bin 0 -> 3788 bytes .../fusion/external/ionicons-2.0.1/png/512/man.png | Bin 0 -> 2126 bytes .../fusion/external/ionicons-2.0.1/png/512/map.png | Bin 0 -> 4906 bytes .../external/ionicons-2.0.1/png/512/medkit.png | Bin 0 -> 1605 bytes .../external/ionicons-2.0.1/png/512/merge.png | Bin 0 -> 3879 bytes .../external/ionicons-2.0.1/png/512/mic-a.png | Bin 0 -> 4098 bytes .../external/ionicons-2.0.1/png/512/mic-b.png | Bin 0 -> 2576 bytes .../external/ionicons-2.0.1/png/512/mic-c.png | Bin 0 -> 1726 bytes .../ionicons-2.0.1/png/512/minus-circled.png | Bin 0 -> 2655 bytes .../ionicons-2.0.1/png/512/minus-round.png | Bin 0 -> 937 bytes .../external/ionicons-2.0.1/png/512/minus.png | Bin 0 -> 160 bytes .../external/ionicons-2.0.1/png/512/model-s.png | Bin 0 -> 4262 bytes .../external/ionicons-2.0.1/png/512/monitor.png | Bin 0 -> 1469 bytes .../external/ionicons-2.0.1/png/512/more.png | Bin 0 -> 3357 bytes .../external/ionicons-2.0.1/png/512/mouse.png | Bin 0 -> 2891 bytes .../external/ionicons-2.0.1/png/512/music-note.png | Bin 0 -> 2519 bytes .../ionicons-2.0.1/png/512/navicon-round.png | Bin 0 -> 1628 bytes .../external/ionicons-2.0.1/png/512/navicon.png | Bin 0 -> 175 bytes .../external/ionicons-2.0.1/png/512/navigate.png | Bin 0 -> 1693 bytes .../external/ionicons-2.0.1/png/512/network.png | Bin 0 -> 3041 bytes .../external/ionicons-2.0.1/png/512/no-smoking.png | Bin 0 -> 5816 bytes .../external/ionicons-2.0.1/png/512/nuclear.png | Bin 0 -> 3618 bytes .../external/ionicons-2.0.1/png/512/outlet.png | Bin 0 -> 2882 bytes .../ionicons-2.0.1/png/512/paper-airplane.png | Bin 0 -> 3678 bytes .../external/ionicons-2.0.1/png/512/paperclip.png | Bin 0 -> 2710 bytes .../external/ionicons-2.0.1/png/512/pause.png | Bin 0 -> 1340 bytes .../external/ionicons-2.0.1/png/512/person-add.png | Bin 0 -> 2410 bytes .../ionicons-2.0.1/png/512/person-stalker.png | Bin 0 -> 3272 bytes .../external/ionicons-2.0.1/png/512/person.png | Bin 0 -> 2258 bytes .../external/ionicons-2.0.1/png/512/pie-graph.png | Bin 0 -> 3608 bytes .../fusion/external/ionicons-2.0.1/png/512/pin.png | Bin 0 -> 2270 bytes .../external/ionicons-2.0.1/png/512/pinpoint.png | Bin 0 -> 4799 bytes .../external/ionicons-2.0.1/png/512/pizza.png | Bin 0 -> 4548 bytes .../external/ionicons-2.0.1/png/512/plane.png | Bin 0 -> 3218 bytes .../external/ionicons-2.0.1/png/512/planet.png | Bin 0 -> 4319 bytes .../external/ionicons-2.0.1/png/512/play.png | Bin 0 -> 1787 bytes .../ionicons-2.0.1/png/512/playstation.png | Bin 0 -> 3275 bytes .../ionicons-2.0.1/png/512/plus-circled.png | Bin 0 -> 3114 bytes .../external/ionicons-2.0.1/png/512/plus-round.png | Bin 0 -> 1567 bytes .../external/ionicons-2.0.1/png/512/plus.png | Bin 0 -> 223 bytes .../external/ionicons-2.0.1/png/512/podium.png | Bin 0 -> 209 bytes .../external/ionicons-2.0.1/png/512/pound.png | Bin 0 -> 2383 bytes .../external/ionicons-2.0.1/png/512/power.png | Bin 0 -> 4727 bytes .../external/ionicons-2.0.1/png/512/pricetag.png | Bin 0 -> 2457 bytes .../external/ionicons-2.0.1/png/512/pricetags.png | Bin 0 -> 2906 bytes .../external/ionicons-2.0.1/png/512/printer.png | Bin 0 -> 1869 bytes .../ionicons-2.0.1/png/512/pull-request.png | Bin 0 -> 3613 bytes .../external/ionicons-2.0.1/png/512/qr-scanner.png | Bin 0 -> 1842 bytes .../external/ionicons-2.0.1/png/512/quote.png | Bin 0 -> 1743 bytes .../ionicons-2.0.1/png/512/radio-waves.png | Bin 0 -> 4978 bytes .../external/ionicons-2.0.1/png/512/record.png | Bin 0 -> 3779 bytes .../external/ionicons-2.0.1/png/512/refresh.png | Bin 0 -> 3582 bytes .../external/ionicons-2.0.1/png/512/reply-all.png | Bin 0 -> 3033 bytes .../external/ionicons-2.0.1/png/512/reply.png | Bin 0 -> 2131 bytes .../external/ionicons-2.0.1/png/512/ribbon-a.png | Bin 0 -> 6449 bytes .../external/ionicons-2.0.1/png/512/ribbon-b.png | Bin 0 -> 5913 bytes .../fusion/external/ionicons-2.0.1/png/512/sad.png | Bin 0 -> 5517 bytes .../external/ionicons-2.0.1/png/512/scissors.png | Bin 0 -> 5061 bytes .../external/ionicons-2.0.1/png/512/search.png | Bin 0 -> 3229 bytes .../external/ionicons-2.0.1/png/512/settings.png | Bin 0 -> 4141 bytes .../external/ionicons-2.0.1/png/512/share.png | Bin 0 -> 2616 bytes .../external/ionicons-2.0.1/png/512/shuffle.png | Bin 0 -> 3420 bytes .../ionicons-2.0.1/png/512/skip-backward.png | Bin 0 -> 2421 bytes .../ionicons-2.0.1/png/512/skip-forward.png | Bin 0 -> 2402 bytes .../png/512/social-android-outline.png | Bin 0 -> 3772 bytes .../ionicons-2.0.1/png/512/social-android.png | Bin 0 -> 2784 bytes .../png/512/social-apple-outline.png | Bin 0 -> 4104 bytes .../ionicons-2.0.1/png/512/social-apple.png | Bin 0 -> 2647 bytes .../png/512/social-bitcoin-outline.png | Bin 0 -> 3790 bytes .../ionicons-2.0.1/png/512/social-bitcoin.png | Bin 0 -> 2424 bytes .../png/512/social-buffer-outline.png | Bin 0 -> 3913 bytes .../ionicons-2.0.1/png/512/social-buffer.png | Bin 0 -> 4687 bytes .../png/512/social-designernews-outline.png | Bin 0 -> 4754 bytes .../ionicons-2.0.1/png/512/social-designernews.png | Bin 0 -> 4242 bytes .../png/512/social-dribbble-outline.png | Bin 0 -> 5588 bytes .../ionicons-2.0.1/png/512/social-dribbble.png | Bin 0 -> 6983 bytes .../png/512/social-dropbox-outline.png | Bin 0 -> 5113 bytes .../ionicons-2.0.1/png/512/social-dropbox.png | Bin 0 -> 6161 bytes .../png/512/social-facebook-outline.png | Bin 0 -> 1788 bytes .../ionicons-2.0.1/png/512/social-facebook.png | Bin 0 -> 1402 bytes .../png/512/social-foursquare-outline.png | Bin 0 -> 3364 bytes .../ionicons-2.0.1/png/512/social-foursquare.png | Bin 0 -> 3021 bytes .../png/512/social-freebsd-devil.png | Bin 0 -> 5300 bytes .../png/512/social-github-outline.png | Bin 0 -> 7475 bytes .../ionicons-2.0.1/png/512/social-github.png | Bin 0 -> 4561 bytes .../png/512/social-google-outline.png | Bin 0 -> 3890 bytes .../ionicons-2.0.1/png/512/social-google.png | Bin 0 -> 3682 bytes .../png/512/social-googleplus-outline.png | Bin 0 -> 4071 bytes .../ionicons-2.0.1/png/512/social-googleplus.png | Bin 0 -> 3888 bytes .../png/512/social-hackernews-outline.png | Bin 0 -> 1994 bytes .../ionicons-2.0.1/png/512/social-hackernews.png | Bin 0 -> 1905 bytes .../png/512/social-instagram-outline.png | Bin 0 -> 3317 bytes .../ionicons-2.0.1/png/512/social-instagram.png | Bin 0 -> 4403 bytes .../png/512/social-linkedin-outline.png | Bin 0 -> 2370 bytes .../ionicons-2.0.1/png/512/social-linkedin.png | Bin 0 -> 2275 bytes .../png/512/social-pinterest-outline.png | Bin 0 -> 6933 bytes .../ionicons-2.0.1/png/512/social-pinterest.png | Bin 0 -> 5532 bytes .../png/512/social-reddit-outline.png | Bin 0 -> 6414 bytes .../ionicons-2.0.1/png/512/social-reddit.png | Bin 0 -> 4498 bytes .../ionicons-2.0.1/png/512/social-rss-outline.png | Bin 0 -> 5945 bytes .../external/ionicons-2.0.1/png/512/social-rss.png | Bin 0 -> 4789 bytes .../png/512/social-skype-outline.png | Bin 0 -> 5608 bytes .../ionicons-2.0.1/png/512/social-skype.png | Bin 0 -> 4269 bytes .../png/512/social-tumblr-outline.png | Bin 0 -> 2725 bytes .../ionicons-2.0.1/png/512/social-tumblr.png | Bin 0 -> 1946 bytes .../external/ionicons-2.0.1/png/512/social-tux.png | Bin 0 -> 7103 bytes .../png/512/social-twitter-outline.png | Bin 0 -> 5569 bytes .../ionicons-2.0.1/png/512/social-twitter.png | Bin 0 -> 3405 bytes .../ionicons-2.0.1/png/512/social-usd-outline.png | Bin 0 -> 5744 bytes .../external/ionicons-2.0.1/png/512/social-usd.png | Bin 0 -> 3446 bytes .../png/512/social-vimeo-outline.png | Bin 0 -> 5525 bytes .../ionicons-2.0.1/png/512/social-vimeo.png | Bin 0 -> 3456 bytes .../png/512/social-windows-outline.png | Bin 0 -> 1775 bytes .../ionicons-2.0.1/png/512/social-windows.png | Bin 0 -> 2550 bytes .../png/512/social-wordpress-outline.png | Bin 0 -> 6418 bytes .../ionicons-2.0.1/png/512/social-wordpress.png | Bin 0 -> 5465 bytes .../png/512/social-yahoo-outline.png | Bin 0 -> 2119 bytes .../ionicons-2.0.1/png/512/social-yahoo.png | Bin 0 -> 1729 bytes .../png/512/social-youtube-outline.png | Bin 0 -> 4655 bytes .../ionicons-2.0.1/png/512/social-youtube.png | Bin 0 -> 2511 bytes .../ionicons-2.0.1/png/512/speakerphone.png | Bin 0 -> 4310 bytes .../ionicons-2.0.1/png/512/speedometer.png | Bin 0 -> 4238 bytes .../external/ionicons-2.0.1/png/512/spoon.png | Bin 0 -> 2306 bytes .../external/ionicons-2.0.1/png/512/star.png | Bin 0 -> 2195 bytes .../external/ionicons-2.0.1/png/512/stats-bars.png | Bin 0 -> 218 bytes .../external/ionicons-2.0.1/png/512/steam.png | Bin 0 -> 3875 bytes .../external/ionicons-2.0.1/png/512/stop.png | Bin 0 -> 1090 bytes .../ionicons-2.0.1/png/512/thermometer.png | Bin 0 -> 1980 bytes .../external/ionicons-2.0.1/png/512/thumbsdown.png | Bin 0 -> 2288 bytes .../external/ionicons-2.0.1/png/512/thumbsup.png | Bin 0 -> 2356 bytes .../ionicons-2.0.1/png/512/toggle-filled.png | Bin 0 -> 3194 bytes .../external/ionicons-2.0.1/png/512/toggle.png | Bin 0 -> 3599 bytes .../external/ionicons-2.0.1/png/512/trash-a.png | Bin 0 -> 2752 bytes .../external/ionicons-2.0.1/png/512/trash-b.png | Bin 0 -> 1882 bytes .../external/ionicons-2.0.1/png/512/trophy.png | Bin 0 -> 3579 bytes .../external/ionicons-2.0.1/png/512/umbrella.png | Bin 0 -> 3416 bytes .../external/ionicons-2.0.1/png/512/university.png | Bin 0 -> 3167 bytes .../external/ionicons-2.0.1/png/512/unlocked.png | Bin 0 -> 2412 bytes .../external/ionicons-2.0.1/png/512/upload.png | Bin 0 -> 2480 bytes .../fusion/external/ionicons-2.0.1/png/512/usb.png | Bin 0 -> 3950 bytes .../ionicons-2.0.1/png/512/videocamera.png | Bin 0 -> 2381 bytes .../ionicons-2.0.1/png/512/volume-high.png | Bin 0 -> 4334 bytes .../external/ionicons-2.0.1/png/512/volume-low.png | Bin 0 -> 2136 bytes .../ionicons-2.0.1/png/512/volume-medium.png | Bin 0 -> 3174 bytes .../ionicons-2.0.1/png/512/volume-mute.png | Bin 0 -> 4803 bytes .../external/ionicons-2.0.1/png/512/wand.png | Bin 0 -> 1933 bytes .../external/ionicons-2.0.1/png/512/waterdrop.png | Bin 0 -> 3169 bytes .../external/ionicons-2.0.1/png/512/wifi.png | Bin 0 -> 3037 bytes .../external/ionicons-2.0.1/png/512/wineglass.png | Bin 0 -> 3734 bytes .../external/ionicons-2.0.1/png/512/woman.png | Bin 0 -> 3592 bytes .../external/ionicons-2.0.1/png/512/wrench.png | Bin 0 -> 2866 bytes .../external/ionicons-2.0.1/png/512/xbox.png | Bin 0 -> 4958 bytes .../app/fusion/external/ionicons-2.0.1/readme.md | 60 + .../ionicons-2.0.1/scss/_ionicons-font.scss | 27 + .../ionicons-2.0.1/scss/_ionicons-icons.scss | 1473 + .../ionicons-2.0.1/scss/_ionicons-variables.scss | 741 + .../external/ionicons-2.0.1/scss/ionicons.scss | 15 + .../external/ionicons-2.0.1/src/alert-circled.svg | 11 + .../fusion/external/ionicons-2.0.1/src/alert.svg | 9 + .../ionicons-2.0.1/src/android-add-circle.svg | 12 + .../external/ionicons-2.0.1/src/android-add.svg | 11 + .../ionicons-2.0.1/src/android-alarm-clock.svg | 15 + .../external/ionicons-2.0.1/src/android-alert.svg | 12 + .../external/ionicons-2.0.1/src/android-apps.svg | 12 + .../ionicons-2.0.1/src/android-archive.svg | 12 + .../ionicons-2.0.1/src/android-arrow-back.svg | 11 + .../ionicons-2.0.1/src/android-arrow-down.svg | 11 + .../src/android-arrow-dropdown-circle.svg | 10 + .../ionicons-2.0.1/src/android-arrow-dropdown.svg | 9 + .../src/android-arrow-dropleft-circle.svg | 10 + .../ionicons-2.0.1/src/android-arrow-dropleft.svg | 9 + .../src/android-arrow-dropright-circle.svg | 10 + .../ionicons-2.0.1/src/android-arrow-dropright.svg | 9 + .../src/android-arrow-dropup-circle.svg | 10 + .../ionicons-2.0.1/src/android-arrow-dropup.svg | 9 + .../ionicons-2.0.1/src/android-arrow-forward.svg | 11 + .../ionicons-2.0.1/src/android-arrow-up.svg | 11 + .../external/ionicons-2.0.1/src/android-attach.svg | 15 + .../external/ionicons-2.0.1/src/android-bar.svg | 12 + .../ionicons-2.0.1/src/android-bicycle.svg | 19 + .../external/ionicons-2.0.1/src/android-boat.svg | 16 + .../ionicons-2.0.1/src/android-bookmark.svg | 7 + .../external/ionicons-2.0.1/src/android-bulb.svg | 18 + .../external/ionicons-2.0.1/src/android-bus.svg | 18 + .../ionicons-2.0.1/src/android-calendar.svg | 11 + .../external/ionicons-2.0.1/src/android-call.svg | 10 + .../external/ionicons-2.0.1/src/android-camera.svg | 12 + .../external/ionicons-2.0.1/src/android-cancel.svg | 11 + .../external/ionicons-2.0.1/src/android-car.svg | 15 + .../external/ionicons-2.0.1/src/android-cart.svg | 14 + .../external/ionicons-2.0.1/src/android-chat.svg | 12 + .../ionicons-2.0.1/src/android-checkbox-blank.svg | 12 + .../src/android-checkbox-outline-blank.svg | 13 + .../src/android-checkbox-outline.svg | 13 + .../ionicons-2.0.1/src/android-checkbox.svg | 13 + .../src/android-checkmark-circle.svg | 9 + .../ionicons-2.0.1/src/android-clipboard.svg | 10 + .../external/ionicons-2.0.1/src/android-close.svg | 12 + .../ionicons-2.0.1/src/android-cloud-circle.svg | 16 + .../ionicons-2.0.1/src/android-cloud-done.svg | 12 + .../ionicons-2.0.1/src/android-cloud-outline.svg | 16 + .../external/ionicons-2.0.1/src/android-cloud.svg | 9 + .../ionicons-2.0.1/src/android-color-palette.svg | 17 + .../ionicons-2.0.1/src/android-compass.svg | 9 + .../ionicons-2.0.1/src/android-contact.svg | 15 + .../ionicons-2.0.1/src/android-contacts.svg | 26 + .../ionicons-2.0.1/src/android-contract.svg | 12 + .../external/ionicons-2.0.1/src/android-create.svg | 13 + .../external/ionicons-2.0.1/src/android-delete.svg | 10 + .../ionicons-2.0.1/src/android-desktop.svg | 13 + .../ionicons-2.0.1/src/android-document.svg | 10 + .../ionicons-2.0.1/src/android-done-all.svg | 13 + .../external/ionicons-2.0.1/src/android-done.svg | 13 + .../ionicons-2.0.1/src/android-download.svg | 9 + .../external/ionicons-2.0.1/src/android-drafts.svg | 15 + .../external/ionicons-2.0.1/src/android-exit.svg | 9 + .../external/ionicons-2.0.1/src/android-expand.svg | 12 + .../src/android-favorite-outline.svg | 13 + .../ionicons-2.0.1/src/android-favorite.svg | 11 + .../external/ionicons-2.0.1/src/android-film.svg | 9 + .../ionicons-2.0.1/src/android-folder-open.svg | 10 + .../external/ionicons-2.0.1/src/android-folder.svg | 14 + .../external/ionicons-2.0.1/src/android-funnel.svg | 7 + .../external/ionicons-2.0.1/src/android-globe.svg | 24 + .../external/ionicons-2.0.1/src/android-hand.svg | 15 + .../ionicons-2.0.1/src/android-hangout.svg | 9 + .../external/ionicons-2.0.1/src/android-happy.svg | 12 + .../external/ionicons-2.0.1/src/android-home.svg | 9 + .../external/ionicons-2.0.1/src/android-image.svg | 13 + .../external/ionicons-2.0.1/src/android-laptop.svg | 14 + .../external/ionicons-2.0.1/src/android-list.svg | 10 + .../external/ionicons-2.0.1/src/android-locate.svg | 16 + .../external/ionicons-2.0.1/src/android-lock.svg | 14 + .../external/ionicons-2.0.1/src/android-mail.svg | 13 + .../external/ionicons-2.0.1/src/android-map.svg | 16 + .../external/ionicons-2.0.1/src/android-menu.svg | 11 + .../ionicons-2.0.1/src/android-microphone-off.svg | 17 + .../ionicons-2.0.1/src/android-microphone.svg | 12 + .../ionicons-2.0.1/src/android-more-horizontal.svg | 9 + .../ionicons-2.0.1/src/android-more-vertical.svg | 9 + .../ionicons-2.0.1/src/android-navigate.svg | 11 + .../src/android-notifications-none.svg | 11 + .../src/android-notifications-off.svg | 13 + .../ionicons-2.0.1/src/android-notifications.svg | 9 + .../external/ionicons-2.0.1/src/android-open.svg | 9 + .../ionicons-2.0.1/src/android-options.svg | 26 + .../external/ionicons-2.0.1/src/android-people.svg | 11 + .../ionicons-2.0.1/src/android-person-add.svg | 17 + .../external/ionicons-2.0.1/src/android-person.svg | 10 + .../ionicons-2.0.1/src/android-phone-landscape.svg | 12 + .../ionicons-2.0.1/src/android-phone-portrait.svg | 12 + .../external/ionicons-2.0.1/src/android-pin.svg | 11 + .../external/ionicons-2.0.1/src/android-plane.svg | 12 + .../ionicons-2.0.1/src/android-playstore.svg | 11 + .../external/ionicons-2.0.1/src/android-print.svg | 10 + .../src/android-radio-button-off.svg | 12 + .../ionicons-2.0.1/src/android-radio-button-on.svg | 13 + .../ionicons-2.0.1/src/android-refresh.svg | 11 + .../ionicons-2.0.1/src/android-remove-circle.svg | 10 + .../external/ionicons-2.0.1/src/android-remove.svg | 7 + .../ionicons-2.0.1/src/android-restaurant.svg | 17 + .../external/ionicons-2.0.1/src/android-sad.svg | 16 + .../external/ionicons-2.0.1/src/android-search.svg | 19 + .../external/ionicons-2.0.1/src/android-send.svg | 7 + .../ionicons-2.0.1/src/android-settings.svg | 19 + .../ionicons-2.0.1/src/android-share-alt.svg | 16 + .../external/ionicons-2.0.1/src/android-share.svg | 12 + .../ionicons-2.0.1/src/android-star-half.svg | 9 + .../ionicons-2.0.1/src/android-star-outline.svg | 10 + .../external/ionicons-2.0.1/src/android-star.svg | 10 + .../ionicons-2.0.1/src/android-stopwatch.svg | 21 + .../external/ionicons-2.0.1/src/android-subway.svg | 13 + .../external/ionicons-2.0.1/src/android-sunny.svg | 18 + .../external/ionicons-2.0.1/src/android-sync.svg | 10 + .../ionicons-2.0.1/src/android-textsms.svg | 10 + .../external/ionicons-2.0.1/src/android-time.svg | 15 + .../external/ionicons-2.0.1/src/android-train.svg | 15 + .../external/ionicons-2.0.1/src/android-unlock.svg | 10 + .../external/ionicons-2.0.1/src/android-upload.svg | 9 + .../ionicons-2.0.1/src/android-volume-down.svg | 8 + .../ionicons-2.0.1/src/android-volume-mute.svg | 7 + .../ionicons-2.0.1/src/android-volume-off.svg | 15 + .../ionicons-2.0.1/src/android-volume-up.svg | 9 + .../external/ionicons-2.0.1/src/android-walk.svg | 12 + .../ionicons-2.0.1/src/android-warning.svg | 11 + .../external/ionicons-2.0.1/src/android-watch.svg | 15 + .../external/ionicons-2.0.1/src/android-wifi.svg | 14 + .../external/ionicons-2.0.1/src/aperture.svg | 20 + .../fusion/external/ionicons-2.0.1/src/archive.svg | 12 + .../external/ionicons-2.0.1/src/arrow-down-a.svg | 7 + .../external/ionicons-2.0.1/src/arrow-down-b.svg | 8 + .../external/ionicons-2.0.1/src/arrow-down-c.svg | 9 + .../external/ionicons-2.0.1/src/arrow-expand.svg | 12 + .../ionicons-2.0.1/src/arrow-graph-down-left.svg | 7 + .../ionicons-2.0.1/src/arrow-graph-down-right.svg | 7 + .../ionicons-2.0.1/src/arrow-graph-up-left.svg | 7 + .../ionicons-2.0.1/src/arrow-graph-up-right.svg | 7 + .../external/ionicons-2.0.1/src/arrow-left-a.svg | 7 + .../external/ionicons-2.0.1/src/arrow-left-b.svg | 8 + .../external/ionicons-2.0.1/src/arrow-left-c.svg | 9 + .../external/ionicons-2.0.1/src/arrow-move.svg | 8 + .../external/ionicons-2.0.1/src/arrow-resize.svg | 8 + .../ionicons-2.0.1/src/arrow-return-left.svg | 8 + .../ionicons-2.0.1/src/arrow-return-right.svg | 8 + .../external/ionicons-2.0.1/src/arrow-right-a.svg | 7 + .../external/ionicons-2.0.1/src/arrow-right-b.svg | 8 + .../external/ionicons-2.0.1/src/arrow-right-c.svg | 9 + .../external/ionicons-2.0.1/src/arrow-shrink.svg | 12 + .../external/ionicons-2.0.1/src/arrow-swap.svg | 10 + .../external/ionicons-2.0.1/src/arrow-up-a.svg | 7 + .../external/ionicons-2.0.1/src/arrow-up-b.svg | 8 + .../external/ionicons-2.0.1/src/arrow-up-c.svg | 9 + .../external/ionicons-2.0.1/src/asterisk.svg | 8 + .../app/fusion/external/ionicons-2.0.1/src/at.svg | 25 + .../ionicons-2.0.1/src/backspace-outline.svg | 21 + .../external/ionicons-2.0.1/src/backspace.svg | 17 + .../app/fusion/external/ionicons-2.0.1/src/bag.svg | 10 + .../ionicons-2.0.1/src/battery-charging.svg | 9 + .../external/ionicons-2.0.1/src/battery-empty.svg | 8 + .../external/ionicons-2.0.1/src/battery-full.svg | 8 + .../external/ionicons-2.0.1/src/battery-half.svg | 9 + .../external/ionicons-2.0.1/src/battery-low.svg | 9 + .../fusion/external/ionicons-2.0.1/src/beaker.svg | 20 + .../fusion/external/ionicons-2.0.1/src/beer.svg | 28 + .../external/ionicons-2.0.1/src/bluetooth.svg | 18 + .../fusion/external/ionicons-2.0.1/src/bonfire.svg | 32 + .../external/ionicons-2.0.1/src/bookmark.svg | 10 + .../fusion/external/ionicons-2.0.1/src/bowtie.svg | 22 + .../external/ionicons-2.0.1/src/briefcase.svg | 12 + .../app/fusion/external/ionicons-2.0.1/src/bug.svg | 30 + .../external/ionicons-2.0.1/src/calculator.svg | 10 + .../external/ionicons-2.0.1/src/calendar.svg | 12 + .../fusion/external/ionicons-2.0.1/src/camera.svg | 15 + .../fusion/external/ionicons-2.0.1/src/card.svg | 14 + .../fusion/external/ionicons-2.0.1/src/cash.svg | 31 + .../ionicons-2.0.1/src/chatbox-working.svg | 11 + .../fusion/external/ionicons-2.0.1/src/chatbox.svg | 8 + .../external/ionicons-2.0.1/src/chatboxes.svg | 12 + .../ionicons-2.0.1/src/chatbubble-working.svg | 12 + .../external/ionicons-2.0.1/src/chatbubble.svg | 9 + .../external/ionicons-2.0.1/src/chatbubbles.svg | 16 + .../ionicons-2.0.1/src/checkmark-circled.svg | 13 + .../ionicons-2.0.1/src/checkmark-round.svg | 9 + .../external/ionicons-2.0.1/src/checkmark.svg | 10 + .../external/ionicons-2.0.1/src/chevron-down.svg | 9 + .../external/ionicons-2.0.1/src/chevron-left.svg | 9 + .../external/ionicons-2.0.1/src/chevron-right.svg | 9 + .../external/ionicons-2.0.1/src/chevron-up.svg | 9 + .../external/ionicons-2.0.1/src/clipboard.svg | 22 + .../fusion/external/ionicons-2.0.1/src/clock.svg | 21 + .../external/ionicons-2.0.1/src/close-circled.svg | 13 + .../external/ionicons-2.0.1/src/close-round.svg | 9 + .../fusion/external/ionicons-2.0.1/src/close.svg | 10 + .../ionicons-2.0.1/src/closed-captioning.svg | 31 + .../fusion/external/ionicons-2.0.1/src/cloud.svg | 9 + .../external/ionicons-2.0.1/src/code-download.svg | 31 + .../external/ionicons-2.0.1/src/code-working.svg | 21 + .../fusion/external/ionicons-2.0.1/src/code.svg | 14 + .../fusion/external/ionicons-2.0.1/src/coffee.svg | 13 + .../fusion/external/ionicons-2.0.1/src/compass.svg | 16 + .../fusion/external/ionicons-2.0.1/src/compose.svg | 14 + .../ionicons-2.0.1/src/connection-bars.svg | 12 + .../external/ionicons-2.0.1/src/contrast.svg | 9 + .../fusion/external/ionicons-2.0.1/src/crop.svg | 11 + .../fusion/external/ionicons-2.0.1/src/cube.svg | 19 + .../fusion/external/ionicons-2.0.1/src/disc.svg | 13 + .../external/ionicons-2.0.1/src/document-text.svg | 15 + .../external/ionicons-2.0.1/src/document.svg | 10 + .../fusion/external/ionicons-2.0.1/src/drag.svg | 11 + .../fusion/external/ionicons-2.0.1/src/earth.svg | 44 + .../fusion/external/ionicons-2.0.1/src/easel.svg | 15 + .../fusion/external/ionicons-2.0.1/src/edit.svg | 13 + .../app/fusion/external/ionicons-2.0.1/src/egg.svg | 7 + .../fusion/external/ionicons-2.0.1/src/eject.svg | 12 + .../external/ionicons-2.0.1/src/email-unread.svg | 19 + .../fusion/external/ionicons-2.0.1/src/email.svg | 15 + .../src/erlenmeyer-flask-bubbles.svg | 15 + .../ionicons-2.0.1/src/erlenmeyer-flask.svg | 21 + .../external/ionicons-2.0.1/src/eye-disabled.svg | 18 + .../app/fusion/external/ionicons-2.0.1/src/eye.svg | 15 + .../fusion/external/ionicons-2.0.1/src/female.svg | 8 + .../fusion/external/ionicons-2.0.1/src/filing.svg | 12 + .../external/ionicons-2.0.1/src/film-marker.svg | 10 + .../external/ionicons-2.0.1/src/fireball.svg | 16 + .../fusion/external/ionicons-2.0.1/src/flag.svg | 12 + .../fusion/external/ionicons-2.0.1/src/flame.svg | 11 + .../external/ionicons-2.0.1/src/flash-off.svg | 16 + .../fusion/external/ionicons-2.0.1/src/flash.svg | 7 + .../fusion/external/ionicons-2.0.1/src/folder.svg | 14 + .../external/ionicons-2.0.1/src/fork-repo.svg | 20 + .../fusion/external/ionicons-2.0.1/src/fork.svg | 14 + .../fusion/external/ionicons-2.0.1/src/forward.svg | 9 + .../fusion/external/ionicons-2.0.1/src/funnel.svg | 13 + .../fusion/external/ionicons-2.0.1/src/gear-a.svg | 15 + .../fusion/external/ionicons-2.0.1/src/gear-b.svg | 11 + .../fusion/external/ionicons-2.0.1/src/grid.svg | 32 + .../fusion/external/ionicons-2.0.1/src/hammer.svg | 11 + .../external/ionicons-2.0.1/src/happy-outline.svg | 23 + .../fusion/external/ionicons-2.0.1/src/happy.svg | 20 + .../external/ionicons-2.0.1/src/headphone.svg | 15 + .../external/ionicons-2.0.1/src/heart-broken.svg | 17 + .../fusion/external/ionicons-2.0.1/src/heart.svg | 10 + .../external/ionicons-2.0.1/src/help-buoy.svg | 13 + .../external/ionicons-2.0.1/src/help-circled.svg | 15 + .../fusion/external/ionicons-2.0.1/src/help.svg | 14 + .../fusion/external/ionicons-2.0.1/src/home.svg | 9 + .../external/ionicons-2.0.1/src/icecream.svg | 15 + .../fusion/external/ionicons-2.0.1/src/image.svg | 13 + .../fusion/external/ionicons-2.0.1/src/images.svg | 20 + .../ionicons-2.0.1/src/information-circled.svg | 11 + .../external/ionicons-2.0.1/src/information.svg | 10 + .../fusion/external/ionicons-2.0.1/src/ionic.svg | 18 + .../ionicons-2.0.1/src/ios-alarm-outline.svg | 21 + .../external/ionicons-2.0.1/src/ios-alarm.svg | 14 + .../ionicons-2.0.1/src/ios-albums-outline.svg | 11 + .../external/ionicons-2.0.1/src/ios-albums.svg | 11 + .../src/ios-americanfootball-outline.svg | 24 + .../ionicons-2.0.1/src/ios-americanfootball.svg | 21 + .../ionicons-2.0.1/src/ios-analytics-outline.svg | 24 + .../external/ionicons-2.0.1/src/ios-analytics.svg | 17 + .../external/ionicons-2.0.1/src/ios-arrow-back.svg | 7 + .../external/ionicons-2.0.1/src/ios-arrow-down.svg | 7 + .../ionicons-2.0.1/src/ios-arrow-forward.svg | 7 + .../external/ionicons-2.0.1/src/ios-arrow-left.svg | 7 + .../ionicons-2.0.1/src/ios-arrow-right.svg | 7 + .../ionicons-2.0.1/src/ios-arrow-thin-down.svg | 9 + .../ionicons-2.0.1/src/ios-arrow-thin-left.svg | 9 + .../ionicons-2.0.1/src/ios-arrow-thin-right.svg | 9 + .../ionicons-2.0.1/src/ios-arrow-thin-up.svg | 9 + .../external/ionicons-2.0.1/src/ios-arrow-up.svg | 7 + .../external/ionicons-2.0.1/src/ios-at-outline.svg | 26 + .../fusion/external/ionicons-2.0.1/src/ios-at.svg | 24 + .../ionicons-2.0.1/src/ios-barcode-outline.svg | 15 + .../external/ionicons-2.0.1/src/ios-barcode.svg | 10 + .../ionicons-2.0.1/src/ios-baseball-outline.svg | 35 + .../external/ionicons-2.0.1/src/ios-baseball.svg | 27 + .../ionicons-2.0.1/src/ios-basketball-outline.svg | 25 + .../external/ionicons-2.0.1/src/ios-basketball.svg | 21 + .../ionicons-2.0.1/src/ios-bell-outline.svg | 13 + .../external/ionicons-2.0.1/src/ios-bell.svg | 11 + .../ionicons-2.0.1/src/ios-body-outline.svg | 27 + .../external/ionicons-2.0.1/src/ios-body.svg | 17 + .../ionicons-2.0.1/src/ios-bolt-outline.svg | 8 + .../external/ionicons-2.0.1/src/ios-bolt.svg | 7 + .../ionicons-2.0.1/src/ios-book-outline.svg | 13 + .../external/ionicons-2.0.1/src/ios-book.svg | 12 + .../ionicons-2.0.1/src/ios-bookmarks-outline.svg | 13 + .../external/ionicons-2.0.1/src/ios-bookmarks.svg | 13 + .../ionicons-2.0.1/src/ios-box-outline.svg | 13 + .../fusion/external/ionicons-2.0.1/src/ios-box.svg | 10 + .../ionicons-2.0.1/src/ios-briefcase-outline.svg | 11 + .../external/ionicons-2.0.1/src/ios-briefcase.svg | 13 + .../ionicons-2.0.1/src/ios-browsers-outline.svg | 12 + .../external/ionicons-2.0.1/src/ios-browsers.svg | 10 + .../ionicons-2.0.1/src/ios-calculator-outline.svg | 19 + .../external/ionicons-2.0.1/src/ios-calculator.svg | 9 + .../ionicons-2.0.1/src/ios-calendar-outline.svg | 14 + .../external/ionicons-2.0.1/src/ios-calendar.svg | 12 + .../ionicons-2.0.1/src/ios-camera-outline.svg | 17 + .../external/ionicons-2.0.1/src/ios-camera.svg | 13 + .../ionicons-2.0.1/src/ios-cart-outline.svg | 16 + .../external/ionicons-2.0.1/src/ios-cart.svg | 14 + .../ionicons-2.0.1/src/ios-chatboxes-outline.svg | 10 + .../external/ionicons-2.0.1/src/ios-chatboxes.svg | 10 + .../ionicons-2.0.1/src/ios-chatbubble-outline.svg | 14 + .../external/ionicons-2.0.1/src/ios-chatbubble.svg | 11 + .../ionicons-2.0.1/src/ios-checkmark-empty.svg | 10 + .../ionicons-2.0.1/src/ios-checkmark-outline.svg | 14 + .../external/ionicons-2.0.1/src/ios-checkmark.svg | 10 + .../ionicons-2.0.1/src/ios-circle-filled.svg | 18 + .../ionicons-2.0.1/src/ios-circle-outline.svg | 13 + .../ionicons-2.0.1/src/ios-clock-outline.svg | 12 + .../external/ionicons-2.0.1/src/ios-clock.svg | 10 + .../ionicons-2.0.1/src/ios-close-empty.svg | 13 + .../ionicons-2.0.1/src/ios-close-outline.svg | 20 + .../external/ionicons-2.0.1/src/ios-close.svg | 16 + .../src/ios-cloud-download-outline.svg | 19 + .../ionicons-2.0.1/src/ios-cloud-download.svg | 12 + .../ionicons-2.0.1/src/ios-cloud-outline.svg | 12 + .../src/ios-cloud-upload-outline.svg | 20 + .../ionicons-2.0.1/src/ios-cloud-upload.svg | 13 + .../external/ionicons-2.0.1/src/ios-cloud.svg | 9 + .../src/ios-cloudy-night-outline.svg | 24 + .../ionicons-2.0.1/src/ios-cloudy-night.svg | 21 + .../ionicons-2.0.1/src/ios-cloudy-outline.svg | 17 + .../external/ionicons-2.0.1/src/ios-cloudy.svg | 14 + .../ionicons-2.0.1/src/ios-cog-outline.svg | 29 + .../fusion/external/ionicons-2.0.1/src/ios-cog.svg | 23 + .../src/ios-color-filter-outline.svg | 25 + .../ionicons-2.0.1/src/ios-color-filter.svg | 29 + .../ionicons-2.0.1/src/ios-color-wand-outline.svg | 17 + .../external/ionicons-2.0.1/src/ios-color-wand.svg | 16 + .../ionicons-2.0.1/src/ios-compose-outline.svg | 14 + .../external/ionicons-2.0.1/src/ios-compose.svg | 13 + .../ionicons-2.0.1/src/ios-contact-outline.svg | 13 + .../external/ionicons-2.0.1/src/ios-contact.svg | 13 + .../ionicons-2.0.1/src/ios-copy-outline.svg | 11 + .../external/ionicons-2.0.1/src/ios-copy.svg | 12 + .../ionicons-2.0.1/src/ios-crop-strong.svg | 12 + .../external/ionicons-2.0.1/src/ios-crop.svg | 12 + .../ionicons-2.0.1/src/ios-download-outline.svg | 14 + .../external/ionicons-2.0.1/src/ios-download.svg | 11 + .../external/ionicons-2.0.1/src/ios-drag.svg | 11 + .../ionicons-2.0.1/src/ios-email-outline.svg | 8 + .../external/ionicons-2.0.1/src/ios-email.svg | 11 + .../ionicons-2.0.1/src/ios-eye-outline.svg | 18 + .../fusion/external/ionicons-2.0.1/src/ios-eye.svg | 13 + .../ionicons-2.0.1/src/ios-fastforward-outline.svg | 8 + .../ionicons-2.0.1/src/ios-fastforward.svg | 7 + .../ionicons-2.0.1/src/ios-filing-outline.svg | 9 + .../external/ionicons-2.0.1/src/ios-filing.svg | 11 + .../ionicons-2.0.1/src/ios-film-outline.svg | 9 + .../external/ionicons-2.0.1/src/ios-film.svg | 11 + .../ionicons-2.0.1/src/ios-flag-outline.svg | 13 + .../external/ionicons-2.0.1/src/ios-flag.svg | 11 + .../ionicons-2.0.1/src/ios-flame-outline.svg | 14 + .../external/ionicons-2.0.1/src/ios-flame.svg | 11 + .../ionicons-2.0.1/src/ios-flask-outline.svg | 19 + .../external/ionicons-2.0.1/src/ios-flask.svg | 17 + .../ionicons-2.0.1/src/ios-flower-outline.svg | 75 + .../external/ionicons-2.0.1/src/ios-flower.svg | 38 + .../ionicons-2.0.1/src/ios-folder-outline.svg | 11 + .../external/ionicons-2.0.1/src/ios-folder.svg | 13 + .../ionicons-2.0.1/src/ios-football-outline.svg | 20 + .../external/ionicons-2.0.1/src/ios-football.svg | 14 + .../src/ios-game-controller-a-outline.svg | 26 + .../ionicons-2.0.1/src/ios-game-controller-a.svg | 19 + .../src/ios-game-controller-b-outline.svg | 35 + .../ionicons-2.0.1/src/ios-game-controller-b.svg | 23 + .../ionicons-2.0.1/src/ios-gear-outline.svg | 40 + .../external/ionicons-2.0.1/src/ios-gear.svg | 17 + .../ionicons-2.0.1/src/ios-glasses-outline.svg | 12 + .../external/ionicons-2.0.1/src/ios-glasses.svg | 11 + .../ionicons-2.0.1/src/ios-grid-view-outline.svg | 8 + .../external/ionicons-2.0.1/src/ios-grid-view.svg | 11 + .../ionicons-2.0.1/src/ios-heart-outline.svg | 15 + .../external/ionicons-2.0.1/src/ios-heart.svg | 9 + .../external/ionicons-2.0.1/src/ios-help-empty.svg | 12 + .../ionicons-2.0.1/src/ios-help-outline.svg | 22 + .../external/ionicons-2.0.1/src/ios-help.svg | 12 + .../ionicons-2.0.1/src/ios-home-outline.svg | 11 + .../external/ionicons-2.0.1/src/ios-home.svg | 10 + .../ionicons-2.0.1/src/ios-infinite-outline.svg | 17 + .../external/ionicons-2.0.1/src/ios-infinite.svg | 16 + .../ionicons-2.0.1/src/ios-information-empty.svg | 12 + .../ionicons-2.0.1/src/ios-information-outline.svg | 17 + .../ionicons-2.0.1/src/ios-information.svg | 11 + .../ionicons-2.0.1/src/ios-ionic-outline.svg | 18 + .../ionicons-2.0.1/src/ios-keypad-outline.svg | 28 + .../external/ionicons-2.0.1/src/ios-keypad.svg | 20 + .../ionicons-2.0.1/src/ios-lightbulb-outline.svg | 17 + .../external/ionicons-2.0.1/src/ios-lightbulb.svg | 16 + .../ionicons-2.0.1/src/ios-list-outline.svg | 23 + .../external/ionicons-2.0.1/src/ios-list.svg | 11 + .../ionicons-2.0.1/src/ios-location-outline.svg | 14 + .../external/ionicons-2.0.1/src/ios-location.svg | 8 + .../ionicons-2.0.1/src/ios-locked-outline.svg | 14 + .../external/ionicons-2.0.1/src/ios-locked.svg | 12 + .../ionicons-2.0.1/src/ios-loop-strong.svg | 18 + .../external/ionicons-2.0.1/src/ios-loop.svg | 22 + .../ionicons-2.0.1/src/ios-medical-outline.svg | 10 + .../external/ionicons-2.0.1/src/ios-medical.svg | 8 + .../ionicons-2.0.1/src/ios-medkit-outline.svg | 14 + .../external/ionicons-2.0.1/src/ios-medkit.svg | 13 + .../external/ionicons-2.0.1/src/ios-mic-off.svg | 14 + .../ionicons-2.0.1/src/ios-mic-outline.svg | 12 + .../fusion/external/ionicons-2.0.1/src/ios-mic.svg | 12 + .../ionicons-2.0.1/src/ios-minus-empty.svg | 9 + .../ionicons-2.0.1/src/ios-minus-outline.svg | 16 + .../external/ionicons-2.0.1/src/ios-minus.svg | 10 + .../ionicons-2.0.1/src/ios-monitor-outline.svg | 7 + .../external/ionicons-2.0.1/src/ios-monitor.svg | 10 + .../ionicons-2.0.1/src/ios-moon-outline.svg | 15 + .../external/ionicons-2.0.1/src/ios-moon.svg | 13 + .../ionicons-2.0.1/src/ios-more-outline.svg | 14 + .../external/ionicons-2.0.1/src/ios-more.svg | 11 + .../ionicons-2.0.1/src/ios-musical-note.svg | 9 + .../ionicons-2.0.1/src/ios-musical-notes.svg | 9 + .../ionicons-2.0.1/src/ios-navigate-outline.svg | 12 + .../external/ionicons-2.0.1/src/ios-navigate.svg | 10 + .../ionicons-2.0.1/src/ios-nutrition-outline.svg | 29 + .../external/ionicons-2.0.1/src/ios-nutrition.svg | 17 + .../ionicons-2.0.1/src/ios-paper-outline.svg | 14 + .../external/ionicons-2.0.1/src/ios-paper.svg | 8 + .../ionicons-2.0.1/src/ios-paperplane-outline.svg | 8 + .../external/ionicons-2.0.1/src/ios-paperplane.svg | 10 + .../ionicons-2.0.1/src/ios-partlysunny-outline.svg | 33 + .../ionicons-2.0.1/src/ios-partlysunny.svg | 28 + .../ionicons-2.0.1/src/ios-pause-outline.svg | 10 + .../external/ionicons-2.0.1/src/ios-pause.svg | 10 + .../ionicons-2.0.1/src/ios-paw-outline.svg | 43 + .../fusion/external/ionicons-2.0.1/src/ios-paw.svg | 26 + .../ionicons-2.0.1/src/ios-people-outline.svg | 44 + .../external/ionicons-2.0.1/src/ios-people.svg | 29 + .../ionicons-2.0.1/src/ios-person-outline.svg | 22 + .../external/ionicons-2.0.1/src/ios-person.svg | 13 + .../ionicons-2.0.1/src/ios-personadd-outline.svg | 25 + .../external/ionicons-2.0.1/src/ios-personadd.svg | 16 + .../ionicons-2.0.1/src/ios-photos-outline.svg | 10 + .../external/ionicons-2.0.1/src/ios-photos.svg | 10 + .../ionicons-2.0.1/src/ios-pie-outline.svg | 16 + .../fusion/external/ionicons-2.0.1/src/ios-pie.svg | 11 + .../ionicons-2.0.1/src/ios-pint-outline.svg | 17 + .../external/ionicons-2.0.1/src/ios-pint.svg | 12 + .../ionicons-2.0.1/src/ios-play-outline.svg | 9 + .../external/ionicons-2.0.1/src/ios-play.svg | 9 + .../external/ionicons-2.0.1/src/ios-plus-empty.svg | 9 + .../ionicons-2.0.1/src/ios-plus-outline.svg | 18 + .../external/ionicons-2.0.1/src/ios-plus.svg | 10 + .../ionicons-2.0.1/src/ios-pricetag-outline.svg | 11 + .../external/ionicons-2.0.1/src/ios-pricetag.svg | 11 + .../ionicons-2.0.1/src/ios-pricetags-outline.svg | 12 + .../external/ionicons-2.0.1/src/ios-pricetags.svg | 16 + .../ionicons-2.0.1/src/ios-printer-outline.svg | 12 + .../external/ionicons-2.0.1/src/ios-printer.svg | 17 + .../ionicons-2.0.1/src/ios-pulse-strong.svg | 12 + .../external/ionicons-2.0.1/src/ios-pulse.svg | 12 + .../ionicons-2.0.1/src/ios-rainy-outline.svg | 20 + .../external/ionicons-2.0.1/src/ios-rainy.svg | 17 + .../ionicons-2.0.1/src/ios-recording-outline.svg | 15 + .../external/ionicons-2.0.1/src/ios-recording.svg | 14 + .../ionicons-2.0.1/src/ios-redo-outline.svg | 11 + .../external/ionicons-2.0.1/src/ios-redo.svg | 10 + .../ionicons-2.0.1/src/ios-refresh-empty.svg | 10 + .../ionicons-2.0.1/src/ios-refresh-outline.svg | 15 + .../external/ionicons-2.0.1/src/ios-refresh.svg | 11 + .../external/ionicons-2.0.1/src/ios-reload.svg | 11 + .../src/ios-reverse-camera-outline.svg | 20 + .../ionicons-2.0.1/src/ios-reverse-camera.svg | 15 + .../ionicons-2.0.1/src/ios-rewind-outline.svg | 8 + .../external/ionicons-2.0.1/src/ios-rewind.svg | 7 + .../ionicons-2.0.1/src/ios-rose-outline.svg | 29 + .../external/ionicons-2.0.1/src/ios-rose.svg | 18 + .../ionicons-2.0.1/src/ios-search-strong.svg | 10 + .../external/ionicons-2.0.1/src/ios-search.svg | 10 + .../ionicons-2.0.1/src/ios-settings-strong.svg | 14 + .../external/ionicons-2.0.1/src/ios-settings.svg | 24 + .../ionicons-2.0.1/src/ios-shuffle-strong.svg | 18 + .../external/ionicons-2.0.1/src/ios-shuffle.svg | 20 + .../src/ios-skipbackward-outline.svg | 8 + .../ionicons-2.0.1/src/ios-skipbackward.svg | 7 + .../ionicons-2.0.1/src/ios-skipforward-outline.svg | 8 + .../ionicons-2.0.1/src/ios-skipforward.svg | 7 + .../external/ionicons-2.0.1/src/ios-snowy.svg | 26 + .../ionicons-2.0.1/src/ios-speedometer-outline.svg | 24 + .../ionicons-2.0.1/src/ios-speedometer.svg | 28 + .../external/ionicons-2.0.1/src/ios-star-half.svg | 8 + .../ionicons-2.0.1/src/ios-star-outline.svg | 8 + .../external/ionicons-2.0.1/src/ios-star.svg | 7 + .../ionicons-2.0.1/src/ios-stopwatch-outline.svg | 15 + .../external/ionicons-2.0.1/src/ios-stopwatch.svg | 13 + .../ionicons-2.0.1/src/ios-sunny-outline.svg | 27 + .../external/ionicons-2.0.1/src/ios-sunny.svg | 26 + .../ionicons-2.0.1/src/ios-telephone-outline.svg | 17 + .../external/ionicons-2.0.1/src/ios-telephone.svg | 12 + .../ionicons-2.0.1/src/ios-tennisball-outline.svg | 19 + .../external/ionicons-2.0.1/src/ios-tennisball.svg | 25 + .../src/ios-thunderstorm-outline.svg | 22 + .../ionicons-2.0.1/src/ios-thunderstorm.svg | 17 + .../ionicons-2.0.1/src/ios-time-outline.svg | 36 + .../external/ionicons-2.0.1/src/ios-time.svg | 27 + .../ionicons-2.0.1/src/ios-timer-outline.svg | 11 + .../external/ionicons-2.0.1/src/ios-timer.svg | 12 + .../ionicons-2.0.1/src/ios-toggle-outline.svg | 22 + .../external/ionicons-2.0.1/src/ios-toggle.svg | 16 + .../ionicons-2.0.1/src/ios-trash-outline.svg | 17 + .../external/ionicons-2.0.1/src/ios-trash.svg | 12 + .../ionicons-2.0.1/src/ios-undo-outline.svg | 11 + .../external/ionicons-2.0.1/src/ios-undo.svg | 10 + .../ionicons-2.0.1/src/ios-unlocked-outline.svg | 14 + .../external/ionicons-2.0.1/src/ios-unlocked.svg | 12 + .../ionicons-2.0.1/src/ios-upload-outline.svg | 14 + .../external/ionicons-2.0.1/src/ios-upload.svg | 10 + .../ionicons-2.0.1/src/ios-videocam-outline.svg | 12 + .../external/ionicons-2.0.1/src/ios-videocam.svg | 11 + .../ionicons-2.0.1/src/ios-volume-high.svg | 19 + .../external/ionicons-2.0.1/src/ios-volume-low.svg | 7 + .../ionicons-2.0.1/src/ios-wineglass-outline.svg | 15 + .../external/ionicons-2.0.1/src/ios-wineglass.svg | 11 + .../ionicons-2.0.1/src/ios-world-outline.svg | 22 + .../external/ionicons-2.0.1/src/ios-world.svg | 29 + .../fusion/external/ionicons-2.0.1/src/ipad.svg | 10 + .../fusion/external/ionicons-2.0.1/src/iphone.svg | 13 + .../fusion/external/ionicons-2.0.1/src/ipod.svg | 13 + .../app/fusion/external/ionicons-2.0.1/src/jet.svg | 14 + .../app/fusion/external/ionicons-2.0.1/src/key.svg | 14 + .../fusion/external/ionicons-2.0.1/src/knife.svg | 9 + .../fusion/external/ionicons-2.0.1/src/laptop.svg | 10 + .../fusion/external/ionicons-2.0.1/src/leaf.svg | 12 + .../fusion/external/ionicons-2.0.1/src/levels.svg | 16 + .../external/ionicons-2.0.1/src/lightbulb.svg | 21 + .../fusion/external/ionicons-2.0.1/src/link.svg | 15 + .../fusion/external/ionicons-2.0.1/src/load-a.svg | 17 + .../fusion/external/ionicons-2.0.1/src/load-b.svg | 20 + .../fusion/external/ionicons-2.0.1/src/load-c.svg | 21 + .../fusion/external/ionicons-2.0.1/src/load-d.svg | 28 + .../external/ionicons-2.0.1/src/location.svg | 11 + .../ionicons-2.0.1/src/lock-combination.svg | 28 + .../fusion/external/ionicons-2.0.1/src/locked.svg | 11 + .../fusion/external/ionicons-2.0.1/src/log-in.svg | 14 + .../fusion/external/ionicons-2.0.1/src/log-out.svg | 17 + .../fusion/external/ionicons-2.0.1/src/loop.svg | 14 + .../fusion/external/ionicons-2.0.1/src/magnet.svg | 14 + .../fusion/external/ionicons-2.0.1/src/male.svg | 10 + .../app/fusion/external/ionicons-2.0.1/src/man.svg | 12 + .../app/fusion/external/ionicons-2.0.1/src/map.svg | 30 + .../fusion/external/ionicons-2.0.1/src/medkit.svg | 12 + .../fusion/external/ionicons-2.0.1/src/merge.svg | 13 + .../fusion/external/ionicons-2.0.1/src/mic-a.svg | 15 + .../fusion/external/ionicons-2.0.1/src/mic-b.svg | 17 + .../fusion/external/ionicons-2.0.1/src/mic-c.svg | 8 + .../external/ionicons-2.0.1/src/minus-circled.svg | 9 + .../external/ionicons-2.0.1/src/minus-round.svg | 8 + .../fusion/external/ionicons-2.0.1/src/minus.svg | 7 + .../fusion/external/ionicons-2.0.1/src/model-s.svg | 33 + .../fusion/external/ionicons-2.0.1/src/monitor.svg | 12 + .../fusion/external/ionicons-2.0.1/src/more.svg | 12 + .../fusion/external/ionicons-2.0.1/src/mouse.svg | 24 + .../external/ionicons-2.0.1/src/music-note.svg | 10 + .../external/ionicons-2.0.1/src/navicon-round.svg | 14 + .../fusion/external/ionicons-2.0.1/src/navicon.svg | 11 + .../external/ionicons-2.0.1/src/navigate.svg | 7 + .../fusion/external/ionicons-2.0.1/src/network.svg | 12 + .../external/ionicons-2.0.1/src/no-smoking.svg | 33 + .../fusion/external/ionicons-2.0.1/src/nuclear.svg | 18 + .../fusion/external/ionicons-2.0.1/src/outlet.svg | 16 + .../external/ionicons-2.0.1/src/paintbrush.svg | 18 + .../external/ionicons-2.0.1/src/paintbucket.svg | 12 + .../external/ionicons-2.0.1/src/paper-airplane.svg | 13 + .../external/ionicons-2.0.1/src/paperclip.svg | 13 + .../fusion/external/ionicons-2.0.1/src/pause.svg | 12 + .../external/ionicons-2.0.1/src/person-add.svg | 13 + .../external/ionicons-2.0.1/src/person-stalker.svg | 18 + .../fusion/external/ionicons-2.0.1/src/person.svg | 10 + .../external/ionicons-2.0.1/src/pie-graph.svg | 11 + .../app/fusion/external/ionicons-2.0.1/src/pin.svg | 11 + .../external/ionicons-2.0.1/src/pinpoint.svg | 11 + .../fusion/external/ionicons-2.0.1/src/pizza.svg | 20 + .../fusion/external/ionicons-2.0.1/src/plane.svg | 10 + .../fusion/external/ionicons-2.0.1/src/planet.svg | 21 + .../fusion/external/ionicons-2.0.1/src/play.svg | 8 + .../external/ionicons-2.0.1/src/playstation.svg | 27 + .../external/ionicons-2.0.1/src/plus-circled.svg | 10 + .../external/ionicons-2.0.1/src/plus-round.svg | 9 + .../fusion/external/ionicons-2.0.1/src/plus.svg | 7 + .../fusion/external/ionicons-2.0.1/src/podium.svg | 11 + .../fusion/external/ionicons-2.0.1/src/pound.svg | 11 + .../fusion/external/ionicons-2.0.1/src/power.svg | 15 + .../external/ionicons-2.0.1/src/pricetag.svg | 13 + .../external/ionicons-2.0.1/src/pricetags.svg | 18 + .../fusion/external/ionicons-2.0.1/src/printer.svg | 14 + .../external/ionicons-2.0.1/src/pull-request.svg | 16 + .../external/ionicons-2.0.1/src/qr-scanner.svg | 12 + .../fusion/external/ionicons-2.0.1/src/quote.svg | 16 + .../external/ionicons-2.0.1/src/radio-waves.svg | 25 + .../fusion/external/ionicons-2.0.1/src/record.svg | 7 + .../fusion/external/ionicons-2.0.1/src/refresh.svg | 15 + .../external/ionicons-2.0.1/src/reply-all.svg | 12 + .../fusion/external/ionicons-2.0.1/src/reply.svg | 9 + .../external/ionicons-2.0.1/src/ribbon-a.svg | 14 + .../external/ionicons-2.0.1/src/ribbon-b.svg | 18 + .../external/ionicons-2.0.1/src/sad-outline.svg | 28 + .../app/fusion/external/ionicons-2.0.1/src/sad.svg | 20 + .../external/ionicons-2.0.1/src/scissors.svg | 23 + .../fusion/external/ionicons-2.0.1/src/search.svg | 10 + .../external/ionicons-2.0.1/src/settings.svg | 18 + .../fusion/external/ionicons-2.0.1/src/share.svg | 11 + .../fusion/external/ionicons-2.0.1/src/shuffle.svg | 11 + .../external/ionicons-2.0.1/src/skip-backward.svg | 15 + .../external/ionicons-2.0.1/src/skip-forward.svg | 15 + .../ionicons-2.0.1/src/social-android-outline.svg | 29 + .../external/ionicons-2.0.1/src/social-android.svg | 22 + .../ionicons-2.0.1/src/social-angular-outline.svg | 11 + .../external/ionicons-2.0.1/src/social-angular.svg | 11 + .../ionicons-2.0.1/src/social-apple-outline.svg | 20 + .../external/ionicons-2.0.1/src/social-apple.svg | 14 + .../ionicons-2.0.1/src/social-bitcoin-outline.svg | 27 + .../external/ionicons-2.0.1/src/social-bitcoin.svg | 14 + .../ionicons-2.0.1/src/social-buffer-outline.svg | 24 + .../external/ionicons-2.0.1/src/social-buffer.svg | 18 + .../ionicons-2.0.1/src/social-chrome-outline.svg | 17 + .../external/ionicons-2.0.1/src/social-chrome.svg | 22 + .../ionicons-2.0.1/src/social-codepen-outline.svg | 26 + .../external/ionicons-2.0.1/src/social-codepen.svg | 26 + .../ionicons-2.0.1/src/social-css3-outline.svg | 12 + .../external/ionicons-2.0.1/src/social-css3.svg | 14 + .../src/social-designernews-outline.svg | 18 + .../ionicons-2.0.1/src/social-designernews.svg | 18 + .../ionicons-2.0.1/src/social-dribbble-outline.svg | 15 + .../ionicons-2.0.1/src/social-dribbble.svg | 26 + .../ionicons-2.0.1/src/social-dropbox-outline.svg | 13 + .../external/ionicons-2.0.1/src/social-dropbox.svg | 13 + .../ionicons-2.0.1/src/social-euro-outline.svg | 19 + .../external/ionicons-2.0.1/src/social-euro.svg | 12 + .../ionicons-2.0.1/src/social-facebook-outline.svg | 9 + .../ionicons-2.0.1/src/social-facebook.svg | 8 + .../src/social-foursquare-outline.svg | 22 + .../ionicons-2.0.1/src/social-foursquare.svg | 20 + .../ionicons-2.0.1/src/social-freebsd-devil.svg | 22 + .../ionicons-2.0.1/src/social-github-outline.svg | 24 + .../external/ionicons-2.0.1/src/social-github.svg | 14 + .../ionicons-2.0.1/src/social-google-outline.svg | 19 + .../external/ionicons-2.0.1/src/social-google.svg | 20 + .../src/social-googleplus-outline.svg | 18 + .../ionicons-2.0.1/src/social-googleplus.svg | 17 + .../src/social-hackernews-outline.svg | 12 + .../ionicons-2.0.1/src/social-hackernews.svg | 9 + .../ionicons-2.0.1/src/social-html5-outline.svg | 13 + .../external/ionicons-2.0.1/src/social-html5.svg | 9 + .../src/social-instagram-outline.svg | 12 + .../ionicons-2.0.1/src/social-instagram.svg | 18 + .../src/social-javascript-outline.svg | 27 + .../ionicons-2.0.1/src/social-javascript.svg | 17 + .../ionicons-2.0.1/src/social-linkedin-outline.svg | 22 + .../ionicons-2.0.1/src/social-linkedin.svg | 13 + .../ionicons-2.0.1/src/social-markdown.svg | 14 + .../external/ionicons-2.0.1/src/social-nodejs.svg | 26 + .../external/ionicons-2.0.1/src/social-octocat.svg | 28 + .../src/social-pinterest-outline.svg | 14 + .../ionicons-2.0.1/src/social-pinterest.svg | 15 + .../external/ionicons-2.0.1/src/social-python.svg | 21 + .../ionicons-2.0.1/src/social-reddit-outline.svg | 26 + .../external/ionicons-2.0.1/src/social-reddit.svg | 18 + .../ionicons-2.0.1/src/social-rss-outline.svg | 16 + .../external/ionicons-2.0.1/src/social-rss.svg | 12 + .../external/ionicons-2.0.1/src/social-sass.svg | 35 + .../ionicons-2.0.1/src/social-skype-outline.svg | 26 + .../external/ionicons-2.0.1/src/social-skype.svg | 20 + .../ionicons-2.0.1/src/social-snapchat-outline.svg | 42 + .../ionicons-2.0.1/src/social-snapchat.svg | 31 + .../ionicons-2.0.1/src/social-tumblr-outline.svg | 13 + .../external/ionicons-2.0.1/src/social-tumblr.svg | 10 + .../external/ionicons-2.0.1/src/social-tux.svg | 53 + .../ionicons-2.0.1/src/social-twitch-outline.svg | 13 + .../external/ionicons-2.0.1/src/social-twitch.svg | 9 + .../ionicons-2.0.1/src/social-twitter-outline.svg | 19 + .../external/ionicons-2.0.1/src/social-twitter.svg | 12 + .../ionicons-2.0.1/src/social-usd-outline.svg | 44 + .../external/ionicons-2.0.1/src/social-usd.svg | 24 + .../ionicons-2.0.1/src/social-vimeo-outline.svg | 23 + .../external/ionicons-2.0.1/src/social-vimeo.svg | 18 + .../ionicons-2.0.1/src/social-whatsapp-outline.svg | 25 + .../ionicons-2.0.1/src/social-whatsapp.svg | 18 + .../ionicons-2.0.1/src/social-windows-outline.svg | 17 + .../external/ionicons-2.0.1/src/social-windows.svg | 17 + .../src/social-wordpress-outline.svg | 16 + .../ionicons-2.0.1/src/social-wordpress.svg | 20 + .../ionicons-2.0.1/src/social-yahoo-outline.svg | 10 + .../external/ionicons-2.0.1/src/social-yahoo.svg | 8 + .../ionicons-2.0.1/src/social-yen-outline.svg | 9 + .../external/ionicons-2.0.1/src/social-yen.svg | 8 + .../ionicons-2.0.1/src/social-youtube-outline.svg | 22 + .../external/ionicons-2.0.1/src/social-youtube.svg | 12 + .../ionicons-2.0.1/src/soup-can-outline.svg | 28 + .../external/ionicons-2.0.1/src/soup-can.svg | 16 + .../external/ionicons-2.0.1/src/speakerphone.svg | 19 + .../external/ionicons-2.0.1/src/speedometer.svg | 15 + .../fusion/external/ionicons-2.0.1/src/spoon.svg | 10 + .../fusion/external/ionicons-2.0.1/src/star.svg | 7 + .../external/ionicons-2.0.1/src/stats-bars.svg | 12 + .../fusion/external/ionicons-2.0.1/src/steam.svg | 20 + .../fusion/external/ionicons-2.0.1/src/stop.svg | 8 + .../external/ionicons-2.0.1/src/thermometer.svg | 11 + .../external/ionicons-2.0.1/src/thumbsdown.svg | 13 + .../external/ionicons-2.0.1/src/thumbsup.svg | 13 + .../external/ionicons-2.0.1/src/toggle-filled.svg | 11 + .../fusion/external/ionicons-2.0.1/src/toggle.svg | 12 + .../external/ionicons-2.0.1/src/transgender.svg | 12 + .../fusion/external/ionicons-2.0.1/src/trash-a.svg | 10 + .../fusion/external/ionicons-2.0.1/src/trash-b.svg | 13 + .../fusion/external/ionicons-2.0.1/src/trophy.svg | 16 + .../external/ionicons-2.0.1/src/tshirt-outline.svg | 11 + .../fusion/external/ionicons-2.0.1/src/tshirt.svg | 8 + .../external/ionicons-2.0.1/src/umbrella.svg | 18 + .../external/ionicons-2.0.1/src/university.svg | 11 + .../external/ionicons-2.0.1/src/unlocked.svg | 10 + .../fusion/external/ionicons-2.0.1/src/upload.svg | 9 + .../app/fusion/external/ionicons-2.0.1/src/usb.svg | 22 + .../external/ionicons-2.0.1/src/videocamera.svg | 11 + .../external/ionicons-2.0.1/src/volume-high.svg | 15 + .../external/ionicons-2.0.1/src/volume-low.svg | 11 + .../external/ionicons-2.0.1/src/volume-medium.svg | 13 + .../external/ionicons-2.0.1/src/volume-mute.svg | 14 + .../fusion/external/ionicons-2.0.1/src/wand.svg | 17 + .../external/ionicons-2.0.1/src/waterdrop.svg | 11 + .../fusion/external/ionicons-2.0.1/src/wifi.svg | 16 + .../external/ionicons-2.0.1/src/wineglass.svg | 21 + .../fusion/external/ionicons-2.0.1/src/woman.svg | 13 + .../fusion/external/ionicons-2.0.1/src/wrench.svg | 11 + .../fusion/external/ionicons-2.0.1/src/xbox.svg | 21 + .../app/fusion/external/utils/js/browserCheck.js | 24 + .../scripts/controllers/nbook-framecontroller.js | 34 + .../scripts/controllers/nbookController.js | 179 + .../scripts/controllers/notebookFrameController.js | 65 + .../scripts/dependency/angular.js | 29400 +++++++++++++ .../scripts/view-models/notebook-frame.html | 85 + .../scripts/view-models/notebook-viz.html | 26 + .../scripts/view-models/notebook.htm | 54 + .../scripts/view-models/notebookInputs.html | 90 + .../att_angular_gridster/angular-gridster.js | 2244 + .../att_angular_gridster/ui-gridster-tpls.js | 168 + .../fusion/scripts/controllers/adminController.js | 65 + .../fusion/scripts/controllers/admin_menu_edit.js | 230 + .../fusion/scripts/controllers/ase-controller.js | 22 + .../scripts/controllers/broadcast-controller.js | 79 + .../controllers/broadcast-list-controller.js | 120 + .../controllers/collaborate-list-controller.js | 63 + .../app/fusion/scripts/controllers/dummy.txt | 0 .../controllers/fn_menu_add_popup_controller.js | 281 + .../scripts/controllers/jcs-admin-controller.js | 83 + .../scripts/controllers/modelpopupController.js | 40 + .../scripts/controllers/post-search-controller.js | 202 + .../scripts/controllers/profile-controller.js | 286 + .../controllers/profile-search-controller.js | 80 + .../scripts/controllers/profileController.js | 38 + .../fusion/scripts/controllers/role-controller.js | 226 + .../controllers/role-function-list-controller.js | 157 + .../scripts/controllers/role-list-controller.js | 102 + .../controllers/rolefunctionpopupController.js | 84 + .../controllers/rolepopupmodelController.js | 205 + .../scripts/controllers/self-profile-controller.js | 284 + .../scripts/controllers/usage-list-controller.js | 41 + .../scripts/controllers/workflows/workflowApp.js | 24 + .../controllers/workflows/workflowController.js | 509 + .../controllers/workflows/workflowRouting.js | 26 + .../webapp/app/fusion/scripts/directives/dummy.txt | 0 .../webapp/app/fusion/scripts/directives/footer.js | 30 + .../webapp/app/fusion/scripts/directives/header.js | 504 + .../app/fusion/scripts/directives/leftMenu.js | 203 + .../webapp/app/fusion/scripts/jquery.resize.js | 139 + .../main/webapp/app/fusion/scripts/layout/debug.js | 329 + .../app/fusion/scripts/layout/jquery-latest.js | 9555 +++++ .../app/fusion/scripts/layout/jquery-ui-latest.js | 14879 +++++++ .../fusion/scripts/layout/jquery.layout-latest.js | 6086 +++ .../main/webapp/app/fusion/scripts/modalService.js | 185 + .../main/webapp/app/fusion/scripts/moment.min.js | 6 + .../app/fusion/scripts/services/adminService.js | 160 + .../app/fusion/scripts/services/headerService.js | 89 + .../app/fusion/scripts/services/leftMenuService.js | 54 + .../app/fusion/scripts/services/profileService.js | 98 + .../app/fusion/scripts/services/userInfoService.js | 51 + .../app/fusion/scripts/socket/peerBroadcast.js | 122 + .../main/webapp/app/fusion/scripts/utils/dummy.txt | 0 .../app/fusion/scripts/utils/page-resource.js | 95 + .../fusion/scripts/utils/sandbox-resources.html | 9 + .../scripts/view-models/admin-page/admin.html | 115 + .../scripts/view-models/admin-page/profile.html | 50 + .../app/fusion/scripts/view-models/dummy.txt | 0 .../app/fusion/scripts/view-models/footer.html | 42 + .../app/fusion/scripts/view-models/header.html | 186 + .../app/fusion/scripts/view-models/left_menu.html | 41 + .../view-models/profile-page/admin_menu_edit.html | 175 + .../view-models/profile-page/broadcast.html | 61 + .../view-models/profile-page/broadcast_list.html | 71 + .../view-models/profile-page/collaborate_list.html | 57 + .../view-models/profile-page/jcs_admin.html | 87 + .../view-models/profile-page/popup_modal.html | 282 + .../profile-page/popup_modal_fn_menu_add.html | 155 + .../profile-page/popup_modal_fn_menu_edit.html | 148 + .../view-models/profile-page/popup_modal_role.html | 82 + .../profile-page/popup_modal_rolefunction.html | 46 + .../view-models/profile-page/post_search.html | 139 + .../view-models/profile-page/profile_detail.html | 188 + .../view-models/profile-page/profile_search.html | 72 + .../scripts/view-models/profile-page/role.html | 118 + .../profile-page/role_function_list.html | 88 + .../view-models/profile-page/role_list.html | 61 + .../view-models/profile-page/self_profile.html | 183 + .../view-models/profile-page/usage_list.html | 64 + .../view-models/workflows/workflow-landing.html | 130 + .../view-models/workflows/workflow-listing.html | 85 + .../view-models/workflows/workflow-new.html | 108 + .../view-models/workflows/workflow-preview.html | 36 + .../view-models/workflows/workflow-remove.html | 38 + .../view-models/workflows/workflow-schedule.html | 116 + .../fusion/scripts/webrtc/RTCMultiConnection.js | 6788 +++ .../app/fusion/scripts/webrtc/getSourceId.html | 78 + .../att_angular_gridster/sandbox-gridster.css | 173 + .../styles/att_angular_gridster/ui-gridster.css | 116 + .../main/webapp/app/fusion/styles/fusion-sunny.css | 362 + .../main/webapp/app/fusion/styles/jquery-ui.css | 1225 + .../fusion/styles/layout/layout-default-latest.css | 224 + .../app/fusion/styles/workflows/workflows.css | 50 + .../drools/controller/drools-list-controller.js | 62 + .../drools/controller/drools-view-controller.js | 64 + .../drools/controller/droolsController.js | 30 + .../app/fusionapp/drools/controller/dummy.txt | 0 .../app/fusionapp/drools/directives/dummy.txt | 0 .../app/fusionapp/drools/services/droolsService.js | 76 + .../webapp/app/fusionapp/drools/utils/dummy.txt | 0 .../fusionapp/drools/view-models/droolsList.html | 47 + .../drools/view-models/droolsSinglePage.html | 92 + .../fusionapp/drools/view-models/droolsView.html | 61 + .../app/fusionapp/drools/view-models/dummy.txt | 0 .../main/webapp/app/fusionapp/external/dummy.txt | 0 .../src/main/webapp/app/fusionapp/fonts/dummy.txt | 0 .../src/main/webapp/app/fusionapp/images/dummy.txt | 0 .../app/fusionapp/scripts/controller/dummy.txt | 0 .../scripts/controller/sample-page-controller.js | 80 + .../controller/sample-page-iframe-controller.js | 23 + .../scripts/controller/sampleController.js | 30 + .../app/fusionapp/scripts/directives/dummy.txt | 0 .../webapp/app/fusionapp/scripts/utils/dummy.txt | 0 .../app/fusionapp/scripts/view-models/dummy.txt | 0 .../app/fusionapp/scripts/view-models/sample.html | 60 + .../scripts/view-models/sampleWithIframe.html | 22 + .../scripts/view-models/singlePageSample.html | 87 + .../src/main/webapp/app/fusionapp/styles/dummy.txt | 0 ecomp-sdk/sdk-app/src/main/webapp/index.jsp | 24 + ecomp-sdk/sdk-app/src/main/webapp/manifest.jsp | 47 + .../css/att_angular_gridster/sandbox-gridster.css | 173 + .../css/att_angular_gridster/ui-gridster.css | 116 + .../main/webapp/static/fusion/css/fusion-sunny.css | 362 + .../main/webapp/static/fusion/css/jquery-ui.css | 1225 + .../fusion/css/layout/layout-default-latest.css | 224 + .../src/main/webapp/static/fusion/d3/css/nv.d3.css | 656 + .../src/main/webapp/static/fusion/d3/js/cie.js | 155 + .../main/webapp/static/fusion/d3/js/colorbrewer.js | 302 + .../src/main/webapp/static/fusion/d3/js/core.js | 122 + .../main/webapp/static/fusion/d3/js/crossfilter.js | 1180 + .../webapp/static/fusion/d3/js/crossfilter.min.js | 1 + .../src/main/webapp/static/fusion/d3/js/d3.geom.js | 816 + .../src/main/webapp/static/fusion/d3/js/d3.js | 5 + .../webapp/static/fusion/d3/js/d3.layout.cloud.js | 433 + .../main/webapp/static/fusion/d3/js/d3.layout.js | 908 + .../src/main/webapp/static/fusion/d3/js/d3.v2.js | 7037 ++++ .../main/webapp/static/fusion/d3/js/d3.v2.min.js | 4 + .../main/webapp/static/fusion/d3/js/d3.v3.min.js | 1 + .../src/main/webapp/static/fusion/d3/js/fisheye.js | 86 + .../src/main/webapp/static/fusion/d3/js/hive.js | 80 + .../src/main/webapp/static/fusion/d3/js/horizon.js | 192 + .../webapp/static/fusion/d3/js/interactiveLayer.js | 251 + .../src/main/webapp/static/fusion/d3/js/intro.js | 1 + .../webapp/static/fusion/d3/js/models/axis-min.js | 1 + .../main/webapp/static/fusion/d3/js/models/axis.js | 470 + .../webapp/static/fusion/d3/js/models/axis.min.js | 1 + .../static/fusion/d3/js/models/backup/bullet.js | 250 + .../fusion/d3/js/models/backup/bulletChart.js | 349 + .../static/fusion/d3/js/models/boilerplate.js | 104 + .../webapp/static/fusion/d3/js/models/bullet.js | 385 + .../static/fusion/d3/js/models/bulletChart.js | 343 + .../fusion/d3/js/models/cumulativeLineChart.js | 782 + .../static/fusion/d3/js/models/discreteBar.js | 349 + .../static/fusion/d3/js/models/discreteBarChart.js | 333 + .../static/fusion/d3/js/models/distribution.js | 148 + .../static/fusion/d3/js/models/historicalBar.js | 331 + .../fusion/d3/js/models/historicalBarChart.js | 419 + .../static/fusion/d3/js/models/indentedTree.js | 337 + .../webapp/static/fusion/d3/js/models/legend.js | 270 + .../main/webapp/static/fusion/d3/js/models/line.js | 284 + .../webapp/static/fusion/d3/js/models/lineChart.js | 465 + .../static/fusion/d3/js/models/linePlusBarChart.js | 433 + .../d3/js/models/linePlusBarWithFocusChart.js | 658 + .../static/fusion/d3/js/models/lineWithFisheye.js | 200 + .../fusion/d3/js/models/lineWithFisheyeChart.js | 297 + .../fusion/d3/js/models/lineWithFocusChart.js | 574 + .../webapp/static/fusion/d3/js/models/multiBar.js | 461 + .../static/fusion/d3/js/models/multiBarChart.js | 524 + .../fusion/d3/js/models/multiBarHorizontal.js | 424 + .../fusion/d3/js/models/multiBarHorizontalChart.js | 434 + .../fusion/d3/js/models/multiBarTimeSeries.js | 384 + .../fusion/d3/js/models/multiBarTimeSeriesChart.js | 405 + .../static/fusion/d3/js/models/multiChart.js | 452 + .../webapp/static/fusion/d3/js/models/ohlcBar.js | 380 + .../fusion/d3/js/models/parallelCoordinates.js | 239 + .../main/webapp/static/fusion/d3/js/models/pie.js | 400 + .../webapp/static/fusion/d3/js/models/pieChart.js | 292 + .../webapp/static/fusion/d3/js/models/scatter.js | 674 + .../static/fusion/d3/js/models/scatterChart.js | 628 + .../fusion/d3/js/models/scatterPlusLineChart.js | 620 + .../webapp/static/fusion/d3/js/models/sparkline.js | 194 + .../static/fusion/d3/js/models/sparklinePlus.js | 295 + .../static/fusion/d3/js/models/stackedArea.js | 368 + .../static/fusion/d3/js/models/stackedAreaChart.js | 629 + .../src/main/webapp/static/fusion/d3/js/nv.d3.js | 13097 ++++++ .../main/webapp/static/fusion/d3/js/nv.d3.min.js | 1 + .../src/main/webapp/static/fusion/d3/js/outro.js | 1 + .../src/main/webapp/static/fusion/d3/js/sankey.js | 292 + .../src/main/webapp/static/fusion/d3/js/tooltip.js | 490 + .../src/main/webapp/static/fusion/d3/js/utils.js | 152 + .../src/main/webapp/static/fusion/images/Rlogo.jpg | Bin 0 -> 3173 bytes .../src/main/webapp/static/fusion/images/Thumbs.db | Bin 0 -> 102912 bytes .../webapp/static/fusion/images/action_icon.png | Bin 0 -> 2388 bytes .../static/fusion/images/action_list_spacer.gif | Bin 0 -> 73 bytes .../main/webapp/static/fusion/images/active.png | Bin 0 -> 682 bytes .../src/main/webapp/static/fusion/images/add.png | Bin 0 -> 352 bytes .../static/fusion/images/add_tool_button.png | Bin 0 -> 31105 bytes .../main/webapp/static/fusion/images/addicon.png | Bin 0 -> 463 bytes .../static/fusion/images/application_window_bg.jpg | Bin 0 -> 914 bytes .../webapp/static/fusion/images/arrow-next.png | Bin 0 -> 1561 bytes .../webapp/static/fusion/images/arrow-prev.png | Bin 0 -> 1557 bytes .../fusion/images/att_angular_gridster/grips.png | Bin 0 -> 951 bytes .../webapp/static/fusion/images/backButton.png | Bin 0 -> 816 bytes .../src/main/webapp/static/fusion/images/blank.gif | Bin 0 -> 49 bytes .../webapp/static/fusion/images/blueButton.png | Bin 0 -> 1468 bytes .../main/webapp/static/fusion/images/bubble.png | Bin 0 -> 662 bytes .../src/main/webapp/static/fusion/images/cache.png | Bin 0 -> 1081 bytes .../main/webapp/static/fusion/images/calendar.gif | Bin 0 -> 929 bytes .../main/webapp/static/fusion/images/chevron.png | Bin 0 -> 252 bytes .../static/fusion/images/close_container.gif | Bin 0 -> 85 bytes .../webapp/static/fusion/images/collapsed-icon.png | Bin 0 -> 1379 bytes .../main/webapp/static/fusion/images/column-bg.png | Bin 0 -> 165 bytes .../static/fusion/images/copyicon-highlighted.png | Bin 0 -> 264 bytes .../main/webapp/static/fusion/images/copyicon.png | Bin 0 -> 235 bytes .../main/webapp/static/fusion/images/csv_icon.jpg | Bin 0 -> 632 bytes .../main/webapp/static/fusion/images/csv_icon.png | Bin 0 -> 938 bytes .../webapp/static/fusion/images/customers-add.png | Bin 0 -> 755 bytes .../static/fusion/images/customers-search.png | Bin 0 -> 976 bytes .../main/webapp/static/fusion/images/customers.png | Bin 0 -> 749 bytes .../main/webapp/static/fusion/images/decrypted.png | Bin 0 -> 628 bytes .../fusion/images/deleteicon-highlighted.gif | Bin 0 -> 592 bytes .../fusion/images/deleteicon-highlighted.png | Bin 0 -> 566 bytes .../webapp/static/fusion/images/deleteicon.gif | Bin 0 -> 579 bytes .../src/main/webapp/static/fusion/images/ecomp.png | Bin 0 -> 107597 bytes .../webapp/static/fusion/images/ecomp_trans.png | Bin 0 -> 109926 bytes .../main/webapp/static/fusion/images/editicon.gif | Bin 0 -> 360 bytes .../webapp/static/fusion/images/error_type.gif | Bin 0 -> 398 bytes .../webapp/static/fusion/images/example-frame.png | Bin 0 -> 33699 bytes .../static/fusion/images/excelicon_multi.gif | Bin 0 -> 1028 bytes .../webapp/static/fusion/images/executeicon.png | Bin 0 -> 1076 bytes .../webapp/static/fusion/images/expanded-icon.png | Bin 0 -> 1372 bytes .../main/webapp/static/fusion/images/file-add.png | Bin 0 -> 675 bytes .../webapp/static/fusion/images/file_import.png | Bin 0 -> 653 bytes .../webapp/static/fusion/images/file_save-all.png | Bin 0 -> 610 bytes .../webapp/static/fusion/images/filter_icon.png | Bin 0 -> 29069 bytes .../webapp/static/fusion/images/folder_add.png | Bin 0 -> 772 bytes .../webapp/static/fusion/images/folder_closed.png | Bin 0 -> 559 bytes .../webapp/static/fusion/images/folder_delete.png | Bin 0 -> 767 bytes .../webapp/static/fusion/images/folder_edit.png | Bin 0 -> 829 bytes .../webapp/static/fusion/images/folder_open.png | Bin 0 -> 632 bytes .../webapp/static/fusion/images/folder_user.png | Bin 0 -> 887 bytes .../main/webapp/static/fusion/images/funnel.png | Bin 0 -> 543 bytes .../main/webapp/static/fusion/images/fusion.gif | Bin 0 -> 8821 bytes .../webapp/static/fusion/images/grayButton.png | Bin 0 -> 1361 bytes .../static/fusion/images/gray_add_tool_button.png | Bin 0 -> 30883 bytes .../webapp/static/fusion/images/headerChatIcon.png | Bin 0 -> 465 bytes .../static/fusion/images/icon_remove_all.gif | Bin 0 -> 982 bytes .../main/webapp/static/fusion/images/inactive.png | Bin 0 -> 842 bytes .../main/webapp/static/fusion/images/info_type.gif | Bin 0 -> 291 bytes .../webapp/static/fusion/images/leftButton.png | Bin 0 -> 681 bytes .../main/webapp/static/fusion/images/loading.gif | Bin 0 -> 6820 bytes .../webapp/static/fusion/images/loading_bar.gif | Bin 0 -> 28954 bytes .../webapp/static/fusion/images/login_button.gif | Bin 0 -> 1222 bytes .../src/main/webapp/static/fusion/images/m1.gif | Bin 0 -> 636 bytes .../src/main/webapp/static/fusion/images/mail.png | Bin 0 -> 449 bytes .../src/main/webapp/static/fusion/images/map.png | Bin 0 -> 611 bytes .../src/main/webapp/static/fusion/images/minus.gif | Bin 0 -> 75 bytes .../webapp/static/fusion/images/modify_icon.gif | Bin 0 -> 246 bytes .../static/fusion/images/no_favorites_star.png | Bin 0 -> 2794 bytes .../main/webapp/static/fusion/images/note-add.png | Bin 0 -> 589 bytes .../webapp/static/fusion/images/note-search.png | Bin 0 -> 876 bytes .../src/main/webapp/static/fusion/images/note.png | Bin 0 -> 583 bytes .../src/main/webapp/static/fusion/images/notes.png | Bin 0 -> 673 bytes .../main/webapp/static/fusion/images/offline.png | Bin 0 -> 3483 bytes .../webapp/static/fusion/images/offlineMsg.gif | Bin 0 -> 1004 bytes .../main/webapp/static/fusion/images/online.png | Bin 0 -> 888 bytes .../src/main/webapp/static/fusion/images/page.gif | Bin 0 -> 131 bytes .../webapp/static/fusion/images/pagination.png | Bin 0 -> 724 bytes .../static/fusion/images/panel-e-w-toggle.png | Bin 0 -> 459 bytes .../static/fusion/images/panel-n-s-toggle.png | Bin 0 -> 335 bytes .../src/main/webapp/static/fusion/images/pix.gif | Bin 0 -> 49 bytes .../src/main/webapp/static/fusion/images/plus.gif | Bin 0 -> 78 bytes .../main/webapp/static/fusion/images/printer.gif | Bin 0 -> 1036 bytes .../main/webapp/static/fusion/images/profile.png | Bin 0 -> 462 bytes .../webapp/static/fusion/images/report-add.png | Bin 0 -> 724 bytes .../static/fusion/images/report-favorite.png | Bin 0 -> 693 bytes .../main/webapp/static/fusion/images/report-my.png | Bin 0 -> 739 bytes .../webapp/static/fusion/images/report-public.png | Bin 0 -> 776 bytes .../main/webapp/static/fusion/images/report.png | Bin 0 -> 563 bytes .../main/webapp/static/fusion/images/reports.png | Bin 0 -> 769 bytes .../static/fusion/images/results-first-active.png | Bin 0 -> 545 bytes .../fusion/images/results-first-disabled.png | Bin 0 -> 421 bytes .../static/fusion/images/results-last-active.png | Bin 0 -> 541 bytes .../static/fusion/images/results-last-disabled.png | Bin 0 -> 421 bytes .../static/fusion/images/results-next-active.png | Bin 0 -> 416 bytes .../static/fusion/images/results-next-disabled.png | Bin 0 -> 326 bytes .../static/fusion/images/results-prev-active.png | Bin 0 -> 421 bytes .../static/fusion/images/results-prev-disabled.png | Bin 0 -> 322 bytes .../webapp/static/fusion/images/resultset_last.png | Bin 0 -> 506 bytes .../static/fusion/images/resultset_previous.png | Bin 0 -> 381 bytes .../webapp/static/fusion/images/return_to_top.gif | Bin 0 -> 846 bytes .../webapp/static/fusion/images/rightButton.png | Bin 0 -> 731 bytes .../main/webapp/static/fusion/images/search.png | Bin 0 -> 3501 bytes .../webapp/static/fusion/images/search_profile.png | Bin 0 -> 880 bytes .../main/webapp/static/fusion/images/sort_asc.gif | Bin 0 -> 57 bytes .../main/webapp/static/fusion/images/sort_desc.gif | Bin 0 -> 58 bytes .../main/webapp/static/fusion/images/spacer.gif | Bin 0 -> 43 bytes .../webapp/static/fusion/images/success_type.gif | Bin 0 -> 260 bytes .../main/webapp/static/fusion/images/swoosh.gif | Bin 0 -> 14250 bytes .../main/webapp/static/fusion/images/tab-hm.png | Bin 0 -> 249 bytes .../main/webapp/static/fusion/images/tab-v-hm.png | Bin 0 -> 317 bytes .../src/main/webapp/static/fusion/images/tab.png | Bin 0 -> 343 bytes .../main/webapp/static/fusion/images/table-add.png | Bin 0 -> 3314 bytes .../webapp/static/fusion/images/table-delete.png | Bin 0 -> 3342 bytes .../webapp/static/fusion/images/table-edit.png | Bin 0 -> 3348 bytes .../src/main/webapp/static/fusion/images/table.png | Bin 0 -> 496 bytes .../main/webapp/static/fusion/images/tabs-bg.png | Bin 0 -> 147 bytes .../webapp/static/fusion/images/toolButton.gif | Bin 0 -> 414 bytes .../webapp/static/fusion/images/toolButton.png | Bin 0 -> 531 bytes .../main/webapp/static/fusion/images/toolbar.png | Bin 0 -> 171 bytes .../src/main/webapp/static/fusion/images/users.png | Bin 0 -> 938 bytes .../webapp/static/fusion/images/warning_type.gif | Bin 0 -> 1055 bytes .../main/webapp/static/fusion/images/webphone.ico | Bin 0 -> 241 bytes .../webapp/static/fusion/images/whiteButton.png | Bin 0 -> 1430 bytes .../js/att_angular_gridster/angular-gridster.js | 2244 + .../js/att_angular_gridster/ui-gridster-tpls.js | 168 + .../main/webapp/static/fusion/js/jquery.resize.js | 139 + .../main/webapp/static/fusion/js/layout/debug.js | 329 + .../static/fusion/js/layout/jquery-latest.js | 9555 +++++ .../static/fusion/js/layout/jquery-ui-latest.js | 14879 +++++++ .../fusion/js/layout/jquery.layout-latest.js | 6086 +++ .../src/main/webapp/static/fusion/js/moment.min.js | 6 + .../main/webapp/static/fusion/raptor/css/Style.css | 77 + .../static/fusion/raptor/css/bd_quantum_raptor.css | 305 + .../webapp/static/fusion/raptor/css/calendar.css | 97 + .../webapp/static/fusion/raptor/css/dashboard.css | 36 + .../webapp/static/fusion/raptor/css/drupal.css | 83 + .../fusion/raptor/css/form-field-tooltip.css | 12 + .../static/fusion/raptor/css/mobile_raptor.css | 73 + .../webapp/static/fusion/raptor/css/novamap.css | 25 + .../webapp/static/fusion/raptor/css/picker.css | 40 + .../main/webapp/static/fusion/raptor/css/ral.css | 1437 + .../webapp/static/fusion/raptor/css/raptor.css | 62 + .../webapp/static/fusion/raptor/d3/css/nv.d3.css | 656 + .../main/webapp/static/fusion/raptor/d3/js/cie.js | 155 + .../static/fusion/raptor/d3/js/colorbrewer.js | 302 + .../main/webapp/static/fusion/raptor/d3/js/core.js | 122 + .../static/fusion/raptor/d3/js/crossfilter.js | 1180 + .../static/fusion/raptor/d3/js/crossfilter.min.js | 1 + .../webapp/static/fusion/raptor/d3/js/d3.geom.js | 816 + .../main/webapp/static/fusion/raptor/d3/js/d3.js | 3015 ++ .../webapp/static/fusion/raptor/d3/js/d3.layout.js | 908 + .../webapp/static/fusion/raptor/d3/js/d3.v2.js | 7033 ++++ .../webapp/static/fusion/raptor/d3/js/d3.v2.min.js | 4 + .../webapp/static/fusion/raptor/d3/js/d3.v3.js | 8444 ++++ .../webapp/static/fusion/raptor/d3/js/d3.v3.min.js | 1 + .../webapp/static/fusion/raptor/d3/js/fisheye.js | 86 + .../main/webapp/static/fusion/raptor/d3/js/hive.js | 80 + .../webapp/static/fusion/raptor/d3/js/horizon.js | 192 + .../static/fusion/raptor/d3/js/interactiveLayer.js | 251 + .../webapp/static/fusion/raptor/d3/js/intro.js | 1 + .../static/fusion/raptor/d3/js/models/axis-min.js | 1 + .../static/fusion/raptor/d3/js/models/axis.js | 470 + .../static/fusion/raptor/d3/js/models/axis.min.js | 1 + .../fusion/raptor/d3/js/models/boilerplate.js | 104 + .../static/fusion/raptor/d3/js/models/bullet.js | 385 + .../fusion/raptor/d3/js/models/bulletChart.js | 343 + .../raptor/d3/js/models/cumulativeLineChart.js | 782 + .../fusion/raptor/d3/js/models/discreteBar.js | 349 + .../fusion/raptor/d3/js/models/discreteBarChart.js | 333 + .../fusion/raptor/d3/js/models/distribution.js | 148 + .../fusion/raptor/d3/js/models/historicalBar.js | 331 + .../raptor/d3/js/models/historicalBarChart.js | 419 + .../fusion/raptor/d3/js/models/indentedTree.js | 337 + .../static/fusion/raptor/d3/js/models/legend.js | 270 + .../static/fusion/raptor/d3/js/models/line.js | 284 + .../static/fusion/raptor/d3/js/models/lineChart.js | 465 + .../fusion/raptor/d3/js/models/linePlusBarChart.js | 433 + .../d3/js/models/linePlusBarWithFocusChart.js | 658 + .../fusion/raptor/d3/js/models/lineWithFisheye.js | 200 + .../raptor/d3/js/models/lineWithFisheyeChart.js | 297 + .../raptor/d3/js/models/lineWithFocusChart.js | 574 + .../static/fusion/raptor/d3/js/models/multiBar.js | 461 + .../fusion/raptor/d3/js/models/multiBarChart.js | 524 + .../raptor/d3/js/models/multiBarHorizontal.js | 424 + .../raptor/d3/js/models/multiBarHorizontalChart.js | 434 + .../raptor/d3/js/models/multiBarTimeSeries.js | 384 + .../raptor/d3/js/models/multiBarTimeSeriesChart.js | 405 + .../fusion/raptor/d3/js/models/multiChart.js | 452 + .../static/fusion/raptor/d3/js/models/ohlcBar.js | 380 + .../raptor/d3/js/models/parallelCoordinates.js | 239 + .../static/fusion/raptor/d3/js/models/pie.js | 400 + .../static/fusion/raptor/d3/js/models/pie.js.bak | 400 + .../static/fusion/raptor/d3/js/models/pieChart.js | 292 + .../static/fusion/raptor/d3/js/models/scatter.js | 674 + .../fusion/raptor/d3/js/models/scatterChart.js | 628 + .../raptor/d3/js/models/scatterPlusLineChart.js | 620 + .../static/fusion/raptor/d3/js/models/sparkline.js | 194 + .../fusion/raptor/d3/js/models/sparklinePlus.js | 295 + .../fusion/raptor/d3/js/models/stackedArea.js | 368 + .../fusion/raptor/d3/js/models/stackedAreaChart.js | 629 + .../webapp/static/fusion/raptor/d3/js/nv.d3.min.js | 1 + .../webapp/static/fusion/raptor/d3/js/outro.js | 1 + .../webapp/static/fusion/raptor/d3/js/sankey.js | 292 + .../webapp/static/fusion/raptor/d3/js/tooltip.js | 490 + .../webapp/static/fusion/raptor/d3/js/utils.js | 152 + .../static/fusion/raptor/dy3/js/dashed-canvas.js | 176 + .../webapp/static/fusion/raptor/dy3/js/data.js | 63 + .../static/fusion/raptor/dy3/js/dygraph-canvas.js | 816 + .../fusion/raptor/dy3/js/dygraph-combined.js | 2 + .../raptor/dy3/js/dygraph-combined_bak_color.js | 2 + .../static/fusion/raptor/dy3/js/dygraph-dev.js | 45 + .../static/fusion/raptor/dy3/js/dygraph-externs.js | 93 + .../static/fusion/raptor/dy3/js/dygraph-gviz.js | 82 + .../raptor/dy3/js/dygraph-interaction-model.js | 676 + .../static/fusion/raptor/dy3/js/dygraph-layout.js | 349 + .../raptor/dy3/js/dygraph-options-reference.js | 867 + .../static/fusion/raptor/dy3/js/dygraph-options.js | 384 + .../fusion/raptor/dy3/js/dygraph-plugin-base.js | 4 + .../fusion/raptor/dy3/js/dygraph-plugin-install.js | 19 + .../static/fusion/raptor/dy3/js/dygraph-tickers.js | 487 + .../static/fusion/raptor/dy3/js/dygraph-utils.js | 1305 + .../webapp/static/fusion/raptor/dy3/js/dygraph.js | 3857 ++ .../webapp/static/fusion/raptor/dy3/js/excanvas.js | 924 + .../static/fusion/raptor/dy3/js/interaction.js | 333 + .../static/fusion/raptor/dy3/js/interaction.min.js | 1 + .../static/fusion/raptor/dy3/js/interaction_sun.js | 303 + .../static/fusion/raptor/dy3/js/moment.min.js | 6 + .../static/fusion/raptor/dy3/js/phantom-driver.js | 206 + .../static/fusion/raptor/dy3/js/phantom-perf.js | 94 + .../static/fusion/raptor/dy3/js/plugins/README | 113 + .../fusion/raptor/dy3/js/plugins/annotations.js | 182 + .../static/fusion/raptor/dy3/js/plugins/axes.js | 315 + .../fusion/raptor/dy3/js/plugins/chart-labels.js | 202 + .../static/fusion/raptor/dy3/js/plugins/grid.js | 124 + .../static/fusion/raptor/dy3/js/plugins/legend.js | 332 + .../fusion/raptor/dy3/js/plugins/range-selector.js | 852 + .../fusion/raptor/dy3/js/rgbcolor/rgbcolor.js | 257 + .../static/fusion/raptor/dy3/js/stacktrace.js | 411 + .../static/fusion/raptor/dy3/js/strftime/Doxyfile | 243 + .../fusion/raptor/dy3/js/strftime/strftime-min.js | 1 + .../fusion/raptor/dy3/js/strftime/strftime.js | 731 + .../static/fusion/raptor/ebz/date_time_picker.css | 557 + .../static/fusion/raptor/ebz/date_time_picker.js | 277 + .../webapp/static/fusion/raptor/ebz/dynamicform.js | 112 + .../main/webapp/static/fusion/raptor/ebz/moment.js | 3688 ++ .../webapp/static/fusion/raptor/ebz/multiselect.js | 62 + .../webapp/static/fusion/raptor/ebz/quick_links.js | 33 + .../fusion/raptor/ebz/report_chart_wizard.html | 313 + .../fusion/raptor/ebz/report_chart_wizard.js | 671 + .../static/fusion/raptor/ebz/report_run.html | 67 + .../webapp/static/fusion/raptor/ebz/report_run.js | 293 + .../static/fusion/raptor/ebz/report_search.html | 34 + .../static/fusion/raptor/ebz/report_search.js | 136 + .../static/fusion/raptor/js/CalendarPopup.js | 1486 + .../main/webapp/static/fusion/raptor/js/ajax.js | 214 + .../fusion/raptor/js/ajax_dynamic_content.js | 97 + .../static/fusion/raptor/js/cingular_button.js | 217 + .../main/webapp/static/fusion/raptor/js/drupal.js | 1018 + .../static/fusion/raptor/js/editabledropdown.js | 363 + .../static/fusion/raptor/js/form-field-tooltip.js | 715 + .../main/webapp/static/fusion/raptor/js/gmap.js | 634 + .../main/webapp/static/fusion/raptor/js/jquery.js | 4376 ++ .../webapp/static/fusion/raptor/js/jquery.min.js | 154 + .../static/fusion/raptor/js/label_quantum.js | 5 + .../webapp/static/fusion/raptor/js/nova_button.js | 1184 + .../static/fusion/raptor/js/other_scripts.js | 331 + .../fusion/raptor/js/persist_table_header.js | 47 + .../static/fusion/raptor/js/prototype-1.6.0.3.js | 4320 ++ .../main/webapp/static/fusion/raptor/js/raptor.js | 314 + .../static/fusion/raptor/js/rounded-corners.js | 353 + .../main/webapp/static/fusion/raptor/js/script.js | 482 + .../webapp/static/fusion/raptor/uigrid/ui-grid.css | 1971 + .../webapp/static/fusion/raptor/uigrid/ui-grid.eot | Bin 0 -> 8728 bytes .../webapp/static/fusion/raptor/uigrid/ui-grid.js | 26735 ++++++++++++ .../webapp/static/fusion/raptor/uigrid/ui-grid.svg | 34 + .../webapp/static/fusion/raptor/uigrid/ui-grid.ttf | Bin 0 -> 8564 bytes .../static/fusion/raptor/uigrid/ui-grid.woff | Bin 0 -> 4792 bytes .../static/fusion/raptor/uigrid/vfs_fonts.js | 1 + .../static/fusion/sample/css/images/blank.gif | Bin 0 -> 49 bytes .../webapp/static/fusion/sample/css/scribble.css | 40 + .../webapp/static/fusion/sample/css/slider.css | 142 + .../static/fusion/sample/css/spacegallery.css | 18 + .../webapp/static/fusion/sample/css/welcome.css | 169 + .../static/fusion/sample/html/area_chart.html | 49 + .../static/fusion/sample/html/bar_chart.html | 95 + .../static/fusion/sample/html/d3_gauges_demo.html | 39 + .../fusion/sample/html/data/speedometer2.csv | 16 + .../fusion/sample/html/data/speedometer3.csv | 2 + .../static/fusion/sample/html/data/worddata.csv | 22 + .../webapp/static/fusion/sample/html/donut_d3.html | 43 + .../static/fusion/sample/html/js/area_chart.min.js | 1 + .../static/fusion/sample/html/js/donut.min.js | 1 + .../static/fusion/sample/html/js/gauges.min.js | 1 + .../static/fusion/sample/html/js/line_chart.min.js | 1 + .../static/fusion/sample/html/js/pie_chart.min.js | 1 + .../static/fusion/sample/html/js/worddata.min.js | 1 + .../static/fusion/sample/html/line_chart.html | 49 + .../static/fusion/sample/html/pie_chart.html | 38 + .../static/fusion/sample/html/wordcloud.html | 37 + .../static/fusion/sample/images/Calendar-16x16.png | Bin 0 -> 552 bytes .../static/fusion/sample/images/arrow-next.png | Bin 0 -> 1561 bytes .../static/fusion/sample/images/arrow-prev.png | Bin 0 -> 1557 bytes .../images/carousel/slide_b_drive_test_map.png | Bin 0 -> 202465 bytes .../sample/images/carousel/slide_b_eppt_county.png | Bin 0 -> 21222 bytes .../images/carousel/slide_b_eppt_regression.png | Bin 0 -> 11536 bytes .../images/carousel/slide_b_ios_throughput.png | Bin 0 -> 26131 bytes .../sample/images/carousel/slide_b_lata_map.png | Bin 0 -> 192031 bytes .../images/carousel/slide_b_lata_map_legend.png | Bin 0 -> 3021 bytes .../images/carousel/slide_b_nova_sdn_map.png | Bin 0 -> 179361 bytes .../static/fusion/sample/images/copyicon.png | Bin 0 -> 235 bytes .../static/fusion/sample/images/deleteicon.gif | Bin 0 -> 579 bytes .../static/fusion/sample/images/example-frame.png | Bin 0 -> 33699 bytes .../webapp/static/fusion/sample/images/loading.gif | Bin 0 -> 6820 bytes .../static/fusion/sample/images/tunnels/1_mon.png | Bin 0 -> 22762 bytes .../static/fusion/sample/images/tunnels/2_tue.png | Bin 0 -> 22772 bytes .../static/fusion/sample/images/tunnels/3_wed.png | Bin 0 -> 24012 bytes .../static/fusion/sample/images/tunnels/4_thu.png | Bin 0 -> 23902 bytes .../static/fusion/sample/images/tunnels/5_fri.png | Bin 0 -> 22349 bytes .../static/fusion/sample/images/tunnels/6_sat.png | Bin 0 -> 23674 bytes .../static/fusion/sample/images/tunnels/7_sun.png | Bin 0 -> 22845 bytes .../fusion/sample/images/tunnels/BH_DLSTX_IN.png | Bin 0 -> 10575 bytes .../fusion/sample/images/tunnels/BH_DLSTX_OUT.png | Bin 0 -> 10460 bytes .../static/fusion/sample/images/tunnels/BH_Nat.png | Bin 0 -> 10420 bytes .../fusion/sample/images/tunnels/BH_Nat_Def.png | Bin 0 -> 8941 bytes .../sample/images/tunnels/BH_Nat_Priority.png | Bin 0 -> 10590 bytes .../webapp/static/fusion/sample/js/FusionCharts.js | 361 + .../main/webapp/static/fusion/sample/js/charts.js | 132 + .../src/main/webapp/static/fusion/sample/js/eye.js | 34 + .../fusion/sample/js/jquery.flexslider-min.js | 5 + .../webapp/static/fusion/sample/js/scribble.js | 19 + .../static/fusion/sample/js/slides.min.jquery.js | 20 + .../webapp/static/fusion/sample/js/spacegallery.js | 235 + .../main/webapp/static/fusion/sample/js/utils.js | 252 + .../fusion/sample/org_chart/css/bootstrap.min.css | 351 + .../static/fusion/sample/org_chart/css/custom.css | 97 + .../sample/org_chart/css/jquery.jOrgChart.css | 51 + .../fusion/sample/org_chart/css/prettify.css | 1 + .../static/fusion/sample/org_chart/example.html | 85 + .../fusion/sample/org_chart/example_vsp.html | 88 + .../static/fusion/sample/org_chart/images/bkgd.png | Bin 0 -> 133 bytes .../fusion/sample/org_chart/images/raspberry.jpg | Bin 0 -> 5755 bytes .../fusion/sample/org_chart/jquery.jOrgChart.js | 267 + .../static/fusion/sample/org_chart/prettify.js | 28 + .../src/main/webapp/static/js/jquery-1.10.2.js | 9789 +++++ .../sdk-app/src/main/webapp/static/js/jquery-ui.js | 16617 ++++++++ .../src/main/webapp/static/js/jquery.mask.min.js | 12 + .../src/main/webapp/static/js/modalService.js | 169 + .../sdk-app/src/main/webapp/static/js/search.js | 829 + .../java/org/openecomp/portalapp/SanityTest.java | 20 + .../controller/CollaborationControllerTest.java | 27 + .../openecomp/portalapp/controller/NetMapTest.java | 19 + .../portalapp/service/ProfileServiceTest.java | 37 + .../core/MockApplicationContextTestSuite.java | 126 + .../services/WorkflowScheduleServiceTest.java | 41 + ecomp-sdk/sdk-workflow/.gitignore | 1 + ecomp-sdk/sdk-workflow/README.md | 7 + ecomp-sdk/sdk-workflow/pom.xml | 111 + .../controller/NotebookController.java | 54 + .../controller/NotebookTestController.java | 56 + .../controller/RNoteBookController.java | 84 + .../controller/RNoteBookFEController.java | 113 + .../domain/RNoteBookCredentials.java | 93 + .../exception/RNotebookIntegrationException.java | 41 + .../service/RNoteBookIntegrationService.java | 31 + .../service/RNoteBookIntegrationServiceImpl.java | 144 + .../workflow/controllers/WorkflowController.java | 183 + .../workflow/dao/HibernateConfiguration.java | 20 + .../portalsdk/workflow/dao/WorkflowDAO.java | 32 + .../portalsdk/workflow/dao/WorkflowDAOImpl.java | 109 + .../workflow/domain/WorkflowSchedule.java | 91 + .../portalsdk/workflow/models/Workflow.java | 202 + .../portalsdk/workflow/models/WorkflowLite.java | 174 + .../workflow/scheduler/WorkFlowScheduleJob.java | 45 + .../scheduler/WorkFlowScheduleRegistry.java | 107 + .../services/WorkflowScheduleExecutor.java | 108 + .../workflow/services/WorkflowScheduleService.java | 34 + .../services/WorkflowScheduleServiceImpl.java | 144 + .../workflow/services/WorkflowService.java | 35 + .../workflow/services/WorkflowServiceImpl.java | 77 + .../main/resources/RNoteBookIntegration.hbm.xml | 43 + ecomp-sdk/thirdparty/.gitignore | 1 + ecomp-sdk/thirdparty/README.md | 23 + ecomp-sdk/thirdparty/pom.xml | 93 + .../core/onboarding/client/ECOMPSSOFilter.java | 77 + .../core/onboarding/client/SecureServlet.java | 61 + .../core/onboarding/client/UnSecureServlet.java | 61 + .../core/onboarding/crossapi/CipherUtil.java | 125 + .../core/onboarding/crossapi/ECOMPSSO.java | 238 + .../onboarding/crossapi/IPortalRestAPIService.java | 133 + .../onboarding/crossapi/IPortalUebAPIService.java | 46 + .../onboarding/crossapi/PortalAPIException.java | 49 + .../onboarding/crossapi/PortalAPIResponse.java | 58 + .../onboarding/crossapi/PortalApiConstants.java | 62 + .../onboarding/crossapi/PortalApiProperties.java | 98 + .../onboarding/crossapi/PortalRestAPIProxy.java | 498 + .../crossapi/PortalTimeoutBindingListener.java | 52 + .../onboarding/crossapi/PortalTimeoutHandler.java | 419 + .../core/onboarding/crossapi/PortalTimeoutVO.java | 63 + .../onboarding/crossapi/SessionCommunication.java | 161 + .../onboarding/crossapi/UserContextListener.java | 52 + .../onboarding/crossapi/UserSessionListener.java | 84 + .../core/onboarding/rest/FavoritesClient.java | 51 + .../core/onboarding/rest/FunctionalMenuClient.java | 54 + .../core/onboarding/rest/RestWebServiceClient.java | 178 + .../portalsdk/core/onboarding/ueb/Consumer.java | 164 + .../core/onboarding/ueb/FunctionalMenu.java | 61 + .../portalsdk/core/onboarding/ueb/Helper.java | 64 + .../portalsdk/core/onboarding/ueb/Publisher.java | 124 + .../core/onboarding/ueb/PublisherList.java | 77 + .../core/onboarding/ueb/TopicManager.java | 121 + .../core/onboarding/ueb/UebException.java | 65 + .../portalsdk/core/onboarding/ueb/UebManager.java | 358 + .../portalsdk/core/onboarding/ueb/UebMsg.java | 119 + .../portalsdk/core/onboarding/ueb/UebMsgTypes.java | 28 + .../onboarding/ueb/WaitingRequestersQueueList.java | 73 + .../portalsdk/core/restful/domain/EcompRole.java | 87 + .../portalsdk/core/restful/domain/EcompUser.java | 197 + .../core/restful/domain/SharedContext.java | 300 + 2605 files changed, 632830 insertions(+) create mode 100644 .gitreview create mode 100644 .idea/ecompsdkos.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 ecomp-sdk/LICENSE.txt create mode 100644 ecomp-sdk/README.md create mode 100644 ecomp-sdk/pom.xml create mode 100644 ecomp-sdk/quantum/.gitignore create mode 100644 ecomp-sdk/quantum/README.md create mode 100644 ecomp-sdk/quantum/pom.xml create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/FusionObject.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/LoginBean.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/PostDroolsBean.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/PostSearchBean.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/UserRowBean.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/support/SearchBase.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/support/SearchResult.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/AppConfig.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/AppInitializer.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/Configurable.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/HibernateConfiguration.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/HibernateMappingLocatable.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/AdminAuthGenericController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/AngularAdminController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/BroadcastController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/BroadcastListController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CacheAdminController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CollaborateListController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CollaborationController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ElementModelController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ExternalLoginController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FavoritesController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FnMenuController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FuncMenuController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FusionBaseController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/LogoutController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/MenuListController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/PostSearchController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ProfileController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ProfileSearchController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedBaseController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedRESTfulBaseController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleFunctionListController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleListController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/SingleSignOnController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/UnRestrictedBaseController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/UsageListController.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/AbstractDao.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/ProfileDao.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/ProfileDaoImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/hibernate/ModelOperationsCommon.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/support/FusionDao.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/App.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/AuditLog.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/BroadcastMessage.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/DomainVo.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/FnMenu.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/FusionVo.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LoginBean.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Lookup.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LuCountry.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LuState.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LuTimeZone.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Menu.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/MenuData.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Profile.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Role.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/RoleFunction.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UrlsAccessible.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UrlsAccessibleKey.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/User.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UserApp.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UserAppId.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/sessionmgt/TimeoutVO.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Attribute.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/CollaborateList.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Container.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Domain.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/DomainVo.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Element.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/ElementDetails.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/FusionCommand.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Layout.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/NameValueId.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Position.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Size.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/drools/DroolsRuleService.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/drools/DroolsRuleServiceImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/FusionExceptionResolver.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/SessionExpiredException.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/UrlAccessRestrictedException.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/support/FusionException.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/support/FusionRuntimeException.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interceptor/ResourceInterceptor.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interceptor/SessionTimeoutInterceptor.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interfaces/SecurityInterface.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/ApplicationContextListener.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/CollaborateListBindingListener.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/UserSessionListener.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/AuditLog.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/EELFLoggerAdvice.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/EELFLoggerAspect.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/MetricsLog.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AlarmSeverityEnum.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AppMessagesEnum.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ApplicationCodes.properties create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AuditLogFormatter.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorCodesEnum.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorSeverityEnum.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorTypeEnum.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/logic/EELFLoggerDelegate.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/menu/MenuBuilder.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/menu/MenuProperties.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/AbstractCacheManager.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/jcs/JCSCacheEventHandler.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/jcs/JCSCacheManager.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/support/FusionCacheManager.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/client/AppContextManager.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/client/OnBoardingApiServiceImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/session/TestClass.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/sso/TestClass.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/HttpStatusAndResponse.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/PortalRestClientBase.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/SharedContextRestClient.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/CoreRegister.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/CronRegistry.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/Registerable.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppService.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppServiceImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditService.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditServiceImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastService.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastServiceImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessService.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessServiceImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementLinkService.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementMapService.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapService.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapServiceImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginService.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsService.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsServiceImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchService.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchServiceImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileService.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleService.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceNonSpringImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileService.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallService.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallServiceImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/FusionService.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocator.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocatorImpl.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/CacheManager.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/CipherUtil.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/EncDecUtilTest.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/EncTest.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/JSONUtil.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/SystemProperties.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/UsageUtils.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/YamlUtils.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/socket/PeerBroadcastSocket.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/socket/WebRTCSocket.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/AppUtils.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/ControllerProperties.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/FeedbackMessage.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/JsonMessage.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/MessagesList.java create mode 100644 ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java create mode 100644 ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/MockApplicationContextTestSuite.java create mode 100644 ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/MockHibernateMappingLocations.java create mode 100644 ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/controller/sessionmgt/PortalCommunicationTest.java create mode 100644 ecomp-sdk/sdk-analytics/.gitignore create mode 100644 ecomp-sdk/sdk-analytics/README.md create mode 100644 ecomp-sdk/sdk-analytics/pom.xml create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/AntBuild.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/RaptorObject.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/config/ConfigLoader.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Action.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionHandler.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionMapping.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Controller.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ErrorHandler.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardProcessor.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequence.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceCrossTab.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceDashboard.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceLinear.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedCrossTab.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedHive.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinear.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinearDatamining.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorException.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorRuntimeException.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorSchedularException.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/ReportSQLException.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/UserAccessException.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/UserDefinedException.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/ValidationException.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/Line.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/LineCollection.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/LineInfo.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/ColorProperties.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/GMapProperties.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/GeoCoordinate.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/MapConstant.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/NovaMap.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/layer/SwingLayer.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/Node.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/NodeCollection.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/NodeInfo.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/utils/MapUtils.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/utils/SwingWorker.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/DataCache.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/ReportHandler.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/ReportLoader.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/SearchHandler.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ChartSeqComparator.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameColLookup.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameList.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameLookup.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameSql.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameValue.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/NameComparator.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/OrderBySeqComparator.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/OrderSeqComparator.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportSecurity.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportWrapper.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DBColumnInfo.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DrillDownParamDef.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/Marker.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportDefinition.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportLogEntry.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportMap.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportSchedule.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/SecurityEntry.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableJoin.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableSource.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PageEvent.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PdfBean.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PdfReportHandler.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/BarChartOptions.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/CategoryAxisJSON.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartD3Helper.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartGen.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartJSON.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartJSONHelper.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartWebRuntime.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/CommonChartOptions.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ErrorJSONRuntime.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FlexTimeSeriesChartOptions.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FormField.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FormatProcessor.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/Item.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/LookupDBInfo.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/RangeAxisJSON.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportFormFields.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportJSONRuntime.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportParamDateValueParser.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportParamValues.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportParamValuesForPDFExcel.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ReportRuntime.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/TimeSeriesChartOptions.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/VisualManager.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResult.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResultJSON.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResult.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultColumn.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultField.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultJSON.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultRow.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/scheduler/SchedulerUtil.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/scheduler/SendEmail.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/scheduler/SendNotifications.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/AppUtils.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ConnectionUtils.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/DbUtils.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ExecuteQuery.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/Globals.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IAppUtils.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IDbUtils.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RDbUtils.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RemDbUtils.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AntBuild.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AppUtils.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/DbUtils.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/RemoteDbUtils.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/AdapterSessionFactoryContainer.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/DateUtils.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/IdName.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Item.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Lookup.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/RaptorAdapter.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/SpringContext.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/controller/FileServletController.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/CR_Report.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/QuickLink.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/RaptorSearch.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/ReportInfo.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorService.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorServiceImpl.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorController.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/ReportsSearchListController.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/AppConstants.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/DataSet.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/ExcelColorDef.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/HtmlStripper.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/Log.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/RemDbInfo.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/SQLCorrector.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/Scheduler.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/Utils.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/XSSFilter.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/util/upgrade/SystemUpgrade.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeader.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeaderRow.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnVisual.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabColumnValues.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabOrderManager.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabTotalValue.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataRow.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataValue.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/HtmlFormatter.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportColumnHeaderRows.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportData.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportDataRows.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportRowHeaderCols.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeader.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeaderCol.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ChartAdditionalOptions.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ChartDrillFormfield.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ChartDrillOptions.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ColFilterList.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ColFilterType.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/CustomReportType.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardEditorList.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardEditorReport.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardReports.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DashboardReportsNew.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataColumnList.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataColumnType.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataSourceList.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataSourceType.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/DataminingOptions.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormFieldList.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormFieldType.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormatList.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/FormatType.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/JavascriptItemType.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/JavascriptList.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/Marker.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ObjectFactory.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/PDFAdditionalOptions.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/PredefinedValueList.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/ReportMap.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/Reports.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/SemaphoreList.java create mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/xmlobj/SemaphoreType.java create mode 100644 ecomp-sdk/sdk-app/.gitignore create mode 100644 ecomp-sdk/sdk-app/README.md create mode 100644 ecomp-sdk/sdk-app/db-scripts/EcompSdkDDLMySql_1610_Complete_OS.sql create mode 100644 ecomp-sdk/sdk-app/db-scripts/EcompSdkDMLMySql_1610_Complete_OS.sql create mode 100644 ecomp-sdk/sdk-app/distribution.xml create mode 100644 ecomp-sdk/sdk-app/pom.xml create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppInitializer.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/HibernateMappingLocations.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/AngularSinglePageController.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/CallflowController.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/ElasticSearchController.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/LeafletMapContoller.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/PostDroolsController.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/UserProfileController.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/WelcomeController.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/model/Result.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogJob.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogRegistry.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/Register.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java create mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/util/CustomLoggingFilter.java create mode 100644 ecomp-sdk/sdk-app/src/main/resources/att-rules.drl create mode 100644 ecomp-sdk/sdk-app/src/main/resources/cache.ccf create mode 100644 ecomp-sdk/sdk-app/src/main/resources/logback.xml create mode 100644 ecomp-sdk/sdk-app/src/main/resources/mchange-log.properties create mode 100644 ecomp-sdk/sdk-app/src/main/resources/portal.properties create mode 100644 ecomp-sdk/sdk-app/src/main/resources/state-rules.drl create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/quartz.properties create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor.properties create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor_app_fusion.properties create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor_db_fusion.properties create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/raptor_pdf.properties create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/sql.properties create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/conf/system.properties create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/defs/definitions.xml create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/conf/fusion.properties create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/defs/definitions.xml create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/.gitignore create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/broadcast.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/broadcast_list.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/collaborateList.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/data_out.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_footer.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/loginSnippet.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template_noheader_nofooter.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template_report_embedded.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/es_search_demo.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/es_suggest_demo.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/frame_insert.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/include.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/jcs_admin.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/meta.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal_role.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal_rolefunction.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/post_search.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/profile.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/profile_search.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role_function_list.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role_list.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/usage_list.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/webrtc/collaboration.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/RNoteBookIntegration.hbm.xml create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/Workflow.hbm.xml create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/custom_header_include.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/custom_js_include.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/date_end_field_run_sql.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/date_start_field_run_sql.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/default_field_run_sql.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/disclaimer.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/error_include.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/error_page.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/footer.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_drill_down_report.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_import_semaphore.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_semaphore.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_sql.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_table_cols.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_testrun_sql.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_csv.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_pdf.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_xls.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_ebz.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_import.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_sample.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_search.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_wizard.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/test_field_run_sql.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/test_run_sql.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_adhoc_schedule.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_chart.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_add_multi.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_edit.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_list.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_columns_order_all.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_data_forecasting.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_definition.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_filters_edit.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_filters_list.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_form_fields_edit.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_form_fields_list.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_javascript.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_log.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_map.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_run.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_formfield_include.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_multiple.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_only.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_only_from_search.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_edit.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_list.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_order_all.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sql_def.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_tables_edit.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_tables_list.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_user_access.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/error.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/leafletMap.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/login_external.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/net_map.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/user_profile.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/welcome.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/web.xml create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.min.js.map create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.min.js.map create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.min.js.map create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-csp.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.min.js.map create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.min.js.map create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.min.js.map create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-mocks.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.min.js.map create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.min.js.map create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.min.js.map create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-scenario.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-touch.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-touch.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-touch.min.js.map create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular.min.js.map create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/errors.json create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/version.json create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/version.txt create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-ui/ui-bootstrap-tpls-1.2.4.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/bootstrap/bs.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/css/nv.d3.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/cie.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/colorbrewer.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/core.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/crossfilter.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/crossfilter.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.geom.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.layout.cloud.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.layout.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.v2.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.v2.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/d3.v3.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/fisheye.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/hive.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/horizon.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/interactiveLayer.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/intro.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/axis-min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/axis.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/axis.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/backup/bullet.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/backup/bulletChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/boilerplate.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/bullet.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/bulletChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/cumulativeLineChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/discreteBar.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/discreteBarChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/distribution.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/historicalBar.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/historicalBarChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/indentedTree.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/legend.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/line.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/linePlusBarChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/linePlusBarWithFocusChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineWithFisheye.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineWithFisheyeChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/lineWithFocusChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBar.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarHorizontal.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarHorizontalChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarTimeSeries.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiBarTimeSeriesChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/multiChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/ohlcBar.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/parallelCoordinates.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/pie.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/pieChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/scatter.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/scatterChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/scatterPlusLineChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/sparkline.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/sparklinePlus.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/stackedArea.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/models/stackedAreaChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/nv.d3.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/nv.d3.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/outro.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/sankey.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/tooltip.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/d3/js/utils.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-animate.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-cookies.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-route.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-route.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-sanitize.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular-touch.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/angular.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/app.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/checklist-model.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/checklist-model.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/gestures.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/ng_base.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/angular_js/ui-charts-tpls.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/ebz_header/footer.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/ebz_header/header.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/ebz_header/portal_ebz_header.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/fn-ebz.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/images/no_favorites_star.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/js/attHeaderSnippet.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/js/footer.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/att-abs-tpls.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/att-abs-tpls.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/base.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/btn.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/demo.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/dtpk.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/frms.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/ie/backgroundsize.min.htc create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/images/upanddown.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/pages/iconography.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/sldr.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/style.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ebz/sandbox/styles/tbs.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/.gitignore create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/LICENSE create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/bower.json create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/component.json create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/composer.json create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/css/ionicons.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/css/ionicons.min.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.eot create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.ttf create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/fonts/ionicons.woff create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/_ionicons-font.less create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/_ionicons-icons.less create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/_ionicons-variables.less create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/less/ionicons.less create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/alert-circled.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/alert.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-add-contact.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-add.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-alarm.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-archive.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-back.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-down-left.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-down-right.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-forward.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-up-left.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-arrow-up-right.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-battery.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-book.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-calendar.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-call.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-camera.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-chat.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-checkmark.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-clock.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-close.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-contact.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-contacts.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-data.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-developer.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-display.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-download.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-drawer.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-dropdown.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-earth.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-folder.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-forums.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-friends.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-hand.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-image.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-inbox.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-information.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-keypad.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-lightbulb.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-locate.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-location.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-mail.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-microphone.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-mixer.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-more.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-note.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-playstore.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-printer.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-promotion.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-reminder.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-remove.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-search.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-send.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-settings.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-share.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-social-user.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-social.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-sort.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-stair-drawer.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-star.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-stopwatch.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-storage.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-system-back.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-system-home.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-system-windows.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-timer.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-trash.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-user-menu.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-volume.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/android-wifi.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/aperture.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/archive.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-down-a.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-down-b.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-down-c.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-expand.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-down-left.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-down-right.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-up-left.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-graph-up-right.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-left-a.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-left-b.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-left-c.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-move.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-resize.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-return-left.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-return-right.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-right-a.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-right-b.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-right-c.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-shrink.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-swap.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-up-a.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-up-b.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/arrow-up-c.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/asterisk.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/at.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bag.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-charging.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-empty.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-full.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-half.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/battery-low.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/beaker.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/beer.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bluetooth.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bonfire.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bookmark.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/briefcase.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/bug.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/calculator.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/calendar.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/camera.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/card.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/cash.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbox-working.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbox.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatboxes.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbubble-working.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbubble.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chatbubbles.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/checkmark-circled.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/checkmark-round.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/checkmark.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-down.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-left.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-right.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/chevron-up.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/clipboard.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/clock.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/close-circled.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/close-round.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/close.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/closed-captioning.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/cloud.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/code-download.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/code-working.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/code.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/coffee.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/compass.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/compose.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/connection-bars.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/contrast.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/cube.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/disc.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/document-text.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/document.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/drag.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/earth.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/edit.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/egg.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/eject.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/email.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/eye-disabled.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/eye.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/female.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/filing.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/film-marker.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/fireball.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flag.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flame.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flash-off.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flash.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/flask.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/folder.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/fork-repo.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/fork.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/forward.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/funnel.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/game-controller-a.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/game-controller-b.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/gear-a.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/gear-b.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/grid.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/hammer.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/happy.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/headphone.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/heart-broken.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/heart.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/help-buoy.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/help-circled.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/help.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/home.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/icecream.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/icon-social-google-plus-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/icon-social-google-plus.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/image.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/images.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/information-circled.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/information.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ionic.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-alarm-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-alarm.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-albums-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-albums.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-americanfootball-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-americanfootball.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-analytics-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-analytics.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-back.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-down.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-forward.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-left.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-right.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-down.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-left.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-right.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-thin-up.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-arrow-up.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-at-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-at.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-barcode-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-barcode.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-baseball-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-baseball.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-basketball-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-basketball.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bell-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bell.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bolt-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bolt.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bookmarks-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-bookmarks.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-box-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-box.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-briefcase-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-briefcase.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-browsers-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-browsers.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calculator-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calculator.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calendar-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-calendar.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-camera-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-camera.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cart-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cart.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatboxes-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatboxes.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatbubble-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-chatbubble.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-checkmark-empty.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-checkmark-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-checkmark.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-circle-filled.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-circle-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-clock-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-clock.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-close-empty.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-close-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-close.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-download-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-download.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-upload-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud-upload.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloud.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy-night-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy-night.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cloudy.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cog-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-cog.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-compose-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-compose.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-contact-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-contact.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-copy-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-copy.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-download-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-download.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-drag.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-email-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-email.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-expand.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-eye-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-eye.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-fastforward-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-fastforward.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-filing-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-filing.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-film-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-film.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-flag-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-flag.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-folder-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-folder.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-football-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-football.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-gear-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-gear.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-glasses-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-glasses.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-heart-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-heart.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-help-empty.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-help-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-help.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-home-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-home.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-infinite-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-infinite.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-information-empty.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-information-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-information.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-ionic-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-keypad-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-keypad.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-lightbulb-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-lightbulb.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-location-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-location.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-locked-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-locked.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-loop-strong.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-loop.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-medkit-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-medkit.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-mic-off.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-mic-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-mic.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-minus-empty.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-minus-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-minus.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-monitor-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-monitor.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-moon-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-moon.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-more-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-more.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-musical-note.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-musical-notes.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-navigate-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-navigate.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paper-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paper.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paperplane-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paperplane.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-partlysunny-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-partlysunny.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pause-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pause.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paw-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-paw.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-people-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-people.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-person-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-person.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-personadd-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-personadd.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-photos-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-photos.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pie-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pie.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-play-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-play.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-plus-empty.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-plus-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-plus.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetag-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetag.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetags-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pricetags.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-printer-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-printer.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pulse-strong.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-pulse.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rainy-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rainy.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-recording-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-recording.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-redo-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-redo.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-refresh-empty.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-refresh-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-refresh.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-reload.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-reverse-camera-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-reverse-camera.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rewind-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-rewind.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-search-strong.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-search.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-settings-strong.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-settings.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-shrink.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipbackward-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipbackward.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipforward-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-skipforward.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-snowy.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-speedometer-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-speedometer.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-star-half.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-star-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-star.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-stopwatch-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-stopwatch.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-sunny-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-sunny.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-telephone-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-telephone.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-tennisball-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-tennisball.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-thunderstorm-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-thunderstorm.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-time-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-time.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-timer-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-timer.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-toggle-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-toggle.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-trash-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-trash.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-undo-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-undo.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-unlocked-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-unlocked.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-upload-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-upload.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-videocam-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-videocam.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-volume-high.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-volume-low.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-wineglass-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-wineglass.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-world-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ios7-world.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ipad.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/iphone.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ipod.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/jet.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/key.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/knife.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/laptop.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/leaf.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/levels.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/lightbulb.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/link.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-a.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-b.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-c.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/load-d.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/location.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/locked.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/log-in.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/log-out.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/loop.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/magnet.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/male.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/man.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/map.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/medkit.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/merge.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mic-a.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mic-b.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mic-c.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/minus-circled.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/minus-round.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/minus.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/model-s.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/monitor.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/more.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/mouse.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/music-note.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/navicon-round.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/navicon.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/navigate.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/network.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/no-smoking.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/nuclear.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/outlet.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/paper-airplane.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/paperclip.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pause.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/person-add.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/person-stalker.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/person.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pie-graph.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pin.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pinpoint.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pizza.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plane.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/planet.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/play.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/playstation.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plus-circled.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plus-round.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/plus.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/podium.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pound.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/power.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pricetag.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pricetags.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/printer.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/pull-request.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/qr-scanner.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/quote.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/radio-waves.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/record.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/refresh.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/reply-all.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/reply.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ribbon-a.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/ribbon-b.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/sad.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/scissors.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/search.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/settings.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/share.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/shuffle.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/skip-backward.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/skip-forward.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-android-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-android.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-apple-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-apple.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-bitcoin-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-bitcoin.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-buffer-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-buffer.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-designernews-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-designernews.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dribbble-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dribbble.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dropbox-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-dropbox.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-facebook-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-facebook.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-foursquare-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-foursquare.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-freebsd-devil.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-github-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-github.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-google-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-google.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-googleplus-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-googleplus.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-hackernews-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-hackernews.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-instagram-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-instagram.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-linkedin-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-linkedin.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-pinterest-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-pinterest.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-reddit-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-reddit.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-rss-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-rss.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-skype-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-skype.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-tumblr-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-tumblr.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-tux.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-twitter-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-twitter.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-usd-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-usd.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-vimeo-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-vimeo.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-windows-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-windows.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-wordpress-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-wordpress.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-yahoo-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-yahoo.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-youtube-outline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/social-youtube.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/speakerphone.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/speedometer.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/spoon.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/star.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/stats-bars.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/steam.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/stop.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/thermometer.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/thumbsdown.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/thumbsup.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/toggle-filled.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/toggle.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/trash-a.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/trash-b.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/trophy.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/umbrella.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/university.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/unlocked.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/upload.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/usb.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/videocamera.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-high.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-low.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-medium.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/volume-mute.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wand.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/waterdrop.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wifi.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wineglass.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/woman.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/wrench.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/png/512/xbox.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/readme.md create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/_ionicons-font.scss create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/_ionicons-icons.scss create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/_ionicons-variables.scss create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/scss/ionicons.scss create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/alert-circled.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/alert.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-add-circle.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-add.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-alarm-clock.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-alert.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-apps.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-archive.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-back.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-down.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropdown-circle.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropdown.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropleft-circle.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropleft.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropright-circle.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropright.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropup-circle.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-dropup.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-forward.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-arrow-up.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-attach.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bar.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bicycle.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-boat.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bookmark.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bulb.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-bus.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-calendar.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-call.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-camera.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cancel.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-car.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cart.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-chat.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox-blank.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox-outline-blank.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkbox.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-checkmark-circle.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-clipboard.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-close.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud-circle.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud-done.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-cloud.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-color-palette.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-compass.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-contact.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-contacts.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-contract.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-create.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-delete.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-desktop.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-document.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-done-all.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-done.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-download.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-drafts.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-exit.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-expand.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-favorite-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-favorite.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-film.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-folder-open.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-folder.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-funnel.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-globe.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-hand.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-hangout.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-happy.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-home.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-image.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-laptop.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-list.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-locate.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-lock.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-mail.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-map.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-menu.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-microphone-off.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-microphone.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-more-horizontal.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-more-vertical.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-navigate.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-notifications-none.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-notifications-off.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-notifications.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-open.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-options.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-people.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-person-add.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-person.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-phone-landscape.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-phone-portrait.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-pin.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-plane.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-playstore.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-print.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-radio-button-off.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-radio-button-on.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-refresh.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-remove-circle.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-remove.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-restaurant.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-sad.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-search.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-send.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-settings.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-share-alt.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-share.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-star-half.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-star-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-star.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-stopwatch.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-subway.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-sunny.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-sync.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-textsms.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-time.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-train.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-unlock.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-upload.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-down.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-mute.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-off.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-volume-up.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-walk.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-warning.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-watch.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/android-wifi.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/aperture.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/archive.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-down-a.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-down-b.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-down-c.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-expand.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-down-left.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-down-right.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-up-left.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-graph-up-right.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-left-a.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-left-b.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-left-c.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-move.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-resize.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-return-left.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-return-right.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-right-a.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-right-b.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-right-c.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-shrink.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-swap.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-up-a.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-up-b.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/arrow-up-c.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/asterisk.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/at.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/backspace-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/backspace.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bag.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-charging.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-empty.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-full.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-half.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/battery-low.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/beaker.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/beer.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bluetooth.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bonfire.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bookmark.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bowtie.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/briefcase.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/bug.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/calculator.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/calendar.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/camera.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/card.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/cash.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbox-working.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbox.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatboxes.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbubble-working.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbubble.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chatbubbles.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/checkmark-circled.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/checkmark-round.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/checkmark.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-down.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-left.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-right.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/chevron-up.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/clipboard.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/clock.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/close-circled.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/close-round.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/close.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/closed-captioning.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/cloud.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/code-download.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/code-working.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/code.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/coffee.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/compass.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/compose.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/connection-bars.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/contrast.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/crop.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/cube.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/disc.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/document-text.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/document.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/drag.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/earth.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/easel.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/edit.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/egg.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/eject.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/email-unread.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/email.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/erlenmeyer-flask-bubbles.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/erlenmeyer-flask.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/eye-disabled.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/eye.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/female.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/filing.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/film-marker.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/fireball.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flag.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flame.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flash-off.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/flash.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/folder.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/fork-repo.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/fork.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/forward.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/funnel.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/gear-a.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/gear-b.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/grid.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/hammer.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/happy-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/happy.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/headphone.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/heart-broken.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/heart.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/help-buoy.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/help-circled.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/help.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/home.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/icecream.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/image.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/images.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/information-circled.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/information.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ionic.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-alarm-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-alarm.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-albums-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-albums.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-americanfootball-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-americanfootball.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-analytics-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-analytics.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-back.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-down.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-forward.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-left.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-right.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-down.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-left.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-right.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-thin-up.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-arrow-up.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-at-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-at.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-barcode-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-barcode.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-baseball-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-baseball.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-basketball-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-basketball.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bell-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bell.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-body-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-body.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bolt-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bolt.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-book-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-book.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bookmarks-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-bookmarks.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-box-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-box.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-briefcase-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-briefcase.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-browsers-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-browsers.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calculator-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calculator.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calendar-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-calendar.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-camera-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-camera.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cart-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cart.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatboxes-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatboxes.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatbubble-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-chatbubble.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-checkmark-empty.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-checkmark-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-checkmark.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-circle-filled.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-circle-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-clock-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-clock.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-close-empty.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-close-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-close.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-download-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-download.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-upload-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud-upload.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloud.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy-night-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy-night.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cloudy.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cog-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-cog.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-filter-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-filter.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-wand-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-color-wand.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-compose-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-compose.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-contact-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-contact.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-copy-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-copy.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-crop-strong.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-crop.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-download-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-download.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-drag.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-email-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-email.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-eye-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-eye.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-fastforward-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-fastforward.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-filing-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-filing.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-film-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-film.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flag-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flag.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flame-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flame.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flask-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flask.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flower-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-flower.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-folder-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-folder.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-football-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-football.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-a-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-a.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-b-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-game-controller-b.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-gear-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-gear.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-glasses-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-glasses.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-grid-view-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-grid-view.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-heart-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-heart.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-help-empty.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-help-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-help.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-home-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-home.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-infinite-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-infinite.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-information-empty.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-information-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-information.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-ionic-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-keypad-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-keypad.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-lightbulb-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-lightbulb.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-list-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-list.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-location-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-location.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-locked-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-locked.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-loop-strong.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-loop.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medical-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medical.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medkit-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-medkit.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-mic-off.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-mic-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-mic.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-minus-empty.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-minus-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-minus.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-monitor-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-monitor.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-moon-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-moon.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-more-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-more.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-musical-note.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-musical-notes.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-navigate-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-navigate.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-nutrition-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-nutrition.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paper-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paper.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paperplane-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paperplane.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-partlysunny-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-partlysunny.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pause-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pause.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paw-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-paw.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-people-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-people.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-person-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-person.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-personadd-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-personadd.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-photos-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-photos.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pie-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pie.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pint-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pint.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-play-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-play.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-plus-empty.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-plus-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-plus.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetag-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetag.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetags-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pricetags.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-printer-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-printer.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pulse-strong.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-pulse.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rainy-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rainy.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-recording-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-recording.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-redo-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-redo.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-refresh-empty.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-refresh-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-refresh.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-reload.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-reverse-camera-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-reverse-camera.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rewind-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rewind.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rose-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-rose.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-search-strong.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-search.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-settings-strong.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-settings.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-shuffle-strong.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-shuffle.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipbackward-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipbackward.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipforward-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-skipforward.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-snowy.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-speedometer-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-speedometer.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-star-half.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-star-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-star.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-stopwatch-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-stopwatch.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-sunny-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-sunny.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-telephone-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-telephone.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-tennisball-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-tennisball.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-thunderstorm-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-thunderstorm.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-time-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-time.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-timer-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-timer.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-toggle-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-toggle.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-trash-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-trash.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-undo-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-undo.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-unlocked-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-unlocked.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-upload-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-upload.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-videocam-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-videocam.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-volume-high.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-volume-low.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-wineglass-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-wineglass.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-world-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ios-world.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ipad.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/iphone.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ipod.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/jet.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/key.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/knife.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/laptop.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/leaf.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/levels.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/lightbulb.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/link.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-a.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-b.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-c.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/load-d.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/location.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/lock-combination.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/locked.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/log-in.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/log-out.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/loop.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/magnet.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/male.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/man.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/map.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/medkit.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/merge.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mic-a.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mic-b.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mic-c.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/minus-circled.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/minus-round.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/minus.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/model-s.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/monitor.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/more.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/mouse.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/music-note.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/navicon-round.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/navicon.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/navigate.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/network.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/no-smoking.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/nuclear.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/outlet.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paintbrush.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paintbucket.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paper-airplane.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/paperclip.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pause.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/person-add.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/person-stalker.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/person.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pie-graph.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pin.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pinpoint.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pizza.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plane.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/planet.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/play.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/playstation.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plus-circled.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plus-round.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/plus.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/podium.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pound.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/power.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pricetag.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pricetags.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/printer.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/pull-request.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/qr-scanner.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/quote.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/radio-waves.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/record.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/refresh.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/reply-all.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/reply.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ribbon-a.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/ribbon-b.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/sad-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/sad.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/scissors.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/search.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/settings.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/share.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/shuffle.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/skip-backward.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/skip-forward.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-android-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-android.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-angular-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-angular.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-apple-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-apple.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-bitcoin-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-bitcoin.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-buffer-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-buffer.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-chrome-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-chrome.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-codepen-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-codepen.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-css3-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-css3.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-designernews-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-designernews.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dribbble-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dribbble.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dropbox-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-dropbox.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-euro-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-euro.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-facebook-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-facebook.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-foursquare-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-foursquare.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-freebsd-devil.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-github-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-github.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-google-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-google.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-googleplus-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-googleplus.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-hackernews-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-hackernews.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-html5-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-html5.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-instagram-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-instagram.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-javascript-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-javascript.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-linkedin-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-linkedin.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-markdown.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-nodejs.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-octocat.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-pinterest-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-pinterest.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-python.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-reddit-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-reddit.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-rss-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-rss.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-sass.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-skype-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-skype.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-snapchat-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-snapchat.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-tumblr-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-tumblr.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-tux.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitch-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitch.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitter-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-twitter.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-usd-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-usd.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-vimeo-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-vimeo.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-whatsapp-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-whatsapp.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-windows-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-windows.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-wordpress-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-wordpress.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yahoo-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yahoo.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yen-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-yen.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-youtube-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/social-youtube.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/soup-can-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/soup-can.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/speakerphone.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/speedometer.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/spoon.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/star.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/stats-bars.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/steam.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/stop.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/thermometer.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/thumbsdown.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/thumbsup.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/toggle-filled.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/toggle.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/transgender.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/trash-a.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/trash-b.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/trophy.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/tshirt-outline.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/tshirt.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/umbrella.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/university.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/unlocked.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/upload.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/usb.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/videocamera.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-high.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-low.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-medium.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/volume-mute.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wand.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/waterdrop.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wifi.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wineglass.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/woman.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/wrench.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/ionicons-2.0.1/src/xbox.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/utils/js/browserCheck.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/controllers/nbook-framecontroller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/controllers/nbookController.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/controllers/notebookFrameController.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/dependency/angular.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook-frame.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook-viz.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook.htm create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebookInputs.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/att_angular_gridster/angular-gridster.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/att_angular_gridster/ui-gridster-tpls.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/adminController.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/admin_menu_edit.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/ase-controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/broadcast-controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/broadcast-list-controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/collaborate-list-controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/dummy.txt create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/fn_menu_add_popup_controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/jcs-admin-controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/modelpopupController.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/post-search-controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profile-controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profile-search-controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profileController.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-function-list-controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-list-controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/rolefunctionpopupController.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/rolepopupmodelController.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/self-profile-controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/usage-list-controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowApp.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowController.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowRouting.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/dummy.txt create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/footer.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/header.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/leftMenu.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/jquery.resize.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/debug.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery-latest.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery-ui-latest.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery.layout-latest.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/modalService.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/moment.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/adminService.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/headerService.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/leftMenuService.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/profileService.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/services/userInfoService.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/socket/peerBroadcast.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/dummy.txt create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/page-resource.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/sandbox-resources.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/admin-page/admin.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/admin-page/profile.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/dummy.txt create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/footer.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/header.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/left_menu.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/admin_menu_edit.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/broadcast.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/broadcast_list.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/collaborate_list.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/jcs_admin.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_add.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_edit.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_role.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_rolefunction.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/post_search.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/profile_detail.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/profile_search.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role_function_list.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role_list.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/self_profile.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/usage_list.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-landing.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-listing.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-new.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-preview.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-remove.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-schedule.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/webrtc/RTCMultiConnection.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/webrtc/getSourceId.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/att_angular_gridster/sandbox-gridster.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/att_angular_gridster/ui-gridster.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/fusion-sunny.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/jquery-ui.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/layout/layout-default-latest.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/workflows/workflows.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/drools-list-controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/drools-view-controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/droolsController.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/dummy.txt create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/directives/dummy.txt create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/services/droolsService.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/utils/dummy.txt create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsList.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsSinglePage.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsView.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/dummy.txt create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/external/dummy.txt create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/fonts/dummy.txt create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/images/dummy.txt create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/dummy.txt create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sample-page-controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sample-page-iframe-controller.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sampleController.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/directives/dummy.txt create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/utils/dummy.txt create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/dummy.txt create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/sample.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/sampleWithIframe.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/singlePageSample.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/styles/dummy.txt create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/index.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/manifest.jsp create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/att_angular_gridster/sandbox-gridster.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/att_angular_gridster/ui-gridster.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/fusion-sunny.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/jquery-ui.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/layout/layout-default-latest.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/css/nv.d3.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/cie.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/colorbrewer.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/core.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/crossfilter.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/crossfilter.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.geom.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.layout.cloud.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.layout.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v2.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v2.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v3.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/fisheye.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/hive.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/horizon.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/interactiveLayer.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/intro.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis-min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/backup/bullet.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/backup/bulletChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/boilerplate.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/bullet.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/bulletChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/cumulativeLineChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/discreteBar.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/discreteBarChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/distribution.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/historicalBar.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/historicalBarChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/indentedTree.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/legend.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/line.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/linePlusBarChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/linePlusBarWithFocusChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFisheye.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFisheyeChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFocusChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBar.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarHorizontal.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarHorizontalChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarTimeSeries.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarTimeSeriesChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/ohlcBar.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/parallelCoordinates.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/pie.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/pieChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatter.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatterChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatterPlusLineChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/sparkline.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/sparklinePlus.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/stackedArea.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/stackedAreaChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/nv.d3.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/nv.d3.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/outro.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/sankey.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/tooltip.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/utils.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/Rlogo.jpg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/Thumbs.db create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/action_icon.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/action_list_spacer.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/active.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/add.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/add_tool_button.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/addicon.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/application_window_bg.jpg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/arrow-next.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/arrow-prev.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/att_angular_gridster/grips.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/backButton.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/blank.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/blueButton.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/bubble.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/cache.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/calendar.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/chevron.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/close_container.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/collapsed-icon.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/column-bg.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/copyicon-highlighted.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/copyicon.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/csv_icon.jpg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/csv_icon.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers-add.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers-search.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/decrypted.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon-highlighted.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon-highlighted.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/ecomp.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/ecomp_trans.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/editicon.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/error_type.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/example-frame.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/excelicon_multi.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/executeicon.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/expanded-icon.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file-add.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file_import.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file_save-all.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/filter_icon.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_add.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_closed.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_delete.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_edit.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_open.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_user.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/funnel.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/fusion.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/grayButton.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/gray_add_tool_button.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/headerChatIcon.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/icon_remove_all.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/inactive.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/info_type.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/leftButton.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/loading.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/loading_bar.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/login_button.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/m1.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/mail.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/map.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/minus.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/modify_icon.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/no_favorites_star.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note-add.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note-search.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/notes.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/offline.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/offlineMsg.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/online.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/page.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/pagination.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/panel-e-w-toggle.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/panel-n-s-toggle.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/pix.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/plus.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/printer.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/profile.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-add.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-favorite.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-my.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-public.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/reports.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-first-active.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-first-disabled.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-last-active.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-last-disabled.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-next-active.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-next-disabled.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-prev-active.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-prev-disabled.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/resultset_last.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/resultset_previous.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/return_to_top.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/rightButton.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/search.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/search_profile.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/sort_asc.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/sort_desc.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/spacer.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/success_type.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/swoosh.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab-hm.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab-v-hm.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-add.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-delete.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-edit.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tabs-bg.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolButton.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolButton.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolbar.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/users.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/warning_type.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/webphone.ico create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/whiteButton.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/att_angular_gridster/angular-gridster.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/att_angular_gridster/ui-gridster-tpls.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/jquery.resize.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/debug.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery-latest.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery-ui-latest.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery.layout-latest.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/moment.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/Style.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/bd_quantum_raptor.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/calendar.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/dashboard.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/drupal.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/form-field-tooltip.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/mobile_raptor.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/novamap.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/picker.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/ral.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/raptor.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/css/nv.d3.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/cie.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/colorbrewer.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/core.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/crossfilter.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/crossfilter.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.geom.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.layout.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v2.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v2.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v3.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v3.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/fisheye.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/hive.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/horizon.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/interactiveLayer.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/intro.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis-min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/boilerplate.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/bullet.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/bulletChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/cumulativeLineChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/discreteBar.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/discreteBarChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/distribution.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/historicalBar.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/historicalBarChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/indentedTree.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/legend.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/line.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/linePlusBarChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/linePlusBarWithFocusChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFisheye.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFisheyeChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFocusChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBar.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarHorizontal.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarHorizontalChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarTimeSeries.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarTimeSeriesChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/ohlcBar.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/parallelCoordinates.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pie.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pie.js.bak create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pieChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatter.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatterChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatterPlusLineChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/sparkline.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/sparklinePlus.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/stackedArea.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/stackedAreaChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/nv.d3.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/outro.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/sankey.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/tooltip.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/utils.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dashed-canvas.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/data.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-canvas.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-combined.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-combined_bak_color.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-dev.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-externs.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-gviz.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-interaction-model.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-layout.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-options-reference.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-options.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-plugin-base.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-plugin-install.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-tickers.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-utils.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/excanvas.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction_sun.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/moment.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/phantom-driver.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/phantom-perf.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/README create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/annotations.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/axes.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/chart-labels.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/grid.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/legend.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/range-selector.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/rgbcolor/rgbcolor.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/stacktrace.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/Doxyfile create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/strftime-min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/strftime.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/dynamicform.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/moment.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/multiselect.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/quick_links.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_chart_wizard.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_chart_wizard.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_run.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_run.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_search.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_search.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/CalendarPopup.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/ajax.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/ajax_dynamic_content.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/cingular_button.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/drupal.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/editabledropdown.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/form-field-tooltip.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/gmap.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/jquery.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/jquery.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/label_quantum.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/nova_button.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/other_scripts.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/persist_table_header.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/prototype-1.6.0.3.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/raptor.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/rounded-corners.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/script.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.eot create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.svg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.ttf create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.woff create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/vfs_fonts.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/images/blank.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/scribble.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/slider.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/spacegallery.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/welcome.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/area_chart.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/bar_chart.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/d3_gauges_demo.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/speedometer2.csv create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/speedometer3.csv create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/worddata.csv create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/donut_d3.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/area_chart.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/donut.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/gauges.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/line_chart.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/pie_chart.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/worddata.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/line_chart.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/pie_chart.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/wordcloud.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/Calendar-16x16.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/arrow-next.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/arrow-prev.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_drive_test_map.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_eppt_county.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_eppt_regression.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_ios_throughput.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_lata_map.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_lata_map_legend.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_nova_sdn_map.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/copyicon.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/deleteicon.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/example-frame.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/loading.gif create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/1_mon.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/2_tue.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/3_wed.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/4_thu.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/5_fri.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/6_sat.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/7_sun.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_DLSTX_IN.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_DLSTX_OUT.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat_Def.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat_Priority.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/FusionCharts.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/charts.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/eye.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/jquery.flexslider-min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/scribble.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/slides.min.jquery.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/spacegallery.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/utils.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/bootstrap.min.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/custom.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/jquery.jOrgChart.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/prettify.css create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/example.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/example_vsp.html create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/images/bkgd.png create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/images/raspberry.jpg create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/jquery.jOrgChart.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/prettify.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/js/jquery-1.10.2.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/js/jquery-ui.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/js/jquery.mask.min.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/js/modalService.js create mode 100644 ecomp-sdk/sdk-app/src/main/webapp/static/js/search.js create mode 100644 ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/SanityTest.java create mode 100644 ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/controller/CollaborationControllerTest.java create mode 100644 ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/controller/NetMapTest.java create mode 100644 ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalapp/service/ProfileServiceTest.java create mode 100644 ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalsdk/core/MockApplicationContextTestSuite.java create mode 100644 ecomp-sdk/sdk-app/src/test/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleServiceTest.java create mode 100644 ecomp-sdk/sdk-workflow/.gitignore create mode 100644 ecomp-sdk/sdk-workflow/README.md create mode 100644 ecomp-sdk/sdk-workflow/pom.xml create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/NotebookController.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/NotebookTestController.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/RNoteBookController.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/controller/RNoteBookFEController.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/domain/RNoteBookCredentials.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/exception/RNotebookIntegrationException.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/service/RNoteBookIntegrationService.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/rnotebookintegration/service/RNoteBookIntegrationServiceImpl.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/controllers/WorkflowController.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/dao/HibernateConfiguration.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/dao/WorkflowDAO.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/dao/WorkflowDAOImpl.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/domain/WorkflowSchedule.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/models/Workflow.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/models/WorkflowLite.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/scheduler/WorkFlowScheduleJob.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/scheduler/WorkFlowScheduleRegistry.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleExecutor.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleService.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowScheduleServiceImpl.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowService.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/java/org/openecomp/portalsdk/workflow/services/WorkflowServiceImpl.java create mode 100644 ecomp-sdk/sdk-workflow/src/main/resources/RNoteBookIntegration.hbm.xml create mode 100644 ecomp-sdk/thirdparty/.gitignore create mode 100644 ecomp-sdk/thirdparty/README.md create mode 100644 ecomp-sdk/thirdparty/pom.xml create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/client/ECOMPSSOFilter.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/client/SecureServlet.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/client/UnSecureServlet.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/CipherUtil.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/ECOMPSSO.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/IPortalRestAPIService.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/IPortalUebAPIService.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalAPIException.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalAPIResponse.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalApiConstants.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalApiProperties.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalRestAPIProxy.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalTimeoutBindingListener.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalTimeoutHandler.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/PortalTimeoutVO.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/SessionCommunication.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/UserContextListener.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/crossapi/UserSessionListener.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FavoritesClient.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/FunctionalMenuClient.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/rest/RestWebServiceClient.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/Consumer.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/FunctionalMenu.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/Helper.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/Publisher.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/PublisherList.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/TopicManager.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebException.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebManager.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebMsg.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/UebMsgTypes.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/onboarding/ueb/WaitingRequestersQueueList.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/restful/domain/EcompRole.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/restful/domain/EcompUser.java create mode 100644 ecomp-sdk/thirdparty/src/main/java/org/openecomp/portalsdk/core/restful/domain/SharedContext.java diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..8a5478c --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=gerrit.openecomp.org +port=29418 +project=ecompsdkos.git \ No newline at end of file diff --git a/.idea/ecompsdkos.iml b/.idea/ecompsdkos.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/ecompsdkos.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..107a11b --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..ed67d0f --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..51e13c4 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1486485514698 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ecomp-sdk/LICENSE.txt b/ecomp-sdk/LICENSE.txt new file mode 100644 index 0000000..880bbc9 --- /dev/null +++ b/ecomp-sdk/LICENSE.txt @@ -0,0 +1,19 @@ +/* + * ============LICENSE_START=========================================================== + * ==================================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ==================================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================================== + * ECOMP and OpenECOMP are trademarks and service marks of AT&T Intellectual Property. + */ \ No newline at end of file diff --git a/ecomp-sdk/README.md b/ecomp-sdk/README.md new file mode 100644 index 0000000..f3a52dc --- /dev/null +++ b/ecomp-sdk/README.md @@ -0,0 +1,15 @@ +ECOMP Portal SDK +================ + +This is the parent Maven project for the following +ECOMP Portal SDK maven child projects: + +* SDK Framework library +* SDK Core library +* SDK Analytics library +* SDK Workflow library + +This area also includes the ECOMP Portal SDK web application, which +is a sample web app to build and deploy to a Tomcat instance. + +Release notes are published in each project. diff --git a/ecomp-sdk/pom.xml b/ecomp-sdk/pom.xml new file mode 100644 index 0000000..c327a7f --- /dev/null +++ b/ecomp-sdk/pom.xml @@ -0,0 +1,249 @@ + + + 4.0.0 + org.openecomp.ecompsdkos + ecompSDK-project + pom + + 1.0.0 + Ecomp Portal SDK Project (parent) + https://wiki/display/EcompPortal + + scm:git:https://gitlab/scm/st_quantum/quantum.git + scm:git:ssh://git@gitlab/st_quantum/quantum.git + HEAD + + + + + thirdparty + + quantum + sdk-analytics + sdk-workflow + + + + UTF-8 + 1610.3.10 + 4.2.0.RELEASE + 4.3.11.Final + + true + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + false + org.umlgraph.doclet.UmlGraphDoc + + org.umlgraph + umlgraph + 5.6 + + -views + true + + + + + + + + + nexus-snapshots + Nexus Maven Central - Snapshots + https://ecomp-nexus:8443/repository/maven-snapshots/ + + + + nexus + Nexus Maven Central - Releases + https://ecomp-nexus:8443/repository/maven-releases/ + + + oss-sonatype + oss sonatype Central + https://oss.sonatype.org/service/local/repositories/releases/content/ + + + + + + + + doclint-java8-disable + + [1.8,) + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + -Xdoclint:none + + + + + + + + + + + + com.blackducksoftware.integration + hub-maven-plugin + 1.4.0 + false + + ${project.name} + ${project.basedir} + + + + create-bdio-file + package + + createHubOutput + + + + + + org.codehaus.mojo + sonar-maven-plugin + 3.2 + + + org.apache.maven.plugins + maven-site-plugin + 3.6 + + + org.apache.maven.wagon + wagon-webdav-jackrabbit + 2.10 + + + + + + org.apache.maven.plugins + maven-scm-plugin + 1.8.1 + + developerConnection + branch + feature/BRANCH_OS + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.6 + + + + ${project.version} + ${sdk-internal.version} + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.3 + + + attach-javadocs + + jar + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.0 + + + attach-sources + + jar + + + + + + + org.apache.maven.plugins + maven-release-plugin + 2.5.3 + + + + + + + + + + + nexus + ecompsdk-repository-releases + https://ecomp-nexus:8443/repository/maven-releases + + + + nexus-snapshots + ecompsdk-repository-snapshots + https://ecomp-nexus:8443/repository/maven-snapshots + + + + nexus + dav:https://ecomp-nexus:8443/repository/portalsdk-javadoc/${version} + + + + + + JCenter + JCenter Repository + http://jcenter.bintray.com + + + + Restlet + Restlet Repository + http://maven.restlet.com + + + diff --git a/ecomp-sdk/quantum/.gitignore b/ecomp-sdk/quantum/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/ecomp-sdk/quantum/.gitignore @@ -0,0 +1 @@ +/target diff --git a/ecomp-sdk/quantum/README.md b/ecomp-sdk/quantum/README.md new file mode 100644 index 0000000..bf00b41 --- /dev/null +++ b/ecomp-sdk/quantum/README.md @@ -0,0 +1,11 @@ +ECOMP Portal SDK Core +===================== + +This is the Maven project for the ECOMP Portal SDK Core, +which is distributed as ecompSDK-core-nnn.jar. This library +requires Hibernate and Spring, and provides many features +such as data access, session management, logging, on-boarding +and more. Most of these features are used in the ECOMP SDK +web application. + + diff --git a/ecomp-sdk/quantum/pom.xml b/ecomp-sdk/quantum/pom.xml new file mode 100644 index 0000000..2ae9388 --- /dev/null +++ b/ecomp-sdk/quantum/pom.xml @@ -0,0 +1,330 @@ + + 4.0.0 + + + org.openecomp.ecompsdkos + ecompSDK-project + 1.0.0 + + + ecompSDK-core + jar + Ecomp Portal SDK Core (quantum) + + + + 6.4.0.Final + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.19.1 + + ${skiptests} + + **/Test*.java + **/*Test.java + **/*TestCase.java + + + classpath: + + + + + + + + + + + + + org.openecomp.ecompsdkos + ecompFW + ${project.version} + + + commons-logging + commons-logging + + + log4j + log4j + + + log4j + apache-log4j-extras + + + org.slf4j + slf4j-log4j12 + + + + + + + + + org.drools + drools-compiler + ${drools.version} + + + + + org.springframework + spring-core + ${springframework.version} + + + commons-logging + commons-logging + + + + + org.springframework + spring-web + ${springframework.version} + + + org.springframework + spring-webmvc + ${springframework.version} + + + org.springframework + spring-tx + ${springframework.version} + + + org.springframework + spring-context-support + ${springframework.version} + + + org.springframework + spring-orm + ${springframework.version} + + + org.springframework + spring-test + ${springframework.version} + + + org.springframework + spring-aop + ${springframework.version} + + + org.springframework.boot + spring-boot-starter + 1.3.0.RELEASE + + + org.slf4j + log4j-over-slf4j + + + ch.qos.logback + logback-classic + + + + + + org.aspectj + aspectjrt + 1.8.9 + + + + org.aspectj + aspectjweaver + 1.8.9 + + + + + + org.hibernate + hibernate-core + ${hibernate.version} + + + org.hibernate + hibernate-validator + 5.1.3.Final + + + + javax.servlet + javax.servlet-api + 3.1.0 + + + javax.servlet.jsp + javax.servlet.jsp-api + 2.3.1 + + + javax.servlet + jstl + 1.2 + + + + org.slf4j + jcl-over-slf4j + 1.7.12 + + + + org.slf4j + log4j-over-slf4j + 1.7.12 + + + com.mchange + c3p0 + 0.9.5.2 + + + + org.apache.tiles + tiles-core + 3.0.5 + + + org.apache.tiles + tiles-jsp + 3.0.5 + + + + org.yaml + snakeyaml + 1.15 + + + + com.fasterxml.jackson.core + jackson-annotations + 2.6.3 + + + com.fasterxml.jackson.core + jackson-core + 2.6.3 + + + com.fasterxml.jackson.core + jackson-databind + 2.6.3 + + + mysql + mysql-connector-java + 5.1.22 + + + + org.apache.jcs + jcs + 1.3 + + + * + * + + + + + + + org.apache.tomcat + tomcat-websocket + 8.0.28 + provided + + + + concurrent + concurrent + 1.3.2 + + + * + * + + + + + + junit + junit + 4.12 + + + + + + commons-codec + commons-codec + 1.10 + + + commons-lang + commons-lang + 2.6 + + + + + org.quartz-scheduler + quartz + 2.2.1 + + + + c3p0 + c3p0 + + + + + + + org.elasticsearch + elasticsearch + 2.2.0 + + + io.searchbox + jest + 2.0.0 + + + commons-logging + commons-logging + + + + + + com.att.eelf + eelf-core + 0.0.1 + + + + diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/FusionObject.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/FusionObject.java new file mode 100644 index 0000000..0086638 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/FusionObject.java @@ -0,0 +1,113 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core; + +/** + *

+ * Title: FusionObject + *

+ * + *

+ * Description: This interface is implemented by all top-level support classes + * of each package in FUSION. This allows all top-level support classes to have + * some commonality for easier maintenance. + *

+ * + *

+ * Copyright: Copyright (c) 2007 + *

+ * + * + * @version 1.1 + */ +public interface FusionObject { + + public class Parameters { + // HashMap parameters passed to the Service and Dao tiers + public static final String PARAM_USERID = "userId"; + public static final String PARAM_HTTP_REQUEST = "request"; + public static final String PARAM_FILTERS = "filters"; + public static final String PARAM_CLIENT_DEVICE = "client_device"; + // Request parameters passed in the Web tier + public static final String REQUEST_PARAM_DISPLAY_SUCCESS_MESSAGE = "display_success_message"; + } + + /** + *

+ * Title: FusionObject.Utilities + *

+ * + *

+ * Description: Inner class that has some utility functions available for + * any class that implements it. + *

+ * + *

+ * Copyright: Copyright (c) 2007 + *

+ * + * + * @version 1.1 + */ + public class Utilities { + /** + * nvl - replaces a string value with an empty string if null. + * + * @param s + * String - the string value that needs to be checked + * @return String - returns the original string value if not null. + * Otherwise an empty string ("") is returned. + */ + public static String nvl(String s) { + return (s == null) ? "" : s; + } + + /** + * nvl - replaces a string value with a default value if null. + * + * @param s + * String - the string value that needs to be checked + * @param sDefault + * String - the default value + * @return String - returns the original string value if not null. + * Otherwise the default value is returned. + */ + public static String nvl(String s, String sDefault) { + return nvl(s).equals("") ? sDefault : s; + } + + /** + * Tests the specified string for nullity. + * + * @param a + * String to test for nullity. + * @return True if the specified string is null, empty or the 4-character + * sequence "null" (ignoring case); otherwise false. + */ + public static boolean isNull(String a) { + if ((a == null) || (a.length() == 0) || a.equalsIgnoreCase("null")) + return true; + else + return false; + } + + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/LoginBean.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/LoginBean.java new file mode 100644 index 0000000..e5a58e8 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/LoginBean.java @@ -0,0 +1,196 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.command; + +import java.util.Set; + +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.domain.support.FusionCommand; + +public class LoginBean extends FusionCommand { + + private String loginId; + private String loginPwd; + private String hrid; + private String userid; + private String siteAccess; + private String loginErrorMessage; + + private User user; + @SuppressWarnings("rawtypes") + private Set menu; + @SuppressWarnings("rawtypes") + private Set businessDirectMenu; + + /** + * getLoginId + * + * @return String + */ + public String getLoginId() { + return loginId; + } + + /** + * getLoginPwd + * + * @return String + */ + public String getLoginPwd() { + return loginPwd; + } + + /** + * getMenu + * + * @return Set + */ + @SuppressWarnings("rawtypes") + public Set getMenu() { + return menu; + } + + /** + * getUser + * + * @return User + */ + public User getUser() { + return user; + } + + /** + * getHrid + * + * @return String + */ + public String getHrid() { + return hrid; + } + + /** + * getSiteAccess + * + * @return String + */ + public String getSiteAccess() { + return siteAccess; + } + + /** + * getBusinessDirectMenu + * + * @return Set + */ + @SuppressWarnings("rawtypes") + public Set getBusinessDirectMenu() { + return businessDirectMenu; + } + + /** + * getLoginErrorMessage + * + * @return String + */ + public String getLoginErrorMessage() { + return loginErrorMessage; + } + + + + /** + * setLoginId + * + * @param loginId String + */ + public void setLoginId(String loginId) { + this.loginId = loginId; + } + + /** + * setLoginPwd + * + * @param loginPwd String + */ + public void setLoginPwd(String loginPwd) { + this.loginPwd = loginPwd; + } + + @SuppressWarnings("rawtypes") + public void setMenu(Set menu) { + this.menu = menu; + } + + /** + * setUser + * + * @param user User + */ + public void setUser(User user) { + this.user = user; + } + + /** + * setHrid + * + * @param hrid String + */ + public void setHrid(String hrid) { + this.hrid = hrid; + } + + /** + * setSiteAccess + * + * @param siteAccess String + */ + public void setSiteAccess(String siteAccess) { + this.siteAccess = siteAccess; + } + + /** + * setBusinessDirectMenu + * + * @param businessDirectMenu Set + */ + @SuppressWarnings("rawtypes") + public void setBusinessDirectMenu(Set businessDirectMenu) { + this.businessDirectMenu = businessDirectMenu; + } + + /** + * setLoginErrorMessage + * + * @param loginErrorMessage String + */ + public void setLoginErrorMessage(String loginErrorMessage) { + this.loginErrorMessage = loginErrorMessage; + } + + public String getUserid() { + return userid; + } + + public void setUserid(String userid) { + this.userid = userid; + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/PostDroolsBean.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/PostDroolsBean.java new file mode 100644 index 0000000..541d9f7 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/PostDroolsBean.java @@ -0,0 +1,51 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.command; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +@JsonSerialize +public class PostDroolsBean { + + private String droolsFile; + private String className; + private String selectedRules; + + public String getDroolsFile() { + return droolsFile; + } + public void setDroolsFile(String droolsFile) { + this.droolsFile = droolsFile; + } + public String getSelectedRules() { + return selectedRules; + } + public void setSelectedRules(String selectedRules) { + this.selectedRules = selectedRules; + } + public String getClassName() { + return className; + } + public void setClassName(String className) { + this.className = className; + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/PostSearchBean.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/PostSearchBean.java new file mode 100644 index 0000000..b07b8fe --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/PostSearchBean.java @@ -0,0 +1,374 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.command; + +import java.util.List; + +import org.openecomp.portalsdk.core.command.support.SearchBase; +import org.openecomp.portalsdk.core.domain.User; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +@JsonSerialize +public class PostSearchBean extends SearchBase { + + private User user = null; + private User userOrig = null; + private String[] selected; + private String[] postHrid; + private String[] postOrgUserId; + private String[] postFirstName; + private String[] postLastName; + private String[] postOrgCode; + private String[] postPhone; + private String[] postEmail; + private String[] postAddress1; + private String[] postAddress2; + private String[] postCity; + private String[] postState; + private String[] postZipCode; + private String[] postLocationClli; + private String[] postBusinessCountryCode; + private String[] postBusinessCountryName; + private String[] postDepartment; + private String[] postDepartmentName; + private String[] postBusinessUnit; + private String[] postBusinessUnitName; + private String[] postJobTitle; + private String[] postOrgManagerUserId; + private String[] postCommandChain; + private String[] postCompanyCode; + private String[] postCompany; + private String[] postCostCenter; + private String[] postSiloStatus; + private String[] postFinancialLocCode; + + + public PostSearchBean() { + this(null); + } // PostSearchBean + + @SuppressWarnings("rawtypes") + public PostSearchBean(List items) { + super(items); + + user = new User(); + userOrig = new User(); + + setSortBy1(""); + setSortBy1Orig(""); + + //setSortByList(...); + } // PostSearchBean + + + public String getFirstName() { return user.getFirstName(); } + public String getLastName() { return user.getLastName(); } + public String getHrid() { return user.getHrid(); } + public String getOrgUserId() { return user.getOrgUserId(); } + public String getOrgCode() { return user.getOrgCode(); } + public String getEmail() { return user.getEmail(); } + public String getOrgManagerUserId() { return user.getOrgManagerUserId(); } + + public String getFirstNameOrig() { return user.getFirstName(); } + public String getLastNameOrig() { return user.getLastName(); } + public String getHridOrig() { return user.getHrid(); } + public String getOrgUserIdOrig() { return user.getOrgUserId(); } + public String getOrgCodeOrig() { return user.getOrgCode(); } + public String getEmailOrig() { return user.getEmail(); } + public String getOrgManagerUserIdOrig() { return user.getOrgManagerUserId(); } + + + public User getUser() { return user; } + + public String[] getPostEmail() { + return postEmail; + } + + public String[] getPostFirstName() { + return postFirstName; + } + + public String[] getPostHrid() { + return postHrid; + } + + public String[] getPostLastName() { + return postLastName; + } + + public String[] getPostOrgCode() { + return postOrgCode; + } + + public String[] getPostPhone() { + return postPhone; + } + + public String[] getPostOrgUserId() { + return postOrgUserId; + } + + public String[] getSelected() { + return selected; + } + + public String[] getPostAddress1() { + return postAddress1; + } + + public String[] getPostBusinessCountryCode() { + return postBusinessCountryCode; + } + + public String[] getPostCity() { + return postCity; + } + + public String[] getPostCommandChain() { + return postCommandChain; + } + + public String[] getPostCompany() { + return postCompany; + } + + public String[] getPostCompanyCode() { + return postCompanyCode; + } + + public String[] getPostDepartment() { + return postDepartment; + } + + public String[] getPostDepartmentName() { + return postDepartmentName; + } + + public String[] getPostBusinessCountryName() { + return postBusinessCountryName; + } + + public String[] getPostJobTitle() { + return postJobTitle; + } + + public String[] getPostLocationClli() { + return postLocationClli; + } + + public String[] getPostOrgManagerUserId() { + return postOrgManagerUserId; + } + + public String[] getPostState() { + return postState; + } + + public String[] getPostZipCode() { + return postZipCode; + } + + public void setFirstName(String value) { user.setFirstName(value); } + public void setLastName(String value) { user.setLastName(value); } + public void setHrid(String value) { user.setHrid(value); } + public void setOrgUserId(String value) { user.setOrgUserId(value); } + public void setOrgCode(String value) { user.setOrgCode(value); } + public void setEmail(String value) { user.setEmail(value); } + public void setOrgManagerUserId(String value) { user.setOrgManagerUserId(value); } + + public void setFirstNameOrig(String value) { userOrig.setFirstName(value); } + public void setLastNameOrig(String value) { userOrig.setLastName(value); } + public void setHridOrig(String value) { userOrig.setHrid(value); } + public void setOrgUserIdOrig(String value) { userOrig.setOrgUserId(value); } + public void setOrgCodeOrig(String value) { userOrig.setOrgCode(value); } + public void setEmailOrig(String value) { userOrig.setEmail(value); } + public void setOrgManagerUserIdOrig(String value) { userOrig.setOrgManagerUserId(value); } + + public void setUser(User value) { this.user = value; } + + public void setPostEmail(String[] postEmail) { + this.postEmail = postEmail; + } + + public void setPostFirstName(String[] postFirstName) { + this.postFirstName = postFirstName; + } + + public void setPostHrid(String[] postHrid) { + this.postHrid = postHrid; + } + + public void setPostLastName(String[] postLastName) { + this.postLastName = postLastName; + } + + public void setPostOrgCode(String[] postOrgCode) { + this.postOrgCode = postOrgCode; + } + + public void setPostPhone(String[] postPhone) { + this.postPhone = postPhone; + } + + public void setPostOrgUserId(String[] postOrgUserId) { + this.postOrgUserId = postOrgUserId; + } + + public void setSelected(String[] selected) { + this.selected = selected; + } + + public void setPostAddress1(String[] postAddress1) { + this.postAddress1 = postAddress1; + } + + public void setPostBusinessCountryCode(String[] postBusinessCountryCode) { + this.postBusinessCountryCode = postBusinessCountryCode; + } + + public void setPostCity(String[] postCity) { + this.postCity = postCity; + } + + public void setPostCommandChain(String[] postCommandChain) { + this.postCommandChain = postCommandChain; + } + + public void setPostCompany(String[] postCompany) { + this.postCompany = postCompany; + } + + public void setPostCompanyCode(String[] postCompanyCode) { + this.postCompanyCode = postCompanyCode; + } + + public void setPostDepartment(String[] postDepartment) { + this.postDepartment = postDepartment; + } + + public void setPostDepartmentName(String[] postDepartmentName) { + this.postDepartmentName = postDepartmentName; + } + + public void setPostBusinessCountryName(String[] postBusinessCountryName) { + this.postBusinessCountryName = postBusinessCountryName; + } + + public void setPostJobTitle(String[] postJobTitle) { + this.postJobTitle = postJobTitle; + } + + public void setPostLocationClli(String[] postLocationClli) { + this.postLocationClli = postLocationClli; + } + + public void setPostOrgManagerUserId(String[] postOrgManagerUserId) { + this.postOrgManagerUserId = postOrgManagerUserId; + } + + public void setPostState(String[] postState) { + this.postState = postState; + } + + public void setPostZipCode(String[] postZipCode) { + this.postZipCode = postZipCode; + } + + public String[] getPostAddress2() { + return postAddress2; + } + + public void setPostAddress2(String[] postAddress2) { + this.postAddress2 = postAddress2; + } + + public User getUserOrig() { + return userOrig; + } + + public void setUserOrig(User userOrig) { + this.userOrig = userOrig; + } + + public String[] getPostBusinessUnit() { + return postBusinessUnit; + } + + public void setPostBusinessUnit(String[] postBusinessUnit) { + this.postBusinessUnit = postBusinessUnit; + } + + public String[] getPostBusinessUnitName() { + return postBusinessUnitName; + } + + public void setPostBusinessUnitName(String[] postBusinessUnitName) { + this.postBusinessUnitName = postBusinessUnitName; + } + + public String[] getPostCostCenter() { + return postCostCenter; + } + + public void setPostCostCenter(String[] postCostCenter) { + this.postCostCenter = postCostCenter; + } + + public String[] getPostSiloStatus() { + return postSiloStatus; + } + + public void setPostSiloStatus(String[] postSiloStatus) { + this.postSiloStatus = postSiloStatus; + } + + public String[] getPostFinancialLocCode() { + return postFinancialLocCode; + } + + public void setPostFinancialLocCode(String[] postFinancialLocCode) { + this.postFinancialLocCode = postFinancialLocCode; + } + + public void resetSearch() { + super.resetSearch(); + setUser(new User()); + } // resetSearch + + + public boolean isCriteriaUpdated() { + if(user==null&&userOrig==null) + return false; + else if(user==null||userOrig==null) + return true; + else + return (! ( + Utilities.nvl(user.getFirstName()).equals(Utilities.nvl(userOrig.getFirstName()))&& + Utilities.nvl(user.getLastName()).equals(Utilities.nvl(userOrig.getLastName()))&& + //Utilities.nvl(user.getHrid()).equals(Utilities.nvl(userOrig.getHrid()))&& + Utilities.nvl(user.getOrgUserId()).equals(Utilities.nvl(userOrig.getOrgUserId()))&& + Utilities.nvl(user.getOrgCode()).equals(Utilities.nvl(userOrig.getOrgCode()))&& + Utilities.nvl(user.getEmail()).equals(Utilities.nvl(userOrig.getEmail()))&& + Utilities.nvl(user.getOrgManagerUserId()).equals(Utilities.nvl(userOrig.getOrgManagerUserId()))&& + true)); + } // isCriteriaUpdated + +} // PostSearchBean diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/UserRowBean.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/UserRowBean.java new file mode 100644 index 0000000..7230add --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/UserRowBean.java @@ -0,0 +1,85 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.command; + +import org.openecomp.portalsdk.core.domain.User; + +public class UserRowBean extends User { + + /** + * + */ + private static final long serialVersionUID = -2724597119083972190L; + private String sessionId; + private String lastAccess; + private String remaining; + private String loginTime; + private String LastLoginTime; + + + public String getLastAccess(){ + return this.lastAccess; + } + + + public void setLastAccess(String lastAccess){ + this.lastAccess = lastAccess; + } + + + public String getRemaining(){ + return this.remaining; + } + + + public void setRemaining(String remaining){ + this.remaining = remaining; + } + + + public String getSessionId() { + return sessionId; + } + + + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + + + public String getLoginTime() { + return loginTime; + } + + + public void setLoginTime(String loginTime) { + this.loginTime = loginTime; + } + + + public String getLastLoginTime() { + return LastLoginTime; + } + + + public void setLastLoginTime(String lastLoginTime) { + LastLoginTime = lastLoginTime; + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/support/SearchBase.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/support/SearchBase.java new file mode 100644 index 0000000..6fb60aa --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/support/SearchBase.java @@ -0,0 +1,268 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.command.support; + +import java.util.List; + +import org.openecomp.portalsdk.core.domain.support.FusionCommand; + +public abstract class SearchBase extends FusionCommand { + + public static String SORT_BY_MODIFIER_DESC = "D"; + public static String SORT_BY_MODIFIER_ASC = "A"; + public static String SORT_BY_MODIFIER_DESC_IMAGE_NAME = "sort_desc.gif"; + public static String SORT_BY_MODIFIER_ASC_IMAGE_NAME = "sort_asc.gif"; + + + private String sortBy1 = null; + private String sortBy2 = null; + private String sortBy3 = null; + + private String sortBy1Orig = null; + private String sortBy2Orig = null; + private String sortBy3Orig = null; + + private String sortByModifier1 = null; + private String sortByModifier2 = null; + private String sortByModifier3 = null; + + private String sortByModifier1Orig = null; + private String sortByModifier2Orig = null; + private String sortByModifier3Orig = null; + + private String accessType = "WRITE"; //null; + + private String submitAction = ""; + private String masterId = ""; + private String detailId = ""; + + private String showResult = "Y"; + + private SearchResult searchResult = null; + + @SuppressWarnings("rawtypes") + public SearchBase(List items) { + searchResult = (items == null) ? (new SearchResult()) : (new SearchResult(items)); + } // SearchBase + + + public String getSortBy1() { + return sortBy1; + } + + public String getSortBy2() { + return sortBy2; + } + + public String getSortBy3() { + return sortBy3; + } + + public String getSortBy1Orig() { + return sortBy1; + } + + public String getSortBy2Orig() { + return sortBy2; + } + + public String getSortBy3Orig() { + return sortBy3; + } + + public String getAccessType() { + return accessType; + } + + public String getSubmitAction() { + return submitAction; + } + + public String getMasterId() { + return masterId; + } + + public String getDetailId() { + return detailId; + } + + public String getShowResult() { + return showResult; + } + + //public ArrayList getSortByList() { return sortByList; } + + public SearchResult getSearchResult() { + return searchResult; + } + + public String getSortByModifier1() { + return sortByModifier1; + } + + public String getSortByModifier1Orig() { + return sortByModifier1; + } + + public String getSortByModifier2() { + return sortByModifier2; + } + + public String getSortByModifier2Orig() { + return sortByModifier2; + } + + public String getSortByModifier3() { + return sortByModifier3; + } + + public String getSortByModifier3Orig() { + return sortByModifier3; + } + + public int getPageNo() { + return (isCriteriaUpdated() || isSortingUpdated()) ? 0 : getSearchResult().getPageNo(); + } + + public int getPageSize() { + return getSearchResult().getPageSize(); + } + + public int getDataSize() { + return getSearchResult().getDataSize(); + } + + public int getNewDataSize() { + return isCriteriaUpdated() ? -1 : getDataSize(); + } + + + public void setSortBy1(String sortBy1) { + this.sortBy1 = sortBy1; + } + + public void setSortBy2(String sortBy2) { + this.sortBy2 = sortBy2; + } + + public void setSortBy3(String sortBy3) { + this.sortBy3 = sortBy3; + } + + public void setSortBy1Orig(String sortBy1Orig) { + this.sortBy1Orig = sortBy1Orig; + } + + public void setSortBy2Orig(String sortBy2Orig) { + this.sortBy2Orig = sortBy2Orig; + } + + public void setSortBy3Orig(String sortBy3Orig) { + this.sortBy3Orig = sortBy3Orig; + } + + public void setAccessType(String accessType) { + this.accessType = accessType; + } + + public void setSubmitAction(String submitAction) { + this.submitAction = submitAction; + } + + public void setMasterId(String masterId) { + this.masterId = masterId; + } + + public void setDetailId(String detailId) { + this.detailId = detailId; + } + + public void setShowResult(String showResult) { + this.showResult = showResult; + } + + public void setSearchResult(SearchResult searchResult) { + this.searchResult = searchResult; + } + + public void setSortByModifier1(String sortByModifier1) { + this.sortByModifier1 = sortByModifier1; + } + + public void setSortByModifier1Orig(String sortByModifier1Orig) { + this.sortByModifier1Orig = sortByModifier1Orig; + } + + public void setSortByModifier2(String sortByModifier2) { + this.sortByModifier2 = sortByModifier2; + } + + public void setSortByModifier2Orig(String sortByModifier2Orig) { + this.sortByModifier2Orig = sortByModifier2Orig; + } + + public void setSortByModifier3(String sortByModifier3) { + this.sortByModifier3 = sortByModifier3; + } + + public void setSortByModifier3Orig(String sortByModifier3Orig) { + this.sortByModifier3Orig = sortByModifier3Orig; + } + + public void setSortingUpdated(boolean sortingUpdated) { + } + + public void setPageNo(int pageNo) { + getSearchResult().setPageNo(pageNo); + } + + public void setPageSize(int pageSize) { + getSearchResult().setPageSize(pageSize); + } + + public void setDataSize(int dataSize) { + getSearchResult().setDataSize(dataSize); + } + + + public void resetSearch() { + setSortBy1(null); + setSortBy2(null); + setSortBy3(null); + setSortByModifier1(SearchBase.SORT_BY_MODIFIER_ASC); + setSortByModifier2(SearchBase.SORT_BY_MODIFIER_ASC); + setSortByModifier3(SearchBase.SORT_BY_MODIFIER_ASC); + setPageNo(0); + setDataSize( -1); + } // resetSearch + + + public abstract boolean isCriteriaUpdated(); + + public boolean isSortingUpdated() { + return (!(Utilities.nvl(sortBy1).equals(Utilities.nvl(sortBy1Orig)) && + Utilities.nvl(sortBy2).equals(Utilities.nvl(sortBy2Orig)) && + Utilities.nvl(sortBy3).equals(Utilities.nvl(sortBy3Orig)) && + Utilities.nvl(sortByModifier1).equals(Utilities.nvl(sortByModifier1Orig)) && + Utilities.nvl(sortByModifier2).equals(Utilities.nvl(sortByModifier2Orig)) && + Utilities.nvl(sortByModifier3).equals(Utilities.nvl(sortByModifier3Orig)))); + } // isSortingUpdated + +} // SearchBase diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/support/SearchResult.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/support/SearchResult.java new file mode 100644 index 0000000..4a2c05f --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/command/support/SearchResult.java @@ -0,0 +1,58 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.command.support; + +import java.util.ArrayList; +import java.util.List; + +@SuppressWarnings("rawtypes") +public class SearchResult extends ArrayList implements java.io.Serializable { + /** + * + */ + private static final long serialVersionUID = -451947878984459011L; + private int pageNo = 0; + private int pageSize = 50; + private int dataSize = -1; + + private String accessType = null; + + public SearchResult() {} + + @SuppressWarnings("unchecked") + public SearchResult(List items) { + super(items); + } + + public int getPageNo() { return pageNo; } + public int getPageSize() { return pageSize; } + public int getDataSize() { return dataSize; } + + public int getSize() { return size(); } // for Struts bean property access + + public String getAccessType() { return accessType; } + + public void setPageNo(int pageNo) { this.pageNo=pageNo; } + public void setPageSize(int pageSize) { this.dataSize=pageSize; } + public void setDataSize(int dataSize) { this.dataSize=dataSize; } + + public void setAccessType(String accessType) { this.accessType = accessType; } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/AppConfig.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/AppConfig.java new file mode 100644 index 0000000..3a4753e --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/AppConfig.java @@ -0,0 +1,301 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.conf; + +import java.util.ArrayList; +import java.util.List; + +import javax.sql.DataSource; + +import org.openecomp.portalsdk.core.interceptor.ResourceInterceptor; +import org.openecomp.portalsdk.core.interceptor.SessionTimeoutInterceptor; +import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum; +import org.openecomp.portalsdk.core.logging.format.AppMessagesEnum; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.menu.MenuBuilder; +import org.openecomp.portalsdk.core.service.DataAccessService; +import org.openecomp.portalsdk.core.service.DataAccessServiceImpl; +import org.openecomp.portalsdk.core.util.CipherUtil; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.web.support.AppUtils; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.context.annotation.Bean; +import org.springframework.web.servlet.ViewResolver; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.view.InternalResourceViewResolver; +import org.springframework.web.servlet.view.JstlView; +import org.springframework.web.servlet.view.UrlBasedViewResolver; +import org.springframework.web.servlet.view.tiles3.TilesConfigurer; +import org.springframework.web.servlet.view.tiles3.TilesView; + +import com.mchange.v2.c3p0.ComboPooledDataSource; + +/** + * Configures Spring features in the ECOMP Portal SDK including request + * interceptors and view resolvers. Application should subclass and override + * methods as needed. + */ +public class AppConfig extends WebMvcConfigurerAdapter implements Configurable, ApplicationContextAware { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppConfig.class); + + private final List tileDefinitions = new ArrayList(); + protected ApplicationContext appApplicationContext = null; + + public AppConfig() { + //loads all default fields and marks logging + //has been started for each log file type. + initGlobalLocalContext(); + } + + /** + * Creates and returns a new instance of a secondary (order=2) + * {@link ViewResolver} that finds files by adding prefix "/WEB-INF/jsp/" + * and suffix ".jsp" to the base view name. + * + * @return New instance of {@link ViewResolver}. + */ + @Bean + public ViewResolver viewResolver() { + InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); + viewResolver.setViewClass(JstlView.class); + viewResolver.setPrefix("/WEB-INF/jsp/"); + viewResolver.setSuffix(".jsp"); + viewResolver.setOrder(2); + return viewResolver; + } + + /** + * Loads all the default logging fields into the + * global MDC context and marks each log file type + * that logging has been started. + */ + private void initGlobalLocalContext() { + logger.init(); + } + + /* + * Any requests from the url pattern /static/**, Spring will look for the + * resources from the /static/ Same as in xml + */ + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + // registry.addResourceHandler("/static/**").addResourceLocations("/static/"); + registry.addResourceHandler("/**").addResourceLocations("/"); + } + + /** + * Creates and returns a new instance of a {@link DataAccessService} class. + * + * @return New instance of {@link DataAccessService}. + */ + @Bean + public DataAccessService dataAccessService() { + return new DataAccessServiceImpl(); + } + + /** + * Creates and returns a new instance of a {@link SystemProperties} class. + * + * @return New instance of {@link SystemProperties}. + */ + @Bean + public SystemProperties systemProperties() { + return new SystemProperties(); + } + + /** + * Creates and returns a new instance of a {@link MenuBuilder} class. + * + * @return New instance of {@link MenuBuilder}. + */ + @Bean + public MenuBuilder menuBuilder() { + return new MenuBuilder(); + } + + /** + * Creates and returns a new instance of a {@link UserUtils} class. + * + * @return New instance of {@link UserUtils}. + */ + @Bean + public UserUtils userUtil() { + return new UserUtils(); + } + + /** + * Creates and returns a new instance of an {@link AppUtils} class. + * + * @return New instance of {@link AppUtils}. + */ + @Bean + public AppUtils appUtils() { + return new AppUtils(); + } + + /** + * Creates and returns a new instance of a {@link TilesConfigurer} class. + * + * @return New instance of {@link TilesConfigurer}. + */ + @Bean + public TilesConfigurer tilesConfigurer() { + TilesConfigurer tilesConfigurer = new TilesConfigurer(); + tilesConfigurer.setDefinitions(tileDefinitions()); + tilesConfigurer.setCheckRefresh(true); + return tilesConfigurer; + } + + /** + * + * Application Data Source + * + * @return DataSource Object + */ + + @Bean + public DataSource dataSource() throws Exception { + systemProperties(); + ComboPooledDataSource dataSource = new ComboPooledDataSource(); + try { + dataSource.setDriverClass(SystemProperties.getProperty(SystemProperties.DB_DRIVER)); + dataSource.setJdbcUrl(SystemProperties.getProperty(SystemProperties.DB_CONNECTIONURL)); + dataSource.setUser(SystemProperties.getProperty(SystemProperties.DB_USERNAME)); + // dataSource.setPassword(SystemProperties.getProperty(SystemProperties.DB_PASSWOR)); + String password = SystemProperties.getProperty(SystemProperties.DB_PASSWOR); + if (SystemProperties.containsProperty(SystemProperties.DB_ENCRYPT_FLAG)) { + String encryptFlag = SystemProperties.getProperty(SystemProperties.DB_ENCRYPT_FLAG); + if (encryptFlag != null && encryptFlag.equalsIgnoreCase("true")) { + password = CipherUtil.decrypt(password); + } + } + dataSource.setPassword(password); + dataSource + .setMinPoolSize(Integer.parseInt(SystemProperties.getProperty(SystemProperties.DB_MIN_POOL_SIZE))); + dataSource + .setMaxPoolSize(Integer.parseInt(SystemProperties.getProperty(SystemProperties.DB_MAX_POOL_SIZE))); + dataSource.setIdleConnectionTestPeriod( + Integer.parseInt(SystemProperties.getProperty(SystemProperties.IDLE_CONNECTION_TEST_PERIOD))); + dataSource.setTestConnectionOnCheckout(true); + dataSource.setPreferredTestQuery("SELECT 1"); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Error initializing database, verify database settings in properties file: " + + UserUtils.getStackTrace(e),AlarmSeverityEnum.CRITICAL); + logger.error(EELFLoggerDelegate.debugLogger, "Error initializing database, verify database settings in properties file: " + + UserUtils.getStackTrace(e),AlarmSeverityEnum.CRITICAL); + // Raise an alarm that opening a connection to the database is + // failed. + logger.logEcompError(AppMessagesEnum.BeDaoSystemError); + throw e; + } + return dataSource; + } + + /* + * TODO: Check whether it is appropriate to extend the list of tile + * definitions at every invocation. + */ + protected String[] tileDefinitions() { + tileDefinitions.add("/WEB-INF/fusion/defs/definitions.xml"); + tileDefinitions.addAll(addTileDefinitions()); + + return tileDefinitions.toArray(new String[0]); + } + + /** + * Creates and returns a new empty list. This method should be overridden by + * child classes. + * + * @return An empty list. + */ + public List addTileDefinitions() { + return new ArrayList(); + } + + /** + * Creates and returns a new instance of a primary (order=1) + * {@link UrlBasedViewResolver} that finds files using the contents of + * definitions.xml files. + * + * @return New instance of {@link UrlBasedViewResolver} + */ + @Bean + public UrlBasedViewResolver tileViewResolver() { + UrlBasedViewResolver viewResolver = new UrlBasedViewResolver(); + viewResolver.setViewClass(TilesView.class); + viewResolver.setOrder(1); + return viewResolver; + } + + /** + * Adds new instances of the following interceptors to the specified + * interceptor registry: {@link SessionTimeoutInterceptor}, + * {@link ResourceInterceptor} + */ + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(new SessionTimeoutInterceptor()) + .excludePathPatterns(getExcludeUrlPathsForSessionTimeout()); + registry.addInterceptor(resourceInterceptor()); + } + + /** + * Creates and returns a new instance of a {@link ResourceInterceptor}. + * + * @return New instance of {@link ResourceInterceptor} + */ + @Bean + public ResourceInterceptor resourceInterceptor() { + return new ResourceInterceptor(); + } + + private String[] excludeUrlPathsForSessionTimeout = {}; + + /** + * Gets the array of Strings that are paths excluded for session timeout. + * + * @return Array of String + */ + public String[] getExcludeUrlPathsForSessionTimeout() { + return excludeUrlPathsForSessionTimeout; + } + + /** + * Sets the array of Strings that are paths excluded for session timeout. + */ + public void setExcludeUrlPathsForSessionTimeout(final String... excludeUrlPathsForSessionTimeout) { + this.excludeUrlPathsForSessionTimeout = excludeUrlPathsForSessionTimeout; + } + + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + appApplicationContext = applicationContext; + + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/AppInitializer.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/AppInitializer.java new file mode 100644 index 0000000..df0d56d --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/AppInitializer.java @@ -0,0 +1,69 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.conf; + +import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; + +public abstract class AppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppInitializer.class); + private final String activeProfile = "src"; + + @Override + protected WebApplicationContext createServletApplicationContext() { + WebApplicationContext context = super.createServletApplicationContext(); + + try { + + ((ConfigurableEnvironment) context.getEnvironment()).setActiveProfiles(activeProfile); + } catch (Exception e) { + + logger.error(EELFLoggerDelegate.errorLogger, "Unable to set the active profile" + e.getMessage(),AlarmSeverityEnum.MAJOR); + throw e; + + } + + return context; + } + + @Override + protected Class[] getRootConfigClasses() { + return null; + } + + @Override + protected Class[] getServletConfigClasses() { + + return new Class[] { AppConfig.class }; + } + + /* + * URL request will direct to the Spring dispatcher for processing + */ + @Override + protected String[] getServletMappings() { + return new String[] { "/" }; + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/Configurable.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/Configurable.java new file mode 100644 index 0000000..9585e45 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/Configurable.java @@ -0,0 +1,38 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.conf; + +import java.util.List; + +import org.openecomp.portalsdk.core.service.DataAccessService; +import org.springframework.web.servlet.ViewResolver; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; + +public interface Configurable { + + public ViewResolver viewResolver(); + + public void addResourceHandlers(ResourceHandlerRegistry registry) ; + + public DataAccessService dataAccessService(); + + public List addTileDefinitions(); + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/HibernateConfiguration.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/HibernateConfiguration.java new file mode 100644 index 0000000..b70ced4 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/HibernateConfiguration.java @@ -0,0 +1,155 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.conf; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import javax.sql.DataSource; + +import org.hibernate.SessionFactory; +import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.orm.hibernate4.HibernateTransactionManager; +import org.springframework.orm.hibernate4.LocalSessionFactoryBean; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import com.mchange.v2.c3p0.ComboPooledDataSource; + +@Configuration +@EnableTransactionManagement +public class HibernateConfiguration { + + @Autowired + private SystemProperties systemProperties; + + @Autowired + private HibernateMappingLocatable mappingLocate; + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HibernateConfiguration.class); + + DataSource dataSource; + + + @Bean + public LocalSessionFactoryBean sessionFactory() { + LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); + sessionFactory.setDataSource(getDataSource()); + sessionFactory.setPackagesToScan(new String[] { "org.openecomp"}); + sessionFactory.setHibernateProperties(hibernateProperties()); + sessionFactory.setMappingLocations(mappingLocate.getMappingLocations()); + return sessionFactory; + } + + + + + @SuppressWarnings("rawtypes") + @Bean + public Map dataSourceMap() throws Exception { + Connection conn = null; + Statement stmt = null; + Map dataSourceMap = new HashMap(); + + try { + conn = getDataSource().getConnection(); + stmt = conn.createStatement(); + String sql; + sql = "SELECT schema_id,datasource_type,connection_url,user_name,password,driver_class,min_pool_size,max_pool_size,idle_connection_test_period FROM schema_info"; + ResultSet rs = stmt.executeQuery(sql); + + while (rs.next()) { + ComboPooledDataSource dataSource = new ComboPooledDataSource(); + dataSource.setDriverClass(rs.getString("driver_class")); + dataSource.setJdbcUrl(rs.getString("connection_url")); + dataSource.setUser(rs.getString("user_name")); + dataSource.setPassword(rs.getString("password")); + dataSource.setMinPoolSize(rs.getInt("min_pool_size")); + dataSource.setMaxPoolSize(rs.getInt("max_pool_size")); + dataSource.setIdleConnectionTestPeriod(rs.getInt("idle_connection_test_period")); + dataSourceMap.put(rs.getString("schema_id"), dataSource); + } + rs.close(); + stmt.close(); + conn.close(); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Error initializing database, verify database settings in properties file: " + e.getMessage(),AlarmSeverityEnum.CRITICAL); + e.printStackTrace(); + dataSourceMap = null; + throw e; + } finally { + try { + if (stmt != null) + stmt.close(); + } catch (SQLException se2) {} + try { + if (conn != null) + conn.close(); + } catch (SQLException se) { se.printStackTrace();} + } + + return dataSourceMap; + } + + private Properties hibernateProperties() { + Properties properties = new Properties(); + properties.put("hibernate.dialect", SystemProperties.getProperty(SystemProperties.HB_DIALECT)); + properties.put("hibernate.show_sql", SystemProperties.getProperty(SystemProperties.HB_SHOW_SQL)); + return properties; + } + + @Bean + @Autowired + public HibernateTransactionManager transactionManager(SessionFactory s) { + HibernateTransactionManager txManager = new HibernateTransactionManager(); + txManager.setSessionFactory(s); + return txManager; + } + + public SystemProperties getSystemProperties() { + return systemProperties; + } + + public void setSystemProperties(SystemProperties systemProperties) { + this.systemProperties = systemProperties; + } + + + + + public DataSource getDataSource() { + return dataSource; + } + + + @Autowired + public void setDataSource(DataSource dataSource) { + this.dataSource = dataSource; + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/HibernateMappingLocatable.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/HibernateMappingLocatable.java new file mode 100644 index 0000000..a3bbe18 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/conf/HibernateMappingLocatable.java @@ -0,0 +1,28 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.conf; + +import org.springframework.core.io.Resource; + +public interface HibernateMappingLocatable { + + public Resource[] getMappingLocations(); + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/AdminAuthGenericController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/AdminAuthGenericController.java new file mode 100644 index 0000000..8a1f1d2 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/AdminAuthGenericController.java @@ -0,0 +1,134 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; +/*package org.openecomp.portalsdk.core.controller; + +import java.io.IOException; +import java.util.List; + +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import org.openecomp.portalsdk.core.domain.Role; +import org.openecomp.portalsdk.core.onboarding.crossapi.IGenericRolesService; +import org.openecomp.portalsdk.core.onboarding.crossapi.IGenericUsersService; +import com.fasterxml.jackson.core.JsonProcessingException; + + +@RestController +@RequestMapping("/api") +public class AdminAuthGenericController extends RestrictedRESTfulBaseController { + protected final Log logger = LogFactory.getLog(getClass()); + @Autowired + IGenericUsersService genericUserService; + + @Autowired + IGenericRolesService genericRolesService; + + *//** + * RESTful service method to fetch available roles + * @return + *//* + @RequestMapping(value={"/roles"}, method = RequestMethod.GET, produces = "application/json") + public String getAvailableRoles() throws Exception{ + return genericRolesService.getAvailableRoles(); + } + + *//** + * RESTful service method to save user - expects user details in json string + * @param userJson + *//* + @RequestMapping(value={"/user"}, method = RequestMethod.POST) + public String pushUser(@RequestBody String userJson) throws Exception{ + return genericUserService.pushUser(userJson); + } + + *//** + * RESTful service method to edit user - expects user details in json string + * @param userJson + *//* + @RequestMapping(value={"/user/{loginId}"}, method = RequestMethod.POST) + public String editUser(@PathVariable("loginId") String loginId, @RequestBody String userJson) throws Exception{ + return genericUserService.editUser(loginId, userJson); + } + + *//** + * RESTful service method to save user role using user's login Id and details in role Json string + * @param loginId + * @param roleJson + * @throws JsonProcessingException + *//* + @RequestMapping(value={"/user/{loginId}/roles"}, method = RequestMethod.POST) + public String pushUserRole(@PathVariable("loginId") String loginId, @RequestBody String rolesJson) throws Exception{ + return genericRolesService.pushUserRole(loginId, rolesJson); + } + + + *//** + * Below method is to retrieve user - TODO @Talasila - Created to test the fn_app relation to fn_user_role. If not needed, please remove this method. + * @param id + * @return + * @throws Exception + *//* + @RequestMapping(value={"/user/{loginId}"}, method = RequestMethod.GET, produces = "application/json") + public String getUser(@PathVariable("loginId") String loginId) throws Exception{ + return genericUserService.getUser(loginId); + } + + @RequestMapping(value={"/users"}, method = RequestMethod.GET, produces = "application/json") + public String getUsers() throws Exception{ + return genericUserService.getUsers(); + } + + *//** + * RESTful service method to fetch individual user's roles using user's loginId + * @param loginId + * @return + *//* + @RequestMapping(value={"/user/{loginId}/roles"}, method = RequestMethod.GET, produces = "application/json") + public String getUserRoles(@PathVariable("loginId") String loginId) throws Exception{ + return genericRolesService.getUserRoles(loginId); + } + + *//** + * RESTful service method to fetch available roles + * @return + *//* + + //Commenting this out as it depends on Role API - Ikram + @RequestMapping(value={"/rolesFull"}, method = RequestMethod.GET, produces = "application/json") + public List getAvailableFullRoles(){ + return genericRolesService.getAvailableFullRoles(); + } + + @ExceptionHandler(Exception.class) + void handleBadRequests(Exception e, HttpServletResponse response) throws IOException { + response.sendError(HttpStatus.BAD_REQUEST.value(),e.getMessage()); + } +} +*/ diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/AngularAdminController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/AngularAdminController.java new file mode 100644 index 0000000..e3aab7d --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/AngularAdminController.java @@ -0,0 +1,50 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +@Controller +@RequestMapping("/") +public class AngularAdminController extends RestrictedBaseController{ + + @RequestMapping(value = {"/userProfile" }, method = RequestMethod.GET) + public ModelAndView view(HttpServletRequest request) { + Map model = new HashMap(); + + return new ModelAndView("user_profile_list","model", model); + } + + @RequestMapping(value = {"/admin" }, method = RequestMethod.GET) + public ModelAndView adminView(HttpServletRequest request) { + Map model = new HashMap(); + + return new ModelAndView(getViewName(),"model", model); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/BroadcastController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/BroadcastController.java new file mode 100644 index 0000000..6dfe9ca --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/BroadcastController.java @@ -0,0 +1,130 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.io.PrintWriter; +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.json.JSONObject; +import org.openecomp.portalsdk.core.domain.BroadcastMessage; +import org.openecomp.portalsdk.core.service.BroadcastService; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.web.support.AppUtils; +import org.openecomp.portalsdk.core.web.support.JsonMessage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Controller +@RequestMapping("/") +public class BroadcastController extends RestrictedBaseController { + + @Autowired + private BroadcastService broadcastService; + + @RequestMapping(value = { "/broadcast" }, method = RequestMethod.GET) + public ModelAndView broadcast(HttpServletRequest request) { + Map model = new HashMap(); + ObjectMapper mapper = new ObjectMapper(); + + try { + model.put("broadcastMessage", mapper.writeValueAsString(broadcastService.getBroadcastMessage(request))); + model.put("broadcastSites", mapper.writeValueAsString(referenceData(request).get("broadcastSites"))); + } catch (Exception e) { + e.printStackTrace(); + } + return new ModelAndView(getViewName(), model); + } + + @RequestMapping(value = { "/get_broadcast" }, method = RequestMethod.GET) + public void getBroadcast(HttpServletRequest request, HttpServletResponse response) { + Map model = new HashMap(); + ObjectMapper mapper = new ObjectMapper(); + + try { + + model.put("broadcastMessage", mapper.writeValueAsString(broadcastService.getBroadcastMessage(request))); + model.put("broadcastSites", mapper.writeValueAsString(referenceData(request).get("broadcastSites"))); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + + } catch (Exception e) { + e.printStackTrace(); + } + + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + protected Map referenceData(HttpServletRequest request) { + Map lookupData = new HashMap(); + + if ("true".equals(SystemProperties.getProperty(SystemProperties.CLUSTERED))) { + lookupData.put("broadcastSites", AppUtils.getLookupList("fn_lu_broadcast_site", "broadcast_site_cd", + "broadcast_site_descr", "", "broadcast_site_descr")); + } + + return lookupData; + } + + @RequestMapping(value = { "/broadcast/save" }, method = RequestMethod.POST) + public ModelAndView save(HttpServletRequest request, HttpServletResponse response) throws Exception { + + try { + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + BroadcastMessage broadcastMessage = mapper.readValue(root.get("broadcastMessage").toString(), + BroadcastMessage.class); + + broadcastService.saveBroadcastMessage(broadcastMessage); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + String responseString = mapper.writeValueAsString(broadcastMessage); + JSONObject j = new JSONObject("{broadcastMessage: " + responseString + "}"); + + out.write(j.toString()); + + return null; + } catch (Exception e) { + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + return null; + } + + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/BroadcastListController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/BroadcastListController.java new file mode 100644 index 0000000..7e0789c --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/BroadcastListController.java @@ -0,0 +1,142 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.io.PrintWriter; +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.json.JSONObject; +import org.openecomp.portalsdk.core.domain.BroadcastMessage; +import org.openecomp.portalsdk.core.service.BroadcastService; +import org.openecomp.portalsdk.core.web.support.JsonMessage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Controller +@RequestMapping("/") +public class BroadcastListController extends RestrictedBaseController { + + @Autowired + private BroadcastService broadcastService; + + @RequestMapping(value = { "/broadcast_list" }, method = RequestMethod.GET) + public ModelAndView broadcastList(HttpServletRequest request) { + Map model = new HashMap(); + + model.put("model", broadcastService.getBcModel(request)); + return new ModelAndView(getViewName(), model); + } + + @RequestMapping(value = { "/get_broadcast_list" }, method = RequestMethod.GET) + public void getBroadcast(HttpServletRequest request, HttpServletResponse response) { + Map model = new HashMap(); + ObjectMapper mapper = new ObjectMapper(); + try { + model.put("model", broadcastService.getBcModel(request)); + model.put("messagesList", broadcastService.getBcModel(request).get("messagesList")); + model.put("messageLocations", broadcastService.getBcModel(request).get("messageLocations")); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + @RequestMapping(value = { "/broadcast_list/remove" }, method = RequestMethod.POST) + public ModelAndView remove(HttpServletRequest request, HttpServletResponse response) throws Exception { + + try { + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + BroadcastMessage broadcastMessage = mapper.readValue(root.get("broadcastMessage").toString(), + BroadcastMessage.class); + + broadcastService.removeBroadcastMessage(broadcastMessage); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + String responseString = mapper.writeValueAsString(broadcastMessage); + JSONObject j = new JSONObject("{broadcastMessage: " + responseString + "}"); + + out.write(j.toString()); + + return null; + } catch (Exception e) { + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + return null; + } + + } + + @RequestMapping(value = { "/broadcast_list/toggleActive" }, method = RequestMethod.POST) + public ModelAndView toggleActive(HttpServletRequest request, HttpServletResponse response) throws Exception { + + try { + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + BroadcastMessage broadcastMessage = mapper.readValue(root.get("broadcastMessage").toString(), + BroadcastMessage.class); + + broadcastService.saveBroadcastMessage(broadcastMessage); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + String responseString = mapper.writeValueAsString(broadcastMessage); + JSONObject j = new JSONObject("{broadcastMessage: " + responseString + "}"); + + out.write(j.toString()); + + return null; + } catch (Exception e) { + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + return null; + } + + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CacheAdminController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CacheAdminController.java new file mode 100644 index 0000000..095c41b --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CacheAdminController.java @@ -0,0 +1,252 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.io.PrintWriter; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.jcs.JCS; +import org.apache.jcs.admin.CacheRegionInfo; +import org.apache.jcs.admin.JCSAdminBean; +import org.apache.jcs.engine.behavior.ICacheElement; +import org.json.JSONArray; +import org.json.JSONObject; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.web.support.JsonMessage; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +@Controller +@RequestMapping("/") +public class CacheAdminController extends RestrictedBaseController { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CacheAdminController.class); + private JCSAdminBean jcsAdminBean = new JCSAdminBean(); + + @RequestMapping(value = {"/jcs_admin" }, method = RequestMethod.GET) + public ModelAndView cacheAdmin(HttpServletRequest request) { + Map model = new HashMap(); + + model.put("model", getRegions()); + + return new ModelAndView(getViewName(),model); + } + + @RequestMapping(value = {"/get_regions" }, method = RequestMethod.GET) + public void getRegions(HttpServletRequest request,HttpServletResponse response) { + // ObjectMapper mapper = new ObjectMapper(); + try{ + JsonMessage msg = new JsonMessage(getRegions().toString()); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + }catch (Exception e) { + e.printStackTrace(); + } + + } + + @RequestMapping(value = {"/jcs_admin/clearRegion" }, method = RequestMethod.GET) + public void clearRegion(HttpServletRequest request,HttpServletResponse response) throws Exception { + String cacheName = (String) request.getParameter("cacheName"); + clearCacheRegion(cacheName); + + response.setContentType("application/json"); + PrintWriter out = response.getWriter(); + out.write(getRegions().toString()); + } + + @RequestMapping(value = {"/jcs_admin/clearAll" }, method = RequestMethod.GET) + public void clearAll(HttpServletRequest request,HttpServletResponse response) throws Exception { + clearAllRegions(); + + response.setContentType("application/json"); + PrintWriter out = response.getWriter(); + out.write(getRegions().toString()); + } + + @RequestMapping(value = {"/jcs_admin/clearItem" }, method = RequestMethod.GET) + public void clearItem(HttpServletRequest request,HttpServletResponse response) throws Exception { + String keyName = (String) request.getParameter("keyName"); + String cacheName = (String) request.getParameter("cacheName"); + clearCacheRegionItem(cacheName, keyName); + + response.setContentType("application/json"); + PrintWriter out = response.getWriter(); + out.write(getRegions().toString()); + } + + @RequestMapping(value = {"/jcs_admin/showItemDetails" }, method = RequestMethod.GET) + public void showItemDetails(HttpServletRequest request,HttpServletResponse response) throws Exception { + String cacheName = (String) request.getParameter("cacheName"); + String keyName = (String) request.getParameter("keyName"); + String details = null; + + try { + details = getItemDetails(cacheName, keyName); + } catch (Exception e) { + details = "There was an error retrieving the region details. Please try again."; + logger.error(EELFLoggerDelegate.errorLogger, "An error has occurred while retrieving the item details for the cache region - " + + cacheName + e.getMessage()); + + } + + response.setContentType("application/json"); + PrintWriter out = response.getWriter(); + out.write(details); + } + + @RequestMapping(value = {"/jcs_admin/showRegionDetails" }, method = RequestMethod.GET) + public void showRegionDetails(HttpServletRequest request,HttpServletResponse response) throws Exception { + String cacheName = (String) request.getParameter("cacheName"); + String details = null; + + try { + details = getRegionStats(cacheName); + } catch (Exception e) { + details = "There was an error retrieving the region details. Please try again."; + logger.error(EELFLoggerDelegate.errorLogger, "An error has occurred while retrieving the region details for the cache region - " + + cacheName + e.getMessage()); + + } + + response.setContentType("application/json"); + PrintWriter out = response.getWriter(); + out.write(details); + } + + @SuppressWarnings("unchecked") + public JSONArray getRegions(){ + LinkedList regions = null; + JSONArray ja = new JSONArray(); + try { + regions = getJcsAdminBean().buildCacheInfo(); + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); + for (CacheRegionInfo cri : regions) { + JSONObject jo = new JSONObject(); + jo.put("cacheName", cri.getCache().getCacheName()); + jo.put("size", cri.getCache().getSize()); + jo.put("byteCount", cri.getByteCount()); + jo.put("status", cri.getStatus()); + jo.put("hitCountRam", cri.getCache().getHitCountRam()); + jo.put("hitCountAux", cri.getCache().getHitCountAux()); + jo.put("missCountNotFound", cri.getCache().getMissCountNotFound()); + jo.put("missCountExpired", cri.getCache().getMissCountExpired()); + jo.put("items",new JSONArray(mapper.writeValueAsString(getRegionItems(cri.getCache().getCacheName())))); + ja.put(jo); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "An error has occurred while retrieving the list of cache regions" + e.getMessage()); + + } + + return ja; + } + + private String getRegionStats(String cacheName) throws Exception { + String stats = ""; + + JCS cache = JCS.getInstance(cacheName); + stats = cache.getStats(); + + return stats; + } + + private String getItemDetails(String cacheName, String keyName) + throws Exception { + String details = ""; + + JCS cache = JCS.getInstance(cacheName); + ICacheElement element = cache.getCacheElement(keyName); + + if (element != null) { + ObjectMapper mapper = new ObjectMapper(); + mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); + details = mapper.writeValueAsString(element); + } + + return details; + } + + @SuppressWarnings("rawtypes") + private List getRegionItems(String cacheName) { + List items = null; + + try { + items = getJcsAdminBean().buildElementInfo(cacheName); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "An error has occurred while retrieving the list of items for cache region - " + + cacheName + e.getMessage()); + + } + + return items; + } + + private void clearAllRegions() { + try { + getJcsAdminBean().clearAllRegions(); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "An error has occurred while clearing all cache regions." + e.getMessage()); + + } + } + + private void clearCacheRegion(String cacheName) { + try { + getJcsAdminBean().clearRegion(cacheName); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "An error has occurred while clearing the cache region - " + + cacheName + e.getMessage()); + + } + } + + private void clearCacheRegionItem(String cacheName, String keyName) { + try { + getJcsAdminBean().removeItem(cacheName, keyName); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "An error has occurred while removing cache region item - " + + keyName + e.getMessage()); + + } + } + + public JCSAdminBean getJcsAdminBean() { + return jcsAdminBean; + } + + public void setJcsAdminBean(JCSAdminBean jcsAdminBean) { + this.jcsAdminBean = jcsAdminBean; + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CollaborateListController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CollaborateListController.java new file mode 100644 index 0000000..9e43e94 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CollaborateListController.java @@ -0,0 +1,84 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.json.JSONObject; +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.service.UserProfileService; +import org.openecomp.portalsdk.core.web.support.JsonMessage; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@Controller +@RequestMapping("/") +public class CollaborateListController extends RestrictedBaseController{ + @Autowired + UserProfileService service; + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CollaborateListController.class); + + @RequestMapping(value = {"/collaborate_list" }, method = RequestMethod.GET) + public ModelAndView ProfileSearch(HttpServletRequest request) { + Map model = new HashMap(); + ObjectMapper mapper = new ObjectMapper(); + User user = UserUtils.getUserSession(request); + + List profileList =null; + try { + profileList = service.findAllUserWithOnOffline(user.getOrgUserId()); + model.put("profileList", mapper.writeValueAsString(profileList)); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Error happened during collaborate list search" + e.getMessage()); + + } + return new ModelAndView(getViewName(),"model", model); + } + + @RequestMapping(value = {"/get_collaborate_list" }, method = RequestMethod.GET) + public void getCollaborateList(HttpServletRequest request,HttpServletResponse response) { + + ObjectMapper mapper = new ObjectMapper(); + User user = UserUtils.getUserSession(request); + + List profileList =null; + try { + profileList = service.findAllUserWithOnOffline(user.getOrgUserId()); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(profileList)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Error happened during get collaborate list" + e.getMessage()); + + } + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CollaborationController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CollaborationController.java new file mode 100644 index 0000000..a9c1d44 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/CollaborationController.java @@ -0,0 +1,47 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +@Controller +@RequestMapping("/") +public class CollaborationController extends RestrictedBaseController{ + + @RequestMapping(value = {"/collaboration" }, method = RequestMethod.GET) + public ModelAndView view(HttpServletRequest request) { + Map model = new HashMap(); + User user = UserUtils.getUserSession(request); + + model.put("name",(user.getFirstName() + " " + (user.getLastName() != null? user.getLastName().substring(0,1): "" ))); + return new ModelAndView(getViewName(),"model", model); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ElementModelController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ElementModelController.java new file mode 100644 index 0000000..a6e7b96 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ElementModelController.java @@ -0,0 +1,91 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.openecomp.portalsdk.core.service.ElementLinkService; +import org.openecomp.portalsdk.core.service.ElementMapService; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + + +@Controller +@RequestMapping("/") +public class ElementModelController extends RestrictedBaseController{ + + @RequestMapping(value = {"/elementMapLayout" }, method = RequestMethod.POST) + public ModelAndView layout(HttpServletRequest request, + HttpServletResponse response) throws Exception{ + + Map model = new HashMap(); + String collapseDomains = request.getParameter("collapsedDomains"); + String expandDomains = request.getParameter("expandedDomains"); + + String contentFileName = request.getParameter("contentFileName"); + String layoutFileName = request.getParameter("layoutFileName"); + + ElementMapService main = new ElementMapService(); + String yamlString = main.main1(new String[]{collapseDomains,expandDomains, contentFileName, layoutFileName }); + + //response.setContentType("application/json"); + //PrintWriter out = response.getWriter(); + //out.print(yamlString); + //out.flush(); + + //return null; + model.put("output_string", yamlString); + return new ModelAndView("data_out", "model", model); + } + + @RequestMapping(value = {"/elementMapLink" }, method = RequestMethod.POST) + public ModelAndView callflow(HttpServletRequest request, + HttpServletResponse response) throws Exception{ + + Map model = new HashMap(); + String callFlowName = request.getParameter("callFlowName"); + String callFlowStep = request.getParameter("callFlowStep"); + + ElementLinkService main = new ElementLinkService(); + String yamlString = main.main1(new String[]{callFlowName,callFlowStep }); + model.put("output_string", yamlString); + return new ModelAndView("data_out", "model", model); + } + + public ModelAndView callflowAdditional(HttpServletRequest request, + HttpServletResponse response) throws Exception{ + + Map model = new HashMap(); + String callFlowName = request.getParameter("callFlowName"); + String callFlowStep = request.getParameter("callFlowStep"); + + ElementLinkService main = new ElementLinkService(); + String yamlString = main.main2(new String[]{callFlowName,callFlowStep }); + model.put("output_string", yamlString); + return new ModelAndView("data_out", "model", model); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ExternalLoginController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ExternalLoginController.java new file mode 100644 index 0000000..90e47d4 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ExternalLoginController.java @@ -0,0 +1,121 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.openecomp.portalsdk.core.command.LoginBean; +import org.openecomp.portalsdk.core.menu.MenuProperties; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalTimeoutHandler; +import org.openecomp.portalsdk.core.service.LoginService; +import org.openecomp.portalsdk.core.service.ProfileService; +import org.openecomp.portalsdk.core.web.support.AppUtils; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + +@Controller +@RequestMapping("/") +public class ExternalLoginController extends UnRestrictedBaseController{ + @Autowired + ProfileService service; + @Autowired + private LoginService loginService; + String viewName; + + @RequestMapping(value = {"/login_external.htm" }, method = RequestMethod.GET) + public ModelAndView ExternalLogin(HttpServletRequest request) { + Map model = new HashMap(); + return new ModelAndView(getViewName(),"model", model); + } + + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @RequestMapping(value = {"/login_external/login" }, method = RequestMethod.POST) + public @ResponseBody String ExternalLogin(HttpServletRequest request, HttpServletResponse response) throws Exception{ + + Map model = new HashMap(); + LoginBean commandBean = new LoginBean(); + String loginId = request.getParameter("loginId"); + String password = request.getParameter("password"); + commandBean.setLoginId(loginId); + commandBean.setLoginPwd(password); + HashMap additionalParamsMap = new HashMap(); + + commandBean = getLoginService().findUser(commandBean, (String)request.getAttribute(MenuProperties.MENU_PROPERTIES_FILENAME_KEY), + additionalParamsMap); + + if (commandBean.getUser() == null) { + String loginErrorMessage = (commandBean.getLoginErrorMessage() != null) ? commandBean.getLoginErrorMessage() + : "login.error.external.invalid"; + model.put("error", loginErrorMessage); + String[] errorCodes = new String[1]; + errorCodes[0] = loginErrorMessage; + return "failure"; + + } + else { + // store the currently logged in user's information in the session + UserUtils.setUserSession(request, commandBean.getUser(), commandBean.getMenu(), commandBean.getBusinessDirectMenu(), + null); + initateSessionMgtHandler(request); + // user has been authenticated, now take them to the welcome page + return "success"; + + } + + + } + + public String getJessionId(HttpServletRequest request){ + + return request.getSession().getId(); + + } + + protected void initateSessionMgtHandler(HttpServletRequest request) { + String jSessionId = getJessionId(request); + PortalTimeoutHandler.sessionCreated(jSessionId, jSessionId, AppUtils.getSession(request)); + } + + public String getViewName() { + return viewName; + } + public void setViewName(String viewName) { + this.viewName = viewName; + } + public LoginService getLoginService() { + return loginService; + } + + public void setLoginService(LoginService loginService) { + this.loginService = loginService; + } + +} + diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FavoritesController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FavoritesController.java new file mode 100644 index 0000000..b2ad61f --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FavoritesController.java @@ -0,0 +1,117 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.openecomp.portalsdk.core.domain.App; +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.logging.aspect.AuditLog; +import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.onboarding.rest.FavoritesClient; +import org.openecomp.portalsdk.core.service.AppService; +import org.openecomp.portalsdk.core.util.CipherUtil; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +@Controller +@RequestMapping("/") +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +@AuditLog +public class FavoritesController extends UnRestrictedBaseController { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FavoritesController.class); + + @Autowired + AppService appService; + + /** + * Makes the REST API call to Portal Back-end and retrieves Favorite menu + * items for the currently logged in user. + * + * @param request + * @param response + */ + @RequestMapping(value = { "/get_favorites" }, method = RequestMethod.GET) + public void getFavorites(HttpServletRequest request, HttpServletResponse response) { + String appName = ""; + String requestId = ""; + String appUserName = ""; + String decryptedPwd = ""; + + try { + HttpSession session = request.getSession(); + User user = (User) session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)); + if (user == null || user.getId() == null) { + logger.info(EELFLoggerDelegate.errorLogger, + ("Http request did not contain user info, cannot retrieve favorites.")); + + response.setContentType("application/json"); + JSONArray jsonResponse = new JSONArray(); + JSONObject error = new JSONObject(); + error.put("error", "Http request did not contain user info, cannot retrieve favorites."); + jsonResponse.put(error); + response.getWriter().write(jsonResponse.toString()); + } else { + logger.info(EELFLoggerDelegate.errorLogger, + "Retrieving Favorites for the user '" + MDC.get(SystemProperties.MDC_LOGIN_ID) + "'."); + + App app = appService.getDefaultApp(); + if (app!=null) { + appName = app.getName(); + appUserName = app.getUsername(); + try{ + decryptedPwd = CipherUtil.decrypt(app.getAppPassword(), SystemProperties.getProperty(SystemProperties.Decryption_Key)); + } catch(Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in WebServiceCallServiceImpl.get while decrypting the password. Details: " + e.getMessage()); + } + } else { + logger.warn(EELFLoggerDelegate.errorLogger, "Unable to locate the app information from the database."); + appName = SystemProperties.SDK_NAME; + } + requestId = MDC.get(MDC_KEY_REQUEST_ID); + + String jsonResponse = FavoritesClient.getFavorites(MDC.get(SystemProperties.MDC_LOGIN_ID), appName, requestId, appUserName, decryptedPwd); + + logger.debug(EELFLoggerDelegate.debugLogger, "FavoritesMenu response: " + jsonResponse); + + response.setContentType("application/json"); + response.getWriter().write(jsonResponse); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, + "Exception occurred in FavoritesController.getFavorites while performing get_favorites. Details: " + + e.getMessage(), AlarmSeverityEnum.MINOR); + } + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FnMenuController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FnMenuController.java new file mode 100644 index 0000000..f19a6f1 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FnMenuController.java @@ -0,0 +1,224 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.json.JSONObject; +import org.openecomp.portalsdk.core.domain.Menu; +import org.openecomp.portalsdk.core.domain.MenuData; +import org.openecomp.portalsdk.core.service.FnMenuService; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.web.support.JsonMessage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +import com.fasterxml.jackson.core.JsonGenerationException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * Description: this java class is a controller for Admin to add/edit/delete menu items from FN_MENU + */ + +@Controller +@RequestMapping("/") +public class FnMenuController extends RestrictedBaseController { + @Autowired + FnMenuService service; + + String viewName; + + @RequestMapping(value = {"/admin_fn_menu/get_parent_list" }, method = RequestMethod.GET) + public void getParentList(HttpServletRequest request,HttpServletResponse response) throws Exception { + ObjectMapper mapper = new ObjectMapper(); + try{ + + response.getWriter().write(mapper.writeValueAsString(service.getParentList())); + + } catch (Exception e) { + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + + } + + } + + @RequestMapping(value = {"/admin_fn_menu/get_function_cd_list" }, method = RequestMethod.GET) + public void getFunctionCDList(HttpServletRequest request,HttpServletResponse response) throws Exception { + ObjectMapper mapper = new ObjectMapper(); + try{ + + response.getWriter().write(mapper.writeValueAsString(service.getFunctionCDList())); + + } catch (Exception e) { + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + + } + + } + + @RequestMapping(value = {"/admin_fn_menu" }, method = RequestMethod.GET) + public void getFnMenuList(HttpServletRequest request,HttpServletResponse response) { + Map model = new HashMap(); + ObjectMapper mapper = new ObjectMapper(); + List temp =null; + List> childItemList = new ArrayList>(); + List parentList = new ArrayList<>(); + + try { + temp = service.getFnMenuItems(); + for(MenuData menu: temp){ + MenuData parentData = new MenuData(); + parentData.setId(menu.getId()); + parentData.setLabel(menu.getLabel()); + if(menu.getParentMenu()!=null){ + parentData.setParentId(menu.getParentMenu().getId()); + } + parentData.setAction(menu.getAction()); + parentData.setFunctionCd(menu.getFunctionCd()); + parentData.setImageSrc(menu.getImageSrc()); + parentData.setSortOrder(menu.getSortOrder()); + parentData.setActive(menu.isActive()); + parentData.setServlet(menu.getServlet()); + parentData.setQueryString(menu.getQueryString()); + parentData.setExternalUrl(menu.getExternalUrl()); + parentData.setTarget(menu.getTarget()); + parentData.setMenuSetCode(menu.getMenuSetCode()); + parentData.setSeparator(menu.isSeparator()); + parentData.setImageSrc(menu.getImageSrc()); + parentList.add(parentData); + List tempList = new ArrayList(); + childItemList.add(tempList); + } + model.put("fnMenuItems", parentList); + + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } catch (JsonGenerationException e) { + e.printStackTrace(); + } catch (JsonMappingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + } + + + @RequestMapping(value = {"/admin_fn_menu/updateFnMenu" }, method = RequestMethod.POST) + public ModelAndView updateFnMenu(HttpServletRequest request, + HttpServletResponse response) throws Exception { + + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + Menu fnMenuItem = mapper.readValue(root.get("availableFnMenuItem").toString(), Menu.class); + + service.saveFnMenu(fnMenuItem); + request.getSession().removeAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME)); + request.getSession().removeAttribute(SystemProperties.LEFT_MENU_CHILDREND); + request.getSession().removeAttribute(SystemProperties.LEFT_MENU_PARENT); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + String responseString = mapper.writeValueAsString(service.getMenuItem(fnMenuItem.getId())); + + out.write(responseString); + + return null; + + } catch (Exception e) { + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + + } + return null; + + } + + @RequestMapping(value = {"/admin_fn_menu/removeMenuItem" }, method = RequestMethod.POST) + public ModelAndView removeFnMenu(HttpServletRequest request, + HttpServletResponse response) throws Exception { + + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + Menu fnMenuItem = mapper.readValue(root.get("fnMenuItem").toString(), Menu.class); + Menu fnMenuItemRow = service.getMenuItemRow(fnMenuItem.getId()); + + service.removeMenuItem(fnMenuItemRow); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + String responseString = mapper.writeValueAsString(service.getMenuItem(fnMenuItem.getId())); + out.write(responseString); + + return null; + + } catch (Exception e) { + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + + + } + return null; + + } + + public String getViewName() { + return viewName; + } + public void setViewName(String viewName) { + this.viewName = viewName; + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FuncMenuController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FuncMenuController.java new file mode 100644 index 0000000..5baebf0 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FuncMenuController.java @@ -0,0 +1,174 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID; + +import java.io.IOException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.openecomp.portalsdk.core.domain.App; +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.logging.aspect.AuditLog; +import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties; +import org.openecomp.portalsdk.core.onboarding.rest.FunctionalMenuClient; +import org.openecomp.portalsdk.core.onboarding.ueb.UebException; +import org.openecomp.portalsdk.core.onboarding.ueb.UebManager; +import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg; +import org.openecomp.portalsdk.core.onboarding.ueb.UebMsgTypes; +import org.openecomp.portalsdk.core.service.AppService; +import org.openecomp.portalsdk.core.util.CipherUtil; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +@Controller +@RequestMapping("/") +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +public class FuncMenuController extends UnRestrictedBaseController{ + + @Autowired + AppService appService; + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FuncMenuController.class); + + @AuditLog + @RequestMapping(value = {"/get_functional_menu" }, method = RequestMethod.GET) + public void functionalMenu(HttpServletRequest request, HttpServletResponse response) { + + User user = UserUtils.getUserSession(request); + //JSONArray validMenu = new JSONArray("[{\"menuId\":140,\"column\":1,\"text\":\"RT SDK Menu\",\"parentMenuId\":139,\"url\":\"http://www.cnn.com\"},{\"menuId\":139,\"column\":1,\"text\":\"RT Menu\",\"parentMenuId\":11,\"url\":\"\"},{\"menuId\":11,\"column\":1,\"text\":\"Product Design\",\"parentMenuId\":1,\"url\":\"\"},{\"menuId\":1,\"column\":1,\"text\":\"Design\",\"url\":\"\"}]"); + + try { + if ( user != null ) { + String useRestForFunctionalMenu = PortalApiProperties.getProperty(PortalApiConstants.USE_REST_FOR_FUNCTIONAL_MENU); + String funcMenuJsonString = ""; + if (useRestForFunctionalMenu==null || useRestForFunctionalMenu=="" || useRestForFunctionalMenu.equalsIgnoreCase("false")) { + logger.info(EELFLoggerDelegate.errorLogger, "Making use of UEB communication and Requesting functional menu for user " + user.getOrgUserId()); + funcMenuJsonString = getFunctionalMenu(user.getOrgUserId()); + } else { + funcMenuJsonString = getFunctionalMenuViaREST(user.getOrgUserId()); + } + response.setContentType("application/json"); + response.getWriter().write(funcMenuJsonString); + } else { + logger.info(EELFLoggerDelegate.errorLogger, "Http request did not contain user info, cannot retrieve functional menu"); + response.setContentType("application/json"); + JSONArray jsonResponse = new JSONArray(); + JSONObject error = new JSONObject(); + error.put("error","Http request did not contain user info, cannot retrieve functional menu"); + jsonResponse.put(error); + response.getWriter().write(jsonResponse.toString()); + } + } catch (Exception e) { + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/json"); + JSONArray jsonResponse = new JSONArray(); + JSONObject error = new JSONObject(); + try { + if ( null == e.getMessage() ) { + error.put("error","No menu data"); + } else { + error.put("error",e.getMessage()); + } + jsonResponse.put(error); + response.getWriter().write(jsonResponse.toString()); + logger.error(EELFLoggerDelegate.errorLogger, "Error getting functional_menu: " + e.getMessage(),AlarmSeverityEnum.MAJOR); + } catch (IOException e1) { + e1.printStackTrace(); + } + } + + } + + //-------------------------------------------------------------------------- + // Makes a synchronous call to ECOMP Portal to get the JSON file that + // contains the contents of the functional menu. The JSON file will be + // in the payload of the returned UEB message. + //-------------------------------------------------------------------------- + private String getFunctionalMenu(String userId) throws UebException + { + String returnString = null; + UebMsg funcMenuUebMsg = null; + UebMsg msg = new UebMsg(); + msg.putMsgType(UebMsgTypes.UEB_MSG_TYPE_GET_FUNC_MENU); + msg.putUserId(userId); + funcMenuUebMsg = UebManager.getInstance().requestReply(msg); + if (funcMenuUebMsg != null) { + if (funcMenuUebMsg.getPayload().startsWith("Error:")) { + logger.error(EELFLoggerDelegate.errorLogger, "getFunctionalMenu received an error in UEB msg = " + funcMenuUebMsg.getPayload()); + } else { + returnString = funcMenuUebMsg.getPayload(); + } + } + + logger.debug(EELFLoggerDelegate.debugLogger, "FunctionalMenu response: " + returnString); + + return returnString; + } + + private String getFunctionalMenuViaREST(String userId) { + String appName = ""; + String requestId = ""; + String appUserName = ""; + String decryptedPwd = ""; + + logger.info(EELFLoggerDelegate.debugLogger, "Making use of REST API communication and Requesting functional menu for user " + userId); + + App app = appService.getDefaultApp(); + if (app!=null) { + appName = app.getName(); + appUserName = app.getUsername(); + try{ + decryptedPwd = CipherUtil.decrypt(app.getAppPassword(), SystemProperties.getProperty(SystemProperties.Decryption_Key)); + } catch(Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in WebServiceCallServiceImpl.get while decrypting the password. Details: " + e.toString()); + } + } else { + logger.warn(EELFLoggerDelegate.errorLogger, "Unable to locate the app information from the database."); + appName = SystemProperties.SDK_NAME; + } + requestId = MDC.get(MDC_KEY_REQUEST_ID); + + String fnMenu = null; + try { + fnMenu = FunctionalMenuClient.getFunctionalMenu(userId, appName, requestId, appUserName, decryptedPwd); + }catch(Exception ex) { + fnMenu = "Failed to get functional menu: " + ex.toString(); + } + + logger.debug(EELFLoggerDelegate.debugLogger, "FunctionalMenu response: {}", fnMenu); + + return fnMenu; + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FusionBaseController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FusionBaseController.java new file mode 100644 index 0000000..c782011 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/FusionBaseController.java @@ -0,0 +1,135 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.openecomp.portalsdk.core.domain.MenuData; +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.interfaces.SecurityInterface; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.menu.MenuBuilder; +import org.openecomp.portalsdk.core.service.AppService; +import org.openecomp.portalsdk.core.service.DataAccessService; +import org.openecomp.portalsdk.core.service.FnMenuService; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.ModelAttribute; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@Controller +public abstract class FusionBaseController implements SecurityInterface{ + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FusionBaseController.class); + + @Override + public boolean isAccessible() { + return true; + } + + public boolean isRESTfulCall(){ + return true; + } + @Autowired + private FnMenuService fnMenuService; + + @Autowired + private MenuBuilder menuBuilder; + + @Autowired + private DataAccessService dataAccessService; + + @Autowired + AppService appService; + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @ModelAttribute("menu") + public Map getMenu(HttpServletRequest request) { + HttpSession session = null; + Map model = new HashMap(); + try { + try { + String appName = appService.getDefaultAppName(); + if (appName==null || appName=="") { + appName = SystemProperties.SDK_NAME; + } + logger.setRequestBasedDefaultsIntoGlobalLoggingContext(request, appName); + } catch (Exception e) { + } + + session = request.getSession(); + User user = UserUtils.getUserSession(request); + if(session!=null && user!=null){ + Set menuResult = (Set) session.getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME)); + if(menuResult==null){ + Set appMenu = getMenuBuilder().getMenu(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_SET_NAME),dataAccessService); + session.setAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME), MenuBuilder.filterMenu(appMenu, request)); + menuResult = (Set) session.getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME)); + } + model = setMenu(menuResult); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, e.getMessage()); + } + return model; + } + + public Map setMenu(Set menuResult) throws Exception{ + ObjectMapper mapper = new ObjectMapper(); + List> childItemList = new ArrayList>();; + List parentList = new ArrayList();; + Map model = new HashMap(); + try{ + fnMenuService.setMenuDataStructure(childItemList, parentList, menuResult); + }catch(Exception e){ + logger.error(EELFLoggerDelegate.errorLogger, e.getMessage()); + } + model.put("childItemList",childItemList!=null?mapper.writeValueAsString(childItemList):""); + model.put("parentList",parentList!=null?mapper.writeValueAsString(parentList):""); + return model; + } + + public MenuBuilder getMenuBuilder() { + return menuBuilder; + } + + public void setMenuBuilder(MenuBuilder menuBuilder) { + this.menuBuilder = menuBuilder; + } + + public DataAccessService getDataAccessService() { + return dataAccessService; + } + + public void setDataAccessService(DataAccessService dataAccessService) { + this.dataAccessService = dataAccessService; + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/LogoutController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/LogoutController.java new file mode 100644 index 0000000..5798362 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/LogoutController.java @@ -0,0 +1,110 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.servlet.ModelAndView; + +@Controller +@RequestMapping("/") +public class LogoutController extends UnRestrictedBaseController{ + + private User user; + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(LogoutController.class); + /** + * @param request + * @param response + * @return modelView + * + * globalLogout will invalid the current application session, then redirects to portal logout + */ + @RequestMapping(value = {"/logout.htm" }, method = RequestMethod.GET) + public ModelAndView globalLogout(HttpServletRequest request, HttpServletResponse response) { + ModelAndView modelView = null; + try{ + chatRoomLogout(request); + request.getSession().invalidate(); + String portalUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL); + String portalDomain = portalUrl.substring(0, portalUrl.lastIndexOf('/')); + String redirectUrl = portalDomain+"/logout.htm"; + modelView = new ModelAndView("redirect:"+redirectUrl); + }catch(Exception e){ + logger.error(EELFLoggerDelegate.errorLogger, "Logout Error: " + e.getMessage(),AlarmSeverityEnum.MAJOR); + } + return modelView; + } + + /** + * @param request + * @param response + * @return modelView + * + * appLogout is a function that will invalid the current session (application logout) and redirects user to Portal. + */ + @RequestMapping(value = {"/app_logout.htm" }, method = RequestMethod.GET) + public ModelAndView appLogout(HttpServletRequest request, HttpServletResponse response) { + ModelAndView modelView = null; + try{ + chatRoomLogout(request); + modelView = new ModelAndView("redirect:"+PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)); + UserUtils.clearUserSession(request); + request.getSession().invalidate(); + }catch(Exception e){ + logger.error(EELFLoggerDelegate.errorLogger, "Application Logout Error: " + e.getMessage(),AlarmSeverityEnum.MAJOR); + } + return modelView; + } + + + public void chatRoomLogout(HttpServletRequest request){ + request = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest(); + setUser(UserUtils.getUserSession(request)); + // if(getUser()!=null){ + // Long login_IdLong = getUser().getId(); + // String name = getUser().getFirstName(); + // String login_IdStr = Long.toString(login_IdLong); + // } + //UserListName.getInstance().delUserName(name); + //UserListID.getInstance().delUserName(login_IdStr); + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/MenuListController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/MenuListController.java new file mode 100644 index 0000000..ee66a94 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/MenuListController.java @@ -0,0 +1,245 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.json.JSONObject; +import org.openecomp.portalsdk.core.domain.MenuData; +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties; +import org.openecomp.portalsdk.core.restful.client.SharedContextRestClient; +import org.openecomp.portalsdk.core.restful.domain.SharedContext; +import org.openecomp.portalsdk.core.service.AppService; +import org.openecomp.portalsdk.core.service.FnMenuService; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.web.support.JsonMessage; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import com.fasterxml.jackson.databind.ObjectMapper; + + +@Controller +@RequestMapping("/") +public class MenuListController extends UnRestrictedBaseController{ + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MenuListController.class); + @Autowired + AppService appService; + @Autowired + FnMenuService fnMenuService; + @Autowired + SharedContextRestClient sharedContextRestClient; + /** + * + * Get Menu items and store into session. + * + * @param request + * @param response + */ + @SuppressWarnings("unchecked") + @RequestMapping(value = {"/get_menu" }, method = RequestMethod.GET) + public void ProfileSearch(HttpServletRequest request, HttpServletResponse response) { + logger.info("calling /get_menu.."); + try { + ObjectMapper mapper = new ObjectMapper(); + Set menuResult=null; + HttpSession session = request.getSession(); + List> childItemList = (List>) session.getAttribute(SystemProperties.LEFT_MENU_CHILDREND); + List parentList = (List) session.getAttribute(SystemProperties.LEFT_MENU_PARENT); + if(parentList==null || childItemList==null || parentList.size()==0 || childItemList.size()==0){ + childItemList=new ArrayList>(); + parentList = new ArrayList(); + menuResult = (Set) session.getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME)); + fnMenuService.setMenuDataStructure(childItemList, parentList, menuResult); + logger.info("storing leftmenu items into session"); + session.setAttribute(SystemProperties.LEFT_MENU_PARENT, parentList); + session.setAttribute(SystemProperties.LEFT_MENU_CHILDREND, childItemList); + } + String userName = (String) session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_NAME)); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(parentList),mapper.writeValueAsString(childItemList),userName); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + logger.info("done with /get_menu call without any errors"); + } catch (Exception e) { + logger.info("errors while calling /get_menu",e); + } + } + + /** + * + * Get app name from system.properties file. + * + * @param request + * @param response + */ + + @RequestMapping(value = {"/get_app_name" }, method = RequestMethod.GET) + public void getAppName(HttpServletRequest request, HttpServletResponse response) { + logger.info("calling /get_app_name."); + HttpSession session = request.getSession(true); + try { + // String appName = SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME); + String appName = (String) session.getAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME)); + if(appName!=null && appName.equals("app_display_name")){ + appName = ""; + } + JsonMessage msg = new JsonMessage(appName); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + logger.info("done with /get_app_name call without any errors"); + } catch (Exception e) { + logger.error("errors while calling /get_app_name",e); + } + } + + @SuppressWarnings("unchecked") + @ModelAttribute("menu") + public Map getLeftMenuJSP(HttpServletRequest request) { + logger.info("invoking getting left menu"); + ObjectMapper mapper = new ObjectMapper(); + Map model = new HashMap(); + try { + HttpSession session = request.getSession(); + List> childItemList = (List>) session.getAttribute(SystemProperties.LEFT_MENU_CHILDREND); + List parentList = (List) session.getAttribute(SystemProperties.LEFT_MENU_PARENT); + if(parentList==null || childItemList==null){ + childItemList=new ArrayList>(); + parentList = new ArrayList(); + Set menuResult = (Set) session.getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME)); + fnMenuService.setMenuDataStructure(childItemList, parentList, menuResult); + session.setAttribute(SystemProperties.LEFT_MENU_PARENT, parentList); + session.setAttribute(SystemProperties.LEFT_MENU_CHILDREND, childItemList); + } + model.put("childItemList",mapper.writeValueAsString(childItemList)); + model.put("parentList",mapper.writeValueAsString(parentList)); + } catch (Exception e) { + logger.info("errors while getting left menu",e); + } + logger.info("done with getting left menu without any errors"); + return model; + } + + /** + * Answers requests for user information, which is fetched from the shared context at Portal. + * + * @param request + * @param response + * @return JSON block with user information. + */ + @RequestMapping(value = {"/get_userinfo" }, method = RequestMethod.GET) + public String getUserInfo(HttpServletRequest request, HttpServletResponse response) { + logger.info(EELFLoggerDelegate.debugLogger, "Getting shared context for user"); + try{ + String contextId= null; + if(request.getCookies()!=null){ + for(Cookie ck :request.getCookies()){ + if(ck.getName().equalsIgnoreCase("EPService")) + contextId = ck.getValue(); + } + } + logger.info(EELFLoggerDelegate.debugLogger, "ContextId is : " + contextId); + List sharedContextRes = sharedContextRestClient.getUserContext(contextId); + logger.info(EELFLoggerDelegate.debugLogger, "Shared Context Response is : " + sharedContextRes); + Map model = new HashMap(); + for(SharedContext sharedContext: sharedContextRes){ + model.put(sharedContext.getCkey(), sharedContext.getCvalue()); + } + JSONObject j = new JSONObject(model); + response.getWriter().write(j.toString()); + } catch(Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Failed to get shared context for user" + e.getMessage()); + } + return null; + } + + /** + * Get User information from app sessions + * @param request + * @param response + */ + @RequestMapping(value = {"/get_topMenuInfo" }, method = RequestMethod.GET) + public void getTopMenu(HttpServletRequest request, HttpServletResponse response) { + + HttpSession session = request.getSession(); + try { + String userName = (String) session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_NAME)); + String firstName = (String) session.getAttribute(SystemProperties.FIRST_NAME); + String lastName = (String) session.getAttribute(SystemProperties.LAST_NAME); + User user = (User) session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)); + Map map = new HashMap(); + String redirectUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL); + String portalDomain = redirectUrl.substring(0, redirectUrl.lastIndexOf('/')); + String portalUrl = portalDomain + "/processSingleSignOn"; + String getAccessUrl = portalDomain + "/get_access"; + String email = user.getEmail(); + String contactUsLink = SystemProperties.getProperty(SystemProperties.CONTACT_US_LINK); + String userId = UserUtils.getUserIdFromCookie(request); + + map.put("portalUrl", portalUrl); + map.put("contactUsLink", contactUsLink); + map.put("userName", userName); + map.put("firstName", firstName); + map.put("lastName", lastName); + map.put("userid", userId); + map.put("email", email); + map.put("getAccessUrl",getAccessUrl); + JSONObject j = new JSONObject(map); + response.getWriter().write(j.toString()); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Failed to serialize JSON" + e.getMessage()); + } + + } + + @RequestMapping(value = {"/page_redirect" }, method = RequestMethod.GET) + public void pageRedirect(HttpServletRequest request, HttpServletResponse response) { + String pageToURL=null; + try { + String pageTo = request.getParameter("page"); + if(pageTo.equals("contact")) + pageToURL = SystemProperties.getProperty(SystemProperties.CONTACT_US_LINK); + else if(pageTo.equals("access")){ + String redirectUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL); + String portalDomain = redirectUrl.substring(0, redirectUrl.lastIndexOf('/')); + pageToURL = portalDomain + "/get_access"; + } + response.getWriter().write(pageToURL); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Failed to serialize JSON" + e.getMessage()); + } + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/PostSearchController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/PostSearchController.java new file mode 100644 index 0000000..fa5a108 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/PostSearchController.java @@ -0,0 +1,219 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.json.JSONObject; +import org.openecomp.portalsdk.core.command.PostSearchBean; +import org.openecomp.portalsdk.core.domain.Lookup; +import org.openecomp.portalsdk.core.domain.Profile; +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.service.LdapService; +import org.openecomp.portalsdk.core.service.PostSearchService; +import org.openecomp.portalsdk.core.service.ProfileService; +import org.openecomp.portalsdk.core.service.UserProfileService; +import org.openecomp.portalsdk.core.web.support.JsonMessage; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Controller +@RequestMapping("/") +public class PostSearchController extends RestrictedBaseController { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PostSearchController.class); + + @SuppressWarnings("rawtypes") + private static List sortByList = null; + + @Autowired + private PostSearchService postSearchService; + + @Autowired + LdapService ldapService; + + @Autowired + private ProfileService profileService; + + @Autowired + UserProfileService userProfileService; + + public UserProfileService getUserProfileService() { + return userProfileService; + } + + public void setUserProfileService(UserProfileService userProfileService) { + this.userProfileService = userProfileService; + } + + @RequestMapping(value = { "/post_search" }, method = RequestMethod.GET) + public ModelAndView welcome(HttpServletRequest request, + @ModelAttribute("postSearchBean") PostSearchBean postSearchBean) { + Map model = new HashMap(); + + ObjectMapper mapper = new ObjectMapper(); + try { + postSearchBean = new PostSearchBean(); + model.put("profileList", mapper.writeValueAsString(postSearchBean.getSearchResult())); + model.put("postSearchBean", mapper.writeValueAsString(postSearchBean)); + model.put("existingUsers", mapper.writeValueAsString(getExistingUsers())); + model.put("sortByList", mapper.writeValueAsString(getSortByList())); + } catch (Exception ex) { + logger.error(EELFLoggerDelegate.errorLogger, "welcome: failed to write JSON" + ex.getMessage()); + } + + return new ModelAndView(getViewName(), model); + } + + @RequestMapping(value = { "/post_search_sample" }, method = RequestMethod.GET) + public void getPostSearchProfile(HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("postSearchBean") PostSearchBean postSearchBean) { + Map model = new HashMap(); + + ObjectMapper mapper = new ObjectMapper(); + try { + postSearchBean = new PostSearchBean(); + model.put("profileList", mapper.writeValueAsString(postSearchBean.getSearchResult())); + model.put("postSearchBean", mapper.writeValueAsString(postSearchBean)); + model.put("existingUsers", mapper.writeValueAsString(getExistingUsers())); + model.put("sortByList", mapper.writeValueAsString(getSortByList())); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } catch (Exception ex) { + logger.error(EELFLoggerDelegate.errorLogger, "getPostSearchProfile: failed to write JSON" + ex.getMessage()); + } + + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + private HashMap getExistingUsers() { + HashMap existingUsers = new HashMap(); + + List list = profileService.findAll(); + + if (list != null) { + Iterator i = list.iterator(); + while (i.hasNext()) { + Profile user = i.next(); + String orgUserId = user.getOrgUserId(); + Long id = user.getId(); // id scalar + if (orgUserId != null) + existingUsers.put(orgUserId, id); + } + } + return existingUsers; + } + + @RequestMapping(value = { "/post_search/search" }, method = RequestMethod.POST) + public ModelAndView search(HttpServletRequest request, HttpServletResponse response) throws Exception { + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + PostSearchBean postSearchBean = mapper.readValue(root.get("postSearchBean").toString(), + PostSearchBean.class); + + //postSearchBean.setSearchResult(loadSearchResultData(request, postSearchBean)); + List users = loadSearchResultDataFromFnTableOrExt(request,postSearchBean); + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + String responseString = mapper.writeValueAsString(users); + JSONObject j = new JSONObject("{users: " + responseString + "}"); + + out.write(j.toString()); + } catch (Exception ex) { + logger.error(EELFLoggerDelegate.errorLogger, "search: failed to send search result" + ex.getMessage()); + } + + return null; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + public static List getSortByList() { + if (sortByList == null) { + sortByList = new ArrayList(); + sortByList.add(new Lookup("Last Name", "last_name")); + sortByList.add(new Lookup("First Name", "first_name")); + sortByList.add(new Lookup("HRID", "hrid")); + sortByList.add(new Lookup("SBCID", "sbcid")); + sortByList.add(new Lookup("Organization", "org_code")); + sortByList.add(new Lookup("Email", "email")); + } // if + + return sortByList; + } // getSortByList + + private List loadSearchResultDataFromFnTableOrExt(HttpServletRequest request, PostSearchBean searchCriteria) + throws Exception { + return userProfileService.searchPost(searchCriteria.getUser(), searchCriteria.getSortBy1(), + searchCriteria.getSortBy2(), searchCriteria.getSortBy3(), searchCriteria.getPageNo(), + searchCriteria.getNewDataSize(), UserUtils.getUserSession(request).getId().intValue()); + } + + @RequestMapping(value = { "/post_search/process" }, method = RequestMethod.POST) + public ModelAndView process(HttpServletRequest request, HttpServletResponse response) throws Exception { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); + JsonNode root = mapper.readTree(request.getReader()); + PostSearchBean postSearch = mapper.readValue(root.get("postSearchBean").toString(), PostSearchBean.class); + + postSearchService.process(request, postSearch); + List users = loadSearchResultDataFromFnTableOrExt(request,postSearch); + + logger.info(EELFLoggerDelegate.auditLogger, "Import new user from webphone "); + + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + String userString = mapper.writeValueAsString(users); + JSONObject j = new JSONObject("{users: " + userString + ",existingUsers: " + + mapper.writeValueAsString(getExistingUsers()) + "}"); + + out.write(j.toString()); + + return null; + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ProfileController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ProfileController.java new file mode 100644 index 0000000..1fd7800 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ProfileController.java @@ -0,0 +1,349 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.json.JSONObject; +import org.openecomp.portalsdk.core.domain.Role; +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.service.RoleService; +import org.openecomp.portalsdk.core.service.UserProfileService; +import org.openecomp.portalsdk.core.web.support.AppUtils; +import org.openecomp.portalsdk.core.web.support.JsonMessage; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Controller +@RequestMapping("/") +public class ProfileController extends RestrictedBaseController { + + @Autowired + UserProfileService service; + @Autowired + RoleService roleService; + + String viewName; + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ProfileController.class); + + @RequestMapping(value = { "/profile" }, method = RequestMethod.GET) + public ModelAndView profile(HttpServletRequest request) { + Map model = new HashMap(); + ObjectMapper mapper = new ObjectMapper(); + + User profile = null; + Long profileId = null; + + if (request.getRequestURI().indexOf("self_profile.htm") > -1) { + profile = UserUtils.getUserSession(request); + profileId = profile.getId(); + } else { + profileId = Long.parseLong(request.getParameter("profile_id")); + profile = (User) service.getUser(request.getParameter("profile_id")); + } + + try { + model.put("stateList", mapper.writeValueAsString(getStates())); + model.put("countries", mapper.writeValueAsString(getCountries())); + model.put("timeZones", mapper.writeValueAsString(getTimeZones())); + model.put("availableRoles", mapper.writeValueAsString(getAvailableRoles())); + model.put("profile", mapper.writeValueAsString(profile)); + model.put("profileId", mapper.writeValueAsString(profileId)); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "profile: failed to write JSON" + e.getMessage()); + } + return new ModelAndView("profile", "model", model); + } + + @RequestMapping(value = { "/self_profile" }, method = RequestMethod.GET) + public ModelAndView self_profile(HttpServletRequest request) { + Map model = new HashMap(); + ObjectMapper mapper = new ObjectMapper(); + + User profile = null; + Long profileId = null; + + profile = UserUtils.getUserSession(request); + profileId = profile.getId(); + profile = (User) service.getUser(profileId.toString()); + + try { + model.put("stateList", mapper.writeValueAsString(getStates())); + model.put("countries", mapper.writeValueAsString(getCountries())); + model.put("timeZones", mapper.writeValueAsString(getTimeZones())); + model.put("availableRoles", mapper.writeValueAsString(getAvailableRoles())); + model.put("profile", mapper.writeValueAsString(profile)); + model.put("profileId", mapper.writeValueAsString(profileId)); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "self_profile: failed to write JSON" + e.getMessage()); + } + return new ModelAndView("profile", "model", model); + } + + @RequestMapping(value = { "/get_self_profile" }, method = RequestMethod.GET) + public void getSelfProfile(HttpServletRequest request, HttpServletResponse response) { + Map model = new HashMap(); + ObjectMapper mapper = new ObjectMapper(); + + User profile = null; + Long profileId = null; + + profile = UserUtils.getUserSession(request); + profileId = profile.getId(); + profile = (User) service.getUser(profileId.toString()); + + try { + model.put("stateList", mapper.writeValueAsString(getStates())); + model.put("countries", mapper.writeValueAsString(getCountries())); + model.put("timeZones", mapper.writeValueAsString(getTimeZones())); + model.put("availableRoles", mapper.writeValueAsString(getAvailableRoles())); + model.put("profile", mapper.writeValueAsString(profile)); + model.put("profileId", mapper.writeValueAsString(profileId)); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getSelfProfile: failed to write JSON" + e.getMessage()); + } + + } + + @RequestMapping(value = { "/get_profile" }, method = RequestMethod.GET) + public void GetUser(HttpServletRequest request, HttpServletResponse response) { + Map model = new HashMap(); + ObjectMapper mapper = new ObjectMapper(); + try { + User profile = null; + Long profileId = null; + if (request.getRequestURI().indexOf("self_profile.htm") > -1) { + profile = UserUtils.getUserSession(request); + profileId = profile.getId(); + } else { + profileId = Long.parseLong(request.getParameter("profile_id")); + profile = (User) service.getUser(request.getParameter("profile_id")); + } + model.put("stateList", mapper.writeValueAsString(getStates())); + model.put("countries", mapper.writeValueAsString(getCountries())); + model.put("timeZones", mapper.writeValueAsString(getTimeZones())); + model.put("availableRoles", mapper.writeValueAsString(getAvailableRoles())); + model.put("profile", mapper.writeValueAsString(profile)); + model.put("profileId", mapper.writeValueAsString(profileId)); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "GetUser: failed to write JSON" + e.getMessage()); + } + } + + @RequestMapping(value = { "/profile/saveProfile" }, method = RequestMethod.POST) + public ModelAndView saveProfile(HttpServletRequest request, HttpServletResponse response) { + logger.info(EELFLoggerDelegate.debugLogger, "ProfileController.save"); + try { + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + User user = mapper.readValue(root.get("profile").toString(), User.class); + + String selectedCountry = mapper.readValue(root.get("selectedCountry").toString(), String.class); + String selectedState = mapper.readValue(root.get("selectedState").toString(), String.class); + String selectedTimeZone = mapper.readValue(root.get("selectedTimeZone").toString(), String.class); + + Long profileId = Long.parseLong(request.getParameter("profile_id")); + + User domainUser = (User) service.getUser(request.getParameter("profile_id")); + // user.setRoles(domainUser.getRoles()); + user.setPseudoRoles(domainUser.getPseudoRoles()); + user.setUserApps(domainUser.getUserApps()); + if (!selectedCountry.equals("")) { + user.setCountry(selectedCountry); + } + if (!selectedState.equals("")) { + user.setState(selectedState); + } + if (!selectedTimeZone.equals("")) { + user.setTimeZoneId(Long.parseLong(selectedTimeZone)); + } + service.saveUser(user); + logger.info(EELFLoggerDelegate.auditLogger, "Save user's profile for user " + profileId); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + out.write("" + profileId); + return null; + } catch (Exception e) { + response.setCharacterEncoding("UTF-8"); + try { + request.setCharacterEncoding("UTF-8"); + } catch (UnsupportedEncodingException e1) { + + e1.printStackTrace(); + + } + PrintWriter out = null; + try { + out = response.getWriter(); + } catch (IOException e1) { + logger.error(EELFLoggerDelegate.errorLogger, "saveProfile: failed to get writer" + e1.getMessage()); + } + out.write(e.getMessage()); + return null; + } + } + + @RequestMapping(value = { "/profile/removeRole" }, method = RequestMethod.POST) + public ModelAndView removeRole(HttpServletRequest request, HttpServletResponse response) throws Exception { + + logger.info(EELFLoggerDelegate.debugLogger, "ProfileController.save"); + try { + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + Role role = mapper.readValue(root.get("role").toString(), Role.class); + + // Long profileId = Long.parseLong(request.getParameter("profile_id")); + + User domainUser = (User) service.getUser(request.getParameter("profile_id")); + + domainUser.removeRole(role.getId()); + + service.saveUser(domainUser); + logger.info(EELFLoggerDelegate.auditLogger, "Remove role " + role.getId() + " from user " + request.getParameter("profile_id")); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + + Map model = new HashMap(); + model.put("profile", mapper.writeValueAsString(domainUser)); + JSONObject j = new JSONObject(mapper.writeValueAsString(domainUser)); + + out.write(j.toString()); + + return null; + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "removeRole" + e.getMessage()); + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + return null; + } + + } + + @RequestMapping(value = { "/profile/addNewRole" }, method = RequestMethod.POST) + public ModelAndView addNewRole(HttpServletRequest request, HttpServletResponse response) throws Exception { + + logger.info(EELFLoggerDelegate.debugLogger, "ProfileController.save" ); + try { + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + Role role = mapper.readValue(root.get("role").toString(), Role.class); + + // Long profileId = Long.parseLong(request.getParameter("profile_id")); + + User domainUser = (User) service.getUser(request.getParameter("profile_id")); + + domainUser.addRole(role); + + service.saveUser(domainUser); + logger.info(EELFLoggerDelegate.auditLogger, "Add new role " + role.getName() + " to user " + request.getParameter("profile_id")); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + + Map model = new HashMap(); + model.put("profile", mapper.writeValueAsString(domainUser)); + JSONObject j = new JSONObject(mapper.writeValueAsString(domainUser)); + + out.write(j.toString()); + + return null; + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "addNewRole" + e.getMessage()); + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + return null; + } + + } + + public String getViewName() { + return viewName; + } + + public void setViewName(String viewName) { + this.viewName = viewName; + } + + @SuppressWarnings("rawtypes") + public List getStates() { + return AppUtils.getLookupList("FN_LU_STATE", "STATE_CD", "STATE", null, "STATE_CD"); + } + + @SuppressWarnings("rawtypes") + public List getCountries() { + return AppUtils.getLookupList("FN_LU_COUNTRY", "COUNTRY_CD", "COUNTRY", null, "COUNTRY"); + } + + @SuppressWarnings("rawtypes") + public List getTimeZones() { + return AppUtils.getLookupList("FN_LU_TIMEZONE", "TIMEZONE_ID", "TIMEZONE_NAME", null, "TIMEZONE_NAME"); + } + + @SuppressWarnings("rawtypes") + public List getAvailableRoles() { + return roleService.getAvailableRoles(); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ProfileSearchController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ProfileSearchController.java new file mode 100644 index 0000000..42ebd41 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/ProfileSearchController.java @@ -0,0 +1,149 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.json.JSONObject; +import org.openecomp.portalsdk.core.domain.MenuData; +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.service.FnMenuService; +import org.openecomp.portalsdk.core.service.UserProfileService; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.web.support.JsonMessage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@Controller +@RequestMapping("/") +public class ProfileSearchController extends RestrictedBaseController{ + @Autowired + UserProfileService service; + @Autowired + FnMenuService fnMenuService; + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ProfileSearchController.class); + @RequestMapping(value = {"/profile_search" }, method = RequestMethod.GET) + public ModelAndView ProfileSearch(HttpServletRequest request) { + Map model = new HashMap(); + ObjectMapper mapper = new ObjectMapper(); + List profileList =null; + logger.info(EELFLoggerDelegate.applicationLogger, "Initiating ProfileSearch in ProfileSearchController"); + try { + profileList = service.findAll(); + model.putAll(setDashboardData(request)); + model.put("profileList", mapper.writeValueAsString(profileList)); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.applicationLogger, "error while profile_search process in ProfileSearchController" + e.getMessage()); + } + return new ModelAndView(getViewName(),"model", model); + } + + @RequestMapping(value = {"/get_user" }, method = RequestMethod.GET) + public void GetUser(HttpServletRequest request, HttpServletResponse response) { + logger.info(EELFLoggerDelegate.applicationLogger, "Initiating get_user in ProfileSearchController"); + ObjectMapper mapper = new ObjectMapper(); + List profileList =null; + try { + profileList = service.findAll(); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(profileList)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + + } catch (Exception e) { + logger.error(EELFLoggerDelegate.applicationLogger, "error while get_user process in ProfileSearchController" + e.getMessage()); + } + } + + @RequestMapping(value = {"/get_user_pagination" }, method = RequestMethod.GET) + public void getUserPagination(HttpServletRequest request, HttpServletResponse response) { + Map model = new HashMap(); + ObjectMapper mapper = new ObjectMapper(); + logger.info(EELFLoggerDelegate.applicationLogger, "Initiating get_user_pagination in ProfileSearchController"); + int pageNum = Integer.parseInt(request.getParameter("pageNum")); + int viewPerPage = Integer.parseInt(request.getParameter("viewPerPage")); + List profileList =null; + try { + profileList = service.findAll(); + model.put("totalPage",(int) Math.ceil((double)profileList.size() / viewPerPage)); + profileList = profileList.subList(viewPerPage*(pageNum-1)setDashboardData(HttpServletRequest request) throws Exception{ + ObjectMapper mapper = new ObjectMapper(); + Map model = new HashMap(); + List> childItemList = new ArrayList>(); + List parentList = new ArrayList(); + logger.info(EELFLoggerDelegate.applicationLogger, "Initiating setDashboardData in ProfileSearchController"); + HttpSession session = request.getSession(); + try{ + Set menuResult = (Set) session.getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME)); + fnMenuService.setMenuDataStructure(childItemList, parentList, menuResult); + }catch(Exception e){ + logger.error(EELFLoggerDelegate.applicationLogger, "error while setDashboardData process in ProfileSearchController" + e.getMessage()); + } + model.put("childItemList",mapper.writeValueAsString(childItemList)); + model.put("parentList",mapper.writeValueAsString(parentList)); + return model; + } + + @RequestMapping(value = {"/profile/toggleProfileActive" }, method = RequestMethod.GET) + public void toggleProfileActive(HttpServletRequest request, HttpServletResponse response) throws IOException { + try{ + logger.info(EELFLoggerDelegate.applicationLogger, "Initiating toggleProfileActive in ProfileSearchController"); + String userId = request.getParameter("profile_id"); + User user = (User)service.getUser(userId); + user.setActive(!user.getActive()); + service.saveUser(user); + logger.info(EELFLoggerDelegate.auditLogger, "Change active status for user " + user.getId() + " to " + user.getActive()); + ObjectMapper mapper = new ObjectMapper(); + response.setContentType("application/json"); + PrintWriter out = response.getWriter(); + out.write(mapper.writeValueAsString(user.getActive())); + }catch(Exception e){ + logger.error(EELFLoggerDelegate.applicationLogger, "error while toggleProfileActive process in ProfileSearchController" + e.getMessage()); + } + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedBaseController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedBaseController.java new file mode 100644 index 0000000..2b2e342 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedBaseController.java @@ -0,0 +1,50 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +public class RestrictedBaseController extends FusionBaseController{ + + protected String viewName; + private String exceptionView; + @Override + public boolean isAccessible() { + return false; + } + @Override + public boolean isRESTfulCall(){ + return false; + } + protected String getViewName() { + return viewName; + } + protected void setViewName(String viewName) { + this.viewName = viewName; + } + + public String getExceptionView() { + return (exceptionView == null) ? "runtime_error_handler" : exceptionView; + } + + public void setExceptionView(String exceptionView) { + this.exceptionView = exceptionView; + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedRESTfulBaseController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedRESTfulBaseController.java new file mode 100644 index 0000000..d11c7d7 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedRESTfulBaseController.java @@ -0,0 +1,50 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +public class RestrictedRESTfulBaseController extends FusionBaseController{ + + protected String viewName; + private String exceptionView; + @Override + public boolean isAccessible() { + return false; + } + @Override + public boolean isRESTfulCall(){ + return true; + } + protected String getViewName() { + return viewName; + } + protected void setViewName(String viewName) { + this.viewName = viewName; + } + + public String getExceptionView() { + return (exceptionView == null) ? "runtime_error_handler" : exceptionView; + } + + public void setExceptionView(String exceptionView) { + this.exceptionView = exceptionView; + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleController.java new file mode 100644 index 0000000..0419e2b --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleController.java @@ -0,0 +1,332 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.io.PrintWriter; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.json.JSONObject; +import org.openecomp.portalsdk.core.domain.Role; +import org.openecomp.portalsdk.core.domain.RoleFunction; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.service.RoleService; +import org.openecomp.portalsdk.core.web.support.JsonMessage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.ServletRequestUtils; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.type.TypeFactory; + +@Controller +@RequestMapping("/") +public class RoleController extends RestrictedBaseController { + @Autowired + RoleService service; + + String viewName; + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RoleController.class); + + @RequestMapping(value = { "/role" }, method = RequestMethod.GET) + public ModelAndView role(HttpServletRequest request) { + Map model = new HashMap(); + ObjectMapper mapper = new ObjectMapper(); + + Role role = service.getRole(new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0))); + logger.info("role_id" + role.getId()); + try { + model.put("availableRoleFunctions", mapper.writeValueAsString(service.getRoleFunctions())); + model.put("availableRoles", mapper.writeValueAsString(service.getAvailableChildRoles(role.getId()))); + model.put("role", mapper.writeValueAsString(role)); + } catch (Exception e) { + logger.error("role: failed", e); + logger.error(EELFLoggerDelegate.errorLogger, "Unable to set the active profile" + e.getMessage()); + } + return new ModelAndView(getViewName(), model); + } + + @RequestMapping(value = { "/get_role" }, method = RequestMethod.GET) + public void getRole(HttpServletRequest request, HttpServletResponse response) { + Map model = new HashMap(); + ObjectMapper mapper = new ObjectMapper(); + + Role role = service.getRole(new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0))); + logger.info(EELFLoggerDelegate.applicationLogger, "role_id" + role.getId()); + try { + model.put("availableRoleFunctions", mapper.writeValueAsString(service.getRoleFunctions())); + model.put("availableRoles", mapper.writeValueAsString(service.getAvailableChildRoles(role.getId()))); + model.put("role", mapper.writeValueAsString(role)); + + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getRole failed" + e.getMessage()); + } + + } + + @RequestMapping(value = { "/role/saveRole" }, method = RequestMethod.POST) + public ModelAndView saveRole(HttpServletRequest request, HttpServletResponse response) throws Exception { + + logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.save"); + logger.info(EELFLoggerDelegate.auditLogger, "RoleController.save"); + try { + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + Role role = mapper.readValue(root.get("role").toString(), Role.class); + + List childRoles = mapper.readValue(root.get("childRoles").toString(), + TypeFactory.defaultInstance().constructCollectionType(List.class, Role.class)); + + List roleFunctions = mapper.readValue(root.get("roleFunctions").toString(), + TypeFactory.defaultInstance().constructCollectionType(List.class, RoleFunction.class)); + + Role domainRole = null; + if (role.getId() != null) { + logger.info(EELFLoggerDelegate.auditLogger, "updating existing role " + role.getId()); + domainRole = service.getRole(role.getId()); + + domainRole.setName(role.getName()); + domainRole.setPriority(role.getPriority()); + } else { + logger.info(EELFLoggerDelegate.auditLogger, "saving as new role"); + domainRole = new Role(); + domainRole.setName(role.getName()); + domainRole.setPriority(role.getPriority()); + if (role.getChildRoles().size() > 0) { + for (Object childRole : childRoles) { + domainRole.addChildRole((Role) childRole); + } + } + if (role.getRoleFunctions().size() > 0) { + for (Object roleFunction : roleFunctions) { + domainRole.addRoleFunction((RoleFunction) roleFunction); + } + } + } + + service.saveRole(domainRole); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + String responseString = mapper.writeValueAsString(domainRole); + JSONObject j = new JSONObject("{role: " + responseString + "}"); + + out.write(j.toString()); + + return null; + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "saveRole failed" + e.getMessage()); + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + return null; + } + + } + + @RequestMapping(value = { "/role/removeRoleFunction" }, method = RequestMethod.POST) + public ModelAndView removeRoleFunction(HttpServletRequest request, HttpServletResponse response) throws Exception { + + logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.removeRoleFunction"); + try { + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + RoleFunction roleFunction = mapper.readValue(root.get("roleFunction").toString(), RoleFunction.class); + + Role domainRole = service.getRole(new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0))); + logger.info(EELFLoggerDelegate.auditLogger, "Remove role function " + roleFunction.getCode() + " from role " + ServletRequestUtils.getIntParameter(request, "role_id", 0)); + + domainRole.removeRoleFunction(roleFunction.getCode()); + + service.saveRole(domainRole); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + + String responseString = mapper.writeValueAsString(domainRole); + JSONObject j = new JSONObject("{role: " + responseString + "}"); + out.write(j.toString()); + + return null; + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "removeRole failed" + e.getMessage()); + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + return null; + } + + } + + @RequestMapping(value = { "/role/addRoleFunction" }, method = RequestMethod.POST) + public ModelAndView addRoleFunction(HttpServletRequest request, HttpServletResponse response) throws Exception { + + logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.removeRoleFunction"); + try { + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + RoleFunction roleFunction = mapper.readValue(root.get("roleFunction").toString(), RoleFunction.class); + + Role domainRole = service.getRole(new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0))); + + domainRole.addRoleFunction(roleFunction); + + service.saveRole(domainRole); + logger.info(EELFLoggerDelegate.auditLogger, "Add role function " + roleFunction.getCode() + " to role " + ServletRequestUtils.getIntParameter(request, "role_id", 0)); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + + String responseString = mapper.writeValueAsString(domainRole); + JSONObject j = new JSONObject("{role: " + responseString + "}"); + out.write(j.toString()); + + return null; + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "removeRoleFunction failed" + e.getMessage()); + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + return null; + } + + } + + @RequestMapping(value = { "/role/removeChildRole" }, method = RequestMethod.POST) + public ModelAndView removeChildRole(HttpServletRequest request, HttpServletResponse response) throws Exception { + + logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.removeChileRole"); + try { + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + Role childRole = mapper.readValue(root.get("childRole").toString(), Role.class); + + Role domainRole = service.getRole(new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0))); + + domainRole.removeChildRole(childRole.getId()); + logger.info(EELFLoggerDelegate.auditLogger, "remove child role " + childRole.getId() + " from role " + ServletRequestUtils.getIntParameter(request, "role_id", 0)); + + + service.saveRole(domainRole); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + + String responseString = mapper.writeValueAsString(domainRole); + JSONObject j = new JSONObject("{role: " + responseString + "}"); + out.write(j.toString()); + + return null; + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "removeChildRole failed" + e.getMessage()); + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + return null; + } + + } + + @RequestMapping(value = { "/role/addChildRole" }, method = RequestMethod.POST) + public ModelAndView addChildRole(HttpServletRequest request, HttpServletResponse response) throws Exception { + + logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.addChileRole"); + try { + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + Role childRole = mapper.readValue(root.get("childRole").toString(), Role.class); + + Role domainRole = service.getRole(new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0))); + + domainRole.addChildRole(childRole); + + service.saveRole(domainRole); + logger.info(EELFLoggerDelegate.auditLogger, "Add child role " + childRole.getId() + " to role " + ServletRequestUtils.getIntParameter(request, "role_id", 0)); + + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + + String responseString = mapper.writeValueAsString(domainRole); + JSONObject j = new JSONObject("{role: " + responseString + "}"); + out.write(j.toString()); + + return null; + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "addChildRole failed" + e.getMessage()); + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + return null; + } + + } + + public String getViewName() { + return viewName; + } + + public void setViewName(String viewName) { + this.viewName = viewName; + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleFunctionListController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleFunctionListController.java new file mode 100644 index 0000000..3b9eed6 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleFunctionListController.java @@ -0,0 +1,184 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.json.JSONObject; +import org.openecomp.portalsdk.core.domain.RoleFunction; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.service.RoleService; +import org.openecomp.portalsdk.core.web.support.JsonMessage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +import com.fasterxml.jackson.core.JsonGenerationException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Controller +@RequestMapping("/") +public class RoleFunctionListController extends RestrictedBaseController { + @Autowired + RoleService service; + + String viewName; + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RoleFunctionListController.class); + + @RequestMapping(value = {"/role_function_list" }, method = RequestMethod.GET) + public ModelAndView welcome(HttpServletRequest request) { + Map model = new HashMap(); + ObjectMapper mapper = new ObjectMapper(); + + try { + model.put("availableRoleFunctions", mapper.writeValueAsString(service.getRoleFunctions())); + } catch (JsonGenerationException e) { + e.printStackTrace(); + } catch (JsonMappingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + return new ModelAndView(getViewName(),model); + } + + @RequestMapping(value = {"/get_role_functions" }, method = RequestMethod.GET) + public void getRoleFunctionList(HttpServletRequest request,HttpServletResponse response) { + Map model = new HashMap(); + ObjectMapper mapper = new ObjectMapper(); + + try { + model.put("availableRoleFunctions", mapper.writeValueAsString(service.getRoleFunctions())); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } catch (JsonGenerationException e) { + e.printStackTrace(); + } catch (JsonMappingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + } + + @RequestMapping(value = {"/role_function_list/saveRoleFunction" }, method = RequestMethod.POST) + public ModelAndView saveRoleFunction(HttpServletRequest request, + HttpServletResponse response) throws Exception { + + try { + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + RoleFunction availableRoleFunction = mapper.readValue(root.get("availableRoleFunction").toString(), RoleFunction.class); + + RoleFunction domainRoleFunction = service.getRoleFunction(availableRoleFunction.getCode()); + + //role. toggle active ind + domainRoleFunction.setName(availableRoleFunction.getName()); + domainRoleFunction.setCode(availableRoleFunction.getCode()); + + service.saveRoleFunction(domainRoleFunction); + logger.info(EELFLoggerDelegate.auditLogger, "Save role function " + domainRoleFunction.getName()); + + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + String responseString = mapper.writeValueAsString(service.getRoleFunctions()); + JSONObject j = new JSONObject("{availableRoleFunctions: "+responseString+"}"); + + out.write(j.toString()); + + return null; + } catch (Exception e) { + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + return null; + } + + } + + @RequestMapping(value = {"/role_function_list/removeRoleFunction" }, method = RequestMethod.POST) + public ModelAndView removeRoleFunction(HttpServletRequest request, + HttpServletResponse response) throws Exception { + + try { + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + RoleFunction availableRoleFunction = mapper.readValue(root.get("availableRoleFunction").toString(), RoleFunction.class); + + RoleFunction domainRoleFunction = service.getRoleFunction(availableRoleFunction.getCode()); + + service.deleteRoleFunction(domainRoleFunction); + logger.info(EELFLoggerDelegate.auditLogger, "Remove role function " + domainRoleFunction.getName()); + + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + + String responseString = mapper.writeValueAsString(service.getRoleFunctions()); + JSONObject j = new JSONObject("{availableRoleFunctions: "+responseString+"}"); + out.write(j.toString()); + + return null; + } catch (Exception e) { + System.out.println(e); + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + return null; + } + + } + + public String getViewName() { + return viewName; + } + public void setViewName(String viewName) { + this.viewName = viewName; + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleListController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleListController.java new file mode 100644 index 0000000..78fbc19 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/RoleListController.java @@ -0,0 +1,179 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.json.JSONObject; +import org.openecomp.portalsdk.core.domain.Role; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.service.RoleService; +import org.openecomp.portalsdk.core.web.support.JsonMessage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +import com.fasterxml.jackson.core.JsonGenerationException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Controller +@RequestMapping("/") +public class RoleListController extends RestrictedBaseController { + @Autowired + RoleService service; + String viewName; + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RoleListController.class); + + + @RequestMapping(value = {"/role_list" }, method = RequestMethod.GET) + public ModelAndView role(HttpServletRequest request) { + Map model = new HashMap(); + ObjectMapper mapper = new ObjectMapper(); + + try { + model.put("availableRoles", mapper.writeValueAsString(service.getAvailableRoles())); + } catch (JsonGenerationException e) { + e.printStackTrace(); + } catch (JsonMappingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + return new ModelAndView(getViewName(),model); + } + + @RequestMapping(value = {"/get_roles" }, method = RequestMethod.GET) + public void getRoles(HttpServletRequest request, HttpServletResponse response) { + Map model = new HashMap(); + ObjectMapper mapper = new ObjectMapper(); + + try { + model.put("availableRoles", mapper.writeValueAsString(service.getAvailableRoles())); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } catch (JsonGenerationException e) { + e.printStackTrace(); + } catch (JsonMappingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + @RequestMapping(value = {"/role_list/toggleRole" }, method = RequestMethod.POST) + public ModelAndView toggleRole(HttpServletRequest request, + HttpServletResponse response) throws Exception { + + try { + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + Role role = mapper.readValue(root.get("role").toString(), Role.class); + + Role domainRole = service.getRole(role.getId()); + //role. toggle active ind + boolean active = domainRole.getActive(); + domainRole.setActive(!active); + + service.saveRole(domainRole); + logger.info(EELFLoggerDelegate.auditLogger, "Toggle active status for role " + domainRole.getId()); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + String responseString = mapper.writeValueAsString(service.getAvailableRoles()); + JSONObject j = new JSONObject("{availableRoles: "+responseString+"}"); + + out.write(j.toString()); + + return null; + } catch (Exception e) { + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + return null; + } + + } + + @RequestMapping(value = {"/role_list/removeRole" }, method = RequestMethod.POST) + public ModelAndView removeRole(HttpServletRequest request, + HttpServletResponse response) throws Exception { + + try { + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + JsonNode root = mapper.readTree(request.getReader()); + Role role = mapper.readValue(root.get("role").toString(), Role.class); + + Role domainRole = service.getRole(role.getId()); + + service.deleteDependcyRoleRecord(role.getId()); + service.deleteRole(domainRole); + logger.info(EELFLoggerDelegate.auditLogger, "Remove role " + domainRole.getId()); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + PrintWriter out = response.getWriter(); + + String responseString = mapper.writeValueAsString(service.getAvailableRoles()); + JSONObject j = new JSONObject("{availableRoles: "+responseString+"}"); + out.write(j.toString()); + + return null; + } catch (Exception e) { + System.out.println(e); + response.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding("UTF-8"); + PrintWriter out = response.getWriter(); + out.write(e.getMessage()); + return null; + } + + } + + public String getViewName() { + return viewName; + } + public void setViewName(String viewName) { + this.viewName = viewName; + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/SingleSignOnController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/SingleSignOnController.java new file mode 100644 index 0000000..4a0fb6f --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/SingleSignOnController.java @@ -0,0 +1,232 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.openecomp.portalsdk.core.command.LoginBean; +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.menu.MenuProperties; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalTimeoutHandler; +import org.openecomp.portalsdk.core.service.LoginService; +import org.openecomp.portalsdk.core.service.ProfileService; +import org.openecomp.portalsdk.core.util.CipherUtil; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.web.support.AppUtils; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.util.WebUtils; + +@Controller +@RequestMapping("/") +public class SingleSignOnController extends UnRestrictedBaseController { + + private static final String EP_SERVICE = "EPService"; + private static final String USER_ID = "UserId"; + public static final String DEFAULT_SUCCESS_VIEW = "welcome"; + public static final String DEFAULT_FAILURE_VIEW = "login"; + public static final String ERROR_MESSAGE_KEY = "error"; + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SingleSignOnController.class); + + @Autowired + ProfileService service; + @Autowired + private LoginService loginService; + String viewName; + private String welcomeView; + + public String getWelcomeView() { + return welcomeView; + } + + public void setWelcomeView(String welcomeView) { + this.welcomeView = welcomeView; + } + + /** + * Handles requests directed to the single sign-on page by the session + * timeout interceptor. + * + * @param request + * @return Redirect to an appropriate address + * @throws Exception + */ + @RequestMapping(value = { "/single_signon.htm" }, method = RequestMethod.GET) + public ModelAndView singleSignOnLogin(HttpServletRequest request) throws Exception { + + Map model = new HashMap(); + HashMap additionalParamsMap = new HashMap(); + LoginBean commandBean = new LoginBean(); + + // SessionTimeoutInterceptor sets these parameters + String forwardURL = URLDecoder.decode(request.getParameter("forwardURL"), "UTF-8"); + String redirectToPortal = request.getParameter("redirectToPortal"); + + if (isLoginCookieExist(request) && redirectToPortal == null) { + HttpSession session = null; + session = AppUtils.getSession(request); + User user = UserUtils.getUserSession(request); + if (session == null || user == null) { + String orgUserId = ""; + orgUserId = getUserIdFromCookie(request); + commandBean.setUserid(orgUserId); + commandBean = getLoginService().findUser(commandBean, + (String) request.getAttribute(MenuProperties.MENU_PROPERTIES_FILENAME_KEY), + additionalParamsMap); + if (commandBean.getUser() == null) { + String loginErrorMessage = (commandBean.getLoginErrorMessage() != null) + ? commandBean.getLoginErrorMessage() + : SystemProperties.MESSAGE_KEY_LOGIN_ERROR_USER_NOT_FOUND; + model.put(ERROR_MESSAGE_KEY, SystemProperties.getProperty(loginErrorMessage)); + final String redirectUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL) + + "?noUserError=Yes"; + logger.debug(EELFLoggerDelegate.debugLogger, "singleSignOnLogin: user is null, redirect URL is {}", + redirectUrl); + return new ModelAndView("redirect:" + redirectUrl); + } else { + // store the user's information in the session + + UserUtils.setUserSession(request, commandBean.getUser(), commandBean.getMenu(), + commandBean.getBusinessDirectMenu(), ""); + initateSessionMgtHandler(request); + logger.debug(EELFLoggerDelegate.debugLogger, + "singleSignOnLogin: create new user session for expired user {}; user {} exists in the system", + commandBean.getUser().getOrgUserId()); + return new ModelAndView("redirect:" + forwardURL); + } + } // user is null or session is null + else { + // both user and session are non-null. + logger.info(EELFLoggerDelegate.debugLogger, "singleSignOnLogin: redirecting to the forwardURL {}", + forwardURL); + return new ModelAndView("redirect:" + forwardURL); + } + + } else { + /* + * Login cookie not found, or redirect-to-portal parameter was found. + * + * Redirect the user to the portal with a suitable return URL. The + * forwardURL parameter that arrives as a parameter is a partial + * (not absolute) request path for a page in the application. The + * challenge here is to compute the correct absolute path for the + * original request so the portal can redirect the user back to the + * right place. + */ + String returnToAppUrl = null; + if (SystemProperties.containsProperty(SystemProperties.APP_BASE_URL)) { + // New feature: + // application can publish a base URL in system.properties + String appUrl = SystemProperties.getProperty(SystemProperties.APP_BASE_URL); + returnToAppUrl = appUrl + (appUrl.endsWith("/") ? "" : "/") + forwardURL; + logger.debug(EELFLoggerDelegate.debugLogger, + "singleSignOnLogin: using app base URL {} and redirectURL {}", appUrl, returnToAppUrl); + } else { + // Be backward compatible with applications that don't need this + // feature. + // This is the controller for the single_signon.htm page, so the + // replace + // should always find the specified token. + returnToAppUrl = ((HttpServletRequest) request).getRequestURL().toString().replace("single_signon.htm", + forwardURL); + logger.debug(EELFLoggerDelegate.debugLogger, "singleSignOnLogin: computed redirectURL {}", returnToAppUrl); + } + final String encodedReturnToAppUrl = URLEncoder.encode(returnToAppUrl, "UTF-8"); + // Also send the application's UEB key so Portal can block URL + // reflection attacks. + final String uebAppKey = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY); + final String url = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL); + final String portalUrl = url.substring(0, url.lastIndexOf('/')) + "/processSingleSignOn"; + final String redirectUrl = portalUrl + "?uebAppKey=" + uebAppKey + "&redirectUrl=" + encodedReturnToAppUrl; + logger.debug(EELFLoggerDelegate.debugLogger, "singleSignOnLogin: portal-bound redirect URL is {}", + redirectUrl); + return new ModelAndView("redirect:" + redirectUrl); + } + } + + protected void initateSessionMgtHandler(HttpServletRequest request) { + String portalJSessionId = getPortalJSessionId(request); + String jSessionId = getJessionId(request); + PortalTimeoutHandler.sessionCreated(portalJSessionId, jSessionId, AppUtils.getSession(request)); + } + + public boolean isLoginCookieExist(HttpServletRequest request) { + Cookie ep = WebUtils.getCookie(request, EP_SERVICE); + return (ep != null); + } + + public static String getUserIdFromCookie(HttpServletRequest request) throws Exception { + String userId = ""; + Cookie[] cookies = request.getCookies(); + Cookie userIdcookie = null; + if (cookies != null) + for (Cookie cookie : cookies) + if (cookie.getName().equals(USER_ID)) + userIdcookie = cookie; + if(userIdcookie!=null){ + userId = CipherUtil.decrypt(userIdcookie.getValue(), + SystemProperties.getProperty(SystemProperties.Decryption_Key)); + } + return userId; + + } + + public String getPortalJSessionId(HttpServletRequest request) { + Cookie ep = WebUtils.getCookie(request, EP_SERVICE); + return ep.getValue(); + + } + + public String getJessionId(HttpServletRequest request) { + return request.getSession().getId(); + } + + public String getViewName() { + return viewName; + } + + public void setViewName(String viewName) { + this.viewName = viewName; + } + + public LoginService getLoginService() { + return loginService; + } + + public void setLoginService(LoginService loginService) { + this.loginService = loginService; + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/UnRestrictedBaseController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/UnRestrictedBaseController.java new file mode 100644 index 0000000..78bf4c5 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/UnRestrictedBaseController.java @@ -0,0 +1,40 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +public class UnRestrictedBaseController extends FusionBaseController{ + protected String viewName; + + @Override + public boolean isAccessible() { + return true; + } + @Override + public boolean isRESTfulCall(){ + return false; + } + protected String getViewName() { + return viewName; + } + + protected void setViewName(String viewName) { + this.viewName = viewName; + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/UsageListController.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/UsageListController.java new file mode 100644 index 0000000..c561657 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/controller/UsageListController.java @@ -0,0 +1,163 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.controller; + +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.openecomp.portalsdk.core.command.UserRowBean; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.util.UsageUtils; +import org.openecomp.portalsdk.core.web.support.JsonMessage; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +@Controller +@RequestMapping("/") +public class UsageListController extends RestrictedBaseController { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UsageListController.class); + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @RequestMapping(value = { "/usage_list" }, method = RequestMethod.GET) + public ModelAndView usageList(HttpServletRequest request) { + Map model = new HashMap(); + + HttpSession httpSession = request.getSession(); + HashMap activeUsers = (HashMap) httpSession.getServletContext().getAttribute("activeUsers"); + if (activeUsers.size() == 0) { + activeUsers.put(httpSession.getId(), httpSession); + httpSession.getServletContext().setAttribute("activeUsers", activeUsers); + } + ArrayList rows = UsageUtils.getActiveUsers(activeUsers); + JSONArray ja = new JSONArray(); + try { + for (UserRowBean userRowBean : rows) { + JSONObject jo = new JSONObject(); + jo.put("id", userRowBean.getId()); + jo.put("lastName", userRowBean.getLastName()); + jo.put("email", userRowBean.getEmail()); + jo.put("lastAccess", userRowBean.getLastAccess()); + jo.put("remaining", userRowBean.getRemaining()); + jo.put("sessionId", userRowBean.getSessionId()); + if (!(httpSession.getId().equals(userRowBean.getSessionId()))) { + jo.put("delete", "yes"); + } else { + jo.put("delete", "no"); + } + ja.put(jo); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "usageList 1: failed" + e.getMessage()); + } + + model.put("model", ja); + + return new ModelAndView(getViewName(), model); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @RequestMapping(value = { "/get_usage_list" }, method = RequestMethod.GET) + public void usageList(HttpServletRequest request, HttpServletResponse response) { + HttpSession httpSession = request.getSession(); + HashMap activeUsers = (HashMap) httpSession.getServletContext().getAttribute("activeUsers"); + if (activeUsers.size() == 0) { + activeUsers.put(httpSession.getId(), httpSession); + httpSession.getServletContext().setAttribute("activeUsers", activeUsers); + } + ArrayList rows = UsageUtils.getActiveUsers(activeUsers); + JSONArray ja = new JSONArray(); + try { + for (UserRowBean userRowBean : rows) { + JSONObject jo = new JSONObject(); + jo.put("id", userRowBean.getId()); + jo.put("lastName", userRowBean.getLastName()); + jo.put("email", userRowBean.getEmail()); + jo.put("lastAccess", userRowBean.getLastAccess()); + jo.put("remaining", userRowBean.getRemaining()); + jo.put("sessionId", userRowBean.getSessionId()); + if (!(httpSession.getId().equals(userRowBean.getSessionId()))) { + jo.put("delete", "yes"); + } else { + jo.put("delete", "no"); + } + ja.put(jo); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "usageList 2: failed" + e.getMessage()); + } + JsonMessage msg; + try { + msg = new JsonMessage(ja.toString()); + JSONObject j = new JSONObject(msg); + response.getWriter().write(j.toString()); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "usageList 3: failed" + e.getMessage()); + } + + } + + @SuppressWarnings("rawtypes") + @RequestMapping(value = { "/usage_list/removeSession" }, method = RequestMethod.GET) + public void removeSession(HttpServletRequest request, HttpServletResponse response) throws Exception { + HashMap activeUsers = (HashMap) request.getSession().getServletContext().getAttribute("activeUsers"); + UserRowBean data = new UserRowBean(); + data.setSessionId(request.getParameter("deleteSessionId")); + UsageUtils.getActiveUsersAfterDelete(activeUsers, data); + + HttpSession httpSession = request.getSession(); + ArrayList rows = UsageUtils.getActiveUsers(activeUsers); + JSONArray ja = new JSONArray(); + try { + for (UserRowBean userRowBean : rows) { + JSONObject jo = new JSONObject(); + jo.put("id", userRowBean.getId()); + jo.put("lastName", userRowBean.getLastName()); + jo.put("email", userRowBean.getEmail()); + jo.put("lastAccess", userRowBean.getLastAccess()); + jo.put("remaining", userRowBean.getRemaining()); + jo.put("sessionId", userRowBean.getSessionId()); + if (!(httpSession.getId().equals(userRowBean.getSessionId()))) { + jo.put("delete", "yes"); + } else { + jo.put("delete", "no"); + } + ja.put(jo); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "removeSession: failed" + e.getMessage()); + } + + response.setContentType("application/json"); + PrintWriter out = response.getWriter(); + out.write(ja.toString()); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/AbstractDao.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/AbstractDao.java new file mode 100644 index 0000000..0b27406 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/AbstractDao.java @@ -0,0 +1,62 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.dao; +import java.io.Serializable; +import java.lang.reflect.ParameterizedType; + +import org.hibernate.Criteria; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; + +public abstract class AbstractDao { + + private final Class persistentClass; + + @SuppressWarnings("unchecked") + public AbstractDao(){ + this.persistentClass =(Class) ((ParameterizedType) this.getClass().getGenericSuperclass()).getActualTypeArguments()[1]; + } + + @Autowired + private SessionFactory sessionFactory; + + protected Session getSession(){ + return sessionFactory.getCurrentSession(); + } + + @SuppressWarnings("unchecked") + public T getByKey(PK key) { + return (T) getSession().get(persistentClass, key); + } + + public void persist(T entity) { + getSession().persist(entity); + } + + public void delete(T entity) { + getSession().delete(entity); + } + + protected Criteria createEntityCriteria(){ + return getSession().createCriteria(persistentClass); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/ProfileDao.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/ProfileDao.java new file mode 100644 index 0000000..0094072 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/ProfileDao.java @@ -0,0 +1,29 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.dao; + +import java.util.List; + +import org.openecomp.portalsdk.core.domain.Profile; + +public interface ProfileDao { + List findAll(); + Profile getProfile(int id); +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/ProfileDaoImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/ProfileDaoImpl.java new file mode 100644 index 0000000..8d8d0d6 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/ProfileDaoImpl.java @@ -0,0 +1,50 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.dao; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.openecomp.portalsdk.core.domain.Profile; +import org.springframework.stereotype.Repository; + +@Repository("profileDao") +public class ProfileDaoImpl extends AbstractDao implements ProfileDao{ + + + public List findAll() { + Criteria crit = getSession().createCriteria(Profile.class); + @SuppressWarnings("unchecked") + List p = crit.list(); + + return p; + } + + + public Profile getProfile(int id) { + Criteria crit = getSession().createCriteria(Profile.class); + crit.add(Restrictions.eq("id", id)); + Profile profile = (Profile) crit.uniqueResult(); + + return profile; + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/hibernate/ModelOperationsCommon.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/hibernate/ModelOperationsCommon.java new file mode 100644 index 0000000..cd9e644 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/hibernate/ModelOperationsCommon.java @@ -0,0 +1,453 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.dao.hibernate; + +import java.io.Serializable; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.hibernate.Criteria; +import org.hibernate.FetchMode; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.Session; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.ProjectionList; +import org.hibernate.type.LongType; +import org.openecomp.portalsdk.core.dao.support.FusionDao; +import org.openecomp.portalsdk.core.domain.Lookup; +import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.util.SystemProperties; + +public abstract class ModelOperationsCommon extends FusionDao { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ModelOperationsCommon.class); + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public List _getList(Class domainClass, String filterClause, Integer fromIndex, Integer toIndex, String orderBy) { + List list = null; + String className = domainClass.getName(); + + Session session = getSessionFactory().getCurrentSession(); + + logger.info(EELFLoggerDelegate.debugLogger, "Getting " + className.toLowerCase() + " records" + + ((fromIndex != null) ? " from rows " + fromIndex.toString() + " to " + toIndex.toString() : "") + + "..."); + + + if (filterClause != null && filterClause.length() > 0) { + logger.info(EELFLoggerDelegate.debugLogger, "Filtering " + className + " by: " + filterClause); + + } + + list = session.createQuery("from " + className + Utilities.nvl(filterClause, "") + + ((orderBy != null) ? " order by " + orderBy : "")).list(); + list = (fromIndex != null) ? list.subList(fromIndex.intValue() - 1, toIndex.intValue()) : list; + + if (orderBy == null && list != null) { + Collections.sort(list); + } + + return list; + } + + public List _getList(Class domainClass, ProjectionList projectionsList, List restrictionsList, + List orderByList) { + return _getList(domainClass, projectionsList, restrictionsList, orderByList, null); + } + + public List _getList(Class domainClass, ProjectionList projectionsList, List restrictionsList, + List orderByList, HashMap fetchModeMap) { + + Session session = getSessionFactory().getCurrentSession(); + + Criteria criteria = session.createCriteria(domainClass); + + if (projectionsList != null) { + criteria.setProjection(projectionsList); + } + + if (restrictionsList != null && !restrictionsList.isEmpty()) { + for (Criterion criterion : restrictionsList) + criteria.add(criterion); + } + + if (orderByList != null && !orderByList.isEmpty()) { + for (Order order : orderByList) + criteria.addOrder(order); + } + + if (fetchModeMap != null) { + Iterator itr = fetchModeMap.keySet().iterator(); + String key = null; + while (itr.hasNext()) { + key = itr.next(); + criteria.setFetchMode(key, fetchModeMap.get(key)); + } + + } + return criteria.list(); + } + + @SuppressWarnings("rawtypes") + public DomainVo _get(Class domainClass, Serializable id) { + DomainVo vo = null; + + Session session = getSessionFactory().getCurrentSession(); + + logger.info(EELFLoggerDelegate.debugLogger, "Getting " + domainClass.getName() + " record for id - " + id.toString()); + + + vo = (DomainVo) session.get(domainClass, id); + + if (vo == null) { + try { + vo = (DomainVo) domainClass.newInstance(); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Failed while instantiating a class of " + domainClass.getName() + e.getMessage()); + + } + } + + return vo; + } + + @SuppressWarnings("rawtypes") + public List _getLookupList(String dbTable, String dbValueCol, String dbLabelCol, String dbFilter, String dbOrderBy, + HashMap additionalParams) { + logger.info(EELFLoggerDelegate.debugLogger, "Retrieving " + dbTable + " lookup list..."); + + List list = null; + String dbOrderByCol = dbOrderBy; + + Session session = getSessionFactory().getCurrentSession(); + + // default the orderBy if null; + if (Utilities.nvl(dbOrderBy).length() == 0) { + dbOrderByCol = dbLabelCol; + dbOrderBy = dbLabelCol; + } else { + if (dbOrderBy.lastIndexOf(" ") > -1) { + dbOrderByCol = dbOrderBy.substring(0, dbOrderBy.lastIndexOf(" ")); + } + } + + StringBuffer sql = new StringBuffer(); + + sql.append("select distinct ").append(dbLabelCol).append(" as lab, ").append(dbValueCol).append(" as val, ") + .append(dbOrderByCol).append(" as sortOrder ").append("from ").append(dbTable).append(" ") + .append((Utilities.nvl(dbFilter).length() == 0) ? "" : (" where " + dbFilter)).append(" order by ") + .append(dbOrderBy); + + try { + list = session.createSQLQuery(sql.toString()).addEntity(Lookup.class).list(); + } catch (Exception e) { + list = null; + logger.info(EELFLoggerDelegate.debugLogger, "The results for the lookup list query [" + sql + "] were empty."); + } + + return list; + } // getLookupList + + /* This method is used to execute SQL queries */ + @SuppressWarnings("rawtypes") + protected final List _executeSQLQuery(String sql, Class domainClass) { + return _executeSQLQuery(sql, domainClass, null, null); + } + + /* This method is used to execute SQL queries with paging */ + @SuppressWarnings("rawtypes") + protected final List _executeSQLQuery(String sql, Class domainClass, Integer fromIndex, Integer toIndex) { + Session session = getSessionFactory().getCurrentSession(); + + SQLQuery query = session.createSQLQuery(sql).addEntity(domainClass.getName().toLowerCase(), domainClass); + + if (fromIndex != null && toIndex != null) { + query.setFirstResult(fromIndex.intValue()); + int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1; + query.setMaxResults(pageSize); + } + + return query.list(); + } + + /* This method is used to execute HQL queries */ + @SuppressWarnings("rawtypes") + protected final List _executeQuery(String sql) { + return _executeQuery(sql, null, null); + } + + /* This method is used to execute HQL queries with paging */ + @SuppressWarnings("rawtypes") + protected final List _executeQuery(String sql, Integer fromIndex, Integer toIndex) { + Session session = getSessionFactory().getCurrentSession(); + + Query query = session.createQuery(sql); + + if (fromIndex != null && toIndex != null) { + query.setFirstResult(fromIndex.intValue()); + int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1; + query.setMaxResults(pageSize); + } + + return query.list(); + } + + /* + * This method can be used to execute both HQL or SQL named queries. The + * distinction will come in the hbm.xml mapping file defining the named + * query. Named HQL queries use the tag while named SQL queries use + * the tag. + */ + @SuppressWarnings("rawtypes") + protected final List _executeNamedQuery(String queryName, Map params) { + return _executeNamedQuery(queryName, params, null, null); + } + + /* + * This method can be used to execute both HQL or SQL named queries with + * paging. The distinction will come in the hbm.xml mapping file defining + * the named query. Named HQL queries use the tag while named SQL + * queries use the tag. + */ + @SuppressWarnings("rawtypes") + protected final List _executeNamedQuery(String queryName, Map params, Integer fromIndex, Integer toIndex) { + Session session = getSessionFactory().getCurrentSession(); + Query query = session.getNamedQuery(queryName); + bindQueryParameters(query, params); + if (fromIndex != null && toIndex != null) { + query.setFirstResult(fromIndex.intValue()); + int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1; + query.setMaxResults(pageSize); + } + return query.list(); + } + + // RAPTOR ZK + /* + * This method can be used to execute both HQL or SQL named queries with + * paging. The distinction will come in the hbm.xml mapping file defining + * the named query. Named HQL queries use the tag while named SQL + * queries use the tag. + */ + @SuppressWarnings("rawtypes") + protected final List _executeNamedCountQuery(Class entity, String queryName, String whereClause, Map params) { + Session session = getSessionFactory().getCurrentSession(); + Query query = session.getNamedQuery(queryName); + String queryStr = query.getQueryString(); + StringBuffer modifiedSql = new StringBuffer(" select count(*) as countRows from (" + queryStr + " ) al "); + if (whereClause != null && whereClause.length() > 0) + modifiedSql.append("where " + whereClause); + // SQLQuery sqlQuery = session.createSQLQuery(" select count(*) as + // {reportSearch.countRows} from ("+ modifiedSql.toString()+")"); + SQLQuery sqlQuery = session.createSQLQuery(modifiedSql.toString()); + bindQueryParameters(sqlQuery, params); + sqlQuery.addScalar("countRows", LongType.INSTANCE); + // sqlQuery.addEntity("reportSearch", entity); + // sqlQuery.setResultTransformer(new + // AliasToBeanResultTransformer(SearchCount.class)); + return sqlQuery.list(); + + } + + /* + * This method can be used to execute both HQL or SQL named queries with + * paging. The distinction will come in the hbm.xml mapping file defining + * the named query. Named HQL queries use the tag while named SQL + * queries use the tag. It is modified to test ZK filter. + */ + @SuppressWarnings("rawtypes") + protected final List _executeNamedQuery(Class entity, String queryName, String whereClause, Map params, + Integer fromIndex, Integer toIndex) { + Session session = getSessionFactory().getCurrentSession(); + Query query = session.getNamedQuery(queryName); + bindQueryParameters(query, params); + String queryStr = query.getQueryString(); + StringBuffer modifiedSql = new StringBuffer(" select * from (" + queryStr + " ) al "); + if (whereClause != null && whereClause.length() > 0) + modifiedSql.append("where " + whereClause); + + SQLQuery sqlQuery = session.createSQLQuery(modifiedSql.toString()); + bindQueryParameters(sqlQuery, params); + sqlQuery.addEntity("reportSearch", entity); + + if (fromIndex != null && toIndex != null) { + sqlQuery.setFirstResult(fromIndex.intValue()); + int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1; + sqlQuery.setMaxResults(pageSize); + } + return sqlQuery.list(); + } + + /* + * This method can be used to execute both HQL or SQL named queries with + * paging. The distinction will come in the hbm.xml mapping file defining + * the named query. Named HQL queries use the tag while named SQL + * queries use the tag. + */ + @SuppressWarnings("rawtypes") + protected final List _executeNamedQueryWithOrderBy(Class entity, String queryName, Map params, String _orderBy, + boolean asc, Integer fromIndex, Integer toIndex) { + Session session = getSessionFactory().getCurrentSession(); + Query query = session.getNamedQuery(queryName); + bindQueryParameters(query, params); + String queryStr = query.getQueryString(); + queryStr = String.format(queryStr, _orderBy, asc ? "ASC" : "DESC"); + SQLQuery sqlQuery = session.createSQLQuery(queryStr); + bindQueryParameters(sqlQuery, params); + sqlQuery.addEntity("reportSearch", entity); + if (fromIndex != null && toIndex != null) { + sqlQuery.setFirstResult(fromIndex.intValue()); + int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1; + sqlQuery.setMaxResults(pageSize); + } + return sqlQuery.list(); + } + + // Where Clause + @SuppressWarnings("rawtypes") + protected final List _executeNamedQueryWithOrderBy(Class entity, String queryName, String whereClause, Map params, + String _orderBy, boolean asc, Integer fromIndex, Integer toIndex) { + Session session = getSessionFactory().getCurrentSession(); + Query query = session.getNamedQuery(queryName); + bindQueryParameters(query, params); + String queryStr = query.getQueryString(); + queryStr = String.format(queryStr, _orderBy, asc ? "ASC" : "DESC"); + // StringBuffer modifiedSql = new StringBuffer(queryStr ); + StringBuffer modifiedSql = new StringBuffer(" select * from (" + queryStr + " ) al "); + // modifiedSql.insert(queryStr.lastIndexOf("order by"), " " + + // whereClause + " "); + if (whereClause != null && whereClause.length() > 0) + modifiedSql.append("where " + whereClause); + SQLQuery sqlQuery = session.createSQLQuery(modifiedSql.toString()); + bindQueryParameters(sqlQuery, params); + sqlQuery.addEntity("reportSearch", entity); + if (fromIndex != null && toIndex != null) { + sqlQuery.setFirstResult(fromIndex.intValue()); + int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1; + sqlQuery.setMaxResults(pageSize); + } + return sqlQuery.list(); + } + + // RAPTOR ZK END + + /* Processes custom Insert/Update/Delete SQL statements */ + protected final int _executeUpdateQuery(String sql) throws Exception { + Session session = getSessionFactory().getCurrentSession(); + Query query = session.createSQLQuery(sql); + return query.executeUpdate(); + } + + /* Processes Insert/Update/Delete Named SQL statements */ + @SuppressWarnings("rawtypes") + protected final int _executeNamedUpdateQuery(String queryName, Map params) throws Exception { + Session session = getSessionFactory().getCurrentSession(); + Query query = session.getNamedQuery(queryName); + bindQueryParameters(query, params); + return query.executeUpdate(); + } + + protected final void _update(DomainVo vo, Integer userId) { + _update(vo, ((userId != null) ? userId.intValue() : 0)); + } + + protected final void _update(DomainVo vo, int userId) { + Date timestamp = new Date(); + + Session session = getSessionFactory().getCurrentSession(); + + if (vo.getId() == null || vo.getId().intValue() == 0) { // add new + vo.setCreated(timestamp); + vo.setModified(timestamp); + + if (userId != 0 + && userId != Integer.parseInt(SystemProperties.getProperty(SystemProperties.APPLICATION_USER_ID))) { + vo.setCreatedId(new Long(userId)); + vo.setModifiedId(new Long(userId)); + } + } else { // update existing + vo.setModified(timestamp); + + if (userId != 0 + && userId != Integer.parseInt(SystemProperties.getProperty(SystemProperties.APPLICATION_USER_ID))) { + vo.setModifiedId(new Long(userId)); + } + } + + session.saveOrUpdate(vo); + } + + protected final void _remove(DomainVo vo) { + Session session = getSessionFactory().getCurrentSession(); + session.delete(vo); + } + + @SuppressWarnings("rawtypes") + protected final int _remove(Class domainClass, String whereClause) { + int rowsAffected = 0; + + Session session = getSessionFactory().getCurrentSession(); + + StringBuffer sql = new StringBuffer("delete from "); + + sql.append(domainClass.getName()).append(" where ").append(whereClause); + + rowsAffected = session.createQuery(sql.toString()).executeUpdate(); + + return rowsAffected; + } + + protected final void _flush() { + Session session = getSessionFactory().getCurrentSession(); + session.flush(); + } + + @SuppressWarnings("rawtypes") + private void bindQueryParameters(Query query, Map params) { + if (params != null) { + for (Iterator i = params.entrySet().iterator(); i.hasNext();) { + Map.Entry entry = (Map.Entry) i.next(); + + Object parameterValue = entry.getValue(); + + if (!(parameterValue instanceof Collection) && !(parameterValue instanceof Object[])) { + query.setParameter((String) entry.getKey(), parameterValue); + } else { + if (parameterValue instanceof Collection) { + query.setParameterList((String) entry.getKey(), (Collection) parameterValue); + } else { + if (parameterValue instanceof Object[]) { + query.setParameterList((String) entry.getKey(), (Object[]) parameterValue); + } + } + } + } + } + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/support/FusionDao.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/support/FusionDao.java new file mode 100644 index 0000000..75b3c80 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/dao/support/FusionDao.java @@ -0,0 +1,35 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.dao.support; + +import org.hibernate.SessionFactory; +import org.openecomp.portalsdk.core.FusionObject; + +public class FusionDao implements FusionObject { + private SessionFactory sessionFactory; + + public void setSessionFactory(SessionFactory sessionFactory) { + this.sessionFactory = sessionFactory; + } + + public SessionFactory getSessionFactory() { + return this.sessionFactory; + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/App.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/App.java new file mode 100644 index 0000000..6e8e6c8 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/App.java @@ -0,0 +1,206 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain; + +import org.openecomp.portalsdk.core.domain.support.DomainVo; + +/** + * Represents a row in the FN_APP table in the EP_SDK database. (A nearly + * identical table is defined in Portal database.) + * + * @version 1.0 + */ +public class App extends DomainVo { + + private static final long serialVersionUID = 3465979916929796990L; + + // superclass defines Id + private String name; // app_name + private String imageUrl; // app_image_url + private String description; // app_description + private String notes; // app_notes + private String url; // app_url + private String alternateUrl; // app_alternate_url + private String restEndpoint; // app_rest_endpoint + private String mlAppName; // ml_app_name + private String mlAppAdminId; // ml_app_admin_id; + private String motsId; // mots_id + private String appPassword; // app_password + private String open; + private String enabled; + private byte[] thumbnail; + private String username; // app_username + private String uebKey; // ueb_key + private String uebSecret; // ueb_secret + private String uebTopicName; // ueb_topic_name + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAppPassword() { + return appPassword; + } + + public void setAppPassword(String appPassword) { + this.appPassword = appPassword; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getAlternateUrl() { + return alternateUrl; + } + + public void setAlternateUrl(String alternateUrl) { + this.alternateUrl = alternateUrl; + } + + public String getRestEndpoint() { + return restEndpoint; + } + + public void setRestEndpoint(String restEndpoint) { + this.restEndpoint = restEndpoint; + } + + public String getMlAppName() { + return mlAppName; + } + + public void setMlAppName(String mlAppName) { + this.mlAppName = mlAppName; + } + + public String getMlAppAdminId() { + return mlAppAdminId; + } + + public void setMlAppAdminId(String mlAppAdminId) { + this.mlAppAdminId = mlAppAdminId; + } + + public String getMotsId() { + return motsId; + } + + public void setMotsId(String motsId) { + this.motsId = motsId; + } + + public String getOpen() { + return open; + } + + public void setOpen(String open) { + this.open = open; + } + + public String getEnabled() { + return enabled; + } + + public void setEnabled(String enabled) { + this.enabled = enabled; + } + + public byte[] getThumbnail() { + return this.thumbnail; + } + + public void setThumbnail(byte[] thumbnail) { + this.thumbnail = thumbnail; + } + + public String getUebKey() { + return uebKey; + } + + public void setUebKey(String uebKey) { + this.uebKey = uebKey; + } + + public String getUebSecret() { + return uebSecret; + } + + public void setUebSecret(String uebSecret) { + this.uebSecret = uebSecret; + } + + public String getUebTopicName() { + return uebTopicName; + } + + public void setUebTopicName(String uebTopicName) { + this.uebTopicName = uebTopicName; + } + + /** + * Answers true if the objects have the same ID. + */ + public int compareTo(Object obj) { + Long c1 = getId(); + Long c2 = ((App) obj).getId(); + return c1.compareTo(c2); + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/AuditLog.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/AuditLog.java new file mode 100644 index 0000000..f861232 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/AuditLog.java @@ -0,0 +1,79 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain; + +import java.util.Date; + +import org.openecomp.portalsdk.core.domain.support.DomainVo; +public class AuditLog extends DomainVo { + + /** + * + */ + private static final long serialVersionUID = 1L; + public static final String CD_ACTIVITY_LOGIN = "login"; + public static final String CD_ACTIVITY_LOGOUT = "logout"; + public static final String CD_ACTIVITY_MOBILE_LOGIN = "mobile_login"; + public static final String CD_ACTIVITY_MOBILE_LOGOUT = "mobile_logout"; + + /*-------Profile activities -----------*/ + public static final String CD_ACTIVITY_ROLE_ADD = "add_role"; + public static final String CD_ACTIVITY_ROLE_REMOVE = "remove_role"; + public static final String CD_ACTIVITY_CHILD_ROLE_ADD = "add_child_role"; + public static final String CD_ACTIVITY_CHILD_ROLE_REMOVE = "remove_child_role"; + public static final String CD_ACTIVITY_ROLE_ADD_FUNCTION = "add_role_function"; + public static final String CD_ACTIVITY_ROLE_REMOVE_FUNCTION = "remove_role_function"; + public static final String CD_ACTIVITY_USER_ROLE_ADD = "add_user_role"; + public static final String CD_ACTIVITY_USER_ROLE_REMOVE = "remove_user_role"; + + + private String activityCode; + private String affectedRecordId; + private String comments; + + public AuditLog() { + setCreated(new Date()); + } + + public String getActivityCode() { + return activityCode; + } + + public String getComments() { + return comments; + } + + public String getAffectedRecordId() { + return affectedRecordId; + } + + public void setActivityCode(String activityCode) { + this.activityCode = activityCode; + } + + public void setComments(String comments) { + this.comments = comments; + } + + public void setAffectedRecordId(String affectedRecordId) { + this.affectedRecordId = affectedRecordId; + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/BroadcastMessage.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/BroadcastMessage.java new file mode 100644 index 0000000..e005df4 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/BroadcastMessage.java @@ -0,0 +1,123 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain; + +import java.util.Date; + +import org.openecomp.portalsdk.core.domain.support.DomainVo; + +public class BroadcastMessage extends DomainVo{ + /** + * + */ + private static final long serialVersionUID = 1L; + + public BroadcastMessage() { + } + + public static final String ID_MESSAGE_LOCATION_LOGIN = "10"; + public static final String ID_MESSAGE_LOCATION_WELCOME = "20"; + + private String messageText; + private Integer locationId; + private Date startDate; + private Date endDate; + private Integer sortOrder; + private Boolean active; + private String siteCd; + + public Boolean getActive() { + return active; + } + + public Date getEndDate() { + return endDate; + } + + public Integer getLocationId() { + return locationId; + } + + public String getMessageText() { + return messageText; + } + + public Integer getSortOrder() { + return sortOrder; + } + + public Date getStartDate() { + return startDate; + } + + public String getSiteCd() { + return siteCd; + } + + + public void setActive(Boolean active) { + this.active = active; + } + + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + public void setLocationId(Integer locationId) { + this.locationId = locationId; + } + + public void setMessageText(String messageText) { + this.messageText = messageText; + } + + public void setSortOrder(Integer sortOrder) { + this.sortOrder = sortOrder; + } + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + public void setSiteCd(String siteCd) { + this.siteCd = siteCd; + } + + + public int compareTo(Object obj){ + Integer c1 = getLocationId(); + Integer c2 = ((BroadcastMessage)obj).getLocationId(); + + if (c1.compareTo(c2) == 0) { + c1 = getSortOrder(); + c2 = ((BroadcastMessage)obj).getSortOrder(); + + if (c1.compareTo(c2) == 0) { + Long c3 = getId(); + Long c4 = ((BroadcastMessage)obj).getId(); + + return c3.compareTo(c4); + } + } + + return c1.compareTo(c2); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/DomainVo.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/DomainVo.java new file mode 100644 index 0000000..9d17399 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/DomainVo.java @@ -0,0 +1,177 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; + +/* Super class from which all data objects descend + * + * Per Sunder T on 3 June 2016: + * + * Yes, we need to get rid of domain.DomainVO and fold all the references to the support.DomainVO. + */ +@SuppressWarnings("rawtypes") +@Deprecated +public class DomainVo extends FusionVo implements Serializable, Cloneable, Comparable { + + /** + * + */ + private static final long serialVersionUID = 1L; + protected Long id; + protected Date created; + protected Date modified; + protected Long createdId; + protected Long modifiedId; + protected Long rowNum; + + protected Serializable auditUserId; + + Set auditTrail = null; + + public DomainVo() { + } + + public void setId(Long i) { + id = i; + } + + public void setCreated(Date created) { + this.created = created; + } + + public void setModified(Date modified) { + this.modified = modified; + } + + public void setCreatedId(Long createdId) { + this.createdId = createdId; + } + + public void setModifiedId(Long modifiedId) { + this.modifiedId = modifiedId; + } + + public void setAuditUserId(Serializable auditUserId) { + this.auditUserId = auditUserId; + } + + public void setRowNum(Long rowNum) { + this.rowNum = rowNum; + } + + public void setAuditTrail(Set auditTrail) { + this.auditTrail = auditTrail; + } + + public Long getId() { + return id; + } + + public Date getCreated() { + return created; + } + + public Date getModified() { + return modified; + } + + public Long getCreatedId() { + return createdId; + } + + public Long getModifiedId() { + return modifiedId; + } + + public Serializable getAuditUserId() { + return auditUserId; + } + + public Long getRowNum() { + return rowNum; + } + + public Set getAuditTrail() { + return auditTrail; + } + + @SuppressWarnings("unchecked") + public void addAuditTrailLog(AuditLog auditLog) { + if (getAuditTrail() == null) { + setAuditTrail(new HashSet()); + } + + getAuditTrail().add(auditLog); + } + + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + public Object copy() { + return copy(false); + } + + public Object copy(boolean isIdNull) { + // let's create a "copy" of the object using serialization + ByteArrayOutputStream baos = null; + ByteArrayInputStream bais = null; + ObjectOutputStream oos = null; + ObjectInputStream ois = null; + + DomainVo newVo = null; + + try { + + baos = new ByteArrayOutputStream(); + oos = new ObjectOutputStream(baos); + oos.writeObject(this); + + bais = new ByteArrayInputStream(baos.toByteArray()); + ois = new ObjectInputStream(bais); + newVo = (DomainVo) ois.readObject(); + + if (isIdNull) { + newVo.setId(null); + } + + } catch (Exception e) { + e.printStackTrace(); + } + + return newVo; + } + + public int compareTo(Object obj) { + Long c1 = getId(); + Long c2 = ((DomainVo) obj).getId(); + + return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/FnMenu.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/FnMenu.java new file mode 100644 index 0000000..e2c1f46 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/FnMenu.java @@ -0,0 +1,142 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain; + + +import org.openecomp.portalsdk.core.domain.support.DomainVo; + +/** + *

RoleFunction.java

+ * + *

Represents a role function data object.

+ * + * @version 1.0 + */ +public class FnMenu extends DomainVo { + /** + * + */ + private static final long serialVersionUID = 1L; + + public FnMenu() {} + + private Integer menuId; + private String label; + private Integer parentId; + private String action; + private String functionCd; + private Integer sortOrder; + private String servlet; + private String queryString; + private String externalUrl; + private String target; + private String active; + private String separator; + private String imageSrc; + private String menuSetCode; + + public Integer getMenuId() { + return menuId; + } + public void setMenuId(Integer menuId) { + this.menuId = menuId; + } + public String getLabel() { + return label; + } + public void setLabel(String label) { + this.label = label; + } + public Integer getParentId() { + return parentId; + } + public void setParentId(Integer parentId) { + this.parentId = parentId; + } + public String getAction() { + return action; + } + public void setAction(String action) { + this.action = action; + } + public String getFunctionCd() { + return functionCd; + } + public void setFunctionCd(String functionCd) { + this.functionCd = functionCd; + } + public Integer getSortOrder() { + return sortOrder; + } + public void setSortOrder(Integer sortOrder) { + this.sortOrder = sortOrder; + } + public String getServlet() { + return servlet; + } + public void setServlet(String servlet) { + this.servlet = servlet; + } + public String getQueryString() { + return queryString; + } + public void setQueryString(String queryString) { + this.queryString = queryString; + } + public String getExternalUrl() { + return externalUrl; + } + public void setExternalUrl(String externalUrl) { + this.externalUrl = externalUrl; + } + public String getTarget() { + return target; + } + public void setTarget(String target) { + this.target = target; + } + public String getActive() { + return active; + } + public void setActive(String active) { + this.active = active; + } + public String getSeparator() { + return separator; + } + public void setSeparator(String separator) { + this.separator = separator; + } + public String getImageSrc() { + return imageSrc; + } + public void setImageSrc(String imageSrc) { + this.imageSrc = imageSrc; + } + public String getMenuSetCode() { + return menuSetCode; + } + public void setMenuSetCode(String menuSetCode) { + this.menuSetCode = menuSetCode; + } + + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/FusionVo.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/FusionVo.java new file mode 100644 index 0000000..dc1b8d4 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/FusionVo.java @@ -0,0 +1,27 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain; + +import org.openecomp.portalsdk.core.FusionObject; + +public class FusionVo implements FusionObject { + public FusionVo() { + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LoginBean.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LoginBean.java new file mode 100644 index 0000000..52c6d00 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/LoginBean.java @@ -0,0 +1,187 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain; + +import java.util.Set; + +import org.openecomp.portalsdk.core.domain.support.FusionCommand; + +@SuppressWarnings("rawtypes") +public class LoginBean extends FusionCommand { + + private String loginId; + private String loginPwd; + private String hrid; + private String orgUserId; + private String siteAccess; + private String loginErrorMessage; + + private User user; + private Set menu; + private Set businessDirectMenu; + + /** + * getLoginId + * + * @return String + */ + public String getLoginId() { + return loginId; + } + + /** + * getLoginPwd + * + * @return String + */ + public String getLoginPwd() { + return loginPwd; + } + + /** + * getMenu + * + * @return Set + */ + public Set getMenu() { + return menu; + } + + /** + * getUser + * + * @return User + */ + public User getUser() { + return user; + } + + /** + * getHrid + * + * @return String + */ + public String getHrid() { + return hrid; + } + + /** + * getSiteAccess + * + * @return String + */ + public String getSiteAccess() { + return siteAccess; + } + + /** + * getBusinessDirectMenu + * + * @return Set + */ + public Set getBusinessDirectMenu() { + return businessDirectMenu; + } + + /** + * getLoginErrorMessage + * + * @return String + */ + public String getLoginErrorMessage() { + return loginErrorMessage; + } + + public String getOrgUserId() { + return orgUserId; + } + + /** + * setLoginId + * + * @param loginId String + */ + public void setLoginId(String loginId) { + this.loginId = loginId; + } + + /** + * setLoginPwd + * + * @param loginPwd String + */ + public void setLoginPwd(String loginPwd) { + this.loginPwd = loginPwd; + } + + public void setMenu(Set menu) { + this.menu = menu; + } + + /** + * setUser + * + * @param user User + */ + public void setUser(User user) { + this.user = user; + } + + /** + * setHrid + * + * @param hrid String + */ + public void setHrid(String hrid) { + this.hrid = hrid; + } + + /** + * setSiteAccess + * + * @param siteAccess String + */ + public void setSiteAccess(String siteAccess) { + this.siteAccess = siteAccess; + } + + /** + * setBusinessDirectMenu + * + * @param businessDirectMenu Set + */ + public void setBusinessDirectMenu(Set businessDirectMenu) { + this.businessDirectMenu = businessDirectMenu; + } + + /** + * setLoginErrorMessage + * + * @param loginErrorMessage String + */ + public void setLoginErrorMessage(String loginErrorMessage) { + this.loginErrorMessage = loginErrorMessage; + } + + public void setOrgUserId(String orgUserId) { + this.orgUserId = orgUserId; + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Lookup.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Lookup.java new file mode 100644 index 0000000..a71bdfc --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/Lookup.java @@ -0,0 +1,85 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain; + +import java.io.Serializable; + +import org.openecomp.portalsdk.core.domain.support.NameValueId; + +public class Lookup extends FusionVo implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + private NameValueId nameValueId = new NameValueId(); + + public Lookup() {} + + public Lookup(String label, String value) { + this(); + setLabel(label); + setValue(value); + } + + public String getValue() { + return getNameValueId().getVal(); + } + + public String getLabel() { + return getNameValueId().getLab(); + } + + public void setValue(String value) { + getNameValueId().setVal(value); + } + + public void setLabel(String label) { + getNameValueId().setLab(label); + } + + public NameValueId getNameValueId() { + return nameValueId; + } + + public void setNameValueId(NameValueId nameValueId) { + this.nameValueId = nameValueId; + } + + // required by ZK for to set the selectedItems of Listboxes (used heavily for -style drop-downs) + public int hashCode() { + int hash = getUrl().hashCode(); + hash = hash + getFunctionCd().hashCode(); + + return hash; + } + + public boolean equals( Object obj ) { + boolean equivalent = false; + + UrlsAccessible lookup = (UrlsAccessible)obj; + if( lookup.getUrl().equals(getUrl()) && lookup.getFunctionCd().equals(getFunctionCd())) { + equivalent = true; + } + + return equivalent; + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UrlsAccessibleKey.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UrlsAccessibleKey.java new file mode 100644 index 0000000..f1cec49 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UrlsAccessibleKey.java @@ -0,0 +1,90 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain; + +import java.io.Serializable; + + +public class UrlsAccessibleKey implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + private String url; + private String functionCd; + + public UrlsAccessibleKey() { + } + + public UrlsAccessibleKey(String url, String functionCd) { + setUrl(url); + setFunctionCd(functionCd); + } + + + public String getUrl() { + return url; + } + + + public String getFunctionCd() { + return functionCd; + } + + + public void setUrl(String url) { + this.url = url; + } + + + public void setFunctionCd(String functionCd) { + this.functionCd = functionCd; + } + + + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (o == null) { + return false; + } + + if (!(o instanceof UrlsAccessibleKey)) { + return false; + } + + final UrlsAccessibleKey key = (UrlsAccessibleKey)o; + + if (getFunctionCd().equals(key.getFunctionCd()) & getUrl().equals(key.getUrl())) { + return true; + } + + return false; + } + + + public int hashCode() { + return getUrl().hashCode() + getFunctionCd().hashCode(); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/User.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/User.java new file mode 100644 index 0000000..e6c4a17 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/User.java @@ -0,0 +1,585 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain; + + +import java.util.Date; +import java.util.Iterator; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.openecomp.portalsdk.core.domain.support.DomainVo; + +/** + *

User.java

+ * + *

Represents a user data object.

+ * + * @version 1.0 + */ +@SuppressWarnings("rawtypes") +public class User extends DomainVo { + + /** + * + */ + private static final long serialVersionUID = 1L; + private Long orgId; + private Long managerId; + private String firstName; + private String middleInitial; + private String lastName; + private String phone; + private String fax; + private String cellular; + private String email; + private Long addressId; + private String alertMethodCd; + private String hrid; + private String orgUserId; + private String orgCode; + private String address1; + private String address2; + private String city; + private String state; + private String zipCode; + private String country; + private String orgManagerUserId; + private String locationClli; + private String businessCountryCode; + private String businessCountryName; + private String businessUnit; + private String businessUnitName; + private String department; + private String departmentName; + private String companyCode; + private String company; + private String zipCodeSuffix; + private String jobTitle; + private String commandChain; + private String siloStatus; + private String costCenter; + private String financialLocCode; + + + + private String loginId; + private String loginPwd; + private Date lastLoginDate; + private boolean active; + private boolean internal; + private Long selectedProfileId; + private Long timeZoneId; + private boolean online; + private String chatId; + + private Set userApps = new TreeSet(); + + private Set pseudoRoles = new TreeSet(); + + + public User() {} + + public Long getAddressId() { + return addressId; + } + + public String getAlertMethodCd() { + return alertMethodCd; + } + + public String getCellular() { + return cellular; + } + + public String getEmail() { + return email; + } + + public String getFax() { + return fax; + } + + public String getFirstName() { + return firstName; + } + + public String getHrid() { + return hrid; + } + + public Date getLastLoginDate() { + return lastLoginDate; + } + + public String getLastName() { + return lastName; + } + + public String getFullName() { + return getFirstName() + " " + getLastName(); + } + + public String getLoginId() { + return loginId; + } + + public String getLoginPwd() { + return loginPwd; + } + + public Long getManagerId() { + return managerId; + } + + public String getMiddleInitial() { + return middleInitial; + } + + public String getOrgCode() { + return orgCode; + } + + public Long getOrgId() { + return orgId; + } + + public String getPhone() { + return phone; + } + + public String getOrgUserId() { + return orgUserId; + } + + public boolean getActive() { + return active; + } + + public boolean getInternal() { + return internal; + } + + public String getAddress1() { + return address1; + } + + public String getAddress2() { + return address2; + } + + public String getCity() { + return city; + } + + public String getCountry() { + return country; + } + + public String getState() { + return state; + } + + public String getZipCode() { + return zipCode; + } + + public String getBusinessCountryCode() { + return businessCountryCode; + } + + public String getCommandChain() { + return commandChain; + } + + public String getCompany() { + return company; + } + + public String getCompanyCode() { + return companyCode; + } + + public String getDepartment() { + return department; + } + + public String getJobTitle() { + return jobTitle; + } + + public String getLocationClli() { + return locationClli; + } + + public String getOrgManagerUserId() { + return orgManagerUserId; + } + + public String getZipCodeSuffix() { + return zipCodeSuffix; + } + + public String getBusinessCountryName() { + return businessCountryName; + } + + public Set getPseudoRoles() { + return pseudoRoles; + } + + public Long getSelectedProfileId() { + return selectedProfileId; + } + + public void setAddressId(Long addressId) { + this.addressId = addressId; + } + + public void setAlertMethodCd(String alertMethodCd) { + this.alertMethodCd = alertMethodCd; + } + + public void setCellular(String cellular) { + this.cellular = cellular; + } + + public void setEmail(String email) { + this.email = email; + } + + public void setFax(String fax) { + this.fax = fax; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public void setHrid(String hrid) { + this.hrid = hrid; + } + + public void setLastLoginDate(Date lastLoginDate) { + this.lastLoginDate = lastLoginDate; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public void setLoginId(String loginId) { + this.loginId = loginId; + } + + public void setLoginPwd(String loginPwd) { + this.loginPwd = loginPwd; + } + + public void setManagerId(Long managerId) { + this.managerId = managerId; + } + + public void setMiddleInitial(String middleInitial) { + this.middleInitial = middleInitial; + } + + public void setOrgCode(String orgCode) { + this.orgCode = orgCode; + } + + public void setOrgId(Long orgId) { + this.orgId = orgId; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public void setOrgUserId(String orgUserId) { + this.orgUserId = orgUserId; + } + + public void setActive(boolean active) { + this.active = active; + } + + public void setInternal(boolean internal) { + this.internal = internal; + } + + public void setAddress1(String address1) { + this.address1 = address1; + } + + public void setAddress2(String address2) { + this.address2 = address2; + } + + public void setCity(String city) { + this.city = city; + } + + public void setCountry(String country) { + this.country = country; + } + + public void setState(String state) { + this.state = state; + } + + public void setZipCode(String zipCode) { + this.zipCode = zipCode; + } + + public void setBusinessCountryCode(String businessCountryCode) { + this.businessCountryCode = businessCountryCode; + } + + public void setCommandChain(String commandChain) { + this.commandChain = commandChain; + } + + public void setCompany(String company) { + this.company = company; + } + + public void setCompanyCode(String companyCode) { + this.companyCode = companyCode; + } + + public void setDepartment(String department) { + this.department = department; + } + + public void setJobTitle(String jobTitle) { + this.jobTitle = jobTitle; + } + + public void setLocationClli(String locationClli) { + this.locationClli = locationClli; + } + + public void setOrgManagerUserId(String orgManagerUserId) { + this.orgManagerUserId = orgManagerUserId; + } + + public void setZipCodeSuffix(String zipCodeSuffix) { + this.zipCodeSuffix = zipCodeSuffix; + } + + public void setBusinessCountryName(String businessCountryName) { + this.businessCountryName = businessCountryName; + } + + public void setPseudoRoles(Set pseudoRoles) { + this.pseudoRoles = pseudoRoles; + } + + public void setSelectedProfileId(Long selectedProfileId) { + this.selectedProfileId = selectedProfileId; + } + + public Long getTimeZoneId() { + return timeZoneId; + } + + public void setTimeZoneId(Long timeZoneId) { + this.timeZoneId = timeZoneId; + } + + public String getBusinessUnit() { + return businessUnit; + } + + public void setBusinessUnit(String businessUnit) { + this.businessUnit = businessUnit; + } + + public String getSiloStatus() { + return siloStatus; + } + + public void setSiloStatus(String siloStatus) { + this.siloStatus = siloStatus; + } + + public String getCostCenter() { + return costCenter; + } + + public void setCostCenter(String costCenter) { + this.costCenter = costCenter; + } + + public String getFinancialLocCode() { + return financialLocCode; + } + + public void setFinancialLocCode(String financialLocCode) { + this.financialLocCode = financialLocCode; + } + + public String getBusinessUnitName() { + return businessUnitName; + } + + public void setBusinessUnitName(String businessUnitName) { + this.businessUnitName = businessUnitName; + } + + public String getDepartmentName() { + return departmentName; + } + + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + public int compareTo(Object obj){ + User user = (User)obj; + + String c1 = getLastName() + getFirstName() + getMiddleInitial(); + String c2 = user.getLastName() + user.getFirstName() + user.getMiddleInitial(); + + return c1.compareTo(c2); + } + + public boolean isOnline() { + return online; + } + + public void setOnline(boolean online) { + this.online = online; + } + + public String getChatId() { + return chatId; + } + + public void setChatId(String chatId) { + this.chatId = chatId; + } + + public Set getUserApps() { + return userApps; + } + + public void setUserApps(Set userApps) { + this.userApps = userApps; + } + + @SuppressWarnings("unchecked") + public void addAppRoles(App app, SortedSet roles) { + if(roles!=null){ + //add all + Set userApps = new TreeSet(); + Iterator itr = roles.iterator(); + while(itr.hasNext()){ + Role role = (Role) itr.next(); + UserApp userApp = new UserApp(); + userApp.setUserId(this.id); + userApp.setApp(app); + userApp.setRole(role); + userApps.add(userApp); + } + setUserApps(userApps); + } else { + //remove all + this.userApps.clear(); + } + + + } + + @SuppressWarnings("unchecked") + public SortedSet getAppRoles(App app) { + SortedSet roles = new TreeSet(); + Set apps = getUserApps(); + Iterator appsItr = apps.iterator(); + UserApp userApp = null; + //getting default app + while(appsItr.hasNext()){ + UserApp tempUserApp = (UserApp)appsItr.next(); + if(tempUserApp.getApp().getId().equals(app.getId())){ + userApp = tempUserApp; + roles.add(userApp.getRole()); + } + } + return roles; + } + + public SortedSet getRoles() { + App app = new App(); + app.setId(new Long(1)); + app.setName("Default"); + return getAppRoles(app); + } + + public UserApp getDefaultUserApp(){ + Set apps = getUserApps(); + Iterator appsItr = apps.iterator(); + UserApp userApp = null; + //getting default app + while(appsItr.hasNext()){ + UserApp tempApp = (UserApp)appsItr.next(); + if(tempApp.equals(new Long(1))){ + userApp = tempApp; + break; + } + } + return userApp; + } + + public void setRoles(SortedSet roles) { + App app = new App(); + app.setId(new Long(1)); + app.setName("Default"); + addAppRoles(app,roles); + } + + public void removeRole(Long roleId) { + Set apps = getUserApps(); + Iterator appsItr = apps.iterator(); + //getting default app + while(appsItr.hasNext()){ + UserApp tempUserApp = (UserApp)appsItr.next(); + if(tempUserApp.getRole().getId().equals(roleId)){ + appsItr.remove(); + } + } + + } + + @SuppressWarnings("unchecked") + public void addRole(Role role){ + if(role!=null){ + SortedSet roles = getRoles(); + if(roles==null){ + roles = new TreeSet(); + } + roles.add(role); + setRoles(roles); + } + + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UserApp.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UserApp.java new file mode 100644 index 0000000..5c2c383 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UserApp.java @@ -0,0 +1,108 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain; + +// Generated Aug 27, 2014 5:51:36 PM by Hibernate Tools 3.4.0.CR1 + +/** + * FnUserRole generated by hbm2java + */ +@SuppressWarnings("rawtypes") +public class UserApp implements java.io.Serializable, Comparable { + + /** + * + */ + private static final long serialVersionUID = 1L; + private Long userId; + private App app; + private Role role; + private Short priority; + + public UserApp() { + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public App getApp() { + return app; + } + + public void setApp(App app) { + this.app = app; + } + + public Role getRole() { + return role; + } + + public void setRole(Role role) { + this.role = role; + } + + public Short getPriority() { + return this.priority; + } + + public void setPriority(Short priority) { + this.priority = priority; + } + + public boolean equals(Object other) { + if ((this == other)) + return true; + if ((other == null)) + return false; + if (!(other instanceof UserApp)) + return false; + UserApp castOther = (UserApp) other; + + return (this.getUserId().equals(castOther.getUserId())) + && (this.getApp().getId().equals(castOther.getApp().getId())) + && (this.getRole().getId().equals(castOther.getRole().getId())) + && ((this.priority==null && castOther.getPriority()==null) || this.getPriority().equals(castOther.getPriority())); + } + + public int hashCode() { + int result = 17; + + result = 37 * result + (int) (this.getUserId()==null ? 0 : this.getUserId().intValue()); + result = 37 * result + (int) (this.getApp().getId()==null ? 0 : this.getApp().getId().intValue()); + result = 37 * result + (int) (this.getRole().getId()==null ? 0 : this.getRole().getId().intValue()); + result = 37 * result + (int) (this.priority==null ? 0 : this.priority); + return result; + } + + public int compareTo(Object other){ + UserApp castOther = (UserApp) other; + + Long c1 = (this.getUserId()==null ? 0 : this.getUserId()) + (this.getApp()==null||this.getApp().getId()==null ? 0 : this.getApp().getId()) + (this.getRole()==null||this.getRole().getId()==null ? 0 : this.getRole().getId()) + (this.priority==null ? 0 : this.priority); + Long c2 = (castOther.getUserId()==null ? 0 : castOther.getUserId()) + (castOther.getApp()==null||castOther.getApp().getId()==null ? 0 : castOther.getApp().getId()) + (castOther.getRole()==null||castOther.getRole().getId()==null ? 0 : castOther.getRole().getId()) + (castOther.priority==null ? 0 : castOther.priority); + + return c1.compareTo(c2); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UserAppId.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UserAppId.java new file mode 100644 index 0000000..9458b90 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/UserAppId.java @@ -0,0 +1,88 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain; + +// Generated Aug 27, 2014 5:51:36 PM by Hibernate Tools 3.4.0.CR1 + +/** + * FnUserRoleId generated by hbm2java + */ +public class UserAppId implements java.io.Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + private Long userId; + private App app; + private Role role; + + public UserAppId() { + super(); + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public App getApp() { + return app; + } + + public void setApp(App app) { + this.app = app; + } + + public Role getRole() { + return role; + } + + public void setRole(Role role) { + this.role = role; + } + + public boolean equals(Object other) { + if ((this == other)) + return true; + if ((other == null)) + return false; + if (!(other instanceof UserAppId)) + return false; + UserAppId castOther = (UserAppId) other; + + return (this.getUserId() == castOther.getUserId()) + && (this.getApp().getId() == castOther.getApp().getId()) + && (this.getRole().getId() == castOther.getRole().getId()); + } + + public int hashCode() { + int result = 17; + + result = 37 * result + (int) (this.getUserId()==null ? 0 : this.getUserId().intValue()); + result = 37 * result + (int) (this.getApp().getId()==null ? 0 : this.getApp().getId().intValue()); + result = 37 * result + (int) (this.getRole().getId()==null ? 0 : this.getRole().getId().intValue()); + return result; + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/sessionmgt/TimeoutVO.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/sessionmgt/TimeoutVO.java new file mode 100644 index 0000000..57e474c --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/sessionmgt/TimeoutVO.java @@ -0,0 +1,63 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain.sessionmgt; + +public class TimeoutVO implements Comparable{ + + private String jSessionId; + private Long sessionTimOutMilliSec; + + public TimeoutVO(){ + + } + + public TimeoutVO(String _jSessionId, Long _sessionTimOutMilliSec) { + setjSessionId(_jSessionId); + setSessionTimOutMilliSec(_sessionTimOutMilliSec); + + } + + public String getjSessionId() { + return jSessionId; + } + + public void setjSessionId(String jSessionId) { + this.jSessionId = jSessionId; + } + + public Long getSessionTimOutMilliSec() { + return sessionTimOutMilliSec; + } + + public void setSessionTimOutMilliSec(Long sessionTimOutMilliSec) { + this.sessionTimOutMilliSec = sessionTimOutMilliSec; + } + + @Override + public int compareTo(TimeoutVO o) { + return sessionTimOutMilliSec.compareTo(o.sessionTimOutMilliSec); + } + + + + + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Attribute.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Attribute.java new file mode 100644 index 0000000..a78d7bf --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Attribute.java @@ -0,0 +1,62 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain.support; + +public class Attribute { + public double width; + public double top; + public double left; + public String name; + public double height; + + public double getWidth() { + return width; + } + public void setWidth(double width) { + this.width = width; + } + public double getTop() { + return top; + } + public void setTop(double top) { + this.top = top; + } + public double getLeft() { + return left; + } + public void setLeft(double left) { + this.left = left; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public double getHeight() { + return height; + } + public void setHeight(double height) { + this.height = height; + } + + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/CollaborateList.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/CollaborateList.java new file mode 100644 index 0000000..eaeab84 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/CollaborateList.java @@ -0,0 +1,56 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain.support; + +import java.io.Serializable; +import java.util.HashSet; + +public class CollaborateList implements Serializable { + + private static final long serialVersionUID = -4104440747626736243L; + private HashSet userNameList = new HashSet(); + private static CollaborateList userListData = new CollaborateList(); + private CollaborateList(){} + + public static CollaborateList getInstance(){ + return userListData; + } + + public HashSet getAllUserName(){ + return userNameList; + } + + public static void addUserName(String name){ + final HashSet allUserName = CollaborateList.getInstance().getAllUserName(); + if(allUserName.contains(name)){ + //System.out.println("cannot add this user"); + }else{ + allUserName.add(name); + } + } + + public static void delUserName(String name){ + final HashSet allUserName = CollaborateList.getInstance().getAllUserName(); + allUserName.remove((String) name); + } + + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Container.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Container.java new file mode 100644 index 0000000..7d52af4 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Container.java @@ -0,0 +1,331 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain.support; + +import java.util.List; +import java.util.Map; + +public class Container { + + String id; + + public String name; + + Size size; + + Position p; + + public Map containerRowCol; + + public Map elementRowCol; + + int numOfRows; + + int numOfCols; + + double sum = 0; + + double interEleWd; + + double interEleH; + + double interEleToContainerWd; + + double interEleToContainerH; + + double interEleToInnerContainerWd; + + double interEleToInnerContainerH; + + public double top; + + public double left; + + public double height; + + public double width; + + public String visibilityType; + + + + + + public Container(String id, String name, int numOfRows, int numOfCols, double interEleWd, double interEleH, + double interEleToContainerWd, double interEleToContainerH, double interEleToInnerContainerWd, + double interEleToInnerContainerH) { + + this.id = id; + this.name = name; + this.numOfRows = numOfRows; + this.numOfCols = numOfCols; + this.interEleWd = interEleWd; + this.interEleH = interEleH; + this.interEleToContainerWd = interEleToContainerWd; + this.interEleToContainerH = interEleToContainerH; + this.interEleToInnerContainerWd = interEleToInnerContainerWd; + this.interEleToInnerContainerH = interEleToInnerContainerH; + + } + + + public List innerCList; + + public List elementList; + + public Container() { + + } + + + + public Map getContainerRowCol() { + return containerRowCol; + } + + + + + public Map getElementRowCol() { + return elementRowCol; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public void setInnerContainer(Map innerCon) { + containerRowCol = innerCon; + } + + public void setElements(Map innerE) { + elementRowCol = innerE; + } + + + public Position getP() { + return p; + } + + public void setP(Position p) { + this.p = p; + } + + + public void setTop(double top) { + this.top = top; + } + + + public void setLeft(double left) { + this.left = left; + } + + + public void setHeight(double height) { + this.height = height; + } + + + public void setWidth(double width) { + this.width = width; + } + + + public void setInnerCList(List innerCList) { + this.innerCList = innerCList; + } + + + + public void setElementList(List elementList) { + this.elementList = elementList; + } + + public void setVisibilityType(String visibilityType) { + this.visibilityType = visibilityType; + } + + public Size computeSize() { + Size size = new Size(); + double width = 0; + double height = 0; + // System.out.println("Inside computesize"); + for (int i = 0; i0; chk--) { + if (containerRowCol.containsKey(String.valueOf(k)+ String.valueOf(chk-1))) { + if (containerRowCol.get(String.valueOf(k)+ String.valueOf(chk-1)).computeSize().getWidth() + + containerRowCol.get(String.valueOf(k)+ String.valueOf(chk-1)).getP().getX() > p.x) { + ysum+= containerRowCol.get(String.valueOf(k)+ String.valueOf(chk-1)).computeSize().getHeight(); + break; + } + } + } + } + + } + if (this.getName().equals("Broadworks complex") || this.getName().equals("Application Servers") + || this.getName().equals("Call Session Control") || this.getName().equals("GMLC Provider") || this.getName().equals("Neo") || this.getName().equals("Support")) { + p.y = this.getP().getY()+ysum+i*interEleH+interEleToInnerContainerH+1; + } else { + // System.out.println("element name "+e.getName()+" this.getP().getY() "+this.getP().getY() + // +" ysum " +ysum+" i*interEleH "+i*interEleH+" interEleToContainerH " +interEleToContainerH); + if (e.getName().equals("")) { + p.y = this.getP().getY()+ysum+i*interEleH+(interEleToContainerH); + System.out.println("test element name "+this.getName()+" Container height "+this.computeSize().getHeight()+" this.getP().getY() "+this.getP().getY() + +" ysum " +ysum+" i*interEleH "+i*interEleH+" interEleToContainerH-3 " +interEleToContainerH+" p.y "+p.y); + }else + p.y = this.getP().getY()+ysum+i*interEleH+interEleToContainerH; + // System.out.println(e.getName()+"My contain this.getP().getY() "+this.getP().getY() + // +"elements Y "+p.y); + } + xsum+= e.computeSize().getWidth(); + e.setP(p); + System.out.println("my element name "+e.getName()+" e.getP().getX() "+e.getP().getX()); + System.out.println(); + } + } + xsum = 0; + } + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Domain.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Domain.java new file mode 100644 index 0000000..3e74278 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Domain.java @@ -0,0 +1,259 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + +package org.openecomp.portalsdk.core.domain.support; + +import java.util.List; +import java.util.Map; + +public class Domain { + // Unique identifier of the domain + String id; + // List cList; + + public String name; + Size size; + Position p; + + //Attribute1 at; + + public Position getP() { + return p; + } + + public void setP(Position p) { + this.p = p; + } + + //Horizontal space between a pair of containers + double interContWd = 1.0; + //Vertical space between a pair of containers + double interContH; + double domainToLayoutWd; + double domainToContH; + double domainToLayoutH; + int numOfRowsofContainer; + int numOfColsofContainer; + boolean indexChanged; + Map containerRowCol; + public Domain(String id, String name, double interContWd, double interContH, double domainToLayoutWd, + double domainToLayoutH, double domainToContH, int numOfRowsofContainer, int numOfColsofContainer) { + this.id = id; + this.name = name; + this.interContWd = interContWd; + this.interContH = interContH; + this.domainToLayoutWd = domainToLayoutWd; + this.domainToLayoutH = domainToLayoutH; + this.domainToContH = domainToContH; + this.numOfRowsofContainer = numOfRowsofContainer; + this.numOfColsofContainer = numOfColsofContainer; + // at = new Attribute1(); + } + + + + + public double top; + + public double left; + + public double height; + + public double width; + + public List containerList; + + public double newXafterColl; + + public double YafterColl; + + public void setNewXafterColl(double newXafterColl) { + this.newXafterColl = newXafterColl; + } + + public double getNewXafterColl() { + return newXafterColl; + } + + public double getYafterColl() { + return YafterColl; + } + + public void setYafterColl(double yafterColl) { + YafterColl = yafterColl; + } + + public void setDomainToLayoutWd(double domainToLayoutWd) { + this.domainToLayoutWd = domainToLayoutWd; + } + + public double getDomainToLayoutWd() { + return domainToLayoutWd; + } + + public double getTop() { + return top; + } + + public void setTop(double top) { + this.top = top; + } + + public double getLeft() { + return left; + } + + public void setLeft(double left) { + this.left = left; + } + + public double getHeight() { + return height; + } + + public void setHeight(double height) { + this.height = height; + } + + public double getWidth() { + return width; + } + + public void setWidth(double width) { + this.width = width; + } + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setContainers(Map containerRowCol) { + this.containerRowCol = containerRowCol; + } + + public Map getContainerRowCol() { + return containerRowCol; + } + + + /* public Attribute1 getAt() { + return at; + } + + public void setAt(Attribute1 at) { + this.at = at; + }*/ + + public void setContainerList(List containerList) { + // new ArrayList(); + this.containerList = containerList; + } + + + +/* public boolean isCollapsed() { + return collapsed; + } + + public void setCollapsed(boolean collapsed) { + this.collapsed = collapsed; + }*/ + + public boolean isIndexChanged() { + return indexChanged; + } + + public void setIndexChanged(boolean indexChanged) { + this.indexChanged = indexChanged; + } + + //Compute the size of any domain + public Size computeSize() { + size = new Size(); + size.setHeight(5); + double width = 0; + for (int i = 0; i < numOfRowsofContainer; i++) { + if (containerRowCol!=null && containerRowCol.containsKey(String.valueOf(i)+String.valueOf(numOfColsofContainer-1))) { + for (int j = 0; j < numOfColsofContainer; j++) { + width+=containerRowCol.get(String.valueOf(i)+String.valueOf(j)).computeSize().getWidth(); + } + break; + } + + } + width+=(numOfColsofContainer-1)*interContWd; + if (this.getName().equals("VNI")) + size.setWidth(width-4); + else + size.setWidth(width); + return size; + } + + public void computeConatinerPositions() { + + double xsum = 0; + double ysum = 0; + for (int i=0; i< numOfRowsofContainer; i++){ + for (int j=0; j0 && containerRowCol.containsKey(String.valueOf(k)+ String.valueOf(j-1)) && + !containerRowCol.get(String.valueOf(i)+ String.valueOf(j)).getName().equals("Alpharetta")) { + ysum+= containerRowCol.get(String.valueOf(k)+ String.valueOf(j-1)).computeSize().getHeight(); + } + } + System.out.println("C name "+c.getName()+" ysum "+ysum+" domainToLayoutH "+domainToLayoutH+" this.computeSize().getHeight() "+ + this.computeSize().getHeight()+" domainToContH "+domainToContH+" interContH "+interContH); + p.y = domainToLayoutH+ysum+this.computeSize().getHeight()+ + domainToContH+i*interContH; + + c.setP(p); + xsum+= c.computeSize().getWidth(); + + } + } + xsum = 0; + + } + + } + +} + + diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/DomainVo.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/DomainVo.java new file mode 100644 index 0000000..645a913 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/DomainVo.java @@ -0,0 +1,179 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain.support; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.util.Date; +import java.util.Set; + +import org.openecomp.portalsdk.core.domain.FusionVo; + + +/* Super class from which all data objects descend */ +@SuppressWarnings("rawtypes") +public class DomainVo extends FusionVo implements Serializable, Cloneable, Comparable { + + /** + * + */ + private static final long serialVersionUID = 1L; + protected Long id; + protected Date created; + protected Date modified; + protected Long createdId; + protected Long modifiedId; + protected Long rowNum; + + protected Serializable auditUserId; + + Set auditTrail = null; + + public DomainVo() {} + + + public void setId(Long i) { + id = i; + } + + public void setCreated(Date created) { + this.created = created; + } + + public void setModified(Date modified) { + this.modified = modified; + } + + public void setCreatedId(Long createdId) { + this.createdId = createdId; + } + + public void setModifiedId(Long modifiedId) { + this.modifiedId = modifiedId; + } + + public void setAuditUserId(Serializable auditUserId) { + this.auditUserId = auditUserId; + } + + public void setRowNum(Long rowNum) { + this.rowNum = rowNum; + } + + public void setAuditTrail(Set auditTrail) { + this.auditTrail = auditTrail; + } + + public Long getId() { + return id; + } + + public Date getCreated() { + return created; + } + + public Date getModified() { + return modified; + } + + public Long getCreatedId() { + return createdId; + } + + public Long getModifiedId() { + return modifiedId; + } + + public Serializable getAuditUserId() { + return auditUserId; + } + + public Long getRowNum() { + return rowNum; + } + + public Set getAuditTrail() { + return auditTrail; + } + +/* public void addAuditTrailLog(AuditLog auditLog) { + if (getAuditTrail() == null) { + setAuditTrail(new HashSet()); + } + + getAuditTrail().add(auditLog); + }*/ + + + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + + public Object copy() { + return copy(false); + } + + + public Object copy(boolean isIdNull) { + // let's create a "copy" of the object using serialization + ByteArrayOutputStream baos = null; + ByteArrayInputStream bais = null; + ObjectOutputStream oos = null; + ObjectInputStream ois = null; + + DomainVo newVo = null; + + try { + + baos = new ByteArrayOutputStream(); + oos = new ObjectOutputStream(baos); + oos.writeObject(this); + + bais = new ByteArrayInputStream(baos.toByteArray()); + ois = new ObjectInputStream(bais); + newVo = (DomainVo)ois.readObject(); + + if (isIdNull) { + newVo.setId(null); + } + + } + catch (Exception e) { + e.printStackTrace(); + } + + return newVo; + } + + + + public int compareTo(Object obj){ + Long c1 = getId(); + Long c2 = ((DomainVo)obj).getId(); + + return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Element.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Element.java new file mode 100644 index 0000000..84f929f --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Element.java @@ -0,0 +1,161 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain.support; + +public class Element { + + public String id; + public String name; + + public double top; + + public double left; + + public double height; + + public String imgFileName; + + public String borderType; + + public String bgColor; + + public ElementDetails details; + + //public List details; + + + public void setBgColor(String bgColor) { + this.bgColor = bgColor; + } + + public void setId(String id) { + this.id = id; + } + + public void setTop(double top) { + this.top = top; + } + + public void setLeft(double left) { + this.left = left; + } + + public void setHeight(double height) { + this.height = height; + } + + public void setWidth(double width) { + this.width = width; + } + + + public double width; + + + public String getId() { + return id; + } + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + Position p; + + public Position getP() { + return p; + } + + public void setP(Position p) { + this.p = p; + } + + + + public Element(String id, String name, String imgPath, String bgColor, String logical_group, String display_longname, + String description, String primary_function, String key_interfaces, String location, String vendor, String vendor_shortname) { + this.id = id; + this.name = name; + this.imgFileName = imgPath; + this.bgColor = bgColor; + + + } + + public Element(String id, String name) { + this.id = id; + this.name = name; + } + + public Element(String id, String name, String imgFilename, String bgColor, String borderType, ElementDetails details) { + this.id = id; + this.name = name; + this.imgFileName = imgFilename; + this.bgColor = bgColor; + this.borderType = borderType; + this.details = details; + + } + + + public void setBorderType(String borderType) { + this.borderType = borderType; + } + + public String getImgFileName() { + return imgFileName; + } + + public void setImgFileName(String imgFileName) { + this.imgFileName = imgFileName; + } + + public String getBorderType() { + return borderType; + } + + + + public ElementDetails getDetails() { + return details; + } + + + + public void setDetails(ElementDetails details) { + this.details = details; + } + + public Size computeSize() { + Size size= new Size(); + size.setWidth(0.5*7.0); + size.setHeight(0.5*3.0); + // size.setWidth(0.5*10.0); + // size.setHeight(0.5*6.0); + return size; + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/ElementDetails.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/ElementDetails.java new file mode 100644 index 0000000..cebaedd --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/ElementDetails.java @@ -0,0 +1,68 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain.support; + +public class ElementDetails { + public String logical_group; + public String display_longname; + public String description; + public String primary_function; + public String network_function; + public String key_interfaces; + public String location; + public String vendor; + public String vendor_shortname; + public String enclosingContainer; + + +// public Map details1; + +// public ElementDetails(Map details) { + + // this.details = new HashMap(); + // this.details1 = details; +// } + + + + + + public ElementDetails(String logical_group, String display_longname, String description, String primary_function, String network_function, + String key_interfaces, String location, String vendor, String vendor_shortname, String enclosingContainer) { + + this.logical_group = logical_group; + this.display_longname = display_longname; + this.description = description; + this.primary_function = primary_function; + this.network_function = network_function; + this.key_interfaces = key_interfaces; + this.location = location; + this.vendor = vendor; + this.vendor_shortname = vendor_shortname; + this.enclosingContainer = enclosingContainer; + } + + public void setLogical_group(String logical_group) { + this.logical_group = logical_group; + } + + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/FusionCommand.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/FusionCommand.java new file mode 100644 index 0000000..6ac85b6 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/FusionCommand.java @@ -0,0 +1,39 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain.support; + +import org.openecomp.portalsdk.core.FusionObject; + +public class FusionCommand implements FusionObject { + + private String task; + + public FusionCommand() { + } + + public String getTask() { + return task; + } + + public void setTask(String task) { + this.task = task; + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Layout.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Layout.java new file mode 100644 index 0000000..5805623 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Layout.java @@ -0,0 +1,991 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain.support; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +public class Layout { + + public Map domainRowCol; + + Map originalDomainRowCol; + + //Horizontal space between a pair of domains + double interDomainWd; + //Vertical space between a pair of domains + double interDomainH; + //Computing the co-ordinates of any domain + int numberofRowsofDomains; + + int numberofColsofDomains; + + Map collapsedDomains; + + List collapsedDomainsNewList; + + public List getCollapsedDomainsNewList() { + return collapsedDomainsNewList; + } + + public void setCollapsedDomainsNewList(List collapsedDomainsNewList) { + this.collapsedDomainsNewList = collapsedDomainsNewList; + } + + public void setCollapsedDomains(Map collapsedDomains) { + this.collapsedDomains = collapsedDomains; + } + + public Map getCollapsedDomains() { + return collapsedDomains; + } + + public int getNumberofColsofDomains() { + return numberofColsofDomains; + } + + public void setNumberofColsofDomains(int numberofColsofDomains) { + this.numberofColsofDomains = numberofColsofDomains; + } + + public Layout(Map domainRowCol, double interDomainWd, double interDomainH, + int numberofRowsofDomains, int numberofColsofDomains) { + + this.domainRowCol = domainRowCol; + this.interDomainWd = interDomainWd; + this.interDomainH = interDomainH; + this.numberofRowsofDomains = numberofRowsofDomains; + this.numberofColsofDomains = numberofColsofDomains; + this.collapsedDomains = new HashMap(); + this.originalDomainRowCol = new TreeMap(); + this.collapsedDomainsNewList = new ArrayList(); + } + + public Map getDomainRowCol() { + return domainRowCol; + } + + public void setDomainRowCol(Map domainRowCol) { + this.domainRowCol = domainRowCol; + } + + + public void computeDomainPositions() { + double xsum = 0; + double domainTolayout = 10.6; + for (int i=0; i< numberofRowsofDomains; i++){ + for (int j=0; j 0) + p.x+= accountForPlusSpaceBefore(d); + xsum+=d.computeSize().getWidth(); + double ysum=0; + for (int k=0; k enclosedContainers = d.getContainerRowCol(); + for (Map.Entry entry : enclosedContainers.entrySet()) { + if (entry.getKey().equals("00")) { + double containerX = entry.getValue().getP().getX(); + p.x = containerX; + double ysum=0; + for (int k=0; k updatedRC = new HashMap(); + + for (Map.Entry copyEntry : domainRowCol.entrySet()) { + updatedRC.put(copyEntry.getKey(), copyEntry.getValue()); + System.out.println("copyEntry.getKey() "+copyEntry.getKey()+ " copyEntry.getValue() "+copyEntry.getValue()); + } + + Map updatedRCSorted = new TreeMap(updatedRC); + + Map collapsedDomainMap = getCollapsedDomains(); + + List collapsedDomainNewL = getCollapsedDomainsNewList(); + + + if (collapsedDomainNewL.size() == 0) { + for (Map.Entry copyEntry : domainRowCol.entrySet()) { + originalDomainRowCol.put(copyEntry.getKey(), copyEntry.getValue()); + } + } + + + Map updatedRCSortedTrunc = new TreeMap(); + + int colToDelete = 0; + for (Map.Entry entry : updatedRCSorted.entrySet()) { + if (entry.getValue().getName().equals(domainsToCollapse)) { + if (entry.getValue().isIndexChanged()) { + collapsedDomainMap.put("0"+String.valueOf(Integer.parseInt(entry.getKey())+1), entry.getValue()); + + } + else { + collapsedDomainMap.put(entry.getKey(),entry.getValue()); + } + + collapsedDomainNewL.add(entry.getValue()); + setNumberofColsofDomains(getNumberofColsofDomains()-1); + updatedRC.remove(entry.getKey()); + colToDelete = Character.getNumericValue(entry.getKey().toCharArray()[1]); + break; + } + } + + + for (Map.Entry copyEntry : updatedRCSorted.entrySet()) { + updatedRCSortedTrunc.put(copyEntry.getKey(), copyEntry.getValue()); + System.out.println("copyEntry.getKey() "+copyEntry.getKey()+ " copyEntry.getValue() "+copyEntry.getValue()); + } + + for (Map.Entry rmv : updatedRCSorted.entrySet()) { + if (Character.getNumericValue(rmv.getKey().toCharArray()[1]) <= colToDelete) { + updatedRCSortedTrunc.remove(rmv.getKey()); + } + } + + for (Map.Entry updateOthers : updatedRCSortedTrunc.entrySet()) { + char update[] = updateOthers.getKey().toCharArray(); + int charToupdate = Character.getNumericValue(update[1]); + --charToupdate; + String resultRowCol = String.valueOf(update[0])+String.valueOf(charToupdate); + updateOthers.getValue().setIndexChanged(true); + updatedRC.put(resultRowCol, updateOthers.getValue()); + updatedRC.remove(updateOthers.getKey()); + + } + setDomainRowCol(updatedRC); + + double currDistFromLftM = 11.0; + for (Map.Entry cd : updatedRC.entrySet()) { + + Domain d = cd.getValue(); + double accountPlus = accountForPlusSpaceBefore(d); + d.setDomainToLayoutWd(currDistFromLftM+accountPlus); + d.computeConatinerPositions(); + for (Map.Entry entry1 : d.getContainerRowCol().entrySet()) { + Container c = entry1.getValue(); + c.computeSize(); + c.computeElementPositions(); + if (c.getContainerRowCol() != null) { + for (Map.Entry entryInner : c.getContainerRowCol().entrySet()) { + Container inner = entryInner.getValue(); + inner.computeElementPositions(); + } + } + } + currDistFromLftM += d.computeSize().getWidth()+2; + + } + + + + + //nline + // Insert method invocation + updatePlusPosition(collapsedDomainNewL, updatedRC); + + //order changed + setCollapsedDomains(collapsedDomainMap); + setCollapsedDomainsNewList(collapsedDomainNewL); + + + computeDomainPositionsModified(); + return this; + } + + + + public Layout collapseDomainNew(String domainsToCollapse) { + + if(domainsToCollapse == null || domainsToCollapse.isEmpty()) + return null; + + Map updatedRC = new HashMap(); + + for (Map.Entry copyEntry : domainRowCol.entrySet()) { + updatedRC.put(copyEntry.getKey(), copyEntry.getValue()); + System.out.println("copyEntry.getKey() "+copyEntry.getKey()+ " copyEntry.getValue() "+copyEntry.getValue()); + } + + Map updatedRCSorted = new TreeMap(updatedRC); + + Map collapsedDomainMap = getCollapsedDomains(); + + List collapsedDomainNewL = getCollapsedDomainsNewList(); + + + if (collapsedDomainNewL.size() == 0) { + for (Map.Entry copyEntry : domainRowCol.entrySet()) { + originalDomainRowCol.put(copyEntry.getKey(), copyEntry.getValue()); + } + } + + + Map updatedRCSortedTrunc = new TreeMap(); + + int colToDelete = 0; + for (Map.Entry entry : updatedRCSorted.entrySet()) { + if (entry.getValue().getName().equals(domainsToCollapse)) { + if (entry.getValue().isIndexChanged()) { + collapsedDomainMap.put("0"+String.valueOf(Integer.parseInt(entry.getKey())+1), entry.getValue()); + + } + else { + collapsedDomainMap.put(entry.getKey(),entry.getValue()); + } + + collapsedDomainNewL.add(entry.getValue()); + setNumberofColsofDomains(getNumberofColsofDomains()-1); + updatedRC.remove(entry.getKey()); + colToDelete = Character.getNumericValue(entry.getKey().toCharArray()[1]); + break; + } + } + + + for (Map.Entry copyEntry : updatedRCSorted.entrySet()) { + updatedRCSortedTrunc.put(copyEntry.getKey(), copyEntry.getValue()); + System.out.println("copyEntry.getKey() "+copyEntry.getKey()+ " copyEntry.getValue() "+copyEntry.getValue()); + } + + for (Map.Entry rmv : updatedRCSorted.entrySet()) { + if (Character.getNumericValue(rmv.getKey().toCharArray()[1]) <= colToDelete) { + updatedRCSortedTrunc.remove(rmv.getKey()); + } + } + + for (Map.Entry updateOthers : updatedRCSortedTrunc.entrySet()) { + char update[] = updateOthers.getKey().toCharArray(); + int charToupdate = Character.getNumericValue(update[1]); + --charToupdate; + String resultRowCol = String.valueOf(update[0])+String.valueOf(charToupdate); + updateOthers.getValue().setIndexChanged(true); + updatedRC.put(resultRowCol, updateOthers.getValue()); + updatedRC.remove(updateOthers.getKey()); + + } + setDomainRowCol(updatedRC); + + double currDistFromLftM = 11.0; + + boolean isDisplayed; + for (Map.Entry orgEntry : originalDomainRowCol.entrySet()) { + isDisplayed = false; + for (Map.Entry cd : updatedRC.entrySet()) { + if (cd.getValue().getName().equals(orgEntry.getValue().getName())) { + Domain d = cd.getValue(); + d.setDomainToLayoutWd(currDistFromLftM); + d.computeConatinerPositions(); + for (Map.Entry entry1 : d.getContainerRowCol().entrySet()) { + Container c = entry1.getValue(); + c.computeSize(); + c.computeElementPositions(); + if (c.getContainerRowCol() != null) { + for (Map.Entry entryInner : c.getContainerRowCol().entrySet()) { + Container inner = entryInner.getValue(); + inner.computeElementPositions(); + } + } + } + currDistFromLftM += d.computeSize().getWidth()+1; + isDisplayed = true; + break; + } + } + + if (!isDisplayed) { + Domain myCollapsed = orgEntry.getValue(); + myCollapsed.setNewXafterColl(currDistFromLftM); + myCollapsed.setYafterColl(myCollapsed.getP().getY()); + currDistFromLftM += 4; + } + } + + setCollapsedDomains(collapsedDomainMap); + setCollapsedDomainsNewList(collapsedDomainNewL); + + + computeDomainPositionsModified(); + return this; + + } + + + public Layout collapseDomain(String domainsToCollapse) { + + Map updatedRC = new HashMap(); + + for (Map.Entry copyEntry : domainRowCol.entrySet()) { + updatedRC.put(copyEntry.getKey(), copyEntry.getValue()); + System.out.println("copyEntry.getKey() "+copyEntry.getKey()+ " copyEntry.getValue() "+copyEntry.getValue()); + } + + Map updatedRCSorted = new TreeMap(updatedRC); + + Map collapsedDomainMap = getCollapsedDomains(); + + if (collapsedDomainMap.size() == 0) { + for (Map.Entry copyEntry : domainRowCol.entrySet()) { + originalDomainRowCol.put(copyEntry.getKey(), copyEntry.getValue()); + } + } + + + double prevDomXCordinate = 0.0; + Map updatedRCSortedTrunc = new TreeMap(); + int colToDelete = 0; + for (Map.Entry entry : updatedRCSorted.entrySet()) { + if (entry.getValue().getName().equals(domainsToCollapse)) { + if (entry.getValue().isIndexChanged()) + collapsedDomainMap.put("0"+String.valueOf(Integer.parseInt(entry.getKey())+1), entry.getValue()); + else + collapsedDomainMap.put(entry.getKey(),entry.getValue()); + prevDomXCordinate = entry.getValue().getP().getX(); + entry.getValue().getP().setX(prevDomXCordinate-2); + setNumberofColsofDomains(getNumberofColsofDomains()-1); + updatedRC.remove(entry.getKey()); + colToDelete = Character.getNumericValue(entry.getKey().toCharArray()[1]); + break; + } + } + + setCollapsedDomains(collapsedDomainMap); + + for (Map.Entry copyEntry : updatedRCSorted.entrySet()) { + updatedRCSortedTrunc.put(copyEntry.getKey(), copyEntry.getValue()); + System.out.println("copyEntry.getKey() "+copyEntry.getKey()+ " copyEntry.getValue() "+copyEntry.getValue()); + } + + for (Map.Entry rmv : updatedRCSorted.entrySet()) { + if (Character.getNumericValue(rmv.getKey().toCharArray()[1]) <= colToDelete) { + updatedRCSortedTrunc.remove(rmv.getKey()); + } + } + + for (Map.Entry updateOthers : updatedRCSortedTrunc.entrySet()) { + char update[] = updateOthers.getKey().toCharArray(); + int charToupdate = Character.getNumericValue(update[1]); + --charToupdate; + String resultRowCol = String.valueOf(update[0])+String.valueOf(charToupdate); + updateOthers.getValue().setIndexChanged(true); + updatedRC.put(resultRowCol, updateOthers.getValue()); + updatedRC.remove(updateOthers.getKey()); + } + + setDomainRowCol(updatedRC); + + + + for (Map.Entry entry : updatedRCSortedTrunc.entrySet()) { + Domain d = entry.getValue(); + if (collapsedDomains.size() == 2 && collapsedDomains.containsKey("00") && collapsedDomains.containsKey("01") && domainsToCollapse.equals("RAN")) { + if (d.getName().equals("USP")) + d.setDomainToLayoutWd(prevDomXCordinate); + else if (d.getName().equals("VNI")) + d.setDomainToLayoutWd(prevDomXCordinate+8); + else + d.setDomainToLayoutWd(prevDomXCordinate+10); + } + else if (domainsToCollapse.equals("RAN") && !d.getName().equals("EPC") && collapsedDomains.size() < 3) + d.setDomainToLayoutWd(prevDomXCordinate+11); + else if (domainsToCollapse.equals("RAN") && collapsedDomains.size() == 3 && collapsedDomains.containsKey("01") && collapsedDomains.containsKey("04")) { + if (d.getName().equals("USP")) + d.setDomainToLayoutWd(prevDomXCordinate); + else + d.setDomainToLayoutWd(prevDomXCordinate+10); + } + + else if (collapsedDomains.containsKey("00") && collapsedDomains.size() == 3 && collapsedDomains.containsKey("01") && collapsedDomains.containsKey("02")) { + if (d.getName().equals("VNI")) + d.setDomainToLayoutWd(prevDomXCordinate+10); + else + d.setDomainToLayoutWd(prevDomXCordinate); + + } + + else if (collapsedDomains.containsKey("00") && collapsedDomains.size() == 3 && collapsedDomains.containsKey("01") && collapsedDomains.containsKey("03")) { + if (d.getName().equals("VNI")) + d.setDomainToLayoutWd(prevDomXCordinate+10); + else + d.setDomainToLayoutWd(prevDomXCordinate); + + } + + + + else { + d.setDomainToLayoutWd(prevDomXCordinate); + } + d.computeConatinerPositions(); + prevDomXCordinate = d.getP().getX(); + for (Map.Entry entry1 : d.getContainerRowCol().entrySet()) { + Container c = entry1.getValue(); + c.computeSize(); + c.computeElementPositions(); + if (c.getContainerRowCol() != null) { + for (Map.Entry entryInner : c.getContainerRowCol().entrySet()) { + Container inner = entryInner.getValue(); + inner.computeElementPositions(); + } + } + } + } + computeDomainPositions(); + return this; + + } + + public Layout uncollapseDomainModified(String domainToUnCollapse) { + Map currentDomainsSorted = new TreeMap(domainRowCol); + Map updateDomains = new TreeMap(); + Map collapsedDomainList = getCollapsedDomains(); + Map collapsedDomainListSorted = new TreeMap(collapsedDomainList); + + List domainstoUpd = new ArrayList(); + + int colToUnCollapse = 99; + + Domain domainToInsert = null; + + if (collapsedDomains.size() == 0) { + for (Map.Entry unindexDomain : originalDomainRowCol.entrySet()) { + Domain dm = unindexDomain.getValue(); + dm.setIndexChanged(false); + } + } + + + for (Map.Entry entry : collapsedDomainListSorted.entrySet()) { + if (entry.getValue().getName().equals(domainToUnCollapse)) { + colToUnCollapse = Character.getNumericValue(entry.getKey().toCharArray()[1]); + domainToInsert = entry.getValue(); + collapsedDomainList.remove(entry.getKey()); + break; + } + } + + domainstoUpd.add(domainToInsert); + + for (Map.Entry e : originalDomainRowCol.entrySet()) + System.out.println("Original key value"+e.getKey()+":"+e.getValue().getName()); + + int lastKeyCol = -1; + for (Map.Entry entry : originalDomainRowCol.entrySet()) { + int currcol = Character.getNumericValue(entry.getKey().toCharArray()[1]); + if (currcol < colToUnCollapse) { + for (Map.Entry currDomainsEntry : currentDomainsSorted.entrySet()) { + if (currDomainsEntry.getValue().getName().equals(entry.getValue().getName())) { + updateDomains.put(currDomainsEntry.getKey(), currDomainsEntry.getValue()); + lastKeyCol = Character.getNumericValue(currDomainsEntry.getKey().toCharArray()[1]); + break; + } + } + } else { + String newKey = "0"+String.valueOf(lastKeyCol+1); + if (currcol == colToUnCollapse) { + updateDomains.put(newKey, domainToInsert); + ++lastKeyCol; + } else { + for (Map.Entry currDomainsEnt : currentDomainsSorted.entrySet()) { + if (currDomainsEnt.getValue().getName().equals(entry.getValue().getName())) { + updateDomains.put(newKey, currDomainsEnt.getValue()); + domainstoUpd.add(currDomainsEnt.getValue()); + ++lastKeyCol; + break; + } + } + } + + } + } + + setNumberofColsofDomains(getNumberofColsofDomains()+1); + setDomainRowCol(updateDomains); + setCollapsedDomains(collapsedDomainList); + + for (Map.Entry e : updateDomains.entrySet()) + System.out.println("me Updatedomains key value"+e.getKey()+":"+e.getValue().getName()); + + for (int i = 0; i < domainstoUpd.size(); i++) { + Domain d = domainstoUpd.get(i); + double newX = 0.0; + if (i+1 < domainstoUpd.size()) + newX = domainstoUpd.get(i+1).getP().getX(); + else + newX = domainstoUpd.get(i).getP().getX()+32; + + if (d.getName().equals("Datacenter")) + newX+= 2; + d.setDomainToLayoutWd(newX); + d.computeConatinerPositions(); + for (Map.Entry entry1 : d.getContainerRowCol().entrySet()) { + Container c = entry1.getValue(); + c.computeSize(); + c.computeElementPositions(); + if (c.getContainerRowCol() != null) { + for (Map.Entry entryInner : c.getContainerRowCol().entrySet()) { + Container inner = entryInner.getValue(); + inner.computeElementPositions(); + } + } + } + } + + computeDomainPositions(); + return this; + + } + + + + public Layout uncollapseDomain(String domainToCollapse) { + Map currentDomainsSorted = new TreeMap(domainRowCol); + Map updateDomains = new TreeMap(); + Map collapsedDomainList = getCollapsedDomains(); + Map collapsedDomainListSorted = new TreeMap(collapsedDomainList); + + List domainstoUpd = new ArrayList(); + + + for (Map.Entry entry : collapsedDomainListSorted.entrySet()) { + if (entry.getValue().getName().equals(domainToCollapse)) { + if (currentDomainsSorted != null) { + int colToUnCollapse = Character.getNumericValue(entry.getKey().toCharArray()[1]); + for (Map.Entry curr : currentDomainsSorted.entrySet()) { + if (Character.getNumericValue(curr.getKey().toCharArray()[1]) < colToUnCollapse) { + updateDomains.put(curr.getKey(),curr.getValue()); + } else { + updateDomains.put("0"+String.valueOf(Integer.parseInt(curr.getKey())+1),curr.getValue()); + domainstoUpd.add(curr.getValue()); + } + } + } + updateDomains.put(entry.getKey(), entry.getValue()); + collapsedDomainList.remove(entry.getKey()); + break; + + } + } + setNumberofColsofDomains(getNumberofColsofDomains()+1); + setDomainRowCol(updateDomains); + setCollapsedDomains(collapsedDomainList); + + for (Map.Entry e : updateDomains.entrySet()) + System.out.println("Updatedomains key value"+e.getKey()+":"+e.getValue().getName()); + + + for (int i = 0; i < domainstoUpd.size(); i++) { + Domain d = domainstoUpd.get(i); + double newX = 0.0; + if (i+1 < domainstoUpd.size()) + newX = domainstoUpd.get(i+1).getP().getX(); + else + newX = domainstoUpd.get(i).getP().getX()+38; + + if (d.getName().equals("Datacenter")) + newX+= 5; + d.setDomainToLayoutWd(newX); + d.computeConatinerPositions(); + for (Map.Entry entry1 : d.getContainerRowCol().entrySet()) { + Container c = entry1.getValue(); + c.computeSize(); + c.computeElementPositions(); + if (c.getContainerRowCol() != null) { + for (Map.Entry entryInner : c.getContainerRowCol().entrySet()) { + Container inner = entryInner.getValue(); + inner.computeElementPositions(); + } + } + } + } + + computeDomainPositions(); + return this; + } + + public Layout uncollapseDomainNew(String domainToUnCollapse) { + Map currentDomainsSorted = new TreeMap(domainRowCol); + Map updateDomains = new TreeMap(); + Map collapsedDomainList = getCollapsedDomains(); + List domainstoUpd = new ArrayList(); + + //nline + List collapsedDomainNewLL = getCollapsedDomainsNewList(); + + int colToUnCollapse = 99; + + Domain domainToInsert = null; + + //nline + if (collapsedDomainNewLL.size() == 0) { + for (Map.Entry unindexDomain : originalDomainRowCol.entrySet()) { + Domain dm = unindexDomain.getValue(); + dm.setIndexChanged(false); + } + } + + + for (Map.Entry entry : originalDomainRowCol.entrySet()) { + if (entry.getValue().getName().equals(domainToUnCollapse)) { + colToUnCollapse = Character.getNumericValue(entry.getKey().toCharArray()[1]); + domainToInsert = entry.getValue(); + collapsedDomainList.remove(entry.getKey()); + //nline + collapsedDomainNewLL.remove(entry.getValue()); + break; + } + } + + domainstoUpd.add(domainToInsert); + + for (Map.Entry e : originalDomainRowCol.entrySet()) + System.out.println("Original key value"+e.getKey()+":"+e.getValue().getName()); + + int lastKeyCol = -1; + for (Map.Entry entry : originalDomainRowCol.entrySet()) { + int currcol = Character.getNumericValue(entry.getKey().toCharArray()[1]); + if (currcol < colToUnCollapse) { + for (Map.Entry currDomainsEntry : currentDomainsSorted.entrySet()) { + if (currDomainsEntry.getValue().getName().equals(entry.getValue().getName())) { + updateDomains.put(currDomainsEntry.getKey(), currDomainsEntry.getValue()); + lastKeyCol = Character.getNumericValue(currDomainsEntry.getKey().toCharArray()[1]); + break; + } + } + } else { + String newKey = "0"+String.valueOf(lastKeyCol+1); + if (currcol == colToUnCollapse) { + updateDomains.put(newKey, domainToInsert); + ++lastKeyCol; + } else { + for (Map.Entry currDomainsEnt : currentDomainsSorted.entrySet()) { + if (currDomainsEnt.getValue().getName().equals(entry.getValue().getName())) { + updateDomains.put(newKey, currDomainsEnt.getValue()); + domainstoUpd.add(currDomainsEnt.getValue()); + ++lastKeyCol; + break; + } + } + } + + } + } + + setNumberofColsofDomains(getNumberofColsofDomains()+1); + setDomainRowCol(updateDomains); + + for (Map.Entry e : updateDomains.entrySet()) + System.out.println("me Updatedomains key value"+e.getKey()+":"+e.getValue().getName()); + + + + double currDistFromLftMargin = 11.0; + for (Map.Entry cd : updateDomains.entrySet()) { + Domain d = cd.getValue(); + double accountPlus = accountForPlusSpaceBefore(d); + d.setDomainToLayoutWd(currDistFromLftMargin+accountPlus); + d.computeConatinerPositions(); + for (Map.Entry entry1 : d.getContainerRowCol().entrySet()) { + Container c = entry1.getValue(); + c.computeSize(); + c.computeElementPositions(); + if (c.getContainerRowCol() != null) { + for (Map.Entry entryInner : c.getContainerRowCol().entrySet()) { + Container inner = entryInner.getValue(); + inner.computeElementPositions(); + } + } + } + currDistFromLftMargin += d.computeSize().getWidth()+2; + + } + + //nline + updatePlusPosition(collapsedDomainNewLL, updateDomains); + + //order changed + setCollapsedDomains(collapsedDomainList); + + //nline + setCollapsedDomainsNewList(collapsedDomainNewLL); + + + computeDomainPositionsModified(); + return this; + + } + + public Layout uncollapseDomainNew1(String domainToUnCollapse) { + + if(domainToUnCollapse == null || domainToUnCollapse.isEmpty()) + return null; + + Map currentDomainsSorted = new TreeMap(domainRowCol); + Map updateDomains = new TreeMap(); + Map collapsedDomainList = getCollapsedDomains(); + List domainstoUpd = new ArrayList(); + + //nline + List collapsedDomainNewLL = getCollapsedDomainsNewList(); + + int colToUnCollapse = 99; + + Domain domainToInsert = null; + + //nline + if (collapsedDomainNewLL.size() == 0) { + for (Map.Entry unindexDomain : originalDomainRowCol.entrySet()) { + Domain dm = unindexDomain.getValue(); + dm.setIndexChanged(false); + } + } + + + for (Map.Entry entry : originalDomainRowCol.entrySet()) { + if (entry.getValue().getName().equals(domainToUnCollapse)) { + colToUnCollapse = Character.getNumericValue(entry.getKey().toCharArray()[1]); + domainToInsert = entry.getValue(); + collapsedDomainList.remove(entry.getKey()); + //nline + collapsedDomainNewLL.remove(entry.getValue()); + break; + } + } + + domainstoUpd.add(domainToInsert); + + for (Map.Entry e : originalDomainRowCol.entrySet()) + System.out.println("Original key value"+e.getKey()+":"+e.getValue().getName()); + + int lastKeyCol = -1; + for (Map.Entry entry : originalDomainRowCol.entrySet()) { + int currcol = Character.getNumericValue(entry.getKey().toCharArray()[1]); + if (currcol < colToUnCollapse) { + for (Map.Entry currDomainsEntry : currentDomainsSorted.entrySet()) { + if (currDomainsEntry.getValue().getName().equals(entry.getValue().getName())) { + updateDomains.put(currDomainsEntry.getKey(), currDomainsEntry.getValue()); + lastKeyCol = Character.getNumericValue(currDomainsEntry.getKey().toCharArray()[1]); + break; + } + } + } else { + String newKey = "0"+String.valueOf(lastKeyCol+1); + if (currcol == colToUnCollapse) { + updateDomains.put(newKey, domainToInsert); + ++lastKeyCol; + } else { + for (Map.Entry currDomainsEnt : currentDomainsSorted.entrySet()) { + if (currDomainsEnt.getValue().getName().equals(entry.getValue().getName())) { + updateDomains.put(newKey, currDomainsEnt.getValue()); + domainstoUpd.add(currDomainsEnt.getValue()); + ++lastKeyCol; + break; + } + } + } + + } + } + + setNumberofColsofDomains(getNumberofColsofDomains()+1); + setDomainRowCol(updateDomains); + + for (Map.Entry e : updateDomains.entrySet()) + System.out.println("me Updatedomains key value"+e.getKey()+":"+e.getValue().getName()); + + + + + double currDistFromLftM = 11.0; + + boolean isDisplayed; + for (Map.Entry orgEntry : originalDomainRowCol.entrySet()) { + isDisplayed = false; + for (Map.Entry cd : updateDomains.entrySet()) { + if (cd.getValue().getName().equals(orgEntry.getValue().getName())) { + Domain d = cd.getValue(); + d.setDomainToLayoutWd(currDistFromLftM); + d.computeConatinerPositions(); + for (Map.Entry entry1 : d.getContainerRowCol().entrySet()) { + Container c = entry1.getValue(); + c.computeSize(); + c.computeElementPositions(); + if (c.getContainerRowCol() != null) { + for (Map.Entry entryInner : c.getContainerRowCol().entrySet()) { + Container inner = entryInner.getValue(); + inner.computeElementPositions(); + } + } + } + currDistFromLftM += d.computeSize().getWidth()+1; + isDisplayed = true; + break; + } + } + + if (!isDisplayed) { + Domain myCollapsed = orgEntry.getValue(); + myCollapsed.setNewXafterColl(currDistFromLftM); + currDistFromLftM += 4; + } + } + + + //order changed + setCollapsedDomains(collapsedDomainList); + + //nline + setCollapsedDomainsNewList(collapsedDomainNewLL); + + + computeDomainPositionsModified(); + return this; + + } + + private void updatePlusPosition(List collapsedDNewL, Map displayedDomainMap) { + List copyCollapseList = new ArrayList(); + + for (Domain copyCollapse : collapsedDNewL) { + copyCollapseList.add(copyCollapse); + } + + int orgColofCollapsed = -1; + int orgColofDisplayed = -1; + int orgColofDisplayedOtherPlus = -1; + for (Domain plus : collapsedDNewL) { + double distOfCollFrmLft = 0.0; + for (Map.Entry colCheck : originalDomainRowCol.entrySet()) { + if (colCheck.getValue().getName().equals(plus.getName())) { + orgColofCollapsed = Character.getNumericValue(colCheck.getKey().toCharArray()[1]); + break; + } + } + for (Map.Entry displayedEntry : displayedDomainMap.entrySet()) { + + for (Map.Entry colCheck1 : originalDomainRowCol.entrySet()) { + if (colCheck1.getValue().getName().equals(displayedEntry.getValue().getName())) { + orgColofDisplayed = Character.getNumericValue(colCheck1.getKey().toCharArray()[1]); + break; + } + } + if (orgColofDisplayed < orgColofCollapsed) { + distOfCollFrmLft+= displayedEntry.getValue().computeSize().getWidth(); + + } + + } + + for (Domain collp : copyCollapseList) { + if (!collp.getName().equals(plus.getName())) { + for (Map.Entry colCheck2 : originalDomainRowCol.entrySet()) { + if (colCheck2.getValue().getName().equals(collp.getName())) { + orgColofDisplayedOtherPlus = Character.getNumericValue(colCheck2.getKey().toCharArray()[1]); + break; + } + } + if (orgColofDisplayedOtherPlus < orgColofCollapsed) { + distOfCollFrmLft+=3.0; + } + } + } + + plus.setNewXafterColl(distOfCollFrmLft+1.5); + + + } + } + + + private double accountForPlusSpaceBefore(Domain d) { + + int orgColofCollapsed = 0; + int orgColofDisplayed = 0; + double distFromLftM = 0.0; + + for (Map.Entry colCheckk : originalDomainRowCol.entrySet()) { + if (colCheckk.getValue().getName().equals(d.getName())) { + orgColofDisplayed = Character.getNumericValue(colCheckk.getKey().toCharArray()[1]); + break; + } + } + + for (Domain collapsed : getCollapsedDomainsNewList()) { + for (Map.Entry colCheck : originalDomainRowCol.entrySet()) { + if (colCheck.getValue().getName().equals(collapsed.getName())) { + orgColofCollapsed = Character.getNumericValue(colCheck.getKey().toCharArray()[1]); + break; + } + } + + if (orgColofCollapsed < orgColofDisplayed) { + distFromLftM+= 2; + } + } + return distFromLftM; + + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/NameValueId.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/NameValueId.java new file mode 100644 index 0000000..52d03c5 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/NameValueId.java @@ -0,0 +1,94 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain.support; + +import java.io.Serializable; + + +public class NameValueId implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + private String lab; + private String val; + + public NameValueId() { + } + + public NameValueId(String value, String label) { + setVal(value); + setLab(label); + } + + + public String getLab() { + return lab; + } + + + public String getVal() { + return val; + } + + + public void setLab(String label) { + this.lab = label; + } + + + public void setVal(String value) { + this.val = value; + } + + + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (o == null) { + return false; + } + + if (!(o instanceof NameValueId)) { + return false; + } + + final NameValueId nameValueId = (NameValueId)o; + + if (!getVal().equals(nameValueId.getVal())) { + return false; + } + + if (!getLab().equals(nameValueId.getLab())) { + return false; + } + + return true; + } + + + public int hashCode() { + return getVal().hashCode(); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Position.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Position.java new file mode 100644 index 0000000..db137c8 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Position.java @@ -0,0 +1,40 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain.support; + +public class Position { + double x; + double y; + + public double getX() { + return x; + } + public void setX(double x) { + this.x = x; + } + public double getY() { + return y; + } + public void setY(double y) { + this.y = y; + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Size.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Size.java new file mode 100644 index 0000000..4ebfb96 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/domain/support/Size.java @@ -0,0 +1,40 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.domain.support; + +public class Size { + private double width; + private double height; + + public double getWidth() { + return width; + } + public void setWidth(double width) { + this.width = width; + } + public double getHeight() { + return height; + } + public void setHeight(double height) { + this.height = height; + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/drools/DroolsRuleService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/drools/DroolsRuleService.java new file mode 100644 index 0000000..c556aa1 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/drools/DroolsRuleService.java @@ -0,0 +1,27 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.drools; + +public interface DroolsRuleService { + + public void init(String... params); + public String getResultsString(); + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/drools/DroolsRuleServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/drools/DroolsRuleServiceImpl.java new file mode 100644 index 0000000..7328c47 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/drools/DroolsRuleServiceImpl.java @@ -0,0 +1,58 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.drools; + + +/** + * + * This is POC test class to execute sample rules + */ +public class DroolsRuleServiceImpl implements DroolsRuleService{ + + + private String state; + private String resultsString; + + public DroolsRuleServiceImpl() { + + } + + public void init(String... params) { + this.state = params[0]; + } + + + + public String getState() { + return state; + } + + public String accessLabel() { + return "Drools POC Test"; + } + + public String getResultsString() { + return resultsString; + } + + public void setResultsString(String resultsString) { + this.resultsString = resultsString; + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/FusionExceptionResolver.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/FusionExceptionResolver.java new file mode 100644 index 0000000..f756d76 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/FusionExceptionResolver.java @@ -0,0 +1,50 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.exception; + +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.servlet.ModelAndView; + +@ControllerAdvice +public class FusionExceptionResolver { + + @ExceptionHandler(UrlAccessRestrictedException.class) + public ModelAndView handleUrlAccessException(UrlAccessRestrictedException ex) { + ModelAndView model = new ModelAndView("error"); + model.addObject("errMsg", ex.getMessage()); + return model; + + } + @ExceptionHandler(SessionExpiredException.class) + public ModelAndView handleSessionException(SessionExpiredException ex) { + ModelAndView model = new ModelAndView("error"); + model.addObject("errMsg", ex.getMessage()); + return model; + } + @ExceptionHandler(Exception.class) + public ModelAndView handleAllException(Exception ex) { + ModelAndView model = new ModelAndView("error"); + model.addObject("errMsg", ex.getMessage()); + return model; + + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/SessionExpiredException.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/SessionExpiredException.java new file mode 100644 index 0000000..ba8f76b --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/SessionExpiredException.java @@ -0,0 +1,34 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.exception; + +import org.openecomp.portalsdk.core.exception.support.FusionRuntimeException; + +public class SessionExpiredException extends FusionRuntimeException { + /** + * + */ + private static final long serialVersionUID = 1L; + public static final String MESSAGE = "Your session has expired. Please login again."; + + public SessionExpiredException() { + super(MESSAGE); + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/UrlAccessRestrictedException.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/UrlAccessRestrictedException.java new file mode 100644 index 0000000..39fe264 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/UrlAccessRestrictedException.java @@ -0,0 +1,34 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.exception; + +import org.openecomp.portalsdk.core.exception.support.FusionRuntimeException; + +public class UrlAccessRestrictedException extends FusionRuntimeException { + /** + * + */ + private static final long serialVersionUID = 1L; + public static final String MESSAGE = "Authorization Denied"; + + public UrlAccessRestrictedException() { + super(MESSAGE); + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/support/FusionException.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/support/FusionException.java new file mode 100644 index 0000000..135fc3e --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/support/FusionException.java @@ -0,0 +1,24 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.exception.support; + +import org.openecomp.portalsdk.core.FusionObject; + +public interface FusionException extends FusionObject {} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/support/FusionRuntimeException.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/support/FusionRuntimeException.java new file mode 100644 index 0000000..f7ca61f --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/exception/support/FusionRuntimeException.java @@ -0,0 +1,36 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.exception.support; + +public class FusionRuntimeException extends RuntimeException implements FusionException { + /** + * + */ + private static final long serialVersionUID = 1L; + + public FusionRuntimeException() { + this(""); + } + + public FusionRuntimeException(String message) { + super(message); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interceptor/ResourceInterceptor.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interceptor/ResourceInterceptor.java new file mode 100644 index 0000000..24088cd --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interceptor/ResourceInterceptor.java @@ -0,0 +1,164 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.interceptor; + +import java.net.HttpURLConnection; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.openecomp.portalsdk.core.controller.FusionBaseController; +import org.openecomp.portalsdk.core.domain.App; +import org.openecomp.portalsdk.core.exception.UrlAccessRestrictedException; +import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalTimeoutHandler; +import org.openecomp.portalsdk.core.service.DataAccessService; +import org.openecomp.portalsdk.core.service.LoginService; +import org.openecomp.portalsdk.core.service.WebServiceCallService; +import org.openecomp.portalsdk.core.util.CipherUtil; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +public class ResourceInterceptor extends HandlerInterceptorAdapter { + public static final String APP_METADATA = "APP.METADATA"; + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ResourceInterceptor.class); + + @Autowired + private DataAccessService dataAccessService; + @Autowired + private LoginService loginService; + @Autowired + private WebServiceCallService webServiceCallService; + + private AbstractCacheManager cacheManager; + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) + throws Exception { + String uri = request.getRequestURI(); + String url = uri.substring(uri.indexOf("/", 1) + 1); + logger.info(EELFLoggerDelegate.debugLogger, "Url - " + url); + logger.info(EELFLoggerDelegate.debugLogger, "lastIndexOf - " + uri.substring(uri.lastIndexOf("/") + 1)); + if (handler instanceof HandlerMethod) { + HandlerMethod method = (HandlerMethod) handler; + FusionBaseController controller = (FusionBaseController) method.getBean(); + if (!controller.isAccessible()) { + if (controller.isRESTfulCall()) { + // check user authentication for RESTful calls + String secretKey = null; + try { + if (!webServiceCallService.verifyRESTCredential(secretKey, request.getHeader("username"), + request.getHeader("password"))) { + logger.error(EELFLoggerDelegate.errorLogger, "Error accesing RESTful service. Un-authorized",AlarmSeverityEnum.MINOR); + throw new UrlAccessRestrictedException(); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Error authenticating RESTful service :" + e,AlarmSeverityEnum.MINOR); + ((HttpServletResponse) response).setStatus(HttpURLConnection.HTTP_UNAUTHORIZED); + return false; + } + } + if (!UserUtils.isUrlAccessible(request, url)) { + logger.error(EELFLoggerDelegate.errorLogger, "Error accesing URL. Un-authorized",AlarmSeverityEnum.MINOR); + throw new UrlAccessRestrictedException(); + } + } + } + + logger.debug("successfully authorized rest call"); + logger.info(EELFLoggerDelegate.debugLogger, "successfully authorized rest call"); + handleSessionUpdates(request); + logger.debug("handled session updates for synchronization"); + logger.info(EELFLoggerDelegate.debugLogger, "handled session updates for synchronization"); + return super.preHandle(request, response, handler); + } + + /** + * + * @param request + */ + protected void handleSessionUpdates(HttpServletRequest request) { + + App app = null; + Object appObj = getCacheManager().getObject(APP_METADATA); + if (appObj == null) { + app = findApp(); + getCacheManager().putObject(APP_METADATA, app); + + } else { + app = (App) appObj; + } + + String ecompRestURL = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REST_URL); + String decreptedPwd = ""; + try { + decreptedPwd = CipherUtil.decrypt(app.getAppPassword(), + SystemProperties.getProperty(SystemProperties.Decryption_Key)); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Could not decrypt Password" + e.getMessage(),AlarmSeverityEnum.MINOR); + } + + PortalTimeoutHandler.handleSessionUpdatesNative(request, app.getUsername(), decreptedPwd, + PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY), ecompRestURL, null); + } + + public App findApp() { + List list = null; + StringBuffer criteria = new StringBuffer(); + criteria.append(" where id = 1"); + list = getDataAccessService().getList(App.class, criteria.toString(), null, null); + return (list == null || list.size() == 0) ? null : (App) list.get(0); + } + + public DataAccessService getDataAccessService() { + return dataAccessService; + } + + public void setDataAccessService(DataAccessService dataAccessService) { + this.dataAccessService = dataAccessService; + } + + public LoginService getLoginService() { + return loginService; + } + + public void setLoginService(LoginService loginService) { + this.loginService = loginService; + } + + @Autowired + public void setCacheManager(AbstractCacheManager cacheManager) { + this.cacheManager = cacheManager; + } + + public AbstractCacheManager getCacheManager() { + return cacheManager; + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interceptor/SessionTimeoutInterceptor.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interceptor/SessionTimeoutInterceptor.java new file mode 100644 index 0000000..e28ce86 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interceptor/SessionTimeoutInterceptor.java @@ -0,0 +1,103 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.interceptor; + +import java.net.URLEncoder; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.openecomp.portalsdk.core.controller.FusionBaseController; +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.exception.SessionExpiredException; +import org.openecomp.portalsdk.core.listener.CollaborateListBindingListener; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.web.support.AppUtils; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +public class SessionTimeoutInterceptor extends HandlerInterceptorAdapter { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SessionTimeoutInterceptor.class); + + public SessionTimeoutInterceptor() { + } + + /** + * Checks all requests for valid session information. If not found, + * redirects to a controller that will establish a valid session. + */ + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) + throws Exception { + if (handler instanceof HandlerMethod) { + HandlerMethod method = (HandlerMethod) handler; + FusionBaseController controller = (FusionBaseController) method.getBean(); + if (!controller.isAccessible() && !controller.isRESTfulCall()) { + try { + // getSession() throws SessionExpiredException + HttpSession session = AppUtils.getSession(request); + User user = UserUtils.getUserSession(request); + // check if user is logging out + if (request.getRequestURI().indexOf("logout.htm") > -1) { + session.removeAttribute(CollaborateListBindingListener.SESSION_ATTR_NAME); + throw new SessionExpiredException(); + } else if (user == null) { + // Jump to the redirection code + throw new Exception("preHandle: user not found in session"); + } else { + // session binding listener will add this value to the + // map, and with session replication the listener will + // fire in all tomcat instances + session.setAttribute(CollaborateListBindingListener.SESSION_ATTR_NAME, + new CollaborateListBindingListener(user.getOrgUserId())); + } + } catch (Exception ex) { + // get the path within the webapp that the user requested (no host name etc.) + final String forwardUrl = request.getRequestURI().substring(request.getContextPath().length() + 1) + + (request.getQueryString() == null ? "" : "?" + request.getQueryString()); + final String forwardUrlParm = "forwardURL=" + URLEncoder.encode(forwardUrl, "UTF-8"); + final String singleSignonPrefix = "/single_signon.htm?"; + if (ex instanceof SessionExpiredException) { + // Session is expired; send to portal. + // Redirect to an absolute path in the webapp; e.g., "/context/single_signon.htm" + final String redirectUrl = request.getContextPath() + singleSignonPrefix + "redirectToPortal=Yes&" + forwardUrlParm; + logger.debug(EELFLoggerDelegate.debugLogger, "preHandle: session is expired, redirecting to {}", + redirectUrl); + response.sendRedirect(redirectUrl); + return false; + } else { + // Other issue; do not send to portal. + // Redirect to an absolute path in the webapp; e.g., "/context/single_signon.htm" + final String redirectUrl = request.getContextPath() + singleSignonPrefix + forwardUrlParm; + logger.debug(EELFLoggerDelegate.debugLogger, "preHandle: took exception {}, redirecting to {}", + ex.getMessage(), redirectUrl); + response.sendRedirect(redirectUrl); + return false; + } + } + } + } + + return super.preHandle(request, response, handler); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interfaces/SecurityInterface.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interfaces/SecurityInterface.java new file mode 100644 index 0000000..b40c471 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/interfaces/SecurityInterface.java @@ -0,0 +1,24 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.interfaces; + +public interface SecurityInterface { + public boolean isAccessible(); +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/ApplicationContextListener.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/ApplicationContextListener.java new file mode 100644 index 0000000..10e2b2d --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/ApplicationContextListener.java @@ -0,0 +1,43 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.listener; + +import javax.servlet.ServletContext; +import javax.servlet.annotation.WebListener; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.context.event.ContextRefreshedEvent; +import org.springframework.stereotype.Component; + +@WebListener +@Component +public class ApplicationContextListener implements ApplicationListener { + + @Autowired + ServletContext context; + + + public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent ) { + +// String contextPath = context.getContextPath(); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/CollaborateListBindingListener.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/CollaborateListBindingListener.java new file mode 100644 index 0000000..9306aaf --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/CollaborateListBindingListener.java @@ -0,0 +1,61 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.listener; + +import java.io.Serializable; + +import javax.servlet.http.HttpSessionBindingEvent; +import javax.servlet.http.HttpSessionBindingListener; + +import org.openecomp.portalsdk.core.domain.support.CollaborateList; + +public class CollaborateListBindingListener implements HttpSessionBindingListener, Serializable { + + private static final long serialVersionUID = 1L; + private String userName; + public static final String SESSION_ATTR_NAME = "CollaborateListSessionAttrName"; + + public CollaborateListBindingListener(String _userName) { + userName = _userName; + } + + @Override + public void valueBound(HttpSessionBindingEvent event) { + final CollaborateListBindingListener value = ((CollaborateListBindingListener) event.getValue()); + CollaborateList.addUserName(value.getUserName()); + + } + + @Override + public void valueUnbound(HttpSessionBindingEvent event) { + final CollaborateListBindingListener value = ((CollaborateListBindingListener) event.getValue()); + if (value != null) + CollaborateList.delUserName(value.getUserName()); + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/UserSessionListener.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/UserSessionListener.java new file mode 100644 index 0000000..adc8477 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/listener/UserSessionListener.java @@ -0,0 +1,62 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.listener; + +import javax.servlet.annotation.WebListener; +import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpSessionEvent; +import javax.servlet.http.HttpSessionListener; + +import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; + + +@WebListener +public class UserSessionListener implements HttpSessionListener{ + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UserSessionListener.class); + + public void sessionCreated(HttpSessionEvent event){ + + } + + /** + * Removes sessions from the context scoped HashMap when they expire + * or are invalidated. + */ + public void sessionDestroyed(HttpSessionEvent event){ + try { + HttpSession session = event.getSession(); + session.removeAttribute(CollaborateListBindingListener.SESSION_ATTR_NAME); + + // Object user = session.getAttribute(SystemProperties.getProperty("user.attribute.name")); + + //if( user != null) + // { + session.removeAttribute(CollaborateListBindingListener.SESSION_ATTR_NAME); + //CollaborateList.getInstance().delUserName(user.getOrgUserId()); + // } + + } + catch(Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "sessionDestroyed" + e.getMessage(),AlarmSeverityEnum.MINOR); + } + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/AuditLog.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/AuditLog.java new file mode 100644 index 0000000..5a1a864 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/AuditLog.java @@ -0,0 +1,32 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.logging.aspect; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + + +@Target({ElementType.METHOD, ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface AuditLog { + String value() default ""; +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/EELFLoggerAdvice.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/EELFLoggerAdvice.java new file mode 100644 index 0000000..5264c70 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/EELFLoggerAdvice.java @@ -0,0 +1,193 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.logging.aspect; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.servlet.http.HttpServletRequest; + +import org.openecomp.portalsdk.core.logging.format.AuditLogFormatter; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.service.AppService; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.util.SystemProperties.SecurityEventTypeEnum; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; + +import com.att.eelf.configuration.Configuration; + +@org.springframework.context.annotation.Configuration +public class EELFLoggerAdvice { + + @Autowired + AppService appService; + + EELFLoggerDelegate adviceLogger = EELFLoggerDelegate.getLogger(EELFLoggerAdvice.class); + + //DateTime Format according to the ECOMP Application Logging Guidelines. + private static final SimpleDateFormat ecompLogDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); + + public Object[] before(SecurityEventTypeEnum securityEventType, Object[] args, Object[] passOnArgs) { + try { + String className = ""; + if (passOnArgs[0]!=null) { + className = passOnArgs[0].toString(); + } + + String methodName = ""; + if (passOnArgs[1]!=null) { + methodName = passOnArgs[1].toString(); + } + + String appName = appService.getDefaultAppName(); + if (appName==null || appName=="") { + appName = SystemProperties.SDK_NAME; + } + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(className); + + //Initialize Request defaults only for controller methods. + MDC.put(className + methodName + SystemProperties.METRICSLOG_BEGIN_TIMESTAMP, getCurrentDateTimeUTC()); + MDC.put(SystemProperties.TARGET_ENTITY, appName + "_BE"); + MDC.put(SystemProperties.TARGET_SERVICE_NAME, methodName); + if (securityEventType!=null) { + MDC.put(className + methodName + SystemProperties.AUDITLOG_BEGIN_TIMESTAMP, getCurrentDateTimeUTC()); + HttpServletRequest req = null; + if (args[0]!=null && args[0] instanceof HttpServletRequest ) { + req = (HttpServletRequest)args[0]; + logger.setRequestBasedDefaultsIntoGlobalLoggingContext(req, appName); + } + } + logger.debug(EELFLoggerDelegate.debugLogger, (methodName +" was invoked.")); + } catch(Exception e) { + adviceLogger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in EELFLoggerAdvice.before() method. Details: " + e.getMessage()); + } + + return new Object[] {""}; + } + + public void after(SecurityEventTypeEnum securityEventType, String result, Object[] args, Object[] returnArgs, Object[] passOnArgs) { + try { + String className = ""; + if (passOnArgs[0]!=null) { + className = passOnArgs[0].toString(); + } + + String methodName = ""; + if (passOnArgs[1]!=null) { + methodName = passOnArgs[1].toString(); + } + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(className); + + String appName = appService.getDefaultAppName(); + if (appName==null || appName=="") { + appName = SystemProperties.SDK_NAME; + } + + if (MDC.get(SystemProperties.TARGET_SERVICE_NAME) == null || MDC.get(SystemProperties.TARGET_SERVICE_NAME) == "") { + MDC.put(SystemProperties.TARGET_SERVICE_NAME, methodName); + } + + if (MDC.get(SystemProperties.TARGET_ENTITY) == null || MDC.get(SystemProperties.TARGET_ENTITY) == "") { + MDC.put(SystemProperties.TARGET_ENTITY, appName + "_BE"); + } + + MDC.put(SystemProperties.METRICSLOG_BEGIN_TIMESTAMP, MDC.get(className + methodName + SystemProperties.METRICSLOG_BEGIN_TIMESTAMP)); + MDC.put(SystemProperties.METRICSLOG_END_TIMESTAMP, getCurrentDateTimeUTC()); + this.calculateDateTimeDifference(MDC.get(SystemProperties.METRICSLOG_BEGIN_TIMESTAMP), MDC.get(SystemProperties.METRICSLOG_END_TIMESTAMP)); + + logger.info(EELFLoggerDelegate.metricsLogger, methodName + " operation is completed."); + logger.debug(EELFLoggerDelegate.debugLogger, "Finished executing " + methodName + "."); + + if (securityEventType!=null) { + + MDC.put(SystemProperties.AUDITLOG_BEGIN_TIMESTAMP, MDC.get(className + methodName + SystemProperties.AUDITLOG_BEGIN_TIMESTAMP)); + MDC.put(SystemProperties.AUDITLOG_END_TIMESTAMP, getCurrentDateTimeUTC()); + this.calculateDateTimeDifference(MDC.get(SystemProperties.AUDITLOG_BEGIN_TIMESTAMP), MDC.get(SystemProperties.AUDITLOG_END_TIMESTAMP)); + + this.logSecurityMessage(logger, securityEventType, result, methodName); + + //clear when finishes audit logging + MDC.remove(Configuration.MDC_KEY_REQUEST_ID); + MDC.remove(SystemProperties.PARTNER_NAME); + MDC.remove(SystemProperties.MDC_LOGIN_ID); + MDC.remove(SystemProperties.PROTOCOL); + MDC.remove(SystemProperties.FULL_URL); + MDC.remove(Configuration.MDC_SERVICE_NAME); + MDC.remove(SystemProperties.RESPONSE_CODE); + MDC.remove(SystemProperties.STATUS_CODE); + MDC.remove(className + methodName + SystemProperties.AUDITLOG_BEGIN_TIMESTAMP); + MDC.remove(SystemProperties.AUDITLOG_BEGIN_TIMESTAMP); + MDC.remove(SystemProperties.AUDITLOG_END_TIMESTAMP); + } + + MDC.remove(className + methodName + SystemProperties.METRICSLOG_BEGIN_TIMESTAMP); + MDC.remove(SystemProperties.METRICSLOG_BEGIN_TIMESTAMP); + MDC.remove(SystemProperties.METRICSLOG_END_TIMESTAMP); + MDC.remove(SystemProperties.MDC_TIMER); + MDC.remove(SystemProperties.TARGET_ENTITY); + MDC.remove(SystemProperties.TARGET_SERVICE_NAME); + } catch(Exception e) { + adviceLogger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in EELFLoggerAdvice.after() method. Details: " + e.getMessage()); + } + } + + private void logSecurityMessage(EELFLoggerDelegate logger, SecurityEventTypeEnum securityEventType, String result, String restMethod) { + StringBuilder additionalInfoAppender = new StringBuilder(); + String auditMessage = ""; + + additionalInfoAppender.append(String.format("%s request was received.", restMethod)); + + //Status code + MDC.put(SystemProperties.STATUS_CODE, result); + + String fullURL = MDC.get(SystemProperties.FULL_URL); + if (fullURL!=null && fullURL!="") { + additionalInfoAppender.append(" Request-URL:" + MDC.get(SystemProperties.FULL_URL)); + } + + auditMessage = AuditLogFormatter.getInstance().createMessage( MDC.get(SystemProperties.PROTOCOL), + securityEventType.name(), + MDC.get(SystemProperties.MDC_LOGIN_ID), + additionalInfoAppender.toString()); + + logger.info(EELFLoggerDelegate.auditLogger, auditMessage); + } + + private String getCurrentDateTimeUTC() { + String currentDateTime = ecompLogDateFormat.format(new Date()); + return currentDateTime; + } + + private void calculateDateTimeDifference(String beginDateTime, String endDateTime) { + if (beginDateTime!=null && endDateTime!=null) { + try { + Date beginDate = ecompLogDateFormat.parse(beginDateTime); + Date endDate = ecompLogDateFormat.parse(endDateTime); + String timeDifference = String.format("%d ms", endDate.getTime() - beginDate.getTime()); + MDC.put(SystemProperties.MDC_TIMER, timeDifference); + } catch(Exception e) { + adviceLogger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in EELFLoggerAdvice.calculateDateTimeDifference() method. Details: " + e.getMessage()); + } + } + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/EELFLoggerAspect.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/EELFLoggerAspect.java new file mode 100644 index 0000000..3138d21 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/EELFLoggerAspect.java @@ -0,0 +1,88 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.logging.aspect; + +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.openecomp.portalsdk.core.util.SystemProperties.SecurityEventTypeEnum; +import org.springframework.beans.factory.annotation.Autowired; + + +@Aspect +@org.springframework.context.annotation.Configuration +public class EELFLoggerAspect { + + @Autowired + EELFLoggerAdvice advice; + + /* + * Point-cut expression to handle all INCOMING_REST_MESSAGES + */ + @Pointcut("execution(public * org.openecomp.portalsdk.core.controller.*.*(..))") + public void incomingAuditMessages() {} + + @Around("incomingAuditMessages() && @annotation(auditLog)") + public Object logAuditMethodAround(ProceedingJoinPoint joinPoint, AuditLog auditLog) throws Throwable { + return this.logAroundMethod(joinPoint, SecurityEventTypeEnum.INCOMING_REST_MESSAGE); + } + + @Around("incomingAuditMessages() && @within(auditLog)") + public Object logAuditMethodClassAround(ProceedingJoinPoint joinPoint, AuditLog auditLog) throws Throwable { + return this.logAroundMethod(joinPoint, SecurityEventTypeEnum.INCOMING_REST_MESSAGE); + } + + /* + * Point cut expression to capture metrics logging + */ + @Pointcut("execution(public * *(..))") + public void publicMethod() {} + + @Around("publicMethod() && @within(metricsLog)") + public Object logMetricsClassAround(ProceedingJoinPoint joinPoint, MetricsLog metricsLog) throws Throwable { + return this.logAroundMethod(joinPoint, null); + } + + @Around("publicMethod() && @annotation(metricsLog)") + public Object logMetricsMethodAround(ProceedingJoinPoint joinPoint, MetricsLog metricsLog) throws Throwable { + return this.logAroundMethod(joinPoint, null); + } + + private Object logAroundMethod(ProceedingJoinPoint joinPoint, SecurityEventTypeEnum securityEventType) throws Throwable { + //Before + Object[] passOnArgs = new Object[] {joinPoint.getSignature().getDeclaringType().getName(),joinPoint.getSignature().getName()}; + Object[] returnArgs = advice.before(securityEventType, joinPoint.getArgs(), passOnArgs); + + //Execute the actual method + Object result = null; + String restStatus = "COMPLETE"; + try { + result = joinPoint.proceed(); + } catch(Exception e) { + restStatus = "ERROR"; + } + + //After + advice.after(securityEventType, restStatus, joinPoint.getArgs(), returnArgs, passOnArgs); + + return result; + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/MetricsLog.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/MetricsLog.java new file mode 100644 index 0000000..f795ffb --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/aspect/MetricsLog.java @@ -0,0 +1,32 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.logging.aspect; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + + +@Target({ElementType.METHOD, ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface MetricsLog { + String value() default ""; +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AlarmSeverityEnum.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AlarmSeverityEnum.java new file mode 100644 index 0000000..360d8d8 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AlarmSeverityEnum.java @@ -0,0 +1,28 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.logging.format; + +public enum AlarmSeverityEnum { + CRITICAL, + MAJOR, + MINOR, + INFORMATIONAL, + NONE, +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AppMessagesEnum.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AppMessagesEnum.java new file mode 100644 index 0000000..a6924ba --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AppMessagesEnum.java @@ -0,0 +1,249 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.logging.format; + +public enum AppMessagesEnum { + /* + 100-199 Security/Permission Related + - Authentication problems (from external client, to external server) + - Certification errors + - + + 200-299 Availability/Timeout Related + - connectivity error + - connection timeout + + 300-399 Data Access/Integrity Related + - Data in graph in invalid(E.g. no creator is found for service) + - Artifact is missing in ES, but exists in graph. + + 400-499 Schema Interface Type/Validation + - received Pay-load checksum is invalid + - received JSON is not valid + + 500-599 Business/Flow Processing Related + - check out to service is not allowed + - Roll-back is done + - failed to generate heat file + + + 600-899 Reserved - do not use + + 900-999 Unknown Errors + - Unexpected exception + */ + + BeUebAuthenticationError(ErrorCodesEnum.BEUEBAUTHENTICATIONERROR_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR100E", "An Authentication failure occurred during access to UEB server", "Details: {0}.", "Please check UEB server list and keys configured under Portal.Properties file."), + + BeRestApiAuthenticationError(ErrorCodesEnum.BERESTAPIAUTHENTICATIONERROR, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR101E", "Rejected an incoming REST API request due to invalid credentials", "", "Please check application credentials defined in Database or properties files."), + + InternalAuthenticationInfo(ErrorCodesEnum.INTERNALAUTHENTICATIONINFO_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, + "ERR199I", "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."), + + InternalAuthenticationWarning(ErrorCodesEnum.INTERNALAUTHENTICATIONWARNING_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, + "ERR199W", "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."), + + InternalAuthenticationError(ErrorCodesEnum.INTERNALAUTHENTICATIONERROR_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR199E", "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."), + + InternalAuthenticationFatal(ErrorCodesEnum.INTERNALAUTHENTICATIONFATAL_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.FATAL, + "ERR199F", "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."), + + BeHealthCheckError(ErrorCodesEnum.BeHEALTHCHECKERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR200E", "ECOMP-PORTAL Back-end probably lost connectivity to either one of the following components: MySQL DB, UEB Cluster", "", "Please check the logs for more information."), + + BeHealthCheckMySqlError(ErrorCodesEnum.BEHEALTHCHECKMYSQLERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR201E", "ECOMP-PORTAL Back-end probably lost connectivity to MySQL DB", "", "Check connectivity to MYSQL is configured correctly under system.properties file."), + + BeHealthCheckUebClusterError(ErrorCodesEnum.BEHEALTHCHECKUEBCLUSTERERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR203E", "ECOMP-PORTAL Back-end probably lost connectivity to UEB Cluster", "", "Check connectivity to UEB cluster which is configured under portal.properties file."), + + FeHealthCheckError(ErrorCodesEnum.FEHEALTHCHECKERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR204E", "Unable to connect to a valid ECOMP-PORTAL Back-end Server.", "", "Please check connectivity from this FE instance towards BE or BE Load Balancer."), + + BeHealthCheckRecovery(ErrorCodesEnum.BEHEALTHCHECKRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, + "ERR205I", "ECOMP-PORTAL Back-end Recovery to either one of the following components: MySQL DB, UEB Cluster", "", "Please check logs for more specific information about the problem."), + + BeHealthCheckMySqlRecovery(ErrorCodesEnum.BEHEALTHCHECKMYSQLRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, + "ERR206I", "ECOMP-PORTAL Back-end connection recovery to MySQL DB", "", "Please check logs for more specific information about the problem."), + + BeHealthCheckUebClusterRecovery(ErrorCodesEnum.BEHEALTHCHECKUEBCLUSTERRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, + "ERR208I", "ECOMP-PORTAL Back-end connection recovery to UEB Cluster", "", "Please check logs for more specific information about the problem."), + + FeHealthCheckRecovery(ErrorCodesEnum.FEHEALTHCHECKRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, + "ERR209I", "Connectivity to ECOMP-PORTAL Front-end Server is recovered", "", "Please check logs for more specific information about the problem."), + + BeUebConnectionError(ErrorCodesEnum.BEUEBCONNECTIONERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR210E", "ECOMP-PORTAL Back-end probably lost connectivity to UEB Cluster", "Details: {0}.", "Please check UEB server list and keys configured under Portal.Properties file."), + + BeUebUnkownHostError(ErrorCodesEnum.BEUEBUNKOWNHOSTERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR211E", "ECOMP-PORTAL Back-end probably lost connectivity to UEB Cluster", "Cannot reach host: {0}.", "Please check UEB server list and keys configured under Portal.Properties file."), + + BeUebRegisterOnboardingAppError(ErrorCodesEnum.BEUEBREGISTERONBOARDINGAPPERROR, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR212E", "Failed to register the On-boarding application with UEB Communication server", "Details: {0}.", "Please check UEB server list and keys configured under Portal.Properties file."), + + BeHttpConnectionError(ErrorCodesEnum.BEHTTPCONNECTIONERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR213E", "It could be that communication to an external application might resulted an exception or failed to reach the external application", + "Details: {0}.", "Please check logs for more information."), + + InternalConnectionInfo(ErrorCodesEnum.INTERNALCONNECTIONINFO_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, + "ERR299I", "Internal Connection problem", "Details: {0}.", "Please check logs for more information."), + + InternalConnectionWarning(ErrorCodesEnum.INTERNALCONNECTIONWARNING_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, + "ERR299W", "Internal Connection problem", "Details: {0}.", "Please check logs for more information."), + + InternalConnectionError(ErrorCodesEnum.INTERNALCONNECTIONERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR299E", "Internal Connection problem", "Details: {0}.", "Please check logs for more information."), + + InternalConnectionFatal(ErrorCodesEnum.INTERNALCONNECTIONFATAL_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.FATAL, + "ERR299F", "Internal Connection problem", "Details: {0}.", "Please check logs for more information."), + + BeUebObjectNotFoundError(ErrorCodesEnum.BEUEBOBJECTNOTFOUNDERROR_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR303E", "Error occurred during access to U-EB Server.", "Data not found: {0}.", "An error occurred during access to UEB Server, {1} failed to either register or unregister to/from UEB topic."), + + BeUserMissingError(ErrorCodesEnum.BEUSERMISSINGERROR_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR310E", "User is not found", "", "User {0} must be added to the corresponding application with proper user roles."), + + BeUserInactiveWarning(ErrorCodesEnum.BEUSERINACTIVEWARNING_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, + "ERR313W", "User is found but in-active", "", "User {0} must be added to the corresponding application with proper user roles."), + + BeUserAdminPrivilegesInfo(ErrorCodesEnum.BEUSERADMINPRIVILEGESINFO_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, + "ERR314W", "User is found but don't have administrative privileges", "", "User {0} should be given administrator role for the corresponding application to perform the necessary actions."), + + BeInvalidJsonInput(ErrorCodesEnum.BEINVALIDJSONINPUT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR405E", "Failed to convert JSON input to object", "", "Please check logs for more information."), + + BeIncorrectHttpStatusError(ErrorCodesEnum.BEINCORRECTHTTPSTATUSERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR407E", "Communication to an external application is resulted in with Incorrect Http response code", "", "Please check logs for more information."), + + BeInitializationError(ErrorCodesEnum.BEINITIALIZATIONERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR500E", "ECOMP-PORTAL Back-end was not initialized properly", "", "Please check logs for more information."), + + BeUebSystemError(ErrorCodesEnum.BEUEBSYSTEMERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR502E", "Error occurred during access to U-EB Server", "Details: {0}.", "An error occurred in {1} distribution mechanism. Please check the logs for more information."), + + BeDaoSystemError(ErrorCodesEnum.BEDAOSYSTEMERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR505E", "Performing DDL or DML operations on database might have failed", "", "Please check MySQL DB health or look at the logs for more details."), + + BeSystemError(ErrorCodesEnum.BESYSTEMERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR506E", "Unexpected error during operation", "", "Please check logs for more information."), + + BeExecuteRollbackError(ErrorCodesEnum.BEEXECUTEROLLBACKERROR, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR507E", "Roll-back operation towards database has failed", "", "Please check MYSQL DB health or look at the logs for more details."), + + FeHttpLoggingError(ErrorCodesEnum.FEHTTPLOGGINGERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.ERROR, + "ERR517E", "Error when logging FE HTTP request/response", "", "Please check MYSQL DB health or look at the logs for more details."), + + FePortalServletError(ErrorCodesEnum.FEPORTALSERVLETERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR518E", "Error when trying to access FE Portal page.", "", "Please check logs for more information."), + + BeDaoCloseSessionError(ErrorCodesEnum.BEDAOCLOSESESSIONERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR519E", "Close local session operation with database failed", "", "Please check MYSQL DB health or look at the logs form more details."), + + BeRestApiGeneralError(ErrorCodesEnum.BERESTAPIGENERALERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR900E", "Unexpected error during ECOMP-PORTAL Back-end REST API execution", "", "Please check error log for more information."), + + FeHealthCheckGeneralError(ErrorCodesEnum.FEHEALTHCHECKGENERALERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, + "ERR901E", "General error during FE Health Check", "", "Please check error log for more information."), + + InternalUnexpectedInfo(ErrorCodesEnum.INTERNALUNEXPECTEDINFO_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, + "ERR999I", "Unexpected error", "Details: {0}.", "Please check logs for more information."), + + InternalUnexpectedWarning(ErrorCodesEnum.INTERNALUNEXPECTEDWARNING_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, + "ERR999W", "Unexpected error", "Details: {0}.", "Please check logs for more information."), + + InternalUnexpectedError(ErrorCodesEnum.INTERNALUNEXPECTEDERROR_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, + "ERR999E", "Unexpected error", "Details: {0}.", "Please check logs for more information."), + + InternalUnexpectedFatal(ErrorCodesEnum.INTERNALUNEXPECTEDFATAL_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.FATAL, + "ERR999F", "Unexpected error", "Details: {0}.", "Please check logs for more information."), + + ; + + ErrorTypeEnum eType; + AlarmSeverityEnum alarmSeverity; + ErrorCodesEnum messageCode; + ErrorSeverityEnum errorSeverity; + String errorCode; + String errorDescription; + String details; + String resolution; + + AppMessagesEnum(ErrorCodesEnum messageCode, ErrorTypeEnum eType, AlarmSeverityEnum alarmSeverity, ErrorSeverityEnum errorSeverity, String errorCode, String errorDescription, + String details, String resolution) { + this.messageCode = messageCode; + this.eType = eType; + this.alarmSeverity = alarmSeverity; + this.errorSeverity = errorSeverity; + this.errorCode = errorCode; + this.errorDescription = errorDescription; + this.details = details; + this.resolution = resolution; + } + + public String getDetails() { + return this.details; + } + + public String getResolution() { + return this.resolution; + } + public String getErrorCode() { + return this.errorCode; + } + + public String getErrorDescription() { + return this.errorDescription; + } + + public ErrorSeverityEnum getErrorSeverity() { + return this.errorSeverity; + } + + public void setErrorSeverity(ErrorSeverityEnum errorSeverity) { + this.errorSeverity = errorSeverity; + } + + public ErrorCodesEnum getMessageCode() { + return messageCode; + } + + public void setMessageCode(ErrorCodesEnum messageCode) { + this.messageCode = messageCode; + } + + public AlarmSeverityEnum getAlarmSeverity() { + return alarmSeverity; + } + + public void setAlarmSeverity(AlarmSeverityEnum alarmSeverity) { + this.alarmSeverity = alarmSeverity; + } + + public ErrorTypeEnum getErrorType() { + return eType; + } + + public void setErrorType(ErrorTypeEnum eType) { + this.eType = eType; + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ApplicationCodes.properties b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ApplicationCodes.properties new file mode 100644 index 0000000..efd9ac2 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ApplicationCodes.properties @@ -0,0 +1,221 @@ +### +# ================================================================================ +# eCOMP Portal SDK +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ================================================================================ +### +######################################################################## +#Resource key=Error Code|Message text|Resolution text |Description text +####### +#Newlines can be utilized to add some clarity ensuring continuing line +#has atleast one leading space +#ResourceKey=\ +# ERR0000E\ +# Sample error msg txt\ +# Sample resolution msg\ +# Sample description txt +# +###### +#Error code classification category +#100 Permission errors +#200 Availability errors/Timeouts +#300 Data errors +#400 Schema Interface type/validation errors +#500 Business process errors +#900 Unknown errors +# +######################################################################## + +#Health check +BEUEBAUTHENTICATIONERROR_ONE_ARGUMENT=\ + ERR100E|\ + Authentication problem towards U-EB server. Reason: {0}.|\ + An Authentication failure occurred during access to UEB server. Please check that UEB keys are configured correctly under fusion.properties file.| + +BERESTAPIAUTHENTICATIONERROR =\ + ERR101E|\ + Rejected an incoming REST API request to {0} from {1} due to invalid credentials.|\ + Please check application credentials defined in Database or portal.properties file.| + +INTERNALAUTHENTICATIONINFO_ONE_ARGUMENT=\ + ERR199I|\ + Internal authentication problem. Description: {0}.| + +INTERNALAUTHENTICATIONWARNING_ONE_ARGUMENT=\ + ERR199W|\ + Internal authentication problem. Description: {0}.| + +INTERNALAUTHENTICATIONERROR_ONE_ARGUMENT=\ + ERR199E|\ + Internal authentication problem. Description: {0}.| + +INTERNALAUTHENTICATIONFATAL_ONE_ARGUMENT=\ + ERR199F|\ + Internal authentication problem. Description: {0}.| + +BEHEALTHCHECKERROR=\ + ERR200E|\ + {0} probably lost connectivity to either one of the following components: MySQL DB, UEB Cluster. Please check the logs for more information.| + +BEHEALTHCHECKMYSQLERROR=\ + ERR201E|\ + {0} probably lost connectivity to MySQL DB. Please check the logs for more information.|\ + Check connectivity to MYSQL is configured correctly under system.properties file.| + +BEHEALTHCHECKUEBCLUSTERERROR=\ + ERR203E|\ + {0} probably lost connectivity to UEB Cluster. Please check the logs for more information.|\ + Check connectivity to UEB cluster which is configured under portal.properties file.| + +BEHEALTHCHECKRECOVERY=\ + ERR205I|\ + {0} Recovery to either one of the following components: MySQL DB, UEB Cluster.| + +BEHEALTHCHECKMYSQLRECOVERY=\ + ERR206I|\ + {0} connection recovery to MySQL DB.| + +BEHEALTHCHECKUEBCLUSTERRECOVERY=\ + ERR208I|\ + {0} connection recovery to UEB Cluster.| + +FEHEALTHCHECKRECOVERY=\ + ERR209I|\ + Connectivity to {0} Server is recovered.| + +#UEB communication +BEUEBCONNECTIONERROR_ONE_ARGUMENT=\ + ERR210E|\ + Connection problem towards U-EB server. Reason: {0}.|\ + Please check that that parameter uebServers in portal.properties points to a valid UEB Cluster.| + +BEUEBSYSTEMERROR=\ + ERR502E|\ + Error occurred during access to U-EB Server. Operation: {0}.|\ + An error occurred in {1} distribution mechanism. Please check the logs for more information.| + +BEUEBUNKOWNHOSTERROR_ONE_ARGUMENT=\ + ERR211E|\ + Connection problem towards U-EB server. Cannot reach host {0}.|\ + Please check that that parameter uebServers in portal.properties points to a valid UEB Cluster.| + +#Onboarding apps +BEUEBREGISTERONBOARDINGAPPERROR=\ + ERR212E|\ + Unable to register the On-boarding application with the U-EB server. Reason: {0}.|\ + Please check that that parameter uebServers in system.properties points to a valid UEB Cluster.| + +#HTTP communication +BEHTTPCONNECTIONERROR_ONE_ARGUMENT=\ + ERR213E|\ + HTTP connection to an external application is failed. Reason: {0}.|\ + Please check the logs for more information.| + +INTERNALCONNECTIONINFO_ONE_ARGUMENT=\ + ERR299I|\ + Internal Connection problem. Description: {0}.| + +INTERNALCONNECTIONWARNING_ONE_ARGUMENT=\ + ERR299W|\ + Internal Connection problem. Description: {0}.| + +INTERNALCONNECTIONERROR_ONE_ARGUMENT=\ + ERR299E|\ + Internal Connection problem. Description: {0}.| + +INTERNALCONNECTIONFATAL_ONE_ARGUMENT=\ + ERR299F|\ + Internal Connection problem. Description: {0}.| + +BEUEBOBJECTNOTFOUNDERROR_ONE_ARGUMENT=\ + ERR303E|\ + Error occurred during access to U-EB Server. Data not found: {0}.|\ + An error occurred during access to UEB Server, {1} failed to either register or unregister to/from UEB topic.| + +#Login error codes +BEUSERMISSINGERROR_ONE_ARGUMENT=\ + ERR310E|\ + User {0} requested is not found.| + +BEUSERINACTIVEWARNING_ONE_ARGUMENT=\ + ERR313W|\ + User {0} is found but inactive.| + +BEUSERADMINPRIVILEGESINFO_ONE_ARGUMENT=\ + ERR314W|\ + User {0} is found but don't have administrative privileges.| + +BEINVALIDJSONINPUT=\ + ERR405E|\ + Failed to convert JSON input to object.|\ + Please check error logs for more information.| + +BEINCORRECTHTTPSTATUSERROR=\ + ERR407E|\ + Incorrect HttpResponse Received.|\ + Please check error & metrics logs for more information.| + +BEINITIALIZATIONERROR=\ + ERR500E|\ + BE was not initialized properly.| + +BEDAOSYSTEMERROR=\ + ERR505E|\ + Operation towards database failed.|\ + Please check MySQL DB health or look at the logs for more details.| + +BESYSTEMERROR=\ + ERR506E|\ + Unexpected error during operation.| + +BEEXECUTEROLLBACKERROR=\ + ERR507E|\ + Roll-back operation towards database failed.|\ + Please check MYSQL DB health or look at the logs for more details.| + +FEHTTPLOGGINGERROR=\ + ERR517E|\ + Error when logging FE HTTP request/response.| + +BEDAOCLOSESESSIONERROR=\ + ERR519E|\ + Close local session operation with database failed.|\ + Please check MYSQL DB health or look at the logs form more details.| + +BERESTAPIGENERALERROR=\ + ERR900E|\ + Unexpected error during BE REST API execution.|\ + Please check error log for more information.| + +FEHEALTHCHECKGENERALERROR=\ + ERR901E|\ + General error during FE Health Check.| + +INTERNALUNEXPECTEDINFO_ONE_ARGUMENT=\ + ERR999I|\ + Unexpected error. Description: {0}.| + +INTERNALUNEXPECTEDWARNING_ONE_ARGUMENT=\ + ERR999W|\ + Unexpected error. Description: {0}.| + +INTERNALUNEXPECTEDERROR_ONE_ARGUMENT=\ + ERR999E|\ + Unexpected error. Description: {0}.| + +INTERNALUNEXPECTEDFATAL_ONE_ARGUMENT=\ + ERR999F|\ + Unexpected error. Description: {0}.| diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AuditLogFormatter.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AuditLogFormatter.java new file mode 100644 index 0000000..2cb336e --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/AuditLogFormatter.java @@ -0,0 +1,106 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.logging.format; + +import java.text.MessageFormat; +import java.util.Map; + +import org.openecomp.portalsdk.core.util.SystemProperties; + +public class AuditLogFormatter { + //Singleton + private static AuditLogFormatter instance = new AuditLogFormatter(); + + public static AuditLogFormatter getInstance() { + + return instance; + } + + public String createMessage(String protocol,String set, + String loginId, String message) { + + Object[] securityMessageArgs = prepareFormatArgs( + protocol, + set, + loginId, + message ); + + return MessageFormat.format(SystemProperties.SECURITY_LOG_TEMPLATE, securityMessageArgs); + } + + /** + * A method for normalizing the security log field - returns + * the @Param defaultValue in case the entry is null or empty. + * If the @param entry is not empty, a single quotation is added to it. + * + * @param entry the entry + * @param defaultValue The default value in case the entry is empty + * @return String (formatted) + */ + private String formatEntry(Object entry, String defaultValue) { + return (entry!=null && !entry.toString().isEmpty()) ? addSingleQuotes(entry.toString()): defaultValue; + + } + + private String addSingleQuotes(String s) { + if (null!=s && !s.isEmpty()) { + s = SystemProperties.SINGLE_QUOTE+s+SystemProperties.SINGLE_QUOTE; + } + return s; + } + + + /** + * This method prepares an Object array of arguments that would be passed + * to the MessageFormat.format() method, to format the security log. + * + * @param protocol + * @param set + * @param loginId + * @param accessingClient + * @param isSuccess + * @param message + * @return + */ + private Object[] prepareFormatArgs(String protocol,String set, + String loginId, String message) { + + Object[] messageFormatArgs = { + formatEntry(protocol, SystemProperties.NA), + formatEntry(set, SystemProperties.NA), + formatEntry(loginId, SystemProperties.UNKNOWN), + message + }; + return messageFormatArgs; + } + + + public String createMessage(Map logArgsMap) { + + Object[] securityMessageArgs = prepareFormatArgs( + logArgsMap.get(SystemProperties.PROTOCOL), + logArgsMap.get(SystemProperties.SECURIRY_EVENT_TYPE), + logArgsMap.get(SystemProperties.LOGIN_ID), + logArgsMap.get(SystemProperties.ADDITIONAL_INFO) + ); + + return MessageFormat.format(SystemProperties.SECURITY_LOG_TEMPLATE, securityMessageArgs); + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorCodesEnum.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorCodesEnum.java new file mode 100644 index 0000000..59fe2bb --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorCodesEnum.java @@ -0,0 +1,87 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.logging.format; + +import com.att.eelf.i18n.EELFResolvableErrorEnum; +//import com.att.eelf.i18n.EELFResourceManager; + +public enum ErrorCodesEnum implements EELFResolvableErrorEnum { + BERESTAPIAUTHENTICATIONERROR, + BEHTTPCONNECTIONERROR_ONE_ARGUMENT, + BEUEBAUTHENTICATIONERROR_ONE_ARGUMENT, + + INTERNALAUTHENTICATIONINFO_ONE_ARGUMENT, + INTERNALAUTHENTICATIONWARNING_ONE_ARGUMENT, + INTERNALAUTHENTICATIONERROR_ONE_ARGUMENT, + INTERNALAUTHENTICATIONFATAL_ONE_ARGUMENT, + + BEHEALTHCHECKRECOVERY, + BEHEALTHCHECKMYSQLRECOVERY, + BEHEALTHCHECKUEBCLUSTERRECOVERY, + FEHEALTHCHECKRECOVERY, + BeHEALTHCHECKERROR, + + BEHEALTHCHECKMYSQLERROR, + BEHEALTHCHECKUEBCLUSTERERROR, + FEHEALTHCHECKERROR, + BEUEBCONNECTIONERROR_ONE_ARGUMENT, + BEUEBUNKOWNHOSTERROR_ONE_ARGUMENT, + BEUEBREGISTERONBOARDINGAPPERROR, + + INTERNALCONNECTIONINFO_ONE_ARGUMENT, + INTERNALCONNECTIONWARNING_ONE_ARGUMENT, + INTERNALCONNECTIONERROR_ONE_ARGUMENT, + INTERNALCONNECTIONFATAL_ONE_ARGUMENT, + + BEUEBOBJECTNOTFOUNDERROR_ONE_ARGUMENT, + BEUSERMISSINGERROR_ONE_ARGUMENT, + + BEUSERINACTIVEWARNING_ONE_ARGUMENT, + BEUSERADMINPRIVILEGESINFO_ONE_ARGUMENT, + + BEINVALIDJSONINPUT, + BEINCORRECTHTTPSTATUSERROR, + + BEINITIALIZATIONERROR, + BEUEBSYSTEMERROR, + BEDAOSYSTEMERROR, + BESYSTEMERROR, + BEEXECUTEROLLBACKERROR, + + FEHTTPLOGGINGERROR, + FEPORTALSERVLETERROR, + BEDAOCLOSESESSIONERROR, + + BERESTAPIGENERALERROR, + FEHEALTHCHECKGENERALERROR, + + INTERNALUNEXPECTEDINFO_ONE_ARGUMENT, + INTERNALUNEXPECTEDWARNING_ONE_ARGUMENT, + INTERNALUNEXPECTEDERROR_ONE_ARGUMENT, + INTERNALUNEXPECTEDFATAL_ONE_ARGUMENT, + + ; + + /** + * Static initializer to ensure the resource bundles for this class are loaded... + * Here this application loads messages from three bundles + */ + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorSeverityEnum.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorSeverityEnum.java new file mode 100644 index 0000000..5908fda --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorSeverityEnum.java @@ -0,0 +1,27 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.logging.format; + +public enum ErrorSeverityEnum { + INFO, + WARN, + ERROR, + FATAL, +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorTypeEnum.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorTypeEnum.java new file mode 100644 index 0000000..8ce2d4d --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/format/ErrorTypeEnum.java @@ -0,0 +1,29 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.logging.format; + +public enum ErrorTypeEnum { + RECOVERY, + CONFIG_ERROR, + SYSTEM_ERROR, + DATA_ERROR, + CONNECTION_PROBLEM, + AUTHENTICATION_PROBLEM +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/logic/EELFLoggerDelegate.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/logic/EELFLoggerDelegate.java new file mode 100644 index 0000000..7cf5ee4 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/logging/logic/EELFLoggerDelegate.java @@ -0,0 +1,323 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.logging.logic; + +import static com.att.eelf.configuration.Configuration.MDC_ALERT_SEVERITY; +import static com.att.eelf.configuration.Configuration.MDC_INSTANCE_UUID; +import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID; +import static com.att.eelf.configuration.Configuration.MDC_SERVER_FQDN; +import static com.att.eelf.configuration.Configuration.MDC_SERVER_IP_ADDRESS; +import static com.att.eelf.configuration.Configuration.MDC_SERVICE_INSTANCE_ID; +import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME; + +import java.net.InetAddress; +import java.text.MessageFormat; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +import javax.servlet.http.HttpServletRequest; + +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum; +import org.openecomp.portalsdk.core.logging.format.AppMessagesEnum; +import org.openecomp.portalsdk.core.logging.format.ErrorSeverityEnum; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.slf4j.MDC; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.att.eelf.configuration.SLF4jWrapper; + +public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { + + public static EELFLogger errorLogger = EELFManager.getInstance().getErrorLogger(); + public static EELFLogger applicationLogger = EELFManager.getInstance().getApplicationLogger(); + public static EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); + public static EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); + public static EELFLogger debugLogger = EELFManager.getInstance().getDebugLogger(); + private String className; + private static ConcurrentMap classMap = new ConcurrentHashMap(); + + public EELFLoggerDelegate(String _className) { + super(_className); + className = _className; + } + + public static EELFLoggerDelegate getLogger(Class clazz) { + + String className = clazz.getName(); + EELFLoggerDelegate delegate = classMap.get(className); + if (delegate == null) { + delegate = new EELFLoggerDelegate(className); + classMap.put(className, delegate); + } + + return delegate; + + } + + public static EELFLoggerDelegate getLogger(String className) { + if (className==null || className=="") { + className = EELFLoggerDelegate.class.getName(); + } + EELFLoggerDelegate delegate = classMap.get(className); + if (delegate == null) { + delegate = new EELFLoggerDelegate(className); + classMap.put(className, delegate); + } + + return delegate; + } + + public void debug(EELFLogger logger, String msg) { + if (logger.isDebugEnabled()) { + MDC.put(SystemProperties.MDC_CLASS_NAME, className); + logger.debug(msg); + MDC.remove(SystemProperties.MDC_CLASS_NAME); + } + } + + public void debug(EELFLogger logger, String msg, Object... arguments) { + if (logger.isDebugEnabled()) { + MDC.put(SystemProperties.MDC_CLASS_NAME, className); + logger.debug(msg, arguments); + MDC.remove(SystemProperties.MDC_CLASS_NAME); + } + } + + public void debug(EELFLogger logger, String msg, Throwable th) { + if (logger.isDebugEnabled()) { + MDC.put(SystemProperties.MDC_CLASS_NAME, className); + logger.debug(msg, th); + MDC.remove(SystemProperties.MDC_CLASS_NAME); + } + } + + // does not solve the superfluous overhead of string append + public void info(EELFLogger logger, String msg) { + MDC.put(SystemProperties.MDC_CLASS_NAME, className); + logger.info(msg); + MDC.remove(SystemProperties.MDC_CLASS_NAME); + } + + public void info(EELFLogger logger, String msg, Object... arguments) { + MDC.put(SystemProperties.MDC_CLASS_NAME, className); + logger.info(msg, arguments); + MDC.remove(SystemProperties.MDC_CLASS_NAME); + } + + public void info(EELFLogger logger, String msg, Throwable th) { + MDC.put(SystemProperties.MDC_CLASS_NAME, className); + logger.info(msg, th); + MDC.remove(SystemProperties.MDC_CLASS_NAME); + } + + public void warn(EELFLogger logger, String msg) { + MDC.put(SystemProperties.MDC_CLASS_NAME, className); + logger.warn(msg); + MDC.remove(SystemProperties.MDC_CLASS_NAME); + } + + public void warn(EELFLogger logger, String msg, Object... arguments) { + MDC.put(SystemProperties.MDC_CLASS_NAME, className); + logger.warn(msg, arguments); + MDC.remove(SystemProperties.MDC_CLASS_NAME); + } + + public void warn(EELFLogger logger, String msg, Throwable th) { + MDC.put(SystemProperties.MDC_CLASS_NAME, className); + logger.warn(msg, th); + MDC.remove(SystemProperties.MDC_CLASS_NAME); + } + + public void error(EELFLogger logger, String msg) { + MDC.put(SystemProperties.MDC_CLASS_NAME, className); + logger.error(msg); + MDC.remove(SystemProperties.MDC_CLASS_NAME); + } + + public void error(EELFLogger logger, String msg, Object... arguments) { + MDC.put(SystemProperties.MDC_CLASS_NAME, className); + logger.warn(msg, arguments); + MDC.remove(SystemProperties.MDC_CLASS_NAME); + } + + public void error(EELFLogger logger, String msg, Throwable th) { + MDC.put(SystemProperties.MDC_CLASS_NAME, className); + logger.warn(msg, th); + MDC.remove(SystemProperties.MDC_CLASS_NAME); + } + + public void error(EELFLogger logger, String msg, AlarmSeverityEnum severtiy) { + MDC.put(MDC_ALERT_SEVERITY, severtiy.name()); + MDC.put(SystemProperties.MDC_CLASS_NAME, className); + logger.error(msg); + MDC.remove(MDC_ALERT_SEVERITY); + MDC.remove(SystemProperties.MDC_CLASS_NAME); + } + + public void init() { + // Initialize the logger context + setGlobalLoggingContext(); + + String msg = "############################ Logging is started. ############################"; + info(applicationLogger, msg); + error(errorLogger, msg); + info(auditLogger, msg); + info(metricsLogger, msg); + debug(debugLogger, msg); + info(errorLogger, "Successfully initialized the Global logger context."); + } + + public void logEcompError(AppMessagesEnum epMessageEnum, String... param) { + try { + AlarmSeverityEnum alarmSeverityEnum = epMessageEnum.getAlarmSeverity(); + ErrorSeverityEnum errorSeverityEnum = epMessageEnum.getErrorSeverity(); + + MDC.put(MDC_ALERT_SEVERITY, alarmSeverityEnum.name()); + MDC.put("ErrorCode", epMessageEnum.getErrorCode()); + MDC.put("ErrorDescription", epMessageEnum.getErrorDescription()); + + String resolution = this.formatMessage(epMessageEnum.getDetails() + " " + epMessageEnum.getResolution(), (Object[]) param); + if (errorSeverityEnum == ErrorSeverityEnum.WARN) { + errorLogger.warn(resolution); + } else if(errorSeverityEnum == ErrorSeverityEnum.INFO) { + errorLogger.info(resolution); + } else { + errorLogger.error(resolution); + } + } catch(Exception e) { + errorLogger.error("Failed to log the error code. Details: " + UserUtils.getStackTrace(e)); + } finally { + MDC.remove("ErrorCode"); + MDC.remove("ErrorDescription"); + MDC.remove(MDC_ALERT_SEVERITY); + } + } + + private String formatMessage(String message, Object...args) { + StringBuilder sbFormattedMessage = new StringBuilder(); + if (args!=null && args.length>0 && message!=null && message != "") { + MessageFormat mf = new MessageFormat(message); + sbFormattedMessage.append(mf.format(args)); + } else { + sbFormattedMessage.append(message); + } + + return sbFormattedMessage.toString(); + } + + /** + * Loads all the default logging fields into the MDC context. + */ + private void setGlobalLoggingContext() { + MDC.put(MDC_SERVICE_INSTANCE_ID, ""); + MDC.put(MDC_ALERT_SEVERITY, AlarmSeverityEnum.INFORMATIONAL.toString()); + try { + MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName()); + MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress()); + MDC.put(MDC_INSTANCE_UUID, SystemProperties.getProperty(SystemProperties.INSTANCE_UUID)); + } catch (Exception e) { + } + } + + public static void mdcPut(String key, String value) { + MDC.put(key, value); + } + + public static String mdcGet(String key) { + return MDC.get(key); + } + + public static void mdcRemove(String key) { + MDC.remove(key); + } + + /** + * Loads the RequestId/TransactionId into the MDC which it should be receiving + * with an each incoming REST API request. Also, configures few other request + * based logging fields into the MDC context. + * @param req + */ + public void setRequestBasedDefaultsIntoGlobalLoggingContext(HttpServletRequest req, String appName) { + //Load the default fields + setGlobalLoggingContext(); + + //Load the request based fields + if (req!=null) { + //Load the Request into MDC context. + String requestId = UserUtils.getRequestId(req); + MDC.put(MDC_KEY_REQUEST_ID, requestId); + + //Load user agent into MDC context, if available. + String accessingClient = "Unknown"; + accessingClient = req.getHeader(SystemProperties.USERAGENT_NAME); + if (accessingClient!=null && accessingClient!="" && + (accessingClient.contains("Mozilla") || accessingClient.contains("Chrome") || accessingClient.contains("Safari"))) { + accessingClient = appName + "_FE"; + } + MDC.put(SystemProperties.PARTNER_NAME, accessingClient); + + //Protocol, Rest URL & Rest Path + String restURL = ""; + MDC.put(SystemProperties.FULL_URL, SystemProperties.UNKNOWN); + MDC.put(SystemProperties.PROTOCOL, SystemProperties.HTTP); + restURL = UserUtils.getFullURL(req); + if (restURL!=null && restURL!="") { + MDC.put(SystemProperties.FULL_URL, restURL); + if (restURL.toLowerCase().contains("https")) { + MDC.put(SystemProperties.PROTOCOL, SystemProperties.HTTPS); + } + } + + //Rest Path + MDC.put(MDC_SERVICE_NAME, req.getServletPath()); + + //Client IPAddress i.e. IPAddress of the remote host who is making this request. + String clientIPAddress = ""; + clientIPAddress = req.getHeader("X-FORWARDED-FOR"); + if (clientIPAddress == null) { + clientIPAddress = req.getRemoteAddr(); + } + MDC.put(SystemProperties.CLIENT_IP_ADDRESS, clientIPAddress); + + //Load loginId into MDC context. + MDC.put(SystemProperties.MDC_LOGIN_ID, "Unknown"); + String loginId = ""; + try { + loginId = UserUtils.getUserIdFromCookie(req); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (loginId == null || loginId == "") { + User user = UserUtils.getUserSession(req); + if (user != null) { + loginId = user.getLoginId(); + } + } + + if (loginId!=null && loginId!="") { + MDC.put(SystemProperties.MDC_LOGIN_ID, loginId); + } + } + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/menu/MenuBuilder.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/menu/MenuBuilder.java new file mode 100644 index 0000000..aac5702 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/menu/MenuBuilder.java @@ -0,0 +1,164 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.menu; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; + +import org.openecomp.portalsdk.core.FusionObject; +import org.openecomp.portalsdk.core.domain.MenuData; +import org.openecomp.portalsdk.core.service.DataAccessService; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.springframework.beans.factory.annotation.Autowired; + +@SuppressWarnings("rawtypes") +public class MenuBuilder implements FusionObject { + + @Autowired + private DataAccessService dataAccessService; + + public MenuBuilder() { + } + + + @SuppressWarnings("unchecked") + public Set getMenu(String menuSetName, DataAccessService dataAccessService) { + + Set menu = null; + MenuData root = null; + + HashMap params = new HashMap(); + + params.put("menu_set_cd", menuSetName); + + // execute a query of the latest configuration of the FN_MENU table for the given menu_set_cd. + List menuItems = dataAccessService.executeNamedQuery(SystemProperties.getProperty(SystemProperties.MENU_QUERY_NAME), params, null); + + Iterator i = menuItems.iterator(); + if (i.hasNext()) { + root = (MenuData)i.next(); + menu = root.getChildMenus(); + } + + return menu; + } + + @SuppressWarnings("unchecked") + public Set getMenu(String menuSetName) { + + Set menu = null; + MenuData root = null; + + HashMap params = new HashMap(); + + params.put("menu_set_cd", menuSetName); + + // execute a query of the latest configuration of the FN_MENU table for the given menu_set_cd. + List menuItems = getDataAccessService().executeNamedQuery(SystemProperties.getProperty(SystemProperties.MENU_QUERY_NAME), params, null); + + Iterator i = menuItems.iterator(); + if (i.hasNext()) { + root = (MenuData)i.next(); + menu = root.getChildMenus(); + } + + return menu; + } + + public static Set filterMenu(Set menus, HttpServletRequest request) { + Iterator j = menus.iterator(); + + while (j.hasNext()) { + MenuData menuItem = (MenuData)j.next(); + + if (!UserUtils.isAccessible(request, menuItem.getFunctionCd())) { + // remove the menu if the user doesn't have access to it + j.remove(); + } + else { + // if an accessible menu has a child menu, let's filter that recursively + + Set childMenus = menuItem.getChildMenus(); + if (childMenus != null && childMenus.size() > 0) { + filterMenu(childMenus, request); + } + + } + } + + return menus; + } + + + public static String getUrlHtml(MenuData menuData) { + String html = ""; + + if (menuData.getExternalUrl() != null && menuData.getExternalUrl().length() > 0) { + html = menuData.getExternalUrl(); + } + else if (menuData.getServlet() != null && menuData.getServlet().length() > 0) { + html = "/" + menuData.getServlet(); + } + else if (menuData.getAction() != null && menuData.getAction().length() > 0) { + html = "/" + menuData.getAction(); + } + + return html; + } + + + public static String getTargetHtml(MenuData menuData) { + String html = ""; + + if (menuData.getTarget() != null && menuData.getTarget().length() > 0) { + html = "target=\"" + menuData.getTarget() + "\""; + } + + return html; + } + + + public static String getQueryStringHtml(MenuData menuData) { + String html = ""; + + if (menuData.getQueryString() != null && menuData.getQueryString().length() > 0) { + html = "?" + menuData.getQueryString(); + } + + return html; + } + + public DataAccessService getDataAccessService() { + return dataAccessService; + } + + + public void setDataAccessService(DataAccessService dataAccessService) { + this.dataAccessService = dataAccessService; + } + +} + + diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/menu/MenuProperties.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/menu/MenuProperties.java new file mode 100644 index 0000000..007a7f3 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/menu/MenuProperties.java @@ -0,0 +1,114 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.menu; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Properties; + +import javax.servlet.ServletContext; + +import org.openecomp.portalsdk.core.util.SystemProperties; + + +/* + MenuProperties contains a list of constants used during the creation, + privilege screening, and rendering of the application menu. +*/ +public class MenuProperties { + private MenuProperties() { + // cannot instantiate + } + + @SuppressWarnings("rawtypes") + private static HashMap menuProperties = new HashMap(); + + // keys used to reference values in the menu.properties file + public static final String WIDTH = "width"; + public static final String LEFT_POSITION = "left_position"; + public static final String TOP_POSITION = "top_position"; + public static final String FONT_COLOR = "font_color"; + public static final String MOUSEOVER_FONT_COLOR = "mouseover_font_color"; + public static final String BACKGROUND_COLOR = "background_color"; + public static final String MOUSEOVER_BACKGROUND_COLOR = "mouseover_background_color"; + public static final String BORDER_COLOR = "border_color"; + public static final String SEPARATOR_COLOR = "separator_color"; + public static final String IMAGE_SRC = "image_src"; + public static final String IMAGE_SRC_LEFT = "image_src_left"; + public static final String IMAGE_SRC_OVER = "image_src_over"; + public static final String IMAGE_SRC_LEFT_OVER = "image_src_left_over"; + public static final String EVALUATE_UPON_TREE_SHOW = "evaluate_upon_tree_show"; + public static final String EVALUATE_UPON_TREE_HIDE = "evaluate_upon_tree_hide"; + public static final String TOP_IS_PERMANENT = "top_is_permanent"; + public static final String TOP_IS_HORIZONTAL = "top_is_horizontal"; + public static final String TREE_IS_HORIZONTAL = "tree_is_horizontal"; + public static final String POSITION_UNDER = "position_under"; + public static final String TOP_MORE_IMAGES_VISIBLE = "top_more_images_visible"; + public static final String TREE_MORE_IMAGES_VISIBLE = "tree_more_images_visible"; + public static final String RIGHT_TO_LEFT = "right_to_left"; + public static final String DISPLAY_ON_CLICK = "display_on_click"; + public static final String TOP_IS_VARIABLE_WIDTH = "top_is_variable_width"; + public static final String TREE_IS_VARIABLE_WIDTH = "tree_is_variable_width"; + public static final String TOP_KEEP_IN_WINDOW_X = "top_keep_in_window_x"; + public static final String TOP_KEEP_IN_WINDOW_Y = "top_keep_in_window_y"; + public static final String MENU_ID_ADMIN = "menu_id_admin"; + public static final String MENU_ID_LOGOUT = "menu_id_logout"; + public static final String MENU_FRAME = "menu_frame"; + public static final String MAIN_FRAME = "main_frame"; + public static final String NESTED_MAIN_FRAME = "nested_main_frame"; + public static final String ROLE_FUNCTIONS_TAG = "role_functions_tag"; + + public static final String MAX_DISPLAYABLE_ADMIN_MENU_SORT_ORDER = "max_displayable_admin_menu_sort_order"; + public static final String MENU_PROPERTIES_FILENAME_KEY = "menu_properties_filename"; + public static final String DEFAULT_SERVLET_NAME = "dispatcher"; + public static final String DEFAULT_TARGET = "_self"; + + public static final String TOP_MENU_CLASS = "top_menu_class"; + public static final String TOP_MENU_LINK_CLASS = "top_menu_link_class"; + + public static final String ON_MOUSE_OUT_TRAILER = "on_mouse_out_trailer"; + public static final String ON_MOUSE_OVER_TRAILER = "on_mouse_over_trailer"; + public static final String ON_CLICK_TRAILER = "on_click_trailer"; + + public static final String MENU_ID_PREFIX = "menu_id_prefix"; + + + @SuppressWarnings("unchecked") +public static void loadFromFile(ServletContext servletContext, String filename, String menuSetName) throws IOException { + Properties p = new Properties(); + + if (filename == null) { + filename = SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_PROPERTIES_NAME); + } + + p.load(servletContext.getResourceAsStream(SystemProperties.getProperty(SystemProperties.MENU_PROPERTIES_FILE_LOCATION) + filename)); + menuProperties.put(menuSetName, p); + } // loadMenuProperties + + public static String getProperty(String key) { + return getProperty(key, SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_SET_NAME)); + } + + public static String getProperty(String key, String menuSetName) { + Properties p = (Properties)menuProperties.get(menuSetName); + return p.getProperty(key); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/AbstractCacheManager.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/AbstractCacheManager.java new file mode 100644 index 0000000..6fb56d9 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/AbstractCacheManager.java @@ -0,0 +1,60 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.objectcache; + +import java.io.IOException; + +import org.openecomp.portalsdk.core.objectcache.support.FusionCacheManager; + + +public abstract class AbstractCacheManager implements FusionCacheManager { + public AbstractCacheManager() { + super(); + // TODO Auto-generated constructor stub + } + + public Object getObject(String key) { + // TODO Auto-generated method stub + return null; + } + + public void putObject(String key, Object objectToCache) { + // TODO Auto-generated method stub + } + + public boolean isObjectInCache(String key) { + // TODO Auto-generated method stub + return false; + } + + public void removeObject(String key) { + // TODO Auto-generated method stub + } + + public void clearCache() { + // TODO Auto-generated method stub + } + + public void configure() throws IOException { + // TODO Auto-generated method stub + + } +} + diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/jcs/JCSCacheEventHandler.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/jcs/JCSCacheEventHandler.java new file mode 100644 index 0000000..0695876 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/jcs/JCSCacheEventHandler.java @@ -0,0 +1,60 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.objectcache.jcs; + +import org.apache.jcs.engine.control.event.behavior.IElementEvent; +import org.apache.jcs.engine.control.event.behavior.IElementEventConstants; +import org.apache.jcs.engine.control.event.behavior.IElementEventHandler; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; + +public class JCSCacheEventHandler implements IElementEventHandler, IElementEventConstants { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(JCSCacheEventHandler.class); + + public JCSCacheEventHandler() { + super(); + } + + public void handleElementEvent(IElementEvent event) { + // Handle code for various event notifications on cached elements by JCS. + switch (event.getElementEvent()) { + case ELEMENT_EVENT_EXCEEDED_MAXLIFE_BACKGROUND: + logger.error(EELFLoggerDelegate.errorLogger, "Event ELEMENT_EVENT_EXCEEDED_MAXLIFE_BACKGROUND occurred for element " + event); + break; + case ELEMENT_EVENT_EXCEEDED_MAXLIFE_ONREQUEST: + logger.error(EELFLoggerDelegate.errorLogger, "Event ELEMENT_EVENT_EXCEEDED_MAXLIFE_ONREQUEST occurred for element " + event); + break; + case ELEMENT_EVENT_EXCEEDED_IDLETIME_BACKGROUND: + logger.error(EELFLoggerDelegate.errorLogger, "Event ELEMENT_EVENT_EXCEEDED_IDLETIME_BACKGROUND occurred for element " + event); + break; + case ELEMENT_EVENT_EXCEEDED_IDLETIME_ONREQUEST: + logger.error(EELFLoggerDelegate.errorLogger, "Event ELEMENT_EVENT_EXCEEDED_IDLETIME_ONREQUEST occurred for element " + event); + break; + case ELEMENT_EVENT_SPOOLED_DISK_AVAILABLE: + logger.error(EELFLoggerDelegate.errorLogger, "Event ELEMENT_EVENT_SPOOLED_DISK_AVAILABLE occurred for element " + event); + break; + case ELEMENT_EVENT_SPOOLED_DISK_NOT_AVAILABLE: + logger.error(EELFLoggerDelegate.errorLogger, "Event ELEMENT_EVENT_SPOOLED_DISK_NOT_AVAILABLE occurred for element " + event); + break; + case ELEMENT_EVENT_SPOOLED_NOT_ALLOWED: + logger.error(EELFLoggerDelegate.errorLogger, "Event ELEMENT_EVENT_SPOOLED_NOT_ALLOWED occurred for element " + event); + } + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/jcs/JCSCacheManager.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/jcs/JCSCacheManager.java new file mode 100644 index 0000000..39b3f0c --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/jcs/JCSCacheManager.java @@ -0,0 +1,186 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.objectcache.jcs; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; +import java.util.Vector; + +import javax.annotation.PostConstruct; +import javax.servlet.ServletContext; + +import org.apache.jcs.JCS; +import org.apache.jcs.access.exception.CacheException; +import org.apache.jcs.engine.CacheConstants; +import org.apache.jcs.engine.behavior.IElementAttributes; +import org.apache.jcs.engine.control.CompositeCacheManager; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager; +import org.openecomp.portalsdk.core.service.DataAccessService; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.springframework.web.context.ServletContextAware; + +public abstract class JCSCacheManager extends AbstractCacheManager implements CacheConstants, ServletContextAware { + + public static String LOOKUP_OBJECT_CACHE_NAME = "lookUpObjectCache"; + public static String JCS_CONFIG_FILE_PATH = "cache_config_file_path"; + public static String CACHE_LOAD_ON_STARTUP = "cache_load_on_startup"; + public static String CACHE_PROPERTY_VALUE_TRUE = "true"; + public static String CACHE_CONTROL_SWITCH_ON = "1"; + public static String CACHE_CONTROL_SWITCH_OFF = "0"; + public static String CACHE_CONTROL_SWITCH = "cache_switch"; + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(JCSCacheManager.class); + + private static JCS lookUpCache; + private ServletContext servletContext; + + private Properties cacheConfigProperties = null; + private final Vector jscManagedCacheList = new Vector(); + + private DataAccessService dataAccessService; + + public JCSCacheManager() { + super(); + jscManagedCacheList.add(LOOKUP_OBJECT_CACHE_NAME); + } + + @PostConstruct + public void configure() throws IOException { + super.configure(); + + String jcsConfigFilePath = SystemProperties.getProperty(JCS_CONFIG_FILE_PATH); + // getProperty throws if the key is missing; but check anyhow. + if (jcsConfigFilePath == null || jcsConfigFilePath.length() == 0) + throw new IOException("configure: failed to get value for config property " + JCS_CONFIG_FILE_PATH); + InputStream jcsConfigInputStream = getServletContext().getResourceAsStream(jcsConfigFilePath); + if (jcsConfigInputStream == null) + throw new IOException("configure: failed to open stream for config property " + JCS_CONFIG_FILE_PATH + + " with name " + jcsConfigFilePath); + logger.debug(EELFLoggerDelegate.debugLogger, + "configure: loading cache properties from classpath resource {} ", jcsConfigFilePath); + Properties p = new Properties(); + p.load(jcsConfigInputStream); + jcsConfigInputStream.close(); + + CompositeCacheManager ccm = CompositeCacheManager.getUnconfiguredInstance(); + ccm.configure(p); + setCacheConfigProperties(p); + + try { + initializeLookUpCache(); + } catch (CacheException ce) { + throw new IOException("configure: failed to initialize lookup cache", ce); + } + + } + + private void initializeLookUpCache() throws CacheException { + lookUpCache = JCS.getInstance(LOOKUP_OBJECT_CACHE_NAME); + + JCSCacheEventHandler eventHandler = new JCSCacheEventHandler(); + IElementAttributes elementAttributes = lookUpCache.getDefaultElementAttributes(); + + elementAttributes.addElementEventHandler(eventHandler); + + lookUpCache.setDefaultElementAttributes(elementAttributes); + + if (CACHE_PROPERTY_VALUE_TRUE.equalsIgnoreCase(SystemProperties.getProperty(CACHE_LOAD_ON_STARTUP))) { + loadDataOnStartUp(); + } + } + + public Object getObject(String key) { + if (CACHE_CONTROL_SWITCH_ON.equalsIgnoreCase(SystemProperties.getProperty(CACHE_CONTROL_SWITCH))) { + if (lookUpCache == null) + return null; + else + return lookUpCache.get(key); + } else + return null; + } + + public void putObject(String key, Object objectToCache) { + try { + if (CACHE_CONTROL_SWITCH_ON.equalsIgnoreCase(SystemProperties.getProperty(CACHE_CONTROL_SWITCH))) { + if (lookUpCache != null) { + lookUpCache.put(key, objectToCache); + } + } + } catch (CacheException ce) { + logger.error(EELFLoggerDelegate.errorLogger, "putObject: failed to put the object with key " + key, ce); + } + } + + public void clearCache(String region) { + try { + if (region.equals(LOOKUP_OBJECT_CACHE_NAME)) + lookUpCache.clear(); + } catch (CacheException ce) { + logger.error(EELFLoggerDelegate.errorLogger, + "clearCache: failed to clear the cache for the region " + region, ce); + } + } + + public void clearCache() { + clearCache(LOOKUP_OBJECT_CACHE_NAME); + } + + private void loadDataOnStartUp() { + loadLookUpCache(); + } + + public abstract void loadLookUpCache(); + + public void refreshLookUpCache() { + clearCache(LOOKUP_OBJECT_CACHE_NAME); + loadLookUpCache(); + } + + public Properties getCacheConfigProperties() { + return cacheConfigProperties; + } + + public void setCacheConfigProperties(Properties cacheConfigProperties) { + this.cacheConfigProperties = cacheConfigProperties; + } + + public Vector getJscManagedCacheList() { + return jscManagedCacheList; + } + + public DataAccessService getDataAccessService() { + return dataAccessService; + } + + public void setDataAccessService(DataAccessService dataAccessService) { + this.dataAccessService = dataAccessService; + } + + public ServletContext getServletContext() { + return servletContext; + } + + public void setServletContext(ServletContext servletContext) { + this.servletContext = servletContext; + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/support/FusionCacheManager.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/support/FusionCacheManager.java new file mode 100644 index 0000000..01cc9ce --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/objectcache/support/FusionCacheManager.java @@ -0,0 +1,36 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.objectcache.support; + +import java.io.IOException; + +import org.openecomp.portalsdk.core.FusionObject; + +public interface FusionCacheManager extends FusionObject { + + Object getObject(String key); + void putObject(String key, Object objectToCache); + boolean isObjectInCache(String key); + + void removeObject(String key); + void clearCache(); + void configure() throws IOException; +} + diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/client/AppContextManager.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/client/AppContextManager.java new file mode 100644 index 0000000..0e56445 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/client/AppContextManager.java @@ -0,0 +1,45 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.onboarding.client; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +/** + * + * + * Use this class to get access to ApplicationContext for classes who were not created by Spring. + */ + + +@Component +public class AppContextManager implements ApplicationContextAware{ + private static ApplicationContext _appCtx; + + @Override + public void setApplicationContext(ApplicationContext ctx){ + _appCtx = ctx; + } + + public static ApplicationContext getAppContext(){ + return _appCtx; + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/client/OnBoardingApiServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/client/OnBoardingApiServiceImpl.java new file mode 100644 index 0000000..1d71afd --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/client/OnBoardingApiServiceImpl.java @@ -0,0 +1,316 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.onboarding.client; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; + +import javax.servlet.http.HttpServletRequest; + +import org.openecomp.portalsdk.core.domain.Role; +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.domain.UserApp; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.onboarding.crossapi.IPortalRestAPIService; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalAPIException; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalTimeoutHandler; +import org.openecomp.portalsdk.core.restful.domain.EcompRole; +import org.openecomp.portalsdk.core.restful.domain.EcompUser; +import org.openecomp.portalsdk.core.service.RoleService; +import org.openecomp.portalsdk.core.service.UserProfileService; +import org.openecomp.portalsdk.core.service.WebServiceCallService; +import org.openecomp.portalsdk.core.util.JSONUtil; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.slf4j.MDC; +import org.springframework.context.ApplicationContext; + +/** + * Implements the REST API interface to answer requests made by Portal app about + * users and active sessions. + * + * Since an instance of this class will be instantiated by the OnBoarding + * servlet from the ecompFW library, we cannot use Spring injections here. This + * 'injection' is done indirectly using AppContextManager class. + * + + */ +@SuppressWarnings("rawtypes") +public class OnBoardingApiServiceImpl implements IPortalRestAPIService { + RoleService roleService; + UserProfileService userProfileService; + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(OnBoardingApiServiceImpl.class); + + public OnBoardingApiServiceImpl() { + // Defend against null-pointer exception during server startup + // that was caused by a spurious Spring annotation on this class. + ApplicationContext appContext = AppContextManager.getAppContext(); + if (appContext == null) + throw new RuntimeException("OnBoardingApiServiceImpl ctor failed to get appContext"); + roleService = appContext.getBean(RoleService.class); + userProfileService = appContext.getBean(UserProfileService.class); + } + + private void setCurrentAttributes(User user, EcompUser userJson) { + + user.setEmail(userJson.getEmail()); + user.setFirstName(userJson.getFirstName()); + user.setHrid(userJson.getHrid()); + user.setJobTitle(userJson.getJobTitle()); + user.setLastName(userJson.getLastName()); + user.setLoginId(userJson.getLoginId()); + user.setOrgManagerUserId(userJson.getOrgManagerUserId()); + user.setMiddleInitial(userJson.getMiddleInitial()); + user.setOrgCode(userJson.getOrgCode()); + user.setOrgId(userJson.getOrgId()); + user.setPhone(userJson.getPhone()); + user.setOrgUserId(userJson.getOrgUserId()); + user.setActive(userJson.isActive()); + // user.setRoles(new TreeSet(userJson.getRoles())); + } + + @Override + public void pushUser(EcompUser userJson) throws PortalAPIException { + + if (logger.isDebugEnabled()) + logger.debug(EELFLoggerDelegate.debugLogger, "pushUser was invoked: " + userJson); + User user = new User(); + String response = ""; + try { + // Set input attributes to the object obout to be saved + setCurrentAttributes(user, userJson); + user.setRoles(new TreeSet()); + user.setUserApps(new TreeSet()); + user.setPseudoRoles(new TreeSet()); + userProfileService.saveUser(user); + logger.debug(EELFLoggerDelegate.debugLogger, "push user success."); + response = "push user success."; + response = JSONUtil.convertResponseToJSON(response); + } catch (Exception e) { + response = "OnboardingApiService.pushUser failed"; + logger.error(EELFLoggerDelegate.errorLogger, response, e); + throw new PortalAPIException(response, e); + } finally { + MDC.remove(SystemProperties.MDC_TIMER); + } + } + + @Override + public void editUser(String loginId, EcompUser userJson) throws PortalAPIException { + + if (logger.isDebugEnabled()) + logger.debug(EELFLoggerDelegate.debugLogger, "OnboardingApi editUser was invoked with loginID " + loginId + ", JSON: " + userJson); + User editUser = new User(); + String response = ""; + try { + setCurrentAttributes(editUser, userJson); + if (editUser.getOrgUserId() != null) { + editUser.setLoginId(editUser.getOrgUserId()); + } + User domainUser = userProfileService.getUserByLoginId(loginId); + if (domainUser != null) + domainUser = JSONUtil.mapToDomainUser(domainUser, editUser); + else + domainUser = editUser; + userProfileService.saveUser(domainUser); + logger.debug(EELFLoggerDelegate.debugLogger, "edit user success."); + response = "edit user success."; + response = JSONUtil.convertResponseToJSON(response); + } catch (Exception e) { + response = "OnboardingApiService.editUser failed"; + logger.error(EELFLoggerDelegate.errorLogger, response, e); + throw new PortalAPIException(response, e); + } finally { + MDC.remove(SystemProperties.MDC_TIMER); + } + + // return response; + } + + @Override + public EcompUser getUser(String loginId) throws PortalAPIException { + try { + if (logger.isDebugEnabled()) + logger.debug(EELFLoggerDelegate.debugLogger, "## REST API ## loginId: " + loginId); + User user = userProfileService.getUserByLoginId(loginId); + if (user == null) { + logger.info(EELFLoggerDelegate.debugLogger, "User + " + loginId + " doesn't exist"); + return null; + // Unforunately, Portal is not ready to accept proper error + // response yet .. + // commenting throw clauses until portal is ready + // throw new PortalAPIException("User + " + loginId + " doesn't + // exist"); + } else + return UserUtils.convertToEcompUser(user); + } catch (Exception e) { + String response = "OnboardingApiService.getUser failed"; + logger.error(EELFLoggerDelegate.errorLogger, response, e); + return null; + // Unforunately, Portal is not ready to accept proper error response + // yet .. commenting throw clauses until portal is ready + // throw new PortalAPIException(response, e); + } + + } + + @Override + public List getUsers() throws PortalAPIException { + try { + List users = userProfileService.findAllActive(); + List ecompUsers = new ArrayList(); + for (User user : users) + ecompUsers.add(UserUtils.convertToEcompUser(user)); + return ecompUsers; + } catch (Exception e) { + String response = "OnboardingApiService.getUsers failed"; + logger.error(EELFLoggerDelegate.errorLogger, response, e); + throw new PortalAPIException(response, e); + } + } + + @Override + public List getAvailableRoles() throws PortalAPIException { + try { + List roles = roleService.getActiveRoles(); + List ecompRoles = new ArrayList(); + for (Role role : roles) + ecompRoles.add(UserUtils.convertToEcompRole(role)); + return ecompRoles; + } catch (Exception e) { + String response = "OnboardingApiService.getAvailableRoles failed"; + logger.error(EELFLoggerDelegate.errorLogger, response, e); + throw new PortalAPIException(response, e); + } + } + + @Override + public void pushUserRole(String loginId, List rolesJson) throws PortalAPIException { + String response = ""; + try { + logger.debug(EELFLoggerDelegate.debugLogger, "## REST API ## loginId: " + loginId); + logger.debug(EELFLoggerDelegate.debugLogger, "## REST API ## rolesJson: " + rolesJson); + User user = userProfileService.getUserByLoginId(loginId); + /* + * List ecompRoles = mapper.readValue(rolesJson, + * TypeFactory.defaultInstance().constructCollectionType(List.class, + * EcompRole.class)); + */ + SortedSet roles = new TreeSet(); + for (EcompRole role : rolesJson) { + roles.add(roleService.getRole(role.getId())); + } + // Replace existing roles with new ones + replaceExistingRoles(roles, user); + + logger.debug(EELFLoggerDelegate.debugLogger, "push user role success."); + response = "push user role success."; + response = JSONUtil.convertResponseToJSON(response); + + } catch (Exception e) { + response = "OnboardingApiService.pushUserRole failed"; + logger.error(EELFLoggerDelegate.errorLogger, response, e); + throw new PortalAPIException(response, e); + } finally { + MDC.remove(SystemProperties.MDC_TIMER); + } + + } + + @Override + public List getUserRoles(String loginId) throws PortalAPIException { + if (logger.isDebugEnabled()) + logger.debug(EELFLoggerDelegate.debugLogger, "## REST API ## loginId: " + loginId); + List ecompRoles = new ArrayList(); + try { + User user = userProfileService.getUserByLoginId(loginId); + SortedSet currentRoles = null; + if (user != null) { + currentRoles = user.getRoles(); + if (currentRoles != null) + for (Role role : currentRoles) + ecompRoles.add(UserUtils.convertToEcompRole(role)); + } + return ecompRoles; + } catch (Exception e) { + String response = "OnboardingApiService.getUserRoles failed"; + logger.error(EELFLoggerDelegate.errorLogger, response, e); + throw new PortalAPIException(response, e); + } + } + + @SuppressWarnings("unchecked") + private void replaceExistingRoles(SortedSet roles, User user) { + // 1. remove existing roles + Set userApps = user.getUserApps(); + Iterator appsItr = userApps.iterator(); + while (appsItr.hasNext()) { + UserApp tempUserApp = (UserApp) appsItr.next(); + boolean roleFound = false; + for (Role role : roles) { + if (tempUserApp.getRole().getId().equals(role.getId())) { + roleFound = true; + break; + } + } + if (!roleFound) + appsItr.remove(); + } + user.setUserApps(userApps); + userProfileService.saveUser(user); + + // 2. add new roles + user.setRoles(roles); + userProfileService.saveUser(user); + } + + @Override + public boolean isAppAuthenticated(HttpServletRequest request) throws PortalAPIException { + WebServiceCallService securityService = AppContextManager.getAppContext().getBean(WebServiceCallService.class); + try { + String appUser = request.getHeader("username"); + String password = request.getHeader("password"); + // System.out.println("username = " + appUser); + // System.out.println("password = " + password); + boolean flag = securityService.verifyRESTCredential(null, appUser, password); + // System.out.println("username = " + appUser); + // System.out.println("password = " + password); + return flag; + + } catch (Exception e) { + String response = "OnboardingApiService.isAppAuthenticated failed"; + logger.error(EELFLoggerDelegate.errorLogger, response, e); + throw new PortalAPIException(response, e); + } + } + + public String getSessionTimeOuts() throws Exception { + return PortalTimeoutHandler.gatherSessionExtensions(); + } + + public void updateSessionTimeOuts(String sessionMap) throws Exception { + PortalTimeoutHandler.updateSessionExtensions(sessionMap); + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/session/TestClass.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/session/TestClass.java new file mode 100644 index 0000000..6bbf8c1 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/session/TestClass.java @@ -0,0 +1,24 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.onboarding.session; + +public class TestClass { + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/sso/TestClass.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/sso/TestClass.java new file mode 100644 index 0000000..ccd903a --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/onboarding/sso/TestClass.java @@ -0,0 +1,24 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.onboarding.sso; + +public class TestClass { + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/HttpStatusAndResponse.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/HttpStatusAndResponse.java new file mode 100644 index 0000000..a824223 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/HttpStatusAndResponse.java @@ -0,0 +1,42 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.restful.client; + +/** + * Holds the status code and body that result from accessing an HTTP URL. + */ +public class HttpStatusAndResponse { + + private int statusCode; + private String response; + + public HttpStatusAndResponse(int status, String resp) { + this.statusCode = status; + this.response = resp; + } + + public int getStatusCode() { + return statusCode; + } + + public String getResponse() { + return response; + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/PortalRestClientBase.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/PortalRestClientBase.java new file mode 100644 index 0000000..a7c517e --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/PortalRestClientBase.java @@ -0,0 +1,171 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.restful.client; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.http.Consts; +import org.apache.http.HttpEntity; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.openecomp.portalsdk.core.domain.App; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties; +import org.openecomp.portalsdk.core.service.AppService; +import org.openecomp.portalsdk.core.util.CipherUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * Provides a basic client to access a REST endpoint at the Portal via get or + * post. Usage caveats: + *
    + *
  1. Must be auto-wired by Spring, because this in turn auto-wires a + * data-access service to read application credentials from the FN_APP table. + *
  2. If HTTP access is used and the server uses a self-signed certificate, the + * local trust store must be extended appropriately. The HTTP client throws + * exceptions if the JVM cannot validate the server certificate. + *
+ */ +@Component +public class PortalRestClientBase { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PortalRestClientBase.class); + + @Autowired + AppService appService; + + /** + * Constructs and sends a GET request for the URI, with REST application + * credentials in the header as the Portal expects. + * + * @param uri + * URI of the service + * @return Result of the get; null if an error happens + * @throws URISyntaxException + * @throws IOException + * @throws ClientProtocolException + */ + public HttpStatusAndResponse getRestWithCredentials(final URI uri) throws Exception { + + String uebKey = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY); + App app = appService.getDefaultApp(); + if (uebKey == null || app == null || app.getUsername() == null || app.getAppPassword() == null) + throw new Exception("Missing one or more required properties and/or database entries"); + String decryptedPassword = CipherUtil.decrypt(app.getAppPassword()); + CloseableHttpClient httpClient = HttpClients.createDefault(); + HttpGet httpGet = new HttpGet(uri); + httpGet.setHeader("uebkey", uebKey); + httpGet.setHeader("username", app.getUsername()); + httpGet.setHeader("password", decryptedPassword); + + String responseJson = null; + CloseableHttpResponse response = null; + try { + logger.info(EELFLoggerDelegate.debugLogger, "GET from " + uri); + response = httpClient.execute(httpGet); + logger.info(EELFLoggerDelegate.debugLogger, "Status is " + response.getStatusLine()); + if (response.getStatusLine().getStatusCode() != HttpServletResponse.SC_OK) + logger.info(EELFLoggerDelegate.debugLogger, "Status is " + response.getStatusLine().toString()); + HttpEntity entity = response.getEntity(); + if (entity == null) { + logger.info(EELFLoggerDelegate.debugLogger, "Entity is null!"); + } else { + // entity content length is never set. + // this naively tries to read everything. + responseJson = EntityUtils.toString(entity); + logger.info(EELFLoggerDelegate.debugLogger, responseJson); + EntityUtils.consume(entity); + } + } finally { + if (response != null) + response.close(); + } + if (response == null) + return null; + return new HttpStatusAndResponse(response.getStatusLine().getStatusCode(), responseJson); + } + + /** + * Constructs and sends a POST request using the specified body, with REST + * application credentials in the header as the Portal expects. + * + * @param uri + * REST endpoint + * @param json + * Content to post + * @return Result of the post; null if an error happens + * @throws Exception + */ + public HttpStatusAndResponse postRestWithCredentials(final URI uri, final String json) throws Exception { + + String uebKey = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY); + App app = appService.getDefaultApp(); + if (uebKey == null || app == null || app.getUsername() == null || app.getAppPassword() == null) + throw new Exception("Missing one or more required properties and/or database entries"); + + CloseableHttpClient httpClient = HttpClients.createDefault(); + HttpPost httpPost = new HttpPost(uri); + httpPost.setHeader("uebkey", uebKey); + httpPost.setHeader("username", app.getUsername()); + httpPost.setHeader("password", app.getAppPassword()); + + StringEntity postEntity = new StringEntity(json, ContentType.create("application/json", Consts.UTF_8)); + httpPost.setEntity(postEntity); + + String responseJson = null; + CloseableHttpResponse response = null; + try { + logger.info(EELFLoggerDelegate.debugLogger, "POST to " + uri); + response = httpClient.execute(httpPost); + logger.info(EELFLoggerDelegate.debugLogger, "Status is " + response.getStatusLine()); + if (response.getStatusLine().getStatusCode() != HttpServletResponse.SC_OK) + throw new Exception("Status is " + response.getStatusLine().toString()); + + HttpEntity entity = response.getEntity(); + if (entity == null) { + logger.info(EELFLoggerDelegate.debugLogger, "Entity is null!"); + } else { + // entity content length is never set. + // this naively tries to read everything. + responseJson = EntityUtils.toString(entity); + logger.info(EELFLoggerDelegate.debugLogger, responseJson); + EntityUtils.consume(entity); + } + } finally { + if (response != null) + response.close(); + } + return new HttpStatusAndResponse(response.getStatusLine().getStatusCode(), responseJson); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/SharedContextRestClient.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/SharedContextRestClient.java new file mode 100644 index 0000000..f017a7d --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/restful/client/SharedContextRestClient.java @@ -0,0 +1,330 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.restful.client; + +import java.net.URI; +import java.util.HashMap; +import java.util.List; + +import org.apache.http.client.utils.URIBuilder; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties; +import org.openecomp.portalsdk.core.restful.domain.SharedContext; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * Provides convenience methods to use the shared-context service at Portal. + * This hides all JSON; instead it accepts and returns Java objects. + * Usage caveats (repeated from superclass): + *
    + *
  1. Must be auto-wired by Spring, because this in turn auto-wires a data + * access service to read application credentials from the FN_APP table. + *
  2. If HTTP access is used and the server uses a self-signed certificate, the + * local trust store must be extended appropriately. The HTTP client throws + * exceptions if the JVM cannot validate the server certificate. + *
+ */ +@Component +public class SharedContextRestClient extends PortalRestClientBase { + + @Autowired + SystemProperties systemProperties; + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SharedContextRestClient.class); + + /** + * Reusable JSON (de)serializer + */ + private final ObjectMapper mapper = new ObjectMapper(); + + /** + * Gets the shared-context value for the specified context ID and key. + * + * @param contextId + * An Ecomp Portal session ID + * @param key + * Key for the shared-context entry; e.g., "lastName" + * @return SharedContext object; null if not found. + * @throws Exception + */ + public SharedContext getContextValue(String contextId, String key) throws Exception { + HttpStatusAndResponse hsr = getContext("get", contextId, key); + logger.info(EELFLoggerDelegate.debugLogger, "getSharedContext: resp is " + hsr); + if (hsr == null) { + logger.error(EELFLoggerDelegate.applicationLogger, "getContextValue: unexpected null response"); + return null; + } + SharedContext jsonObj = null; + try { + jsonObj = mapper.readValue(hsr.getResponse(), SharedContext.class); + } catch (JsonMappingException ex) { + logger.error(EELFLoggerDelegate.applicationLogger, "getContextValue: failed to map response onto object" + ex.getMessage()); + } catch (JsonParseException ex) { + logger.info(EELFLoggerDelegate.applicationLogger, "getContextValue: failed to parse response" + ex.getMessage()); + } + if (jsonObj != null && jsonObj.getResponse() != null) + return null; + return jsonObj; + } + + /** + * Gets user information for the specified context ID. + * + * @param contextId + * An Ecomp Portal session ID + * @return List of SharedContext objects corresponding to the following + * keys: USER_FIRST_NAME, USER_LAST_NAME, USER_EMAIL and + * USER_ORGUSERID; empty if none were found; null if an error happens. + * @throws Exception + */ + public List getUserContext(String contextId) throws Exception { + HttpStatusAndResponse hsr = getContext("get_user", contextId, null); + logger.info(EELFLoggerDelegate.debugLogger, "getUserContext: resp is " + hsr); + if (hsr == null) { + logger.error(EELFLoggerDelegate.applicationLogger, "getUserContext: unexpected null response"); + return null; + } + List jsonList = null; + try { + TypeReference> typeRef = new TypeReference>() { + }; + jsonList = mapper.readValue(hsr.getResponse(), typeRef); + } catch (JsonMappingException ex) { + logger.error(EELFLoggerDelegate.applicationLogger, "getUserContext: failed to map response onto object" + ex.getMessage()); + } catch (JsonParseException ex) { + logger.error(EELFLoggerDelegate.applicationLogger, "getUserContext: failed to parse response" + ex.getMessage()); + } + return jsonList; + } + + /** + * Checks whether a shared-context entry exists for the specified context ID + * and key. + * + * @param contextId + * An Ecomp Portal session ID + * @param key + * Key for the shared-context entry; e.g., "lastName" + * @return True if the object exists, false otherwise; null on error. + * @throws Exception + */ + public Boolean checkSharedContext(String contextId, String key) throws Exception { + HttpStatusAndResponse hsr = getContext("check", contextId, key); + logger.info(EELFLoggerDelegate.debugLogger, "checkSharedContext: resp is " + hsr); + if (hsr == null) { + logger.error(EELFLoggerDelegate.applicationLogger, "checkSharedContext: unexpected null response"); + return null; + } + String response = null; + try { + SharedContext jsonObj = mapper.readValue(hsr.getResponse(), SharedContext.class); + response = jsonObj.getResponse(); + } catch (JsonMappingException ex) { + logger.error(EELFLoggerDelegate.applicationLogger, "checkSharedContext: failed to map response onto object" + ex.getMessage()); + } catch (JsonParseException ex) { + logger.error(EELFLoggerDelegate.applicationLogger, "checkSharedContext: failed to parse response" + ex.getMessage()); + } + if (response == null) + return null; + return ("exists".equals(response)); + } + + /** + * Removes a shared-context entry with the specified context ID and key. + * + * @param contextId + * An Ecomp Portal session ID + * @param key + * Key for the shared-context entry; e.g., "lastName" + * @return True if the entry was removed, false otherwise; null on error. + * @throws Exception + */ + public Boolean removeSharedContext(String contextId, String key) throws Exception { + HttpStatusAndResponse hsr = getContext("remove", contextId, key); + logger.info(EELFLoggerDelegate.debugLogger, "removeSharedContext: resp is " + hsr); + if (hsr == null) { + logger.error(EELFLoggerDelegate.applicationLogger, "removeSharedContext: unexpected null response"); + return null; + } + SharedContext jsonObj = null; + try { + jsonObj = mapper.readValue(hsr.getResponse(), SharedContext.class); + } catch (JsonMappingException ex) { + logger.error(EELFLoggerDelegate.applicationLogger, "removeSharedContext: failed to map response onto object" + ex.getMessage()); + } catch (JsonParseException ex) { + logger.error(EELFLoggerDelegate.applicationLogger, "removeSharedContext: failed to parse response" + ex.getMessage()); + } + if (jsonObj == null) + return null; + String response = jsonObj.getResponse(); + return ("removed".equals(response)); + } + + /** + * Clears the shared context for the specified context ID; i.e., removes all + * key-value pairs. + * + * @param contextId + * An Ecomp Portal session ID + * @return Number of key-value pairs removed; -1 if not found or any + * problems occur. + * @throws Exception + */ + public int clearSharedContext(String contextId) throws Exception { + HttpStatusAndResponse hsr = getContext("remove", contextId, null); + logger.info(EELFLoggerDelegate.debugLogger, "clearSharedContext: resp is " + hsr); + if (hsr == null) { + logger.error(EELFLoggerDelegate.applicationLogger, "clearSharedContext: unexpected null response"); + return -1; + } + SharedContext jsonObj = null; + try { + jsonObj = mapper.readValue(hsr.getResponse(), SharedContext.class); + } catch (JsonMappingException ex) { + logger.error(EELFLoggerDelegate.applicationLogger, "clearSharedContext: failed to map response onto object" + ex.getMessage()); + } catch (JsonParseException ex) { + logger.error(EELFLoggerDelegate.applicationLogger, "clearSharedContext: failed to parse response" + ex.getMessage()); + } + if (jsonObj == null) + return -1; + String response = jsonObj.getResponse(); + if (response == null) + return -1; + return Integer.parseInt(response); + } + + /** + * Creates a shared-context entry. + * + * @param contextId + * An Ecomp Portal session ID + * @param key + * Key for the shared-context entry; e.g., "lastName" + * @param value + * Value for the entry + * @throws Exception + * @return True if the object previously existed, false otherwise; null if + * any problem happened. + */ + public Boolean setSharedContext(String contextId, String key, String value) throws Exception { + String body = buildContext(contextId, key, value); + HttpStatusAndResponse hsr = postContext("set", body); + logger.info(EELFLoggerDelegate.debugLogger, "setSharedContext: resp is " + hsr); + if (hsr == null) { + logger.error(EELFLoggerDelegate.applicationLogger, "setSharedContext: unexpected null response"); + return null; + } + SharedContext jsonObj = null; + try { + jsonObj = mapper.readValue(hsr.getResponse(), SharedContext.class); + } catch (JsonMappingException ex) { + logger.error(EELFLoggerDelegate.applicationLogger, "setSharedContext: failed to map response onto object" + ex.getMessage()); + } catch (JsonParseException ex) { + logger.error(EELFLoggerDelegate.applicationLogger, "setSharedContext: failed to parse response" + ex.getMessage()); + } + if (jsonObj == null) + return null; + String response = jsonObj.getResponse(); + return ("replaced".equals(response)); + } + + /** + * Builds the full URL with the specified parameters, then calls the method + * that adds credentials and GETs. + * + * @param requestPath + * @param contextId + * @param contextKey + * @return HttpStatusAndResponse object; may be null. + * @throws Exception + */ + @SuppressWarnings("unused") + private HttpStatusAndResponse getContext(String requestPath, String contextId, String contextKey) throws Exception{ + String restUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REST_URL); + String portalDomain = restUrl.substring(0, restUrl.lastIndexOf('/')); + String contextRestUrl = portalDomain + "/context"; + if (contextRestUrl == null) + throw new Exception("getContext: failed to get property " + SystemProperties.ECOMP_SHARED_CONTEXT_REST_URL); + URIBuilder uriBuilder = new URIBuilder(contextRestUrl + "/" + requestPath); + uriBuilder.addParameter("context_id", contextId); + if (contextKey != null) + uriBuilder.addParameter("ckey", contextKey); + final URI uri = uriBuilder.build(); + return getRestWithCredentials(uri); + } + + /** + * Builds the full URL, then calls the method that adds credentials and + * POSTs. + * + * @param requestPath + * @param contextId + * @param contextKey + * @return HttpStatusAndResponse object; may be null. + * @throws Exception + */ + private HttpStatusAndResponse postContext(String requestPath, String json) throws Exception { + String contextRestUrl = SystemProperties.getProperty(SystemProperties.ECOMP_SHARED_CONTEXT_REST_URL); + if (contextRestUrl == null) + throw new Exception("postContext: failed to get property " + SystemProperties.ECOMP_SHARED_CONTEXT_REST_URL); + URIBuilder uriBuilder = new URIBuilder(contextRestUrl + "/" + requestPath); + URI uri = uriBuilder.build(); + return postRestWithCredentials(uri, json); + } + + /** + * Builds a JSON block with a single shared-context entry. + * + * @param cxid + * Context ID + * @param ckey + * Context Key + * @param cvalue + * Context value + * @return JSON block + */ + private String buildContext(String cxid, String ckey, String cvalue) throws JsonProcessingException { + ObjectMapper mapper = new ObjectMapper(); + HashMap stringMap = new HashMap(); + stringMap.put("context_id", cxid); + stringMap.put("ckey", ckey); + stringMap.put("cvalue", cvalue); + String json = mapper.writeValueAsString(stringMap); + return json; + } + + // Simple test scaffold + public static void main(String[] args) throws Exception { + + SharedContextRestClient client = new SharedContextRestClient(); + SharedContext get = client.getContextValue("abc", "123"); + System.out.println("Get yields " + get.toString()); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/CoreRegister.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/CoreRegister.java new file mode 100644 index 0000000..5f81308 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/CoreRegister.java @@ -0,0 +1,95 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.scheduler; + +import java.util.ArrayList; +import java.util.List; + +import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.quartz.CronTrigger; +import org.quartz.Trigger; +import org.springframework.context.annotation.DependsOn; +import org.springframework.stereotype.Component; + +@Component +@DependsOn({"systemProperties"}) +public class CoreRegister { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CoreRegister.class); + Trigger trigger[] = new Trigger[1]; + + + + //@Autowired + //private SessionMgtRegistry sessionMgtRegistry; + + protected List scheduleTriggers = new ArrayList(); + + + public void registerTriggers() { + // we can use this method to add any schedules to the core + + /* + try { + if(SystemProperties.getProperty(SystemProperties.SESSIONTIMEOUT_FEED_CRON) != null) + getScheduleTriggers().add(sessionMgtRegistry.getTrigger()); + + } catch(IllegalStateException ies) { + logger.info("Session Timout Cron not available"); + } + */ + + } + + protected void addTrigger(final String cron, final CronTrigger cronRegistryTrigger) { + // if the property value is not available; the cron will not be added and can be ignored. its safe to ignore the exceptions + + try { + + if(SystemProperties.getProperty(cron) != null) { + getScheduleTriggers().add(cronRegistryTrigger); + } + + } catch(IllegalStateException ies) { + logger.error(EELFLoggerDelegate.errorLogger, "Log Cron not available", AlarmSeverityEnum.MAJOR); + } + } + + + + + public List getScheduleTriggers() { + return scheduleTriggers; + } + + + + public void setScheduleTriggers(List scheduleTriggers) { + this.scheduleTriggers = scheduleTriggers; + } + + + + + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/CronRegistry.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/CronRegistry.java new file mode 100644 index 0000000..fdfda98 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/CronRegistry.java @@ -0,0 +1,124 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.scheduler; + +import java.text.ParseException; +import java.util.Map; + +import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.quartz.CronTrigger; +import org.springframework.scheduling.quartz.CronTriggerFactoryBean; +import org.springframework.scheduling.quartz.JobDetailFactoryBean; +import org.springframework.scheduling.quartz.QuartzJobBean; + +import com.mchange.v2.c3p0.ComboPooledDataSource; + +public abstract class CronRegistry { + + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CronRegistry.class); + protected JobDetailFactoryBean jobDetailFactory; + protected CronTriggerFactoryBean cronTriggerFactory; + + private ComboPooledDataSource dataSource; + + public CronRegistry() { + try { + jobDetailFactoryBean(); + cronTriggerFactoryBean(); + } + catch(Exception e) { + logger.error(EELFLoggerDelegate.debugLogger, e.getMessage()); + } + } + + //@Autowired + public CronRegistry(ComboPooledDataSource dataSource) { + try { + this.dataSource = dataSource; + jobDetailFactoryBean(); + cronTriggerFactoryBean(); + } + catch(Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AlarmSeverityEnum.MAJOR); + } + } + + //@Autowired + public CronRegistry(Object... initializeObjects) { + try { + initializeObjects(initializeObjects); + jobDetailFactoryBean(); + cronTriggerFactoryBean(); + } + catch(Exception e) { + logger.info(EELFLoggerDelegate.errorLogger, e.getMessage()); + } + } + + protected void initializeObjects(Object... initializeObjects) { + } + + public abstract JobDetailFactoryBean jobDetailFactoryBean() throws ParseException; + + protected JobDetailFactoryBean jobDetailFactoryBean(String groupName, String jobName, + Class jobClass, Map map) { + + jobDetailFactory = new JobDetailFactoryBean(); + jobDetailFactory.setJobClass(jobClass); + jobDetailFactory.setJobDataAsMap(map); + jobDetailFactory.setGroup(groupName); + jobDetailFactory.setName(jobName); + jobDetailFactory.afterPropertiesSet(); + + return jobDetailFactory; + } + + public abstract CronTriggerFactoryBean cronTriggerFactoryBean() throws ParseException; + + protected CronTriggerFactoryBean cronTriggerFactoryBean(String groupName, String triggerName, String cronExpression) throws ParseException { + cronTriggerFactory = new CronTriggerFactoryBean(); + cronTriggerFactory.setJobDetail(jobDetailFactory.getObject()); + cronTriggerFactory.setStartDelay(3000); + cronTriggerFactory.setName(triggerName); + cronTriggerFactory.setGroup(groupName); + logger.info(EELFLoggerDelegate.applicationLogger, triggerName + " Scheduled: " + cronExpression); + cronTriggerFactory.setCronExpression( cronExpression); //"0 * * * * ? *" + cronTriggerFactory.afterPropertiesSet(); + return cronTriggerFactory; + } + + public CronTrigger getTrigger() { + return cronTriggerFactory.getObject(); + } + + + public void setDataSource(ComboPooledDataSource dataSource) { + this.dataSource = dataSource; + } + + + public ComboPooledDataSource getDataSource() { + return dataSource; + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/Registerable.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/Registerable.java new file mode 100644 index 0000000..e2e4c38 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/scheduler/Registerable.java @@ -0,0 +1,30 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.scheduler; + +import org.quartz.Trigger; + +public interface Registerable { + + public void registerTriggers(); + + public Trigger[] getTriggers(); + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppService.java new file mode 100644 index 0000000..55180fd --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppService.java @@ -0,0 +1,61 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.List; + +import org.openecomp.portalsdk.core.domain.App; + +/** + * Defines methods to fetch App domain objects. + * + * Very thin interface; Portal defines a much richer interface. + */ +public interface AppService { + + /** + * Gets all apps defined in the table. + * + * @return List of apps. + */ + List getApps(); + + /** + * Gets the app with the specified ID. + * + * @param appId + * @return App with the specified ID. + */ + App getApp(Long appId); + + /** + * Gets the singleton entry - applications should have exactly 1 row in the + * FN_APP table. + */ + App getDefaultApp(); + + /** + * Fetches the application name once from database + * and keep refers to the same name later on as required. + * @return Default Application Name + */ + String getDefaultAppName(); + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppServiceImpl.java new file mode 100644 index 0000000..30e566a --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppServiceImpl.java @@ -0,0 +1,106 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.List; + +import org.openecomp.portalsdk.core.domain.App; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service("appService") +@Transactional +public class AppServiceImpl implements AppService{ + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppServiceImpl.class); + + @Autowired + private DataAccessService dataAccessService; + + /** + * Loads the appName once from database and + * keep refers to it as required. + */ + private static String defaultAppName = ""; + + /* + * (non-Javadoc) + * @see org.openecomp.portalsdk.core.service.AppService#getApps() + */ + @SuppressWarnings("unchecked") + @Override + public List getApps() { + return getDataAccessService().getList(App.class, null); + } + + /* + * (non-Javadoc) + * @see org.openecomp.portalsdk.core.service.AppService#getApp(long) + */ + @Override + public App getApp(Long appId) { + return (App)getDataAccessService().getDomainObject(App.class, appId, null); + } + + /* + * (non-Javadoc) + * @see org.openecomp.portalsdk.core.service.AppService#getApp() + */ + @Override + public App getDefaultApp() { + return getApp(1L); + } + + /** + * Gets the data access service. + * @return DataAccessService + */ + public DataAccessService getDataAccessService() { + return dataAccessService; + } + + /** + * Sets the data access service. + * @param dataAccessService + */ + public void setDataAccessService(DataAccessService dataAccessService) { + this.dataAccessService = dataAccessService; + } + + /** + * Fetches the application name once from database + * and keep refers to the same name later on as required. + * @return Default Application Name + */ + @Override + public String getDefaultAppName() { + if (AppServiceImpl.defaultAppName==null || AppServiceImpl.defaultAppName=="") { + App app = getApp(1L); + if (app!=null) { + AppServiceImpl.defaultAppName = app.getName(); + } else { + logger.warn(EELFLoggerDelegate.errorLogger, ("Unable to locate the app information from the database.")); + } + } + return AppServiceImpl.defaultAppName; + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditService.java new file mode 100644 index 0000000..b632c92 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditService.java @@ -0,0 +1,36 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.HashMap; + +import org.openecomp.portalsdk.core.domain.AuditLog; + +public interface AuditService { + /** + * + * Update log data in database + * + * @param auditLog + * @param additionalParams + */ + @SuppressWarnings("rawtypes") + void logActivity(AuditLog auditLog, HashMap additionalParams); +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditServiceImpl.java new file mode 100644 index 0000000..8fbd550 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditServiceImpl.java @@ -0,0 +1,50 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.HashMap; + +import org.openecomp.portalsdk.core.domain.AuditLog; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service("auditService") +@Transactional +public class AuditServiceImpl implements AuditService { + public AuditServiceImpl() {} + + @Autowired + private DataAccessService dataAccessService; + + @SuppressWarnings("rawtypes") + public void logActivity(AuditLog auditLog, HashMap additionalParams) { + getDataAccessService().saveDomainObject(auditLog, additionalParams); + } + + public DataAccessService getDataAccessService() { + return dataAccessService; + } + + public void setDataAccessService(DataAccessService dataAccessService) { + this.dataAccessService = dataAccessService; + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastService.java new file mode 100644 index 0000000..8d60e74 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastService.java @@ -0,0 +1,37 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.HashMap; +import java.util.Hashtable; + +import javax.servlet.http.HttpServletRequest; + +import org.openecomp.portalsdk.core.domain.BroadcastMessage; + +@SuppressWarnings("rawtypes") +public interface BroadcastService { + HashMap getBcModel(HttpServletRequest request); + Hashtable getBroadcastMessages(); + void loadMessages(); + BroadcastMessage getBroadcastMessage(HttpServletRequest request); + void saveBroadcastMessage(BroadcastMessage broadcastMessage); + void removeBroadcastMessage(BroadcastMessage broadcastMessage); +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastServiceImpl.java new file mode 100644 index 0000000..def1c1a --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastServiceImpl.java @@ -0,0 +1,248 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.Calendar; +import java.util.Collections; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +import javax.servlet.http.HttpServletRequest; + +import org.openecomp.portalsdk.core.domain.BroadcastMessage; +import org.openecomp.portalsdk.core.domain.Lookup; +import org.openecomp.portalsdk.core.service.support.FusionService; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.web.support.AppUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.ServletRequestBindingException; +import org.springframework.web.bind.ServletRequestUtils; + +@SuppressWarnings("rawtypes") +@Service("broadcastService") +@Transactional +public class BroadcastServiceImpl extends FusionService implements BroadcastService { + + public BroadcastServiceImpl() { + } + + @Autowired + private DataAccessService dataAccessService; + private static Hashtable broadcastMessages = new Hashtable(); + + @SuppressWarnings("unchecked") + public void loadMessages() { + List messageLocations = AppUtils.getLookupListNoCache("fn_lu_message_location", "message_location_id", "message_location_descr", "", "message_location_id"); + + for (int i=0; i < messageLocations.size(); i++) { + Lookup location = (Lookup)messageLocations.get(i); + String locationId = location.getValue(); + + broadcastMessages.put(locationId, getPersistedBroadcastMessages(locationId)); + } + } + + @SuppressWarnings("unchecked") + public HashMap getBcModel(HttpServletRequest request){ + HashMap bcModel = new HashMap(); + + List items = null; + int messageId = ServletRequestUtils.getIntParameter(request, "message_id", 0); + String task = ServletRequestUtils.getStringParameter(request, "task", "get"); + + // delete or toggle activation on the selected record (if applicable) + if (messageId != 0 && (task.equals("delete") || task.equals("toggleActive"))) { + BroadcastMessage message = (BroadcastMessage)getDataAccessService().getDomainObject(BroadcastMessage.class, new Long(messageId), null); + + if (task.equals("delete")) { + getDataAccessService().deleteDomainObject(message, null); + } + else if (task.equals("toggleActive")) { + HashMap additionalParams = new HashMap(); + additionalParams.put(Parameters.PARAM_HTTP_REQUEST, request); + + message.setActive(new Boolean(!message.getActive().booleanValue())); + getDataAccessService().saveDomainObject(message, additionalParams); + } + loadMessages(); + } + + items = getDataAccessService().getList(BroadcastMessage.class, null); + Collections.sort(items); + bcModel.put("messagesList", packageMessages(items)); + + List locations = AppUtils.getLookupList("fn_lu_message_location", "message_location_id", "message_location_descr", "", "message_location_id"); + bcModel.put("messageLocations", locations); + + if ("true".equals(SystemProperties.getProperty(SystemProperties.CLUSTERED))) { + List sites = AppUtils.getLookupList("fn_lu_broadcast_site", "broadcast_site_cd", "broadcast_site_descr", "", "broadcast_site_descr"); + bcModel.put("broadcastSites", sites); + } + + return bcModel; + } + + @SuppressWarnings("unchecked") + private HashMap packageMessages(List messages) { + HashMap messagesList = new HashMap(); + Set locationMessages = null; + + Integer previousLocationId = null; + + for (int i=0; i < messages.size(); i++) { + BroadcastMessage message = (BroadcastMessage)messages.get(i); + + if (!message.getLocationId().equals(previousLocationId)) { + if (previousLocationId != null) { + messagesList.put(previousLocationId.toString(), locationMessages); + } + + locationMessages = new TreeSet(); + previousLocationId = message.getLocationId(); + } + + locationMessages.add(message); + } + + if (previousLocationId != null) { + messagesList.put(previousLocationId.toString(), locationMessages); + } + + return messagesList; + } + + + @SuppressWarnings("unchecked") + private List getPersistedBroadcastMessages(String locationId) { + + HashMap params = new HashMap(); + params.put("location_id", new Integer(locationId)); + Calendar calInstanceToday = Calendar.getInstance(); + calInstanceToday.set(Calendar.HOUR, 0); + calInstanceToday.set(Calendar.MINUTE, 0); + calInstanceToday.set(Calendar.SECOND, 0); + params.put("today_date", calInstanceToday.getTime()); + + return getDataAccessService().executeNamedQuery("broadcastMessages", params, null); + } + + public Hashtable getBroadcastMessages() { + return broadcastMessages; + } + + public static List getBroadcastMessages(String locationId) { + return (List)broadcastMessages.get(locationId); + } + + public static String displayMessages(String locationId) { + return displayServerMessages(locationId, null); + } + + public static String displayServerMessages(String locationId, String siteCd) { + StringBuffer html = new StringBuffer(); + + List messages = getBroadcastMessages(locationId); + + for (int i=0; i < messages.size(); i++) { + BroadcastMessage message = (BroadcastMessage)messages.get(i); + + if ((message.getSiteCd() == null) || ((message.getSiteCd() != null) && message.getSiteCd().equals(siteCd))) { + html.append("
  • ") + .append(message.getMessageText()); + } + } + + if (html.length() > 0) { + html.insert(0, "
      "); + html.append("
    "); + } + + return html.toString(); + } + + public static boolean hasMessages(String locationId) { + return hasServerMessages(locationId, null); + } + + public static boolean hasServerMessages(String locationId, String siteCd) { + List messages = getBroadcastMessages(locationId); + + boolean messagesExist = !((messages == null) || messages.size() == 0); + + if (siteCd == null) { + return messagesExist; + } + else { + for (int i=0; i < messages.size(); i++) { + BroadcastMessage message = (BroadcastMessage)messages.get(i); + + if ((message.getSiteCd() == null) || message.getSiteCd().equals(siteCd)) { + return true; + } + } + return false; + } + } + + public DataAccessService getDataAccessService() { + return dataAccessService; + } + + public void setDataAccessService(DataAccessService dataAccessService) { + this.dataAccessService = dataAccessService; + } + + public BroadcastMessage getBroadcastMessage(HttpServletRequest request) { + long messageId = ServletRequestUtils.getLongParameter(request, "message_id", 0); + + BroadcastMessage message = new BroadcastMessage(); + if(messageId!=0) + message = (BroadcastMessage)getDataAccessService().getDomainObject(BroadcastMessage.class, new Long(messageId), null); + + if (message.getLocationId() == null) { + try { + message.setLocationId(new Integer(ServletRequestUtils.getStringParameter(request, "message_location_id"))); + } catch (NumberFormatException e) { + e.printStackTrace(); + } catch (ServletRequestBindingException e) { + e.printStackTrace(); + } + message.setActive(Boolean.TRUE); + } + + return message; + } + + @Override + public void saveBroadcastMessage(BroadcastMessage broadcastMessage) { + dataAccessService.saveDomainObject(broadcastMessage, null); + } + + @Override + public void removeBroadcastMessage(BroadcastMessage broadcastMessage) { + dataAccessService.deleteDomainObject(broadcastMessage, null); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessService.java new file mode 100644 index 0000000..26892b8 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessService.java @@ -0,0 +1,80 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.FetchMode; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.ProjectionList; +import org.openecomp.portalsdk.core.domain.support.DomainVo; + +@SuppressWarnings("rawtypes") +public interface DataAccessService { + + // generic view, save, delete methods + DomainVo getDomainObject(Class domainClass, Serializable id, HashMap additionalParams); + void deleteDomainObject(DomainVo domainObject, HashMap additionalParams); + void deleteDomainObjects(Class domainClass, String whereClause, HashMap additionalParams); + void saveDomainObject(DomainVo domainObject, HashMap additionalParams); + + // generic get list method(s) + List getList(Class domainClass, HashMap additionalParams); + List getList(Class domainClass, String filter, String orderBy, HashMap additionalParams); + List getList(Class domainClass, String filter, int fromIndex, int toIndex, String orderBy, HashMap additionalParams); + List getList(Class domainClass, ProjectionList projectionsList , List restrictionsList , List orderByList); + public List getList(Class domainClass, ProjectionList projectionsList, List restrictionsList, List orderByList,HashMap fetchModeMap); + + List getLookupList(String dbTable, String dbValueCol, String dbLabelCol, String dbFilter, String dbOrderBy, HashMap additionalParams); + + // generic native-SQL execution methods + List executeSQLQuery(String sql, Class domainClass, HashMap additionalParams); + List executeSQLQuery(String sql, Class domainClass, Integer fromIndex, Integer toIndex,HashMap additionalParams); + + // generic HQL execution methods + List executeQuery(String hql, HashMap additionalParams); + List executeQuery(String hql, Integer fromIndex, Integer toIndex, HashMap additionalParams); + + // generic named query execution methods + List executeNamedQuery(String queryName, Integer fromIndex, Integer toIndex, HashMap additionalParams); + List executeNamedQuery(String queryName, Map params, HashMap additionalParams); + List executeNamedQuery(String queryName, Map params, Integer fromIndex, Integer toIndex, HashMap additionalParams); + + //with Where Clause for RAPTOR ZK + List executeNamedQueryWithOrderBy(Class entity, String queryName, Map params, String _orderBy, boolean asc, Integer fromIndex, Integer toIndex, HashMap additionalParams); + List executeNamedCountQuery(Class entity, String queryName, String whereClause, Map params); + List executeNamedQuery(Class entity, String queryName, String whereClause, Map params, Integer fromIndex, Integer toIndex, HashMap additionalParams); + List executeNamedQueryWithOrderBy(Class entity, String queryName, String whereClause, Map params, String _orderBy, boolean asc, Integer fromIndex, Integer toIndex, HashMap additionalParams); + + // generic update query execution method + int executeUpdateQuery(String sql, HashMap additionalParams) throws RuntimeException; + + // generic named update query execution method + int executeNamedUpdateQuery(String queryName, Map params, HashMap additionalParams) throws RuntimeException; + + // synchronizes the local updates with the database (and vice versa) + void synchronize(HashMap additionalParams); + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessServiceImpl.java new file mode 100644 index 0000000..a4644b7 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessServiceImpl.java @@ -0,0 +1,592 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.io.Serializable; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.hibernate.Criteria; +import org.hibernate.FetchMode; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.ProjectionList; +import org.openecomp.portalsdk.core.domain.Lookup; +import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.service.support.FusionService; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +/** + * Provides implementations of methods in {@link DataAccessService}. + */ +@Transactional +public class DataAccessServiceImpl extends FusionService implements DataAccessService { + + @Autowired + private SessionFactory sessionFactory; + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(DataAccessServiceImpl.class); + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#getDomainObject(java.lang. + * Class, java.io.Serializable, java.util.HashMap) + */ + @Override + public DomainVo getDomainObject(Class domainClass, Serializable id, HashMap additionalParams) { + DomainVo vo = null; + Session session = sessionFactory.getCurrentSession(); + logger.info(EELFLoggerDelegate.debugLogger, "Getting " + domainClass.getName() + " record for id - " + id.toString()); + vo = (DomainVo) session.get(domainClass, id); + + if (vo == null) { + try { + vo = (DomainVo) domainClass.newInstance(); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "An error occured while instantiating a class of " + domainClass.getName() + e.getMessage()); + } + } + return vo; + } + + /* + * (non-Javadoc) + * + */ + @Override + public void deleteDomainObject(DomainVo domainObject, HashMap additionalParams) { + Session session = sessionFactory.getCurrentSession(); + session.delete(domainObject); + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#deleteDomainObjects(java. + * lang.Class, java.lang.String, java.util.HashMap) + */ + @Override + public void deleteDomainObjects(Class domainClass, String whereClause, HashMap additionalParams) { + Session session = sessionFactory.getCurrentSession(); + + StringBuffer sql = new StringBuffer("delete from "); + + sql.append(domainClass.getName()).append(" where ").append(whereClause); + + session.createQuery(sql.toString()).executeUpdate(); + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#saveDomainObject + */ + @Override + public void saveDomainObject(DomainVo vo, HashMap additionalParams) { + Integer userId = 1; + if (additionalParams != null) { + // look for a passed user id + // userId = (Integer)additionalParams.get(Parameters.PARAM_USERID); + Object uid = additionalParams.get(Parameters.PARAM_USERID); + if (uid instanceof Integer) { + userId = (Integer) uid; + } else if (uid instanceof Long) { + userId = ((Long) uid).intValue(); + } + // if (userId == null) { + // look for a passed request to get the user id from + // userId = new + // Integer(UserUtils.getUserId((HttpServletRequest)additionalParams.get(Parameters.PARAM_HTTP_REQUEST))); + // } + } + _update(vo, userId); + } + + /** + * Creates or updates the specified virtual object. Uses the specified user + * ID as the creator and modifier if a new object is created; uses ID only + * as modifier if an object already exists. + * + * @param vo + * @param userId + * Ignored if value is zero. + */ + protected final void _update(DomainVo vo, int userId) { + Date timestamp = new Date(); + + Session session = sessionFactory.getCurrentSession(); + + if (vo.getId() == null || vo.getId().intValue() == 0) { // add new + vo.setCreated(timestamp); + vo.setModified(timestamp); + + if (userId != 0 + && userId != Integer.parseInt(SystemProperties.getProperty(SystemProperties.APPLICATION_USER_ID))) { + vo.setCreatedId(new Long(userId)); + vo.setModifiedId(new Long(userId)); + } + } else { // update existing + vo.setModified(timestamp); + + if (userId != 0 + && userId != Integer.parseInt(SystemProperties.getProperty(SystemProperties.APPLICATION_USER_ID))) { + vo.setModifiedId(new Long(userId)); + } + } + + session.saveOrUpdate(vo); + } + + /** + * generic get list method + * + * @param domainClass + * @param filterClause + * @param fromIndex + * @param toIndex + * @param orderBy + * @return + */ + private List getListCommon(Class domainClass, String filterClause, Integer fromIndex, Integer toIndex, + String orderBy) { + List list = null; + String className = domainClass.getName(); + Session session = sessionFactory.getCurrentSession(); + + if (logger.isInfoEnabled()) { + logger.info(EELFLoggerDelegate.debugLogger, "Getting " + className.toLowerCase() + " records" + + ((fromIndex != null) ? " from rows " + fromIndex.toString() + " to " + toIndex.toString() : "") + + "..."); + if (filterClause != null && filterClause.length() > 0) + logger.info(EELFLoggerDelegate.debugLogger, "Filtering " + className + " by: " + filterClause); + } + + list = session.createQuery("from " + className + Utilities.nvl(filterClause, "") + + ((orderBy != null) ? " order by " + orderBy : "")).list(); + list = (fromIndex != null) ? list.subList(fromIndex.intValue() - 1, toIndex.intValue()) : list; + + if (orderBy == null && list != null) + Collections.sort(list); + + return list; + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#getList(java.lang.Class, + * java.util.HashMap) + */ + @Override + public List getList(Class domainClass, HashMap additionalParams) { + return getListCommon(domainClass, null, null, null, null); + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#getList(java.lang.Class, + * java.lang.String, java.lang.String, java.util.HashMap) + */ + @Override + public List getList(Class domainClass, String filter, String orderBy, HashMap additionalParams) { + return getListCommon(domainClass, filter, null, null, orderBy); + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#getList(java.lang.Class, + * java.lang.String, int, int, java.lang.String, java.util.HashMap) + */ + @Override + public List getList(Class domainClass, String filter, int fromIndex, int toIndex, String orderBy, + HashMap additionalParams) { + return getListCommon(domainClass, filter, new Integer(fromIndex), new Integer(toIndex), orderBy); + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#getList(java.lang.Class, + * org.hibernate.criterion.ProjectionList, java.util.List, java.util.List) + */ + @Override + public List getList(Class domainClass, ProjectionList projectionsList, List restrictionsList, + List orderByList) { + + Session session = sessionFactory.getCurrentSession(); + + Criteria criteria = session.createCriteria(domainClass); + + if (projectionsList != null) { + criteria.setProjection(projectionsList); + } + + if (restrictionsList != null && !restrictionsList.isEmpty()) { + for (Criterion criterion : restrictionsList) + criteria.add(criterion); + } + + if (orderByList != null && !orderByList.isEmpty()) { + for (Order order : orderByList) + criteria.addOrder(order); + } + /* + * if(fetchModeMap!=null){ Iterator itr = + * fetchModeMap.keySet().iterator(); String key=null; + * while(itr.hasNext()){ key = itr.next(); + * criteria.setFetchMode(key,fetchModeMap.get(key)); } } + */ + return criteria.list(); + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#getLookupList(java.lang. + * String, java.lang.String, java.lang.String, java.lang.String, + * java.lang.String, java.util.HashMap) + */ + @Override + public List getLookupList(String dbTable, String dbValueCol, String dbLabelCol, String dbFilter, String dbOrderBy, + HashMap additionalParams) { + if (logger.isInfoEnabled()) + logger.info(EELFLoggerDelegate.debugLogger, "Retrieving " + dbTable + " lookup list..."); + String dbOrderByCol = dbOrderBy; + + Session session = sessionFactory.getCurrentSession(); + + // default the orderBy if null; + if (Utilities.nvl(dbOrderBy).length() == 0) { + dbOrderByCol = dbLabelCol; + dbOrderBy = dbLabelCol; + } else { + if (dbOrderBy.lastIndexOf(" ") > -1) { + dbOrderByCol = dbOrderBy.substring(0, dbOrderBy.lastIndexOf(" ")); + } + } + + StringBuffer sql = new StringBuffer(); + + sql.append("select distinct ").append(dbLabelCol).append(" as lab, ").append(dbValueCol).append(" as val, ") + .append(dbOrderByCol).append(" as sortOrder ").append("from ").append(dbTable).append(" ") + .append((Utilities.nvl(dbFilter).length() == 0) ? "" : (" where " + dbFilter)).append(" order by ") + .append(dbOrderBy); + + List list = null; + try { + list = session.createSQLQuery(sql.toString()).addEntity(Lookup.class).list(); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.debugLogger, "Failed to create SQL lookup query for [" + sql + "]" + e.getMessage()); + } + return list; + } + + /* + * methods accepting a Map of additional params to passed to the DAO (for + * extensibility, just in case) + */ + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#executeSQLQuery(java.lang. + * String, java.lang.Class, java.util.HashMap) + */ + @Override + public List executeSQLQuery(String sql, Class domainClass, HashMap additionalParams) { + return executeSQLQuery(sql, domainClass, null, null, additionalParams); + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#executeSQLQuery(java.lang. + * String, java.lang.Class, java.lang.Integer, java.lang.Integer, + * java.util.HashMap) + */ + @Override + public List executeSQLQuery(String sql, Class domainClass, Integer fromIndex, Integer toIndex, + HashMap additionalParams) { + Session session = sessionFactory.getCurrentSession(); + + SQLQuery query = session.createSQLQuery(sql).addEntity(domainClass.getName().toLowerCase(), domainClass); + + if (fromIndex != null && toIndex != null) { + query.setFirstResult(fromIndex.intValue()); + int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1; + query.setMaxResults(pageSize); + } + + return query.list(); + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#executeQuery(java.lang. + * String, java.util.HashMap) + */ + @Override + public List executeQuery(String sql, HashMap additionalParams) { + return executeQuery(sql, null, null, additionalParams); + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#executeQuery(java.lang. + * String, java.lang.Integer, java.lang.Integer, java.util.HashMap) + */ + @Override + public List executeQuery(String sql, Integer fromIndex, Integer toIndex, HashMap additionalParams) { + Session session = sessionFactory.getCurrentSession(); + + Query query = session.createQuery(sql); + + if (fromIndex != null && toIndex != null) { + query.setFirstResult(fromIndex.intValue()); + int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1; + query.setMaxResults(pageSize); + } + + return query.list(); + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedQuery(java.lang + * .String, java.lang.Integer, java.lang.Integer, java.util.HashMap) + */ + @Override + public List executeNamedQuery(String queryName, Integer fromIndex, Integer toIndex, HashMap additionalParams) { + return executeNamedQuery(queryName, null, fromIndex, toIndex, additionalParams); + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedQuery(java.lang + * .String, java.util.Map, java.util.HashMap) + */ + @Override + public List executeNamedQuery(String queryName, Map params, HashMap additionalParams) { + return executeNamedQuery(queryName, params, null, null, additionalParams); + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedQuery(java.lang + * .String, java.util.Map, java.lang.Integer, java.lang.Integer, + * java.util.HashMap) + */ + @Override + public List executeNamedQuery(String queryName, Map params, Integer fromIndex, Integer toIndex, + HashMap additionalParams) { + Session session = sessionFactory.getCurrentSession(); + Query query = session.getNamedQuery(queryName); + bindQueryParameters(query, params); + if (fromIndex != null && toIndex != null) { + query.setFirstResult(fromIndex.intValue()); + int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1; + query.setMaxResults(pageSize); + } + return query.list(); + } + + /** + * Stores parameters into the query using String keys from the map. Gives + * special treatment to map values of Collection and array type. + * + * @param query + * Query with parameters + * @param params + * Map of String to Object. + */ + private void bindQueryParameters(Query query, Map params) { + if (params != null) { + for (Iterator i = params.entrySet().iterator(); i.hasNext();) { + Map.Entry entry = (Map.Entry) i.next(); + + Object parameterValue = entry.getValue(); + + if (!(parameterValue instanceof Collection) && !(parameterValue instanceof Object[])) { + query.setParameter((String) entry.getKey(), parameterValue); + } else if (parameterValue instanceof Collection) { + query.setParameterList((String) entry.getKey(), (Collection) parameterValue); + } else if (parameterValue instanceof Object[]) { + query.setParameterList((String) entry.getKey(), (Object[]) parameterValue); + } + } + } + } + + // With Where Clause & RAPTOR's ZK + + /* + * (non-Javadoc) + * + * @see org.openecomp.portalsdk.core.service.DataAccessService# + * executeNamedQueryWithOrderBy(java.lang.Class, java.lang.String, + * java.util.Map, java.lang.String, boolean, java.lang.Integer, + * java.lang.Integer, java.util.HashMap) + */ + @Override + public List executeNamedQueryWithOrderBy(Class entity, String queryName, Map params, String _orderBy, boolean asc, + Integer fromIndex, Integer toIndex, HashMap additionalParams) { + // TODO Auto-generated method stub + logger.info(EELFLoggerDelegate.debugLogger, "Not implemented"); + return null; + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedCountQuery(java + * .lang.Class, java.lang.String, java.lang.String, java.util.Map) + */ + @Override + public List executeNamedCountQuery(Class entity, String queryName, String whereClause, Map params) { + // TODO Auto-generated method stub + logger.info(EELFLoggerDelegate.debugLogger, "Not implemented"); + return null; + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedQuery(java.lang + * .Class, java.lang.String, java.lang.String, java.util.Map, + * java.lang.Integer, java.lang.Integer, java.util.HashMap) + */ + @Override + public List executeNamedQuery(Class entity, String queryName, String whereClause, Map params, Integer fromIndex, + Integer toIndex, HashMap additionalParams) { + // TODO Auto-generated method stub + logger.info(EELFLoggerDelegate.debugLogger, "Not implemented"); + return null; + } + + /* + * (non-Javadoc) + * + * @see org.openecomp.portalsdk.core.service.DataAccessService# + * executeNamedQueryWithOrderBy(java.lang.Class, java.lang.String, + * java.lang.String, java.util.Map, java.lang.String, boolean, + * java.lang.Integer, java.lang.Integer, java.util.HashMap) + */ + @Override + public List executeNamedQueryWithOrderBy(Class entity, String queryName, String whereClause, Map params, + String _orderBy, boolean asc, Integer fromIndex, Integer toIndex, HashMap additionalParams) { + // TODO Auto-generated method stub + logger.info(EELFLoggerDelegate.debugLogger, "Not implemented"); + return null; + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#getList(java.lang.Class, + * org.hibernate.criterion.ProjectionList, java.util.List, java.util.List, + * java.util.HashMap) + */ + @Override + public List getList(Class domainClass, ProjectionList projectionsList, List restrictionsList, + List orderByList, HashMap fetchModeMap) { + // TODO Auto-generated method stub + logger.info(EELFLoggerDelegate.debugLogger, "Not implemented"); + return null; + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#executeUpdateQuery(java. + * lang.String, java.util.HashMap) + */ + @Override + public int executeUpdateQuery(String sql, HashMap additionalParams) throws RuntimeException { + // TODO Auto-generated method stub + logger.info(EELFLoggerDelegate.debugLogger, "Not implemented"); + return 0; + } + + /* + * (non-Javadoc) + * + * @see + * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedUpdateQuery( + * java.lang.String, java.util.Map, java.util.HashMap) + */ + @Override + public int executeNamedUpdateQuery(String queryName, Map params, HashMap additionalParams) throws RuntimeException { + // TODO Auto-generated method stub + logger.info(EELFLoggerDelegate.debugLogger, "Not implemented"); + return 0; + } + + /* + * (non-Javadoc) + * + * @see org.openecomp.portalsdk.core.service.DataAccessService#synchronize(java.util. + * HashMap) + */ + @Override + public void synchronize(HashMap additionalParams) { + // TODO Auto-generated method stub + logger.info(EELFLoggerDelegate.debugLogger, "Not implemented"); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementLinkService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementLinkService.java new file mode 100644 index 0000000..948b635 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementLinkService.java @@ -0,0 +1,269 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.util.YamlUtils; + + + +public class ElementLinkService { + + + public String main1(String[] args) throws Exception{ + String filePath; + if(args[0].startsWith("custom")){ + filePath = SystemProperties.getProperty("customCallFlow_path"); + }else{ + filePath = SystemProperties.getProperty("element_map_file_path") + File.separator; + } + + String callFlowBusinessYml = ""; + String callFlowStep = ""; + + if(args != null && args.length > 0 ) { + + if( args[0] != null) { + callFlowBusinessYml = args[0] + ".yml"; + } + + if( args[1] != null) { + callFlowStep = args[1]; + } + } + + + ElementLinkService mapper = new ElementLinkService(); + + return mapper.createLinkFile(filePath, callFlowBusinessYml, callFlowStep); + } + + public String main2(String[] args) throws Exception{ + + String filePath = SystemProperties.getProperty("element_map_file_path") + File.separator; + String callFlowBusinessYml = ""; + String callFlowStep = ""; + + if(args != null && args.length > 0 ) { + + if( args[0] != null) { + callFlowBusinessYml = args[0] + "-Override.yml"; + } + + if( args[1] != null) { + callFlowStep = args[1]; + } + } + + + ElementLinkService mapper = new ElementLinkService(); + + return mapper.createLinkFileAdditional(filePath, callFlowBusinessYml, callFlowStep); + } + + + public static void main(String[] args) throws Exception{ + + String filePath = "C:\\Users\\statta\\git\\D2Platform\\war\\WEB-INF\\resources\\trisim_files"; + String callFlowBusinessYml = "call_flow_hc-origination-termination-to-volteue-3.3.16-Override.yml"; + + + ElementLinkService mapper = new ElementLinkService(); + System.out.print(mapper.createLinkFileAdditional(filePath, callFlowBusinessYml, "Step_2")); + } + + @SuppressWarnings("unchecked") + protected String createLinkFile(String resourceFilePath, String callFLowBsFileName, String callFlowStep) throws Exception { + + Map callFlowBs = YamlUtils.readYamlFile(resourceFilePath, callFLowBsFileName); + + List> callSteps = (List>) callFlowBs.get("callSequenceSteps"); + String callFlowName = (String) callFlowBs.get("shortName"); + return addLinks( resourceFilePath, callFlowName, callSteps, callFlowStep); + + + } + + @SuppressWarnings("unchecked") + protected String createLinkFileAdditional(String resourceFilePath, String callFLowBsFileName, String callFlowStep) throws Exception { + + Map callFlowBs; + + try{ + callFlowBs = YamlUtils.readYamlFile(resourceFilePath, callFLowBsFileName); + + List> callSteps = (List>) callFlowBs.get("callSequenceSteps"); + String callFlowName = (String) callFlowBs.get("shortName"); + return addLinksAdditional( resourceFilePath, callFlowName, callSteps, callFlowStep); + + } catch (Exception e) { + + return ""; + } + + + } + + @SuppressWarnings("unchecked") + protected String addLinks(String filePath, String callFlowName, + List> callSteps, String callFlowStep) throws IOException { + + Map> checkDuplicateMap = new HashMap>(); + + for(Map callStep : callSteps) { + + if(((String)callStep.get("name")).split(":")[0].trim().replace(" ", "_").equals(callFlowStep)) { + + List> links = new ArrayList>(); + + List> subSteps = (List>)callStep.get("subSteps"); + + for(Map subStep : subSteps) { + Map link = new HashMap(); + + String source = (String) subStep.get("source_tosca_id"); + String destination = (String) subStep.get("destination_tosca_id"); + + if((checkDuplicateMap.get(source) == null || checkDuplicateMap.get(source).isEmpty() || !checkDuplicateMap.get(source).contains(destination)) && !source.equals(destination)) { + if(checkDuplicateMap.get(destination) == null) { + List toscaList = new ArrayList(); + checkDuplicateMap.put(destination, toscaList); + } + + if(checkDuplicateMap.get(source) == null) { + List toscaList = new ArrayList(); + checkDuplicateMap.put(source, toscaList); + } + + + List toscaSourceList = checkDuplicateMap.get(destination); + toscaSourceList.add(source); + + List toscaDestinationList = checkDuplicateMap.get(source); + toscaDestinationList.add(destination); + + link.put("s", source); + link.put("d", destination); + links.add(link); + + } + + } + + Map callFlowUI = new HashMap(); + callFlowUI.put("linkList", links); + + return YamlUtils.returnYaml(callFlowUI); + + } + + + } + return ""; + } + + protected String addLinksAdditional(String filePath, String callFlowName, + List> callSteps, String callFlowStep) throws IOException { + + + for(Map callStep : callSteps) { + + if(((String)callStep.get("name")).split(":")[0].trim().replace(" ", "_").equals(callFlowStep)) { + + Map callFlowUI = new HashMap(); + try{ + List> links = addLinkVertices(callStep); + callFlowUI.put("linkList", links); } + catch(Exception e) {} + try{ + List activeIds = addActiveNodes(callStep); + callFlowUI.put("activeIds", activeIds);} + catch(Exception e) {} + try{ + List> disconnectLinks = addDisconnectLinks(callStep); + callFlowUI.put("disconnectLinks", disconnectLinks); } + catch(Exception e) {} + + return YamlUtils.returnYaml(callFlowUI); + } + } + + return ""; + } + + @SuppressWarnings("unchecked") + List addActiveNodes(Map callStep) { + + List activeIds = (List)callStep.get("activeIds"); + + return activeIds; + } + + @SuppressWarnings("unchecked") + List> addDisconnectLinks(Map callStep) { + + List> disconnectLinks = (List>)callStep.get("disconnectLinks"); + + return disconnectLinks; + } + + @SuppressWarnings("unchecked") + List> addLinkVertices(Map callStep) { + List> links = new ArrayList>(); + + List> vertices = (List>)callStep.get("vertices"); + + for(int i=0; i< vertices.size()-1;i++) { + Map vertex = (Map) vertices.get(i); + Map vertexNext = (Map) vertices.get(i+1); + + Integer sourceX = (Integer) vertex.get("x"); + Integer sourceY = (Integer) vertex.get("y"); + String sourceD = (String) vertex.get("D"); + String sourceL = (vertex.get("L") != null) ? (String) vertex.get("L") : "-"; + + if(sourceX == -999) // there is a break in the linkage + continue; + + Integer destinationX = (Integer) vertexNext.get("x"); + Integer destinationY = (Integer) vertexNext.get("y"); + String destinationD = (String) vertexNext.get("D"); + + if(destinationX == -999) // there is a break in the linkage + continue; + + Map link = new HashMap(); + + link.put("s", sourceX + "," + sourceY +","+sourceD + "," + sourceL); + link.put("d", destinationX + "," + destinationY +"," + destinationD); + links.add(link); + } + return links; + } +} + + diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementMapService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementMapService.java new file mode 100644 index 0000000..d88213f --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementMapService.java @@ -0,0 +1,915 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +import org.apache.commons.lang.StringUtils; +import org.openecomp.portalsdk.core.domain.support.Container; +import org.openecomp.portalsdk.core.domain.support.Domain; +import org.openecomp.portalsdk.core.domain.support.Element; +import org.openecomp.portalsdk.core.domain.support.ElementDetails; +import org.openecomp.portalsdk.core.domain.support.Layout; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.util.YamlUtils; +import org.yaml.snakeyaml.Yaml; +import org.yaml.snakeyaml.nodes.Tag; +import org.yaml.snakeyaml.representer.Representer; + +public class ElementMapService { + + public String convertToYAML(Layout layout) throws Exception{ + Map resultDomain= layout.domainRowCol; + Map> domainMap = new HashMap>(); + List domainList = new ArrayList(); + String pathToImg = SystemProperties.getProperty("element_map_icon_path"); //"static/img/map/icons/"; + for (Domain d : resultDomain.values()) { + + d.setWidth(10*d.computeSize().getWidth()); + d.setHeight(10*d.computeSize().getHeight()); + d.setLeft(10*d.getP().getX()); + d.setTop(10*d.getP().getY()); + + + List containerList = new ArrayList(); + for (Container c : d.getContainerRowCol().values()) { + c.setWidth(10*c.computeSize().getWidth()); + c.setHeight(10*c.computeSize().getHeight()); + c.setLeft(10*c.getP().getX()); + c.setTop(10*c.getP().getY()); + Element ue = (Element)c.getElementRowCol().values().toArray()[0]; + if (ue.getName().equals("ue1") || ue.getName().equals("ue2") || ue.getName().equals("ue3") || + ue.getName().equals("ue4") || ue.getName().equals("ue5") || ue.getName().equals("ue6")) { + c.setVisibilityType("invisible"); + } + + if (c.getContainerRowCol() != null) { + List innerContainerList = new ArrayList(); + for (Container innerC : c.getContainerRowCol().values()) { + innerC.setName(innerC.getName()); + innerC.setWidth(10*innerC.computeSize().getWidth()); + innerC.setHeight(10*innerC.computeSize().getHeight()); + innerC.setLeft(10*innerC.getP().getX()); + innerC.setTop(10*innerC.getP().getY()); + + if (innerC.getElementRowCol() != null) { + List innerContainerEList = new ArrayList(); + for (Element ele : innerC.getElementRowCol().values()) { + ele.setWidth(10*ele.computeSize().getWidth()); + ele.setHeight(10*ele.computeSize().getHeight()); + ele.setLeft(10*ele.getP().getX()); + ele.setTop(10*ele.getP().getY()-10); + ele.setImgFileName(pathToImg+ele.getImgFileName()); + if (ele.getBorderType().equals("V")) + ele.setBorderType("dashed"); + else + ele.setBorderType("solid"); + + innerContainerEList.add(ele); + } + innerC.setElementList(innerContainerEList); + } + innerContainerList.add(innerC); + } + c.setInnerCList(innerContainerList); + } + + if (c.getElementRowCol() != null) { + List elementList = new ArrayList(); + for (Element e : c.getElementRowCol().values()) { + e.setWidth(10*e.computeSize().getWidth()); + e.setHeight(10*e.computeSize().getHeight()); + e.setLeft(10*e.getP().getX()); + e.setTop(10*e.getP().getY()-10); + e.setImgFileName(pathToImg+e.getImgFileName()); + + if (e.getBorderType().equals("V")) + e.setBorderType("dashed"); + else + e.setBorderType("solid"); + + if (e.getName().equals("ue1") || e.getName().equals("ue2") || e.getName().equals("ue3") + || e.getName().equals("ue4") || e.getName().equals("ue5") || e.getName().equals("ue6")) + e.setBgColor("white"); + elementList.add(e); + } + c.setElementList(elementList); + } + containerList.add(c); + } + d.setContainerList(containerList); + domainList.add(d); + + } + domainMap.put("domainList", domainList); + + List collapsedDomains = new ArrayList(); + + //nline + for (Domain collapsed : layout.getCollapsedDomainsNewList()) { + collapsed.setWidth(10*collapsed.computeSize().getWidth()); + collapsed.setHeight(10*collapsed.computeSize().getHeight()); + collapsed.setLeft(10*collapsed.getP().getX()); + collapsed.setTop(10*collapsed.getP().getY()); + //nline + collapsed.setNewXafterColl(10*collapsed.getNewXafterColl()); + collapsed.setYafterColl(10*collapsed.getYafterColl()); + collapsedDomains.add(collapsed); + } + + domainMap.put("collapsedDomainList", collapsedDomains); + + Representer representer = new Representer(); + representer.addClassTag(Domain.class, Tag.MAP); + + + Yaml yaml = new Yaml(representer); + String output = yaml.dump(domainMap); + + return output; + +} + + + + public static HashMap toscaElementsMap = new HashMap(); + public static HashMap elementMap = new HashMap(); + public static HashMap miscElementMap = new HashMap(); + public static HashMap outercontainers = new HashMap(); + public static HashMap innercontainers = new HashMap(); + public static HashMap domainMap = new HashMap(); + + + static String filePath = + SystemProperties.getProperty("element_map_file_path") ; + static String callFlowBusinessYml = "call_flow_sip_digest.yml"; + static String networkToscaYml = null;//"NetworkMap_topology_composition.yml"; + static String networkLayoutYml = null;// "network_map_layout.yml"; + + + @SuppressWarnings({ "unchecked", "unused" }) + public String main1(String args[]) throws Exception{ + + + if(args != null && args.length > 0 ) { + + if( args[2] != null) { + networkToscaYml = args[2] + ".yml"; + } + + if( args[3] != null) { + networkLayoutYml = args[3] + ".yml"; + } + } + + HashMap toscaYaml = (HashMap)YamlUtils.readYamlFile(filePath, networkToscaYml); //TrinityYAMLHelper.getToscaYaml(); + HashMap networkMapLayoutYaml = (HashMap)YamlUtils.readYamlFile(filePath, networkLayoutYml); //TrinityYAMLHelper.getNetworkMapLayoutYaml(); + + toscaElementsMap = new HashMap(); + elementMap = new HashMap(); + domainMap = new HashMap(); + outercontainers = new HashMap(); + innercontainers = new HashMap(); + miscElementMap = new HashMap(); + + if(toscaYaml != null){ + for(String key : toscaYaml.keySet()){ + if("topology_template".equalsIgnoreCase(key) && toscaYaml.get(key) instanceof HashMap){ + HashMap toscaTopologyDetails = (HashMap) toscaYaml.get(key); + + for(String detailsKey: toscaTopologyDetails.keySet()){ + + if("node_templates".equalsIgnoreCase(detailsKey) && toscaTopologyDetails.get(detailsKey) instanceof HashMap){ + + toscaElementsMap = (HashMap) toscaTopologyDetails.get(detailsKey); + + for(String toscaElementKey: toscaElementsMap.keySet()){ + } + + } + } + } + + } + } + + if(networkMapLayoutYaml != null){ + if(networkMapLayoutYaml.containsKey("toscaNetworkMapElementStyleList") && networkMapLayoutYaml.get("toscaNetworkMapElementStyleList") instanceof ArrayList){ + + ArrayList elementlist = (ArrayList)networkMapLayoutYaml.get("toscaNetworkMapElementStyleList"); + String elementName; + String elementID; + String imgPath; + String row; + String column; + String mapKey; + int i=0; + + if(elementlist != null){ + for(Object eachElement: elementlist){ + if(eachElement != null && eachElement instanceof HashMap){ + HashMap elementDetails = (HashMap) eachElement; + if(elementDetails != null){ + elementName = "NA"+i; + elementID = "NA"+i; + imgPath = "NA"+i; + row = "0"; + column = "0"; + for(String detailsKey: elementDetails.keySet()){ + if ("tosca_id".equalsIgnoreCase(detailsKey)) elementName = elementDetails.get(detailsKey).toString(); + if ("id".equalsIgnoreCase(detailsKey)) { + elementID = String.valueOf(elementDetails.get(detailsKey)); + } + if ("row".equalsIgnoreCase(detailsKey)) { + row = String.valueOf(elementDetails.get(detailsKey)); + } + if ("column".equalsIgnoreCase(detailsKey)) { + column = String.valueOf(elementDetails.get(detailsKey)); + } + if ("icon".equalsIgnoreCase(detailsKey)) imgPath = elementDetails.get(detailsKey).toString(); + } + + if(elementMap.containsKey(elementName.concat("/").concat(row).concat(column))){ + if(elementMap.containsKey(elementName.concat("/").concat(String.valueOf(i)).concat(String.valueOf(i)))){ + mapKey = elementName; + } else mapKey = elementName.concat("/").concat(String.valueOf(i)).concat(String.valueOf(i)); + + } else mapKey = elementName.concat("/").concat(row).concat(column); + + elementMap.put(mapKey, fetchElementObject(elementID,elementName,imgPath)); + } + } + i++; + } + } + + for(String elementkey : elementMap.keySet()){ + Element c = (Element) elementMap.get(elementkey); + } + + if(!elementMap.isEmpty()){ + miscElementMap = new HashMap(elementMap); + } + } + + + if(networkMapLayoutYaml.containsKey("containerStyleList") && networkMapLayoutYaml.get("containerStyleList") instanceof ArrayList){ + + ArrayList containerstylelist = (ArrayList)networkMapLayoutYaml.get("containerStyleList"); + String containerName; + String containerID; + String domain; + String row; + String column; + String mapKey; + int i=0; + + if(containerstylelist != null){ + //Inner Containers + for(Object eachContainer: containerstylelist){ + if(eachContainer != null && eachContainer instanceof HashMap){ + HashMap containerDetails = (HashMap) eachContainer; + if(containerDetails != null){ + containerName = "NA"+i; + containerID = "NA"+i; + domain = "NA"+i; + row = "0"; + column = "0"; + + for(String detailsKey: containerDetails.keySet()){ + if ("logical_group_name".equalsIgnoreCase(detailsKey)) containerName = containerDetails.get(detailsKey).toString(); + if ("id".equalsIgnoreCase(detailsKey)) { + containerID = String.valueOf(containerDetails.get(detailsKey)); + } + if("domain".equalsIgnoreCase(detailsKey)){ + domain = containerDetails.get(detailsKey).toString(); + } + if ("row".equalsIgnoreCase(detailsKey)) { + row = String.valueOf(containerDetails.get(detailsKey)); + } + if ("column".equalsIgnoreCase(detailsKey)) { + column = String.valueOf(containerDetails.get(detailsKey)); + } + } + if(containerName.contains("/")){ + + if(innercontainers.containsKey((domain +":"+ containerName).concat("/").concat(row).concat(column))){ + if(elementMap.containsKey((domain +":"+ containerName).concat("/").concat(String.valueOf(i)).concat(String.valueOf(i)))){ + mapKey = (domain +":"+ containerName); + } else mapKey = (domain +":"+ containerName).concat("/").concat(String.valueOf(i)).concat(String.valueOf(i)); + + } else mapKey = (domain +":"+ containerName).concat("/").concat(row).concat(column); + + innercontainers.put(mapKey, fetchContainerObject(containerID,containerName.substring(containerName.indexOf("/")+1),true,containerName,domain)); + } + } + } + i++; + } + + //OuterContainers + i=0; + for(Object eachContainer: containerstylelist){ + if(eachContainer != null && eachContainer instanceof HashMap){ + HashMap containerDetails = (HashMap) eachContainer; + if(containerDetails != null){ + containerName = "NA"+i; + containerID = "NA"+i; + domain = "NA"+i; + row = "0"; + column = "0"; + + for(String detailsKey: containerDetails.keySet()){ + if ("logical_group_name".equalsIgnoreCase(detailsKey)) containerName = containerDetails.get(detailsKey).toString(); + if ("id".equalsIgnoreCase(detailsKey)) { + containerID = String.valueOf(containerDetails.get(detailsKey)); + } + if("domain".equalsIgnoreCase(detailsKey)){ + domain = containerDetails.get(detailsKey).toString(); + } + if ("row".equalsIgnoreCase(detailsKey)) { + row = String.valueOf(containerDetails.get(detailsKey)); + } + if ("column".equalsIgnoreCase(detailsKey)) { + column = String.valueOf(containerDetails.get(detailsKey)); + } + } + if(!containerName.contains("/")){ + if(outercontainers.containsKey((domain +":"+ containerName).concat("/").concat(row).concat(column))){ + if(outercontainers.containsKey((domain +":"+ containerName).concat("/").concat(String.valueOf(i)).concat(String.valueOf(i)))){ + mapKey = (domain +":"+ containerName); + } else mapKey = (domain +":"+ containerName).concat("/").concat(String.valueOf(i)).concat(String.valueOf(i)); + + } else mapKey = (domain +":"+ containerName).concat("/").concat(row).concat(column); + outercontainers.put(mapKey, fetchContainerObject(containerID,containerName,false,containerName,domain)); + } + + } + } + i++; + } + } + + for(String innerContainerkey : innercontainers.keySet()){ + Container c = (Container) innercontainers.get(innerContainerkey); + } + + for(String outerContainerkey : outercontainers.keySet()){ + Container c = (Container) outercontainers.get(outerContainerkey); + } + + } + + if(networkMapLayoutYaml.containsKey("domainList") && networkMapLayoutYaml.get("domainList") instanceof ArrayList){ + + ArrayList domainlist = (ArrayList)networkMapLayoutYaml.get("domainList"); + String domainName; + String domainID; + String row; + String column; + String mapKey; + int i=0; + + if(domainlist != null){ + + Double leftPosition = 7d; + HashMap domainStagingMap = new HashMap(); + + for(Object eachDomain: domainlist){ + if(eachDomain != null && eachDomain instanceof HashMap){ + HashMap domainDetails = (HashMap) eachDomain; + if(domainDetails != null){ + domainName = "NA"+i; + domainID = "NA"+i; + row = "0"; + column = "0"; + for(String detailsKey: domainDetails.keySet()){ + if ("name".equalsIgnoreCase(detailsKey)) domainName = domainDetails.get(detailsKey).toString(); + if ("id".equalsIgnoreCase(detailsKey)) { + domainID = String.valueOf(domainDetails.get(detailsKey)); + } + if ("row".equalsIgnoreCase(detailsKey)) { + row = String.valueOf(domainDetails.get(detailsKey)); + } + if ("column".equalsIgnoreCase(detailsKey)) { + column = String.valueOf(domainDetails.get(detailsKey)); + } + } + + if(domainStagingMap.containsKey(row.concat(column))){ + mapKey = domainName; + } else mapKey = row.concat(column); + + domainStagingMap.put(mapKey, domainID+"%"+domainName); + } + } + i++; + } + + if(domainStagingMap != null && !domainStagingMap.isEmpty()){ + for(String domainsKey: new TreeSet(domainStagingMap.keySet())){ + String value = domainStagingMap.get(domainsKey); + if(value.contains("%")){ + domainMap.put(domainsKey, fetchDomainObject(value.substring(0,value.indexOf("%")),value.substring(value.indexOf("%")+1))); + } + } + } + } + + for(String domainkey : domainMap.keySet()){ + Domain c = (Domain) domainMap.get(domainkey); + } + + } + + + } + + Layout dynamicLayout = new Layout(domainMap, 2, 10, 1, 5); + + dynamicLayout.computeDomainPositionsModified(); + Map resultDomain2= dynamicLayout.domainRowCol; + + for (String key : resultDomain2.keySet()) { + if (resultDomain2.get(key).getP() !=null) { + + } + } + + ElementMapService cm2 = new ElementMapService(); + try { + + if(args != null && args.length > 0 ) { + + if( args[0] != null) { + String collapsedDomains[] = args[0].split(","); + for(String collapsedDomain : collapsedDomains) + dynamicLayout.collapseDomainNew(collapsedDomain); + } + + if( args[1] != null) { + String expandedDomains[] = args[1].split(","); + for(String expandedDomain : expandedDomains) + dynamicLayout.uncollapseDomainNew1(expandedDomain); + } + + return cm2.convertToYAML(dynamicLayout); + + } + }catch (Exception e) { + + e.printStackTrace(); + } + + + return ""; + + + } + + private static int computeRows(Set keys){ + int i = 0; + if(keys!= null && !keys.isEmpty()){ + for(String s: keys){ + String r = s.substring(0, 1); + if(StringUtils.isNumeric(r)){ + int j = Integer.parseInt(r); + if(i<= j){ + i=j; + } + + } + } + + return i+1; + } + + return 1; + } + + private static int computeColumns(Set keys){ + int i = 0; + if(keys!= null && !keys.isEmpty()){ + for(String s: keys){ + String r = s.substring(1, 2); + if(StringUtils.isNumeric(r)){ + int j = Integer.parseInt(r); + if(i<= j){ + i=j; + } + + } + } + + return i+1; + } + + return 1; + } + + private static Container fetchContainerObject(String id, String name, boolean isInner, String logicalGroupName, String domain){ + Map containerElementsMap = new HashMap(); + + containerElementsMap = fetchElementsMapForContainer(name, isInner, logicalGroupName, domain); + int rows = 1; + int columns = 1; + + if(isInner){ + + if(containerElementsMap != null && !containerElementsMap.isEmpty()){ + rows = computeRows(containerElementsMap.keySet()); + columns = computeColumns(containerElementsMap.keySet()); + } + + Container thisContainer = new Container(id, name, rows, columns, 1, 4, 8, 12, 1, 2); + thisContainer.setElements(containerElementsMap); + + return thisContainer; + } else { + Map innerContainersMap = fetchInnerContainersMapForOuter(name, isInner, logicalGroupName,domain); + + if(innerContainersMap != null && !innerContainersMap.isEmpty()){ + if(containerElementsMap != null && !containerElementsMap.isEmpty()){ + Set keys = new HashSet(innerContainersMap.keySet()); + keys.addAll(containerElementsMap.keySet()); + rows = computeRows(keys); + columns = computeColumns(keys); + } else { + rows = computeRows(innerContainersMap.keySet()); + columns = computeColumns(innerContainersMap.keySet()); + } + } else if(containerElementsMap != null && !containerElementsMap.isEmpty()){ + rows = computeRows(containerElementsMap.keySet()); + columns = computeColumns(containerElementsMap.keySet()); + } + + Container thisContainer = new Container(id, name, rows, columns,2 , 6, 2, 5, 0, 0); + thisContainer.setElements(containerElementsMap); + thisContainer.setInnerContainer(innerContainersMap); + + + return thisContainer; + } + + } + + private static Domain fetchDomainObject(String id, String name){ + HashMap domainContainersMap = fetchContainersForDomain(name); + + int rows = 1; + int columns = 1; + if(domainContainersMap != null && !domainContainersMap.isEmpty()){ + rows = computeRows(domainContainersMap.keySet()); + columns = computeColumns(domainContainersMap.keySet()); + } + + double domainWidth = 11; + Domain thisDomain; + + if(domainMap != null && !domainMap.isEmpty()){ + int domainsCountSoFar = domainMap.size(); + switch(domainsCountSoFar){ + case 1: {domainWidth = 12.1; break;} + case 2: {domainWidth = 13.3; break;} + case 3: {domainWidth = 14.5; break;} + case 4: {domainWidth = 15.6; break;} + default: {domainWidth = 11; break;} + } + + for(String domainsKey: new TreeSet(domainMap.keySet())){ + Domain eachDomain = domainMap.get(domainsKey); + domainWidth+= eachDomain.computeSize().getWidth(); + } + thisDomain = new Domain(id, name, 2, 2, domainWidth, 10, 3, rows, columns); + } else { + + thisDomain = new Domain(id, name, 2, 1, 11, 10, 3, rows, columns); + } + + thisDomain.setContainers(domainContainersMap); + + thisDomain.computeConatinerPositions(); + if(domainContainersMap!= null && !domainContainersMap.isEmpty()){ + for(Container thisContainer : domainContainersMap.values()){ + thisContainer.computeSize(); + thisContainer.computeElementPositions(); + Map resultElementMap = thisContainer.elementRowCol; + for (String key : resultElementMap.keySet()) { + if(resultElementMap.get(key) == null || resultElementMap.get(key).getP() == null) { + } + + } + + HashMap innerContainersMap = (HashMap) thisContainer.getContainerRowCol(); + if(innerContainersMap != null && !innerContainersMap.isEmpty()){ + for(Container thisInnerContainer : innerContainersMap.values()){ + thisInnerContainer.computeElementPositions(); + } + } + } + } + + return thisDomain; + } + + private static HashMap fetchContainersForDomain(String domain){ + HashMap domainContainersMap = new HashMap(); + + domainContainersMap = fetchFromOuterContainers(domain); + + return domainContainersMap; + + } + + @SuppressWarnings("unchecked") + private static Element fetchElementObject(String id, String name, String imgPath){ + String bgColor = "bgColor"; + String logical_group; + String display_longname; + String display_shortname; + String description; + String primary_function; + String key_interfaces; + String location; + String vendor; + String vendor_shortname; + String enclosingContainer; + String borderType; + String network_function; + + if(toscaElementsMap.containsKey(name)){ + + if(toscaElementsMap.get(name) != null && toscaElementsMap.get(name) instanceof HashMap){ + HashMap toscaElementDetails = (HashMap) toscaElementsMap.get(name); + + for(String detailsKey: toscaElementDetails.keySet()){ + if("properties".equalsIgnoreCase(detailsKey) && toscaElementDetails.get(detailsKey) instanceof HashMap){ + HashMap elementDetails = (HashMap) toscaElementDetails.get(detailsKey); + + if(elementDetails != null){ + logical_group = elementDetails.get("logical_group") == null? "" : elementDetails.get("logical_group").toString(); + display_longname = elementDetails.get("display_longname") == null? "" : elementDetails.get("display_longname").toString(); + display_shortname = elementDetails.get("display_shortname") == null? "" : elementDetails.get("display_shortname").toString(); + description = elementDetails.get("description") == null? "" : elementDetails.get("description").toString(); + primary_function = elementDetails.get("primary_function") == null? "" : elementDetails.get("primary_function").toString(); + key_interfaces = elementDetails.get("key_interfaces") == null? "" : elementDetails.get("key_interfaces").toString(); + location = elementDetails.get("location") == null? "" : elementDetails.get("location").toString(); + vendor = elementDetails.get("vendor") == null? "" : elementDetails.get("vendor").toString(); + vendor_shortname = elementDetails.get("vendor_shortname") == null? "" : elementDetails.get("vendor_shortname").toString(); + enclosingContainer = logical_group.replace("/", "-"); + network_function = elementDetails.get("network_function"); + borderType = elementDetails.get("network_function") == null? "P" : elementDetails.get("network_function").toString().toUpperCase(); + bgColor = elementDetails.get("background_color") == null? "bgColor" : elementDetails.get("background_color").toString(); + + ElementDetails details = new ElementDetails(logical_group,display_longname,description,primary_function, network_function, + key_interfaces,location,vendor,vendor_shortname,enclosingContainer); + + return new Element(name, display_shortname, imgPath, bgColor,borderType, details); + } + + } + } + + } + + } else { + return new Element(id,name); + } + + return new Element(id,name); + } + + @SuppressWarnings("unchecked") + private static String fetchDomainNameOfElement(String name){ + if(toscaElementsMap.containsKey(name)){ + + if(toscaElementsMap.get(name) != null && toscaElementsMap.get(name) instanceof HashMap){ + HashMap toscaElementDetails = (HashMap) toscaElementsMap.get(name); + + for(String detailsKey: toscaElementDetails.keySet()){ + if("properties".equalsIgnoreCase(detailsKey) && toscaElementDetails.get(detailsKey) instanceof HashMap){ + HashMap elementDetails = (HashMap) toscaElementDetails.get(detailsKey); + + if(elementDetails != null){ + return elementDetails.get("domain") == null? "" : elementDetails.get("domain").toString(); + } + + } + } + + } + + } else { + return ""; + } + + return ""; + } + + private static HashMap fetchInnerContainersMapForOuter(String name, boolean isInner, String logicalGroupName, String domain){ + return fetchInnerContainersMap(name,logicalGroupName,domain); + } + + private static HashMap fetchElementsMapForContainer(String name, boolean isInner, String logicalGroupName, String domain){ + return fetchElementsMap(logicalGroupName,domain); + } + + private static HashMap fetchInnerContainersMap(String name, String logicalGroupName, String domain){ + HashMap containersMap = new HashMap(); + String rowColumnKey = ""; + int count = 0; + + if(innercontainers!=null && !innercontainers.isEmpty()){ + for(String key : innercontainers.keySet()){ + + + Container eachContainer = innercontainers.get(key); + + if(key.toUpperCase().contains((domain+":"+name).toUpperCase())){ + if(key.contains("/")){ + rowColumnKey = key.substring(key.lastIndexOf("/")+1); + } + + if(rowColumnKey.isEmpty() || containersMap.containsKey(rowColumnKey)){ + count=0; + while(count<=9){ + if(containersMap.containsKey(String.valueOf(count).concat(String.valueOf(count)))){ + count++; + } else + { + rowColumnKey = String.valueOf(count).concat(String.valueOf(count)); + break; + } + } + + + } + + containersMap.put(rowColumnKey,eachContainer); + } + + + } + } + return containersMap.isEmpty()?null:containersMap; + + } + + private static HashMap fetchFromOuterContainers(String domain){ + HashMap thisContainersMap = new HashMap(); + String rowColumnKey = ""; + int count = 0; + + if(outercontainers!=null && !outercontainers.isEmpty()){ + for(String key : outercontainers.keySet()){ + Container eachContainer = outercontainers.get(key); + + if(key.toUpperCase().contains((domain+":").toUpperCase())){ + if(key.contains("/")){ + rowColumnKey = key.substring(key.lastIndexOf("/")+1); + } + + if(rowColumnKey.isEmpty() || thisContainersMap.containsKey(rowColumnKey)){ + count=0; + while(count<=9){ + if(thisContainersMap.containsKey(String.valueOf(count).concat(String.valueOf(count)))){ + count++; + } else + { + rowColumnKey = String.valueOf(count).concat(String.valueOf(count)); + break; + } + } + + + } + + thisContainersMap.put(rowColumnKey,eachContainer); + } + } + + } + + //Misc Elements Containers + + if(miscElementMap!=null && !miscElementMap.isEmpty()){ + for(String key : miscElementMap.keySet()){ + Element eachElement = miscElementMap.get(key); + String elementName = eachElement.getName(); + String domainName = fetchDomainNameOfElement(elementName); + + if(domain.equalsIgnoreCase(domainName)){ + Container eachContainer = new Container(domainName+":"+elementName, elementName, 1, 1, 3, 6, 2, 5, 0, 0); + count=0; + while(count<=9){ + if(thisContainersMap.containsKey(String.valueOf(count).concat(String.valueOf(count)))){ + count++; + } else + { + rowColumnKey = String.valueOf(count).concat(String.valueOf(count)); + break; + } + } + + thisContainersMap.put(rowColumnKey,eachContainer); + } + + + } + + } + + + return thisContainersMap.isEmpty()?null:thisContainersMap; + } + + + + @SuppressWarnings("unused") + private static HashMap addOuterContainersForMiscElements(String domain){ + HashMap containerElementsMap = new HashMap(); + if(miscElementMap!=null && !miscElementMap.isEmpty()){ + for(String key : miscElementMap.keySet()){ + Element eachElement = miscElementMap.get(key); + String elementName = eachElement.getName(); + String domainName = fetchDomainNameOfElement(elementName); + + if(domain.equalsIgnoreCase(domainName)){ + Container newContainer = new Container(domainName+":"+elementName, elementName, 1, 1, 3, 6, 2, 5, 0, 0); + containerElementsMap.put(domainName+":"+elementName, newContainer); + } + + + } + + } + return containerElementsMap.isEmpty()? null:containerElementsMap; + } + + private static HashMap fetchElementsMap(String logicalGroupName, String domain){ + HashMap innerElementMap = new HashMap(); + String rowColumnKey = ""; + int count = 0; + + if(elementMap!=null && !elementMap.isEmpty()){ + for(String key : elementMap.keySet()){ + Element eachElement = elementMap.get(key); + + String elementName = eachElement.getId(); + String elementLogicalGroup = eachElement.details == null ? "" : eachElement.details.logical_group; + if(elementLogicalGroup.equalsIgnoreCase(logicalGroupName) && domain.equalsIgnoreCase(fetchDomainNameOfElement(elementName))){ + if(key.contains("/")){ + rowColumnKey = key.substring(key.indexOf("/")+1); + } + + if(rowColumnKey.isEmpty() || innerElementMap.containsKey(rowColumnKey)){ + count=0; + while(count<=9){ + if(innerElementMap.containsKey(String.valueOf(count).concat(String.valueOf(count)))){ + count++; + } else + { + rowColumnKey = String.valueOf(count).concat(String.valueOf(count)); + break; + } + } + + + } + + innerElementMap.put(rowColumnKey,eachElement); + miscElementMap.remove(key); + } + + } + } + + return innerElementMap.isEmpty()?null:innerElementMap; + } + + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java new file mode 100644 index 0000000..040c9d2 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java @@ -0,0 +1,46 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openecomp.portalsdk.core.domain.Menu; +import org.openecomp.portalsdk.core.domain.MenuData; +import org.openecomp.portalsdk.core.domain.RoleFunction; + +/** + * Description: this java class is an interface of services for Admin to add/edit/delete menu items from FN_MENU + */ +public interface FnMenuService { + List getFnMenuItems(); + void saveFnMenuData(MenuData domainFnMenu); + void saveFnMenu(Menu domainFnMenu); + void removeMenuItem(MenuData domainFnMenu); + MenuData getMenuItemRow(Long id); + Menu getMenuItem(Long id); + List getParentId(String label); + @SuppressWarnings("rawtypes") + List getParentList(); + List getFunctionCDList(); + void removeMenuItem(Menu domainFnMenu); + Map> setMenuDataStructure(List> childItemList, List parentList, Set menuResult) throws Exception; +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java new file mode 100644 index 0000000..b17be18 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java @@ -0,0 +1,145 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openecomp.portalsdk.core.domain.Menu; +import org.openecomp.portalsdk.core.domain.MenuData; +import org.openecomp.portalsdk.core.domain.RoleFunction; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Description: this java class is an implementation of services for Admin to add/edit/delete menu items from FN_MENU + */ + +@Service("fnMenuService") +@Transactional +public class FnMenuServiceImpl implements FnMenuService{ + + @Autowired + private DataAccessService dataAccessService; + + @SuppressWarnings("unchecked") + public List getFnMenuItems() { + return getDataAccessService().getList(MenuData.class, null, "1", null); + + } + + + public DataAccessService getDataAccessService() { + return dataAccessService; + } + + + public void setDataAccessService(DataAccessService dataAccessService) { + this.dataAccessService = dataAccessService; + } + + + @Override + public void saveFnMenuData(MenuData domainFnMenu) { + // TODO Auto-generated method stub + getDataAccessService().saveDomainObject(domainFnMenu, null); + + } + + @SuppressWarnings("unchecked") + @Override + public List getParentId(String label) { + // TODO Auto-generated method stub + Map params = new HashMap(); + params.put("paramLabel", label); + return getDataAccessService().executeNamedQuery("IdForLabelList", params, null); + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public List getParentList() { + // TODO Auto-generated method stub + + return getDataAccessService().executeNamedQuery("parentList", null, null); + + } + + @SuppressWarnings("unchecked") + @Override + public List getFunctionCDList() { + // TODO Auto-generated method stub + + return getDataAccessService().executeNamedQuery("functionCDlist", null, null); + + } + + @Override + public void removeMenuItem(MenuData domainFnMenu) { + getDataAccessService().deleteDomainObject(domainFnMenu, null); + } + + @Override + public void removeMenuItem(Menu domainFnMenu) { + getDataAccessService().deleteDomainObject(domainFnMenu, null); + } + + public MenuData getMenuItemRow(Long id) { + return (MenuData)getDataAccessService().getDomainObject(MenuData.class, id, null); + } + + @Override + public Menu getMenuItem(Long id) { + return (Menu)getDataAccessService().getDomainObject(Menu.class, id, null); + } + + @Override + public void saveFnMenu(Menu domainFnMenu) { + // TODO Auto-generated method stub + getDataAccessService().saveDomainObject(domainFnMenu, null); + + } + @Override + public Map> setMenuDataStructure(List> childItemList, List parentList, Set menuResult) throws Exception{ + for(MenuData menu: menuResult){ + MenuData parentData = new MenuData(); + parentData.setLabel(menu.getLabel()); + parentData.setAction(menu.getAction()); + parentData.setImageSrc(menu.getImageSrc()); + parentList.add(parentData); + List tempList = new ArrayList(); + for(Object o:menu.getChildMenus()){ + MenuData m = (MenuData)o; + MenuData data = new MenuData(); + data.setLabel(m.getLabel()); + data.setAction(m.getAction()); + data.setImageSrc(m.getImageSrc()); + tempList.add(data); + } + childItemList.add(tempList); + } + return null; + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapService.java new file mode 100644 index 0000000..9c790eb --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapService.java @@ -0,0 +1,31 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import org.openecomp.portalsdk.core.command.support.SearchResult; +import org.openecomp.portalsdk.core.domain.support.DomainVo; + + +public interface LdapService { + + // search POST for users based on the criteria selected in the Request + SearchResult searchPost(DomainVo searchCriteria, String sortBy1, String sortBy2, String sortBy3, int pageNo, int dataSize, int userId) throws Exception; + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapServiceImpl.java new file mode 100644 index 0000000..d1176c1 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapServiceImpl.java @@ -0,0 +1,269 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import javax.naming.directory.DirContext; +import javax.naming.directory.SearchControls; + +import org.openecomp.portalsdk.core.command.support.SearchResult; +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.domain.support.DomainVo; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.service.support.FusionService; +import org.openecomp.portalsdk.core.service.support.ServiceLocator; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service("ldapService") +@Transactional +public class LdapServiceImpl extends FusionService implements LdapService { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(LdapServiceImpl.class); + @Autowired + private ServiceLocator serviceLocator; + + @SuppressWarnings({ "unchecked", "rawtypes" }) + public SearchResult searchPost(DomainVo searchCriteria, String sortBy1, String sortBy2, String sortBy3, + int pageNo, int dataSize, int userId) throws Exception { + + // initialize the directory context to access POST + DirContext dirContext = serviceLocator.getDirContext(SystemProperties.getProperty(SystemProperties.POST_INITIAL_CONTEXT_FACTORY), + SystemProperties.getProperty(SystemProperties.POST_PROVIDER_URL), + SystemProperties.getProperty(SystemProperties.POST_SECURITY_PRINCIPAL)); + + SearchResult searchResult = new SearchResult(); + + try { + + String[] postAttributes = {"nickname","givenName","initials","sn","employeeNumber","mail","telephoneNumber", + "departmentNumber","a1","street","roomNumber","l","st","postalCode","zip4","physicalDeliveryOfficeName","bc", + "friendlyCountryName","bd","bdname","bu","buname","jtname","mgrid","a2","compcode","compdesc", + "costcenter","silo","b2"}; + + SearchControls searchControls = new SearchControls(); + searchControls.setTimeLimit(5000); + searchControls.setReturningAttributes(postAttributes); + + StringBuffer filterClause = new StringBuffer("(&(objectClass=*)"); + + User user = (User)searchCriteria; + + if(Utilities.nvl(user.getFirstName()).length() > 0) { + filterClause.append("(givenName=").append(user.getFirstName()).append("*)"); + } + if(Utilities.nvl(user.getLastName()).length() > 0) { + filterClause.append("(sn=").append(user.getLastName()).append("*)"); + } + if(Utilities.nvl(user.getHrid()).length() > 0) { + filterClause.append("(employeeNumber=").append(user.getHrid()).append("*)"); + } + if(Utilities.nvl(user.getOrgManagerUserId()).length() > 0) { + filterClause.append("(mgrid=").append(user.getOrgManagerUserId()).append("*)"); + } + if(Utilities.nvl(user.getOrgCode()).length() > 0) { + filterClause.append("(departmentNumber=").append(user.getOrgCode()).append("*)"); + } + if(Utilities.nvl(user.getEmail()).length() > 0) { + filterClause.append("(mail=").append(user.getEmail()).append("*)"); + } + if(Utilities.nvl(user.getOrgUserId()).length() > 0) { + filterClause.append("(a1=").append(user.getOrgUserId()).append("*)"); + } + filterClause.append("(c3=N)"); // this has been added to filter CP09 entries on the LDAP server that are duplicates of existing individuals + filterClause.append(")"); + + List list = new ArrayList(); + if (!filterClause.toString().equals("(&(objectClass=*))")) { + NamingEnumeration e = dirContext.search(SystemProperties.getProperty(SystemProperties.POST_PROVIDER_URL) + "/" + + SystemProperties.getProperty(SystemProperties.POST_SECURITY_PRINCIPAL), + filterClause.toString(), + searchControls); + + list = processResults(e); + } + + Collections.sort(list); + + searchResult = new SearchResult(list); + searchResult.setPageNo(pageNo); + if(dataSize >= 0) { + searchResult.setDataSize(dataSize); + } + else { + searchResult.setDataSize(list.size()); + } // else + + } + catch(NamingException ne) { + logger.error(EELFLoggerDelegate.errorLogger,ne.getMessage()); + } + finally { + dirContext.close(); + } + + return searchResult; + } + + + @SuppressWarnings({ "rawtypes", "unchecked" }) + private ArrayList processResults(NamingEnumeration e) throws NamingException { + ArrayList results = new ArrayList(); + int count = 0; + + while (e.hasMore()) { + javax.naming.directory.SearchResult searchResult = (javax.naming.directory.SearchResult)e.next(); + results.add(processAttributes(searchResult.getAttributes())); + count++; + + if(count > Integer.parseInt(SystemProperties.getProperty(SystemProperties.POST_MAX_RESULT_SIZE))) { + break; + } + + } + + return results; + } + + + @SuppressWarnings("rawtypes") + private DomainVo processAttributes(Attributes resultAttributes) throws NamingException { + User user = new User(); + + try { + if (resultAttributes == null) { + System.out.println("This result has no attributes"); + } else { + for (NamingEnumeration e = resultAttributes.getAll(); e.hasMore();) { //why the nested loop? + Attribute attribute = (Attribute)e.next(); + for (NamingEnumeration ie = attribute.getAll(); ie.hasMore();) { + if (attribute.getID().equalsIgnoreCase("nickname")) { + user.setFirstName((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("initials")) { + user.setMiddleInitial((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("sn")) { + user.setLastName((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("employeeNumber")) { + user.setHrid((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("mail")) { + user.setEmail((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("telephoneNumber")) { + user.setPhone((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("departmentNumber")) { + user.setOrgCode((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("a1")) { + user.setOrgUserId((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("street")) { + user.setAddress1((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("roomNumber")) { + user.setAddress2((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("l")) { + user.setCity((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("st")) { + user.setState((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("postalCode")) { + user.setZipCode((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("zip4")) { + user.setZipCodeSuffix((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("physicalDeliveryOfficeName")) { + user.setLocationClli((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("bc")) { + user.setBusinessCountryCode((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("friendlyCountryName")) { + user.setBusinessCountryName((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("bd")) { + user.setDepartment((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("bdname")) { + user.setDepartmentName((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("jtname")) { + user.setJobTitle((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("mgrid")) { + user.setOrgManagerUserId((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("a2")) { + user.setCommandChain((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("compcode")) { + user.setCompanyCode((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("compdesc")) { + user.setCompany((String) ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("bu")) { + user.setBusinessUnit((String)ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("buname")) { + user.setBusinessUnitName((String)ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("silo")) { + user.setSiloStatus((String)ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("costcenter")) { + user.setCostCenter((String)ie.next()); + } + else if (attribute.getID().equalsIgnoreCase("b2")) { + user.setFinancialLocCode((String)ie.next()); + } + else { //we don't care about returned attribute, let's move on + ie.next(); + } + + } + } + } + } catch (NamingException e) { + logger.error(EELFLoggerDelegate.errorLogger, "An error occurred while processing the following user from POST with an ORGUSERID of " + user.getOrgUserId() + e.getMessage()); + } finally { + + } + return user; + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginService.java new file mode 100644 index 0000000..113833b --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginService.java @@ -0,0 +1,36 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + + +import java.util.HashMap; + +import org.openecomp.portalsdk.core.command.LoginBean; + + +public interface LoginService { + + // validate user exists in the system + @SuppressWarnings("rawtypes") + LoginBean findUser(LoginBean bean, String menuPropertiesFilename, HashMap additionalParams) throws Exception; + + @SuppressWarnings("rawtypes") + LoginBean findUser(LoginBean bean, String menuPropertiesFilename, HashMap additionalParams, boolean matchPassword) throws Exception; +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceImpl.java new file mode 100644 index 0000000..7da427b --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceImpl.java @@ -0,0 +1,190 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.openecomp.portalsdk.core.command.LoginBean; +import org.openecomp.portalsdk.core.domain.Role; +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.menu.MenuBuilder; +import org.openecomp.portalsdk.core.service.support.FusionService; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.web.support.AppUtils; +import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service("loginService") +@Transactional +public class LoginServiceImpl extends FusionService implements LoginService { + + @SuppressWarnings("unused") + private MenuBuilder menuBuilder; + + @Autowired + private DataAccessService dataAccessService; + + + @SuppressWarnings("rawtypes") + public LoginBean findUser(LoginBean bean, String menuPropertiesFilename, HashMap additionalParams ) throws Exception { + return findUser(bean, menuPropertiesFilename, additionalParams, true); + } + + @SuppressWarnings("rawtypes") + public LoginBean findUser(LoginBean bean, String menuPropertiesFilename, HashMap additionalParams, boolean matchPassword) throws Exception { + User user = null; + User userCopy = null; + + if (bean.getUserid() != null && bean.getUserid() != null) { + user = (User)findUser(bean); + } + else { + if (matchPassword) + user = (User)findUser(bean.getLoginId(), bean.getLoginPwd()); + else + user = (User)findUserWithoutPwd(bean.getLoginId()); + } + + if (user != null) { + + // raise an error if the application is locked and the user does not have system administrator privileges + if (AppUtils.isApplicationLocked() && !UserUtils.hasRole(user, SystemProperties.getProperty(SystemProperties.SYS_ADMIN_ROLE_ID))) { + bean.setLoginErrorMessage(SystemProperties.MESSAGE_KEY_LOGIN_ERROR_APPLICATION_LOCKED); + } + + // raise an error if the user is inactive + if (!user.getActive()) { + bean.setLoginErrorMessage(SystemProperties.MESSAGE_KEY_LOGIN_ERROR_USER_INACTIVE); + } + + if (!userHasActiveRoles(user)) { + bean.setLoginErrorMessage(SystemProperties.MESSAGE_KEY_LOGIN_ERROR_USER_INACTIVE); + } + // only login the user if no errors have occurred + if (bean.getLoginErrorMessage() == null) { + + // this will be a snapshot of the user's information as retrieved from the database + userCopy = (User)user.clone(); + + // update the last logged in date for the user + user.setLastLoginDate(new Date()); + getDataAccessService().saveDomainObject(user, additionalParams); + + // update the audit log of the user + //Check for the client device type and set log attributes appropriately + + // save the above changes to the User and their audit trail + + // create the application menu based on the user's privileges + Set appMenu = getMenuBuilder().getMenu(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_SET_NAME),dataAccessService); + bean.setMenu(appMenu != null?appMenu:new HashSet()); + Set businessDirectMenu = getMenuBuilder().getMenu(SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_SET_NAME),dataAccessService); + bean.setBusinessDirectMenu(businessDirectMenu != null?businessDirectMenu:new HashSet()); + + bean.setUser(userCopy); + } + + } + + return bean; + } + + @SuppressWarnings("rawtypes") + private boolean userHasActiveRoles(User user) { + boolean hasActiveRole = false; + Iterator roles = user.getRoles().iterator(); + while (roles.hasNext()) { + Role role = (Role)roles.next(); + if (role.getActive()) { + hasActiveRole = true; + break; + } + } + return hasActiveRole; + } + + + @SuppressWarnings("rawtypes") + public User findUser(String loginId, String password) { + List list = null; + + StringBuffer criteria = new StringBuffer(); + criteria.append(" where login_id = '").append(loginId).append("'") + .append(" and login_pwd = '").append(password).append("'"); + + list = getDataAccessService().getList(User.class, criteria.toString(), null, null); + + return (list == null || list.size() == 0) ? null : (User)list.get(0); + } + + @SuppressWarnings("rawtypes") + private User findUserWithoutPwd(String loginId) { + List list = null; + + StringBuffer criteria = new StringBuffer(); + criteria.append(" where login_id = '").append(loginId).append("'"); + + list = getDataAccessService().getList(User.class, criteria.toString(), null, null); + + return (list == null || list.size() == 0) ? null : (User)list.get(0); + } + + + @SuppressWarnings("rawtypes") + public User findUser(LoginBean bean) { + List list = null; + + StringBuffer criteria = new StringBuffer(); + criteria.append(" where org_user_id = '").append(bean.getUserid()).append("'"); + + list = getDataAccessService().getList(User.class, criteria.toString(), null, null); + + return (list == null || list.size() == 0) ? null : (User)list.get(0); + } + + + public MenuBuilder getMenuBuilder() { + return new MenuBuilder(); + } + + + public void setMenuBuilder(MenuBuilder menuBuilder) { + this.menuBuilder = menuBuilder; + } + + + public DataAccessService getDataAccessService() { + return dataAccessService; + } + + + public void setDataAccessService(DataAccessService dataAccessService) { + this.dataAccessService = dataAccessService; + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsService.java new file mode 100644 index 0000000..596ebed --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsService.java @@ -0,0 +1,34 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.List; + +import org.openecomp.portalsdk.core.command.PostDroolsBean; + +public interface PostDroolsService { + + String execute(String droolsFile, String className, String selectedRules); + + List fetchDroolBeans(); + + String retrieveClass(String droolsFile); + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsServiceImpl.java new file mode 100644 index 0000000..726d897 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsServiceImpl.java @@ -0,0 +1,179 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.io.File; +import java.io.IOException; +import java.nio.file.DirectoryIteratorException; +import java.nio.file.DirectoryStream; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.kie.api.io.ResourceType; +import org.kie.internal.KnowledgeBase; +import org.kie.internal.KnowledgeBaseFactory; +import org.kie.internal.builder.KnowledgeBuilder; +import org.kie.internal.builder.KnowledgeBuilderFactory; +import org.kie.internal.definition.KnowledgePackage; +import org.kie.internal.io.ResourceFactory; +import org.kie.internal.runtime.StatefulKnowledgeSession; +import org.openecomp.portalsdk.core.command.PostDroolsBean; +import org.openecomp.portalsdk.core.drools.DroolsRuleService; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.fasterxml.jackson.databind.ObjectMapper; + + +@Service("postDroolsService") +@Transactional +public class PostDroolsServiceImpl implements PostDroolsService{ + + static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PostDroolsServiceImpl.class); + + @Override + public String execute(String droolsFile, String className, String selectedRules) { + logger.info(EELFLoggerDelegate.applicationLogger, "Executing Drools..."); + String resultsString = executeDemoRules(droolsFile, className, selectedRules); + return resultsString; + } + + + public List fetchDroolBeans() { + + List beanList = new ArrayList(); + Path path = FileSystems.getDefault().getPath(SystemProperties.getProperty(SystemProperties.FILES_PATH)); + try (DirectoryStream stream = Files.newDirectoryStream(path,"*.{drl}")) { + for (Path entry: stream) { + + PostDroolsBean postDroolsBean = new PostDroolsBean(); + String fileName = entry.getName(entry.getNameCount()-1).toString(); + postDroolsBean.setDroolsFile(fileName);//sample populated + postDroolsBean.setClassName(retrieveClass(fileName)); + //postDroolsBean.setSelectedRules("[\"NJ\",\"NY\",\"KY\"]"); + beanList.add(postDroolsBean); + } + } catch (DirectoryIteratorException ex) { + logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage()); + } catch (IOException e) { + logger.error(EELFLoggerDelegate.errorLogger, e.getMessage()); + } + return beanList; + } + + @Override + public String retrieveClass(String fileName) { + String resultsString = ""; + try { + // load up the knowledge base + final KnowledgeBuilder kbuilder = loadKBuilder(fileName); + final Collection pkgs = kbuilder.getKnowledgePackages(); + return pkgs.iterator().next().getFactTypes().iterator().next().getFactClass().getName(); + + } catch (Throwable t) { + logger.error(EELFLoggerDelegate.errorLogger, t.getMessage()); + } + + return resultsString; + } + + protected static KnowledgeBuilder loadKBuilder(String fileName) { + final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); + + // this will parse and compile in one step + kbuilder.add(ResourceFactory.newFileResource(SystemProperties.getProperty(SystemProperties.FILES_PATH) + File.separator + fileName), + ResourceType.DRL); + + if (kbuilder.hasErrors()) { + + logger.error(EELFLoggerDelegate.errorLogger, kbuilder.getErrors().toString()); + + throw new RuntimeException("Unable to compile \".drl\"."); + + } + return kbuilder; + } + + + @SuppressWarnings({ "deprecation", "unchecked" }) + public static String executeDemoRules(String fileName, String className, String ruleValue) { + String resultsString = ""; + try { + // load up the knowledge base + // KieServices ks = KieServices.Factory.get(); + // KieContainer kContainer = ks.getKieClasspathContainer(); + // KieSession kSession = kContainer.newKieSession("ksession-rules"); + + final KnowledgeBuilder kbuilder = loadKBuilder(fileName); + + // get the compiled packages (which are serializable) + + final Collection pkgs = kbuilder.getKnowledgePackages(); + + // add the packages to a knowledgebase (deploy the knowledge + // packages). + + final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); + + kbase.addKnowledgePackages(pkgs); + + final StatefulKnowledgeSession kSession = kbase.newStatefulKnowledgeSession(); + + ObjectMapper mapper = new ObjectMapper(); + if(ruleValue == null || ruleValue.equals("")) { + resultsString = "Please enter valid rule"; + return resultsString; + } + List selectedRules = mapper.readValue(ruleValue, List.class); + List ruleResponse = new ArrayList(); + + for(String rule : selectedRules){ + Class clazz = (Class) Class.forName(className); + DroolsRuleService droolsIntroduction =clazz.newInstance(); + droolsIntroduction.init(rule); + kSession.insert(droolsIntroduction); + kSession.fireAllRules(); + ruleResponse.add(droolsIntroduction.getResultsString()); + } + + resultsString = mapper.writeValueAsString(ruleResponse); + +// kSession.insert(new DroolsRuleService("KY")); +// kSession.fireAllRules(); +// +// kSession.setGlobal("age", "25"); +// kSession.insert(new DroolsRuleService("NY")); +// kSession.fireAllRules(); + } catch (Throwable t) { + logger.error(EELFLoggerDelegate.errorLogger, t.getMessage()); + } + + return resultsString; + } + + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchService.java new file mode 100644 index 0000000..55c9db3 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchService.java @@ -0,0 +1,30 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import javax.servlet.http.HttpServletRequest; + +import org.openecomp.portalsdk.core.command.PostSearchBean; + +public interface PostSearchService { + + void process(HttpServletRequest request, PostSearchBean postSearch); + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchServiceImpl.java new file mode 100644 index 0000000..2ecedbe --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchServiceImpl.java @@ -0,0 +1,203 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import org.openecomp.portalsdk.core.FusionObject.Parameters; +import org.openecomp.portalsdk.core.command.PostSearchBean; +import org.openecomp.portalsdk.core.domain.Lookup; +import org.openecomp.portalsdk.core.domain.Role; +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.portalsdk.core.web.support.FeedbackMessage; +import org.openecomp.portalsdk.core.web.support.MessagesList; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service("postSearchService") +@Transactional +public class PostSearchServiceImpl implements PostSearchService{ + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PostSearchServiceImpl.class); + + @Autowired + private DataAccessService dataAccessService; + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void process(HttpServletRequest request, PostSearchBean postSearch) { + HashMap additionalParams = new HashMap(); + additionalParams.put(Parameters.PARAM_HTTP_REQUEST, request); + + if (postSearch.getSelected() != null) { + //sort the selected users for quick validation + + Arrays.sort(postSearch.getSelected()); + System.out.println("list - " + postSearch.getPostOrgUserId().length); + // import the users that have been selected + for(int i=0; i < postSearch.getPostOrgUserId().length; i++){ + if (Arrays.binarySearch(postSearch.getSelected(), postSearch.getPostOrgUserId()[i]) >= 0) { + logger.info(EELFLoggerDelegate.debugLogger, "Adding ORGUSERID - " + postSearch.getPostOrgUserId()[i]); + logger.info(EELFLoggerDelegate.auditLogger, "Import new user from webphone " + postSearch.getPostOrgUserId()[i]); + + User user = new User(); + user.setLastName(postSearch.getPostLastName()[i]); + user.setFirstName(postSearch.getPostFirstName()[i]); + + if (postSearch.getPostHrid() != null && postSearch.getPostHrid().length > 0) { + user.setHrid(postSearch.getPostHrid()[i]); + } + + if (postSearch.getPostPhone() != null && postSearch.getPostPhone().length > 0) { + user.setPhone(postSearch.getPostPhone()[i]); + } + + if (postSearch.getPostEmail() != null && postSearch.getPostEmail().length > 0) { + user.setEmail(postSearch.getPostEmail()[i]); + } + + if (postSearch.getPostOrgUserId() != null && postSearch.getPostOrgUserId().length > 0) { + user.setOrgUserId(postSearch.getPostOrgUserId()[i]); + user.setLoginId(postSearch.getPostOrgUserId()[i]); + } + + if (postSearch.getPostAddress1() != null && postSearch.getPostAddress1().length > 0) { + user.setAddress1(postSearch.getPostAddress1()[i]); + } + + if (postSearch.getPostAddress2() != null && postSearch.getPostAddress2().length > 0) { + user.setAddress2(postSearch.getPostAddress2()[i]); + } + + if (postSearch.getPostCity() != null && postSearch.getPostCity().length > 0) { + user.setCity(postSearch.getPostCity()[i]); + } + + if (postSearch.getPostState() != null && postSearch.getPostState().length > 0) { + user.setState(postSearch.getPostState()[i]); + } + + if (postSearch.getPostZipCode() != null && postSearch.getPostZipCode().length > 0) { + user.setZipCode(postSearch.getPostZipCode()[i]); + } + + if (postSearch.getPostLocationClli() != null && postSearch.getPostLocationClli().length > 0) { + user.setLocationClli(postSearch.getPostLocationClli()[i]); + } + + if (postSearch.getPostBusinessCountryCode() != null && postSearch.getPostBusinessCountryCode().length > 0) { + user.setBusinessCountryCode(postSearch.getPostBusinessCountryCode()[i]); + } + + if (postSearch.getPostBusinessCountryName() != null && postSearch.getPostBusinessCountryName().length > 0) { + + // find the country cd for the indicated country + List countries = dataAccessService.getLookupList("fn_lu_country", "country_cd", "country", "country = '" + + postSearch.getPostBusinessCountryName()[i] + "'", null, null); + + if (countries!=null&&countries.size() == 1) { + Lookup country = (Lookup)countries.get(0); + user.setCountry(country.getValue()); + } + else { + logger.info(EELFLoggerDelegate.debugLogger, "No countries or more than one country was found matching the country returned from WEBPHONE. " + + "Therefore, no country was set for this user."); + } + + } + + if (postSearch.getPostDepartment() != null && postSearch.getPostDepartment().length > 0) { + user.setDepartment(postSearch.getPostDepartment()[i]); + } + + if (postSearch.getPostDepartmentName() != null && postSearch.getPostDepartmentName().length > 0) { + user.setDepartmentName(postSearch.getPostDepartmentName()[i]); + } + + if (postSearch.getPostBusinessUnit() != null && postSearch.getPostBusinessUnit().length > 0) { + user.setBusinessUnit(postSearch.getPostBusinessUnit()[i]); + } + + if (postSearch.getPostBusinessUnitName() != null && postSearch.getPostBusinessUnitName().length > 0) { + user.setBusinessUnitName(postSearch.getPostBusinessUnitName()[i]); + } + + if (postSearch.getPostJobTitle() != null && postSearch.getPostJobTitle().length > 0) { + user.setJobTitle(postSearch.getPostJobTitle()[i]); + } + + if (postSearch.getPostOrgManagerUserId() != null && postSearch.getPostOrgManagerUserId().length > 0) { + user.setOrgManagerUserId(postSearch.getPostOrgManagerUserId()[i]); + } + + if (postSearch.getPostCommandChain() != null && postSearch.getPostCommandChain().length > 0) { + user.setCommandChain(postSearch.getPostCommandChain()[i]); + } + + if (postSearch.getPostCompanyCode() != null && postSearch.getPostCompanyCode().length > 0) { + user.setCompanyCode(postSearch.getPostCompanyCode()[i]); + } + + if (postSearch.getPostCompany() != null && postSearch.getPostCompany().length > 0) { + user.setCompany(postSearch.getPostCompany()[i]); + } + + if (postSearch.getPostCostCenter() != null && postSearch.getPostCostCenter().length > 0) { + user.setCostCenter(postSearch.getPostCostCenter()[i]); + } + + if (postSearch.getPostSiloStatus() != null && postSearch.getPostSiloStatus().length > 0) { + user.setSiloStatus(postSearch.getPostSiloStatus()[i]); + } + + if (postSearch.getPostFinancialLocCode() != null && postSearch.getPostFinancialLocCode().length > 0) { + user.setFinancialLocCode(postSearch.getPostFinancialLocCode()[i]); + } + + user.setActive(true); + + try { + dataAccessService.saveDomainObject(user, additionalParams); + + Role role = (Role)dataAccessService.getDomainObject(Role.class,Long.valueOf(SystemProperties.getProperty(SystemProperties.POST_DEFAULT_ROLE_ID)), null); + user.addRole(role); + } + catch (Exception e) { + MessagesList messages = new MessagesList(); + messages.addExceptionMessage(new FeedbackMessage("An error occurred while attempting to import " + user.getFirstName() + " " + + user.getLastName() + ": " + e.getMessage(), FeedbackMessage.MESSAGE_TYPE_ERROR)); + + } + } + } + + } + + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileService.java new file mode 100644 index 0000000..61bd3b6 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileService.java @@ -0,0 +1,36 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.List; + +import org.openecomp.portalsdk.core.domain.Profile; +import org.openecomp.portalsdk.core.domain.User; + + +public interface ProfileService { + List findAll(); + + Profile getProfile(int id); + + User getUser(String id); + + void saveUser(User user); +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceImpl.java new file mode 100644 index 0000000..3927d72 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceImpl.java @@ -0,0 +1,72 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.List; + +import org.openecomp.portalsdk.core.dao.ProfileDao; +import org.openecomp.portalsdk.core.domain.Profile; +import org.openecomp.portalsdk.core.domain.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service("profileService") +@Transactional +public class ProfileServiceImpl implements ProfileService{ + + @Autowired + private ProfileDao profileDao; + + @Autowired + private DataAccessService dataAccessService; + + @SuppressWarnings("unchecked") + public List findAll() { + return getDataAccessService().getList(Profile.class, null); + } + + public User getUser(String userId){ + return (User) getDataAccessService().getDomainObject(User.class, Long.parseLong(userId), null); + } + + public void saveUser(User user){ + + getDataAccessService().saveDomainObject(user, null); + } + + + public Profile getProfile(int id) { + return profileDao.getProfile(id); + } + + + public DataAccessService getDataAccessService() { + return dataAccessService; + } + + + public void setDataAccessService(DataAccessService dataAccessService) { + this.dataAccessService = dataAccessService; + } + + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleService.java new file mode 100644 index 0000000..01367ec --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleService.java @@ -0,0 +1,50 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.List; + +import org.openecomp.portalsdk.core.domain.Role; +import org.openecomp.portalsdk.core.domain.RoleFunction; + + +public interface RoleService { + List getRoleFunctions(); + + List getAvailableChildRoles(Long roleId); + + Role getRole(Long id); + + void saveRole(Role domainRole); + + void deleteRole(Role domainRole); + + List getAvailableRoles(); + + List getActiveRoles(); + + RoleFunction getRoleFunction(String code); + + void saveRoleFunction(RoleFunction domainRoleFunction); + + void deleteRoleFunction(RoleFunction domainRoleFunction); + + void deleteDependcyRoleRecord(Long id); +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceImpl.java new file mode 100644 index 0000000..e71e0c5 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceImpl.java @@ -0,0 +1,171 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +import javax.sql.DataSource; + +import org.openecomp.portalsdk.core.domain.Role; +import org.openecomp.portalsdk.core.domain.RoleFunction; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service("roleService") +@Transactional +public class RoleServiceImpl implements RoleService{ + + @Autowired + private DataAccessService dataAccessService; + + DataSource dataSource; + + public DataSource getDataSource() { + return dataSource; + } + + + @Autowired + public void setDataSource(DataSource dataSource) { + this.dataSource = dataSource; + } + + @SuppressWarnings("unchecked") + public List getRoleFunctions() { + //List msgDB = getDataAccessService().getList(Profile.class, null); + return getDataAccessService().getList(RoleFunction.class, null); + } + + @SuppressWarnings("unchecked") + public List getAvailableChildRoles(Long roleId) { + List availableChildRoles = (List)getDataAccessService().getList(Role.class,null); + if(roleId==null || roleId==0){ + return availableChildRoles; + } + + Role currentRole = (Role)getDataAccessService().getDomainObject(Role.class,roleId,null); + Set allParentRoles = new TreeSet(); + allParentRoles = getAllParentRolesAsList(currentRole, allParentRoles); + + + Iterator availableChildRolesIterator = availableChildRoles.iterator(); + while (availableChildRolesIterator.hasNext()) { + Role role = availableChildRolesIterator.next(); + if(!role.getActive() || allParentRoles.contains(role) || role.getId().equals(roleId)){ + availableChildRolesIterator.remove(); + } + } + return availableChildRoles; + } + + @SuppressWarnings("unchecked") + private Set getAllParentRolesAsList(Role role, Set allParentRoles) { + Set parentRoles = role.getParentRoles(); + allParentRoles.addAll(parentRoles); + Iterator parentRolesIterator = parentRoles.iterator(); + while (parentRolesIterator.hasNext()) { + getAllParentRolesAsList(parentRolesIterator.next(),allParentRoles); + } + return allParentRoles; + } + + public RoleFunction getRoleFunction(String code) { + return (RoleFunction)getDataAccessService().getDomainObject(RoleFunction.class, code, null); + } + + public void saveRoleFunction(RoleFunction domainRoleFunction) { + getDataAccessService().saveDomainObject(domainRoleFunction, null); + } + + public void deleteRoleFunction(RoleFunction domainRoleFunction) { + getDataAccessService().deleteDomainObject(domainRoleFunction, null); + } + + public Role getRole(Long id) { + return (Role)getDataAccessService().getDomainObject(Role.class, id, null); + } + + public void saveRole(Role domainRole) { + getDataAccessService().saveDomainObject(domainRole, null); + } + + public void deleteRole(Role domainRole) { + getDataAccessService().deleteDomainObject(domainRole, null); + } + + @SuppressWarnings("unchecked") + public List getAvailableRoles() { + return getDataAccessService().getList(Role.class, null); + } + + @SuppressWarnings("unchecked") + @Override + public List getActiveRoles() { + String filter = " where active_yn = 'Y' "; + return getDataAccessService().getList(Role.class, filter, null,null); + } + + public DataAccessService getDataAccessService() { + return dataAccessService; + } + + + public void setDataAccessService(DataAccessService dataAccessService) { + this.dataAccessService = dataAccessService; + } + + @Override + public void deleteDependcyRoleRecord(Long id) { + + Connection conn = null; + Statement stmt = null; + + try { + conn = getDataSource().getConnection(); + stmt = conn.createStatement(); + String sql = "delete from fn_user_role where role_id = '" + id + "'"; + stmt.executeUpdate(sql); + stmt.close(); + conn.close(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (stmt != null) + stmt.close(); + } catch (SQLException se2) {} + try { + if (conn != null) + conn.close(); + } catch (SQLException se) { se.printStackTrace();} + } + + } + + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceNonSpringImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceNonSpringImpl.java new file mode 100644 index 0000000..bd6796c --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceNonSpringImpl.java @@ -0,0 +1,122 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; +/*package org.openecomp.portalsdk.core.service; + +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import org.openecomp.portalsdk.core.domain.Role; +import org.openecomp.portalsdk.core.domain.RoleFunction; + +@Service("roleService") +@Transactional +public class RoleServiceNonSpringImpl implements RoleService{ + + @Autowired + private DataAccessService dataAccessService; + + @SuppressWarnings("unchecked") + public List getRoleFunctions() { + //List msgDB = getDataAccessService().getList(Profile.class, null); + return getDataAccessService().getList(RoleFunction.class, null); + } + + @SuppressWarnings("unchecked") + public List getAvailableChildRoles(Long roleId) { + List availableChildRoles = (List)getDataAccessService().getList(Role.class,null); + if(roleId==null || roleId==0){ + return availableChildRoles; + } + + Role currentRole = (Role)getDataAccessService().getDomainObject(Role.class,roleId,null); + Set allParentRoles = new TreeSet(); + allParentRoles = getAllParentRolesAsList(currentRole, allParentRoles); + + + Iterator availableChildRolesIterator = availableChildRoles.iterator(); + while (availableChildRolesIterator.hasNext()) { + Role role = availableChildRolesIterator.next(); + if(!role.getActive() || allParentRoles.contains(role) || role.getId().equals(roleId)){ + availableChildRolesIterator.remove(); + } + } + return availableChildRoles; + } + + @SuppressWarnings("unchecked") + private Set getAllParentRolesAsList(Role role, Set allParentRoles) { + Set parentRoles = role.getParentRoles(); + allParentRoles.addAll(parentRoles); + Iterator parentRolesIterator = parentRoles.iterator(); + while (parentRolesIterator.hasNext()) { + getAllParentRolesAsList(parentRolesIterator.next(),allParentRoles); + } + return allParentRoles; + } + + public RoleFunction getRoleFunction(String code) { + return (RoleFunction)getDataAccessService().getDomainObject(RoleFunction.class, code, null); + } + + public void saveRoleFunction(RoleFunction domainRoleFunction) { + getDataAccessService().saveDomainObject(domainRoleFunction, null); + } + + public void deleteRoleFunction(RoleFunction domainRoleFunction) { + getDataAccessService().deleteDomainObject(domainRoleFunction, null); + } + + public Role getRole(Long id) { + return (Role)getDataAccessService().getDomainObject(Role.class, id, null); + } + + public void saveRole(Role domainRole) { + getDataAccessService().saveDomainObject(domainRole, null); + } + + public void deleteRole(Role domainRole) { + getDataAccessService().deleteDomainObject(domainRole, null); + } + + @SuppressWarnings("unchecked") + public List getAvailableRoles() { + return getDataAccessService().getList(Role.class, null); + } + + public DataAccessService getDataAccessService() { + return dataAccessService; + } + + + public void setDataAccessService(DataAccessService dataAccessService) { + this.dataAccessService = dataAccessService; + } + + + +} +*/ diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileService.java new file mode 100644 index 0000000..0cf3986 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileService.java @@ -0,0 +1,36 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.List; + +import org.openecomp.portalsdk.core.domain.User; + + +public interface UserProfileService { + List findAll(); + User getUser(String id); + User getUserByLoginId(String loginId); + void saveUser(User user); + public List findAllUserWithOnOffline(String originOrgUserId); + List findAllActive(); + List searchPost(User user, String sortBy1, String sortBy2, String sortBy3, int pageNo, int newDataSize, + int intValue); +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceImpl.java new file mode 100644 index 0000000..e089991 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceImpl.java @@ -0,0 +1,210 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.SortedSet; + +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Restrictions; +import org.json.JSONArray; +import org.json.JSONObject; +import org.openecomp.portalsdk.core.FusionObject.Utilities; +import org.openecomp.portalsdk.core.domain.Role; +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.domain.support.CollaborateList; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service("userProfileService") +@Transactional +public class UserProfileServiceImpl implements UserProfileService{ + + + @Autowired + private DataAccessService dataAccessService; + + @SuppressWarnings("unchecked") + public List findAll() { + return getDataAccessService().getList(User.class, null); + } + + public User getUser(String userId){ + return (User) getDataAccessService().getDomainObject(User.class, Long.parseLong(userId), null); + } + + @SuppressWarnings("unchecked") + public User getUserByLoginId(String loginId){ + User user=null; + List restrictionsList = new ArrayList(); + Criterion criterion1= Restrictions.eq("loginId",loginId); + restrictionsList.add(criterion1); + List users = (List) getDataAccessService().getList(User.class,null, restrictionsList, null); + if(users!=null && users.size()==1) + user = users.get(0); + return user; + } + + public void saveUser(User user){ + + getDataAccessService().saveDomainObject(user, null); + } + + public DataAccessService getDataAccessService() { + return dataAccessService; + } + + + public void setDataAccessService(DataAccessService dataAccessService) { + this.dataAccessService = dataAccessService; + } + + @SuppressWarnings("unchecked") + public List findAllUserWithOnOffline(String originOrgUserId) { + HashSet onlineUser = CollaborateList.getInstance().getAllUserName(); + List users = getDataAccessService().getList(User.class, null); + for(User u:users){ + if(onlineUser.contains(u.getOrgUserId())) + u.setOnline(true); + if(u.getOrgUserId()!=null){ + if(originOrgUserId.compareTo(u.getOrgUserId()) > 0) { + u.setChatId(originOrgUserId + "-" + u.getOrgUserId()); + } else u.setChatId(u.getOrgUserId() + "-" + originOrgUserId ); + } + } + return users; + + } + + @SuppressWarnings("unchecked") + public List findAllActive() { + List users = getDataAccessService().getList(User.class, null); + Iterator itr = users.iterator(); + while(itr.hasNext()){ + User u = (User) itr.next(); + if(!u.getActive()) + itr.remove();//if not active remove user from list + else { + SortedSet roles = u.getRoles(); + Iterator itrRoles = roles.iterator(); + while(itrRoles.hasNext()){ + Role role = (Role) itrRoles.next(); + if(!role.getActive()) + u.removeRole(role.getId());//if not active remove role from list + } + } + } + return users; + } + + + @Override + public List searchPost(User user, String sortBy1, String sortBy2, String sortBy3, int pageNo, + int newDataSize, int intValue) { + + List users=new ArrayList(); + List filterdUsers=new ArrayList(); + BufferedReader in = null; + + try{ + String url = SystemProperties.getProperty(SystemProperties.AUTH_USER_SERVER); + URL obj = new URL(url); + + HttpURLConnection con = (HttpURLConnection) obj.openConnection(); + + // optional default is GET + con.setRequestMethod("GET"); + con.setConnectTimeout(3000); + con.setReadTimeout(8000); + + StringBuffer response = new StringBuffer(); + + + + in = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8")); + String inputLine; + while ((inputLine = in.readLine()) != null) + response.append(inputLine); + + JSONObject jObject = new JSONObject(response.toString()); // json + JSONArray jsonUsers = jObject.getJSONArray("response"); // get data object + for (int i = 0; i < jsonUsers.length(); i++) { + JSONObject eachObject = jsonUsers.getJSONObject(i); + User eachUser = new User(); + eachUser.setOrgUserId(eachObject.get("id").toString());// getString("id")); + eachUser.setFirstName(eachObject.get("givenName").toString()); + eachUser.setLastName(eachObject.get("familyName").toString()); + eachUser.setEmail(eachObject.get("email").toString()); + + users.add(eachUser); + } + + for(int i = 0 ; i < users.size(); i ++){ + + if(Utilities.nvl(user.getFirstName()).length() > 0){ + if(!user.getFirstName().equalsIgnoreCase(users.get(i).getFirstName())){ + continue; + } + } + if(Utilities.nvl(user.getLastName()).length() > 0){ + if(!user.getLastName().equalsIgnoreCase(users.get(i).getLastName())){ + continue; + } + } + if(Utilities.nvl(user.getOrgUserId()).length() > 0){ + if(!user.getOrgUserId().equalsIgnoreCase(users.get(i).getOrgUserId())){ + continue; + } + } + if(Utilities.nvl(user.getEmail()).length() > 0){ + if(!user.getEmail().equalsIgnoreCase(users.get(i).getEmail())){ + continue; + } + } + + filterdUsers.add(users.get(i)); + + } + + }catch (Exception e){ + + }finally{ + try { + in.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return filterdUsers; + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallService.java new file mode 100644 index 0000000..a7a5ad0 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallService.java @@ -0,0 +1,26 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + + +public interface WebServiceCallService { + public boolean verifyRESTCredential(String secretKey, String requestAppName, String requestPassword)throws Exception; + /*public String get(String restURL, String restPath);*/ +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallServiceImpl.java new file mode 100644 index 0000000..3e1a1a4 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallServiceImpl.java @@ -0,0 +1,189 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service; + +import java.util.List; + +import org.openecomp.portalsdk.core.domain.App; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.util.CipherUtil; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service("webServiceCallService") +@Transactional +public class WebServiceCallServiceImpl implements WebServiceCallService{ + + @Autowired + private DataAccessService dataAccessService; + + @Autowired + AppService appService; + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WebServiceCallServiceImpl.class); + + /** + * Verify REST Credential + * @return true if the credential is accepted; else false. + */ + @Override + public boolean verifyRESTCredential(String secretKey, String requestAppName, String requestPassword)throws Exception { + App app = appService.getDefaultApp(); + if (app!=null) { + String encriptedPwdDB = app.getAppPassword(); + String appUserName = app.getUsername(); + String decreptedPwd = CipherUtil.decrypt(encriptedPwdDB, secretKey==null?SystemProperties.getProperty(SystemProperties.Decryption_Key):secretKey); + if(decreptedPwd.equals(requestPassword) && appUserName.equals(requestAppName)) { + return true; + } + } + return false; + } + + /** + * Getting App information from FN_APP table + * @return App domain object, or null if not found. + */ + public App findApp(){ + List list = null; + StringBuffer criteria = new StringBuffer(); + criteria.append(" where id = 1"); + list = getDataAccessService().getList(App.class, criteria.toString(), null, null); + return (list == null || list.size() == 0) ? null : (App) list.get(0); + } + + public DataAccessService getDataAccessService() { + return dataAccessService; + } + + public void setDataAccessService(DataAccessService dataAccessService) { + this.dataAccessService = dataAccessService; + } + + /*/ + @Override + public String get(String restURL, String restPath) { + String appUserName = ""; + String appUebKey = ""; + String decreptedPwd = ""; + String appName = ""; + String inputLine = ""; + String serviceName = ""; + String loginId = ""; + StringBuffer jsonResponse = new StringBuffer(); + + StopWatch stopWatch = new StopWatch("WebServiceCallServiceImpl.get"); + stopWatch.start(); + try { + logger.info(EELFLoggerDelegate.metricsLogger, "WebServiceCallServiceImpl.get (" + restPath + ") operation is started."); + logger.debug(EELFLoggerDelegate.debugLogger, "WebServiceCallServiceImpl.get (" + restPath + ") operation is started."); + loginId = MDC.get("LoginId"); + appUebKey = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY); + App app = appService.getDefaultApp(); + if (app!=null) { + appName = app.getName(); + appUserName = app.getUsername(); + try{ + decreptedPwd = CipherUtil.decrypt(app.getAppPassword(), SystemProperties.getProperty(SystemProperties.Decryption_Key)); + } catch(Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in WebServiceCallServiceImpl.get while decrypting the password. Details: " + e.getMessage()); + } + } else { + logger.warn(EELFLoggerDelegate.errorLogger, "Unable to locate the app information from the database."); + appName = SystemProperties.SERVICE_NAME; + } + + //Create the connection object + URL obj = new URL(restURL + restPath); + HttpURLConnection con = (HttpURLConnection) obj.openConnection(); + con.setRequestMethod("GET"); + con.setConnectTimeout(3000); + con.setReadTimeout(8000); + + //add request header + con.setRequestProperty("username", appUserName); + con.setRequestProperty("password", decreptedPwd); + con.setRequestProperty("uebkey", appUebKey); + con.setRequestProperty(SystemProperties.LOGIN_ID, loginId); + con.setRequestProperty(SystemProperties.USERAGENT_NAME, appName); + con.setRequestProperty(SystemProperties.ECOMP_REQUEST_ID, MDC.get(MDC_KEY_REQUEST_ID)); + + //set MDC context for outgoing audit logging + serviceName = String.format("%s:%s.%s", appName, SystemProperties.ECOMP_PORTAL_BE, restPath); + MDC.put(Configuration.MDC_SERVICE_NAME, serviceName); + MDC.put(Configuration.MDC_REMOTE_HOST, restURL); + MDC.put(SystemProperties.MDC_APPNAME, appName); + MDC.put(SystemProperties.MDC_REST_PATH, restPath); + MDC.put(SystemProperties.MDC_REST_METHOD, "GET"); + + int responseCode = con.getResponseCode(); + logger.info(EELFLoggerDelegate.errorLogger, "Received the response code '" + responseCode + "' while getting the '" + restPath + "' for user: " + loginId); + + BufferedReader in = new BufferedReader( + new InputStreamReader(con.getInputStream())); + + while ((inputLine = in.readLine()) != null) { + jsonResponse.append(inputLine); + } + in.close(); + + logSecurityMessage(RESULT_ENUM.SUCCESS); + logger.debug(EELFLoggerDelegate.debugLogger, restPath + " response: " + jsonResponse.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, "WebServiceCallServiceImpl.get (" + restPath + ") operation is started."); + } catch(UrlAccessRestrictedException e) { + logger.error(EELFLoggerDelegate.errorLogger, "Authentication exception occurred in WebServiceCallServiceImpl.get (" + restPath + "). Details: " + e.getMessage()); + logSecurityMessage(RESULT_ENUM.FAILURE); + } catch(Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in WebServiceCallServiceImpl.get (" + restPath + "). Details: " + e.getMessage()); + logSecurityMessage(RESULT_ENUM.FAILURE); + } finally { + if (stopWatch.isRunning()) stopWatch.stop(); + MDC.put(SystemProperties.MDC_TIMER, stopWatch.getTotalTimeMillis() + "ms"); + logger.info(EELFLoggerDelegate.metricsLogger, "WebServiceCallServiceImpl.get (" + restPath + ") operation is completed."); + + //clear the temporary MDC context values + MDC.remove(SystemProperties.MDC_TIMER); + MDC.remove(SystemProperties.MDC_REST_METHOD); + MDC.remove(SystemProperties.MDC_REST_PATH); + MDC.remove(SystemProperties.MDC_APPNAME); + MDC.remove(Configuration.MDC_REMOTE_HOST); + MDC.remove(Configuration.MDC_SERVICE_NAME); + } + + return jsonResponse.toString(); + } + + //Handles all the outgoing rest/ueb messages. + public void logSecurityMessage(RESULT_ENUM isSuccess) { + String additionalInfo = ""; + String protocol = "HTTP"; + String loginId = MDC.get("LoginId"); + additionalInfo = String.format("Rest API=%s, Rest Method=%s, App-Name=%s, Request-URL=%s", + MDC.get(SystemProperties.MDC_REST_PATH), MDC.get(SystemProperties.MDC_REST_METHOD), + MDC.get(SystemProperties.MDC_APPNAME), MDC.get(Configuration.MDC_REMOTE_HOST)); + + logger.info(EELFLoggerDelegate.auditLogger, AuditLogFormatter.getInstance().createMessage( + protocol, SecurityEventTypeEnum.OUTGOING_REST_MESSAGE.name(), loginId, SystemProperties.SERVICE_NAME, + isSuccess.name(), additionalInfo)); + } + /**/ +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/FusionService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/FusionService.java new file mode 100644 index 0000000..34649ee --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/FusionService.java @@ -0,0 +1,27 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service.support; + + +import org.openecomp.portalsdk.core.FusionObject; + +public class FusionService implements FusionObject { + /** Logger for this class and subclasses */ +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocator.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocator.java new file mode 100644 index 0000000..5858c3f --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocator.java @@ -0,0 +1,27 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service.support; + +import javax.naming.directory.DirContext; + + +public interface ServiceLocator { + DirContext getDirContext(String initialContextFactory, String providerUrl, String securityPrincipal); +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocatorImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocatorImpl.java new file mode 100644 index 0000000..e743783 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocatorImpl.java @@ -0,0 +1,74 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.service.support; + +import java.util.Properties; + +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.directory.DirContext; +import javax.naming.directory.InitialDirContext; +import javax.naming.ldap.InitialLdapContext; + +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.springframework.stereotype.Service; + +/** + * This class implements the J2EE service locator pattern. It provides lookup + * facilities for various services. Currenttly LDAP (pre-v3) is supported + */ +@Service("serviceLocator") +public class ServiceLocatorImpl implements ServiceLocator { + + private Context context; // JNDI context (not currently in use) + private Context rootContext; // Java env root context (not currently in use) + private DirContext dirContext; // LDAP DIR context + private InitialLdapContext ldapContext; // LDAP context LDAPv3-style (not currently in use) + + + // cannot directly instantiate + public ServiceLocatorImpl() {} + + // Get an LDAP directory context + public DirContext getDirContext(String initialContextFactory, String providerUrl, String securityPrincipal) { + + if (dirContext == null) { + + Properties properties = new Properties(); + properties.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory); + properties.put(Context.PROVIDER_URL, providerUrl); + properties.put(Context.SECURITY_PRINCIPAL, securityPrincipal); + + try { + dirContext = new InitialDirContext(properties); + } + catch (NamingException ne) { + logger.error(EELFLoggerDelegate.errorLogger, "An error has occurred while creating an Initial Directory Context: " + ne.getMessage()); + logger.error(EELFLoggerDelegate.errorLogger, "Explanation: " + ne.getExplanation()); + } + } + + return dirContext; + } + + /** Logger for this class and subclasses */ + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ServiceLocatorImpl.class); + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/CacheManager.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/CacheManager.java new file mode 100644 index 0000000..e26ac88 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/CacheManager.java @@ -0,0 +1,43 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.util; + +import org.openecomp.portalsdk.core.objectcache.jcs.JCSCacheManager; +import org.springframework.context.annotation.Configuration; +@Configuration +public class CacheManager extends JCSCacheManager { + public CacheManager() { + + } + + /* The following can be customized for your application to cache the appropriate data upon application startup. The provided + example retrieves a list of sample lookup data and puts the list in the Cache Manager. To retrieve that data, simply call the + Cache Manager's getObject(String key) method which will return an Object instance. To put additional data in the Cache Manager + outside of application startup, call the Cache Manager's putObject(String key, Object objectToCache) method. */ + public void loadLookUpCache() { + /* + List result = (List)getDataAccessService().getList(Role.class,null); + + if (result != null) { + putObject("lookupRoles", result); + }*/ + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/CipherUtil.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/CipherUtil.java new file mode 100644 index 0000000..0eec929 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/CipherUtil.java @@ -0,0 +1,125 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.util; + +import javax.crypto.Cipher; +import javax.crypto.spec.SecretKeySpec; + +import org.apache.commons.codec.binary.Base64; + +public class CipherUtil { + + private final static String key = "AGLDdG4D04BKm2IxIWEr8o==!"; + + /** + * @param plainText + * @param secretKey + * @return encrypted version of plain text. + * @throws Exception + */ + public static String encrypt(String plainText, String secretKey) throws Exception{ + byte[] rawKey; + String encryptedString; + SecretKeySpec sKeySpec; + byte[] encryptText = plainText.getBytes("UTF-8"); + Cipher cipher; + rawKey = Base64.decodeBase64(secretKey); + sKeySpec = new SecretKeySpec(rawKey, "AES"); + cipher = Cipher.getInstance("AES"); + cipher.init(Cipher.ENCRYPT_MODE, sKeySpec); + encryptedString = Base64.encodeBase64String(cipher.doFinal(encryptText)); + + return encryptedString; + } + + /** + * + * @param plainText + * @return Encrypted Text + * @throws Exception + */ + public static String encrypt(String plainText) throws Exception + { + return CipherUtil.encrypt(plainText,key); + } + + /** + * @param encryptedText + * @param secretKey + * @return plain text version of encrypted text + * @throws Exception + */ + public static String decrypt(String encryptedText, String secretKey) throws Exception { + Cipher cipher; + String encryptedString; + byte[] encryptText = null; + byte[] rawKey; + SecretKeySpec sKeySpec; + + rawKey = Base64.decodeBase64(secretKey); + sKeySpec = new SecretKeySpec(rawKey, "AES"); + encryptText = Base64.decodeBase64(encryptedText.getBytes("UTF-8")); + cipher = Cipher.getInstance("AES"); + cipher.init(Cipher.DECRYPT_MODE, sKeySpec); + encryptedString = new String(cipher.doFinal(encryptText)); + + return encryptedString; + } + + /** + * @param encryptedText + * @return Decrypted Text + * @throws Exception + */ + public static String decrypt(String encryptedText) throws Exception + { + return CipherUtil.decrypt(encryptedText,key); + } + + + public static void main(String[] args) throws Exception { + + String password = "Welcome123"; + String encrypted; + String decrypted; + + if (args.length != 2) { + System.out.println("Default password testing... "); + System.out.println("Plain password: " + password); + encrypted = encrypt(password); + System.out.println("Encrypted password: " + encrypted); + decrypted = decrypt(encrypted); + System.out.println("Decrypted password: " + decrypted); + } else { + String whatToDo = args[0]; + if (whatToDo.equalsIgnoreCase("d")) { + encrypted = args[1]; + System.out.println("Encrypted Text: " + encrypted); + decrypted = decrypt(encrypted); + System.out.println("Decrypted Text: " + decrypted); + } else { + decrypted = args[1]; + System.out.println("Plain Text: " + decrypted); + encrypted = encrypt(decrypted); + System.out.println("Encrypted Text" + encrypted); + } + } + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/EncDecUtilTest.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/EncDecUtilTest.java new file mode 100644 index 0000000..46a2453 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/EncDecUtilTest.java @@ -0,0 +1,112 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.util; +import java.security.AlgorithmParameters; +import java.security.SecureRandom; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.SecretKey; +import javax.crypto.SecretKeyFactory; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.PBEKeySpec; +import javax.crypto.spec.SecretKeySpec; + +import org.apache.commons.codec.binary.Base64; + +public class EncDecUtilTest { + + private static final String password = "test"; + private static final String salt = "r n�HN~��|f��X�" ; + private static int pswdIterations = 65536 ; + private static int keySize = 256; + private byte[] ivBytes; + + public String encrypt(String plainText) throws Exception { + + //get salt + //salt = generateSalt(); + byte[] saltBytes = salt.getBytes("UTF-8"); + + // Derive the key + SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); + PBEKeySpec spec = new PBEKeySpec( + password.toCharArray(), + saltBytes, + pswdIterations, + keySize + ); + + SecretKey secretKey = factory.generateSecret(spec); + SecretKeySpec secret = new SecretKeySpec(secretKey.getEncoded(), "AES"); + + //encrypt the message + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + cipher.init(Cipher.ENCRYPT_MODE, secret); + AlgorithmParameters params = cipher.getParameters(); + ivBytes = params.getParameterSpec(IvParameterSpec.class).getIV(); + byte[] encryptedTextBytes = cipher.doFinal(plainText.getBytes("UTF-8")); + return new Base64().encodeAsString(encryptedTextBytes); + } + + @SuppressWarnings("static-access") + public String decrypt(String encryptedText) throws Exception { + + byte[] saltBytes = salt.getBytes("UTF-8"); + byte[] encryptedTextBytes = new Base64().decodeBase64(encryptedText); + + // Derive the key + SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); + PBEKeySpec spec = new PBEKeySpec( + password.toCharArray(), + saltBytes, + pswdIterations, + keySize + ); + + SecretKey secretKey = factory.generateSecret(spec); + SecretKeySpec secret = new SecretKeySpec(secretKey.getEncoded(), "AES"); + + // Decrypt the message + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + cipher.init(Cipher.DECRYPT_MODE, secret, new IvParameterSpec(ivBytes)); + + + byte[] decryptedTextBytes = null; + try { + decryptedTextBytes = cipher.doFinal(encryptedTextBytes); + } catch (IllegalBlockSizeException e) { + e.printStackTrace(); + } catch (BadPaddingException e) { + e.printStackTrace(); + } + + return new String(decryptedTextBytes); + } + + public String generateSalt() { + SecureRandom random = new SecureRandom(); + byte bytes[] = new byte[20]; + random.nextBytes(bytes); + String s = new String(bytes); + return s; + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/EncTest.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/EncTest.java new file mode 100644 index 0000000..865731d --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/EncTest.java @@ -0,0 +1,39 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.util; + +public class EncTest { + + + public static void main(String[] args) { + String secretKey = "AGLDdG4D04BKm2IxIWEr8o=="; + String value1= "AppPassword!1"; + try { + String encryptedValue1= CipherUtil.encrypt(value1, secretKey); + System.out.println(encryptedValue1); + String decryptedValue1 = CipherUtil.decrypt(encryptedValue1, secretKey); + System.out.println(decryptedValue1); + } catch (Exception e) { + // Invalid key would throw an exception. + e.printStackTrace(); + } + + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/JSONUtil.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/JSONUtil.java new file mode 100644 index 0000000..6b849e8 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/JSONUtil.java @@ -0,0 +1,56 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.util; + +import java.util.HashMap; +import java.util.Map; + +import org.openecomp.portalsdk.core.domain.User; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class JSONUtil { + public static String convertResponseToJSON(String response) throws JsonProcessingException{ + ObjectMapper mapper = new ObjectMapper(); + Map responseMap = new HashMap(); + responseMap.put("response", response); + response = mapper.writeValueAsString(responseMap); + return response; + } + + public static User mapToDomainUser(User domainUser, User editUser) { + domainUser.setOrgId(editUser.getOrgId()); + domainUser.setManagerId(editUser.getManagerId()); + domainUser.setFirstName(editUser.getFirstName()); + domainUser.setMiddleInitial(editUser.getMiddleInitial()); + domainUser.setLastName(editUser.getLastName()); + domainUser.setPhone(editUser.getPhone()); + domainUser.setEmail(editUser.getEmail()); + domainUser.setHrid(editUser.getHrid()); + domainUser.setOrgUserId(editUser.getOrgUserId()); + domainUser.setOrgCode(editUser.getOrgCode()); + domainUser.setOrgManagerUserId(editUser.getOrgManagerUserId()); + domainUser.setJobTitle(editUser.getJobTitle()); + domainUser.setLoginId(editUser.getLoginId()); + domainUser.setActive(editUser.getActive()); + return domainUser; + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/SystemProperties.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/SystemProperties.java new file mode 100644 index 0000000..8bc6d7a --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/SystemProperties.java @@ -0,0 +1,279 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.util; + +import javax.servlet.ServletContext; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; + +/** + * SystemProperties contains a list of constants used throughout portions of the + * application. Populated by Spring from multiple configuration files. + * + * Should be used like this: + * + *
    + * 
    + * @Autowired
    + * SystemProperties systemProperties;
    + * 
    + */ +@Configuration +@PropertySource(value = { "${container.classpath:}/WEB-INF/conf/system.properties", + "${container.classpath:}/WEB-INF/fusion/conf/fusion.properties", + "${container.classpath:}/WEB-INF/conf/sql.properties" }) +public class SystemProperties { + + private static Environment environment; + + public SystemProperties() { + } + + protected Environment getEnvironment() { + return environment; + } + + @Autowired + public void setEnvironment(Environment environment) { + SystemProperties.environment = environment; + } + + public ServletContext getServletContext() { + return servletContext; + } + + public void setServletContext(ServletContext servletContext) { + this.servletContext = servletContext; + } + + + public static boolean containsProperty(String key) { + return environment.containsProperty(key); + } + + public static String getProperty(String key) { + if (environment!=null) { + return environment.getRequiredProperty(key); + } else { + return ""; + } + } + + // method created to get around JSTL 1.0 limitation of not being able to + // access a static method of a bean + public String getApplicationName() { + return getProperty(APPLICATION_NAME); + } + + public String getAppDisplayName() { + return getProperty(APP_DISPLAY_NAME); + } + + private ServletContext servletContext; + + // keys used to reference values in the system properties file + public static final String DOMAIN_CLASS_LOCATION = "domain_class_location"; + public static final String DEFAULT_ERROR_MESSAGE = "default_error_message"; + + public static final String AUTHENTICATION_MECHANISM = "authentication_mechanism"; + + public static final String APPLICATION_NAME = "application_name"; + public static final String HIBERNATE_CONFIG_FILE_PATH = "hibernate_config_file_path"; + public static final String APPLICATION_USER_ID = "application_user_id"; + + public static final String POST_INITIAL_CONTEXT_FACTORY = "post_initial_context_factory"; + public static final String POST_PROVIDER_URL = "post_provider_url"; + public static final String POST_SECURITY_PRINCIPAL = "post_security_principal"; + public static final String POST_MAX_RESULT_SIZE = "post_max_result_size"; + public static final String POST_DEFAULT_ROLE_ID = "post_default_role_id"; + + public static final String FILES_PATH = "files_path"; + public static final String TEMP_PATH = "temp_path"; + + public static final String NUM_UPLOAD_FILES = "num_upload_files"; + + public static final String SYS_ADMIN_ROLE_ID = "sys_admin_role_id"; + + public static final String SYS_ADMIN_ROLE_FUNCTION_DELETE_FROM_UI = "sys_admin_role_function_delete_from_ui"; + public static final String USER_NAME = "user_name"; + public static final String FIRST_NAME = "first_name"; + public static final String LAST_NAME = "last_name"; + public static final String APP_DISPLAY_NAME = "app_display_name"; + // Application base URL is a proper prefix of the on-boarding URL + public static final String APP_BASE_URL = "app_base_url"; + + public static final String MENU_PROPERTIES_FILE_LOCATION = "menu_properties_file_location"; + public static final String MENU_QUERY_NAME = "menu_query_name"; + public static final String APPLICATION_MENU_SET_NAME = "application_menu_set_name"; + public static final String APPLICATION_MENU_ATTRIBUTE_NAME = "application_menu_attribute_name"; + public static final String APPLICATION_MENU_PROPERTIES_NAME = "application_menu_properties_name"; + public static final String BUSINESS_DIRECT_MENU_SET_NAME = "business_direct_menu_set_name"; + public static final String BUSINESS_DIRECT_MENU_ATTRIBUTE_NAME = "business_direct_menu_attribute_name"; + public static final String BUSINESS_DIRECT_MENU_PROPERTIES_NAME = "business_direct_menu_properties_name"; + public static final String RAPTOR_CONFIG_FILE_PATH = "raptor_config_file_path"; + public static final String HOMEPAGE_DATA_CALLBACK_CLASS = "homepage_data_callback_class"; + public static final String ERROR_EMAIL_DISTRIBUTION = "error_email_distribution"; + public static final String ERROR_EMAIL_SOURCE_ADDRESS = "error_email_source_address"; + public static final String ERROR_EMAIL_SUBJECT_LINE = "error_email_subject_line"; + public static final String PROFILE_SEARCH_REPORT_ID = "profile_search_report_id"; + public static final String CALLABLE_PROFILE_SEARCH_REPORT_ID = "callable_profile_search_report_id"; + public static final String CLUSTERED = "clustered"; + + public static final String USER_ATTRIBUTE_NAME = "user_attribute_name"; + public static final String ROLES_ATTRIBUTE_NAME = "roles_attribute_name"; + public static final String ROLE_FUNCTIONS_ATTRIBUTE_NAME = "role_functions_attribute_name"; + public static final String CLIENT_DEVICE_ATTRIBUTE_NAME = "client_device_attribute_name"; + public static final String CLIENT_DEVICE_EMULATION = "client_device_emulation"; + public static final String CLIENT_DEVICE_TYPE_TO_EMULATE = "client_device_type_to_emulate"; + // File generation - Document + public static final String TEMPLATES_PATH = "templates_path"; + public static final String DOCUMENT_XML_ENCODING = "document_xml_encoding"; + + // Transaction + public static final String ROUTING_DATASOURCE_KEY = "routing_datasource_key"; + + // Document Library keys + public static final String DOCLIB_ADMIN_ROLE_ID = "doclib_admin_role_id"; + public static final String DOCLIB_USER_ROLE_ID = "doclib_user_role_id"; + + public static final String SYSTEM_PROPERTIES_FILENAME = "system.properties"; + public static final String FUSION_PROPERTIES_FILENAME = "fusion.properties"; + public static final String SUCCESS_TASKS_PROPERTIES_FILENAME = "success_tasks.properties"; + + // login error message keys + public static final String MESSAGE_KEY_LOGIN_ERROR_COOKIE_EMPTY = "login.error.hrid.empty"; + public static final String MESSAGE_KEY_LOGIN_ERROR_HEADER_EMPTY = "login.error.header.empty"; + public static final String MESSAGE_KEY_LOGIN_ERROR_USER_INACTIVE = "login.error.user.inactive"; + public static final String MESSAGE_KEY_LOGIN_ERROR_USER_NOT_FOUND = "login.error.hrid.not-found"; + public static final String MESSAGE_KEY_LOGIN_ERROR_APPLICATION_LOCKED = "login.error.application.locked"; + public static final String MESSAGE_KEY_AUTOLOGIN_NONE = "webphone.autoimport.nouser"; + public static final String MESSAGE_KEY_AUTOLOGIN_MULTIPLE = "webphone.autoimport.multiple"; + + // Application Mobile capability + public static final String MOBILE_ENABLE = "mobile_enable"; + + public static final String DATABASE_TIME_ZONE = "db.time_zone"; + + public static final String AUTO_USER_IMPORT_ENABLE = "auto_user_import_enable"; + public static final String AUTO_USER_IMPORT_ROLE = "auto_user_import_role"; + + public static final String ITRACKER_EMAIL_SOURCE_ADDRESS = "itracker_email_source_address"; + public static final String ITRACKER_EMAIL_DISTRIBUTION = "itracker_email_distribution"; + public static final String ITRACKER_SYSTEM_USER = "itracker_system_user_id"; + + public static final String MAIL_SERVER_HOST = "mail_server_host"; + public static final String MAIL_SERVER_PORT = "mail_server_port"; + + // Routing Data Source keys + public static final String ROUTING_DATASOURCE_KEY_NON_XA = "NON-XA"; + public static final String ROUTING_DATASOURCE_KEY_XA = "XA"; + public static final String QUARTZ_JOB_ENABLED = "quartz_job_enable"; + public static final String WORKFLOW_EMAIL_SENDER = "workflow_email_sender"; + public static final String DROOLS_GUVNOR_HOME = "drools.guvnor.home"; + + // Hibernate Config + public static final String HB_DIALECT = "hb.dialect"; + public static final String HB_SHOW_SQL = "hb.show_sql"; + // DataSource + public static final String DB_DRIVER = "db.driver"; + public static final String DB_CONNECTIONURL = "db.connectionURL"; + public static final String DB_USERNAME = "db.userName"; + public static final String DB_PASSWOR = "db.password"; + public static final String DB_MIN_POOL_SIZE = "db.min_pool_size"; + public static final String DB_MAX_POOL_SIZE = "db.max_pool_size"; + public static final String IDLE_CONNECTION_TEST_PERIOD = "hb.idle_connection_test_period"; + + public static final String MYLOGINS_FEED_CRON = "mylogins_feed_cron"; + public static final String SESSIONTIMEOUT_FEED_CRON = "sessiontimeout_feed_cron"; + public static final String LOG_CRON = "log_cron"; + + public static final String DB_ENCRYPT_FLAG = "db.encrypt_flag"; + + // Decryption Key + public static final String Decryption_Key = "decryption_key"; + + // Logging/Audit Fields + public static final String MDC_APPNAME = "AppName"; + public static final String MDC_REST_PATH = "RestPath"; + public static final String MDC_REST_METHOD = "RestMethod"; + public static final String INSTANCE_UUID = "instance_uuid"; + public static final String MDC_CLASS_NAME = "ClassName"; + public static final String MDC_LOGIN_ID = "LoginId"; + public static final String MDC_TIMER = "Timer"; + public static final String SDK_NAME = "ECOMP_SDK"; + public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID"; + public static final String PARTNER_NAME = "PartnerName"; + public static final String FULL_URL = "Full-URL"; + public static final String AUDITLOG_BEGIN_TIMESTAMP = "AuditLogBeginTimestamp"; + public static final String AUDITLOG_END_TIMESTAMP = "AuditLogEndTimestamp"; + public static final String METRICSLOG_BEGIN_TIMESTAMP = "MetricsLogBeginTimestamp"; + public static final String METRICSLOG_END_TIMESTAMP = "MetricsLogEndTimestamp"; + public static final String CLIENT_IP_ADDRESS = "ClientIPAddress"; + public static final String STATUS_CODE = "StatusCode"; + public static final String RESPONSE_CODE = "ResponseCode"; + public static final String TARGET_ENTITY = "TargetEntity"; //Component or sub component name + public static final String TARGET_SERVICE_NAME = "TargetServiceName"; //API or operation name + + // Logging Compliance + public static final String DOUBLE_WHITESPACE_SEPARATOR = " "; + public static final String SINGLE_WHITESPACE_SEPARATOR = " "; + public static final String SINGLE_QUOTE = "'"; + public static final String NA = "N/A"; + public static final String UNKNOWN = "Unknown"; + public static final String SECURITY_LOG_TEMPLATE = "Protocol:{0} Security-Event-Type:{1} Login-ID:{2} {3}"; + public static final String ECOMP_PORTAL_BE = "ECOMP_PORTAL_BE"; + public static final String PROTOCOL = "PROTOCOL"; + public static final String SECURIRY_EVENT_TYPE = "SECURIRY_EVENT_TYPE"; + public static final String LOGIN_ID = "LOGIN_ID"; + public static final String ACCESSING_CLIENT = "ACCESSING_CLIENT"; + public static final String RESULT_STR = "RESULT"; + public static final String ECOMP_PORTAL_FE = "ECOMP_PORTAL_FE"; + public static final String ADDITIONAL_INFO = "ADDITIONAL_INFO"; + public static final String INTERFACE_NAME = "INTERFACE_NAME"; + public static final String USERAGENT_NAME = "user-agent"; + + // Protocols + public static final String HTTP = "HTTP"; + public static final String HTTPS = "HTTPS"; + public static final String SSO_VALUE = "sso"; + + public enum RESULT_ENUM { + SUCCESS, FAILURE + } + + public enum SecurityEventTypeEnum { + FE_LOGIN_ATTEMPT, FE_LOGOUT, SSO_LOGIN_ATTEMPT_PHASE_1, SSO_LOGIN_ATTEMPT_PHASE_2, SSO_LOGOUT, LDAP_PHONEBOOK_USER_SEARCH, INCOMING_REST_MESSAGE, OUTGOING_REST_MESSAGE, REST_AUTHORIZATION_CREDENTIALS_MODIFIED, ECOMP_PORTAL_USER_MODIFIED, ECOMP_PORTAL_USER_ADDED, ECOMP_PORTAL_USER_REMOVED, ECOMP_PORTAL_WIDGET, INCOMING_UEB_MESSAGE, ECOMP_PORTAL_HEALTHCHECK + } + + // Menu + public static final String CONTACT_US_LINK = "contact_us_link"; + + //Left Menu + public static final String LEFT_MENU_PARENT = "parentList"; + public static final String LEFT_MENU_CHILDREND = "childItemList"; + + // URL of the portal site that provides the shared-context REST service + public static final String ECOMP_SHARED_CONTEXT_REST_URL = "ecomp_shared_context_rest_url"; + + public static final String AUTH_USER_SERVER = "authenticate_user_server"; +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/UsageUtils.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/UsageUtils.java new file mode 100644 index 0000000..a8cc7fd --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/UsageUtils.java @@ -0,0 +1,92 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.util; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; + +import javax.servlet.http.HttpSession; + +import org.openecomp.portalsdk.core.command.UserRowBean; +import org.openecomp.portalsdk.core.domain.User; + +public class UsageUtils { + @SuppressWarnings("rawtypes") + public static ArrayList getActiveUsers(HashMap activeUsers) { + ArrayList rows = new ArrayList(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); + + for(Iterator i = activeUsers.keySet().iterator(); i.hasNext(); ){ + String sessionId = (String)i.next(); + HttpSession session = (HttpSession)activeUsers.get(sessionId); + User userBean = (User)session.getAttribute("user"); + // + // Not all sessions will be valid logins + // Skip those ones + // + if(null == userBean) + continue; + + UserRowBean userRow = new UserRowBean(); + userRow.setFirstName(userBean.getFirstName()); + userRow.setLastName(userBean.getLastName()); + userRow.setEmail(userBean.getEmail()); + userRow.setId(userBean.getId()); + userRow.setSessionId(sessionId); + userRow.setLoginTime(sdf.format(new Date(session.getCreationTime()))); + userRow.setLastLoginTime(sdf.format(userBean.getLastLoginDate())); + + // + // Calculate the last time and time remaining for these sessions. + // + int sessionLength = session.getMaxInactiveInterval(); + long now = new java.util.Date().getTime(); + long lastAccessed = (now - session.getLastAccessedTime()) / 1000; + long lengthInactive = (now - session.getLastAccessedTime()); + long minutesRemaining = sessionLength - (lengthInactive / 1000); + + userRow.setLastAccess((lastAccessed / 60) + ":" + String.format("%02d", (lastAccessed % 60))); + userRow.setRemaining((minutesRemaining / 60) + ":" + String.format("%02d", (minutesRemaining % 60))); + + rows.add(userRow); + } + + return rows; + } + + @SuppressWarnings("rawtypes") + public static ArrayList getActiveUsersAfterDelete(HashMap activeUsers, final java.lang.Object data) { + return getActiveUsers(deleteSession(activeUsers,data)); + + } + + @SuppressWarnings("rawtypes") + private static HashMap deleteSession(HashMap activeUsers, Object data) { + String sessionId = ((UserRowBean)data).getSessionId(); + HttpSession session = (HttpSession)activeUsers.get(sessionId); + session.invalidate(); + activeUsers.remove(sessionId); + + return activeUsers; + } +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/YamlUtils.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/YamlUtils.java new file mode 100644 index 0000000..58bcb25 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/util/YamlUtils.java @@ -0,0 +1,69 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.util; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.Map; + +import org.yaml.snakeyaml.Yaml; +import org.yaml.snakeyaml.representer.Representer; + +public class YamlUtils { + + static Yaml yaml; + + static { + + Representer representer = new Representer(); + yaml = new Yaml(representer); + + } + + public static void writeYamlFile(String filePath, String fileName, + Map model) throws IOException { + FileWriter writer = new FileWriter(filePath + File.separator + fileName); + yaml.dump(model, writer); + writer.close(); + } + + public static String returnYaml( + Map model) throws IOException { + + return yaml.dump(model); + + } + + @SuppressWarnings("unchecked") + public static Map readYamlFile( + String filePath, String fileName) throws FileNotFoundException, + IOException { + FileReader reader = new FileReader(filePath + File.separator + fileName); + + Map callFlowBs = (Map)yaml.load(reader); + reader.close(); + return callFlowBs; + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/socket/PeerBroadcastSocket.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/socket/PeerBroadcastSocket.java new file mode 100644 index 0000000..ddf08c8 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/socket/PeerBroadcastSocket.java @@ -0,0 +1,104 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.web.socket; + +import java.io.IOException; +import java.util.Hashtable; +import java.util.Map; + +import javax.websocket.OnClose; +import javax.websocket.OnMessage; +import javax.websocket.OnOpen; +import javax.websocket.Session; +import javax.websocket.server.ServerEndpoint; + +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@ServerEndpoint("/contact") +public class PeerBroadcastSocket { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PeerBroadcastSocket.class); + + public static Map channelMap = new Hashtable(); + public Map sessionMap = new Hashtable(); + ObjectMapper mapper = new ObjectMapper(); + + @OnMessage + public void message(String message, Session session) { + try { + // JSONObject jsonObject = new JSONObject(message); + @SuppressWarnings("unchecked") + Map jsonObject = mapper.readValue(message, Map.class); + try { + Object from = jsonObject.get("from"); + if (from != null) { + channelMap.put(from.toString(), session); + sessionMap.put(session.getId(), from.toString()); + } + } catch (Exception je) { + logger.error(EELFLoggerDelegate.errorLogger, "Failed to read value" + je.getMessage()); + } + + try { + Object to = jsonObject.get("to"); + if (to == null) + return; + Object toSessionObj = channelMap.get(to); + if (toSessionObj != null) { + Session toSession = null; + toSession = (Session) toSessionObj; + toSession.getBasicRemote().sendText(message); + } + + } catch (Exception ex) { + logger.error(EELFLoggerDelegate.errorLogger, "Failed to send text" + ex.getMessage()); + } + + } catch (Exception ex) { + logger.error(EELFLoggerDelegate.errorLogger, "Failed" + ex.getMessage()); + } + + } + + @OnOpen + public void open(Session session) { + logger.info(EELFLoggerDelegate.debugLogger, "Channel opened"); + } + + @OnClose + public void close(Session session) { + String channel = sessionMap.get(session.getId()); + if (channel != null) { + Object sessObj = channelMap.get(channel); + if (sessObj != null) { + try { + ((Session) sessObj).close(); + } catch (IOException e) { + logger.error(EELFLoggerDelegate.errorLogger, "Failed to close" + e.getMessage()); + } + } + channelMap.remove(channel); + } + logger.info(EELFLoggerDelegate.debugLogger, "Channel closed"); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/socket/WebRTCSocket.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/socket/WebRTCSocket.java new file mode 100644 index 0000000..810cba5 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/socket/WebRTCSocket.java @@ -0,0 +1,143 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.web.socket; + +import java.util.Hashtable; +import java.util.Map; + +import javax.websocket.OnClose; +import javax.websocket.OnMessage; +import javax.websocket.OnOpen; +import javax.websocket.Session; +import javax.websocket.server.ServerEndpoint; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@ServerEndpoint("/webrtc") +public class WebRTCSocket { + + + public static Map> channelMap = new Hashtable>(); + public Map sessionMap = new Hashtable(); + ObjectMapper mapper = new ObjectMapper(); + + + @OnMessage + public void message(String message, Session session) { + try { + //JSONObject jsonObject = new JSONObject(message); + @SuppressWarnings("unchecked") + Map jsonObject = mapper.readValue(message, Map.class); + try { + Object isOpen = jsonObject.get("open"); + if(isOpen != null && (Boolean)isOpen == true) { + String channel = (String) jsonObject.get("channel"); + Object value = channelMap.get(channel); + Hashtable sourceDestMap = null; + if(value == null) + sourceDestMap = new Hashtable(); + else + sourceDestMap = (Hashtable) value; + + sourceDestMap.put(session.getId(), new Object[]{session}); + channelMap.put(channel, sourceDestMap); + sessionMap.put(session.getId(), channel); + + + } + } + catch (Exception je) { + je.printStackTrace(); + } + + try{ + + Object dataObj = jsonObject.get("data"); + if(dataObj == null) + return; + Map dataMapObj = ( Map)dataObj; + //Object thisUserId = dataMapObj.get("userid"); + String channel = null; + try{ + Object channelObj = dataMapObj.get("sessionid"); + if(channelObj != null) + channel = (String) channelObj; + else + channel = (String) jsonObject.get("channel"); + } + catch(Exception json) { + json.printStackTrace(); + } + + /* + JSONObject dataMapObj = (JSONObject)dataObj; + Object thisUserId = dataMapObj.get("userid"); + String channel = (String) dataMapObj.get("sessionid"); + Hashtable sourceDestMap = sessionMap.get(channel); + + if(thisUserId != null && sourceDestMap.get((String)thisUserId) == null) { + sourceDestMap.put((String)thisUserId, new Object[] {message, session}); + } + + for(String userId : sourceDestMap.keySet()){ + if(!userId.equals(thisUserId)) { + Session otherSession = (Session) ((Object[])sourceDestMap.get(userId))[1]; + otherSession.getBasicRemote().sendText(message); + } + } + */ + + Hashtable sourceDestMap = channelMap.get(channel); + if(sourceDestMap != null) + for(String id : sourceDestMap.keySet()){ + if(!id.equals(session.getId())) { + Session otherSession = (Session) ((Object[])sourceDestMap.get(id))[0]; + if(otherSession.isOpen()) + otherSession.getBasicRemote().sendText(mapper.writeValueAsString(dataObj)); + } + + } + } + catch (Exception je) { + je.printStackTrace(); + } + + } + catch (Exception je) { + je.printStackTrace(); + } + //System.out.println("Message received:" + message); + } + + @OnOpen + public void open(Session session) { + // System.out.println("Channel opened"); + } + + @OnClose + public void close(Session session) { + String channel = sessionMap.get(session.getId()); + if (channel != null) { + channelMap.remove(channel); + } + // System.out.println("Channel closed"); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/AppUtils.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/AppUtils.java new file mode 100644 index 0000000..170d87c --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/AppUtils.java @@ -0,0 +1,195 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.web.support; + +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.sql.DataSource; + +import org.hibernate.Session; +import org.openecomp.portalsdk.core.exception.SessionExpiredException; +import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager; +import org.openecomp.portalsdk.core.service.DataAccessService; +import org.springframework.beans.factory.annotation.Autowired; + + +public class AppUtils { + + private static DataAccessService dataAccessService; + + private static AbstractCacheManager cacheManager; + + private static boolean applicationLocked; + + private static Hashtable feedback = new Hashtable(); + + private static DataSource datasource; + + public static DataSource getDatasource() { + return datasource; + } + + @Autowired + public void setDatasource(DataSource datasource) { + AppUtils.datasource = datasource; + } + + public AppUtils() { + } + + public static HttpSession getSession(HttpServletRequest request) { + HttpSession session = null; + if (request != null) { + session = request.getSession(false); + if (session == null) { + throw new SessionExpiredException(); + } + } else { + throw new SessionExpiredException(); + } + return session; + } + + public static List getLookupList(String dbTable, String dbValueCol, String dbLabelCol, String dbFilter, String dbOrderBy) { + return getLookupList(dbTable, dbValueCol, dbLabelCol, dbFilter, dbOrderBy, null); + } // getLookupList + + public static List getLookupList(String dbTable, String dbValueCol, String dbLabelCol, String dbFilter, String dbOrderBy, Session session) { + String cacheKey = dbTable + "|" + dbValueCol + "|" + dbLabelCol + "|" + dbFilter + "|" + dbOrderBy; + List list = getLookupListFromCache(cacheKey); + if (list == null) { + list = getDataAccessService().getLookupList(dbTable, dbValueCol, dbLabelCol, dbFilter, dbOrderBy, null); + if (list != null) { + addLookupListToCache(cacheKey, list); + } + } // if + return list; + } // getLookupList + + private static List getLookupListFromCache(String key) { + return (List)getObjectFromCache(key); + } // getLookupListFromCache + + public static Object getObjectFromCache(String key) { + if (isCacheManagerAvailable()) { + return getCacheManager().getObject(key); + } else { + return null; + } + } // getObjectFromCache + + private static void addLookupListToCache(String key, List list) { + addObjectToCache(key, list); + } // addLookupListToCache + + public static void addObjectToCache(String key, Object o) { + if (isCacheManagerAvailable()) { + getCacheManager().putObject(key, o); + } + } // addObjectToCache + + @Autowired + public void setCacheManager(AbstractCacheManager cacheManager) { + this.cacheManager = cacheManager; + } + + public static AbstractCacheManager getCacheManager() { + return cacheManager; + } + + public static boolean isCacheManagerAvailable() { + return (getCacheManager() != null); + } + + public void setFeedback(Hashtable feedback) { + this.feedback = feedback; + } + + public static boolean isApplicationLocked() { + return applicationLocked; + } + + public static DataAccessService getDataAccessService() { + return dataAccessService; + } + + @Autowired + public void setDataAccessService(DataAccessService dataAccessService) { + this.dataAccessService = dataAccessService; + } + + public static void setApplicationLocked(boolean locked) { + applicationLocked = locked; + } + + public static String getLookupValueByLabel(String label, String dbTable, String dbValueCol, String dbLabelCol) { + if (label == null || label.equals("")) { + return ""; + } + + List lstResult = getLookupListNoCache(dbTable, dbValueCol, dbLabelCol, dbLabelCol + "='" + label.replaceAll("'", "''") + "'", ""); + if (lstResult == null) { + return ""; + } + if (lstResult.size() > 0) { + return ((org.openecomp.portalsdk.core.domain.Lookup)lstResult.toArray()[0]).getValue(); + } else { + return ""; + } + } + + public static String getLookupValueByLabel(String label, List lookupList) { + Iterator i = null; + + if (label == null || label.equalsIgnoreCase("")) { + return ""; + } + + if (lookupList == null || lookupList.size() == 0) { + return ""; + } + + i = lookupList.iterator(); + while (i.hasNext()) { + org.openecomp.portalsdk.core.domain.Lookup lookup = (org.openecomp.portalsdk.core.domain.Lookup)i.next(); + + if (lookup.getLabel().equals(label)) { + return lookup.getValue(); + } + } + + return ""; +} + public static List getLookupListNoCache(String dbTable, String dbValueCol, String dbLabelCol, String dbFilter, String dbOrderBy) { + return getLookupListNoCache(dbTable, dbValueCol, dbLabelCol, dbFilter, dbOrderBy, null); + } // getLookupListNoCache + + + public static List getLookupListNoCache(String dbTable, String dbValueCol, String dbLabelCol, String dbFilter, String dbOrderBy, Session session) { + return getDataAccessService().getLookupList(dbTable, dbValueCol, dbLabelCol, dbFilter, dbOrderBy, null); + } // getLookupListNoCache + + + +} // AppUtils diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/ControllerProperties.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/ControllerProperties.java new file mode 100644 index 0000000..1d09eba --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/ControllerProperties.java @@ -0,0 +1,41 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.web.support; + +public interface ControllerProperties { + + static final String TASK_GET = "get"; + static final String TASK_DELETE = "delete"; + static final String TASK_SAVE = "save"; + static final String TASK_PROCESS = "process"; + static final String TASK_TOGGLE_ACTIVE = "toggleActive"; + static final String TASK_DOWNLOAD = "download"; + static final String TASK_POPUP = "popup"; + static final String TASK_LOOKUP = "lookup"; + static final String TASK_ADD_ROW = "addRow"; + static final String TASK_APPROVE = "approve"; + static final String TASK_REJECT = "reject"; + static final String TASK_RESET = "reset"; + static final String TASK_ASSIGN = "assign"; + static final String TASK_CUT = "cut"; + static final String TASK_COPY = "copy"; + static final String TASK_PASTE = "paste"; + static final String TASK_SELECT = "select"; +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/FeedbackMessage.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/FeedbackMessage.java new file mode 100644 index 0000000..d8993b0 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/FeedbackMessage.java @@ -0,0 +1,80 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.web.support; + +public class FeedbackMessage { + + private String message; + private int messageType; + private boolean keyed; + + public static final int MESSAGE_TYPE_ERROR = 10; + public static final int MESSAGE_TYPE_WARNING = 20; + public static final int MESSAGE_TYPE_INFO = 30; + public static final int MESSAGE_TYPE_SUCCESS = 40; + + public static final String DEFAULT_MESSAGE_SUCCESS = "Update successful."; + public static final String DEFAULT_MESSAGE_ERROR = "An error occurred while processing the request: "; + + public static final String DEFAULT_MESSAGE_SYSTEM_ADMINISTRATOR = "If the problem persists, please contact your Administrator."; + + public FeedbackMessage() { + } + + public FeedbackMessage(String message) { + this(message, MESSAGE_TYPE_ERROR); + } + + public FeedbackMessage(String message, int messageType) { + this(message, messageType, false); + } + + public FeedbackMessage(String message, int messageType, boolean keyed) { + this.message = message; + this.messageType = messageType; + this.keyed = keyed; + } + + public String getMessage() { + return message; + } + + public int getMessageType() { + return messageType; + } + + public boolean isKeyed() { + return keyed; + } + + public void setMessage(String message) { + this.message = message; + } + + public void setMessageType(int messageType) { + this.messageType = messageType; + } + + public void setKeyed(boolean keyed) { + this.keyed = keyed; + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/JsonMessage.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/JsonMessage.java new file mode 100644 index 0000000..5566bf9 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/JsonMessage.java @@ -0,0 +1,118 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.web.support; + +import java.io.PrintWriter; +import java.io.StringWriter; + +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalAPIResponse; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class JsonMessage { + + private String data; + private String data2; + private String data3; + public JsonMessage(String data) { + super(); + this.data = data; + } + public JsonMessage(String data,String data2) { + super(); + this.data = data; + this.data2 = data2; + } + + public JsonMessage(String data,String data2,String data3) { + super(); + this.data = data; + this.data2 = data2; + this.data3 = data3; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + public String getData2() { + return data2; + } + public void setData2(String data2) { + this.data2 = data2; + } + public String getData3() { + return data3; + } + public void setData3(String data3) { + this.data3 = data3; + } + + + /** + * Builds JSON object with status + message response body. + * + * @param success + * True to indicate success, false to signal failure. + * @param msg + * Message to include in the response object; ignored if null. + * @return + * + *
    +	 * { "status" : "ok" (or "error"), "message": "some explanation" }
    +	 *         
    + */ + public static String buildJsonResponse(boolean success, String msg) { + PortalAPIResponse response = new PortalAPIResponse(success, msg); + String json = null; + try { + json = new ObjectMapper().writeValueAsString(response); + } catch (JsonProcessingException ex) { + // Truly should never, ever happen + json = "{ \"status\": \"error\",\"message\":\"" + ex.toString() + "\" }"; + } + return json; + } + + /** + * Builds JSON object with status of error and message containing stack + * trace for the specified throwable. + * + * @param t + * Throwable with stack trace to use as message + * @return + * + *
    +	 * { "status" : "error", "message": "some-big-stacktrace" }
    +	 *         
    + */ + public static String buildJsonResponse(Throwable t) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + t.printStackTrace(pw); + return buildJsonResponse(false, sw.toString()); + } + + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/MessagesList.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/MessagesList.java new file mode 100644 index 0000000..9ab956d --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/MessagesList.java @@ -0,0 +1,93 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.web.support; + +import java.util.ArrayList; +import java.util.List; + +public class MessagesList { + + private boolean successMessageDisplayed = true; + private boolean includeCauseInCustomExceptions = false; + + private List successMessages; + private List exceptionMessages; + + public MessagesList() { + setExceptionMessages(new ArrayList()); + setSuccessMessages(new ArrayList()); + } + + public MessagesList(boolean displaySuccess) { + this(); + setSuccessMessageDisplayed(displaySuccess); + } + + public List getExceptionMessages() { + return exceptionMessages; + } + + public List getSuccessMessages() { + return successMessages; + } + + public boolean isSuccessMessageDisplayed() { + return successMessageDisplayed; + } + + public boolean isIncludeCauseInCustomExceptions() { + return includeCauseInCustomExceptions; + } + + + public void setExceptionMessages(List exceptionMessages) { + this.exceptionMessages = exceptionMessages; + } + + public void setSuccessMessages(List successMessages) { + this.successMessages = successMessages; + } + + public void setSuccessMessageDisplayed(boolean successMessageDisplayed) { + this.successMessageDisplayed = successMessageDisplayed; + } + + public void setIncludeCauseInCustomExceptions(boolean includeCauseInCustomExceptions) { + this.includeCauseInCustomExceptions = includeCauseInCustomExceptions; + } + + + public void addSuccessMessage(FeedbackMessage message) { + getSuccessMessages().add(message); + } + + public void addExceptionMessage(FeedbackMessage message) { + getExceptionMessages().add(message); + } + + public boolean hasExceptionMessages() { + return!getExceptionMessages().isEmpty(); + } + + public boolean hasSuccessMessages() { + return!getSuccessMessages().isEmpty(); + } + +} diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java new file mode 100644 index 0000000..7f97457 --- /dev/null +++ b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java @@ -0,0 +1,373 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.core.web.support; + +import java.io.PrintWriter; +import java.io.Serializable; +import java.io.StringWriter; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; +import java.util.UUID; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.openecomp.portalsdk.core.FusionObject; +import org.openecomp.portalsdk.core.domain.Role; +import org.openecomp.portalsdk.core.domain.RoleFunction; +import org.openecomp.portalsdk.core.domain.UrlsAccessible; +import org.openecomp.portalsdk.core.domain.User; +import org.openecomp.portalsdk.core.exception.SessionExpiredException; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.menu.MenuBuilder; +import org.openecomp.portalsdk.core.restful.domain.EcompRole; +import org.openecomp.portalsdk.core.restful.domain.EcompUser; +import org.openecomp.portalsdk.core.service.DataAccessService; +import org.openecomp.portalsdk.core.util.CipherUtil; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.springframework.beans.factory.annotation.Autowired; + +@SuppressWarnings("rawtypes") +public class UserUtils implements Serializable, FusionObject { + + /** + * + */ + private static final long serialVersionUID = 1L; + private static final String USER_ID = "UserId"; + + static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UserUtils.class); + + public static final String KEY_USER_ROLES_CACHE = "userRoles"; + + public static final String WJ_HEADER_USER_NAME = "iv-user"; + public static final String WJ_HEADER_USER_GROUP = "iv-groups"; + + private static DataAccessService dataAccessService; + + public static void setUserSession(HttpServletRequest request, User user, Set applicationMenuData, Set businessDirectMenuData, String loginMethod) { + HttpSession session = request.getSession(true); + + UserUtils.clearUserSession(request); // let's clear the current user session to avoid any conflicts during the set + + session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); + + getRoleFunctions(request); + + // truncate the role (and therefore the role function) data to save memory in the session + user.setRoles(null); + session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_NAME), user.getFullName()); + session.setAttribute(SystemProperties.FIRST_NAME, user.getFirstName()); + session.setAttribute(SystemProperties.LAST_NAME, user.getLastName()); + String displayName = ""; + if (SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME) != null) + displayName = SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME); + session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME), displayName); + + session.setAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME), MenuBuilder.filterMenu(applicationMenuData, request)); + session.setAttribute(SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_ATTRIBUTE_NAME), MenuBuilder.filterMenu(businessDirectMenuData, request)); + } + + public static void clearUserSession(HttpServletRequest request) { + HttpSession session = AppUtils.getSession(request); + + if (session == null) { + throw new SessionExpiredException(); + } + + // removes all stored attributes from the current user's session + session.removeAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)); + session.removeAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME)); + session.removeAttribute(SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_ATTRIBUTE_NAME)); + session.removeAttribute(SystemProperties.getProperty(SystemProperties.ROLES_ATTRIBUTE_NAME)); + session.removeAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME)); + } + + @SuppressWarnings("unchecked") + public static Set getRoleFunctions(HttpServletRequest request) { + HashSet roleFunctions = null; + + HttpSession session = request.getSession(); + roleFunctions = (HashSet)session.getAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME)); + + if (roleFunctions == null) { + HashMap roles = getRoles(request); + roleFunctions = new HashSet(); + + Iterator i = roles.keySet().iterator(); + + while (i.hasNext()) { + Long roleKey = (Long)i.next(); + Role role = (Role)roles.get(roleKey); + + Iterator j = role.getRoleFunctions().iterator(); + + while (j.hasNext()) { + RoleFunction function = (RoleFunction) j.next(); + roleFunctions.add(function.getCode()); + } + } + + session.setAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME), roleFunctions); + } + + return roleFunctions; + } + + public static HashMap getRoles(HttpServletRequest request) { + HashMap roles = null; + + //HttpSession session = request.getSession(); + HttpSession session = AppUtils.getSession(request); + roles = (HashMap)session.getAttribute(SystemProperties.getProperty(SystemProperties.ROLES_ATTRIBUTE_NAME)); + + // if roles are not already cached, let's grab them from the user session + if (roles == null) { + User user = getUserSession(request); + + // get all user roles (including the tree of child roles) + roles = getAllUserRoles(user); + + session.setAttribute(SystemProperties.getProperty(SystemProperties.ROLES_ATTRIBUTE_NAME), getAllUserRoles(user)); + } + + return roles; + } + + public static User getUserSession(HttpServletRequest request) { + HttpSession session = AppUtils.getSession(request); + + if (session == null) { + throw new SessionExpiredException(); + } + + return (User)session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)); + } + + @SuppressWarnings("unchecked") + public static HashMap getAllUserRoles(User user) { + HashMap roles = new HashMap(); + Iterator i = user.getRoles().iterator(); + + while (i.hasNext()) { + Role role = (Role)i.next(); + + if (role.getActive()) { + roles.put(role.getId(), role); + + // let's take a recursive trip down the tree to add all child roles + addChildRoles(role, roles); + } + } + + return roles; + } + + @SuppressWarnings("unchecked") + private static void addChildRoles(Role role, HashMap roles) { + Set childRoles = role.getChildRoles(); + + if (childRoles != null && childRoles.size() > 0) { + Iterator j = childRoles.iterator(); + while (j.hasNext()) { + Role childRole = (Role)j.next(); + + if (childRole.getActive()) { + roles.put(childRole.getId(), childRole); + + addChildRoles(childRole, roles); + } + } + } + + } + + @SuppressWarnings("unchecked") + public static boolean isUrlAccessible(HttpServletRequest request, String currentUrl) { + boolean isAccessible = false; + + Map params = new HashMap(); + params.put("current_url", currentUrl); + + List list = getDataAccessService().executeNamedQuery("restrictedUrls", params, null); + + // loop through the list of restricted URL's + if (list != null && list.size() > 0) { + for (int i=0; i < list.size(); i++) { + + UrlsAccessible urlFunctions = (UrlsAccessible) list.get(i); + String functionCd = (String)urlFunctions.getFunctionCd(); + + if (UserUtils.isAccessible(request, functionCd)) { + isAccessible = true; + } + } + return isAccessible; + } + + return true; + } + + public static boolean hasRole(HttpServletRequest request, String roleKey) { + return getRoles(request).keySet().contains(new Long(roleKey)); + } + + + public static boolean hasRole(User user, String roleKey) { + return getAllUserRoles(user).keySet().contains(new Long(roleKey)); + } + + public static boolean isAccessible(HttpServletRequest request, String functionKey) { + return getRoleFunctions(request).contains(functionKey); + } + + public static DataAccessService getDataAccessService() { + return dataAccessService; + } + + @Autowired + public void setDataAccessService(DataAccessService dataAccessService) { + UserUtils.dataAccessService = dataAccessService; + } + + public static int getUserId(HttpServletRequest request) { + return getUserIdAsLong(request).intValue(); + } + + public static Long getUserIdAsLong(HttpServletRequest request) { + Long userId = new Long(SystemProperties.getProperty(SystemProperties.APPLICATION_USER_ID)); + + if (request != null) { + if (getUserSession(request) != null) { + userId = getUserSession(request).getId(); + } + } + + return userId; + } + + + private static final Object stackTraceLock = new Object(); + public static String getStackTrace(Throwable t) { + synchronized(stackTraceLock) { + StringWriter sw = new StringWriter (); + PrintWriter pw = new PrintWriter (sw); + t.printStackTrace (pw); + return sw.toString (); + } + } + + public static String getFullURL(HttpServletRequest request) { + if (request!=null) { + StringBuffer requestURL = request.getRequestURL(); + String queryString = request.getQueryString(); + + if (queryString == null) { + return requestURL.toString(); + } else { + return requestURL.append('?').append(queryString).toString(); + } + } + + return ""; + } + + public static String getRequestId(HttpServletRequest request) { + Enumeration headerNames = request.getHeaderNames(); + + String requestId = ""; + try { + while (headerNames.hasMoreElements()) { + String headerName = (String) headerNames.nextElement(); + logger.info(EELFLoggerDelegate.debugLogger, "One header is " + headerName + " : " + request.getHeader(headerName)); + if (headerName.equalsIgnoreCase(SystemProperties.ECOMP_REQUEST_ID)) { + requestId = request.getHeader(headerName); + break; + } + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.debugLogger, "HEADER!!!! Exception : " + UserUtils.getStackTrace(e)); + } + + return (requestId.isEmpty() ? UUID.randomUUID().toString() : requestId); + } + + + public static EcompUser convertToEcompUser (User user){ + EcompUser userJson = new EcompUser(); + + + userJson.setEmail(user.getEmail()); + userJson.setFirstName(user.getFirstName()); + userJson.setHrid(user.getHrid()); + userJson.setJobTitle(user.getJobTitle()); + userJson.setLastName(user.getLastName()); + userJson.setLoginId(user.getLoginId()); + userJson.setOrgManagerUserId(user.getOrgManagerUserId()); + userJson.setMiddleInitial(user.getMiddleInitial()); + userJson.setOrgCode(user.getOrgCode()); + userJson.setOrgId(user.getOrgId()); + userJson.setPhone(user.getPhone()); + userJson.setOrgUserId(user.getOrgUserId()); + + + Set ecompRoles = new TreeSet(); + + for(Role role : user.getRoles()){ + ecompRoles.add(convertToEcompRole(role)); + } + + userJson.setRoles(ecompRoles); + + return userJson; + } + + public static EcompRole convertToEcompRole(Role role){ + + EcompRole ecompRole = new EcompRole(); + ecompRole.setId(role.getId()); + ecompRole.setName(role.getName()); + + return ecompRole; + } + + public static String getUserIdFromCookie(HttpServletRequest request) throws Exception { + String userId = ""; + Cookie[] cookies = request.getCookies(); + Cookie userIdcookie = null; + if (cookies != null) + for (Cookie cookie : cookies) + if (cookie.getName().equals(USER_ID)) + userIdcookie = cookie; + if(userIdcookie!=null){ + userId = CipherUtil.decrypt(userIdcookie.getValue(), + SystemProperties.getProperty(SystemProperties.Decryption_Key)); + } + return userId; + + } +} diff --git a/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/MockApplicationContextTestSuite.java b/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/MockApplicationContextTestSuite.java new file mode 100644 index 0000000..0f918f6 --- /dev/null +++ b/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/MockApplicationContextTestSuite.java @@ -0,0 +1,127 @@ +package org.openecomp.portalsdk.core; + +import java.io.IOException; + +import org.junit.Before; +import org.junit.runner.RunWith; +import org.openecomp.portalsdk.core.conf.AppConfig; +import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager; +import org.openecomp.portalsdk.core.util.CacheManager; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.AnnotationConfigWebContextLoader; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; + + +/** + * + * + * + * In order to write a unit test, + * 1. inherit this class - See SanityTest.java + * 2. place the "war" folder on your test class's classpath + * 3. run the test with the following VM argument; This is important because when starting the application from Container, the System Properties file (SystemProperties.java) can have the direct path + * but, when running from the Mock Junit container, the path should be prefixed with "classpath" to enable the mock container to search for the file in the classpath + * -Dcontainer.classpath="classpath:" + * + */ + +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = {MockAppConfig.class}) +@ActiveProfiles(value="test") +public class MockApplicationContextTestSuite { + + @Autowired + public WebApplicationContext wac; + + private MockMvc mockMvc; + + @Before + public void setup() { + if(mockMvc == null) { + this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); + + } + } + + public Object getBean(String name) { + return this.wac.getBean(name); + } + + + public MockMvc getMockMvc() { + return mockMvc; + } + + public void setMockMvc(MockMvc mockMvc) { + this.mockMvc = mockMvc; + } + + public WebApplicationContext getWebApplicationContext() { + return wac; + } + + + + +} + + + @Configuration + @ComponentScan(basePackages = "org.openecomp", + excludeFilters = { + + } + ) + @Profile("test") + class MockAppConfig extends AppConfig { + + @Bean + public SystemProperties systemProperties(){ + return new MockSystemProperties(); + } + + @Bean + public AbstractCacheManager cacheManager() { + return new CacheManager() { + + public void configure() throws IOException { + + } + }; + } + + protected String[] tileDefinitions() { + return new String[] {"classpath:/WEB-INF/fusion/defs/definitions.xml", "classpath:/WEB-INF/defs/definitions.xml"}; + } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + //registry.addInterceptor(new SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout()); + //registry.addInterceptor(resourceInterceptor()); + } + + public static class MockSystemProperties extends SystemProperties { + + public MockSystemProperties() { + } + + } + + } + + + + diff --git a/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/MockHibernateMappingLocations.java b/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/MockHibernateMappingLocations.java new file mode 100644 index 0000000..a7de515 --- /dev/null +++ b/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/MockHibernateMappingLocations.java @@ -0,0 +1,20 @@ +package org.openecomp.portalsdk.core; + + + +import org.openecomp.portalsdk.core.conf.HibernateMappingLocatable; +import org.springframework.context.annotation.Profile; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; +import org.springframework.stereotype.Component; + +@Component +@Profile("test") +public class MockHibernateMappingLocations implements HibernateMappingLocatable{ + + public Resource[] getMappingLocations() { + return new Resource[]{new ClassPathResource("WEB-INF/fusion/orm/Fusion.hbm.xml"), new ClassPathResource("WEB-INF/fusion/orm/Workflow.hbm.xml")}; + } + + +} diff --git a/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/controller/sessionmgt/PortalCommunicationTest.java b/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/controller/sessionmgt/PortalCommunicationTest.java new file mode 100644 index 0000000..3e14bec --- /dev/null +++ b/ecomp-sdk/quantum/src/test/java/org/openecomp/portalsdk/core/controller/sessionmgt/PortalCommunicationTest.java @@ -0,0 +1,56 @@ +package org.openecomp.portalsdk.core.controller.sessionmgt; +/*package org.openecomp.portalsdk.core.controller.sessionmgt; + +import org.junit.Assert; +import org.junit.Test; +import org.springframework.mock.web.MockHttpSession; +import org.springframework.test.web.servlet.ResultActions; +import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; + +import org.openecomp.portalsdk.core.MockApplicationContextTestSuite; +import org.openecomp.portalsdk.core.service.sessionmgt.CoreTimeoutHandler; + +public class PortalCommunicationTest extends MockApplicationContextTestSuite{ + + + @Test + public void testGetTimeoutSessions() throws Exception { + + MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/api/sessionTimeOuts"); + MockHttpSession httpSession = new MockHttpSession(this.wac.getServletContext(),"1234"); + CoreTimeoutHandler.sessionCreated("12", "1234", httpSession); + + ResultActions ra = this.getMockMvc().perform(requestBuilder); + + System.out.println(" %%%%%%%%%%%%%%%%%%%%%%%%% " + ra.andReturn().getResponse().getContentAsString()); + System.out.println(" %%%%%%%%%%%%%%%%%%%%%%%%% " + "{\"12\":{\"jSessionId\":\"1234\",\"sessionTimOutMilliSec\":"); + + Assert.assertTrue(ra.andReturn().getResponse().getContentAsString().startsWith("{\"12\":{\"jSessionId\":\"1234\",\"sessionTimOutMilliSec\":")); + + } + + @Test + public void testUpdateTimeoutSessions() throws Exception { + + // pre condition + MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/api/sessionTimeOuts"); + MockHttpSession httpSession = new MockHttpSession(this.wac.getServletContext(),"1234"); + CoreTimeoutHandler.sessionCreated("12", "1234", httpSession); + ResultActions ra = this.getMockMvc().perform(requestBuilder); + + String responseSessMapStr = ra.andReturn().getResponse().getContentAsString(); + + + // test + requestBuilder = MockMvcRequestBuilders.post("/api/updateSessionTimeOuts"); + requestBuilder.param("sessionMap", responseSessMapStr); + ra = this.getMockMvc().perform(requestBuilder); + + + } + + + +} +*/ \ No newline at end of file diff --git a/ecomp-sdk/sdk-analytics/.gitignore b/ecomp-sdk/sdk-analytics/.gitignore new file mode 100644 index 0000000..d4111ff --- /dev/null +++ b/ecomp-sdk/sdk-analytics/.gitignore @@ -0,0 +1,2 @@ +/.settings/ +/target/ diff --git a/ecomp-sdk/sdk-analytics/README.md b/ecomp-sdk/sdk-analytics/README.md new file mode 100644 index 0000000..e7a5d13 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/README.md @@ -0,0 +1,8 @@ +ECOMP Portal SDK Analytics +========================== + +This is the Maven project for the ECOMP Portal SDK Analytics, +which is distributed as ecompSDK-analytics-nnn.jar. This library +requires Hibernate and Spring, and provides features including +charts, maps and reports. + diff --git a/ecomp-sdk/sdk-analytics/pom.xml b/ecomp-sdk/sdk-analytics/pom.xml new file mode 100644 index 0000000..7e3e8d9 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/pom.xml @@ -0,0 +1,160 @@ + + 4.0.0 + + + org.openecomp.ecompsdkos + ecompSDK-project + 1.0.0 + + + ecompSDK-analytics + Ecomp Portal SDK Analytics + Provides reporting features for SDK applications + jar + + + + + + + + + org.openecomp.ecompsdkos + ecompSDK-core + ${project.version} + + + + com.fasterxml.jackson.core + jackson-annotations + 2.6.3 + + + com.fasterxml.jackson.core + jackson-core + 2.6.3 + + + com.fasterxml.jackson.core + jackson-databind + 2.6.3 + + + + + commons-codec + commons-codec + 1.10 + + + commons-lang + commons-lang + 2.6 + + + javax.servlet + javax.servlet-api + 3.1.0 + + + + com.lowagie + itext + 2.0.8 + + + + org.slf4j + jcl-over-slf4j + 1.7.12 + + + org.springframework + spring-core + ${springframework.version} + + + commons-logging + commons-logging + + + + + org.springframework + spring-orm + ${springframework.version} + + + org.springframework + spring-web + ${springframework.version} + + + org.springframework + spring-webmvc + ${springframework.version} + + + + org.apache.poi + poi + 3.5-FINAL + + + commons-logging + commons-logging + + + log4j + log4j + + + + + org.apache.poi + poi-ooxml + 3.5-FINAL + + + commons-logging + commons-logging + + + log4j + log4j + + + + + org.apache.poi + poi-scratchpad + 3.5-FINAL + + + commons-logging + commons-logging + + + log4j + log4j + + + + + org.apache.poi + poi-contrib + 3.5-FINAL + + + commons-logging + commons-logging + + + log4j + log4j + + + + + + diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/AntBuild.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/AntBuild.java new file mode 100644 index 0000000..eeb2b60 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/AntBuild.java @@ -0,0 +1,89 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics; + +import java.io.IOException; +import java.net.URL; +import java.util.Iterator; +import java.util.Map; +import java.util.jar.Attributes; +import java.util.jar.Manifest; + +/** + * This class is used to get version and Build information when + * user run "java -jar raptor_classes.jar" command. + */ +public class AntBuild { + + public static String buildNum = ""; + + public static void main(String[] args) { + System.out.println("Jar (raptor_classes.jar) Information: "); + readManifest(); + } + + public static void readManifest() { + try { + Class clazz = AntBuild.class; + String classContainer = clazz.getProtectionDomain().getCodeSource().getLocation().toString(); + URL manifestUrl = new URL("jar:" + classContainer + "!/META-INF/MANIFEST.MF"); + Manifest manifest = new Manifest(manifestUrl.openStream()); + + //JarFile jar = new JarFile("../lib/raptor_classes.jar"); + //Manifest manifest = jar.getManifest(); + + Attributes attribs = manifest.getMainAttributes(); + Iterator it = attribs.entrySet().iterator(); + while(it.hasNext()) { + Map.Entry entry = (Map.Entry) it.next(); + Attributes.Name attributeName = (Attributes.Name) entry.getKey(); + String attributeValue = (String) entry.getValue(); + if (attributeName.toString().equals("Created-By")) + System.out.println("Java HotSpot(TM) Client VM " + " : " + attributeValue); + else if (attributeName.toString().equals("Java-Version")) + System.out.println("Java Version " + " : " + attributeValue); + else if (attributeName.toString().equals("Java-Runtime-Version")) + System.out.println("Java Runtime Version " + " : " + attributeValue); + else if (attributeName.toString().equals("Ant-Version")) + System.out.println(attributeName.toString() + " : " + attributeValue); + else { + if(attributeName.toString().startsWith("Raptor")) { + if (attributeName.toString().startsWith("Raptor-Build-Version")) + buildNum = attributeValue; + System.out.println(attributeName.toString() + " : " + attributeValue); + } + } + } + + } catch (IOException e) { + System.err.println("Cannot read jar-file manifest: " + + e.getMessage()); + } + } + + public static String getBuildNum() { + if (buildNum.length()>0) + return buildNum; + else { + readManifest(); + return buildNum; + } + } +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/RaptorObject.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/RaptorObject.java new file mode 100644 index 0000000..9a45c19 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/RaptorObject.java @@ -0,0 +1,44 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics; + +public class RaptorObject extends java.lang.Object { + + protected String nvl(String s) { + return (s == null) ? "" : s; + } + + protected String nvl(String s, String sDefault) { + return nvl(s).equals("") ? sDefault : s; + } + + protected static String nvls(String s) { + return (s == null) ? "" : s; + } + + protected static String nvls(String s, String sDefault) { + return nvls(s).equals("") ? sDefault : s; + } + + protected boolean getFlagInBoolean(String s) { + return nvl(s).toUpperCase().startsWith("Y") || nvl(s).toLowerCase().equals("true"); + } + +} // RaptorObject diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/config/ConfigLoader.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/config/ConfigLoader.java new file mode 100644 index 0000000..826d7a2 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/config/ConfigLoader.java @@ -0,0 +1,196 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.config; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.StringReader; +import java.util.Properties; + +import javax.servlet.ServletContext; + +import org.openecomp.portalsdk.analytics.controller.Action; +import org.openecomp.portalsdk.analytics.controller.ActionMapping; +import org.openecomp.portalsdk.analytics.util.Log; + +public class ConfigLoader { + // public static final String RAPTOR_ACTION_MAP = + // "raptor_action_map.properties"; + + private static final String P_FILE_EXTENSION = ".properties"; + + public static final String RAPTOR_PROPERTIES = "raptor"; + + public static final String SQL_PROPERTIES = "sql"; + + public static final String APP_PROPERTIES = "raptor_app"; + + public static final String DB_PROPERTIES = "raptor_db"; + + private static String configFilesPath = "/WEB-INF/conf/"; + + public static final String RAPTOR_PDF_PROPERTIES = "raptor_pdf"; + + // private static String internalFilesPath = + // are not supposed to be modified by the user; may be unavailable in some + // cases - so defaults are expected + + private static String raptorActionMapString = + "report.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_run.jsp \n" + + "mobile.report.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |mobile_report_run.jsp \n" + + "report.dashrep1.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportDashRep1 |report_run_dashrep1.jsp \n" + + "report.dashrep2.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportDashRep2 |report_run_dashrep2.jsp \n" + + "report.dashrep3.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportDashRep3 |report_run_dashrep3.jsp \n" + + "report.dashrep4.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportDashRep4 |report_run_dashrep4.jsp \n" + + "report.download |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_download_xls.jsp \n" + + "report.download.excel2007 |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_download_xlsx.jsp \n" + + "report.download.page |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_download_page_xls.jsp \n" + + "report.csv.download |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_download_csv.jsp \n" + + "report.text.download |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_download_txt.jsp \n" + + "report.search |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportSearch |report_search.jsp \n" + + "report.search.execute |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportSearchExecute |report_search \n" + + "report.search.user |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportSearchUser |report_search.jsp \n" + + "report.search.public |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportSearchPublic |report_search.jsp \n" + + "report.search.favorite |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportSearchFavorites |report_search.jsp \n" + + "report.wizard |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportWizard |report_wizard \n" + + "report.create |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportCreate |report_wizard \n" + + "report.import |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_import \n" + + "report.import.save |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportImportSave |report_wizard \n" + + "report.copy |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportCopy |report_wizard \n" + + "report.copy.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportCopy |raptor_wizard_container.jsp \n" + + "report.edit |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportEdit |report_wizard \n" + + "report.delete |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportDelete |report_search \n" + + "report.popup.field |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportFormFieldPopup |popup_field.jsp \n" + + "report.popup.map |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportValuesMapDefPopup |popup_map.jsp \n" + + "report.popup.drilldown.table |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |popup_drill_down_table.jsp \n" + + "report.popup.drilldown.report|org.openecomp.portalsdk.analytics.controller.ActionHandler|reportDrillDownToReportDefPopup|popup_drill_down_report \n" + + "report.popup.import.semaphore|org.openecomp.portalsdk.analytics.controller.ActionHandler|importSemaphorePopup |popup_import_semaphore \n" + + "report.popup.semaphore |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |popup_semaphore \n" + + "report.popup.semaphore.save |org.openecomp.portalsdk.analytics.controller.ActionHandler|saveSemaphorePopup |popup_semaphore \n" + + "report.popup.filter.col |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |popup_filter_col.jsp \n" + + "report.popup.filter.data |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportFilterDataPopup |popup_filter_data.jsp \n" + + "report.popup.sql |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportShowSQLPopup |popup_sql \n " + + "report.run.popup |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_run_popup.jsp \n" + + "report.popup.test.cond |org.openecomp.portalsdk.analytics.controller.ActionHandler|testSchedCondPopup |popup_sql \n" + + "report.popup.testrun.sql |org.openecomp.portalsdk.analytics.controller.ActionHandler|testRunSQLPopup |popup_testrun_sql \n" + + "report.test.jsp |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |test_run_sql \n" + + "report.field.testrun.jsp |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |test_field_run_sql \n" + + "report.field.default.testrun.jsp |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |default_field_run_sql \n" + + "report.field.date.start.testrun.jsp |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |date_start_field_run_sql \n" + + "report.field.date.end.testrun.jsp |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |date_end_field_run_sql \n" + + "report.popup.table.cols |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |popup_table_cols \n" + + "refresh.cache |org.openecomp.portalsdk.analytics.controller.ActionHandler|refreshCache |message.jsp \n" + + "report.message |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |message.jsp \n" + + "report.download.pdf |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_download_pdf.jsp \n" + + "report.popup.pdfconfig |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |popup_pdf_config.jsp \n" + + "download.all |org.openecomp.portalsdk.analytics.controller.ActionHandler|downloadAll |close.jsp \n" + + "download.all.jsp |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |popup_download_flat_file.jsp \n" + + "download.data.file |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |download_data_file.jsp \n" + + "popup.calendar |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |gtm_calendar.jsp \n" + + "report.folderlist |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |folder_report_list.jsp \n" + + "report.folderlist_iframe |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |folder_report_list_iframe.jsp \n" + + "report.childDropDown |org.openecomp.portalsdk.analytics.controller.ActionHandler|getChildDropDown |raptor_childdropdown.jsp \n" + + "report.create.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_create_container.jsp \n" + + "report.search.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_search_container.jsp \n" + + "report.search.execute.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_search_execute_container.jsp \n" + + "report.search.user.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_search_user_container.jsp \n" + + "report.search.public.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_search_public_container.jsp \n" + + "report.search.favorite.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_search_favorite_container.jsp \n" + + "report.run.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_run_container.jsp \n" + + "report.formfields.run.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|formFieldRun |report_run_container.jsp \n" + + "report.run.jsp |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_run.jsp \n" + + "report.schedule.multiple |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |wizard_schedule_multiple.jsp \n" + + "report.schedule.submit |org.openecomp.portalsdk.analytics.controller.ActionHandler|processSchedule |wizard_schedule_only.jsp \n" + + "report.schedule.report.submit |org.openecomp.portalsdk.analytics.controller.ActionHandler|processScheduleReportList |wizard_schedule_only.jsp \n" + + "report.schedule.report.submit_wmenu |org.openecomp.portalsdk.analytics.controller.ActionHandler|processScheduleReportList |wizard_schedule_only_from_search.jsp \n" + + "report.schedule_only |org.openecomp.portalsdk.analytics.controller.ActionHandler|processSchedule |wizard_schedule_only \n" + + "report.schedule_only_from_search |org.openecomp.portalsdk.analytics.controller.ActionHandler|processSchedule |wizard_schedule_only_from_search.jsp \n" + + "report.schedule_delete |org.openecomp.portalsdk.analytics.controller.ActionHandler|processScheduleDelete |report_run_container.jsp \n" + + "report.schedule.submit_from_search |org.openecomp.portalsdk.analytics.controller.ActionHandler|processSchedule |wizard_schedule_only_from_search.jsp \n" + + "report.dashboard.detail |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |dashboard_report_run_detail.jsp \n" + + "report.csv.download.direct |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_download_csv.jsp \n" + + "report.csv.download.direct |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportRun |report_download_csv.jsp \n" + + "report.download.csv.session |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_download_csv \n" + + "report.download.excel2007.session |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_download_xlsx.jsp \n" + + "report.download.excel.session |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_download_xls.jsp \n" + + "report.download.pdf.session |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_download_pdf.jsp \n" + + "report.download.page.session |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_download_page_xls.jsp \n" + + "report.data.remove.session |org.openecomp.portalsdk.analytics.controller.ActionHandler|removeReportDataFromSession |report_run_container.jsp \n" + + "report.dashboard.run.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_dashboard_run_container.jsp \n" + + "chart.force.cluster |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |force_cluster.jsp \n" + + "chart.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportChartRun |report_run_container.jsp \n" + + "chart.json |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportChartRun |report_run_container.jsp \n" + + "chart.data.json |org.openecomp.portalsdk.analytics.controller.ActionHandler|reportChartDataRun |report_run_container.jsp \n" + + "quicklinks.json |org.openecomp.portalsdk.analytics.controller.ActionHandler|getQuickLinksJSON |report_run_container.jsp \n" + + "embed.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_embed_run_container.zul \n" + + "schedule.edit |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |wizard_adhoc_schedule.zul \n" + + "chart.annotations.run |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |plugin_chart_annotation.jsp \n" + + "chart.annotations.exec |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |chart_annotations.jsp \n" + + "chart.mini |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |chart_minified.jsp \n" + + "report.olap.run.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_olap_run_container.jsp \n" + + "report.hive.run.container |org.openecomp.portalsdk.analytics.controller.ActionHandler|gotoJsp |report_hive_run_container.jsp \n" + + ; + + private ConfigLoader() { + } + + public static void setConfigFilesPath(String path) { + configFilesPath = path; + } // setConfigFilesPath + + public static Properties getProperties(ServletContext servletContext, String propertiesFile) + throws IOException { + return getProperties(servletContext, propertiesFile, null); + } // getProperties + + public static Properties getProperties(ServletContext servletContext, + String propertiesFile, String systemTypeExtension) throws IOException { + Properties p = new Properties(); + p.load(servletContext.getResourceAsStream(configFilesPath + propertiesFile + + ((systemTypeExtension == null) ? "" : "_" + systemTypeExtension) + + P_FILE_EXTENSION)); + return p; + } // getProperties + + public static ActionMapping loadRaptorActionMapping(ServletContext servletContext) + throws IOException { + ActionMapping actionMapping = new ActionMapping(); + + String pLine = null; + // BufferedReader pFile = new BufferedReader(new + // InputStreamReader(servletContext.getResourceAsStream(internalFilesPath+RAPTOR_ACTION_MAP))); + BufferedReader pFile = new BufferedReader(new StringReader(raptorActionMapString)); + while ((pLine = pFile.readLine()) != null) + if (pLine.trim().length() > 0) + try { + actionMapping.addAction(Action.parse(pLine)); + } catch (Exception e) { + Log + .write("[ConfigLoader.loadRaptorActionMapping] Error - unable to parse action [" + + pLine + "]"); + } + pFile.close(); + + return actionMapping; + } // loadRaptorActionMapping + +} // ConfigLoader + diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Action.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Action.java new file mode 100644 index 0000000..3d14dcb --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Action.java @@ -0,0 +1,89 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.controller; + +import java.util.StringTokenizer; + +public class Action extends org.openecomp.portalsdk.analytics.RaptorObject { + private String action = null; + + private String controllerClass = null; + + private String controllerMethod = null; + + private String jspName = null; + + private Action() { + } + + public Action(String action, String controllerClass, String controllerMethod, + String jspName) { + setAction(action); + setControllerClass(controllerClass); + setControllerMethod(controllerMethod); + setJspName(jspName); + } // Action + + public static Action parse(String configFileEntry) { + Action a = new Action(); + + StringTokenizer st = new StringTokenizer(configFileEntry, "| \t", false); + // if(st.hasMoreTokens()) + a.setAction(st.nextToken()); + a.setControllerClass(st.nextToken()); + a.setControllerMethod(st.nextToken()); + a.setJspName(st.nextToken()); + + return a; + } // parse + + public String getAction() { + return action; + } + + public String getControllerClass() { + return controllerClass; + } + + public String getControllerMethod() { + return controllerMethod; + } + + public String getJspName() { + return jspName; + } + + private void setAction(String action) { + this.action = action; + } + + private void setControllerClass(String controllerClass) { + this.controllerClass = controllerClass; + } + + private void setControllerMethod(String controllerMethod) { + this.controllerMethod = controllerMethod; + } + + private void setJspName(String jspName) { + this.jspName = jspName; + } + +} // Action diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionHandler.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionHandler.java new file mode 100644 index 0000000..e0cd8d2 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionHandler.java @@ -0,0 +1,2417 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +/* =========================================================================================== + * This class is part of RAPTOR (Rapid Application Programming Tool for OLAP Reporting) + * Raptor : This tool is used to generate different kinds of reports with lot of utilities + * =========================================================================================== + * + * ------------------------------------------------------------------------------------------- + * ActionHandler.java - This class is used to call actions related to reports. + * ------------------------------------------------------------------------------------------- + * + * + * + * Changes + * ------- + * 31-Aug-2009 : Version 8.5.1 (Sundar);
    • reportFormFieldPopup iterates form field collections.
    + * 18-Aug-2009 : Version 8.5.1 (Sundar);
    • request Object is passed to prevent caching user/roles - Datamining/Hosting.
    + * 13-Aug-2009 : Version 8.5 (Sundar);
    • reportFormFieldPopup is changed to have effect on textfield with popup.
    + * 06-Aug-2009 : Version 9.0 (Sundar);
    • reportFormFieldPopupB is changed.
    + * 29-Jul-2009 : Version 8.4 (Sundar);
    • Previously report data for dashboard stored only page level data. This has been changed to show all the data up to the maximum specified.
    + * 27-Jul-2009 : Version 8.4 (Sundar);
    • Bug due to not showing back button after child report in drilldown is navigated more than + * one page is resolved.
    + * 14-Jul-2009 : Version 8.4 (Sundar);
    • Dashboard reports can now be generated excel as separate sheets or group together in PDF. + * They can also be scheduled.
    + * + */ +package org.openecomp.portalsdk.analytics.controller; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.io.Writer; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.TreeMap; +import java.util.Vector; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException; +import org.openecomp.portalsdk.analytics.error.RaptorSchedularException; +import org.openecomp.portalsdk.analytics.error.ReportSQLException; +import org.openecomp.portalsdk.analytics.error.UserDefinedException; +import org.openecomp.portalsdk.analytics.error.ValidationException; +import org.openecomp.portalsdk.analytics.model.DataCache; +import org.openecomp.portalsdk.analytics.model.ReportHandler; +import org.openecomp.portalsdk.analytics.model.ReportLoader; +import org.openecomp.portalsdk.analytics.model.SearchHandler; +import org.openecomp.portalsdk.analytics.model.base.IdNameColLookup; +import org.openecomp.portalsdk.analytics.model.base.IdNameList; +import org.openecomp.portalsdk.analytics.model.base.IdNameSql; +import org.openecomp.portalsdk.analytics.model.base.ReportSecurity; +import org.openecomp.portalsdk.analytics.model.definition.ReportDefinition; +import org.openecomp.portalsdk.analytics.model.definition.ReportSchedule; +import org.openecomp.portalsdk.analytics.model.runtime.ChartWebRuntime; +import org.openecomp.portalsdk.analytics.model.runtime.ErrorJSONRuntime; +import org.openecomp.portalsdk.analytics.model.runtime.FormField; +import org.openecomp.portalsdk.analytics.model.runtime.FormatProcessor; +import org.openecomp.portalsdk.analytics.model.runtime.ReportFormFields; +import org.openecomp.portalsdk.analytics.model.runtime.ReportJSONRuntime; +import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime; +import org.openecomp.portalsdk.analytics.model.runtime.VisualManager; +import org.openecomp.portalsdk.analytics.model.search.ReportSearchResultJSON; +import org.openecomp.portalsdk.analytics.system.AppUtils; +import org.openecomp.portalsdk.analytics.system.ConnectionUtils; +import org.openecomp.portalsdk.analytics.system.DbUtils; +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.system.fusion.domain.QuickLink; +import org.openecomp.portalsdk.analytics.util.AppConstants; +import org.openecomp.portalsdk.analytics.util.DataSet; +import org.openecomp.portalsdk.analytics.util.Utils; +import org.openecomp.portalsdk.analytics.view.DataRow; +import org.openecomp.portalsdk.analytics.view.DataValue; +import org.openecomp.portalsdk.analytics.view.ReportData; +import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType; +import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +public class ActionHandler extends org.openecomp.portalsdk.analytics.RaptorObject { + + //private static Log debugLogger = LogFactory.getLog(ActionHandler.class.getName()); + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ActionHandler.class); + + private void preserveReportRuntimeAsBackup(HttpServletRequest request) { + HttpSession session = request.getSession(); + ArrayList repAl = null; + + if(session.getAttribute(AppConstants.DRILLDOWN_REPORTS_LIST)!=null) + repAl = ((ArrayList)session.getAttribute(AppConstants.DRILLDOWN_REPORTS_LIST)); + int index = Integer.parseInt(nvl((String) session.getAttribute(AppConstants.DRILLDOWN_INDEX), "0")); + int form_index = Integer.parseInt(nvl((String) session.getAttribute(AppConstants.FORM_DRILLDOWN_INDEX), "0")); + int flag = 0; + if(repAl ==null || repAl.size() <= 0) { + //session.setAttribute(AppConstants.SI_BACKUP_FOR_REP_ID, ((ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).getReportID()); + //session.setAttribute(AppConstants.SI_REPORT_RUN_BACKUP, request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)); + repAl = new ArrayList(); + repAl.add((ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)); + + } else { + if(Globals.getMaxDrillDownLevel() < repAl.size()) { + repAl.remove(0); + if(index > 0) index--; + } else if(index < repAl.size()) + repAl.remove(index); + repAl.add(index, (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)); + } + index = index + 1; + // needed to differentiate form and report index to store form parameters for ZK + form_index = form_index + 1; + session.setAttribute(AppConstants.FORM_DRILLDOWN_INDEX, Integer.toString(form_index)); + session.setAttribute(AppConstants.DRILLDOWN_INDEX, Integer.toString(index)); + request.getSession().setAttribute(AppConstants.DRILLDOWN_REPORTS_LIST, repAl); + } // preserveReportRuntimeAsBackup + + private void clearReportRuntimeBackup(HttpServletRequest request) { +// debugLogger.debug("in Action Handler clear is been called."); + HttpSession session = request.getSession(); + session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST); + session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST); + request.removeAttribute(AppConstants.DRILLDOWN_INDEX); + request.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX); + Enumeration enum1 = session.getAttributeNames(); + String attributeName = ""; + while(enum1.hasMoreElements()) { + attributeName = enum1.nextElement(); + if(attributeName.startsWith("parent_")) { + session.removeAttribute(attributeName); + } + } + //request.getSession().removeAttribute(AppConstants.SI_REPORT_RUN_BACKUP); + //request.getSession().removeAttribute(AppConstants.SI_BACKUP_FOR_REP_ID); + } // clearReportRuntimeBackup + + private boolean isDashboardInDrillDownList(HttpServletRequest request) throws RaptorException { + ArrayList aL = (ArrayList) request.getSession().getAttribute( + AppConstants.DRILLDOWN_REPORTS_LIST); + ReportRuntime rr = null; + if(aL ==null || aL.size() <= 0) { + return false; + } else { + for (int i =0; i0 ? --index : 0; + form_index = form_index>0 ? --form_index : 0; + request.setAttribute(AppConstants.DRILLDOWN_INDEX, Integer.toString(index)); + session.setAttribute(AppConstants.DRILLDOWN_INDEX, Integer.toString(index)); + request.setAttribute(AppConstants.FORM_DRILLDOWN_INDEX, Integer.toString(form_index)); + session.setAttribute(AppConstants.FORM_DRILLDOWN_INDEX, Integer.toString(form_index)); + + rr = (ReportRuntime)aL.get(index); + request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr); + //clearReportRuntimeBackup(request); + //} + return rr; + } // getReportRuntimeFromBackup + + public String reportRun(HttpServletRequest request, String nextPage) { + String action = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action")); + ReportRuntime rr = null; + String userId = null; + String formFields = ""; + ReportData rd = null; + boolean isEmailAttachment = false; + boolean fromDashboard = AppUtils.getRequestFlag(request,"fromDashboard"); + request.getSession().setAttribute("login_id", AppUtils.getUserBackdoorLoginId(request)); + + boolean rDisplayContent = AppUtils.getRequestFlag(request, + AppConstants.RI_DISPLAY_CONTENT) + || AppUtils.getRequestFlag(request, "noFormFields"); + + try { + //if "refresh=Y" is in request parameter, session variables are removed. + if(AppUtils.getRequestFlag(request, AppConstants.RI_REFRESH)) { + removeVariablesFromSession(request); + } + + + long currentTime = System.currentTimeMillis(); + request.setAttribute("triggeredStartTime", new Long(currentTime)); + String actionKey = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action")); + String pdfAttachmentKey = AppUtils.getRequestNvlValue(request, "pdfAttachmentKey"); + String parent = ""; + int parentFlag = 0; + if(!nvl(request.getParameter("parent"), "").equals("N")) parent = nvl(request.getParameter("parent"), ""); + if(parent.startsWith("parent_")) parentFlag = 1; + + if (pdfAttachmentKey.length()<=0) { + if(actionKey.equals("report.download.page") || actionKey.equals("report.download") || actionKey.equals("report.download.pdf") || actionKey.equals("report.download.excel2007") || actionKey.equals("report.csv.download") || actionKey.equals("report.text.download")) { + if(parentFlag == 1) rr = (ReportRuntime) request.getSession().getAttribute(parent+"_rr"); + if(rr==null) + rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); //changing session to request + if(!(rr!=null && fromDashboard)) { + userId = AppUtils.getUserID(request); + boolean isFromReportLog = AppUtils.getRequestFlag(request, "fromReportLog"); + int downloadLimit = 0; + if(rr!=null) + downloadLimit = (rr.getMaxRowsInExcelDownload()>0)?rr.getMaxRowsInExcelDownload():Globals.getDownloadLimit(); + if(actionKey.equals("report.csv.download")) + downloadLimit = Globals.getCSVDownloadLimit(); + + if(rr!=null && rr.getReportType().equals(AppConstants.RT_LINEAR)) { + String sql_whole = rr.getReportDataSQL(userId, downloadLimit, request); + request.setAttribute(AppConstants.RI_REPORT_SQL_WHOLE, sql_whole); + } else if(rr!=null && rr.getReportType().equals(AppConstants.RT_CROSSTAB)) { + rd = rr.loadReportData(-1, userId, downloadLimit,request, false); /* TODO: should be changed to true */ + request.getSession().setAttribute(AppConstants.RI_REPORT_DATA, rd); + } + if(!isFromReportLog) { + if(pdfAttachmentKey!=null && pdfAttachmentKey.length()>0) { + if(actionKey.equals("report.download")) { + rr.logReportExecutionTime(userId, "",AppConstants.RLA_SCHEDULED_DOWNLOAD_EXCEL, formFields); + } else if (actionKey.equals("report.download.pdf")) { + rr.logReportExecutionTime(userId, "",AppConstants.RLA_SCHEDULED_DOWNLOAD_PDF, formFields); + } else if (actionKey.equals("report.download.excel2007")) { + rr.logReportExecutionTime(userId, "",AppConstants.RLA_SCHEDULED_DOWNLOAD_EXCELX, formFields); + } + } else { + if(actionKey.equals("report.download") ) { + rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_EXCEL, formFields); + } else if (actionKey.equals("report.download.pdf")) { + rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_PDF, formFields); + } else if (actionKey.equals("report.csv.download")) { + rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_CSV, formFields); + } else if (actionKey.equals("report.text.download")) { + rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_TEXT, formFields); + } else if (actionKey.equals("report.download.page")) { + rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_PAGE_EXCEL, formFields); + } else if (actionKey.equals("report.download.excel2007")) { + rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_EXCELX, formFields); + } + } + } + return nextPage; + } + + } + }// pdfAttachmentKey + String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID); + rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); //changing session to request + + String reportIDFromSession = (rr!=null)?rr.getReportID():""; + logger.debug(EELFLoggerDelegate.debugLogger, ("in Action Handler ********** " + reportID + " " + reportIDFromSession + " "+ actionKey)); +// ReportRuntime rr = (ReportRuntime) request.getAttribute(AppConstants.SI_REPORT_RUNTIME); + logger.debug(EELFLoggerDelegate.debugLogger, ("^^^^^^^^^^^^^^report ID from session " + ((rr!=null)?rr.getReportID():"no report id in session"))); + // if(rr!=null && !(rr.getReportID().equals(reportID))) { +// rr = null; +// request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, null); +// } + + ReportHandler rh1 = new ReportHandler(); + ReportRuntime rr1 = null; + + //debugLogger.debug("Report ID B4 rr1 in ActionHandler " + // + ( request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null?((ReportRuntime)request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).getReportID():"Not in session")); + + + //try { + boolean isGoBackAction = AppUtils.getRequestFlag(request, AppConstants.RI_GO_BACK); + + if (AppUtils.getRequestFlag(request, AppConstants.RI_SHOW_BACK_BTN) && !isGoBackAction) { + // debugLogger.debug("Preserving report"); + if(!reportID.equals(reportIDFromSession)) + preserveReportRuntimeAsBackup(request); + } + + if(reportID !=null) + rr1 = rh1.loadReportRuntime(request, reportID, true, 1); + //} catch(Exception e) { + + // } +// debugLogger.debug("Report ID After rr1 in ActionHandler " +// + ( request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null?((ReportRuntime)request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).getReportID():"Not in session")); + if(rr1!=null && rr1.getReportType().equals(AppConstants.RT_DASHBOARD)) { + int DASH=7; + int requestFlag = DASH; + ReportHandler rh = new ReportHandler(); + // Added below statement to add parent dashboard report id in session. + request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REP_ID, reportID); + //rr = null; + // get dashboard HTML from report runtime. getListOfReportsFromDashBoardHTML + String strHTML = rr1.getDashboardLayoutHTML(); + + //System.out.println("StrHTML " + strHTML); + // call getListOfReportsFromDashBoardHTML returns HashMap + + TreeMap treeMap = getListOfReportsFromDashBoardHTML(strHTML); + //System.out.println("Size " + hashMap.size()); + Set set = treeMap.entrySet(); + String value = ""; + + HashMap reportsRuntimeMap = new HashMap(); + HashMap reportDataMap = new HashMap(); + HashMap reportChartDataMap = new HashMap(); + // displayTypeMap differentiates whether report need to be displayed as data or chart + HashMap reportDisplayTypeMap = new HashMap(); + + userId = null; + userId = AppUtils.getUserID(request); + int pageNo = -1; + //int downloadLimit = (rr1.getMaxRowsInExcelDownload()>0)?rr1.getMaxRowsInExcelDownload():Globals.getDownloadLimit(); + int downloadLimit = 0; + int rep_idx = 0; + int widthFlag = 0; + int heightFlag = 0; + ReportRuntime rrDashboardReports = null; + Integer intObj = null; + ReportRuntime similiarReportRuntime = null; + rd = null; + DataSet ds = null; + String reportIDFromMap = null; + int record = 0; + boolean buildReportdata = true; + + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + record++; + Map.Entry entry = (Entry) iter.next(); + //System.out.println("Key "+ entry.getKey()); + //System.out.println("Value "+ entry.getValue()); + reportIDFromMap = entry.getValue().toString().substring(1); + // The below line is used to optimize, so that if there is already same report id it wouldn't go through the whole process + similiarReportRuntime = getSimiliarReportRuntime(reportsRuntimeMap, reportIDFromMap); + if(similiarReportRuntime != null ) { + rrDashboardReports = (ReportRuntime) getSimiliarReportRuntime(reportsRuntimeMap, reportIDFromMap).clone(); + intObj = getKey(reportsRuntimeMap,reportIDFromMap); + } else { + rrDashboardReports = rh.loadReportRuntime(request, reportIDFromMap, true, requestFlag); + } + if(entry.getValue().toString().toLowerCase().startsWith("c")) { + rrDashboardReports.setDisplayMode(ReportRuntime.DISPLAY_CHART_ONLY); + } else { + rrDashboardReports.setDisplayMode(ReportRuntime.DISPLAY_DATA_ONLY); + } + + downloadLimit = (rrDashboardReports.getMaxRowsInExcelDownload()>0)?rrDashboardReports.getMaxRowsInExcelDownload():Globals.getDownloadLimit(); + if (new Integer(nvl(rrDashboardReports.getDataContainerWidth(),"100")).intValue() >100) widthFlag = 1; + if (new Integer(nvl(rrDashboardReports.getDataContainerHeight(),"100")).intValue() >100) heightFlag = 1; + + if(record == 1) { + if(rrDashboardReports.getReportFormFields()!=null && rrDashboardReports.getReportFormFields().size()>0) { + buildReportdata = false; + if(rDisplayContent) buildReportdata = true; + } + } + + if(buildReportdata) { + if(similiarReportRuntime != null ) { + rd = (ReportData) reportDataMap.get(intObj); + ds = (DataSet) reportChartDataMap.get(intObj); + } else { + if (!rrDashboardReports.getReportType().equals(AppConstants.RT_HIVE)) + rd = rrDashboardReports.loadReportData(pageNo, userId, downloadLimit,request, false /*download*/); + else + rd = rrDashboardReports.loadHiveLinearReportData(rrDashboardReports.getReportSQL(), userId, 2,request); + ds = rrDashboardReports.loadChartData(userId,request); + } + } + + + long totalTime = System.currentTimeMillis() - currentTime; + formFields = AppUtils.getRequestNvlValue(request, "formFields"); + if(buildReportdata) { + rrDashboardReports.logReportRun(userId, String.valueOf(totalTime),formFields); + rrDashboardReports.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_EXECUTION_TIME, formFields); + } + + /*reportsRuntimeMap.put(new Integer(entry.getKey().toString()), rrDashboardReports); + reportDataMap.put(new Integer(entry.getKey().toString()), rd); + reportChartDataMap.put(new Integer(entry.getKey().toString()), ds); + reportDisplayTypeMap.put(new Integer(entry.getKey().toString()), entry.getValue().toString().substring(0,1));*/ + + reportsRuntimeMap.put(new Integer(entry.getKey().toString())+"_"+rrDashboardReports.getReportID(), rrDashboardReports); + reportDisplayTypeMap.put(new Integer(entry.getKey().toString())+"_"+rrDashboardReports.getReportID(), entry.getValue().toString().substring(0,1)); + if(buildReportdata) { + reportDataMap.put(new Integer(entry.getKey().toString())+"_"+rrDashboardReports.getReportID(), rd); + reportChartDataMap.put(new Integer(entry.getKey().toString())+"_"+rrDashboardReports.getReportID(), ds); + } + + } + + /*if(widthFlag ==1) request.getSession().setAttribute("extendedWidth", "Y"); + else request.getSession().removeAttribute("extendedWidth"); + if(heightFlag ==1) request.getSession().setAttribute("extendedHeight", "Y"); + else request.getSession().removeAttribute("extendedHeight"); + */ + request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP, new TreeMap(reportsRuntimeMap)); + request.getSession().setAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP, new TreeMap(reportDisplayTypeMap)); + if(buildReportdata) { + request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP, new TreeMap(reportDataMap)); + request.getSession().setAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP, new TreeMap(reportChartDataMap)); + } +// debugLogger.debug("I am inside this if " + rr1.getReportType() + " "+rr1.getReportID()); + request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr1); //changing session to request + //request.setAttribute(AppConstants.SI_REPORT_RUNTIME, rr1); + if((String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!= null || rr1.getReportType().equals(AppConstants.RT_DASHBOARD)) { + request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME, rr1); + } + + return "raptor/report_dashboard_run_container.jsp"; + } else { + fromDashboard = AppUtils.getRequestFlag(request,"fromDashboard"); + if(isDashboardInDrillDownList(request)) fromDashboard= true; + + if(!fromDashboard) { + request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP); + request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP); + request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP); + request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP); + request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_REP_ID); + request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME); + request.getSession().removeAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP); + request.getSession().removeAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP); + } + //String pdfAttachmentKey = AppUtils.getRequestValue(request, "pdfAttachmentKey"); + String report_email_sent_log_id = AppUtils.getRequestValue(request, "log_id"); + logger.debug(EELFLoggerDelegate.debugLogger, ("Email PDF" + pdfAttachmentKey+" "+ report_email_sent_log_id)); + + //email pdf attachment specific + if(nvl(pdfAttachmentKey).length()>0 && report_email_sent_log_id !=null) + isEmailAttachment = true; + if(isEmailAttachment) { + /* String query = "Select user_id, rep_id from CR_REPORT_EMAIL_SENT_LOG" + + " where rownum = 1" + + " and gen_key='"+pdfAttachmentKey.trim()+"'" + + " and log_id ="+report_email_sent_log_id.trim() + + " and (sysdate - sent_date) < 1 ";*/ + + + String query = Globals.getDownloadAllEmailSent(); + query = query.replace("[pdfAttachmentKey.trim()]", pdfAttachmentKey.trim()); + query = query.replace("[report_email_sent_log_id.trim()]", report_email_sent_log_id.trim()); + + DataSet ds = DbUtils.executeQuery(query, 1); + if(!ds.isEmpty()) { + userId = ds.getString(0,"user_id"); + reportID = ds.getString(0, "rep_id"); + request.setAttribute("schedule_email_userId", userId); + } else { + request.setAttribute("message", "This link has expired, please login and regenerate the report"); + return "raptor/message.jsp"; + } + } else userId = AppUtils.getUserID(request); +// debugLogger.debug("Report ID b4 showbutton in ActionHandler " +// + ( request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null?((ReportRuntime)request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).getReportID():"Not in session")); +// debugLogger.debug("Report ID " + reportID + " " + reportIDFromSession); + + // Scheduling Dashoard report + if(reportID !=null && nvl(pdfAttachmentKey).length()>0) + rr = rh1.loadReportRuntime(request, reportID, true, 1); + if(rr!=null && rr.getReportType().equals(AppConstants.RT_DASHBOARD) && nvl(pdfAttachmentKey).length()>0) { + int DASH=7; + int requestFlag = DASH; + ReportHandler rh = new ReportHandler(); + request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REP_ID, reportID); + //rr = null; + // get dashboard HTML from report runtime. getListOfReportsFromDashBoardHTML + String strHTML = rr.getDashboardLayoutHTML(); + //System.out.println("StrHTML " + strHTML); + // call getListOfReportsFromDashBoardHTML returns HashMap + + TreeMap treeMap = getListOfReportsFromDashBoardHTML(strHTML); + //System.out.println("Size " + hashMap.size()); + Set set = treeMap.entrySet(); + String value = ""; + + HashMap reportsRuntimeMap = new HashMap(); + HashMap reportDataMap = new HashMap(); + HashMap reportChartDataMap = new HashMap(); + HashMap reportDisplayTypeMap = new HashMap(); + + userId = null; + userId = AppUtils.getUserID(request); + int pageNo = -1; + int downloadLimit = 0; + int rep_idx = 0; + int widthFlag = 0; + int heightFlag = 0; + ReportRuntime rrDashboardReports = null; + Integer intObj = null; + ReportRuntime similiarReportRuntime = null; + rd = null; + DataSet ds = null; + String reportIDFromMap = null; + int record = 0; + boolean buildReportdata = true; + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + record++; + Map.Entry entry = (Entry) iter.next(); + + reportIDFromMap = entry.getValue().toString().substring(1); + similiarReportRuntime = getSimiliarReportRuntime(reportsRuntimeMap, reportIDFromMap); + if(similiarReportRuntime != null ) { + rrDashboardReports = getSimiliarReportRuntime(reportsRuntimeMap, reportIDFromMap); + intObj = getKey(reportsRuntimeMap,reportIDFromMap); + } else { + rrDashboardReports = rh.loadReportRuntime(request, reportIDFromMap, true, requestFlag); + } + + downloadLimit = (rrDashboardReports.getMaxRowsInExcelDownload()>0)?rrDashboardReports.getMaxRowsInExcelDownload():Globals.getDownloadLimit(); + + if (new Integer(nvl(rrDashboardReports.getDataContainerWidth(),"100")).intValue() >100) widthFlag = 1; + if (new Integer(nvl(rrDashboardReports.getDataContainerHeight(),"100")).intValue() >100) heightFlag = 1; + if(record == 1) { + if(rrDashboardReports.getReportFormFields()!=null && rrDashboardReports.getReportFormFields().size()>0) { + buildReportdata = false; + if(rDisplayContent) buildReportdata = true; + } + } + if(buildReportdata) { + if(similiarReportRuntime != null ) { + rd = (ReportData) reportDataMap.get(intObj); + ds = (DataSet) reportChartDataMap.get(intObj); + } else { + + if (!rrDashboardReports.getReportType().equals(AppConstants.RT_HIVE)) + rd = rrDashboardReports.loadReportData(pageNo, userId, downloadLimit,request, false /*download*/); + else + rd = rrDashboardReports.loadHiveLinearReportData(rrDashboardReports.getReportSQL(), userId, 2,request); + ds = rrDashboardReports.loadChartData(userId,request); + } + } + + + + long totalTime = System.currentTimeMillis() - currentTime; + formFields = AppUtils.getRequestNvlValue(request, "formFields"); + + rrDashboardReports.logReportRun(userId, String.valueOf(totalTime),formFields); + rrDashboardReports.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_EXECUTION_TIME, formFields); + + reportsRuntimeMap.put(new Integer(entry.getKey().toString()), rrDashboardReports); + reportDisplayTypeMap.put(new Integer(entry.getKey().toString()), entry.getValue().toString().substring(0,1)); + if(buildReportdata) { + reportDataMap.put(new Integer(entry.getKey().toString()), rd); + reportChartDataMap.put(new Integer(entry.getKey().toString()), ds); + //reportDisplayTypeMap.put(new Integer(entry.getKey().toString()), entry.getValue().toString().substring(0,1)); + } + } + + /*if(widthFlag ==1) request.getSession().setAttribute("extendedWidth", "Y"); + else request.getSession().removeAttribute("extendedWidth"); + if(heightFlag ==1) request.getSession().setAttribute("extendedHeight", "Y"); + else request.getSession().removeAttribute("extendedHeight"); + */ + request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP, new TreeMap(reportsRuntimeMap)); + request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr); //changing session to request + if(buildReportdata) { + request.getSession().setAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP, new TreeMap(reportDisplayTypeMap)); + request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP, new TreeMap(reportDataMap)); + request.getSession().setAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP, new TreeMap(reportChartDataMap)); + } + //request.setAttribute(AppConstants.SI_REPORT_RUNTIME, rr1); + //return nextPage; + } else { + + // Ends + + +// debugLogger.debug("Action Handler *****************" + new java.util.Date()+ " " + isGoBackAction); + ReportHandler rh = new ReportHandler(); + //rr = null; // COMMENT THIS LINE + boolean resetParams = AppUtils.getRequestFlag(request, + AppConstants.RI_RESET_PARAMS); + boolean resetAction = AppUtils.getRequestFlag(request, + AppConstants.RI_RESET_ACTION); + boolean refresh = false; + if (resetAction) { + rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); + resetParams=true; + refresh = true; + if(rr!=null) { + rr.setParamValues(request, resetParams,refresh); + request.getSession().removeAttribute(AppConstants.RI_REPORT_DATA); + rr.resetVisualSettings(); + } + return nextPage; + } + + /*if (isGoBackAction) { +// debugLogger.debug("Report back in action handler " + ((ReportRuntime) request.getSession().getAttribute( +// AppConstants.SI_REPORT_RUN_BACKUP))!=null?((ReportRuntime) request.getSession().getAttribute( +// AppConstants.SI_REPORT_RUN_BACKUP)).getReportID():((ReportRuntime) request.getSession().getAttribute( +// AppConstants.SI_REPORT_RUN_BACKUP))); + rr = null; + rr = getReportRuntimeFromBackup(request); + if (rr == null) + throw new Exception("[ActionHandler.reportRun] Report backup not found"); + reportID = rr.getReportID(); + } else {*/ + + logger.debug(EELFLoggerDelegate.debugLogger, ("Ocurring during Schedule ")); + //TODO differentiate Schedule with other actions +// if(isEmailAttachment) { +// +// } else { +// +// } + rr = rh.loadReportRuntime(request, reportID); + //setParamValues called for Drilldown to display formfield + //rr.setParamValues(request, false,true); + + //} // else + + ArrayList aL = (ArrayList)request.getSession().getAttribute(AppConstants.DRILLDOWN_REPORTS_LIST); + ReportRuntime aLR = null; + if(aL != null) { +// for (int i = 1; i < aL.size(); i++) { +// aLR = (ReportRuntime) aL.get(i); +// if (!aLR.getReportID().equals(reportID)) { +// request.setAttribute(AppConstants.RI_SHOW_BACK_BTN, "Y"); +// } +// } +// if(reportID.equals(reportIDFromSession)) { + aLR = (ReportRuntime) aL.get(0); + if (aLR!=null && !aLR.getReportID().equals(reportID)) { + request.setAttribute(AppConstants.RI_SHOW_BACK_BTN, "Y"); + } +// } + } + + if(rDisplayContent) + rr.setDisplayFlags(true, true); + + if (rr.getDisplayContent()) { + int pageNo = 0; + if (isGoBackAction) + pageNo = rr.getCachedPageNo(); + else { + try { + pageNo = Integer.parseInt(AppUtils.getRequestNvlValue(request, AppConstants.RI_NEXT_PAGE)); + } catch (Exception e) { + } + + String vAction = AppUtils.getRequestNvlValue(request, + AppConstants.RI_VISUAL_ACTION); + String vCoId = AppUtils.getRequestNvlValue(request, + AppConstants.RI_DETAIL_ID); + if (vAction.equals(AppConstants.VA_HIDE)) + rr.hideColVisual(vCoId); + else if (vAction.equals(AppConstants.VA_SHOW)) + rr.showColVisual(vCoId); + else if (vAction.equals(AppConstants.VA_SORT)) { + rr.sortColVisual(vCoId); + pageNo = 0; + } // else + } // else + + int downloadLimit = (rr.getMaxRowsInExcelDownload()>0)?rr.getMaxRowsInExcelDownload():Globals.getDownloadLimit(); + if(isEmailAttachment) { + String limit = nvl(request.getParameter("download_limit"),"1000"); + downloadLimit = Integer.parseInt(limit); + } + //if (action.startsWith("mobile")) rr.setPageSize(5); + long reportTime = System.currentTimeMillis(); + if (!rr.getReportType().equals(AppConstants.RT_HIVE)) + rd = rr.loadReportData(pageNo, userId, downloadLimit,request,false /*download*/); + else + rd = rr.loadHiveLinearReportData(rr.getReportSQL(), userId, 2,request); + logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] ------->Time Taken for the loading report data --- " + (System.currentTimeMillis() - reportTime))); + ReportData rd_whole = null; + boolean hideReportMap = rr.isDisplayOptionHideMap()||AppUtils.getRequestNvlValue(request, "noMap").equals("Y"); +/* if (Globals.getMapAllowedYN().equals("Y") && !hideReportMap && rr.getReportMap()!=null){ + rd_whole = rr.loadReportData(-1, userId, downloadLimit,request); + } +*/ + request.getSession().setAttribute(AppConstants.RI_REPORT_DATA, rd); + //if (Globals.getMapAllowedYN().equals("Y") && !hideReportMap && (rr.getReportMap()!=null && rr.getReportMap().getLatColumn()!=null && rr.getReportMap().getLongColumn()!=null)) { + if(rr!=null && rr.getReportType().equals(AppConstants.RT_LINEAR)) { + String sql_whole = rr.getReportDataSQL(userId, downloadLimit, request); + request.setAttribute(AppConstants.RI_REPORT_SQL_WHOLE, sql_whole); + } else if(rr.getReportType().equals(AppConstants.RT_HIVE)) { + String sql_whole = rr.getReportSQL(); + request.setAttribute(AppConstants.RI_REPORT_SQL_WHOLE, sql_whole); + } + //} + //request.setAttribute(AppConstants.RI_REPORT_DATA_WHOLE, rd_whole); + // if(rr.getReportDataSize() > Globals.getFlatFileLowerLimit() && rr.getReportDataSize() <= Globals.getFlatFileUpperLimit() ) { + // rr.setFlatFileName(rh.saveFlatFile(request, rd, rr + // .getParamNameValuePairs(), rr.getReportName(), rr.getReportDescr())); + // } + //if(actionKey!=null && actionKey.equals("report.download")) { +// rr.setExcelPageFileName(rh.saveAsExcelFile(request, rd, rr +// .getParamNameValuePairs(), rr.getReportName(), rr.getReportDescr())); + //} + if (!rr.getReportType().equals(AppConstants.RT_HIVE)) { + long currentChartTime = System.currentTimeMillis(); + DataSet chartDS = rr.loadChartData(userId,request); + if(chartDS != null) + request.getSession().setAttribute(AppConstants.RI_CHART_DATA, rr.loadChartData(userId,request)); + else + request.getSession().removeAttribute(AppConstants.RI_CHART_DATA); + logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] ------->Time Taken for the loading chart data --- " + (System.currentTimeMillis() - currentChartTime))); + } + +/* if((String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null) { + request.getSession().setAttribute("FirstDashReport", rr); + } +*/ + } + request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr); //changing session to request + request.getSession().setAttribute(AppConstants.RI_REPORT_DATA, rd); + } // else + long totalTime = System.currentTimeMillis() - currentTime; + formFields = AppUtils.getRequestNvlValue(request, "formFields"); + request.setAttribute(AppConstants.RLA_EXECUTION_TIME, "" + totalTime); + + + boolean isFromReportLog = AppUtils.getRequestFlag(request, "fromReportLog"); + if(!isFromReportLog) { + if(pdfAttachmentKey!=null && pdfAttachmentKey.length()>0) { + if(actionKey.equals("report.download")) { + rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_SCHEDULED_DOWNLOAD_EXCEL, formFields); + } else if (actionKey.equals("report.download.pdf")) { + rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_SCHEDULED_DOWNLOAD_PDF, formFields); + } + } else { + if(actionKey.equals("report.download") ) { + rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_DOWNLOAD_EXCEL, formFields); + } else if (actionKey.equals("report.download.pdf")) { + rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_DOWNLOAD_PDF, formFields); + } else if (actionKey.equals("report.csv.download")) { + rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_DOWNLOAD_CSV, formFields); + } else if (actionKey.equals("report.text.download")) { + rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_DOWNLOAD_TEXT, formFields); + } else { + + //rr.logReportRun(userId, String.valueOf(totalTime),formFields); + if(rd!=null && !action.equals("report.run.container")) + rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_EXECUTION_TIME, formFields); + } + } + } else { + rr.logReportExecutionTimeFromLogList(userId, String.valueOf(totalTime),formFields); + } + +/* if((String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null) { + reportID = (String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID); + ReportRuntime rrDash = rh1.loadReportRuntime(request, reportID, true, 1); + request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rrDash); + } +*/ + if(rr.isDrillDownURLInPopupPresent()) { + request.getSession().setAttribute("parent_"+rr.getReportID()+"_rr", rr); + request.getSession().setAttribute("parent_"+rr.getReportID()+"_rd", rd); + } + + if(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) { + return "raptor/report_crosstab_run_container.jsp"; + } else if (rr.getReportType().equals(AppConstants.RT_HIVE) && !isEmailAttachment) { + return "raptor/report_hive_run_container.jsp"; + } + } // else + + boolean isEmbedded = false; + Object temp = request.getSession().getAttribute("isEmbedded"); + if(temp!=null){ + isEmbedded = (boolean)temp; + } + if(isEmbedded && !action.equals("chart.run")){ + HashMap embeddedReportsRuntimeMap = null; + HashMap embeddedReportsDataMap = null; + if(request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP)!= null){ + embeddedReportsRuntimeMap = (HashMap)request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP); + } else { + embeddedReportsRuntimeMap = new HashMap(); + } + if(request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP)!= null){ + embeddedReportsDataMap = (HashMap)request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP); + } else { + embeddedReportsDataMap = new HashMap(); + } + embeddedReportsRuntimeMap.put(rr.getReportID(), rr); + embeddedReportsDataMap.put(rr.getReportID(), rd); + + + request.getSession().setAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP, embeddedReportsRuntimeMap); + request.getSession().setAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP, embeddedReportsDataMap); + + } + + ReportJSONRuntime reportJSONRuntime = rr.createReportJSONRuntime(request, rd); + ObjectMapper mapper = new ObjectMapper(); + //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY); + //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE)); + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + String jsonInString = ""; + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(reportJSONRuntime); + } catch (Exception ex) { + ex.printStackTrace(); + + } + return jsonInString; + } catch (RaptorException e) { + try { + e.printStackTrace(); + + if(rr!=null) { // when user tries report they don't have access this should not throw exception that's why this if is added. + if(isEmailAttachment) + rr.logReportExecutionTime(userId, "", "Scheduled: " + AppConstants.RLA_ERROR, formFields); + else + rr.logReportExecutionTime(userId, "", "On Demand: " + AppConstants.RLA_ERROR, formFields); + } + + ErrorJSONRuntime errorJSONRuntime = new ErrorJSONRuntime(); + errorJSONRuntime.setErrormessage(e.getMessage()); + errorJSONRuntime.setStacktrace(getStackTrace(e)); + ObjectMapper mapper = new ObjectMapper(); + //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY); + //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE)); + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + String jsonInString = ""; + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorJSONRuntime); + } catch (Exception ex) { + ex.printStackTrace(); + + } + return jsonInString; + + } catch (RaptorException ex) { + nextPage = (new ErrorHandler()).processFatalError(request, ex); + ErrorJSONRuntime errorJSONRuntime = new ErrorJSONRuntime(); + errorJSONRuntime.setErrormessage(ex.getMessage()); + errorJSONRuntime.setStacktrace(getStackTrace(ex)); + ObjectMapper mapper = new ObjectMapper(); + //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY); + //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE)); + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + String jsonInString = ""; + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorJSONRuntime); + } catch (Exception ex1) { + ex1.printStackTrace(); + } + return jsonInString; + } + //nextPage = (new ErrorHandler()).processFatalError(request, e); + } catch (Throwable t) { + t.printStackTrace(); + ErrorJSONRuntime errorJSONRuntime = new ErrorJSONRuntime(); + errorJSONRuntime.setErrormessage(t.toString()); + errorJSONRuntime.setStacktrace(getStackTrace(t)); + ObjectMapper mapper = new ObjectMapper(); + //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY); + //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE)); + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + String jsonInString = ""; + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorJSONRuntime); + } catch (Exception ex) { + ex.printStackTrace(); + + } + return jsonInString; + + } + //return nextPage; + } // reportRun + + public static String getStackTrace(Throwable aThrowable) { + Writer result = new StringWriter(); + PrintWriter printWriter = new PrintWriter(result); + aThrowable.printStackTrace(printWriter); + return result.toString(); + } + + /** + * The below method is used to optimize, so that if there is already same report id in hashMap it wouldn't go through the whole process again. + **/ + private ReportRuntime getSimiliarReportRuntime(HashMap reportsRuntimeMap, String reportID) { + Set set = reportsRuntimeMap.entrySet(); + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + Map.Entry entry = (Entry) iter.next(); + if (((ReportRuntime) entry.getValue()).getReportID().equals(reportID)) { + return (ReportRuntime) entry.getValue(); + } + } + return null; + } + + private Integer getKey(HashMap reportsRuntimeMap, String reportID) { + Set set = reportsRuntimeMap.entrySet(); + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + Map.Entry entry = (Entry) iter.next(); + if (((ReportRuntime) entry.getValue()).getReportID().equals(reportID)) { + return new Integer(((String) entry.getKey()).substring(2)); + } + } + return null; + } + + public String reportSearch(HttpServletRequest request, String nextPage) { + return reportSearchExecute(request, nextPage); + } // reportSearch + + public String reportSearchUser(HttpServletRequest request, String nextPage) { + removeVariablesFromSession(request); + request.setAttribute(AppConstants.RI_USER_REPORTS, "Y"); + return reportSearchExecute(request, nextPage); + } // reportSearchUser + + public String reportSearchPublic(HttpServletRequest request, String nextPage) { + removeVariablesFromSession(request); + request.setAttribute(AppConstants.RI_PUBLIC_REPORTS, "Y"); + return reportSearchExecute(request, nextPage); + } // reportSearchPublic + + public String reportSearchFavorites(HttpServletRequest request, String nextPage) { + removeVariablesFromSession(request); + request.setAttribute(AppConstants.RI_FAVORITE_REPORTS, "Y"); + return reportSearchExecute(request, nextPage); + } // reportSearchFavorites + + public String reportSearchExecute(HttpServletRequest request, String nextPage) { + removeVariablesFromSession(request); + try { + SearchHandler sh = new SearchHandler(); + ReportSearchResultJSON sr = sh.loadReportSearchResult(request); + return sr.getJSONString(); + //request.setAttribute(AppConstants.RI_SEARCH_RESULT, sr); + } catch (RaptorException e) { + nextPage = (new ErrorHandler()).processFatalError(request, e); + } + + return nextPage; + } // reportSearchExecute + + public String reportChartRun(HttpServletRequest request, String nextPage) { + ChartWebRuntime cwr = new ChartWebRuntime(); + return cwr.generateChart(request, false); //no data + } // reportSearchExecute + + public String reportChartDataRun(HttpServletRequest request, String nextPage) { + ChartWebRuntime cwr = new ChartWebRuntime(); + return cwr.generateChart(request); //data + } // reportSearchExecute + + + // public String reportRunExecute(HttpServletRequest request, String nextPage) { +// try { +// ReportRunHandler rh = new ReportRunHandler(); +// ReportRunResultJSON sr = rh.loadReportRunResult(request); +// return sr.getJSONString(); +// //request.setAttribute(AppConstants.RI_SEARCH_RESULT, sr); +// } catch (RaptorException e) { +// nextPage = (new ErrorHandler()).processFatalError(request, e); +// } +// +// return nextPage; +// } + + public String getQuickLinksJSON(HttpServletRequest request, String nextPage) { + String jsonInString = null; + try { + ArrayList quickLinks = ReportLoader.getQuickLinksJSON(request, request.getParameter("quick_links_menu_id"),true); + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(quickLinks); + + } catch (Exception e) { + e.printStackTrace(); + } + return jsonInString; + } + + public String processScheduleReportList(HttpServletRequest request, String nextPage) { + String reportID = ""; + reportID = AppUtils.getRequestNvlValue(request, "schedule_reports"); + if (nvl(reportID).length()<=0) + reportID = AppUtils.getRequestNvlValue(request, AppConstants.RI_REPORT_ID); + // Added for form field chaining in schedule tab so that setParamValues() is called + request.setAttribute(AppConstants.SCHEDULE_ACTION, "Y"); + + try { + boolean isAdmin = AppUtils.isAdminUser(request); + boolean check = ReportLoader.doesUserCanScheduleReport(request, null); + + logger.debug(EELFLoggerDelegate.debugLogger, ("^^^^^^^^^^^^^Check " + check + " Admin "+ isAdmin)); + + if(check || isAdmin) { + if(reportID.length()>0) { + ReportHandler rh = new ReportHandler(); + ReportDefinition rdef = rh.loadReportDefinition(request, reportID); + request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef); + ReportSchedule reportSchedule = null; + if(rdef!=null) { + reportSchedule = new ReportSchedule(reportID, AppUtils.getUserID(request), false, request); + } + request.getSession().setAttribute(AppConstants.SI_REPORT_SCHEDULE, reportSchedule); + } + } else { + //String message = "You have reached your schedule limit. Please visit this page again after removing your old schedules in \"My Schedule\" section."; + String message = "You have reached the scheduled report limit for your Login ID. Please remove any old schedule requests in the \"My Scheduled Reports\" screen before attempting to schedule any additional reports."; + nextPage = (new ErrorHandler()).processFatalError(request, new RaptorSchedularException(message)); + } + + } catch(Exception ex) { ex.printStackTrace();} + return nextPage; + } + + public String processSchedule(HttpServletRequest request, String nextPage) { + + // Added for form field chaining in schedule tab so that setParamValues() is called + + request.setAttribute(AppConstants.SCHEDULE_ACTION, "Y"); + if(request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE)!=null && (!AppUtils.getRequestNvlValue(request, AppConstants.RI_ACTION).equals("report.schedule_only_from_search"))) { + String action = nvl(request.getParameter(AppConstants.RI_WIZARD_ACTION), + AppConstants.WA_BACK); + String scheduleID = ""; + scheduleID = AppUtils.getRequestValue(request, AppConstants.RI_SCHEDULE_ID); + ReportSchedule reportSchedule = null; + + if( nvl(scheduleID).length() <= 0) { + reportSchedule = (ReportSchedule) request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE); + scheduleID = reportSchedule.getScheduleID(); + } + + String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID); + try { + boolean isAdmin = AppUtils.isAdminUser(request); + boolean check = ReportLoader.doesUserCanScheduleReport(request, scheduleID); + if(!isAdmin && !check) { + String message = "You have reached the scheduled report limit for your Login ID. Please remove any old schedule requests in the My Scheduled Reports screen before attempting to schedule any additional reports."; + nextPage = (new ErrorHandler()).processFatalError(request, new RaptorSchedularException(message)); + return nextPage; + } + + } catch (Exception ex) { ex.printStackTrace();} + if(reportSchedule == null) reportSchedule = new ReportSchedule(reportID, scheduleID, AppUtils.getUserID(request), request); + String formFields = ""; + formFields = reportSchedule.getFormFields(); + formFields = (formFields.length()>1)?formFields.substring(1):formFields; + String formFieldsArr[] = formFields.split("&"); + String sessionParams[] = Globals.getSessionParamsForScheduling().split(","); + + for (int i=0; i1)?formFields.substring(1):formFields; + String formFieldsArr[] = formFields.split("&"); + String sessionParams[] = Globals.getSessionParamsForScheduling().split(","); + + for (int i=0; i 0) + ws.performGoToStep(goToStep); + else + ws.performAction(action, rdef); + } catch (ValidationException ve) { + (new ErrorHandler()).processError(request, ve); + } catch (RaptorException e) { + nextPage = (new ErrorHandler()).processFatalError(request, e); + } catch (Throwable t) { + t.printStackTrace(); + } + + return nextPage; + } // reportWizard + + public String refreshCache ( HttpServletRequest request, String nextPage ) { + //DataCache.refreshReportTableSources(); + removeVariablesFromSession(request); + DataCache.refreshAll(); + Globals.getAppUtils().resetUserCache(); + request.setAttribute("message", "Cache Refreshed"); + return nextPage; + } + public String reportCreate(HttpServletRequest request, String nextPage) { + try { + removeVariablesFromSession(request); + ReportDefinition rdef = ReportDefinition.createBlank(request); + + request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef); + // request.setAttribute(AppConstants.RI_CUR_STEP, + // AppConstants.WS_DEFINITION); + DataCache.refreshReportTableSources(); + request.getSession().removeAttribute("remoteDB"); + } catch (RaptorException e) { + nextPage = (new ErrorHandler()).processFatalError(request, e); + } + + return nextPage; + } // reportCreate + + public String reportImportSave(HttpServletRequest request, String nextPage) { + try { + String reportXML = nvl(AppUtils.getRequestValue(request, "reportXML")).trim(); + + ReportHandler rh = new ReportHandler(); + ReportDefinition rdef = rh.createReportDefinition(request, "-1", reportXML); + rdef.updateReportDefType(); + rdef.generateWizardSequence(request); + rdef.setReportName("Import: " + rdef.getReportName()); + rdef.clearAllDrillDowns(); + + request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef); + } catch (RaptorException e) { + request.setAttribute("error_extra_msg", "Unable to parse XML. Nested error: "); + nextPage = (new ErrorHandler()).processFatalError(request, e); + } + + return nextPage; + } // reportImportSave + + private String reportLoad(HttpServletRequest request, String nextPage, boolean asCopy) { + try { + String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID); + + ReportHandler rh = new ReportHandler(); + ReportDefinition rdef = rh.loadReportDefinition(request, reportID); + if (asCopy) + rdef.setAsCopy(request); + else + rdef.checkUserWriteAccess(request); + + rdef.getWizardSequence().performGoToStep(AppConstants.WS_DEFINITION); + request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef); + // request.setAttribute(AppConstants.RI_CUR_STEP, + // AppConstants.WS_DEFINITION); + } catch (RaptorException e) { + nextPage = (new ErrorHandler()).processFatalError(request, e); + } + + return nextPage; + } // reportLoad + + public String reportCopy(HttpServletRequest request, String nextPage) { + return reportLoad(request, nextPage, true); + } // reportCopy + + public String reportEdit(HttpServletRequest request, String nextPage) { + return reportLoad(request, nextPage, false); + } // reportEdit + + public String reportDelete(HttpServletRequest request, String nextPage) { + try { + String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID); + try { + int i = Integer.parseInt(reportID); + } catch(NumberFormatException ex) { + throw new UserDefinedException("Not a valid report id"); + } + String userID = AppUtils.getUserID(request); + + (new ReportSecurity(reportID)).checkUserDeleteAccess(request); + + ReportLoader.deleteReportRecord(reportID); + + return "deleted:true"; + //nextPage = reportSearchExecute(request, nextPage); + } catch (RaptorException e) { + nextPage = (new ErrorHandler()).processFatalError(request, e); + } + + //return nextPage; + return "deleted:false"; + } // reportDelete + + private String generateSearchString(HttpServletRequest request) { + String searchString = AppUtils.getRequestNvlValue(request, AppConstants.RI_SEARCH_STRING); + boolean containFlag = AppUtils.getRequestFlag(request, AppConstants.RI_CONTAIN_FLAG); + return (searchString.length() > 0) ? ((containFlag ? "%" : "") + searchString + "%"):""; + } // generateSearchString + + public String reportFormFieldPopup(HttpServletRequest request, String nextPage) { + try { + ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute( + AppConstants.SI_REPORT_RUNTIME); + + FormField ff = rr.getFormField(request.getParameter(AppConstants.RI_FIELD_NAME)); + ReportFormFields rff = rr.getReportFormFields(); + + int idx = 0; + FormField ff1 = null; + Map fieldNameMap = new HashMap(); + int countOfFields = 0 ; + String userId = AppUtils.getUserID(request); + IdNameList lookup = ff.getLookupList(); + String oldSQL = lookup.getOldSql(); + + if(AppUtils.getRequestFlag(request, AppConstants.RI_TEXTFIELD_POP)) { + for(rff.resetNext(); rff.hasNext(); idx++) { + ff1 = rff.getNext(); + fieldNameMap.put(ff1.getFieldName(), ff1.getFieldDisplayName()); + countOfFields++; + } + + + //List formParameter = new ArrayList(); + String formField = ""; + HashMap valuesMap = new HashMap(); + for(int i = 0 ; i < rff.size(); i++) { + formField = ((FormField)rff.getFormField(i)).getFieldName(); + if(request.getParameterValues(formField) != null && request.getParameterValues(formField).length > 1 ) { + String[] vals = (String[]) request.getParameterValues(formField); + String value = ""; + StringBuffer valueBuf = new StringBuffer(); + for(int ii = 0 ; ii < vals.length; ii++) { + if(ii == 0) valueBuf.append("("); + valueBuf.append(vals[ii]); + if(ii == vals.length-1) valueBuf.append(")"); + else valueBuf.append(","); + } + value = valueBuf.toString(); + valuesMap.put(fieldNameMap.get(formField), value); + } else if(request.getParameter(formField) != null) { + valuesMap.put(fieldNameMap.get(formField), request.getParameter(formField)); + } + } + if(countOfFields != 0) { + IdNameSql lu = (IdNameSql) lookup; + String SQL = (oldSQL==null)?lu.getSql():oldSQL; + oldSQL = SQL; + Set set = valuesMap.entrySet(); + String value = ""; + StringBuffer valueBuf = new StringBuffer(); + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + Map.Entry entry = (Entry) iter.next(); + if(entry.getValue() instanceof String[]) { + String[] vals = (String[]) entry.getValue(); + for(int i = 0 ; i < vals.length; i++) { + if(i == 0) valueBuf.append("("); + valueBuf.append(vals[i]); + if(i == vals.length-1) valueBuf.append(")"); + else valueBuf.append(","); + } + value = valueBuf.toString(); + } else { + value = (String) entry.getValue(); + } + // added so empty string would be treated as null value if not given in single quotes. + if(value==null || value.trim().length()<=0) value="NULL"; + SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", Utils.oracleSafe(value)); + } + if(request.getParameter(ff.getFieldName())!=null) { + lookup = new IdNameSql(-1,SQL,null); + lookup.setOldSql(oldSQL); + } + else { + lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL()); + lookup.setOldSql(oldSQL); + } + //lookup.loadData("0"); + } + if(lookup instanceof IdNameSql) ((IdNameSql)lookup).setDataSizeUsedinPopup(-3); // -3 indicates to run the count sql for pagination. + } + if(lookup instanceof IdNameSql) { + ((IdNameSql)lookup).loadUserData(request.getParameter(AppConstants.RI_NEXT_PAGE), + nvl(generateSearchString(request),"%"), rr.getDBInfo(),userId); + } + + int dataSizeForPopUp = 0; + if(lookup instanceof IdNameSql) { + dataSizeForPopUp = ((IdNameSql)lookup).getDataSizeUsedinPopup(); + } else + dataSizeForPopUp = lookup.getDataSize(); + + ff.setLookupList(lookup); + request.setAttribute("lookupList", lookup); + if(dataSizeForPopUp >= 0) + request.getSession().setAttribute(AppConstants.SI_DATA_SIZE_FOR_TEXTFIELD_POPUP, ""+dataSizeForPopUp); + } catch (RaptorException e) { + e.printStackTrace(); + nextPage = (new ErrorHandler()).processFatalError(request, e); + } + return nextPage; + } // reportFormFieldPopup + + public String reportValuesMapDefPopup(HttpServletRequest request, String nextPage) { + try { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + String colName = AppUtils.getRequestNvlValue(request, "colName"); + String colType = nvl(AppUtils.getRequestValue(request, "colType"), + AppConstants.CT_CHAR); + String displayName = AppUtils.getRequestNvlValue(request, "displayName"); + String displayFormat = AppUtils.getRequestNvlValue(request, "displayFormat"); + String tableId = AppUtils.getRequestNvlValue(request, "tableId"); + String dbInfo = rdef.getDBInfo(); + if (Utils.isNull(dbInfo)) { + dbInfo = (String) request.getSession().getAttribute("remoteDB"); + } + /*String query = "SELECT x FROM (SELECT DISTINCT " + + (colType.equals(AppConstants.CT_DATE) ? ("TO_CHAR(" + colName + ", '" + + nvl(displayFormat, AppConstants.DEFAULT_DATE_FORMAT) + "')") + : colName) + " x FROM " + + rdef.getTableById(tableId).getTableName() + " WHERE " + colName + + " IS NOT NULL ORDER BY 1) xx WHERE ROWNUM <= " + + Globals.getDefaultPageSize();*/ + + + String q1 = Globals.getReportValuesMapDefA(); + + String q2 = Globals.getReportValuesMapDefB(); + q2 = q2.replace("[colName]", colName); + q2 = q2.replace("[nvl(displayFormat, AppConstants.DEFAULT_DATE_FORMAT)]", nvl(displayFormat, AppConstants.DEFAULT_DATE_FORMAT)); + + String q3 = Globals.getReportValuesMapDefC(); + q3 = q3.replace("[colName]", colName); + + String q4 = Globals.getReportValuesMapDefD(); + q4 = q4.replace("[rdef.getTableById(tableId).getTableName()]", rdef.getTableById(tableId).getTableName()); + q4 = q4.replace("[colName]", colName); + q4 = q4.replace("[Globals.getDefaultPageSize()]", String.valueOf(Globals.getDefaultPageSize())); + + String query = q1 + (colType.equals(AppConstants.CT_DATE) ? q2 : q3) + q4; + + DataSet ds = ConnectionUtils.getDataSet(query, dbInfo); + request.setAttribute(AppConstants.RI_DATA_SET, ds); + } catch (RaptorException e) { + nextPage = (new ErrorHandler()).processFatalError(request, e); + } + + return nextPage; + } // reportValuesMapDefPopup + + public String reportDrillDownToReportDefPopup(HttpServletRequest request, String nextPage) { + try { + // ReportDefinition rdef = (ReportDefinition) + // request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION); + String ddReportID = AppUtils + .getRequestNvlValue(request, AppConstants.RI_REPORT_ID); + ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, ddReportID, + false); + if (ddRr != null) + request.setAttribute(AppConstants.RI_FORM_FIELDS, ddRr.getReportFormFields()); + } catch (RaptorException e) { + nextPage = (new ErrorHandler()).processFatalError(request, e); + } + + return nextPage; + } // reportDrillDownToReportDefPopup + + public String reportFilterDataPopup(HttpServletRequest request, String nextPage) { + try { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + String colId = AppUtils.getRequestNvlValue(request, AppConstants.RI_COLUMN_ID); + IdNameColLookup lookup = null; + String dbInfo = rdef.getDBInfo(); + if (Utils.isNull(dbInfo)) { + dbInfo = (String) request.getSession().getAttribute("remoteDB"); + } + if (!AppUtils.getRequestFlag(request, AppConstants.RI_RESET_PARAMS)) + lookup = (IdNameColLookup) request.getSession().getAttribute( + AppConstants.SI_COLUMN_LOOKUP); + if (lookup == null || (!colId.equals(lookup.getColId()))) { + DataColumnType dct = rdef.getColumnById(colId); + lookup = new IdNameColLookup(colId, rdef.getTableById(dct.getTableId()) + .getTableName(), dct.getColName(), rdef.getSelectExpr(dct), dct + .getColName() + + (dct.getColType().equals(AppConstants.CT_DATE) ? " DESC" : "")); + request.getSession().setAttribute(AppConstants.SI_COLUMN_LOOKUP, lookup); + } // if + + lookup.loadData(nvl(request.getParameter(AppConstants.RI_NEXT_PAGE), "0"), + generateSearchString(request), dbInfo); + } catch (RaptorException e) { + nextPage = (new ErrorHandler()).processFatalError(request, e); + } + + return nextPage; + } // reportFilterDataPopup + + public String reportShowSQLPopup(HttpServletRequest request, String nextPage) { + try { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + String reportSQL = rdef.generateSQL(AppUtils.getUserID(request),request); + + String[] sqlClause = { "SELECT ", "FROM ", "WHERE ", "GROUP BY ", "HAVING ", + "ORDER BY " }; + + int idxNext = 0; + StringBuffer sb = new StringBuffer(); + while (idxNext < sqlClause.length) { + sb.append(""); + if (idxNext > 0) + sb.append("    "); + sb.append(sqlClause[idxNext]); + sb.append("
    \n"); + + int clauseStartPos = reportSQL.indexOf(sqlClause[idxNext]) + + sqlClause[idxNext].length(); + do + idxNext++; + while ((idxNext < sqlClause.length) + && (reportSQL.indexOf(sqlClause[idxNext]) < 0)); + + String clauseContent = null; + if (idxNext < sqlClause.length) + clauseContent = reportSQL.substring(clauseStartPos, reportSQL + .indexOf(sqlClause[idxNext]) - 1); + else + clauseContent = reportSQL.substring(clauseStartPos); + + while (clauseContent.length() > 0) { + int braketCount = 0; + StringBuffer nextToken = new StringBuffer(); + for (int i = 0; i < clauseContent.length(); i++) { + char ch = clauseContent.charAt(i); + nextToken.append(ch); + if (ch == '(') + braketCount++; + else if (ch == ')') + braketCount--; + else if (ch == ',') + if (braketCount == 0) + break; + } // for %> + + sb.append("        "); + sb.append(nextToken.toString()); + sb.append("
    \n"); + + if (nextToken.length() < clauseContent.length()) + clauseContent = clauseContent.substring(nextToken.length() + 1); + else + clauseContent = ""; + } // while + } // while + + request.setAttribute(AppConstants.RI_FORMATTED_SQL, sb.toString()); + request.setAttribute(AppConstants.RI_PAGE_TITLE, "Generated SQL"); + request.setAttribute(AppConstants.RI_PAGE_SUBTITLE, "Generated SQL for report " + + rdef.getReportName()); + } catch (RaptorException e) { + nextPage = (new ErrorHandler()).processFatalError(request, e); + } + + return nextPage; + } // reportShowSQLPopup + + public String testSchedCondPopup(HttpServletRequest request, String nextPage) { + try { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + String sql = AppUtils.getRequestNvlValue(request, AppConstants.RI_FORMATTED_SQL); + + request.setAttribute("msg_align", " align=center"); + request.setAttribute(AppConstants.RI_PAGE_TITLE, "Test Scheduler Condition"); + // request.setAttribute(AppConstants.RI_PAGE_SUBTITLE, ...); + //String query = "SELECT 1 FROM DUAL WHERE EXISTS (" + sql + ")"; + + String query = Globals.getTestSchedCondPopup(); + query = query.replace("[sql]", sql); + + DataSet ds = null; + String remoteDb = request.getParameter("remoteDbPrefix"); + String remoteDbPrefix = (remoteDb != null && !remoteDb.equalsIgnoreCase("null")) ? remoteDb + : rdef.getDBInfo(); + ds = ConnectionUtils.getDataSet(sql, remoteDbPrefix); + // if ( (remoteDbPrefix!=null) && + // (!remoteDbPrefix.equals(AppConstants.DB_LOCAL))) { + // Globals.getRDbUtils().setDBPrefix(remoteDbPrefix); + // ds = RemDbUtils.executeQuery(query); + // } + // else + // ds = DbUtils.executeQuery(query); + if (ds.getRowCount() == 0) + request + .setAttribute(AppConstants.RI_FORMATTED_SQL, + "
    Condition NOT satisfied - email notification will NOT be send.

    "); + else + request + .setAttribute(AppConstants.RI_FORMATTED_SQL, + "
    Condition satisfied - email notification will be send.

    "); + } catch (Exception e) { + // nextPage = (new ErrorHandler()).processFatalError(request, e); + request.setAttribute(AppConstants.RI_FORMATTED_SQL, "
    SQL ERROR " + + e.getMessage() + "
    Email notification will NOT be send.

    "); + } + + return nextPage; + } // testSchedCondPopup + + public String testRunSQLPopup(HttpServletRequest request, String nextPage) { + String sql = AppUtils.getRequestNvlValue(request, AppConstants.RI_FORMATTED_SQL); + if(nvl(sql).length()<=0) { + sql = AppUtils.getRequestNvlValue(request, "reportSQL"); + } + + + boolean chkFormFieldSQL = AppUtils.getRequestNvlValue(request, + AppConstants.RI_CHK_FIELD_SQL).equals("Y"); + try { + if (!sql.trim().toUpperCase().startsWith("SELECT")) + throw new UserDefinedException( + "Invalid statement - the SQL must start with the keyword SELECT"); + + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + if (!chkFormFieldSQL) { + if (rdef.getFormFieldList() != null) + for (Iterator iter = rdef.getFormFieldList().getFormField().iterator(); iter + .hasNext();) { + FormFieldType fft = (FormFieldType) iter.next(); + String fieldId = fft.getFieldId(); + String fieldDisplay = rdef.getFormFieldDisplayName(fft); + /* + * if(paramValues.isParameterMultiValue(fieldId)) + * generatedSQL = Utils.replaceInString(generatedSQL, + * fieldDisplay, nvl(formatListValue((String) + * paramValues.get(fieldId), null, false, false, null), + * "NULL")); else + */ + sql = Utils.replaceInString(sql, fieldDisplay, "NULL"); + } // for + } // if + DataSet ds = null; + String remoteDb = request.getParameter("remoteDbPrefix"); + String remoteDbPrefix = (remoteDb != null && !remoteDb.equalsIgnoreCase("null")) ? remoteDb + : rdef.getDBInfo(); + String userId = AppUtils.getUserID(request); + sql = Utils.replaceInString(sql, "[LOGGED_USERID]", userId); + String[] reqParameters = Globals.getRequestParams().split(","); + String[] sessionParameters = Globals.getSessionParams().split(","); + javax.servlet.http.HttpSession session = request.getSession(); + logger.debug(EELFLoggerDelegate.debugLogger, ("B4 testRunSQL " + sql)); + if(request != null ) { + for (int i = 0; i < reqParameters.length; i++) { + if(!reqParameters[i].startsWith("ff")) + sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i].toUpperCase()) ); + else + sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) ); + } + } + if(session != null ) { + for (int i = 0; i < sessionParameters.length; i++) { + //if(!sessionParameters[i].startsWith("ff")) + //sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i].toUpperCase()) ); + //else { + logger.debug(EELFLoggerDelegate.debugLogger, (" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + (String)session.getAttribute(sessionParameters[i]))); + sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) ); + //} + } + } + logger.debug(EELFLoggerDelegate.debugLogger, ("After testRunSQL " + sql)); + + ds = ConnectionUtils.getDataSet(sql, remoteDbPrefix, true); + // if ( (remoteDbPrefix!=null) && + // (!remoteDbPrefix.equals(AppConstants.DB_LOCAL))) { + // Globals.getRDbUtils().setDBPrefix(remoteDbPrefix); + // ds = RemDbUtils.executeQuery(sql, + // Globals.getDefaultPageSize()+1); + // } + // else + // ds = DbUtils.executeQuery(sql, Globals.getDefaultPageSize()+1); + if (chkFormFieldSQL && ds.getRowCount() > 0) { + String id = ds.getString(0, "id"); + String name = ds.getString(0, "name"); + } // if + + request.setAttribute(AppConstants.RI_DATA_SET, ds); + } catch (RaptorException e) { + request.setAttribute(AppConstants.RI_EXCEPTION, e); + } + + return nextPage; + } // testRunSQLPopup + + public String importSemaphorePopup(HttpServletRequest request, String nextPage) { + try { + (new WizardProcessor()).processImportSemaphorePopup(request); + } catch (RaptorException e) { + nextPage = (new ErrorHandler()).processFatalError(request, e); + } + + return nextPage; + } // importSemaphorePopup + + public String saveSemaphorePopup(HttpServletRequest request, String nextPage) { + try { + (new WizardProcessor()).processSemaphorePopup(request); + } catch (RaptorException e) { + nextPage = (new ErrorHandler()).processFatalError(request, e); + } + + return nextPage; + } // saveSemaphorePopup + + public String gotoJsp(HttpServletRequest request, String nextPage) { + return nextPage; + } // gotoJsp + + public String downloadAll(HttpServletRequest request, String nextPage) throws InterruptedException, IOException, Exception { + String emailId = null; + String pdfAttachmentKey = AppUtils.getRequestValue(request, "pdfAttachmentKey"); + boolean isFromSchedule = nvl(pdfAttachmentKey).length()>0; + if(!isFromSchedule) + emailId = AppUtils.getUserEmail(request); + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd"); + java.util.Date currDate = new java.util.Date(); + String timestamp = sdf.format(currDate); + String dateStr = sdf1.format(currDate); + + String userId = null; + if(!isFromSchedule) + userId = AppUtils.getUserID(request); + else + userId = AppUtils.getRequestValue(request, "user_id"); + Runtime runtime = Runtime.getRuntime(); + ReportRuntime rr = null; + if(!isFromSchedule) { + rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); + if(rr!=null) AppUtils.getUserEmail(request); + } + String scheduleId = ""; + + if(isFromSchedule) { + String reportID = null; + String report_email_sent_log_id = AppUtils.getRequestValue(request, "log_id"); + /*String query = "Select user_id, rep_id from CR_REPORT_EMAIL_SENT_LOG" + + " where rownum = 1" + + " and gen_key='"+pdfAttachmentKey.trim()+"'" + + " and log_id ="+report_email_sent_log_id.trim() + + " and (sysdate - sent_date) < 1 ";*/ + + String query = Globals.getDownloadAllEmailSent(); + query = query.replace("[pdfAttachmentKey.trim()]", pdfAttachmentKey.trim()); + query = query.replace("[report_email_sent_log_id.trim()]", report_email_sent_log_id.trim()); + + DataSet ds = DbUtils.executeQuery(query, 1); + if(!ds.isEmpty()) { + userId = ds.getString(0,"user_id"); + reportID = ds.getString(0, "rep_id"); + request.setAttribute("schedule_email_userId", userId); + } else { + request.setAttribute("message", "This link has expired, please login and regenerate the report"); + return "raptor/message.jsp"; + } + + ReportHandler rh1 = new ReportHandler(); + + if(reportID !=null && nvl(pdfAttachmentKey).length()>0) { + rr = rh1.loadReportRuntime(request, reportID, true, 1); + rr.loadReportData(-1, userId, 1000 ,request, false /*download*/); + } + + String d_sql = Globals.getDownloadAllGenKey(); + d_sql = d_sql.replace("[pdfAttachmentKey]", pdfAttachmentKey); + + //ds = DbUtils.executeQuery("select schedule_id from cr_report_email_sent_log u where U.GEN_KEY = '"+ pdfAttachmentKey + "'"); + + ds = DbUtils.executeQuery(d_sql); + for (int i = 0; i < ds.getRowCount(); i++) { + scheduleId = ds.getString(i,0); + } + } + logger.debug(EELFLoggerDelegate.debugLogger, ("SQL2:\n"+ rr.getCachedSQL())); + String fileName = rr.getReportID()+"_"+userId+"_"+timestamp; + boolean flag = false; + logger.debug(EELFLoggerDelegate.debugLogger, (""+Utils.isDownloadFileExists(rr.getReportID()+"_"+userId+"_"+dateStr))); + // if(Utils.isDownloadFileExists(rr.getReportID()+"_"+userId+"_"+dateStr)) { + // flag = true; + // } + + if(flag){ + String strFileName = Utils.getLatestDownloadableFile(rr.getReportID()+"_"+userId+"_"+dateStr); + //debugLogger.debug("File Name " + strFileName); + StringBuffer messageBuffer = new StringBuffer(""); + messageBuffer.append("Download data file using the following link
    "); + messageBuffer.append("click here.

    "); + request.setAttribute("message", messageBuffer.toString()); + } + else if(!flag) { + String whole_fileName = (Globals.getShellScriptDir() +AppConstants.SHELL_QUERY_DIR+ fileName+AppConstants.FT_SQL); + String whole_columnsfileName = (Globals.getShellScriptDir() +AppConstants.SHELL_QUERY_DIR+ fileName+AppConstants.FT_COLUMNS); + + logger.debug(EELFLoggerDelegate.debugLogger, ("FILENAME "+whole_fileName)); + + List l = rr.getAllColumns(); + StringBuffer allColumnsBuffer = new StringBuffer(); + DataColumnType dct = null; + + for (Iterator iter = l.iterator(); iter.hasNext();) { + dct = (DataColumnType) iter.next(); + allColumnsBuffer.append(dct.getDisplayName()); + if(iter.hasNext()) + allColumnsBuffer.append("|"); + } + try { + PrintWriter xmlOut = new PrintWriter(new BufferedWriter(new FileWriter(new File(whole_columnsfileName)))); + xmlOut.println(allColumnsBuffer.toString()); + xmlOut.flush(); + xmlOut.close(); + } catch (IOException e) {e.printStackTrace();} + try { + PrintWriter xmlOut = new PrintWriter(new BufferedWriter(new FileWriter(new File(whole_fileName)))); + logger.debug(EELFLoggerDelegate.debugLogger, ("**************************")); + logger.debug(EELFLoggerDelegate.debugLogger, (rr.getWholeSQL())); + logger.debug(EELFLoggerDelegate.debugLogger, ("************************")); + logger.debug(EELFLoggerDelegate.debugLogger, ("************************")); + logger.debug(EELFLoggerDelegate.debugLogger, (rr.parseReportSQL(rr.getWholeSQL()))); + xmlOut.println(rr.parseReportSQL(rr.getWholeSQL())); + //xmlOut.println("******************"); + //xmlOut.println(rr.getWholeSQL()); + xmlOut.flush(); + xmlOut.close(); + } catch (IOException e) {e.printStackTrace();} + + StringBuffer command = new StringBuffer(Globals.getShellScriptDir() + AppConstants.SHELL_SCRIPTS_DIR); + if(nvl(emailId).length()>0) { + command.append(AppConstants.SHELL_SCRIPT_NAME + " " + (fileName+AppConstants.FT_SQL)); + command.append(" "+emailId); + } + else if (nvl(scheduleId).length()>0) { + command.append(AppConstants.SCHEDULE_SHELL_SCRIPT_NAME + " " + (fileName+AppConstants.FT_SQL)); + command.append(" " + scheduleId); + } + logger.debug(EELFLoggerDelegate.debugLogger, ("Command " + command)); + Process downloadProcess = runtime.exec(command.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, ("Command Executed ")); + //Connection connection = DbUtils.getConnection(); + Enumeration enum1 = rr.getParamKeys(); + String value = "", key = ""; + String paramStr = ""; + StringBuffer paramBuffer = new StringBuffer(); + if(enum1!=null) { + for (; enum1.hasMoreElements();) { + key = (String) enum1.nextElement(); + value = rr.getParamValue(key); + paramBuffer.append(key+":"+value+" "); + } + paramStr = paramBuffer.toString(); + } + + StringBuffer retrieveUserEmailQry = null; + ArrayList userEmailList = new ArrayList(); + if(nvl(scheduleId).length()>0) { + /*retrieveUserEmailQry = new StringBuffer(); + retrieveUserEmailQry.append(" SELECT "); + retrieveUserEmailQry.append(" au.user_id "); + retrieveUserEmailQry.append(" FROM "); + retrieveUserEmailQry.append(" (SELECT rs.schedule_id, rs.rep_id FROM cr_report_schedule rs WHERE rs.enabled_yn='Y' AND rs.run_date IS NOT NULL "); + retrieveUserEmailQry.append(" AND rs.schedule_id = " + scheduleId + " ) x, cr_report r, app_user au "); + retrieveUserEmailQry.append(" WHERE "); + retrieveUserEmailQry.append("x.rep_id = r.rep_id "); + retrieveUserEmailQry.append(" AND au.user_id IN (SELECT rsu.user_id FROM cr_report_schedule_users rsu WHERE rsu.schedule_id = x.schedule_id and rsu.schedule_id = " + scheduleId ); + retrieveUserEmailQry.append(" UNION "); + retrieveUserEmailQry.append(" SELECT ur.user_id FROM fn_user_role ur "); + retrieveUserEmailQry.append(" WHERE ur.role_id IN "); + retrieveUserEmailQry.append(" (SELECT rsu2.role_id FROM cr_report_schedule_users rsu2 "); + retrieveUserEmailQry.append(" WHERE rsu2.schedule_id = x.schedule_id and "); + retrieveUserEmailQry.append(" rsu2.schedule_id = "+ scheduleId + ")) ");*/ + + String r_sql = Globals.getDownloadAllRetrieve(); + r_sql = r_sql.replace("[scheduleId]", scheduleId); + + // DataSet ds = DbUtils.executeQuery(retrieveUserEmailQry.toString()); + DataSet ds = DbUtils.executeQuery(r_sql); + + for (int i = 0; i < ds.getRowCount(); i++) { + userEmailList.add(ds.getString(i, 0)); + } + + } + // String insertQry = "insert into cr_report_dwnld_log (user_id,rep_id,file_name,dwnld_start_time,filter_params) values (?,?,?,?,?)"; + String insertQry = Globals.getDownloadAllInsert(); + + + Connection connection = null; + PreparedStatement pst = null; + try { + connection = DbUtils.getConnection(); + pst = connection.prepareStatement(insertQry); + if(nvl(emailId).length()>0){ + pst.setInt(1, Integer.parseInt(userId)); + pst.setInt(2, Integer.parseInt(rr.getReportID())); + pst.setString(3, fileName+AppConstants.FT_ZIP); + pst.setTimestamp(4,new java.sql.Timestamp(currDate.getTime())); + pst.setString(5,paramStr); + pst.execute(); + connection.commit(); + } else { + for (int i = 0; i < userEmailList.size(); i++) { + pst.setInt(1, Integer.parseInt((String)userEmailList.get(i))); + pst.setInt(2, Integer.parseInt(rr.getReportID())); + pst.setString(3, fileName+AppConstants.FT_ZIP); + pst.setTimestamp(4,new java.sql.Timestamp(currDate.getTime())); + pst.setString(5,paramStr); + pst.execute(); + connection.commit(); + } + } + pst.close(); + connection.close(); + logger.debug(EELFLoggerDelegate.debugLogger, ("Data inserted")); + } catch (SQLException ex) { + throw new RaptorException(ex); + } catch (ReportSQLException ex) { + throw new RaptorException(ex); + } catch (Exception ex) { + throw new RaptorException (ex); + } finally { + try { + if(connection!=null) + connection.close(); + if(pst!=null) + pst.close(); + } catch (SQLException ex) { + throw new RaptorException(ex); + } + } + //DbUtils.commitTransaction(connection); + //DbUtils.clearConnection(connection); + + + +// debugLogger.debug("|"+downloadProcess.toString() + "|"); +// if (downloadProcess == null) +// throw new Exception("unable to create a process for command:" + +// command); +// int retCode= 1; +// try { +// retCode= downloadProcess.waitFor(); +// } catch (InterruptedException e){ +// e.printStackTrace(); +// } +// debugLogger.debug("retCode " + retCode); +// Process child = rtime.exec("/bin/bash"); +// BufferedWriter outCommand = new BufferedWriter(new +// OutputStreamWriter(child.getOutputStream())); +// outCommand.write(Globals.getShellScriptName()); +// outCommand.flush(); +// int retCode = child.waitFor(); +// debugLogger.debug("RetCode " + retCode); + //request.setAttribute("message", "Shell Script is running in the background. You'll get an email once it is done"); + } + + return nextPage; + } + public String getChildDropDown(HttpServletRequest request, String nextPage) throws RaptorRuntimeException { + + if(request.getParameter("firstTime") != null) { return nextPage; } + + /*ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute( + AppConstants.SI_REPORT_RUNTIME); + + String c_master = request.getParameter("c_master"); + java.util.HashMap valuesMap = Globals.getRequestParamtersMap(request); + request.setAttribute("c_master", c_master); + + int idx = 0; + ReportFormFields rff = rr.getReportFormFields(); + FormField ff = null; + for(rff.resetNext(); rff.hasNext(); idx++) { + ff = rff.getNext(); + + + if(ff.getDependsOn() != null && ff.getDependsOn().trim() != "") + { + String val = request.getParameter(ff.getFieldName()); + request.setAttribute(ff.getFieldName(), ff.getHtml(val, valuesMap, rr)); + } + + } + */ + return nextPage; + + } + + private void removeVariablesFromSession(HttpServletRequest request) { + HttpSession session = request.getSession(); + session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST); + session.removeAttribute(AppConstants.DRILLDOWN_INDEX); + session.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX); + session.removeAttribute(AppConstants.SI_BACKUP_FOR_REP_ID); + session.removeAttribute(AppConstants.SI_COLUMN_LOOKUP); + session.removeAttribute(AppConstants.SI_DASHBOARD_REP_ID); + session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP); + session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME); + session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP); + session.removeAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP); + session.removeAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP); + session.removeAttribute(AppConstants.SI_DATA_SIZE_FOR_TEXTFIELD_POPUP); + session.removeAttribute(AppConstants.SI_MAP); + session.removeAttribute(AppConstants.SI_MAP_OBJECT); + session.removeAttribute(AppConstants.SI_REPORT_DEFINITION); + session.removeAttribute(AppConstants.SI_REPORT_RUNTIME); + session.removeAttribute(AppConstants.SI_REPORT_RUN_BACKUP); + session.removeAttribute(AppConstants.SI_REPORT_SCHEDULE); + session.removeAttribute(AppConstants.RI_REPORT_DATA); + session.removeAttribute(AppConstants.RI_CHART_DATA); + session.removeAttribute(AppConstants.SI_FORMFIELD_INFO); + session.removeAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO); + session.removeAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP); + session.removeAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP); + Enumeration enum1 = session.getAttributeNames(); + String attributeName = ""; + while(enum1.hasMoreElements()) { + attributeName = enum1.nextElement(); + if(attributeName.startsWith("parent_")) { + session.removeAttribute(attributeName); + } + } + } + + + private TreeMap getListOfReportsFromDashBoardHTML(String htmlString) { + //String sourcestring = "
    [Report#123][Report#124]
    [Report#125][Report#126]
    "; + String sourcestring = htmlString; + //Pattern re = Pattern.compile("([a-z]+)\\[([a-z]+)([=<>]+)([a-z]+)\\]",Pattern.CASE_INSENSITIVE); + //Pattern re = Pattern.compile("\\[([R][e][p][o][r][t][#])[(*)]\\]"); + Pattern re = Pattern.compile("\\[(.*?)\\]"); //\\[(.*?)\\] + Matcher m = re.matcher(sourcestring); + HashMap hashReports = new HashMap(); + int mIdx = 0; + while (m.find()){ + for( int groupIdx = 0; groupIdx < m.groupCount(); groupIdx++ ){ + String str = m.group(groupIdx); + //System.out.println(str); + hashReports.put(new String(Integer.toString(mIdx+1)), (str.substring(1).toLowerCase().startsWith("chart")?"c":"d") + str.substring(str.indexOf("#")+1, str.length()-1)); + } + mIdx++; + } + // Sorting HashMap based on Keys + /*List mapKeys = new ArrayList(hashReports.keySet()); + List mapValues = new ArrayList(hashReports.values()); + hashReports.clear(); + hashReports = null; + hashReports = new HashMap(); + + TreeSet sortedSet = new TreeSet(mapKeys); + Object[] sortedArray = sortedSet.toArray(); + int size = sortedArray.length; + for (int i=0; i iter = reportCols.iterator(); iter.hasNext();) { + + DataColumnType dc = (DataColumnType) iter.next(); + if (colNames.length() > 0) + colNames.append(", "); + colNames.append(dc.getColId()); + if (dc.isVisible()) { + //TODO: Drilldown URL + //sql = reportRuntime.parseReportSQLForDrillDownParams(sql, dc, request); + } + } + + DataSet ds = null; + // try { + String dbInfo = reportRuntime.getDBInfo(); + if(maxRows == 1) + sql += " limit "+ maxRows; + System.out.println("SQL getReportData()- " + sql); + ds = ConnectionUtils.getDataSet(sql, dbInfo); + int totalRows = 0; + /*if (reportRuntime.getReportDataSize() < 0) {*/ + //String countSQL = "SELECT count(*) FROM (" + sql + ") x"; + String dbType = ""; + + if (dbInfo!=null && (!dbInfo.equals(AppConstants.DB_LOCAL))) { + try { + org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo(); + dbType = remDbInfo.getDBType(dbInfo); + } catch (Exception ex) { + throw new RaptorException(ex); + } + } + + totalRows = ds.getRowCount(); + /*}*/ + ReportData rd = new ReportData(0, true); + + if(totalRows > 0) { + // Already defined changed for modifying request parameters + //List reportCols = getAllColumns(); + Vector visibleCols = new Vector(reportCols.size()); + Vector formatProcessors = new Vector(reportCols.size()); + + // ColumnHeaderRow chr = new ColumnHeaderRow(); + // rd.reportColumnHeaderRows.addColumnHeaderRow(chr); + // chr.setRowHeight("30"); + int count =0 ; + + /* ADDED */ + ReportFormFields rff = reportRuntime.getReportFormFields(); + ReportFormFields childReportFormFields = null; + String fieldDisplayName = ""; + String fieldValue = ""; + + for (int c = 0; c < reportCols.size(); c++) { + if(reportCols.get(c)!=null) { + DataColumnType dct = (DataColumnType) reportCols.get(c); + if(nvl(dct.getDependsOnFormField()).length()>0 && nvl(dct.getDependsOnFormField()).indexOf("[")!=-1) { + for(int i = 0 ; i < rff.size(); i++) { + fieldDisplayName = "["+((FormField)rff.getFormField(i)).getFieldDisplayName()+"]"; + fieldValue = ""; + //if(dct.getOriginalDisplayName()==null) dct.setOriginalDisplayName(dct.getDisplayName()); + if (dct.getDependsOnFormField().equals(fieldDisplayName)) { + fieldValue = nvl(request.getParameter(((FormField)rff.getFormField(i)).getFieldName())); + + if (fieldValue.length()>0) { + if(!fieldValue.toUpperCase().equals("Y")) + dct.setDisplayName(fieldValue); + if(!dct.isVisible()) + dct.setVisible(true); + } else { + dct.setVisible(false); + } + } + } + } + } + } + + /* ADDED */ + String displayName = ""; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + + DataColumnType dc = (DataColumnType) iter.next(); + + formatProcessors.add(count,new FormatProcessor( + reportRuntime.getSemaphoreById(dc.getSemaphoreId()), dc.getColType(), dc + .getColFormat(), reportRuntime.getReportDefType().equals( + AppConstants.RD_SQL_BASED))); + + /* TODO: Add Drilldown URL */ + if (nvl(dc.getDrillDownURL()).length() > 0) { + childReportFormFields = reportRuntime.getChildReportFormFields(request,dc.getDrillDownURL()); + } + if (dc.isVisible()) { + visibleCols.add(count,dc); + //if(dc.getColId().startsWith("group")) { + for (int d = 0; d < reportCols.size(); d++) { + if(reportCols.get(d)!=null) { + DataColumnType dct1 = (DataColumnType) reportCols.get(d); + if(dct1.getColId().equals(dc.getColId()+"_name") && ds.getRowCount()>0) { + displayName = ds.getString(0,dct1.getColId()); + dc.setDisplayName(displayName); + } + } + } + //} + + VisualManager visualManager = reportRuntime.getVisualManager(); + rd.createColumn(dc.getColId(), dc.getDisplayName(), dc.getDisplayWidthInPxls(),dc.getDisplayHeaderAlignment(), + visualManager.isColumnVisible(dc.getColId()), visualManager + .getSortByColId().equals(dc.getColId()) ? visualManager + .getSortByAscDesc() : null, true, dc.getLevel()!=null?dc.getLevel():0, dc.getStart()!=null?dc.getStart():0, dc.getColspan()!=null?dc.getColspan():0, dc.isIsSortable()!=null?dc.isIsSortable():false); + // chr.addColumnHeader(new ColumnHeader(dc.getDisplayName(), + // (dc.getDisplayWidth()>100)?"10%":(""+dc.getDisplayWidth()+"%"))); + } // if + else { + visibleCols.add(count,null); + rd.createColumn(dc.getColId(), AppConstants.HIDDEN, dc.getDisplayWidthInPxls(), dc.getDisplayHeaderAlignment(), + false, null,false,dc.getLevel()!=null?dc.getLevel():0, dc.getStart()!=null?dc.getStart():0, dc.getColspan()!=null?dc.getColspan():0, dc.isIsSortable()!=null?dc.isIsSortable():false); +// formatProcessors.add(count,null); + } + count++; + } // for + + // Utils._assert(chr.size()==ds.getColumnCount(), + // "[ReportRuntime.loadLinearReportData] The number of visible columns + // does not match the number of data columns"); + //TODO: This should be optimized to accept -1 for flat file download + if(maxRows > totalRows) maxRows = totalRows; + ArrayList reportDataList = new ArrayList(); + for (int r = 0; r < maxRows; r++) { + DataRow dr = new DataRow(); + rd.reportDataRows.addDataRow(dr); + + for (int c = 0; c < reportCols.size(); c++) { + if(reportCols.get(c)!=null) { + DataColumnType dct = (DataColumnType) reportCols.get(c); + //Modified since ds is null. + DataValue dv = new DataValue(); + + if(ds.getRowCount()>0){ + if(ds.getColumnIndex(dct.getColId())!= -1) { + dr.addDataValue(dv); + dv.setDisplayValue(ds.getString(r, dct.getColId())); + } else { + continue; + } + + } else { + dv.setDisplayValue(""); + } + dv.setColName(dct.getColName()); + dv.setColId(dct.getColId()); + dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null")); + + //Add Drilldown URL to dv + if (nvl(dct.getDrillDownURL()).length() > 0) { + + if(dv.getDisplayValue().length() > 0) { + dv.setDrillDownURL(reportRuntime.parseDrillDownURL(r, /* c, */ds, dct, request, childReportFormFields)); + dv.setDrillDowninPoPUp(dct.isDrillinPoPUp()!=null?dct.isDrillinPoPUp():false); + } + + if (dv.getDisplayValue().length() == 0) { + //dv.setDisplayValue("[NULL]"); + dv.setDisplayValue(""); + } + } // if + + StringBuffer indentation = new StringBuffer(""); + if(dct.getIndentation()!=null && dct.getIndentation()>0) { + for (int indent=0; indent< dct.getIndentation(); indent++) { + indentation.append("\t"); + } + dv.setNowrap("true"); + } + dv.setIndentation(indentation.toString()); + + if(dct.isVisible()) { + + dv.setVisible(true); + dv.setAlignment(dct.getDisplayAlignment()); + dv.setDisplayTotal(dct.getDisplayTotal()); + dv.setDisplayName(dct.getDisplayName()); + +// if (nvl(dct.getDrillDownURL()).length() > 0) { + +// if(dv.getDisplayValue().length() > 0) { + //TODO: Below Drilldown URL +// dv.setDrillDownURL(reportRuntime.parseDrillDownURL(r, /* c, */ds, dct,request, childReportFormFields)); +// dv.setDrillDowninPoPUp(dct.isDrillinPoPUp()); +// } +// +// if (dv.getDisplayValue().length() == 0) { +// //dv.setDisplayValue("[NULL]"); +// dv.setDisplayValue(""); +// } +// } // if + + } else { + dv.setVisible(false); + dv.setHidden(true); + } + //System.out.println("in Linear report b4" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue()); + + if(dr.getFormatId()!=null) + ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, true); + else + ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, false); + + //System.out.println("in Linear report After" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue()); + } // if reportCols + } // for + reportDataList.add(dr); + } // for + + rd.setReportDataList(reportDataList); + //Only if rownumber options is needed + //rd.addRowNumbers(pageNo, getPageSize()); + DataRow colDataTotalsLinear = null; + if (colDataTotalsLinear == null) + colDataTotalsLinear = reportRuntime.generateColumnDataTotalsLinear(new ArrayList(reportCols), AppUtils.getUserID(request), + reportRuntime.getDbInfo(),request); + + if(colDataTotalsLinear!=null) + rd.setColumnDataTotalsLinear(colDataTotalsLinear, "Total"); + // Please note the below function doesn't set the visibility for dv since this is set in this function. - Sundar + rd.applyVisibility(); + } + return rd; + } // loadLinearReportData + + public String formFieldRun(HttpServletRequest request, String nextPage) { + ReportRuntime rr = null; + rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); + if(rr!=null) { + ReportJSONRuntime reportJSONRuntime = rr.createFormFieldJSONRuntime(request); + ObjectMapper mapper = new ObjectMapper(); + //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY); + //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE)); + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + String jsonInString = ""; + try { + jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(reportJSONRuntime); + } catch (Exception ex) { + ex.printStackTrace(); + + } + return jsonInString; + } + + return ""; + } + +} // ActionHandler diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionMapping.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionMapping.java new file mode 100644 index 0000000..93fff25 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionMapping.java @@ -0,0 +1,34 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.controller; + +import java.util.HashMap; + +public class ActionMapping extends HashMap { + + public void addAction(Action action) { + put(action.getAction(), action); + } // addAction + + public Action getAction(String actionKey) { + return (Action) get(actionKey); + } // getAction + +} // ActionMapping diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Controller.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Controller.java new file mode 100644 index 0000000..b2be851 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Controller.java @@ -0,0 +1,124 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.controller; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException; +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; + +public class Controller extends org.openecomp.portalsdk.analytics.RaptorObject { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(Controller.class); + public Controller() { + } + + public String processRequest(HttpServletRequest request) { + String actionKey = nvl(request.getParameter(AppConstants.RI_ACTION), "report.run"); + + return processRequest(actionKey, request); + } // processRequest + + public String processRequest(String actionKey, HttpServletRequest request) { + Action action = null; + try { + action = Globals.getRaptorActionMapping().getAction(actionKey); + if (action == null) + throw new RaptorRuntimeException("Action not found"); + } catch (RaptorException e) { + logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey + + "]. RaptorException: " + e.getMessage())); +// if (actionKey.equals("system_upgrade")) // System override + + return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException( + "[Controller.processRequest]Invalid raptor action [" + actionKey + + "]. Exception: " + e.getMessage())); + } + + try { + Class[] paramTypes = new Class[2]; + paramTypes[0] = Class.forName("javax.servlet.http.HttpServletRequest"); + paramTypes[1] = Class.forName("java.lang.String"); + + Class handlerClass = Class.forName(action.getControllerClass()); + Object handler = handlerClass.newInstance(); + Method handlerMethod = handlerClass.getMethod(action.getControllerMethod(), + paramTypes); + + Object[] paramValues = new Object[2]; + paramValues[0] = request; + paramValues[1] = action.getJspName(); + + return (String) handlerMethod.invoke(handler, paramValues); + } catch (ClassNotFoundException e) { + logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey + + "]. ClassNotFoundException: " + e.getMessage())); + return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException( + "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: " + + e.getMessage())); + } catch (IllegalAccessException e) { + logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey + + "]. IllegalAccessException: " + e.getMessage())); + return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException( + "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: " + + e.getMessage())); + }catch (InstantiationException e) { + logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey + + "]. InstantiationException: " + e.getMessage())); + return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException( + "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: " + + e.getMessage())); + }catch (NoSuchMethodException e) { + logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey + + "]. NoSuchMethodException: " + e.getMessage())); + return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException( + "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: " + + e.getMessage())); + }catch (InvocationTargetException e) { + logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey + + "]. InvocationTargetException: " + e.getMessage())); + return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException( + "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: " + + e.getMessage())); + } + } // processRequest + + public void handleRequest(HttpServletRequest request, HttpServletResponse response, + ServletContext servletContext) throws Exception { + String actionKey = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action")); + + handleRequest(actionKey, request, response, servletContext); + } // handleRequest + + public void handleRequest(String actionKey, HttpServletRequest request, + HttpServletResponse response, ServletContext servletContext) throws Exception { + servletContext.getRequestDispatcher("/" + processRequest(actionKey, request)).forward( + request, response); + } // handleRequest + +} // Controller diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ErrorHandler.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ErrorHandler.java new file mode 100644 index 0000000..bca5695 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ErrorHandler.java @@ -0,0 +1,112 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.controller; + +import java.util.ArrayList; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.error.ReportSQLException; +import org.openecomp.portalsdk.analytics.model.definition.ReportDefinition; +import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime; +import org.openecomp.portalsdk.analytics.system.AppUtils; +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; +import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; + +public class ErrorHandler extends org.openecomp.portalsdk.analytics.RaptorObject { + + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ErrorHandler.class); + + public ErrorHandler() { + } + + public void processError(HttpServletRequest request, String errorMsg) { + //Log.write(errorMsg, 2); + logger.error(EELFLoggerDelegate.debugLogger, (errorMsg)); + ArrayList error_list = (ArrayList) request.getAttribute(AppConstants.RI_ERROR_LIST); + if (error_list == null) + error_list = new ArrayList(1); + error_list.add(errorMsg); + request.setAttribute(AppConstants.RI_ERROR_LIST, error_list); + } // processError + + public void processError(HttpServletRequest request, RaptorException e) { + processError(request, "Exception: " + e.getMessage()); + } // processError + + private String getSessionLog(HttpServletRequest request) { + String[] sessionVariablesToLog = Globals.getLogVariablesInSession().split(","); + StringBuffer sessionLogStrBuf = new StringBuffer("\n"); + sessionLogStrBuf.append("***** ADDITIONAL INFORMATION ******"); + HttpSession session = request.getSession(); + ReportRuntime rr = (ReportRuntime) session.getAttribute(AppConstants.SI_REPORT_RUNTIME); + ReportDefinition rdef = (ReportDefinition) session.getAttribute(AppConstants.SI_REPORT_DEFINITION); + if(rr!=null) { + sessionLogStrBuf.append("\nWHILE RUNNING"); + sessionLogStrBuf.append("\nReport Id="+rr.getReportID()+";\t"); + sessionLogStrBuf.append("Report Name="+rr.getReportName()+";\t\n"); + } else if (rdef != null) { + sessionLogStrBuf.append("\nWHILE CREATING/UPDATING"); + sessionLogStrBuf.append("\nReport Id="+rdef.getReportID()+";\t"); + sessionLogStrBuf.append("Report Name="+rdef.getReportName()+";\t\n"); + } + for (int i = 0; i < sessionVariablesToLog.length; i++) { + if(session.getAttribute(sessionVariablesToLog[i])!=null) + sessionLogStrBuf.append(sessionVariablesToLog[i]+"="+(String)session.getAttribute(sessionVariablesToLog[i])+";\t"); + } + sessionLogStrBuf.append("\n***********************************"); + sessionLogStrBuf.append("\n"); + return sessionLogStrBuf.toString(); + } + public String processFatalError(HttpServletRequest request, RaptorException e) { + //Log.write("Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage()), 1); + logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage())+" "+ getSessionLog(request) + e.getMessage()),AlarmSeverityEnum.MAJOR); + if (e instanceof ReportSQLException) { + String errorSQL = ((ReportSQLException) e).getReportSQL(); + if (nvl(errorSQL).length() > 0) + request.setAttribute("c_error_sql", errorSQL); + } // if + AppUtils.processErrorNotification(request, e); + + request.setAttribute(AppConstants.RI_EXCEPTION, e); + return AppUtils.getErrorPage(); + } // processFatalError + + public String processFatalErrorWMenu(HttpServletRequest request, RaptorException e) { + //Log.write("Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage()), 1); + logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage())+" "+ getSessionLog(request) + e.getMessage()),AlarmSeverityEnum.MAJOR); + if (e instanceof ReportSQLException) { + String errorSQL = ((ReportSQLException) e).getReportSQL(); + if (nvl(errorSQL).length() > 0) + request.setAttribute("c_error_sql", errorSQL); + } // if + AppUtils.processErrorNotification(request, e); + + request.setAttribute(AppConstants.RI_EXCEPTION, e); + return AppUtils.getErrorPageWMenu(); + } // processFatalError + +} // ErrorHandler + diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardProcessor.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardProcessor.java new file mode 100644 index 0000000..a9204db --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardProcessor.java @@ -0,0 +1,2354 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.controller; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; + +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.error.ValidationException; +import org.openecomp.portalsdk.analytics.model.ReportHandler; +import org.openecomp.portalsdk.analytics.model.ReportLoader; +import org.openecomp.portalsdk.analytics.model.base.IdNameValue; +import org.openecomp.portalsdk.analytics.model.base.OrderBySeqComparator; +import org.openecomp.portalsdk.analytics.model.base.OrderSeqComparator; +import org.openecomp.portalsdk.analytics.model.definition.ReportDefinition; +import org.openecomp.portalsdk.analytics.model.definition.ReportSchedule; +import org.openecomp.portalsdk.analytics.model.runtime.FormField; +import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime; +import org.openecomp.portalsdk.analytics.system.AppUtils; +import org.openecomp.portalsdk.analytics.system.DbUtils; +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; +import org.openecomp.portalsdk.analytics.util.DataSet; +import org.openecomp.portalsdk.analytics.util.XSSFilter; +import org.openecomp.portalsdk.analytics.xmlobj.ChartDrillFormfield; +import org.openecomp.portalsdk.analytics.xmlobj.ColFilterType; +import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType; +import org.openecomp.portalsdk.analytics.xmlobj.DataSourceType; +import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType; +import org.openecomp.portalsdk.analytics.xmlobj.FormatType; +import org.openecomp.portalsdk.analytics.xmlobj.JavascriptItemType; +import org.openecomp.portalsdk.analytics.xmlobj.Marker; +import org.openecomp.portalsdk.analytics.xmlobj.ObjectFactory; +import org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; + +/**
    + * This class is part of RAPTOR (Rapid Application Programming Tool for OLAP Reporting)
    + *
    + * + * --------------------------------------------------------------------------------------------------
    + * WizardProcessor.java - This class is used to process the user input provided in the wizard.
    + * It is called in creation as well as updation process. It builds report xml via JAXB using user
    + * input. This is vital one, to store meta information of each report
    + * ---------------------------------------------------------------------------------------------------
    + * + * + * Change Log

    + * + * 31-Aug-2009 : Version 8.5.1 (Sundar);
    • For Time Series multi series property is exposed.
    + * 28-Aug-2009 : Version 8.5.1 (Sundar);
    • If user login id is null, it would display user name when user is added for schedule.
    + * 18-Aug-2009 : Version 8.5.1 (Sundar);
    • request Object is passed to prevent caching user/roles - Datamining/Hosting.
    + * 12-Aug-2009 : Version 8.5 (Sundar);
    • For Line Charts too options are captured and rendering is customized.
    + * 29-Jul-2009 : Version 8.4 (Sundar);
    • Maximum Excel Download size would be persisted if changed.
    + * 14-Jul-2009 : Version 8.4 (Sundar);
    • Schedule feature is added to Dashboard Reports.
    + * 29-Jun-2009 : Version 8.4 (Sundar);
    • Options for Compare to Previous year Chart are processed.
    • + *
    • In the Bar chart Last Occuring Series/Category can be plotted as Bar or Line Renderer.
    • + *
    + * 22-Jun-2009 : Version 8.4 (Sundar);
    • processChart method is modified to accommodate creating + * Bar Charts, Time Difference Charts and adding generic chart options.
    + * + */ + +public class WizardProcessor extends org.openecomp.portalsdk.analytics.RaptorObject { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WizardProcessor.class); + + public WizardProcessor() { + } + + private String adjustDataType(String oracleDataType) { + return oracleDataType.equals("VARCHAR2") ? AppConstants.CT_CHAR : oracleDataType; + // Probably should be expanded to convert any CHAR or VARCHAR type to + // CT_CHAR, number type to CT_NUMBER and date to CT_DATE + } // adjustDataType + + public void persistReportDefinition(HttpServletRequest request, ReportDefinition rdef) + throws RaptorException { + ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute( + AppConstants.SI_REPORT_RUNTIME); + if (rr != null && rr.getReportID().equals(rdef.getReportID())) + request.getSession().removeAttribute(AppConstants.SI_REPORT_RUNTIME); + rdef.persistReport(request); + } // persistReportDefinition + + public void processWizardStep(HttpServletRequest request) throws Exception { + String action = nvl(request.getParameter(AppConstants.RI_WIZARD_ACTION), + AppConstants.WA_BACK); + + String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID); + ReportDefinition rdef = (new ReportHandler()).loadReportDefinition(request, reportID); + request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef); + + String curStep = rdef.getWizardSequence().getCurrentStep(); + String curSubStep = rdef.getWizardSequence().getCurrentSubStep(); + if (AppUtils.getRequestNvlValue(request, "showDashboardOptions").length()<=0) + request.setAttribute("showDashboardOptions", "F"); + logger.debug(EELFLoggerDelegate.debugLogger, ("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^curStep " + curStep + " " + curSubStep + " " + action)); + boolean reportUpdated = false; + if (!action.equals(AppConstants.WA_BACK)) { + if (curStep.equals(AppConstants.WS_DEFINITION)) { + reportUpdated = processDefinition(request); + } else if (curStep.equals(AppConstants.WS_SQL)) { + if (action.equals(AppConstants.WA_VALIDATE)) + reportUpdated = processValidateSQL(request); + } else if (curStep.equals(AppConstants.WS_TABLES)) { + if (curSubStep.equals(AppConstants.WSS_ADD)) + reportUpdated = processTableAdd(request); + else if (curSubStep.equals(AppConstants.WSS_EDIT)) + reportUpdated = processTableEdit(request); + else if (action.equals(AppConstants.WA_DELETE)) + reportUpdated = processTableDelete(request); + } else if (curStep.equals(AppConstants.WS_COLUMNS)) { + if (curSubStep.equals(AppConstants.WSS_ADD) + || curSubStep.equals(AppConstants.WSS_EDIT) || action.equals(AppConstants.WA_SAVE) || action.equals(AppConstants.WA_NEXT)) { + reportUpdated = processColumnAddEdit(request, curSubStep + .equals(AppConstants.WSS_EDIT) || curSubStep + .equals(AppConstants.WA_MODIFY)); + //reportUpdated = processColumnAddEdit(request, true); + } + else if (curSubStep.equals(AppConstants.WSS_ADD_MULTI)) + reportUpdated = processColumnAddMulti(request); + else if (curSubStep.equals(AppConstants.WSS_ORDER_ALL)) + reportUpdated = processColumnOrderAll(request); + else if (action.equals(AppConstants.WA_DELETE)) + reportUpdated = processColumnDelete(request); + else if (action.equals(AppConstants.WA_MOVE_UP)) + reportUpdated = processColumnMoveUp(request); + else if (action.equals(AppConstants.WA_MOVE_DOWN)) + reportUpdated = processColumnMoveDown(request); + } else if (curStep.equals(AppConstants.WS_FORM_FIELDS)) { + if (curSubStep.equals(AppConstants.WSS_ADD) + || curSubStep.equals(AppConstants.WSS_EDIT)) + reportUpdated = processFormFieldAddEdit(request, curSubStep + .equals(AppConstants.WSS_EDIT), action); + else if (action.equals(AppConstants.WA_DELETE)) + reportUpdated = processFormFieldDelete(request); + else if (action.equals(AppConstants.WA_MOVE_UP)) + reportUpdated = processFormFieldMoveUp(request); + else if (action.equals(AppConstants.WA_MOVE_DOWN)) + reportUpdated = processFormFieldMoveDown(request); + else if (action.equals(AppConstants.WSS_ADD_BLANK)) + reportUpdated = processFormFieldBlank(request); + else if (action.equals(AppConstants.WSS_INFO_BAR)) + reportUpdated = processFormFieldInfoBar(request); + } else if (curStep.equals(AppConstants.WS_FILTERS)) { + if (curSubStep.equals(AppConstants.WSS_ADD) + || curSubStep.equals(AppConstants.WSS_EDIT)) + reportUpdated = processFilterAddEdit(request, curSubStep + .equals(AppConstants.WSS_EDIT)); + else if (action.equals(AppConstants.WA_DELETE)) + reportUpdated = processFilterDelete(request); + } else if (curStep.equals(AppConstants.WS_SORTING)) { + if (curSubStep.equals(AppConstants.WSS_ADD) + || curSubStep.equals(AppConstants.WSS_EDIT)) + reportUpdated = processSortAddEdit(request, curSubStep + .equals(AppConstants.WSS_EDIT)); + else if (curSubStep.equals(AppConstants.WSS_ORDER_ALL)) + reportUpdated = processSortOrderAll(request); + else if (action.equals(AppConstants.WA_DELETE)) + reportUpdated = processSortDelete(request); + else if (action.equals(AppConstants.WA_MOVE_UP)) + reportUpdated = processSortMoveUp(request); + else if (action.equals(AppConstants.WA_MOVE_DOWN)) + reportUpdated = processSortMoveDown(request); + } else if (curStep.equals(AppConstants.WS_JAVASCRIPT)) { + if (action.equals(AppConstants.WSS_ADD)) + reportUpdated = processAddJavascriptElement(request); + else if (action.equals(AppConstants.WA_SAVE)) + reportUpdated = processSaveJavascriptElement(request); + else if (action.equals(AppConstants.WA_DELETE)) + reportUpdated = processDeleteJavascriptElement(request); + else + reportUpdated = processJavascript(request); + } else if (curStep.equals(AppConstants.WS_CHART)) { + reportUpdated = processChart(request, action); + } else if (curStep.equals(AppConstants.WS_USER_ACCESS)) { + reportUpdated = processUserAccess(request, action); + } else if (curStep.equals(AppConstants.WS_REPORT_LOG)) { + if (action.equals(AppConstants.WA_DELETE_USER)) + reportUpdated = processClearLog(request); + } else if (curStep.equals(AppConstants.WS_SCHEDULE)) { + reportUpdated = processSchedule(request, action); + } else if(curStep.equals(AppConstants.WS_DATA_FORECASTING)) { + reportUpdated = processForecasting(request, action); + } + /****For Report Maps - Start*****/ + else if (curStep.equals(AppConstants.WS_MAP)) { + reportUpdated = processMap(request, action); + } + /****For Report Maps - End*****/ + + // else + } + if (reportUpdated) + persistReportDefinition(request, rdef); + } // processWizardStep + + public void processImportSemaphorePopup(HttpServletRequest request) throws RaptorException { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + String importReportId = AppUtils + .getRequestNvlValue(request, AppConstants.RI_REPORT_ID); + ReportRuntime rr = (new ReportHandler()).loadReportRuntime(request, importReportId, + false); + + ArrayList importedList = new ArrayList(); + if (rr.getSemaphoreList() != null) + for (Iterator iter = rr.getSemaphoreList().getSemaphore().iterator(); iter + .hasNext();) { + SemaphoreType sem = rdef.addSemaphore(new ObjectFactory(), + (SemaphoreType) iter.next()); + importedList + .add(new IdNameValue(sem.getSemaphoreId(), sem.getSemaphoreName())); + } // for + + if (importedList.size() > 0) { + request.setAttribute(AppConstants.RI_DATA_SET, importedList); + persistReportDefinition(request, rdef); + } // if + } // processImportSemaphorePopup + + public void processSemaphorePopup(HttpServletRequest request) throws RaptorException { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + String semaphoreId = AppUtils.getRequestNvlValue(request, "semaphoreId"); + String semaphoreName = AppUtils.getRequestNvlValue(request, "semaphoreName"); + String semaphoreType = AppUtils.getRequestNvlValue(request, "semaphoreType"); + + SemaphoreType semaphore = rdef.getSemaphoreById(semaphoreId); + if (semaphore == null) { + semaphore = rdef.addSemaphoreType(new ObjectFactory(), semaphoreName, + semaphoreType, null); + semaphoreId = semaphore.getSemaphoreId(); + request.setAttribute("semaphoreId", semaphoreId); + } else { + rdef.deleteSemaphore(semaphore); + semaphore.setSemaphoreName(semaphoreName); + semaphore.setSemaphoreType(semaphoreType); + + rdef.setSemaphore(semaphore); + } + + String[] formatId = request.getParameterValues("formatId"); + String[] lessThanValue = request.getParameterValues("lessThanValue"); + String[] expression = request.getParameterValues("expression"); + String[] bold = request.getParameterValues("bold"); + String[] italic = request.getParameterValues("italic"); + String[] underline = request.getParameterValues("underline"); + String[] bgColor = request.getParameterValues("bgColor"); + String[] fontColor = request.getParameterValues("fontColor"); + String[] fontFace = request.getParameterValues("fontFace"); + String[] fontSize = request.getParameterValues("fontSize"); + //String[] anyFmt = request.getParameterValues("anyFmt"); + + // String[] alignment = request.getParameterValues("alignment"); + + for (int i = 0; i < lessThanValue.length; i++) + if (i == 0 || nvl(lessThanValue[i]).length() > 0) { + FormatType fmt = null; + if (i == 0 || nvl(formatId[i]).length() > 0) + fmt = rdef.getSemaphoreFormatById(semaphore, nvl(formatId[i])); + if (fmt == null) + fmt = rdef.addEmptyFormatType(new ObjectFactory(), semaphore); + + fmt.setLessThanValue(nvl(lessThanValue[i])); + fmt.setExpression(nvl(expression[i])); + fmt.setBold(bold[i].equals("Y")); + fmt.setItalic(italic[i].equals("Y")); + fmt.setUnderline(underline[i].equals("Y")); + fmt.setBgColor(bgColor[i]); + fmt.setFontColor(fontColor[i]); + fmt.setFontFace(fontFace[i]); + fmt.setFontSize(fontSize[i]); + //fmt.setAnyFmt((anyFmt[i]!=null)?anyFmt[i].startsWith("Y"):false); + // fmt.setAlignment(alignment[i]); + } else if (nvl(formatId[i]).length() > 0) + rdef.deleteFormatType(semaphore, formatId[i]); + + persistReportDefinition(request, rdef); + } // processSemaphorePopup + + private boolean processDefinition(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + String reportName = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportName")); + String reportDescr = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportDescr")); + String folderId = AppUtils.getRequestNvlValue(request, "folder_id"); + boolean isAllowSchedule = (AppUtils.getRequestNvlValue(request, "allowSchedule").length()<=0?"N":AppUtils.getRequestNvlValue(request, "allowSchedule")).startsWith("Y"); + boolean isColumnGroup = (AppUtils.getRequestNvlValue(request, "multiGroupColumn").length()<=0?"N":AppUtils.getRequestNvlValue(request, "multiGroupColumn")).startsWith("Y"); + boolean isTopDown = (AppUtils.getRequestNvlValue(request, "topDown").length()<=0?"N":AppUtils.getRequestNvlValue(request, "topDown")).startsWith("Y"); + boolean isSizedByContent= (AppUtils.getRequestNvlValue(request, "sizedByContent").length()<=0?"N":AppUtils.getRequestNvlValue(request, "sizedByContent")).startsWith("Y"); + boolean reportsInNewWindow = false; + boolean hideFormFieldAfterRun = false; + + /*recurrance in schedule tab - Start*/ + String isOneTimeScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isOneTimeScheduleAllowed"),"N"); + String isHourlyScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isHourlyScheduleAllowed"),"N"); + String isDailyScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isDailyScheduleAllowed"),"N"); + String isDailyMFScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isDailyMFScheduleAllowed"),"N"); + String isWeeklyScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isWeeklyScheduleAllowed"),"N"); + String isMonthlyScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isMonthlyScheduleAllowed"),"N"); + //System.out.println("//////////// + isOneTimeScheduleAllowed : " + isOneTimeScheduleAllowed); + /*recurrance in schedule tab - End*/ + + + if (reportDescr.length() > 1000) + reportDescr = reportDescr.substring(0, 1000); + boolean reportUpdated; + + String reportType = AppUtils.getRequestNvlValue(request, "reportType"); + + + + //rdef.setReportName(reportName); + //rdef.setReportDescr(reportDescr); + //rdef.setReportType(reportType); + rdef.setFolderId(folderId); +// debugLogger.debug("setting folder ID = " + folderId); + if(reportType.equals(AppConstants.RT_DASHBOARD)) { + rdef.setReportName(reportName); + rdef.setReportDescr(reportDescr); + rdef.setReportType(reportType); + String dashboardLayoutHTML = AppUtils.getRequestNvlValue(request, "dashboardLayoutHTML"); + rdef.setDashboardLayoutHTML(dashboardLayoutHTML); + String dataContainerHeight = nvl(AppUtils.getRequestValue(request, "heightContainer"), "auto"); + String dataContainerWidth = nvl(AppUtils.getRequestValue(request, "widthContainer"), "auto"); + rdef.setDataContainerHeight(dataContainerHeight); + rdef.setDataContainerWidth(dataContainerWidth); + rdef.setAllowSchedule(isAllowSchedule?"Y":"N"); + + + /* + String numDashCols = AppUtils.getRequestNvlValue(request, "numDashCols"); + String reports1 = AppUtils.getRequestNvlValue(request, "reports1"); + String reports2 = AppUtils.getRequestNvlValue(request, "reports2"); + String reports3 = AppUtils.getRequestNvlValue(request, "reports3"); + String reports4 = AppUtils.getRequestNvlValue(request, "reports4"); + String repBgColor1 = AppUtils.getRequestNvlValue(request, "repBgColor1"); + String repBgColor2 = AppUtils.getRequestNvlValue(request, "repBgColor2"); + String repBgColor3 = AppUtils.getRequestNvlValue(request, "repBgColor3"); + String repBgColor4 = AppUtils.getRequestNvlValue(request, "repBgColor4"); + + //List reports = rdef.getDashBoardReports(); + rdef.setNumDashCols(numDashCols); + DashboardReports reportsList = new DashboardReportsImpl(); + + String reports[] = new String[]{reports1, reports2, reports3, reports4}; + String repBgColors[] = new String[]{repBgColor1, repBgColor2, repBgColor3, repBgColor4}; + for (int i = 0; i < reports.length; i++) { + Reports report = new ReportsImpl(); + report.setReportId(reports[i]); + report.setBgcolor(repBgColors[i]); + reportsList.getReportsList().add(report); + } + + + + rdef.setDashBoardReports(reportsList); + */ + reportUpdated = true; + +// reportUpdated = (!(reportName.equals(nvl(rdef.getReportName())) +// && reportDescr.equals(nvl(rdef.getReportDescr())) +// && reportType.equals(nvl(rdef.getReportType())) +// && numDashCols.equals(nvl(rdef.getNumDashCols())))); +//// && rdef.getR + + if (rdef.getWizardSequence() instanceof WizardSequence) + rdef.generateWizardSequence(request); + + } else { + + if (AppUtils.getRequestNvlValue(request, "reportType").equals(AppConstants.RT_CROSSTAB) || rdef.getReportType().equals(AppConstants.RT_CROSSTAB)) { + + String widthNo = AppUtils.getRequestNvlValue(request, "widthNo"); + if(nvl(widthNo).endsWith("px")) + rdef.setWidthNoColumn(widthNo); + else + rdef.setWidthNoColumn(widthNo+"px"); + } + + String dataGridAlign = AppUtils.getRequestNvlValue(request, "dataGridAlign"); + if(nvl(dataGridAlign).length()>0) { + rdef.setDataGridAlign(dataGridAlign); + } else { + rdef.setDataGridAlign("left"); + } + + String pdfImgLogo = AppUtils.getRequestNvlValue(request, "pdfImg"); + if(nvl(pdfImgLogo).length()>0) + rdef.setPdfImg(pdfImgLogo); + else + rdef.setPdfImg(null); + String emptyMessage = AppUtils.getRequestNvlValue(request, "emptyMessage"); + if(nvl(emptyMessage).length()>0) + rdef.setEmptyMessage(emptyMessage); + else + rdef.setEmptyMessage(""); + String formHelp = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "formHelp")); + //String rDashboardType = nvl(AppUtils.getRequestValue(request, "showDashboardOptions"), "N"); + //rdef.setDashboardType(rDashboardType.equals("Y")); + int excelDownloadSize = 500; + try { + excelDownloadSize = Integer.parseInt(AppUtils.getRequestValue(request, "excelDownloadSize")); + } catch (NumberFormatException ex) {} + if(AppUtils.getRequestNvlValue(request, "excelDownloadSize").length()>0) + rdef.setMaxRowsInExcelDownload(Integer.parseInt(AppUtils.getRequestValue(request, "excelDownloadSize"))); + if(AppUtils.getRequestNvlValue(request, "reportInNewWindow").length()>0) + reportsInNewWindow = AppUtils.getRequestNvlValue(request,"reportInNewWindow").equals("Y"); + if(AppUtils.getRequestNvlValue(request, "hideFormFieldsAfterRun").length()>0) + hideFormFieldAfterRun = AppUtils.getRequestNvlValue(request,"hideFormFieldsAfterRun").equals("Y"); + + + if(AppUtils.getRequestNvlValue(request, "displayFolderTree").length()>0) + rdef.setDisplayFolderTree(AppUtils.getRequestNvlValue(request,"displayFolderTree").equals("Y")); + else + rdef.setDisplayFolderTree(false); + String dataSource = AppUtils.getRequestNvlValue(request, "dataSource"); + String dbType = Globals.getDBType(); + String schemaSql = Globals.getRemoteDbSchemaSqlWithWhereClause(); + schemaSql = schemaSql.replace("[schema_id]", dataSource); + DataSet ds = null; + try { + ds = DbUtils.executeQuery(schemaSql); + + String prefix = "", desc = ""; + + for (int i = 0; i < ds.getRowCount(); i++) { + dbType = ds.getItem(i, 2); + } + } + catch (Exception e) {} + + int pageSize = Globals.getDefaultPageSize(); + try { + pageSize = Integer.parseInt(AppUtils.getRequestValue(request, "pageSize")); + } catch (NumberFormatException e) { + } + String rApproved = nvl(AppUtils.getRequestValue(request, "menuApproved"), "N"); + String menuID = ""; + String[] menuIDs = request.getParameterValues("menuID"); + if (menuIDs != null) + for (int i = 0; i < menuIDs.length; i++) + menuID += (menuID.length() == 0 ? "" : "|") + menuIDs[i]; + +// boolean additionalFieldsShown = AppUtils.getRequestNvlValue(request, +// "additionalFieldsShown").equals("Y"); + boolean rRCSDisabled = AppUtils.getRequestNvlValue(request, "runtimeColSortDisabled").equals("Y"); + String reportDefType = AppUtils.getRequestNvlValue(request, "reportDefType"); + String dataContainerHeight = nvl(AppUtils.getRequestValue(request, "heightContainer"), "auto"); + String dataContainerWidth = nvl(AppUtils.getRequestValue(request, "widthContainer"), "auto"); + + String displayOptions = nvl(AppUtils.getRequestValue(request, "hideForm"), "N") + + nvl(AppUtils.getRequestValue(request, "hideChart"), "N") + + nvl(AppUtils.getRequestValue(request, "hideData"), "N") + + nvl(AppUtils.getRequestValue(request, "hideBtns"), "N") + + nvl(AppUtils.getRequestValue(request, "hideMap"), "N") + + nvl(AppUtils.getRequestValue(request, "hideExcelIcons"), "N") + + nvl(AppUtils.getRequestValue(request, "hidePDFIcons"), "N"); +/* StringBuffer dashboardOptions = new StringBuffer(""); + dashboardOptions.append((nvl(AppUtils.getRequestValue(request, "hide"),"chart").equals("chart"))?"Y":"N"); + dashboardOptions.append((nvl(AppUtils.getRequestValue(request, "hide"),"").equals("data"))?"Y":"N"); + dashboardOptions.append((nvl(AppUtils.getRequestValue(request, "hideBtns"),"").equals("Y"))?"Y":"N");*/ + + String numFormCols = nvl(AppUtils.getRequestValue(request, "numFormCols"), "1"); + String reportTitle = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportTitle")); + String reportSubTitle = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportSubTitle")); + String reportHeader = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportHeader")); + String reportFooter = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportFooter")); + + int frozenColumns = 0; + try { + frozenColumns = Integer.parseInt(AppUtils.getRequestValue(request, "frozenColumns")); + } catch (NumberFormatException ex) { + + } + +/* reportUpdated = (!(reportName.equals(nvl(rdef.getReportName())))) + && (!(reportDescr.equals(nvl(rdef.getReportDescr())))) + && (!(formHelp.equals(nvl(rdef.getFormHelpText())))) + && (!(reportType.equals(nvl(rdef.getReportType())))) + && (pageSize != rdef.getPageSize()) && + // rPublic.equals(rdef.isPublic()?"Y":"N")&& + (!(menuID.equals(nvl(rdef.getMenuID())))) + && (!(rApproved.equals(rdef.isMenuApproved()))) && (additionalFieldsShown ? ((!(rRCSDisabled + .equals(rdef.isRuntimeColSortDisabled()))) + && (!(displayOptions.equals(nvl(rdef.getDisplayOptions())))) + && (!(dashboardOptions.equals(nvl(rdef.getDashboardOptions())))) + && (!(numFormCols.equals(nvl(rdef.getNumFormCols())))) + && (!(reportTitle.equals(nvl(rdef.getReportTitle())))) + && (!(reportSubTitle.equals(nvl(rdef.getReportSubTitle())))) + && (!(reportHeader.equals(nvl(rdef.getReportHeader())))) && (!(reportFooter + .equals(nvl(rdef.getReportFooter()))))&& (reportsInNewWindow != rdef.isReportInNewWindow())):true); +*/ +/* reportUpdated = rRCSDisabled ==(rdef.isRuntimeColSortDisabled() + && displayOptions.equals(nvl(rdef.getDisplayOptions())) + //&& dashboardOptions.equals(nvl(rdef.getDashboardOptions())) + && numFormCols.equals(nvl(rdef.getNumFormCols())) + && reportTitle.equals(nvl(rdef.getReportTitle())) + && reportSubTitle.equals(nvl(rdef.getReportSubTitle())) + && reportHeader.equals(nvl(rdef.getReportHeader())) + && reportsInNewWindow == rdef.isReportInNewWindow() + && reportFooter.equals(nvl(rdef.getReportFooter()))) + ;*/ + + + /*reportUpdated = (!(reportName.equals(nvl(rdef.getReportName())) + && reportDescr.equals(nvl(rdef.getReportDescr())) + && formHelp.equals(nvl(rdef.getFormHelpText())) + && reportType.equals(nvl(rdef.getReportType())) + && (pageSize == rdef.getPageSize()) + && excelDownloadSize == rdef.getMaxRowsInExcelDownload() + && reportsInNewWindow == rdef.isReportInNewWindow() + && displayOptions.equals(rdef.getDisplayOptions()) + && dataContainerHeight.equals(rdef.getDataContainerHeight()) + && dataContainerWidth.equals(rdef.getDataContainerWidth()) + && (isAllowSchedule ==(rdef.isAllowSchedule())) + // rPublic.equals(rdef.isPublic()?"Y":"N")&& + && menuID.equals(nvl(rdef.getMenuID())) + && rApproved.equals(rdef.isMenuApproved() ? "Y" : "N") && (rRCSDisabled + == ((rdef.isRuntimeColSortDisabled()) + && displayOptions.equals(nvl(rdef.getDisplayOptions())) + //&& dashboardOptions.equals(nvl(rdef.getDashboardOptions())) + && numFormCols.equals(nvl(rdef.getNumFormCols())) + && reportTitle.equals(nvl(rdef.getReportTitle())) + && reportSubTitle.equals(nvl(rdef.getReportSubTitle())) + && isOneTimeScheduleAllowed.equals(nvl(rdef.getIsOneTimeScheduleAllowed())) + && isHourlyScheduleAllowed.equals(nvl(rdef.getIsHourlyScheduleAllowed())) + && isDailyScheduleAllowed.equals(nvl(rdef.getIsDailyScheduleAllowed())) + && isDailyMFScheduleAllowed.equals(nvl(rdef.getIsDailyMFScheduleAllowed())) + && isWeeklyScheduleAllowed.equals(nvl(rdef.getIsWeeklyScheduleAllowed())) + && isMonthlyScheduleAllowed.equals(nvl(rdef.getIsMonthlyScheduleAllowed())) + && reportHeader.equals(nvl(rdef.getReportHeader())) && reportFooter + .equals(nvl(rdef.getReportFooter())))) + )); */ + rdef.setReportName(reportName); + rdef.setReportDescr(reportDescr); + rdef.setFormHelpText(formHelp); + rdef.setReportType(reportType); + rdef.setPageSize(pageSize); + rdef.setDBInfo(dataSource); + rdef.setDBType(dbType); + rdef.setDisplayOptions(displayOptions); + rdef.setDataContainerHeight(dataContainerHeight); + rdef.setDataContainerWidth(dataContainerWidth); + rdef.setAllowSchedule(isAllowSchedule?"Y":"N"); + rdef.setMultiGroupColumn(isColumnGroup?"Y":"N"); + rdef.setTopDown(isTopDown?"Y":"N"); + rdef.setSizedByContent(isSizedByContent?"Y":"N"); + // rdef.setPublic(rPublic.equals("Y")); + rdef.setMenuID(menuID); + rdef.setMenuApproved(rApproved.equals("Y")); + if (reportDefType.length() > 0) + rdef.setReportDefType(reportDefType); +/* if(rdef.isDashboardType()) { + rdef.setDashboardOptions(dashboardOptions.toString()); + }*/ + rdef.setHideFormFieldAfterRun(hideFormFieldAfterRun); + rdef.setReportInNewWindow(reportsInNewWindow); + rdef.setRuntimeColSortDisabled(rRCSDisabled); + rdef.setNumFormCols(numFormCols); + rdef.setReportTitle(reportTitle); + rdef.setReportSubTitle(reportSubTitle); + rdef.setReportHeader(reportHeader); + rdef.setReportFooter(reportFooter); + rdef.setIsOneTimeScheduleAllowed(isOneTimeScheduleAllowed); + rdef.setIsHourlyScheduleAllowed(isHourlyScheduleAllowed); + rdef.setIsDailyScheduleAllowed(isDailyScheduleAllowed); + rdef.setIsDailyMFScheduleAllowed(isDailyMFScheduleAllowed); + rdef.setIsWeeklyScheduleAllowed(isWeeklyScheduleAllowed); + rdef.setIsMonthlyScheduleAllowed(isMonthlyScheduleAllowed); + rdef.setFrozenColumns(frozenColumns); + + } // if + + if (rdef.getWizardSequence() instanceof WizardSequence) + rdef.generateWizardSequence(request); + + + /* + * if(formHelp.length()>255) formHelp = formHelp.substring(0, 255); + */ + + + // String rPublic = nvl(AppUtils.getRequestValue(request, "public"), + // "N"); + // String menuID = AppUtils.getRequestNvlValue(request, "menuID"); + +// boolean dashboardOptionsShown = AppUtils.getRequestNvlValue(request, +// "dashboardOptionsShown").equals("Y"); + + reportUpdated = true; + + if (rdef.getReportID().equals("-1")) + // Always need to persist new report - in case it is a copy + reportUpdated = true; + + return reportUpdated; + } // processDefinition + + private boolean processTableAdd(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + String tableName = AppUtils.getRequestNvlValue(request, "tableName").toUpperCase(); + String tableId = rdef.getUniqueTableId(tableName); + + String joinTableExpr = null; + String joinTableId = null; + + DataSourceType joinTable = + rdef.getTableById(AppUtils.getRequestValue(request, "joinTableName")); + if (joinTable != null) { + String joinTableName = joinTable.getTableName(); + joinTableId = joinTable.getTableId(); + + String joinExpr = AppUtils.getRequestNvlValue(request, "joinExpr").toUpperCase(); + + joinTableExpr = joinExpr.replaceAll("\\["+tableName+"\\]", tableId); + joinTableExpr = joinTableExpr.replaceAll("\\["+joinTableName+"\\]", joinTableId); +// debugLogger.debug("joinExpr : "+joinExpr+"\njoinTableExpr : "+ joinTableExpr); + } + + rdef.addDataSourceType(new ObjectFactory(), tableId, tableName, AppUtils + .getRequestNvlValue(request, "tablePK"), AppUtils.getRequestNvlValue(request, + "displayName"), joinTableId, joinTableExpr, null); + + rdef.setOuterJoin(rdef.getTableById(tableId), AppUtils.getRequestNvlValue(request, + "outerJoin")); + rdef.resetCache(true); + + return true; + } // processTableAdd + + private boolean processTableEdit(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + DataSourceType dst = rdef.getTableById(AppUtils.getRequestNvlValue(request, + AppConstants.RI_DETAIL_ID)); + + String displayName = XSSFilter.filterRequest(AppUtils.getRequestNvlValue(request, "displayName")); + String outerJoin = AppUtils.getRequestNvlValue(request, "outerJoin"); + + String tableName = AppUtils.getRequestNvlValue(request, "tableName").toUpperCase(); + String joinTableId = AppUtils.getRequestNvlValue(request, "joinTableName"); + + String joinExpr = AppUtils.getRequestNvlValue(request, "joinExpr").toUpperCase(); + + String joinTableExpr = null; + if(joinExpr.length()!=0){ + joinTableExpr = joinExpr.replaceAll("\\["+tableName+"\\]", rdef.getTableByDBName(tableName).getTableId()); + joinTableExpr = joinTableExpr.replaceAll("\\["+rdef.getTableById(joinTableId).getTableName().toUpperCase()+"\\]", joinTableId); + dst.setRefDefinition(joinTableExpr); + } + boolean reportUpdated = (!displayName.equals(nvl(dst.getDisplayName())) || + !outerJoin.equals(rdef.getOuterJoinType(dst)) || + !(joinExpr.length()==0)); + + dst.setDisplayName(displayName); + rdef.setOuterJoin(dst, outerJoin); + if (reportUpdated) + rdef.resetCache(true); + + return true; // reportUpdated; + } // processTableEdit + + + private boolean processTableDelete(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + rdef.deleteDataSourceType(AppUtils.getRequestNvlValue(request, + AppConstants.RI_DETAIL_ID)); + return true; + } // processTableDelete + + private boolean processColumnAddEdit(HttpServletRequest request, boolean isEdit) + throws Exception { + if(!isEdit) { + return true; + } + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + DataColumnType currColumn = null; + + String tableId = null; + String colName = null; + String dataType = null; + if (isEdit) { + currColumn = rdef.getColumnById(AppUtils.getRequestNvlValue(request, + AppConstants.RI_DETAIL_ID)); + + if(currColumn!=null) { + tableId = currColumn.getTableId(); + colName = currColumn.getDbColName(); // currColumn.getColName(); + dataType = currColumn.getDbColType(); + } + } else { + String colData = AppUtils.getRequestNvlValue(request, "columnDetails"); + if(nvl(colData).length()>0) { + tableId = colData.substring(0, colData.indexOf('|')); + colName = colData.substring(tableId.length() + 1, + colData.indexOf('|', tableId.length() + 1)).toUpperCase(); + dataType = colData.substring(tableId.length() + colName.length() + 2); + } + } // else + + String exprFormula = AppUtils.getRequestNvlValue(request, "exprFormula"); + + String colNameValue = null; + if (exprFormula.length() > 0) + if (exprFormula.equals("_exprText_")) + colNameValue = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestValue(request, "exprText")); + else if (exprFormula.equals("COUNT(*)")) + colNameValue = exprFormula; + else + colNameValue = exprFormula + " " + colName + ")"; + else + colNameValue = colName; + + int displayWidth = -1; + try { + displayWidth = Integer.parseInt(AppUtils.getRequestValue(request, "displayWidth")); + } catch (NumberFormatException e) { + } + + String sColId = isEdit ? currColumn.getColId() : (nvl(colName).length()>0?rdef.getUniqueColumnId(colName):null); + String drillDownParams = AppUtils.getRequestValue(request, "drillDownParams"); + if (drillDownParams != null) { + // Replacing references to [this] with [col_id] + while (drillDownParams.indexOf("[this]") >= 0) { + int startIdx = drillDownParams.indexOf("[this]"); + StringBuffer sb = new StringBuffer(); + + if (startIdx > 0) + sb.append(drillDownParams.substring(0, startIdx)); + sb.append("[" + sColId + "]"); + if (startIdx + 6 < drillDownParams.length() - 1) + sb.append(drillDownParams.substring(startIdx + 5)); + drillDownParams = sb.toString(); + } // while + } // if + + String crossTabValue = null; + boolean isVisible = AppUtils.getRequestFlag(request, "visible"); + boolean isSortable = AppUtils.getRequestFlag(request, "sortable"); + String nowrap = AppUtils.getRequestNvlValue(request, "nowrap"); + int indentation = 0; + try { + indentation = Integer.parseInt(AppUtils.getRequestNvlValue(request, "indentation")); + }catch (NumberFormatException e) { + } + String dependsOnFormField = AppUtils.getRequestNvlValue(request, "dependsOnFormField"); + boolean isGroupBreak = AppUtils.getRequestFlag(request, "groupBreak"); + String groupByPosStr = AppUtils.nvls(AppUtils.getRequestValue(request, "groupByPos"), "0"); + int groupByPos = Integer.parseInt(groupByPosStr); + currColumn.setGroupByPos(groupByPos); + + if(groupByPos > 0) { + String subTotalCustomText = AppUtils.nvls(AppUtils.getRequestValue(request, "subTotalCustomText"), "Sub Total"); + currColumn.setSubTotalCustomText(subTotalCustomText); + + boolean hideRepeatedKey = AppUtils.getRequestFlag(request, "hideRepeatedKeys"); + currColumn.setHideRepeatedKey(hideRepeatedKey); + } + + String displayTotal = AppUtils.getRequestNvlValue(request, "displayTotal"); + String widthInPxls = AppUtils.getRequestNvlValue(request, "widthInPxls"); + + if (rdef.getReportType().equals(AppConstants.RT_CROSSTAB)) { + + + + crossTabValue = AppUtils.getRequestValue(request, "crossTabValue"); + isVisible = nvl(crossTabValue).equals(AppConstants.CV_ROW) + || nvl(crossTabValue).equals(AppConstants.CV_COLUMN) + || nvl(crossTabValue).equals(AppConstants.CV_VALUE); + isGroupBreak = nvl(crossTabValue).equals(AppConstants.CV_ROW) + || nvl(crossTabValue).equals(AppConstants.CV_COLUMN); + + if (nvl(crossTabValue).equals(AppConstants.CV_VALUE)) + displayTotal += "|" + + AppUtils.getRequestNvlValue(request, "displayTotalPerRow"); + else + displayTotal = ""; + } // if + + String displayName = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "displayName")); + String colType = AppUtils.getRequestNvlValue(request, "colType"); + String displayFormat = AppUtils.getRequestNvlValue(request, "displayFormat"); + + //HYPERLINK + if(colType.equals(AppConstants.CT_HYPERLINK)) { + String hyperlinkURL = AppUtils.getRequestValue(request, "hyperlinkURL"); + currColumn.setHyperlinkURL(hyperlinkURL); + String anchor = AppUtils.getRequestValue(request, "anchor"); + currColumn.setHyperlinkType(anchor); + if(anchor.equals("IMAGE")) { + String actionImg = AppUtils.getRequestValue(request, "actionImg"); + currColumn.setActionImg(actionImg); + } + } + + + + String displayAlign = AppUtils.getRequestValue(request, "displayAlign"); + String displayHeaderAlign = AppUtils.getRequestValue(request, "displayHeaderAlign"); + String drillDownURL = AppUtils.getRequestValue(request, "drillDownURL"); + String drillDownSuppress = AppUtils.getRequestValue(request, "drillDownSuppress"); + boolean drillDownPopUp = AppUtils.getRequestFlag (request, "drillDownPopUp"); + String semaphoreId = AppUtils.getRequestNvlValue(request, "semaphore"); + String semaphoreType = AppUtils.getRequestNvlValue(request, "semaphoreTypeHidden"); + + String levelStr = AppUtils.getRequestNvlValue(request, "multiGroupColLevel"); + String startColGroup = AppUtils.getRequestNvlValue(request, "startMultiGroup"); + String colGroupColSpan = AppUtils.getRequestNvlValue(request, "colspan"); + int level = 0; + try { + level = Integer.parseInt(levelStr); + }catch (NumberFormatException ex) { + level = 0; + } + int startColGroupInt = 0; + int colGroupColSpanInt = 0; + if(level > 0) { + try { + //startColGroupInt = Integer.parseInt(startColGroup); + colGroupColSpanInt = Integer.parseInt(colGroupColSpan); + } catch (NumberFormatException ex) { + + } + } + currColumn.setLevel(level); + if(level > 0) { + currColumn.setStart(startColGroupInt); + currColumn.setColspan(colGroupColSpanInt); + } + + String targetColumnId = (semaphoreType.indexOf("|")!= -1 ? semaphoreType.substring(semaphoreType.indexOf("|")+1):""); + DataColumnType targetColumn = rdef.getColumnById(targetColumnId); + + SemaphoreType semaphore = rdef.getSemaphoreById(semaphoreId); + rdef.deleteSemaphore(semaphore); + if(nvl(semaphoreType).length() > 0 && semaphoreType.indexOf("|")!=-1) + semaphore.setSemaphoreType(semaphoreType.substring(0,semaphoreType.indexOf("|"))); + if(semaphore!=null) { + semaphore.setComment(currColumn.getColId()); + if(nvl(semaphoreType).length() > 0) + semaphore.setTarget(targetColumnId.length()>0? targetColumnId: ""); + rdef.setSemaphore(semaphore); + } + + + if (isEdit) { + if(nvl(widthInPxls).length()>0) { + if(nvl(widthInPxls).endsWith("px")) + currColumn.setDisplayWidthInPxls(widthInPxls); + else + currColumn.setDisplayWidthInPxls(widthInPxls+"px"); + } else { + currColumn.setDisplayWidthInPxls(""); + } + + currColumn.setCrossTabValue(crossTabValue); + currColumn.setDependsOnFormField(dependsOnFormField); + currColumn.setDisplayName(displayName); + //currColumn.setOriginalDisplayName(displayName); + + if (displayWidth > 0) + currColumn.setDisplayWidth(displayWidth); + currColumn.setDisplayAlignment(displayAlign); + currColumn.setDisplayHeaderAlignment(displayHeaderAlign); + currColumn.setDrillDownURL(drillDownURL); + currColumn.setDrillDownParams(drillDownParams); + currColumn.setDrillDownType(drillDownSuppress); + currColumn.setDrillinPoPUp(drillDownPopUp); + //indentation + currColumn.setIndentation(indentation); + if(drillDownPopUp) { + rdef.setDrillDownURLInPopupPresent(true); + } + /*if(targetColumn!=null) { + currColumn.setSemaphoreId(null); + targetColumn.setSemaphoreId(semaphoreId); + } else */ + currColumn.setSemaphoreId(semaphoreId); + currColumn.setGroupBreak(isGroupBreak); + logger.debug(EELFLoggerDelegate.debugLogger, (" ------------ Display Total ---------- "+ displayTotal)); + currColumn.setDisplayTotal(displayTotal); + //if (currColumn.getDrillDownURL() == null || currColumn.getDrillDownURL().length() == 0) + currColumn.setVisible(isVisible); + currColumn.setIsSortable(isSortable); + currColumn.setNowrap(nowrap); + //else + // currColumn.setVisible(true); + if (rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED)) { + if(colType!=null) + currColumn.setColType(colType); + displayFormat = AppUtils.getRequestValue(request, "colDataFormat"); + if (displayFormat != null){ + currColumn.setColFormat(displayFormat); + } + if(colType!=null && colType.equals(AppConstants.CT_DATE)) { + boolean enhancedPagination = AppUtils.getRequestFlag(request, "enhancedPagination"); + currColumn.setEnhancedPagination(enhancedPagination); + } + } + if (!rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED)) { + currColumn.setColName(colNameValue); + if (displayFormat != null) + currColumn.setColFormat(displayFormat); + //currColumn.setVisible(isVisible); + currColumn.setCalculated(exprFormula.length() > 0); + + rdef.adjustColumnType(currColumn); + } // if + + rdef.resetCache(true); + } else + currColumn = rdef.addDataColumnType(new ObjectFactory(), sColId, tableId, colName, + crossTabValue, colNameValue, displayName, displayWidth, displayAlign, rdef + .getAllColumns().size() + 1, isVisible, + (exprFormula.length() > 0), adjustDataType(dataType), displayFormat, + isGroupBreak, -1, null, displayTotal, null, -1, drillDownSuppress, + drillDownURL, drillDownParams, semaphoreId, null); + + if (rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED)) + rdef.setColumnNoParseDateFlag(currColumn, AppUtils.getRequestFlag(request, + "no_parse_date")); + if(nvl(displayName).length()>0) + return true; + else + return false; + } // processColumnAddEdit + + private boolean processColumnAddMulti(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + List reportCols = rdef.getAllColumns(); + int nCol = reportCols.size() + 1; + + String[] addColumn = request.getParameterValues("addColumn"); + String[] tableId = request.getParameterValues("tableId"); + String[] columnName = request.getParameterValues("columnName"); + String[] columnType = request.getParameterValues("columnType"); + String[] displayName = request.getParameterValues("displayName"); + + for (int i = 0; i < addColumn.length; i++) + if (addColumn[i].equals("Y")) { + int j = 2; + String uniqueDisplayName = displayName[i]; + boolean isUnique = true; + do { + isUnique = true; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) + if (uniqueDisplayName.equals(((DataColumnType) iter.next()) + .getDisplayName())) { + isUnique = false; + uniqueDisplayName = displayName[i] + (j++); + break; + } // if + } while (!isUnique); + + rdef + .addDataColumnType( + new ObjectFactory(), + rdef.getUniqueColumnId(columnName[i]), + tableId[i], + columnName[i], + null, + columnName[i], + uniqueDisplayName, + 10, + "Left", + nCol++, + true, + false, + adjustDataType(columnType[i]), + (columnType[i].equals(AppConstants.CT_DATE) ? AppConstants.DEFAULT_DATE_FORMAT + : null), false, -1, null, null, null, -1, null, null, + null, null, null); + } // if + + return true; + } // processColumnAddMulti + + private boolean processColumnOrderAll(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + String[] colId = request.getParameterValues("colId"); + String[] colOrder = request.getParameterValues("colOrder"); + + boolean reportUpdated = false; + for (int i = 0; i < colId.length; i++) { + DataColumnType dct = rdef.getColumnById(nvl(colId[i])); + if (dct == null) + continue; + + int iColOrder = 0; + try { + iColOrder = Integer.parseInt(colOrder[i]); + } catch (NumberFormatException e) { + } + + if (iColOrder > 0) { + dct.setOrderSeq(iColOrder); + reportUpdated = true; + } // if + } // for + + if (reportUpdated) { + List reportCols = rdef.getAllColumns(); + Collections.sort(reportCols, new OrderSeqComparator()); + + int iOrder = 1; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + dct.setOrderSeq(iOrder++); + } // for + + rdef.resetCache(false); + } // if + + return reportUpdated; + } // processColumnOrderAll + + private boolean processColumnDelete(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + rdef.deleteDataColumnType(AppUtils.getRequestNvlValue(request, + AppConstants.RI_DETAIL_ID)); + return true; + } // processColumnDelete + + private boolean processColumnMoveUp(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + rdef.shiftColumnOrderUp(AppUtils + .getRequestNvlValue(request, AppConstants.RI_DETAIL_ID)); + return true; + } // processColumnMoveUp + + private boolean processColumnMoveDown(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + rdef.shiftColumnOrderDown(AppUtils.getRequestNvlValue(request, + AppConstants.RI_DETAIL_ID)); + return true; + } // processColumnMoveDown + + private boolean processFormFieldAddEdit(HttpServletRequest request, boolean isEdit, + String action) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + String fieldName = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "fieldName")); + String multiSelectSize = "0"; + String colId = AppUtils.getRequestNvlValue(request, "fieldColId"); + if (rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED)) { + String displayFormat = AppUtils.getRequestNvlValue(request, "displayFormat"); + if (displayFormat.length() > 0) + colId += "|" + displayFormat; + } // if + String fieldType = AppUtils.getRequestNvlValue(request, "fieldType"); + String validation = AppUtils.getRequestNvlValue(request, "validation"); + String mandatory = nvl(AppUtils.getRequestValue(request, "mandatory"), "N"); + String defaultValue = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "defaultValue")); + String fieldHelp = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "fieldHelp")); + String fieldSQL = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "fieldSQL")); + String fieldDefaultSQL = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "fieldDefaultSQL")); + String visible = nvl(AppUtils.getRequestValue(request, "visible"),"Y"); + String dependsOn = nvl(AppUtils.getRequestValue(request, "dependsOn"),""); + String rangeStartDate = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "rangeStartDate")); + String rangeEndDate = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "rangeEndDate")); + String rangeStartDateSQL = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "rangeStartDateSQL")); + String rangeEndDateSQL = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "rangeEndDateSQL")); + boolean isGroupFormField = AppUtils.getRequestFlag(request,"isGroupFormField"); + + Calendar start = null; + Calendar end = null; + if (AppUtils.nvl(rangeStartDate).length()>0){ + SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy"); + start = Calendar.getInstance(); + start.setTime(dtf.parse(rangeStartDate)); + } + if (AppUtils.nvl(rangeEndDate).length()>0){ + SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy"); + end = Calendar.getInstance(); + end.setTime(dtf.parse(rangeEndDate)); + }/* + * if(fieldHelp.length()>255) fieldHelp = fieldHelp.substring(0, 255); + */ + + boolean reportUpdated = false; + + FormFieldType currField = null; + if (isEdit) { + String fieldId = AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID); + + currField = rdef.getFormFieldById(fieldId); + if (currField != null && nvl(fieldName).length()>0) { + reportUpdated = (!(fieldName.equals(nvl(currField.getFieldName())) + && colId.equals(nvl(currField.getColId())) + && fieldType.equals(nvl(currField.getFieldType())) + && validation.equals(nvl(currField.getValidationType())) + && mandatory.equals(nvl(currField.getMandatory(), "N")) + && defaultValue.equals(nvl(currField.getDefaultValue())) + && fieldSQL.equals(nvl(currField.getFieldSQL())) + && fieldDefaultSQL.equals(nvl(currField.getFieldDefaultSQL())) + && dependsOn.equals(nvl(currField.getDependsOn(), "N")) + && (start == null || (start != null && currField.getRangeStartDate() == null) || (start.equals(currField.getRangeStartDate()))) + && (end == null || (end != null && currField.getRangeEndDate() == null) || (end.equals(currField.getRangeEndDate()))) + && rangeStartDateSQL.equals(nvl(currField.getRangeStartDateSQL())) + && rangeEndDateSQL.equals(nvl(currField.getRangeEndDateSQL())) + && visible.equals(nvl(currField.getVisible(), "Y")) + && isGroupFormField == currField.isGroupFormField() + && fieldHelp.equals(nvl(currField.getComment())))); + + rdef.replaceFormFieldReferences("[" + currField.getFieldName() + "]", "[" + + fieldName + "]"); + + currField.setFieldName(fieldName); + currField.setColId(colId); + currField.setFieldType(fieldType); + currField.setValidationType(validation); + currField.setMandatory(mandatory); + currField.setDefaultValue(defaultValue); + currField.setFieldSQL(fieldSQL); + currField.setFieldDefaultSQL(fieldDefaultSQL); + currField.setComment(fieldHelp); + currField.setVisible(visible); + currField.setDependsOn(dependsOn); + try { + if(start!=null) { + currField.setRangeStartDate(DatatypeFactory.newInstance() + .newXMLGregorianCalendar(start.YEAR, start.MONTH, start.DAY_OF_WEEK, start.HOUR, start.MINUTE, start.SECOND, start.MILLISECOND, start.ZONE_OFFSET)); + } else { + currField.setRangeStartDate(null); + } + if(end!=null) { + currField.setRangeEndDate(DatatypeFactory.newInstance() + .newXMLGregorianCalendar(end.YEAR, end.MONTH, end.DAY_OF_WEEK, end.HOUR, end.MINUTE, end.SECOND, end.MILLISECOND, end.ZONE_OFFSET)); + } else { + currField.setRangeEndDate(null); + } + /*currField.setRangeEndDate(DatatypeFactory.newInstance() + .newXMLGregorianCalendar(end));*/ + } catch (DatatypeConfigurationException ex) { + + } + + currField.setRangeStartDateSQL(rangeStartDateSQL); + currField.setRangeEndDateSQL(rangeEndDateSQL); + currField.setGroupFormField(isGroupFormField); + if(fieldType.equals(FormField.FFT_LIST_MULTI)) { + multiSelectSize = AppUtils.getRequestNvlValue(request, "multiSelectListSize"); + currField.setMultiSelectListSize(multiSelectSize); + } + + + } // if + } else { + reportUpdated = true; + + currField = rdef.addFormFieldType(new ObjectFactory(), fieldName, colId, + fieldType, validation, mandatory, defaultValue, fieldSQL, fieldHelp, start, end, rangeStartDateSQL, rangeEndDateSQL); + + request.setAttribute(AppConstants.RI_DETAIL_ID, currField.getFieldId()); + } // else + + if (action.equals(AppConstants.WA_ADD_USER)) { + reportUpdated = true; + rdef.addFormFieldPredefinedValue(new ObjectFactory(), currField, XSSFilter.filterRequestOnlyScript(AppUtils + .getRequestNvlValue(request, "newPredefinedValue"))); + } else if (action.equals(AppConstants.WA_DELETE_USER)) { + reportUpdated = true; + rdef.deleteFormFieldPredefinedValue(currField, AppUtils.getRequestNvlValue( + request, "delPredefinedValue")); + } + + return reportUpdated; + } // processFormFieldAddEdit + + private boolean processFormFieldDelete(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + String fieldId = AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID); + rdef.deleteFormField(fieldId); + + return true; + } // processFormFieldDelete + + private boolean processFormFieldMoveUp(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + rdef.shiftFormFieldUp(AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID)); + return true; + } // processFormFieldMoveUp + + private boolean processFormFieldMoveDown(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + rdef.shiftFormFieldDown(AppUtils + .getRequestNvlValue(request, AppConstants.RI_DETAIL_ID)); + return true; + } // processFormFieldMoveDown + + private boolean processFormFieldBlank(HttpServletRequest request) throws Exception { + boolean reportUpdated = false; + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + reportUpdated = true; + rdef.addFormFieldBlank(new ObjectFactory()); + return true; + } // processFormFieldMoveDown + + //processFormFieldInfoBar + private boolean processFormFieldInfoBar(HttpServletRequest request) throws Exception { + boolean reportUpdated = false; + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + reportUpdated = true; + rdef.addCustomizedTextForParameters(XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "blueBarField"))); + return true; + } // processFormFieldMoveDown + + + private boolean processForecasting(HttpServletRequest request, String action) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + if(rdef.getDataminingOptions()==null) + rdef.addDataminingOptions(new ObjectFactory()); + + String classifiers = AppUtils.getRequestNvlValue(request, "classifiers"); + rdef.setClassifier(classifiers); + String dateAttrColId = AppUtils.getRequestNvlValue(request, "timeAttribute"); + String timeFormat = AppUtils.getRequestNvlValue(request, "timeFormat"); + if(timeFormat.equals("Default")) timeFormat = "yyyy-MM-dd HH:mm:ss"; + String forecastingPeriod = AppUtils.getRequestNvlValue(request, "forecastingPeriod"); + + String[] forecastCols = request.getParameterValues("forecastCol"); + List reportCols = rdef.getAllColumns(); + DataColumnType dct = null; + Iterator iter = null; + + + + if(dateAttrColId != null) { + for(iter=reportCols.iterator(); iter.hasNext(); ) { + dct = (DataColumnType) iter.next(); + if(dct.getColId().equals(dateAttrColId)) { + dct.setDataMiningCol(AppConstants.DM_DATE_ATTR); + if(timeFormat!=null) rdef.setForecastingTimeFormat(timeFormat); + break; + } + } + } + + if(forecastCols != null) { + for (int i = 0; i < forecastCols.length; i++) { + for(iter=reportCols.iterator(); iter.hasNext(); ) { + dct = (DataColumnType) iter.next(); + if(dct.getColId().equals(forecastCols[i])) { + dct.setDataMiningCol(AppConstants.DM_FORECASTING_ATTR); + } + } + } + rdef.setForecastingPeriod(forecastingPeriod); + } + boolean reportUpdated = true; + + return reportUpdated; + } // processForecasting + + + private boolean processFilterAddEdit(HttpServletRequest request, boolean isEdit) + throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + String colId = AppUtils.getRequestNvlValue(request, "filterColId"); + String filterExpr = AppUtils.getRequestNvlValue(request, "filterExpr"); + String argType = (filterExpr.equals("IS NULL") || filterExpr.equals("IS NOT NULL")) ? null + : AppUtils.getRequestNvlValue(request, "argType"); + String argValue = (filterExpr.equals("IS NULL") || filterExpr.equals("IS NOT NULL")) ? null + : AppUtils.getRequestNvlValue(request, "argValue"); + + if (nvl(argType).equals(AppConstants.AT_COLUMN)) { + List reportCols = rdef.getAllColumns(); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + if (argValue.equals("[" + dct.getDisplayName() + "]")) { + argValue = dct.getColId(); + break; + } + } // for + } // if + + if (nvl(argType).equals(AppConstants.AT_VALUE) + && (!nvl(argValue).equals(AppConstants.FILTER_MAX_VALUE)) + && (!nvl(argValue).equals(AppConstants.FILTER_MIN_VALUE))) { + // Validating the value by type + DataColumnType currColumn = rdef.getColumnById(colId); + String currColType = currColumn.getColType(); + + try { + String s_sql = Globals.getProcessFilterAddEdit(); + s_sql = s_sql.replace("[argValue]", argValue); + /*DataSet ds = DbUtils.executeQuery("SELECT " + + (currColType.equals(AppConstants.CT_NUMBER) ? ("TO_NUMBER('" + + argValue + "')") + : (currColType.equals(AppConstants.CT_DATE) ? ("TO_DATE('" + + argValue + + "', '" + + nvl(currColumn.getColFormat(), + AppConstants.DEFAULT_DATE_FORMAT) + "')") + : ("'" + argValue + "'"))) + " FROM dual");*/ + + DataSet ds = DbUtils.executeQuery("SELECT " + + (currColType.equals(AppConstants.CT_NUMBER) ? ("TO_NUMBER('" + + argValue + "')") + : (currColType.equals(AppConstants.CT_DATE) ? ("TO_DATE('" + + argValue + + "', '" + + nvl(currColumn.getColFormat(), + AppConstants.DEFAULT_DATE_FORMAT) + "')") + : s_sql))); + } catch (Exception e) { + throw new ValidationException( + "" + + (currColType.equals(AppConstants.CT_NUMBER) ? "Invalid number" + : (currColType.equals(AppConstants.CT_DATE) ? ("Invalid date
    Expected date format " + nvl( + currColumn.getColFormat(), + AppConstants.DEFAULT_DATE_FORMAT)) + : "Invalid value
    Possible reason: use of single quotes")) + + "
    Value: " + argValue); + } + } // if + + if (isEdit) { + int filterPos = -1; + try { + filterPos = Integer.parseInt(AppUtils.getRequestValue(request, "filterPos")); + } catch (NumberFormatException e) { + } + + ColFilterType currFilter = rdef.getFilterById(colId, filterPos); + if (currFilter != null) { + currFilter.setJoinCondition(AppUtils.getRequestValue(request, "filterJoin")); + currFilter.setOpenBrackets(AppUtils.getRequestValue(request, "openBrackets")); + currFilter.setExpression(filterExpr); + // if(argType!=null) + currFilter.setArgType(argType); + // if(argValue!=null) + currFilter.setArgValue(argValue); + currFilter + .setCloseBrackets(AppUtils.getRequestValue(request, "closeBrackets")); + } // if + + rdef.resetCache(true); + } else { + rdef.addColFilterType(new ObjectFactory(), colId, AppUtils.getRequestValue( + request, "filterJoin"), AppUtils.getRequestValue(request, "openBrackets"), + filterExpr, argType, argValue, AppUtils.getRequestValue(request, + "closeBrackets"), null); + } // else + + return true; + } // processFilterAddEdit + + private boolean processFilterDelete(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + String filterId = AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID); + String colId = filterId.substring(0, filterId.indexOf('|')); + int filterPos = -1; + try { + filterPos = Integer.parseInt(filterId.substring(colId.length() + 1)); + } catch (NumberFormatException e) { + } + + rdef.removeColumnFilter(colId, filterPos); + + return true; + } // processFilterDelete + + private boolean processSortAddEdit(HttpServletRequest request, boolean isEdit) + throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + String sortAscDesc = AppUtils.getRequestNvlValue(request, "sortAscDesc"); + if (isEdit) { + DataColumnType currColumn = rdef.getColumnById(AppUtils.getRequestNvlValue( + request, AppConstants.RI_DETAIL_ID)); + if (currColumn != null) + currColumn.setOrderByAscDesc(sortAscDesc); + rdef.resetCache(true); + } else + rdef.addColumnSort(AppUtils.getRequestNvlValue(request, "sortColId"), sortAscDesc, + rdef.getNumSortColumns() + 1); + + return true; + } // processSortAddEdit + + private boolean processSortOrderAll(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + String[] colId = request.getParameterValues("colId"); + String[] sortOrder = request.getParameterValues("sortOrder"); + String[] sortAscDesc = request.getParameterValues("sortAscDesc"); + + boolean reportUpdated = false; + for (int i = 0; i < colId.length; i++) { + DataColumnType dct = rdef.getColumnById(nvl(colId[i])); + if (dct == null) + continue; + + int iSortOrder = 0; + try { + iSortOrder = Integer.parseInt(sortOrder[i]); + } catch (NumberFormatException e) { + } + + if (iSortOrder > 0) { + if (dct.getOrderBySeq() > 0) { + // Update sort + if (dct.getOrderBySeq() != iSortOrder) { + dct.setOrderBySeq(iSortOrder); + reportUpdated = true; + } // if + if (!nvl(dct.getOrderByAscDesc()).equals(nvl(sortAscDesc[i]))) { + dct.setOrderByAscDesc(sortAscDesc[i]); + reportUpdated = true; + } // if + } else { + // Add sort + dct.setOrderBySeq(iSortOrder); + dct.setOrderByAscDesc(sortAscDesc[i]); + reportUpdated = true; + } // else + } else { + if (dct.getOrderBySeq() > 0) { + // Remove sort + dct.setOrderBySeq(0); + dct.setOrderByAscDesc(null); + reportUpdated = true; + } // if + } // else + } // for + + if (reportUpdated) { + List reportCols = rdef.getAllColumns(); + Collections.sort(reportCols, new OrderBySeqComparator()); + int iOrder = 1; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + if (dct.getOrderBySeq() > 0) + dct.setOrderBySeq(iOrder++); + } // for + Collections.sort(reportCols, new OrderSeqComparator()); + + rdef.resetCache(true); + } // if + + return reportUpdated; + } // processSortOrderAll + + private boolean processSortDelete(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + rdef.removeColumnSort(AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID)); + return true; + } // processSortDelete + + private boolean processSortMoveUp(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + rdef + .shiftColumnSortUp(AppUtils.getRequestNvlValue(request, + AppConstants.RI_DETAIL_ID)); + return true; + } // processSortMoveUp + + private boolean processSortMoveDown(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + rdef.shiftColumnSortDown(AppUtils.getRequestNvlValue(request, + AppConstants.RI_DETAIL_ID)); + return true; + } // processSortMoveDown + + private boolean processJavascript (HttpServletRequest request) throws Exception { + processSaveJavascriptElement(request); + return true; + } + + private boolean processSaveJavascriptElement (HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + rdef.setJavascriptElement(AppUtils.getRequestNvlValue(request, AppConstants.RI_JAVASCRIPT)); + String id = AppUtils.getRequestNvlValue(request, AppConstants.RI_JAVASCRIPT_ITEM_ID); + String fieldId = AppUtils.getRequestNvlValue(request, "javascriptFormField-"+id); + if( nvl(fieldId).length()>0 && !(fieldId.startsWith("-1"))) { + + String callableJavascriptText = AppUtils.getRequestNvlValue(request, "callText-"+id); + + logger.debug(EELFLoggerDelegate.debugLogger, ("FieldId " + fieldId + " Call Text " + callableJavascriptText+ " id " + id)); + JavascriptItemType javaScriptType = null; + if(id.length()>0 && id.startsWith("-1")) { + javaScriptType = rdef.addJavascriptType(new ObjectFactory(), id); + javaScriptType.setFieldId(fieldId); + if(!fieldId.equals("os1") || !fieldId.equals("ol1")) + javaScriptType.setId(rdef.getNextIdForJavaScriptElement(new ObjectFactory(), fieldId)); + else { + if(fieldId.equals("os1")) + javaScriptType.setId("os1|1"); + else + javaScriptType.setId("ol1|1"); + } + javaScriptType.setCallText(callableJavascriptText); + } else { + javaScriptType = rdef.addJavascriptType(new ObjectFactory(), id); + javaScriptType.setCallText(callableJavascriptText); + } + } + return true; + } + private boolean processAddJavascriptElement (HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + JavascriptItemType javaScriptType = rdef.addJavascriptType(new ObjectFactory(), ""); + javaScriptType.setId(""); + javaScriptType.setFieldId(""); + javaScriptType.setCallText(""); + + return true; + } + + private boolean processDeleteJavascriptElement (HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + String id = AppUtils.getRequestNvlValue(request, AppConstants.RI_JAVASCRIPT_ITEM_ID); + if(rdef.deleteJavascriptType(id)) + return true; + else + return false; + } + + private boolean processChart(HttpServletRequest request, String action) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + int valueColsCount = rdef.getChartValueColumnsList(AppConstants.CHART_ALL_COLUMNS, null).size(); + + String chartType = AppUtils.getRequestNvlValue(request, "chartType"); + String chartTypeFixed = AppUtils.getRequestValue(request, "chartTypeFixed"); + String legendColId = AppUtils.getRequestNvlValue(request, "legendCol"); + // String valueColId = AppUtils.getRequestNvlValue(request, "valueCol"); + String leftAxisLabel = AppUtils.getRequestValue(request, "leftAxisLabel"); + String rightAxisLabel = AppUtils.getRequestValue(request, "rightAxisLabel"); + String chartWidth = XSSFilter.filterRequest(AppUtils.getRequestNvlValue(request, "chartWidth")); + String chartHeight = XSSFilter.filterRequest(AppUtils.getRequestNvlValue(request, "chartHeight")); + String chartMultiseries = AppUtils.getRequestNvlValue(request, "multiSeries"); + String lastSeriesALineChart = AppUtils.getRequestNvlValue(request, "lastSeriesALineChart"); + String lastSeriesABarChart = AppUtils.getRequestNvlValue(request, "lastSeriesABarChart"); + String overLayItemLabel = "N"; + String chartDisplay = null; + + String multiplePieOrder = null; + String multiplePieLabelDisplay = null; + + String chartOrientation = null; + String secondaryChartRenderer = null; + + String linearRegression = null; + + boolean multiplePieOrderInRunPage = false; + boolean multiplePieLabelDisplayInRunPage = false; + + boolean chartOrientationInRunPage = false; + boolean secondaryChartRendererInRunPage = false; + + boolean chartDisplayInRunPage = false; + + String intervalFromdate = null; + String intervalTodate = null; + String intervalLabel = null; + boolean displayIntervalInputInRunPage = false; + boolean animate = false; + + animate = AppUtils.getRequestNvlValue(request, "animatedOption").equals("animate"); + if(Globals.showAnimatedChartOption()) + rdef.setChartAnimate(animate); + + + String removeColId = ""; + if (action.equals(AppConstants.WA_DELETE_USER)) { + removeColId = AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID); + if(valueColsCount == 2 && !rdef.hasSeriesColumn()) { + rdef.setChartLeftAxisLabel(null); + rdef.setChartRightAxisLabel(null); + + if(chartType.equals(AppConstants.GT_TIME_SERIES) || chartType.equals(AppConstants.GT_PIE_MULTIPLE)) { + chartMultiseries = "N"; + } + } + } + + if(rdef.getChartAdditionalOptions()==null) + rdef.addChartAdditionalOptions(new ObjectFactory()); + + if(rdef.getChartDrillOptions()==null) + rdef.addChartDrillOptions(new ObjectFactory()); + + //clearing already added + if(rdef.getChartDrillOptions().getTargetFormfield()!=null) + rdef.getChartDrillOptions().getTargetFormfield().removeAll(rdef.getChartDrillOptions().getTargetFormfield()); + + + if(chartType.equals(AppConstants.GT_PIE_MULTIPLE)) { + multiplePieOrder = AppUtils.getRequestNvlValue(request, "multiplePieOrder"); + multiplePieLabelDisplay = AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplay"); + chartDisplay = AppUtils.getRequestNvlValue(request, "chartDisplay"); + //if(AppUtils.getRequestNvlValue(request, "multiplePieOrderInRunPage").length()>0) + multiplePieOrderInRunPage = AppUtils.getRequestNvlValue(request,"multiplePieOrderInRunPage").equals("Y"); + //if(AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplayInRunPage").length()>0) + multiplePieLabelDisplayInRunPage = AppUtils.getRequestNvlValue(request,"multiplePieLabelDisplayInRunPage").equals("Y"); + //if(AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").length()>0) + chartDisplayInRunPage = AppUtils.getRequestNvlValue(request,"chartDisplayInRunPage").equals("Y"); + if(rdef.getChartAdditionalOptions()!=null) { + rdef.setChartMultiplePieOrder(multiplePieOrder+(multiplePieOrderInRunPage?"|Y":"")); + rdef.setChartMultiplePieLabelDisplay(multiplePieLabelDisplay+(multiplePieLabelDisplayInRunPage?"|Y":"")); + rdef.setChartDisplay(chartDisplay+(chartDisplayInRunPage?"|Y":"")); + } + + } + + if(chartType.equals(AppConstants.GT_REGRESSION)) { + linearRegression = AppUtils.getRequestNvlValue(request, "regressionType"); + rdef.setLinearRegressionColor(AppUtils.getRequestNvlValue(request, "valueLinearRegressionColor")); + rdef.setExponentialRegressionColor(AppUtils.getRequestNvlValue(request, "valueExponentialRegressionColor")); + rdef.setCustomizedRegressionPoint(AppUtils.getRequestNvlValue(request, "regressionPointCustomization")); + + if(nvl(linearRegression).length()>0) + rdef.setLinearRegression(linearRegression); + else + rdef.setLinearRegression("Y"); + } + + if(chartType.equals(AppConstants.GT_BAR_3D)) { + chartOrientation = AppUtils.getRequestNvlValue(request, "chartOrientation"); + secondaryChartRenderer = AppUtils.getRequestNvlValue(request, "secondaryChartRenderer"); + chartDisplay = AppUtils.getRequestNvlValue(request, "chartDisplay"); + //if(AppUtils.getRequestNvlValue(request, "chartOrientationInRunPage").length()>0) + chartOrientationInRunPage = AppUtils.getRequestNvlValue(request,"chartOrientationInRunPage").equals("Y"); + //if(AppUtils.getRequestNvlValue(request, "secondaryChartRendererInRunPage").length()>0) + secondaryChartRendererInRunPage = AppUtils.getRequestNvlValue(request,"secondaryChartRendererInRunPage").equals("Y"); + //if(AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").length()>0) + chartDisplayInRunPage = AppUtils.getRequestNvlValue(request,"chartDisplayInRunPage").equals("Y"); + rdef.setChartOrientation(chartOrientation+(chartOrientationInRunPage?"|Y":"")); + rdef.setSecondaryChartRenderer(secondaryChartRenderer+(secondaryChartRendererInRunPage?"|Y":"")); + rdef.setChartDisplay(chartDisplay+(chartDisplayInRunPage?"|Y":"")); + rdef.setLastSeriesALineChart(nvl(lastSeriesALineChart, "N")); + } + + if(chartType.equals(AppConstants.GT_LINE)) { + chartOrientation = AppUtils.getRequestNvlValue(request, "chartOrientation"); + secondaryChartRenderer = AppUtils.getRequestNvlValue(request, "secondaryChartRenderer"); + chartDisplay = AppUtils.getRequestNvlValue(request, "chartDisplay"); + //if(AppUtils.getRequestNvlValue(request, "chartOrientationInRunPage").length()>0) + chartOrientationInRunPage = AppUtils.getRequestNvlValue(request,"chartOrientationInRunPage").equals("Y"); + //if(AppUtils.getRequestNvlValue(request, "secondaryChartRendererInRunPage").length()>0) + secondaryChartRendererInRunPage = AppUtils.getRequestNvlValue(request,"secondaryChartRendererInRunPage").equals("Y"); + //if(AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").length()>0) + chartDisplayInRunPage = AppUtils.getRequestNvlValue(request,"chartDisplayInRunPage").equals("Y"); + rdef.setChartOrientation(chartOrientation+(chartOrientationInRunPage?"|Y":"")); + rdef.setSecondaryChartRenderer(secondaryChartRenderer+(secondaryChartRendererInRunPage?"|Y":"")); + rdef.setChartDisplay(chartDisplay+(chartDisplayInRunPage?"|Y":"")); + rdef.setLastSeriesABarChart(nvl(lastSeriesABarChart, "N")); + } + if(chartType.equals(AppConstants.GT_TIME_DIFFERENCE_CHART)) { + intervalFromdate = AppUtils.getRequestNvlValue(request, "intervalFromDate"); + intervalTodate = AppUtils.getRequestNvlValue(request, "intervalToDate"); + intervalLabel = AppUtils.getRequestNvlValue(request, "intervalLabel"); + displayIntervalInputInRunPage = AppUtils.getRequestNvlValue(request,"intervalInputInRunPage").equals("Y"); + rdef.setIntervalFromdate(intervalFromdate+(displayIntervalInputInRunPage?"|Y":"")); + rdef.setIntervalTodate(intervalTodate+(displayIntervalInputInRunPage?"|Y":"")); + rdef.setIntervalLabel(intervalLabel); + } + if(chartType.equals(AppConstants.GT_STACKED_VERT_BAR) || chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR) || chartType.equals(AppConstants.GT_STACKED_VERT_BAR_LINES) + || chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR_LINES)) { + overLayItemLabel = AppUtils.getRequestNvlValue(request, "overlayItemValue"); + rdef.setOverlayItemValueOnStackBar(nvl(overLayItemLabel, "N")); + animate = AppUtils.getRequestNvlValue(request, "animatedOption").equals("animate"); + rdef.setChartAnimate(animate); + } + + rdef.setRangeAxisLowerLimit(AppUtils.getRequestNvlValue(request, "yAxisLowerLimit")); + rdef.setRangeAxisUpperLimit(AppUtils.getRequestNvlValue(request, "yAxisUpperLimit")); + rdef.setLegendLabelAngle(AppUtils.getRequestNvlValue(request,"labelAngle")); + rdef.setLegendPosition(AppUtils.getRequestNvlValue(request,"legendPosition")); + rdef.setMaxLabelsInDomainAxis(AppUtils.getRequestNvlValue(request,"maxLabelsInDomainAxis")); + String chartLegendDisplay = AppUtils.getRequestNvlValue(request,"hideLegend"); + boolean showLegendDisplayOptionsInRunPage = false; + showLegendDisplayOptionsInRunPage = AppUtils.getRequestNvlValue(request,"showLegendDisplayOptionsInRunPage").equals("Y"); + rdef.setChartLegendDisplay(chartLegendDisplay+(showLegendDisplayOptionsInRunPage?"|Y":"")); + rdef.setChartToolTips(AppUtils.getRequestNvlValue(request,"hideTooltips")); + rdef.setDomainAxisValuesAsString(AppUtils.getRequestNvlValue(request,"keepAsString")); + + //System.out.println("KeepAsString " + AppUtils.getRequestNvlValue(request,"keepAsString")); + //System.out.println("From ReportDef " + rdef.keepDomainAxisValueInChartAsString()); + // boolean reportUpdated = (! + // chartType.equals(nvl(rdef.getChartType()))); + rdef.setChartType(chartType); + rdef.setChartTypeFixed(nvl(chartTypeFixed, "N")); + if (nvl(leftAxisLabel).length()>0) + rdef.setChartLeftAxisLabel(leftAxisLabel); + else + rdef.setChartLeftAxisLabel(null); + if (nvl(rightAxisLabel).length()>0) + rdef.setChartRightAxisLabel(rightAxisLabel); + else + rdef.setChartRightAxisLabel(null); + rdef.setChartWidth(nvl(chartWidth, "" + Globals.getDefaultChartWidth())); + rdef.setChartHeight(nvl(chartHeight, "" + Globals.getDefaultChartHeight())); + if(chartType.equals(AppConstants.GT_TIME_SERIES) || chartType.equals(AppConstants.GT_PIE_MULTIPLE)) { + rdef.setChartMultiSeries(chartMultiseries); + } else { + rdef.setChartMultiSeries("N"); + } + + List reportCols = rdef.getAllColumns(); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + + if (dct.getColId().equals(legendColId)) { + // reportUpdated = reportUpdated||(! + // nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND)); + dct.setColOnChart(AppConstants.GC_LEGEND); + } else { + // reportUpdated = + // reportUpdated||nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND); + dct.setColOnChart(null); + } + + /* + * if(dct.getColId().equals(valueColId)) { reportUpdated = + * reportUpdated||(dct.getChartSeq()<=0); dct.setChartSeq(1); } + * else { reportUpdated = reportUpdated||(dct.getChartSeq()>0); + */ + dct.setChartSeq(-1); + /* } */ + } // for + + int idx = 1; + List columns = rdef.getAllColumns(); + if(chartType.equals(AppConstants.GT_TIME_SERIES)) { + String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries"); + String chartGroup = AppUtils.getRequestNvlValue(request, "chartGroup"); + String yAxis = AppUtils.getRequestNvlValue(request, "yAxis"); + for (Iterator iterator = columns.iterator(); iterator.hasNext();) { + DataColumnType alldct = (DataColumnType) iterator.next(); + //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId()); + alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false); + } + + String drillDownReportId = AppUtils.getRequestNvlValue(request, "drillDownReport"); + if(!drillDownReportId.equals("-1")) { + ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, drillDownReportId, + false); + if (ddRr != null) + request.setAttribute("CHART_FORMFIELDS", ddRr.getReportFormFields()); + + for(ddRr.getReportFormFields().resetNext(); ddRr.getReportFormFields().hasNext(); ) { + FormField ff = ddRr.getReportFormFields().getNext(); + if(!ff.getFieldType().equals(FormField.FFT_BLANK)) { + String value = AppUtils.getRequestNvlValue(request, "drillDown_"+ff.getFieldName()); + ChartDrillFormfield cdf = new ObjectFactory().createChartDrillFormfield(); + cdf.setFormfield(value); + rdef.getChartDrillOptions().getTargetFormfield().add(cdf); + } + } + } + + } else { + if(chartType.equals(AppConstants.GT_BAR_3D)) { + String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries"); + String chartGroup = AppUtils.getRequestNvlValue(request, "chartGroup"); + String yAxis = AppUtils.getRequestNvlValue(request, "yAxis"); + for (Iterator iterator = columns.iterator(); iterator.hasNext();) { + DataColumnType alldct = (DataColumnType) iterator.next(); + //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId()); + alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false); + } + String drillDownReportId = AppUtils.getRequestNvlValue(request, "drillDownReport"); + rdef.setDrillReportIdForChart(drillDownReportId); + if(drillDownReportId.equals("-1")){ + rdef.setDrillReportIdForChart(""); + } + + if(!drillDownReportId.equals("-1")) { + ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, drillDownReportId, + false); + if (ddRr != null) + request.setAttribute("CHART_FORMFIELDS", ddRr.getReportFormFields()); + + for(ddRr.getReportFormFields().resetNext(); ddRr.getReportFormFields().hasNext(); ) { + FormField ff = ddRr.getReportFormFields().getNext(); + if(!ff.getFieldType().equals(FormField.FFT_BLANK)) { + String value = AppUtils.getRequestNvlValue(request, "drillDown_"+ff.getFieldName()); + ChartDrillFormfield cdf = new ObjectFactory().createChartDrillFormfield(); + cdf.setFormfield(value); + rdef.getChartDrillOptions().getTargetFormfield().add(cdf); + } + } + + String xAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownXAxisFormfield"); + String yAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownYAxisFormfield"); + String seriesAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownSeriesAxisFormfield"); + + if(!xAxisFormField.equals("-1")){ + rdef.setDrillXAxisFormField(xAxisFormField); + + if(!yAxisFormField.equals("-1")) + rdef.setDrillYAxisFormField(yAxisFormField); + if(!seriesAxisFormField.equals("-1")) + rdef.setDrillSeriesFormField(seriesAxisFormField); + } else { + rdef.setDrillXAxisFormField(""); + rdef.setDrillYAxisFormField(""); + rdef.setDrillSeriesFormField(""); + } + } + + } else if(chartType.equals(AppConstants.GT_SCATTER)) { + String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries"); + for (Iterator iterator = columns.iterator(); iterator.hasNext();) { + DataColumnType alldct = (DataColumnType) iterator.next(); + //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId()); + alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false); + } + + }else if(chartType.equals(AppConstants.GT_REGRESSION)) { + String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries"); + for (Iterator iterator = columns.iterator(); iterator.hasNext();) { + DataColumnType alldct = (DataColumnType) iterator.next(); + //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId()); + alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false); + } + }else if(chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR) || chartType.equals(AppConstants.GT_STACKED_VERT_BAR) + || chartType.equals(AppConstants.GT_STACKED_VERT_BAR_LINES) || chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR_LINES)) { + String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries"); + for (Iterator iterator = columns.iterator(); iterator.hasNext();) { + DataColumnType alldct = (DataColumnType) iterator.next(); + //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId()); + alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false); + } + }else if(chartType.equals(AppConstants.GT_LINE)) { + String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries"); + for (Iterator iterator = columns.iterator(); iterator.hasNext();) { + DataColumnType alldct = (DataColumnType) iterator.next(); + //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId()); + alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false); + } + } else if (chartType.equals(AppConstants.GT_TIME_DIFFERENCE_CHART)) { + String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries"); + for (Iterator iterator = columns.iterator(); iterator.hasNext();) { + DataColumnType alldct = (DataColumnType) iterator.next(); + //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId()); + alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false); + } + } else if (chartType.equals(AppConstants.GT_COMPARE_PREVYEAR_CHART)) { + String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries"); + for (Iterator iterator = columns.iterator(); iterator.hasNext();) { + DataColumnType alldct = (DataColumnType) iterator.next(); + //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId()); + alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false); + } + + } else { + if (rdef.hasSeriesColumn()) { + for (Iterator iterator = columns.iterator(); iterator.hasNext();) { + DataColumnType alldct = (DataColumnType) iterator.next(); + alldct.setChartSeries(false); + } + } + + String drillDownReportId = AppUtils.getRequestNvlValue(request, "drillDownReport"); + rdef.setDrillReportIdForChart(drillDownReportId); + if(drillDownReportId.equals("-1")){ + rdef.setDrillReportIdForChart(""); + } + + if(!drillDownReportId.equals("-1")) { + ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, drillDownReportId, + false); + if (ddRr != null) + request.setAttribute("CHART_FORMFIELDS", ddRr.getReportFormFields()); + for(ddRr.getReportFormFields().resetNext(); ddRr.getReportFormFields().hasNext(); ) { + FormField ff = ddRr.getReportFormFields().getNext(); + if(!ff.getFieldType().equals(FormField.FFT_BLANK)) { + String value = AppUtils.getRequestNvlValue(request, "drillDown_"+ff.getFieldName()); + ChartDrillFormfield cdf = new ObjectFactory().createChartDrillFormfield(); + cdf.setFormfield(value); + rdef.getChartDrillOptions().getTargetFormfield().add(cdf); + } + } + + String xAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownXAxisFormfield"); + String yAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownYAxisFormfield"); + String seriesAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownSeriesAxisFormfield"); + + if(!xAxisFormField.equals("-1")){ + rdef.setDrillXAxisFormField(xAxisFormField); + + if(!yAxisFormField.equals("-1")) + rdef.setDrillYAxisFormField(yAxisFormField); + if(!seriesAxisFormField.equals("-1")) + rdef.setDrillSeriesFormField(seriesAxisFormField); + } else { + rdef.setDrillXAxisFormField(""); + rdef.setDrillYAxisFormField(""); + rdef.setDrillSeriesFormField(""); + } + } + + } + } + + for (int i = 1; i < Math.max(valueColsCount, 1) + 1; i++) { + //debugLogger.debug("********** " + chartSeries); + if(i==1) { + /* Range Axis is resetted before adding */ + for (Iterator iterator = columns.iterator(); iterator.hasNext();) { + DataColumnType dct = (DataColumnType) iterator.next(); + if(!nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND)) { + dct.setChartSeq(-1); + dct.setChartColor(null); + dct.setColOnChart(null); + dct.setCreateInNewChart(false); + dct.setChartGroup(null); + dct.setYAxis(null); + } + } + + } + String newChartColAxis = AppUtils.getRequestNvlValue(request, "newChart" + i+"Axis"); + String valueColId = AppUtils.getRequestNvlValue(request, "valueCol" + i); + String valueColColor = AppUtils.getRequestNvlValue(request, "valueCol" + i + + "Color"); + String valueColAxis = AppUtils + .getRequestNvlValue(request, "valueCol" + valueColId + "Axis"); + String chartGroup = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "chartGroup" + valueColId + "Axis")); + String yAxisGroup = ""; + yAxisGroup = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "YAxisLabel" + valueColId)); + //debugLogger.debug("^^^^^^^^^^^^^^^^^Chart Group " + chartGroup); + //if(chartType.equals(AppConstants.GT_TIME_SERIES)) { + // debugLogger.debug("**********Outer If " + chartSeries); + //} + + if (valueColId.length() > 0 && (!valueColId.equals(removeColId))) { + DataColumnType dct = rdef.getColumnById(valueColId); + dct.setChartSeq(idx++); + dct.setChartColor(valueColColor); + dct.setColOnChart(valueColAxis.equals("Y") ? "1" : "0"); + if(chartType.equals(AppConstants.GT_TIME_SERIES)) { + dct.setCreateInNewChart(newChartColAxis.equals("Y") ? true : false); + } else + dct.setCreateInNewChart(false); + + if(chartGroup!=null && chartGroup.length()>0) + dct.setChartGroup(chartGroup+"|"+valueColId); + else dct.setChartGroup(""); + if(chartType.equals(AppConstants.GT_TIME_SERIES)) + dct.setYAxis(nvl(yAxisGroup)+"|"+valueColId); + else if (chartType.equals(AppConstants.GT_BAR_3D)) + dct.setYAxis(nvl(yAxisGroup)+"|"+valueColId); + else dct.setYAxis(""); + //} + //else + //dct.setCreateInNewChart(false); + } else if (valueColId.length() > 0 && (valueColId.equals(removeColId))) {// if + DataColumnType dct = rdef.getColumnById(valueColId); + dct.setChartSeq(-1); + dct.setChartColor(null); + dct.setColOnChart(null); + dct.setCreateInNewChart(false); + dct.setChartGroup(null); + dct.setYAxis(null); + } else { // else + DataColumnType dct = rdef.getColumnById(valueColId); + dct.setChartSeq(-1); + dct.setChartColor(null); + dct.setColOnChart(null); + dct.setCreateInNewChart(false); + dct.setChartGroup(null); + dct.setYAxis(null); + } + } // for + + if (action.equals(AppConstants.WA_ADD_USER)) { + String valueColId = AppUtils.getRequestNvlValue(request, "valueColNew"); + String valueColColor = AppUtils.getRequestNvlValue(request, "valueColNewColor"); + String valueColAxis = AppUtils.getRequestNvlValue(request, "valueColNewAxis"); + + if (valueColId.length() > 0) { + DataColumnType dct = rdef.getColumnById(valueColId); + dct.setChartSeq(idx++); + dct.setChartColor(valueColColor); + dct.setColOnChart(valueColAxis.equals("Y") ? "1" : "0"); + } // if + } // for + + return true; // reportUpdated; + } // processChart + + public boolean processAdhocSchedule(HttpServletRequest request, String action) + throws Exception { + ReportSchedule reportSchedule = (ReportSchedule) request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE); + reportSchedule.setScheduleUserID(AppUtils.getUserID(request)); + reportSchedule.setSchedEnabled( + nvl(AppUtils.getRequestValue(request, "schedEnabled"), "N")); + reportSchedule.setStartDate( + AppUtils.getRequestNvlValue(request, "schedStartDate")); + reportSchedule.setEndDate( + AppUtils.getRequestNvlValue(request, "schedEndDate")); + reportSchedule.setEndHour(AppUtils.getRequestNvlValue(request, "schedEndHour")); + reportSchedule.setEndMin(AppUtils.getRequestNvlValue(request, "schedEndMin")); + reportSchedule.setEndAMPM(AppUtils.getRequestNvlValue(request, "schedEndAMPM")); + //schedRunDate + reportSchedule.setRunDate( + AppUtils.getRequestNvlValue(request, "schedRunDate").length()>0?AppUtils.getRequestNvlValue(request, "schedRunDate"):AppUtils.getRequestNvlValue(request, "schedStartDate")); + reportSchedule.setRunHour(AppUtils.getRequestNvlValue(request, "schedHour")); + reportSchedule.setRunMin(AppUtils.getRequestNvlValue(request, "schedMin")); + reportSchedule.setRunAMPM(AppUtils.getRequestNvlValue(request, "schedAMPM")); + reportSchedule.setRecurrence( + AppUtils.getRequestNvlValue(request, "schedRecurrence")); + reportSchedule.setConditional( + nvl(AppUtils.getRequestValue(request, "conditional"), "N")); + reportSchedule.setConditionSQL( + AppUtils.getRequestNvlValue(request, "conditionSQL")); + reportSchedule.setNotify_type( + AppUtils.getRequestNvlValue(request, "notify_type")); + reportSchedule.setDownloadLimit( + AppUtils.getRequestNvlValue(request, "downloadLimit")); + reportSchedule.setFormFields( + AppUtils.getRequestNvlValue(request, "formFields")); + reportSchedule.setAttachmentMode( + AppUtils.getRequestNvlValue(request, "sendAttachment")); + + String userId = AppUtils.getRequestNvlValue(request, "schedEmailAdd"); + String roleId = AppUtils.getRequestNvlValue(request, "schedEmailAddRole"); + int flag = 0; + if ((!(userId.length()>0 || roleId.length()>0) && (reportSchedule.getEmailToUsers().isEmpty() && reportSchedule.getEmailToRoles().isEmpty())) ) { + flag = 1; + } + + if (flag == 1 || (action.equals(AppConstants.WA_ADD_USER) || action.equals(AppConstants.WA_ADD_ROLE)) ) { + String loggedInUserId = AppUtils.getUserID(request); + if (Globals.getUseLoginIdInSchedYN().equals("Y")){ + reportSchedule.addEmailToUser(loggedInUserId, AppUtils.getUserLoginId(request)); + } else + reportSchedule.addEmailToUser(loggedInUserId, (AppUtils.getUserName(loggedInUserId).length()>0?AppUtils.getUserName(loggedInUserId):(AppUtils.getUserLoginId(loggedInUserId).length()>0?AppUtils.getUserLoginId(loggedInUserId):loggedInUserId) )); + } + if (action.equals(AppConstants.WA_ADD_USER)) { + //String userId = AppUtils.getRequestNvlValue(request, "schedEmailAdd"); + String userName = AppUtils.getUserName(userId); + if (Globals.getUseLoginIdInSchedYN().equals("Y")){ + String userLoginId = AppUtils.getUserLoginId(userId); + if (userId.length() > 0 && (userLoginId != null && userLoginId.length() > 0)) + reportSchedule.addEmailToUser(userId, userLoginId); + else { + if (userId.length() > 0 && (userName != null && userName.length() > 0) ) + reportSchedule.addEmailToUser(userId, userName); + else { + reportSchedule.addEmailToUser(userId, userId); + } + } + }else{ + if (userId.length() > 0 && (userName != null && userName.length() > 0) ) + reportSchedule.addEmailToUser(userId, userName); + else { + reportSchedule.addEmailToUser(userId, userId); + } + } + + } else if (action.equals(AppConstants.WA_DELETE_USER)) + reportSchedule.removeEmailToUser( + AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID)); + else if (action.equals(AppConstants.WA_ADD_ROLE)) { + //String roleId = AppUtils.getRequestNvlValue(request, "schedEmailAddRole"); + String roleName = AppUtils.getRoleName(roleId); + if (roleId.length() > 0 && roleName != null) + reportSchedule.addEmailToRole(roleId, roleName); + } else if (action.equals(AppConstants.WA_DELETE_ROLE)) + reportSchedule.removeEmailToRole( + AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID)); + request.getSession().setAttribute(AppConstants.SI_REPORT_SCHEDULE, reportSchedule); + return true; + } // processAdhocSchedule + + private boolean processSchedule(HttpServletRequest request, String action) + throws Exception { + // Added for form field chaining in schedule tab so that setParamValues() is called + request.setAttribute(AppConstants.SCHEDULE_ACTION, "Y"); + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + ReportSchedule reportSchedule = rdef.getReportSchedule(); + reportSchedule.setScheduleUserID(AppUtils.getUserID(request)); + reportSchedule.setSchedEnabled( + nvl(AppUtils.getRequestValue(request, "schedEnabled"), "N")); + reportSchedule.setStartDate( + AppUtils.getRequestNvlValue(request, "schedStartDate")); + reportSchedule.setEndDate( + AppUtils.getRequestNvlValue(request, "schedEndDate")); + reportSchedule.setEndHour(AppUtils.getRequestNvlValue(request, "schedEndHour")); + reportSchedule.setEndMin(AppUtils.getRequestNvlValue(request, "schedEndMin")); + reportSchedule.setEndAMPM(AppUtils.getRequestNvlValue(request, "schedEndAMPM")); + //schedRunDate + reportSchedule.setRunDate( + AppUtils.getRequestNvlValue(request, "schedRunDate").length()>0?AppUtils.getRequestNvlValue(request, "schedRunDate"):AppUtils.getRequestNvlValue(request, "schedStartDate")); + reportSchedule.setRunHour(AppUtils.getRequestNvlValue(request, "schedHour")); + reportSchedule.setRunMin(AppUtils.getRequestNvlValue(request, "schedMin")); + reportSchedule.setRunAMPM(AppUtils.getRequestNvlValue(request, "schedAMPM")); + reportSchedule.setRecurrence( + AppUtils.getRequestNvlValue(request, "schedRecurrence")); + reportSchedule.setConditional( + nvl(AppUtils.getRequestValue(request, "conditional"), "N")); + reportSchedule.setConditionSQL( + AppUtils.getRequestNvlValue(request, "conditionSQL")); + reportSchedule.setNotify_type( + AppUtils.getRequestNvlValue(request, "notify_type")); + reportSchedule.setDownloadLimit( + AppUtils.getRequestNvlValue(request, "downloadLimit")); + reportSchedule.setFormFields( + AppUtils.getRequestNvlValue(request, "formFields")); + reportSchedule.setAttachmentMode( + AppUtils.getRequestNvlValue(request, "sendAttachment")); + + reportSchedule.setEncryptMode( + AppUtils.getRequestNvlValue(request, "encryptMode")); + if (action.equals(AppConstants.WA_ADD_USER)) { + String userId = AppUtils.getRequestNvlValue(request, "schedEmailAdd"); + String userName = AppUtils.getUserName(userId); + if (Globals.getUseLoginIdInSchedYN().equals("Y")){ + String userLoginId = AppUtils.getUserLoginId(userId); + if (userId.length() > 0 && (userLoginId != null && userLoginId.length() > 0)) + reportSchedule.addEmailToUser(userId, userLoginId); + else { + if (userId.length() > 0 && (userName != null && userName.length() > 0) ) + reportSchedule.addEmailToUser(userId, userName); + else { + reportSchedule.addEmailToUser(userId, userId); + } + } + }else{ + if (userId.length() > 0 && (userName != null && userName.length() > 0) ) + reportSchedule.addEmailToUser(userId, userName); + else { + reportSchedule.addEmailToUser(userId, userId); + } + } + } else if (action.equals(AppConstants.WA_DELETE_USER)) + reportSchedule.removeEmailToUser( + AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID)); + else if (action.equals(AppConstants.WA_ADD_ROLE)) { + String roleId = AppUtils.getRequestNvlValue(request, "schedEmailAddRole"); + String roleName = AppUtils.getRoleName(roleId); + if (roleId.length() > 0 && roleName != null) + reportSchedule.addEmailToRole(roleId, roleName); + } else if (action.equals(AppConstants.WA_DELETE_ROLE)) + reportSchedule.removeEmailToRole( + AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID)); + + return true; + } // processSchedule + + private boolean processUserAccess(HttpServletRequest request, String action) + throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + String ownerID = AppUtils.getRequestNvlValue(request, "reportOwner"); + String rPublic = nvl(AppUtils.getRequestValue(request, "public"), "N"); + + boolean reportUpdated = (!(ownerID.equals(nvl(rdef.getOwnerID())) && rPublic + .equals(rdef.isPublic() ? "Y" : "N"))); + + rdef.getReportSecurity().setOwnerID(ownerID); + rdef.setPublic(rPublic.equals("Y")); + + if (action.equals(AppConstants.WA_ADD_USER)) + rdef.getReportSecurity().addUserAccess( + AppUtils.getRequestNvlValue(request, "newUserId"), "Y"); + else if (action.equals(AppConstants.WA_DELETE_USER)) + rdef.getReportSecurity().removeUserAccess( + AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID)); + else if (action.equals(AppConstants.WA_GRANT_USER)) + rdef.getReportSecurity().updateUserAccess( + AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID), "N"); + else if (action.equals(AppConstants.WA_REVOKE_USER)) + rdef.getReportSecurity().updateUserAccess( + AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID), "Y"); + else if (action.equals(AppConstants.WA_ADD_ROLE)) + rdef.getReportSecurity().addRoleAccess( + AppUtils.getRequestNvlValue(request, "newRoleId"), "Y"); + else if (action.equals(AppConstants.WA_DELETE_ROLE)) + rdef.getReportSecurity().removeRoleAccess( + AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID)); + else if (action.equals(AppConstants.WA_GRANT_ROLE)) + rdef.getReportSecurity().updateRoleAccess( + AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID), "N"); + else if (action.equals(AppConstants.WA_REVOKE_ROLE)) + rdef.getReportSecurity().updateRoleAccess( + AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID), "Y"); + + return reportUpdated; + } // processUserAccess + + private boolean processClearLog(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + String user_id = AppUtils.getUserID(request); + // Modified so that only the logged in user entries are erased. - Sundar + ReportLoader.clearReportLogEntries(rdef.getReportID(), user_id); + return false; + } // processClearLog + + private boolean processValidateSQL(HttpServletRequest request) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + String sql = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportSQL")); + request.setAttribute("sqlValidated", "N"); + rdef.parseReportSQL(sql); + request.setAttribute("sqlValidated", "Y"); + + return true; + } // processValidateSQL + + + /*****For Report Maps - Start******/ + private boolean processMap(HttpServletRequest request, String action) throws Exception { + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + + org.openecomp.portalsdk.analytics.xmlobj.ReportMap repMap = rdef.getReportMap(); + //clearing already added + if (repMap != null){ + repMap.getMarkers().removeAll(repMap.getMarkers()); + } + String addressColumn = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "addressColumn0")); + System.out.println(" #$%#$%#$% -- address col = " + addressColumn); + String dataColumn = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "dataColumn0")); + String legendColumn = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "legendColumn")); + //String legendDisplayName = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "dataHeaderL")); + //if(nvl(legendDisplayName).length()<=0) legendDisplayName = legendColumn; + String color = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "markerColor0")); + String isMapAllowed = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "isMapAllowed")); + String useDefaultSize = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "useDefaultSize")); + String height = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "height")); + String width = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "width")); + System.out.println(" #$%#$%#$% -- useDefaultSize="+ useDefaultSize+" height = " + height+" width="+width); + + String addAddress = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "addAddress")); + String latCol = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "latColumn")); + String longCol = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "longColumn")); + String colorCol = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "colorColumn")); + if (isMapAllowed.equals("")) + isMapAllowed = "N"; + if (useDefaultSize.equals("")) + useDefaultSize = "N"; + if (repMap == null) + rdef.setReportMap(new ObjectFactory().createReportMap()); + repMap.setAddressColumn(addressColumn); + repMap.setDataColumn(dataColumn); + repMap.setIsMapAllowedYN(isMapAllowed); + repMap.setUseDefaultSize(useDefaultSize); + repMap.setMarkerColor(color); + repMap.setAddAddressInDataYN(addAddress); + repMap.setLatColumn(latCol); + repMap.setLongColumn(longCol); + repMap.setColorColumn(colorCol); + repMap.setHeight(height.trim()); + repMap.setWidth(width.trim()); + repMap.setLegendColumn(legendColumn); + //repMap.setLegendDisplayName(legendDisplayName); + + Marker m = new ObjectFactory().createMarker(); + m.setAddressColumn(addressColumn); + m.setDataColumn(dataColumn); + repMap.getMarkers().add(m); + String markerCountString = AppUtils.getRequestNvlValue(request, "markerCount"); + int markerCount = 0; + if (markerCountString != null && markerCountString.equals("") == false){ + markerCount = new Integer(markerCountString).intValue(); + } + for (int i = 1; i < markerCount; i ++){ + String additionalAddressColumn = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "addressColumn" + i)); + String additionalDataHeader = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "dataHeader" + i)); + String additionalData = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "dataColumn" + i)); + String additionalColor = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "markerColor" + i)); + if (additionalAddressColumn.equals("1") == false){ + m = new ObjectFactory().createMarker(); + m.setAddressColumn(additionalAddressColumn); + m.setDataHeader(additionalDataHeader); + m.setDataColumn(additionalData); + m.setMarkerColor(additionalColor); + repMap.getMarkers().add(m); + } + } + return true; + } // processMap + /*****For Report Maps - End******/ + + +} // WizardProcessor diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequence.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequence.java new file mode 100644 index 0000000..3a84387 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequence.java @@ -0,0 +1,189 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.controller; + +import java.util.Vector; + +import org.openecomp.portalsdk.analytics.model.definition.ReportDefinition; +import org.openecomp.portalsdk.analytics.util.AppConstants; + +public class WizardSequence extends Vector { + // private String currentStep = AppConstants.WS_DEFINITION; + private int currentStepIdx = 0; + + private String currentSubStep = ""; + + private int nextElemIdx = 0; + + public void resetNext() { + resetNext(0); + } // resetNext + + public void resetNext(int toPos) { + nextElemIdx = toPos; + } // resetNext + + public boolean hasNext() { + return (nextElemIdx < size()); + } // hasNext + + public String getNext() { + return hasNext() ? getStep(nextElemIdx++) : null; + } // getNext + + // ***************************************************** + + public WizardSequence() { + add(AppConstants.WS_DEFINITION); + } // WizardSequence + + private String getStep(int index) { + return (String) get(index); + } // getStep + + private int getStepIndex(String step) { + for (int i = 0; i < size(); i++) + if (getStep(i).equals(step)) + return i; + + throw new IndexOutOfBoundsException(); + } // getStepIndex + + /* + * private String getInitialStep() { return getStep(0); } // getInitialStep + * + * private String getFinalStep() { return getStep(getStepCount()-1); } // + * getFinalStep + */ + private boolean isInitialStep(int index) { + return (index == 0); + } // isInitialStep + + /* + * private boolean isInitialStep(String step) { return + * isInitialStep(getStepIndex(step)); } // isInitialStep + */ + private boolean isFinalStep(int index) { + if (index == 0) + return false; + + return (index == (getStepCount() - 1)); + } // isFinalStep + + /* + * private boolean isFinalStep(String step) { return + * isFinalStep(getStepIndex(step)); } // isFinalStep + */ + + private int getNextStepIndex(int index) { + return (index == (getStepCount() - 1)) ? index : (index + 1); + } // getNextStep + + /* + * private String getNextStep(String step) { return + * getStep(getNextStepIndex(getStepIndex(step))); } // getNextStep + * + * private String getNextStep(String step, String subStep) { + * if(subStep.length()>0) return step; + * + * return getNextStep(step); } // getNextStep + */ + private int getPrevStepIndex(int index) { + return (index == 0) ? index : (index - 1); + } // getPrevStepIndex + + /* + * private String getPrevStep(String step) { return + * getStep(getPrevStepIndex(getStepIndex(step))); } // getPrevStep + * + * private String getPrevStep(String step, String subStep) { + * if(subStep.length()>0) return step; + * + * return getPrevStep(step); } // getPrevStep + */ + // ***************************************************** + public int getStepCount() { + return size(); + } // getStepCount + + public int getCurrentStepIndex() { + return currentStepIdx + 1; + } // getCurrentStepIndex + + public String getCurrentStep() { + return getStep(currentStepIdx); + } // getCurrentStep + + public String getCurrentSubStep() { + return currentSubStep; + } // getCurrentSubStep + + public boolean isInitialStep() { + return isInitialStep(currentStepIdx); + } // isInitialStep + + public boolean isFinalStep() { + return isFinalStep(currentStepIdx); + } // isFinalStep + + public void performAction(String action, ReportDefinition rdef) { + if (action.equals(AppConstants.WA_BACK)) + if (currentSubStep.length() > 0) + currentSubStep = ""; + else + currentStepIdx = getPrevStepIndex(currentStepIdx); + else if (action.equals(AppConstants.WA_NEXT)) { + if (currentSubStep.length() > 0) + currentSubStep = ""; + else { + currentStepIdx = getNextStepIndex(currentStepIdx); + if (rdef != null) + if (!rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED)) + if (getCurrentStep().equals(AppConstants.WS_TABLES) + && (rdef.getDataSourceList().getDataSource().size() == 0)) + currentSubStep = AppConstants.WSS_ADD; + else if (getCurrentStep().equals(AppConstants.WS_COLUMNS) + && (rdef.getAllColumns().size() == 0)) + currentSubStep = (rdef.getReportType().equals( + AppConstants.RT_CROSSTAB) ? AppConstants.WSS_ADD + : AppConstants.WSS_ADD_MULTI); + } + } else if (action.equals(AppConstants.WA_EDIT) || action.equals(AppConstants.WA_ADD) + || action.equals(AppConstants.WA_ADD_MULTI) + || action.equals(AppConstants.WA_ORDER_ALL)|| action.equals(AppConstants.WSS_ADD_BLANK) || action.equals(AppConstants.WA_MODIFY)) { + currentSubStep = action; + } + else if (currentSubStep.equals(AppConstants.WSS_ADD) + || currentSubStep.equals(AppConstants.WSS_EDIT)) + currentSubStep = AppConstants.WSS_EDIT; + else + currentSubStep = ""; + } // performAction + + public void performGoToStep(String step) { + int stepIdx = getStepIndex(step); + + if (stepIdx >= 0 && stepIdx < getStepCount()) { + currentStepIdx = stepIdx; + currentSubStep = ""; + } + } // performGoToStep + +} // WizardSequence diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceCrossTab.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceCrossTab.java new file mode 100644 index 0000000..2f16dcc --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceCrossTab.java @@ -0,0 +1,43 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.controller; + +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; + +public class WizardSequenceCrossTab extends WizardSequence { + + public WizardSequenceCrossTab(boolean userIsAuthorizedToSeeLog) { + super(); + + add(AppConstants.WS_TABLES); + add(AppConstants.WS_COLUMNS); + add(AppConstants.WS_FORM_FIELDS); + add(AppConstants.WS_FILTERS); + add(AppConstants.WS_JAVASCRIPT); + add(AppConstants.WS_USER_ACCESS); + //add(AppConstants.WS_SCHEDULE); + if (userIsAuthorizedToSeeLog) + if (Globals.getEnableReportLog()) + add(AppConstants.WS_REPORT_LOG); + add(AppConstants.WS_RUN); + } // WizardSequenceCrossTab + +} // WizardSequenceCrossTab diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceDashboard.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceDashboard.java new file mode 100644 index 0000000..d883e27 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceDashboard.java @@ -0,0 +1,38 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.controller; + +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; + +public class WizardSequenceDashboard extends WizardSequence { + + public WizardSequenceDashboard(boolean userIsAuthorizedToSeeLog) { + super(); + + add(AppConstants.WS_USER_ACCESS); + //add(AppConstants.WS_SCHEDULE); + if (userIsAuthorizedToSeeLog) + if (Globals.getEnableReportLog()) + add(AppConstants.WS_REPORT_LOG); + add(AppConstants.WS_RUN); + } // WizardSequenceDashboard + +} // WizardSequenceDashboard diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceLinear.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceLinear.java new file mode 100644 index 0000000..1ae4e8a --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceLinear.java @@ -0,0 +1,45 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.controller; + +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; + +public class WizardSequenceLinear extends WizardSequence { + + public WizardSequenceLinear(boolean userIsAuthorizedToSeeLog) { + super(); + + add(AppConstants.WS_TABLES); + add(AppConstants.WS_COLUMNS); + add(AppConstants.WS_FORM_FIELDS); + add(AppConstants.WS_FILTERS); + add(AppConstants.WS_SORTING); + //add(AppConstants.WS_JAVASCRIPT); + //add(AppConstants.WS_CHART); + add(AppConstants.WS_USER_ACCESS); + //add(AppConstants.WS_SCHEDULE); + if (userIsAuthorizedToSeeLog) + if (Globals.getEnableReportLog()) + add(AppConstants.WS_REPORT_LOG); + add(AppConstants.WS_RUN); + } // WizardSequenceLinear + +} // WizardSequenceLinear diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedCrossTab.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedCrossTab.java new file mode 100644 index 0000000..663c30c --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedCrossTab.java @@ -0,0 +1,42 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.controller; + +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; + +public class WizardSequenceSQLBasedCrossTab extends WizardSequence { + + public WizardSequenceSQLBasedCrossTab(boolean userIsAuthorizedToSeeLog) { + super(); + + add(AppConstants.WS_SQL); + add(AppConstants.WS_COLUMNS); + add(AppConstants.WS_FORM_FIELDS); + add(AppConstants.WS_JAVASCRIPT); + add(AppConstants.WS_USER_ACCESS); + //add(AppConstants.WS_SCHEDULE); + if (userIsAuthorizedToSeeLog) + if (Globals.getEnableReportLog()) + add(AppConstants.WS_REPORT_LOG); + add(AppConstants.WS_RUN); + } // WizardSequenceSQLBasedCrossTab + +} // WizardSequenceSQLBasedCrossTab diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedHive.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedHive.java new file mode 100644 index 0000000..7799638 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedHive.java @@ -0,0 +1,44 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.controller; + +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; + +public class WizardSequenceSQLBasedHive extends WizardSequence { + + public WizardSequenceSQLBasedHive(boolean userIsAuthorizedToSeeLog) { + super(); + + add(AppConstants.WS_SQL); + add(AppConstants.WS_COLUMNS); + add(AppConstants.WS_FORM_FIELDS); + add(AppConstants.WS_JAVASCRIPT); + add(AppConstants.WS_CHART); + add(AppConstants.WS_USER_ACCESS); + //add(AppConstants.WS_MAP); + //add(AppConstants.WS_SCHEDULE); + if (userIsAuthorizedToSeeLog) + if (Globals.getEnableReportLog()) + add(AppConstants.WS_REPORT_LOG); + add(AppConstants.WS_RUN); + } // WizardSequenceSQLBasedHive + +} // WizardSequenceSQLBasedHive diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinear.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinear.java new file mode 100644 index 0000000..eb90d3d --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinear.java @@ -0,0 +1,45 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.controller; + +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; + +public class WizardSequenceSQLBasedLinear extends WizardSequence { + + public WizardSequenceSQLBasedLinear(boolean userIsAuthorizedToSeeLog) { + super(); + + add(AppConstants.WS_SQL); + add(AppConstants.WS_COLUMNS); + add(AppConstants.WS_FORM_FIELDS); + //add(AppConstants.WS_JAVASCRIPT); + //if(!Globals.showAnimatedChartOnly()) + //add(AppConstants.WS_CHART); + add(AppConstants.WS_USER_ACCESS); + //add(AppConstants.WS_MAP); + //add(AppConstants.WS_SCHEDULE); + if (userIsAuthorizedToSeeLog) + if (Globals.getEnableReportLog()) + add(AppConstants.WS_REPORT_LOG); + add(AppConstants.WS_RUN); + } // WizardSequenceSQLBasedLinear + +} // WizardSequenceSQLBasedLinear diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinearDatamining.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinearDatamining.java new file mode 100644 index 0000000..e43bf28 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinearDatamining.java @@ -0,0 +1,44 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.controller; + +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; + +public class WizardSequenceSQLBasedLinearDatamining extends WizardSequence { + + public WizardSequenceSQLBasedLinearDatamining(boolean userIsAuthorizedToSeeLog) { + super(); + + add(AppConstants.WS_SQL); + add(AppConstants.WS_COLUMNS); + add(AppConstants.WS_FORM_FIELDS); + add(AppConstants.WS_DATA_FORECASTING); + add(AppConstants.WS_JAVASCRIPT); + add(AppConstants.WS_CHART); + add(AppConstants.WS_USER_ACCESS); + //add(AppConstants.WS_SCHEDULE); + if (userIsAuthorizedToSeeLog) + if (Globals.getEnableReportLog()) + add(AppConstants.WS_REPORT_LOG); + add(AppConstants.WS_RUN); + } // WizardSequenceSQLBasedLinear + +} // WizardSequenceSQLBasedLinear diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorException.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorException.java new file mode 100644 index 0000000..f0de41f --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorException.java @@ -0,0 +1,35 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.error; + +public class RaptorException extends Exception { + + public RaptorException(String message) { + super(message); + } + + public RaptorException(String message, Throwable ex) { + super(message, ex); + } + + public RaptorException(Throwable ex) { + super(ex); + } +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorRuntimeException.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorRuntimeException.java new file mode 100644 index 0000000..98938f4 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorRuntimeException.java @@ -0,0 +1,36 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.error; + +public class RaptorRuntimeException extends RaptorException { + + public RaptorRuntimeException (String message) { + super(message); + } + + public RaptorRuntimeException (String message, Throwable ex) { + super(message, ex); + } + + public RaptorRuntimeException (Throwable ex) { + super(ex); + } + +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorSchedularException.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorSchedularException.java new file mode 100644 index 0000000..3339ba5 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/RaptorSchedularException.java @@ -0,0 +1,36 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.error; + +public class RaptorSchedularException extends RaptorException { + + public RaptorSchedularException (String message) { + super(message); + } + + public RaptorSchedularException (String message, Throwable ex) { + super(message, ex); + } + + public RaptorSchedularException (Throwable ex) { + super(ex); + } + +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/ReportSQLException.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/ReportSQLException.java new file mode 100644 index 0000000..f78810e --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/ReportSQLException.java @@ -0,0 +1,51 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.error; + +public class ReportSQLException extends RaptorException { + private String reportSQL = null; + + public ReportSQLException(String message, String reportSQL) { + super(message); + + this.reportSQL = reportSQL; + } // ReportSQLException + + public ReportSQLException(String message, String reportSQL, Throwable ex) { + super(message, ex); + + this.reportSQL = reportSQL; + } // ReportSQLException + + public ReportSQLException(String message) { + super(message); + this.reportSQL = ""; + } // ReportSQLException + + public ReportSQLException(String message, Throwable ex) { + super(message, ex); + this.reportSQL = ""; + } // ReportSQLException + + public String getReportSQL() { + return reportSQL; + } // getReportSQL + +} // ReportSQLException diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/UserAccessException.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/UserAccessException.java new file mode 100644 index 0000000..ed88f5f --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/UserAccessException.java @@ -0,0 +1,34 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.error; + +public class UserAccessException extends RaptorRuntimeException { + + public UserAccessException(Throwable ex) { + super(ex); + } // UserAccessException + + public UserAccessException(String reportID, String userName, String accessType) { + //super("User " + userName + " does NOT have " + accessType + " permission for report " + // + reportID); + super("Access denied. Please contact Administrator"); + } // UserAccessException + +} // UserAccessException diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/UserDefinedException.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/UserDefinedException.java new file mode 100644 index 0000000..31476bf --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/UserDefinedException.java @@ -0,0 +1,35 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +/** + * + */ +package org.openecomp.portalsdk.analytics.error; + +/** + * This class is exclusively used to print error messages to user. + * + */ +public class UserDefinedException extends RaptorRuntimeException { + + public UserDefinedException(String message) { + super(message); + } + +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/ValidationException.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/ValidationException.java new file mode 100644 index 0000000..ee26abd --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/error/ValidationException.java @@ -0,0 +1,42 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.error; + +public class ValidationException extends RaptorRuntimeException { + private String fieldID = null; + + public ValidationException(String message) { + super(message); + } + + public ValidationException(String message, Throwable ex) { + super(message, ex); + } + + public ValidationException(String fieldID, String message) { + super(message); + this.fieldID = fieldID; + } + + public String getFieldID() { + return fieldID; + } + +} // ValidationException diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/Line.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/Line.java new file mode 100644 index 0000000..0044560 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/Line.java @@ -0,0 +1,86 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.gmap.line; + +import java.awt.geom.Point2D; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; + +import org.openecomp.portalsdk.analytics.gmap.map.NovaMap; + +public class Line { + private NovaMap map; + private LineCollection lineCollection; + private ArrayList selectionList; + private Set lineIDSet; + + public Line(NovaMap map) { + this.map = map; + lineCollection = new LineCollection(); + lineIDSet = new HashSet(); + selectionList = new ArrayList(); + } + + public ArrayList lineExist(Point2D screenPoint) { + ArrayList existLineInfo = null; + String selectedLine = null; + String selectedType = null; + int nearest = -1; + int nodeSize = map.getShapeWidth(); + nodeSize = nodeSize > 20 ? 20 : nodeSize; + int x0 = (int) screenPoint.getX(); + int y0 = (int) screenPoint.getY(); + + ArrayList lineInfos = lineCollection.getLineCollection(); + + for (LineInfo lineInfo : lineInfos) { + Point2D point1 = map.getScreenPointFromLonLat(lineInfo.geoCoordinate1.longitude, lineInfo.geoCoordinate1.latitude); + Point2D point2 = map.getScreenPointFromLonLat(lineInfo.geoCoordinate2.longitude, lineInfo.geoCoordinate2.latitude); + int x1 = (int) point1.getX(); + int y1 = (int) point1.getY(); + int x2 = (int) point2.getX(); + int y2 = (int) point2.getY(); + int diff = Math.abs((x0 - x1) * (y0 - y2) - (x0 - x2) * (y0 - y1)); + + if (((x1 - x0) * (x2 - x0) <= (nodeSize * 2)) && ((y1 - y0) * (y2 - y0) <= (nodeSize * 2)) && + diff < (Math.abs(y1 - y2) + Math.abs(x1 - x2)) * (int) (nodeSize * .2)) { + if (nearest == -1) { + nearest = diff; + selectedLine = lineInfo.getLineID(); + selectedType = lineInfo.getLineType(); + } + else if (diff <= nearest) { + nearest = diff; + selectedLine = lineInfo.getLineID(); + selectedType = lineInfo.getLineType(); + } + + if (existLineInfo == null) { + existLineInfo = new ArrayList(); + } + + existLineInfo.add(lineInfo); + } + } + + return existLineInfo; + } +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/LineCollection.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/LineCollection.java new file mode 100644 index 0000000..249b277 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/LineCollection.java @@ -0,0 +1,158 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.gmap.line; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; + +public class LineCollection { + private Set selectedLine; // all selected node + private String lineID; // last clicked node + private ArrayList lineCollection; + + public LineCollection() { + lineCollection = new ArrayList(20000); + selectedLine = new HashSet(); + } + + public void addSelectedLine(String lineID) { + selectedLine.add(lineID); + } + + public void removeSelectedLine(String lineID) { + selectedLine.remove(lineID); + } + + public Set getSelectedLine() { + return selectedLine; + } + + public boolean containSelectedLine(String lineID) { + return selectedLine.contains(lineID); + } + + public void clearSelectedLine() { + selectedLine.clear(); + } + + public void addLine(LineInfo lineInfo) { + lineCollection.add(lineInfo); + } + + public ArrayList getLineCollection() { + return lineCollection; + } + + public LineInfo getLine(String lineID) { + for (LineInfo lineInfo : lineCollection) { + if (lineInfo.getLineID().equalsIgnoreCase(lineID)) { + return lineInfo; + } + } + + return null; + } + + public LineInfo getLine(String lineID, String lineType) { + for (LineInfo lineInfo : lineCollection) { + if (lineInfo.getLineID().equalsIgnoreCase(lineID) && lineInfo.getLineType().equalsIgnoreCase(lineType)) { + return lineInfo; + } + } + + return null; + } + + public LineInfo getLine(String nodeID1, String nodeID2, boolean dummy) { + for (LineInfo lineInfo : lineCollection) { + if ((lineInfo.getNodeID1().equalsIgnoreCase(nodeID1) && lineInfo.getNodeID2().equalsIgnoreCase(nodeID2)) || + (lineInfo.getNodeID1().equalsIgnoreCase(nodeID2) && lineInfo.getNodeID2().equalsIgnoreCase(nodeID1))) { + return lineInfo; + } + } + + return null; + } + + public LineInfo removeLine(String lineID) { + for (int i = 0; i < lineCollection.size(); i++) { + if (lineCollection.get(i).getLineID().equalsIgnoreCase(lineID)) { + return lineCollection.remove(i); + } + } + + removeSelectedLine(lineID); + return null; + } + + public LineInfo removeLine(String lineID, String lineType) { + for (int i = 0; i < lineCollection.size(); i++) { + if (lineCollection.get(i).getLineID().equalsIgnoreCase(lineID) && + lineCollection.get(i).getLineType().equalsIgnoreCase(lineType)) { + return lineCollection.remove(i); + } + } + + removeSelectedLine(lineID); + return null; + } + + public void clearLine() { + lineCollection.clear(); + selectedLine.clear(); + } + + public int getSize() { + return lineCollection.size(); + } + + public String getLineID() { + return lineID; + } + + public void setLineID(String lineID) { + this.lineID = lineID; + } + + public void clearAllCollection () { + clearLine(); + clearSelectedLine(); + this.lineID = null; + } + + public String[] getWildCardLine(String lineID) { + ArrayList list = new ArrayList(); + + for (LineInfo lineInfo : lineCollection) { + if (lineInfo.getLineID().toLowerCase().indexOf(lineID.toLowerCase()) != -1) { + list.add(lineInfo.getLineID()); + } + } + + String[] result = new String[list.size()]; + + for (int i = 0; i < list.size(); i++) { + result[i] = list.get(i); + } + + return result; + } +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/LineInfo.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/LineInfo.java new file mode 100644 index 0000000..fd9ec94 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/line/LineInfo.java @@ -0,0 +1,190 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.gmap.line; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openecomp.portalsdk.analytics.gmap.map.GeoCoordinate; + +public class LineInfo { + public GeoCoordinate geoCoordinate1; + public GeoCoordinate geoCoordinate2; + + private String nodeID1; + private String nodeID2; + + private String lineID; + private String lineType; + private String lineDescription; + + private boolean moveable; + private boolean deleteable; + + private int state; + + private Map lineAttributes; + + public LineInfo(String nodeID1, String nodeID2) { + this.nodeID1 = nodeID1; + this.nodeID2 = nodeID2; + lineAttributes = new HashMap(); + } + + public LineInfo clone() { + LineInfo lineInfo = new LineInfo(nodeID1, nodeID2); + lineInfo.geoCoordinate1.longitude = geoCoordinate1.longitude; + lineInfo.geoCoordinate1.latitude = geoCoordinate1.latitude; + lineInfo.geoCoordinate2.longitude = geoCoordinate2.longitude; + lineInfo.geoCoordinate2.latitude = geoCoordinate2.latitude; + lineInfo.setDescription(lineDescription); + lineInfo.setLineID(lineID); + lineInfo.setLineType(lineType); + lineInfo.setMoveable(moveable); + lineInfo.setDeleteable(deleteable); + lineInfo.setState(state); + lineInfo.initializeAttributes(lineAttributes); + + return lineInfo; + } + + public void setLineID(String lineID) { + this.lineID = lineID; + geoCoordinate1 = new GeoCoordinate(); + geoCoordinate2 = new GeoCoordinate(); + } + + public String getLineID() { + return lineID; + } + + public void setLineType(String lineType) { + this.lineType = lineType; + } + + public String getLineType() { + return lineType; + } + + public int getState() { + return state; + } + + public void setState(int state) { + this.state = state; + } + + public String getDescription() { + return lineDescription; + } + + public void setDescription(String lineDescription) { + this.lineDescription = lineDescription; + } + + public boolean isMoveable() { + return moveable; + } + + public void setMoveable(boolean moveable) { + this.moveable = moveable; + } + + public String getNodeID1() { + return nodeID1; + } + + public void setNodeID1(String nodeID1) { + this.nodeID1 = nodeID1; + } + + public String getNodeID2() { + return nodeID2; + } + + public void setNodeID2(String nodeID2) { + this.nodeID2 = nodeID2; + } + + public void initializeAttributes(Map lineAttributes) { + this.lineAttributes.clear(); + Set keySet = lineAttributes.keySet(); + Iterator iter = keySet.iterator(); + + while (iter.hasNext()) { + String key = iter.next(); + this.lineAttributes.put(key, lineAttributes.get(key)); + } + } + + public void setAttribute(String key, String value) { + lineAttributes.put(key, value); + } + + public String getAttribute(String key) { + String value = lineAttributes.get(key); + return value; + } + + public List getAttributeKeys() { + Set keySet = lineAttributes.keySet(); + List keys = new ArrayList(keySet.size()); + Iterator iter = keySet.iterator(); + + while (iter.hasNext()) { + String key = iter.next(); + + if (key.indexOf("x_") != 0) { + keys.add(key); + } + } + + return keys; + } + + public List getAttributeInternalKeys() { + Set keySet = lineAttributes.keySet(); + List internalKeys = new ArrayList(); + Iterator iter = keySet.iterator(); + + while (iter.hasNext()) { + String key = iter.next(); + + if (key.indexOf("x_") == 0) { + key = key.substring(2); + internalKeys.add(key); + } + } + + return internalKeys; + } + + public boolean isDeleteable() { + return deleteable; + } + + public void setDeleteable(boolean deleteable) { + this.deleteable = deleteable; + } +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/ColorProperties.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/ColorProperties.java new file mode 100644 index 0000000..a87af42 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/ColorProperties.java @@ -0,0 +1,119 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.gmap.map; + +import java.awt.Color; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +public class ColorProperties { + private NovaMap map; + + private Map colorProperties; + private ArrayList nodeLegends; + private ArrayList lineLegends; + + public ColorProperties(NovaMap map) { + this.map = map; + colorProperties = new HashMap(); + } + + public void setColor(String type, String color) { + //colorProperties.put(type + "_COLOR", color); + String[] rgb = color.split(","); + colorProperties.put(type + "_COLOR", + new Color(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), + Integer.parseInt(rgb[2]))); + } + +// public void setColor(String type, int number, String color) { +// Object object = colorProperties.get(type + ":" + number + "_COLOR"); +// +// if (object != null) { +// Color oldColor = (Color) object; +// +// if (!color.equals(oldColor.getRed() + "," + oldColor.getGreen() + "," + oldColor.getBlue())) { +// String[] rgb = color.split(","); +// colorProperties.put(type + ":" + number + "_COLOR", +// new Color(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), +// Integer.parseInt(rgb[2]))); +// } +// } +// else { +// String[] rgb = color.split(","); +// colorProperties.put(type + ":" + number + "_COLOR", +// new Color(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), +// Integer.parseInt(rgb[2]))); +// } +// } + +// public Color getColor(String type, int number) { +// return (Color) colorProperties.get(type + ":" + number + "_COLOR"); +// } + + public Color getColor(String type) { + return (Color) colorProperties.get(type + "_COLOR"); + } + + public void setShape(String type, String shape) { + colorProperties.put(type + "_SHAPE", shape); + } + + public void setShape(String type, int number, String shape) { + colorProperties.put(type + ":" + number + "_SHAPE", shape); + } + + public String getShape(String type) { + return (String) colorProperties.get(type + "_SHAPE"); + } + + public String getShape(String type, int number) { + return (String) colorProperties.get(type + ":" + number + "_SHAPE"); + } + + public void setSize(String type, String size) { + colorProperties.put(type + "_SIZE", size); + } + + public void setSize(String type, int number, String size) { + colorProperties.put(type + ":" + number + "_SIZE", size); + } + + public int getSize(String type) { + Object object = colorProperties.get(type + "_SIZE"); + + if (object == null) { + return 0; + } + + return Integer.parseInt(object.toString()); + } + + public int getSize(String type, int number) { + Object object = colorProperties.get(type + ":" + number + "_SIZE"); + + if (object == null) { + return 0; + } + + return Integer.parseInt(object.toString()); + } +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/GMapProperties.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/GMapProperties.java new file mode 100644 index 0000000..7c66f4b --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/GMapProperties.java @@ -0,0 +1,46 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.gmap.map; + +import org.openecomp.portalsdk.analytics.system.Globals; + +public class GMapProperties { + + public static String getProjectFolder() { + return Globals.getProjectFolder(); + } + + public static String getMarketShapefileFolder() { + return Globals.getMarketShapefileFolder(); + } + + public static String getTileSize() { + return Globals.getTileSize(); + } + + public static String getOutputFolder() { + return Globals.getOutputFolder(); + } + + public static String getTempFolderURL() { + return Globals.getTempFolderURL(); + } + +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/GeoCoordinate.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/GeoCoordinate.java new file mode 100644 index 0000000..ed3fe8b --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/GeoCoordinate.java @@ -0,0 +1,25 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.gmap.map; + +public class GeoCoordinate { + public double longitude; + public double latitude; +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/MapConstant.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/MapConstant.java new file mode 100644 index 0000000..cef1f4a --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/MapConstant.java @@ -0,0 +1,44 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.gmap.map; + +public class MapConstant { + public static final String CURSOR = "CURSOR"; + public static final String FILLED_TRIANGLE = "FILLED TRIANGLE"; + public static final String FILLED_SQUARE = "FILLED SQUARE"; + public static final String FILLED_CIRCLE = "FILLED CIRCLE"; + public static final String FILLED_DIAMOND = "FILLED DIAMOND"; + public static final String HOLLOW_TRIANGLE = "HOLLOW TRIANGLE"; + public static final String HOLLOW_SQUARE = "HOLLOW SQUARE"; + public static final String HOLLOW_CIRCLE = "HOLLOW CIRCLE"; + public static final String HOLLOW_DIAMOND = "HOLLOW DIAMOND"; + + public static int NORMAL_STATE = 1; + public static int FORCE_STATE = 2; + public static int EXCLUDE_STATE = 3; + public static int ANY_STATE = 4; + + public static int ZOOM_MIN = 1; + public static int ZOOM_MAX = 22; + + public static final double ARROW_ANGLE_HIGH = .75; + public static final double ARROW_ANGLE_LOW = .45; + public static final double ZOOMING_INDEX = .6; +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/NovaMap.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/NovaMap.java new file mode 100644 index 0000000..ba24506 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/NovaMap.java @@ -0,0 +1,504 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.gmap.map; + +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.geom.AffineTransform; +import java.awt.geom.NoninvertibleTransformException; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.HashSet; + +import javax.servlet.http.HttpServletRequest; + +import org.openecomp.portalsdk.analytics.gmap.line.Line; +import org.openecomp.portalsdk.analytics.gmap.line.LineInfo; +import org.openecomp.portalsdk.analytics.gmap.map.layer.SwingLayer; +import org.openecomp.portalsdk.analytics.gmap.node.Node; +import org.openecomp.portalsdk.analytics.gmap.node.NodeInfo; + +public class NovaMap { + private static int[] shapeWidth; + + public static final Font TEXT_FONT = new Font("sans-serif", Font.BOLD, 12); + public static final Font HEADER_FONT = new Font("sans-serif", Font.ITALIC+Font.BOLD, 12); + + private HashSet showList; + private ArrayList swingLayers; + private AffineTransform transform; + + private Node node; + private Line line; + private ColorProperties colorProperties; + + private Rectangle2D defaultBoundary; + + private int zoomLevel; + + private String currentYearMonth; + + private String dataLoaded = ""; + + /** + * size in screen pixel + */ + private Rectangle boundingBox; + + /** + * size in pixel web mercator projection + */ + private Rectangle2D mapArea; + + /** + * size in longitude latitude + */ + private Rectangle2D geoArea; + + public static double[] meter2pixel; + + private boolean showLegend = false; + + static { + initShapeWidth(); + initMeter2Pixel(); + } + + private static void initMeter2Pixel() { + meter2pixel = new double[MapConstant.ZOOM_MAX - MapConstant.ZOOM_MIN+1]; + meter2pixel[0] = 156543.04/2; + for(int i=1; i 4 && i < 10) { + width += 2; + } + else { + width++; + } + + shapeWidth[i] = width; + } + } + + public NovaMap() { + boundingBox = new Rectangle(); + mapArea = new Rectangle2D.Double(); + geoArea = new Rectangle2D.Double(); + showList = new HashSet(); + swingLayers = new ArrayList(); + } + + + + public int getBestZoomLevel(double Latitude1, double Longitude1, + double Latitude2, double Longitude2, + double height, double width) { + + if (height==0) + height=700; + if (width==0) + width=1200; + + double lat1 = Math.min(Latitude1, Latitude1); + double CosLat = Math.cos(Math.toRadians(lat1)); + double Wmeter = getDistance( + lat1, Longitude1, + lat1, Longitude2)/CosLat; + double Hmeter = getDistance( + Latitude1, Longitude1, + Latitude2, Longitude1)/CosLat; + + int zoom = 0; + if(Latitude1 == Latitude2 && Longitude1 == Longitude2) + zoom = 15; + if (zoom <= 0) { + for(; + zoom < meter2pixel.length + && (width*meter2pixel[zoom]) > Wmeter + && (height*meter2pixel[zoom]) > Hmeter; + ++zoom) ; + } + +// && (1200*meter2pixel[zoom]) > Wmeter +// && (700*meter2pixel[zoom]) > Hmeter; + + return zoom + MapConstant.ZOOM_MIN-1; + } + + public static double getDistance(double Latitude1, double Longitude1, + double Latitude2, double Longitude2) { + Latitude1 = Math.toRadians(Latitude1); + Longitude1 = Math.toRadians(Longitude1); + Latitude2 = Math.toRadians(Latitude2); + Longitude2 = Math.toRadians(Longitude2); + + final double R = 6371.0; // earth's mean radius in km + double dSinLat05 = Math.sin( (Latitude2 - Latitude1)/2 ); + double dSinLong05 = Math.sin( (Longitude2 - Longitude1)/2 ); + double a = dSinLat05 * dSinLat05 + + Math.cos(Latitude1) * Math.cos(Latitude2) * dSinLong05 * dSinLong05; + double c = (0==a || 1==a) + ? 0 + : 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1.0-a)); + return R * c * 1000.0; //in meters + } + + public Rectangle getBoundingBox() { + return boundingBox; + } + + public void setBoundingBox(int width, int height) { + boundingBox.setSize(width, height); + } + + public void setNode(Node node) { + this.node = node; + } + + public Node getNode() { + return node; + } + + public void setLine(Line line) { + this.line = line; + } + + public Line getLine() { + return line; + } + + public void setColorProperties(ColorProperties colorProperties) { + this.colorProperties = colorProperties; + } + + public ColorProperties getColorProperties() { + return colorProperties; + } + + public void setZoomLevel(int zoomLevel) { + this.zoomLevel = zoomLevel; + } + + public int getZoomLevel() { + return zoomLevel; + } + + public void addShowList(String type) { + showList.add(type.toUpperCase()); + } + + public void addShowList(String type, int number) { + showList.add(type.toUpperCase() + ":" + number); + } + + public void removeShowList(String type) { + showList.remove(type.toUpperCase()); + } + + public void removeShowList(String type, int number) { + showList.remove(type.toUpperCase() + ":" + number); + } + + public void clearShowList() { + showList.clear(); + } + + public HashSet getShowList() { + return showList; + } + + public boolean containsShowList(String type) { + return showList.contains(type.toUpperCase()); + } + + public boolean containsShowList(String type, int number) { + return showList.contains(type.toUpperCase() + ":" + number); + } + + public int getShowListSize() { + return showList.size(); + } + + public void addSwingLayer(SwingLayer swingLayer) { + swingLayers.add(swingLayer); + } + + public void removeSwingLayer(SwingLayer swingLayer) { + swingLayers.remove(swingLayer); + } + + public void clearSwingLayers() { + swingLayers.clear(); + } + + public ArrayList getSwingLayers() { + return swingLayers; + } + + public int getShapeWidth() { + return shapeWidth[getZoomLevel()>=22?21:(getZoomLevel()<=8 ? 8:getZoomLevel())]; + } + + public Point2D getPixelPos(double latitude, double longitude) { + double sinLatitude = Math.sin(Math.toRadians(latitude)); + return new Point2D.Double( + ((longitude + 180.0) / 360.0) * 256.0 * (1< existNodeInfo = node.nodeExist(screenPoint); + + if (existNodeInfo == null) { + ArrayList existLineInfo = line.lineExist(screenPoint); + + if (existLineInfo == null) { + + } + else { + System.out.println("%%%%%%map.singleLeftClick end 1"); + return existLineInfo; + } + } + else { +// if (existNodeInfo.size() == 1) { +// NodeInfo nodeInfo = existNodeInfo.get(0); +// node.getNodeCollection().clearSelectedNode(); +// node.getNodeCollection().addSelectedNode(nodeInfo.getID(), nodeInfo.getLegendID()); +// return getSelectedImage(geoArea); +// } +// else { +// return existNodeInfo; +// } + + System.out.println("%%%%%%map.singleLeftClick end 2"); + return existNodeInfo; + } + + System.out.println("%%%%%%map.singleLeftClick end 3"); + return null; + } + + public String getCurrentYearMonth() { + return currentYearMonth; + } + + public void setCurrentYearMonth(String currentYearMonth) { + this.currentYearMonth = currentYearMonth; + } + + public Rectangle2D getDefaultBoundary() { + return defaultBoundary; + } + + public void setDefaultBoundary(Rectangle2D defaultBoundary) { + this.defaultBoundary = defaultBoundary; + } + + public boolean isShowLegend() { + return showLegend; + } + + public void setShowLegend(boolean showLegend) { + this.showLegend = showLegend; + } + + public String getDataLoaded() { + return dataLoaded; + } + + public void setDataLoaded(String dataLoaded) { + this.dataLoaded = dataLoaded; + } + +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/layer/SwingLayer.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/layer/SwingLayer.java new file mode 100644 index 0000000..f5237cc --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/map/layer/SwingLayer.java @@ -0,0 +1,234 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.gmap.map.layer; + +import java.awt.Color; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.Stroke; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; + +import org.openecomp.portalsdk.analytics.gmap.map.ColorProperties; +import org.openecomp.portalsdk.analytics.gmap.map.MapConstant; +import org.openecomp.portalsdk.analytics.gmap.map.NovaMap; +import org.openecomp.portalsdk.analytics.gmap.node.Node; +import org.openecomp.portalsdk.analytics.gmap.node.NodeInfo; +import org.openecomp.portalsdk.analytics.system.Globals; + + +public class SwingLayer { + private Rectangle shape; + private NovaMap map; + + public SwingLayer(NovaMap map) { + this.map = map; + } + + public boolean paintLayer(HttpServletRequest request, Graphics2D g2d, Rectangle bounds, Rectangle2D mapArea, Graphics2D g2Legend) { + return paintNodes(request, g2d, bounds, mapArea, g2Legend); + } + + protected boolean paintNodes(HttpServletRequest request, Graphics2D g2d, Rectangle bounds, Rectangle2D mapArea, Graphics2D g2Legend) { + boolean painted = false; + Node node = map.getNode(); + ColorProperties colorProperties = map.getColorProperties(); + int legendSize = 0; + if(map.isShowLegend()) + legendSize = map.getShowListSize(); + Object showListArr[] = ((HashSet)map.getShowList()).toArray(); + HashMap hashMap = node.getNodeCollection().getNodeCollection(); + Set set = hashMap.entrySet(); + int width = map.getShapeWidth(); + ArrayList visibleLabel = new ArrayList(151); + Color oldColor = g2d.getColor(); + Stroke oldStroke = g2d.getStroke(); + int textWidth = 0; + int legendLength = 0; + for (int i = 0; i < showListArr.length; i++) { + legendLength = ((String)showListArr[i]).length(); + if(legendLength > textWidth) textWidth = legendLength; + } + Point2D point = null; + for (Iterator iterator = set.iterator(); iterator.hasNext();) { + Map.Entry entry = (Map.Entry) iterator.next(); + NodeInfo nodeInfo = (NodeInfo) entry.getValue(); + + String id1 = (String) request.getAttribute("server_process_id"); + String id2 = (String) request.getSession().getAttribute("server_process_id"); + + if (!id1.equals(id2)) { + request.setAttribute("server_process_interrupted", true); + System.out.println("swing layer interrupted"); + return false; + } + //System.out.println("%%%%%%%getImage. no of T1%%%%%%" + nodeInfo.getAttribute("x_sequence")); + + + point = map.getPixelPos(nodeInfo.geoCoordinate.latitude, nodeInfo.geoCoordinate.longitude); + + if (!mapArea.contains(point.getX(), point.getY())) { + continue; + } + + painted = true; + + g2d.setColor(colorProperties.getColor(nodeInfo.getNodeType())); + + Point2D xyPoint = map.getScreenPointFromPixel(point.getX(), point.getY()); + int width2 = (colorProperties.getSize(nodeInfo.getNodeType()) * width) / 5; + + if (shape == null) { + shape = new Rectangle((int) xyPoint.getX(), (int) xyPoint.getY(), width2, width2); + } + else { + shape.setRect((int) xyPoint.getX(), (int) xyPoint.getY(), width2, width2); + } + + if (colorProperties.getShape(nodeInfo.getNodeType())!=null && colorProperties.getShape(nodeInfo.getNodeType()).equalsIgnoreCase(MapConstant.FILLED_SQUARE)) { + g2d.fillRect((int) shape.getCenterX() - width2, (int) shape.getCenterY() - width2, width2, width2); + } + else if (colorProperties.getShape(nodeInfo.getNodeType())!=null && colorProperties.getShape(nodeInfo.getNodeType()).equalsIgnoreCase(MapConstant.HOLLOW_SQUARE)) { + g2d.drawRect((int) shape.getCenterX() - width2, (int) shape.getCenterY() - width2, width2, width2); + } + else if (colorProperties.getShape(nodeInfo.getNodeType())!=null && colorProperties.getShape(nodeInfo.getNodeType()).equalsIgnoreCase(MapConstant.FILLED_CIRCLE)) { + g2d.fillOval((int) shape.getCenterX() - width2, (int) shape.getCenterY() - width2, width2, width2); + } + else if (colorProperties.getShape(nodeInfo.getNodeType())!=null && colorProperties.getShape(nodeInfo.getNodeType()).equalsIgnoreCase(MapConstant.HOLLOW_CIRCLE)) { + g2d.drawOval((int) shape.getCenterX() - width2, (int) shape.getCenterY() - width2, width2, width2); + } + else if (colorProperties.getShape(nodeInfo.getNodeType())!=null && colorProperties.getShape(nodeInfo.getNodeType()).equalsIgnoreCase(MapConstant.FILLED_TRIANGLE)) { + int[] xPoints = {(int) shape.getX(), (int) shape.getX() - width2 / 2, (int) shape.getX() + width2 / 2}; + int[] yPoints = {(int) shape.getY() + width2 / 2, (int) shape.getY() - width2 / 2, (int) shape.getY() - width2 / 2}; + g2d.fillPolygon(xPoints, yPoints, xPoints.length); + } + else if (colorProperties.getShape(nodeInfo.getNodeType())!=null && colorProperties.getShape(nodeInfo.getNodeType()).equalsIgnoreCase(MapConstant.HOLLOW_TRIANGLE)) { + int[] xPoints = {(int) shape.getX(), (int) shape.getX() - width2 / 2, (int) shape.getX() + width2 / 2}; + int[] yPoints = {(int) shape.getY() + width2 / 2, (int) shape.getY() - width2 / 2, (int) shape.getY() - width2 / 2}; + g2d.drawPolygon(xPoints, yPoints, xPoints.length); + } + else if (colorProperties.getShape(nodeInfo.getNodeType())!=null && colorProperties.getShape(nodeInfo.getNodeType()).equalsIgnoreCase(MapConstant.FILLED_DIAMOND)) { + int[] xPoints = {(int) shape.getX() - width2 / 2, (int) shape.getX(), (int) shape.getX() + width2 / 2, (int) shape.getX()}; + int[] yPoints = {(int) shape.getY() , (int) shape.getY() - width2 / 2, (int) shape.getY(), (int) shape.getY() + width2 / 2}; + g2d.fillPolygon(xPoints, yPoints, xPoints.length); + } + else if (colorProperties.getShape(nodeInfo.getNodeType())!=null && colorProperties.getShape(nodeInfo.getNodeType()).equalsIgnoreCase(MapConstant.HOLLOW_DIAMOND)) { + int[] xPoints = {(int) shape.getX() - width2 / 2, (int) shape.getX(), (int) shape.getX() + width2 / 2, (int) shape.getX()}; + int[] yPoints = {(int) shape.getY() , (int) shape.getY() - width2 / 2, (int) shape.getY(), (int) shape.getY() + width2 / 2}; + g2d.drawPolygon(xPoints, yPoints, xPoints.length); + } else { + g2d.drawRect((int) shape.getCenterX() - width2, (int) shape.getCenterY() - width2, width2, width2); + } + + if (nodeInfo.isMoveable()) { + int fontSize = width / 2; + fontSize = fontSize > 14 ? 14 : fontSize; + fontSize = (colorProperties.getSize(nodeInfo.getNodeType()) * fontSize) / 5; + Font font = new Font("sans-serif", Font.BOLD, fontSize); + g2d.setFont(font); + g2d.setColor(Color.BLACK); + g2d.drawString("M", shape.x + width2 / 2, shape.y); + } + +// if (map.containsShowLabelList(nodeInfo.getNodeType())) { +// g2d.setColor(Color.BLACK); +// FontMetrics metrics = g2d.getFontMetrics(); +// int x = shape.x - metrics.stringWidth(nodeInfo.getID()) / 2; +// int y = shape.y + width2 * 4 / 3; +// g2d.drawString(nodeInfo.getID(), x, y); +// } + } + String legendName = ""; + int baseY = 0; + baseY = (int)(20*showListArr.length) + 20;//+5; + int baseX = 0; + if(map.isShowLegend()) { + for (int i = showListArr.length-1; i>=0; i--) { + + legendName = (String)showListArr[i]; + //for(int i = 0; i < showListArr.length; i++ ) { + if(i == showListArr.length-1){ + textWidth = (textWidth<="Legend".length())?"Legend".length():textWidth; + g2Legend.setColor(Color.WHITE); + //g2d.draw(new Rectangle2D.Double((int) bounds.getMaxX()*0.1, (int) bounds.getMaxY()*0.75*showListArr.length, (int) bounds.getMaxX()*0.75, (int) bounds.getMaxY()*0.75)); + g2Legend.fill3DRect((int)(0), (int)(0), (int) bounds.getWidth() , (int)(baseY) , true); // (int)(bounds.getMaxX()*0.9)- (int)(bounds.getMaxX()*0.25) + //if(i == 0){ + g2Legend.setColor(Color.BLACK); + g2Legend.setFont(NovaMap.HEADER_FONT); + g2Legend.drawString("Legend", (int) (10), 10); + } + int[] xPointsL = {(int) (10 - width / 2), (int) (10), (int) (10 + width/2), (int) (10)}; + int[] yPointsL = {(int) (15*i+5+20), (int) (15*i+5+20 - width / 2), (int) (15*i+5+20), (int) (15*i+5+20 + width / 2)}; + g2Legend.setColor(colorProperties.getColor( ((String)showListArr[i]).toUpperCase())); + g2Legend.fillPolygon(xPointsL, yPointsL, xPointsL.length); + g2Legend.setFont(NovaMap.TEXT_FONT); + g2Legend.setColor(Color.BLACK); + + g2Legend.drawString(legendName.substring(0, legendName.indexOf("-")), (int) (10) + width+10, (int) (15*i)+10+20); + } + } + +/* g2d.drawString("0", (int) bounds.getMaxX()/2+20 + width+10, 0); + g2d.drawString("50", (int) bounds.getMaxX()/2+20 + width+10, 50); + g2d.drawString("100", (int) bounds.getMaxX()/2+20 + width+10, 100); + g2d.drawString("200", (int) bounds.getMaxX()/2+20 + width+10, 200); + g2d.drawString("400", (int) bounds.getMaxX()/2+20 + width+10, 400); + g2d.drawString("600", (int) bounds.getMaxX()/2+20 + width+10, 600); +*/ +// g2d.setFont(NovaMap.TEXT_FONT); +// g2d.setColor(Color.BLACK); + if(nvl(map.getDataLoaded()).trim().length() > 0) { + g2d.setColor(Color.WHITE); + g2d.fill3DRect(new Double(bounds.getMinX()).intValue(), new Double(bounds.getMaxY()).intValue()-30, (int) bounds.getWidth() , (int)(30) , true); // (int)(bounds.getMaxX()*0.9)- (int)(bounds.getMaxX()*0.25) + g2d.setColor(Color.RED); + g2d.setFont(NovaMap.HEADER_FONT); + g2d.drawString(Globals.getUserDefinedMessageForMemoryLimitReached() + " "+ map.getDataLoaded()+ " were downloaded to Map.", new Double(bounds.getMinX()).intValue()+80, new Double(bounds.getMaxY()).intValue()-15); + } + + //g2d.drawString("Hello", new Double(bounds.getMinX()).intValue()+20, new Double(bounds.getMaxY()).intValue()-50); + FontMetrics metrics = g2d.getFontMetrics(); + + for (int i = 0; i < visibleLabel.size(); i++) { + String[] properties = visibleLabel.get(i).split(">>>"); + int x = Integer.parseInt(properties[1]) - metrics.stringWidth(properties[0]) / 2; + int y = Integer.parseInt(properties[2]) + Integer.parseInt(properties[3]) * 4 / 3; + g2d.drawString(properties[0], x, y); + } + + g2d.setColor(oldColor); + g2d.setStroke(oldStroke); + + return painted; + } + + private String nvl(String s) { + return (s == null) ? "" : s; + } +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/Node.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/Node.java new file mode 100644 index 0000000..a58eb45 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/Node.java @@ -0,0 +1,178 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.gmap.node; + +import java.awt.geom.Point2D; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +import org.openecomp.portalsdk.analytics.gmap.map.MapConstant; +import org.openecomp.portalsdk.analytics.gmap.map.NovaMap; + +public class Node { + private Set nodeIDSet; + private NodeCollection nodeCollection; + private ArrayList selectionList; + private NovaMap map; + + public Node(NovaMap map) { + this.map = map; + nodeCollection = new NodeCollection(); + nodeIDSet = new HashSet(); + selectionList = new ArrayList(); + } + + public NodeInfo addNode(double longitude, double latitude, String nodeType, String nodeID, + String nodeAttributes, int state, boolean moveable, boolean deleteable) { + NodeInfo nodeInfo = new NodeInfo(nodeID); + nodeInfo.geoCoordinate.longitude = longitude; + nodeInfo.geoCoordinate.latitude = latitude; + nodeInfo.setNodeType(nodeType); + nodeInfo.setState(state); + nodeInfo.setMoveable(moveable); + nodeInfo.setDeleteable(deleteable); + nodeInfo.initializeAttributes(nodeAttributes); + + //if (nodeCollection.getNode(nodeInfo.getNodeID()+""+nodeInfo.getNodeType()) == null) { + nodeCollection.addNode(nodeInfo); + nodeIDSet.add(nodeID); +/* } + else { + return nodeCollection.getNode(nodeType); + } +*/ + return nodeInfo; + } + + /** + * + */ +/* public void updateNumberT1(String currentYearMonth) { + ArrayList nodeCollection = this.nodeCollection.getNodeCollection(); + + for (NodeInfo nodeInfo : nodeCollection) { + nodeInfo.setAttribute(NodeInfo.NUMBER_OF_T1_KEY, nodeInfo.getAttribute(currentYearMonth)); + } + } +*/ +/* public Set getUniqueNumberT1(String currentYearMonth) { + ArrayList nodeCollection = this.nodeCollection.getNodeCollection(); + Set numberT1Set = new TreeSet(); + + for (NodeInfo nodeInfo : nodeCollection) { + numberT1Set.add(Integer.parseInt(nodeInfo.getAttribute(currentYearMonth).toString())); + } + + return numberT1Set; + } +*/ + public void updateNumberT1(String currentYearMonth) { + HashMap hashMap = this.nodeCollection.getNodeCollection(); + Set set = hashMap.entrySet(); + + for (Iterator iterator = set.iterator(); iterator.hasNext();) { + Map.Entry entry = (Map.Entry) iterator.next(); + NodeInfo nodeInfo = (NodeInfo) entry.getValue(); + nodeInfo.setAttribute(NodeInfo.NUMBER_OF_T1_KEY, nodeInfo.getAttribute(currentYearMonth)); + } + + } + + public Set getUniqueNumberT1(String currentYearMonth) { + HashMap hashMap = this.nodeCollection.getNodeCollection(); + Set set = hashMap.entrySet(); + Set numberT1Set = new TreeSet(); + + for (Iterator iterator = set.iterator(); iterator.hasNext();) { + Map.Entry entry = (Map.Entry) iterator.next(); + NodeInfo nodeInfo = (NodeInfo) entry.getValue(); + numberT1Set.add(Integer.parseInt(nodeInfo.getAttribute(currentYearMonth).toString())); + } + + return numberT1Set; + } + + /** + * + * @param screenPoint + * @return list of NodeInfo within screenPoint. If not found, null is return + */ + public ArrayList nodeExist(Point2D screenPoint) { + ArrayList existNodeInfo = null; + int nearest = 9999; + String selectedNode = null; + String selectedType = null; + int nodeSize = map.getShapeWidth(); + HashMap hashMap = nodeCollection.getNodeCollection(); + Set set = hashMap.entrySet(); + //ArrayList list = nodeCollection.getNodeCollection(); + + for (Iterator iterator = set.iterator(); iterator.hasNext();) { + Map.Entry entry = (Map.Entry) iterator.next(); + NodeInfo nodeInfo = (NodeInfo) entry.getValue(); + + if (!map.containsShowList(nodeInfo.getNodeType())) { + continue; + } + + int width = (map.getColorProperties().getSize(nodeInfo.getNodeType()) * nodeSize) / 5; + int foundFactor = (int) (MapConstant.ZOOMING_INDEX * width); + Point2D nodePoint = map.getScreenPointFromLonLat(nodeInfo.geoCoordinate.longitude, + nodeInfo.geoCoordinate.latitude); + + int lonDiff = (int) Math.abs(screenPoint.getX() - nodePoint.getX()); + int latDiff = (int) Math.abs(screenPoint.getY() - nodePoint.getY()); + + if (lonDiff < foundFactor && latDiff < foundFactor) { + if (lonDiff < nearest) { + nearest = lonDiff; + selectedNode = nodeInfo.getNodeID(); + selectedType = nodeInfo.getNodeType(); + nodeCollection.setNodeID(selectedNode); + } + + if (existNodeInfo == null) { + existNodeInfo = new ArrayList(); + } + + existNodeInfo.add(nodeInfo); + } + } + + return existNodeInfo; + } + + public NodeCollection getNodeCollection() { + return nodeCollection; + } + + public void clearNodeIDSet() { + nodeIDSet.clear(); + } + + public void clearSelectionList() { + selectionList.clear(); + } +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/NodeCollection.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/NodeCollection.java new file mode 100644 index 0000000..35801a4 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/NodeCollection.java @@ -0,0 +1,188 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.gmap.node; + + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Set; + +public class NodeCollection { + private Set selectedNode; // all selected node + private String nodeID; // last clicked node + private HashMap nodeCollection; + + public NodeCollection() { + selectedNode = new HashSet(); + nodeCollection = new HashMap(20000); + } + + public void addSelectedNode(String nodeID) { + selectedNode.add(nodeID); + } + + public void removeSelectedNode(String nodeID) { + selectedNode.remove(nodeID); + } + + public boolean containSelectedNode(String nodeID) { + return selectedNode.contains(nodeID); + } + + public void addSelectedNode(String nodeID, String nodeType) { + selectedNode.add(nodeID + ">>" + nodeType); + } + + public void removeSelectedNode(String nodeID, String nodeType) { + selectedNode.remove(nodeID + ">>" + nodeType); + } + + public void clearSelectedNode() { + selectedNode.clear(); + } + + public boolean containSelectedNode(String nodeID, String nodeType) { + return selectedNode.contains(nodeID + ">>" + nodeType); + } + + public Set getSelectedNode() { + return selectedNode; + } + + public void addNode(NodeInfo nodeInfo) { + if (nodeInfo == null) { + System.out.println("nodeInfo is null"); + } + nodeCollection.put(nodeInfo.getNodeID()+""+nodeInfo.getNodeType(), nodeInfo); + } + + public HashMap getNodeCollection() { + return nodeCollection; + } + +/* public NodeInfo getNode(String nodeID) { + for (NodeInfo nodeInfo : nodeCollection) { + if (nodeInfo.getNodeID().equalsIgnoreCase(nodeID) ) { + return nodeInfo; + } + } + + return null; + } +*/ +/* public NodeInfo getNode(String nodeID, String nodeType) { + for (NodeInfo nodeInfo : nodeCollection) { + if (nodeInfo.getNodeID().equalsIgnoreCase(nodeID) && nodeInfo.getNodeType().equalsIgnoreCase(nodeType)) { + return nodeInfo; + } + } + + return null; + } +*/ + public NodeInfo getNode(String nodeType) { + return (NodeInfo)nodeCollection.get(nodeType); + } +/* public ArrayList getWildCardNode(String nodeID, String nodeType) { + ArrayList list = new ArrayList(); + + for (NodeInfo nodeInfo : nodeCollection) { + if (nodeInfo.getNodeType().equalsIgnoreCase(nodeType) && + nodeInfo.getNodeID().toLowerCase().indexOf(nodeID.toLowerCase()) != -1) { + list.add(nodeInfo); + } + } + + return list; + }*/ + +/* public NodeInfo removeNode(String nodeID) { + for (int i = 0; i < nodeCollection.size(); i++) { + if (nodeCollection.get(i).getNodeID().equalsIgnoreCase(nodeID)) { + return nodeCollection.remove(i); + } + } + + removeSelectedNode(nodeID); + return null; + } + + public NodeInfo removeNode(String nodeID, String nodeType) { + for (int i = 0; i < nodeCollection.size(); i++) { + if (nodeCollection.get(i).getNodeID().equalsIgnoreCase(nodeID) && + nodeCollection.get(i).getNodeType().equalsIgnoreCase(nodeType)) { + return nodeCollection.remove(i); + } + } + + removeSelectedNode(nodeID, nodeType); + return null; + } +*/ +/* public void removeNode(String nodeType) { + nodeCollection.remove(nodeType); + }*/ + +/* public ArrayList getCellsiteLocation(String location, boolean exactMatch) { + ArrayList list = new ArrayList(); + + for (NodeInfo nodeInfo : nodeCollection) { + if (nodeInfo.getAttribute("Location") == null) { + continue; + } + + if (exactMatch) { + if (nodeInfo.getAttribute("Location").equalsIgnoreCase(location)) { + list.add(nodeInfo); + } + } + else { + if (nodeInfo.getAttribute("Location").toUpperCase().indexOf(location.toUpperCase()) != -1) { + list.add(nodeInfo); + } + } + } + + return list; + } +*/ + public void clearNode() { + nodeCollection.clear(); + selectedNode.clear(); + } + + public int getSize() { + return nodeCollection.size(); + } + + public void setNodeID(String nodeID) { + this.nodeID = nodeID; + } + + public String getNodeID() { + return nodeID; + } + + public void clearAllCollection() { + this.clearNode(); + this.clearSelectedNode(); + this.nodeID = ""; + } +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/NodeInfo.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/NodeInfo.java new file mode 100644 index 0000000..d1676e0 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/node/NodeInfo.java @@ -0,0 +1,210 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.gmap.node; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.TreeMap; + +import org.openecomp.portalsdk.analytics.gmap.map.GeoCoordinate; + +public class NodeInfo { + public static final String NUMBER_OF_T1_KEY = "x_numberOfT1"; + public static final String SEQUENCE_KEY = "x_sequence"; + + public GeoCoordinate geoCoordinate; + + private String nodeID; + private String nodeType; + private int state; + private boolean moveable; + private boolean deleteable; + + private List lineIDS; + private Map nodeAttributes; + + public NodeInfo(String nodeID) { + this.nodeID = nodeID; + lineIDS = new ArrayList(); + nodeAttributes = new TreeMap(); + geoCoordinate = new GeoCoordinate(); + } + + public NodeInfo clone() { + NodeInfo nodeInfo = new NodeInfo(nodeID); + nodeInfo.geoCoordinate.longitude = geoCoordinate.longitude; + nodeInfo.geoCoordinate.latitude = geoCoordinate.latitude; + nodeInfo.setMoveable(moveable); + nodeInfo.setNodeType(nodeType); + nodeInfo.setNodeID(nodeID); + nodeInfo.setState(state); + nodeInfo.setLineIDS(cloneLineIDS()); + nodeInfo.setDeleteable(deleteable); + nodeInfo.initializeAttributes(nodeAttributes); + + return nodeInfo; + } + + public void addLineID(String lineID, String lineType) { + if (!lineIDS.contains(lineID + ">>" + lineType)) { + lineIDS.add(lineID + ">>" + lineType); + } + } + + public void removeLineID(String lineID, String lineType) { + lineIDS.remove(lineID + ">>" + lineType); + } + + public String getLineID(String lineID, String lineType) { + for (Object temp : lineIDS) { + if (temp.toString().equals(lineID + ">>" + lineType)) { + return temp.toString(); + } + } + + return null; + } + + public List getLineIDS() { + return lineIDS; + } + + public void printLineIDS() { + Iterator iter = lineIDS.iterator(); + + while (iter.hasNext()) { + System.out.println(iter.next()); + } + } + + public List cloneLineIDS() { + List lineIDS = new ArrayList(); + + for (String lineID : this.lineIDS) { + lineIDS.add(lineID); + } + + return lineIDS; + } + + public void setLineIDS(List lineIDS) { + this.lineIDS = lineIDS; + } + + public void setNodeID(String nodeID) { + this.nodeID = nodeID; + } + + public String getNodeID() { + return nodeID; + } + + public void setNodeType(String nodeType) { + this.nodeType = nodeType; + } + + public String getNodeType() { + return nodeType; + } + + public void setState(int state) { + this.state = state; + } + + public int getState() { + return state; + } + + public void setMoveable(boolean moveable) { + this.moveable = moveable; + } + + public boolean isMoveable() { + return moveable; + } + + public void setDeleteable(boolean deleteable) { + this.deleteable = deleteable; + } + + public boolean isDeleteable() { + return deleteable; + } + + public String getAttribute(String key) { + String value = nodeAttributes.get(key); + return value; + } + + public void initializeAttributes(Map nodeAttributes) { + this.nodeAttributes.clear(); + Set keySet = nodeAttributes.keySet(); + Iterator iter = keySet.iterator(); + + while (iter.hasNext()) { + String key = iter.next(); + this.nodeAttributes.put(key, nodeAttributes.get(key)); + } + } + + public void initializeAttributes(String nodeAttributes) { + if (nodeAttributes == null) { + return; + } + + this.nodeAttributes.clear(); + StringTokenizer tokenizer = new StringTokenizer(nodeAttributes, "|"); + + while (tokenizer.hasMoreTokens()) { + String attribute = tokenizer.nextToken(); + StringTokenizer attributeTokenizer = new StringTokenizer(attribute, "="); + + if (attributeTokenizer.countTokens() == 2) { + String key = attributeTokenizer.nextToken(); + String value = attributeTokenizer.nextToken(); + this.nodeAttributes.put(key, value); + } + } + } + + public void setAttribute(String key, String value) { + nodeAttributes.put(key, value); + } + + public List getAttributeKeys() { + Set keySet = nodeAttributes.keySet(); + List keys = new ArrayList(keySet.size()); + Iterator iter = keySet.iterator(); + + while (iter.hasNext()) { + String key = iter.next(); + + if (key.indexOf("x_") != 0) { + keys.add(key); + } + } + + return keys; + } +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/utils/MapUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/utils/MapUtils.java new file mode 100644 index 0000000..d938869 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/utils/MapUtils.java @@ -0,0 +1,62 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.gmap.utils; + +import java.text.SimpleDateFormat; + + +public class MapUtils { + public static final short PLATE_CARREE_PROJECTION = 0; + public static final short WEB_MERCATOR_PROJECTION = 1; + + + + private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new java.text.SimpleDateFormat("yyyy/MM"); + + + + public static String getModifiedMarketID(String marketID) { + String modifiedMarketID = marketID.replaceAll("/", "_"); + modifiedMarketID = modifiedMarketID.replaceAll(" ", "_"); + return modifiedMarketID; + } + + /** + * increment or decrement + * @param currentYearMonth + * @param value - positive value will increment, otherwise decrement + * @return null if not valid number (must be between 2008/01 to 2010/12) + */ + + +/* public static void saveColor(HttpServletRequest request, DomainService domainService, + String type, String colorValue) { +// String userID = Integer.toString(UserUtils.getUserId(request)); +// MapColorPK colorPK = new MapColorPK(); +// MapColorVO colorVO = new MapColorVO(); +// +// colorPK.setUserID(userID); +// colorPK.setPrefID(type); +// colorVO.setMapColorPK(colorPK); +// colorVO.setColorValue(colorValue); +// +// domainService.saveDomainObject(colorVO); + } */ +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/utils/SwingWorker.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/utils/SwingWorker.java new file mode 100644 index 0000000..26cbb11 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/gmap/utils/SwingWorker.java @@ -0,0 +1,155 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.gmap.utils; + +import javax.swing.SwingUtilities; + +/** + * This is the 3rd version of SwingWorker (also known as + * SwingWorker 3), an abstract class that you subclass to + * perform GUI-related work in a dedicated thread. For + * instructions on using this class, see: + * + * http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html + * + * Note that the API changed slightly in the 3rd version: + * You must now invoke start() on the SwingWorker after + * creating it. + */ +public abstract class SwingWorker { + private Object value; // see getValue(), setValue() + private Thread thread; + + /** + * Class to maintain reference to current worker thread + * under separate synchronization control. + */ + private static class ThreadVar { + private Thread thread; + ThreadVar(Thread t) { thread = t; } + synchronized Thread get() { return thread; } + synchronized void clear() { thread = null; } + } + + private ThreadVar threadVar; + + /** + * Get the value produced by the worker thread, or null if it + * hasn't been constructed yet. + */ + protected synchronized Object getValue() { + return value; + } + + /** + * Set the value produced by worker thread + */ + private synchronized void setValue(Object x) { + value = x; + } + + /** + * Compute the value to be returned by the get method. + */ + public abstract Object construct(); + + /** + * Called on the event dispatching thread (not on the worker thread) + * after the construct method has returned. + */ + public void finished() { + } + + /** + * A new method that interrupts the worker thread. Call this method + * to force the worker to stop what it's doing. + */ + public void interrupt() { + Thread t = threadVar.get(); + if (t != null) { + t.interrupt(); + } + threadVar.clear(); + } + + /** + * Return the value created by the construct method. + * Returns null if either the constructing thread or the current + * thread was interrupted before a value was produced. + * + * @return the value created by the construct method + */ + public Object get() { + while (true) { + Thread t = threadVar.get(); + if (t == null) { + return getValue(); + } + try { + t.join(); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); // propagate + return null; + } + } + } + + + /** + * Start a thread that will call the construct method + * and then exit. + */ + public SwingWorker() { + final Runnable doFinished = new Runnable() { + public void run() { finished(); } + }; + + Runnable doConstruct = new Runnable() { + public void run() { + try { + setValue(construct()); + } + finally { + threadVar.clear(); + } + + SwingUtilities.invokeLater(doFinished); + } + }; + + Thread t = new Thread(doConstruct); + threadVar = new ThreadVar(t); + } + + /** + * Start the worker thread. + */ + public void start() { + Thread t = threadVar.get(); + if (t != null) { + t.start(); + } + } + + public Thread getThread() { + return threadVar.get(); + } +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/DataCache.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/DataCache.java new file mode 100644 index 0000000..5bf4e00 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/DataCache.java @@ -0,0 +1,524 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Vector; + +import javax.servlet.http.HttpServletRequest; + +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.error.ReportSQLException; +import org.openecomp.portalsdk.analytics.model.base.IdNameValue; +import org.openecomp.portalsdk.analytics.model.definition.DBColumnInfo; +import org.openecomp.portalsdk.analytics.model.definition.TableJoin; +import org.openecomp.portalsdk.analytics.model.definition.TableSource; +import org.openecomp.portalsdk.analytics.model.runtime.LookupDBInfo; +import org.openecomp.portalsdk.analytics.system.AppUtils; +import org.openecomp.portalsdk.analytics.system.ConnectionUtils; +import org.openecomp.portalsdk.analytics.system.DbUtils; +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; +import org.openecomp.portalsdk.analytics.util.DataSet; + +public class DataCache extends org.openecomp.portalsdk.analytics.RaptorObject { + private static Vector dataViewActions = null; + + private static Vector publicReportIdNames = null; + + private static Vector privateReportIdNames = null; + + private static Vector groupReportIdNames = null; + + private static Vector reportTableSources = null; + + private static Vector reportTableJoins = null; + + private static HashMap reportTableDbColumns = new HashMap(); + + private static HashMap reportFieldDbLookups = null; + + public DataCache() { + } + + public static Vector getDataViewActions() throws RaptorException { + if (dataViewActions == null) + /* try */{ + dataViewActions = new Vector(); + + //DataSet ds = DbUtils + // .executeQuery("SELECT ts.web_view_action FROM cr_table_source ts WHERE ts.web_view_action IS NOT NULL"); + + String sql = Globals.getTheDataViewActions(); + DataSet ds = DbUtils + .executeQuery(sql); + + for (int i = 0; i < ds.getRowCount(); i++) + dataViewActions.add(ds.getString(i, 0)); + } // catch(Exception e) {} + + return dataViewActions; + } // getDataViewActions + + public static Vector getPublicReportIdNames() throws RaptorException { + // if(publicReportIdNames==null) => needs to be up-to-date at any time + /* try */{ + publicReportIdNames = new Vector(); + + //DataSet ds = DbUtils + // .executeQuery("SELECT rep_id, title FROM cr_report WHERE public_yn = 'Y' ORDER BY title"); + + String sql = Globals.getThePublicReportIdNames(); + DataSet ds = DbUtils + .executeQuery(sql); + for (int i = 0; i < ds.getRowCount(); i++) + publicReportIdNames + .add(new IdNameValue(ds.getString(i, 0), ds.getString(i, 1))); + } // catch(Exception e) {} + + return publicReportIdNames; + } // getPublicReportIdNames + + public static Vector getPrivateAccessibleReportIdNames(String user_id, Vector userRoles) throws RaptorException { + // if(publicReportIdNames==null) => needs to be up-to-date at any time + /* try */{ + privateReportIdNames = new Vector(); + + // StringBuffer query = new StringBuffer(" SELECT cr.rep_id, cr.title FROM cr_report cr "); + String sql = Globals.getThePrivateAccessibleNamesA(); + //query.append(" WHERE cr.rep_id not in (select rep_id from cr_report_access cra where user_id = '"+ user_id+"' "); + sql = sql.replace("[user_id]", user_id); + StringBuffer query = new StringBuffer(sql); + for (int i = 0; i < userRoles.size(); i++) { + if( i == 0){ + // query.append(" OR role_id in ("); + query.append(Globals.getThePrivateAccessibleNamesIf()); + } + if(i < (userRoles.size()-1)) + query.append((String)userRoles.get(i) + ","); + + else if(i == (userRoles.size()-1)) + query.append((String)userRoles.get(i)+")"); + + } + //query.append(" ) "); + //query.append(" AND public_yn = 'N' and cr.owner_id = '"+ user_id+"' order by 2 "); + sql = Globals.getThePrivateAccessibleNamesB(); + sql = sql.replace("[user_id]", user_id); + query.append(sql); + + DataSet ds = DbUtils + .executeQuery(query.toString() ); + + for (int i = 0; i < ds.getRowCount(); i++) + privateReportIdNames + .add(new IdNameValue(ds.getString(i, 0), ds.getString(i, 1))); + } // catch(Exception e) {} + + return privateReportIdNames; + } // getPrivateAccessibleReportIdNames + + + public static Vector getGroupAccessibleReportIdNames(String user_id, Vector userRoles) throws RaptorException { + // if(publicReportIdNames==null) => needs to be up-to-date at any time + /* try */{ + groupReportIdNames = new Vector(); + + //StringBuffer query = new StringBuffer(" SELECT cr.rep_id, cr.title FROM cr_report cr "); + //query.append(" WHERE cr.rep_id in (select rep_id from cr_report_access cra where user_id = '"+ user_id+"' "); + String sql = Globals.getTheGroupAccessibleNamesA(); + sql = sql.replace("[user_id]", user_id); + StringBuffer query = new StringBuffer(sql); + + for (int i = 0; i < userRoles.size(); i++) { + if( i == 0) + query.append(Globals.getThePrivateAccessibleNamesIf()); + if(i < (userRoles.size()-1)) + query.append((String)userRoles.get(i) + ","); + else if(i == (userRoles.size()-1)) + query.append((String)userRoles.get(i)+")"); + + } + //query.append(" ) "); + //query.append(" AND public_yn = 'N' order by 2 "); + + query.append(Globals.getTheGroupAccessibleNamesB()); + DataSet ds = DbUtils + .executeQuery(query.toString() ); + + for (int i = 0; i < ds.getRowCount(); i++) + groupReportIdNames + .add(new IdNameValue(ds.getString(i, 0), ds.getString(i, 1))); + } // catch(Exception e) {} + + return groupReportIdNames; + } // getGroupAccessibleReportIdNames + + + public static TableSource getTableSource(String tableName, String dBinfo, Vector userRoles, String userId, HttpServletRequest request) throws RaptorException { + try { + Vector tableSources = null; + if(Globals.getRestrictTablesByRole()) { + tableSources = getReportTableSources(userRoles, dBinfo, userId, request); + } else { + tableSources = getReportTableSources(dBinfo); + } + for (Iterator iter = getReportTableSources(dBinfo).iterator(); iter.hasNext();) { + TableSource tableSource = (TableSource) iter.next(); + if (tableSource.getTableName().equals(tableName)) + return tableSource; + } // for + } catch (RaptorException e) { + throw new RaptorException(e.getMessage(), e.getCause()); + } + + return null; + } + public static void refreshReportTableSources() { + reportTableSources = null; + } + + public static Vector getReportTableSources(String dBInfo) throws RaptorException { + if (reportTableSources == null) + /* try */{ + reportTableSources = new Vector(); + //String query = " SELECT table_name, display_name, pk_fields, web_view_action, large_data_source_yn, filter_sql FROM cr_table_source "; + String query = Globals.getTheReportTableSourcesA(); + if (dBInfo != null && !dBInfo.equals(AppConstants.DB_LOCAL)){ + //query += " where SOURCE_DB= '" + dBInfo + "'"; + query+=Globals.getTheReportTableSourcesWhere(); + query = query.replace("[dBInfo]", dBInfo); + } + else { + //query += " where SOURCE_DB is null or SOURCE_DB = '" + AppConstants.DB_LOCAL + // + "'"; + query+=Globals.getTheReportTableSourcesIf(); + query = query.replace("[AppConstants.DB_LOCAL]", AppConstants.DB_LOCAL); + } + //query += " ORDER BY table_name "; + query+=Globals.getTheReportTableSourcesElse(); + DataSet ds = DbUtils.executeQuery(query); + for (int i = 0; i < ds.getRowCount(); i++) + reportTableSources.add(new TableSource(ds.getString(i, 0), ds.getString(i, 1), + ds.getString(i, 2), ds.getString(i, 3), ds.getString(i, 4), ds + .getString(i, 5))); + } // catch(Exception e) {} + + return reportTableSources; + } // getReportTableSources + + public static Vector getReportTableSources(Vector userRoles, String dBInfo, String userId, HttpServletRequest request) + throws RaptorException { + if (!Globals.getRestrictTablesByRole()) + return getReportTableSources(dBInfo); + Vector userTableSources = new Vector(); + if (userRoles.size() > 0) + /* try */{ + StringBuffer sb = new StringBuffer(); + for (Iterator iter = userRoles.iterator(); iter.hasNext();) { + sb.append((sb.length() == 0) ? "(" : ", "); + sb.append(iter.next()); + } // for + sb.append(")"); + //StringBuffer query = new StringBuffer("SELECT ts.table_name, ts.display_name, ts.pk_fields, "); + // query.append(" ts.web_view_action, ts.large_data_source_yn, ts.filter_sql FROM cr_table_source ts "); + // query.append (" WHERE "); + StringBuffer query = new StringBuffer(Globals.grabTheReportTableA()); + //if(!(AppUtils.isAdminUser(userId) || AppUtils.isSuperUser(userId))) + // query.append (" (EXISTS (SELECT 1 FROM cr_table_role tr WHERE tr.table_name=ts.table_name AND tr.role_id IN "+sb.toString()+")) and "); + //+ " OR (NOT EXISTS (SELECT 1 FROM cr_table_role tr WHERE tr.table_name=ts.table_name)) "; + if (dBInfo != null && !dBInfo.equals(AppConstants.DB_LOCAL)){ + String d_sql = Globals.grabTheReportTableIf(); + d_sql = d_sql.replace("[dBInfo]", dBInfo); + //query.append( " ts.SOURCE_DB= '" + dBInfo + "'"); + query.append(d_sql); + } + else{ + //query.append(" (ts.SOURCE_DB is null or ts.SOURCE_DB = '"+ AppConstants.DB_LOCAL + "')"); + String d_sql = Globals.grabTheReportTableElse(); + d_sql = d_sql.replace("[AppConstants.DB_LOCAL]", AppConstants.DB_LOCAL); + query.append(d_sql); + } + if(!(AppUtils.isAdminUser(request) || AppUtils.isSuperUser(request))) { + //query.append(" minus "); + + // query.append(" SELECT ts.table_name, ts.display_name, ts.pk_fields, ts.web_view_action, "); + // query.append(" ts.large_data_source_yn, ts.filter_sql from cr_table_source ts where "); + // query.append(" table_name in (select table_name from cr_table_role where role_id not IN "+sb.toString()+") and "); + String e_sql = Globals.grabTheReportTableB(); + e_sql = e_sql.replace("[sb.toString()]", sb.toString()); + query.append(e_sql); + + if (dBInfo != null && !dBInfo.equals(AppConstants.DB_LOCAL)){ + + // query.append( " ts.SOURCE_DB= '" + dBInfo + "'"); + String d_sql = Globals.grabTheReportTableIf(); + d_sql = d_sql.replace("[dBInfo]", dBInfo); + query.append(d_sql); + } + else{ + //query.append(" (ts.SOURCE_DB is null or ts.SOURCE_DB = '"+ AppConstants.DB_LOCAL + "')"); + String d_sql = Globals.grabTheReportTableElse(); + d_sql = d_sql.replace("[AppConstants.DB_LOCAL]", AppConstants.DB_LOCAL); + query.append(d_sql); + } + } + //query.append(" ORDER BY 1 "); + query.append(Globals.grabTheReportTableC()); + DataSet ds = DbUtils.executeQuery(query.toString()); + for (int i = 0; i < ds.getRowCount(); i++) + userTableSources.add(new TableSource(ds.getString(i, 0), ds.getString(i, 1), + ds.getString(i, 2), ds.getString(i, 3), ds.getString(i, 4), ds + .getString(i, 5))); + } // catch(Exception e) {} + + return userTableSources; + } // getReportTableSources + + public static Vector getReportTableJoins() throws RaptorException { + if (reportTableJoins == null) + /* try */{ + reportTableJoins = new Vector(); + + //DataSet ds = DbUtils + // .executeQuery("SELECT src_table_name, dest_table_name, join_expr FROM cr_table_join"); + DataSet ds = DbUtils + .executeQuery(Globals.getTheReportTableCrJoin()); + for (int i = 0; i < ds.getRowCount(); i++) + reportTableJoins.add(new TableJoin(ds.getString(i, 0), ds.getString(i, 1), ds + .getString(i, 2))); + } // catch(Exception e) {} + + return reportTableJoins; + } // getReportTableJoins + + public static Vector getReportTableJoins(Vector userRoles) throws RaptorException { + if (!Globals.getRestrictTablesByRole()) + return getReportTableJoins(); + + Vector userTableJoins = new Vector(); + if (userRoles.size() > 0) + /* try */{ + StringBuffer sb = new StringBuffer(); + for (Iterator iter = userRoles.iterator(); iter.hasNext();) { + sb.append((sb.length() == 0) ? "(" : ", "); + sb.append(iter.next()); + } // for + sb.append(")"); + + /*DataSet ds = DbUtils + .executeQuery("SELECT tj.src_table_name, tj.dest_table_name, tj.join_expr FROM cr_table_join tj " + + "WHERE ((EXISTS (SELECT 1 FROM cr_table_role trs WHERE trs.table_name=tj.src_table_name AND trs.role_id IN " + + sb.toString() + + ")) " + + "OR (NOT EXISTS (SELECT 1 FROM cr_table_role trs WHERE trs.table_name=tj.src_table_name))) " + + "AND ((EXISTS (SELECT 1 FROM cr_table_role trd WHERE trd.table_name=tj.dest_table_name AND trd.role_id IN " + + sb.toString() + + ")) " + + "OR (NOT EXISTS (SELECT 1 FROM cr_table_role trd WHERE trd.table_name=tj.dest_table_name)))");*/ + + + String f_sql = Globals.getTheReportTableJoins(); + f_sql = f_sql.replace("[sb.toString()]", sb.toString()); + + DataSet ds = DbUtils + .executeQuery(f_sql); + + for (int i = 0; i < ds.getRowCount(); i++) + userTableJoins.add(new TableJoin(ds.getString(i, 0), ds.getString(i, 1), ds + .getString(i, 2))); + } // catch(Exception e) {} + + return userTableJoins; + } // getReportTableJoins + + private static void processDollarFields(Vector tableDbColumns) { + int i = 0; + while (i < tableDbColumns.size()) { + DBColumnInfo dbci = (DBColumnInfo) tableDbColumns.get(i); + if (dbci.getColName().equals("DL$MONTH")) { + tableDbColumns.remove(i); + dbci.setLabel("Data Month/Year"); + tableDbColumns.add(0, dbci); + i++; + } else if (dbci.getColName().indexOf('$') >= 0) + tableDbColumns.remove(i); + else + i++; + } // while + } // processDollarFields + + private static String generateReportTableDbUserColumnSQL(String tableName) { + StringBuffer sb = new StringBuffer(); + // sb.append("SELECT a.table_name, a.column_name, a.data_type, a.label "); + //sb.append(" FROM user_column_def a "); + // sb.append("WHERE a.table_name = '" + tableName.toUpperCase() + "' "); + // sb.append("ORDER BY a.column_id"); + + String sql = Globals.getGenerateReportTableCol(); + sql = sql.replace("[tableName.toUpperCase()]", tableName.toUpperCase()); + sb.append(sql); + + return sb.toString(); + }//generateReportTableDbUserColumnSQL + private static String generateReportTableDbColumnsSQL(String tableName, String maskSql) { + StringBuffer sb = new StringBuffer(); + //sb.append("SELECT utc.table_name, utc.column_name, utc.data_type, "); + sb.append(Globals.getGenerateDbUserSqlA()); + if (maskSql == null){ + //sb.append("utc.column_name label "); + sb.append(Globals.getGenerateDbUserSqlIf()); + } + else{ + //sb.append("nvl(x.label, utc.column_name) label "); + //sb.append("FROM user_tab_columns utc "); + sb.append(Globals.getGenerateDbUserSqlElse()); + } + if (maskSql != null) { + sb.append(", ("); + sb.append(maskSql); + sb.append(") AS x "); + } + //sb.append("WHERE utc.table_name = '" + tableName.toUpperCase() + "' "); + String g_sql = Globals.getGenerateDbUserSqlB(); + g_sql = g_sql.replace("[tableName.toUpperCase()]", tableName.toUpperCase()); + sb.append(g_sql); + if (maskSql != null){ + //sb.append(" AND utc.table_name = x.table_name AND utc.column_name = x.column_name "); + sb.append(Globals.getGenerateDbUserSqlC()); + } + //sb.append("ORDER BY utc.column_id"); + sb.append(Globals.getGenerateDbUserSqlD()); + //System.out.println(sb.toString()); + return sb.toString(); + } // generateReportTableDbColumnsSQL + + public static synchronized Vector getReportTableDbColumns(String tableName, + String remoteDbPrefix) throws RaptorException { + Vector tableDbColumns = null; + if(reportTableDbColumns!=null) + tableDbColumns = (Vector) reportTableDbColumns.get(tableName); + else + reportTableDbColumns = new HashMap(); + if (tableDbColumns == null) + /* try */{ + tableDbColumns = new Vector(); + + String maskSql = AppUtils.getReportDbColsMaskSQL(); + DataSet ds = null; + if(Globals.getUserColDef()) { + try { + ds = ConnectionUtils.getDataSet( + generateReportTableDbUserColumnSQL(tableName),AppConstants.DB_LOCAL); + } + catch (ReportSQLException ex) { + throw new ReportSQLException("No Such Table. Please create table or make user_column_def in raptor.properties as \"false\""); + } + + } + else if(maskSql!=null){ + try { + ds = ConnectionUtils.getDataSet( + generateReportTableDbColumnsSQL(tableName, maskSql), remoteDbPrefix); + } + catch(ReportSQLException ex){ + throw new ReportSQLException("Field related table is not present in the database. Please make \"use_field_table\"" + + " as \"no\" in the raptor_app_.properties");} + } + if (ds==null || ds.getRowCount() == 0) { + // In case there are no records in the FIELDS table + ds = ConnectionUtils.getDataSet(generateReportTableDbColumnsSQL(tableName, + null), remoteDbPrefix); + } + for (int i = 0; i < ds.getRowCount(); i++) + tableDbColumns.add(new DBColumnInfo(ds.getString(i, 0), ds.getString(i, 1), ds + .getString(i, 2), ds.getString(i, 3))); + + processDollarFields(tableDbColumns); + reportTableDbColumns.put(tableName, tableDbColumns); + } // catch(Exception e) {} + + return tableDbColumns; + } // getReportTableDbColumns + + public static synchronized String getReportTableDbColumnType(String tableName, + String columnName, String dbInfo) throws RaptorException { + for (Iterator iter = getReportTableDbColumns(tableName, dbInfo).iterator(); iter + .hasNext();) { + DBColumnInfo dbCol = (DBColumnInfo) iter.next(); + if (dbCol.getColName().equals(columnName)) + return dbCol.getColType(); + } // for + + return null; + } // getReportTableDbColumnType + + public static synchronized LookupDBInfo getLookupTable(String tableName, String fieldName) throws RaptorException { + if (reportFieldDbLookups == null) + try { + String sql = AppUtils.getReportDbLookupsSQL(); + + if (sql != null) { + DataSet ds = DbUtils.executeQuery(sql); + reportFieldDbLookups = new HashMap(); + for (int i = 0; i < ds.getRowCount(); i++) { + String tName = ds.getString(i, 0); + String fName = ds.getString(i, 1); + reportFieldDbLookups.put(tName + '|' + fName, new LookupDBInfo(tName, + fName, ds.getString(i, 2), ds.getString(i, 3), ds.getString(i, + 4))); + } // for + } // if + } catch (Exception e) { throw new RaptorException(e.getMessage(), e.getCause()); + } + + LookupDBInfo lookupDBInfo = null; + if (reportFieldDbLookups != null) + lookupDBInfo = (LookupDBInfo) reportFieldDbLookups + .get(tableName + '|' + fieldName); + + if (lookupDBInfo == null) + lookupDBInfo = new LookupDBInfo(tableName, fieldName, tableName, fieldName, + fieldName); + + return lookupDBInfo; + } // getLookupTable + + // public static void setRemoteDBPrefix (String remoteDBPrefix) { + // _remoteDBPrefix = remoteDBPrefix; + // } + // + // public static String getRemoteDBPrefix () { + // return _remoteDBPrefix; + // } + + public static void refreshAll() { + DataCache.dataViewActions = null; + DataCache.privateReportIdNames = null; + DataCache.publicReportIdNames = null; + DataCache.reportFieldDbLookups = null; + DataCache.reportTableDbColumns = null; + DataCache.reportTableJoins = null; + DataCache.reportTableSources = null; + AppUtils.resetUserCache(); + } +} // DataCache + diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/ReportHandler.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/ReportHandler.java new file mode 100644 index 0000000..c663e69 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/ReportHandler.java @@ -0,0 +1,6605 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +/* =========================================================================================== + * This class is part of RAPTOR (Rapid Application Programming Tool for OLAP Reporting) + * Raptor : This tool is used to generate different kinds of reports with lot of utilities + * =========================================================================================== + * + * ------------------------------------------------------------------------------------------- + * ReportHandler.java - This class is used to generate reports in Excel using POI and also to + * create ReportRuntime and ReportDefinition object using report id. + * ------------------------------------------------------------------------------------------- + * + * + * Changes + * ------- + * 18-Aug-2009 : Version 8.5.1 (Sundar);
    • request Object is passed to prevent caching user/roles - Datamining/Hosting.
    + * 14-Jul-2009 : Version 8.4 (Sundar);
    • Signature for generating excel method has been changed to add the report name as sheet name.
    • + *
    • Dashboard reports can be downloaded with each report as a separate sheet.
    • + *
    + * 08-Jun-2009 : Version 8.3 (Sundar);
    • Short datatype is replaced with default integer datatype to create + * row as short is not expoting more than 32768 rows.
    + * + */ +package org.openecomp.portalsdk.analytics.model; + +import java.io.BufferedInputStream; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.io.StringReader; +import java.io.UnsupportedEncodingException; +import java.io.Writer; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.text.ParsePosition; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.TreeMap; +import java.util.Vector; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipOutputStream; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.usermodel.HSSFDateUtil; +import org.apache.poi.hssf.usermodel.HSSFFont; +import org.apache.poi.hssf.usermodel.HSSFFooter; +import org.apache.poi.hssf.usermodel.HSSFHeader; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.hssf.util.HSSFColor; +import org.apache.poi.hssf.util.Region; +import org.apache.poi.poifs.filesystem.POIFSFileSystem; +import org.apache.poi.ss.usermodel.CreationHelper; +import org.apache.poi.ss.usermodel.DateUtil; +import org.apache.poi.ss.usermodel.Header; +import org.apache.poi.ss.usermodel.HorizontalAlignment; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.ss.util.CellReference; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFDataFormat; +import org.apache.poi.xssf.usermodel.XSSFFont; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.openecomp.portalsdk.analytics.controller.ErrorHandler; +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.error.ReportSQLException; +import org.openecomp.portalsdk.analytics.model.base.IdNameValue; +import org.openecomp.portalsdk.analytics.model.definition.ReportDefinition; +import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime; +import org.openecomp.portalsdk.analytics.system.AppUtils; +import org.openecomp.portalsdk.analytics.system.ConnectionUtils; +import org.openecomp.portalsdk.analytics.system.ExecuteQuery; +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; +import org.openecomp.portalsdk.analytics.util.DataSet; +import org.openecomp.portalsdk.analytics.util.ExcelColorDef; +import org.openecomp.portalsdk.analytics.util.HtmlStripper; +import org.openecomp.portalsdk.analytics.util.Log; +import org.openecomp.portalsdk.analytics.util.Utils; +import org.openecomp.portalsdk.analytics.view.ColumnHeader; +import org.openecomp.portalsdk.analytics.view.ColumnHeaderRow; +import org.openecomp.portalsdk.analytics.view.DataRow; +import org.openecomp.portalsdk.analytics.view.DataValue; +import org.openecomp.portalsdk.analytics.view.HtmlFormatter; +import org.openecomp.portalsdk.analytics.view.ReportData; +import org.openecomp.portalsdk.analytics.view.RowHeader; +import org.openecomp.portalsdk.analytics.view.RowHeaderCol; +import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType; +import org.openecomp.portalsdk.analytics.xmlobj.DataSourceType; +import org.openecomp.portalsdk.analytics.xmlobj.FormatList; +import org.openecomp.portalsdk.analytics.xmlobj.FormatType; +import org.openecomp.portalsdk.analytics.xmlobj.Reports; +import org.openecomp.portalsdk.analytics.xmlobj.SemaphoreList; +import org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; + +import com.lowagie.text.Document; +import com.lowagie.text.Paragraph; +import com.lowagie.text.html.simpleparser.HTMLWorker; +import com.lowagie.text.html.simpleparser.StyleSheet; +import com.lowagie.text.pdf.PdfPTable; +//import javax.servlet.RequestDispatcher; + +public class ReportHandler extends org.openecomp.portalsdk.analytics.RaptorObject { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportHandler.class); + + public ReportHandler() { + } + + private String SHEET_NAME = ""; + private static final String XML_ENCODING = "UTF-8"; + private static int font_size = 10; + private static int font_header_title_size = 12; + private static int font_header_descr_size = 9; + private static int font_footer_size = 9; + + + private HashMap loadStyles(ReportRuntime rr, HSSFWorkbook wb) { + HSSFCellStyle styleDefault = wb.createCellStyle(); + //System.out.println("Load Styles"); + // Style default will be normal with no background + HSSFFont fontDefault = wb.createFont(); + // The default will be plain . + fontDefault.setColor((short) HSSFFont.COLOR_NORMAL); + fontDefault.setFontHeight((short) (font_size / 0.05)); + fontDefault.setFontName("Tahoma"); + + styleDefault.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleDefault.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleDefault.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleDefault.setBorderLeft(HSSFCellStyle.BORDER_THIN); + styleDefault.setBorderRight(HSSFCellStyle.BORDER_THIN); + // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleDefault.setFillPattern(HSSFCellStyle.NO_FILL); + styleDefault.setFont(fontDefault); + + HSSFCellStyle styleRed = wb.createCellStyle(); + styleRed.cloneStyleFrom(styleDefault); + styleRed.setFillForegroundColor((short)HSSFColor.RED.index); + styleRed.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + HSSFFont fontRed = wb.createFont(); + fontRed.setColor((short) HSSFColor.WHITE.index); + fontRed.setFontHeight((short) (font_size / 0.05)); + fontRed.setFontName("Tahoma"); + styleRed.setFont(fontRed); + + HSSFCellStyle styleYellow = wb.createCellStyle(); + styleYellow.cloneStyleFrom(styleDefault); + styleYellow.setFillForegroundColor((short)HSSFColor.YELLOW.index); + styleYellow.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + HSSFFont fontYellow = wb.createFont(); + fontYellow.setColor((short) HSSFColor.BLACK.index); + fontYellow.setFontHeight((short) (font_size / 0.05)); + fontYellow.setFontName("Tahoma"); + styleYellow.setFont(fontYellow); + + HSSFCellStyle styleGreen = wb.createCellStyle(); + styleGreen.cloneStyleFrom(styleDefault); + styleGreen.setFillForegroundColor((short)HSSFColor.GREEN.index); + styleGreen.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + HSSFFont fontGreen = wb.createFont(); + fontGreen.setColor((short) HSSFColor.WHITE.index); + fontGreen.setFontHeight((short) (font_size / 0.05)); + fontGreen.setFontName("Tahoma"); + styleGreen.setFont(fontGreen); + + + ArrayList semColumnList = new ArrayList(); + List dsList = rr.getDataSourceList().getDataSource(); + for (Iterator iter = dsList.iterator(); iter.hasNext();) { + DataSourceType element = (DataSourceType) iter.next(); + List dcList = element.getDataColumnList().getDataColumn(); + for (Iterator iterator = dcList.iterator(); iterator.hasNext();) { + DataColumnType element1 = (DataColumnType) iterator.next(); + semColumnList.add(element1.getSemaphoreId()); + + } + } + SemaphoreList semList = rr.getSemaphoreList(); + HashMap hashMapStyles = new HashMap(); + HashMap hashMapFonts = new HashMap(); + hashMapFonts.put("default", fontDefault); + hashMapFonts.put("red", fontRed); + hashMapFonts.put("yellow", fontYellow); + hashMapFonts.put("green", fontGreen); + hashMapStyles.put("default", styleDefault); + hashMapStyles.put("red", styleRed); + hashMapStyles.put("yellow", styleYellow); + hashMapStyles.put("green", styleGreen); + HSSFCellStyle cellStyle = null; + if (semList == null || semList.getSemaphore() == null) { + return hashMapStyles; + } else { + for (Iterator iter = semList.getSemaphore().iterator(); iter.hasNext();) { + SemaphoreType sem = (SemaphoreType) iter.next(); + if(!semColumnList.contains(sem.getSemaphoreId())) continue; + //System.out.println("SemphoreId ----> " + sem.getSemaphoreId()); + FormatList fList = sem.getFormatList(); + List formatList = fList.getFormat(); + for (Iterator fIter = formatList.iterator(); fIter.hasNext();) { + FormatType fmt = (FormatType) fIter.next(); + if(fmt!=null){ + //if (fmt.getLessThanValue().length() > 0) { + cellStyle = wb.createCellStyle(); + HSSFFont cellFont = wb.createFont(); + //System.out.println("Format Id " + fmt.getFormatId()); + if (nvl(fmt.getBgColor()).length() > 0) { +// System.out.println("Load Styles " + +// fmt.getFormatId() +// + " " +fmt.getBgColor() + " " + +// ExcelColorDef.getExcelColor(fmt.getBgColor())); + cellStyle.setFillForegroundColor(ExcelColorDef.getExcelColor(fmt + .getBgColor())); + cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + } + if (nvl(fmt.getFontColor()).length() > 0) { + cellFont.setColor(ExcelColorDef.getExcelColor(fmt.getFontColor())); + } else + cellFont.setColor((short) HSSFFont.COLOR_NORMAL); + if (fmt.isBold()) + cellFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + if (fmt.isItalic()) + cellFont.setItalic(true); + if (fmt.isUnderline()) + cellFont.setUnderline(HSSFFont.U_SINGLE); + if(nvl(fmt.getFontFace()).length()>0) + cellFont.setFontName(fmt.getFontFace()); + else + cellFont.setFontName("Tahoma"); + //cellFont.setFontHeight((short) (10 / 0.05)); + + if(nvl(fmt.getFontSize()).length()>0) { + try { + //cellFont.setFontHeight((short) (Integer.parseInt(fmt.getFontSize()) / 0.05)); + cellFont.setFontHeight((short) (font_size/0.05)); + } catch(NumberFormatException e){ + cellFont.setFontHeight((short) (font_size / 0.05));//10 + } + } + else + cellFont.setFontHeight((short) (font_size / 0.05)); + cellStyle.setFont(cellFont); + cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); + hashMapStyles.put(fmt.getFormatId(), cellStyle); + } else { + hashMapStyles.put(fmt.getFormatId(), styleDefault); + hashMapStyles.put("default", styleDefault); + } + } + + } + } + return hashMapStyles; + } + + private void paintExcelParams(HSSFWorkbook wb,int rowNum,int col,ArrayList paramsList, String customizedParamInfo, HSSFSheet sheet, String reportTitle, String reportDescr) throws IOException { + //HSSFSheet sheet = wb.getSheet(getSheetName()); + int cellNum = 0; + HSSFRow row = null; + short s1 = 0, s2 = (short) 1; + HtmlStripper strip = new HtmlStripper(); + // Name Style + HSSFCellStyle styleName = wb.createCellStyle(); + //styleName.setFillBackgroundColor(HSSFColor.GREY_80_PERCENT.index); + styleName.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index); + //styleName.setFillPattern(HSSFCellStyle.SPARSE_DOTS); + styleName.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleName.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleName.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleName.setBorderRight(HSSFCellStyle.BORDER_THIN); + styleName.setBorderLeft(HSSFCellStyle.BORDER_THIN); + styleName.setDataFormat((short)0); + HSSFFont font = wb.createFont(); + font.setFontHeight((short) (font_size / 0.05)); + font.setFontName("Tahoma"); + font.setColor(HSSFColor.BLACK.index); + font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + styleName.setFont(font); + //Data Style + + // Create some fonts. + HSSFFont fontDefault = wb.createFont(); + // Initialize the styles & fonts. + // The default will be plain . + fontDefault.setColor((short) HSSFFont.COLOR_NORMAL); + fontDefault.setFontHeight((short) (font_size / 0.05)); + fontDefault.setFontName("Tahoma"); + fontDefault.setItalic(true); + // Style default will be normal with no background + HSSFCellStyle styleValue = wb.createCellStyle(); + styleValue.setDataFormat((short)0); + styleValue.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleValue.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleValue.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleValue.setBorderLeft(HSSFCellStyle.BORDER_THIN); + styleValue.setBorderRight(HSSFCellStyle.BORDER_THIN); + // styleValue.setFillForegroundColor(HSSFColor.YELLOW.index); + styleValue.setFillPattern(HSSFCellStyle.NO_FILL); + styleValue.setFont(fontDefault); + HSSFCell cell = null; + HSSFCellStyle styleDescription = wb.createCellStyle(); + styleDescription.setAlignment(HSSFCellStyle.ALIGN_CENTER); +// styleDescription.setBorderBottom(HSSFCellStyle.BORDER_THIN); +// styleDescription.setBorderTop(HSSFCellStyle.BORDER_THIN); +// styleDescription.setBorderRight(HSSFCellStyle.BORDER_THIN); +// styleDescription.setBorderLeft(HSSFCellStyle.BORDER_THIN); + HSSFFont fontDescr = wb.createFont(); + fontDescr.setFontHeight((short) (font_size / 0.05)); //14 + fontDescr.setFontName("Tahoma"); + fontDescr.setColor(HSSFColor.BLACK.index); + fontDescr.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + styleDescription.setFont(font); + HSSFCell cellDescr = null; + int paramSeq = 0; + HSSFHeader header = sheet.getHeader(); + StringBuffer strBuf = new StringBuffer(); + if(!Globals.customizeFormFieldInfo() || customizedParamInfo.length()<=0) { + for (Iterator iter = paramsList.iterator(); iter.hasNext();) { + IdNameValue value = (IdNameValue) iter.next(); + //System.out.println("\"" + value.getId() + " = " + value.getName() + "\""); + if(nvl(value.getId()).trim().length()>0 && (!nvl(value.getId()).trim().equals("BLANK"))) { + paramSeq += 1; + if(paramSeq <= 1) { + row = sheet.createRow(++rowNum); + cell = row.createCell((short) 0); + sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2)); + cellDescr = row.createCell((short) 0); + cellDescr.setCellValue("Run-time Parameters"); + cellDescr.setCellStyle(styleDescription); + + + strBuf.append(reportTitle+"\n"); + //strBuf.append("Run-time Parameters\n"); + } + row = sheet.createRow(++rowNum); + cellNum = 0; + //System.out.println("RowNum " + rowNum + " " + value.getId() + " " +value.getName()); + cell = row.createCell((short) cellNum); + cell.setCellValue(value.getId()); + cell.setCellStyle(styleName); + cellNum += 1; + cell = row.createCell((short) cellNum); + cell.setCellValue(value.getName().replaceAll("~",",")); + cell.setCellStyle(styleValue); + + //strBuf.append(value.getId()+": "+ value.getName()+"\n"); + } + } //for + } else { + strBuf.append(reportTitle+"\n"); + Document document = new Document(); + document.open(); + HTMLWorker worker = new HTMLWorker(document); + StyleSheet style = new StyleSheet(); + style.loadTagStyle("body", "leading", "16,0"); + ArrayList p = HTMLWorker.parseToList(new StringReader(customizedParamInfo), style); + String name = ""; + String token = ""; + String value = ""; + String s = ""; + PdfPTable pdfTable = null; + for (int k = 0; k < p.size(); ++k){ + if(p.get(k) instanceof Paragraph) + s = ((Paragraph)p.get(k)).toString(); + else { /*if ((p.get(k) instanceof PdfPTable))*/ + pdfTable = ((PdfPTable)p.get(k)); + } + //todo: Logic for parsing pdfTable should be added after upgrading to iText 5.0.0 + //s = Utils.replaceInString(s, ",", "|"); + s = s.replaceAll(",", "|"); + s = s.replaceAll("~", ","); + if(s.indexOf(":")!= -1) { + //System.out.println("|"+s+"|"); + row = sheet.createRow(++rowNum); + cell = row.createCell((short) 0); + sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2)); + cellDescr = row.createCell((short) 0); + cellDescr.setCellValue("Run-time Parameters"); + cellDescr.setCellStyle(styleDescription); + + //strBuf.append("Run-time Parameters\n"); + StringTokenizer st = new StringTokenizer(s.trim(), "|"); + while(st.hasMoreTokens()) { + token = st.nextToken(); + token = token.trim(); + if (!(token.trim().equals("|") || token.trim().equals("]]") || token.trim().equals("]") || token.trim().equals("[") )) { + if(token.endsWith(":")) { + name = token; + name = name.substring(0, name.length()-1); + if(name.startsWith("[")) + name = name.substring(1); + value = st.nextToken(); + if(nvl(value).endsWith("]"))value = nvl(value).substring(0, nvl(value).length()-1); + } /*else if(name != null && name.length() > 0) { + value = st.nextToken(); + if(value.endsWith("]]"))value = value.substring(0, value.length()-1); + }*/ + if(name!=null && name.trim().length()>0) { + row = sheet.createRow((short) ++rowNum); + cellNum = 0; + cell = row.createCell((short) cellNum); + cell.setCellValue(name.trim()); + cell.setCellStyle(styleName); + cellNum += 1; + cell = row.createCell((short) cellNum); + cell.setCellValue(value.trim()); + cell.setCellStyle(styleValue); + //strBuf.append(name.trim()+": "+ value.trim()+"\n"); + } +/* if(token.endsWith(":") && (value!=null && value.trim().length()<=0) && (name!=null && name.trim().length()>0 && name.endsWith(":"))) { + name = name.substring(0, name.indexOf(":")+1); + //value = token.substring(token.indexOf(":")+1); + row = sheet.createRow((short) ++rowNum); + cellNum = 0; + cell = row.createCell((short) cellNum); + cell.setCellValue(name.trim()); + cell.setCellStyle(styleName); + cellNum += 1; + cell = row.createCell((short) cellNum); + cell.setCellValue(value.trim()); + cell.setCellStyle(styleValue); + + //strBuf.append(name.trim()+": "+ value.trim()+"\n"); + value = ""; + name = ""; + } +*/ } + int cw = 0; + cw = name.trim().length() + 12; + // if(i!=cellWidth.size()-1) + if(sheet.getColumnWidth((short)0)< (short) name.trim().length()) + sheet.setColumnWidth((short)0, (short) name.trim().length()); + if(sheet.getColumnWidth((short)1)< (short) value.trim().length()) + sheet.setColumnWidth((short)1, (short) value.trim().length()); + name = ""; + value = ""; + + } + + try { + SimpleDateFormat oracleDateFormat = new SimpleDateFormat("MM/dd/yyyy kk:mm:ss"); + Date sysdate = oracleDateFormat.parse(ReportLoader.getSystemDateTime()); + SimpleDateFormat dtimestamp = new SimpleDateFormat(Globals.getScheduleDatePattern()); + + row = sheet.createRow((short) ++rowNum); + cellNum = 0; + cell = row.createCell((short) cellNum); + cell.setCellValue("Report Date/Time"); + cell.setCellStyle(styleName); + cellNum += 1; + cell = row.createCell((short) cellNum); + + cell.setCellValue(dtimestamp.format(sysdate)+" "+Globals.getTimeZone()); + cell.setCellStyle(styleValue); + + } catch(Exception ex) { + //ex.printStackTrace(); + } + + + } + } + + +/* Iterator iter1 = paramsList.iterator(); + s1 = 0; s2 = (short)10; + if(iter1.hasNext()) { + row = sheet.createRow((short) ++rowNum); + cellNum = 0; + cell = row.createCell((short) cellNum); + sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2)); + cell.setCellValue(strip.stripHtml(customizedParamInfo)); + } +*/ +/* rowNum += 2; + row = sheet.createRow(rowNum);*/ + } // if + Iterator iterCheck = paramsList.iterator(); + if(iterCheck.hasNext()) { + rowNum += 2; + row = sheet.createRow(rowNum); + } + header.setCenter(HSSFHeader.font("Tahoma", "")+ HSSFHeader.fontSize((short) 9)+" " + strBuf.toString()); + HSSFFooter footer = sheet.getFooter(); + footer.setLeft(HSSFFooter.font("Tahoma", "")+ HSSFFooter.fontSize((short) 9)+ "Page " + HSSFFooter.page() + + " of " + HSSFFooter.numPages() ); + footer.setCenter(HSSFFooter.font("Tahoma", "")+ HSSFFooter.fontSize((short) 9)+Globals.getFooterFirstLine()+"\n"+Globals.getFooterSecondLine()); + + } + + + + private int paintExcelData(HSSFWorkbook wb, int rowNum, int col, ReportData rd, + HashMap styles, ReportRuntime rr, HSSFSheet sheet, String sql_whole, OutputStream sos, HttpServletRequest request) throws RaptorException { + int mb = 1024*1024; + Runtime runtime = Runtime.getRuntime(); + int returnValue = 0; + // HSSFSheet sheet = wb.getSheetAt(0); + HSSFCellStyle styleDefault = wb.createCellStyle(); + HSSFCellStyle styleNumber = wb.createCellStyle(); + HSSFCellStyle styleDecimalNumber = wb.createCellStyle(); + HSSFCellStyle styleCurrencyNumber = wb.createCellStyle(); + HSSFCellStyle styleCurrencyDecimalNumber = wb.createCellStyle(); + HSSFCellStyle styleDate = wb.createCellStyle(); + HtmlStripper strip = new HtmlStripper(); + //HSSFSheet sheet = wb.getSheet(getSheetName()); + HSSFCellStyle styleDataHeader = wb.createCellStyle(); + // style.setFillBackgroundColor(HSSFColor.AQUA.index); + styleDataHeader.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index); + styleDataHeader.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + styleDataHeader.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleDataHeader.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleDataHeader.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleDataHeader.setBorderRight(HSSFCellStyle.BORDER_THIN); + styleDataHeader.setBorderLeft(HSSFCellStyle.BORDER_THIN); + HSSFFont font = wb.createFont(); + font.setFontHeight((short) (font_size / 0.05)); + font.setFontName("Tahoma"); + font.setColor(HSSFColor.BLACK.index); + styleDataHeader.setFont(font); + // Column Header + boolean firstPass = true; + ArrayList cellWidth = new ArrayList(); + java.util.HashMap dataTypeMap = new java.util.HashMap(); + int cellNum = 0; + rowNum += 0; + ColumnHeaderRow chr = null; + String title = ""; + +// System.out.println("***************** Size " + rd.reportColumnHeaderRows.size()); +// for (int i = 0; i < rd.reportColumnHeaderRows.size(); i++) { +// for (int j = 0; j < rd.reportColumnHeaderRows.getColumnHeaderRow(i).size(); j++) { +// System.out.println("Column Title " + rd.reportColumnHeaderRows.getColumnHeaderRow(i).getColumnHeader(j).getColumnTitle() +// + " " + rd.reportColumnHeaderRows.getColumnHeaderRow(i).getColumnHeader(j).isVisible()); +// } +// } +/* List dsList = rr.getDataSourceList().getDataSource(); + HashMap dataColumnTypeHashMap = new HashMap(); + for (Iterator iter = dsList.iterator(); iter.hasNext();) { + DataSourceType element = (DataSourceType) iter.next(); + List dcList = element.getDataColumnList().getDataColumn(); + for (Iterator iterator = dcList.iterator(); iterator.hasNext();) { + DataColumnType element1 = (DataColumnType) iterator.next(); + dataTypeMap.put(element1.getColId(), element1.getColType()); + dataColumnTypeHashMap.put(element1.getColName(), element1); + } + } +*/ + int columnRows = rr.getVisibleColumnCount() - 1; + + HttpSession session = request.getSession(); + String drilldown_index = (String) session.getAttribute("drilldown_index"); + int index = 0; + try { + index = Integer.parseInt(drilldown_index); + } catch (NumberFormatException ex) { + index = 0; + } + String header = (String) session.getAttribute("TITLE_"+index); + String subtitle = (String) session.getAttribute("SUBTITLE_"+index); + if(nvl(header).length()>0) { + header = Utils.replaceInString(header, "
    ", " "); + header = Utils.replaceInString(header, "
    ", " "); + header = Utils.replaceInString(header, "
    ", " "); + header = strip.stripHtml(nvl(header).trim()); + subtitle = Utils.replaceInString(subtitle, "
    ", " "); + subtitle = Utils.replaceInString(subtitle, "
    ", " "); + subtitle = Utils.replaceInString(subtitle, "
    ", " "); + subtitle = strip.stripHtml(nvl(subtitle).trim()); + HSSFRow row = sheet.createRow(rowNum); + cellNum = 0; + row.createCell((short) cellNum).setCellValue(header); + sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum, (short) (columnRows))); + rowNum += 1; + row = sheet.createRow(rowNum); + cellNum = 0; + row.createCell((short) cellNum).setCellValue(subtitle); + sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum, (short) (columnRows))); + rowNum += 1; + } + + for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();) { + HSSFRow row = sheet.createRow(rowNum); + cellNum = -1; + /*if(rd.reportTotalRowHeaderCols!=null) { + cellNum +=1; + row.createCell((short) cellNum).setCellValue("Total"); + row.createCell((short) cellNum).setCellStyle(styleDataHeader); + //row.getCell((short) cellNum).setCellStyle(styleDataHeader); + }*/ + chr = rd.reportColumnHeaderRows.getNext(); + + if(nvl(sql_whole).length() <= 0 || (!rr.getReportType().equals(AppConstants.RT_LINEAR))) { + if(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) + rd.reportRowHeaderCols.resetNext(0); + else + rd.reportRowHeaderCols.resetNext(1); + + for (; rd.reportRowHeaderCols.hasNext();) { + cellNum += 1; + RowHeaderCol rhc = rd.reportRowHeaderCols.getNext(); + + if (firstPass) { + title = rhc.getColumnTitle(); + title = Utils.replaceInString(title,"_nl_", " \n"); + row.createCell((short) cellNum).setCellValue(title); + //commented after bug reported by EPAT 01/17/2015 + //sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum+columnRows, (short) (cellNum))); + //System.out.println(" **************** Row Header Title " + rhc.getColumnTitle() + " " + cellNum + " " ); + //System.out.println(cellNum + " " + cellWidth.size()); + if (cellWidth.size() > 0 && cellWidth.size() > cellNum) { + if (((Integer) cellWidth.get(cellNum)).intValue() < rhc + .getColumnTitle().length()) + cellWidth.set(cellNum, new Integer(title.length())); + } else + cellWidth.add(cellNum, new Integer(title.length())); + row.getCell((short) cellNum).setCellStyle(styleDataHeader); + } + + + } // for + + } + + firstPass = false; + +/* for(chr.resetNext(); chr.hasNext(); ) { + ColumnHeader ch = chr.getNext(); + if(ch.isVisible()) { + cellNum += 1; + row.createCell((short) cellNum).setCellValue(ch.getColumnTitle()); +// <%= ch.getColSpanHtml() %><%= ch.getRowSpanHtml() %>> +// <%= ch.getColumnTitleHtml() %> +// + } // if + } // for +*/ + + //cellNum = -1; + + +// Set mapSet = dataTypeMap.entrySet(); +// Map.Entry me; +// String element, value ; +// for (Iterator iter = mapSet.iterator(); iter.hasNext();) { +// me=(Map.Entry)iter.next(); +// element = (String) me.getKey(); +// value = (String) me.getValue(); +// System.out.println("DataTypeMap " + element + " " + value); +// } + + for (chr.resetNext(); chr.hasNext();) { + ColumnHeader ch = chr.getNext(); + if(ch.isVisible()) { + cellNum += 1; + + int colSpan = ch.getColSpan()-1; + title = ch.getColumnTitle(); + title = Utils.replaceInString(title,"_nl_", " \n"); + row.createCell((short) cellNum).setCellValue(title); + if(colSpan > 0) { + for ( int k = 1; k <= colSpan; k++ ) { + row.createCell((short) cellNum+k); + } + sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum, (short) (cellNum+colSpan))); + } + + + +/* if (cellWidth.size() > cellNum) { + if (((Integer) cellWidth.get(cellNum)).intValue() < ch + .getColumnTitle().length()) + cellWidth + .set((cellNum), new Integer(ch.getColumnTitle().length())); + } else + cellWidth.add((cellNum), new Integer(ch.getColumnTitle().length())); +*/ row.getCell((short) (cellNum)).setCellStyle(styleDataHeader); + for ( int k = 1; k <= colSpan; k++ ) { + row.getCell((short) (cellNum+k)).setCellStyle(styleDataHeader); + } + + if(colSpan > 0) + cellNum += colSpan; + } + } // for + +/* int cw = 0; + for (int i = 0; i < cellWidth.size(); i++) { + cw = ((Integer) cellWidth.get(i)).intValue() + 6; + sheet.setColumnWidth((short) (i), (short) ((cw * 8) / ((double) 1 / 20))); + } +*/ + rowNum += 1; + } // for + + + // Data + // Create some cell styles. + //HSSFCellStyle styleDefault = wb.createCellStyle(); + HSSFCellStyle styleCell = null; + + HSSFCellStyle styleTotal = wb.createCellStyle(); + HSSFCellStyle styleCurrencyTotal = wb.createCellStyle(); + HSSFCellStyle styleDefaultTotal = wb.createCellStyle(); + HSSFCellStyle styleCurrencyDecimalNumberTotal = wb.createCellStyle(); + HSSFCellStyle styleDecimalNumberTotal = wb.createCellStyle(); + HSSFCellStyle styleCurrencyNumberTotal = wb.createCellStyle(); + + + // Create some fonts. + HSSFFont fontDefault = wb.createFont(); + HSSFFont fontBold = wb.createFont(); + // Initialize the styles & fonts. + // The default will be plain . + fontDefault.setColor((short) HSSFFont.COLOR_NORMAL); + fontDefault.setFontHeight((short) (font_size / 0.05)); + fontDefault.setFontName("Tahoma"); + + // The default will be bold black tachoma 10pt text. + fontBold.setColor((short) HSSFFont.COLOR_NORMAL); + fontBold.setFontHeight((short) (font_size / 0.05)); + fontBold.setFontName("Tahoma"); + fontBold.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + // Style default will be normal with no background + styleDefault.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleDefault.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleDefault.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleDefault.setBorderLeft(HSSFCellStyle.BORDER_THIN); + styleDefault.setBorderRight(HSSFCellStyle.BORDER_THIN); + // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleDefault.setFillPattern(HSSFCellStyle.NO_FILL); + styleDefault.setFont(fontDefault); + styleDefault.setWrapText(true); + //Number + styleNumber.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleNumber.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleNumber.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleNumber.setBorderLeft(HSSFCellStyle.BORDER_THIN); + styleNumber.setBorderRight(HSSFCellStyle.BORDER_THIN); + // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleNumber.setFillPattern(HSSFCellStyle.NO_FILL); + styleNumber.setFont(fontDefault); + try { + styleNumber.setDataFormat((short)0x26);//HSSFDataFormat.getBuiltinFormat("(#,##0_);[Red](#,##0)")); + } catch (Exception e) { + + } + //Decimal Number + styleDecimalNumber.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleDecimalNumber.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleDecimalNumber.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleDecimalNumber.setBorderLeft(HSSFCellStyle.BORDER_THIN); + styleDecimalNumber.setBorderRight(HSSFCellStyle.BORDER_THIN); + // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleDecimalNumber.setFillPattern(HSSFCellStyle.NO_FILL); + styleDecimalNumber.setFont(fontDefault); + styleDecimalNumber.setDataFormat((short)0x27);//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)")); + + //Decimal Number + styleDecimalNumberTotal.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleDecimalNumberTotal.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleDecimalNumberTotal.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleDecimalNumberTotal.setBorderLeft(HSSFCellStyle.BORDER_THIN); + styleDecimalNumberTotal.setBorderRight(HSSFCellStyle.BORDER_THIN); + // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleDecimalNumberTotal.setFillPattern(HSSFCellStyle.NO_FILL); + styleDecimalNumberTotal.setFont(fontBold); + styleDecimalNumberTotal.setDataFormat((short)0x27);//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)")); + + //CurrencyNumber + styleCurrencyDecimalNumber.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleCurrencyDecimalNumber.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleCurrencyDecimalNumber.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleCurrencyDecimalNumber.setBorderLeft(HSSFCellStyle.BORDER_THIN); + styleCurrencyDecimalNumber.setBorderRight(HSSFCellStyle.BORDER_THIN); + // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleCurrencyDecimalNumber.setFillPattern(HSSFCellStyle.NO_FILL); + styleCurrencyDecimalNumber.setFont(fontDefault); + styleCurrencyDecimalNumber.setDataFormat((short)8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)")); + + //currency number bold + styleCurrencyDecimalNumberTotal.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleCurrencyDecimalNumberTotal.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleCurrencyDecimalNumberTotal.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleCurrencyDecimalNumberTotal.setBorderLeft(HSSFCellStyle.BORDER_THIN); + styleCurrencyDecimalNumberTotal.setBorderRight(HSSFCellStyle.BORDER_THIN); + // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleCurrencyDecimalNumberTotal.setFillPattern(HSSFCellStyle.NO_FILL); + styleCurrencyDecimalNumberTotal.setFont(fontBold); + styleCurrencyDecimalNumberTotal.setDataFormat((short)8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)")); + + + //CurrencyNumber + styleCurrencyNumber.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleCurrencyNumber.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleCurrencyNumber.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleCurrencyNumber.setBorderLeft(HSSFCellStyle.BORDER_THIN); + styleCurrencyNumber.setBorderRight(HSSFCellStyle.BORDER_THIN); + // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleCurrencyNumber.setFillPattern(HSSFCellStyle.NO_FILL); + styleCurrencyNumber.setFont(fontDefault); + styleCurrencyNumber.setDataFormat((short) 6);//HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)")); + + + //CurrencyNumber + styleCurrencyNumberTotal.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleCurrencyNumberTotal.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleCurrencyNumberTotal.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleCurrencyNumberTotal.setBorderLeft(HSSFCellStyle.BORDER_THIN); + styleCurrencyNumberTotal.setBorderRight(HSSFCellStyle.BORDER_THIN); + // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleCurrencyNumberTotal.setFillPattern(HSSFCellStyle.NO_FILL); + styleCurrencyNumberTotal.setFont(fontBold); + styleCurrencyNumberTotal.setDataFormat((short) 6);//HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)")); + + //Date + styleDate.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleDate.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleDate.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleDate.setBorderLeft(HSSFCellStyle.BORDER_THIN); + styleDate.setBorderRight(HSSFCellStyle.BORDER_THIN); + // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleDate.setFillPattern(HSSFCellStyle.NO_FILL); + styleDate.setFont(fontDefault); + styleDate.setDataFormat((short)0xe);//HSSFDataFormat.getBuiltinFormat("m/d/yy")); + + // Style for Total will be Bold with normal font with no background + styleTotal.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleTotal.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleTotal.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleTotal.setBorderLeft(HSSFCellStyle.BORDER_THIN); + styleTotal.setBorderRight(HSSFCellStyle.BORDER_THIN); + // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleTotal.setFillPattern(HSSFCellStyle.NO_FILL); + styleTotal.setDataFormat((short)0x28);//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)")); + styleTotal.setFont(fontBold); + + styleCurrencyTotal.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleCurrencyTotal.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleCurrencyTotal.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleCurrencyTotal.setBorderLeft(HSSFCellStyle.BORDER_THIN); + styleCurrencyTotal.setBorderRight(HSSFCellStyle.BORDER_THIN); + // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleCurrencyTotal.setFillPattern(HSSFCellStyle.NO_FILL); + styleCurrencyTotal.setDataFormat((short)8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)")); + styleCurrencyTotal.setFont(fontBold); + + styleDefaultTotal.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleDefaultTotal.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleDefaultTotal.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleDefaultTotal.setBorderLeft(HSSFCellStyle.BORDER_THIN); + styleDefaultTotal.setBorderRight(HSSFCellStyle.BORDER_THIN); + // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleDefaultTotal.setFillPattern(HSSFCellStyle.NO_FILL); + styleDefaultTotal.setDataFormat((short)0x28); + ////styleDefaultTotal.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)")); + styleDefaultTotal.setFont(fontBold); + + firstPass = true; + // Declare a row object reference. + HSSFRow row = null; + // Declare a cell object reference. + HSSFCell cell = null; + //HSSFCell cellNumber = null; + //HSSFCell cellCurrencyNumber = null; + //HSSFCell cellDate = null; + + //All the possible combinations of date format + SimpleDateFormat MMDDYYYYFormat = new SimpleDateFormat("MM/dd/yyyy"); + SimpleDateFormat YYYYMMDDFormat = new SimpleDateFormat("yyyy/MM/dd"); + SimpleDateFormat MONYYYYFormat = new SimpleDateFormat("MMM yyyy"); + SimpleDateFormat MMYYYYFormat = new SimpleDateFormat("MM/yyyy"); + SimpleDateFormat MMMMMDDYYYYFormat = new SimpleDateFormat("MMMMM dd, yyyy"); + SimpleDateFormat YYYYMMDDDASHFormat = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat DDMONYYYYFormat = new SimpleDateFormat("dd-MMM-yyyy"); + SimpleDateFormat MONTHYYYYFormat = new SimpleDateFormat("MMMMM, yyyy"); + SimpleDateFormat MMDDYYYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); + SimpleDateFormat MMDDYYYYHHMMFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm"); + SimpleDateFormat YYYYMMDDHHMMSSFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); + SimpleDateFormat YYYYMMDDHHMMFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm"); + SimpleDateFormat DDMONYYYYHHMMSSFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); + SimpleDateFormat DDMONYYYYHHMMFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm"); + SimpleDateFormat DDMONYYHHMMFormat = new SimpleDateFormat("dd-MMM-yy HH:mm"); + SimpleDateFormat MMDDYYFormat = new SimpleDateFormat("MM/dd/yy"); + SimpleDateFormat MMDDYYHHMMFormat = new SimpleDateFormat("MM/dd/yy HH:mm"); + SimpleDateFormat MMDDYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yy HH:mm:ss"); + SimpleDateFormat MMDDYYYYHHMMZFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm z"); + SimpleDateFormat MMMMMDDYYYYHHMMSS = new SimpleDateFormat("MMMMM-dd-yyyy HH:mm:ss"); + + + + + ResultSet rs = null; + Connection conn = null; + Statement st = null; + ResultSetMetaData rsmd = null; + CreationHelper createHelper = wb.getCreationHelper(); + + if(nvl(sql_whole).length() >0 && rr.getReportType().equals(AppConstants.RT_LINEAR)) { + try { + conn = ConnectionUtils.getConnection(rr.getDbInfo()); + st = conn.createStatement(); + System.out.println("************* Map Whole SQL *************"); + System.out.println(sql_whole); + System.out.println("*****************************************"); + rs = st.executeQuery(sql_whole); + rsmd = rs.getMetaData(); + int numberOfColumns = rsmd.getColumnCount(); + HashMap colHash = new HashMap(); + DataRow dr = null; + int j = 0; + int rowCount = 0; + while(rs.next()) { + rowCount++; + row = sheet.createRow(rowNum); + cellNum = -1; + colHash = new HashMap(); + for (int i = 1; i <= numberOfColumns; i++) { + colHash.put(rsmd.getColumnLabel(i).toUpperCase(), strip.stripHtml(rs.getString(i))); + } + rd.reportDataRows.resetNext(); + dr = rd.reportDataRows.getNext(); + j = 0; + //if(rowCount%1000 == 0) wb.write(sos); + + /*if(rd.reportTotalRowHeaderCols!=null) { + //cellNum = -1; + //for (rd.reportRowHeaderCols.resetNext(); rd.reportRowHeaderCols.hasNext();) { + cellNum += 1; + //RowHeaderCol rhc = rd.reportRowHeaderCols.getRowHeaderCol(0); + //if (firstPass) + // rhc.resetNext(); + //RowHeader rh = rhc.getRowHeader(rowCount-1); + row.createCell((short) cellNum).setCellValue(rowCount); + row.getCell((short) cellNum).setCellStyle(styleDefault); + if (firstPass) + cellWidth.add(cellNum, new Integer((rowCount+"").length())); + else + cellWidth.set(cellNum, new Integer((rowCount+"").length())); + + //} // for + }*/ + firstPass = false; + //cellNum = -1; + for (dr.resetNext(); dr.hasNext();j++) { + //for (chr.resetNext(); chr.hasNext();) { + //ColumnHeader ch = chr.getNext(); + styleCell = null; + DataValue dv = dr.getNext(); + HtmlFormatter htmlFormat = dv.getCellFormatter(); + if ((dr.isRowFormat() && !dv.isCellFormat()) && styles != null) + styleCell = (HSSFCellStyle) styles.get(nvl(dr.getFormatId(),"default")); + if (htmlFormat != null && dv.getFormatId() != null && styles != null) + styleCell = (HSSFCellStyle) styles.get(nvl(dv.getFormatId(),"default")); + String value = nvl((String)colHash.get(dv.getColId().toUpperCase())); + + boolean bold = false; + + if(dv.isVisible()) { + cellNum += 1; + cell = row.createCell((short) cellNum); + //System.out.println("Stripping HTML 1"); + //cell.setCellValue(strip.stripHtml(dv.getDisplayValue())); + String dataType = (String) (dataTypeMap.get(dv.getColId())); + //System.out.println("Value " + value + " " + (( dataType !=null && dataType.equals("DATE")) || (dv.getColName()!=null && dv.getColName().toLowerCase().endsWith("date"))) ); + if (dataType!=null && dataType.equals("NUMBER")){ + //cellNumber = row.createCell((short) cellNum); + //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC); + //cellNumber.setCellValue(dv.getDisplayValue()); + //cellCurrencyNumber = row.createCell((short) cellNum); + int zInt = 0; + if (value.equals("null")){ + cell.setCellValue(zInt); + }else{ + + if ((value.indexOf("."))!= -1){ + if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + + //if (dv.getDisplayValue().startsWith("$")){ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); + String tempDollar = dv.getDisplayValue().trim(); + tempDollar = tempDollar.replaceAll(" ", "").substring(0); + tempDollar = tempDollar.replaceAll("\\$", "").substring(0); + //System.out.println("SUBSTRING |" + tempDollar); + //System.out.println("Before copy Value |" + tempDollar); + //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1); + //System.out.println("After copy Value |" + tempDollar); + if ((tempDollar.indexOf(","))!= -1){ + tempDollar = tempDollar.replaceAll(",", ""); + } + //System.out.println("The final string 1 is "+tempDollar); + double tempDoubleDollar = 0.0; + try { + tempDoubleDollar = Double.parseDouble(tempDollar); + if(styleCell!=null) { + styleCell.setDataFormat((short) 8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)")); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleCurrencyDecimalNumber); + cell.setCellValue(tempDoubleDollar); + } catch (NumberFormatException ne) { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + //cell.setCellStyle(styleDefault); + cell.setCellValue(tempDollar); + } + }else{ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); + double tempDouble = 0.0; + try { + tempDouble = Double.parseDouble(value); + if(styleCell!=null) { + styleCell.setDataFormat((short)0x28);//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)")); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDecimalNumber); + cell.setCellValue(tempDouble); + } catch (NumberFormatException ne) { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + cell.setCellValue(value); + } + + } + }else { + if (!(value.equals(""))){ + if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + //if (dv.getDisplayValue().startsWith("$")){ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); + String tempInt = value.trim(); + tempInt = tempInt.replaceAll(" ", "").substring(0); + tempInt = tempInt.replaceAll("\\$", "").substring(0); + //System.out.println("SUBSTRING |" + tempInt); + //System.out.println("Before copy Value |" + tempInt); + //tempInt = String.copyValueOf(tempInt.toCharArray(), 1, tempInt.length()-1); + //System.out.println("After copy Value |" + tempInt); + if ((tempInt.indexOf(","))!= -1){ + tempInt = tempInt.replaceAll(",", ""); + } + //System.out.println("The final string INT is "+tempInt); + Long tempIntDollar = 0L; + try { + tempIntDollar = Long.parseLong(tempInt); + if(styleCell!=null) { + styleCell.setDataFormat((short) 6);//HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)")); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleCurrencyNumber); + cell.setCellValue(tempIntDollar); + } catch (NumberFormatException ne) { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + cell.setCellValue(tempInt); + } + }else{ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); + String tempStr = value.trim(); + if ((tempStr.indexOf(","))!= -1){ + tempStr = tempStr.replaceAll(",", ""); + } + Long temp = 0L; + + try { + temp = Long.parseLong(tempStr); + if(styleCell!=null) { + styleCell.setDataFormat((short) 0x26);//HSSFDataFormat.getBuiltinFormat("(#,##0_);[Red](#,##0)")); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleNumber); + cell.setCellValue(temp); + } catch (NumberFormatException ne) { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + cell.setCellValue(tempStr); + } + + + } + //int temp = Integer.parseInt(value.trim()); + // cell.setCellValue(temp); + //}else{ + // cell.setCellValue(strip.stripHtml(value)); + //} + } + } + } + + }else if ( ( dataType !=null && dataType.equals("DATE")) || (dv.getDisplayName()!=null && dv.getDisplayName().toLowerCase().endsWith("date")) || + (dv.getColId()!=null && dv.getColId().toLowerCase().endsWith("date")) || + (dv.getColName()!=null && dv.getColName().toLowerCase().endsWith("date")) ) { + //cellDate = row.createCell((short) cellNum); + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("mm/dd/yy")); + + if(styleCell!=null) { + styleCell.setDataFormat((short) 0xe);//HSSFDataFormat.getBuiltinFormat("m/d/yy")); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDate); + //String MY_DATE_FORMAT = "yyyy-MM-dd"; + //value = nvl(value).length()<=0?nvl(dv.getDisplayValue()):value; + Date date = null; + int flag = 0; + date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yy h:mm:ss")); + flag = 1; + } + if(date==null) + date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yy h:mm")); + flag = 1; + } + if(date==null) + date = MMDDYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yy")); + flag = 1; + } + if(date==null) + date = MMDDYYYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yyyy h:mm:ss")); + flag = 1; + } + if(date==null) + date = MMDDYYYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yyyy h:mm")); + flag = 1; + } + if(date==null) + date = MMDDYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yyyy")); + flag = 1; + } + if(date==null) + date = YYYYMMDDFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("yyyy/m/d")); + flag = 1; + } + if(date==null) + date = timestampFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("yyyy-m-d h:mm:ss")); //yyyy-MM-dd HH:mm:ss + flag = 1; + } + if(date==null) + date = MONYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("mmm yyyy")); + flag = 1; + } + if(date==null) + date = MMYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/yyyy")); + flag = 1; + } + if(date==null) + date = MMMMMDDYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("mmm/d/yyyy")); + flag = 1; + } + if(date==null) + date = MONTHYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("mmm/yyyy")); + flag = 1; + } + if(date==null) + date = YYYYMMDDHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("yyyy/m/d h:mm:ss")); + flag = 1; + } + if(date==null) + date = YYYYMMDDDASHFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("yyyy-m-d")); + flag = 1; + } + if(date==null) + date = YYYYMMDDHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("yyyy/m/d h:mm")); + flag = 1; + } + if(date==null) + date = DDMONYYYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("d-mmm-yyyy h:mm:ss")); + flag = 1; + } + if(date==null) + date = DDMONYYYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("d-mmm-yyyy h:mm")); + flag = 1; + } + if(date==null) + date = DDMONYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("d-mmm-yy h:mm")); + flag = 1; + } + if(date==null) + date = DDMONYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("d-mmm-yyyy")); + flag = 1; + } + if(date==null) + date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yy h:mm:ss")); + flag = 1; + } + if(date==null) + date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yy h:mm")); + flag = 1; + } + if(date==null) + date = MMDDYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yy")); + flag = 1; + } + if(date==null) + date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yy h:mm")); + flag = 1; + } + if(date==null) + date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yy h:mm:ss")); + flag = 1; + } + if(date==null) + date = MMDDYYYYHHMMZFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yyyy h:mm")); + flag = 1; + } + if(date==null) + date = MMMMMDDYYYYHHMMSS.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yyyy h:mm")); + flag = 1; + } + + if(date!=null) { + //System.out.println("ExcelDate " + HSSFDateUtil.getExcelDate(date)); + cell.setCellValue(HSSFDateUtil.getExcelDate(date)); + try { + String str = cell.getStringCellValue(); + } catch (IllegalStateException ex) { /*cell.getCellStyle().setDataFormat((short)0);*/cell.setCellValue(value);} + } else { + /*cell.getCellStyle().setDataFormat((short)0);*/ + cell.setCellValue(value); + } + //cellDate.setCellValue(date); + //cellDate.setCellValue(value); //cellDate.setCellValue(date); + //cellDate.setCellValue(dv.getDisplayValue()); + + }else if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){ + //cellNumber = row.createCell((short) cellNum); + //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC); + //cellNumber.setCellValue(dv.getDisplayValue()); + cell = row.createCell((short) cellNum); + int zInt = 0; + if (value.equals("null")){ + cell.setCellValue(zInt); + }else{ + + if ((value.indexOf("."))!= -1){ + if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + + //if (value.startsWith("$")){ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); + String tempDollar = value.trim(); + tempDollar = tempDollar.replaceAll(" ", "").substring(0); + tempDollar = tempDollar.replaceAll("\\$", "").substring(0); + //System.out.println("SUBSTRING |" + tempDollar); + //System.out.println("Before copy Value |" + tempDollar); + //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1); + //System.out.println("After copy Value |" + tempDollar); + if ((tempDollar.indexOf(","))!= -1){ + tempDollar = tempDollar.replaceAll(",", ""); + } + //System.out.println("The final string 2IF is "+tempDollar); + double tempDoubleDollar = 0.0; + try { + tempDoubleDollar = Double.parseDouble(tempDollar); + if(styleCell!=null) { + styleCell.setDataFormat((short) 8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)")); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleCurrencyDecimalNumber); + cell.setCellValue(tempDoubleDollar); + } catch (NumberFormatException ne) { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + cell.setCellValue(tempDollar); + } + + + }else{ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); + String tempDoubleStr = value.trim(); + tempDoubleStr = tempDoubleStr.replaceAll(" ", "").substring(0); + if ((tempDoubleStr.indexOf(","))!= -1){ + tempDoubleStr = tempDoubleStr.replaceAll(",", ""); + } + double tempDouble = 0.0; + try { + tempDouble = Double.parseDouble(tempDoubleStr); + if(styleCell!=null) { + styleCell.setDataFormat((short)0x28 );//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)")); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDecimalNumber); + cell.setCellValue(tempDouble); + } catch (NumberFormatException ne) { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + cell.setCellValue(tempDoubleStr); + } + } + + }else { + if (!(value.equals(""))){ + if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + //if (value.startsWith("$")){ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); + String tempInt = value.trim(); + tempInt = tempInt.replaceAll(" ", "").substring(0); + tempInt = tempInt.replaceAll("\\$", "").substring(0); + //System.out.println("SUBSTRING |" + tempInt); + //System.out.println("Before copy Value |" + tempInt); + //tempInt = String.copyValueOf(tempInt.toCharArray(), 1, tempInt.length()-1); + //System.out.println("After copy Value |" + tempInt); + if ((tempInt.indexOf(","))!= -1){ + tempInt = tempInt.replaceAll(",", ""); + } + //System.out.println("The final string INT 2 is "+tempInt); + + Long tempIntDollar = 0L; + + try { + tempIntDollar = Long.parseLong(tempInt); + if(styleCell!=null) { + styleCell.setDataFormat((short) 6);//HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)")); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleCurrencyNumber); + cell.setCellValue(tempIntDollar); + } catch (NumberFormatException ne) { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + cell.setCellValue(tempInt); + } + }else{ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); + String tempStr = value.trim(); + if ((tempStr.indexOf(","))!= -1){ + tempStr = tempStr.replaceAll(",", ""); + } + Long temp = 0L; + + try { + temp = Long.parseLong(tempStr); + if(styleCell!=null) { + styleCell.setDataFormat((short) 0x26);//HSSFDataFormat.getBuiltinFormat("(#,##0_);[Red](#,##0)")); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleNumber); + cell.setCellValue(temp); + } catch (NumberFormatException ne) { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + cell.setCellValue(tempStr); + } + } + //int temp = Integer.parseInt(dv.getDisplayValue().trim()); + // cell.setCellValue(temp); + //}else{ + // cell.setCellValue(strip.stripHtml(dv.getDisplayValue())); + //} + } else { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + } + } + } + + + } + else { + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("General")); + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + cell.setCellValue(strip.stripHtml(value)); + } + + //if (!(value.equals(""))){ + //int temp = Integer.parseInt(value.trim()); + //cell.setCellValue(temp); + //}else{ + // cell.setCellValue(strip.stripHtml(value)); + //} + //HSSFCellStyle styleFormat = null; + //HSSFCellStyle numberStyle = null; + //HSSFFont formatFont = null; + //short fgcolor = 0; + //short fillpattern = 0; + if (cellWidth.size() > cellNum) { + if (((Integer) cellWidth.get(cellNum)).intValue() < dv + .getDisplayValue().length()) + cellWidth.set((cellNum), + (value.length()<=Globals.getMaxCellWidthInExcel())?new Integer(value.length()):new Integer(Globals.getMaxCellWidthInExcel())); + } else + cellWidth.add((cellNum), (value.length()<=Globals.getMaxCellWidthInExcel())?new Integer(value.length()):new Integer(Globals.getMaxCellWidthInExcel())); + //System.out.println("1IF "+ (dv.isBold()) + " "+ value + " " + dv.getDisplayTotal() + " " + dv.getColName() ); + if (dv.isBold()) { + if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){ + if (value!=null && (value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + cell.setCellStyle(styleCurrencyTotal); + } + else { + cell.setCellStyle(styleTotal); + } + } else { + cell.setCellStyle(styleDefaultTotal); + } + bold = true; + } + //System.out.println("2IF "+ (dr.isRowFormat()) + " " + (dv.isCellFormat()) + " " + (styles!=null)); + if ((dr.isRowFormat() && !dv.isCellFormat()) && styles != null) { + //cell.setCellStyle((HSSFCellStyle) styles.get(nvl(dr.getFormatId(),"default"))); + continue; + } + //System.out.println("3IF "+ (htmlFormat != null) + " " + (dv.getFormatId() != null) + " " + (bold == false) + " "+ (styles != null)); + if (htmlFormat != null && dv.getFormatId() != null && bold == false + && styles != null) { + //cell.setCellStyle((HSSFCellStyle) styles.get(nvl(dv.getFormatId(),"default"))); + } //else if (bold == false) + //cell.setCellStyle(styleDefault); + } // dv.isVisible + } + rowNum += 1; + + } + + int cw = 0; + for (int i = 0; i < cellWidth.size(); i++) { + cw = ((Integer) cellWidth.get(i)).intValue() + 12; + // if(i!=cellWidth.size()-1) + sheet.setColumnWidth((short) (i), (short) ((cw * 8) / ((double) 1 / 20))); + // else + // sheet.setColumnWidth((short) (i + 1), (short) ((cw * 10) / + // ((double) 1 / 20))); + } + + // To Display Total Values for Linear report + if(rd.reportDataTotalRow!=null) { + row = sheet.createRow(rowNum); + cellNum = -1; + rd.reportTotalRowHeaderCols.resetNext(); + //for (rd.reportTotalRowHeaderCols.resetNext(); rd.reportTotalRowHeaderCols.hasNext();) { + cellNum += 1; + RowHeaderCol rhc = rd.reportTotalRowHeaderCols.getNext(); + RowHeader rh = rhc.getRowHeader(0); + row.createCell((short) cellNum).setCellValue(strip.stripHtml(rh.getRowTitle())); + row.getCell((short) cellNum).setCellStyle(styleDefaultTotal); + //} + + rd.reportDataTotalRow.resetNext(); + DataRow drTotal = rd.reportDataTotalRow.getNext(); + //cellNum = -1; + + drTotal.resetNext(); + drTotal.getNext(); + for (; drTotal.hasNext();) { + cellNum += 1; + cell = row.createCell((short) cellNum); + DataValue dv = drTotal.getNext(); + String value = dv.getDisplayValue(); + cell.setCellValue(value); + boolean bold = false; + if (dv.isBold()) { + if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){ + if (value!=null && (value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + cell.setCellStyle(styleCurrencyTotal); + } else { + cell.setCellStyle(styleTotal); + } + } else { + cell.setCellStyle(styleDefaultTotal); + } + bold = true; + } + } + } + + } catch (SQLException ex) { + ex.printStackTrace(); + throw new RaptorException(ex); + } catch (ReportSQLException ex) { + throw new RaptorException(ex); + } catch (Exception ex) { + if(!(ex.getCause() instanceof java.net.SocketException) ) + throw new RaptorException (ex); + } finally { + try { + if(conn!=null) + conn.close(); + if(st!=null) + st.close(); + if(rs!=null) + rs.close(); + } catch (SQLException ex) { + throw new RaptorException(ex); + } + } + + /*if(Globals.getShowDisclaimer() && !Globals.disclaimerPositionedTopInCSVExcel()) { + rowNum += 1; + row = sheet.createRow(rowNum); + cellNum = 0; + String disclaimer = Globals.getFooterFirstLine() + " " + Globals.getFooterSecondLine(); + row.createCell((short) cellNum).setCellValue(disclaimer); + sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum, (short) (columnRows))); + rowNum += 1; + }*/ + } else { + if(rr.getReportType().equals(AppConstants.RT_LINEAR)) { + int rowCount = 0; + for (rd.reportDataRows.resetNext(); rd.reportDataRows.hasNext();) { + DataRow dr = rd.reportDataRows.getNext(); + //List l = rd.getReportDataList(); + //for (int dataRow = 0; dataRow < l.size(); dataRow++) { + rowCount++; + + + //DataRow dr = (DataRow) l.get(dataRow); + row = sheet.createRow(rowNum); + + cellNum = -1; + + if (rr.getReportType().equals(AppConstants.RT_LINEAR) && rd.reportTotalRowHeaderCols!=null) { + rd.reportRowHeaderCols.resetNext(0); + if(rd.reportTotalRowHeaderCols!=null) { + //cellNum = -1; + //for (rd.reportRowHeaderCols.resetNext(); rd.reportRowHeaderCols.hasNext();) { + //cellNum += 1; + //RowHeaderCol rhc = rd.reportRowHeaderCols.getRowHeaderCol(0); + //if (firstPass) + // rhc.resetNext(); + //RowHeader rh = rhc.getRowHeader(rowCount-1); + //row.createCell((short) cellNum).setCellValue(rowCount); + //row.getCell((short) cellNum).setCellStyle(styleDefault); + //if (firstPass) + //cellWidth.add(cellNum, new Integer((rowCount+"").length())); + //else + //cellWidth.set(cellNum, new Integer((rowCount+"").length())); + + //} // for + } + + } else { + rd.reportRowHeaderCols.resetNext(0); + } + for (; rd.reportRowHeaderCols.hasNext();) { + cellNum += 1; + RowHeaderCol rhc = rd.reportRowHeaderCols.getNext(); + if (firstPass) + rhc.resetNext(); + RowHeader rh = rhc.getNext(); + row.createCell((short) cellNum).setCellValue(strip.stripHtml(rh.getRowTitle())); + row.getCell((short) cellNum).setCellStyle(styleDefault); + if (cellWidth.size() > 0) { + if (((Integer) cellWidth.get(cellNum)).intValue() < rh.getRowTitle() + .length()) + cellWidth.set(cellNum, new Integer(rh.getRowTitle().length())); + } else + cellWidth.add(cellNum, new Integer(rh.getRowTitle().length())); + + } // for + firstPass = false; + //cellNum = -1; + int j = 0; + + for (dr.resetNext(); dr.hasNext();j++) { + DataValue dv = dr.getNext(); + styleCell = null; + boolean bold = false; + String value = nvl(dv.getDisplayValue()); + value = strip.stripHtml(value); + HtmlFormatter htmlFormat = dv.getCellFormatter(); + if ((dr.isRowFormat() && !dv.isCellFormat()) && styles != null) + styleCell = (HSSFCellStyle) styles.get(nvl(dr.getFormatId(),"default")); + if (htmlFormat != null && dv.getFormatId() != null && styles != null) + styleCell = (HSSFCellStyle) styles.get(nvl(dv.getFormatId(),"default")); + + if(dv.isVisible()) { + cellNum += 1; + cell = row.createCell((short) cellNum); + //System.out.println("Stripping HTML 1"); + //cell.setCellValue(strip.stripHtml(value)); + String dataType = (String) (dataTypeMap.get(dv.getColId())); + //System.out.println(" The Display Value is ********"+value + " " + dv.getDisplayTotal() + " " + dv.getColName()); + + if (dataType!=null && dataType.equals("NUMBER")){ + //cellNumber = row.createCell((short) cellNum); + //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC); + //cellNumber.setCellValue(value); + //cellCurrencyNumber = row.createCell((short) cellNum); + int zInt = 0; + if (value.equals("null")){ + cell.setCellValue(zInt); + }else{ + + if ((value.indexOf("."))!= -1){ + if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + + //if (value.startsWith("$")){ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); + String tempDollar = value.trim(); + tempDollar = tempDollar.replaceAll(" ", "").substring(0); + tempDollar = tempDollar.replaceAll("\\$", "").substring(0); + //System.out.println("SUBSTRING |" + tempDollar); + //System.out.println("Before copy Value |" + tempDollar); + //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1); + //System.out.println("After copy Value |" + tempDollar); + if ((tempDollar.indexOf(","))!= -1){ + tempDollar = tempDollar.replaceAll(",", ""); + } + //System.out.println("The final string 1 is "+tempDollar); + double tempDoubleDollar = 0.0; + try { + tempDoubleDollar = Double.parseDouble(tempDollar); + if(styleCell!=null) { + styleCell.setDataFormat((short) 8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)")); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleCurrencyDecimalNumber); + cell.setCellValue(tempDoubleDollar); + } catch (NumberFormatException ne) { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + cell.setCellValue(tempDollar); + } + }else{ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); + double tempDouble = 0.0; + try { + tempDouble = Double.parseDouble(value); + if(styleCell!=null) { + styleCell.setDataFormat((short) 0x28);//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)")); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDecimalNumber); + cell.setCellValue(tempDouble); + } catch (NumberFormatException ne) { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + cell.setCellValue(value); + } + + } + }else { + if (!(value.equals(""))){ + if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + //if (value.startsWith("$")){ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); + String tempInt = value.trim(); + tempInt = tempInt.replaceAll(" ", "").substring(0); + tempInt = tempInt.replaceAll("\\$", "").substring(0); + //System.out.println("SUBSTRING |" + tempInt); + //System.out.println("Before copy Value |" + tempInt); + //tempInt = String.copyValueOf(tempInt.toCharArray(), 1, tempInt.length()-1); + //System.out.println("After copy Value |" + tempInt); + if ((tempInt.indexOf(","))!= -1){ + tempInt = tempInt.replaceAll(",", ""); + } + //System.out.println("The final string INT is "+tempInt); + Long tempIntDollar = 0L; + try { + tempIntDollar = Long.parseLong(tempInt); + if(styleCell!=null) { + styleCell.setDataFormat((short)6);//HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)")); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleCurrencyNumber); + cell.setCellValue(tempIntDollar); + } catch (NumberFormatException ne) { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + cell.setCellValue(tempInt); + } + }else{ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); + String tempStr = value.trim(); + if ((tempStr.indexOf(","))!= -1){ + tempStr = tempStr.replaceAll(",", ""); + } + Long temp = 0L; + + try { + temp = Long.parseLong(tempStr); + if(styleCell!=null) { + styleCell.setDataFormat((short)0x26);//HSSFDataFormat.getBuiltinFormat("(#,##0_);[Red](#,##0)")); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleNumber); + cell.setCellValue(temp); + } catch (NumberFormatException ne) { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + cell.setCellValue(tempStr); + } + + + } + //int temp = Integer.parseInt(value.trim()); + // cell.setCellValue(temp); + //}else{ + // cell.setCellValue(strip.stripHtml(value)); + //} + } + } + } + + }else if ( ( dataType !=null && dataType.equals("DATE")) || (dv.getDisplayName()!=null && dv.getDisplayName().toLowerCase().endsWith("date")) || + (dv.getColId()!=null && dv.getColId().toLowerCase().endsWith("date")) || + (dv.getColName()!=null && dv.getColName().toLowerCase().endsWith("date")) ) { + //cellDate = row.createCell((short) cellNum); + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("mm/dd/yy")); + + if(styleCell!=null) { + styleCell.setDataFormat((short)0xe); //HSSFDataFormat.getBuiltinFormat("m/d/yy")); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDate); + //String MY_DATE_FORMAT = "yyyy-MM-dd"; + Date date = null; + int flag = 0; + date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yy h:mm:ss")); + flag = 1; + } + if(date==null) + date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yy h:mm")); + flag = 1; + } + if(date==null) + date = MMDDYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yyyy")); + flag = 1; + } + if(date==null) + date = MMDDYYYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yyyy h:mm:ss")); + flag = 1; + } + if(date==null) + date = MMDDYYYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yyyy h:mm")); + flag = 1; + } + if(date==null) + date = MMDDYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yy")); + flag = 1; + } + if(date==null) + date = YYYYMMDDFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("yyyy/m/d")); + flag = 1; + } + if(date==null) + date = timestampFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("yyyy-m-d h:mm:ss")); //yyyy-MM-dd HH:mm:ss + flag = 1; + } + if(date==null) + date = MONYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("mmm yyyy")); + flag = 1; + } + if(date==null) + date = MMYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/yyyy")); + flag = 1; + } + if(date==null) + date = MMMMMDDYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("mmm/d/yyyy")); + flag = 1; + } + if(date==null) + date = MONTHYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("mmm/yyyy")); + flag = 1; + } + if(date==null) + date = YYYYMMDDHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("yyyy/m/d h:mm:ss")); + flag = 1; + } + if(date==null) + date = YYYYMMDDDASHFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("yyyy-m-d")); + flag = 1; + } + if(date==null) + date = YYYYMMDDHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("yyyy/m/d h:mm")); + flag = 1; + } + if(date==null) + date = DDMONYYYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("d-mmm-yyyy h:mm:ss")); + flag = 1; + } + if(date==null) + date = DDMONYYYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("d-mmm-yyyy h:mm")); + flag = 1; + } + if(date==null) + date = DDMONYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("d-mmm-yy h:mm")); + flag = 1; + } + if(date==null) + date = DDMONYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("d-mmm-yyyy")); + flag = 1; + } + if(date==null) + date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yy h:mm:ss")); + flag = 1; + } + if(date==null) + date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yy h:mm")); + flag = 1; + } + if(date==null) + date = MMDDYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yy")); + flag = 1; + } + if(date==null) + date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yy h:mm")); + flag = 1; + } + if(date==null) + date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yy h:mm:ss")); + flag = 1; + } + if(date==null) + date = MMDDYYYYHHMMZFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yyyy h:mm")); + flag = 1; + } + if(date==null) + date = MMMMMDDYYYYHHMMSS.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cell.getCellStyle().setDataFormat( + createHelper.createDataFormat().getFormat("m/d/yyyy h:mm")); + flag = 1; + } + + if(date!=null) { + //System.out.println("ExcelDate " + HSSFDateUtil.getExcelDate(date)); + cell.setCellValue(HSSFDateUtil.getExcelDate(date)); + try { + String str = cell.getStringCellValue(); + } catch (IllegalStateException ex) { /*cell.getCellStyle().setDataFormat((short)0);*/cell.setCellValue(value);} + } else { + /*cell.getCellStyle().setDataFormat((short)0);*/ + cell.setCellValue(value); + } + //cellDate.setCellValue(date); + //cellDate.setCellValue(value); + + }else if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){ + //cellNumber = row.createCell((short) cellNum); + //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC); + //cellNumber.setCellValue(value); + cell = row.createCell((short) cellNum); + int zInt = 0; + if (value.equals("null")){ + cell.setCellValue(zInt); + }else{ + + if ((value.indexOf("."))!= -1){ + if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + + //if (value.startsWith("$")){ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); + String tempDollar = value.trim(); + tempDollar = tempDollar.replaceAll(" ", "").substring(0); + tempDollar = tempDollar.replaceAll("\\$", "").substring(0); + //System.out.println("SUBSTRING |" + tempDollar); + //System.out.println("Before copy Value |" + tempDollar); + //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1); + //System.out.println("After copy Value |" + tempDollar); + if ((tempDollar.indexOf(","))!= -1){ + tempDollar = tempDollar.replaceAll(",", ""); + } + //System.out.println("The final string 2IF is "+tempDollar); + double tempDoubleDollar = 0.0; + try { + tempDoubleDollar = Double.parseDouble(tempDollar); + if(styleCell!=null) { + styleCell.setDataFormat((short)8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)")); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleCurrencyDecimalNumber); + cell.setCellValue(tempDoubleDollar); + } catch (NumberFormatException ne) { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + cell.setCellValue(tempDollar); + } + + + }else{ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); + String tempDoubleStr = value.trim(); + tempDoubleStr = tempDoubleStr.replaceAll(" ", "").substring(0); + if ((tempDoubleStr.indexOf(","))!= -1){ + tempDoubleStr = tempDoubleStr.replaceAll(",", ""); + } + double tempDouble = 0.0; + try { + tempDouble = Double.parseDouble(tempDoubleStr); + if(styleCell!=null) { + styleCell.setDataFormat((short) 0x28); // for decimal + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDecimalNumber); + cell.setCellValue(tempDouble); + } catch (NumberFormatException ne) { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + cell.setCellValue(tempDoubleStr); + } + } + + }else { + if (!(value.equals(""))){ + if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + //if (value.startsWith("$")){ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); + String tempInt = value.trim(); + tempInt = tempInt.replaceAll(" ", "").substring(0); + tempInt = tempInt.replaceAll("\\$", "").substring(0); + //System.out.println("SUBSTRING |" + tempInt); + //System.out.println("Before copy Value |" + tempInt); + //tempInt = String.copyValueOf(tempInt.toCharArray(), 1, tempInt.length()-1); + //System.out.println("After copy Value |" + tempInt); + if ((tempInt.indexOf(","))!= -1){ + tempInt = tempInt.replaceAll(",", ""); + } + //System.out.println("The final string INT 2 is "+tempInt); + + Long tempIntDollar = 0L; + + try { + tempIntDollar = Long.parseLong(tempInt); + if(styleCell!=null) { + styleCell.setDataFormat((short) 6); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleCurrencyNumber); + cell.setCellValue(tempIntDollar); + } catch (NumberFormatException ne) { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + cell.setCellValue(tempInt); + } + }else{ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); + String tempStr = value.trim(); + if ((tempStr.indexOf(","))!= -1){ + tempStr = tempStr.replaceAll(",", ""); + } + Long temp = 0L; + + try { + temp = Long.parseLong(tempStr); + if(styleCell!=null) { + styleCell.setDataFormat((short) 0x26); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleNumber); + cell.setCellValue(temp); + } catch (NumberFormatException ne) { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + cell.setCellValue(tempStr); + } + } + //int temp = Integer.parseInt(value.trim()); + // cell.setCellValue(temp); + //}else{ + // cell.setCellValue(strip.stripHtml(value)); + //} + } else { + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + } + } + } + + + } + else { + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("General")); + if(styleCell!=null) { + styleCell.setWrapText(true); + cell.setCellStyle(styleCell); + } else + cell.setCellStyle(styleDefault); + cell.setCellValue(strip.stripHtml(value)); + } + + //if (!(value.equals(""))){ + //int temp = Integer.parseInt(value.trim()); + //cell.setCellValue(temp); + //}else{ + // cell.setCellValue(strip.stripHtml(value)); + //} + //HSSFCellStyle styleFormat = null; + //HSSFCellStyle numberStyle = null; + //HSSFFont formatFont = null; + //short fgcolor = 0; + //short fillpattern = 0; + if (cellWidth.size() > cellNum) { + if (((Integer) cellWidth.get(cellNum)).intValue() < dv + .getDisplayValue().length()) + cellWidth.set((cellNum), + (value.length()<=Globals.getMaxCellWidthInExcel())?new Integer(value.length()):new Integer(Globals.getMaxCellWidthInExcel())); + } else + cellWidth.add((cellNum), (value.length()<=Globals.getMaxCellWidthInExcel())?new Integer(value.length()):new Integer(Globals.getMaxCellWidthInExcel())); + //System.out.println("1IF "+ (dv.isBold()) + " "+ value + " " + dv.getDisplayTotal() + " " + dv.getColName() ); + if (dv.isBold()) { + if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){ + if (value!=null && (value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + cell.setCellStyle(styleCurrencyTotal); + } + else { + cell.setCellStyle(styleTotal); + } + } else { + cell.setCellStyle(styleDefaultTotal); + } + bold = true; + } + //System.out.println("2IF "+ (dr.isRowFormat()) + " " + (dv.isCellFormat()) + " " + (styles!=null)); + if ((dr.isRowFormat() && !dv.isCellFormat()) && styles != null) { + //cell.setCellStyle((HSSFCellStyle) styles.get(nvl(dr.getFormatId(),"default"))); + continue; + } + //System.out.println("3IF "+ (htmlFormat != null) + " " + (dv.getFormatId() != null) + " " + (bold == false) + " "+ (styles != null)); + if (htmlFormat != null && dv.getFormatId() != null && bold == false + && styles != null) { + // cell.setCellStyle((HSSFCellStyle) styles.get(nvl(dv.getFormatId(),"default"))); + } //else if (bold == false) + //cell.setCellStyle(styleDefault); + } // if (dv.isVisible) + } // for + + /*for (int tmp=0; tmp rowNames = dr.getRowValues(); + for(dr.resetNext(); dr.hasNext(); rowCount++ ) { + if(first) { + if(rowNames!=null) { + for(int i=0; i0) { + cellNum += 1; + row.createCell((short) cellNum).setCellValue(strip.stripHtml(dv.getDisplayValue())); + //row.getCell((short) cellNum).setCellStyle(styleDefault); + if(nvl(dv.getFormatId()).length()>0) + row.getCell((short) cellNum).setCellStyle((HSSFCellStyle) styles.get(nvl(dv.getFormatId(),"default"))); + else + row.setRowStyle((HSSFCellStyle) styles.get(nvl(dr.getFormatId(),"default"))); + } else { + cellNum += 1; + row.createCell((short) cellNum).setCellValue(strip.stripHtml(value)); + row.getCell((short) cellNum).setCellStyle(styleDefault); + } // end + value = dv.getDisplayValue(); + if(value.indexOf("|#")!=-1) { + String color = value.substring(value.indexOf("|")+1); + if(color.equals("#FF0000")) + row.getCell((short) cellNum).setCellStyle((HSSFCellStyle) styles.get("red")); + else if (color.equals("#008000")) + row.getCell((short) cellNum).setCellStyle((HSSFCellStyle) styles.get("green")); + else if (color.equals("#FFFF00")) + row.getCell((short) cellNum).setCellStyle((HSSFCellStyle) styles.get("yellow")); + else { + row.getCell((short) cellNum).setCellStyle((HSSFCellStyle) styles.get("default")); + } + + } + } + } + rowNum += 1; + int cw = 0; + for (int i = 0; i < cellWidth.size(); i++) { + cw = ((Integer) cellWidth.get(i)).intValue() + 12; + // if(i!=cellWidth.size()-1) + sheet.setColumnWidth((short) (i), (short) ((cw * 8) / ((double) 1 / 20))); + // else + // sheet.setColumnWidth((short) (i + 1), (short) ((cw * 10) / + // ((double) 1 / 20))); + } + + + } // for + + } + + + } + + String footer = (String) session.getAttribute("FOOTER_"+index); + if(nvl(footer).length()>0) { + footer = Utils.replaceInString(footer, "
    ", " "); + footer = Utils.replaceInString(footer, "
    ", " "); + footer = Utils.replaceInString(footer, "
    ", " "); + footer = strip.stripHtml(nvl(footer).trim()); + row = sheet.createRow(rowNum); + cellNum = 0; + row.createCell((short) cellNum).setCellValue(footer); + sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum, (short) (columnRows))); + //sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum+columnRows, (short) (cellNum))); + rowNum += 1; + } + + if(Globals.getShowDisclaimer() && !Globals.disclaimerPositionedTopInCSVExcel()) { + + rowNum += 1; + row = sheet.createRow(rowNum); + cellNum = 0; + String disclaimer = Globals.getFooterFirstLine() + " " + Globals.getFooterSecondLine(); + row.createCell((short) cellNum).setCellValue(disclaimer); + sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum, (short) (columnRows))); + rowNum += 1; + } + + logger.debug(EELFLoggerDelegate.debugLogger, ("##### Heap utilization statistics [MB] #####")); + logger.debug(EELFLoggerDelegate.debugLogger, ("Used Memory:" + + (runtime.maxMemory() - runtime.freeMemory()) / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("Free Memory:" + + runtime.freeMemory() / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("Total Memory:" + runtime.totalMemory() / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("Max Memory:" + runtime.maxMemory() / mb)); + return returnValue; + + } + + private void paintExcelHeader(HSSFWorkbook wb, int rowNum, int col, String reportTitle, + String reportDescr, HSSFSheet sheet) { + short s1 = 0, s2 = (short) (col-1); + rowNum += 1; + sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2)); + HSSFRow row = null, row1 = null; + + row = sheet.createRow(rowNum); + // Header Style + HSSFCellStyle styleHeader = wb.createCellStyle(); + styleHeader.setAlignment(HSSFCellStyle.ALIGN_CENTER); + HSSFFont font = wb.createFont(); + font.setFontHeight((short) (font_header_title_size / 0.05)); //14 + font.setFontName("Tahoma"); + font.setColor(HSSFColor.BLACK.index); + styleHeader.setFont(font); + + HSSFCell cell = row.createCell((short) 0); + cell.setCellValue(reportTitle); + cell.setCellStyle(styleHeader); + HSSFHeader header = sheet.getHeader(); + header.setCenter(HSSFHeader.font("Tahoma", "")+ HSSFHeader.fontSize((short) 9)+" " + reportTitle); + + //header.setCenter(HSSFHeader.font("Tahoma", "")+ HSSFHeader.fontSize((short) 9)+reportTitle+"\n"+((Globals.getShowDescrAtRuntime() && nvl(reportDescr).length() > 0)?reportDescr:"")); + + // Report Description + if (Globals.getShowDescrAtRuntime() && nvl(reportDescr).length() > 0) { + rowNum += 1; + sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2)); + HSSFCellStyle styleDescription = wb.createCellStyle(); + styleDescription.setAlignment(HSSFCellStyle.ALIGN_CENTER); + HSSFFont fontDescr = wb.createFont(); + fontDescr.setFontHeight((short) font_header_descr_size); + fontDescr.setFontName("Tahoma"); + fontDescr.setColor(HSSFColor.BLACK.index); + styleDescription.setFont(fontDescr); + HSSFCell cellDescr = row.createCell((short) 0); + cellDescr.setCellValue(reportDescr); + cellDescr.setCellStyle(styleHeader); + } + + if(Globals.disclaimerPositionedTopInCSVExcel()) { + rowNum += 1; + row = sheet.createRow(rowNum); + sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2)); + HSSFCellStyle styleDescription = wb.createCellStyle(); + styleDescription.setAlignment(HSSFCellStyle.ALIGN_CENTER); + HSSFFont fontDescr = wb.createFont(); + fontDescr.setFontHeight((short) (font_size / 0.05)); //14 + fontDescr.setFontName("Tahoma"); + fontDescr.setColor(HSSFColor.BLACK.index); + fontDescr.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + styleDescription.setFont(fontDescr); + HSSFCell cellDescr = row.createCell((short) 0); + String disclaimer = Globals.getFooterFirstLine() + " " + Globals.getFooterSecondLine(); + cellDescr.setCellValue(disclaimer); + cellDescr.setCellStyle(styleDescription); + } + + rowNum += 1; + row = sheet.createRow(rowNum); + // System.out.println(" Last Row " + wb.getSheetAt(0).getLastRowNum()); + } + + private void paintExcelFooter(HSSFWorkbook wb, int rowNum, int col, HSSFSheet sheet) { + logger.debug(EELFLoggerDelegate.debugLogger, ("excel footer")); + //HSSFSheet sheet = wb.getSheet(getSheetName()); + HSSFFooter footer = sheet.getFooter(); + footer.setLeft(HSSFFooter.font("Tahoma", "")+ HSSFFooter.fontSize((short) font_footer_size)+ "Page " + HSSFFooter.page() + + " of " + HSSFFooter.numPages() ); + footer.setCenter(HSSFFooter.font("Tahoma", "")+ HSSFFooter.fontSize((short) font_footer_size)+Globals.getFooterFirstLine()+"\n"+Globals.getFooterSecondLine()); + //footer.setCenter(HSSFFooter.font("Tahoma", "Italic")+ HSSFFooter.fontSize((short) 16))+Globals.getFooterSecondLine()); +/* footer.font("Tahoma"); + short s1 = 0, s2 = (short) (col-1); + rowNum += 1; + sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2)); + HSSFRow row = null, row1 = null; + + row = sheet.createRow(rowNum); + // Header Style + HSSFCellStyle styleFooter = wb.createCellStyle(); + styleFooter.setAlignment(HSSFCellStyle.ALIGN_CENTER); + HSSFFont font = wb.createFont(); + font.setFontHeight((short) (10 / 0.05)); + font.setFontName("Tahoma"); + font.setColor(HSSFColor.BLACK.index); + font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + styleFooter.setFont(font); + + HSSFCell cell = row.createCell((short) 0); + debugLogger.debug(Globals.getFooterFirstLine()); + cell.setCellValue(Globals.getFooterFirstLine()); + cell.setCellStyle(styleFooter); + + rowNum += 1; + sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2)); + row = sheet.createRow(rowNum); + cell = row.createCell((short) 0); + debugLogger.debug(Globals.getFooterSecondLine()); + cell.setCellValue(Globals.getFooterSecondLine()); + cell.setCellStyle(styleFooter); +*/ + logger.debug(EELFLoggerDelegate.debugLogger, ("Done")); + } + + public String saveAsExcelFile(HttpServletRequest request, ReportData rd, + ArrayList reportParamNameValues, String reportTitle, String reportDescr) { + return saveAsExcelFile(request, rd, reportParamNameValues, reportTitle, reportDescr, 2); //2 denotes ReportRuntime object should be taken from session. + } + public String saveAsExcelFile(HttpServletRequest request, ReportData rd, + ArrayList reportParamNameValues, String reportTitle, String reportDescr, int requestFlag) { + setSheetName(Globals.getSheetName()); + try { + ReportRuntime rr; + if(requestFlag == 2) + rr = (ReportRuntime) request.getSession().getAttribute( + AppConstants.SI_REPORT_RUNTIME); + else + rr = (ReportRuntime) request.getAttribute( + AppConstants.SI_REPORT_RUNTIME); + HSSFWorkbook wb = new HSSFWorkbook(); + HashMap styles = new HashMap(); + if (rr != null) + styles = loadStyles(rr, wb); + String xlsFName = AppUtils.generateUniqueFileName(request, rr.getReportName(), AppConstants.FT_XLS); + logger.debug(EELFLoggerDelegate.debugLogger, ("Xls File name " + + AppUtils.getTempFolderPath() + + xlsFName)); + FileOutputStream xlsOut = new FileOutputStream(AppUtils.getTempFolderPath() + + xlsFName); + // BufferedWriter xlsOut = new BufferedWriter(new + // FileWriter(AppUtils + // .getTempFolderPath() + // + xlsFName)); + + int col = 0; + //System.out.println("Row Header Count " + rd.reportRowHeaderCols.getRowCount()); + //System.out.println("Total Count " + rd.getTotalColumnCount()); + + if (!rd.reportRowHeaderCols.hasNext()) + col = rd.getTotalColumnCount(); + else + col = rd.getTotalColumnCount(); + int rowNum = 0; + HSSFSheet sheet = wb.createSheet(getSheetName()); + + if (Globals.getPrintTitleInDownload()&& reportTitle != null ) { + paintExcelHeader(wb, rowNum, col, reportTitle, reportDescr, sheet); + rowNum = sheet.getLastRowNum(); + } else + rowNum = 0; + if (Globals.getPrintParamsInDownload() && rr.getParamNameValuePairsforPDFExcel(request, 1) != null) { + paintExcelParams(wb,rowNum,col,rr.getParamNameValuePairsforPDFExcel(request, 1), rr.getFormFieldComments(request), sheet, reportTitle, reportDescr); + } // if + rowNum = sheet.getLastRowNum(); + //System.out.println(" rowNum after Params " + rowNum); + paintExcelData(wb, rowNum, col, rd, styles,rr, sheet, "", xlsOut, request); + if (Globals.getPrintFooterInDownload() ) { + rowNum = sheet.getLastRowNum(); + rowNum += 2; + paintExcelFooter(wb, rowNum, col, sheet); + } + //response.setContentType("application/vnd.ms-excel"); + //response.setHeader("Content-disposition", "attachment;filename=download_all_" + // + user_id + ".xls"); + wb.write(xlsOut); + xlsOut.flush(); + xlsOut.close(); + return xlsFName; + } catch (Exception e) { + e.printStackTrace(); + (new ErrorHandler()).processError(request, "Exception saving data to EXCEL file: " + + e.getMessage()); + return null; + } + } // saveAsExcelFile + + public void createExcelFileContent(Writer out, ReportData rd, ReportRuntime rr, HttpServletRequest request, + HttpServletResponse response, String user_id, int type) throws IOException, RaptorException { + // Adding utility for downloading Dashboard reports. + + HashMap styles = new HashMap(); + HttpSession session = request.getSession(); + ServletOutputStream sos = null; + BufferedInputStream buf = null; + HSSFWorkbook wb = null; +// if(session.getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null) +// ReportRuntime rrDashboard = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); + String formattedDate = ""; + String xlsFName = ""; + int returnValue = 0; + boolean isDashboard = false; + if ((session.getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null) && ( ((String) session.getAttribute(AppConstants.SI_DASHBOARD_REP_ID)).equals(rr.getReportID())) ) { + isDashboard = true; + } + if(isDashboard) { + try { + formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date()); + xlsFName = "dashboard"+formattedDate+user_id+".xls"; + + FileInputStream xlsIn = null; + POIFSFileSystem fileSystem = null; + buf = null; + FileOutputStream xlsOut = null; + + +/* try { + xlsIn = new FileInputStream (AppUtils.getTempFolderPath() + + xlsFName); + } + catch (FileNotFoundException e) { + System.out.println ("File not found in the specified path."); + e.printStackTrace (); + } + if(xlsIn != null) { + fileSystem = new POIFSFileSystem (xlsIn); + wb = new HSSFWorkbook(fileSystem); + } else { + xlsOut = new FileOutputStream(AppUtils.getTempFolderPath() + + xlsFName); + wb = new HSSFWorkbook(); + } +*/ + + Map reportRuntimeMap = null; + Map reportDataMap = null; + //Map reportDisplayTypeMap = null; + reportRuntimeMap = (TreeMap) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP); + reportDataMap = (TreeMap) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP); + //reportDisplayTypeMap = (TreeMap) request.getSession().getAttribute(AppConstants.SI); + HSSFSheet sheet = null; + if(reportRuntimeMap!=null) { + //ServletOutputStream sos = response.getOutputStream(); + Set setReportRuntime = reportRuntimeMap.entrySet(); + Set setReportDataMap = reportDataMap.entrySet(); + Iterator iter2 = setReportDataMap.iterator(); + int count = 0; + + for(Iterator iter = setReportRuntime.iterator(); iter.hasNext(); ) { + count++; + try { + xlsIn = new FileInputStream (AppUtils.getTempFolderPath() + + xlsFName); + } + catch (FileNotFoundException e) { + System.out.println ("File not found in the specified path."); + //e.printStackTrace (); + } + if(xlsIn != null) { + fileSystem = new POIFSFileSystem (xlsIn); + wb = new HSSFWorkbook(fileSystem); + xlsOut = new FileOutputStream(AppUtils.getTempFolderPath() + + xlsFName); + } else { + xlsOut = new FileOutputStream(AppUtils.getTempFolderPath() + + xlsFName); + wb = new HSSFWorkbook(); + } + + Map.Entry entryData = (Entry) iter2.next(); + Map.Entry entry = (Entry) iter.next(); + //String rep_id = (String) entry.getKey(); + ReportRuntime rrDashRep = (ReportRuntime) entry.getValue(); + ReportData rdDashRep = (ReportData) entryData.getValue(); + //styles = loadStyles(rrDashRep, wb); + int col = 0; + String reportTitle = (nvl(rrDashRep.getReportTitle()).length()>0?rrDashRep.getReportTitle():rrDashRep.getReportName()); + String reportDescr = rrDashRep.getReportDescr(); + if (!rdDashRep.reportRowHeaderCols.hasNext()) + col = rdDashRep.getTotalColumnCount(); + else + col = rdDashRep.getTotalColumnCount(); + if(col==0) col=10; + int rowNum = 0; + String formattedReportName = new HtmlStripper().stripSpecialCharacters(rrDashRep.getReportName()); + + try { + sheet = wb.createSheet(formattedReportName); + sheet.getPrintSetup().setLandscape(true); + styles = loadStyles(rrDashRep, wb); + } catch (IllegalArgumentException ex) { wb.write(xlsOut);xlsOut.flush();xlsOut.close();continue;} + + if (Globals.getPrintTitleInDownload()&& reportTitle != null ) { + paintExcelHeader(wb, rowNum, col, reportTitle, reportDescr, sheet); + rowNum = sheet.getLastRowNum(); + } else + rowNum = 0; + //getting ReportRuntime object from session + if (Globals.getPrintParamsInDownload() && rrDashRep.getParamNameValuePairsforPDFExcel(request, 1) != null) { + if(count > 1 && Globals.showParamsInAllDashboardReports()) + paintExcelParams(wb,rowNum,col,rrDashRep.getParamNameValuePairsforPDFExcel(request, 1), rrDashRep.getFormFieldComments(request), sheet, reportTitle, reportDescr); + else if (count == 1) + paintExcelParams(wb,rowNum,col,rrDashRep.getParamNameValuePairsforPDFExcel(request, 1), rrDashRep.getFormFieldComments(request), sheet, reportTitle, reportDescr); + } // if + rowNum = sheet.getLastRowNum(); + String sql_whole = rrDashRep.getWholeSQL(); + returnValue = paintExcelData(wb, rowNum, col, rdDashRep, styles,rrDashRep, sheet, sql_whole, xlsOut, request); + if( returnValue == 0 ) { + if (Globals.getPrintFooterInDownload()) { + rowNum = sheet.getLastRowNum(); + rowNum += 2; + paintExcelFooter(wb, rowNum, col, sheet); + } + //wb.write(sos); + wb.write(xlsOut); + //TODO Remove comment + xlsOut.flush(); + xlsOut.close(); + wb = null; + } else { + //xlsOut.flush(); + //xlsOut.close(); + //response.reset(); + //response.setContentType("application/vnd.ms-excel"); +// RequestDispatcher dispatcher = request.getRequestDispatcher("raptor.htm?r_action=report.message"); +// request.setAttribute("message", Globals.getUserDefinedMessageForMemoryLimitReached()); +// try { +// dispatcher.forward(request, response); +// } catch (ServletException ex) {} + } + } + + response.reset(); + response.setContentType("application/vnd.ms-excel"); + response.setHeader("Content-disposition", "attachment;filename="+"dashboard"+formattedDate+user_id+".xls"); + sos = response.getOutputStream(); + xlsIn = new FileInputStream (AppUtils.getTempFolderPath() + + xlsFName); + buf = new BufferedInputStream(xlsIn); + int readBytes = 0; + byte [] bOut = new byte [4096]; + //read from the file; write to the ServletOutputStream + //while ((readBytes = buf.read()) != -1) + while ((readBytes = buf.read (bOut, 0, 4096))> 0) { + buf.available(); + sos.write (bOut, 0, readBytes); + } + + //sos.write(readBytes); + } + } catch (IOException ex) { ex.printStackTrace(); throw ex;} + + finally { + if (sos != null) + sos.close(); + if (buf != null) + buf.close(); + } + + File f = new File (AppUtils.getTempFolderPath() + + xlsFName); + if(f.exists()) f.delete(); + + } else { + wb = new HSSFWorkbook(); + // PrintWriter xlsOut = new PrintWriter(out).; + setSheetName(Globals.getSheetName()); + //ServletOutputStream sos = response.getOutputStream(); + //PrintWriter outWriter = response.getWriter(); + if (rr != null) + styles = loadStyles(rr, wb); + /* int col = 0; + if (!rd.reportRowHeaderCols.hasNext()) + col = rd.getTotalColumnCount(); + else + col = rd.getTotalColumnCount() + 1; + int rowNum = 0; + String reportTitle = rr.getReportName(); + String reportDescr = rr.getReportDescr(); + // if (Globals.getPrintTitleInDownload() && reportTitle != null) { + HSSFSheet sheet = wb.createSheet(getSheetName()); + System.out.println(" Title " + Globals.getPrintTitleInDownload()); + + if (Globals.getPrintTitleInDownload()&& reportTitle != null ) { + paintExcelHeader(wb, rowNum, col, reportTitle, reportDescr); + rowNum = wb.getSheetAt(0).getLastRowNum(); + } else + rowNum = 0; + System.out.println(" Params " + Globals.getPrintParamsInDownload()); + if (Globals.getPrintParamsInDownload() && rr.getParamNameValuePairs() != null) { + paintExcelParams(wb,rowNum,col,rr.getParamNameValuePairs()); + } // if + paintExcelData(wb, rowNum, col, rd, styles); + rowNum = wb.getSheetAt(0).getLastRowNum(); + */ + int col = 0; + //System.out.println("Row Header Count " + rd.reportRowHeaderCols.getRowCount()); + //System.out.println("Total Count " + rd.getTotalColumnCount()); + String reportTitle = (nvl(rr.getReportTitle()).length()>0?rr.getReportTitle():rr.getReportName()); + String reportDescr = rr.getReportDescr(); + + col = getColumnCountForDownloadFile(rr,rd); + /*if (!rd.reportRowHeaderCols.hasNext()) + col = rd.getTotalColumnCount(); + else + col = rd.getTotalColumnCount(); + */ + int rowNum = 0; + HSSFSheet sheet = wb.createSheet(getSheetName()); + sheet.getPrintSetup().setLandscape(true); + + if (Globals.getPrintTitleInDownload()&& reportTitle != null ) { + paintExcelHeader(wb, rowNum, col, reportTitle, reportDescr, sheet); + rowNum = sheet.getLastRowNum(); + } else + rowNum = 0; + if (Globals.getPrintParamsInDownload() && rr.getParamNameValuePairsforPDFExcel(request, 1) != null) { + ArrayList paramsList = rr.getParamNameValuePairsforPDFExcel(request, 1); + if(paramsList.size()<=0) { + paramsList = (ArrayList) request.getSession().getAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO); + } + + paintExcelParams(wb,rowNum,col,paramsList, rr.getFormFieldComments(request), sheet, reportTitle, reportDescr); + } // if + rowNum = sheet.getLastRowNum(); + + String formattedReportName = new HtmlStripper().stripSpecialCharacters(rr.getReportName()); + formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date()); + response.reset(); + response.setContentType("application/vnd.ms-excel"); + response.setHeader("Content-disposition", "attachment;filename="+formattedReportName+formattedDate+user_id+".xls"); + sos = response.getOutputStream(); + + if(type == 3 && rr.getSemaphoreList()==null && !(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) ) { //type = 3 is whole + //String sql_whole = (String) request.getAttribute(AppConstants.RI_REPORT_SQL_WHOLE); + String sql_whole = rr.getWholeSQL(); + returnValue = paintExcelData(wb, rowNum, col, rd, styles,rr, sheet, sql_whole, sos, request); + } else if(type == 2) { + returnValue = paintExcelData(wb, rowNum, col, rd, styles,rr, sheet, "", sos, request); + } else { + //String sql_whole = (String) request.getAttribute(AppConstants.RI_REPORT_SQL_WHOLE); + int downloadLimit = (rr.getMaxRowsInExcelDownload()>0)?rr.getMaxRowsInExcelDownload():Globals.getDownloadLimit(); + String action = request.getParameter(AppConstants.RI_ACTION); + if(!(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) && !action.endsWith("session")) { + rd = rr.loadReportData(-1, AppUtils.getUserID(request), downloadLimit,request, false /*download*/); + } + if(rr.getSemaphoreList()!=null) { + if(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) { + returnValue = paintExcelData(wb, rowNum, col, rd, styles,rr, sheet, "", sos, request); + } else { + rd = rr.loadReportData(-1, AppUtils.getUserID(request), downloadLimit,request, true); + returnValue = paintExcelData(wb, rowNum, col, rd, styles,rr, sheet, "", sos, request); + } + } else { + returnValue = paintExcelData(wb, rowNum, col, rd, styles,rr, sheet, rr.getWholeSQL(), sos, request); + } + } + if( returnValue == 0 ) { + if (Globals.getPrintFooterInDownload()) { + rowNum = sheet.getLastRowNum(); + rowNum += 2; + paintExcelFooter(wb, rowNum, col, sheet); + } + //Alternatively: + wb.setPrintArea( + 0, //sheet index + 0, //start column + col, //end column + 0, //start row + rowNum //end row + ); + //TODO Remove comment + wb.write(sos); + sos.flush(); + sos.close(); + wb = null; + } else { + //sos.flush(); + //sos.close(); +/* response.reset(); + + RequestDispatcher dispatcher = request.getRequestDispatcher("/raptor.htm?action=raptor&r_action=report.message"); + request.setAttribute("message", Globals.getUserDefinedMessageForMemoryLimitReached()); + try { + dispatcher.forward(request, response); + } catch (ServletException ex) {} +*/ + } + } + } + + + public void createFlatFileContent(Writer out, ReportData rd, ReportRuntime rr, + HttpServletRequest request, HttpServletResponse response, String user_id) + throws IOException, Exception { + ReportHandler rephandler = new ReportHandler(); + String reportID = rr.getReportID(); + rr = rephandler.loadReportRuntime(request, reportID); + String query = rr.getWholeSQL(); + String dbInfo = rr.getDbInfo(); + //File f = new File(request.(arg0)("/")); + DataSet ds = ConnectionUtils.getDataSet(query, dbInfo); + + //Writing Column names to the file + List l = rr.getAllColumns(); + StringBuffer allColumnsBuffer = new StringBuffer(); + DataColumnType dct = null; + + for (Iterator iter = l.iterator(); iter.hasNext();) { + dct = (DataColumnType) iter.next(); + allColumnsBuffer.append(dct.getDisplayName()); + if(iter.hasNext()) + allColumnsBuffer.append("|"); + } + rd = rr.loadReportData(-1, user_id, -1,request, true); + //PrintWriter txtOut = new PrintWriter(out); + //response.setContentType("application/notepad"); + //response.setHeader("Content-disposition", "attachment;filename=download_all_"+AppUtils.getUserID(request)+".txt"); + ServletOutputStream sos = response.getOutputStream(); + + //No Report Title for flat file. +// if (Globals.getPrintTitleInDownload() && reportTitle != null) { +// txtOut.println(); +// txtOut.println("\"" + reportTitle + "\""); +// txtOut.println(); +// if (Globals.getShowDescrAtRuntime() && nvl(reportDescr).length() > 0) { +// txtOut.println("\"" + reportDescr + "\""); +// txtOut.println(); +// } +// } // if + // No Params either +// int count = 0; +// if (Globals.getPrintParamsInDownload() && reportParamNameValues != null) { +// for (Iterator iter = reportParamNameValues.iterator(); iter.hasNext();) { +// count += 1; +// if(count == 1) txtOut.println(); +// IdNameValue value = (IdNameValue) iter.next(); +// txtOut.println(value.getId() + " = " + value.getName()); +// if(!iter.hasNext()) txtOut.println(); +// } // for +// } // if + + + + boolean firstPass = true; + for (rd.reportDataRows.resetNext(); rd.reportDataRows.hasNext();) { + DataRow dr = rd.reportDataRows.getNext(); + for (rd.reportRowHeaderCols.resetNext(1); rd.reportRowHeaderCols.hasNext();) { + RowHeaderCol rhc = rd.reportRowHeaderCols.getNext(); + if (firstPass) + rhc.resetNext(); + RowHeader rh = rhc.getNext(); + + sos.print(rh.getRowTitle()); + if(rhc.hasNext()) sos.print("|"); + } // for + firstPass = false; + + for (dr.resetNext(); dr.hasNext();) { + DataValue dv = dr.getNext(); + + sos.print( dv.getDisplayValue()); + if(dr.hasNext()) sos.print("|"); + } // for + + sos.println(); + } // for + //sos.flush(); + sos.close(); + } // createFlatFileContent + + + public void createExcel2007FileContent(Writer out, ReportData rd, ReportRuntime rr, HttpServletRequest request, + HttpServletResponse response, String user_id, int type) + throws Exception { + + // to check performance + int mb = 1024*1024; + Runtime runtime = Runtime.getRuntime(); + + logger.debug(EELFLoggerDelegate.debugLogger, ("STARTING.EXCELX DOWNLOAD....")); + logger.debug(EELFLoggerDelegate.debugLogger, ("##### Heap utilization statistics [MB] #####")); + logger.debug(EELFLoggerDelegate.debugLogger, ("Used Memory:" + + (runtime.totalMemory() - runtime.freeMemory()) / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("Free Memory:" + + runtime.freeMemory() / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("Total Memory:" + runtime.totalMemory() / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("Max Memory:" + runtime.maxMemory() / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("##### END #####")); + + // Adding utility for downloading Dashboard reports. + + Map styles = new HashMap(); + HttpSession session = request.getSession(); + ServletOutputStream sos = null; + BufferedInputStream buf = null; + XSSFWorkbook wb = null; + String formattedReportName = new HtmlStripper().stripSpecialCharacters(rr.getReportName()); + String formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date()); + //Sheet name to be filled is taken from property. How would this be called if it is Dashboard? + //commented out since application will create and leave it blank. + //setSheetName(Globals.getSheetName()); + boolean isDashboard = false; + if ((session.getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null) && ( ((String) session.getAttribute(AppConstants.SI_DASHBOARD_REP_ID)).equals(rr.getReportID())) ) { + isDashboard = true; + } + //boolean isDashboard = (session.getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null); + ArrayList sheetArrayList = new ArrayList(); + + Map reportRuntimeMap = null; + Map reportDataMap = null; + + ArrayList reportIDList = new ArrayList(); + + //Map reportDisplayTypeMap = null; + if(isDashboard) { + reportRuntimeMap = (TreeMap) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP); + reportDataMap = (TreeMap) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP); + + if(reportRuntimeMap!=null) { + Set setReportRuntime = reportRuntimeMap.entrySet(); + for(Iterator iter = setReportRuntime.iterator(); iter.hasNext(); ) { + Map.Entry entry = (Entry) iter.next(); + ReportRuntime rrDashRep = (ReportRuntime) entry.getValue(); + reportIDList.add(rrDashRep.getReportID()); + } + } + } + + + + + int col = 0; + String reportTitle = (nvl(rr.getReportTitle()).length()>0?rr.getReportTitle():rr.getReportName()); + String reportDescr = rr.getReportDescr(); + + // Total Columns visible in excel + //col = getColumnCountForDownloadFile(rr, rd); + + int rowNum = 0; + + + XSSFSheet sheet = null; + //save the template + String filename = ""; + String extension = ""; + + String sheetRef = null; + + FileOutputStream os = null; //template file + File templateFile = null; + + if(isDashboard) { + if(reportRuntimeMap!=null) { + + FileInputStream readTemplate = null; + //Load customized styles + int count = 0; + + //If template supplied by Application + String templateFilename = rr.getTemplateFile(); + extension = templateFilename.substring(templateFilename.lastIndexOf(".")+1); + filename = formattedReportName+formattedDate+user_id; + + Set setReportRuntimeWB = reportRuntimeMap.entrySet(); + for(Iterator iter = setReportRuntimeWB.iterator(); iter.hasNext(); ) { + count++; + Map.Entry entry = (Entry) iter.next(); + ReportRuntime rrDashRep = (ReportRuntime) entry.getValue(); + os = new FileOutputStream(AppUtils.getTempFolderPath()+ filename+"T."+ nvls(extension, "xlsx")); + + if(count==1) { + if(nvl(rr.getTemplateFile()).length()>0) { + readTemplate = new FileInputStream(org.openecomp.portalsdk.analytics.system.AppUtils.getExcelTemplatePath()+rr.getTemplateFile()); + wb=new XSSFWorkbook(readTemplate); + } else { + //copy the os file to new file and open new file in below line + wb=new XSSFWorkbook(); + } + } else { + readTemplate = new FileInputStream(AppUtils.getTempFolderPath()+ filename+"."+ nvls(extension, "xlsx")); + wb=new XSSFWorkbook(readTemplate); + } + if(rrDashRep!=null) + styles = loadXSSFStyles(rrDashRep, wb, styles); + String reportSheetName = new HtmlStripper().stripSpecialCharacters(rrDashRep.getReportName()); + if(nvl(reportSheetName).length()>28) + reportSheetName = reportSheetName.substring(0, 28); + sheet = wb.createSheet(count+"-"+reportSheetName); + if(!Globals.printExcelInLandscapeMode()) + sheet.getPrintSetup().setLandscape(false); + else + sheet.getPrintSetup().setLandscape(true); + wb.write(os); + os.flush(); + if(nvl(rr.getTemplateFile()).length()>0) { + readTemplate.close(); + } + os.close(); + + FileInputStream inF = new FileInputStream(AppUtils.getTempFolderPath()+ filename+"T."+ nvls(extension, "xlsx")); + FileOutputStream outStream = new FileOutputStream(AppUtils.getTempFolderPath()+ filename+"."+ nvls(extension, "xlsx")); + copyStream(inF, outStream); + outStream.flush(); + outStream.close(); + inF.close(); + + } + + FileInputStream xlsIn = null; + POIFSFileSystem fileSystem = null; + buf = null; + FileOutputStream xlsOut = null; + formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date()); + String xlsFName = "dashboard"+formattedDate+user_id+".xls"; + + Set setReportRuntime = reportRuntimeMap.entrySet(); + Set setReportDataMap = reportDataMap.entrySet(); + Iterator iter2 = setReportDataMap.iterator(); + + + //filename = templateFilename.substring(0, templateFilename.lastIndexOf("."))+"_"+formattedDate+user_id; + + count = 0; + for(Iterator iter = setReportRuntime.iterator(); iter.hasNext(); ) { + count++; + + Map.Entry entry = (Entry) iter.next(); + Map.Entry entryData = (Entry) iter2.next(); + ReportRuntime rrDashRep = (ReportRuntime) entry.getValue(); + ReportData rdDashRep = (ReportData) entryData.getValue(); + + String reportSheetName = new HtmlStripper().stripSpecialCharacters(rrDashRep.getReportName()); + if(nvl(reportSheetName).length()>28) + reportSheetName = reportSheetName.substring(0, 28); + sheet = wb.getSheet(count+"-"+reportSheetName); + sheetRef = sheet.getPackagePart().getPartName().getName(); + + //Step 2. Generate XML file. + File tmp = File.createTempFile("sheet", ".xml"); + FileOutputStream fileOutTemp = new FileOutputStream(tmp); + Writer fw = new OutputStreamWriter(fileOutTemp, XML_ENCODING); + String sql_whole = rrDashRep.getWholeSQL(); + SpreadsheetWriter sw = new SpreadsheetWriter(fw); + sw.beginSheet(); + + + generate(wb, sw, styles, rdDashRep, sql_whole, rrDashRep, request, sheet); + + + sw.endSheet(); + + fw.flush(); + fw.close(); + fileOutTemp.flush(); + fileOutTemp.close(); + + + //Step 3. Substitute the template entry with the generated data + + FileOutputStream outF = new FileOutputStream(AppUtils.getTempFolderPath()+ filename+"."+ nvls(extension, "xlsx")); + templateFile = new File(AppUtils.getTempFolderPath()+ filename+"T."+ nvls(extension, "xlsx")); + substitute(templateFile, tmp, sheetRef.substring(1), outF); + outF.flush(); + outF.close(); + + FileInputStream inF = new FileInputStream(AppUtils.getTempFolderPath()+ filename+"."+ nvls(extension, "xlsx")); + FileOutputStream outStream = new FileOutputStream(AppUtils.getTempFolderPath()+ filename+"T."+ nvls(extension, "xlsx")); + copyStream(inF, outStream); + outStream.flush(); + outStream.close(); + inF.close(); + } + } + } else { + //If template supplied by Application + if(nvl(rr.getTemplateFile()).length()>0) { + String templateFilename = rr.getTemplateFile(); + extension = templateFilename.substring(templateFilename.lastIndexOf(".")+1); + filename = formattedReportName+formattedDate+user_id; + //filename = templateFilename.substring(0, templateFilename.lastIndexOf("."))+"_"+formattedDate+user_id; + } else + filename = formattedReportName+formattedDate+user_id; + + + if(nvl(rr.getTemplateFile()).length()<=0) { + os = new FileOutputStream(AppUtils.getTempFolderPath()+"template"+formattedDate+user_id+".xlsx"); + wb=new XSSFWorkbook(); + //Load customized styles + if (rr != null) + styles = loadXSSFStyles(rr, wb, styles); + //create data sheet + if(isDashboard) { + + } else { + + } + String reportSheetName = new HtmlStripper().stripSpecialCharacters(rr.getReportName()); + if(nvl(reportSheetName).length()>28) + reportSheetName = reportSheetName.substring(0, 28); + sheet = wb.createSheet(reportSheetName); + + //customized mode + if(!Globals.printExcelInLandscapeMode()) + sheet.getPrintSetup().setLandscape(false); + else + sheet.getPrintSetup().setLandscape(true); + //get data sheet name + sheetRef = sheet.getPackagePart().getPartName().getName(); + wb.write(os); + os.flush(); + //wb = null; + os.close(); + + } else { + os = new FileOutputStream(AppUtils.getTempFolderPath()+ filename+"T."+ nvls(extension, "xlsx")); + FileInputStream readTemplate = new FileInputStream(org.openecomp.portalsdk.analytics.system.AppUtils.getExcelTemplatePath()+rr.getTemplateFile()); + wb=new XSSFWorkbook(readTemplate); + if (rr != null) + styles = loadXSSFStyles(rr, wb, styles); + sheet = wb.getSheetAt(0); + if(!Globals.printExcelInLandscapeMode()) + sheet.getPrintSetup().setLandscape(false); + else + sheet.getPrintSetup().setLandscape(true); + //sheet = wb.getSheet(getSheetName()); + sheetRef = sheet.getPackagePart().getPartName().getName(); + wb.write(os); + os.flush(); + readTemplate.close(); + //wb = null; + os.close(); + } + + //Step 2. Generate XML file. + File tmp = File.createTempFile("sheet", ".xml"); + FileOutputStream fileOutTemp = new FileOutputStream(tmp); + Writer fw = new OutputStreamWriter(fileOutTemp, XML_ENCODING); + + //String sql_whole = (String) request.getAttribute(AppConstants.RI_REPORT_SQL_WHOLE); + String sql_whole = ""; + if (!rr.getReportType().equals(AppConstants.RT_HIVE)) + sql_whole = rr.getWholeSQL(); + else + sql_whole = rr.getReportSQL(); + + SpreadsheetWriter sw = new SpreadsheetWriter(fw); + + sw.beginSheet(); + + if((rd.getDataRowCount() >= rr.getReportDataSize()) && !rr.getReportType().equals(AppConstants.RT_HIVE)) { + sql_whole=""; + } + + generate(wb, sw, styles, rd, sql_whole, rr, request, sheet); + + sw.endSheet(); + + fw.flush(); + fw.close(); + fileOutTemp.flush(); + fileOutTemp.close(); + + + //Step 3. Substitute the template entry with the generated data + + FileOutputStream outF = new FileOutputStream(AppUtils.getTempFolderPath()+ filename+"."+ nvls(extension, "xlsx")); + + if(nvl(rr.getTemplateFile()).length()>0) { + templateFile = new File(AppUtils.getTempFolderPath()+ filename+"T."+ nvls(extension, "xlsx")); + } else + templateFile = new File(AppUtils.getTempFolderPath()+"template"+formattedDate+user_id+".xlsx"); + + substitute(templateFile, tmp, sheetRef.substring(1), outF); + outF.flush(); + outF.close(); + + } + //get servlet output stream + + + response.reset(); + sos = response.getOutputStream(); + String mime_type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + if(extension.equals("xlsm")) + mime_type = "application/vnd.ms-excel.sheet.macroEnabled.12"; + response.setContentType(mime_type); + + response.setHeader("Content-disposition", "attachment;filename="+filename+"."+ nvls(extension, "xlsx")); + + buf = new BufferedInputStream(new FileInputStream(AppUtils.getTempFolderPath()+filename + "."+ nvls(extension, "xlsx"))); + int readBytes = 0; + + //read from the file; write to the ServletOutputStream + while ((readBytes = buf.read()) != -1) + sos.write(readBytes); + + buf.close(); + sos.flush(); + sos.close(); + logger.debug(EELFLoggerDelegate.debugLogger, ("ENDING..DOWNLOADING XLSX...")); + logger.debug(EELFLoggerDelegate.debugLogger, ("##### Heap utilization statistics [MB] #####")); + logger.debug(EELFLoggerDelegate.debugLogger, ("Used Memory:" + + (runtime.totalMemory() - runtime.freeMemory()) / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("Free Memory:" + + runtime.freeMemory() / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("Total Memory:" + runtime.totalMemory() / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("Max Memory:" + runtime.maxMemory() / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("##### END #####")); + } + + /** + * + * @param zipfile the template file + * @param tmpfile the XML file with the sheet data + * @param entry the name of the sheet entry to substitute, e.g. xl/worksheets/sheet1.xml + * @param out the stream to write the result to + */ + private static void substitute(File zipfile, File tmpfile, String entry, OutputStream out) throws IOException { + ZipFile zip = new ZipFile(zipfile); + + ZipOutputStream zos = new ZipOutputStream(out); + + @SuppressWarnings("unchecked") + Enumeration en = (Enumeration) zip.entries(); + while (en.hasMoreElements()) { + ZipEntry ze = en.nextElement(); + if(!ze.getName().equals(entry)){ + zos.putNextEntry(new ZipEntry(ze.getName())); + InputStream is = zip.getInputStream(ze); + copyStream(is, zos); + is.close(); + } + } + zos.putNextEntry(new ZipEntry(entry)); + InputStream is = new FileInputStream(tmpfile); + copyStream(is, zos); + zos.flush(); + zos.close(); + is.close(); + zip.close(); + } + + private static void copyStream(InputStream in, OutputStream out) throws IOException { + byte[] chunk = new byte[1024]; + int count; + while ((count = in.read(chunk)) >=0 ) { + out.write(chunk,0,count); + } + } + + + public void createCSVFileContent(Writer out, ReportData rd, + ReportRuntime rr, HttpServletRequest request, HttpServletResponse response) + throws RaptorException { + //ArrayList reportParamNameValues = rr.getParamNameValuePairs(); + //String reportTitle = rr.getReportName(); + //String reportDescr = rr.getReportDescr(); + PrintWriter csvOut = new PrintWriter(out); + ServletOutputStream sos = null; + BufferedInputStream buf = null; + String fileName = ""; + String formattedReportName = new HtmlStripper().stripSpecialCharacters(rr.getReportName()); + String formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date()); + String fName = formattedReportName+formattedDate+AppUtils.getUserID(request); + boolean raw = AppUtils.getRequestFlag(request, "raw"); + String sql_whole = (String) request.getAttribute(AppConstants.RI_REPORT_SQL_WHOLE); + + + String csvFName = fName+".csv"; + String zipFName = fName+".zip"; + if(true) { + try { + fileName = AppUtils.getTempFolderPath()+""+csvFName; + csvOut = new PrintWriter(new BufferedWriter( + new OutputStreamWriter( + new FileOutputStream(fileName), "UTF-8")), false); + } catch (FileNotFoundException fex) { + fex.printStackTrace(); + } + catch (UnsupportedEncodingException fex1) { + fex1.printStackTrace(); + } + } + HtmlStripper strip = new HtmlStripper(); + ResultSet rs = null; + //OracleConnection conn = null; + //OracleStatement st = null; + //Connection conO = null; + //Statement stO = null; + Connection conn = null; + Statement st = null; + ResultSetMetaData rsmd = null; + ColumnHeaderRow chr = null; + int mb = 1024*1024; + Runtime runtime = Runtime.getRuntime(); + String valueName = ""; + if(!raw) { + String reportTitle = (nvl(rr.getReportTitle()).length()>0?rr.getReportTitle():rr.getReportName()); + csvOut.println(); + csvOut.print("\"" + reportTitle + "\","); + csvOut.println(); + + if(Globals.disclaimerPositionedTopInCSVExcel()) { + if(Globals.getShowDisclaimer()) { + csvOut.println(); + csvOut.print("\"" + Globals.getFooterFirstLine() + "\","); + csvOut.println(); + csvOut.print("\"" + Globals.getFooterSecondLine() + "\","); + csvOut.println(); + csvOut.println(); + } + } + } + if (Globals.getPrintParamsInCSVDownload() && !raw) { + ArrayList paramsList = rr.getParamNameValuePairsforPDFExcel(request, 1); + if(paramsList.size()<=0) { + paramsList = (ArrayList) request.getSession().getAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO); + } + int paramSeq = 0; + for (Iterator iter = paramsList.iterator(); iter.hasNext();) { + IdNameValue value = (IdNameValue) iter.next(); + //System.out.println("\"" + value.getId() + " = " + value.getName() + "\""); + if(nvl(value.getId()).trim().length()>0 && (!nvl(value.getId()).trim().equals("BLANK"))) { + paramSeq += 1; + if(paramSeq <= 1) { + csvOut.print("\"" + "Run-time Parameters" + "\""); + csvOut.println(); + //strBuf.append("Run-time Parameters\n"); + } + csvOut.print("\"" + value.getId() +":" + "\","); + valueName = nvl(value.getName()); + if(valueName.indexOf("~")!= -1 && valueName.startsWith("(")) { + csvOut.print("\"'" + valueName.replaceAll("~",",")+ "'\","); + } else { + if(valueName.startsWith("(") && valueName.endsWith(")")) { + csvOut.print("\"" + valueName.replaceAll("~",",").substring(1, valueName.length()-1)+ "\","); + } else + csvOut.print("\"" + valueName.replaceAll("~",",")+ "\","); + } + csvOut.println(); + + //strBuf.append(value.getId()+": "+ value.getName()+"\n"); + } + } //for + csvOut.println(); + csvOut.println(); + } + + System.out.println("##### Heap utilization statistics [MB] #####"); + System.out.println("Used Memory:" + + (runtime.maxMemory() - runtime.freeMemory()) / mb); + System.out.println("Free Memory:" + + runtime.freeMemory() / mb); + System.out.println("Total Memory:" + runtime.totalMemory() / mb); + System.out.println("Max Memory:" + runtime.maxMemory() / mb); + if (!rr.getReportType().equals(AppConstants.RT_HIVE)) + sql_whole = rr.getWholeSQL(); + else + sql_whole = rr.getReportSQL(); + if(nvl(sql_whole).length()>0) { + try { + conn = ConnectionUtils.getConnection(rr.getDbInfo()); + st = conn.createStatement(); + //conn.setDefaultRowPrefetch(1000); + //st.setFetchDirection(ResultSet.TYPE_FORWARD_ONLY); + //st.setFetchSize(1000); + System.out.println("************* Map Whole SQL *************"); + System.out.println(sql_whole); + System.out.println("*****************************************"); + rs = st.executeQuery(sql_whole); + //st.setFetchSize(1000); + rsmd = rs.getMetaData(); + int numberOfColumns = rsmd.getColumnCount(); + HashMap colHash = new HashMap(); + String title = ""; + + if(rd!=null) { + + /*if(rd.reportTotalRowHeaderCols!=null) { + csvOut.print("\"" + "#" + "\","); + }*/ + + for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();) { + chr = rd.reportColumnHeaderRows.getNext(); + for (chr.resetNext(); chr.hasNext();) { + ColumnHeader ch = chr.getNext(); + title = ch.getColumnTitle(); + title = Utils.replaceInString(title,"_nl_", " \n"); + if(ch.isVisible() && nvl(title).length()>0) { + csvOut.print("\"" + title + "\","); + for (int i = 1; i < ch.getColSpan(); i++) + csvOut.print(","); + } + } // for + + csvOut.println(); + } // for + int rowCount = 0; + while(rs.next()) { +/* if(runtime.freeMemory()/mb <= ((runtime.maxMemory()/mb)*Globals.getMemoryThreshold()/100) ) { + csvOut.print(Globals.getUserDefinedMessageForMemoryLimitReached() + " " + rowCount +"records out of " + rr.getReportDataSize() + " were downloaded to CSV."); + break; + } +*/ rowCount++; + //if(!raw) { + colHash = new HashMap(); + for (int i = 1; i <= numberOfColumns; i++) { + colHash.put(rsmd.getColumnLabel(i).toUpperCase(), rs.getString(i)); + } + /*if(rd.reportDataTotalRow!=null) { + csvOut.print("\"" + rowCount + "\","); + }*/ + for (chr.resetNext(); chr.hasNext();) { + ColumnHeader ch = chr.getNext(); + title = ch.getColumnTitle(); + title = Utils.replaceInString(title,"_nl_", " \n"); + + if(ch.isVisible() && nvl(title).length()>0) { + csvOut.print("\"" + strip.stripCSVHtml(nvl((String)colHash.get(ch.getColId().toUpperCase()))) + "\","); + } + + } + csvOut.println(); + /*} else { + for (int i = 1; i <= numberOfColumns; i++) { + csvOut.print("\"" + strip.stripCSVHtml( rs.getString(i)) + "\","); + } + csvOut.println(); + }*/ + + } + + if(rd.reportDataTotalRow!=null) { + for (rd.reportDataTotalRow.resetNext(); rd.reportDataTotalRow.hasNext();) { + DataRow dr = rd.reportDataTotalRow.getNext(); + csvOut.print("\"" + "Total" + "\","); + dr.resetNext();dr.getNext(); + for (; dr.hasNext();) { + DataValue dv = dr.getNext(); + if(dv.isVisible()) { + csvOut.print("\"" + strip.stripCSVHtml(dv.getDisplayValue()) + "\","); + } + } // for + + csvOut.println(); + } + } + + if(rowCount == 0) { + csvOut.print("\"No Data Found \""); + } + } else { + csvOut.print("\"No Data Found \""); + } + + } catch (SQLException ex) { + throw new RaptorException(ex); + } catch (ReportSQLException ex) { + throw new RaptorException(ex); + } catch (Exception ex) { + throw new RaptorException (ex); + } finally { + try { + if(conn!=null) + conn.close(); + if(st!=null) + st.close(); + if(rs!=null) + rs.close(); + } catch (SQLException ex) { + throw new RaptorException(ex); + } + } + + if(!raw) { + if(!Globals.disclaimerPositionedTopInCSVExcel()) { + if(Globals.getShowDisclaimer()) { + csvOut.print("\"" + Globals.getFooterFirstLine() + "\","); + csvOut.println(); + csvOut.print("\"" + Globals.getFooterSecondLine() + "\","); + csvOut.println(); + } + } + } + + // csvOut.flush(); + } else { + boolean firstPass = true; + if(rd!=null) { + if(rd.reportTotalRowHeaderCols!=null) { + csvOut.print("\"" + "#" + "\","); + } + + for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();) { + chr = rd.reportColumnHeaderRows.getNext(); + for (rd.reportRowHeaderCols.resetNext(1); rd.reportRowHeaderCols.hasNext();) { + RowHeaderCol rhc = rd.reportRowHeaderCols.getNext(); + + if (firstPass) + csvOut.print("\"" + rhc.getColumnTitle() + "\""); + csvOut.print(","); + } // for + firstPass = false; + + for (chr.resetNext(); chr.hasNext();) { + ColumnHeader ch = chr.getNext(); + if(ch.isVisible()) { + csvOut.print("\"" + ch.getColumnTitle() + "\","); + for (int i = 1; i < ch.getColSpan(); i++) + csvOut.print(","); + } + } // for + + csvOut.println(); + } // for + + firstPass = true; + int rowCount = 0; + for (rd.reportDataRows.resetNext(); rd.reportDataRows.hasNext();) { + if(rd.reportDataTotalRow!=null) { + rowCount++; + csvOut.print("\"" + rowCount + "\","); + } + + DataRow dr = rd.reportDataRows.getNext(); + + for (rd.reportRowHeaderCols.resetNext(1); rd.reportRowHeaderCols.hasNext();) { + RowHeaderCol rhc = rd.reportRowHeaderCols.getNext(); + if (firstPass) + rhc.resetNext(); + RowHeader rh = rhc.getNext(); + + csvOut.print("\"" + strip.stripCSVHtml(rh.getRowTitle()) + "\","); + } // for + firstPass = false; + + for (dr.resetNext(); dr.hasNext();) { + DataValue dv = dr.getNext(); + if(dv.isVisible()) + csvOut.print("\"" + strip.stripCSVHtml(dv.getDisplayValue()) + "\","); + } // for + + csvOut.println(); + } // for + if(rd.reportDataTotalRow!=null) { + for (rd.reportDataTotalRow.resetNext(); rd.reportDataTotalRow.hasNext();) { + DataRow dr = rd.reportDataTotalRow.getNext(); + csvOut.print("\"" + "Total" + "\","); + firstPass = false; + + for (dr.resetNext(); dr.hasNext();) { + DataValue dv = dr.getNext(); + if(dv.isVisible()) + csvOut.print("\"" + strip.stripCSVHtml(dv.getDisplayValue()) + "\","); + } // for + + csvOut.println(); + } + } + + if(!raw) { + if(!Globals.disclaimerPositionedTopInCSVExcel()) { + if(Globals.getShowDisclaimer()) { + csvOut.print("\"" + Globals.getFooterFirstLine() + "\","); + csvOut.println(); + csvOut.print("\"" + Globals.getFooterSecondLine() + "\","); + csvOut.println(); + } + } + } + + //csvOut.flush(); + } else { + csvOut.print("\"No Data Found \""); + } + } + csvOut.flush(); + csvOut.close(); + +/* + if (Globals.getPrintTitleInDownload() && reportTitle != null) { + csvOut.println(); + csvOut.println("\"" + reportTitle + "\""); + csvOut.println(); + if (Globals.getShowDescrAtRuntime() && nvl(reportDescr).length() > 0) { + csvOut.println("\"" + reportDescr + "\""); + csvOut.println(); + } + } // if + + if (Globals.getPrintParamsInDownload() && reportParamNameValues != null) { + csvOut.println(); + for (Iterator iter = reportParamNameValues.iterator(); iter.hasNext();) { + IdNameValue value = (IdNameValue) iter.next(); + csvOut.println("\"" + value.getId() + " = " + value.getName() + "\""); + } // for + csvOut.println(); + } // if +*/ + if(true && !raw) { + try { + + //final int BUFFER = 2048; + + //fis.read(buf,0,buf.length); + int size = 0; + byte[] buffer = new byte[1024]; + + //CRC32 crc = new CRC32(); + //PrintStream fos = new PrintStream(new WriterOutputStream(out)); + //BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER); + //ZipOutputStream s = new ZipOutputStream(dest); + ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(AppUtils.getTempFolderPath()+""+zipFName)); + FileInputStream fis = new FileInputStream(fileName); + + //s.setLevel(6); + + ZipEntry entry = new ZipEntry(csvFName); + //crc.reset(); + zos.putNextEntry(entry); + + // read data to the end of the source file and write it to the zip + // output stream. + while ((size = fis.read(buffer, 0, buffer.length)) > 0) { + zos.write(buffer, 0, size); + } + + zos.closeEntry(); + fis.close(); + + // Finish zip process + zos.close(); + + } catch(Exception e) { + e.printStackTrace(); + } + } + + response.reset(); + java.io.File file = null; + + if(true && !raw) { + response.setContentType("application/octet-stream"); + response.setHeader("Content-disposition","attachment;filename="+fName+".zip"); + file = new java.io.File(AppUtils.getTempFolderPath()+""+fName+".zip"); + } else { + response.setContentType("application/csv"); + response.setHeader("Content-disposition","attachment;filename="+fName+".csv"); + file = new java.io.File(AppUtils.getTempFolderPath()+""+fName+".csv"); + } + + + FileInputStream fileIn = null; + int c; + try { + sos = response.getOutputStream(); + fileIn = new FileInputStream(file); + buf = new BufferedInputStream(fileIn); + byte [] bOut = new byte [4096]; + //read from the file; write to the ServletOutputStream + //while ((readBytes = buf.read()) != -1) + int readBytes = 0; + while ((readBytes = buf.read (bOut, 0, 4096))> 0) { + buf.available(); + sos.write (bOut, 0, readBytes); + } + + } catch (IOException ex) { + ex.printStackTrace(); + } + catch(Exception e) { + e.printStackTrace(); + } finally { + try { + if (sos != null) + sos.close(); + if (buf != null) + buf.close(); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + + File f = new File (AppUtils.getTempFolderPath() + + fName); + if(f.exists()) f.delete(); + System.out.println("##### Heap utilization statistics [MB] #####"); + System.out.println("Used Memory:" + + (runtime.maxMemory() - runtime.freeMemory()) / mb); + logger.debug(EELFLoggerDelegate.debugLogger, ("Free Memory:" + + runtime.freeMemory() / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("Total Memory:" + runtime.totalMemory() / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("Max Memory:" + runtime.maxMemory() / mb)); + + } // createCSVFileContent + +/* public String saveCSVPageFile(HttpServletRequest request, ReportData rd, + ArrayList reportParamNameValues, String reportTitle, String reportDescr) { + try { + String formattedReportName = new HtmlStripper().stripSpecialCharacters(reportTitle); + String formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date()); + + String csvFName = formattedReportName+formattedDate+AppUtils.getUserID(request)+".csv"; + //String csvFName = AppUtils.generateFileName(request, AppConstants.FT_CSV); + + BufferedWriter csvOut = new BufferedWriter(new FileWriter(AppUtils + .getTempFolderPath() + + csvFName)); + createCSVFileContent(csvOut, rd, reportParamNameValues, reportTitle, reportDescr); + csvOut.close(); + + return csvFName; + } catch (Exception e) { + (new ErrorHandler()).processError(request, "Exception saving data to CSV file: " + + e.getMessage()); + return null; + } + } // saveCSVPageFile +*/ + +// public String saveAsFlatFile(HttpServletRequest request, ReportData rd, +// ReportRuntime rr, String reportTitle, String reportDescr) { +// try { +// String csvFName = AppUtils.generateFileName(request, AppConstants.FT_TXT); +// +// BufferedWriter txtOut = new BufferedWriter(new FileWriter(AppUtils +// .getTempFolderPath() +// + csvFName)); +// createFlatFileContent(txtOut, rd, rr, reportTitle, reportDescr); +// txtOut.close(); +// +// return csvFName; +// } catch (Exception e) { +// (new ErrorHandler()).processError(request, "Exception saving data to CSV file: " +// + e.getMessage()); +// return null; +// } +// } // saveCSVPageFile + + public String saveXMLFile(HttpServletRequest request, String reportName, String reportXML) { + try { + String xmlFName = AppUtils.generateUniqueFileName(request, reportName, AppConstants.FT_XML); + + PrintWriter xmlOut = new PrintWriter(new BufferedWriter(new FileWriter(new File( + AppUtils.getTempFolderPath() + xmlFName)))); + xmlOut.println(reportXML); + xmlOut.close(); + + //return AppUtils.getTempFolderURL() + // + java.net.URLEncoder.encode(java.net.URLDecoder.decode(xmlFName)); + return java.net.URLEncoder.encode(java.net.URLDecoder.decode(xmlFName)); + + } catch (Exception e) { + (new ErrorHandler()).processError(request, + "Exception saving XML source to file system: " + e.getMessage()); + return null; + } + } // saveXMLFile + + public ReportRuntime loadReportRuntime(HttpServletRequest request, String reportID) + throws RaptorException { + return loadReportRuntime(request, reportID, true); + } // loadReportRuntime + + public ReportRuntime loadReportRuntime(HttpServletRequest request, String reportID, + boolean prepareForExecution) throws RaptorException { + return loadReportRuntime(request, reportID, true, 2); // where 2 is adding to session + } + public ReportRuntime loadReportRuntime(HttpServletRequest request, String reportID, + boolean prepareForExecution, int requestFlag) throws RaptorException { + boolean refresh = nvl(request.getParameter(AppConstants.RI_REFRESH)).toUpperCase().startsWith("Y"); + boolean rDisplayContent = AppUtils.getRequestFlag(request, + AppConstants.RI_DISPLAY_CONTENT) + || AppUtils.getRequestFlag(request, "noFormFields"); + + ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute( + AppConstants.SI_REPORT_RUNTIME); + boolean inSchedule = AppUtils.getRequestFlag(request, AppConstants.SCHEDULE_ACTION); + if (rr != null ) { + if(requestFlag == 7) { // DASH + String reportXML = ReportLoader.loadCustomReportXML(reportID); + logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] Report [" + reportID + "]: XML loaded")); + rr = ReportRuntime.unmarshal(reportXML, reportID, request); + rr.setParamValues(request, false,refresh); + rr.setDisplayFlags(true, true); // show content even at the first time + return rr; + } else { + logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] Load Report Runtime "+ reportID + " " +rr.getReportID() + " " + request.getParameter("refresh") )); + if (reportID.equals(rr.getReportID()) && (request.getParameter("refresh")==null || !request.getParameter("refresh").equals("Y"))) { + // The report runtime is already in the session + if (prepareForExecution) { + boolean resetParams = AppUtils.getRequestFlag(request, + AppConstants.RI_RESET_PARAMS); + rr.setParamValues(request, resetParams,refresh); + + if (resetParams) + rr.resetVisualSettings(); + rr.setDisplayFlags(nvl(request.getParameter(AppConstants.RI_SOURCE_PAGE)) + .length() == 0, rDisplayContent || rr.isDisplayOptionHideForm()); + } // if + + return rr; + } // if + } + } + + /* + * Cannot convert the definition => XML file not saved for preview also, + * commented code not maintained up to date ReportDefinition rdef = + * (ReportDefinition) + * request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION); + * if(rdef!=null) if(reportID.equals(rdef.getReportID())) { // The + * report definition is in the session => create report runtime from it + * rr = new ReportRuntime(rdef, request); if(prepareForExecution) { + * request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, + * rr); + * rr.setDisplayFlags(request.getParameter(AppConstants.RI_SOURCE_PAGE)==null); } // + * if return rr; } // if + */ + + // Report is NOT in the session => load from the database + String reportXML = ReportLoader.loadCustomReportXML(reportID); + logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] Report [" + reportID + "]: XML loaded")); + + rr = ReportRuntime.unmarshal(reportXML, reportID, request); + if (prepareForExecution) { + String userID ; + int flag = 0; + if(request.getAttribute("schedule_email_userId") != null) { + userID = (String)request.getAttribute("schedule_email_userId"); + flag = 1; + } + else + userID = AppUtils.getUserID(request); + // If it is dashboard type then report can be viewed without specific privilege to report + String dashboardId = AppUtils.getRequestValue(request, AppConstants.RI_DASHBOARD_ID); + //System.out.println("USSSSSSSSSSSSERID " + userID); + //System.out.println("PDF " + AppUtils.getRequestNvlValue(request, "pdfAttachmentKey") ); + if(!rr.isDashboardType() && !(isReportAddedAsDashboard(request, dashboardId, rr.getReportID()))) { + if ( AppUtils.getRequestNvlValue(request, "pdfAttachmentKey").length()<=0 ) + if(flag == 1 )rr.checkUserReadAccess(request, userID); + else rr.checkUserReadAccess(request); + } + // TODO ON Demand + //rr.setXmlFileName(saveXMLFile(request, rr.getReportName(), reportXML)); + if (rDisplayContent) { + //System.out.println("In rDisplayContent "); + rr.setParamValues(request, false,true); + //if (requestFlag==2) + request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr); + } + if(inSchedule) { + //System.out.println("In inSchedule "); + rr.setParamValues(request, false,false); + } + if( requestFlag == 7 ) { // DASH + rr.setDisplayFlags(true, true); + } else { + rr.setDisplayFlags(request.getParameter(AppConstants.RI_SOURCE_PAGE) == null, + rDisplayContent || rr.isDisplayOptionHideForm()); + } +// System.out.println("Report ID B4 Id in reportHandler " +// + ( request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null?((ReportRuntime)request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).getReportID():"Not in session")); +// System.out.println("requestFlag " + requestFlag); + if(requestFlag==2 && !rDisplayContent) { + //System.out.println("In Request Flag "); + request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr); + rr.setParamValues(request, false, false); + } + else if(requestFlag==1) { + rr.setParamValues(request, false,refresh); + request.setAttribute(AppConstants.SI_REPORT_RUNTIME, rr); + + } +// System.out.println("Report ID B4 Id in reportHandler " +// + ( request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null?((ReportRuntime)request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).getReportID():"Not in session")); + //request.setAttribute(AppConstants.SI_REPORT_RUNTIME, rr); + } // if + + return rr; + } // loadReportRuntime + + private boolean isReportAddedAsDashboard(HttpServletRequest request, String dashboardId, String reportId)throws RaptorException { + if(nvl(dashboardId).length() <= 0) + return false; + String reportXML = ReportLoader.loadCustomReportXML(dashboardId); + ReportDefinition rdef = createReportDefinition(request, dashboardId, reportXML); + List l = rdef.getDashBoardReports().getReportsList(); + for (Iterator iterator = l.iterator(); iterator.hasNext();) { + Reports reports = (Reports) iterator.next(); + if(reports.getReportId().equals(reportId)) return true; + + } + return false; + } + + public ReportDefinition createReportDefinition(HttpServletRequest request, + String reportID, String reportXML) throws RaptorException { + ReportDefinition rdef = ReportDefinition.unmarshal(reportXML, reportID, request); + rdef.generateWizardSequence(request); + return rdef; + } // createReportDefinition + + public ReportDefinition loadReportDefinition(HttpServletRequest request, String reportID) + throws RaptorException { + //System.out.println("********* ReportID " + reportID); + boolean isReportIDBlank = (reportID.length() == 0 || reportID.equals("-1")); + String actionKey = nvl(request.getParameter(AppConstants.RI_ACTION), ""); + String wizardActionKey = nvl(request.getParameter(AppConstants.RI_WIZARD_ACTION), ""); + ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( + AppConstants.SI_REPORT_DEFINITION); + if(nvl(actionKey).equals("report.edit")) + rdef = null; + //ReportDefinition rdef = null; + if (rdef != null) + if (isReportIDBlank || reportID.equals(rdef.getReportID())) { + // The report definition is already in the session + return rdef; + } + + ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute( + AppConstants.SI_REPORT_RUNTIME); + if (rr != null) + if (isReportIDBlank || reportID.equals(rr.getReportID())) { + // The report runtime is in the session => create report + // definition from it + rdef = new ReportDefinition(rr, request); + String userID = AppUtils.getUserID(request); + rdef.generateWizardSequence(request); + // rdef.checkUserWriteAccess(userID); + + request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef); + return rdef; + } // if + + // Report is NOT in the session => load from the database + if (isReportIDBlank) + rdef = ReportDefinition.createBlank(request); + else { + String reportXML = ReportLoader.loadCustomReportXML(reportID); + logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] Report [" + reportID + "]: XML loaded")); + rdef = createReportDefinition(request, reportID, reportXML); + } // else + + request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef); + return rdef; + } // loadReportDefinition + + public void setSheetName( String sheet_name ) { + SHEET_NAME = sheet_name; + } + + public String getSheetName() { + return SHEET_NAME; + } + + /** + * Writes spreadsheet data in a Writer. + * (YK: in future it may evolve in a full-featured API for streaming data in Excel) + */ + public static class SpreadsheetWriter { + private final Writer _out; + private int _rownum; + + public SpreadsheetWriter(Writer out){ + _out = out; + } + + public void beginSheet() throws IOException { + _out.write("" + + "" ); + _out.write("\n"); + } + + public void endSheet() throws IOException { + _out.write(""); + _out.write(""); + } + + /** + * Insert a new row + * + * @param rownum 0-based row number + */ + public void insertRow(int rownum) throws IOException { + _out.write("\n"); + this._rownum = rownum; + } + + /** + * Insert row end marker + */ + public void endRow() throws IOException { + _out.write("\n"); + } + + public void createCell(int columnIndex, String value, int styleIndex) throws IOException { + String ref = new CellReference(_rownum, columnIndex).formatAsString(); + _out.write(""); + _out.write(""+value+""); + _out.write(""); + } + + public void createCell(int columnIndex, String value) throws IOException { + createCell(columnIndex, value, -1); + } + + public void createCell(int columnIndex, double value, int styleIndex) throws IOException { + String ref = new CellReference(_rownum, columnIndex).formatAsString(); + _out.write(""); + _out.write(""+value+""); + _out.write(""); + } + + public void createCell(int columnIndex, double value) throws IOException { + createCell(columnIndex, value, -1); + } + + public void createCell(int columnIndex, Calendar value, int styleIndex) throws IOException { + createCell(columnIndex, DateUtil.getExcelDate(value, false), styleIndex); + } + } + + public int getColumnCountForDownloadFile(ReportRuntime rr, ReportData rd) { + int columnCount = 0; + for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();) { + ColumnHeaderRow chr = rd.reportColumnHeaderRows.getNext(); + for(chr.resetNext(); chr.hasNext(); ) { + ColumnHeader ch = chr.getNext(); + if(ch.isVisible()) { + columnCount++; + } + } + } + if(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) { + for (rd.reportRowHeaderCols.resetNext(); rd.reportRowHeaderCols.hasNext();) { + RowHeaderCol rhc = rd.reportRowHeaderCols.getNext(); + if(rhc.isVisible()) { + columnCount++; + } + } + } + return columnCount; + } + + + private Map loadXSSFStyles(ReportRuntime rr, XSSFWorkbook wb, Map loadedStyles) { + XSSFCellStyle styleDefault = wb.createCellStyle(); + //System.out.println("Load Styles"); + // Style default will be normal with no background + XSSFFont fontDefault = wb.createFont(); + + XSSFDataFormat xssffmt = wb.createDataFormat(); + // The default will be plain . + fontDefault.setColor((short) HSSFFont.COLOR_NORMAL); + fontDefault.setFontHeight((short) (font_size / 0.05)); + fontDefault.setFontName("Tahoma"); + + styleDefault.setAlignment(XSSFCellStyle.ALIGN_CENTER); + styleDefault.setBorderBottom(XSSFCellStyle.BORDER_THIN); + styleDefault.setBorderTop(XSSFCellStyle.BORDER_THIN); + styleDefault.setBorderLeft(XSSFCellStyle.BORDER_THIN); + styleDefault.setBorderRight(XSSFCellStyle.BORDER_THIN); + // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleDefault.setFillPattern(XSSFCellStyle.NO_FILL); + styleDefault.setFont(fontDefault); + ArrayList semColumnList = new ArrayList(); + List dsList = rr.getDataSourceList().getDataSource(); + for (Iterator iter = dsList.iterator(); iter.hasNext();) { + DataSourceType element = (DataSourceType) iter.next(); + List dcList = element.getDataColumnList().getDataColumn(); + for (Iterator iterator = dcList.iterator(); iterator.hasNext();) { + DataColumnType element1 = (DataColumnType) iterator.next(); + semColumnList.add(element1.getSemaphoreId()); + + } + } + SemaphoreList semList = rr.getSemaphoreList(); + Map hashMapStyles = new HashMap();; + Map hashMapFonts = new HashMap(); + hashMapFonts.put("default", fontDefault); + hashMapStyles.put("default", styleDefault); + XSSFCellStyle styleLeftDefault = wb.createCellStyle(); + styleLeftDefault.setAlignment(XSSFCellStyle.ALIGN_LEFT); + styleLeftDefault.setBorderBottom(XSSFCellStyle.BORDER_THIN); + styleLeftDefault.setBorderTop(XSSFCellStyle.BORDER_THIN); + styleLeftDefault.setBorderLeft(XSSFCellStyle.BORDER_THIN); + styleLeftDefault.setBorderRight(XSSFCellStyle.BORDER_THIN); + // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleLeftDefault.setFillPattern(XSSFCellStyle.NO_FILL); + styleLeftDefault.setFont(fontDefault); + hashMapStyles.put("defaultLeft", styleLeftDefault); + + + XSSFCellStyle styleDate = wb.createCellStyle(); + styleDate.setAlignment(XSSFCellStyle.ALIGN_RIGHT); + styleDate.setDataFormat(xssffmt.getFormat("d-mmm-yy")); + styleDate.setAlignment(XSSFCellStyle.ALIGN_CENTER); + styleDate.setBorderBottom(XSSFCellStyle.BORDER_THIN); + styleDate.setBorderTop(XSSFCellStyle.BORDER_THIN); + styleDate.setBorderLeft(XSSFCellStyle.BORDER_THIN); + styleDate.setBorderRight(XSSFCellStyle.BORDER_THIN); + // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleDate.setFillPattern(XSSFCellStyle.NO_FILL); + styleDate.setFont(fontDefault); + hashMapStyles.put("date", styleDate); + + XSSFCellStyle rowHeaderStyle = wb.createCellStyle(); + XSSFFont headerFont = wb.createFont(); + headerFont.setBold(true); + rowHeaderStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); + rowHeaderStyle.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND); + rowHeaderStyle.setFont(headerFont); + rowHeaderStyle.setBorderTop(XSSFCellStyle.BORDER_THIN); + rowHeaderStyle.setBorderLeft(XSSFCellStyle.BORDER_THIN); + rowHeaderStyle.setBorderBottom(XSSFCellStyle.BORDER_THIN); + rowHeaderStyle.setBorderRight(XSSFCellStyle.BORDER_THIN); + hashMapStyles.put("header", rowHeaderStyle); + + + XSSFCellStyle boldStyle = wb.createCellStyle(); + //headerFont = wb.createFont(); + //headerFont.setBold(true); + boldStyle.setFont(headerFont); + boldStyle.setBorderTop(XSSFCellStyle.BORDER_THIN); + boldStyle.setBorderLeft(XSSFCellStyle.BORDER_THIN); + boldStyle.setBorderBottom(XSSFCellStyle.BORDER_THIN); + boldStyle.setBorderRight(XSSFCellStyle.BORDER_THIN); + boldStyle.setAlignment(HorizontalAlignment.CENTER); + hashMapStyles.put("title", boldStyle); + + XSSFCellStyle cellStyle = null; + if (semList == null || semList.getSemaphore() == null) { + hashMapStyles.put("default", styleDefault); + } /*else { + for (Iterator iter = semList.getSemaphore().iterator(); iter.hasNext();) { + SemaphoreType sem = (SemaphoreType) iter.next(); + if(!semColumnList.contains(sem.getSemaphoreId())) continue; + //System.out.println("SemphoreId ----> " + sem.getSemaphoreId()); + FormatList fList = sem.getFormatList(); + List formatList = fList.getFormat(); + for (Iterator fIter = formatList.iterator(); fIter.hasNext();) { + FormatType fmt = (FormatType) fIter.next(); + if(fmt!=null){ + //if (fmt.getLessThanValue().length() > 0) { + cellStyle = wb.createCellStyle(); + XSSFFont cellFont = wb.createFont(); + //System.out.println("Format Id " + fmt.getFormatId()); + if (nvl(fmt.getBgColor()).length() > 0) { +// System.out.println("Load Styles " + +// fmt.getFormatId() +// + " " +fmt.getBgColor() + " " + +// ExcelColorDef.getExcelColor(fmt.getBgColor())); + cellStyle.setFillForegroundColor(ExcelColorDef.getExcelColor(fmt + .getBgColor())); + cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + } + if (nvl(fmt.getFontColor()).length() > 0) { + cellFont.setColor(ExcelColorDef.getExcelColor(fmt.getFontColor())); + } else + cellFont.setColor((short) HSSFFont.COLOR_NORMAL); + if (fmt.isBold()) + cellFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + if (fmt.isItalic()) + cellFont.setItalic(true); + if (fmt.isUnderline()) + cellFont.setUnderline(HSSFFont.U_SINGLE); + if(nvl(fmt.getFontFace()).length()>0) + cellFont.setFontName(fmt.getFontFace()); + else + cellFont.setFontName("Tahoma"); + //cellFont.setFontHeight((short) (10 / 0.05)); + + if(nvl(fmt.getFontSize()).length()>0) { + try { + cellFont.setFontHeight((short) (Integer.parseInt(fmt.getFontSize()) / 0.05)); + } catch(NumberFormatException e){ + cellFont.setFontHeight((short) (font_size / 0.05)); + } + } + else + cellFont.setFontHeight((short) (font_size / 0.05)); + cellStyle.setFont(cellFont); + cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); + hashMapStyles.put(fmt.getFormatId(), cellStyle); + } else { + //hashMapStyles.put(fmt.getFormatId(), styleDefault); + hashMapStyles.put("default", styleDefault); + } + } + + } + }*/ + loadedStyles.putAll(hashMapStyles); + return loadedStyles; + } + + private void generate(XSSFWorkbook wb, SpreadsheetWriter sw, Map styles, ReportData rd, String sql_whole, ReportRuntime rr, HttpServletRequest request, XSSFSheet sheet) throws Exception { + HtmlStripper strip = new HtmlStripper(); + XSSFCellStyle styleCell = null; + XSSFCellStyle styleRowCell = null; + XSSFCellStyle styleDefaultCell = null; + + styleDefaultCell = (XSSFCellStyle) styles.get("default"); + + + // to check performance + int mb = 1024*1024; + Runtime runtime = Runtime.getRuntime(); + + int rowNum = 0; + /*short s1 = 0, s2 = (short) (col-1); + rowNum += 1; + sw.insertRow(rowNum); + int styleIndex = styles.get("header").getIndex(); + sw.createCell(rowNum, reportTitle, styleIndex); + + //header.setCenter(HSSFHeader.font("Tahoma", "")+ HSSFHeader.fontSize((short) 9)+reportTitle+"\n"+((Globals.getShowDescrAtRuntime() && nvl(reportDescr).length() > 0)?reportDescr:"")); + + // Report Description + if (Globals.getShowDescrAtRuntime() && nvl(reportDescr).length() > 0) { + sw.createCell(rowNum, reportDescr, styleIndex); + } + rowNum += 2; + sw.insertRow(rowNum);*/ + int cellNum = 0; + + + ColumnHeaderRow chr = null; + java.util.HashMap dataTypeMap = new java.util.HashMap(); + boolean firstPass = true; + int columnRows = rr.getVisibleColumnCount() ; + + HttpSession session = request.getSession(); + String drilldown_index = (String) session.getAttribute("drilldown_index"); + int index = 0; + try { + index = Integer.parseInt(drilldown_index); + } catch (NumberFormatException ex) { + index = 0; + } + String header = (String) session.getAttribute("TITLE_"+index); + String subtitle = (String) session.getAttribute("SUBTITLE_"+index); + if(nvl(header).length()>0) { + header = Utils.replaceInString(header, "
    ", " "); + header = Utils.replaceInString(header, "
    ", " "); + header = Utils.replaceInString(header, "
    ", " "); + header = strip.stripHtml(nvl(header).trim()); + subtitle = Utils.replaceInString(subtitle, "
    ", " "); + subtitle = Utils.replaceInString(subtitle, "
    ", " "); + subtitle = Utils.replaceInString(subtitle, "
    ", " "); + subtitle = strip.stripHtml(nvl(subtitle).trim()); + //XSSFRow row = sheet.createRow(rowNum); + sw.insertRow(rowNum); + cellNum = 0; + //XSSFCell cell = row.createCell(cellNum); + sw.createCell(cellNum, Utils.excelEncode(header)); + for (int i = 1; i <= columnRows; i++) { + sw.createCell(cellNum+i, ""); + } + sheet.addMergedRegion(new CellRangeAddress(rowNum+1, rowNum+1, cellNum+1, columnRows)); + sw.endRow(); +/* cell.setCellValue(Utils.excelEncode(header)); + cell.setCellStyle(styles.get("title")); +*/ //sw.createCell(cellNum,Utils.excelEncode(header), styles.get("title").getIndex()); +// sheet.addMergedRegion(new CellRangeAddress(rowNum+1, rowNum+1, cellNum+1, columnRows)); + rowNum += 1; +// row = sheet.createRow(rowNum); + sw.insertRow(rowNum); + cellNum = 0; +/* cell = row.createCell(cellNum); + cell.setCellValue(Utils.excelEncode(subtitle)); + cell.setCellStyle(styles.get("title")); +*/ //sw.createCell(cellNum,Utils.excelEncode(header), styles.get("title").getIndex()); + + sheet.addMergedRegion(new CellRangeAddress(rowNum+1, rowNum+1, cellNum+1, columnRows)); + sw.createCell(cellNum, Utils.excelEncode(subtitle)); + sw.endRow(); + //sheet.addMergedRegion(new CellRangeAddress(rowNum+1, rowNum+1, cellNum+1, columnRows)); +/* sw.insertRow(rowNum); + cellNum = 0; + sw.createCell(cellNum,Utils.excelEncode(subtitle), styles.get("title").getIndex()); + sheet.addMergedRegion(new CellRangeAddress(rowNum+1, rowNum+1, cellNum+1, columnRows)); + +*/ rowNum += 1; + } + cellNum = 0; + String title = ""; + for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();) { + sw.insertRow(rowNum); + cellNum = -1; + /*if(rd.reportTotalRowHeaderCols!=null) { + cellNum +=1; + sw.createCell(cellNum, "No.", styles.get("header").getIndex()); + + //row.getCell((short) cellNum).setCellStyle(styleDataHeader); + }*/ + chr = rd.reportColumnHeaderRows.getNext(); + + if(nvl(sql_whole).length() <= 0 || (!rr.getReportType().equals(AppConstants.RT_LINEAR))) { + + for (rd.reportRowHeaderCols.resetNext(1); rd.reportRowHeaderCols.hasNext();) { + cellNum += 1; + RowHeaderCol rhc = rd.reportRowHeaderCols.getNext(); + title = rhc.getColumnTitle(); + title = Utils.replaceInString(title,"_nl_", " \n"); + + sw.createCell(cellNum,Utils.excelEncode(title), styles.get("header").getIndex()); + //sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum+columnRows, (short) (cellNum))); + //System.out.println(" **************** Row Header Title " + rhc.getColumnTitle() + " " + cellNum + " " ); + //System.out.println(cellNum + " " + cellWidth.size()); + } // for + + } + + firstPass = false; + for (chr.resetNext(); chr.hasNext();) { + ColumnHeader ch = chr.getNext(); + if(ch.isVisible()) { + cellNum += 1; + int colSpan = ch.getColSpan()-1; + title = ch.getColumnTitle(); + title = Utils.replaceInString(title,"_nl_", " \n"); + sw.createCell(cellNum, Utils.excelEncode(title), styles.get("header").getIndex()); + if(colSpan > 0) { + for ( int k = 1; k <= colSpan; k++ ) { + sw.createCell(cellNum+k, "", styles.get("header").getIndex()); + } + //sheet.addMergedRegion(new Region(rowNum, (short) cellNum, rowNum, (short) (cellNum+colSpan))); + } + if(colSpan > 0) + cellNum += colSpan; + } + } // for + rowNum += 1; + } // for + + sw.endRow(); + //All the possible combinations of date format + CreationHelper createHelper = wb.getCreationHelper(); + HashMap dateFormatMap = new HashMap(); + + SimpleDateFormat MMDDYYYYFormat = new SimpleDateFormat("MM/dd/yyyy"); + SimpleDateFormat YYYYMMDDFormat = new SimpleDateFormat("yyyy/MM/dd"); + SimpleDateFormat MONYYYYFormat = new SimpleDateFormat("MMM yyyy"); + SimpleDateFormat MMYYYYFormat = new SimpleDateFormat("MM/yyyy"); + SimpleDateFormat MMMMMDDYYYYFormat = new SimpleDateFormat("MMMMM dd, yyyy"); + SimpleDateFormat YYYYMMDDDASHFormat = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat DDMONYYYYFormat = new SimpleDateFormat("dd-MMM-yyyy"); + SimpleDateFormat MONTHYYYYFormat = new SimpleDateFormat("MMMMM, yyyy"); + SimpleDateFormat MMDDYYYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); + SimpleDateFormat MMDDYYYYHHMMFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm"); + SimpleDateFormat YYYYMMDDHHMMSSFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); + SimpleDateFormat YYYYMMDDHHMMFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm"); + SimpleDateFormat DDMONYYYYHHMMSSFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); + SimpleDateFormat DDMONYYYYHHMMFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm"); + SimpleDateFormat DDMONYYHHMMFormat = new SimpleDateFormat("dd-MMM-yy HH:mm"); + SimpleDateFormat MMDDYYFormat = new SimpleDateFormat("MM/dd/yy"); + SimpleDateFormat MMDDYYHHMMFormat = new SimpleDateFormat("MM/dd/yy HH:mm"); + SimpleDateFormat MMDDYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yy HH:mm:ss"); + SimpleDateFormat MMDDYYYYHHMMZFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm z"); + SimpleDateFormat MMMMMDDYYYYHHMMSS = new SimpleDateFormat("MMMMM-dd-yyyy HH:mm:ss"); + + short dateFormat = createHelper.createDataFormat().getFormat("MM/dd/yyyy"); + dateFormatMap.put("MMDDYYYY", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("yyyy/MM/dd"); + dateFormatMap.put("YYYYMMDD", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("MMM yyyy"); + dateFormatMap.put("MONYYYY", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("MM/yyyy"); + dateFormatMap.put("MMYYYY", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("MMMMM dd, yyyy"); + dateFormatMap.put("MMMMMDDYYYY", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("yyyy-MM-dd"); + dateFormatMap.put("YYYYMMDDDASH", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("yyyy-MM-dd HH:mm:ss"); + dateFormatMap.put("timestamp", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("dd-MMM-yyyy"); + dateFormatMap.put("MONTHYYYY", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("MMMMM, yyyy"); + dateFormatMap.put("MMDDYYYY", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("MM/dd/yyyy HH:mm:ss"); + dateFormatMap.put("MMDDYYYYHHMM", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("MM/dd/yyyy HH:mm"); + dateFormatMap.put("MMDDYYYY", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("yyyy/MM/dd HH:mm:ss"); + dateFormatMap.put("YYYYMMDDHHMMSS", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("yyyy/MM/dd HH:mm"); + dateFormatMap.put("YYYYMMDDHHMM", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("dd-MMM-yyyy HH:mm:ss"); + dateFormatMap.put("DDMONYYYYHHMMSS", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("dd-MMM-yyyy HH:mm"); + dateFormatMap.put("DDMONYYYYHHMM", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("dd-MMM-yy HH:mm"); + dateFormatMap.put("DDMONYYHHMM", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("dd-MMM-yyyy"); + dateFormatMap.put("DDMONYYYY", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("MM/dd/yy"); + dateFormatMap.put("MMDDYY", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("MM/dd/yy HH:mm"); + dateFormatMap.put("MMDDYYHHMM", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("MM/dd/yy HH:mm:ss"); + dateFormatMap.put("MMDDYYHHMMSS", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("MM/dd/yyyy HH:mm z"); + dateFormatMap.put("MMDDYYYYHHMMZ", new Short(dateFormat)); + dateFormat = createHelper.createDataFormat().getFormat("MMMMM-dd-yyyy HH:mm:ss"); + dateFormatMap.put("MMMMMDDYYYYHHMMSS", new Short(dateFormat)); + + ResultSet rs = null; + Connection conn = null; + Statement st = null; + ResultSetMetaData rsmd = null; + + + if(nvl(sql_whole).length() >0 && (rr.getReportType().equals(AppConstants.RT_LINEAR) || rr.getReportType().equals(AppConstants.RT_HIVE) )) { + try { + conn = ConnectionUtils.getConnection(rr.getDbInfo()); + st = conn.createStatement(); + logger.debug(EELFLoggerDelegate.debugLogger, ("************* Map Whole SQL *************")); + logger.debug(EELFLoggerDelegate.debugLogger, (sql_whole)); + logger.debug(EELFLoggerDelegate.debugLogger, ("*****************************************")); + rs = st.executeQuery(sql_whole); + rsmd = rs.getMetaData(); + int numberOfColumns = rsmd.getColumnCount(); + HashMap colHash = new HashMap(); + DataRow dr = null; + int j = 0; + int rowCount = 0; + while(rs.next()) { + + rowCount++; + + if(rowCount%10000 == 0) { + // to check performance + logger.debug(EELFLoggerDelegate.debugLogger, ("Performance check for "+rowCount+" starting**************")); + logger.debug(EELFLoggerDelegate.debugLogger, ("##### Heap utilization statistics [MB] #####")); + logger.debug(EELFLoggerDelegate.debugLogger, ("Used Memory:" + + (runtime.totalMemory() - runtime.freeMemory()) / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("Free Memory:" + + runtime.freeMemory() / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("Total Memory:" + runtime.totalMemory() / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("Max Memory:" + runtime.maxMemory() / mb)); + System.out.println(rowCount+"TH ROW****##### END #####"); + + // + } + sw.insertRow(rowNum); + cellNum = -1; + colHash = new HashMap(); + for (int i = 1; i <= numberOfColumns; i++) { + colHash.put(rsmd.getColumnName(i).toUpperCase(), strip.stripHtml(rs.getString(i))); + } + rd.reportDataRows.resetNext(); + dr = rd.reportDataRows.getNext(); + styleRowCell = null; + if (dr.isRowFormat() && styles != null) + styleRowCell = (XSSFCellStyle) styles.get(nvl(/*dr.getFormatId(),*/"","default")); + j = 0; + //if(rowCount%1000 == 0) wb.write(sos); + + /*if(rd.reportTotalRowHeaderCols!=null) { + //cellNum = -1; + //for (rd.reportRowHeaderCols.resetNext(); rd.reportRowHeaderCols.hasNext();) { + cellNum += 1; + //RowHeaderCol rhc = rd.reportRowHeaderCols.getRowHeaderCol(0); + //if (firstPass) + // rhc.resetNext(); + //RowHeader rh = rhc.getRowHeader(rowCount-1); + sw.createCell(cellNum, rowCount, styleDefaultCell.getIndex()); + + //} // for + }*/ + firstPass = false; + //cellNum = -1; + for (dr.resetNext(); dr.hasNext();j++) { + styleCell = null; + //for (chr.resetNext(); chr.hasNext();) { + //ColumnHeader ch = chr.getNext(); + DataValue dv = dr.getNext(); + HtmlFormatter htmlFormat = dv.getCellFormatter(); + + if (htmlFormat != null && dv.getFormatId() != null && styles != null) + styleCell = (XSSFCellStyle) styles.get(nvl(/*dv.getFormatId()*/"","default")); + String value = nvl((String)colHash.get(dv.getColId().toUpperCase())); + + boolean bold = false; + + if(dv.isVisible()) { + cellNum += 1; + //System.out.println("Stripping HTML 1"); + //cell.setCellValue(strip.stripHtml(dv.getDisplayValue())); + String dataType = (String) (dataTypeMap.get(dv.getColId())); + //System.out.println("Value " + value + " " + (( dataType !=null && dataType.equals("DATE")) || (dv.getColName()!=null && dv.getColName().toLowerCase().endsWith("date"))) ); + if (dataType!=null && dataType.equals("NUMBER")){ + //cellNumber = row.createCell((short) cellNum); + //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC); + //cellNumber.setCellValue(dv.getDisplayValue()); + //cellCurrencyNumber = row.createCell((short) cellNum); + int zInt = 0; + if (value.equals("null")){ + sw.createCell(cellNum,zInt,styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + }else{ + + if ((value.indexOf("."))!= -1){ + if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + + //if (dv.getDisplayValue().startsWith("$")){ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); + String tempDollar = dv.getDisplayValue().trim(); + tempDollar = tempDollar.replaceAll(" ", "").substring(0); + tempDollar = tempDollar.replaceAll("\\$", "").substring(0); + //System.out.println("SUBSTRING |" + tempDollar); + //System.out.println("Before copy Value |" + tempDollar); + //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1); + //System.out.println("After copy Value |" + tempDollar); + if ((tempDollar.indexOf(","))!= -1){ + tempDollar = tempDollar.replaceAll(",", ""); + } + //System.out.println("The final string 1 is "+tempDollar); + double tempDoubleDollar = 0.0; + try { + tempDoubleDollar = Double.parseDouble(tempDollar); + if(styleRowCell!=null) + sw.createCell(cellNum, tempDoubleDollar, styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, tempDoubleDollar, styleCell.getIndex()); + else + sw.createCell(cellNum, tempDoubleDollar, styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + } catch (NumberFormatException ne) { + if(styleRowCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempDollar), styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempDollar), styleCell.getIndex()); + else + sw.createCell(cellNum, Utils.excelEncode(tempDollar), styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + } + }else{ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); + double tempDouble = 0.0; + try { + tempDouble = Double.parseDouble(value); + if(styleRowCell!=null) + sw.createCell(cellNum, tempDouble, styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, tempDouble, styleCell.getIndex()); + else + sw.createCell(cellNum, tempDouble, styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + } catch (NumberFormatException ne) { + if(styleRowCell!=null) + sw.createCell(cellNum, Utils.excelEncode(value),styleRowCell.getIndex() ); + else if (styleCell!=null) + sw.createCell(cellNum, Utils.excelEncode(value), styleCell.getIndex()); + else + sw.createCell(cellNum, Utils.excelEncode(value), styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + } + + } + }else { + if (!(value.equals(""))){ + if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + //if (dv.getDisplayValue().startsWith("$")){ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); + String tempInt = value.trim(); + tempInt = tempInt.replaceAll(" ", "").substring(0); + tempInt = tempInt.replaceAll("\\$", "").substring(0); + //System.out.println("SUBSTRING |" + tempInt); + //System.out.println("Before copy Value |" + tempInt); + //tempInt = String.copyValueOf(tempInt.toCharArray(), 1, tempInt.length()-1); + //System.out.println("After copy Value |" + tempInt); + if ((tempInt.indexOf(","))!= -1){ + tempInt = tempInt.replaceAll(",", ""); + } + //System.out.println("The final string INT is "+tempInt); + Long tempIntDollar = 0L; + try { + tempIntDollar = Long.parseLong(tempInt); + if(styleRowCell!=null) + sw.createCell(cellNum, tempIntDollar, styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, tempIntDollar, styleCell.getIndex()); + else + sw.createCell(cellNum, tempIntDollar, styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + } catch (NumberFormatException ne) { + if(styleRowCell!=null) + sw.createCell(cellNum, tempInt, styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, tempInt, styleCell.getIndex()); + else + sw.createCell(cellNum, tempInt, styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + } + }else{ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); + String tempStr = value.trim(); + if ((tempStr.indexOf(","))!= -1){ + tempStr = tempStr.replaceAll(",", ""); + } + Long temp = 0L; + + try { + temp = Long.parseLong(tempStr); + if(styleRowCell!=null) + sw.createCell(cellNum, temp, styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, temp, styleCell.getIndex()); + else + sw.createCell(cellNum, temp, styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + } catch (NumberFormatException ne) { + if(styleRowCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempStr), styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempStr), styleCell.getIndex()); + else + sw.createCell(cellNum, Utils.excelEncode(tempStr), styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + } + } + } + } + } + + } else if ( ( dataType !=null && dataType.equals("DATE")) || (dv.getDisplayName()!=null && dv.getDisplayName().toLowerCase().endsWith("date")) || + (dv.getColId()!=null && dv.getColId().toLowerCase().endsWith("date")) || + (dv.getColName()!=null && dv.getColName().toLowerCase().endsWith("date")) ) { + XSSFCellStyle cellStyle = null; + if(styleRowCell!=null) { + cellStyle = styleRowCell; + } else if (styleCell!=null) { + cellStyle = styleCell; + } else { + cellStyle = styles.get(nvl(/*dv.getFormatId()*/"","date")); + } + + + Date date = null; + int flag = 0; + date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("MMDDYYHHMMSS")); + flag = 1; + } + if(date==null) + date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("MMDDYYHHMM")); + flag = 1; + } + if(date==null) + date = MMDDYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("MMDDYY")); + flag = 1; + } + if(date==null) + date = MMDDYYYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("MMDDYYYYHHMMSS")); + flag = 1; + } + if(date==null) + date = MMDDYYYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("MMDDYYYYHHMM")); + flag = 1; + } + if(date==null) + date = MMDDYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("MMDDYYYY")); + flag = 1; + } + if(date==null) + date = YYYYMMDDFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("YYYYMMDD")); + flag = 1; + } + if(date==null) + date = timestampFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("timestamp")); + flag = 1; + } + if(date==null) + date = MONYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("MONYYYY")); + flag = 1; + } + if(date==null) + date = MMYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("MMYYYY")); + flag = 1; + } + if(date==null) + date = MMMMMDDYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("MMMMMDDYYYY")); + flag = 1; + } + if(date==null) + date = MONTHYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("MONTHYYYY")); + flag = 1; + } + if(date==null) + date = YYYYMMDDHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("YYYYMMDDHHMMSS")); + flag = 1; + } + if(date==null) + date = YYYYMMDDDASHFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("YYYYMMDDDASH")); + flag = 1; + } + if(date==null) + date = YYYYMMDDHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("YYYYMMDDHHMM")); + flag = 1; + } + if(date==null) + date = DDMONYYYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("DDMONYYYYHHMMSS")); + flag = 1; + } + if(date==null) + date = DDMONYYYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("DDMONYYYYHHMM")); + flag = 1; + } + if(date==null) + date = DDMONYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("DDMONYYHHMM")); + flag = 1; + } + if(date==null) + date = DDMONYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("DDMONYYYY")); + flag = 1; + } + if(date==null) + date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("MMDDYYHHMMSS")); + flag = 1; + } + if(date==null) + date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("MMDDYYHHMM")); + flag = 1; + } + if(date==null) + date = MMDDYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("MMDDYY")); + flag = 1; + } + if(date==null) + date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("MMDDYYHHMM")); + flag = 1; + } + if(date==null) + date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("MMDDYYHHMMSS")); + flag = 1; + } + if(date==null) + date = MMDDYYYYHHMMZFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("MMDDYYYYHHMMZ")); + flag = 1; + } + if(date==null) + date = MMMMMDDYYYYHHMMSS.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + cellStyle.setDataFormat(dateFormatMap.get("MMMMMDDYYYYHHMMSS")); + flag = 1; + } + + if(date!=null) { + //System.out.println("ExcelDate " + HSSFDateUtil.getExcelDate(date)); + Calendar cal=Calendar.getInstance(); + cal.setTime(date); + //sw.createCell(cellNum, cal,styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + //if(styleRowCell!=null) + sw.createCell(cellNum, cal, cellStyle.getIndex()); + //else if (styleCell!=null) + //sw.createCell(cellNum, cal, cellStyle.getIndex()); + //else + //sw.createCell(cellNum, cal, cellStyle.getIndex()); + } else { + //cell.getCellStyle().setDataFormat((short)0); + //if(styleRowCell!=null) + sw.createCell(cellNum, Utils.excelEncode(value), cellStyle.getIndex()); + //else if (styleCell!=null) + //sw.createCell(cellNum, Utils.excelEncode(value), cellStyle.getIndex()); + //else + //sw.createCell(cellNum, Utils.excelEncode(value), cellStyle.getIndex()); + + } + //cellDate.setCellValue(date); + //cellDate.setCellValue(value); //cellDate.setCellValue(date); + //cellDate.setCellValue(dv.getDisplayValue()); + + } else if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){ + //cellNumber = row.createCell((short) cellNum); + //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC); + //cellNumber.setCellValue(dv.getDisplayValue()); + int zInt = 0; + if (value.equals("null")){ + if(styleRowCell!=null) + sw.createCell(cellNum, zInt, styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, zInt, styleCell.getIndex()); + else + sw.createCell(cellNum, zInt, styleDefaultCell.getIndex()); + + } else { + + if ((value.indexOf("."))!= -1){ + if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + + //if (value.startsWith("$")){ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); + String tempDollar = value.trim(); + tempDollar = tempDollar.replaceAll(" ", "").substring(0); + tempDollar = tempDollar.replaceAll("\\$", "").substring(0); + //System.out.println("SUBSTRING |" + tempDollar); + //System.out.println("Before copy Value |" + tempDollar); + //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1); + //System.out.println("After copy Value |" + tempDollar); + if ((tempDollar.indexOf(","))!= -1){ + tempDollar = tempDollar.replaceAll(",", ""); + } + //System.out.println("The final string 2IF is "+tempDollar); + double tempDoubleDollar = 0.0; + try { + tempDoubleDollar = Double.parseDouble(tempDollar); + if(styleRowCell!=null) + sw.createCell(cellNum, tempDoubleDollar,styleRowCell.getIndex() ); + else if (styleCell!=null) + sw.createCell(cellNum, tempDoubleDollar, styleCell.getIndex()); + else + sw.createCell(cellNum, tempDoubleDollar, styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + } catch (NumberFormatException ne) { + if(styleRowCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempDollar), styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempDollar), styleCell.getIndex()); + else + sw.createCell(cellNum, Utils.excelEncode(tempDollar), styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + } + + + }else{ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); + String tempDoubleStr = value.trim(); + tempDoubleStr = tempDoubleStr.replaceAll(" ", "").substring(0); + if ((tempDoubleStr.indexOf(","))!= -1){ + tempDoubleStr = tempDoubleStr.replaceAll(",", ""); + } + double tempDouble = 0.0; + try { + tempDouble = Double.parseDouble(tempDoubleStr); + if(styleRowCell!=null) + sw.createCell(cellNum, tempDouble, styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, tempDouble, styleCell.getIndex()); + else + sw.createCell(cellNum, tempDouble, styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + } catch (NumberFormatException ne) { + if(styleRowCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempDoubleStr), styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempDoubleStr), styleCell.getIndex()); + else + sw.createCell(cellNum, Utils.excelEncode(tempDoubleStr), styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + } + } + + }else { + if (!(value.equals(""))){ + if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + //if (value.startsWith("$")){ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); + String tempInt = value.trim(); + tempInt = tempInt.replaceAll(" ", "").substring(0); + tempInt = tempInt.replaceAll("\\$", "").substring(0); + //System.out.println("SUBSTRING |" + tempInt); + //System.out.println("Before copy Value |" + tempInt); + //tempInt = String.copyValueOf(tempInt.toCharArray(), 1, tempInt.length()-1); + //System.out.println("After copy Value |" + tempInt); + if ((tempInt.indexOf(","))!= -1){ + tempInt = tempInt.replaceAll(",", ""); + } + //System.out.println("The final string INT 2 is "+tempInt); + + Long tempIntDollar = 0L; + + try { + tempIntDollar = Long.parseLong(tempInt); + if(styleRowCell!=null) + sw.createCell(cellNum, tempIntDollar,styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, tempIntDollar,styleCell.getIndex()); + else + sw.createCell(cellNum, tempIntDollar,styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + + } catch (NumberFormatException ne) { + if(styleRowCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempInt), styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempInt),styleCell.getIndex()); + else + sw.createCell(cellNum, Utils.excelEncode(tempInt), styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + } + }else{ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); + String tempStr = value.trim(); + if ((tempStr.indexOf(","))!= -1){ + tempStr = tempStr.replaceAll(",", ""); + } + Long temp = 0L; + + try { + temp = Long.parseLong(tempStr); + if(styleRowCell!=null) + sw.createCell(cellNum, temp, styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, temp, styleCell.getIndex()); + else + sw.createCell(cellNum, temp, styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + } catch (NumberFormatException ne) { + if(styleRowCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempStr), styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempStr), styleCell.getIndex()); + else + sw.createCell(cellNum, Utils.excelEncode(tempStr), styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + + } + } + } else { + sw.createCell(cellNum, "", styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + } + } + } + + + } + else { + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("General")); + if(styleRowCell!=null) + sw.createCell(cellNum, strip.stripHtml(Utils.excelEncode(value)), styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, strip.stripHtml(Utils.excelEncode(value)), styleCell.getIndex()); + else { + if(nvl(value).startsWith(" ")) + sw.createCell(cellNum, strip.stripHtml(Utils.excelEncode(value)), styles.get(nvl(/*dv.getFormatId(),*/"","defaultLeft")).getIndex()); + else + sw.createCell(cellNum, strip.stripHtml(Utils.excelEncode(value)), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + + } + + } + + if (dv.isBold()) { + if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){ + if (value!=null && (value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + //cell.setCellStyle(styleCurrencyTotal); + } + else { + //cell.setCellStyle(styleTotal); + } + } else { + //cell.setCellStyle(styleDefaultTotal); + } + bold = true; + } + //System.out.println("2IF "+ (dr.isRowFormat()) + " " + (dv.isCellFormat()) + " " + (styles!=null)); + if ((dr.isRowFormat() && !dv.isCellFormat()) && styles != null) { + //cell.setCellStyle((HSSFCellStyle) styles.get(nvl(dr.getFormatId(),"default"))); + continue; + } + //System.out.println("3IF "+ (htmlFormat != null) + " " + (dv.getFormatId() != null) + " " + (bold == false) + " "+ (styles != null)); + if (htmlFormat != null && dv.getFormatId() != null && bold == false + && styles != null) { + //cell.setCellStyle((HSSFCellStyle) styles.get(nvl(/*dv.getFormatId()*/"","default"))); + } //else if (bold == false) + //cell.setCellStyle(styleDefault); + } // dv.isVisible + + } + rowNum += 1; + sw.endRow(); + + } + if(rd.reportTotalRowHeaderCols!=null) { + rowCount++; + sw.insertRow(rowNum); + cellNum = -1; + rd.reportTotalRowHeaderCols.resetNext(); + cellNum += 1; + RowHeaderCol rhc = rd.reportTotalRowHeaderCols.getNext(); + RowHeader rh = rhc.getRowHeader(0); + if (dr.isRowFormat() && styles != null) + styleRowCell = (XSSFCellStyle) styles.get(nvl(/*dr.getFormatId(),*/"","default")); + + if(styleRowCell!=null) + sw.createCell(cellNum, strip.stripHtml(rh.getRowTitle()), styleRowCell.getIndex()); + else + sw.createCell(cellNum, strip.stripHtml(rh.getRowTitle()), styleDefaultCell.getIndex()); + rd.reportDataTotalRow.resetNext(); + //rd.reportDataTotalRow.getNext(); + DataRow drTotal = rd.reportDataTotalRow.getNext(); + if(drTotal!=null) { + drTotal.resetNext(); drTotal.getNext(); + for (; drTotal.hasNext();) { + DataValue dv = drTotal.getNext(); + if(dv.isVisible()) { + cellNum += 1; + styleCell = null; + String value = dv.getDisplayValue(); + sw.createCell(cellNum,value,styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } + } + } + rowNum += 1; + sw.endRow(); + } + + + + + +/* // To Display Total Values for Linear report + if(rd.reportDataTotalRow!=null) { + row = sheet.createRow(rowNum); + cellNum = -1; + rd.reportTotalRowHeaderCols.resetNext(); + //for (rd.reportTotalRowHeaderCols.resetNext(); rd.reportTotalRowHeaderCols.hasNext();) { + cellNum += 1; + RowHeaderCol rhc = rd.reportTotalRowHeaderCols.getNext(); + RowHeader rh = rhc.getRowHeader(0); + row.createCell((short) cellNum).setCellValue(strip.stripHtml(rh.getRowTitle())); + row.getCell((short) cellNum).setCellStyle(styleDefaultTotal); + //} + + DataRow drTotal = rd.reportDataTotalRow.getNext(); + //cellNum = -1; + for (drTotal.resetNext(); drTotal.hasNext();j++) { + cellNum += 1; + cell = row.createCell((short) cellNum); + DataValue dv = drTotal.getNext(); + String value = dv.getDisplayValue(); + cell.setCellValue(value); + boolean bold = false; + if (dv.isBold()) { + if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){ + if (value!=null && (value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + cell.setCellStyle(styleCurrencyTotal); + } else { + cell.setCellStyle(styleTotal); + } + } else { + cell.setCellStyle(styleDefaultTotal); + } + bold = true; + } + } + }*/ + + } catch (SQLException ex) { + throw new RaptorException(ex); + } catch (ReportSQLException ex) { + throw new RaptorException(ex); + } catch (Exception ex) { + if(!(ex.getCause() instanceof java.net.SocketException) ) + throw new RaptorException (ex); + } finally { + try { + if(conn!=null) + conn.close(); + if(st!=null) + st.close(); + if(rs!=null) + rs.close(); + } catch (SQLException ex) { + throw new RaptorException(ex); + } + } + + String footer = (String) session.getAttribute("FOOTER_"+index); + if(nvl(footer).length()>0) { + footer = Utils.replaceInString(footer, "
    ", " "); + footer = Utils.replaceInString(footer, "
    ", " "); + footer = Utils.replaceInString(footer, "
    ", " "); + footer = strip.stripHtml(nvl(footer).trim()); + rowNum += 1; + sw.insertRow(rowNum); + cellNum = 0; + sw.createCell(cellNum, footer.replaceAll("&", "&"), styleDefaultCell.getIndex()); + sw.endRow(); + rowNum += 1; + } + + if(Globals.getShowDisclaimer()) { + rowNum += 1; + sw.insertRow(rowNum); + cellNum = 0; + + sw.createCell(cellNum, org.openecomp.portalsdk.analytics.system.Globals.getFooterFirstLine().replaceAll("&", "&"), styleDefaultCell.getIndex()); + sw.endRow(); + rowNum += 1; + sw.insertRow(rowNum); + cellNum = 0; + sw.createCell(cellNum, org.openecomp.portalsdk.analytics.system.Globals.getFooterSecondLine().replaceAll("&", "&"), styleDefaultCell.getIndex()); + sw.endRow(); + } + + } else { + //start data from rd + + int rowCount = 0; + DataRow dr = null; + for (rd.reportDataRows.resetNext(); rd.reportDataRows.hasNext();) { + rowCount++; + + + dr = rd.reportDataRows.getNext(); + sw.insertRow(rowNum); + + cellNum = -1; + + if (rr.getReportType().equals(AppConstants.RT_LINEAR) && rd.reportTotalRowHeaderCols!=null) { + rd.reportRowHeaderCols.resetNext(0); + if(rd.reportTotalRowHeaderCols!=null) { + //cellNum = -1; + //for (rd.reportRowHeaderCols.resetNext(); rd.reportRowHeaderCols.hasNext();) { + //a commented to suppress rownum + //a cellNum += 1; + //RowHeaderCol rhc = rd.reportRowHeaderCols.getRowHeaderCol(0); + //if (firstPass) + // rhc.resetNext(); + //RowHeader rh = rhc.getRowHeader(rowCount-1); + //a sw.createCell(cellNum, rowCount, styleDefaultCell.getIndex()); + //} // for + } + + } + firstPass = false; + //cellNum = -1; + int j = 0; + + for (dr.resetNext(); dr.hasNext();j++) { + DataValue dv = dr.getNext(); + styleCell = null; + boolean bold = false; + String value = nvl(dv.getDisplayValue()); + value = strip.stripHtml(value); + HtmlFormatter htmlFormat = dv.getCellFormatter(); + if ((dr.isRowFormat() && !dv.isCellFormat()) && styles != null) + styleCell = (XSSFCellStyle) styles.get(nvl(/*dr.getFormatId(),*/"","default")); + if (htmlFormat != null && dv.getFormatId() != null && styles != null) + styleCell = (XSSFCellStyle) styles.get(nvl(/*dv.getFormatId(),*/"","default")); + + if(dv.isVisible()) { + cellNum += 1; + //cell = row.createCell((short) cellNum); + //System.out.println("Stripping HTML 1"); + //cell.setCellValue(strip.stripHtml(value)); + String dataType = (String) (dataTypeMap.get(dv.getColId())); + //System.out.println(" The Display Value is ********"+value + " " + dv.getDisplayTotal() + " " + dv.getColName()); + + if (dataType!=null && dataType.equals("NUMBER")){ + //cellNumber = row.createCell((short) cellNum); + //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC); + //cellNumber.setCellValue(value); + //cellCurrencyNumber = row.createCell((short) cellNum); + int zInt = 0; + if (value.equals("null")){ + sw.createCell(cellNum,zInt,styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + }else{ + + if ((value.indexOf("."))!= -1){ + if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + + //if (value.startsWith("$")){ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); + String tempDollar = value.trim(); + tempDollar = tempDollar.replaceAll(" ", "").substring(0); + tempDollar = tempDollar.replaceAll("\\$", "").substring(0); + //System.out.println("SUBSTRING |" + tempDollar); + //System.out.println("Before copy Value |" + tempDollar); + //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1); + //System.out.println("After copy Value |" + tempDollar); + if ((tempDollar.indexOf(","))!= -1){ + tempDollar = tempDollar.replaceAll(",", ""); + } + //System.out.println("The final string 1 is "+tempDollar); + double tempDoubleDollar = 0.0; + try { + tempDoubleDollar = Double.parseDouble(tempDollar); + if(styleRowCell!=null) + sw.createCell(cellNum, tempDoubleDollar, styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, tempDoubleDollar, styleCell.getIndex()); + else + sw.createCell(cellNum, tempDoubleDollar, styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } catch (NumberFormatException ne) { + if(styleRowCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempDollar), styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempDollar), styleCell.getIndex()); + else + sw.createCell(cellNum, Utils.excelEncode(tempDollar), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } + }else{ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); + double tempDouble = 0.0; + try { + tempDouble = Double.parseDouble(value); + if(styleRowCell!=null) + sw.createCell(cellNum, tempDouble, styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, tempDouble, styleCell.getIndex()); + else + sw.createCell(cellNum, tempDouble, styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } catch (NumberFormatException ne) { + if(styleRowCell!=null) + sw.createCell(cellNum, Utils.excelEncode(value),styleRowCell.getIndex() ); + else if (styleCell!=null) + sw.createCell(cellNum, Utils.excelEncode(value), styleCell.getIndex()); + else + sw.createCell(cellNum, Utils.excelEncode(value), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } + + } + }else { + if (!(value.equals(""))){ + if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + //if (value.startsWith("$")){ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); + String tempInt = value.trim(); + tempInt = tempInt.replaceAll(" ", "").substring(0); + tempInt = tempInt.replaceAll("\\$", "").substring(0); + //System.out.println("SUBSTRING |" + tempInt); + //System.out.println("Before copy Value |" + tempInt); + //tempInt = String.copyValueOf(tempInt.toCharArray(), 1, tempInt.length()-1); + //System.out.println("After copy Value |" + tempInt); + if ((tempInt.indexOf(","))!= -1){ + tempInt = tempInt.replaceAll(",", ""); + } + //System.out.println("The final string INT is "+tempInt); + Long tempIntDollar = 0L; + try { + tempIntDollar = Long.parseLong(tempInt); + if(styleRowCell!=null) + sw.createCell(cellNum, tempIntDollar, styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, tempIntDollar, styleCell.getIndex()); + else + sw.createCell(cellNum, tempIntDollar, styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } catch (NumberFormatException ne) { + if(styleRowCell!=null) + sw.createCell(cellNum, tempInt, styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, tempInt, styleCell.getIndex()); + else + sw.createCell(cellNum, tempInt, styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } + }else{ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); + String tempStr = value.trim(); + if ((tempStr.indexOf(","))!= -1){ + tempStr = tempStr.replaceAll(",", ""); + } + Long temp = 0L; + + try { + temp = Long.parseLong(tempStr); + if(styleRowCell!=null) + sw.createCell(cellNum, temp, styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, temp, styleCell.getIndex()); + else + sw.createCell(cellNum, temp, styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } catch (NumberFormatException ne) { + if(styleRowCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempStr), styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempStr), styleCell.getIndex()); + else + sw.createCell(cellNum, Utils.excelEncode(tempStr), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } + + + } + //int temp = Integer.parseInt(value.trim()); + // cell.setCellValue(temp); + //}else{ + // cell.setCellValue(strip.stripHtml(value)); + //} + } + } + } + + }else if ( ( dataType !=null && dataType.equals("DATE")) || (dv.getDisplayName()!=null && dv.getDisplayName().toLowerCase().endsWith("date")) || + (dv.getColId()!=null && dv.getColId().toLowerCase().endsWith("date")) || + (dv.getColName()!=null && dv.getColName().toLowerCase().endsWith("date")) ) { + Date date = null; + int flag = 0; + date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = MMDDYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = MMDDYYYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = MMDDYYYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = MMDDYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = YYYYMMDDFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = timestampFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = MONYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = MMYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = MMMMMDDYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = MONTHYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = YYYYMMDDHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = YYYYMMDDDASHFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = YYYYMMDDHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = DDMONYYYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = DDMONYYYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = DDMONYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = DDMONYYYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = MMDDYYFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = MMDDYYHHMMFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = MMDDYYHHMMSSFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = MMDDYYYYHHMMZFormat.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + if(date==null) + date = MMMMMDDYYYYHHMMSS.parse(value, new ParsePosition(0)); + if(date != null && flag == 0) { + flag = 1; + } + + + if(date!=null) { + Calendar cal=Calendar.getInstance(); + cal.setTime(date); + //sw.createCell(cellNum, cal,styles.get(nvl(/*dv.getFormatId()*/"","default")).getIndex()); + if(styleRowCell!=null) + sw.createCell(cellNum, cal, styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, cal, styleCell.getIndex()); + else + sw.createCell(cellNum, cal, styles.get(nvl(/*dv.getFormatId()*/"","date")).getIndex()); + + } else { + /*cell.getCellStyle().setDataFormat((short)0);*/ + if(styleRowCell!=null) + sw.createCell(cellNum, Utils.excelEncode(value), styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, Utils.excelEncode(value), styleCell.getIndex()); + else + sw.createCell(cellNum, Utils.excelEncode(value), styles.get(nvl(/*dv.getFormatId(),*/"","date")).getIndex()); + + } + //cellDate.setCellValue(date); + //cellDate.setCellValue(value); + + }else if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){ + //cellNumber = row.createCell((short) cellNum); + //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC); + //cellNumber.setCellValue(value); + int zInt = 0; + if (value.equals("null")){ + if(styleRowCell!=null) + sw.createCell(cellNum, zInt, styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, zInt, styleCell.getIndex()); + else + sw.createCell(cellNum, zInt, styleDefaultCell.getIndex()); + } else { + + if ((value.indexOf("."))!= -1){ + if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + + //if (value.startsWith("$")){ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); + String tempDollar = value.trim(); + tempDollar = tempDollar.replaceAll(" ", "").substring(0); + tempDollar = tempDollar.replaceAll("\\$", "").substring(0); + //System.out.println("SUBSTRING |" + tempDollar); + //System.out.println("Before copy Value |" + tempDollar); + //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1); + //System.out.println("After copy Value |" + tempDollar); + if ((tempDollar.indexOf(","))!= -1){ + tempDollar = tempDollar.replaceAll(",", ""); + } + //System.out.println("The final string 2IF is "+tempDollar); + double tempDoubleDollar = 0.0; + try { + tempDoubleDollar = Double.parseDouble(tempDollar); + if(styleRowCell!=null) + sw.createCell(cellNum, tempDoubleDollar,styleRowCell.getIndex() ); + else if (styleCell!=null) + sw.createCell(cellNum, tempDoubleDollar, styleCell.getIndex()); + else + sw.createCell(cellNum, tempDoubleDollar, styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } catch (NumberFormatException ne) { + if(styleRowCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempDollar), styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempDollar), styleCell.getIndex()); + else + sw.createCell(cellNum, Utils.excelEncode(tempDollar), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } + + + }else{ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); + String tempDoubleStr = value.trim(); + tempDoubleStr = tempDoubleStr.replaceAll(" ", "").substring(0); + if ((tempDoubleStr.indexOf(","))!= -1){ + tempDoubleStr = tempDoubleStr.replaceAll(",", ""); + } + double tempDouble = 0.0; + try { + tempDouble = Double.parseDouble(tempDoubleStr); + if(styleRowCell!=null) + sw.createCell(cellNum, tempDouble, styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, tempDouble, styleCell.getIndex()); + else + sw.createCell(cellNum, tempDouble, styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } catch (NumberFormatException ne) { + if(styleRowCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempDoubleStr), styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempDoubleStr), styleCell.getIndex()); + else + sw.createCell(cellNum, Utils.excelEncode(tempDoubleStr), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } + } + + }else { + if (!(value.equals(""))){ + if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + //if (value.startsWith("$")){ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); + String tempInt = value.trim(); + tempInt = tempInt.replaceAll(" ", "").substring(0); + tempInt = tempInt.replaceAll("\\$", "").substring(0); + //System.out.println("SUBSTRING |" + tempInt); + //System.out.println("Before copy Value |" + tempInt); + //tempInt = String.copyValueOf(tempInt.toCharArray(), 1, tempInt.length()-1); + //System.out.println("After copy Value |" + tempInt); + if ((tempInt.indexOf(","))!= -1){ + tempInt = tempInt.replaceAll(",", ""); + } + //System.out.println("The final string INT 2 is "+tempInt); + + Long tempIntDollar = 0L; + + try { + tempIntDollar = Long.parseLong(tempInt); + if(styleRowCell!=null) + sw.createCell(cellNum, tempIntDollar,styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, tempIntDollar,styleCell.getIndex()); + else + sw.createCell(cellNum, tempIntDollar,styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } catch (NumberFormatException ne) { + if(styleRowCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempInt), styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempInt),styleCell.getIndex()); + else + sw.createCell(cellNum, Utils.excelEncode(tempInt), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } + }else{ + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); + String tempStr = value.trim(); + if ((tempStr.indexOf(","))!= -1){ + tempStr = tempStr.replaceAll(",", ""); + } + Long temp = 0L; + + try { + temp = Long.parseLong(tempStr); + if(styleRowCell!=null) + sw.createCell(cellNum, temp, styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, temp, styleCell.getIndex()); + else + sw.createCell(cellNum, temp, styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } catch (NumberFormatException ne) { + if(styleRowCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempStr), styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, Utils.excelEncode(tempStr), styleCell.getIndex()); + else + sw.createCell(cellNum, Utils.excelEncode(tempStr), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } + } + //int temp = Integer.parseInt(value.trim()); + // cell.setCellValue(temp); + //}else{ + // cell.setCellValue(strip.stripHtml(value)); + //} + } else { + sw.createCell(cellNum, "", styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } + } + } + + + } + else { + //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("General")); + if(styleRowCell!=null) + sw.createCell(cellNum, strip.stripHtml(Utils.excelEncode(value)), styleRowCell.getIndex()); + else if (styleCell!=null) + sw.createCell(cellNum, strip.stripHtml(Utils.excelEncode(value)), styleCell.getIndex()); + else + sw.createCell(cellNum, strip.stripHtml(Utils.excelEncode(value)), styles.get(nvl(/*dv.getFormatId(),*/"","default")).getIndex()); + } + + //if (!(value.equals(""))){ + //int temp = Integer.parseInt(value.trim()); + //cell.setCellValue(temp); + //}else{ + // cell.setCellValue(strip.stripHtml(value)); + //} + //HSSFCellStyle styleFormat = null; + //HSSFCellStyle numberStyle = null; + //HSSFFont formatFont = null; + //short fgcolor = 0; + //short fillpattern = 0; + //System.out.println("1IF "+ (dv.isBold()) + " "+ value + " " + dv.getDisplayTotal() + " " + dv.getColName() ); + if (dv.isBold()) { + if((dv.getDisplayTotal()!=null && dv.getDisplayTotal().equals("SUM(")) || (dv.getColName()!=null && dv.getColName().indexOf("999")!=-1)){ + if (value!=null && (value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { + //cell.setCellStyle(styleCurrencyTotal); + } + else { + //cell.setCellStyle(styleTotal); + } + } else { + //cell.setCellStyle(styleDefaultTotal); + } + bold = true; + } + //System.out.println("2IF "+ (dr.isRowFormat()) + " " + (dv.isCellFormat()) + " " + (styles!=null)); + if ((dr.isRowFormat() && !dv.isCellFormat()) && styles != null) { + //cell.setCellStyle((HSSFCellStyle) styles.get(nvl(dr.getFormatId(),"default"))); + continue; + } + //System.out.println("3IF "+ (htmlFormat != null) + " " + (dv.getFormatId() != null) + " " + (bold == false) + " "+ (styles != null)); + if (htmlFormat != null && dv.getFormatId() != null && bold == false + && styles != null) { + // cell.setCellStyle((HSSFCellStyle) styles.get(nvl(/*dv.getFormatId()*/"","default"))); + } //else if (bold == false) + //cell.setCellStyle(styleDefault); + } // if (dv.isVisible) + } // for + + /*for (int tmp=0; tmp0) { + footer = Utils.replaceInString(footer, "
    ", " "); + footer = Utils.replaceInString(footer, "
    ", " "); + footer = Utils.replaceInString(footer, "
    ", " "); + footer = strip.stripHtml(nvl(footer).trim()); + rowNum += 1; + sw.insertRow(rowNum); + cellNum = 0; + sw.createCell(cellNum, footer.replaceAll("&", "&"), styleDefaultCell.getIndex()); + sw.endRow(); + rowNum += 1; + } + + + if(Globals.getShowDisclaimer()) { + rowNum += 1; + sw.insertRow(rowNum); + cellNum = 0; + + sw.createCell(cellNum, org.openecomp.portalsdk.analytics.system.Globals.getFooterFirstLine().replaceAll("&", "&"), styleDefaultCell.getIndex()); + sw.endRow(); + rowNum += 1; + sw.insertRow(rowNum); + cellNum = 0; + sw.createCell(cellNum, org.openecomp.portalsdk.analytics.system.Globals.getFooterSecondLine().replaceAll("&", "&"), styleDefaultCell.getIndex()); + sw.endRow(); + } + + + } + // end data from rd + } + + // System.out.println(" Last Row " + wb.getSheetAt(0).getLastRowNum()); + } + + private void paintXSSFExcelParams(XSSFWorkbook wb,int rowNum,int col,ArrayList paramsList, String customizedParamInfo, XSSFSheet sheet, String reportTitle, String reportDescr) throws IOException { + //HSSFSheet sheet = wb.getSheet(getSheetName()); + int cellNum = 0; + XSSFRow row = null; + short s1 = 0, s2 = (short) 1; + HtmlStripper strip = new HtmlStripper(); + // Name Style + XSSFCellStyle styleName = wb.createCellStyle(); + //styleName.setFillBackgroundColor(HSSFColor.GREY_80_PERCENT.index); + styleName.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index); + //styleName.setFillPattern(HSSFCellStyle.SPARSE_DOTS); + styleName.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleName.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleName.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleName.setBorderRight(HSSFCellStyle.BORDER_THIN); + styleName.setBorderLeft(HSSFCellStyle.BORDER_THIN); + styleName.setDataFormat((short)0); + XSSFFont font = wb.createFont(); + font.setFontHeight((short) (font_size / 0.05)); + font.setFontName("Tahoma"); + font.setColor(HSSFColor.BLACK.index); + font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + styleName.setFont(font); + //Data Style + + // Create some fonts. + XSSFFont fontDefault = wb.createFont(); + // Initialize the styles & fonts. + // The default will be plain . + fontDefault.setColor((short) HSSFFont.COLOR_NORMAL); + fontDefault.setFontHeight((short) (font_size / 0.05)); + fontDefault.setFontName("Tahoma"); + fontDefault.setItalic(true); + // Style default will be normal with no background + XSSFCellStyle styleValue = wb.createCellStyle(); + styleValue.setDataFormat((short)0); + styleValue.setAlignment(HSSFCellStyle.ALIGN_CENTER); + styleValue.setBorderBottom(HSSFCellStyle.BORDER_THIN); + styleValue.setBorderTop(HSSFCellStyle.BORDER_THIN); + styleValue.setBorderLeft(HSSFCellStyle.BORDER_THIN); + styleValue.setBorderRight(HSSFCellStyle.BORDER_THIN); + // styleValue.setFillForegroundColor(HSSFColor.YELLOW.index); + styleValue.setFillPattern(HSSFCellStyle.NO_FILL); + styleValue.setFont(fontDefault); + XSSFCell cell = null; + XSSFCellStyle styleDescription = wb.createCellStyle(); + styleDescription.setAlignment(HSSFCellStyle.ALIGN_CENTER); +// styleDescription.setBorderBottom(HSSFCellStyle.BORDER_THIN); +// styleDescription.setBorderTop(HSSFCellStyle.BORDER_THIN); +// styleDescription.setBorderRight(HSSFCellStyle.BORDER_THIN); +// styleDescription.setBorderLeft(HSSFCellStyle.BORDER_THIN); + XSSFFont fontDescr = wb.createFont(); + fontDescr.setFontHeight((short) (font_header_descr_size / 0.05)); + fontDescr.setFontName("Tahoma"); + fontDescr.setColor(HSSFColor.BLACK.index); + fontDescr.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + styleDescription.setFont(font); + XSSFCell cellDescr = null; + int paramSeq = 0; + Header header = sheet.getHeader(); + StringBuffer strBuf = new StringBuffer(); + if(!Globals.customizeFormFieldInfo() || customizedParamInfo.length()<=0) { + for (Iterator iter = paramsList.iterator(); iter.hasNext();) { + IdNameValue value = (IdNameValue) iter.next(); + //System.out.println("\"" + value.getId() + " = " + value.getName() + "\""); + if(nvl(value.getId()).trim().length()>0 && (!nvl(value.getId()).trim().equals("BLANK"))) { + paramSeq += 1; + if(paramSeq <= 1) { + row = sheet.createRow(++rowNum); + cell = row.createCell((short) 0); + sheet.addMergedRegion(new CellRangeAddress(rowNum, rowNum, s1, s2)); + cellDescr = row.createCell((short) 0); + cellDescr.setCellValue("Run-time Parameters"); + cellDescr.setCellStyle(styleDescription); + + + strBuf.append(reportTitle+"\n"); + //strBuf.append("Run-time Parameters\n"); + } + row = sheet.createRow(++rowNum); + cellNum = 0; + //System.out.println("RowNum " + rowNum + " " + value.getId() + " " +value.getName()); + cell = row.createCell((short) cellNum); + cell.setCellValue(value.getId()); + cell.setCellStyle(styleName); + cellNum += 1; + cell = row.createCell((short) cellNum); + cell.setCellValue(value.getName().replaceAll("~",",")); + cell.setCellStyle(styleValue); + + //strBuf.append(value.getId()+": "+ value.getName()+"\n"); + } + } //for + } else { + strBuf.append(reportTitle+"\n"); + Document document = new Document(); + document.open(); + HTMLWorker worker = new HTMLWorker(document); + StyleSheet style = new StyleSheet(); + style.loadTagStyle("body", "leading", "16,0"); + ArrayList p = HTMLWorker.parseToList(new StringReader(customizedParamInfo), style); + String name = ""; + String token = ""; + String value = ""; + String s = ""; + PdfPTable pdfTable = null; + for (int k = 0; k < p.size(); ++k){ + if(p.get(k) instanceof Paragraph) + s = ((Paragraph)p.get(k)).toString(); + else { /*if ((p.get(k) instanceof PdfPTable))*/ + pdfTable = ((PdfPTable)p.get(k)); + } + //todo: Logic for parsing pdfTable should be added after upgrading to iText 5.0.0 + //s = Utils.replaceInString(s, ",", "|"); + s = s.replaceAll(",", "|"); + s = s.replaceAll("~", ","); + if(s.indexOf(":")!= -1) { + //System.out.println("|"+s+"|"); + row = sheet.createRow(++rowNum); + cell = row.createCell((short) 0); + sheet.addMergedRegion(new CellRangeAddress(rowNum, rowNum, s1, s2)); + cellDescr = row.createCell((short) 0); + cellDescr.setCellValue("Run-time Parameters"); + cellDescr.setCellStyle(styleDescription); + + //strBuf.append("Run-time Parameters\n"); + StringTokenizer st = new StringTokenizer(s.trim(), "|"); + while(st.hasMoreTokens()) { + token = st.nextToken(); + token = token.trim(); + if (!(token.trim().equals("|") || token.trim().equals("]]") || token.trim().equals("]") || token.trim().equals("[") )) { + if(token.endsWith(":")) { + name = token; + name = name.substring(0, name.length()-1); + if(name.startsWith("[")) + name = name.substring(1); + value = st.nextToken(); + if(nvl(value).endsWith("]"))value = nvl(value).substring(0, nvl(value).length()-1); + } /*else if(name != null && name.length() > 0) { + value = st.nextToken(); + if(value.endsWith("]]"))value = value.substring(0, value.length()-1); + }*/ + if(name!=null && name.trim().length()>0) { + row = sheet.createRow((short) ++rowNum); + cellNum = 0; + cell = row.createCell((short) cellNum); + cell.setCellValue(name.trim()); + cell.setCellStyle(styleName); + cellNum += 1; + cell = row.createCell((short) cellNum); + cell.setCellValue(value.trim()); + cell.setCellStyle(styleValue); + //strBuf.append(name.trim()+": "+ value.trim()+"\n"); + } +/* if(token.endsWith(":") && (value!=null && value.trim().length()<=0) && (name!=null && name.trim().length()>0 && name.endsWith(":"))) { + name = name.substring(0, name.indexOf(":")+1); + //value = token.substring(token.indexOf(":")+1); + row = sheet.createRow((short) ++rowNum); + cellNum = 0; + cell = row.createCell((short) cellNum); + cell.setCellValue(name.trim()); + cell.setCellStyle(styleName); + cellNum += 1; + cell = row.createCell((short) cellNum); + cell.setCellValue(value.trim()); + cell.setCellStyle(styleValue); + + //strBuf.append(name.trim()+": "+ value.trim()+"\n"); + value = ""; + name = ""; + } +*/ } + int cw = 0; + cw = name.trim().length() + 12; + // if(i!=cellWidth.size()-1) + if(sheet.getColumnWidth((short)0)< (short) name.trim().length()) + sheet.setColumnWidth((short)0, (short) name.trim().length()); + if(sheet.getColumnWidth((short)1)< (short) value.trim().length()) + sheet.setColumnWidth((short)1, (short) value.trim().length()); + name = ""; + value = ""; + + } + + try { + SimpleDateFormat oracleDateFormat = new SimpleDateFormat("MM/dd/yyyy kk:mm:ss"); + Date sysdate = oracleDateFormat.parse(ReportLoader.getSystemDateTime()); + SimpleDateFormat dtimestamp = new SimpleDateFormat(Globals.getScheduleDatePattern()); + + row = sheet.createRow((short) ++rowNum); + cellNum = 0; + cell = row.createCell((short) cellNum); + cell.setCellValue("Report Date/Time"); + cell.setCellStyle(styleName); + cellNum += 1; + cell = row.createCell((short) cellNum); + + cell.setCellValue(dtimestamp.format(sysdate)+" "+Globals.getTimeZone()); + cell.setCellStyle(styleValue); + + } catch(Exception ex) { + //ex.printStackTrace(); + } + + + } + } + + +/* Iterator iter1 = paramsList.iterator(); + s1 = 0; s2 = (short)10; + if(iter1.hasNext()) { + row = sheet.createRow((short) ++rowNum); + cellNum = 0; + cell = row.createCell((short) cellNum); + sheet.addMergedRegion(new Region(rowNum, s1, rowNum, s2)); + cell.setCellValue(strip.stripHtml(customizedParamInfo)); + } +*/ +/* rowNum += 2; + row = sheet.createRow(rowNum);*/ + } // if + Iterator iterCheck = paramsList.iterator(); + if(iterCheck.hasNext()) { + rowNum += 2; + row = sheet.createRow(rowNum); + } + header.setCenter(HSSFHeader.font("Tahoma", "")+ HSSFHeader.fontSize((short) font_header_title_size)+strBuf.toString()); + } + + // Trying different --> + public void createHTMLFileContent(Writer out, ReportData rd, + ReportRuntime rr, String sql_whole, HttpServletRequest request, HttpServletResponse response) + throws RaptorException, IOException { + //response.setContentType("application/vnd.ms-excel"); + //response.setHeader("Content-disposition", + // "attachment; filename=" + + // "Example.xls" ); + PrintWriter csvOut = response.getWriter(); + HtmlStripper strip = new HtmlStripper(); + ResultSet rs = null; + Connection conn = null; + Statement st = null; + ResultSetMetaData rsmd = null; + ColumnHeaderRow chr = null; + int mb = 1024*1024; + Runtime runtime = Runtime.getRuntime(); + csvOut.println("\n" + + "" + rr.getReportName() + "\n" + + "\n" ); + System.out.println("HTML-Excel Generation Triggered: " + new java.util.Date()); + csvOut.print(""); + if (Globals.getPrintParamsInCSVDownload()) { + ArrayList paramsList = rr.getParamNameValuePairsforPDFExcel(request, 1); + int paramSeq = 0; + for (Iterator iter = paramsList.iterator(); iter.hasNext();) { + IdNameValue value = (IdNameValue) iter.next(); + //System.out.println("\"" + value.getId() + " = " + value.getName() + "\""); + if(nvl(value.getId()).trim().length()>0 && (!nvl(value.getId()).trim().equals("BLANK"))) { + paramSeq += 1; + if(paramSeq <= 1) { + csvOut.println(""); + //strBuf.append("Run-time Parameters\n"); + } + csvOut.println(""); + csvOut.println(""); + csvOut.println(""); + + //strBuf.append(value.getId()+": "+ value.getName()+"\n"); + } + } //for + csvOut.println(""); + csvOut.println(""); + System.out.println("HTML-Excel: Header Rendering complete " + new java.util.Date()); + } + int rowCount = 0; + if(nvl(sql_whole).length()>0) { + try { + conn = ConnectionUtils.getConnection(rr.getDbInfo()); + st = conn.createStatement(); + Log.write("[SQL] " + sql_whole, 4); + int downloadLimit = Globals.getDownloadLimit(); + Callable callable = new ExecuteQuery(st, sql_whole, downloadLimit); + ExecutorService executor = new ScheduledThreadPoolExecutor(5); + System.out.println("Time Started" + new java.util.Date()); + Future future = executor.submit(callable); + try { + rs = future.get(900, TimeUnit.SECONDS); + } catch (TimeoutException ex) { + System.out.println("Cancelling Query"); + st.cancel(); + System.out.println("Query Cancelled"); + throw new Exception("user requested"); + } + rsmd = rs.getMetaData(); + int numberOfColumns = rsmd.getColumnCount(); + HashMap colHash = new HashMap(); + + if(rd!=null) { + for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();) { + chr = rd.reportColumnHeaderRows.getNext(); + csvOut.println(""); + for (chr.resetNext(); chr.hasNext();) { + ColumnHeader ch = chr.getNext(); + if(ch.isVisible()) { + csvOut.print(""); + //for (int i = 1; i < ch.getColSpan(); i++) + // csvOut.print(","); + + } + } // for + csvOut.println(""); + } // for + + + while(rs.next()) { + csvOut.println(""); +/* if(runtime.freeMemory()/mb <= ((runtime.maxMemory()/mb)*Globals.getMemoryThreshold()/100) ) { + csvOut.print(Globals.getUserDefinedMessageForMemoryLimitReached() + " " + rowCount +"records out of " + rr.getReportDataSize() + " were downloaded to CSV."); + break; + } +*/ rowCount++; + colHash = new HashMap(); + for (int i = 1; i <= numberOfColumns; i++) { + colHash.put(rsmd.getColumnName(i), rs.getString(i)); + } + for (chr.resetNext(); chr.hasNext();) { + ColumnHeader ch = chr.getNext(); + if(ch.isVisible()) { + csvOut.println(""); + } + + } + csvOut.println(""); + } + System.out.println("Downloaded Rows in HTML-Excel " + rowCount + " : "+ new java.util.Date()); + if(rowCount == 0) { + csvOut.print(""); + } else { + } + } else { + csvOut.println(""); + } + csvOut.println("
    " + "Run-time Parameters" + "
    " + value.getId() +"" + value.getName().replaceAll("~",",")+ "
     
     
    " + ch.getColumnTitle() + "
    " + strip.stripCSVHtml(nvl((String)colHash.get(ch.getLinkColId().toUpperCase()))) + "
    No Data Found
    No Data Found
    \n"); + + } catch (SQLException ex) { + throw new RaptorException(ex); + } catch (ReportSQLException ex) { + throw new RaptorException(ex); + } catch (Exception ex) { + throw new RaptorException (ex); + } finally { + try { + if(conn!=null) + conn.close(); + if(st!=null) + st.close(); + if(rs!=null) + rs.close(); + } catch (SQLException ex) { + throw new RaptorException(ex); + } + } + //csvOut.flush(); + } else { + boolean firstPass = true; + int numberOfColumns = 0; + if(rd!=null) { + for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();) { + chr = rd.reportColumnHeaderRows.getNext(); + csvOut.println(""); + for (rd.reportRowHeaderCols.resetNext(1); rd.reportRowHeaderCols.hasNext();) { + RowHeaderCol rhc = rd.reportRowHeaderCols.getNext(); + + if (firstPass) { + numberOfColumns++; + csvOut.print("" + rhc.getColumnTitle() + ""); + } + //csvOut.print(","); + } // for + + + for (chr.resetNext(); chr.hasNext();) { + ColumnHeader ch = chr.getNext(); + if(ch.isVisible()) { + if(firstPass) numberOfColumns++; + csvOut.print("" + ch.getColumnTitle() + ""); + //for (int i = 1; i < ch.getColSpan(); i++) + //csvOut.print(","); + } + } // for + firstPass = false; + csvOut.println(""); + } // for + + firstPass = true; + for (rd.reportDataRows.resetNext(); rd.reportDataRows.hasNext();) { + DataRow dr = rd.reportDataRows.getNext(); + csvOut.println(""); + for (rd.reportRowHeaderCols.resetNext(1); rd.reportRowHeaderCols.hasNext();) { + RowHeaderCol rhc = rd.reportRowHeaderCols.getNext(); + if (firstPass) + rhc.resetNext(); + RowHeader rh = rhc.getNext(); + + csvOut.print("" + strip.stripCSVHtml(rh.getRowTitle()) + ""); + } // for + firstPass = false; + + for (dr.resetNext(); dr.hasNext();) { + DataValue dv = dr.getNext(); + if(dv.isVisible()) + csvOut.print("" + strip.stripCSVHtml(dv.getDisplayValue()) + ""); + } // for + + csvOut.println(""); + + } // for + //csvOut.flush(); + } else { + csvOut.println("No Data Found"); + } + } + csvOut.println("\n"); + System.out.println("HTML-Excel Generation: Data Rendering complete " + new java.util.Date()); + System.out.println("##### Heap utilization statistics [MB] #####"); + System.out.println("Used Memory:" + + (runtime.maxMemory() - runtime.freeMemory()) / mb); + System.out.println("Free Memory:" + + runtime.freeMemory() / mb); + System.out.println("Total Memory:" + runtime.totalMemory() / mb); + System.out.println("Max Memory:" + runtime.maxMemory() / mb); + + } // createCSVFileContent + + /** + * Checking if every row and cell in merging region exists, and create those which are not + * @param sheet in which check is performed + * @param region to check + * @param cellStyle cell style to apply for whole region + */ + private void cleanBeforeMergeOnValidCells(XSSFSheet sheet,CellRangeAddress region, XSSFCellStyle cellStyle ) + { + for(int rowNum =region.getFirstRow();rowNum<=region.getLastRow();rowNum++){ + XSSFRow row= sheet.getRow(rowNum); + if(row==null){ + sheet.createRow(rowNum); + } + for(int colNum=region.getFirstColumn();colNum<=region.getLastColumn();colNum++){ + XSSFCell currentCell = row.getCell(colNum); + if(currentCell==null){ + currentCell = row.createCell(colNum); + } + + currentCell.setCellStyle(cellStyle); + + } + } + + + } +} // ReportHandler + + +/** + * Adapter for a Writer to behave like an OutputStream. + * + * Bytes are converted to chars using the platform default encoding. + * If this encoding is not a single-byte encoding, some data may be lost. + */ + class WriterOutputStream extends OutputStream { + + private final Writer writer; + + public WriterOutputStream(Writer writer) { + this.writer = writer; + } + + public void write(int b) throws IOException { + // It's tempting to use writer.write((char) b), but that may get the encoding wrong + // This is inefficient, but it works + write(new byte[] {(byte) b}, 0, 1); + } + + public void write(byte b[], int off, int len) throws IOException { + writer.write(new String(b, off, len)); + } + + public void flush() throws IOException { + writer.flush(); + } + + public void close() throws IOException { + writer.close(); + } +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/ReportLoader.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/ReportLoader.java new file mode 100644 index 0000000..2197de6 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/ReportLoader.java @@ -0,0 +1,1061 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +/* =========================================================================================== + * This class is part of RAPTOR (Rapid Application Programming Tool for OLAP Reporting) + * Raptor : This tool is used to generate different kinds of reports with lot of utilities + * =========================================================================================== + * + * ------------------------------------------------------------------------------------------- + * ReportLoader.java - This class is used to call database interaction related to reports. + * ------------------------------------------------------------------------------------------- + * + * + * + * Changes + * ------- + * 28-Aug-2009 : Version 8.5.1 (Sundar);
    • isDashboardType is made to return false, as any report can be added to Dashboard.
    + * 18-Aug-2009 : Version 8.5.1 (Sundar);
    • request Object is passed to prevent caching user/roles - Datamining/Hosting.
    + * 27-Jul-2009 : Version 8.4 (Sundar);
    • Admin User is given the same privilege as Super User when the property + * "admin_role_equiv_to_super_role" in raptor.properties is Y. A check is made in corresponding to that.
    + * + */ +package org.openecomp.portalsdk.analytics.model; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.Writer; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Vector; + +import javax.servlet.http.HttpServletRequest; + +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.error.ReportSQLException; +import org.openecomp.portalsdk.analytics.model.base.IdNameValue; +import org.openecomp.portalsdk.analytics.model.base.ReportWrapper; +import org.openecomp.portalsdk.analytics.model.definition.ReportLogEntry; +import org.openecomp.portalsdk.analytics.model.search.ReportSearchResult; +import org.openecomp.portalsdk.analytics.system.AppUtils; +import org.openecomp.portalsdk.analytics.system.DbUtils; +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.system.fusion.domain.QuickLink; +import org.openecomp.portalsdk.analytics.util.AppConstants; +import org.openecomp.portalsdk.analytics.util.DataSet; +import org.openecomp.portalsdk.analytics.util.Utils; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; + +public class ReportLoader extends org.openecomp.portalsdk.analytics.RaptorObject { + + static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportLoader.class); + + + //private static Properties sqlProperty; + + public static String loadCustomReportXML(String reportID) throws RaptorException { + Connection connection = DbUtils.getConnection(); + try { + return loadCustomReportXML(connection, reportID); + } finally { + DbUtils.clearConnection(connection); + } + } // loadCustomReportXML + + public static String loadCustomReportXML(Connection connection, String reportID) + throws RaptorException { + + StringBuffer sb = new StringBuffer(); + + PreparedStatement stmt = null; + + ResultSet rs = null; + + try { + + String sql = Globals.getLoadCustomReportXml(); + stmt = connection.prepareStatement(sql); + stmt.setInt(1,Integer.parseInt(reportID)); + rs = stmt.executeQuery(); + if(Globals.isWeblogicServer()) { + java.sql.Clob clob= null; + Object obj = null; + if (rs.next()) { + clob = rs.getClob(1); + } + else + throw new RaptorException("Report " + reportID + " not found in the database"); + + int len = 0; + char[] buffer = new char[512]; + Reader in = null; + in = new InputStreamReader(clob.getAsciiStream()); + // if(obj instanceof oracle.sql.CLOB) { + // in = ((oracle.sql.CLOB) obj).getCharacterStream(); + // } else if (obj instanceof weblogic.jdbc.wrapper.Clob) { + // in = ((weblogic.jdbc.base.BaseClob) obj).getCharacterStream(); + // } + while ((len = in.read(buffer)) != -1) + sb.append(buffer, 0, len); + in.close(); + } else if (Globals.isPostgreSQL() || Globals.isMySQL()) { + String clob= null; + Object obj = null; + if (rs.next()) { + sb.append(rs.getString(1)); + } + else + throw new RaptorException("Report " + reportID + " not found in the database"); + } else { + /*oracle.sql.CLOB clob = null; + if (rs.next()) + clob = (oracle.sql.CLOB) rs.getObject(1); + else + throw new RaptorException("Report " + reportID + " not found in the database"); + int len = 0; + char[] buffer = new char[512]; + Reader in = clob.getCharacterStream(); + while ((len = in.read(buffer)) != -1) + sb.append(buffer, 0, len); + in.close();*/ + throw new RaptorException("only maria db support for this "); + } + } catch (SQLException ex) { + throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } catch (IOException ex) { + throw new RaptorException (ex.getMessage(), ex.getCause()); + } finally { + try { + if(rs!=null) + rs.close(); + if(stmt!=null) + stmt.close(); + } catch (SQLException ex) { + throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } + } + return sb.toString(); + } // loadCustomReportXML + + private static void dbUpdateReportXML(Connection connection, String reportID, + String reportXML) throws RaptorException { + PreparedStatement stmt = null; + ResultSet rs = null; + + try { + String sql = Globals.getDBUpdateReportXml(); + stmt = connection.prepareStatement(sql,ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + stmt.setInt(1,Integer.parseInt(reportID)); + rs = stmt.executeQuery(); + Writer out = null; + /*if(Globals.isWeblogicServer()) { + java.sql.Clob clob = null; + if (rs.next()) + clob = rs.getClob(1); + else + throw new RaptorException("Report " + reportID + " not found in the database"); + + if (clob.length() > reportXML.length()) + clob.truncate(0); + //clob.trim(reportXML.length()); + out = ((weblogic.jdbc.vendor.oracle.OracleThinClob)clob).getCharacterOutputStream(); + } else*/ + if (Globals.isPostgreSQL() || Globals.isMySQL()) { + if (rs.next()) { + rs.updateString("report_xml",reportXML); + rs.updateRow(); + connection.commit(); + //sb.append(rs.getString(1)); + } + else + throw new RaptorException("Report " + reportID + " not found in the database"); + } else { + /*oracle.sql.CLOB clob = null; + if (rs.next()) + clob = (oracle.sql.CLOB) rs.getObject(1); + else + throw new RaptorException("Report " + reportID + " not found in the database"); + + if (clob.length() > reportXML.length()) + clob.trim(reportXML.length()); + out = clob.getCharacterOutputStream();*/ + throw new RaptorException("only maria db support for this "); + } + if(!(Globals.isPostgreSQL() || Globals.isMySQL())) { + out.write(reportXML); + out.flush(); + out.close(); + } + } catch (SQLException ex) { + throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } catch (IOException ex) { + throw new RaptorException (ex.getMessage(), ex.getCause()); + } finally { + try { + if(rs!=null) + rs.close(); + if(stmt!=null) + stmt.close(); + } catch (SQLException ex) { + throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } + } + } // dbUpdateReportXML + + public static void updateCustomReportRec(Connection connection, ReportWrapper rw, + String reportXML) throws RaptorException { + /* DbUtils.executeUpdate(connection,"UPDATE cr_report SET title='" + + Utils.oracleSafe(rw.getReportName()) + "', descr='" + + Utils.oracleSafe(rw.getReportDescr()) + "', public_yn='" + + (rw.isPublic() ? "Y" : "N") + "', menu_id='" + rw.getMenuID() + + "', menu_approved_yn='" + (rw.isMenuApproved() ? "Y" : "N") + "', owner_id=" + + rw.getOwnerID() + ", maint_id=" + rw.getUpdateID() + + ", maint_date=TO_DATE('" + rw.getUpdateDate() + "', '" + + Globals.getOracleTimeFormat() + "'), dashboard_type_yn='"+ (rw.isDashboardType()?"Y":"N")+"', dashboard_yn= '" + + (rw.getReportType().equals(AppConstants.RT_DASHBOARD)?"Y":"N") + "' WHERE rep_id = " + rw.getReportID());*/ + + String sql = Globals.getUpdateCustomReportRec(); + + sql = sql.replace("[Utils.oracleSafe(rw.getReportName())]", Utils.oracleSafe(rw.getReportName())); + sql = sql.replace("[Utils.oracleSafe(rw.getReportDescr())]", Utils.oracleSafe(rw.getReportDescr())); + sql = sql.replace("[(rw.isPublic()]",(rw.isPublic() ? "Y" : "N")); + sql = sql.replace("[rw.getMenuID()]", rw.getMenuID()); + sql = sql.replace("[(rw.isMenuApproved()]", (rw.isMenuApproved() ? "Y" : "N")); + sql = sql.replace("[rw.getOwnerID()]",rw.getOwnerID()); + sql = sql.replace("[rw.getUpdateID()]",rw.getUpdateID()); + sql = sql.replace("[rw.getUpdateDate()]",rw.getUpdateDate()); + sql = sql.replace("[Globals.getOracleTimeFormat()]", Globals.getOracleTimeFormat()); + sql = sql.replace("[(rw.isDashboardType()]", (rw.isDashboardType()?"Y":"N")); + sql = sql.replace("[(rw.getReportType().equals(AppConstants.RT_DASHBOARD)]", (rw.getReportType().equals(AppConstants.RT_DASHBOARD)?"Y":"N")); + sql = sql.replace("[rw.getReportID()]", rw.getReportID()); + + DbUtils.executeUpdate(connection, sql); + + dbUpdateReportXML(connection, rw.getReportID(), reportXML); + } // updateCustomReportRec + + public static boolean isDashboardType ( String reportID ) throws RaptorException { + return false; +/* String sql = "select dashboard_type_yn from cr_report where rep_id = ?"; + Connection connection = DbUtils.getConnection(); + PreparedStatement stmt = null; + ResultSet rs = null; + boolean dashboardType= false; + try { + stmt = connection.prepareStatement(sql); + stmt.setString(1, reportID); + rs = stmt.executeQuery(); + if(rs.next()) { + dashboardType = nvls(rs.getString(1),"N").trim().toUpperCase().startsWith("Y"); + } + } catch (SQLException ex) { + throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } finally { + try { + rs.close(); + stmt.close(); + DbUtils.clearConnection(connection); + } catch (SQLException ex) { + throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } + } + return dashboardType;*/ + } + + public static boolean isReportsAlreadyScheduled ( String reportID ) throws RaptorException { + //String sql = "select rep_id from cr_report_schedule where rep_id = ?"; + String sql = Globals.getIsReportAlreadyScheduled(); + + Connection connection = DbUtils.getConnection(); + PreparedStatement stmt = null; + ResultSet rs = null; + boolean isScheduled= false; + try { + stmt = connection.prepareStatement(sql); + stmt.setInt(1, Integer.parseInt(reportID)); + rs = stmt.executeQuery(); + if(rs.next()) { + isScheduled = true; + } + } catch (SQLException ex) { + throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } finally { + try { + if(rs!=null) + rs.close(); + if(stmt!=null) + stmt.close(); + DbUtils.clearConnection(connection); + } catch (SQLException ex) { + throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } + } + return isScheduled; +} + + public static void createCustomReportRec(Connection connection, ReportWrapper rw, + String reportXML) throws RaptorException { + + /*DbUtils + .executeUpdate( + connection, + "INSERT INTO cr_report(rep_id, title, descr, public_yn, menu_id, menu_approved_yn, report_xml, owner_id, create_id, create_date, maint_id, maint_date, dashboard_type_yn, dashboard_yn, folder_id) VALUES(" + + rw.getReportID() + + ", '" + + Utils.oracleSafe(rw.getReportName()) + + "', '" + + Utils.oracleSafe(rw.getReportDescr()) + + "', '" + + (rw.isPublic() ? "Y" : "N") + + "', '" + + rw.getMenuID() + + "', '" + + (rw.isMenuApproved() ? "Y" : "N") + + "', '', " + + rw.getOwnerID() + + ", " + + rw.getCreateID() + + ", TO_DATE('" + + rw.getCreateDate() + + "', '" + + Globals.getOracleTimeFormat() + + "'), " + + rw.getUpdateID() + + ", TO_DATE('" + + rw.getUpdateDate() + + "', '" + + Globals.getOracleTimeFormat() + + "'), '" + + (rw.isDashboardType()?"Y":"N") + + "', '" + + (rw.getReportType().equals(AppConstants.RT_DASHBOARD)?"Y":"N") + + "', " + + rw.getFolderId() + + ")");*/ + String sql = Globals.getCreateCustomReportRec(); + + sql = sql.replace("[rw.getReportID()]", rw.getReportID()); + sql = sql.replace("[Utils.oracleSafe(rw.getReportName())]", Utils.oracleSafe(rw.getReportName())); + sql = sql.replace("[Utils.oracleSafe(rw.getReportDescr())]", Utils.oracleSafe(rw.getReportDescr())); + sql = sql.replace("[rw.isPublic()]", (rw.isPublic() ? "Y" : "N")); + sql = sql.replace("[rw.getMenuID()]", rw.getMenuID()); + sql = sql.replace("[rw.isMenuApproved()]", (rw.isMenuApproved() ? "Y" : "N")); + sql = sql.replace("[rw.getOwnerID()]", rw.getOwnerID()); + sql = sql.replace("[rw.getCreateID()]", rw.getCreateID()); + sql = sql.replace("[rw.getCreateDate()]", rw.getCreateDate()); + sql = sql.replace("[Globals.getOracleTimeFormat()]", Globals.getOracleTimeFormat()); + sql = sql.replace("[rw.getUpdateID()]", rw.getUpdateID()); + sql = sql.replace("[rw.getUpdateDate()]", rw.getUpdateDate()); + sql = sql.replace("[rw.isDashboardType()]", (rw.isDashboardType()?"Y":"N")); + sql = sql.replace("[rw.getReportType().equals(AppConstants.RT_DASHBOARD)]", (rw.getReportType().equals(AppConstants.RT_DASHBOARD)?"Y":"N")); + sql = sql.replace("[rw.getFolderId()]", rw.getFolderId()); + + + DbUtils.executeUpdate(connection,sql); + + dbUpdateReportXML(connection, rw.getReportID(), reportXML); + } // createCustomReportRec + + public static Vector getUserReportNames(HttpServletRequest request) { + return getUserReportNames(AppUtils.getUserID(request)); + } // getUserReportNames + + public static Vector getUserReportNames(String userID) { + Vector reportIdNames = new Vector(); + + try { + + String sql = Globals.getTheUserReportNames(); + sql = sql.replace("[userID]", userID); + DataSet ds = DbUtils.executeQuery(sql); + + //DataSet ds = DbUtils + // .executeQuery("SELECT cr.rep_id, cr.title FROM cr_report cr WHERE nvl(cr.owner_id, cr.create_id) = " + // + userID); + + for (int i = 0; i < ds.getRowCount(); i++) + reportIdNames.add(new IdNameValue(ds.getString(i, 0), ds.getString(i, 1))); + } catch (Exception e) { + } + + return reportIdNames; + } // getUserReportNames + + public static String getReportOwnerID(String reportID) throws RaptorException { + + // String sql = "SELECT nvl(cr.owner_id, cr.create_id) owner FROM cr_report cr WHERE rep_id = ?"; + + String sql = Globals.getTheReportOwnerId(); + + Connection connection = DbUtils.getConnection(); + PreparedStatement stmt = null; + ResultSet rs = null; + String reportOwnerID = null; + try { + stmt = connection.prepareStatement(sql); + stmt.setInt(1, Integer.parseInt(reportID)); + rs = stmt.executeQuery(); + if(rs.next()) { + reportOwnerID = rs.getString(1); + } + } catch (SQLException ex) { + throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } finally { + try { + if(rs!=null) + rs.close(); + if(stmt!=null) + stmt.close(); + DbUtils.clearConnection(connection); + } catch (SQLException ex) { + throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } + } + + return reportOwnerID; + } // getReportOwnerID + + public static void deleteReportRecord(String reportID) throws RaptorException { + Connection con = DbUtils.startTransaction(); + + /*try { + DbUtils.executeUpdate(con, "DELETE cr_report_log WHERE rep_id = " + reportID); + DbUtils.executeUpdate(con, "DELETE cr_report_schedule_users WHERE rep_id = " + + reportID); + DbUtils.executeUpdate(con, "DELETE cr_report_schedule WHERE rep_id = " + reportID); + DbUtils.executeUpdate(con, "DELETE cr_report_access WHERE rep_id = " + reportID); + DbUtils.executeUpdate(con, "DELETE cr_report_email_sent_log WHERE rep_id = " + reportID); + DbUtils.executeUpdate(con, "DELETE cr_favorite_reports WHERE rep_id = " + reportID); + DbUtils.executeUpdate(con, "DELETE cr_report WHERE rep_id = " + reportID); + DbUtils.commitTransaction(con); + } */ + + try{ + String sql1= Globals.getDeleteReportRecordLog(); + sql1 = sql1.replace("[reportID]", reportID); + String sql2= Globals.getDeleteReportRecordUsers(); + sql2 = sql2.replace("[reportID]", reportID); + String sql3= Globals.getDeleteReportRecordSchedule(); + sql3 = sql3.replace("[reportID]", reportID); + String sql4= Globals.getDeleteReportRecordAccess(); + sql4 = sql4.replace("[reportID]", reportID); + String sql5= Globals.getDeleteReportRecordEmail(); + sql5 = sql5.replace("[reportID]", reportID); + String sql6= Globals.getDeleteReportRecordFavorite(); + sql6 = sql6.replace("[reportID]", reportID); + String sql7= Globals.getDeleteReportRecordReport(); + sql7 = sql7.replace("[reportID]", reportID); + + DbUtils.executeUpdate(con, sql1); + DbUtils.executeUpdate(con, sql2); + DbUtils.executeUpdate(con, sql3); + DbUtils.executeUpdate(con, sql4); + DbUtils.executeUpdate(con, sql5); + DbUtils.executeUpdate(con, sql6); + DbUtils.executeUpdate(con, sql7); + DbUtils.commitTransaction(con); + + } + + + catch (Exception e) { + DbUtils.rollbackTransaction(con); + } finally { + DbUtils.clearConnection(con); + } + } // deleteReportRecord + + public static ArrayList loadQuickLinks(HttpServletRequest request, String menuId, boolean b) throws RaptorException { + String userID = AppUtils.getUserID(request); + StringBuffer roleList = new StringBuffer(); + roleList.append("-1"); + for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();) + roleList.append("," + ((String) iter.next())); + + // DataSet ds = DbUtils.executeQuery("SELECT cr.rep_id, cr.title FROM + // cr_report cr WHERE cr.public_yn = 'Y' AND cr.menu_id = + // '"+nvls(menuId)+"' AND cr.menu_approved_yn = 'Y' ORDER BY cr.title"); + // Copied from SearchHandler and simplified + /*String query = "SELECT cr.rep_id, " + + "cr.title, " + + "cr.descr " + + "FROM cr_report cr, " + + "(SELECT rep_id, " + + "MIN(read_only_yn) read_only_yn " + + "FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = " + + userID + + ") " + + "UNION ALL " + + "(SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN (" + + roleList.toString() + "))" + ") report_access " + + "GROUP BY rep_id) ra " + "WHERE INSTR('|'||cr.menu_id||'|', '|'||'" + + nvls(menuId) + "'||'|') > 0 AND " + "cr.menu_approved_yn = 'Y' AND " + + "cr.rep_id = ra.rep_id (+) AND " + + "(nvl(cr.owner_id, cr.create_id) = " + userID + + " OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL) " + + "ORDER BY cr.title";*/ + + String query = Globals.getLoadQuickLinks(); + query = query.replace("[userID]", userID); + query = query.replace("[roleList.toString()]", roleList.toString()); + query = query.replace("[nvls(menuId)]", nvls(menuId)); + + DataSet ds = DbUtils + .executeQuery(query); + + ArrayList quickLinks = new ArrayList(ds.getRowCount()); + StringBuffer link = new StringBuffer(""); + for (int i = 0; i < ds.getRowCount(); i++) { + link = new StringBuffer(""); + link.append("" +ds.getString(i, 1) + "" + (Globals.getShowDescrAtRuntime() ? " - " + ds.getString(i, 2) : "") ); + quickLinks.add(link.toString()); + } + + return quickLinks; + } // loadQuickLinks + + public static ArrayList getQuickLinksJSON(HttpServletRequest request, String menuId, boolean b) throws RaptorException { + String userID = AppUtils.getUserID(request); + StringBuffer roleList = new StringBuffer(); + roleList.append("-1"); + for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();) + roleList.append("," + ((String) iter.next())); + + String query = Globals.getLoadQuickLinks(); + query = query.replace("[userID]", userID); + query = query.replace("[roleList.toString()]", roleList.toString()); + query = query.replace("[nvls(menuId)]", nvls(menuId)); + + DataSet ds = DbUtils + .executeQuery(query); + + ArrayList quickLinksArray = new ArrayList(ds.getRowCount()); + for (int i = 0; i < ds.getRowCount(); i++) { + QuickLink quickLink = new QuickLink(); + StringBuffer link = new StringBuffer(""); + link.append(AppUtils.getReportExecuteActionURLNG() +"c_master="+ ds.getString(i, 0)); + if(b) link.append("&PAGE_ID="+menuId+"&refresh=Y"); + quickLink.setReportURL(link.toString()); + quickLink.setReportName(ds.getString(i, 1)); + quickLink.setShowDescr(Globals.getShowDescrAtRuntime()); + quickLink.setReportDescr(ds.getString(i, 2)); + quickLinksArray.add(quickLink); + } + + return quickLinksArray; + } // loadQuickLinks + + //this will retrieve all the reports within the specified folder. + public static ReportSearchResult loadFolderReports(HttpServletRequest request, String menuId, boolean b, String folderId, boolean isUserReport, boolean isPublicReport) throws RaptorException { + String HTML_FORM = "forma"; + String userID = AppUtils.getUserID(request); + StringBuffer roleList = new StringBuffer(); + roleList.append("-1"); + String rep_title_sql = "''"; + String PRIVATE_ICON = "Private "; + + for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();) + roleList.append("," + ((String) iter.next())); + + /*String sql= "SELECT cr.rep_id, " + + "cr.rep_id report_id, " + + rep_title_sql+ + "||DECODE(cr.public_yn, 'Y', '', '" + + PRIVATE_ICON + + "')||cr.title||'' title, " + + "cr.descr, " + + "au.first_name||' '||au.last_name owner_name, " + + "TO_CHAR(cr.create_date, 'MM/DD/YYYY') create_date, " + + "DECODE(NVL(cr.owner_id, cr.create_id), " + + userID + + ", 'N', NVL(ra.read_only_yn, 'Y')) read_only_yn, " + + "DECODE(NVL(cr.owner_id, cr.create_id), " + + userID + + ", 'Y', 'N') user_is_owner_yn " + + " FROM cr_report cr, " + + "app_user au, " + + "(SELECT rep_id, MIN(read_only_yn) read_only_yn " + + "FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = " + + userID + + ") " + + "UNION ALL " + + "(SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN " + + "(-1,1000,1))" + ") report_access GROUP BY rep_id) ra " + + "WHERE TO_CHAR(cr.rep_id) = nvl('', TO_CHAR(cr.rep_id)) AND UPPER(cr.title) LIKE UPPER('%%') " + + "AND nvl(cr.owner_id, cr.create_id) = au.user_id AND cr.rep_id = ra.rep_id (+) " + + " AND cr.folder_id= '" + folderId + "'" ;*/ + + /*String sql = "" + + "SELECT cr.rep_id, " + + "cr.rep_id report_id, " + + rep_title_sql + "||DECODE(cr.public_yn, 'Y', '', '" + PRIVATE_ICON + "')||cr.title||'' title, " + + "cr.descr, " + + "au.first_name||' '||au.last_name owner_name, " + + "TO_CHAR(cr.create_date, 'MM/DD/YYYY') create_date, " + + "DECODE(NVL(cr.owner_id, cr.create_id), " + userID + + ", 'N', NVL(ra.read_only_yn, 'Y')) read_only_yn, " + + "DECODE(NVL(cr.owner_id, cr.create_id), " + userID + + ", 'Y', 'N') user_is_owner_yn " + + "FROM cr_report cr, " + + "app_user au, " + + "(SELECT rep_id, " + + "MIN(read_only_yn) read_only_yn " + + "FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = " + + userID + + ") " + + "UNION ALL " + + "(SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN (" + + roleList.toString() + "))" + ") report_access " + "GROUP BY rep_id) ra " + + "WHERE " + "nvl(cr.owner_id, cr.create_id) = au.user_id " + + "AND cr.rep_id = ra.rep_id (+) AND cr.folder_id= '" + folderId + "'";*/ + + String sql = Globals.getLoadFolderReports(); + sql = sql.replace("[userID]", userID); + sql = sql.replace("[PRIVATE_ICON]", PRIVATE_ICON); + sql = sql.replace("[rep_title_sql]", rep_title_sql); + sql = sql.replace("[roleList.toString()]", roleList.toString()); + sql = sql.replace("[folderId]", folderId); + + + // String user_sql = " AND nvl(cr.owner_id, cr.create_id) = " + userID; + // String public_sql = " AND (nvl(cr.owner_id, cr.create_id) = " + userID + // + " OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL)"; + + String user_sql = Globals.getLoadFolderReportsUser(); + user_sql = user_sql.replace("[userID]", userID); + String public_sql = Globals.getLoadFolderReportsPublicSql(); + public_sql = public_sql.replace("[userID]", userID); + + if (isUserReport) + // My reports - user is owner + sql += user_sql; + else if (isPublicReport) + // Public reports - user has read or write access to the report + // (user is owner or report is public or user has explicit user or + // role access) + if (!AppUtils.isSuperUser(request)) + sql += public_sql; + else if (!AppUtils.isSuperUser(request)) + // All reports + // If user is super user - gets unrestricted access to all reports + // (read_only gets overriden later) + // else - not super user - doesn't get access to private reports of + // other users (= Public reports); Admin users get edit right + // override later + sql += public_sql; + logger.debug(EELFLoggerDelegate.debugLogger, ("query is for folder list is : " + sql)); + + DataSet ds = DbUtils.executeQuery(sql); + + /*Vector quickLinks = new Vector(ds.getRowCount()); + StringBuffer link = new StringBuffer(""); + for (int i = 0; i < ds.getRowCount(); i++) { + link = new StringBuffer(""); + link.append("" +ds.getString(i, 2) + "" + (Globals.getShowDescrAtRuntime() ? " - " + ds.getString(i, 2) : "") ); + quickLinks.add(link.toString()); + } + + return quickLinks;*/ + ReportSearchResult rsr = new ReportSearchResult(-1, ds.getRowCount(), 6, 7); + rsr.parseData(ds, request); + //rsr.truncateToPage(pageNo); + + return rsr; + } // loadFolderReports + + public static ArrayList loadQuickDownloadLinks(String userID, HttpServletRequest request) throws RaptorException { + /*String query = " SELECT a.file_name, b.title,to_char(a.dwnld_start_time, 'Dy DD-Mon-YYYY HH24:MI:SS') as time, "+ + " a.dwnld_start_time " + + " FROM cr_report_dwnld_log a, cr_report b where a.user_id = "+userID +" and "+ + " a.rep_id = b.rep_id " + + " and (a.dwnld_start_time) >= to_date(to_char(sysdate-24/24, 'mm/dd/yyyy'), 'mm/dd/yyyy') " + + " and a.record_ready_time is not null " + + " order by a.dwnld_start_time desc"; */ + + String query = Globals.getLoadQuickDownloadLinks(); + query = query.replace("[userID]", userID); + + + DataSet ds = DbUtils + .executeQuery(query); + ArrayList quickDownloadLinks = new ArrayList(ds.getRowCount()); + logger.debug(EELFLoggerDelegate.debugLogger, ("ROW SIZE " + ds.getRowCount())); + for (int i = 0; i < ds.getRowCount(); i++) { + quickDownloadLinks.add("" + ds.getString(i, 1)+ "" + " "+ ds.getString(i, 2)); + } + logger.debug(EELFLoggerDelegate.debugLogger, ("VECTOR SIZE " + quickDownloadLinks.size())); + + return quickDownloadLinks; + } // loadQuickLinks + + public static HashMap loadReportsToSchedule (HttpServletRequest request) throws RaptorException { + String userID = AppUtils.getUserID(request); + StringBuffer roleList = new StringBuffer(); + roleList.append("-1"); + for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();) + roleList.append("," + ((String) iter.next())); + /*StringBuffer query = new StringBuffer(""); + query.append("SELECT cr.rep_id, "); + query.append("Initcap(cr.title), "); + query.append("cr.descr "); + query.append("FROM cr_report cr, "); + query.append("(SELECT rep_id, "); + query.append("MIN(read_only_yn) read_only_yn "); + query.append("FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = "); + query.append(userID); + query.append(") "); + query.append("UNION ALL "); + query.append("(SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN ("); + query.append(roleList.toString() + "))" + ") report_access "); + query.append("GROUP BY rep_id) ra " + "WHERE "); + query.append("cr.rep_id = ra.rep_id (+) AND "); + query.append(" (cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL or cr.owner_id = " + userID +") "); + query.append("ORDER BY Initcap(cr.title)") ;*/ + + String sql = Globals.getLoadReportsToSchedule(); + sql = sql.replace("[userID]", userID); + sql = sql.replace("[roleList.toString()]", roleList.toString()); + + // DataSet ds = DbUtils + // .executeQuery(query.toString()); + + DataSet ds = DbUtils + .executeQuery(sql); + HashMap map = new HashMap(); + for (int i = 0; i < ds.getRowCount(); i++) { + map.put(ds.getItem(i,0), ds.getItem(i,1)); + } + + return map; + } + + public static HashMap loadReportsToAddInDashboard (HttpServletRequest request) throws RaptorException { + String userID = AppUtils.getUserID(request); + StringBuffer roleList = new StringBuffer(); + roleList.append("-1"); + for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();) + roleList.append("," + ((String) iter.next())); + /*StringBuffer query = new StringBuffer(""); + query.append("SELECT cr.rep_id, "); + query.append("cr.title, "); + query.append("cr.descr "); + query.append("FROM cr_report cr, "); + query.append("(SELECT rep_id, "); + query.append("MIN(read_only_yn) read_only_yn "); + query.append("FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = "); + query.append(userID); + query.append(") "); + query.append("UNION ALL "); + query.append("(SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN ("); + query.append(roleList.toString() + "))" + ") report_access "); + query.append("GROUP BY rep_id) ra " + "WHERE "); + query.append("cr.rep_id = ra.rep_id (+) AND "); + query.append("(nvl(cr.owner_id, cr.create_id) = " + userID); + query.append(" OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL) "); + query.append(" AND (cr.dashboard_yn = 'N' or cr.dashboard_yn is null) "); + query.append("ORDER BY cr.title") ;*/ + + String sql = Globals.getLoadReportsToAddInDashboard(); + sql = sql.replace("[userID]", userID); + sql = sql.replace("[roleList.toString()]", roleList.toString()); + + // DataSet ds = DbUtils + // .executeQuery(query.toString()); + + DataSet ds = DbUtils + .executeQuery(sql); + + HashMap map = new HashMap(); + for (int i = 0; i < ds.getRowCount(); i++) { + map.put(ds.getItem(i,0), ds.getItem(i,1)); + } + + return map; + } + + public static Vector loadMyRecentLinks(String userID, HttpServletRequest request) throws RaptorException { + /* StringBuffer query = new StringBuffer(""); + query.append("select rep_id, title, descr, form_fields from ( select rownum, rep_id, title, descr, form_fields from "); + query.append(" (select cr.rep_id, cr.title, a.form_fields, cr.descr, a.log_time, a.user_id, a.action, a.action_value " ); + query.append(" from cr_report_log a, cr_report cr where user_id = " + userID); + query.append(" and action = 'Report Execution Time' and a.rep_id = cr.rep_id order by log_time desc) x where rownum <= 6 ) y where rownum >= 1");*/ +// DataSet ds = DbUtils +// .executeQuery( +// " SELECT a.file_name, b.title,to_char(a.dwnld_start_time, 'Dy DD-Mon-YYYY HH24:MI:SS') as time, "+ +// " a.dwnld_start_time " + +// " FROM cr_report_dwnld_log a, cr_report b where a.user_id = "+userID +" and "+ +// " a.rep_id = b.rep_id and (a.dwnld_start_time) >= to_date(to_char(sysdate-24/24, 'mm/dd/yyyy'), 'mm/dd/yyyy') " + +// " and a.record_ready_time is not null " + +// " order by a.dwnld_start_time desc"); +// DataSet ds = DbUtils + // .executeQuery(query.toString()); + + + String sql = Globals.getLoadMyRecentLinks(); + sql = sql.replace("[userID]", userID); + + DataSet ds = DbUtils + .executeQuery(sql); + + Vector myRecentLinks = new Vector(ds.getRowCount()); + logger.debug(EELFLoggerDelegate.debugLogger, ("ROW SIZE " + ds.getRowCount())); + for (int i = 0; i < ds.getRowCount(); i++) { + myRecentLinks.add("" + ds.getString(i, 1)+ ""); + } + logger.debug(EELFLoggerDelegate.debugLogger, ("VECTOR SIZE " + myRecentLinks.size())); + + return myRecentLinks; + } // loadQuickLinks + + public static void createReportLogEntry(Connection connection, String reportID, + String userID, String action, String executionTime,String form_fields) throws RaptorException { + if(form_fields.length()>=4000) form_fields = ""; + //String stmt = "INSERT INTO cr_report_log (rep_id, log_time, user_id, action, action_value, form_fields) VALUES(" + // + reportID + ", SYSDATE, " + userID + ", '" + action + "' , '" + executionTime + "', '"+ form_fields +"')"; + + String stmt = Globals.getCreateReportLogEntry(); + stmt = stmt.replace("[reportID]", reportID); + stmt = stmt.replace("[userID]", userID); + stmt = stmt.replace("[action]", action); + stmt = stmt.replace("[executionTime]", executionTime); + stmt = stmt.replace("[form_fields]", form_fields); + + if (Globals.getEnableReportLog()) + if (connection == null) + DbUtils.executeUpdate(stmt); + else + DbUtils.executeUpdate(connection, stmt); + } // createReportLogEntry + + public static void createReportLogEntryForExecutionTime(Connection connection, String reportID, + String userID, String executionTime, String action, String formFields) throws RaptorException { + if(formFields.length()>=4000) formFields = ""; + //String stmt = "INSERT INTO cr_report_log (rep_id, log_time, user_id, action, action_value, form_fields) VALUES(" + // + reportID + ", sysdate+1/(24*60*60) , " + userID + ", '" + action + "' , '" + executionTime + "', '"+ formFields +"')"; + + String stmt = Globals.getCreateReportLogEntryExecTime(); + stmt = stmt.replace("[reportID]", reportID); + stmt = stmt.replace("[userID]", userID); + stmt = stmt.replace("[action]", action); + stmt = stmt.replace("[executionTime]", executionTime); + stmt = stmt.replace("[formFields]", formFields); + + if (Globals.getEnableReportLog()) + if (connection == null) + DbUtils.executeUpdate(stmt); + else + DbUtils.executeUpdate(connection, stmt); + } // createReportLogEntry + + public static void clearReportLogEntries(String reportId, String userId) throws RaptorException { + String sql = Globals.getClearReportLogEntries(); + Connection connection = DbUtils.getConnection(); + PreparedStatement stmt = null; + String reportOwnerID = null; + int rowsAffected = 0; + try { + stmt = connection.prepareStatement(sql); + stmt.setInt(1, Integer.parseInt(reportId)); + stmt.setInt(2, Integer.parseInt(userId)); + rowsAffected = stmt.executeUpdate(); + if(rowsAffected > 0) connection.commit(); + } catch (SQLException ex) { + throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } finally { + try { + stmt.close(); + connection.close(); + DbUtils.clearConnection(connection); + } catch (SQLException ex) { + throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } + } + } // clearReportLogEntries + + public static Vector loadReportLogEntries(String reportId) throws RaptorException { + /* StringBuffer query = new StringBuffer("SELECT x.log_time, x.user_id,") ; + query.append(" (CASE WHEN x.action = 'Report Execution Time' THEN "); + query.append(" ''||x.action||''"); + query.append(" ELSE x.action END) action, " ); + query.append(" (CASE WHEN x.action = 'Report Execution Time' THEN "); + query.append(" action_value " ); + query.append(" ELSE 'N/A' END) time_taken, " ); + query.append( " (CASE WHEN x.action = 'Report Execution Time' THEN '\"Run' ELSE 'N/A' END) run_image, " ); + query.append(" x.name FROM "); + query.append(" (SELECT rl.rep_id, TO_CHAR(rl.log_time, 'Month DD, YYYY HH:MI:SS AM') log_time, rl.action_value, fuser.last_name ||', '||fuser.first_name name, "); + query.append(" rl.user_id, rl.action, rl.form_fields FROM cr_report_log rl, fn_user fuser WHERE rl.rep_id = "+ nvls(reportId)+ " and rl.action != 'Report Run' and fuser.user_id = rl.user_id" ); + query.append(" ORDER BY rl.log_time DESC) x WHERE ROWNUM <= 100");*/ +// DataSet ds = DbUtils +// .executeQuery("SELECT x.log_time, x.user_id, x.action FROM (SELECT TO_CHAR(rl.log_time, 'Month DD, YYYY HH:MI:SS AM') log_time, rl.user_id, rl.action FROM cr_report_log rl WHERE rl.rep_id = " +// + nvls(reportId) + " ORDER BY rl.log_time DESC) x WHERE ROWNUM <= 100"); + // DataSet ds = DbUtils.executeQuery(query.toString()); + + String sql = Globals.getLoadReportLogEntries(); + sql = sql.replace("[AppUtils.getRaptorActionURL()]", AppUtils.getRaptorActionURL()); + sql = sql.replace("[AppUtils.getImgFolderURL()]", AppUtils.getImgFolderURL()); + sql = sql.replace("[nvls(reportId)]", nvls(reportId)); + + + DataSet ds = DbUtils.executeQuery(sql); + + Vector logEntries = new Vector(ds.getRowCount()); + + for (int i = 0; i < ds.getRowCount(); i++) + logEntries.add(new ReportLogEntry(ds.getString(i, 0), ds + .getString(i, 5), ds.getString(i, 2), ds.getString(i, 3), ds.getString(i, 4))); + + return logEntries; + } // loadReportLogEntries + + public static boolean doesUserCanScheduleReport(HttpServletRequest request, String scheduleId) throws RaptorException { + boolean flagLimit = false; + boolean flagScheduleIdPresent = false; + String userId = AppUtils.getUserID(request); + if(AppUtils.isAdminUser(request))return true; + //String query = "select crs.sched_user_id, count(*) from cr_report_schedule crs where sched_user_id = " + userId + " group by crs.sched_user_id having count(*) >= " + Globals.getScheduleLimit(); + String query = Globals.getDoesUserCanScheduleReport(); + query = query.replace("[userId]", userId); + query = query.replace("[Globals.getScheduleLimit()]", String.valueOf(Globals.getScheduleLimit())); + + DataSet ds = DbUtils.executeQuery(query); + logger.debug(EELFLoggerDelegate.debugLogger, (" User Schedule ds.getRowCount() " + ds.getRowCount() + " " +(ds.getRowCount()>0))); + if(ds.getRowCount() > 0) flagLimit = true; + else flagLimit = false; + logger.debug(EELFLoggerDelegate.debugLogger, ("scheduleId " + scheduleId)); + if(scheduleId==null || scheduleId.trim().length()<=0) return !flagLimit; + //query = "select crs.schedule_id from cr_report_schedule crs where schedule_id = " + scheduleId; + query = Globals.getDoesUserCanSchedule(); + query = query.replace("[scheduleId]", scheduleId); + + if(ds.getRowCount() > 0) flagScheduleIdPresent = true; + else flagScheduleIdPresent = false; + if(!flagLimit) return true; + if(flagLimit && flagScheduleIdPresent) return true; + else return false; + } + + public static String getSystemDateTime() throws RaptorException { + //String query = "select to_char(sysdate,'MM/dd/yyyy HH24:mi:ss') from dual"; + String query = Globals.getTheSystemDateTime(); + + DataSet ds = DbUtils.executeQuery(query); + String timeStr = ""; + if(ds.getRowCount() > 0) { + timeStr = ds.getString(0,0); + } + return timeStr; + + } + + public static String getNextDaySystemDateTime() throws RaptorException { + //String query = "select to_char(sysdate+1,'MM/dd/yyyy HH24:mi:ss') from dual"; + String query = Globals.getTheNextDayDateTime(); + DataSet ds = DbUtils.executeQuery(query); + String timeStr = ""; + if(ds.getRowCount() > 0) { + timeStr = ds.getString(0,0); + } + return timeStr; + + } + + public static String getNext15MinutesOfSystemDateTime() throws RaptorException { + //String query = "select to_char(sysdate+15/(24*60),'MM/dd/yyyy HH24:mi:ss') from dual"; + String query = Globals.getTheNextFifteenMinDateTime(); + + DataSet ds = DbUtils.executeQuery(query); + String timeStr = ""; + if(ds.getRowCount() > 0) { + timeStr = ds.getString(0,0); + } + return timeStr; + + } + + public static String getNext30MinutesOfSystemDateTime() throws RaptorException { + //String query = "select to_char(sysdate+30/(24*60),'MM/dd/yyyy HH24:mi:ss') from dual"; + String query = Globals.getTheNextThirtyMinDateTime(); + DataSet ds = DbUtils.executeQuery(query); + String timeStr = ""; + if(ds.getRowCount() > 0) { + timeStr = ds.getString(0,0); + } + return timeStr; + + } + + public static String getTemplateFile(String reportId) throws RaptorException { + //String query = "select template_file from cr_report_template_map where report_id = " + reportId; + String query = Globals.getTheTemplateFile(); + query = query.replace("[reportId]", reportId); + String templateFile = ""; + try { + DataSet ds = DbUtils.executeQuery(query); + if(ds.getRowCount() > 0) { + templateFile = ds.getString(0,0); + } + }catch(RaptorException ex) { + logger.debug(EELFLoggerDelegate.debugLogger, ("SQL Exception while trying to access cr_report_template_map ")); + } + return templateFile; + + } + + + public static HashMap loadPDFImgLookUp() throws RaptorException { + StringBuffer query = new StringBuffer(""); + HashMap pdfImgMap = new HashMap(); + //query.append("select image_id, image_loc from cr_raptor_pdf_img"); + query.append(Globals.getLoadPdfImgLookup()); + DataSet ds = DbUtils.executeQuery(query.toString()); + for (int i = 0; i < ds.getRowCount(); i++) { + pdfImgMap.put(ds.getString(i, 0), ds.getString(i,1)); + } + return pdfImgMap; + } // loadQuickLinks + + public static HashMap loadActionImgLookUp() throws RaptorException { + StringBuffer query = new StringBuffer(""); + HashMap pdfImgMap = new HashMap(); + //query.append("select image_id, image_loc from cr_raptor_action_img"); + query.append(Globals.getLoadActionImgLookup()); + DataSet ds = DbUtils.executeQuery(query.toString()); + for (int i = 0; i < ds.getRowCount(); i++) { + pdfImgMap.put(ds.getString(i, 0), ds.getString(i,1)); + } + return pdfImgMap; + } // loadQuickLinks + +} // ReportLoader + diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/SearchHandler.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/SearchHandler.java new file mode 100644 index 0000000..428bc90 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/SearchHandler.java @@ -0,0 +1,490 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +/* =========================================================================================== + * This class is part of RAPTOR (Rapid Application Programming Tool for OLAP Reporting) + * Raptor : This tool is used to generate different kinds of reports with lot of utilities + * =========================================================================================== + * + * ------------------------------------------------------------------------------------------- + * SearchHandler.java - This class is used to search reports and sort them in different order + * based on preference. It can also download the list in CSV format. + * ------------------------------------------------------------------------------------------- + * + * + * + * Changes + * ------- + * 18-Aug-2009 : Version 8.5.1 (Sundar);
    • request Object is passed to prevent caching user/roles - Datamining/Hosting.
    + * 13-Aug-2009 : Version 8.5 (Sundar);
    • Refresh is added while running report.
    • + *
    + * 27-Jul-2009 : Version 8.4 (Sundar);
    • A new sort order PUBLIC is added.
    • + *
    • In Public reports option it brings all the reports + * including the one which logged in user didn't create + * and which is not public. This is available for Super users and "Admin equivalent Super Users".
    • + *
    + * + */ +package org.openecomp.portalsdk.analytics.model; + +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.Writer; +import java.util.Iterator; + +import javax.servlet.http.HttpServletRequest; + +import org.openecomp.portalsdk.analytics.controller.ErrorHandler; +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.model.search.ReportSearchResult; +import org.openecomp.portalsdk.analytics.model.search.ReportSearchResultJSON; +import org.openecomp.portalsdk.analytics.model.search.SearchResultColumn; +import org.openecomp.portalsdk.analytics.model.search.SearchResultField; +import org.openecomp.portalsdk.analytics.model.search.SearchResultRow; +import org.openecomp.portalsdk.analytics.system.AppUtils; +import org.openecomp.portalsdk.analytics.system.DbUtils; +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; +import org.openecomp.portalsdk.analytics.util.DataSet; +import org.openecomp.portalsdk.analytics.util.HtmlStripper; + +public class SearchHandler extends org.openecomp.portalsdk.analytics.RaptorObject { + private static final String HTML_FORM = "forma"; + private final static String PRIVATE_ICON = "Private "; + + public SearchHandler() { + } + + public void createCSVFileContent(Writer out, ReportSearchResult sr) throws IOException { + PrintWriter csvOut = new PrintWriter(out); + HtmlStripper strip = new HtmlStripper(); + + for (int c = 1; c < sr.getNumColumns(); c++) { + SearchResultColumn column = sr.getColumn(c); + if (column.getLinkURL() == null) + csvOut.print("\"" + column.getColumnTitle() + "\","); + } // for + csvOut.println(); + + for (int r = 0; r < sr.getNumRows(); r++) { + SearchResultRow row = sr.getRow(r); + + int c = 1; + for (row.resetNext(1); row.hasNext();) { + SearchResultField field = row.getNext(); + if (sr.getColumn(c++).getLinkURL() == null) + if (field.getDisplayValue().startsWith(PRIVATE_ICON)) + csvOut.print("\"" + + strip.stripHtml(field.getDisplayValue().substring(PRIVATE_ICON.length())) + + "\","); + else + csvOut.print("\"" + strip.stripHtml(field.getDisplayValue()) + "\","); + } // for + + csvOut.println(); + } // for + } // createCSVFileContent + + public String saveCSVPageFile(HttpServletRequest request, ReportSearchResult sr) { + try { + String csvFName = AppUtils.generateFileName(request, + (sr.getPageNo() < 0) ? AppConstants.FT_CSV_ALL : AppConstants.FT_CSV); + + BufferedWriter csvOut = new BufferedWriter(new FileWriter(AppUtils + .getTempFolderPath() + + csvFName)); + createCSVFileContent(csvOut, sr); + csvOut.close(); + + if (sr.getPageNo() < 0) + sr.setCsvAllRowsFileName(csvFName); + else + sr.setCsvPageFileName(csvFName); + + return csvFName; + } catch (Exception e) { + (new ErrorHandler()).processError(request, "Exception saving data to CSV file: " + + e.getMessage()); + return null; + } + } // saveCSVPageFile + + public ReportSearchResultJSON loadReportSearchResult(HttpServletRequest request) + throws RaptorException { + String userID = AppUtils.getUserID(request); + String fReportID = nvl(AppUtils.getRequestValue(request, AppConstants.RI_F_REPORT_ID)); + String fReportName = nvl(AppUtils.getRequestValue(request, + AppConstants.RI_F_REPORT_NAME)); + String sortOrder = nvl(AppUtils.getRequestValue(request, AppConstants.RI_SORT_ORDER), + AppConstants.RI_F_REPORT_NAME); + + String menuId = nvl(AppUtils.getRequestValue(request, AppConstants.RI_LIST_CATEGORY)); + + boolean userOnly = AppUtils.getRequestFlag(request, AppConstants.RI_USER_REPORTS); + boolean publicOnly = AppUtils.getRequestFlag(request, AppConstants.RI_PUBLIC_REPORTS); + boolean favoriteOnly = AppUtils.getRequestFlag(request, AppConstants.RI_FAVORITE_REPORTS); + + int pageNo = 0; + try { + pageNo = Integer.parseInt(request.getParameter(AppConstants.RI_NEXT_PAGE)); + } catch (Exception e) { + } + + StringBuffer roleList = new StringBuffer(); + roleList.append("-1"); + String rep_title_sql = "''"; + for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();) + roleList.append("," + ((String) iter.next())); + // + /*String sql = "SELECT cr.rep_id, " + + "cr.rep_id report_id, " + + rep_title_sql+ + "||DECODE(cr.public_yn, 'Y', '', '" + + PRIVATE_ICON + + "')||cr.title||'' title, " + + "cr.descr, " + + "au.first_name||' '||au.last_name owner_name, " + + "TO_CHAR(cr.create_date, 'MM/DD/YYYY') create_date, " + + "DECODE(NVL(cr.owner_id, cr.create_id), " + + userID + + ", 'N', NVL(ra.read_only_yn, 'Y')) read_only_yn, " + + "DECODE(NVL(cr.owner_id, cr.create_id), " + + userID + + ", 'Y', 'N') user_is_owner_yn, " + + "case when report_xml like '%N%' " + + "then 'N' " + + "when report_xml like '%Y%' " + + "or 1 = (select distinct 1 from cr_report_schedule where rep_id = cr.rep_id) " + + "then 'Y' " + + "else 'N' end " + + "FROM cr_report cr, " + + "app_user au, " + + "(SELECT rep_id, " + + "MIN(read_only_yn) read_only_yn " + + "FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = " + + userID + + ") " + + "UNION ALL " + + "(SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN (" + + roleList.toString() + "))" + ") report_access " + "GROUP BY rep_id) ra " + + "WHERE TO_CHAR(cr.rep_id) = nvl('" + fReportID + + "', TO_CHAR(cr.rep_id)) AND " + "UPPER(cr.title) LIKE UPPER('%" + + fReportName + "%') AND " + "nvl(cr.owner_id, cr.create_id) = au.user_id " + + "AND cr.rep_id = ra.rep_id (+) ";*/ + + String sql = Globals.getLoadReportSearchResult(); + String rep_id = ""; + String rep_id_options = ""; + String rep_id_sql = " AND FORMAT(cr.rep_id, 0) like coalesce('%%', FORMAT(cr.rep_id, 0)) "; + if(request.getParameter("rep_id")!=null) { + rep_id = request.getParameter("rep_id"); + } + if(request.getParameter("rep_id_options")!=null) { + rep_id_options = request.getParameter("rep_id_options"); + } + + /*Default: AND FORMAT(cr.rep_id, 0) like coalesce('%%', FORMAT(cr.rep_id, 0)) */ + + /*Equal to AND cr.rep_id = 1000 0 */ + /*Less than : AND cr.rep_id < 1000 1 */ + /*Greater than AND cr.rep_id > 1000 2 */ + + + if(AppUtils.nvl(rep_id).length()>0 ) { + if(AppUtils.nvl(rep_id_options).length()>0 ) { + switch (rep_id_options) { + case "0": + rep_id_sql = " AND cr.rep_id = "+ rep_id+" "; + break; + case "1": + rep_id_sql = " AND cr.rep_id < "+ rep_id+" "; + break; + case "2": + rep_id_sql = " AND cr.rep_id > "+ rep_id+" "; + break; + default: + rep_id_sql = " AND FORMAT(cr.rep_id, 0) like coalesce('%%', FORMAT(cr.rep_id, 0)) "; + break; + } + } else { + rep_id_sql = " AND cr.rep_id = "+ rep_id+" "; + } + } else { + rep_id_sql = " AND FORMAT(cr.rep_id, 0) like coalesce('%%', FORMAT(cr.rep_id, 0)) "; //equal is default + } + + sql = sql.replace("[fReportID]", rep_id_sql); + + String rep_name = ""; + String rep_name_options = ""; + String rep_name_sql = " AND UPPER(cr.title) LIKE UPPER('%%') "; + if(request.getParameter("rep_name")!=null) { + rep_name = request.getParameter("rep_name"); + } + if(request.getParameter("rep_name_options")!=null) { + rep_name_options = request.getParameter("rep_name_options"); + } + + /* Report name AND UPPER(cr.title) LIKE UPPER('Dash%') 0 */ + + /* Report name AND UPPER(cr.title) LIKE UPPER('%1') 1 */ + /* Report name AND UPPER(cr.title) LIKE UPPER('%1%') 2 */ + + if(AppUtils.nvl(rep_name).length()>0 ) { + if(AppUtils.nvl(rep_name_options).length()>0 ) { + switch (rep_name_options) { + case "0": + rep_name_sql = " AND UPPER(cr.title) LIKE UPPER('"+rep_name+"%') "; + break; + case "1": + rep_name_sql = " AND UPPER(cr.title) LIKE UPPER('%"+rep_name+"') "; + break; + case "2": + rep_name_sql = " AND UPPER(cr.title) LIKE UPPER('%"+rep_name+"%') "; + break; + default: + rep_name_sql = " AND UPPER(cr.title) LIKE UPPER('%%') "; + break; + } + } else { + rep_name_sql = " AND UPPER(cr.title) LIKE UPPER('%"+rep_name+"%') "; //contains is default + } + } else { + rep_name_sql = " AND UPPER(cr.title) LIKE UPPER('%%') "; + } + sql = sql.replace("[fReportName]", rep_name_sql); + + if (menuId.length() > 0){ + /*sql += "AND INSTR('|'||cr.menu_id||'|', '|'||'" + menuId + "'||'|') > 0 " + * +"AND + * cr.menu_approved_yn = + * 'Y' " + ;*/ + String sql_add = Globals.getLoadReportSearchInstr(); + sql+= sql_add; + } + + //String user_sql = " AND nvl(cr.owner_id, cr.create_id) = " + userID; + String user_sql = Globals.getLoadReportSearchResultUser(); + + //String public_sql = " AND (nvl(cr.owner_id, cr.create_id) = " + userID + // + " OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL)"; + String public_sql = Globals.getLoadReportSearchResultPublic(); + + //String fav_sql = " AND cr.rep_id in (select rep_id from cr_favorite_reports where user_id = " + userID +" ) "; + String fav_sql = Globals.getLoadReportSearchResultFav(); + + if (userOnly) + // My reports - user is owner + sql += " " + user_sql; + else if (publicOnly) { + // Public reports - user has read or write access to the report + // (user is owner or report is public or user has explicit user or + // role access) + if (!AppUtils.isSuperUser(request)) + sql += " " + public_sql; + } else if (favoriteOnly) { + sql += " " + public_sql; + sql += " " + fav_sql; + } else if (!AppUtils.isSuperUser(request)) { + // All reports + // If user is super user - gets unrestricted access to all reports + // (read_only gets overriden later) + // else - not super user - doesn't get access to private reports of + // other users (= Public reports); Admin users get edit right + // override later + //sql += public_sql; + sql += " " + public_sql; + } + + + + if (sortOrder.equals(AppConstants.RI_F_OWNER_ID)){ + //sql += " ORDER BY DECODE(nvl(cr.owner_id, cr.create_id), " + userID + //+ ", ' ', upper(au.first_name||' '||au.last_name)), upper(cr.title)"; + String sql_sort = Globals.getLoadReportSearchResultSort(); + sql+=" " + sql_sort; + } + else if (sortOrder.equals(AppConstants.RI_F_REPORT_ID)) + sql += " ORDER BY cr.rep_id"; + else if(sortOrder.equals(AppConstants.RI_F_REPORT_CREATE_DATE)) + sql += " ORDER BY cr.create_date"; + else if(sortOrder.equals(AppConstants.RI_F_PUBLIC)) + sql += " ORDER BY cr.public_yn desc"; + + else + // if(sortOrder.equals(AppConstants.RI_F_REPORT_NAME)) + sql += " ORDER BY upper(cr.title)"; + + sql = sql.replace("[rep_title_sql]", "cr.title"); + sql = sql.replace("[PRIVATE_ICON]", PRIVATE_ICON); + sql = sql.replace("[userID]", userID); + sql = sql.replace("[roleList.toString()]", roleList.toString()); + + //System.out.println("query is for search list is : " + sql); + DataSet ds = DbUtils.executeQuery(sql); + + ReportSearchResultJSON rsr = new ReportSearchResultJSON(0, 6, 7); + rsr.parseData(ds, request, 0, 20, 6, 7); + //saveCSVPageFile(request, rsr); + //rsr.truncateToPage(pageNo); + //saveCSVPageFile(request, rsr); + + return rsr; + } // loadReportSearchResult + + public ReportSearchResult loadFolderReportResult(HttpServletRequest request) + throws Exception { + String userID = AppUtils.getUserID(request); + String fReportID = nvl(AppUtils.getRequestValue(request, AppConstants.RI_F_REPORT_ID)); + String fReportName = nvl(AppUtils.getRequestValue(request, + AppConstants.RI_F_REPORT_NAME)); + String sortOrder = nvl(AppUtils.getRequestValue(request, AppConstants.RI_SORT_ORDER), + AppConstants.RI_F_REPORT_NAME); + + String menuId = nvl(AppUtils.getRequestValue(request, AppConstants.RI_LIST_CATEGORY)); + + boolean userOnly = AppUtils.getRequestFlag(request, AppConstants.RI_USER_REPORTS); + boolean publicOnly = AppUtils.getRequestFlag(request, AppConstants.RI_PUBLIC_REPORTS); + + int pageNo = 0; + try { + pageNo = Integer.parseInt(request.getParameter(AppConstants.RI_NEXT_PAGE)); + } catch (Exception e) { + } + + StringBuffer roleList = new StringBuffer(); + roleList.append("-1"); + String rep_title_sql = "''"; + for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();) + roleList.append("," + ((String) iter.next())); + // + /*String sql = "SELECT cr.rep_id, " + + "cr.rep_id report_id, " + + rep_title_sql+ + "||DECODE(cr.public_yn, 'Y', '', '" + + PRIVATE_ICON + + "')||cr.title||'' title, " + + "cr.descr, " + + "au.first_name||' '||au.last_name owner_name, " + + "TO_CHAR(cr.create_date, 'MM/DD/YYYY') create_date, " + + "DECODE(NVL(cr.owner_id, cr.create_id), " + + userID + + ", 'N', NVL(ra.read_only_yn, 'Y')) read_only_yn, " + + "DECODE(NVL(cr.owner_id, cr.create_id), " + + userID + + ", 'Y', 'N') user_is_owner_yn " + + "FROM cr_report cr, " + + "app_user au, " + + "(SELECT rep_id, " + + "MIN(read_only_yn) read_only_yn " + + "FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = " + + userID + + ") " + + "UNION ALL " + + "(SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN (" + + roleList.toString() + "))" + ") report_access " + "GROUP BY rep_id) ra " + + "WHERE TO_CHAR(cr.rep_id) = nvl('" + fReportID + + "', TO_CHAR(cr.rep_id)) AND " + "UPPER(cr.title) LIKE UPPER('%" + + fReportName + "%') AND " + "nvl(cr.owner_id, cr.create_id) = au.user_id " + + "AND cr.rep_id = ra.rep_id (+) ";*/ + + String sql = Globals.getLoadFolderReportResult(); + sql = sql.replace("[rep_title_sql]", rep_title_sql); + sql = sql.replace("[PRIVATE_ICON]", PRIVATE_ICON); + sql = sql.replace("[userID]", userID); + sql = sql.replace("[roleList.toString()]", roleList.toString()); + sql = sql.replace("[fReportID]", fReportID); + sql = sql.replace("[fReportName]", fReportName); + + if (menuId.length() > 0){ + /*sql += "AND INSTR('|'||cr.menu_id||'|', '|'||'" + menuId + "'||'|') > 0 " + * +"AND + * cr.menu_approved_yn = + * 'Y' " + ;*/ + String sql_add = Globals.getLoadReportSearchInstr(); + sql+= sql_add; + } + + //String user_sql = " AND nvl(cr.owner_id, cr.create_id) = " + userID; + String user_sql = Globals.getLoadReportSearchResultUser(); + + //String public_sql = " AND (nvl(cr.owner_id, cr.create_id) = " + userID + // + " OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL)"; + String public_sql = Globals.getLoadReportSearchResultPublic(); + + if (userOnly) + // My reports - user is owner + sql += user_sql; + else if (publicOnly) + // Public reports - user has read or write access to the report + // (user is owner or report is public or user has explicit user or + // role access) + if (!AppUtils.isSuperUser(request)) + sql += public_sql; + else if (!AppUtils.isSuperUser(request)) { + // All reports + // If user is super user - gets unrestricted access to all reports + // (read_only gets overriden later) + // else - not super user - doesn't get access to private reports of + // other users (= Public reports); Admin users get edit right + // override later + sql += public_sql; + } + + if (sortOrder.equals(AppConstants.RI_F_OWNER_ID)){ + + + //sql += " ORDER BY DECODE(nvl(cr.owner_id, cr.create_id), " + userID + // + ", ' ', au.first_name||' '||au.last_name), cr.title"; + + String sql_sort = Globals.getLoadFolderReportResultSort(); + sql+=sql_sort; + } + else if (sortOrder.equals(AppConstants.RI_F_REPORT_ID)) + sql += " ORDER BY cr.rep_id"; + else if(sortOrder.equals(AppConstants.RI_F_REPORT_CREATE_DATE)) + sql += " ORDER BY cr.create_date"; + else if(sortOrder.equals(AppConstants.RI_F_PUBLIC)) + sql += " ORDER BY cr.public_yn desc"; + else + // if(sortOrder.equals(AppConstants.RI_F_REPORT_NAME)) + sql += " ORDER BY cr.title"; + + //System.out.println("query is for search list is : " + sql); + DataSet ds = DbUtils.executeQuery(sql); + + ReportSearchResult rsr = new ReportSearchResult(-1, 6, 7); + rsr.parseData(ds, request); + saveCSVPageFile(request, rsr); + rsr.truncateToPage(pageNo); + saveCSVPageFile(request, rsr); + + return rsr; + } // loadFolderReportResult + + +} // SearchHandler diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ChartSeqComparator.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ChartSeqComparator.java new file mode 100644 index 0000000..7b15db5 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ChartSeqComparator.java @@ -0,0 +1,49 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.base; + +import java.util.Comparator; + +import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType; + +public class ChartSeqComparator implements Comparator { + + public int compare(Object o1, Object o2) { + DataColumnType dct1 = (DataColumnType) o1; + DataColumnType dct2 = (DataColumnType) o2; + + int dct1ChartSeq = (dct1.getChartSeq()!=null ? dct1.getChartSeq().intValue(): -1); + int dct2ChartSeq = (dct2.getChartSeq()!=null ? dct2.getChartSeq().intValue(): -1); + + if (dct1ChartSeq == dct2ChartSeq) + return 0; + else if (dct1ChartSeq < 0) // Position columns + // with seq -1 at + // the end + return 1; + else if (dct2ChartSeq < 0) + return -1; + else if (dct1ChartSeq < dct2ChartSeq) + return -1; + else + return 1; + } // compare + +} // ChartSeqComparator diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameColLookup.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameColLookup.java new file mode 100644 index 0000000..d7fdc33 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameColLookup.java @@ -0,0 +1,35 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.base; + +public class IdNameColLookup extends IdNameLookup { + private String colId = null; + + public IdNameColLookup(String colId, String dbTableName, String dbIdField, + String dbNameField, String dbSortByField) { + super(dbTableName, dbIdField, dbNameField, dbSortByField, false); + this.colId = colId; + } // IdNameColLookup + + public String getColId() { + return colId; + } + +} // IdNameColLookup diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameList.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameList.java new file mode 100644 index 0000000..dba3db0 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameList.java @@ -0,0 +1,183 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.base; + +import java.util.Vector; + +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.system.Globals; + +public class IdNameList extends Vector { + protected int pageNo = -1; + + protected int pageSize = 50; + + private int nextElemIdx = 0; + + private String oldSql = null; + + public IdNameList() { + super(); + pageSize = Globals.getFormFieldsListSize(); + } // IdNameList + + public int getPageNo() { + return pageNo; + } // getPageNo + + public int getPageSize() { + return pageSize; + } // getPageSize + + public int getDataSize() { + return size(); + } // getDataSize + + public void resetNext() { + resetNext(0); + } // resetNext + + public void resetNext(int toPos) { + nextElemIdx = toPos; + } // resetNext + + public boolean hasNext() { + return (nextElemIdx < size()); + } // hasNext + + public IdNameValue getNext() { + return hasNext() ? getValue(nextElemIdx++) : null; + } // getNext + + public int getCount() { + return size(); + } // getCount + + public IdNameValue getValue(int idx) { + return (IdNameValue) get(idx); + } // getValue + + public void addValue(IdNameValue value) { + add(value); + } // addValue + + public void addValue(String id, String name, boolean defaultValue) { + addValue(new IdNameValue(id, name, defaultValue)); + } // addValue + + public void addValue(String id, String name, boolean defaultValue, boolean readOnly) { + addValue(new IdNameValue(id, name, defaultValue, readOnly)); + } // addValue + + public void addValue(String id, String name) { + addValue(new IdNameValue(id, name)); + } // addValue + + public void addValue(int idx, IdNameValue value) { + add(idx, value); + } // addValue + + public void addValue(int idx, String id, String name) { + addValue(idx, new IdNameValue(id, name)); + } // addValue + + public String getNameById(String id) { + for (int i = 0; i < size(); i++) { + IdNameValue value = getValue(i); + if (value.getId().equals(id)) + return value.getName(); + } // for + + return null; + } // getNameById + + public String getIdByName(String name) { + for (int i = 0; i < size(); i++) { + IdNameValue value = getValue(i); + if (value.getName().equals(name)) + return value.getId(); + } // for + + return null; + } // getIdByName + + public boolean canUseSearchString() { + return true; + } + + public String getBaseSQL() { + return null; + } + + public String getOldSql() { + return oldSql; + } + + public void setOldSql(String oldSql) { + this.oldSql = oldSql; + } + public String getBaseWholeSQL() { + return null; + } + + public String getBaseWholeReadonlySQL() { + return null; + } + + public String getBaseSQLForPDFExcel(boolean multiParam) { + return null; + } + + public void clearData() { + } + + public void loadData(String pageNo, String searchString, String dbInfo,String userId) throws RaptorException {} + public void loadUserData(String pageNo, String searchString, String dbInfo,String userId) throws RaptorException {} + public void loadUserData(int pageNo, String searchString, String dbInfo, String userId) throws RaptorException {} + public void loadUserData(String searchString, int pageNo, String dbInfo) throws RaptorException {} + + public void loadData(String pageNo) throws RaptorException {} + public void loadData(int pageNo) throws RaptorException {} + public void loadData(String pageNo, String searchString, String dbInfo) throws RaptorException {} + private void loadData(int pageNo, String searchString, String dbInfo) throws RaptorException {} + +/* + public void loadData(int pageNo, String dbInfo) throws RaptorException { + } + + public void loadUserData(int pageNo, String dbInfo, String userId) throws RaptorException { + } + + + + + public void loadData(String pageNo, String searchString) throws RaptorException { + } + +*/ + protected static String nvl(String s) { + return (s == null) ? "" : s; + } + + protected static String nvl(String s, String sDefault) { + return nvl(s).equals("") ? sDefault : s; + } + +} // IdNameList diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameLookup.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameLookup.java new file mode 100644 index 0000000..e4424f6 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameLookup.java @@ -0,0 +1,198 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.base; + +import org.openecomp.portalsdk.analytics.error.RaptorException; + +public class IdNameLookup extends IdNameSql { + private String dbTableName = null; + + private String dbIdField = null; + + private String dbNameField = null; + + private String dbSortByField = null; + + private String searchString = ""; + + public IdNameLookup(int pageNo, String dbTableName, String dbIdField, String dbNameField) { + this(dbTableName, dbIdField, dbNameField); + + this.pageNo = pageNo; + } // IdNameLookup + + public IdNameLookup(String dbTableName, String dbIdField, String dbNameField) { + this(dbTableName, dbIdField, dbNameField, null, "", false); + } // IdNameLookup + +/* public IdNameLookup(String dbTableName, String dbIdField, String dbNameField, + String dbSortByField) { + super(); + + setDbTableName(dbTableName); + setDbIdField(dbIdField); + setDbNameField(dbNameField); + setDbSortByField(dbSortByField); + updateParentSQL(); + } // IdNameLookup + + public IdNameLookup(String dbTableName, String dbIdField, String dbNameField, + String dbSortByField, String defaultSQL) { + super(); + + setDbTableName(dbTableName); + setDbIdField(dbIdField); + setDbNameField(dbNameField); + setDbSortByField(dbSortByField); + setDefaultSQL(defaultSQL); + updateParentSQL(); + } // IdNameLookup +*/ + public IdNameLookup(String dbTableName, String dbIdField, String dbNameField, + String dbSortByField, boolean textField) { + super(); + setDbTableName(dbTableName); + setDbIdField(dbIdField); + setDbNameField(dbNameField); + setDbSortByField(dbSortByField); + if(!textField) + updateParentSQL(); + } // IdNameLookup + + public IdNameLookup(String dbTableName, String dbIdField, String dbNameField, + String dbSortByField, String defaultSQL, boolean textField) { + super(); + + setDbTableName(dbTableName); + setDbIdField(dbIdField); + setDbNameField(dbNameField); + setDbSortByField(dbSortByField); + setDefaultSQL(defaultSQL); + if(!textField) + updateParentSQL(); + } // IdNameLookup + + public String getDbTableName() { + return dbTableName; + } + + public String getDbIdField() { + return dbIdField; + } + + public String getDbNameField() { + return dbNameField; + } + + public String getDbSortByField() { + return dbSortByField; + } + + public void setDbTableName(String dbTableName) { + this.dbTableName = dbTableName; + } + + public void setDbIdField(String dbIdField) { + this.dbIdField = dbIdField; + } + + public void setDbNameField(String dbNameField) { + this.dbNameField = dbNameField; + } + + + public void setDbSortByField(String dbSortByField) { + this.dbSortByField = dbSortByField; + } + + private void updateParentSQL() { + String sql_start = "SELECT DISTINCT " + dbIdField + " id, " + dbNameField + " name"; + String sql_end = " FROM " + dbTableName + " WHERE " + dbIdField + " IS NOT NULL"; + if (searchString.length() > 0) + sql_end += " AND UPPER(" + dbNameField + ") LIKE UPPER('" + searchString + "')"; + + String sql_middle = ""; + if (dbSortByField != null && (!dbSortByField.equals(dbNameField)) && (!dbSortByField.trim().startsWith("TO_DATE"))) + sql_middle = ", " + + ((dbSortByField.indexOf(' ') > 0) ? dbSortByField.substring(0, + dbSortByField.indexOf(' ')) : dbSortByField) + " sort"; + + setSqlNoOrderBy(sql_start + sql_middle + sql_end); +// System.out.println("SQL Start " + sql_start); +// System.out.println("SQL Middle " + sql_middle); +// System.out.println("SQL End " + sql_end); +// System.out.println("DbSortByField " + dbSortByField); + + setSql(sql_start + sql_middle + sql_end + " ORDER BY " + nvl(dbSortByField, "2")); + } // updateParentSQL + + public boolean canUseSearchString() { + return true; + } + + public String getBaseSQL() { + return "SELECT " + dbIdField + " FROM " + dbTableName; + } // getBaseSQL + + public String getBaseWholeSQL() { + return "SELECT " + dbIdField + " FROM " + dbTableName; + } // getBaseSQL + + /* + public void loadData(int pageNo) throws RaptorException { + loadData(pageNo, ""); + } // loadData + + public void loadData(String pageNo) throws RaptorException { + loadData(pageNo, ""); + } // loadData +*/ + + public void loadData(String pageNo, String searchString, String dbInfo) throws RaptorException { + int iPageNo = 0; + + if (pageNo != null) + try { + iPageNo = Integer.parseInt(pageNo); + } catch (NumberFormatException e) { + } + + loadData(iPageNo, searchString, dbInfo); + } // loadData + + private void loadData(int pageNo, String searchString, String dbInfo) throws RaptorException { + boolean dataAlreadyLoaded = (this.pageNo == pageNo) + && (this.searchString.equals(searchString)); + + if (dataAlreadyLoaded) + return; + + if (!this.searchString.equals(searchString)) { + dataSize = -1; + pageNo = 0; + } // if + + this.pageNo = pageNo; + this.searchString = searchString; + updateParentSQL(); + performLoadData(searchString,dbInfo); + } // loadData + +} // IdNameLookup diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameSql.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameSql.java new file mode 100644 index 0000000..9928ad8 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameSql.java @@ -0,0 +1,400 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +/* =========================================================================================== + * This class is part of RAPTOR (Rapid Application Programming Tool for OLAP Reporting) + * Raptor : This tool is used to generate different kinds of reports with lot of utilities + * =========================================================================================== + * + * ------------------------------------------------------------------------------------------- + * IdNameSql.java - This class is used to generate form field items when sql is provided. + * ------------------------------------------------------------------------------------------- + * + * Created By : Stan Pishamanov + * Modified By: Sundar Ramalingam + * + * Changes + * ------- + * 08-Jun-2009 : Version 8.3 (RS); Rownum references is avoided for reports connnecting to Daytona + * Database. + * + */ +package org.openecomp.portalsdk.analytics.model.base; + +import java.util.HashMap; + +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.system.ConnectionUtils; +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; +import org.openecomp.portalsdk.analytics.util.DataSet; +import org.openecomp.portalsdk.analytics.util.Utils; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; + +public class IdNameSql extends IdNameList { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(IdNameSql.class); + + + protected int dataSize = -1; + + protected int dataSizeUsedInPopup = -1; + + private String sql = null; + + private String oldSql = null; + + private String defaultSQL = null; + + private String sqlNoOrderBy = null; + + public IdNameSql(int pageNo, String sql, String defaultSQL) { + this(sql,defaultSQL); + this.pageNo = pageNo; + } // IdNameSql + + public IdNameSql(String sql) { + this(); + setSql(sql); + } // IdNameSql + + public IdNameSql(String sql, String defaultSQL) { + this(); + setDefaultSQL(defaultSQL); + setSql(sql); + } // IdNameSql + + protected IdNameSql() { + super(); + } // IdNameSql + + public boolean canUseSearchString() { + return true; + } + + public String getSql() { + return sql; + } + + public String getOldSql() { + return oldSql; + } + + public String getBaseSQL() { + return "SELECT id FROM (" + sql + ") xid"; + } + + public String getBaseWholeSQL() { + return "SELECT id, name FROM (" + sql + ") xid"; + } + + public String getBaseWholeReadonlySQL() { + return "SELECT id, name, ff_readonly FROM (" + sql + ") xid"; + } + + public String getBaseSQLForPDFExcel(boolean multiParam) { + if(!multiParam) + return "SELECT id, name FROM (" + sql + ") xid where id = '[VALUE]'"; + else + return "SELECT id, name FROM (" + sql + ") xid where id in [VALUE]"; + + } + + // public String getSqlNoOrderBy() { return sqlNoOrderBy; } + + protected void setSql(String sql) { + this.sql = sql; + } + + public void setOldSql(String oldSql) { + this.oldSql = oldSql; + } + + protected void setSqlNoOrderBy(String sql) { + this.sqlNoOrderBy = sql; + } + + public int getDataSize() { + return dataSize; + } // getDataSize + + public int getDataSizeUsedinPopup() { + return dataSizeUsedInPopup; + } // getDataSizeUsedinPopup + + public void setDataSizeUsedinPopup(int dataSizePop) { + this.dataSizeUsedInPopup = dataSizePop; + } // getDataSizeUsedinPopup + + public void clearData() { + removeAllElements(); + } // clearData + +/* public void loadData(String pageNo, String searchString, String dbInfo, String userId) throws RaptorException { + // setSql(searchString); + loadUserData(pageNo, searchString, dbInfo,userId); + } // loadData +*/ + + public void loadUserData(String pageNo, String searchString, String dbInfo,String userId) throws RaptorException { + int iPageNo = 0; + + if (pageNo != null) + try { + iPageNo = Integer.parseInt(pageNo); + } catch (NumberFormatException e) { + } + + loadUserData(iPageNo, searchString, dbInfo,userId); + } // loadData + + public void loadUserData(int pageNo, String searchString, String dbInfo, String userId) throws RaptorException { + if(userId!=null) { + String sql = Utils.replaceInString(getSql(), "[LOGGED_USERID]", userId); + //String defaultSQL = ""; + if(defaultSQL!=null && (defaultSQL.trim().toLowerCase().startsWith("select")) ) { + defaultSQL = Utils.replaceInString(getDefaultSQL(), "[LOGGED_USERID]", userId); + setDefaultSQL(defaultSQL); + } + setSql(sql); + + } + loadData(searchString,pageNo, dbInfo); + } + + public void loadData(String searchString, int pageNo, String dbInfo) throws RaptorException { + + //boolean dataAlreadyLoaded = (this.pageNo == pageNo); + + //if (dataAlreadyLoaded) + // return; + + this.pageNo = pageNo; + + performLoadData(searchString, dbInfo); + } // loadData + + protected void performLoadData(String searchString, String dbInfo) throws RaptorException { + long currentTime = System.currentTimeMillis(); + int startRow = 0; + int endRow = dataSize; + String readOnlyInSql = "ff_readonly"; + String dbType = Globals.getDBType(); + if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { + try { + org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo(); + dbType = remDbInfo.getDBType(dbInfo); + } catch (Exception ex) { + throw new RaptorException(ex); + } + } + if (pageNo >= 0) { + startRow = pageNo * pageSize; + endRow = startRow + pageSize; + } // if + DataSet ds = null; + DataSet dsDefault = null; + StringBuffer query = new StringBuffer(""); + StringBuffer queryPop = new StringBuffer(""); + String sql = getSql(); + boolean avail_ReadOnly = (sql.toLowerCase().indexOf(readOnlyInSql)!=-1); + + if (dbType.equals("DAYTONA") && getSql().trim().toUpperCase().startsWith("SELECT")) { + query.append(getSql()); + } else { + if(avail_ReadOnly) // need to add readonlyinsql + if(!(Globals.isMySQL() && dbType.equals(AppConstants.MYSQL))) + query.append("SELECT rownum, id, name, " + readOnlyInSql +" FROM ("+ Globals.getReportSqlForFormfield() +", " + readOnlyInSql + " FROM (" + sql + + ") x "+ Globals.getReportSqlForFormfieldSuffix()); + else + query.append("SELECT id, name, " + readOnlyInSql +" FROM ("+ Globals.getReportSqlForFormfield() +", " + readOnlyInSql + " FROM (" + sql + + ") x "+ Globals.getReportSqlForFormfieldSuffix()); + else + query.append(Globals.getReportSqlForFormfieldPrefix()+ Globals.getReportSqlForFormfield() +" FROM (" + sql + + ") x " + Globals.getReportSqlForFormfieldSuffix()); + if(pageNo!= -2 && (dbType.equals(AppConstants.ORACLE)) ) { + query.append(" WHERE rownum <= " + ((dataSize < 0) ? (endRow + 1) : endRow)); + } else if(pageNo!=2 && (dbType.equals(AppConstants.POSTGRESQL))) { + query.append(" LIMIT " + ((dataSize < 0) ? (endRow + 1) : endRow)); + + } else if(pageNo!=2 && (dbType.equals(AppConstants.MYSQL))) { + query.append(" LIMIT " + startRow); //((dataSize < 0) ? (endRow + 1) : endRow) + + } + if(searchString!=null && searchString.length()>0 && !searchString.equals("%")) { + if(pageNo == -2) query.append(" WHERE "); + else query.append(" and "); + query.append("name like '"+ searchString +"'"); + } + if(dbType.equals(AppConstants.POSTGRESQL)) { + query.append(") xx OFFSET " + startRow); + } else if(dbType.equals(AppConstants.MYSQL)) { + query.append(" ," + ((dataSize < 0) ? (endRow + 1) : endRow) +") xx"); + } else if(dbType.equals(AppConstants.ORACLE)) + query.append(") xx WHERE rownum>" + startRow); + } + String defaultQuery =""; + boolean readOnly = true; + ds = ConnectionUtils.getDataSet(query.toString(), dbInfo); + + // if ( (dbInfo!=null) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { + // Globals.getRDbUtils().setDBPrefix(dbInfo); + // ds = RemDbUtils.executeQuery(query); + // } + // else + // ds = DbUtils.executeQuery(query); + clearData(); + if (dbType.equals("DAYTONA") && (getDefaultSQL()!=null && getDefaultSQL().trim().toUpperCase().startsWith("SELECT"))) { + defaultQuery = getDefaultSQL(); + } else if (getDefaultSQL()!=null && getDefaultSQL().length()>10 && getDefaultSQL().substring(0,10).toLowerCase().startsWith("select")) { + defaultQuery = Globals.getReportSqlForFormfieldPrefix()+ Globals.getReportSqlForFormfield() +" FROM (" + getDefaultSQL() + + ") x " + + ") xx "; + logger.debug(EELFLoggerDelegate.debugLogger, ("Default Query " +defaultQuery)); + } + HashMap defaultMap = new HashMap(); + if(!isNull(defaultQuery)) { + dsDefault = ConnectionUtils.getDataSet(defaultQuery, dbInfo); + if(dsDefault!=null && dsDefault.getRowCount()>0) { + for (int i = 0; i < dsDefault.getRowCount(); i++) { + //addValue(dsDefault.getString(i, 0), dsDefault.getString(i, 1), true); + defaultMap.put(dsDefault.getString(i, "id"), dsDefault.getString(i, "name")); + } + } + } + + for (int i = 0; i < ((pageNo!=-2)?Math.min(ds.getRowCount(), pageSize):ds.getRowCount()); i++) { + //if(getCount()==0) + // addValue(ds.getString(i, 0), ds.getString(i, 1)); + if(i==0 && avail_ReadOnly) + readOnly = ds.getString(i, "ff_readonly").toUpperCase().startsWith("Y")||ds.getString(i, "ff_readonly").toUpperCase().startsWith("T"); + if(getCount()>=0) {//&& !((IdNameValue)getValue(0)).getId().equals(ds.getString(i, 0))) + if(defaultMap.get(ds.getString(i, "id")) == null) + if(avail_ReadOnly) + addValue(ds.getString(i, "id"), ds.getString(i, "name"), false, readOnly); + else + addValue(ds.getString(i, "id"), ds.getString(i, "name"), false); + else + if(avail_ReadOnly) + addValue(ds.getString(i, "id"), ds.getString(i, "name"), true, readOnly); + else + addValue(ds.getString(i, "id"), ds.getString(i, "name"), true); + } + } + + if (!(dbType.equals("DAYTONA"))) { + if (ds.getRowCount() <= pageSize) { + if(dsDefault!=null && dsDefault.getRowCount()>0) + dataSize = ds.getRowCount()+1; + else + dataSize = ds.getRowCount(); + + //System.out.println("IDNAME SQL COUNT");*/ + if(searchString!=null && searchString.length()>0 && !searchString.equals("%")) { + queryPop = new StringBuffer(""); + queryPop.append("SELECT count(*) num_rows FROM ("+ Globals.getReportSqlForFormfield() +", name FROM (" + sql + + ") x "); + if(searchString!=null && searchString.length()>0 && !searchString.equals("%")) + queryPop.append(" where name like '"+ searchString +"'"); + queryPop.append(") xx "); + + ds = ConnectionUtils.getDataSet(queryPop.toString(), dbInfo); + try { + dataSizeUsedInPopup = Integer.parseInt(ds.getString(0, 0)); + } catch (NumberFormatException e) { + } + } else if(dataSizeUsedInPopup == -3) { + queryPop = new StringBuffer(""); + //System.out.println("IDNAME SQL COUNT"); + //queryPop.append("SELECT count(*) num_rows FROM ("+query.toString()+") x"); + queryPop.append("SELECT count(*) num_rows FROM ("+ Globals.getReportSqlForFormfield() +", name FROM (" + sql + + ") x "); + queryPop.append(") xx "); + + ds = ConnectionUtils.getDataSet(queryPop.toString(), dbInfo); + // if ( (dbInfo!=null) && + // (!dbInfo.equals(AppConstants.DB_LOCAL))) { + // Globals.getRDbUtils().setDBPrefix(dbInfo); + // ds = RemDbUtils.executeQuery(query); + // } + // else + // ds = DbUtils.executeQuery(query); + // + try { + dataSizeUsedInPopup = Integer.parseInt(ds.getString(0, 0)); + } catch (NumberFormatException e) { + } + + } + + } else { + //pageNo = 0; + if(pageNo!= -2) { + queryPop = new StringBuffer(""); + //System.out.println("IDNAME SQL COUNT"); + //queryPop.append("SELECT count(*) num_rows FROM ("+query.toString()+") x"); + queryPop.append("SELECT count(*) num_rows FROM ("+ Globals.getReportSqlForFormfield() +" FROM (" + sql + + ") x "); + queryPop.append(") xx "); + + ds = ConnectionUtils.getDataSet(queryPop.toString(), dbInfo); + // if ( (dbInfo!=null) && + // (!dbInfo.equals(AppConstants.DB_LOCAL))) { + // Globals.getRDbUtils().setDBPrefix(dbInfo); + // ds = RemDbUtils.executeQuery(query); + // } + // else + // ds = DbUtils.executeQuery(query); + // + try { + dataSize = Integer.parseInt(ds.getString(0, 0)); + dataSizeUsedInPopup = Integer.parseInt(ds.getString(0, 0)); + } catch (NumberFormatException e) { + } + } + } // else + } // dataSize < 0 + long totalTime = System.currentTimeMillis() - currentTime; + logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] ------->Time Taken to the above formfield Query (+ count Query if any) --- " + totalTime)); + } // performLoadData + + + public String getDefaultSQL() { + + return defaultSQL; + } + + + public void setDefaultSQL(String defaultSQL) { + + this.defaultSQL = defaultSQL; + } + + public void setSQL(String sql_) + { + this.sql = sql_; + } + + public static boolean isNull(String a) { + if ((a == null) || (a.length() == 0) || a.equalsIgnoreCase("null")) + return true; + else + return false; + } +} // IdNameSql diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameValue.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameValue.java new file mode 100644 index 0000000..5ac81f7 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/IdNameValue.java @@ -0,0 +1,100 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.base; + +public class IdNameValue { + private String id = null; + + private String name = null; + + private boolean defaultValue = false; + + private boolean readOnly = false; + + public IdNameValue() { + super(); + } + + public IdNameValue(String id, String name) { + this(); + + setId(id); + setName(name); + setDefaultValue(false); + + } // IdNameValue + + public IdNameValue(String id, String name, boolean defaultValue) { + this(); + + setId(id); + setName(name); + setDefaultValue(defaultValue); + } // IdNameValue + + public IdNameValue(String id, String name, boolean defaultValue, boolean readOnly) { + this(); + + setId(id); + setName(name); + setDefaultValue(defaultValue); + setReadOnly(readOnly); + } // IdNameValue + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public void setId(String id) { + this.id = id; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(boolean defaultValue) { + this.defaultValue = defaultValue; + } + + /** + * @return the visibility + */ + public boolean isReadOnly() { + return readOnly; + } + + /** + * @param visibility the visibility to set + */ + public void setReadOnly(boolean readOnly) { + this.readOnly = readOnly; + } + + +} // IdNameValue diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/NameComparator.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/NameComparator.java new file mode 100644 index 0000000..8a6f2a9 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/NameComparator.java @@ -0,0 +1,32 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.base; + +import java.util.Comparator; + +public class NameComparator implements Comparator { + + public int compare(Object o1, Object o2) { + return ((IdNameValue) o1).getName() + .compareToIgnoreCase((((IdNameValue) o2).getName())); + } // compare + +} // NameComparator + diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/OrderBySeqComparator.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/OrderBySeqComparator.java new file mode 100644 index 0000000..930f508 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/OrderBySeqComparator.java @@ -0,0 +1,37 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.base; + +import java.util.Comparator; + +import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType; + +public class OrderBySeqComparator implements Comparator { + + public int compare(Object o1, Object o2) { + if (((DataColumnType) o1).getOrderBySeq() == ((DataColumnType) o2).getOrderBySeq()) + return 0; + else if (((DataColumnType) o1).getOrderBySeq() < ((DataColumnType) o2).getOrderBySeq()) + return -1; + else + return 1; + } // compare + +} // OrderSeqComparator diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/OrderSeqComparator.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/OrderSeqComparator.java new file mode 100644 index 0000000..e6c013d --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/OrderSeqComparator.java @@ -0,0 +1,37 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.base; + +import java.util.Comparator; + +import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType; + +public class OrderSeqComparator implements Comparator { + + public int compare(Object o1, Object o2) { + if (((DataColumnType) o1).getOrderSeq() == ((DataColumnType) o2).getOrderSeq()) + return 0; + else if (((DataColumnType) o1).getOrderSeq() < ((DataColumnType) o2).getOrderSeq()) + return -1; + else + return 1; + } // compare + +} // OrderSeqComparator diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportSecurity.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportSecurity.java new file mode 100644 index 0000000..f281ac4 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportSecurity.java @@ -0,0 +1,407 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.base; + +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Vector; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.error.UserAccessException; +import org.openecomp.portalsdk.analytics.model.definition.SecurityEntry; +import org.openecomp.portalsdk.analytics.system.AppUtils; +import org.openecomp.portalsdk.analytics.system.DbUtils; +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; +import org.openecomp.portalsdk.analytics.util.DataSet; +import org.openecomp.portalsdk.analytics.util.Utils; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; + +public class ReportSecurity extends org.openecomp.portalsdk.analytics.RaptorObject { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportSecurity.class); + + + private String reportID = null; + + private String ownerID = null; + + private String createID = null; + + private String createDate = null; + + private String updateID = null; + + private String updateDate = null; + + private boolean isPublic = false; + + private Hashtable reportRoles = new Hashtable(); + + private Hashtable reportUsers = new Hashtable(); + + public ReportSecurity(String reportID) { + this(reportID, null, null, null, null, null, false); + } // ReportSecurity + + public ReportSecurity(String reportID, String ownerID, String createID, String createDate, + String updateID, String updateDate, boolean isPublic) { + super(); + + if (ownerID == null) + // Need to load the report record from the database + if (!reportID.equals("-1")) + try { + /*DataSet ds = DbUtils + .executeQuery("SELECT NVL(cr.owner_id, cr.create_id) owner_id, cr.create_id, TO_CHAR(cr.create_date, '" + + Globals.getOracleTimeFormat() + + "') create_date, maint_id, TO_CHAR(cr.maint_date, '" + + Globals.getOracleTimeFormat() + + "') update_date, cr.public_yn FROM cr_report cr WHERE cr.rep_id=" + + reportID);*/ + String sql = Globals.getReportSecurity(); + sql = sql.replace("[rw.getReportID()]", reportID); + DataSet ds = DbUtils.executeQuery(sql); + ownerID = ds.getString(0, 0); + createID = ds.getString(0, 1); + createDate = ds.getString(0, 2); + updateID = ds.getString(0, 3); + updateDate = ds.getString(0, 4); + isPublic = nvl(ds.getString(0, 5)).equals("Y"); + } catch (Exception e) { + String eMsg = "ReportSecurity.ReportSecurity: Unable to load report record details. Exception: " + + e.getMessage(); + //Log.write(eMsg); + logger.debug(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] "+eMsg)); + throw new RuntimeException(eMsg); + } + + this.reportID = reportID; + this.ownerID = ownerID; + this.createID = createID; + this.createDate = createDate; + this.updateID = updateID; + this.updateDate = updateDate; + this.isPublic = isPublic; + + /* + * reportUsers.put(ownerID, "N"); // Owner has full access + * reportRoles.put(AppUtils.getSuperRoleID(), "N"); // Super role has + * full access for(Iterator iter=AppUtils.getAdminRoleIDs().iterator(); + * iter.hasNext(); ) reportRoles.put((String) iter.next(), "Y"); // + * Admin role(s) have read-only access + */ + try { + String reportUserAccessSql= Globals.getReportUserAccess(); + reportUserAccessSql = reportUserAccessSql.replace("[reportID]", reportID); + + DataSet ds = DbUtils + .executeQuery(reportUserAccessSql); + for (int i = 0; i < ds.getRowCount(); i++) { + String roleID = nvl(ds.getString(i, 0)); + if (roleID.length() > 0) + reportRoles.put(roleID, ds.getString(i, 2)); + + String userID = nvl(ds.getString(i, 1)); + if (userID.length() > 0) + reportUsers.put(userID, ds.getString(i, 2)); + } // for + } catch (Exception e) { + String eMsg = "ReportSecurity.ReportSecurity: Unable to load access priviledges - error " + + e.getMessage(); + logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] " + eMsg)); + throw new RuntimeException(eMsg); + } + } // ReportSecurity + + public String getOwnerID() { + return ownerID; + } + + public String getCreateID() { + return createID; + } + + public String getCreateDate() { + return createDate; + } + + public String getUpdateID() { + return updateID; + } + + public String getUpdateDate() { + return updateDate; + } + + public void setOwnerID(String ownerID) { + this.ownerID = ownerID; + } + + public void setPublic(boolean isPublic) { + this.isPublic = isPublic; + } + + public void reportCreate(String reportID, String userID, boolean isPublic) { + this.reportID = reportID; + this.ownerID = userID; + this.createID = userID; + this.createDate = Utils.getCurrentDateTime(); + this.updateID = userID; + this.updateDate = this.createDate; + this.isPublic = isPublic; + } // reportCreate + + public void reportUpdate(HttpServletRequest request) throws RaptorException { + checkUserWriteAccess(request); + String userID = AppUtils.getUserID(request); + this.updateID = userID; + this.updateDate = Utils.getCurrentDateTime(); + } // reportUpdate + + /** ************************************************************* */ + + public Vector getReportUsers(HttpServletRequest request) throws RaptorException { + HttpSession session = request.getSession(); + String query = Globals.getCustomizedScheduleQueryForUsers(); + String[] sessionParameters = Globals.getSessionParams().split(","); + session.setAttribute("login_id", AppUtils.getUserBackdoorLoginId(request)); + String param = ""; + for (int i = 0; i < sessionParameters.length; i++) { + param = (String)session.getAttribute(sessionParameters[0]); + query = Utils.replaceInString(query, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) ); + } + boolean isAdmin = AppUtils.isAdminUser(request); + Vector allUsers = AppUtils.getAllUsers(query,param, isAdmin); + Vector rUsers = new Vector(allUsers.size()); + + for (Iterator iter = allUsers.iterator(); iter.hasNext();) { + IdNameValue user = (IdNameValue) iter.next(); + String readOnlyAccess = (String) reportUsers.get(user.getId()); + if (readOnlyAccess != null) + rUsers.add(new SecurityEntry(user.getId(), user.getName(), readOnlyAccess + .equals("Y"))); + } // for + + return rUsers; + } // getReportUsers + + public Vector getReportRoles(HttpServletRequest request) throws RaptorException { + HttpSession session = request.getSession(); + String query = Globals.getCustomizedScheduleQueryForRoles(); + String[] sessionParameters = Globals.getSessionParams().split(","); + String param = ""; + for (int i = 0; i < sessionParameters.length; i++) { + param = (String)session.getAttribute(sessionParameters[0]); + query = Utils.replaceInString(query, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) ); + + } + boolean isAdmin = AppUtils.isAdminUser(request); + Vector allRoles = AppUtils.getAllRoles(query, param, isAdmin); + Vector rRoles = new Vector(allRoles.size()); + + for (Iterator iter = allRoles.iterator(); iter.hasNext();) { + IdNameValue role = (IdNameValue) iter.next(); + String readOnlyAccess = (String) reportRoles.get(role.getId()); + if (readOnlyAccess != null) + rRoles.add(new SecurityEntry(role.getId(), role.getName(), readOnlyAccess + .equals("Y"))); + } // for + + return rRoles; + } // getReportRoles + + /** ************************************************************* */ + + private void validateReadOnlyAccess(String readOnlyAccess) throws Exception { + if (!(readOnlyAccess != null && (readOnlyAccess.equals("Y") || readOnlyAccess + .equals("N")))) + throw new RuntimeException( + "[ReportSecurity.validateReadOnlyAccess] Invalid parameter value"); + } // validateReadOnlyAccess + + public void addUserAccess(String userID, String readOnlyAccess) throws Exception { + validateReadOnlyAccess(readOnlyAccess); + reportUsers.put(userID, readOnlyAccess); + String addUserAccessSql= Globals.getAddUserAccess(); + addUserAccessSql = addUserAccessSql.replace("[reportID]", reportID); + addUserAccessSql = addUserAccessSql.replace("[userID]", userID); + addUserAccessSql = addUserAccessSql.replace("[readOnlyAccess]", readOnlyAccess); + DbUtils + .executeUpdate(addUserAccessSql); + } // addUserAccess + + public void updateUserAccess(String userID, String readOnlyAccess) throws Exception { + validateReadOnlyAccess(readOnlyAccess); + reportUsers.remove(userID); + reportUsers.put(userID, readOnlyAccess); + String updateUserAccessSql= Globals.getUpdateUserAccess(); + updateUserAccessSql = updateUserAccessSql.replace("[reportID]", reportID); + updateUserAccessSql = updateUserAccessSql.replace("[userID]", userID); + updateUserAccessSql = updateUserAccessSql.replace("[readOnlyAccess]", readOnlyAccess); + DbUtils.executeUpdate(updateUserAccessSql); + } // updateUserAccess + + public void removeUserAccess(String userID) throws Exception { + reportUsers.remove(userID); + + String removeUserAccessSql= Globals.getRemoveUserAccess(); + removeUserAccessSql = removeUserAccessSql.replace("[reportID]", reportID); + removeUserAccessSql = removeUserAccessSql.replace("[userID]", userID); + DbUtils.executeUpdate(removeUserAccessSql); + } // removeUserAccess + + public void addRoleAccess(String roleID, String readOnlyAccess) throws Exception { + validateReadOnlyAccess(readOnlyAccess); + reportRoles.put(roleID, readOnlyAccess); + String addRoleAccessSql= Globals.getAddRoleAccess(); + addRoleAccessSql = addRoleAccessSql.replace("[reportID]", reportID); + addRoleAccessSql = addRoleAccessSql.replace("[roleID]", roleID); + addRoleAccessSql = addRoleAccessSql.replace("[readOnlyAccess]", readOnlyAccess); + DbUtils + .executeUpdate(addRoleAccessSql); + } // addRoleAccess + + public void updateRoleAccess(String roleID, String readOnlyAccess) throws Exception { + validateReadOnlyAccess(readOnlyAccess); + reportRoles.remove(roleID); + reportRoles.put(roleID, readOnlyAccess); + String updateRoleAccessSql= Globals.getUpdateRoleAccess(); + updateRoleAccessSql = updateRoleAccessSql.replace("[reportID]", reportID); + updateRoleAccessSql = updateRoleAccessSql.replace("[roleID]", roleID); + updateRoleAccessSql = updateRoleAccessSql.replace("[readOnlyAccess]", readOnlyAccess); + DbUtils.executeUpdate(updateRoleAccessSql); + } // updateRoleAccess + + public void removeRoleAccess(String roleID) throws Exception { + reportRoles.remove(roleID); + String removeRoleAccessSql= Globals.getRemoveRoleAccess(); + removeRoleAccessSql = removeRoleAccessSql.replace("[reportID]", reportID); + removeRoleAccessSql = removeRoleAccessSql.replace("[roleID]", roleID); + DbUtils.executeUpdate(removeRoleAccessSql); + } // removeRoleAccess + + /** ************************************************************* */ + + public void checkUserReadAccess(HttpServletRequest request, String userID) throws RaptorException { + if(userID == null) + userID = AppUtils.getUserID(request); + if(userID != null) { + //userID = AppUtils.getUserID(request); + if (nvl(reportID).equals("-1")) + return; + + if (true) //todo: replace with proper check isPublic + return; + + if (userID.equals(ownerID)) + return; + + if (reportUsers.get(userID) != null) + return; + } + Vector userRoles = null; + String userName = null; + if(userID == null) { + userRoles = AppUtils.getUserRoles(request); + userName = AppUtils.getUserName(request); + userID = AppUtils.getUserID(request); + } else { + userRoles = AppUtils.getUserRoles(userID); + userName = AppUtils.getUserName(userID); + } + if (nvl(reportID).equals("-1")) + return; + + if (isPublic) + return; + + if (userID.equals(ownerID)) + return; + + if (reportUsers.get(userID) != null) + return; + + for (Iterator iter = userRoles.iterator(); iter.hasNext();) { + String userRole = (String) iter.next(); + if (nvl(userRole).equals(AppUtils.getSuperRoleID())) + return; + } + for (Iterator iter = userRoles.iterator(); iter.hasNext();) { + String userRole = (String) iter.next(); + + if (nvl(userRole).equals(AppUtils.getSuperRoleID())) + return; + + if (reportRoles.get(userRole) != null) + return; + + for (Iterator iterA = AppUtils.getAdminRoleIDs().iterator(); iterA.hasNext();) + if (nvl(userRole).equals((String) iterA.next())) + return; + } // for + + throw new UserAccessException(reportID, "[" + userID + "] " + + userName, AppConstants.UA_READ); + } // checkUserReadAccess + + public void checkUserWriteAccess(HttpServletRequest request) throws RaptorException { + String userID = AppUtils.getUserID(request); + if (nvl(reportID).equals("-1")) + return; + + if (userID.equals(ownerID)) + return; + + if (nvl((String) reportUsers.get(userID)).equals("N")) + return; + + for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();) { + String userRole = (String) iter.next(); + + if (nvl(userRole).equals(AppUtils.getSuperRoleID())) + return; + + if (nvl((String) reportRoles.get(userRole)).equals("N")) + return; + + for (Iterator iterA = AppUtils.getAdminRoleIDs().iterator(); iterA.hasNext();) + if (nvl(userRole).equals((String) iterA.next())) + return; + } // for + + throw new UserAccessException(reportID, "[" + userID + "] " + + AppUtils.getUserName(request), AppConstants.UA_WRITE); + } // checkUserWriteAccess + + public void checkUserDeleteAccess(HttpServletRequest request) throws RaptorException { + String userID = AppUtils.getUserID(request); + if (Globals.getDeleteOnlyByOwner()) { + if (!userID.equals(ownerID)) + throw new UserAccessException(reportID, "[" + userID + "] " + + AppUtils.getUserName(request), AppConstants.UA_DELETE); + } else + checkUserWriteAccess(request); + } // checkUserDeleteAccess + +} // ReportSecurity diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportWrapper.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportWrapper.java new file mode 100644 index 0000000..f856318 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportWrapper.java @@ -0,0 +1,5719 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.base; + +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.TreeSet; +import java.util.Vector; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServletRequest; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.transform.stream.StreamResult; + +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException; +import org.openecomp.portalsdk.analytics.error.UserDefinedException; +import org.openecomp.portalsdk.analytics.model.DataCache; +import org.openecomp.portalsdk.analytics.model.ReportLoader; +import org.openecomp.portalsdk.analytics.model.definition.TableSource; +import org.openecomp.portalsdk.analytics.model.runtime.FormField; +import org.openecomp.portalsdk.analytics.model.runtime.ReportParamValues; +import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime; +import org.openecomp.portalsdk.analytics.system.AppUtils; +import org.openecomp.portalsdk.analytics.system.ConnectionUtils; +import org.openecomp.portalsdk.analytics.system.DbUtils; +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; +import org.openecomp.portalsdk.analytics.util.DataSet; +import org.openecomp.portalsdk.analytics.util.SQLCorrector; +import org.openecomp.portalsdk.analytics.util.Utils; +import org.openecomp.portalsdk.analytics.xmlobj.ChartAdditionalOptions; +import org.openecomp.portalsdk.analytics.xmlobj.ChartDrillFormfield; +import org.openecomp.portalsdk.analytics.xmlobj.ChartDrillOptions; +import org.openecomp.portalsdk.analytics.xmlobj.ColFilterList; +import org.openecomp.portalsdk.analytics.xmlobj.ColFilterType; +import org.openecomp.portalsdk.analytics.xmlobj.CustomReportType; +import org.openecomp.portalsdk.analytics.xmlobj.DashboardEditorList; +import org.openecomp.portalsdk.analytics.xmlobj.DashboardReports; +import org.openecomp.portalsdk.analytics.xmlobj.DashboardReportsNew; +import org.openecomp.portalsdk.analytics.xmlobj.DataColumnList; +import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType; +import org.openecomp.portalsdk.analytics.xmlobj.DataSourceList; +import org.openecomp.portalsdk.analytics.xmlobj.DataSourceType; +import org.openecomp.portalsdk.analytics.xmlobj.DataminingOptions; +import org.openecomp.portalsdk.analytics.xmlobj.FormFieldList; +import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType; +import org.openecomp.portalsdk.analytics.xmlobj.FormatList; +import org.openecomp.portalsdk.analytics.xmlobj.FormatType; +import org.openecomp.portalsdk.analytics.xmlobj.JavascriptItemType; +import org.openecomp.portalsdk.analytics.xmlobj.JavascriptList; +import org.openecomp.portalsdk.analytics.xmlobj.Marker; +import org.openecomp.portalsdk.analytics.xmlobj.ObjectFactory; +import org.openecomp.portalsdk.analytics.xmlobj.PDFAdditionalOptions; +import org.openecomp.portalsdk.analytics.xmlobj.PredefinedValueList; +import org.openecomp.portalsdk.analytics.xmlobj.ReportMap; +import org.openecomp.portalsdk.analytics.xmlobj.Reports; +import org.openecomp.portalsdk.analytics.xmlobj.SemaphoreList; +import org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; + +/**
    + * This class is part of RAPTOR (Rapid Application Programming Tool for OLAP Reporting)
    + *
    + * + * --------------------------------------------------------------------------------------------------
    + * ReportWrapper.java - This is the base class for the RAPTOR. This involves in creating,
    + * modifying, running RAPTOR reports.
    + * --------------------------------------------------------------------------------------------------
    + * + * + * Change Log

    + * + * 31-Aug-2009 : Version 8.5.1 (Sundar);
    • All the elements in the meta xml is copied to the target reports.
    + * 18-Aug-2009 : Version 8.5.1 (Sundar);
    • request Object is passed to prevent caching user/roles - Datamining/Hosting.
    + * 27-Jul-2009 : Version 8.4 (Sundar);
    • verifySQLBasedReportAccess method checks for Admin user instead of super user.
    + * 09-Jul-2009 : Version 8.4 (Sundar);
    • Bug due to parsing and removing formfields from "and" is bulletproofed to the right "and" to which the formfield is associated.
    + * 08-Jul-2009 : Version 8.4 (Sundar);
    • Bug due to parsing and removing formfields when there is no parameter for Daytona specific database is resolved.
    + * 29-Jun-2009 : Version 8.4 (Sundar);
    • isLastSeriesALineChart() and setLastSeriesALineChart(String value) method have been added for the Bar Chart enhancements.
    + * 23-Jun-2009 : Version 8.4 (Sundar);
    • check for cr.getChartAdditionalOptions() for null value is added.
    + * 22-Jun-2009 : Version 8.4 (Sundar);
    • Wrapper functions to call JAXB were added. These Wrapper + * functions are related to the Pareto chart, Time Difference Chart, Multiple Pie Chart and generic Chart Options.
    + * + */ + +public class ReportWrapper extends org.openecomp.portalsdk.analytics.RaptorObject { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportWrapper.class); + + + protected CustomReportType cr = null; + + protected Vector allColumns = null; + + protected Vector allVisibleColumns = null; + + protected Vector allFilters = null; + + protected String generatedSQL = null; + + protected String generatedChartSQL = null; + + protected String wholeSQL = null; // For display purposes only + + + protected String reportID = null; + + protected String menuID = ""; + + protected boolean menuApproved = false; + + protected String reportDefType = ""; + + protected ReportSecurity reportSecurity = null; + + protected String reportSQLWithRowNum = null; + + protected String reportSQLOnlyFirstPart = null; + + + private ReportWrapper(CustomReportType cr, String reportID, ReportSecurity reportSecurity) { + super(); + + if (reportID == null) + reportID = "-1"; + + this.cr = cr; + this.reportID = reportID; + + this.reportSecurity = reportSecurity; + } // ReportWrapper + + public ReportWrapper(ReportWrapper rw) { + this(rw.getCustomReport(), // .cloneCustomReport() + rw.getReportID(), rw.reportSecurity); + + this.menuID = rw.getMenuID(); + this.menuApproved = rw.isMenuApproved(); + + this.reportDefType = rw.getReportDefType(); + } // ReportWrapper + + public ReportWrapper(CustomReportType cr, String reportID, String ownerID, String createID, + String createDate, String updateID, String updateDate, String menuID, + boolean menuApproved) throws RaptorException { + this(cr, reportID, null); + + if (ownerID == null) + // Need to load the report record from the database + if (!reportID.equals("-1")) + try { + /*DataSet ds = DbUtils + .executeQuery("SELECT NVL(cr.owner_id, cr.create_id) owner_id, cr.create_id, TO_CHAR(cr.create_date, '" + + Globals.getOracleTimeFormat() + + "') create_date, maint_id, TO_CHAR(cr.maint_date, '" + + Globals.getOracleTimeFormat() + + "') update_date, cr.menu_id, cr.menu_approved_yn FROM cr_report cr WHERE cr.rep_id=" + + reportID);*/ + + String r_sql = Globals.getReportWrapperFormat(); + r_sql = r_sql.replace("[Globals.getOracleTimeFormat()]", Globals.getOracleTimeFormat()); + r_sql = r_sql.replace("[reportID]", reportID); + + DataSet ds = DbUtils + .executeQuery(r_sql); + + ownerID = ds.getString(0, 0); + createID = ds.getString(0, 1); + createDate = ds.getString(0, 2); + updateID = ds.getString(0, 3); + updateDate = ds.getString(0, 4); + menuID = nvl(ds.getString(0, 5)); + menuApproved = nvl(ds.getString(0, 6)).equals("Y"); + } catch (Exception e) { + String eMsg = "ReportWrapper.ReportWrapper: Unable to load report record details. Exception: " + + e.getMessage(); + //Log.write(eMsg); + logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] "+ eMsg)); + throw new RaptorRuntimeException(eMsg); + } + + this.menuID = nvl(menuID); + this.menuApproved = menuApproved; + + if (!reportID.equals("-1")) + updateReportDefType(); + + reportSecurity = new ReportSecurity(reportID, ownerID, createID, createDate, updateID, + updateDate, cr.isPublic()); + } // ReportWrapper + + public CustomReportType getCustomReport() { + return cr; + } + + public String getReportID() { + return reportID; + } + + public String getMenuID() { + return menuID; + } + + public boolean checkMenuIDSelected(String chkMenuID) { + return ("|" + menuID + "|").indexOf("|" + chkMenuID + "|") >= 0; + } + + public boolean isMenuApproved() { + return menuApproved; + } + + public String getReportDefType() { + return reportDefType; + } + + public void setMenuID(String menuID) { + this.menuID = menuID; + } + + public void setMenuApproved(boolean menuApproved) { + this.menuApproved = menuApproved; + } + + public void setReportDefType(String reportDefType) { + this.reportDefType = reportDefType; + } + + public void updateReportDefType() { + this.reportDefType = (nvl(cr.getReportSQL()).length() > 0) ? ((cr.getDataminingOptions()!=null && nvl(cr.getDataminingOptions().getClassifier()).length()>0) ? + AppConstants.RD_SQL_BASED_DATAMIN:AppConstants.RD_SQL_BASED) + : AppConstants.RD_VISUAL; + } + + public String getJavascriptElement() { + return cr.getJavascriptElement(); + } + + public int getPageSize() { + return cr.getPageSize()==null?50:cr.getPageSize(); + } + + public int getMaxRowsInExcelDownload() { + return cr.getMaxRowsInExcelDownload()==null?500:cr.getMaxRowsInExcelDownload(); + } + + public boolean isDisplayFolderTree() { + return cr.isDisplayFolderTree()!=null?cr.isDisplayFolderTree().booleanValue():false; + } + + public boolean isHideFormFieldAfterRun() { + return cr.isHideFormFieldAfterRun()!=null?cr.isHideFormFieldAfterRun().booleanValue():false; + } + + public void setHideFormFieldAfterRun(boolean hideFormFieldAfterRun) { + cr.setHideFormFieldAfterRun(hideFormFieldAfterRun); + } + + public boolean isReportInNewWindow() { + return cr.isReportInNewWindow()!=null?cr.isReportInNewWindow().booleanValue():false; + } + + public String getReportType() { + return cr.getReportType(); + } + + public String getReportName() { + return cr.getReportName(); + } + + public String getDBInfo() { + return cr.getDbInfo(); + } + + public String getDBType() { + return cr.getDbType(); + } + + public boolean isDrillDownURLInPopupPresent() { + return cr.isDrillURLInPoPUpPresent()!=null?cr.isDrillURLInPoPUpPresent().booleanValue():false; + } + + public void setDrillDownURLInPopupPresent(boolean value) { + cr.setDrillURLInPoPUpPresent(value); + } + + public String getReportDescr() { + return cr.getReportDescr(); + } + + public String getChartType() { + return cr.getChartType(); + } + + public boolean displayChartTitle() { + return cr.isShowChartTitle(); + } + + public void setShowChartTitle(boolean showTitle) { + cr.setShowChartTitle(showTitle); + } + + + public String getChartTypeFixed() { + return cr.getChartTypeFixed(); + } + + public boolean isChartTypeFixed() { + return nvl(cr.getChartTypeFixed()).length() > 0 ? cr.getChartTypeFixed().equals("Y") + : (!Globals.getAllowRuntimeChartSel()); + } + + public String getChartLeftAxisLabel() { + return cr.getChartLeftAxisLabel(); + } + + public String getChartRightAxisLabel() { + return cr.getChartRightAxisLabel(); + } + + public String getChartWidth() { + return cr.getChartWidth(); + } + + public int getChartWidthAsInt() { + return getIntValue(cr.getChartWidth(), Globals.getDefaultChartWidth()); + } + + public String getChartHeight() { + return cr.getChartHeight()==null?"500":cr.getChartHeight(); + } + + /*public boolean isChartMultiSeries() { + //String s = cr.getChartMultiSeries(); + return + return (nvl(s).length()>0)? (s.equals("Y")||s.equals("y")||s.equalsIgnoreCase("true")?true:false):true; + }*/ + + public boolean displayPieOrderinRunPage() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartMultiplePieOrder():""; + if(nvl(s).indexOf("|")!= -1) { + s = s.substring(s.indexOf("|")+1); + return getFlagInBoolean(s); + } else return false; + } + + public boolean isMultiplePieOrderByRow() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartMultiplePieOrder():""; + if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|")); + return (nvl(s).length()>0)? (s.equals("row")?true:false):true; + } + + public boolean isMultiplePieOrderByColumn() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartMultiplePieOrder():""; + if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|")); + return (nvl(s).length()>0)&&(s.equals("column"))?true:false; + } + + public boolean displayPieLabelDisplayinRunPage() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartMultiplePieLabelDisplay():""; + if(nvl(s).indexOf("|")!= -1) { + s = s.substring(s.indexOf("|")+1); + return getFlagInBoolean(s); + } else return false; + } + + public String getMultiplePieLabelDisplay() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartMultiplePieLabelDisplay():""; + if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|")); + return s; + } + + public boolean displayChartDisplayinRunPage() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartDisplay():""; + if(nvl(s).indexOf("|")!= -1) { + s = s.substring(s.indexOf("|")+1); + return getFlagInBoolean(s); + } else return false; + } + + public boolean isChartDisplayIn3D() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartDisplay():""; + if(nvl(s).length()<=0) return true; + if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|")); + return (nvl(s).length()>0)&&(s.equals("3D"))?true:false; + } + + public boolean displayChartOrientationInRunPage() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartOrientation():""; + if(nvl(s).indexOf("|")!= -1) { + s = s.substring(s.indexOf("|")+1); + return getFlagInBoolean(s); + } else return false; + + } + + public String getLinearRegression() { + String s = ""; + s = nvl((cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getLinearRegression():"Y"); + return s; + } + + public void setLinearRegression(String linear) { + cr.getChartAdditionalOptions().setLinearRegression(linear); + } + + public String getLinearRegressionColor() { + return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getLinearRegressionColor():""; + } + + public String getCustomizedRegressionPoint() { + return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getMaxRegression():""; + } + + public void setCustomizedRegressionPoint( String d) { + cr.getChartAdditionalOptions().setMaxRegression(d); + } + + public void setLinearRegressionColor(String color) { + cr.getChartAdditionalOptions().setLinearRegressionColor(color); + } + + public String getExponentialRegressionColor() { + return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getExponentialRegressionColor():""; + } + + public void setExponentialRegressionColor(String color) { + cr.getChartAdditionalOptions().setExponentialRegressionColor(color); + } + + public void setRangeAxisUpperLimit(String d) { + if(cr.getChartAdditionalOptions()!=null) + cr.getChartAdditionalOptions().setRangeAxisUpperLimit(d); + } + + public void setRangeAxisLowerLimit(String d) { + if(cr.getChartAdditionalOptions()!=null) + cr.getChartAdditionalOptions().setRangeAxisLowerLimit(d); + } + + public String getRangeAxisUpperLimit() { + return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getRangeAxisUpperLimit():""; + } + + public String getRangeAxisLowerLimit() { + return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getRangeAxisLowerLimit():""; + } + + public boolean isChartAnimate() { + return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isAnimate()!=null?cr.getChartAdditionalOptions().isAnimate():false):false; + } + + public boolean isAnimateAnimatedChart() { + return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isAnimateAnimatedChart()!=null?cr.getChartAdditionalOptions().isAnimateAnimatedChart():false):true; + } + + public void setAnimateAnimatedChart(boolean animate) { + cr.getChartAdditionalOptions().setAnimateAnimatedChart(animate); + } + + public void setChartStacked(boolean stacked) { + cr.getChartAdditionalOptions().setStacked(stacked); + } + + public boolean isChartStacked() { + return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isStacked()!=null?cr.getChartAdditionalOptions().isStacked():true):false; + } + + public void setBarControls(boolean barControls) { + cr.getChartAdditionalOptions().setBarControls(barControls); + } + + public boolean displayBarControls() { + return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isBarControls()!=null?cr.getChartAdditionalOptions().isBarControls():false):false; + } + + public void setXAxisDateType(boolean dateType) { + cr.getChartAdditionalOptions().setXAxisDateType(dateType); + } + + public boolean isXAxisDateType() { + return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isXAxisDateType()!=null?cr.getChartAdditionalOptions().isXAxisDateType():false):false; + } + + public void setLessXaxisTickers(boolean lessTickers) { + cr.getChartAdditionalOptions().setLessXaxisTickers(lessTickers); + } + + public boolean isLessXaxisTickers() { + return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isLessXaxisTickers()!=null?cr.getChartAdditionalOptions().isLessXaxisTickers():false):false; + } + + public void setTimeAxis(boolean timeAxis) { + cr.getChartAdditionalOptions().setTimeAxis(timeAxis); + } + + public boolean isTimeAxis() { + return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isTimeAxis()!=null?cr.getChartAdditionalOptions().isTimeAxis():true):true; + } + + public void setLogScale(boolean logScale) { + cr.getChartAdditionalOptions().setLogScale(logScale); + } + + public boolean isLogScale() { + return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isLogScale()!=null?cr.getChartAdditionalOptions().isLogScale():false):false; + } + + + public void setMultiSeries(boolean multiSeries) { + cr.getChartAdditionalOptions().setMultiSeries(multiSeries); + cr.setChartMultiSeries(multiSeries?"Y":"N"); + } + + public boolean isMultiSeries() { + if(AppUtils.nvl(cr.getChartMultiSeries()).equals("Y")) + cr.getChartAdditionalOptions().setMultiSeries(true); + return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isMultiSeries()!=null?cr.getChartAdditionalOptions().isMultiSeries():false):false; + } + + public void setTimeSeriesRender(String timeSeriesRenderer) { + cr.getChartAdditionalOptions().setTimeSeriesRender(timeSeriesRenderer); + } + + public String getTimeSeriesRender() { + return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getTimeSeriesRender():"line"; + } + + public void setShowXAxisLabel(boolean showXaxisLabel) { + cr.getChartAdditionalOptions().setShowXAxisLabel(showXaxisLabel); + } + + public boolean isShowXaxisLabel() { + return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isShowXAxisLabel()!=null?cr.getChartAdditionalOptions().isShowXAxisLabel():false):false; + } + + public void setAddXAxisTickers(boolean addXAxisTickers) { + cr.getChartAdditionalOptions().setAddXAxisTickers(addXAxisTickers); + } + + public boolean isAddXAxisTickers() { + return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().isAddXAxisTickers()!=null?cr.getChartAdditionalOptions().isAddXAxisTickers():false):true; + } + + public void setZoomIn(Integer zoomIn) { + cr.getChartAdditionalOptions().setZoomIn(zoomIn); + } + + public Integer getZoomIn() { + return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().getZoomIn()!=null?cr.getChartAdditionalOptions().getZoomIn():new Integer("25")): new Integer("25"); + } + + public void setTimeAxisType(String timeAxisType) { + cr.getChartAdditionalOptions().setTimeAxisType(timeAxisType); + } + + public String getTimeAxisType() { + return (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().getTimeAxisType()!=null?cr.getChartAdditionalOptions().getTimeAxisType():"hourly"): "hourly"; + } + + public void setTopMargin(Integer topMargin) { + cr.getChartAdditionalOptions().setTopMargin(topMargin); + } + + public Integer getTopMargin() { + return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getTopMargin(): new Integer("30"); + } + + public void setBottomMargin(Integer bottomMargin) { + cr.getChartAdditionalOptions().setBottomMargin(bottomMargin); + } + + public Integer getBottomMargin() { + return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getBottomMargin(): new Integer("50"); + } + + public void setRightMargin(Integer rightMargin) { + cr.getChartAdditionalOptions().setRightMargin(rightMargin); + } + + public Integer getRightMargin() { + return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getRightMargin(): new Integer("60"); + } + + public void setLeftMargin(Integer leftMargin) { + cr.getChartAdditionalOptions().setLeftMargin(leftMargin); + } + + public Integer getLeftMargin() { + return (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getLeftMargin(): new Integer("100"); + } + + + public boolean isVerticalOrientation() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartOrientation():""; + if(nvl(s).length()<=0) return true; + if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|")); + return (nvl(s).length()>0)&&(s.equals("vertical"))?true:false; + } + + public boolean isHorizontalOrientation() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getChartOrientation():""; + if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|")); + return (nvl(s).length()>0)&&(s.equals("horizontal"))?true:false; + } + + public boolean displaySecondaryChartRendererInRunPage() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getSecondaryChartRenderer():""; + if(nvl(s).indexOf("|")!= -1) { + s = s.substring(s.indexOf("|")+1); + return getFlagInBoolean(s); + } else return false; + + } + + public String getSecondaryChartRenderer() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getSecondaryChartRenderer():""; + if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|")); + return s; + } + + public String getOverlayItemValueOnStackBar() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getOverlayItemValueOnStackBar():"N"; + return s; + } + + public boolean displayIntervalInputInRunPage() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getIntervalFromdate():""; + if(nvl(s).indexOf("|")!= -1) { + s = s.substring(s.indexOf("|")+1); + return getFlagInBoolean(s); + } else return false; + } + + public boolean showLegendDisplayOptionsInRunPage() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getHidechartLegend():""; + if(nvl(s).indexOf("|")!= -1) { + s = s.substring(s.indexOf("|")+1); + return getFlagInBoolean(s); + } else return false; + } + + public String getIntervalFromdate() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getIntervalFromdate():""; + if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|")); + return nvl(s,""); + } + + public String getIntervalTodate() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getIntervalTodate():""; + if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|")); + return nvl(s,""); + } + + public String getIntervalLabel() { + return cr.getChartAdditionalOptions()!=null ? nvl(cr.getChartAdditionalOptions().getIntervalLabel()):""; + } + + public String getLegendPosition() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getLegendPosition():""; + return nvl(s,"bottom"); + } + + public String getLegendLabelAngle() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getLabelAngle():""; + return nvl(s,"UP90"); + } + + public String getMaxLabelsInDomainAxis() { + String s = ""; + s = (cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getMaxLabelsInDomainAxis():""; + return nvl(s,"99"); + } + + public boolean isLastSeriesALineChart() { + String s = ""; + s = nvl((cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getLastSeriesALineChart():""); + return s.equals("Y"); + } + + public boolean isLastSeriesABarChart() { + String s = ""; + s = nvl((cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getLastSeriesABarChart():""); + return s.equals("Y"); + } + + public void setChartLegendDisplay(String value) { + cr.getChartAdditionalOptions().setHidechartLegend(value); + } + + public boolean hideChartLegend() { + String s = ""; + s = nvl((cr.getChartAdditionalOptions()!=null)?cr.getChartAdditionalOptions().getHidechartLegend():"N"); + if(nvl(s).length()<=0) s = "N"; + if(nvl(s).indexOf("|")!= -1) s = s.substring(0, s.indexOf("|")); + return s.equals("Y"); + } + + public void setChartToolTips(String value) { + cr.getChartAdditionalOptions().setHideToolTips(value); + } + + public void setDomainAxisValuesAsString(String value) { + cr.getChartAdditionalOptions().setKeepDomainAxisValueAsString(value); + } + + public boolean hideChartToolTips() { + boolean s = true; + s = (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().getHideToolTips()!=null? + (cr.getChartAdditionalOptions().getHideToolTips().equals("Y")?true:false):(Globals.hideToolTipsGlobally()?true:false)):(Globals.hideToolTipsGlobally()?true:false); + return s; + } + + public boolean keepDomainAxisValueInChartAsString() { + boolean s = true; + s = (cr.getChartAdditionalOptions()!=null)?(cr.getChartAdditionalOptions().getKeepDomainAxisValueAsString()!=null? + (cr.getChartAdditionalOptions().getKeepDomainAxisValueAsString().equals("Y")?true:false):false):false; + return s; + } + + public int getChartHeightAsInt() { + return getIntValue(cr.getChartHeight(), Globals.getDefaultChartHeight()); + } + + public boolean isPublic() { + return cr.isPublic(); + } + + public boolean isDashboardType() throws RaptorException { + return cr.isDashboardType()!=null?cr.isDashboardType().booleanValue():false; + } + + // public String getCreateId() { return cr.getCreateId(); } + // public Calendar getCreateDate() { return cr.getCreateDate(); } + public String getReportSQL() { + return cr.getReportSQL(); + } + + public String getReportTitle() { + return cr.getReportTitle(); + } + + public String getReportSubTitle() { + return cr.getReportSubTitle(); + } + + public String getReportHeader() { + return cr.getReportHeader(); + } + + public String getReportFooter() { + return cr.getReportFooter(); + } + + public String getNumDashCols() { + return cr.getNumDashCols(); + } + + public int getNumDashColsAsInt() { + return getIntValue(cr.getNumDashCols(), 1); + } + + public String getNumFormCols() { + return cr.getNumFormCols(); + } + + public int getNumFormColsAsInt() { + return getIntValue(cr.getNumFormCols(), 5); + } + + public String getDisplayOptions() { + return cr.getDisplayOptions(); + } + + + +//Additional Methods + + public int getJumpTo() { + return cr.getJumpTo()==null?1:cr.getJumpTo(); + } + public void setJumpTo(int value){ + cr.setJumpTo(value); + } + + + public int getSearchPageSize(){ + return cr.getSearchPageSize()==null?20:cr.getSearchPageSize(); + } + public void setSearchPageSize(int value){ + cr.setSearchPageSize(value); + } + + + public boolean isToggleLayout(){ + if(cr.isToggleLayout()!=null) + return cr.isToggleLayout(); + + else + return Globals.displayRuntimeOptionsAsDefault(); + + } + public void setToggleLayout(boolean value){ + cr.setToggleLayout(value); + } + + public boolean isShowPageSize(){ + if(cr.isShowPageSize()!=null) + return cr.isShowPageSize(); + + else + return Globals.displayRuntimeOptionsAsDefault(); + + } + public void setShowPageSize(boolean value){ + cr.setShowPageSize(value); + } + + public boolean isShowNavPos(){ + if(cr.isShowNavPos()!=null) + return cr.isShowNavPos(); + + else + return Globals.displayRuntimeOptionsAsDefault(); + + } + public void setShowNavPos(boolean value){ + cr.setShowNavPos(value); + } + + public boolean isShowGotoOption(){ + if(cr.isShowGotoOption()!=null) + return cr.isShowGotoOption(); + + else + return Globals.displayRuntimeOptionsAsDefault(); + + } + public void setShowGotoOption(boolean value){ + cr.setShowGotoOption(value); + } + + public boolean isPageNav(){ + + if(cr.isPageNav()!=null) + return cr.isPageNav(); + + else + return Globals.displayRuntimeOptionsAsDefault(); + + } + + public void setPageNav(boolean value){ + cr.setPageNav(value); + } + + + public String getNavPosition(){ + if(cr.getNavPosition()!=null) + return cr.getNavPosition(); + + else + return "top"; + //return cr.getNavPosition(); + } + public void setNavPosition(String value){ + cr.setNavPosition(value); + } + + + public String getDashboardEditor(){ + return getDashBoardReportsNew().getDashboardEditor(); + } + + public void setDashboardEditor(String value){ + getDashBoardReportsNew().setDashboardEditor(value); + } + + + public DashboardEditorList getDashboardEditorList(){ + return getDashBoardReportsNew().getDashboardEditorList(); + } + + public void setDashboardEditorList(DashboardEditorList value){ + getDashBoardReportsNew().setDashboardEditorList(value); + } + + public PDFAdditionalOptions getPDFAdditionalOptions() { + try { + if(cr.getPdfAdditionalOptions()==null) + addPDFAdditionalOptions(new ObjectFactory()); + } catch(RaptorException ex) { + ex.printStackTrace(); + } + return cr.getPdfAdditionalOptions(); + } + + public String getPDFFont(){ + return getPDFAdditionalOptions().getPDFFont()!=null?getPDFAdditionalOptions().getPDFFont():Globals.getDataFontFamily(); + } + public void setPDFFont(String value){ + getPDFAdditionalOptions().setPDFFont(value); + } + + public int getPDFFontSize() { + return getPDFAdditionalOptions().getPDFFontSize()==null?9:getPDFAdditionalOptions().getPDFFontSize(); + } + public void setPDFFontSize(int value){ + getPDFAdditionalOptions().setPDFFontSize(value); + } + + public String getPDFOrientation(){ + return getPDFAdditionalOptions().getPDFOrientation()!=null?"portrait":"landscape"; + } + public void setPDFOrientation(String value){ + getPDFAdditionalOptions().setPDFOrientation(value); + } + + public String getPDFLogo1(){ + return getPDFAdditionalOptions().getPDFLogo1(); + } + public void setPDFLogo1(String value){ + getPDFAdditionalOptions().setPDFLogo1(value); + } + + public String getPDFLogo2(){ + return getPDFAdditionalOptions().getPDFLogo2(); + } + public void setPDFLogo2(String value){ + getPDFAdditionalOptions().setPDFLogo2(value); + } + + public int getPDFLogo1Size() { + return getPDFAdditionalOptions().getPDFLogo1Size()==null?0:getPDFAdditionalOptions().getPDFLogo1Size(); + } + public void setPDFLogo1Size(int value){ + getPDFAdditionalOptions().setPDFLogo1Size(value); + } + + public int getPDFLogo2Size() { + return getPDFAdditionalOptions().getPDFLogo2Size()==null?0:getPDFAdditionalOptions().getPDFLogo2Size(); + } + public void setPDFLogo2Size(int value){ + getPDFAdditionalOptions().setPDFLogo2Size(value); + } + + public boolean isPDFCoverPage(){ + + if(getPDFAdditionalOptions().isPDFCoverPage()!=null) + return getPDFAdditionalOptions().isPDFCoverPage(); + + else + return true; + + } + + public void setPDFCoverPage(boolean value){ + getPDFAdditionalOptions().setPDFCoverPage(value); + } + + public String getPDFFooter1(){ + return getPDFAdditionalOptions().getPDFFooter1(); + } + public void setPDFFooter1(String value){ + getPDFAdditionalOptions().setPDFFooter1(value); + } + + public String getPDFFooter2(){ + return getPDFAdditionalOptions().getPDFFooter2(); + } + public void setPDFFooter2(String value){ + getPDFAdditionalOptions().setPDFFooter2(value); + } + + + +//End of Additional Methods + + public String getDataContainerHeight() { + return cr.getDataContainerHeight(); + } + + public String getDataContainerWidth() { + return cr.getDataContainerWidth(); + } + + public boolean isAllowSchedule() { + String allowSchedule = getAllowSchedule(); + return (allowSchedule !=null )? allowSchedule.startsWith("Y"):false; + } + + public String getAllowSchedule() { + return cr.getAllowSchedule(); + } + + /* Multi Group */ + + public boolean isMultiGroupColumn() { + String multiGroupColumn = getMultiGroupColumn(); + return (multiGroupColumn !=null )? multiGroupColumn.startsWith("Y"):false; + } + + public String getMultiGroupColumn() { + return cr.getMultiGroupColumn(); + } + + public void setMultiGroupColumn(String value) { + cr.setMultiGroupColumn(value); + } + + private int getColumnGroupLevel(String colId) throws RaptorException { + DataColumnType dc = getColumnById(colId); + return (dc == null) ? 0 : dc.getLevel(); + } // getColumnGroupLevel + + public int getMaxGroupLevel() { + List reportCols = getAllColumns(); + int maxLevel = 0; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if (dc.getLevel()!=null) { + if(maxLevel < dc.getLevel()) + maxLevel = dc.getLevel(); + } + } // for + return maxLevel; + } // getMaxGroupLevel + + private int getColumnGroupStart(String colId) throws RaptorException { + DataColumnType dc = getColumnById(colId); + return (dc == null) ? 0 : dc.getStart(); + } // getColumnGroupStart + + private int getColumnGroupColSpan(String colId) throws RaptorException { + DataColumnType dc = getColumnById(colId); + return (dc == null) ? 0 : dc.getColspan(); + } // getColumnGroupColSpan + + public void setTopDown(String value) { + cr.setTopDown(value); + } + + public boolean isTopDown() { + String topDown = getTopDownOption(); + return (topDown !=null )? topDown.startsWith("Y"):false; + } + + public String getTopDownOption() { + return cr.getTopDown(); + } + + public void setSizedByContent(String value) { + cr.setSizedByContent(value); + } + + public boolean isSizedByContent() { + String sizedByContent = getSizedByContentOption(); + return (sizedByContent !=null )? sizedByContent.startsWith("Y"):false; + } + + public String getSizedByContentOption() { + return cr.getSizedByContent(); + } + + public String getDashboardOptions() { + return cr.getDashboardOptions(); + } + + public boolean isDashboardOptionHideChart() { + return nvl(getDashboardOptions()).length() > 0 && (getDashboardOptions().charAt(0) == 'Y'); + } + + public boolean isDashboardOptionHideData() { + return nvl(getDashboardOptions()).length() > 0 && (getDashboardOptions().charAt(1) == 'Y'); + } + + public boolean isDashboardOptionHideBtns() { + return nvl(getDashboardOptions()).length() > 0 && (getDashboardOptions().charAt(2) == 'Y'); + } + + public boolean isDisplayOptionHideForm() { + return nvl(getDisplayOptions()).length() > 0 && (getDisplayOptions().charAt(0) == 'Y'); + } + + public boolean isDisplayOptionHideChart() { + return nvl(getDisplayOptions()).length() > 1 && (getDisplayOptions().charAt(1) == 'Y'); + } + + public boolean isDisplayOptionHideData() { + return nvl(getDisplayOptions()).length() > 2 && (getDisplayOptions().charAt(2) == 'Y'); + } + + public boolean isDisplayOptionHideBtns() { + return nvl(getDisplayOptions()).length() > 3 && (getDisplayOptions().charAt(3) == 'Y'); + } + + public boolean isDisplayOptionHideMap() { + return nvl(getDisplayOptions()).length() > 4 && (getDisplayOptions().charAt(4) == 'Y'); + } + + public boolean isDisplayOptionHideExcelIcons() { + return nvl(getDisplayOptions()).length() > 5 && (getDisplayOptions().charAt(5) == 'Y'); + } + + public boolean isDisplayOptionHidePDFIcons() { + return nvl(getDisplayOptions()).length() > 6 && (getDisplayOptions().charAt(6) == 'Y'); + } + + public String getComment() { + return cr.getComment(); + } + + public DataSourceList getDataSourceList() { + return cr.getDataSourceList(); + } + + public ChartAdditionalOptions getChartAdditionalOptions() { + return cr.getChartAdditionalOptions(); + } + + public ChartDrillOptions getChartDrillOptions() { + return cr.getChartDrillOptions(); + } + + + public DataminingOptions getDataminingOptions() { + return cr.getDataminingOptions(); + } + + public DashboardReports getDashBoardReports() { + return cr.getDashBoardReports(); + } + + + public DashboardReportsNew getDashBoardReportsNew() { + try { + if(cr.getDashBoardReportsNew()==null) + addDashboardReportsNew(new ObjectFactory()); + } catch(RaptorException ex) { + ex.printStackTrace(); + } + return cr.getDashBoardReportsNew(); + } + + public String getDashboardLayoutHTML() { + return cr.getDashboardLayoutHTML(); + } + + public FormFieldList getFormFieldList() { + return cr.getFormFieldList(); + } + + public JavascriptList getJavascriptList() { + return cr.getJavascriptList(); + } + + public SemaphoreList getSemaphoreList() { + return cr.getSemaphoreList(); + } + + public void setPageSize(int value) { + cr.setPageSize(value); + } + + public void setAllowSchedule(String value) { + cr.setAllowSchedule(value); + } + + public void setMaxRowsInExcelDownload(int value) { + cr.setMaxRowsInExcelDownload(value); + } + + public void setReportInNewWindow (boolean value) { + cr.setReportInNewWindow(value); + } + + public void setDisplayFolderTree (boolean value) { + cr.setDisplayFolderTree(value); + } + + public void setReportType(String value) { + cr.setReportType(value); + } + + public void setReportName(String value) { + cr.setReportName(value); + } + + public void setDBInfo(String value) { + if (!(cr.getDbInfo() != null && cr.getDbInfo().length() > 0)) + cr.setDbInfo(value); + } + + public void setDBType(String value) { + if (!(cr.getDbType() != null && cr.getDbType().length() > 0)) + cr.setDbType(value); + } + + public void setReportDescr(String value) { + cr.setReportDescr(value); + } + + public void setChartType(String value) { + cr.setChartType(value); + } + + public void setChartMultiplePieOrder(String value) { + cr.getChartAdditionalOptions().setChartMultiplePieOrder(value); + } + + public void setChartMultiplePieLabelDisplay(String value) { + cr.getChartAdditionalOptions().setChartMultiplePieLabelDisplay(value); + } + + public void setChartOrientation(String value) { + cr.getChartAdditionalOptions().setChartOrientation(value); + } + + public void setSecondaryChartRenderer(String value) { + cr.getChartAdditionalOptions().setSecondaryChartRenderer(value); + } + + public void setOverlayItemValueOnStackBar(String value) { + cr.getChartAdditionalOptions().setOverlayItemValueOnStackBar(value); + } + + public void setIntervalFromdate(String value) { + cr.getChartAdditionalOptions().setIntervalFromdate(value); + } + + public void setIntervalLabel(String value) { + cr.getChartAdditionalOptions().setIntervalLabel(value); + } + + public void setIntervalTodate(String value) { + cr.getChartAdditionalOptions().setIntervalTodate(value); + } + + public void setLegendPosition(String value) { + cr.getChartAdditionalOptions().setLegendPosition(value); + } + + public void setLegendLabelAngle(String value) { + cr.getChartAdditionalOptions().setLabelAngle(value); + } + + public void setMaxLabelsInDomainAxis(String value) { + if(nvl(value).length()<=0) value = "99"; + cr.getChartAdditionalOptions().setMaxLabelsInDomainAxis(value); + } + + public void setLastSeriesALineChart(String value) { + cr.getChartAdditionalOptions().setLastSeriesALineChart(value); + } + + public void setLastSeriesABarChart(String value) { + cr.getChartAdditionalOptions().setLastSeriesABarChart(value); + } + + public void setChartDisplay(String value) { + cr.getChartAdditionalOptions().setChartDisplay(value); + } + + public void setChartAnimate(boolean animate) { + if(cr.getChartAdditionalOptions()!=null) + cr.getChartAdditionalOptions().setAnimate(animate); + else { + try { + if(getChartAdditionalOptions()==null) + addChartAdditionalOptions(new ObjectFactory()); + } catch(RaptorException ex) { + ex.printStackTrace(); + } + if(cr.getChartAdditionalOptions()!=null) + cr.getChartAdditionalOptions().setAnimate(animate); + + } + + } + + public void addChartAdditionalOptions(ObjectFactory objFactory) throws RaptorException { + ChartAdditionalOptions chartOptions = objFactory.createChartAdditionalOptions(); + cr.setChartAdditionalOptions(chartOptions); + } + + public void addDashboardReportsNew(ObjectFactory objFactory) throws RaptorException { + DashboardReportsNew dashboardReports = objFactory.createDashboardReportsNew(); + cr.setDashBoardReportsNew(dashboardReports); + } + + public void addPDFAdditionalOptions(ObjectFactory objFactory) throws RaptorException { + PDFAdditionalOptions pdfOptions = objFactory.createPDFAdditionalOptions(); + cr.setPdfAdditionalOptions(pdfOptions); + } + + public void setChartTypeFixed(String value) { + cr.setChartTypeFixed(value); + } + + public void setChartLeftAxisLabel(String value) { + cr.setChartLeftAxisLabel(value); + } + + public void setChartRightAxisLabel(String value) { + cr.setChartRightAxisLabel(value); + } + + public void setChartWidth(String value) { + cr.setChartWidth(value); + } + + public void setChartHeight(String value) { + cr.setChartHeight(value); + } + + public void setChartMultiSeries(String value) { + cr.setChartMultiSeries(value); + } + + public void setPublic(boolean value) { + cr.setPublic(value); + if (reportSecurity != null) + reportSecurity.setPublic(value); + } + + // public void setCreateId(String value) { cr.setCreateId(value); } + // public void setCreateDate(Calendar value) { cr.setCreateDate(value); } + public void setReportSQL(String value) { + cr.setReportSQL(value); + } + + public void setReportTitle(String value) { + cr.setReportTitle(value); + } + + public void setReportSubTitle(String value) { + cr.setReportSubTitle(value); + } + + public void setReportHeader(String value) { + cr.setReportHeader(value); + } + + public void setReportFooter(String value) { + cr.setReportFooter(value); + } + + public void setNumFormCols(String value) { + cr.setNumFormCols(value); + } + + public void setNumDashCols(String value) { + cr.setNumDashCols(value); + } + + public void setDisplayOptions(String value) { + cr.setDisplayOptions(value); + } + + public void setDataContainerHeight(String value) { + cr.setDataContainerHeight(value); + } + + public void setDataContainerWidth(String value) { + cr.setDataContainerWidth(value); + } + + public void setDashboardOptions(String value) { + cr.setDashboardOptions(value); + } + + public void setComment(String value) { + cr.setComment(value); + } + + public void setDashboardType(boolean dashboardType) { + cr.setDashboardType(dashboardType); + } + + public void setDashboardLayoutHTML(String html) { + cr.setDashboardLayoutHTML(html); + } + + public void setDataSourceList(DataSourceList value) { + cr.setDataSourceList(value); + } + + public void setFormFieldList(FormFieldList value) { + cr.setFormFieldList(value); + } + + public void setDashBoardReports(DashboardReports value) { + cr.setDashBoardReports(value); + } + + public void setSemaphoreList(SemaphoreList value) { + cr.setSemaphoreList(value); + } + + public void setJavascriptList(JavascriptList value) { + cr.setJavascriptList(value); + } + + public void setJavascriptElement(String javascriptElement) { + cr.setJavascriptElement(javascriptElement); + } + + public void checkUserReadAccess(HttpServletRequest request) throws RaptorException { + reportSecurity.checkUserReadAccess(request, null); + } + public void checkUserReadAccess(HttpServletRequest request, String userID) throws RaptorException { + reportSecurity.checkUserReadAccess(request, userID); + } + + public void checkUserWriteAccess(HttpServletRequest request) throws RaptorException { + reportSecurity.checkUserWriteAccess(request); + verifySQLBasedReportAccess(request); + } + + public String getOwnerID() { + return reportSecurity.getOwnerID(); + } + + public String getCreateID() { + return reportSecurity.getCreateID(); + } + + public String getCreateDate() { + return reportSecurity.getCreateDate(); + } + + public String getUpdateID() { + return reportSecurity.getUpdateID(); + } + + public String getUpdateDate() { + return reportSecurity.getUpdateDate(); + } + + public ReportSecurity getReportSecurity() { + return reportSecurity; + } + + /****Report Maps - Start****/ + public ReportMap getReportMap() { + return cr.getReportMap(); + } + + public void setReportMap(ReportMap reportMap) { + cr.setReportMap(reportMap); + } + /****Report Maps - End****/ + + /****Report Chart Drilldown - Start****/ + public ChartDrillOptions getReportChartDrillOptions() { + return cr.getChartDrillOptions(); + } + + public void setReportChartDrillOptions(ChartDrillOptions chartDrillOptions) { + cr.setChartDrillOptions(chartDrillOptions); + } + /****Report Maps - End****/ + + + /** ************************************************************************************************* */ + + public String getFormHelpText() { + String formHelpText = nvl(getComment()); + + if (formHelpText.indexOf('|') >= 0) + formHelpText = formHelpText.substring(formHelpText.lastIndexOf('|') + 1); + + return formHelpText; + } // getFormHelpText + + public void setFormHelpText(String formHelpText) { + String comment = nvl(getComment()); + + if (comment.indexOf('|') >= 0) + comment = comment.substring(0, comment.lastIndexOf('|')); + if (comment.length() > 0) + comment += '|'; + + setComment(comment + formHelpText); + } // setFormHelpText + + public boolean isRuntimeColSortDisabled() { + String comment = nvl(getComment()); + + if (comment.indexOf('|') < 0) + return false; + + return comment.substring(0, comment.indexOf('|')).equals("Y"); + } // isRuntimeColSortDisabled + + public void setRuntimeColSortDisabled(boolean value) { + String comment = nvl(getComment()); + + if (comment.indexOf('|') >= 0) + comment = comment.substring(comment.indexOf('|') + 1); + + setComment((value ? "Y" : "N") + "|" + comment); + } // setRuntimeColSortDisabled + + /** ************************************************************************************************* */ + + protected void verifySQLBasedReportAccess(HttpServletRequest request) throws RaptorException { + String userID = AppUtils.getUserID(request); + if (getReportDefType().equals(AppConstants.RD_SQL_BASED) + && (!Globals.getAllowSQLBasedReports()) && (!AppUtils.isAdminUser(request))) + throw new org.openecomp.portalsdk.analytics.error.UserAccessException(reportID, "[" + userID + "] " + + AppUtils.getUserName(request), AppConstants.UA_WRITE); + } // verifySQLBasedReportAccess + + /** ************************************************************************************************* */ + + private String getColumnNameById(String colId) throws RaptorException { + DataColumnType dc = getColumnById(colId); + return (dc == null) ? "NULL" : dc.getColName(); + } // getColumnNameById + + // Checks if drill-down URL points to individual record display (return + // true) or another report (return false) + private boolean isViewAction(String value) throws RaptorException { + try { + Vector viewActions = org.openecomp.portalsdk.analytics.model.DataCache.getDataViewActions(); + + for (int i = 0; i < viewActions.size(); i++) + if (value.equals(AppUtils.getBaseActionURL() + ((String) viewActions.get(i)))) + return true; + } catch (Exception e) { + throw new RaptorRuntimeException("ReportWrapper.isViewAction Exception: " + + e.getMessage()); + } + + return false; + } // isViewAction + + public String getSelectExpr(DataColumnType dct) { + // String colName = + // dct.isCalculated()?dct.getColName():((nvl(dct.getTableId()).length()>0)?(dct.getTableId()+"."+dct.getColName()):dct.getColName()); + return getSelectExpr(dct, dct.getColName() /* colName */); + } // getSelectExpr + + /*private String getSelectExpr(DataColumnType dct, String colName) { + String colType = dct.getColType(); + if (colType.equals(AppConstants.CT_CHAR) + || ((nvl(dct.getColFormat()).length() == 0) && (!colType + .equals(AppConstants.CT_DATE)))) + return colName; + else + return "TO_CHAR(" + colName + ", '" + + nvl(dct.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT) + "')"; + } // getSelectExpr + */ + + private String getSelectExpr(DataColumnType dct, String colName) { + String colType = dct.getColType(); + if(colType.equals(AppConstants.CT_NUMBER)) { + return colName; + } else + if (colType.equals(AppConstants.CT_CHAR) + || ((nvl(dct.getColFormat()).length() == 0) && (!colType + .equals(AppConstants.CT_DATE)))) + return colName; + + else + return "TO_CHAR(" + colName + ", '" + + nvl(dct.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT) + "')"; + } // getSelectExpr + + + /** ************************************************************************************************* */ + + public DataSourceType getTableById(String tableId) { + for (Iterator iter = getDataSourceList().getDataSource().iterator(); iter.hasNext();) { + DataSourceType ds = (DataSourceType) iter.next(); + if (ds.getTableId().equals(tableId)) + return ds; + } // for + + return null; + } // getTableById + + public DataSourceType getTableByDBName(String tableName) { + for (Iterator iter = getDataSourceList().getDataSource().iterator(); iter.hasNext();) { + DataSourceType ds = (DataSourceType) iter.next(); + if (ds.getTableName().equals(tableName)) + return ds; + } // for + + return null; + } // getTableByDBName + + public DataSourceType getColumnTableById(String colId) { + return getTableById(getColumnById(colId).getTableId()); + } // getColumnTableById + + public DataColumnType getColumnById(String colId) { + List reportCols = getAllColumns(); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if (dc.getColId().toLowerCase().equals(colId.toLowerCase())) + return dc; + } // for + + return null; + } // getColumnById + + public DataColumnType getChartLegendColumn() { + List reportCols = getAllColumns(); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if (nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND)) + return dc; + } // for + return null; + } // getChartLegendColumn + + /* + * public DataColumnType getChartValueColumn() { List reportCols = + * getAllColumns(); for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) { + * DataColumnType dc = (DataColumnType) iter.next(); if(dc.getChartSeq()>0) + * return dc; } // for + * + * return null; } // getChartValueColumn + */ + + public List getChartValueColumnsList( int filter, HashMap formValues) { /*filter; all=0;create without new chart =1; createNewChart=2 */ + List reportCols = getAllColumns(); + + ArrayList chartValueCols = new ArrayList(); + int flag = 0; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + flag = 0; + DataColumnType dc = (DataColumnType) iter.next(); +// if(filter == 2 || filter == 1) { + flag = getDependsOnFormFieldFlag(dc, formValues); + + if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0 ) { + if(!AppUtils.nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND)) { + if(nvl(dc.getChartGroup()).length()<=0) { + if( filter == 2 && (dc.isCreateInNewChart()!=null && dc.isCreateInNewChart().booleanValue())) { + chartValueCols.add(dc); + } else if (filter == 1 && (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) { + chartValueCols.add(dc); + } + else if(filter == 0) chartValueCols.add(dc); + } else chartValueCols.add(dc); + } + } +// } else +// chartValueCols.add(dc); + } // for + Collections.sort(chartValueCols, new ChartSeqComparator()); + return chartValueCols; + } // getChartValueColumnsList + + + /* public ListModelList getChartValueColumnsListModelList( int filter, HashMap formValues) { / *filter; all=0;create without new chart =1; createNewChart=2 * / + List reportCols = getAllColumns(); + + ArrayList chartValueCols = new ArrayList(); + ListModelList chartValueListModelList = new ListModelList(); + int flag = 0; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + flag = 0; + DataColumnType dc = (DataColumnType) iter.next(); +// if(filter == 2 || filter == 1) { + flag = getDependsOnFormFieldFlag(dc, formValues); + + if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0 ) { + if(nvl(dc.getChartGroup()).length()<=0) { + if( filter == 2 && (dc.isCreateInNewChart()!=null && dc.isCreateInNewChart().booleanValue())) { + chartValueCols.add(dc); + } else if (filter == 1 && (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) { + chartValueCols.add(dc); + } + else if(filter == 0) chartValueCols.add(dc); + } else chartValueCols.add(dc); + } +// } else +// chartValueCols.add(dc); + chartValueListModelList.add(new Item(dc.getColId(), dc.getDisplayName())); + } // for + Collections.sort(chartValueCols, new ChartSeqComparator()); + return chartValueListModelList; + } // getChartValueColumnsList */ + + + /** Check whether chart has series (Category) columns **/ + public boolean hasSeriesColumn() { + List reportCols = getAllColumns(); + + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if (dc.isChartSeries()!=null && dc.isChartSeries().booleanValue()) + return true; + } // for + return false; + } // hasSeriesColumn + + + public List getChartDisplayNamesList( int filter, HashMap formValues) { /*filter; all=0;create without new chart =1; createNewChart=2 */ + List reportCols = getAllColumns(); + ArrayList chartValueColNames = new ArrayList(); + int flag = 0; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + flag = 0; + DataColumnType dc = (DataColumnType) iter.next(); +// if(filter == 2 || filter == 1) { + flag = getDependsOnFormFieldFlag(dc, formValues); + + if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0) { + if(nvl(dc.getChartGroup()).length()<=0) { + if( filter == 2 && (dc.isCreateInNewChart()!=null && dc.isCreateInNewChart().booleanValue()) ) { + chartValueColNames.add(dc.getDisplayName()); + } else if (filter == 1 && (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) { + chartValueColNames.add(dc.getDisplayName()); + } + else if(filter == 0) chartValueColNames.add(dc.getDisplayName()); + } else if(filter == 0) chartValueColNames.add(dc.getDisplayName()); + } + // } else + // chartValueColNames.add(dc.getDisplayName()); + + } + return chartValueColNames; + } // getChartDisplayNamesList + + + public List getChartColumnColorsList(int filter, HashMap formValues) { /*filter; all=0;create without new chart =1; createNewChart=2 */ + List reportCols = getAllColumns(); + ArrayList chartValueColColors = new ArrayList(); + int flag = 0; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + flag = 0; + DataColumnType dc = (DataColumnType) iter.next(); +// if(filter == 2 || filter == 1) { + flag = getDependsOnFormFieldFlag(dc, formValues); + + if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0) { + if(nvl(dc.getChartGroup()).length()<=0) { + if( filter == 2 && (dc.isCreateInNewChart()!=null && dc.isCreateInNewChart().booleanValue()) ) { + chartValueColColors.add(dc.getChartColor()); + } else if (filter == 1 && (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) { + chartValueColColors.add(dc.getChartColor()); + } + else if(filter == 0) chartValueColColors.add(dc.getChartColor()); + } else if(filter == 0) chartValueColColors.add(dc.getChartColor()); + } +// } else +// chartValueColColors.add(dc.getChartColor()); + } + return chartValueColColors; + } // getChartColumnColorsList + + public List getChartValueColumnAxisList( int filter, HashMap formValues) { /*filter; all=0;create without new chart =1; createNewChart=2 */ + List reportCols = getAllColumns(); + ArrayList chartValueColAxis = new ArrayList(); + int flag = 0; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + flag = 0; + DataColumnType dc = (DataColumnType) iter.next(); +// if(filter == 2 || filter == 1) { + flag = getDependsOnFormFieldFlag(dc, formValues); + + if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0) { + if(nvl(dc.getChartGroup()).length()<=0) { + if( filter == 2 && (dc.isCreateInNewChart()!=null && dc.isCreateInNewChart().booleanValue())) { + chartValueColAxis.add(nvl(dc.getColOnChart(), "0")); + } else if (filter == 1 && (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) { + chartValueColAxis.add(nvl(dc.getColOnChart(), "0")); + } + else if(filter == 0) chartValueColAxis.add(nvl(dc.getColOnChart(), "0")); + } else if(filter == 0) chartValueColAxis.add(nvl(dc.getColOnChart(), "0")); + } +// } else +// chartValueColAxis.add(nvl(dc.getColOnChart(), "0")); + } + return chartValueColAxis; + } // getChartColumnAxisList + + + public List getChartValueNewChartList() { + ArrayList chartValueNewChartAxis = new ArrayList(); + for (Iterator iter = getChartValueColumnsList(2, null).iterator(); iter.hasNext();) + chartValueNewChartAxis.add(new Boolean(((DataColumnType) iter.next()).isCreateInNewChart())); + return chartValueNewChartAxis; + } // getChartValueNewChartList + + public List getAllChartGroups() { + ArrayList chartGroups = new ArrayList(); + String chartGroupName=""; + List reportCols = getAllColumns(); + Set groupSet = new TreeSet(); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if(dc.getChartSeq()!=null && dc.getChartSeq()> 0) { + chartGroupName = dc.getChartGroup(); + if(nvl(chartGroupName).length()>0) + groupSet.add(chartGroupName); + } + } + List l = new ArrayList(groupSet); + return l; + } // getAllChartGroups + + public HashMap getAllChartYAxis(ReportParamValues reportParamValues) { + String chartYAxis=""; + List reportCols = getAllColumns(); + HashMap hashMap = new HashMap(); + FormFieldList formFieldList = getFormFieldList(); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if(dc.getChartSeq()!=null && dc.getChartSeq()> 0) { + chartYAxis = dc.getYAxis(); + if(formFieldList!=null && reportParamValues!=null) { + for (Iterator iter1 = getFormFieldList().getFormField().iterator(); iter1.hasNext();) { + FormFieldType fft = (FormFieldType) iter1.next(); + String fieldDisplay = getFormFieldDisplayName(fft); + String fieldId = fft.getFieldId(); + if(!fft.getFieldType().equals(FormField.FFT_BLANK) && !fft.getFieldType().equals(FormField.FFT_LIST_MULTI) && !fft.getFieldType().equals(FormField.FFT_TEXTAREA)) { + String paramValue = Utils.oracleSafe(nvl(reportParamValues.getParamValue(fieldId))); + chartYAxis = Utils.replaceInString(chartYAxis, fieldDisplay, nvl( + paramValue, "")); + } + } + } + if(nvl(dc.getChartGroup()).length()>0) + hashMap.put(dc.getChartGroup(),chartYAxis); + } + } + return hashMap; + } // getAllChartGroups + + public List getChartGroupColumnAxisList( String chartGroupName, HashMap formValues ) { /*filter; all=0;create without new chart =1; createNewChart=2 */ + List reportCols = getAllColumns(); + ArrayList chartGroupColAxis = new ArrayList(); + String chartGroup = chartGroupName.substring(0,chartGroupName.lastIndexOf("|")); + int flag = 0; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + flag = 0; + DataColumnType dc = (DataColumnType) iter.next(); +// if(filter == 2 || filter == 1) { + flag = getDependsOnFormFieldFlag(dc, formValues); + + if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0) { + if( nvl(dc.getChartGroup()).indexOf("|") > 0 && (nvl(dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))).equals(chartGroup))) { + //if( nvl(dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))).equals(chartGroup)) { + //System.out.println("$$$$$$$DC " + dc.getColId()+ " " + dc.getColOnChart()); + chartGroupColAxis.add(dc); + } + } +// } else +// chartValueColAxis.add(nvl(dc.getColOnChart(), "0")); + } + Collections.sort(chartGroupColAxis, new ChartSeqComparator()); + return chartGroupColAxis; + } // getChartColumnAxisList + + public List getChartGroupValueColumnAxisList( String chartGroupName, HashMap formValues ) { + List reportCols = getAllColumns(); + String index = chartGroupName.substring(chartGroupName.lastIndexOf("|")+1); + String chartGroup = chartGroupName.substring(0,chartGroupName.lastIndexOf("|")); + //System.out.println("$$$$INDEX " + index); + ArrayList chartGroupValueColAxis = new ArrayList(); + int flag = 0; + + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + flag = 0; + DataColumnType dc = (DataColumnType) iter.next(); + flag = getDependsOnFormFieldFlag(dc, formValues); + + if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0) { + //System.out.println(" Chartgroup " + dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))); + if( nvl(dc.getChartGroup()).indexOf("|") > 0 && (nvl(dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))).equals(chartGroup))) { + //if( nvl(dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))).equals(chartGroup)) { + //System.out.println(" Added Chartgroupname " + chartGroup + " " + dc.getChartGroup() + " " + index); + chartGroupValueColAxis.add(dc); + } + } + } + return chartGroupValueColAxis; + } // getChartColumnAxisList + + public List getChartGroupDisplayNamesList( String chartGroupName, HashMap formValues) { + List reportCols = getAllColumns(); + ArrayList chartGroupValueColNames = new ArrayList(); + String chartGroup = chartGroupName.substring(0,chartGroupName.lastIndexOf("|")); + int flag = 0; + + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + flag = 0; + DataColumnType dc = (DataColumnType) iter.next(); + //System.out.println("$$$$$CHART " + dc.getChartSeq()+ " " + dc.getChartGroup()+ " " + chartGroup); + flag = getDependsOnFormFieldFlag(dc, formValues); + + if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0 ) { + if( nvl(dc.getChartGroup()).indexOf("|") > 0 && (nvl(dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))).equals(chartGroup))) { + chartGroupValueColNames.add(dc.getDisplayName()); + } + } + } + return chartGroupValueColNames; + } // getChartDisplayNamesList + + + public List getChartGroupColumnColorsList(String chartGroupName, HashMap formValues) { + List reportCols = getAllColumns(); + ArrayList chartValueColColors = new ArrayList(); + String chartGroup = chartGroupName.substring(0,chartGroupName.lastIndexOf("|")); + int flag = 0; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + flag = 0; + DataColumnType dc = (DataColumnType) iter.next(); + flag = getDependsOnFormFieldFlag(dc, formValues); + + if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0 ) { + if( nvl(dc.getChartGroup()).indexOf("|") > 0 && (nvl(dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))).equals(chartGroup))) { + //if( nvl(dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))).equals(chartGroup)) { + chartValueColColors.add(dc.getChartColor()); + } + } + } + return chartValueColColors; + } // getChartColumnColorsList + + + public List getCrossTabRowColumns() { + List reportCols = getAllColumns(); + Vector v = new Vector(reportCols.size()); + + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if (nvl(dc.getCrossTabValue()).equals(AppConstants.CV_ROW)) + v.add(dc); + } // for + + return v; + } // getCrossTabRowColumns + + public List getCrossTabColColumns() { + List reportCols = getAllColumns(); + Vector v = new Vector(reportCols.size()); + + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if (nvl(dc.getCrossTabValue()).equals(AppConstants.CV_COLUMN)) + v.add(dc); + } // for + + return v; + } // getCrossTabColColumns + + public String getCrossTabDisplayTotal(String rowColPos) { + DataColumnType dct = getCrossTabValueColumn(); + if (dct == null) + return ""; + + String displayTotal = nvl(dct.getDisplayTotal()); + if (displayTotal.indexOf('|') >= 0) { + String displayColTotal = displayTotal.substring(0, displayTotal.indexOf('|')); + String displayRowTotal = displayTotal.substring(displayTotal.indexOf('|') + 1); + + if (rowColPos.equals(AppConstants.CV_COLUMN)) + displayTotal = displayColTotal; + else if (rowColPos.equals(AppConstants.CV_ROW)) + displayTotal = displayRowTotal; + else if (displayColTotal.equals(displayRowTotal)) + displayTotal = displayColTotal; + } // if + + return displayTotal; + } // getCrossTabDisplayTotal + + public DataColumnType getCrossTabValueColumn() { + List reportCols = getAllColumns(); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if (nvl(dc.getCrossTabValue()).equals(AppConstants.CV_VALUE)) + return dc; + } // for + + return null; + } // getCrossTabValueColumn + + public int getCrossTabValueColumnIndex() { // Returns the index counting + // only visible columns + List reportCols = getAllColumns(); + + int idx = 0; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if (nvl(dc.getCrossTabValue()).equals(AppConstants.CV_VALUE)) + break; + if (dc.isVisible()) + idx++; + } // for + + return idx; + } // getCrossTabValueColumnIndex + + public ColFilterType getFilterById(String colId, int filterIndex) { + DataColumnType dc = getColumnById(colId); + try { + return (ColFilterType) dc.getColFilterList().getColFilter().get(filterIndex); + } catch (Exception e) { + return null; + } + } // getFilterById + + public boolean needFormInput() { + List reportCols = getAllColumns(); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + + if (dct.getColFilterList() != null) { + List fList = dct.getColFilterList().getColFilter(); + for (Iterator iterF = fList.iterator(); iterF.hasNext();) { + ColFilterType cft = (ColFilterType) iterF.next(); + + if (nvl(cft.getArgType()).equals(AppConstants.AT_FORM)) + return true; + } // for + } // if + } // for + + return false; + } // needFormInput + + public int getNumSortColumns() { + int numSortCols = 0; + for (Iterator iter = getAllColumns().iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + if (dct.getOrderBySeq() != null && dct.getOrderBySeq() > 0) + numSortCols++; + } // for + + return numSortCols; + } // getNumSortColumns + + public SemaphoreType getSemaphoreById(String semaphoreId) { + if (getSemaphoreList() != null && semaphoreId != null) + for (Iterator iter = getSemaphoreList().getSemaphore().iterator(); iter.hasNext();) { + SemaphoreType sem = (SemaphoreType) iter.next(); + if (sem.getSemaphoreId().equals(semaphoreId)) + return sem; + } // for + + return null; + } // getSemaphoreById + + public void deleteSemaphore(SemaphoreType semaphore) { + if (getSemaphoreList() != null) { + if(getSemaphoreList().getSemaphore()!= null) + getSemaphoreList().getSemaphore().remove((SemaphoreType) semaphore); + } + } // deleteSemaphore + + + public void setSemaphore(SemaphoreType sem) { + if (getSemaphoreList() != null) { + getSemaphoreList().getSemaphore().add(sem); + } + + } // setSemaphore + + public static FormatType getSemaphoreFormatById(SemaphoreType semaphore, String formatId) { + if (semaphore != null) + for (Iterator iter = semaphore.getFormatList().getFormat().iterator(); iter + .hasNext();) { + FormatType fmt = (FormatType) iter.next(); + if (fmt.getFormatId().equals(formatId)) + return fmt; + } // for + + return null; + } // getSemaphoreFormatById + + public FormFieldType getFormFieldById(String fieldId) { + if (getFormFieldList() != null && fieldId != null) + for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) { + FormFieldType fft = (FormFieldType) iter.next(); + if (fft.getFieldId().equals(fieldId)) + return fft; + } // for + + return null; + } // getFormFieldById + + public FormFieldType getFormFieldByDisplayValue(String fieldDisplay) { + // fieldDisplay expected to be [fieldName] + if (getFormFieldList() != null && fieldDisplay != null) + for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) { + FormFieldType fft = (FormFieldType) iter.next(); + if (fieldDisplay.equals(getFormFieldDisplayName(fft))) + return fft; + } // for + + return null; + } // getFormFieldById + + public String getFormFieldDisplayName(FormFieldType fft) { + return "[" + fft.getFieldName() + "]"; + } // getFormFieldDisplayName + + /** ************************************************************************************************* */ + + public void resetCache(boolean sqlOnly) { + generatedSQL = null; + if (!sqlOnly) { + allColumns = null; + allFilters = null; + } + } // resetCache + + public String getOuterJoinType(DataSourceType curTable) { + String refDefinition = nvl(curTable.getRefDefinition()); + int outerJoinIdx = refDefinition.indexOf(" (+)"); + if (outerJoinIdx < 0) + // No outer join + return ""; + + int equalSignIdx = refDefinition.indexOf("="); + if (refDefinition.indexOf(curTable.getTableId()) < equalSignIdx) + // Cur. table is on the left side + return (outerJoinIdx < equalSignIdx) ? AppConstants.OJ_CURRENT + : AppConstants.OJ_JOINED; + else + // Joined table is on the left side + return (outerJoinIdx < equalSignIdx) ? AppConstants.OJ_JOINED + : AppConstants.OJ_CURRENT; + } // getOuterJoinType + + public String getFormFieldName(ColFilterType filter) { + FormFieldType fft = null; + if (filter.getArgType().equals(AppConstants.AT_FORM)) + fft = getFormFieldByDisplayValue(filter.getArgValue()); + + return (fft != null) ? fft.getFieldId() : filter.getColId() + "_f" + + filter.getFilterSeq(); + } // getFormFieldName + + public String getFormFieldDisplayName(DataColumnType column, ColFilterType filter) { + FormFieldType fft = null; + if (filter.getArgType().equals(AppConstants.AT_FORM)) + fft = getFormFieldByDisplayValue(filter.getArgValue()); + + return (fft != null) ? fft.getFieldName() : column.getDisplayName() + " " + + filter.getExpression(); + } // getFormFieldDisplayName + + public Calendar getFormFieldRangeStart(ColFilterType filter) { + FormFieldType fft = null; + if (filter.getArgType().equals(AppConstants.AT_FORM)) + fft = getFormFieldByDisplayValue(filter.getArgValue()); + + return (fft != null) ? fft.getRangeStartDate().toGregorianCalendar() : null; + } // getFormFieldRangeStart + + public Calendar getFormFieldRangeEnd(ColFilterType filter) { + FormFieldType fft = null; + if (filter.getArgType().equals(AppConstants.AT_FORM)) + fft = getFormFieldByDisplayValue(filter.getArgValue()); + + //System.out.println("as " + fft.getRangeEndDate()); + return (fft != null) ? fft.getRangeEndDate().toGregorianCalendar() : null; + } // getFormFieldRangeEnd + + public String getFormFieldRangeStartSQL(ColFilterType filter) { + FormFieldType fft = null; + if (filter.getArgType().equals(AppConstants.AT_FORM)) + fft = getFormFieldByDisplayValue(filter.getArgValue()); + + return (fft != null) ? fft.getRangeStartDateSQL() : null; + } // getFormFieldRangeStart + + public String getFormFieldRangeEndSQL(ColFilterType filter) { + FormFieldType fft = null; + if (filter.getArgType().equals(AppConstants.AT_FORM)) + fft = getFormFieldByDisplayValue(filter.getArgValue()); + + //System.out.println("as " + fft.getRangeEndDate()); + return (fft != null) ? fft.getRangeEndDateSQL() : null; + } // getFormFieldRangeEnd + + public String getUniqueTableId(String tableName) { + String tableIdPrefix = tableName.startsWith("MSA_") ? tableName.substring(4, 6) + : tableName.substring(0, 2); + String tableId = ""; + + int tableIdN = getDataSourceList().getDataSource().size() + 1; + do { + tableId = tableIdPrefix.toLowerCase() + (tableIdN++); + } while (getTableById(tableId) != null); + + return tableId; + } // getUniqueTableId + + /** ************************************************************************************************* */ + + protected void deleteDataSourceType(String tableId) { + List dsList = getDataSourceList().getDataSource(); + for (Iterator iter = dsList.iterator(); iter.hasNext();) { + DataSourceType dst = (DataSourceType) iter.next(); + if (dst.getTableId().equals(tableId)) + iter.remove(); + else if (nvl(dst.getRefTableId()).equals(tableId)) { + dst.setRefTableId(null); + dst.setRefDefinition(null); + } + } // for + + resetCache(false); + } // deleteDataSourceType + + public static void adjustColumnType(DataColumnType dct) { + dct.setColType(dct.getDbColType()); + + if (dct.isCalculated()) + if (dct.getColName().startsWith("SUM(") || dct.getColName().startsWith("COUNT(") + || dct.getColName().startsWith("AVG(") + || dct.getColName().startsWith("STDDEV(") + || dct.getColName().startsWith("VARIANCE(")) + dct.setColType(AppConstants.CT_NUMBER); + else if (dct.getColName().startsWith("DECODE(") || dct.getColName().startsWith("coalesce(")) + dct.setColType(AppConstants.CT_CHAR); + } // adjustColumnType + + public static boolean getColumnNoParseDateFlag(DataColumnType dct) { + return (nvls(dct.getComment()).indexOf(AppConstants.CF_NO_PARSE_DATE) >= 0); + } // getColumnNoParseDateFlag + + public static void setColumnNoParseDateFlag(DataColumnType dct, boolean noParseDateFlag) { + dct.setComment(noParseDateFlag ? AppConstants.CF_NO_PARSE_DATE : null); + } // setColumnNoParseDateFlag + + /** ************************************************************************************************* */ + + public static String getSQLBasedFFTColTableName(String fftColId) { + return fftColId.substring(0, fftColId.indexOf('.')); + } // getSQLBasedFFTColTableName + + public static String getSQLBasedFFTColColumnName(String fftColId) { + fftColId = (fftColId.indexOf('|') < 0) ? fftColId : fftColId.substring(0, fftColId + .indexOf('|')); + return fftColId.substring(fftColId.indexOf('.') + 1); + } // getSQLBasedFFTColColumnName + + public static String getSQLBasedFFTColDisplayFormat(String fftColId) { + return (fftColId.indexOf('|') < 0) ? "" : fftColId + .substring(fftColId.indexOf('|') + 1); + } // getSQLBasedFFTColDisplayFormat + + /** ************************************************************************************************* */ + + public List getAllColumns() { + if (cr == null) + throw new NullPointerException("CustomReport not initialized"); + + if (allColumns == null) { + allColumns = new Vector(); + + List dsList = getDataSourceList().getDataSource(); + for (Iterator iter = dsList.iterator(); iter.hasNext();) { + DataSourceType ds = (DataSourceType) iter.next(); + + // allColumns.addAll(ds.getDataColumnList().getDataColumn()); + List dcList = ds.getDataColumnList().getDataColumn(); + for (Iterator iterC = dcList.iterator(); iterC.hasNext();) { + DataColumnType dc = (DataColumnType) iterC.next(); + + allColumns.add(dc); + } // for + } // for + + Collections.sort(allColumns, new OrderSeqComparator()); + } // if + + return allColumns; + } // getAllColumns + + public List getOnlyVisibleColumns() { + if (cr == null) + throw new NullPointerException("CustomReport not initialized"); + + if (allVisibleColumns == null) { + allVisibleColumns = new Vector(); + + List dsList = getDataSourceList().getDataSource(); + for (Iterator iter = dsList.iterator(); iter.hasNext();) { + DataSourceType ds = (DataSourceType) iter.next(); + + // allColumns.addAll(ds.getDataColumnList().getDataColumn()); + List dcList = ds.getDataColumnList().getDataColumn(); + for (Iterator iterC = dcList.iterator(); iterC.hasNext();) { + DataColumnType dc = (DataColumnType) iterC.next(); + if(dc.isVisible()) + allVisibleColumns.add(dc); + } // for + } // for + + Collections.sort(allVisibleColumns, new OrderSeqComparator()); + } // if + + return allVisibleColumns; + } // getOnlyVisibleColumns + public int getVisibleColumnCount() { + if (cr == null) + throw new NullPointerException("CustomReport not initialized"); + int colCount = 0; + List dsList = getDataSourceList().getDataSource(); + for (Iterator iter = dsList.iterator(); iter.hasNext();) { + DataSourceType ds = (DataSourceType) iter.next(); + + // allColumns.addAll(ds.getDataColumnList().getDataColumn()); + List dcList = ds.getDataColumnList().getDataColumn(); + for (Iterator iterC = dcList.iterator(); iterC.hasNext();) { + DataColumnType dc = (DataColumnType) iterC.next(); + if(dc.isVisible()) colCount ++; + } // for + } // for + + return colCount; + } + + public List getAllFilters() { + if (cr == null) + throw new NullPointerException("CustomReport not initialized"); + + // if(allFilters==null) { + allFilters = new Vector(); + + List reportCols = getAllColumns(); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + + if (dct.getColFilterList() != null) { + List colFilters = dct.getColFilterList().getColFilter(); + + for (Iterator iterF = colFilters.iterator(); iterF.hasNext();) { + ColFilterType cft = (ColFilterType) iterF.next(); + + allFilters.add(cft); + } // for + } // if + } // for + + // Collections.sort(allFilters, ??); + // } // if + + return allFilters; + } // getAllFilters + + private String formatValue(String value, DataColumnType dc, boolean useDefaultDateFormat) throws RaptorException { + return formatValue(value, dc, useDefaultDateFormat, getColumnTableById(dc.getColId()), null); + } // formatValue + + private String formatValue(String value, DataColumnType dc, boolean useDefaultDateFormat, + DataSourceType ds, FormFieldType fft) throws RaptorException { + String fmtValue = null; + + if (nvl(value).length() == 0) + fmtValue = ""; + else if (value.equals(AppConstants.FILTER_MAX_VALUE) + || value.equals(AppConstants.FILTER_MIN_VALUE)) + fmtValue = "(SELECT " + + (value.equals(AppConstants.FILTER_MAX_VALUE) ? "MAX" : "MIN") + "(" + + dc.getColName() + ") FROM " + ds.getTableName() + ")"; + else if (dc.getColType().equals(AppConstants.CT_NUMBER)) { + try { + double vD = Double.parseDouble(value); + fmtValue = value; + } catch(NumberFormatException ex) { + throw new UserDefinedException("Expected number, Given String for the form field \"" + fft.getFieldName()+"\""); + } + } + else if (dc.getColType().equals(AppConstants.CT_DATE)) { + if (fft!=null && (fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) ) { + fmtValue = "TO_DATE('" + + value + + "', '" + + (useDefaultDateFormat ? AppConstants.DEFAULT_DATE_FORMAT : nvl(dc + .getColFormat(), AppConstants.DEFAULT_DATE_FORMAT));//+" HH24:MI:SS')"; + fmtValue = fmtValue + " HH24"; + if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) + fmtValue = fmtValue + ":MI"; + if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) + fmtValue = fmtValue + " HH24:MI:SS"; + } else { + fmtValue = "TO_DATE('" + + value + + "', '" + + (useDefaultDateFormat ? AppConstants.DEFAULT_DATE_FORMAT : nvl(dc + .getColFormat(), AppConstants.DEFAULT_DATE_FORMAT)) + "')"; + if (Globals.getMonthFormatUseLastDay()) + if (!useDefaultDateFormat) + if (nvl(dc.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT).equals( + "MM/YYYY") + || nvl(dc.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT) + .equals("MONTH, YYYY")) + fmtValue = "ADD_MONTHS(" + fmtValue + ", 1)-1"; + } + }else { + fmtValue = value; + if (!fmtValue.startsWith("'")) + fmtValue = "'" + fmtValue + "'"; + } + + return fmtValue; + } // formatValue + + private String formatListValue(String listValue, DataColumnType dc, + boolean useDefaultDateFormat, boolean useOnlyPipeDelimiter) throws RaptorException { + return formatListValue("", listValue, dc, useDefaultDateFormat, useOnlyPipeDelimiter, + getColumnTableById(dc.getColId()), null); + } // formatListValue + + public String formatListValue(String fieldDisplay, String listValue, DataColumnType dc, + boolean useDefaultDateFormat, boolean useOnlyPipeDelimiter, DataSourceType ds, + String listBaseSQL) throws RaptorException { + StringBuffer fmtValue = new StringBuffer(""); + //if(nvl(listValue,"").trim().length()>0) { + // The below statement is commented so that pipe is taken out from parsing for text area form field +// StringTokenizer st = new StringTokenizer(listValue, useOnlyPipeDelimiter ? "|" + //: ",|\n\r\f"); + StringTokenizer st = new StringTokenizer(listValue, useOnlyPipeDelimiter ? "|" + : ",\n\r\f"); + + while (st.hasMoreTokens()) { + if (fmtValue.length() > 0) + fmtValue.append(", "); + + if (dc == null) { + // For SQL-based reports - value always string + String value = st.nextToken().trim(); + if (value.startsWith("'")) + fmtValue.append(value); + else + fmtValue.append("'" + value + "'"); + } else + fmtValue.append(formatValue(st.nextToken().trim(), dc, useDefaultDateFormat, + ds, null) ); + + } // while + + if (fmtValue.length() == 0) { + if(nvl(fieldDisplay).length() > 0) { + fmtValue.append(""); + } else { + fmtValue.append("("); + fmtValue.append(nvl(listBaseSQL, "NULL")); + fmtValue.append(")"); + } + } else if (fmtValue.charAt(0) != '(') { + fmtValue.insert(0, '('); + fmtValue.append(')'); + } + /* } else { + fmtValue = new StringBuffer("()"); + }*/ + return fmtValue.toString(); + } // formatListValue + + private String getColumnSelectStr(DataColumnType dc, ReportParamValues paramValues) { + String colName = dc.isCalculated() ? dc.getColName() + : ((nvl(dc.getTableId()).length() > 0) ? (dc.getTableId() + "." + dc + .getColName()) : dc.getColName()); + String paramValue = null; + if (dc.isCalculated()) + if (getFormFieldList() != null) + for (Iterator iter2 = getFormFieldList().getFormField().iterator(); iter2 + .hasNext();) { + FormFieldType fft = (FormFieldType) iter2.next(); + String fieldId = fft.getFieldId(); + String fieldDisplay = getFormFieldDisplayName(fft); + if (!paramValues.isParameterMultiValue(fieldId)) { + paramValue = paramValues.getParamValue(fieldId); + if(paramValue!=null && paramValue.length() > 0) { + colName = Utils.replaceInString(colName, fieldDisplay, Utils + .oracleSafe(nvl(paramValue, "NULL"))); + } else { + colName = Utils.replaceInString(colName, "'" + fieldDisplay + "'", nvl( + paramValue, "NULL")); + colName = Utils.replaceInString(colName, fieldDisplay, nvl( + paramValue, "NULL")); + } + } + } // for + + return colName; + } // getColumnSelectStr + + private void addExtraIdSelect(StringBuffer selectExtraIdCl, String drillDownParams, + boolean includeSelectExpr) { + // drillDownParams - example value "c_master=[bo1.RECID$]" + drillDownParams = drillDownParams.substring(10, drillDownParams.length() - 1); // i.e. + // "bo1.RECID$" + + selectExtraIdCl.append(", "); + if (includeSelectExpr) { + selectExtraIdCl.append(drillDownParams); + selectExtraIdCl.append(" "); + } // if + selectExtraIdCl.append(drillDownParams.replace('.', '_')); // i.e. + // "bo1_RECID$" + } // addExtraIdSelect + + private void addExtraDateSelect(StringBuffer selectExtraDateCl, String drillDownParams, + ReportParamValues paramValues, boolean includeSelectExpr) { + // drillDownParams - example value "ff1=[dl1]&fc2=[mo3]" + String colId = ""; + while (drillDownParams.indexOf('[') >= 0) { + int startIdx = drillDownParams.indexOf('['); + int endIdx = drillDownParams.indexOf(']'); + + if(startIdx<=endIdx) { + colId = drillDownParams.substring(startIdx + 1, endIdx); // i.e. + } else { + drillDownParams = drillDownParams.substring(endIdx + 1); + continue; + } + // "dl1" + + DataColumnType column = getColumnById(colId); + if (column != null) + if (column.getColType().equals(AppConstants.CT_DATE)) + if (!nvl(column.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT).equals( + AppConstants.DEFAULT_DATE_FORMAT)) + if (selectExtraDateCl.toString().indexOf( + " " + colId + AppConstants.DD_COL_EXTENSION) < 0) { + selectExtraDateCl.append(", "); + if (includeSelectExpr) { + selectExtraDateCl.append("TO_CHAR(" + + getColumnSelectStr(column, paramValues) + ", '" + + AppConstants.DEFAULT_DATE_FORMAT + "')"); + selectExtraDateCl.append(" "); + } // if + selectExtraDateCl.append(colId + AppConstants.DD_COL_EXTENSION); // i.e. + // "dl1_dde" + } // if + + drillDownParams = drillDownParams.substring(endIdx + 1); + } // while + } // addExtraDateSelect + + /* + * public String generateSQL() { return generateSQL(null); } // generateSQL + */ + public String generateSQL(String userId, HttpServletRequest request) throws RaptorException { + return generateSQL(new ReportParamValues(), userId, request); + } // generateSQL + + public String generateSQL(ReportParamValues paramValues, String userId, HttpServletRequest request) throws RaptorException { + return generateSQL(paramValues, null, AppConstants.SO_ASC, userId, request); + } // generateSQL + + public String generateSQL(ReportParamValues paramValues, String overrideSortByColId, + String overrideSortByAscDesc, String userId, HttpServletRequest request) throws RaptorException { + if (cr == null) + throw new NullPointerException("CustomReport not initialized"); + if(nvl(getWholeSQL()).length()>0) return getWholeSQL(); + if (paramValues.size() > 0) + resetCache(true); + //resetCache(true); + if (generatedSQL == null) { + if (getReportDefType().equals(AppConstants.RD_SQL_BASED) || getReportDefType().equals(AppConstants.RD_SQL_BASED_DATAMIN)) { + generatedSQL = generateSQLSQLBased(paramValues, overrideSortByColId, + overrideSortByAscDesc, userId, request ); + generatedChartSQL = generateSQLSQLBased(paramValues, null, + AppConstants.SO_ASC, userId, request ); + } else if (getReportDefType().equals(AppConstants.RD_VISUAL) && !getReportType().equals(AppConstants.RT_CROSSTAB)) { + generatedSQL = generateSQLVisual(paramValues, overrideSortByColId, + overrideSortByAscDesc, userId, request); + generatedChartSQL = generateSQLVisual(paramValues, null, + AppConstants.SO_ASC, userId, request); + } else { + generatedSQL = generateSQLCrossTabVisual(paramValues, overrideSortByColId, + overrideSortByAscDesc, userId, request); + } + + //debugLogger.debug("******************"); + //debugLogger.debug("SQL Before Changing new line \n" + generatedSQL); + //debugLogger.debug("******************"); + generatedSQL = replaceNewLine(generatedSQL, ""+ '\n', " "+'\n'+" " ); + //chart sql should not be null + if(nvl(generatedChartSQL).trim().length()>0) + generatedChartSQL = replaceNewLine(generatedChartSQL, ""+ '\n', " "+'\n'+" " ); + //(generatedSQL, "\n", " \n "); + //debugLogger.debug("******************"); + //debugLogger.debug("SQL After Changing new line \n" + generatedSQL); + //debugLogger.debug("******************"); + //generatedSQL = replaceNewLine(generatedSQL, "SELECT", "SELECT "); + //generatedSQL = replaceNewLine(generatedSQL, "select", "select "); + //debugLogger.debug("SQL After Changing new line \n" + generatedSQL); + //debugLogger.debug("[[[[[[[[[[[[[[[[[["); + //generatedSQL = Utils.replaceInString(generatedSQL, "\n", " "); + //generatedSQL = Utils.replaceInString(generatedSQL, "\t", " "); + } // if + + return generatedSQL; + } // generateSQL + + public String generateSQLSQLBased(ReportParamValues paramValues, + String overrideSortByColId, String overrideSortByAscDesc, String userId, HttpServletRequest request) throws RaptorException { + String sql = getReportSQL(); + DataSet ds = null; + //debugLogger.debug(" generateSQLSQLBased " + sql); + String[] reqParameters = Globals.getRequestParams().split(","); + String[] sessionParameters = Globals.getSessionParams().split(","); + String[] scheduleSessionParameters = Globals.getSessionParamsForScheduling().split(","); + javax.servlet.http.HttpSession session = request.getSession(); + String dbType = ""; + String dbInfo = getDBInfo(); + int fieldCount = 0; + // For Daytona removing all formfields which has null param value + Pattern re1 = null; + Matcher matcher = null; + int index = 0; + int posFormField = 0; + int posAnd = 0; + if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { + try { + org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo(); + dbType = remDbInfo.getDBType(dbInfo); + } catch (Exception ex) { + throw new RaptorException(ex); + } + } + + sql = sql + " "; + sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ss][Ee][Ll][Ee][Cc][Tt]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" SELECT "); + //sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ff][Rr][Oo][Mm]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" FROM "); + sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Rr][Ee]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" WHERE "); + sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Nn]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" WHEN "); + sql = Pattern.compile("(^[\r\n]*|([\\s]))[Aa][Nn][Dd]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" AND "); + + if (getFormFieldList() != null) { + for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) { + + FormFieldType fft = (FormFieldType) iter.next(); + String fieldId = fft.getFieldId(); + String fieldDisplay = getFormFieldDisplayName(fft); + if(!fft.getFieldType().equals(FormField.FFT_BLANK)) { + if (paramValues.isParameterMultiValue(fieldId)) { + String replaceValue = formatListValue(fieldDisplay, Utils + .oracleSafe(nvl(paramValues.getParamValue(fieldId))), null, false, + true, null, paramValues.getParamBaseSQL(fieldId)); + if(replaceValue.length() > 0) { + sql = Utils.replaceInString(sql, fieldDisplay, replaceValue); + } else { + fieldCount++; + if(fieldCount == 1) { + //sql = sql + " "; + //sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ss][Ee][Ll][Ee][Cc][Tt]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" SELECT "); + //sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Rr][Ee]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" WHERE "); + //sql = Pattern.compile("(^[\r\n]*|([\\s]))[Aa][Nn][Dd]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" AND "); + } + //sql = getReportSQL(); + while(sql.indexOf(fieldDisplay) > 0) { +/* sql = Utils.replaceInString(sql, "SELECT ", "select "); + sql = Utils.replaceInString(sql, "WHERE", "where"); + sql = Utils.replaceInString(sql, " AND ", " and "); +*/ + re1 = Pattern.compile("(^[\r\n]|[\\s])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL); + //re1 = Pattern.compile("(^[\r\n]|[\\s])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\]", Pattern.DOTALL); +/* posFormField = sql.indexOf(fieldDisplay); + posAnd = sql.lastIndexOf("and", posFormField); + if(posAnd < 0) posAnd = 0; + else if (posAnd > 2) posAnd = posAnd - 2; + matcher = re1.matcher(sql); +*/ + posFormField = sql.indexOf(fieldDisplay); + int posSelectField = sql.lastIndexOf("SELECT ", posFormField); + int andField = 0; + int whereField = 0, whenField = 0; + andField = sql.lastIndexOf(" AND ", posFormField); + whereField = sql.indexOf(" WHERE" , posSelectField); + whenField = sql.indexOf(" WHEN" , posSelectField); + + if(posFormField > whereField) + andField = sql.lastIndexOf(" AND ", posFormField); + if (posFormField > andField && (andField > whereField || andField > whenField)) + posAnd = andField; + else + posAnd = 0; + matcher = re1.matcher(sql); + + + if (posAnd > 0 && matcher.find(posAnd-1)) { + //sql = Utils.replaceInString(sql, matcher.group(), " "); + matcher = re1.matcher(sql); + index = sql!=null?sql.lastIndexOf("["+fft.getFieldName()+"]"):-1; + + if(andField>0) + index = andField; + else + index = whereField; + if(index >= 0 && matcher.find(index-1)) { + sql = sql.replace(matcher.group(), " "); + } + } else { + + //sql = sql.replace + re1 = Pattern.compile("(^[\r\n]|[\\s])WHERE(.*?[^\r\n]*)\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL); + matcher = re1.matcher(sql); + if(whereField != -1) { + if(matcher.find(whereField-1)) { + matcher = re1.matcher(sql); + index = sql!=null?sql.lastIndexOf("["+fft.getFieldName()+"]"):-1; + if(index >= 0 && matcher.find(index-30)) { + sql = sql.replace(matcher.group(), " WHERE 1=1 "); + } + //sql = Utils.replaceInString(sql, matcher.group(), " where 1=1 "); + } /*else { + replaceValue = formatListValue("", Utils + .oracleSafe(nvl(paramValues.getParamValue(fieldId))), null, false, + true, null, paramValues.getParamBaseSQL(fieldId)); + sql = Utils.replaceInString(sql, fieldDisplay, replaceValue); + }*/ + } else { + sql = Utils.replaceInString(sql, fieldDisplay, replaceValue); + } + + } + } + } + + //sql = Utils.replaceInString(sql, " select ", " SELECT "); + //sql = Utils.replaceInString(sql, " where ", " WHERE "); + //sql = Utils.replaceInString(sql, " and ", " AND "); + + } else { + String paramValue = ""; + if(paramValues.isParameterTextAreaValueAndModified(fieldId)) { + String value = ""; + value = nvl(paramValues + .getParamValue(fieldId)); +// value = Utils.oracleSafe(nvl(value)); +// if (!(dbType.equals("DAYTONA") && sql.trim().toUpperCase().startsWith("SELECT"))) { +// value = "('" + Utils.replaceInString(value, ",", "'|'") + "')"; +// value = Utils.replaceInString(value, "|", ","); +// paramValue = XSSFilter.filterRequestOnlyScript(value); +// } else if (nvl(value.trim()).length()>0) { +// value = "('" + Utils.replaceInString(value, ",", "'|'") + "')"; +// value = Utils.replaceInString(value, "|", ","); +// paramValue = XSSFilter.filterRequestOnlyScript(value); +// } + paramValue = value; + } else + paramValue = Utils.oracleSafe(nvl(paramValues + .getParamValue(fieldId))); + + if (paramValue!=null && paramValue.length() > 0) { + if(paramValue.toLowerCase().trim().startsWith("select ")) { + paramValue = Utils.replaceInString(paramValue, "[LOGGED_USERID]", userId); + paramValue = Utils.replaceInString(paramValue, "[USERID]", userId); + paramValue = Utils.replaceInString(paramValue, "[USER_ID]", userId); + + paramValue = Utils.replaceInString(paramValue, "''", "'"); + ds = ConnectionUtils.getDataSet(paramValue, dbInfo); + if (ds.getRowCount() > 0) paramValue = ds.getString(0, 0); + } + //debugLogger.debug("SQLSQLBASED B4^^^^^^^^^ " + sql + " " + fft.getValidationType() + " " + fft.getFieldName() + " " + fft.getFieldId()); + if(fft!=null && (fft.getValidationType()!=null && (fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) ||fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC) ||fft.getValidationType().equals(FormField.VT_DATE) ))) { + //System.out.println("paramValues.getParamValue(fieldId_Hr) Inside if " + fft.getValidationType() + " " + fieldDisplay); + if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR)) { + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue) +((nvl(paramValues + .getParamValue(fieldId+"_Hr") ).length()>0)?" "+addZero(Utils.oracleSafe(nvl(paramValues + .getParamValue(fieldId+"_Hr") ) ) ):"")); + } + else if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN)) { +/* System.out.println("paramValues.getParamValue(fieldId_Hr)" + paramValues + .getParamValue(fieldId+"_Hr") + " " + paramValues + .getParamValue(fieldId+"_Min")) ; +*/ sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue) + ((nvl(paramValues + .getParamValue(fieldId+"_Hr") ).length()>0)?" "+addZero(Utils.oracleSafe(nvl(paramValues + .getParamValue(fieldId+"_Hr") ) ) ):"") + ((nvl(paramValues + .getParamValue(fieldId+"_Min") ).length()>0)?":" + addZero(Utils.oracleSafe(nvl(paramValues + .getParamValue(fieldId+"_Min") ) ) ) : "") ) ; + } + else if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) { + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue) + ((nvl(paramValues + .getParamValue(fieldId+"_Hr") ).length()>0)?" "+addZero(Utils.oracleSafe(nvl(paramValues + .getParamValue(fieldId+"_Hr") ) ) ):"") + ((nvl(paramValues + .getParamValue(fieldId+"_Min") ).length()>0)?":" + addZero(Utils.oracleSafe(nvl(paramValues + .getParamValue(fieldId+"_Min") ) ) ) : "") + ((nvl(paramValues + .getParamValue(fieldId+"_Sec") ).length()>0)?":"+addZero(Utils.oracleSafe(nvl(paramValues + .getParamValue(fieldId+"_Sec") ) ) ) : "" ) ) ; + } else { + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + } + + + } else { + if(paramValue!=null && paramValue.length() > 0) { + if(sql.indexOf("'"+fieldDisplay+"'")!=-1 || sql.indexOf("'"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"'")!=-1 + || sql.indexOf("'%"+fieldDisplay+"%'")!=-1 || sql.indexOf("'%"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"%'")!=-1 + || sql.indexOf("'_"+fieldDisplay+"_'")!=-1 || sql.indexOf("'_"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"_'")!=-1 + || sql.indexOf("'%_"+fieldDisplay+"_%'")!=-1 || sql.indexOf("^"+fieldDisplay+"^")!=-1 || sql.indexOf("'%_"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"_%'")!=-1) { + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + } else { + if(sql.indexOf(fieldDisplay)!=-1) { + if(nvl(paramValue).length()>0) { + try { + double vD = Double.parseDouble(paramValue); + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + + } catch (NumberFormatException ex) { + if (/*dbType.equals("DAYTONA") &&*/ sql.trim().toUpperCase().startsWith("SELECT")) { + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + } else + throw new UserDefinedException("Expected number, Given String for the form field \"" + fieldDisplay+"\""); + } + /*sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL"));*/ + } else + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + + } + } + } + else { + if (dbType.equals("DAYTONA") && sql.trim().toUpperCase().startsWith("SELECT")) { + sql = sql + " "; + re1 = Pattern.compile("(^[\r\n]|[\\s]|[^0-9a-zA-Z])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL); + posFormField = sql.indexOf(fieldDisplay); + posAnd = sql.lastIndexOf(" AND ", posFormField); + if(posAnd < 0) posAnd = 0; + else if (posAnd > 2) posAnd = posAnd - 2; + matcher = re1.matcher(sql); + if (matcher.find(posAnd)) { + sql = sql.replace(matcher.group(), ""); + } + } else { + sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl( + paramValue, "NULL")); + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + } + } + } + + } + + if (dbType.equals("DAYTONA") && sql.trim().toUpperCase().startsWith("SELECT")) { + sql = sql + " "; + re1 = Pattern.compile("(^[\r\n]|[\\s]|[^0-9a-zA-Z])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL); //+[\'\\)|\'|\\s] + posFormField = sql.indexOf(fieldDisplay); + posAnd = sql.lastIndexOf(" AND ", posFormField); + if(posAnd < 0) posAnd = 0; + else if (posAnd > 2) posAnd = posAnd - 2; + matcher = re1.matcher(sql); + if (matcher.find(posAnd)) { + sql = sql.replace(matcher.group(), " "); + } + } else { + if( fft.isGroupFormField()!=null && fft.isGroupFormField().booleanValue()) { + sql = Pattern.compile("[[\\s*][,]]\\["+fft.getFieldName()+"\\](.*?)[,]",Pattern.MULTILINE).matcher(sql).replaceAll(" "); + //sql = Pattern.compile("[,][\\s*]\\["+fft.getFieldName()+"\\][\\s]",Pattern.MULTILINE).matcher(sql).replaceAll(" "); + sql = Pattern.compile("(,.+?)[\\s*]\\["+fft.getFieldName()+"\\][\\s]",Pattern.MULTILINE).matcher(sql).replaceAll(" "); + //sql = Pattern.compile("(?:,?)[\\s*]\\["+fft.getFieldName()+"\\]",Pattern.MULTILINE).matcher(sql).replaceAll(""); + //sql = Pattern.compile("[,][\\s*]\\["+fft.getFieldName()+"\\]",Pattern.MULTILINE).matcher(sql).replaceAll(" "); + //sql = Pattern.compile( "\\["+fft.getFieldName()+"\\](.*?[^\r\n]*)[,]",Pattern.DOTALL).matcher(sql).replaceAll(""); + + //sql = Pattern.compile("[,]|(.*?[^\r\n]*)"+fieldDisplay+"(.*?)\\s",Pattern.DOTALL).matcher(sql).replaceAll(""); + //sql = Pattern.compile("(.*?[^\r\n]*)"+fieldDisplay+"(.*?)\\s|[,]",Pattern.DOTALL).matcher(sql).replaceAll(""); +/* sql = Utils.replaceInString(sql, "," + fieldDisplay , nvl( + paramValue, "")); + sql = Utils.replaceInString(sql, fieldDisplay + "," , nvl( + paramValue, "")); +*/ } else { + //debugLogger.debug("ParamValue |" + paramValue + "| Sql |" + sql + "| Multi Value |" + paramValues.isParameterMultiValue(fieldId)); + sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl( + paramValue, "NULL")); + sql = Utils.replaceInString(sql, fieldDisplay , nvl( + paramValue, "NULL")); + //debugLogger.debug("SQLSQLBASED AFTER^^^^^^^^^ " + sql); + } + } + + } // else + } // if BLANK + } // for + if(request != null ) { + for (int i = 0; i < reqParameters.length; i++) { + if(!reqParameters[i].startsWith("ff")) { + if (nvl(request.getParameter(reqParameters[i].toUpperCase())).length() > 0) + sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i].toUpperCase()) ); + } + else + sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) ); + } + + for (int i = 0; i < scheduleSessionParameters.length; i++) { + if(nvl(request.getParameter(scheduleSessionParameters[i])).trim().length()>0 ) + sql = Utils.replaceInString(sql, "[" + scheduleSessionParameters[i].toUpperCase()+"]", request.getParameter(scheduleSessionParameters[i]) ); + } + } + if(session != null ) { + for (int i = 0; i < sessionParameters.length; i++) { + //if(!sessionParameters[i].startsWith("ff")) + // paramValue = Utils.replaceInString(paramValue, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i].toUpperCase()) ); + // else { + //debugLogger.debug(" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + (String)session.getAttribute(sessionParameters[i])); + sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) ); + //} + } + } + } else { + //debugLogger.debug("BEFORE LOGGED USERID REPLACE " + sql); + //sql = Utils.replaceInString(sql, "'[logged_userId]'", "'"+userId+"'"); + //debugLogger.debug("Replacing string 2 " + sql); + sql = Utils.replaceInString(sql, "[LOGGED_USERID]", userId); + sql = Utils.replaceInString(sql, "[USERID]", userId); + sql = Utils.replaceInString(sql, "[USER_ID]", userId); + //debugLogger.debug("AFTER LOGGED USERID REPLACE " + sql); + // Added for Simon's GM Project where they need to get page_id in their query + //debugLogger.debug("SQLSQLBASED no formfields " + sql); + if(request != null ) { + for (int i = 0; i < reqParameters.length; i++) { + sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) ); + } + } + if(session != null ) { + for (int i = 0; i < sessionParameters.length; i++) { + //debugLogger.debug(" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + (String)session.getAttribute(sessionParameters[i])); + sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) ); + } + } + } + // if it is not multiple select and ParamValue is empty this is the place it can be replaced. + sql = Utils.replaceInString(sql, "[LOGGED_USERID]", userId); + sql = Utils.replaceInString(sql, "[USERID]", userId); + sql = Utils.replaceInString(sql, "[USER_ID]", userId); + //debugLogger.debug("SQLSQLBASED no formfields after" + sql); + //debugLogger.debug("Replacing String 2 "+ sql); + //debugLogger.debug("Replaced String " + sql); + + int closeBracketPos = 0; + if (nvl(overrideSortByColId).length() > 0) { + if(sql.lastIndexOf(")")!= -1) closeBracketPos = sql.lastIndexOf(")"); + int idxOrderBy = (closeBracketPos>0)?sql.toUpperCase().indexOf("ORDER BY", closeBracketPos):sql.toUpperCase().lastIndexOf("ORDER BY"); + DataColumnType dct = getColumnById(overrideSortByColId+"_sort"); + if(dct!=null && dct.getColName().length()>0) { + overrideSortByColId = overrideSortByColId+"_sort"; + } + if (idxOrderBy < 0) + sql += " ORDER BY " + overrideSortByColId + " " + overrideSortByAscDesc; + else { + int braketCount = 0; + int idxOrderByClauseEnd = 0; + for (idxOrderByClauseEnd = idxOrderBy; idxOrderByClauseEnd < sql.length(); idxOrderByClauseEnd++) { + char ch = sql.charAt(idxOrderByClauseEnd); + + if (ch == '(') + braketCount++; + else if (ch == ')') { + if (braketCount == 0) + break; + braketCount--; + } + } // for + + sql = sql.substring(0, idxOrderBy) + " ORDER BY " + overrideSortByColId + " " + + overrideSortByAscDesc + sql.substring(idxOrderByClauseEnd); + } // else + } // if + sql = Pattern.compile("([\n][\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" "); + return sql; + } // generateSQLSQLBased + + public String generateSQLVisual(ReportParamValues paramValues, String overrideSortByColId, + String overrideSortByAscDesc, String userId, HttpServletRequest request)throws RaptorException { + StringBuffer selectCl = new StringBuffer(); + StringBuffer fromCl = new StringBuffer(); + StringBuffer whereCl = new StringBuffer(); + StringBuffer groupByCl = new StringBuffer(); + StringBuffer havingCl = new StringBuffer(); + StringBuffer orderByCl = new StringBuffer(); + StringBuffer selectExtraIdCl = new StringBuffer(); + StringBuffer selectExtraDateCl = new StringBuffer(); + + int whereClBracketCount = 0; + int havingClBracketCount = 0; + int whereClCarryoverBrackets = 0; + int havingClCarryoverBrackets = 0; + + // Identifying FROM clause tables and WHERE clause joins + List dsList = getDataSourceList().getDataSource(); + for (Iterator iter = dsList.iterator(); iter.hasNext();) { + DataSourceType ds = (DataSourceType) iter.next(); + + if (fromCl.length() > 0) + fromCl.append(", "); + fromCl.append(ds.getTableName()); + fromCl.append(" "); + fromCl.append(ds.getTableId()); + + if (nvl(ds.getRefTableId()).length() > 0) { + if (whereCl.length() > 0) + whereCl.append(" AND "); + whereCl.append(ds.getRefDefinition()); + } // if + // Add the condition. + TableSource tableSource = null; + String dBInfo = this.cr.getDbInfo(); + Vector userRoles = AppUtils.getUserRoles(request); + tableSource = DataCache.getTableSource(ds.getTableName(), dBInfo,userRoles,userId, request); + if (userId != null && (!AppUtils.isSuperUser(request)) + && (!AppUtils.isAdminUser(request)) && tableSource != null + && nvl(tableSource.getFilterSql()).length() > 0) { + if (whereCl.length() > 0) + whereCl.append(" AND "); + whereCl.append(Utils.replaceInString(Utils.replaceInString(tableSource + .getFilterSql(), "[" + ds.getTableName() + "]", ds.getTableId()), + "[USER_ID]", userId)); + } // if + } // for + + List reportCols = getAllColumns(); + + boolean isGroupStmt = false; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if (dc.isGroupBreak()) { + isGroupStmt = true; + break; + } // if + } // for + + // Identifying SELECT and GROUP BY clause fields and WHERE and HAVING + // clause filters + // Collections.sort(reportCols, new OrderSeqComparator()); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + String colName = getColumnSelectStr(dc, paramValues); + + // SELECT clause fields + //TODO: Uncomment if it's not working -- if (dc.isVisible()) { + if (selectCl.length() > 0) + selectCl.append(", "); + selectCl.append(getSelectExpr(dc, colName)); + selectCl.append(" "); + selectCl.append(dc.getColId()); + //TODO } // if + + // Checking for extra fields necessary for drill-down + if (nvl(dc.getDrillDownURL()).length() > 0) + if (isViewAction(dc.getDrillDownURL())) + addExtraIdSelect(selectExtraIdCl, nvl(dc.getDrillDownParams()), true); + else + addExtraDateSelect(selectExtraDateCl, nvl(dc.getDrillDownParams()), + paramValues, true); + + // GROUP BY clause fields + if (dc.isGroupBreak()) { + if (groupByCl.length() > 0) + groupByCl.append(", "); + groupByCl.append(colName); + } // if + + // WHERE/HAVING clause fields + //boolean isHavingCl = isGroupStmt && dc.isVisible() && (!dc.isGroupBreak()); + boolean isHavingCl = isGroupStmt && (!dc.isGroupBreak()); + StringBuffer filterCl = isHavingCl ? havingCl : whereCl; + // StringBuffer filterCl = + // isGroupStmt?(dc.isVisible()?(dc.isGroupBreak()?whereCl:havingCl):whereCl):whereCl; + if (dc.getColFilterList() != null) { + int fNo = 0; + List fList = dc.getColFilterList().getColFilter(); + for (Iterator iterF = fList.iterator(); iterF.hasNext(); fNo++) { + ColFilterType cf = (ColFilterType) iterF.next(); + + StringBuffer curFilter = new StringBuffer(); + if (filterCl.length() > 0) + curFilter.append(" " + cf.getJoinCondition() + " "); + if ((isHavingCl ? havingClCarryoverBrackets : whereClCarryoverBrackets) > 0) + for (int b = 0; b < (isHavingCl ? havingClCarryoverBrackets + : whereClCarryoverBrackets); b++) + filterCl.append('('); + curFilter.append(nvl(cf.getOpenBrackets())); + curFilter.append(colName + " "); + curFilter.append(cf.getExpression() + " "); + + boolean applyFilter = true; + if ((nvl(cf.getArgValue()).length() > 0) + || (nvl(cf.getArgType()).equals(AppConstants.AT_FORM))) + if (nvl(cf.getArgType()).equals(AppConstants.AT_FORMULA)) + curFilter.append(cf.getArgValue()); + else if (nvl(cf.getArgType()).equals(AppConstants.AT_VALUE)) + curFilter.append(formatValue(cf.getArgValue(), dc, false)); + else if (nvl(cf.getArgType()).equals(AppConstants.AT_LIST)) + curFilter.append(formatListValue(cf.getArgValue(), dc, false, + false)); + else if (nvl(cf.getArgType()).equals(AppConstants.AT_COLUMN)) + curFilter.append(getColumnNameById(cf.getArgValue())); + else if (nvl(cf.getArgType()).equals(AppConstants.AT_FORM)) { + String fieldName = getFormFieldName(cf); + String fieldValue = Utils.oracleSafe(paramValues + .getParamValue(fieldName)); + boolean isMultiValue = paramValues + .isParameterMultiValue(fieldName); + boolean usePipeDelimiterOnly = false; + + FormFieldType fft = getFormFieldByDisplayValue(cf.getArgValue()); + if (fft == null) + // If not FormField => applying default value + fieldValue = nvl(fieldValue, Utils + .oracleSafe(cf.getArgValue())); + else + usePipeDelimiterOnly = fft.getFieldType().equals( + FormField.FFT_CHECK_BOX) + || fft.getFieldType().equals(FormField.FFT_LIST_MULTI); + //Added for TimeStamp validation + String fieldId = fft.getFieldId(); + if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR)||fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN)||fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) { + fieldValue = nvl( + fieldValue + " " + addZero(Utils.oracleSafe(nvl(paramValues + .getParamValue(fieldId+"_Hr") ) ) ) ) ; + if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) { + fieldValue = fieldValue + (nvl(paramValues + .getParamValue(fieldId+"_Min")).length()>0 ? ":" + addZero(Utils.oracleSafe(nvl(paramValues + .getParamValue(fieldId+"_Min")))): "") ; + } + if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) { + fieldValue = fieldValue + (nvl(paramValues + .getParamValue(fieldId+"_Sec")).length()>0 ? ":"+ addZero(Utils.oracleSafe(nvl(paramValues + .getParamValue(fieldId+"_Sec")))) : ""); + } + } + + // End + if (nvl(fieldValue).length() == 0) + // Does not append filter with missing form + // field argument + applyFilter = false; + else if (isMultiValue || nvl(cf.getExpression()).equals("IN") + || nvl(cf.getExpression()).equals("NOT IN")) + curFilter.append(formatListValue(fieldValue, dc, true, + usePipeDelimiterOnly)); + else + curFilter.append(formatValue(fieldValue, dc, true, null, fft)); + } // else + curFilter.append(nvl(cf.getCloseBrackets())); + + if (applyFilter) { + filterCl.append(curFilter.toString()); + + if (isHavingCl) { + havingClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl( + cf.getCloseBrackets()).length()); + havingClCarryoverBrackets = 0; + } else { + whereClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl( + cf.getCloseBrackets()).length()); + whereClCarryoverBrackets = 0; + } + } else if (nvl(cf.getOpenBrackets()).length() != nvl(cf.getCloseBrackets()) + .length()) + if (nvl(cf.getOpenBrackets()).length() > nvl(cf.getCloseBrackets()) + .length()) { + // Carry over opening brackets + if (isHavingCl) + havingClCarryoverBrackets += (nvl(cf.getOpenBrackets()) + .length() - nvl(cf.getCloseBrackets()).length()); + else + whereClCarryoverBrackets += (nvl(cf.getOpenBrackets()) + .length() - nvl(cf.getCloseBrackets()).length()); + + if (isHavingCl) + havingClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl( + cf.getCloseBrackets()).length()); + else + whereClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl( + cf.getCloseBrackets()).length()); + } else { + // Adding closing brackets + if (filterCl.length() > 0) { + for (int b = 0; b < nvl(cf.getCloseBrackets()).length() + - nvl(cf.getOpenBrackets()).length(); b++) + filterCl.append(')'); + + if (isHavingCl) + havingClBracketCount += (nvl(cf.getOpenBrackets()) + .length() - nvl(cf.getCloseBrackets()).length()); + else + whereClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl( + cf.getCloseBrackets()).length()); + } // if + } // else + } // for + } // if + } // for + + // Identifying ORDER BY clause fields + DataColumnType overrideSortByCol = null; + if (overrideSortByColId != null) + overrideSortByCol = getColumnById(overrideSortByColId); + + if (overrideSortByCol != null) { + orderByCl.append(getColumnSelectStr(overrideSortByCol, paramValues)); + orderByCl.append(" "); + orderByCl.append(nvl(overrideSortByAscDesc, AppConstants.SO_ASC)); + } else if (getReportType().equals(AppConstants.RT_CROSSTAB)) { + /* + * for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) { + * DataColumnType dc = (DataColumnType) iter.next(); + * + * if(nvl(dc.getCrossTabValue()).equals(AppConstants.CV_ROW)||nvl(dc.getCrossTabValue()).equals(AppConstants.CV_COLUMN)) { + * if(orderByCl.length()>0) orderByCl.append(", "); + * orderByCl.append(getColumnSelectStr(dc, paramValues)); + * orderByCl.append(" "); + * if(dc.getColType().equals(AppConstants.CT_DATE)) + * orderByCl.append(AppConstants.SO_DESC); else + * orderByCl.append(AppConstants.SO_ASC); } // if } // for + */ + } else { + Collections.sort(reportCols, new OrderBySeqComparator()); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + + if (dc.getOrderBySeq() > 0) { + if (orderByCl.length() > 0) + orderByCl.append(", "); + orderByCl.append(getColumnSelectStr(dc, paramValues)); + orderByCl.append(" "); + orderByCl.append(dc.getOrderByAscDesc()); + } // if + } // for + Collections.sort(reportCols, new OrderSeqComparator()); + } // else + + // Adding up the actual statement + StringBuffer sql = new StringBuffer(); + //sql.append("SELECT "); // Need to add PK for /*+ FIRST_ROWS */ "); + sql.append(Globals.getGenerateSqlVisualSelect()); + //sql.append((selectCl.length() == 0) ? "COUNT(*) cnt" : selectCl.toString()); + sql.append((selectCl.length() == 0) ? Globals.getGenerateSqlVisualCount() : selectCl.toString()); + if (groupByCl.length() == 0) + sql.append(selectExtraIdCl.toString()); + sql.append(selectExtraDateCl.toString()); + // sql.append(" FROM "); + sql.append((fromCl.length() == 0) ? Globals.getGenerateSqlVisualDual() : "FROM "+fromCl.toString()); + if (whereCl.length() > 0) { + if (whereClBracketCount > 0) { + for (int b = 0; b < whereClBracketCount; b++) + whereCl.append(')'); + } else if (whereClBracketCount < 0) { + for (int b = 0; b < Math.abs(whereClBracketCount); b++) + whereCl.insert(0, '('); + } // else + + sql.append(" WHERE "); + sql.append(whereCl.toString()); + } // if + if (groupByCl.length() > 0) { + sql.append(" GROUP BY "); + sql.append(groupByCl.toString()); + + if (havingCl.length() > 0) { + if (havingClBracketCount > 0) { + for (int b = 0; b < havingClBracketCount; b++) + havingCl.append(')'); + } else if (havingClBracketCount < 0) { + for (int b = 0; b < Math.abs(havingClBracketCount); b++) + havingCl.insert(0, '('); + } // else + + sql.append(" HAVING "); + sql.append(havingCl.toString()); + } + } + if (orderByCl.length() > 0) { + sql.append(" ORDER BY "); + sql.append(orderByCl.toString()); + } + //String sqlStr = Utils.replaceInString(sql.toString(), "[LOGGED_USERID]", userId); + //return sqlStr; + return sql.toString(); + } // generateSQLVisual + + public String generateSQLCrossTabVisual(ReportParamValues paramValues, String overrideSortByColId, + String overrideSortByAscDesc, String userId, HttpServletRequest request) throws RaptorException { + StringBuffer selectCl = new StringBuffer(); + StringBuffer fromCl = new StringBuffer(); + StringBuffer whereCl = new StringBuffer(); + StringBuffer groupByCl = new StringBuffer(); + StringBuffer havingCl = new StringBuffer(); + StringBuffer orderByCl = new StringBuffer(); + StringBuffer selectExtraIdCl = new StringBuffer(); + StringBuffer selectExtraDateCl = new StringBuffer(); + + int whereClBracketCount = 0; + int havingClBracketCount = 0; + int whereClCarryoverBrackets = 0; + int havingClCarryoverBrackets = 0; + + // Identifying FROM clause tables and WHERE clause joins + List dsList = getDataSourceList().getDataSource(); + for (Iterator iter = dsList.iterator(); iter.hasNext();) { + DataSourceType ds = (DataSourceType) iter.next(); + + if (fromCl.length() > 0) + fromCl.append(", "); + fromCl.append(ds.getTableName()); + fromCl.append(" "); + fromCl.append(ds.getTableId()); + + if (nvl(ds.getRefTableId()).length() > 0) { + if (whereCl.length() > 0) + whereCl.append(" AND "); + whereCl.append(ds.getRefDefinition()); + } // if + // Add the condition. + TableSource tableSource = null; + String dBInfo = this.cr.getDbInfo(); + Vector userRoles = AppUtils.getUserRoles(request); + tableSource = DataCache.getTableSource(ds.getTableName(), dBInfo,userRoles,userId, request); + if (userId != null && (!AppUtils.isSuperUser(request)) + && (!AppUtils.isAdminUser(request)) && tableSource != null + && nvl(tableSource.getFilterSql()).length() > 0) { + if (whereCl.length() > 0) + whereCl.append(" AND "); + whereCl.append(Utils.replaceInString(Utils.replaceInString(tableSource + .getFilterSql(), "[" + ds.getTableName() + "]", ds.getTableId()), + "[USER_ID]", userId)); + } // if + } // for + + List reportCols = getAllColumns(); + + boolean isGroupStmt = false; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if (dc.isGroupBreak()) { + isGroupStmt = true; + break; + } // if + } // for + + // Identifying SELECT and GROUP BY clause fields and WHERE and HAVING + // clause filters + // Collections.sort(reportCols, new OrderSeqComparator()); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + String colName = getColumnSelectStr(dc, paramValues); + + // SELECT clause fields + if (dc.isVisible()) { + if (selectCl.length() > 0) + selectCl.append(", "); + selectCl.append(getSelectExpr(dc, colName)); + selectCl.append(" "); + selectCl.append(dc.getColId()); + } // if + + // Checking for extra fields necessary for drill-down + if (nvl(dc.getDrillDownURL()).length() > 0) + if (isViewAction(dc.getDrillDownURL())) + addExtraIdSelect(selectExtraIdCl, nvl(dc.getDrillDownParams()), true); + else + addExtraDateSelect(selectExtraDateCl, nvl(dc.getDrillDownParams()), + paramValues, true); + + // GROUP BY clause fields + if (dc.isGroupBreak()) { + if (groupByCl.length() > 0) + groupByCl.append(", "); + groupByCl.append(colName); + } // if + + // WHERE/HAVING clause fields + boolean isHavingCl = isGroupStmt && dc.isVisible() && (!dc.isGroupBreak()); + //boolean isHavingCl = isGroupStmt && (!dc.isGroupBreak()); + //StringBuffer filterCl = isHavingCl ? havingCl : whereCl; + StringBuffer filterCl = + isGroupStmt?(dc.isVisible()?(dc.isGroupBreak()?whereCl:havingCl):whereCl):whereCl; + if (dc.getColFilterList() != null) { + int fNo = 0; + List fList = dc.getColFilterList().getColFilter(); + for (Iterator iterF = fList.iterator(); iterF.hasNext(); fNo++) { + ColFilterType cf = (ColFilterType) iterF.next(); + + StringBuffer curFilter = new StringBuffer(); + if (filterCl.length() > 0) + curFilter.append(" " + cf.getJoinCondition() + " "); + if ((isHavingCl ? havingClCarryoverBrackets : whereClCarryoverBrackets) > 0) + for (int b = 0; b < (isHavingCl ? havingClCarryoverBrackets + : whereClCarryoverBrackets); b++) + filterCl.append('('); + curFilter.append(nvl(cf.getOpenBrackets())); + curFilter.append(colName + " "); + curFilter.append(cf.getExpression() + " "); + + boolean applyFilter = true; + if ((nvl(cf.getArgValue()).length() > 0) + || (nvl(cf.getArgType()).equals(AppConstants.AT_FORM))) + if (nvl(cf.getArgType()).equals(AppConstants.AT_FORMULA)) + curFilter.append(cf.getArgValue()); + else if (nvl(cf.getArgType()).equals(AppConstants.AT_VALUE)) + curFilter.append(formatValue(cf.getArgValue(), dc, false)); + else if (nvl(cf.getArgType()).equals(AppConstants.AT_LIST)) + curFilter.append(formatListValue(cf.getArgValue(), dc, false, + false)); + else if (nvl(cf.getArgType()).equals(AppConstants.AT_COLUMN)) + curFilter.append(getColumnNameById(cf.getArgValue())); + else if (nvl(cf.getArgType()).equals(AppConstants.AT_FORM)) { + String fieldName = getFormFieldName(cf); + String fieldValue = Utils.oracleSafe(paramValues + .getParamValue(fieldName)); + boolean isMultiValue = paramValues + .isParameterMultiValue(fieldName); + boolean usePipeDelimiterOnly = false; + + FormFieldType fft = getFormFieldByDisplayValue(cf.getArgValue()); + if (fft == null) + // If not FormField => applying default value + fieldValue = nvl(fieldValue, Utils + .oracleSafe(cf.getArgValue())); + else + usePipeDelimiterOnly = fft.getFieldType().equals( + FormField.FFT_CHECK_BOX) + || fft.getFieldType().equals(FormField.FFT_LIST_MULTI); + + if (nvl(fieldValue).length() == 0) + // Does not append filter with missing form + // field argument + applyFilter = false; + else if (isMultiValue || nvl(cf.getExpression()).equals("IN") + || nvl(cf.getExpression()).equals("NOT IN")) + curFilter.append(formatListValue(fieldValue, dc, true, + usePipeDelimiterOnly)); + else + curFilter.append(formatValue(fieldValue, dc, true)); + } // else + curFilter.append(nvl(cf.getCloseBrackets())); + + if (applyFilter) { + filterCl.append(curFilter.toString()); + + if (isHavingCl) { + havingClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl( + cf.getCloseBrackets()).length()); + havingClCarryoverBrackets = 0; + } else { + whereClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl( + cf.getCloseBrackets()).length()); + whereClCarryoverBrackets = 0; + } + } else if (nvl(cf.getOpenBrackets()).length() != nvl(cf.getCloseBrackets()) + .length()) + if (nvl(cf.getOpenBrackets()).length() > nvl(cf.getCloseBrackets()) + .length()) { + // Carry over opening brackets + if (isHavingCl) + havingClCarryoverBrackets += (nvl(cf.getOpenBrackets()) + .length() - nvl(cf.getCloseBrackets()).length()); + else + whereClCarryoverBrackets += (nvl(cf.getOpenBrackets()) + .length() - nvl(cf.getCloseBrackets()).length()); + + if (isHavingCl) + havingClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl( + cf.getCloseBrackets()).length()); + else + whereClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl( + cf.getCloseBrackets()).length()); + } else { + // Adding closing brackets + if (filterCl.length() > 0) { + for (int b = 0; b < nvl(cf.getCloseBrackets()).length() + - nvl(cf.getOpenBrackets()).length(); b++) + filterCl.append(')'); + + if (isHavingCl) + havingClBracketCount += (nvl(cf.getOpenBrackets()) + .length() - nvl(cf.getCloseBrackets()).length()); + else + whereClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl( + cf.getCloseBrackets()).length()); + } // if + } // else + } // for + } // if + } // for + + // Identifying ORDER BY clause fields + DataColumnType overrideSortByCol = null; + if (overrideSortByColId != null) + overrideSortByCol = getColumnById(overrideSortByColId); + + if (overrideSortByCol != null) { + orderByCl.append(getColumnSelectStr(overrideSortByCol, paramValues)); + orderByCl.append(" "); + orderByCl.append(nvl(overrideSortByAscDesc, AppConstants.SO_ASC)); + } else if (getReportType().equals(AppConstants.RT_CROSSTAB)) { + /* + * for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) { + * DataColumnType dc = (DataColumnType) iter.next(); + * + * if(nvl(dc.getCrossTabValue()).equals(AppConstants.CV_ROW)||nvl(dc.getCrossTabValue()).equals(AppConstants.CV_COLUMN)) { + * if(orderByCl.length()>0) orderByCl.append(", "); + * orderByCl.append(getColumnSelectStr(dc, paramValues)); + * orderByCl.append(" "); + * if(dc.getColType().equals(AppConstants.CT_DATE)) + * orderByCl.append(AppConstants.SO_DESC); else + * orderByCl.append(AppConstants.SO_ASC); } // if } // for + */ + } else { + Collections.sort(reportCols, new OrderBySeqComparator()); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + + if (dc.getOrderBySeq() > 0) { + if (orderByCl.length() > 0) + orderByCl.append(", "); + orderByCl.append(getColumnSelectStr(dc, paramValues)); + orderByCl.append(" "); + orderByCl.append(dc.getOrderByAscDesc()); + } // if + } // for + Collections.sort(reportCols, new OrderSeqComparator()); + } // else + + // Adding up the actual statement + StringBuffer sql = new StringBuffer(); + //sql.append("SELECT "); // Need to add PK for /*+ FIRST_ROWS */ "); + sql.append(Globals.getGenerateSqlVisualSelect()); + // sql.append((selectCl.length() == 0) ? "COUNT(*) cnt" : selectCl.toString()); + sql.append((selectCl.length() == 0) ? Globals.getGenerateSqlVisualCount() : selectCl.toString()); + if (groupByCl.length() == 0) + sql.append(selectExtraIdCl.toString()); + sql.append(selectExtraDateCl.toString()); + // sql.append(" FROM "); + sql.append((fromCl.length() == 0) ? Globals.getGenerateSqlVisualDual() : "FROM "+fromCl.toString()); + if (whereCl.length() > 0) { + if (whereClBracketCount > 0) { + for (int b = 0; b < whereClBracketCount; b++) + whereCl.append(')'); + } else if (whereClBracketCount < 0) { + for (int b = 0; b < Math.abs(whereClBracketCount); b++) + whereCl.insert(0, '('); + } // else + + sql.append(" WHERE "); + sql.append(whereCl.toString()); + } // if + if (groupByCl.length() > 0) { + sql.append(" GROUP BY "); + sql.append(groupByCl.toString()); + + if (havingCl.length() > 0) { + if (havingClBracketCount > 0) { + for (int b = 0; b < havingClBracketCount; b++) + havingCl.append(')'); + } else if (havingClBracketCount < 0) { + for (int b = 0; b < Math.abs(havingClBracketCount); b++) + havingCl.insert(0, '('); + } // else + + sql.append(" HAVING "); + sql.append(havingCl.toString()); + } + } + if (orderByCl.length() > 0) { + sql.append(" ORDER BY "); + sql.append(orderByCl.toString()); + } + + System.out.println("Created SQL statement: "+sql); + + //String sqlStr = Utils.replaceInString(sql.toString(), "[LOGGED_USERID]", userId); + //return sqlStr; + return sql.toString(); + } // generateSQLCrossTabVisual + + + public String generatePagedSQL(int pageNo, String userId, HttpServletRequest request, boolean getColumnNamesFromReportSQL, ReportParamValues paramValues) throws RaptorException { + int counter = 0; + if(!Globals.isMySQL()) + counter = 1; + return generateSubsetSQL(pageNo * getPageSize() + counter, ((pageNo + 1) * getPageSize()) + + ((pageNo == 0) ? 1 : 0), userId, request, getColumnNamesFromReportSQL, paramValues); + } // generatePagedSQL + + public String generateSubsetSQL(int startRow, int endRow, String userId, HttpServletRequest request, boolean getColumnNamesFromReportSQL, ReportParamValues paramValues) throws RaptorException { + //debugLogger.debug(" ******** End Row ********* " + endRow); + String dbInfo = getDBInfo(); + String dbType = ""; + if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { + try { + org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo(); + dbType = remDbInfo.getDBType(dbInfo); + } catch (Exception ex) { + throw new RaptorException(ex); + } + } + List reportCols = getAllColumns(); + String wholeSQL_OrderBy = getWholeSQL(); + String reportSQL = getWholeSQL(); + reportSQL = reportSQL.replace(";", ""); + setWholeSQL(reportSQL); + if(nvl(reportSQL).length()>0) + reportSQL = generateSQL(userId, request); + + if (reportSQL.toUpperCase().indexOf("ORDER BY ") < 0) { + StringBuffer sortBy = null; + + if (reportSQL.toUpperCase().indexOf("GROUP BY ") < 0) + if (getDataSourceList().getDataSource().size() > 0) { + DataSourceType dst = (DataSourceType) getDataSourceList().getDataSource() + .get(0); + String tId = dst.getTableId(); + String tPK = dst.getTablePK(); + if (nvl(tPK).length() > 0) { + sortBy = new StringBuffer(); + StringTokenizer st = new StringTokenizer(tPK, ", "); + while (st.hasMoreTokens()) { + if (sortBy.length() > 0) + sortBy.append(","); + sortBy.append(tId); + sortBy.append("."); + sortBy.append(st.nextToken()); + } // while + } + } // if + if (reportSQL.trim().toUpperCase().startsWith("SELECT")) { + //if (!(dbType.equals("DAYTONA") && reportSQL.trim().toUpperCase().startsWith("SELECT"))) + // reportSQL += " ORDER BY " + ((sortBy == null) ? "1" : sortBy.toString()); + } + } + + StringBuffer colNames = new StringBuffer(); + StringBuffer colExtraIdNames = new StringBuffer(); + StringBuffer colExtraDateNames = new StringBuffer(); + + if(getColumnNamesFromReportSQL) { + DataSet ds = ConnectionUtils.getDataSet(reportSQL, dbInfo); + List reportCols1 = getAllColumns(); + reportCols = new Vector(); + outer: + for (Iterator iter = reportCols1.iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + for (int k=0; k 0) + colNames.append(", "); + colNames.append(dc.getColId()); + //TODO uncomment if it's not working} // if + + // Checking for extra fields necessary for drill-down + if (nvl(dc.getDrillDownURL()).length() > 0) + if (isViewAction(dc.getDrillDownURL())) + addExtraIdSelect(colExtraIdNames, nvl(dc.getDrillDownParams()), false); + else + addExtraDateSelect(colExtraDateNames, nvl(dc.getDrillDownParams()), null, + false); + } // for + + if (reportSQL.toUpperCase().indexOf("GROUP BY ") < 0) + colNames.append(colExtraIdNames.toString()); + //commented to avoid coldId_dde + //colNames.append(colExtraDateNames.toString()); + + /* + * if(pageNo==0) if(reportSQL.toUpperCase().indexOf(" WHERE ")<0) + * if(reportSQL.toUpperCase().indexOf(" GROUP BY ")<0) reportSQL = + * reportSQL.substring(0, reportSQL.toUpperCase().indexOf(" ORDER BY + * "))+" WHERE ROWNUM <= + * "+getPageSize()+reportSQL.substring(reportSQL.toUpperCase().indexOf(" + * ORDER BY ")); else reportSQL = "SELECT "+colNames.toString()+" FROM + * (SELECT ROWNUM rnum, "+colNames.toString()+" FROM ("+reportSQL+") x) + * y WHERE rnum <= "+getPageSize()+" ORDER BY rnum"; else reportSQL = + * reportSQL.substring(0, reportSQL.toUpperCase().indexOf(" WHERE "))+" + * WHERE ROWNUM <= "+getPageSize()+" AND + * "+reportSQL.substring(reportSQL.toUpperCase().indexOf(" WHERE ")+7); + * else reportSQL = "SELECT "+colNames.toString()+" FROM (SELECT ROWNUM + * rnum, "+colNames.toString()+" FROM ("+reportSQL+") x) y WHERE rnum >= + * "+(pageNo*getPageSize()+1)+" AND rnum <= + * "+((pageNo+1)*getPageSize())+" ORDER BY rnum"; + */ + if (dbType.equals("DAYTONA") && reportSQL.trim().toUpperCase().startsWith("SELECT")) { + if(endRow == -1) endRow = (getMaxRowsInExcelDownload()>0)?getMaxRowsInExcelDownload():Globals.getDownloadLimit(); + reportSQL = reportSQL + " LIMIT TO " +(startRow==0?startRow+1:startRow)+"->"+endRow; + return reportSQL; + } else if (dbType.equals("DAYTONA")) { + return reportSQL; + } + + //reportSQL = "SELECT " + colNames.toString() + " FROM (SELECT ROWNUM rnum, " + // + colNames.toString() + " FROM (" + reportSQL + ") x "; + + String rSQL = Globals.getGenerateSubsetSql(); + rSQL = rSQL.replace("[colNames.toString()]", colNames.toString()); + rSQL = rSQL.replace("[reportSQL]", reportSQL); + + reportSQL=rSQL; + //added rownum for total report where row header need to be shown + //reportSQLOnlyFirstPart = "SELECT rnum," + colNames.toString() + " FROM (SELECT ROWNUM rnum, " + //+ colNames.toString() + " FROM (" ; + + reportSQLOnlyFirstPart = Globals.getReportSqlOnlyFirstPart(); + reportSQLOnlyFirstPart = reportSQLOnlyFirstPart.replace("[colNames.toString()]", colNames.toString()); + + + reportSQLWithRowNum = reportSQL; + + /* if( endRow != -1) + reportSQL += " WHERE ROWNUM <= " + endRow; + reportSQL += " ) y WHERE rnum >= " + startRow + " ORDER BY rnum"; + return reportSQL;*/ + String parta = Globals.getReportSqlOnlySecondPartA(); + String partb = Globals.getReportSqlOnlySecondPartB(); + + String partSql = ""; + if(!AppUtils.isNotEmpty(getDBType())){ + setDBType(Globals.getDBType()); + } + + int closeBracketPos = 0; + if(wholeSQL_OrderBy.lastIndexOf(")")!= -1) closeBracketPos = wholeSQL_OrderBy.lastIndexOf(")"); + int idxOrderBy = (closeBracketPos>0)?wholeSQL_OrderBy.toUpperCase().indexOf("ORDER BY", closeBracketPos):wholeSQL_OrderBy.toUpperCase().lastIndexOf("ORDER BY"); + String orderbyclause = ""; + if (idxOrderBy < 0) { + orderbyclause = " ORDER BY 1 "; + partSql += " "+ orderbyclause+ " "; + } + else { + orderbyclause = wholeSQL_OrderBy.substring(idxOrderBy); + partSql += " "+ orderbyclause+ " "; + } + + if(getDBType().equals(AppConstants.MYSQL)) { + partSql = "LIMIT "+ String.valueOf(startRow)+" , "+ String.valueOf(getPageSize()); + } else if(getDBType().equals(AppConstants.ORACLE)) { + reportSQL = reportSQL.replace(" AS ", " "); + partSql = "where rownum >= "+ String.valueOf(startRow)+" and rownum <= "+(Integer.parseInt(String.valueOf(startRow)) + Integer.parseInt(String.valueOf(getPageSize()))); + } else if(getDBType().equals(AppConstants.POSTGRESQL)) { + partSql = "LIMIT "+ String.valueOf(getPageSize())+" , "+ String.valueOf(startRow);//limit [pageSize] offset [startRow] + } + + // Limit only to MYSQL or MariaDB + //if (reportSQL.toUpperCase().indexOf("ORDER BY ") < 0) + //partSql += " ORDER BY 1"; + //else { + + + + /*if(!Globals.isMySQL()) + parta = parta.replace("[endRow]", String.valueOf(endRow)); + else + parta = parta.replace("[startRow]", String.valueOf(startRow)); + + //String partb = Globals.getReportSqlOnlySecondPartB(); + if(!Globals.isMySQL()) + partb = partb.replace("[startRow]", String.valueOf(startRow)); + else + partb = partb.replace("[pageSize]", String.valueOf(getPageSize())); + + if( endRow != -1) + reportSQL += parta;*/ + reportSQL += partSql; + + return reportSQL; + + } // generateSubsetSQL + + public String generateChartSQL(ReportParamValues paramValues, String userId, HttpServletRequest request ) throws RaptorException { + List reportCols = getAllColumns(); + List chartValueCols = getChartValueColumnsList(AppConstants.CHART_ALL_COLUMNS, null); // parameter is 0 has this requires all columns. + String reportSQL = generateSQL(userId, request); + //if(nvl(reportSQL).length()>0) reportSQL = generatedChartSQL; + logger.debug(EELFLoggerDelegate.debugLogger, ("SQL " + reportSQL)); + String legendCol = "1 a"; + // String valueCol = "1"; + StringBuffer groupCol = new StringBuffer(); + StringBuffer seriesCol = new StringBuffer(); + StringBuffer valueCols = new StringBuffer(); + + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + String colName = getColumnSelectStr(dc, paramValues); + if (nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND)) + legendCol = getSelectExpr(dc, colName)+" " + dc.getColId(); + // if(dc.getChartSeq()>0) + // valueCol = "NVL("+colName+", 0) "+dc.getColId(); + if ((!nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND)) + && (dc.getChartSeq()==null || dc.getChartSeq() <= 0) && dc.isGroupBreak()) { + groupCol.append(", "); + groupCol.append(colName + " " + dc.getColId()); + } + } // for + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if(dc.isChartSeries()!=null && dc.isChartSeries().booleanValue()) { + //System.out.println("*****************, "+ " " +getColumnSelectStr(dc, paramValues)+ " "+ getSelectExpr(dc,getColumnSelectStr(dc, paramValues))); + seriesCol.append(", "+ getSelectExpr(dc,getColumnSelectStr(dc, paramValues))+ " " + dc.getColId()); + } + } + + /*for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if(!dc.isChartSeries() && !(nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))) { + //System.out.println("*****************, "+ " " +getColumnSelectStr(dc, paramValues)+ " "+ getSelectExpr(dc,getColumnSelectStr(dc, paramValues))); + seriesCol.append(", "+ formatChartColumn(getSelectExpr(dc,getColumnSelectStr(dc, paramValues)))+ " " + dc.getColId()); + } + }*/ + + for (Iterator iter = chartValueCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + String colName = getColumnSelectStr(dc, paramValues); + //valueCols.append(", NVL(" + formatChartColumn(colName) + ",0) " + dc.getColId()); + seriesCol.append("," + formatChartColumn(colName) + " " + dc.getColId()); + } // for + + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + String colName = getColumnSelectStr(dc, paramValues); + if(colName.equals(AppConstants.RI_CHART_TOTAL_COL)) + seriesCol.append(", " + AppConstants.RI_CHART_TOTAL_COL + " " + AppConstants.RI_CHART_TOTAL_COL ); + if (colName.equals(AppConstants.RI_CHART_COLOR)) + seriesCol.append(", " + AppConstants.RI_CHART_COLOR + " " + AppConstants.RI_CHART_COLOR ); + if(colName.equals(AppConstants.RI_CHART_MARKER_START)) + seriesCol.append(", " + AppConstants.RI_CHART_MARKER_START + " " + AppConstants.RI_CHART_MARKER_START ); + if(colName.equals(AppConstants.RI_CHART_MARKER_END)) + seriesCol.append(", " + AppConstants.RI_CHART_MARKER_END + " " + AppConstants.RI_CHART_MARKER_END ); + if(colName.equals(AppConstants.RI_CHART_MARKER_TEXT_LEFT)) + seriesCol.append(", " + AppConstants.RI_CHART_MARKER_TEXT_LEFT + " " + AppConstants.RI_CHART_MARKER_TEXT_LEFT ); + if(colName.equals(AppConstants.RI_CHART_MARKER_TEXT_RIGHT)) + seriesCol.append(", " + AppConstants.RI_CHART_MARKER_TEXT_RIGHT + " " + AppConstants.RI_CHART_MARKER_TEXT_RIGHT ); + if(colName.equals(AppConstants.RI_ANOMALY_TEXT)) + seriesCol.append(", " + AppConstants.RI_ANOMALY_TEXT + " " + AppConstants.RI_ANOMALY_TEXT ); + } + + //debugLogger.debug("ReportSQL Chart " + reportSQL ); + /*for (Iterator iter = chartValueCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + String colName = getColumnSelectStr(dc, paramValues); + //valueCols.append(", NVL(" + formatChartColumn(colName) + ",0) " + dc.getColId()); + valueCols.append("," + formatChartColumn(colName) + " " + dc.getColId()); + } // for + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + String colName = getColumnSelectStr(dc, paramValues); + //if(colName.equals(AppConstants.RI_CHART_TOTAL_COL) || colName.equals(AppConstants.RI_CHART_COLOR)) { + if(colName.equals(AppConstants.RI_CHART_TOTAL_COL)) + valueCols.append(", " + AppConstants.RI_CHART_TOTAL_COL + " " + AppConstants.RI_CHART_TOTAL_COL ); + if (colName.equals(AppConstants.RI_CHART_COLOR)) + valueCols.append(", " + AppConstants.RI_CHART_COLOR + " " + AppConstants.RI_CHART_COLOR ); + if (colName.equals(AppConstants.RI_CHART_INCLUDE)) + valueCols.append(", " + AppConstants.RI_CHART_INCLUDE + " " + AppConstants.RI_CHART_INCLUDE ); + //} + }*/ + String final_sql = ""; + reportSQL = Utils.replaceInString(reportSQL, " from ", " FROM "); + reportSQL = Utils.replaceInString(reportSQL, " select ", " SELECT "); + reportSQL = Utils.replaceInString(reportSQL, " union ", " UNION "); + //reportSQL = reportSQL.replaceAll("[\\s]*\\(", "("); +// if(reportSQL.indexOf("UNION") != -1) { +// if(reportSQL.indexOf("FROM(")!=-1) +// final_sql += " "+reportSQL.substring(reportSQL.indexOf("FROM(") ); +// else if (reportSQL.indexOf("FROM (")!=-1) +// final_sql += " "+reportSQL.substring(reportSQL.indexOf("FROM (") ); +// //TODO ELSE THROW ERROR +// } +// else { +// final_sql += " "+reportSQL.substring(reportSQL.toUpperCase().indexOf(" FROM ")); +// } + int pos = 0; + int pos_first_select = 0; + int pos_dup_select = 0; + int pos_prev_select = 0; + int pos_last_select = 0; + if (reportSQL.indexOf("FROM", pos)!=-1) { + pos = reportSQL.indexOf("FROM", pos); + pos_dup_select = reportSQL.lastIndexOf("SELECT",pos); + pos_first_select = reportSQL.indexOf("SELECT");//,pos); + logger.debug(EELFLoggerDelegate.debugLogger, ("pos_select " + pos_first_select + " " + pos_dup_select)); + if(pos_dup_select > pos_first_select) { + logger.debug(EELFLoggerDelegate.debugLogger, ("********pos_dup_select ********" + pos_dup_select)); + //pos_dup_select1 = pos_dup_select; + pos_prev_select = pos_first_select; + pos_last_select = pos_dup_select; + while (pos_last_select > pos_prev_select) { + logger.debug(EELFLoggerDelegate.debugLogger, ("pos_last , pos_prev " + pos_last_select + " " + pos_prev_select)); + pos = reportSQL.indexOf("FROM", pos+2); + pos_prev_select = pos_last_select; + pos_last_select = reportSQL.lastIndexOf("SELECT",pos); + logger.debug(EELFLoggerDelegate.debugLogger, ("in WHILE LOOP LAST " + pos_last_select)); + } + } + + } + final_sql += " "+reportSQL.substring(pos); + logger.debug(EELFLoggerDelegate.debugLogger, ("Final SQL " + final_sql)); + String sql = "SELECT " + legendCol + ", " + legendCol+"_1" + seriesCol.toString()+ nvl(valueCols.toString(), ", 1") + + groupCol.toString() + + final_sql; + logger.debug(EELFLoggerDelegate.debugLogger, ("Final sql in generateChartSQL " +sql)); + + return sql; + } // generateChartSQL + + private String formatChartColumn(String colName) { + + logger.debug(EELFLoggerDelegate.debugLogger, ("Format Chart Column Input colName" + colName)); + colName = colName.trim(); + colName = Utils.replaceInString(colName, "TO_CHAR", "to_char"); + colName = Utils.replaceInString(colName, "to_number", "TO_NUMBER"); + //reportSQL = reportSQL.replaceAll("[\\s]*\\(", "("); + colName = colName.replaceAll(",[\\s]*\\(", ",("); + StringBuffer colNameBuf = new StringBuffer(colName); + int pos = 0, posFormatStart = 0, posFormatEnd = 0; + String format = ""; + if(colNameBuf.indexOf("999")==-1 && colNameBuf.indexOf("990")==-1) { + logger.debug(EELFLoggerDelegate.debugLogger, (" return colName " + colNameBuf.toString())); + return colNameBuf.toString(); + } + while (colNameBuf.indexOf("to_char")!=-1) { + if(colNameBuf.indexOf("999")!=-1 || colNameBuf.indexOf("990")!=-1) { + pos = colNameBuf.indexOf("to_char"); + colNameBuf.insert(pos, " TO_NUMBER ( CR_RAPTOR.SAFE_TO_NUMBER ("); + pos = colNameBuf.indexOf("to_char"); + colNameBuf.replace(pos, pos+7, "TO_CHAR"); + //colName = Utils.replaceInString(colNameBuf.toString(), "to_char", " TO_NUMBER ( CR_RAPTOR.SAFE_TO_NUMBER ( TO_CHAR "); + logger.debug(EELFLoggerDelegate.debugLogger, ("After adding to_number " + colNameBuf.toString())); + //posFormatStart = colNameBuf.lastIndexOf(",'")+1; + posFormatStart = colNameBuf.indexOf(",'", pos)+1; + posFormatEnd = colNameBuf.indexOf(")",posFormatStart); + logger.debug(EELFLoggerDelegate.debugLogger, (posFormatStart + " " + posFormatEnd + " "+ pos)); + format = colNameBuf.substring(posFormatStart, posFormatEnd); + //posFormatEnd = colNameBuf.indexOf(")",posFormatEnd); + colNameBuf.insert(posFormatEnd+1, " ," + format + ") , "+ format + ")"); + logger.debug(EELFLoggerDelegate.debugLogger, ("colNameBuf " + colNameBuf.toString())); + } + } + logger.debug(EELFLoggerDelegate.debugLogger, (" return colName " + colNameBuf.toString())); + return colNameBuf.toString(); + } + public String generateTotalSQLLinear(ReportParamValues paramValues, String userId, HttpServletRequest request) throws RaptorException { + List reportCols = getAllColumns(); + String reportSQL = generateSQL(userId,request); + //debugLogger.debug("After GenerateSQL " + reportSQL); + + StringBuffer sbSelect = new StringBuffer(); + StringBuffer sbTotal = new StringBuffer(); + StringBuffer colNames = new StringBuffer(); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + + DataColumnType dc = (DataColumnType) iter.next(); + if (colNames.length() > 0) + colNames.append(", "); + colNames.append(dc.getColId()); + } + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + + //if (!dct.isVisible()) + // continue; + + String colName = getColumnSelectStr(dct, paramValues); + + sbSelect.append((sbSelect.length() == 0) ? "SELECT " : ", "); + + sbSelect.append(colName); + sbSelect.append(" "); + sbSelect.append(dct.getColId()); + + + sbTotal.append((sbTotal.length() == 0) ? "SELECT " : ", "); + if (nvl(dct.getDisplayTotal()).length() > 0) { + // sbTotal.append(getSelectExpr(dct, + // dct.getDisplayTotal()+dct.getColId()+")")); + String displayTotal = dct.getDisplayTotal(); + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < displayTotal.length(); i++) { + char ch = displayTotal.charAt(i); + if (ch == '+' || ch == '-') + sb.append(dct.getColId() + ")"); + sb.append(ch); + } // for + sb.append(dct.getColId() + ")"); + + //debugLogger.debug("SB " + sb.toString() + "\n " + getSelectExpr(dct, sb.toString())); + sbTotal.append(getSelectExpr(dct, sb.toString())); + //debugLogger.debug("SBTOTAL " + sbTotal.toString()); + } else + sbTotal.append("NULL"); + sbTotal.append(" total_"); + sbTotal.append(dct.getColId()); + } // for + + //debugLogger.debug(" ****** " + sbTotal.toString()); + logger.debug(EELFLoggerDelegate.debugLogger, ("REPORTWRAPPER " + reportSQL)); + int pos = 0; + int pos_first_select = 0; + int pos_dup_select = 0; + int pos_prev_select = 0; + int pos_last_select = 0; + + //reportSQL = Utils.replaceInString(reportSQL, " from ", " FROM "); + //reportSQL = Utils.replaceInString(reportSQL, "select ", "SELECT "); + reportSQL = replaceNewLine(reportSQL, " from ", " FROM "); + reportSQL = replaceNewLine(reportSQL, "from ", " FROM "); + reportSQL = replaceNewLine(reportSQL, "FROM ", " FROM "); + + reportSQL = " "+reportSQL; + reportSQL = replaceNewLine(reportSQL, "select ", " SELECT "); + reportSQL = replaceNewLine(reportSQL, "SELECT ", " SELECT "); + if (reportSQL.indexOf("FROM", pos)!=-1) { + pos = reportSQL.indexOf("FROM", pos); + pos_dup_select = reportSQL.lastIndexOf("SELECT",pos); + pos_first_select = reportSQL.indexOf("SELECT");//,pos); + logger.debug(EELFLoggerDelegate.debugLogger, ("pos_select " + pos_first_select + " " + pos_dup_select)); + if(pos_dup_select > pos_first_select) { + logger.debug(EELFLoggerDelegate.debugLogger, ("********pos_dup_select ********" + pos_dup_select)); + //pos_dup_select1 = pos_dup_select; + pos_prev_select = pos_first_select; + pos_last_select = pos_dup_select; + while (pos_last_select > pos_prev_select) { + logger.debug(EELFLoggerDelegate.debugLogger, ("pos_last , pos_prev " + pos_last_select + " " + pos_prev_select)); + pos = reportSQL.indexOf("FROM", pos+2); + pos_prev_select = pos_last_select; + pos_last_select = reportSQL.lastIndexOf("SELECT",pos); + logger.debug(EELFLoggerDelegate.debugLogger, ("in WHILE LOOP LAST " + pos_last_select)); + } + } + + } + + + //sbSelect.append(reportSQL.substring(reportSQL.toUpperCase().indexOf(" FROM "))); + + logger.debug(EELFLoggerDelegate.debugLogger, (" *************** " + pos + " " + reportSQL)); + //sbSelect.append(" "+ reportSQL.substring(pos)); + sbSelect.append(" "+reportSQL.substring(pos)); + logger.debug(EELFLoggerDelegate.debugLogger, (" **************** " + sbSelect.toString())); + sbTotal.append(" FROM ("); + sbTotal.append(sbSelect.toString()); + sbTotal.append(") totalSQL"); + + String dbType = ""; + String dbInfo = getDBInfo(); + if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { + try { + org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo(); + dbType = remDbInfo.getDBType(dbInfo); + } catch (Exception ex) { + throw new RaptorException(ex); + } + } + if (dbType.equals("DAYTONA")) { + sbTotal.append("("+ colNames+ ")"); + } + String sql = sbTotal.toString(); + sql = Utils.replaceInString(sql, " from ", " FROM "); + sql = Utils.replaceInString(sql, "select ", "SELECT "); + //sql = Utils.replaceInString(sql, " select ", " SELECT "); + logger.debug(EELFLoggerDelegate.debugLogger, ("Before SQL Corrector " + sql)); + String corrected_SQL = new SQLCorrector().fixSQL(new StringBuffer(sql)); + logger.debug(EELFLoggerDelegate.debugLogger, ("************")); + logger.debug(EELFLoggerDelegate.debugLogger, ("Corrected SQL " + corrected_SQL)); + return corrected_SQL; + //return sbTotal.toString(); + } // generateTotalSQLLinear + + public String generateTotalSQLCrossTab(String sql, String rowColPos, + String userId, HttpServletRequest request, ReportParamValues paramValues) throws RaptorException { + List reportCols = getAllColumns(); + String reportSQL = sql; + + StringBuffer sbSelect = new StringBuffer(); + StringBuffer sbGroup = new StringBuffer(); + // StringBuffer sbOrder = new StringBuffer(); + StringBuffer sbTotal = new StringBuffer(); + StringBuffer colNames = new StringBuffer(); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + + DataColumnType dc = (DataColumnType) iter.next(); + if (colNames.length() > 0) + colNames.append(", "); + colNames.append(dc.getColId()); + } + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + + if (!dct.isVisible()) + continue; + + + String colName = getColumnSelectStr(dct, paramValues); + String colExpr = getSelectExpr(dct, colName); + + sbSelect.append((sbSelect.length() == 0) ? "SELECT " : ", "); + + if (nvl(dct.getCrossTabValue()).equals(rowColPos)) { + //sbSelect.append(colExpr); + sbSelect.append(dct.getColId()); + sbGroup.append((sbGroup.length() == 0) ? " GROUP BY " : ", "); + sbGroup.append(dct.getColId()); + + /* + * sbOrder.append((sbOrder.length()==0)?" ORDER BY ":", "); + * sbOrder.append(dct.getColId()); + * if(dct.getColType().equals(AppConstants.CT_DATE)) + * sbOrder.append(" DESC"); + */ + + sbTotal.append((sbTotal.length() == 0) ? "SELECT " : ", "); + sbTotal.append(dct.getColId()); + } else if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_VALUE)) { + //sbSelect.append(colName); + sbSelect.append(dct.getColId()); + + String displayTotal = getCrossTabDisplayTotal(rowColPos); + if (displayTotal.length() > 0) { + // displayTotal += dct.getColId()+")"; + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < displayTotal.length(); i++) { + char ch = displayTotal.charAt(i); + if (ch == '+' || ch == '-') + sb.append(dct.getColId() + ")"); + sb.append(ch); + } // for + sb.append(dct.getColId() + ")"); + + displayTotal = sb.toString(); + } else + displayTotal = "COUNT(*)"; + + sbTotal.append((sbTotal.length() == 0) ? "SELECT " : ", "); + sbTotal.append(getSelectExpr(dct, displayTotal)); + sbTotal.append(" total_"); + sbTotal.append(dct.getColId()); + } else { + //sbSelect.append(colExpr); + sbSelect.append(dct.getColId()); + } // if + + sbSelect.append(" "); + sbSelect.append(dct.getColId()); + } // for + + sbSelect.append(reportSQL.substring(reportSQL.toUpperCase().indexOf(" FROM "))); + + sbTotal.append(" FROM ("); + sbTotal.append(sbSelect.toString()); + sbTotal.append(") totalSQL"); + sbTotal.append(sbGroup.toString()); + String dbType = ""; + String dbInfo = getDBInfo(); + if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { + try { + org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo(); + dbType = remDbInfo.getDBType(dbInfo); + } catch (Exception ex) { + throw new RaptorException(ex); + } + } + if (dbType.equals("DAYTONA")) { + sbTotal.append("("+ colNames+ ")"); + } + + // sbTotal.append(sbOrder.toString()); + + //debugLogger.debug(getReportDefType() + " " + AppConstants.RD_SQL_BASED); + //debugLogger.debug("SQL To Delete " + sbTotal.toString()); + sql = ""; + if (getReportDefType().equals(AppConstants.RD_SQL_BASED)) { + sql = Utils.replaceInString(sbTotal.toString(), " from ", " FROM "); + sql = Utils.replaceInString(sql, "select ", "SELECT "); + return new SQLCorrector().fixSQL(new StringBuffer(sql)); + } + + return sbTotal.toString(); + + } // generateTotalSQLCrossTab + + + public String generateTotalSQLCrossTab(ReportParamValues paramValues, String rowColPos, + String userId, HttpServletRequest request) throws RaptorException { + List reportCols = getAllColumns(); + String reportSQL = generateSQL(userId, request); + + StringBuffer sbSelect = new StringBuffer(); + StringBuffer sbGroup = new StringBuffer(); + // StringBuffer sbOrder = new StringBuffer(); + StringBuffer sbTotal = new StringBuffer(); + StringBuffer colNames = new StringBuffer(); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + + DataColumnType dc = (DataColumnType) iter.next(); + if (colNames.length() > 0) + colNames.append(", "); + colNames.append(dc.getColId()); + } + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + + if (!dct.isVisible()) + continue; + + String colName = getColumnSelectStr(dct, paramValues); + String colExpr = getSelectExpr(dct, colName); + + sbSelect.append((sbSelect.length() == 0) ? "SELECT " : ", "); + + if (nvl(dct.getCrossTabValue()).equals(rowColPos)) { + sbSelect.append(colExpr); + + sbGroup.append((sbGroup.length() == 0) ? " GROUP BY " : ", "); + sbGroup.append(dct.getColId()); + + /* + * sbOrder.append((sbOrder.length()==0)?" ORDER BY ":", "); + * sbOrder.append(dct.getColId()); + * if(dct.getColType().equals(AppConstants.CT_DATE)) + * sbOrder.append(" DESC"); + */ + + sbTotal.append((sbTotal.length() == 0) ? "SELECT " : ", "); + sbTotal.append(dct.getColId()); + } else if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_VALUE)) { + sbSelect.append(colName); + + String displayTotal = getCrossTabDisplayTotal(rowColPos); + if (displayTotal.length() > 0) { + // displayTotal += dct.getColId()+")"; + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < displayTotal.length(); i++) { + char ch = displayTotal.charAt(i); + if (ch == '+' || ch == '-') + sb.append(dct.getColId() + ")"); + sb.append(ch); + } // for + sb.append(dct.getColId() + ")"); + + displayTotal = sb.toString(); + } else + displayTotal = "COUNT(*)"; + + sbTotal.append((sbTotal.length() == 0) ? "SELECT " : ", "); + sbTotal.append(getSelectExpr(dct, displayTotal)); + sbTotal.append(" total_"); + sbTotal.append(dct.getColId()); + } else { + sbSelect.append(colExpr); + } // if + + sbSelect.append(" "); + sbSelect.append(dct.getColId()); + } // for + + sbSelect.append(reportSQL.substring(reportSQL.toUpperCase().indexOf(" FROM "))); + + sbTotal.append(" FROM ("); + sbTotal.append(sbSelect.toString()); + sbTotal.append(") totalSQL"); + sbTotal.append(sbGroup.toString()); + String dbType = ""; + String dbInfo = getDBInfo(); + if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { + try { + org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo(); + dbType = remDbInfo.getDBType(dbInfo); + } catch (Exception ex) { + throw new RaptorException(ex); + } + } + if (dbType.equals("DAYTONA")) { + sbTotal.append("("+ colNames+ ")"); + } + + // sbTotal.append(sbOrder.toString()); + + //debugLogger.debug(getReportDefType() + " " + AppConstants.RD_SQL_BASED); + //debugLogger.debug("SQL To Delete " + sbTotal.toString()); + String sql = ""; + if (getReportDefType().equals(AppConstants.RD_SQL_BASED)) { + sql = Utils.replaceInString(sbTotal.toString(), " from ", " FROM "); + sql = Utils.replaceInString(sql, "select ", "SELECT "); + return new SQLCorrector().fixSQL(new StringBuffer(sql)); + } + + return sbTotal.toString(); + + } // generateTotalSQLCrossTab + + public String generateDistinctValuesSQL(ReportParamValues paramValues, DataColumnType dct, + String userId, HttpServletRequest request) throws RaptorException { + DataSourceType dst = getColumnTableById(dct.getColId()); + String colName = getColumnSelectStr(dct, paramValues); + String colExpr = getSelectExpr(dct, colName); + ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); + StringBuffer sb = new StringBuffer(); + sb.append("SELECT DISTINCT "); + if (getReportDefType().equals(AppConstants.RD_SQL_BASED)) { + sb.append(dct.getColId()); + sb.append(" FROM ("); + //paramvalues added below to filter distinct values based on formfields. + //sb.append(generateSQL(paramValues, userId, request)); + sb.append(rr.getWholeSQL()); + sb.append(") " + (Globals.isPostgreSQL() || Globals.isMySQL() ?" AS ":"") + " report_sql ORDER BY 1"); + } else { + sb.append(colExpr); + sb.append(" "); + sb.append(dct.getColId()); + if (!colExpr.equals(colName)) { + sb.append(", "); + sb.append(colName); + } // if + sb.append(" FROM "); + sb.append(dst.getTableName()); + sb.append(" "); + sb.append(dst.getTableId()); + sb.append(" ORDER BY "); + sb.append(colName); + if (dct.getColType().equals(AppConstants.CT_DATE)) + sb.append(" DESC"); + } // else + + return sb.toString(); + } // generateDistinctValuesSQL + + /** ************************************************************************************************* */ + + public DataSourceType getTableWithoutColumns() { + List dsList = getDataSourceList().getDataSource(); + for (Iterator iter = dsList.iterator(); iter.hasNext();) { + DataSourceType ds = (DataSourceType) iter.next(); + + if (ds.getDataColumnList().getDataColumn().size() == 0) + return ds; + } // for + + return null; + } // getTableWithoutColumns + + public CustomReportType cloneCustomReportClearTables() throws RaptorException { + ReportWrapper nrw = new ReportWrapper(cloneCustomReport(), reportID, getOwnerID(), + getCreateID(), getCreateDate(), getUpdateID(), getUpdateDate(), getMenuID(), + isMenuApproved()); + + DataSourceType ndst = null; + while ((ndst = nrw.getTableWithoutColumns()) != null) + nrw.deleteDataSourceType(ndst.getTableId()); + + return nrw.getCustomReport(); + } // cloneCustomReportClearTables + + public String marshal() throws RaptorException { + StringWriter sw = new StringWriter(); + ObjectFactory objFactory = new ObjectFactory(); + + try { + JAXBContext jc = JAXBContext.newInstance("org.openecomp.portalsdk.analytics.xmlobj"); + Marshaller m = jc.createMarshaller(); + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + //JAXBElement jaxbElement = new JAXBElement(new QName("customReport"), Object.class, ""); + //m.marshal( System.out ); + //m.marshal(jaxbElement, new StreamResult(sw)); + m.marshal((getTableWithoutColumns() == null) ? objFactory.createCustomReport(cr) : objFactory.createCustomReport(cloneCustomReportClearTables()), + new StreamResult(sw)); + } catch (JAXBException ex) { + throw new RaptorException (ex.getMessage(), ex.getCause()); + } + return sw.toString(); + } // marshal + + public static CustomReportType unmarshalCR(String reportXML) throws RaptorException { + //CustomReport cr = null; + try { + JAXBContext jc = JAXBContext.newInstance("org.openecomp.portalsdk.analytics.xmlobj"); + Unmarshaller u = jc.createUnmarshaller(); + javax.xml.bind.JAXBElement doc = (javax.xml.bind.JAXBElement) u.unmarshal(new java.io.StringReader( + reportXML)); + return doc.getValue(); + } catch (JAXBException ex) { + ex.printStackTrace(); + throw new RaptorException (ex.getMessage(), ex.getCause()); + } + + + } // unmarshal + + protected static CustomReportType createBlankCR() throws RaptorException { + return createBlankCR("N/A"); + } // createBlank + + protected static CustomReportType createBlankCR(String createID) throws RaptorException { + ObjectFactory objFactory = new ObjectFactory(); + CustomReportType cr = objFactory.createCustomReportType(); + //CustomReport cr = null; + try { + //cr = (CustomReport) objFactory.createCustomReport(customReportType); + + cr.setReportName(""); + cr.setReportDescr(""); + cr.setChartType(""); + cr.setPublic(false); + cr.setCreateId(createID); + cr.setCreateDate(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar())); + // cr.setReportSQL(""); + cr.setReportType(""); + cr.setPageSize(50); + + DataSourceList dataSourceList = objFactory.createDataSourceList(); + cr.setDataSourceList(dataSourceList); + } catch (DatatypeConfigurationException ex) { + throw new RaptorException (ex.getMessage(), ex.getCause()); + } + return cr; + } // createBlank + + protected void replaceCustomReportWithClone() throws RaptorException { + try { + CustomReportType clone = cloneCustomReport(); + this.cr = clone; + } catch (Exception e) { + e.printStackTrace(); + logger.debug(EELFLoggerDelegate.debugLogger, ("[SYSTEM ERROR] ReportWrapper.replaceCustomReportWithClone generated exception for report [" + + reportID + "]. Exception: " + e.getMessage())); + throw new RaptorException("[SYSTEM ERROR] ReportWrapper.replaceCustomReportWithClone generated exception for report [" + + reportID + "]. Exception: " + e.getMessage(), e.getCause()); + } + } // replaceCustomReportWithClone + + /** ************************************************************************************************* */ + + public FormatType cloneFormatType(ObjectFactory objFactory, FormatType ft) + throws JAXBException { + FormatType nft = objFactory.createFormatType(); + + nft.setLessThanValue(ft.getLessThanValue()); + nft.setExpression(ft.getExpression()); + nft.setBold(ft.isBold()); + nft.setItalic(ft.isItalic()); + nft.setUnderline(ft.isUnderline()); + if (nvl(ft.getBgColor()).length() > 0) + nft.setBgColor(ft.getBgColor()); + if (nvl(ft.getFontColor()).length() > 0) + nft.setFontColor(ft.getFontColor()); + if (nvl(ft.getFontFace()).length() > 0) + nft.setFontFace(ft.getFontFace()); + if (nvl(ft.getFontSize()).length() > 0) + nft.setFontSize(ft.getFontSize()); + if (nvl(ft.getAlignment()).length() > 0) + nft.setAlignment(ft.getAlignment()); + if (nvl(ft.getComment()).length() > 0) + nft.setComment(ft.getComment()); + + nft.setFormatId(ft.getFormatId()); + + return nft; + } // cloneFormatType + + public SemaphoreType cloneSemaphoreType(ObjectFactory objFactory, SemaphoreType st) + throws JAXBException { + SemaphoreType nst = objFactory.createSemaphoreType(); + + nst.setSemaphoreName(st.getSemaphoreName()); + nst.setSemaphoreType(st.getSemaphoreType()); + nst.setSemaphoreId(st.getSemaphoreId()); + if (nvl(st.getComment()).length() > 0) + nst.setComment(st.getComment()); + + if (st.getFormatList() != null) { + FormatList formatList = objFactory.createFormatList(); + nst.setFormatList(formatList); + + for (Iterator iter = st.getFormatList().getFormat().iterator(); iter.hasNext();) + formatList.getFormat().add( + cloneFormatType(objFactory, (FormatType) iter.next())); + } // if + + return nst; + } // cloneSemaphoreType + + public Reports cloneDashboardType(ObjectFactory objFactory, Reports rpt) + throws JAXBException { + Reports nrpt = objFactory.createReports(); + + nrpt.setReportId(rpt.getReportId()); + nrpt.setBgcolor(rpt.getBgcolor()); + return nrpt; + } // cloneDashboardType + + public Marker cloneMarkerType(ObjectFactory objFactory, Marker marker) + throws JAXBException { + Marker nMarker = objFactory.createMarker(); + nMarker.setAddressColumn(marker.getAddressColumn()); + nMarker.setDataColumn(marker.getDataColumn()); + nMarker.setDataHeader(marker.getDataHeader()); + nMarker.setMarkerColor(marker.getMarkerColor()); + return nMarker; + } // cloneDashboardType + + public ChartDrillFormfield cloneChartDrillFormfield(ObjectFactory objFactory, ChartDrillFormfield chartDrillFormfield) + throws JAXBException { + ChartDrillFormfield nChartDrillFormfield = objFactory.createChartDrillFormfield(); + nChartDrillFormfield.setFormfield(chartDrillFormfield.getFormfield()); + return nChartDrillFormfield; + } // cloneDashboardType + + public boolean isChartDrillDownContainsName(String name) { + for (Iterator iter = getChartDrillOptions().getTargetFormfield().iterator(); iter + .hasNext();) { + org.openecomp.portalsdk.analytics.xmlobj.ChartDrillFormfield cdf = (org.openecomp.portalsdk.analytics.xmlobj.ChartDrillFormfield) iter.next(); + if(cdf.getFormfield().equals(name)) { + return true; + } + } + return false; + } + public FormFieldType cloneFormFieldType(ObjectFactory objFactory, FormFieldType fft) + throws JAXBException { + FormFieldType nfft = objFactory.createFormFieldType(); + + nfft.setColId(fft.getColId()); + nfft.setFieldName(fft.getFieldName()); + nfft.setFieldType(fft.getFieldType()); + if (nvl(fft.getVisible()).length() > 0) + nfft.setVisible(fft.getVisible()); + if (nvl(fft.getValidationType()).length() > 0) + nfft.setValidationType(fft.getValidationType()); + if (nvl(fft.getMandatory()).length() > 0) + nfft.setMandatory(fft.getMandatory()); + if (nvl(fft.getDefaultValue()).length() > 0) + nfft.setDefaultValue(fft.getDefaultValue()); + nfft.setOrderBySeq(fft.getOrderBySeq()); + if (nvl(fft.getFieldSQL()).length() > 0) + nfft.setFieldSQL(fft.getFieldSQL()); + if (nvl(fft.getFieldDefaultSQL()).length() > 0) + nfft.setFieldDefaultSQL(fft.getFieldDefaultSQL()); + if(fft.getRangeStartDate()!=null) + nfft.setRangeStartDate(fft.getRangeStartDate()); + if(fft.getRangeEndDate()!=null) + nfft.setRangeEndDate(fft.getRangeEndDate()); + if(fft.getRangeStartDateSQL()!=null) + nfft.setRangeStartDateSQL(fft.getRangeStartDateSQL()); + if(fft.getRangeEndDateSQL()!=null) + nfft.setRangeEndDateSQL(fft.getRangeEndDateSQL()); + + if (nvl(fft.getComment()).length() > 0) + nfft.setComment(fft.getComment()); + + if (fft.getPredefinedValueList() != null) { + PredefinedValueList predefinedValueList = objFactory.createPredefinedValueList(); + nfft.setPredefinedValueList(predefinedValueList); + + for (Iterator iter = fft.getPredefinedValueList().getPredefinedValue().iterator(); iter + .hasNext();) + predefinedValueList.getPredefinedValue().add(new String((String) iter.next())); + } // if + if (nvl(fft.getDependsOn()).length() > 0) + nfft.setDependsOn(fft.getDependsOn()); + + nfft.setGroupFormField((fft.isGroupFormField()!=null && fft.isGroupFormField().booleanValue())?true:false); + if (nvl(fft.getMultiSelectListSize()).length() > 0) + nfft.setMultiSelectListSize(fft.getMultiSelectListSize()); + + nfft.setFieldId(fft.getFieldId()); + return nfft; + } // cloneFormFieldType + + public JavascriptItemType cloneJavascriptType(ObjectFactory objFactory, JavascriptItemType jit) + throws JAXBException { + JavascriptItemType njit = objFactory.createJavascriptItemType(); + + njit.setId(jit.getId()); + njit.setFieldId(jit.getFieldId()); + njit.setCallText(jit.getCallText()); + return njit; + } // cloneJavascriptType + + public ColFilterType cloneColFilterType(ObjectFactory objFactory, ColFilterType cft) + throws JAXBException { + ColFilterType ncft = objFactory.createColFilterType(); + + ncft.setColId(cft.getColId()); + ncft.setFilterSeq(cft.getFilterSeq()); + ncft.setJoinCondition(cft.getJoinCondition()); + if (nvl(cft.getOpenBrackets()).length() > 0) + ncft.setOpenBrackets(cft.getOpenBrackets()); + ncft.setExpression(cft.getExpression()); + if (nvl(cft.getArgType()).length() > 0) + ncft.setArgType(cft.getArgType()); + if (nvl(cft.getArgValue()).length() > 0) + ncft.setArgValue(cft.getArgValue()); + if (nvl(cft.getCloseBrackets()).length() > 0) + ncft.setCloseBrackets(cft.getCloseBrackets()); + if (nvl(cft.getComment()).length() > 0) + ncft.setComment(cft.getComment()); + + return ncft; + } // cloneColFilterType + + public DataColumnType cloneDataColumnType(ObjectFactory objFactory, DataColumnType dct) + throws JAXBException { + DataColumnType ndct = objFactory.createDataColumnType(); + + ndct.setTableId(dct.getTableId()); + ndct.setDbColName(dct.getDbColName()); + if (nvl(dct.getCrossTabValue()).length() > 0) + ndct.setCrossTabValue(dct.getCrossTabValue()); + ndct.setColName(dct.getColName()); + ndct.setDisplayName(dct.getDisplayName()); + if (dct.getDisplayWidth() > 0) + ndct.setDisplayWidth(dct.getDisplayWidth()); + if (nvl(dct.getDisplayWidthInPxls()).length()>0) + ndct.setDisplayWidthInPxls(dct.getDisplayWidthInPxls()); + if (nvl(dct.getDisplayAlignment()).length() > 0) + ndct.setDisplayAlignment(dct.getDisplayAlignment()); + if (nvl(dct.getDisplayHeaderAlignment()).length() > 0) + ndct.setDisplayHeaderAlignment(dct.getDisplayHeaderAlignment()); + ndct.setOrderSeq(dct.getOrderSeq()); + ndct.setVisible(dct.isVisible()); + ndct.setCalculated(dct.isCalculated()); + ndct.setColType(dct.getColType()); + if(dct.getColType().equals(AppConstants.CT_HYPERLINK)) { + ndct.setHyperlinkURL(dct.getHyperlinkURL()); + ndct.setHyperlinkType(dct.getHyperlinkType()); + if(dct.getHyperlinkType().equals("IMAGE")) { + ndct.setActionImg(dct.getActionImg()); + } + } + + if(dct.getIndentation()!=null) { + ndct.setIndentation(dct.getIndentation()); + } + + if (nvl(dct.getColFormat()).length() > 0) + ndct.setColFormat(dct.getColFormat()); + ndct.setGroupBreak(dct.isGroupBreak()); + ndct.setNowrap(dct.getNowrap()); + if (nvl(dct.getYAxis()).length() > 0) + ndct.setYAxis(dct.getYAxis()); + if (dct.getOrderBySeq()!=null && dct.getOrderBySeq() > 0) + ndct.setOrderBySeq(dct.getOrderBySeq()); + if (nvl(dct.getOrderByAscDesc()).length() > 0) + ndct.setOrderByAscDesc(dct.getOrderByAscDesc()); + if (nvl(dct.getDisplayTotal()).length() > 0) + ndct.setDisplayTotal(dct.getDisplayTotal()); + if (nvl(dct.getColOnChart()).length() > 0) + ndct.setColOnChart(dct.getColOnChart()); + if (dct.getChartSeq() !=null) + ndct.setChartSeq(dct.getChartSeq()); + if (nvl(dct.getChartColor()).length() > 0) + ndct.setChartColor(dct.getChartColor()); + if (nvl(dct.getChartLineType()).length() > 0) + ndct.setChartLineType(dct.getChartLineType()); + ndct.setChartSeries((dct.isChartSeries()!=null && dct.isChartSeries().booleanValue())?true:false); + ndct.setIsRangeAxisFilled((dct.isIsRangeAxisFilled()!=null && dct.isIsRangeAxisFilled().booleanValue())?true:false); + + if (dct.isCreateInNewChart()!=null) + ndct.setCreateInNewChart(dct.isCreateInNewChart()); + if (nvl(dct.getDrillDownType()).length() > 0) + ndct.setDrillDownType(dct.getDrillDownType()); + ndct.setDrillinPoPUp(dct.isDrillinPoPUp()!=null?dct.isDrillinPoPUp():false); + if (nvl(dct.getDrillDownURL()).length() > 0) + ndct.setDrillDownURL(dct.getDrillDownURL()); + if (nvl(dct.getDrillDownParams()).length() > 0) + ndct.setDrillDownParams(dct.getDrillDownParams()); + if (nvl(dct.getComment()).length() > 0) + ndct.setComment(dct.getComment()); + if (nvl(dct.getDependsOnFormField()).length() > 0) + ndct.setDependsOnFormField(dct.getDependsOnFormField()); + if (dct.getColFilterList() != null) { + ColFilterList colFilterList = objFactory.createColFilterList(); + ndct.setColFilterList(colFilterList); + + for (Iterator iter = dct.getColFilterList().getColFilter().iterator(); iter + .hasNext();) + colFilterList.getColFilter().add( + cloneColFilterType(objFactory, (ColFilterType) iter.next())); + } // if + + if (nvl(dct.getSemaphoreId()).length() > 0) + ndct.setSemaphoreId(dct.getSemaphoreId()); + if (nvl(dct.getDbColType()).length() > 0) + ndct.setDbColType(dct.getDbColType()); + else { + ndct.setDbColType(dct.getColType()); + adjustColumnType(ndct); + } + if (nvl(dct.getChartGroup()).length() > 0) + ndct.setChartGroup(dct.getChartGroup()); + + if (nvl(dct.getYAxis()).length() > 0) + ndct.setYAxis(dct.getYAxis()); + + if (nvl(dct.getDependsOnFormField()).length() > 0) + ndct.setDependsOnFormField(dct.getDependsOnFormField()); + + + + if(nvl(dct.getNowrap()).length() > 0) + ndct.setNowrap(dct.getNowrap()); + + if(dct.getIndentation()!=null) { + ndct.setIndentation(dct.getIndentation()); + } + + ndct.setEnhancedPagination((dct.isEnhancedPagination()!=null && dct.isEnhancedPagination().booleanValue())?true:false); + if(nvl(dct.getDataMiningCol()).length() > 0) + ndct.setDataMiningCol(dct.getDataMiningCol()); + + ndct.setColId(dct.getColId()); + + // ndct.setSemaphoreId(nvl(dct.getSemaphoreId())); + // if(nvl(dct.getDbColType()).length()>0) + // ndct.setDbColType(dct.getDbColType()); + return ndct; + } // cloneDataColumnType + + public DataSourceType cloneDataSourceType(ObjectFactory objFactory, DataSourceType dst) + throws JAXBException { + DataSourceType ndst = objFactory.createDataSourceType(); + + ndst.setTableName(dst.getTableName()); + ndst.setTablePK(dst.getTablePK()); + ndst.setDisplayName(dst.getDisplayName()); + if (nvl(dst.getRefTableId()).length() > 0) + ndst.setRefTableId(dst.getRefTableId()); + if (nvl(dst.getRefDefinition()).length() > 0) + ndst.setRefDefinition(dst.getRefDefinition()); + if (nvl(dst.getComment()).length() > 0) + ndst.setComment(dst.getComment()); + DataColumnList dataColumnList = objFactory.createDataColumnList(); + ndst.setDataColumnList(dataColumnList); + + for (Iterator iter = dst.getDataColumnList().getDataColumn().iterator(); iter + .hasNext();) + dataColumnList.getDataColumn().add( + cloneDataColumnType(objFactory, (DataColumnType) iter.next())); + ndst.setTableId(dst.getTableId()); + + + return ndst; + } // cloneDataSourceType + + public CustomReportType cloneCustomReport() throws RaptorException { + ObjectFactory objFactory = new ObjectFactory(); + CustomReportType ncr = objFactory.createCustomReportType(); + + //CustomReport ncr = null; + try { + //ncr = (CustomReport) objFactory.createCustomReport(customReportType); + ncr.setReportName(cr.getReportName()); + ncr.setReportDescr(cr.getReportDescr()); + if (nvl(cr.getNumDashCols()).length() > 0) + ncr.setNumDashCols(cr.getNumDashCols()); + if (nvl(cr.getDashboardLayoutHTML()).length() > 0) + ncr.setDashboardLayoutHTML(cr.getDashboardLayoutHTML()); + if (nvl(cr.getDbInfo()).length() > 0) + ncr.setDbInfo(cr.getDbInfo()); + ncr.setChartType(cr.getChartType()); + if (nvl(cr.getChartTypeFixed()).length() > 0) + ncr.setChartTypeFixed(cr.getChartTypeFixed()); + if (nvl(cr.getChartMultiSeries()).length() > 0) + ncr.setChartMultiSeries(cr.getChartMultiSeries()); + if (nvl(cr.getChartLeftAxisLabel()).length() > 0) + ncr.setChartLeftAxisLabel(cr.getChartLeftAxisLabel()); + if (nvl(cr.getChartRightAxisLabel()).length() > 0) + ncr.setChartRightAxisLabel(cr.getChartRightAxisLabel()); + if (nvl(cr.getChartWidth()).length() > 0) + ncr.setChartWidth(cr.getChartWidth()); + if (nvl(cr.getChartHeight()).length() > 0) + ncr.setChartHeight(cr.getChartHeight()); + ncr.setShowChartTitle(cr.isShowChartTitle()); + ncr.setPublic(cr.isPublic()); + ncr.setHideFormFieldAfterRun(cr.isHideFormFieldAfterRun()); + ncr.setCreateId(cr.getCreateId()); + ncr.setCreateDate(cr.getCreateDate()); + if (nvl(cr.getReportSQL()).length() > 0) + ncr.setReportSQL(cr.getReportSQL()); + if (nvl(cr.getReportTitle()).length() > 0) + ncr.setReportTitle(cr.getReportTitle()); + if (nvl(cr.getReportSubTitle()).length() > 0) + ncr.setReportSubTitle(cr.getReportSubTitle()); + if (nvl(cr.getReportHeader()).length() > 0) + ncr.setReportHeader(cr.getReportHeader()); + if (cr.getFrozenColumns()!=null) + ncr.setFrozenColumns(cr.getFrozenColumns()); + if (nvl(cr.getPdfImgLogo()).length()>0) + ncr.setPdfImgLogo(cr.getPdfImgLogo()); + if (nvl(cr.getEmptyMessage()).length()>0) + ncr.setEmptyMessage(cr.getEmptyMessage()); + if (nvl(cr.getWidthNoColumn()).length()>0) + ncr.setWidthNoColumn(cr.getWidthNoColumn()); + if (nvl(cr.getDataGridAlign()).length()>0) + ncr.setDataGridAlign(cr.getDataGridAlign()); + + if (nvl(cr.getReportFooter()).length() > 0) + ncr.setReportFooter(cr.getReportFooter()); + if (nvl(cr.getNumFormCols()).length() > 0) + ncr.setNumFormCols(cr.getNumFormCols()); + if (nvl(cr.getDisplayOptions()).length() > 0) + ncr.setDisplayOptions(cr.getDisplayOptions()); + if (nvl(cr.getDataContainerHeight()).length() > 0) + ncr.setDataContainerHeight(cr.getDataContainerHeight()); + if (nvl(cr.getDataContainerWidth()).length() > 0) + ncr.setDataContainerWidth(cr.getDataContainerWidth()); + if (nvl(cr.getAllowSchedule()).length() > 0) + ncr.setAllowSchedule(cr.getAllowSchedule()); + if (nvl(cr.getTopDown()).length() > 0) + ncr.setTopDown(cr.getTopDown()); + if (nvl(cr.getSizedByContent()).length() > 0) + ncr.setSizedByContent(cr.getSizedByContent()); + if (nvl(cr.getComment()).length() > 0) + ncr.setComment(cr.getComment()); + if (nvl(cr.getDashboardOptions()).length()>0) + ncr.setDashboardOptions(cr.getDashboardOptions()); + + if(cr.isDashboardType()!=null) + ncr.setDashboardType(cr.isDashboardType()); + if(cr.isReportInNewWindow()!=null) + ncr.setReportInNewWindow(cr.isReportInNewWindow()); + ncr.setDisplayFolderTree(cr.isDisplayFolderTree()); + if (cr.getDashBoardReports() == null) { + if (cr.getMaxRowsInExcelDownload()!=null && cr.getMaxRowsInExcelDownload()>0) + ncr.setMaxRowsInExcelDownload(cr.getMaxRowsInExcelDownload()); + } + + if (nvl(cr.getJavascriptElement()).length()>0) + ncr.setJavascriptElement(cr.getJavascriptElement()); + if (nvl(cr.getFolderId()).length()>0) + ncr.setFolderId(cr.getFolderId()); + ncr.setDrillURLInPoPUpPresent((cr.isDrillURLInPoPUpPresent()!=null && cr.isDrillURLInPoPUpPresent().booleanValue())?true:false); + + if (nvl(cr.getIsOneTimeScheduleAllowed()).length()>0) + ncr.setIsOneTimeScheduleAllowed(cr.getIsOneTimeScheduleAllowed()); + if (nvl(cr.getIsHourlyScheduleAllowed()).length()>0) + ncr.setIsHourlyScheduleAllowed(cr.getIsHourlyScheduleAllowed()); + if (nvl(cr.getIsDailyScheduleAllowed()).length()>0) + ncr.setIsDailyScheduleAllowed(cr.getIsDailyScheduleAllowed()); + if (nvl(cr.getIsDailyMFScheduleAllowed()).length()>0) + ncr.setIsDailyMFScheduleAllowed(cr.getIsDailyMFScheduleAllowed()); + if (nvl(cr.getIsWeeklyScheduleAllowed()).length()>0) + ncr.setIsWeeklyScheduleAllowed(cr.getIsWeeklyScheduleAllowed()); + if (nvl(cr.getIsMonthlyScheduleAllowed()).length()>0) + ncr.setIsMonthlyScheduleAllowed(cr.getIsMonthlyScheduleAllowed()); + + ncr.setPageSize(cr.getPageSize()); + ncr.setReportType(cr.getReportType()); + + + DataSourceList dataSourceList = objFactory.createDataSourceList(); + ncr.setDataSourceList(dataSourceList); + + for (Iterator iter = cr.getDataSourceList().getDataSource().iterator(); iter.hasNext();) { + dataSourceList.getDataSource().add( + cloneDataSourceType(objFactory, (DataSourceType) iter.next())); + } + + if (cr.getFormFieldList() != null) { + FormFieldList formFieldList = objFactory.createFormFieldList(); + ncr.setFormFieldList(formFieldList); + ncr.getFormFieldList().setComment(formFieldList.getComment()); + + for (Iterator iter = cr.getFormFieldList().getFormField().iterator(); iter + .hasNext();) + formFieldList.getFormField().add( + cloneFormFieldType(objFactory, (FormFieldType) iter.next())); + formFieldList.setComment(cr.getFormFieldList().getComment()); + } // if + + if (cr.getJavascriptList() != null) { + JavascriptList javascriptList = objFactory.createJavascriptList(); + ncr.setJavascriptList(javascriptList); + + for (Iterator iter = cr.getJavascriptList().getJavascriptItem().iterator(); iter + .hasNext();) + javascriptList.getJavascriptItem().add( + cloneJavascriptType(objFactory, (JavascriptItemType) iter.next())); + } // if + + if (cr.getSemaphoreList() != null) { + SemaphoreList semaphoreList = objFactory.createSemaphoreList(); + ncr.setSemaphoreList(semaphoreList); + + for (Iterator iter = cr.getSemaphoreList().getSemaphore().iterator(); iter + .hasNext();) { + semaphoreList.getSemaphore().add( + cloneSemaphoreType(objFactory, (SemaphoreType) iter.next())); + } + } // if + + if (nvl(cr.getDashboardOptions()).length()>0) + ncr.setDashboardOptions(cr.getDashboardOptions()); + if(cr.isDashboardType()!=null) + ncr.setDashboardType(cr.isDashboardType()); + if(cr.isReportInNewWindow()!=null) + ncr.setReportInNewWindow(cr.isReportInNewWindow()); + ncr.setDisplayFolderTree(cr.isDisplayFolderTree()); + if (cr.getDashBoardReports() == null) { + if (cr.getMaxRowsInExcelDownload()!=null && cr.getMaxRowsInExcelDownload()>0) + ncr.setMaxRowsInExcelDownload(cr.getMaxRowsInExcelDownload()); + } + + if (cr.getDashBoardReports() != null) { + DashboardReports dashboardReports = objFactory.createDashboardReports(); + ncr.setDashBoardReports(dashboardReports); + + for (Iterator iter = cr.getDashBoardReports().getReportsList().iterator(); iter + .hasNext();) { + dashboardReports.getReportsList().add( + cloneDashboardType(objFactory, (Reports) iter.next())); + } + } // if + + if (cr.getChartAdditionalOptions() != null) { + ChartAdditionalOptions chartAdditionalOptions = objFactory.createChartAdditionalOptions(); + if(nvl(cr.getChartAdditionalOptions().getChartMultiplePieOrder()).length()>0) + chartAdditionalOptions.setChartMultiplePieOrder(cr.getChartAdditionalOptions().getChartMultiplePieOrder()); + if(nvl(cr.getChartAdditionalOptions().getChartMultiplePieLabelDisplay()).length()>0) + chartAdditionalOptions.setChartMultiplePieLabelDisplay(cr.getChartAdditionalOptions().getChartMultiplePieLabelDisplay()); + + if(nvl(cr.getChartAdditionalOptions().getChartOrientation()).length()>0) + chartAdditionalOptions.setChartOrientation(cr.getChartAdditionalOptions().getChartOrientation()); + if(nvl(cr.getChartAdditionalOptions().getSecondaryChartRenderer()).length()>0) + chartAdditionalOptions.setSecondaryChartRenderer(cr.getChartAdditionalOptions().getSecondaryChartRenderer()); + + if(nvl(cr.getChartAdditionalOptions().getChartDisplay()).length()>0) + chartAdditionalOptions.setChartDisplay(cr.getChartAdditionalOptions().getChartDisplay()); + if(nvl(cr.getChartAdditionalOptions().getHideToolTips()).length()>0) + chartAdditionalOptions.setHideToolTips(cr.getChartAdditionalOptions().getHideToolTips()); + if(nvl(cr.getChartAdditionalOptions().getHidechartLegend()).length()>0) + chartAdditionalOptions.setHidechartLegend(cr.getChartAdditionalOptions().getHidechartLegend()); + if(nvl(cr.getChartAdditionalOptions().getLegendPosition()).length()>0) + chartAdditionalOptions.setLegendPosition(cr.getChartAdditionalOptions().getLegendPosition()); + if(nvl(cr.getChartAdditionalOptions().getLabelAngle()).length()>0) + chartAdditionalOptions.setLabelAngle(cr.getChartAdditionalOptions().getLabelAngle()); + + if(nvl(cr.getChartAdditionalOptions().getIntervalFromdate()).length()>0) + chartAdditionalOptions.setIntervalFromdate(cr.getChartAdditionalOptions().getIntervalFromdate()); + if(nvl(cr.getChartAdditionalOptions().getIntervalTodate()).length()>0) + chartAdditionalOptions.setIntervalTodate(cr.getChartAdditionalOptions().getIntervalTodate()); + if(nvl(cr.getChartAdditionalOptions().getIntervalLabel()).length()>0) + chartAdditionalOptions.setIntervalLabel(cr.getChartAdditionalOptions().getIntervalLabel()); + + if(nvl(cr.getChartAdditionalOptions().getLastSeriesALineChart()).length()>0) + chartAdditionalOptions.setLastSeriesALineChart(cr.getChartAdditionalOptions().getLastSeriesALineChart()); + if(nvl(cr.getChartAdditionalOptions().getLastSeriesABarChart()).length()>0) + chartAdditionalOptions.setLastSeriesABarChart(cr.getChartAdditionalOptions().getLastSeriesABarChart()); + + if(nvl(cr.getChartAdditionalOptions().getMaxLabelsInDomainAxis()).length()>0) + chartAdditionalOptions.setMaxLabelsInDomainAxis(cr.getChartAdditionalOptions().getMaxLabelsInDomainAxis()); + if(nvl(cr.getChartAdditionalOptions().getLinearRegression()).length()>0) + chartAdditionalOptions.setLinearRegression(cr.getChartAdditionalOptions().getLinearRegression()); + if(nvl(cr.getChartAdditionalOptions().getLinearRegressionColor()).length()>0) + chartAdditionalOptions.setLinearRegressionColor(cr.getChartAdditionalOptions().getLinearRegressionColor()); + if(nvl(cr.getChartAdditionalOptions().getExponentialRegressionColor()).length()>0) + chartAdditionalOptions.setExponentialRegressionColor(cr.getChartAdditionalOptions().getExponentialRegressionColor()); + if(nvl(cr.getChartAdditionalOptions().getMaxRegression()).length()>0) + chartAdditionalOptions.setMaxRegression(cr.getChartAdditionalOptions().getMaxRegression()); + if(nvl(cr.getChartAdditionalOptions().getRangeAxisUpperLimit()).length()>0) + chartAdditionalOptions.setRangeAxisUpperLimit(cr.getChartAdditionalOptions().getRangeAxisUpperLimit()); + if(nvl(cr.getChartAdditionalOptions().getRangeAxisLowerLimit()).length()>0) + chartAdditionalOptions.setRangeAxisLowerLimit(cr.getChartAdditionalOptions().getRangeAxisLowerLimit()); + if(nvl(cr.getChartAdditionalOptions().getOverlayItemValueOnStackBar()).length()>0) + chartAdditionalOptions.setOverlayItemValueOnStackBar(cr.getChartAdditionalOptions().getOverlayItemValueOnStackBar()); + chartAdditionalOptions.setAnimate((cr.getChartAdditionalOptions().isAnimate()!=null && cr.getChartAdditionalOptions().isAnimate().booleanValue())?true:false); + + if(nvl(cr.getChartAdditionalOptions().getKeepDomainAxisValueAsString()).length()>0) + chartAdditionalOptions.setKeepDomainAxisValueAsString(cr.getChartAdditionalOptions().getKeepDomainAxisValueAsString()); + + + // Animate + chartAdditionalOptions.setAnimateAnimatedChart((cr.getChartAdditionalOptions().isAnimateAnimatedChart()!=null && cr.getChartAdditionalOptions().isAnimateAnimatedChart().booleanValue())?true:false); + chartAdditionalOptions.setStacked((cr.getChartAdditionalOptions().isStacked()!=null && cr.getChartAdditionalOptions().isStacked().booleanValue())?true:false); + chartAdditionalOptions.setBarControls((cr.getChartAdditionalOptions().isBarControls()!=null && cr.getChartAdditionalOptions().isBarControls().booleanValue())?true:false); + chartAdditionalOptions.setXAxisDateType((cr.getChartAdditionalOptions().isXAxisDateType()!=null && cr.getChartAdditionalOptions().isXAxisDateType().booleanValue())?true:false); + chartAdditionalOptions.setLessXaxisTickers((cr.getChartAdditionalOptions().isLessXaxisTickers()!=null && cr.getChartAdditionalOptions().isLessXaxisTickers().booleanValue())?true:false); + chartAdditionalOptions.setTimeAxis((cr.getChartAdditionalOptions().isTimeAxis()!=null && cr.getChartAdditionalOptions().isTimeAxis().booleanValue())?true:false); + + if(nvl(cr.getChartAdditionalOptions().getTimeSeriesRender()).length()>0) + chartAdditionalOptions.setTimeSeriesRender(cr.getChartAdditionalOptions().getTimeSeriesRender()); + + chartAdditionalOptions.setMultiSeries((cr.getChartAdditionalOptions().isMultiSeries()!=null && cr.getChartAdditionalOptions().isMultiSeries().booleanValue())?true:false); + + chartAdditionalOptions.setTopMargin(cr.getChartAdditionalOptions().getTopMargin()!=null?cr.getChartAdditionalOptions().getTopMargin():new Integer(30)); + chartAdditionalOptions.setBottomMargin(cr.getChartAdditionalOptions().getBottomMargin()!=null?cr.getChartAdditionalOptions().getBottomMargin():new Integer(50)); + chartAdditionalOptions.setLeftMargin(cr.getChartAdditionalOptions().getLeftMargin()!=null?cr.getChartAdditionalOptions().getLeftMargin():new Integer(100)); + chartAdditionalOptions.setRightMargin(cr.getChartAdditionalOptions().getRightMargin()!=null?cr.getChartAdditionalOptions().getRightMargin():new Integer(60)); + + + ncr.setChartAdditionalOptions(chartAdditionalOptions); + } // if + + if (nvl(cr.getJavascriptElement()).length()>0) + ncr.setJavascriptElement(cr.getJavascriptElement()); + if (nvl(cr.getFolderId()).length()>0) + ncr.setFolderId(cr.getFolderId()); + + if (cr.getChartDrillOptions() != null) { + ChartDrillOptions chartDrillOptions = objFactory.createChartDrillOptions(); + + if(nvl(cr.getChartDrillOptions().getDrillReportId()).length()>0) + chartDrillOptions.setDrillReportId(cr.getChartDrillOptions().getDrillReportId()); + + for (Iterator iter = cr.getChartDrillOptions().getTargetFormfield().iterator(); iter + .hasNext();) { + chartDrillOptions.getTargetFormfield().add( + cloneChartDrillFormfield(objFactory, (ChartDrillFormfield)iter.next())); + + } + + if(nvl(cr.getChartDrillOptions().getDrillXAxisFormField()).length()>0) + chartDrillOptions.setDrillXAxisFormField(cr.getChartDrillOptions().getDrillXAxisFormField()); + if(nvl(cr.getChartDrillOptions().getDrillYAxisFormField()).length()>0) + chartDrillOptions.setDrillYAxisFormField(cr.getChartDrillOptions().getDrillYAxisFormField()); + if(nvl(cr.getChartDrillOptions().getDrillSeriesFormField()).length()>0) + chartDrillOptions.setDrillSeriesFormField(cr.getChartDrillOptions().getDrillSeriesFormField()); + + + ncr.setChartDrillOptions(chartDrillOptions); + } + + if (nvl(cr.getIsOneTimeScheduleAllowed()).length()>0) + ncr.setIsOneTimeScheduleAllowed(cr.getIsOneTimeScheduleAllowed()); + if (nvl(cr.getIsHourlyScheduleAllowed()).length()>0) + ncr.setIsHourlyScheduleAllowed(cr.getIsHourlyScheduleAllowed()); + if (nvl(cr.getIsDailyScheduleAllowed()).length()>0) + ncr.setIsDailyScheduleAllowed(cr.getIsDailyScheduleAllowed()); + if (nvl(cr.getIsDailyMFScheduleAllowed()).length()>0) + ncr.setIsDailyMFScheduleAllowed(cr.getIsDailyMFScheduleAllowed()); + if (nvl(cr.getIsWeeklyScheduleAllowed()).length()>0) + ncr.setIsWeeklyScheduleAllowed(cr.getIsWeeklyScheduleAllowed()); + if (nvl(cr.getIsMonthlyScheduleAllowed()).length()>0) + ncr.setIsMonthlyScheduleAllowed(cr.getIsMonthlyScheduleAllowed()); + + ncr.setPageSize(cr.getPageSize()); + ncr.setReportType(cr.getReportType()); + + if (cr.getReportMap() != null){ + ReportMap repMap = objFactory.createReportMap(); + if(nvl(cr.getReportMap().getMarkerColor()).length()>0) + repMap.setMarkerColor(cr.getReportMap().getMarkerColor()); + if(nvl(cr.getReportMap().getUseDefaultSize()).length()>0) + repMap.setUseDefaultSize(cr.getReportMap().getUseDefaultSize()); + if(nvl(cr.getReportMap().getHeight()).length()>0) + repMap.setHeight(cr.getReportMap().getHeight()); + if(nvl(cr.getReportMap().getWidth()).length()>0) + repMap.setWidth(cr.getReportMap().getWidth()); + if(nvl(cr.getReportMap().getIsMapAllowedYN()).length()>0) + repMap.setIsMapAllowedYN(cr.getReportMap().getIsMapAllowedYN()); + if(nvl(cr.getReportMap().getAddAddressInDataYN()).length()>0) + repMap.setAddAddressInDataYN(cr.getReportMap().getAddAddressInDataYN()); + if(nvl(cr.getReportMap().getAddressColumn()).length()>0) + repMap.setAddressColumn(cr.getReportMap().getAddressColumn()); + if(nvl(cr.getReportMap().getDataColumn()).length()>0) + repMap.setDataColumn(cr.getReportMap().getDataColumn()); + if(nvl(cr.getReportMap().getDefaultMapType()).length()>0) + repMap.setDefaultMapType(cr.getReportMap().getDefaultMapType()); + if(nvl(cr.getReportMap().getLatColumn()).length()>0) + repMap.setLatColumn(cr.getReportMap().getLatColumn()); + if(nvl(cr.getReportMap().getLongColumn()).length()>0) + repMap.setLongColumn(cr.getReportMap().getLongColumn()); + if(nvl(cr.getReportMap().getColorColumn()).length()>0) + repMap.setColorColumn(cr.getReportMap().getColorColumn()); + if(nvl(cr.getReportMap().getLegendColumn()).length()>0) + repMap.setLegendColumn(cr.getReportMap().getLegendColumn()); + + + for (Iterator iter = cr.getReportMap().getMarkers().iterator(); iter + .hasNext();) { + repMap.getMarkers().add( + cloneMarkerType(objFactory, (Marker)iter.next())); + + } + + ncr.setReportMap(repMap); + } + + + + } catch (JAXBException ex) { // try + throw new RaptorException(ex.getMessage(), ex.getCause()); + } + + return ncr; + } // cloneCustomReport + + /** ************************************************************************************************* */ + + public void printFormatType(FormatType ft) { + System.out.println("------------------------------------------------"); + System.out.println("Semaphore Col Format"); + System.out.println("------------------------------------------------"); + System.out.println("FormatId: [" + ft.getFormatId() + "]"); + System.out.println("LessThanValue: [" + ft.getLessThanValue() + "]"); + System.out.println("Expression: [" + ft.getExpression() + "]"); + System.out.println("Bold: [" + ft.isBold() + "]"); + System.out.println("Italic: [" + ft.isItalic() + "]"); + System.out.println("Underline: [" + ft.isUnderline() + "]"); + System.out.println("BgColor: [" + ft.getBgColor() + "]"); + System.out.println("FontColor: [" + ft.getFontColor() + "]"); + System.out.println("FontFace: [" + ft.getFontFace() + "]"); + System.out.println("FontSize: [" + ft.getFontSize() + "]"); + System.out.println("Alignment: [" + ft.getAlignment() + "]"); + System.out.println("Comment: [" + ft.getComment() + "]"); + System.out.println("------------------------------------------------"); + } // printFormatType + + public void printSemaphoreType(SemaphoreType st) { + System.out.println("------------------------------------------------"); + System.out.println("Semaphore"); + System.out.println("------------------------------------------------"); + System.out.println("SemaphoreId: [" + st.getSemaphoreId() + "]"); + System.out.println("SemaphoreName: [" + st.getSemaphoreName() + "]"); + System.out.println("SemaphoreType: [" + st.getSemaphoreType() + "]"); + System.out.println("Comment: [" + st.getComment() + "]"); + + if (st.getFormatList() != null) + for (Iterator iter = st.getFormatList().getFormat().iterator(); iter.hasNext();) + printFormatType((FormatType) iter.next()); + + System.out.println("------------------------------------------------"); + } // printSemaphoreType + + public void printFormFieldType(FormFieldType fft) { + System.out.println("------------------------------------------------"); + System.out.println("Form Field"); + System.out.println("------------------------------------------------"); + System.out.println("FieldId: [" + fft.getFieldId() + "]"); + System.out.println("ColId: [" + fft.getColId() + "]"); + System.out.println("FieldName: [" + fft.getFieldName() + "]"); + System.out.println("FieldType: [" + fft.getFieldType() + "]"); + System.out.println("ValidationType: [" + fft.getValidationType() + "]"); + System.out.println("Mandatory: [" + fft.getMandatory() + "]"); + System.out.println("DefaultValue: [" + fft.getDefaultValue() + "]"); + System.out.println("OrderBySeq: [" + fft.getOrderBySeq() + "]"); + System.out.println("FieldSQL: [" + fft.getFieldSQL() + "]"); + System.out.println("Comment: [" + fft.getComment() + "]"); + if (fft.getPredefinedValueList() != null) + for (Iterator iter = fft.getPredefinedValueList().getPredefinedValue().iterator(); iter + .hasNext();) + System.out.println("PredefinedValues: [" + ((String) iter.next()) + "]"); + + System.out.println("------------------------------------------------"); + } // printFormFieldType + + public void printColFilterType(ColFilterType cft) { + System.out.println("------------------------------------------------"); + System.out.println("Col Filter"); + System.out.println("------------------------------------------------"); + System.out.println("ColId: [" + cft.getColId() + "]"); + System.out.println("FilterSeq: [" + cft.getFilterSeq() + "]"); + System.out.println("JoinCondition: [" + cft.getJoinCondition() + "]"); + System.out.println("OpenBrackets: [" + cft.getOpenBrackets() + "]"); + System.out.println("Expression: [" + cft.getExpression() + "]"); + System.out.println("ArgType: [" + cft.getArgType() + "]"); + System.out.println("ArgValue: [" + cft.getArgValue() + "]"); + System.out.println("CloseBrackets: [" + cft.getCloseBrackets() + "]"); + System.out.println("Comment: [" + cft.getComment() + "]"); + System.out.println("------------------------------------------------"); + } // printColFilterType + + public void printDataColumnType(DataColumnType dct) { + System.out.println("------------------------------------------------"); + System.out.println("Data Column"); + System.out.println("------------------------------------------------"); + System.out.println("ColId: [" + dct.getColId() + "]"); + System.out.println("TableId: [" + dct.getTableId() + "]"); + System.out.println("DbColName: [" + dct.getDbColName() + "]"); + System.out.println("CrossTabValue: [" + dct.getCrossTabValue() + "]"); + System.out.println("ColName: [" + dct.getColName() + "]"); + System.out.println("DisplayName: [" + dct.getDisplayName() + "]"); + System.out.println("DisplayWidth: [" + dct.getDisplayWidth() + "]"); + System.out.println("DisplayAlignment: [" + dct.getDisplayAlignment() + "]"); + System.out.println("DisplayHeaderAlignment: [" + dct.getDisplayHeaderAlignment() + "]"); + System.out.println("OrderSeq(): [" + dct.getOrderSeq() + "]"); + System.out.println("Visible: [" + dct.isVisible() + "]"); + System.out.println("Calculated: [" + dct.isCalculated() + "]"); + System.out.println("ColType: [" + dct.getColType() + "]"); + System.out.println("ColFormat: [" + dct.getColFormat() + "]"); + System.out.println("GroupBreak: [" + dct.isGroupBreak() + "]"); + System.out.println("OrderBySeq: [" + dct.getOrderBySeq() + "]"); + System.out.println("OrderByAscDesc: [" + dct.getOrderByAscDesc() + "]"); + System.out.println("DisplayTotal: [" + dct.getDisplayTotal() + "]"); + System.out.println("ColOnChart: [" + dct.getColOnChart() + "]"); + System.out.println("ChartSeq: [" + dct.getChartSeq() + "]"); + System.out.println("ChartColor: [" + dct.getChartColor() + "]"); + System.out.println("DrillDownType: [" + dct.getDrillDownType() + "]"); + System.out.println("DrillDownURL: [" + dct.getDrillDownURL() + "]"); + System.out.println("DrillDownParams: [" + dct.getDrillDownParams() + "]"); + System.out.println("Comment: [" + dct.getComment() + "]"); + + if (dct.getColFilterList() != null) + for (Iterator iter = dct.getColFilterList().getColFilter().iterator(); iter + .hasNext();) + printColFilterType((ColFilterType) iter.next()); + + System.out.println("SemaphoreId: [" + dct.getSemaphoreId() + "]"); + System.out.println("DbColType: [" + dct.getDbColType() + "]"); + System.out.println("------------------------------------------------"); + } // printDataColumnType + + public void printDataSourceType(DataSourceType dst) { + System.out.println("------------------------------------------------"); + System.out.println("Data Source"); + System.out.println("------------------------------------------------"); + System.out.println("TableId: [" + dst.getTableId() + "]"); + System.out.println("TableName: [" + dst.getTableName() + "]"); + System.out.println("TablePK: [" + dst.getTablePK() + "]"); + System.out.println("DisplayName: [" + dst.getDisplayName() + "]"); + System.out.println("RefTableId: [" + dst.getRefTableId() + "]"); + System.out.println("RefDefinition: [" + dst.getRefDefinition() + "]"); + System.out.println("Comment: [" + dst.getComment() + "]"); + + for (Iterator iter = dst.getDataColumnList().getDataColumn().iterator(); iter + .hasNext();) + printDataColumnType((DataColumnType) iter.next()); + + System.out.println("------------------------------------------------"); + } // printDataSourceType + + public void print() { + System.out.println("------------------------------------------------"); + System.out.println("ReportWrapper object"); + System.out.println("------------------------------------------------"); + System.out.println("PageSize: [" + getPageSize() + "]"); + System.out.println("ReportType: [" + getReportType() + "]"); + System.out.println("ReportName: [" + getReportName() + "]"); + System.out.println("ReportDescr: [" + getReportDescr() + "]"); + System.out.println("ChartType: [" + getChartType() + "]"); + System.out.println("ChartTypeFixed: [" + getChartTypeFixed() + "]"); + //System.out.println("ChartLeftAxisLabel: [" + getChartLeftAxisLabel() + "]"); + //System.out.println("ChartRightAxisLabel: [" + getChartRightAxisLabel() + "]"); + System.out.println("ChartWidth: [" + getChartWidth() + "]"); + System.out.println("ChartHeight: [" + getChartHeight() + "]"); + System.out.println("Public: [" + isPublic() + "]"); + System.out.println("CreateId: NOT USED ANYMORE[" + /* getCreateId()+ */"]"); + System.out.println("CreateDate: NOT USED ANYMORE[" + /* getCreateDate()+ */"]"); + System.out.println("ReportSQL: [" + getReportSQL() + "]"); + System.out.println("ReportTitle: [" + getReportTitle() + "]"); + System.out.println("DbInfo: [" + getDBInfo() + "]"); + System.out.println("ReportSubTitle: [" + getReportSubTitle() + "]"); + System.out.println("ReportHeader: [" + getReportHeader() + "]"); + System.out.println("ReportFooter: [" + getReportFooter() + "]"); + System.out.println("NumFormCols: [" + getNumFormCols() + "]"); + System.out.println("DisplayOptions: [" + getDisplayOptions() + "]"); + System.out.println("Comment: [" + getComment() + "]"); + + for (Iterator iter = cr.getDataSourceList().getDataSource().iterator(); iter.hasNext();) + printDataSourceType((DataSourceType) iter.next()); + + if (cr.getFormFieldList() != null) + for (Iterator iter = cr.getFormFieldList().getFormField().iterator(); iter + .hasNext();) + printFormFieldType((FormFieldType) iter.next()); + + if (cr.getSemaphoreList() != null) + for (Iterator iter = cr.getSemaphoreList().getSemaphore().iterator(); iter + .hasNext();) + printSemaphoreType((SemaphoreType) iter.next()); + + System.out.println("------------------------------------------------"); + System.out.println("ReportWrapper object end"); + System.out.println("------------------------------------------------"); + } // print + + private int getIntValue(String value, int defaultValue) { + int iValue = defaultValue; + try { + iValue = Integer.parseInt(value); + } catch (Exception e) { + } + + return iValue; + } // getIntValue + public static String replaceNewLine( String strSource, String strFind, String chrReplace ) + { + // buffer to hold the target string after replacement is done. + StringBuffer sbfTemp = new StringBuffer(); + + try + { + // for each occurrence of strFind in strSource, replace it with chrReplace. + int intIndex = strSource.indexOf( strFind, 0 ); + + // check if there is any instace of strFind in strSource + if( intIndex >= 0 ) + { + // holds the index from where the search is supposed to happen. + int intStart = 0; + + // size of the source string + int intTotalSize = strSource.length(); + + while( intStart < intTotalSize && + ( ( intIndex = strSource.indexOf( strFind, intStart ) ) >= 0 ) ) + { + // check if strFind is at the beginning... i.e., at index intStart + if( intIndex == intStart ) + { + /* + * starts with strFind...just append chrReplace + * to the target + */ + sbfTemp.append( chrReplace ); + } + else + { + // append the sub-string...plus chrReplace + sbfTemp.append( strSource.substring( intStart, intIndex ) ); + sbfTemp.append( chrReplace ); + } + + // advance string index + intStart = intIndex + strFind.length(); + } + + // append the last portion of the source string. + sbfTemp.append( strSource.substring( intStart ) ); + } + else + { + // strFind not found... just copy the text as it is. + sbfTemp.append( strSource ); + } + } + catch( Exception expGeneral ) + { + // in case of any exception, return the source string as it is. + sbfTemp = new StringBuffer( strSource ); + } + + return sbfTemp.toString(); + } + + /*folder id*/ + public String getFolderId() { + return nvl(cr.getFolderId()).length()>0?cr.getFolderId():"NULL"; + } + public void setFolderId(String folderId ) { + cr.setFolderId(folderId); + } + + public String addZero(String num) { + int numInt = 0; + try { + numInt = Integer.parseInt(num); + }catch(NumberFormatException ex){ + numInt = 0; + } + if(numInt < 10) return "0"+numInt; + else return ""+numInt; + } + + public String getIsDailyMFScheduleAllowed() { + return cr.getIsDailyMFScheduleAllowed(); + } + + public void setIsDailyMFScheduleAllowed(String isDailyMFScheduleAllowed) { + cr.setIsDailyMFScheduleAllowed(isDailyMFScheduleAllowed); + } + + public String getIsDailyScheduleAllowed() { + return cr.getIsDailyScheduleAllowed(); + } + + public void setIsDailyScheduleAllowed(String isDailyScheduleAllowed) { + cr.setIsDailyScheduleAllowed(isDailyScheduleAllowed); + } + + public String getIsHourlyScheduleAllowed() { + return cr.getIsHourlyScheduleAllowed(); + } + + public void setIsHourlyScheduleAllowed(String isHourlyScheduleAllowed) { + cr.setIsHourlyScheduleAllowed(isHourlyScheduleAllowed); + } + + public String getIsMonthlyScheduleAllowed() { + return cr.getIsMonthlyScheduleAllowed(); + } + + public void setIsMonthlyScheduleAllowed(String isMonthlyScheduleAllowed) { + cr.setIsMonthlyScheduleAllowed(isMonthlyScheduleAllowed); + } + + public String getIsOneTimeScheduleAllowed() { + return cr.getIsOneTimeScheduleAllowed(); + } + + public void setIsOneTimeScheduleAllowed(String isOneTimeScheduleAllowed) { + cr.setIsOneTimeScheduleAllowed(isOneTimeScheduleAllowed); + } + + public String getIsWeeklyScheduleAllowed() { + return cr.getIsWeeklyScheduleAllowed(); + } + + public void setIsWeeklyScheduleAllowed(String isWeeklyScheduleAllowed) { + cr.setIsWeeklyScheduleAllowed(isWeeklyScheduleAllowed); + + } + + public static boolean isNull(String a) { + if ((a == null) || (a.length() == 0) || a.equalsIgnoreCase("null")) + return true; + else + return false; + } + + public int getDependsOnFormFieldFlag(DataColumnType dc, HashMap formValues) { + int flag = 0; + String fieldValue = ""; + if(nvl(dc.getDependsOnFormField()).length()>0 && nvl(dc.getDependsOnFormField()).indexOf("[")!=-1) { + if(formValues != null) { + Set set = formValues.entrySet(); + String value = ""; + for(Iterator iter1 = set.iterator(); iter1.hasNext(); ) { + Map.Entry entry = (Entry) iter1.next(); + value = (String) entry.getValue(); + if (dc.getDependsOnFormField().equals("["+entry.getKey()+"]")) { + fieldValue = nvl(value); + + if (fieldValue.length()>0 && !fieldValue.equals("NULL")) { + flag = 0; + } else { + flag = 1; + } + + } + } + } + } + + return flag; + } + + /* Datamining Getter Setter */ + + public String getClassifier() { + return (cr.getDataminingOptions()!=null?cr.getDataminingOptions().getClassifier():""); + } + + public void setClassifier( String classifier) { + cr.getDataminingOptions().setClassifier(classifier); + } + + + public int getForecastingPeriod() { + return (cr.getDataminingOptions()!=null? new Integer(cr.getDataminingOptions().getForecastingUnits()).intValue():-1); + } + + public void setForecastingPeriod( String period) { + cr.getDataminingOptions().setForecastingUnits(period); + } + + public String getForecastingTimeFormat() { + return (cr.getDataminingOptions()!=null?cr.getDataminingOptions().getTimeformat():""); + } + + public void setForecastingTimeFormat( String format) { + cr.getDataminingOptions().setTimeformat(format); + } + + /** + * Get Number of Columns to Frozen in Data Grid + */ + + public int getFrozenColumns() { + return cr.getFrozenColumns()==null?0:cr.getFrozenColumns(); + } + + public String getFrozenColumnId() { + int noOfColumns = cr.getFrozenColumns()==null?0:cr.getFrozenColumns(); + if(noOfColumns != 0) { + List reportCols = getOnlyVisibleColumns(); + int colIdx = 0; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + ++colIdx; + DataColumnType dc = (DataColumnType) iter.next(); + if(colIdx == noOfColumns) { + + return dc.getColId(); + } else continue; + } // for + return ""; + } else return ""; + + } + + /** + * Set Number of Columns to Frozen in Data Grid + */ + + public void setFrozenColumns( int frozenColumns) { + cr.setFrozenColumns(frozenColumns); + } + + /** + * @return the reportSQLWithRowNum for ZK Support + */ + public String getReportSQLWithRowNum() { + return reportSQLWithRowNum; + } + + /** + * @param reportSQLWithRowNum the reportSQLWithRowNum to set for ZK Support + */ + public void setReportSQLWithRowNum(String reportSQLWithRowNum) { + this.reportSQLWithRowNum = reportSQLWithRowNum; + } + + //used for Zk sort + public void setReportSQLOnlyFirstPart(String reportSQLOnlyFirstPart) { + this.reportSQLOnlyFirstPart = reportSQLOnlyFirstPart; + } + + public String getReportSQLOnlyFirstPart() { + return this.reportSQLOnlyFirstPart; + } + + public String getTemplateFile() throws RaptorException { + return ReportLoader.getTemplateFile(getReportID()); + } + + public String getPdfImg() { + return cr.getPdfImgLogo(); + } + + + public String getEmptyMessage() { + String emptyMessage = cr.getEmptyMessage(); + if(nvl(emptyMessage).length()<=0) + emptyMessage = Globals.getReportEmptyMessage(); + return emptyMessage; + } + + public void setPdfImg(String img_loc) { + cr.setPdfImgLogo(img_loc); + } + + public void setEmptyMessage(String emptyMessage) { + cr.setEmptyMessage(emptyMessage); + } + + public void setDrillReportIdForChart(String reportId) { + //(cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().setDrillReportId():""; + cr.getChartDrillOptions().setDrillReportId(reportId); + } + + public String getDrillReportIdForChart() { + return (cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().getDrillReportId():""; + } + + public void setDrillXAxisFormField(String formField) { + //(cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().setDrillReportId():""; + cr.getChartDrillOptions().setDrillXAxisFormField(formField); + } + + public String getDrillXAxisFormField() { + return (cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().getDrillXAxisFormField():""; + } + + public void setDrillYAxisFormField(String formField) { + //(cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().setDrillReportId():""; + cr.getChartDrillOptions().setDrillYAxisFormField(formField); + } + + public String getDrillYAxisFormField() { + return (cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().getDrillYAxisFormField():""; + } + + public void setDrillSeriesFormField(String formField) { + //(cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().setDrillReportId():""; + cr.getChartDrillOptions().setDrillSeriesFormField(formField); + } + + public String getDrillSeriesFormField() { + return (cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().getDrillSeriesFormField():""; + } + + public boolean isEnhancedPaginationNeeded() { + List reportCols = getAllColumns(); + + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if (dc.isEnhancedPagination()!=null && dc.isEnhancedPagination().booleanValue()) + return true; + } // for + return false; + } + + public DataColumnType getColumnWhichNeedEnhancedPagination() { + List reportCols = getAllColumns(); + + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if (dc.isEnhancedPagination()!=null && dc.isEnhancedPagination().booleanValue()) + return dc; + } // for + return null; + } + + public void setDataGridAlign(String align) { + cr.setDataGridAlign(align); + } + + + public String getDataGridAlign() { + return (cr.getDataGridAlign()!=null)?cr.getDataGridAlign():"left"; + } + + public void setWidthNoColumn(String width) { + cr.setWidthNoColumn(width); + } + + + public String getWidthNoColumn() { + return (cr.getWidthNoColumn()!=null)?cr.getWidthNoColumn():"30px"; + } + + public void setWholeSQL(String sql) { + wholeSQL = sql; + } + public String getWholeSQL() { + return wholeSQL; + } + +} // ReportWrapper diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DBColumnInfo.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DBColumnInfo.java new file mode 100644 index 0000000..4496fdc --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DBColumnInfo.java @@ -0,0 +1,76 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.definition; + +import org.openecomp.portalsdk.analytics.RaptorObject; + +public class DBColumnInfo extends RaptorObject { + private String tableName = null; + + private String colName = null; + + private String colType = null; + + private String label = null; + + // public DBColumnInfo() {} + + public DBColumnInfo(String tableName, String colName, String colType, String label) { + super(); + + setTableName(tableName); + setColName(colName); + setColType(colType); + setLabel(label); + } // DBColumnInfo + + public String getTableName() { + return tableName; + } + + public String getColName() { + return colName; + } + + public String getColType() { + return colType; + } + + public String getLabel() { + return label; + } + + private void setTableName(String tableName) { + this.tableName = tableName; + } + + private void setColName(String colName) { + this.colName = colName; + } + + private void setColType(String colType) { + this.colType = colType; + } + + public void setLabel(String label) { + this.label = label; + } + +} // DBColumnInfo diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DrillDownParamDef.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DrillDownParamDef.java new file mode 100644 index 0000000..8972e54 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DrillDownParamDef.java @@ -0,0 +1,111 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.definition; + +import org.openecomp.portalsdk.analytics.RaptorObject; + +public class DrillDownParamDef extends RaptorObject { + private String fieldName = ""; + + private String valType = "0"; + + private String valValue = ""; + + private String valColId = ""; + + private String valFieldId = ""; + + public DrillDownParamDef(String drillDownParamStr) { + super(); + + drillDownParamStr = nvl(drillDownParamStr).trim(); + if (drillDownParamStr.indexOf('=') >= 0) { + fieldName = drillDownParamStr.substring(0, drillDownParamStr.indexOf('=')); + + if (drillDownParamStr.length() > drillDownParamStr.indexOf('=') + 2 + && drillDownParamStr.charAt(drillDownParamStr.indexOf('=') + 1) == '[' + && drillDownParamStr.charAt(drillDownParamStr.length() - 1) == ']') { + drillDownParamStr = drillDownParamStr.substring( + drillDownParamStr.indexOf('=') + 2, drillDownParamStr.length() - 1); + + if (drillDownParamStr.indexOf('!') < 0) + valColId = drillDownParamStr; + else if (drillDownParamStr.indexOf('!') == 0) + valFieldId = drillDownParamStr.substring(1); + else { + valColId = drillDownParamStr.substring(0, drillDownParamStr.indexOf('!')); + valFieldId = drillDownParamStr + .substring(drillDownParamStr.indexOf('!') + 1); + } // else + + if (valColId.length() > 0 && valFieldId.length() > 0) + valType = "4"; + else if (valFieldId.length() > 0) + valType = "3"; + else if (valColId.length() > 0) + valType = "2"; + } else { + valType = "1"; + valValue = drillDownParamStr.substring(drillDownParamStr.indexOf('=') + 1); + } // else + } // if + } // DrillDownParamDef + + public String getFieldName() { + return fieldName; + } + + public String getValType() { + return valType; + } + + public String getValValue() { + return valValue; + } + + public String getValColId() { + return valColId; + } + + public String getValFieldId() { + return valFieldId; + } + + private void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + private void setValType(String valType) { + this.valType = valType; + } + + private void setValValue(String valValue) { + this.valValue = valValue; + } + + private void setValColId(String valColId) { + this.valColId = valColId; + } + + private void setValFieldId(String valFieldId) { + this.valFieldId = valFieldId; + } + +} // DrillDownParamDef diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/Marker.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/Marker.java new file mode 100644 index 0000000..a9d9be8 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/Marker.java @@ -0,0 +1,79 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.definition; + +import org.openecomp.portalsdk.analytics.RaptorObject; + +public class Marker extends RaptorObject { + String markerColor = ""; + String addressColumn = ""; + String dataColumn = ""; + String address = ""; + String data = ""; + String color = ""; + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + + public Marker(String markerColor, String addressColumn, String dataColumn){ + this.setMarkerColor(markerColor); + this.setAddressColumn(addressColumn); + this.setDataColumn(dataColumn); + } + + public String getAddressColumn() { + return addressColumn; + } + public void setAddressColumn(String addressColumn) { + this.addressColumn = addressColumn; + } + public String getDataColumn() { + return dataColumn; + } + public void setDataColumn(String dataColumn) { + this.dataColumn = dataColumn; + } + public String getMarkerColor() { + return markerColor; + } + public void setMarkerColor(String markerColor) { + this.markerColor = markerColor; + } +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportDefinition.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportDefinition.java new file mode 100644 index 0000000..71ec9f8 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportDefinition.java @@ -0,0 +1,1465 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.definition; + +import java.io.Serializable; +import java.sql.Connection; +import java.util.Calendar; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.StringTokenizer; +import java.util.Vector; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServletRequest; +import javax.xml.bind.JAXBException; +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +//import javax.xml.transform.stream.*; + +import org.openecomp.portalsdk.analytics.controller.WizardSequence; +import org.openecomp.portalsdk.analytics.controller.WizardSequenceCrossTab; +import org.openecomp.portalsdk.analytics.controller.WizardSequenceDashboard; +import org.openecomp.portalsdk.analytics.controller.WizardSequenceLinear; +import org.openecomp.portalsdk.analytics.controller.WizardSequenceSQLBasedCrossTab; +import org.openecomp.portalsdk.analytics.controller.WizardSequenceSQLBasedHive; +import org.openecomp.portalsdk.analytics.controller.WizardSequenceSQLBasedLinear; +import org.openecomp.portalsdk.analytics.controller.WizardSequenceSQLBasedLinearDatamining; +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.model.DataCache; +import org.openecomp.portalsdk.analytics.model.ReportLoader; +import org.openecomp.portalsdk.analytics.model.base.OrderBySeqComparator; +import org.openecomp.portalsdk.analytics.model.base.OrderSeqComparator; +import org.openecomp.portalsdk.analytics.model.base.ReportWrapper; +import org.openecomp.portalsdk.analytics.model.runtime.FormField; +import org.openecomp.portalsdk.analytics.system.AppUtils; +import org.openecomp.portalsdk.analytics.system.DbUtils; +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; +import org.openecomp.portalsdk.analytics.util.DataSet; +import org.openecomp.portalsdk.analytics.util.Utils; +import org.openecomp.portalsdk.analytics.xmlobj.ChartAdditionalOptions; +import org.openecomp.portalsdk.analytics.xmlobj.ChartDrillOptions; +import org.openecomp.portalsdk.analytics.xmlobj.ColFilterType; +import org.openecomp.portalsdk.analytics.xmlobj.CustomReportType; +import org.openecomp.portalsdk.analytics.xmlobj.DataColumnList; +import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType; +import org.openecomp.portalsdk.analytics.xmlobj.DataSourceType; +import org.openecomp.portalsdk.analytics.xmlobj.DataminingOptions; +import org.openecomp.portalsdk.analytics.xmlobj.FormFieldList; +import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType; +import org.openecomp.portalsdk.analytics.xmlobj.FormatList; +import org.openecomp.portalsdk.analytics.xmlobj.FormatType; +import org.openecomp.portalsdk.analytics.xmlobj.JavascriptItemType; +import org.openecomp.portalsdk.analytics.xmlobj.ObjectFactory; +import org.openecomp.portalsdk.analytics.xmlobj.PredefinedValueList; +import org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType; +import org.openecomp.portalsdk.core.controller.FavoritesController; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; + +/**
    + * This class is part of RAPTOR (Rapid Application Programming Tool for OLAP Reporting)
    + *
    + * + * --------------------------------------------------------------------------------------------------
    + * ReportDefinition.java - This involves in creating and modifying RAPTOR reports. + * --------------------------------------------------------------------------------------------------
    + * + * + * Change Log

    + * + * 18-Aug-2009 : Version 8.5.1 (Sundar);
    • request Object is passed to prevent caching user/roles - Datamining/Hosting.
    + * 27-Jul-2009 : Version 8.4 (Sundar);
    • userIsAuthorizedToSeeLog is checked for Admin User instead of Super User.
    + * 22-Jun-2009 : Version 8.4 (Sundar);
    • A new type ChartAdditionalOptions is introduced in RAPTOR XSD. + * For this type a create procedure is added to this class.
    + * + */ + +public class ReportDefinition extends ReportWrapper implements Serializable { + + static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FavoritesController.class); + + + private ReportSchedule reportSchedule = null; + + private WizardSequence wizardSequence = null; + + + private boolean reportUpdateLogged = false; // Used to avoid multiple + // entries in the report log + // when persisting report on + // each step + + private ReportDefinition(CustomReportType crType, String reportID, String ownerID, + String createID, String createDate, String updateID, String updateDate, + String menuID, boolean menuApproved, HttpServletRequest request) throws RaptorException { + super(crType, reportID, ownerID, createID, createDate, updateID, updateDate, menuID, + menuApproved); + if(reportID.equals("-1")) + reportSchedule = new ReportSchedule(getReportID(), getOwnerID(), false, request); + else + reportSchedule = new ReportSchedule(getReportID(), getOwnerID(), true, request); + generateWizardSequence(null); + } // ReportDefinition + + public ReportDefinition(ReportWrapper rw, HttpServletRequest request)throws RaptorException { + super(rw); + + reportSchedule = new ReportSchedule(reportID, rw.getOwnerID(),false, request); + generateWizardSequence(null); + } // ReportDefinition + + private void setReportID(String reportID) { + this.reportID = reportID; + reportSchedule.setReportID(reportID); + reportSchedule.setScheduleUserID(getOwnerID()); + } // setReportID + + public ReportSchedule getReportSchedule() { + return reportSchedule; + } + + public static ReportDefinition unmarshal(String reportXML, String reportID, HttpServletRequest request) + throws RaptorException { + ReportDefinition rn = null; + CustomReportType crType = ReportWrapper.unmarshalCR(reportXML); + //Log.write("Report [" + reportID + "]: XML unmarshalled", 4); + logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] Report [" + reportID + "]: XML unmarshalled")); + + rn = new ReportDefinition(crType, reportID, null, null, null, null, null, null, false, request); + return rn; + } // unmarshal + + public static ReportDefinition createBlank(HttpServletRequest request) throws RaptorException { + String curTime = Utils.getCurrentDateTime(); + String userID = AppUtils.getUserID(request); + ReportDefinition rd = new ReportDefinition(ReportWrapper.createBlankCR(userID), "-1", + userID, userID, curTime, userID, curTime, "", false, request); + + // Necessary initialization + + return rd; + } // ReportDefinition + + public void setAsCopy(HttpServletRequest request) throws RaptorException { + verifySQLBasedReportAccess(request); + + replaceCustomReportWithClone(); + + setReportID("-1"); + setReportName("Copy: " + getReportName()); + } // setAsCopy + + public WizardSequence getWizardSequence() { + return wizardSequence; + } // getWizardSequence + + public void generateWizardSequence(HttpServletRequest request) throws RaptorException { + boolean userIsAuthorizedToSeeLog = false; + String userId = null; + if(request!=null) { + userId = AppUtils.getUserID(request); + if (userId != null) + userIsAuthorizedToSeeLog = AppUtils.isAdminUser(request) + || AppUtils.isAdminUser(request); + //System.out.println("******** Report Type "+getReportType() + " userIsAuthorizedToSeeLog " + userIsAuthorizedToSeeLog); + } + if (getReportType().equals(AppConstants.RT_LINEAR)){ + if (getReportDefType().equals(AppConstants.RD_SQL_BASED)) + wizardSequence = new WizardSequenceSQLBasedLinear(userIsAuthorizedToSeeLog); + else if (getReportDefType().equals(AppConstants.RD_SQL_BASED_DATAMIN)) + wizardSequence = new WizardSequenceSQLBasedLinearDatamining(userIsAuthorizedToSeeLog); + else + wizardSequence = new WizardSequenceLinear(userIsAuthorizedToSeeLog); + } else if (getReportType().equals(AppConstants.RT_CROSSTAB)) { + if (getReportDefType().equals(AppConstants.RD_SQL_BASED)) + wizardSequence = new WizardSequenceSQLBasedCrossTab(userIsAuthorizedToSeeLog); + else + wizardSequence = new WizardSequenceCrossTab(userIsAuthorizedToSeeLog); + } else if (getReportType().equals(AppConstants.RT_DASHBOARD)) { + wizardSequence = new WizardSequenceDashboard(userIsAuthorizedToSeeLog); + } else if (getReportType().equals(AppConstants.RT_HIVE)) { + wizardSequence = new WizardSequenceSQLBasedHive(userIsAuthorizedToSeeLog); + } else + wizardSequence = new WizardSequence(); + } // generateWizardSequence + + private boolean canPersistDashboard() { + //System.out.println(" getDashBoardReports().getReportsList().size() " + getDashBoardReports().getReportsList().size()); + /* Commented for New DashBoard + if (getDashBoardReports()!=null && getDashBoardReports().getReportsList()!=null && getDashBoardReports().getReportsList().size() > 0) { + for (Iterator iter = getDashBoardReports().getReportsList().iterator(); iter.hasNext();) { + Reports report = (Reports)iter.next(); + try { + if(Integer.parseInt(report.getReportId())>0) return true; + } catch (NumberFormatException ex) {} + } // for + } //if + */ + + //if( ) + return nvl(getDashboardLayoutHTML()).length() > 0; + } //canPersistDashboard + + private boolean canPersistLinearReport() { + boolean visibleColExist = false; + + if (getDataSourceList().getDataSource().size() > 0) { + for (Iterator iter = getAllColumns().iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + + if (dct.isVisible()) { + visibleColExist = true; + break; + } + } // for + } // if + + return visibleColExist; + } // canPersistLinearReport + + private boolean canPersistCrossTabReport() { + boolean rowColExist = false; + boolean colColExist = false; + boolean valColExist = false; + + if (getDataSourceList().getDataSource().size() > 0) { + for (Iterator iter = getAllColumns().iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + + if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_ROW)) + rowColExist = true; + if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_COLUMN)) + colColExist = true; + if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_VALUE)) + valColExist = true; + } // for + } // if + + return rowColExist && colColExist && valColExist; + } // canPersistCrossTabReport + + private boolean canPersistReport() { + return getReportType().equals(AppConstants.RT_CROSSTAB) ? canPersistCrossTabReport() + : (getReportType().equals(AppConstants.RT_LINEAR)? canPersistLinearReport():((getReportType().equals(AppConstants.RT_HIVE)? canPersistLinearReport():canPersistDashboard()))); + } // canPersistReport + + public void persistReport(HttpServletRequest request) throws RaptorException { + if (!canPersistReport()) + return; + + Connection connection = null; + try { + String userID = AppUtils.getUserID(request); + String reportXML = marshal(); + logger.debug(EELFLoggerDelegate.debugLogger, ("Ocurring during Schedule ")); + if (nvl(reportID, "-1").equals("-1")) { + connection = DbUtils.startTransaction(); + // Add report + String sql = ""; + if (nvl(Globals.getAdhocReportSequence()).length()> 0 && nvl(Globals.getAdhocUserRoldId()).length() > 0 && AppUtils.isUserInRole(request, Globals.getAdhocUserRoldId()) && !AppUtils.isAdminUser(request)) { + //sql = "SELECT "+ Globals.getAdhocReportSequence() + ".nextval FROM dual"; + sql = Globals.getPersistReportAdhoc(); + sql = sql.replace("[Globals.getAdhocReportSequence()]", Globals.getAdhocReportSequence()); + + } else{ + //sql = "SELECT seq_cr_report.nextval FROM dual"; + sql = Globals.getNewReportData(); + } + DataSet ds = DbUtils.executeQuery(connection,sql); + setReportID(ds.getString(0, 0)); + + reportSecurity.reportCreate(reportID, userID, isPublic()); + ReportLoader.createCustomReportRec(connection, this, reportXML); + ReportLoader.createReportLogEntry(connection, reportID, userID, + AppConstants.RLA_CREATE, "", ""); + reportUpdateLogged = true; + logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] DB insert report " + reportID + " succesfull")); + } else { + // Update report + verifySQLBasedReportAccess(request); + reportSecurity.reportUpdate(request); + connection = DbUtils.startTransaction(); + ReportLoader.updateCustomReportRec(connection, this, reportXML); + if (!reportUpdateLogged) { + ReportLoader.createReportLogEntry(connection, reportID, userID, + AppConstants.RLA_UPDATE,"",""); + reportUpdateLogged = true; + } // if + logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] DB update report " + reportID + " succesfull")); + } + + getReportSchedule().persistScheduleData(connection, request); + + DbUtils.commitTransaction(connection); + } catch (RaptorException e) { + e.printStackTrace(); + DbUtils.rollbackTransaction(connection); + throw e; + } finally { + DbUtils.clearConnection(connection); + } + } // persistReport + + public String getCrossTabDisplayValue(String crossTabValue) { + return nvl(crossTabValue).equals(AppConstants.CV_ROW) ? "Row headings" : (nvl( + crossTabValue).equals(AppConstants.CV_COLUMN) ? "Column headings" : (nvl( + crossTabValue).equals(AppConstants.CV_VALUE) ? "Report values" : "Invisible/Filter")); + } // getCrossTabDisplayValue + + public String getCrossTabDisplayValue(DataColumnType dct) { + return getCrossTabDisplayValue(dct.getCrossTabValue()); + } // getCrossTabDisplayValue + + public String getColumnLabel(DataColumnType dct) throws Exception { + String tableName = getTableById(dct.getTableId()).getTableName(); + Vector dbColumns = null; + dbColumns = DataCache.getReportTableDbColumns(tableName, cr.getDbInfo()); + if (dbColumns != null) + for (int i = 0; i < dbColumns.size(); i++) { + DBColumnInfo dbCol = (DBColumnInfo) dbColumns.get(i); + if (dct.getDbColName().equals(dbCol.getColName())) + return dbCol.getLabel(); + } // for + + return ""; + } // getCrossTabDisplayValue + + public String getFilterLabel(ColFilterType cft) { + StringBuffer fLabel = new StringBuffer(); + + fLabel.append(cft.getExpression()); + fLabel.append(" "); + if (cft.getArgType() != null) + if (cft.getArgType().equals(AppConstants.AT_FORMULA)) { + fLabel.append("[" + cft.getArgValue() + "]"); + } else if (cft.getArgType().equals(AppConstants.AT_VALUE)) { + fLabel.append(cft.getArgValue()); + } else if (cft.getArgType().equals(AppConstants.AT_LIST)) { + fLabel.append("(" + cft.getArgValue() + ")"); + } else if (cft.getArgType().equals(AppConstants.AT_COLUMN)) { + DataColumnType dctFilter = getColumnById(cft.getArgValue()); + fLabel.append("[" + dctFilter.getDisplayName() + "]"); + } else if (cft.getArgType().equals(AppConstants.AT_FORM)) { + fLabel.append("[Form Field]"); + } + + return fLabel.toString(); + } // getFilterLabel + + public Vector getReportUsers(HttpServletRequest request) throws RaptorException { + return reportSecurity.getReportUsers(request); + } // getReportUsers + + public Vector getReportRoles(HttpServletRequest request) throws RaptorException { + return reportSecurity.getReportRoles(request); + } // getReportRoles + + /** ************************************************************************************************* */ + + public void clearAllDrillDowns() { + List reportCols = getAllColumns(); + for (int i = 0; i < reportCols.size(); i++) { + DataColumnType dct = (DataColumnType) reportCols.get(i); + dct.setDrillDownURL(null); + dct.setDrillDownParams(null); + dct.setDrillDownType(null); + } // for + } // clearAllDrillDowns + + public void setOuterJoin(DataSourceType curTable, String joinType) { + String refDefinition = nvl(curTable.getRefDefinition()); + int outerJoinIdx = refDefinition.indexOf(" (+)"); + if (outerJoinIdx >= 0) + // Clear existing outer join + if (outerJoinIdx == (refDefinition.length() - 4)) + refDefinition = refDefinition.substring(0, outerJoinIdx); + else + refDefinition = refDefinition.substring(0, outerJoinIdx) + + refDefinition.substring(outerJoinIdx + 4); + + int equalSignIdx = refDefinition.indexOf("="); + if (equalSignIdx < 0) + // Ref. definition not present + return; + + if (refDefinition.indexOf(curTable.getTableId()) < equalSignIdx) { + // Cur. table is on the left side + if (nvl(joinType).equals(AppConstants.OJ_CURRENT)) + refDefinition = refDefinition.substring(0, equalSignIdx) + " (+)" + + refDefinition.substring(equalSignIdx); + else if (nvl(joinType).equals(AppConstants.OJ_JOINED)) + refDefinition = refDefinition + " (+)"; + } else { + // Joined table is on the left side + if (nvl(joinType).equals(AppConstants.OJ_CURRENT)) + refDefinition = refDefinition + " (+)"; + else if (nvl(joinType).equals(AppConstants.OJ_JOINED)) + refDefinition = refDefinition.substring(0, equalSignIdx) + " (+)" + + refDefinition.substring(equalSignIdx); + } + + curTable.setRefDefinition(refDefinition); + } // setOuterJoin + + public void addDataSourceType(ObjectFactory objFactory, String tableId, String tableName, + String tablePK, String displayName, String refTableId, String refDefinition, + String comment) throws RaptorException { + DataSourceType dst = objFactory.createDataSourceType(); + + dst.setTableId(tableId); + dst.setTableName(tableName); + dst.setTablePK(tablePK); + dst.setDisplayName(displayName); + if (nvl(refTableId).length() > 0) + dst.setRefTableId(refTableId); + if (nvl(refDefinition).length() > 0) + dst.setRefDefinition(refDefinition); + if (nvl(comment).length() > 0) + dst.setComment(comment); + + DataColumnList dataColumnList = objFactory.createDataColumnList(); + dst.setDataColumnList(dataColumnList); + + getDataSourceList().getDataSource().add(dst); + + resetCache(true); + } // addDataSourceType + + public void deleteDataSourceType(String tableId) { + super.deleteDataSourceType(tableId); + } // deleteDataSourceType + + public String getUniqueColumnId(String colName) { + String colId = ""; + + int colIdN = getAllColumns().size() + 1; + do { + colId = colName.substring(0, 2).toLowerCase() + (colIdN++); + } while (getColumnById(colId) != null); + + return colId; + } // getUniqueColumnId + + public DataColumnType addDataColumnType(ObjectFactory objFactory, String colId, + String tableId, // Table to which the new column belongs + String dbColName, String crossTabValue, String colName, String displayName, + int displayWidth, String displayAlignment, int orderSeq, boolean visible, + boolean calculated, String colType, String colFormat, boolean groupBreak, + int orderBySeq, String orderByAscDesc, String displayTotal, String colOnChart, + int chartSeq, String drillDownType, String drillDownURL, String drillDownParams, + String semaphoreId, String comment) throws RaptorException { + DataColumnType dct = null; + dct = objFactory.createDataColumnType(); + + dct.setColId(colId); + dct.setTableId(tableId); + dct.setDbColName(dbColName); + if (nvl(crossTabValue).length() > 0) + dct.setCrossTabValue(crossTabValue); + dct.setColName(colName); + dct.setDisplayName(displayName); + if (displayWidth > 0) + dct.setDisplayWidth(displayWidth); + if (nvl(displayAlignment).length() > 0) + dct.setDisplayAlignment(displayAlignment); + if (orderSeq > 0) + dct.setOrderSeq(orderSeq); + else + dct.setOrderSeq(getAllColumns().size() + 1); + dct.setVisible(visible); + dct.setCalculated(calculated); + // dct.setColType(colType); + if (nvl(colFormat).length() > 0) + dct.setColFormat(colFormat); + dct.setGroupBreak(groupBreak); + if (orderBySeq > 0) + dct.setOrderBySeq(orderBySeq); + if (nvl(orderByAscDesc).length() > 0) + dct.setOrderByAscDesc(orderByAscDesc); + if (nvl(displayTotal).length() > 0) + dct.setDisplayTotal(displayTotal); + if (nvl(colOnChart).length() > 0) + dct.setColOnChart(colOnChart); + if (chartSeq > 0) + dct.setChartSeq(chartSeq); + if (nvl(drillDownType).length() > 0) + dct.setDrillDownType(drillDownType); + if (nvl(drillDownURL).length() > 0) + dct.setDrillDownURL(drillDownURL); + if (nvl(drillDownParams).length() > 0) + dct.setDrillDownParams(drillDownParams); + if (nvl(semaphoreId).length() > 0) + dct.setSemaphoreId(semaphoreId); + if (nvl(comment).length() > 0) + dct.setComment(comment); + + dct.setDbColType(colType); + adjustColumnType(dct); + + // ColFilterList colFilterList = objFactory.createColFilterList(); + // dct.setColFilterList(colFilterList); + + getTableById(tableId).getDataColumnList().getDataColumn().add(dct); + + resetCache(false); + + return dct; + } // addDataColumnType + + public void deleteDataColumnType(String colId) { + int colOrder = getColumnById(colId).getOrderSeq(); + + List dcList = getColumnTableById(colId).getDataColumnList().getDataColumn(); + for (Iterator iterC = dcList.iterator(); iterC.hasNext();) { + DataColumnType dct = (DataColumnType) iterC.next(); + + if (dct.getColId().equals(colId) && dct.getOrderSeq() == colOrder) + iterC.remove(); + else if (dct.getOrderSeq() > colOrder) + dct.setOrderSeq(dct.getOrderSeq() - 1); + } // for + + if (getFormFieldList() != null) + for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) { + FormFieldType fft = (FormFieldType) iter.next(); + if (nvl(fft.getColId()).equals(colId)) { + fft.setColId(""); + fft.setFieldType(FormField.FFT_TEXT); + if (nvl(fft.getDefaultValue()).equals(AppConstants.FILTER_MAX_VALUE) + || nvl(fft.getDefaultValue()) + .equals(AppConstants.FILTER_MIN_VALUE)) + fft.setDefaultValue(""); + } // if + } // for + + resetCache(false); + resetColumnOrderValues(); + } // deleteDataColumnType + + public void shiftColumnOrderUp(String colId) { + List reportCols = getAllColumns(); + for (int i = 0; i < reportCols.size(); i++) { + DataColumnType dct = (DataColumnType) reportCols.get(i); + + if (dct.getColId().equals(colId) && (i > 0)) { + DataColumnType dctUp = (DataColumnType) reportCols.get(i - 1); + dctUp.setOrderSeq(dctUp.getOrderSeq() + 1); + dct.setOrderSeq(dct.getOrderSeq() - 1); + break; + } // if + } // for + + Collections.sort(reportCols, new OrderSeqComparator()); + resetCache(true); + resetColumnOrderValues(); + } // shiftColumnOrderUp + + public void shiftColumnOrderDown(String colId) { + List reportCols = getAllColumns(); + for (int i = 0; i < reportCols.size(); i++) { + DataColumnType dct = (DataColumnType) reportCols.get(i); + + if (dct.getColId().equals(colId) && (i < reportCols.size() - 1)) { + DataColumnType dctDown = (DataColumnType) reportCols.get(i + 1); + dctDown.setOrderSeq(dctDown.getOrderSeq() - 1); + dct.setOrderSeq(dct.getOrderSeq() + 1); + break; + } // if + } // for + + Collections.sort(reportCols, new OrderSeqComparator()); + resetCache(true); + resetColumnOrderValues(); + } // shiftColumnOrderDown + + public void resetColumnOrderValues() { + List reportCols = getAllColumns(); + + int colOrder = 0; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + dct.setOrderSeq(++colOrder); + } // for + + Collections.sort(reportCols, new OrderSeqComparator()); + } // resetColumnOrderValues + + public void addColFilterType(ObjectFactory objFactory, String colId, // Column + // to + // which + // the + // new + // filter + // belongs + String joinCondition, String openBrackets, String expression, String argType, + String argValue, String closeBrackets, String comment) throws RaptorException { + ColFilterType cft = objFactory.createColFilterType(); + + cft.setColId(colId); + cft.setJoinCondition(nvl(joinCondition, "AND")); + if (nvl(openBrackets).length() > 0) + cft.setOpenBrackets(openBrackets); + cft.setExpression(expression); + if (nvl(argType).length() > 0) + cft.setArgType(argType); + if (nvl(argValue).length() > 0) + cft.setArgValue(argValue); + if (nvl(closeBrackets).length() > 0) + cft.setCloseBrackets(closeBrackets); + if (nvl(comment).length() > 0) + cft.setComment(comment); + + DataColumnType dct = getColumnById(colId); + if (dct != null) { + if (dct.getColFilterList() == null) + dct.setColFilterList(objFactory.createColFilterList()); + + cft.setFilterSeq(dct.getColFilterList().getColFilter().size()); + dct.getColFilterList().getColFilter().add(cft); + } // if + + resetCache(true); + } // addColFilterType + + public void removeColumnFilter(String colId, int filterPos) { + DataColumnType dct = getColumnById(colId); + + if (dct.getColFilterList() != null) + try { + dct.getColFilterList().getColFilter().remove(filterPos); + } catch (IndexOutOfBoundsException e) { + } + + resetCache(true); + } // removeColumnFilter + + public void addColumnSort(String colId, String ascDesc) { + addColumnSort(colId, ascDesc, -1); + } // addColumnSort + + public void addColumnSort(String colId, String ascDesc, int sortOrder) { + if (sortOrder <= 0) { + sortOrder = 1; + List reportCols = getAllColumns(); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) + if (((DataColumnType) iter.next()).getOrderBySeq() > 0) + sortOrder++; + } // if + + DataColumnType dct = getColumnById(colId); + dct.setOrderBySeq(sortOrder); + dct.setOrderByAscDesc(ascDesc); + + resetCache(true); + } // addColumnSort + + public void removeColumnSort(String colId) { + DataColumnType dct = getColumnById(colId); + int sortOrder = dct.getOrderBySeq(); + + dct.setOrderBySeq(0); + dct.setOrderByAscDesc(null); + + if (sortOrder > 0) { + List reportCols = getAllColumns(); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dct2 = (DataColumnType) iter.next(); + + if (dct2.getOrderBySeq() > sortOrder) + dct2.setOrderBySeq(dct2.getOrderBySeq() - 1); + } // for + } // if + + resetCache(true); + } // removeColumnSort + + public void shiftColumnSortUp(String colId) { + List reportCols = getAllColumns(); + Collections.sort(reportCols, new OrderBySeqComparator()); + + for (int i = 0; i < reportCols.size(); i++) { + DataColumnType dct = (DataColumnType) reportCols.get(i); + + if (dct.getColId().equals(colId) && (dct.getOrderBySeq() > 0)) { + DataColumnType dctUp = (DataColumnType) reportCols.get(i - 1); + if (dctUp.getOrderBySeq() > 0) + dctUp.setOrderBySeq(dctUp.getOrderBySeq() + 1); + dct.setOrderBySeq(dct.getOrderBySeq() - 1); + break; + } // if + } // for + + Collections.sort(reportCols, new OrderSeqComparator()); + resetCache(true); + } // shiftColumnSortUp + + public void shiftColumnSortDown(String colId) { + List reportCols = getAllColumns(); + Collections.sort(reportCols, new OrderBySeqComparator()); + + for (int i = 0; i < reportCols.size(); i++) { + DataColumnType dct = (DataColumnType) reportCols.get(i); + + if (dct.getColId().equals(colId) && (dct.getOrderBySeq() > 0)) { + DataColumnType dctDown = (DataColumnType) reportCols.get(i + 1); + if (dctDown.getOrderBySeq() > 0) + dctDown.setOrderBySeq(dctDown.getOrderBySeq() - 1); + dct.setOrderBySeq(dct.getOrderBySeq() + 1); + break; + } // if + } // for + + Collections.sort(reportCols, new OrderSeqComparator()); + resetCache(true); + } // shiftColumnSortDown + + /** ************************************************************************************************* */ + + public String generateNewSemaphoreId() { + if (getSemaphoreList() == null) + return "sem1"; + + String semaphoreId = null; + boolean idExists = true; + for (int i = 1; idExists; i++) { + semaphoreId = "sem" + i; + idExists = false; + for (Iterator iter = getSemaphoreList().getSemaphore().iterator(); iter.hasNext();) + if (semaphoreId.equals(((SemaphoreType) iter.next()).getSemaphoreId())) { + idExists = true; + break; + } + } // for + + return semaphoreId; + } // generateNewSemaphoreId + + public SemaphoreType addSemaphore(ObjectFactory objFactory, SemaphoreType semaphoreType) + throws RaptorException { + SemaphoreType sem = null; + try { + if (getSemaphoreList() == null) + setSemaphoreList(objFactory.createSemaphoreList()); + + String semaphoreName = null; + boolean nameExists = true; + for (int i = 1; nameExists; i++) { + semaphoreName = semaphoreType.getSemaphoreName() + ((i > 1) ? (" v" + i) : ""); + nameExists = false; + for (Iterator iter2 = getSemaphoreList().getSemaphore().iterator(); iter2 + .hasNext();) + if (semaphoreName.equals(((SemaphoreType) iter2.next()).getSemaphoreName())) { + nameExists = true; + break; + } + } // for + + sem = cloneSemaphoreType(objFactory, semaphoreType); + getSemaphoreList().getSemaphore().add(sem); + + sem.setSemaphoreId(generateNewSemaphoreId()); + sem.setSemaphoreName(semaphoreName); + } catch (JAXBException ex) { + throw new RaptorException(ex.getMessage(), ex.getCause()); + } + + return sem; + } // addSemaphore + + public SemaphoreType addSemaphoreType(ObjectFactory objFactory, String semaphoreName, + String semaphoreType, String comment) throws RaptorException { + SemaphoreType sem = null; + if (getSemaphoreList() == null) + setSemaphoreList(objFactory.createSemaphoreList()); + + sem = objFactory.createSemaphoreType(); + getSemaphoreList().getSemaphore().add(sem); + + sem.setSemaphoreId(generateNewSemaphoreId()); + sem.setSemaphoreName(semaphoreName); + sem.setSemaphoreType(nvl(semaphoreType)); + if (nvl(comment).length() > 0) + sem.setComment(comment); + + FormatList formatList = objFactory.createFormatList(); + sem.setFormatList(formatList); + return sem; + } // addSemaphoreType + + + public String getNextIdForJavaScriptElement (ObjectFactory objFactory, String fieldId) throws RaptorException { + String id = ""; + JavascriptItemType jit = null; + int incr = 0; + if (getJavascriptList() == null) { + setJavascriptList(objFactory.createJavascriptList()); + return fieldId + "|1"; + } else { + if(getJavascriptList().getJavascriptItem().iterator().hasNext()) { + for (Iterator iter = getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) { + jit = (JavascriptItemType) iter.next(); + logger.debug(EELFLoggerDelegate.debugLogger, ("^^^^^JAVASCRIPTITEMTYPE " + jit.getFieldId() + " " + fieldId + " " + id)); + if(nvl(jit.getFieldId()).length()>0 && jit.getFieldId().equals(fieldId)) { + ++incr; + } + } // for + return fieldId + "|"+incr; + } else { + return fieldId + "|1"; + } + + } + //return null; + } + + public JavascriptItemType addJavascriptType(ObjectFactory objFactory, String id) throws RaptorException { + JavascriptItemType javascriptItemType = null; + int flag = 0; // checking whether id existing in the list + if (getJavascriptList() == null) { + setJavascriptList(objFactory.createJavascriptList()); + javascriptItemType = objFactory.createJavascriptItemType(); + getJavascriptList().getJavascriptItem().add(javascriptItemType); + return javascriptItemType; + } else { + + for (Iterator iter = getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) { + javascriptItemType = (JavascriptItemType)iter.next(); + if(javascriptItemType.getId().equals(id) && !id.startsWith("-1")) { + flag = 1; + break; + } + } + if(flag == 1) return javascriptItemType; + else { + javascriptItemType = objFactory.createJavascriptItemType(); + getJavascriptList().getJavascriptItem().add(javascriptItemType); + return javascriptItemType; + } + } + + } // addSemaphoreType + + public boolean deleteJavascriptType(String id) throws RaptorException { + JavascriptItemType javascriptType = null; + if (getJavascriptList() == null) + return true; + for (Iterator iter = getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) { + javascriptType = (JavascriptItemType)iter.next(); + if(javascriptType.getId().equals(id)) { + iter.remove(); + return true; + } + } + return false; + } // addSemaphoreType + + public static FormatType addEmptyFormatType(ObjectFactory objFactory, + SemaphoreType semaphore) throws RaptorException { + FormatType fmt = null; + fmt = objFactory.createFormatType(); + semaphore.getFormatList().getFormat().add(fmt); + + String formatId = null; + boolean idExists = true; + for (int i = 1; idExists; i++) { + formatId = semaphore.getSemaphoreId() + "_fmt" + i; + idExists = false; + for (Iterator iter = semaphore.getFormatList().getFormat().iterator(); iter + .hasNext();) + if (formatId.equals(((FormatType) iter.next()).getFormatId())) { + idExists = true; + break; + } + } // for + fmt.setFormatId(formatId); + return fmt; + } // addEmptyFormatType + + public static void deleteFormatType(SemaphoreType semaphore, String formatId) { + for (Iterator iter = semaphore.getFormatList().getFormat().iterator(); iter.hasNext();) + if (formatId.equals(((FormatType) iter.next()).getFormatId())) { + iter.remove(); + break; + } // if + } // deleteFormatType + + public FormFieldType addFormFieldType(ObjectFactory objFactory, String fieldName, + String colId, String fieldType, String validationType, String mandatory, + String defaultValue, String fieldSQL, String comment, Calendar rangeStartDate, Calendar rangeEndDate, + String rangeStartDateSQL, String rangeEndDateSQL) throws RaptorException { + FormFieldType fft = null; + fft = objFactory.createFormFieldType(); + + fft.setFieldName(fieldName); + fft.setColId(colId); + fft.setFieldType(fieldType); + fft.setValidationType(validationType); + fft.setMandatory(nvl(mandatory, "N")); + fft.setDefaultValue(nvl(defaultValue)); + fft.setOrderBySeq((getFormFieldList() == null) ? 1 : getFormFieldList().getFormField() + .size() + 1); + fft.setFieldSQL(fieldSQL); + //fft.setRangeStartDate(rangeStartDate); + //fft.setRangeEndDate(rangeEndDate); + + try { + fft.setRangeStartDate(DatatypeFactory.newInstance() + .newXMLGregorianCalendar(rangeStartDate.YEAR, rangeStartDate.MONTH, rangeStartDate.DAY_OF_WEEK, rangeStartDate.HOUR, rangeStartDate.MINUTE, rangeStartDate.SECOND, rangeStartDate.MILLISECOND, rangeStartDate.ZONE_OFFSET)); + fft.setRangeStartDate(DatatypeFactory.newInstance() + .newXMLGregorianCalendar(rangeEndDate.YEAR, rangeEndDate.MONTH, rangeEndDate.DAY_OF_WEEK, rangeEndDate.HOUR, rangeEndDate.MINUTE, rangeEndDate.SECOND, rangeEndDate.MILLISECOND, rangeEndDate.ZONE_OFFSET)); + /*currField.setRangeEndDate(DatatypeFactory.newInstance() + .newXMLGregorianCalendar(end));*/ + } catch (DatatypeConfigurationException ex) { + + } + + fft.setRangeStartDateSQL(rangeStartDateSQL); + fft.setRangeEndDateSQL(rangeEndDateSQL); + if (nvl(comment).length() > 0) + fft.setComment(comment); + + String fieldId = null; + boolean idExists = true; + for (int i = 1; idExists; i++) { + fieldId = "ff" + i; + idExists = false; + if (getFormFieldList() != null) + for (Iterator iter = getFormFieldList().getFormField().iterator(); iter + .hasNext();) + if (fieldId.equals(((FormFieldType) iter.next()).getFieldId())) { + idExists = true; + break; + } + } // for + fft.setFieldId(fieldId); + + if (getFormFieldList() == null) { + FormFieldList formFieldList = objFactory.createFormFieldList(); + setFormFieldList(formFieldList); + } + + getFormFieldList().getFormField().add(fft); + return fft; + } // addFormFieldType + + //addCustomizedTextForParameters + public void addCustomizedTextForParameters(String comment) throws RaptorException { + getFormFieldList().setComment(comment); + } + + public FormFieldType addFormFieldBlank(ObjectFactory objFactory) throws RaptorException { + FormFieldType fft = null; + fft = objFactory.createFormFieldType(); + + fft.setFieldName("BLANK"); + fft.setColId("bk"); + fft.setFieldType(FormField.FFT_BLANK); + fft.setOrderBySeq((getFormFieldList() == null) ? 1 : getFormFieldList().getFormField() + .size() + 1); + String fieldId = null; + boolean idExists = true; + for (int i = 1; idExists; i++) { + fieldId = "ff" + i; + idExists = false; + if (getFormFieldList() != null) + for (Iterator iter = getFormFieldList().getFormField().iterator(); iter + .hasNext();) + if (fieldId.equals(((FormFieldType) iter.next()).getFieldId())) { + idExists = true; + break; + } + } // for + fft.setFieldId(fieldId); + + if (getFormFieldList() == null) { + FormFieldList formFieldList = objFactory.createFormFieldList(); + setFormFieldList(formFieldList); + } + + getFormFieldList().getFormField().add(fft); + return fft; + } // addFormFieldBlank + + public void replaceFormFieldReferences(String fieldName, String replaceWith) { + if (fieldName.equals(replaceWith)) + return; + + for (Iterator iter = getAllColumns().iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + + if (dct.isCalculated() && dct.getColName().indexOf(fieldName) >= 0) + dct.setColName(Utils.replaceInString(dct.getColName(), fieldName, nvl( + replaceWith, "NULL"))); + + if (dct.getColFilterList() != null) + for (Iterator iter2 = dct.getColFilterList().getColFilter().iterator(); iter2 + .hasNext();) { + ColFilterType cft = (ColFilterType) iter2.next(); + + if (nvl(cft.getArgType()).equals(AppConstants.AT_FORM) + && nvl(cft.getArgValue()).equals(fieldName)) + cft.setArgValue(replaceWith); + } // for + } // for + } // replaceFormFieldReferences + + public void deleteFormField(String fieldId) { + String fieldDisplayName = null; + + int orderBySeq = Integer.MAX_VALUE; + if (getFormFieldList() != null) + for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) { + FormFieldType fft = (FormFieldType) iter.next(); + + if (fieldId.equals(fft.getFieldId())) { + //orderBySeq = fft.getOrderBySeq(); + fieldDisplayName = getFormFieldDisplayName(fft); + iter.remove(); + } else if (fft.getOrderBySeq()!=null && (fft.getOrderBySeq().intValue() > orderBySeq)) + fft.setOrderBySeq(fft.getOrderBySeq() - 1); + } // for + + if (fieldDisplayName != null) + replaceFormFieldReferences(fieldDisplayName, ""); + } // deleteFormField + + public void shiftFormFieldUp(String fieldId) { + if (getFormFieldList() == null) + return; + + for (int i = 0; i < getFormFieldList().getFormField().size(); i++) { + FormFieldType fft = (FormFieldType) getFormFieldList().getFormField().get(i); + + if (fft.getFieldId().equals(fieldId) && (i > 0)) { + FormFieldType prevFft = (FormFieldType) getFormFieldList().getFormField().get( + i - 1); + prevFft.setOrderBySeq(prevFft.getOrderBySeq() + 1); + fft.setOrderBySeq((fft.getOrderBySeq() == null)?0:fft.getOrderBySeq() - 1); + + getFormFieldList().getFormField().remove(i); + getFormFieldList().getFormField().add(i - 1, fft); + return; + } // if + } // for + } // shiftFormFieldUp + + public void shiftFormFieldDown(String fieldId) { + if (getFormFieldList() == null) + return; + + for (int i = 0; i < getFormFieldList().getFormField().size(); i++) { + FormFieldType fft = (FormFieldType) getFormFieldList().getFormField().get(i); + + if (fft.getFieldId().equals(fieldId) + && (i < getFormFieldList().getFormField().size() - 1)) { + FormFieldType nextFft = (FormFieldType) getFormFieldList().getFormField().get( + i + 1); + nextFft.setOrderBySeq((nextFft.getOrderBySeq() == null)?0:nextFft.getOrderBySeq() - 1); + fft.setOrderBySeq((fft.getOrderBySeq() == null)?0:fft.getOrderBySeq() + 1); + + getFormFieldList().getFormField().remove(i + 1); + getFormFieldList().getFormField().add(i, nextFft); + return; + } // if + } // for + } // shiftFormFieldDown + + public static void addFormFieldPredefinedValue(ObjectFactory objFactory, + FormFieldType formField, String predefinedValue) throws RaptorException { + if (formField.getPredefinedValueList() == null) { + PredefinedValueList predefinedValueList = objFactory.createPredefinedValueList(); + formField.setPredefinedValueList(predefinedValueList); + } // if + + if (predefinedValue.length() > 0) { + formField.getPredefinedValueList().getPredefinedValue().add(predefinedValue); + Collections.sort(formField.getPredefinedValueList().getPredefinedValue()); + } // if + } // addFormFieldPredefinedValue + + public static void deleteFormFieldPredefinedValue(FormFieldType formField, + String predefinedValue) { + if (formField != null && formField.getPredefinedValueList() != null + && predefinedValue.length() > 0) + for (Iterator iter = formField.getPredefinedValueList().getPredefinedValue() + .iterator(); iter.hasNext();) + if (predefinedValue.equals((String) iter.next())) { + iter.remove(); + break; + } // if + } // deleteFormFieldPredefinedValue + + /** ************************************************************************************************* */ + + private int curSQLParsePos = 0; + + private String getNextSQLParseToken(String sql, boolean updateParsePos) { + int braketCount = 0; + boolean isInsideQuote = false; + StringBuffer nextToken = new StringBuffer(); + for (int idxNext = curSQLParsePos; idxNext < sql.length(); idxNext++) { + char ch = sql.charAt(idxNext); + + if (Character.isWhitespace(ch) || ch == ',') { + if (ch == ',') + nextToken.append(ch); + + if (nextToken.length() == 0) + continue; + else if (braketCount == 0 && (!isInsideQuote)) { + if (updateParsePos) + curSQLParsePos = idxNext + ((ch == ',') ? 1 : 0); + break; + } else if (ch != ',' && nextToken.charAt(nextToken.length() - 1) != ' ') + nextToken.append(' '); + } else { + nextToken.append(ch); + + if (ch == '(' || ch == '[') + braketCount++; + else if (ch == ')' || ch == ']') + braketCount--; + else if (ch == '\''/* ||ch=='\"' */) + isInsideQuote = (!isInsideQuote); + } // else + } // for + + return nextToken.toString(); + } // getNextSQLParseToken + + private boolean isParseSQLColID(String token) { + if (nvl(token).length() == 0) + return false; + + for (int i = 0; i < token.length(); i++) { + char ch = token.charAt(i); + + if (i == 0 && ch == '_') + return false; + + if (!(Character.isLetterOrDigit(ch) || ch == '_')) + return false; + } // for + + return true; + } // isParseSQLColID + + private DataColumnType getParseSQLDataColumn(String sqlExpression, String colId, + StringBuffer parsedSQL, Vector updatedReportCols, boolean isCYMBALScript) throws RaptorException { + DataColumnType dct = null; + + if (colId != null) { + if (!isParseSQLColID(colId)) + throw new org.openecomp.portalsdk.analytics.error.ValidationException( + "[" + + colId + + "] must either be a valid column id consisting only of letters, numbers, and underscores, or there must be a comma in front of it."); + + dct = getColumnById(colId); + } else { + // Getting unique column id + colId = ""; + int colIdN = 0; + for (int i = 0; (i < sqlExpression.length()) && (colIdN < 2); i++) + if (Character.isLetter(sqlExpression.charAt(i))) { + colId += sqlExpression.toLowerCase().charAt(i); + colIdN++; + } // if + + colIdN = getAllColumns().size() + updatedReportCols.size(); + for (boolean idAlreadyUsed = true; idAlreadyUsed; colIdN++) { + String newColId = colId + colIdN; + idAlreadyUsed = false; + + for (Iterator iter = getAllColumns().iterator(); iter.hasNext();) + if (newColId.equals(((DataColumnType) iter.next()).getColId())) { + idAlreadyUsed = true; + break; + } + + if (!idAlreadyUsed) + for (Iterator iter = updatedReportCols.iterator(); iter.hasNext();) + if (newColId.equals(((DataColumnType) iter.next()).getColId())) { + idAlreadyUsed = true; + break; + } + } // for + + colId += (colIdN - 1); + } // else + + if (dct == null) { + dct = (new ObjectFactory()).createDataColumnType(); + dct.setColId(colId); + dct.setDisplayWidth(10); + dct.setDisplayAlignment("Left"); + dct.setVisible(true); + dct.setGroupBreak(false); // ??? + if(!isCYMBALScript) { + boolean isValidIdentifier = Character.isLetterOrDigit(sqlExpression.charAt(0)); + for (int i = 0; i < sqlExpression.length(); i++) + if (!(Character.isLetterOrDigit(sqlExpression.charAt(i)) + || (sqlExpression.charAt(i) == '_') || (sqlExpression.charAt(i) == '$'))) { + isValidIdentifier = false; + break; + } // if + + if (isValidIdentifier) { + dct.setDisplayName(sqlExpression); + } else { + dct.setDisplayName(colId); + } // else + } else dct.setDisplayName(colId); + } // if + if(!isCYMBALScript) + sqlExpression = sqlExpression.replaceAll(", '", ",'"); + dct.setDbColName(sqlExpression); + dct.setColName(sqlExpression); + dct.setCalculated(true); + dct.setColType(AppConstants.CT_CHAR); + dct.setDbColType(AppConstants.CT_CHAR); + adjustColumnType(dct); // ??? + if(!isCYMBALScript) { + if (parsedSQL.toString().equals("SELECT ") + || parsedSQL.toString().equals("SELECT DISTINCT ")) + parsedSQL.append("\n\t"); + else + parsedSQL.append(", \n\t"); + parsedSQL.append(sqlExpression); + parsedSQL.append(" "); + parsedSQL.append(colId); + } + + return dct; + } // getParseSQLDataColumn + + public void parseReportSQL(String sql) throws RaptorException { + StringBuffer parsedSQL = new StringBuffer(); + + Vector updatedReportCols = new Vector(); + + curSQLParsePos = 0; + int lastParsePos = curSQLParsePos; + String lastToken = null; + String nextToken = getNextSQLParseToken(sql, true); + + String dbInfo = getDBInfo(); + boolean isCYMBALScript = false; + if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { + try { + org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo(); + String dbType = remDbInfo.getDBType(dbInfo); + if (dbType.equals("DAYTONA") && !(nextToken.toUpperCase().equals("SELECT"))) { + isCYMBALScript = true; + } + } catch (Exception ex) { + throw new RaptorException(ex); + } + } + if ( isCYMBALScript == false ) { + while (nextToken.length() > 0) { + if (parsedSQL.length() == 0) { + if (nextToken.toUpperCase().equals("SELECT")) + parsedSQL.append("SELECT "); + else + throw new org.openecomp.portalsdk.analytics.error.ValidationException( + "The SQL must start with the SELECT keyword."); + } else if (nextToken.toUpperCase().equals("DISTINCT") + && parsedSQL.toString().equals("SELECT ")) { + parsedSQL.append("DISTINCT "); + } else if (nextToken.equals("*") + && (parsedSQL.toString().equals("SELECT ") || parsedSQL.toString().equals( + "SELECT DISTINCT "))) { + throw new org.openecomp.portalsdk.analytics.error.ValidationException( + "You cannot use \"SELECT *\". Please specify select columns/expressions."); + } else if (nextToken.toUpperCase().equals("FROM")) { + if (lastToken != null) { + updatedReportCols.add(getParseSQLDataColumn(lastToken, null, parsedSQL, + updatedReportCols, false)); + lastToken = null; + } + + parsedSQL.append(" \n"); + while (lastParsePos < sql.length() + && Character.isWhitespace(sql.charAt(lastParsePos))) + lastParsePos++; + parsedSQL.append(sql.substring(lastParsePos)); + break; + } else { + if (nextToken.charAt(nextToken.length() - 1) == ',') { + // The token ends with , + nextToken = nextToken.substring(0, nextToken.length() - 1); + + if (nextToken.length() == 0) { + if (lastToken != null) { + updatedReportCols.add(getParseSQLDataColumn(lastToken, null, + parsedSQL, updatedReportCols, false)); + lastToken = null; + } // else just comma => ignore it + } else { + if (lastToken != null) { + updatedReportCols.add(getParseSQLDataColumn(lastToken, nextToken, + parsedSQL, updatedReportCols, false)); + lastToken = null; + } else + updatedReportCols.add(getParseSQLDataColumn(nextToken, null, + parsedSQL, updatedReportCols, false)); + } + } else { + // The token doesn't end with , + if (lastToken == null) + lastToken = nextToken; + else { + String token = getNextSQLParseToken(sql, false); + if (!token.toUpperCase().equals("FROM")) + throw new org.openecomp.portalsdk.analytics.error.ValidationException( + "|FROM keyword or a comma expected after [" + nextToken + + "]."); + + updatedReportCols.add(getParseSQLDataColumn(lastToken, nextToken, + parsedSQL, updatedReportCols, false)); + lastToken = null; + } // else + } // else + } // else + + lastParsePos = curSQLParsePos; + nextToken = getNextSQLParseToken(sql, true); + } // while + } else { // if CYMBAL Script + curSQLParsePos = 0; + Pattern re = null; + Matcher matcher = null; + String extracted = null; + nextToken = getNextCYMBALSQLParseToken(sql,true); + while (nextToken.length() > 0) { + if (lastToken == null) lastToken = nextToken; + + if( lastToken.toUpperCase().startsWith("DO DISPLAY")) { + re = Pattern.compile("each(.*)\\[.(.*?)\\]"); //\\[(.*?)\\] + matcher = re.matcher(nextToken); + if (matcher.find()) { + extracted = matcher.group(); + re = Pattern.compile("\\[(.*?)\\]"); + matcher = re.matcher(nextToken); + if(matcher.find()) { + extracted = matcher.group(); + extracted = extracted.substring(1,extracted.length()-1); + StringTokenizer sToken = new StringTokenizer(extracted, ","); + while(sToken.hasMoreTokens()) { + String str1 = sToken.nextToken().trim().substring(1); + updatedReportCols.add(getParseSQLDataColumn("", str1, + new StringBuffer(""), updatedReportCols, true)); + } + } + + } + + } + lastToken = nextToken; + nextToken = getNextCYMBALSQLParseToken(sql, true); + } + + } + if (updatedReportCols.size() == 0) + throw new org.openecomp.portalsdk.analytics.error.ValidationException( + "The SQL statement must have at least one column in the SELECT clause."); + if (getDataSourceList().getDataSource().size() == 0) + addDataSourceType(new ObjectFactory(), "du0", "DUAL", "", "DUAL", null, null, null); + DataSourceType dst = (DataSourceType) getDataSourceList().getDataSource().get(0); + dst.getDataColumnList().getDataColumn().clear(); + + for (int i = 0; i < updatedReportCols.size(); i++) { + DataColumnType dct = (DataColumnType) updatedReportCols.get(i); + dct.setTableId(dst.getTableId()); + dct.setOrderSeq(i + 1); + dst.getDataColumnList().getDataColumn().add(dct); + } // for + setReportSQL(parsedSQL.toString()); + resetCache(false); + } // parseReportSQL + + private String getNextCYMBALSQLParseToken(String sql, boolean updateParsePos) { + int braketCount = 0; + boolean isInsideQuote = false; + StringBuffer nextToken = new StringBuffer(); + for (int idxNext = curSQLParsePos; idxNext < sql.length(); idxNext++) { + char ch = sql.charAt(idxNext); + + if (ch!='\n') { + nextToken.append(ch); + if (updateParsePos) + curSQLParsePos = idxNext; + } + else { + curSQLParsePos = idxNext+1; + break; + } + } // for + + return nextToken.toString(); + } // getNextSQLParseToken + + public void addChartAdditionalOptions(ObjectFactory objFactory) throws RaptorException { + ChartAdditionalOptions chartOptions = objFactory.createChartAdditionalOptions(); + cr.setChartAdditionalOptions(chartOptions); + } + + public void addChartDrillOptions(ObjectFactory objFactory) throws RaptorException { + ChartDrillOptions chartOptions = objFactory.createChartDrillOptions(); + cr.setChartDrillOptions(chartOptions); +} + + public void addDataminingOptions(ObjectFactory objFactory) throws RaptorException { + DataminingOptions dataminingOptions = objFactory.createDataminingOptions(); + cr.setDataminingOptions(dataminingOptions); + } + /*public void addChartAdditionalOptions(ObjectFactory objFactory, String chartType, String chartMultiplePieOrder, String chartMultiplePieLabelDisplay, + String chartOrientation, String secondaryChartRenderer, String chartDisplay, String legendPosition, + String labelAngle) throws RaptorException { + try { + ChartAdditionalOptions chartOptions = objFactory.createChartAdditionalOptions(); + + if (nvl(chartMultiplePieOrder).length() > 0) + chartOptions.setChartMultiplePieOrder(chartMultiplePieOrder); + if (nvl(chartMultiplePieLabelDisplay).length() > 0) + chartOptions.setChartMultiplePieLabelDisplay(chartMultiplePieLabelDisplay); + if (nvl(chartOrientation).length() > 0) + chartOptions.setChartOrientation(chartOrientation); + if (nvl(secondaryChartRenderer).length() > 0) + chartOptions.setSecondaryChartRenderer(secondaryChartRenderer); + if (nvl(chartDisplay).length() > 0) + chartOptions.setChartDisplay(chartDisplay); + if (nvl(legendPosition).length() > 0) + chartOptions.setLegendPosition(legendPosition); + if (nvl(labelAngle).length() > 0) + chartOptions.setLabelAngle(labelAngle); + + cr.setChartAdditionalOptions(chartOptions); + } catch (JAXBException ex) { + throw new RaptorException(ex.getMessage(), ex.getCause()); + } + } // addChartAdditionalOptions*/ + + +} // ReportDefinition diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportLogEntry.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportLogEntry.java new file mode 100644 index 0000000..db69e9d --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportLogEntry.java @@ -0,0 +1,89 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.definition; + +import org.openecomp.portalsdk.analytics.RaptorObject; + +public class ReportLogEntry extends RaptorObject { + private String logTime = null; + + private String userName = null; + + private String action = null; + + private String timeTaken; + + private String runIcon; + + public ReportLogEntry() { + super(); + } + + public ReportLogEntry(String logTime, String userName, String action, String timeTaken, String runIcon) { + this(); + + setLogTime(logTime); + setUserName(userName); + setAction(action); + setTimeTaken(timeTaken); + setRunIcon(runIcon); + } // ReportLogEntry + + public String getLogTime() { + return logTime; + } + + public String getUserName() { + return userName; + } + + public String getAction() { + return action; + } + + public void setLogTime(String logTime) { + this.logTime = logTime; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public void setAction(String action) { + this.action = action; + } + + public String getTimeTaken() { + return timeTaken; + } + + public void setTimeTaken(String timeTaken) { + this.timeTaken = timeTaken; + } + + public String getRunIcon() { + return runIcon; + } + + public void setRunIcon(String runIcon) { + this.runIcon = runIcon; + } + +} // ReportLogEntry diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportMap.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportMap.java new file mode 100644 index 0000000..450349c --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportMap.java @@ -0,0 +1,82 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.definition; + +import java.util.ArrayList; +import java.util.List; + +import org.openecomp.portalsdk.analytics.RaptorObject; + +public class ReportMap extends RaptorObject { + String markerColor = ""; + String addressColumn = ""; + String dataColumn = ""; + String isMapAllowedYN = ""; + String addAddressInDataYN = ""; + List markers = new ArrayList(); + + public String getIsMapAllowedYN() { + return isMapAllowedYN; + } + public void setIsMapAllowedYN(String isMapAllowedYN) { + this.isMapAllowedYN = isMapAllowedYN; + } + public ReportMap(String markerColor, String addressColumn, String dataColumn, String isMapAllowed, String addAddressInDataYN){ + this.setMarkerColor(markerColor); + this.setAddressColumn(addressColumn); + this.setDataColumn(dataColumn); + this.setIsMapAllowedYN(isMapAllowed); + this.setAddAddressInDataYN(addAddressInDataYN); + } + public String getAddressColumn() { + return addressColumn; + } + public void setAddressColumn(String addressColumn) { + this.addressColumn = addressColumn; + } + public String getDataColumn() { + return dataColumn; + } + public void setDataColumn(String dataColumn) { + this.dataColumn = dataColumn; + } + public String getMarkerColor() { + return markerColor; + } + public void setMarkerColor(String markerColor) { + this.markerColor = markerColor; + } + public List getMarkers() { + return markers; + } + public void setMarkers(List markers) { + this.markers = markers; + } + public String getAddAddressInDataYN() { + return addAddressInDataYN; + } + public void setAddAddressInDataYN(String addAddressInDataYN) { + this.addAddressInDataYN = addAddressInDataYN; + } + + + + +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportSchedule.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportSchedule.java new file mode 100644 index 0000000..d95c91b --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportSchedule.java @@ -0,0 +1,1407 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.definition; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.Writer; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Vector; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServletRequest; + +import org.openecomp.portalsdk.analytics.RaptorObject; +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException; +import org.openecomp.portalsdk.analytics.error.ReportSQLException; +import org.openecomp.portalsdk.analytics.error.UserDefinedException; +import org.openecomp.portalsdk.analytics.model.base.IdNameValue; +import org.openecomp.portalsdk.analytics.model.base.NameComparator; +import org.openecomp.portalsdk.analytics.model.runtime.FormField; +import org.openecomp.portalsdk.analytics.model.runtime.ReportParamValues; +import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime; +import org.openecomp.portalsdk.analytics.system.AppUtils; +import org.openecomp.portalsdk.analytics.system.ConnectionUtils; +import org.openecomp.portalsdk.analytics.system.DbUtils; +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; +import org.openecomp.portalsdk.analytics.util.DataSet; +import org.openecomp.portalsdk.analytics.util.Utils; +import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; + +public class ReportSchedule extends RaptorObject { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportSchedule.class); + + + private String reportID = null; + + private String scheduleUserID = null; + + private String scheduleID = ""; + + private boolean infoUpdated = false; + + private String schedEnabled = "Y"; + + private String startDate = ""; + + private String endDate = ""; + + private String runDate = ""; + + private String runHour = "12"; + + private String runMin = "00"; + + private String runAMPM = "AM"; + + private String endHour = "11"; + + private String endMin = "45"; + + private String endAMPM = "PM"; + + private String recurrence = ""; + + private String conditional = "N"; + + private String conditionSQL = ""; + + private String notify_type = "1"; //1 -- link, 2 -- pdf, 4 -- excel, 3 -- csv + + private String encryptMode = "N"; //1 -- link, 2 -- pdf, 4 -- excel, 3 -- csv + + private String attachment = "Y"; //1 -- link, 2 -- pdf, 4 -- excel, 3 -- csv + + private String downloadLimit = "0"; + + private String formFields = ""; + + private Vector emailToUsers = new Vector(); + + private Vector emailToRoles = new Vector(); + + public ReportSchedule(String reportID, String scheduleUserID, boolean loadData, HttpServletRequest request) { + super(); + + setReportID(reportID); + setScheduleUserID(scheduleUserID); + if(loadData) + loadScheduleData(request); + else + newScheduleData(); + } // ReportSchedule + + public ReportSchedule(String reportID, String scheduleID, String scheduleUserID, HttpServletRequest request) { + super(); + + setReportID(reportID); + setScheduleID(scheduleID); + setScheduleUserID(scheduleUserID); + loadScheduleData(request); + } // ReportSchedule + + void setReportID(String reportID) { + this.reportID = reportID; + } + + public String getSchedEnabled() { + return schedEnabled; + } + + public String getStartDate() { + return startDate; + } + + public String getEndDate() { + return endDate; + } + + public String getRunDate() { + return runDate; + } + + public String getRunHour() { + return runHour; + } + + public String getRunMin() { + return runMin; + } + + public String getRunAMPM() { + return runAMPM; + } + + public String getRecurrence() { + return recurrence; + } + + public String getConditional() { + return conditional; + } + + public String getConditionSQL() { + return conditionSQL; + } + + public List getEmailToUsers() { + return emailToUsers; + } + + public List getEmailToRoles() { + return emailToRoles; + } + + /** + * @return the downloadLimit + */ + public String getDownloadLimit() { + return downloadLimit; + } + + /** + * @param downloadLimit the downloadLimit to set + */ + public void setDownloadLimit(String downloadLimit) { + if(nvl(downloadLimit).equals(this.downloadLimit)) + return; + this.downloadLimit = nvl(downloadLimit,"0"); + infoUpdated = true; + } + + /** + * @return the formFields + */ + public String getFormFields() { + return formFields; + } + + /** + * @param formFields the formFields to set + */ + public void setFormFields(String formFields) { + if(nvl(formFields).equals(this.formFields)) + return; + this.formFields = nvl(formFields); + infoUpdated = true; + } + + public String getNotify_type() { + return notify_type; + } + + /** + * @param notify_type the notify_type to set + * 1 -- link (default), 2 -- pdf, 4 -- excel + */ + public void setNotify_type(String notify_type) { + if(nvl(notify_type).equals(this.notify_type)) + return; + this.notify_type = nvl(notify_type,"1"); + infoUpdated = true; + } + + public void setSchedEnabled(String schedEnabled) { + if (nvl(schedEnabled).equals(this.schedEnabled)) + return; + infoUpdated = true; + this.schedEnabled = nvl(schedEnabled, "N"); + } + + public void setStartDate(String startDate) { + if (nvl(startDate).equals(this.startDate)) + return; + infoUpdated = true; + this.startDate = nvl(startDate); + } + + public void setEndDate(String endDate) { + if (nvl(endDate).equals(this.endDate)) + return; + infoUpdated = true; + this.endDate = nvl(endDate); + } + + public void setRunDate(String runDate) { + if (nvl(runDate).equals(this.runDate)) + return; + infoUpdated = true; + this.runDate = nvl(runDate); + } + + public void setRunHour(String runHour) { + if (nvl(runHour).equals(this.runHour)) + return; + infoUpdated = true; + this.runHour = nvl(runHour, "12"); + } + + public void setRunMin(String runMin) { + if (nvl(runMin).equals(this.runMin)) + return; + infoUpdated = true; + this.runMin = nvl(runMin, "00"); + } + + public void setRunAMPM(String runAMPM) { + if (nvl(runAMPM).equals(this.runAMPM)) + return; + infoUpdated = true; + this.runAMPM = nvl(runAMPM, "AM"); + } + + public void setRecurrence(String recurrence) { + if (nvl(recurrence).equals(this.recurrence)) + return; + infoUpdated = true; + this.recurrence = nvl(recurrence); + } + + public void setConditional(String conditional) { + if (nvl(conditional).equals(this.conditional)) + return; + infoUpdated = true; + this.conditional = nvl(conditional, "N"); + } + + public void setConditionSQL(String conditionSQL) { + if (nvl(conditionSQL).equals(this.conditionSQL)) + return; + infoUpdated = true; + this.conditionSQL = nvl(conditionSQL); + } + + public void addEmailToUser(String userId, String userName) { + if (nvl(userId).length() == 0) + return; + + for (int i = 0; i < emailToUsers.size(); i++) { + IdNameValue selUser = (IdNameValue) emailToUsers.get(i); + if (userId.equals(selUser.getId())) + return; + } // for + + emailToUsers.add(new IdNameValue(userId, userName)); + Collections.sort(emailToUsers, new NameComparator()); + infoUpdated = true; + } // addEmailToUser + + + public void addEmailArrayToUser(ArrayList allSelectedUsers) { + if (allSelectedUsers==null || allSelectedUsers.size()<=0) + return; + emailToUsers.removeAllElements(); + for (int i = 0; i < allSelectedUsers.size(); i++) { + emailToUsers.add(allSelectedUsers.get(i)); + } + Collections.sort(emailToUsers, new NameComparator()); + infoUpdated = true; + } // addEmailArrayToUser + + public void removeEmailToUser(String userId) { + if (nvl(userId).length() == 0) + return; + + for (int i = 0; i < emailToUsers.size(); i++) { + IdNameValue selUser = (IdNameValue) emailToUsers.get(i); + if (userId.equals(selUser.getId())) { + infoUpdated = true; + emailToUsers.remove(i); + return; + } // if + } // for + } // removeEmailToUser + + public void addEmailToRole(String roleId, String roleName) { + if (nvl(roleId).length() == 0) + return; + + for (int i = 0; i < emailToRoles.size(); i++) { + IdNameValue selRole = (IdNameValue) emailToRoles.get(i); + if (roleId.equals(selRole.getId())) + return; + } // for + + emailToRoles.add(new IdNameValue(roleId, roleName)); + Collections.sort(emailToRoles, new NameComparator()); + infoUpdated = true; + } // addEmailToRole + + public void addEmailArrayToRole(ArrayList allSelectedRoles) { + if (allSelectedRoles==null || allSelectedRoles.size()<=0) + return; + emailToRoles.removeAllElements(); + for (int i = 0; i < allSelectedRoles.size(); i++) { + emailToRoles.add(allSelectedRoles.get(i)); + } + Collections.sort(emailToRoles, new NameComparator()); + infoUpdated = true; + } // addEmailArrayToRole + + public void removeEmailToRole(String roleId) { + if (nvl(roleId).length() == 0) + return; + + for (int i = 0; i < emailToRoles.size(); i++) { + IdNameValue selRole = (IdNameValue) emailToRoles.get(i); + if (roleId.equals(selRole.getId())) { + infoUpdated = true; + emailToRoles.remove(i); + return; + } // if + } // for + } // addEmailToRole + + private void loadScheduleData(HttpServletRequest request) { + try { + StringBuffer query = new StringBuffer(""); + //query.append("SELECT rs.enabled_yn, TO_CHAR(rs.start_date, 'MM/DD/YYYY') start_date, TO_CHAR(rs.end_date, 'MM/DD/YYYY') end_date, TO_CHAR(rs.run_date, 'MM/DD/YYYY') run_date, NVL(TO_CHAR(rs.run_date, 'HH'), '12') run_hour, NVL(TO_CHAR(rs.run_date, 'MI'), '00') run_min, NVL(TO_CHAR(rs.run_date, 'AM'), 'AM') run_ampm, rs.recurrence, rs.conditional_yn, rs.notify_type, rs.max_row, rs.initial_formfields, rs.schedule_id, NVL(TO_CHAR(rs.end_date, 'HH'), '11') end_hour, NVL(TO_CHAR(rs.end_date, 'MI'), '45') end_min, NVL(TO_CHAR(rs.end_date, 'AM'), 'PM') end_ampm, encrypt_yn, attachment_yn FROM cr_report_schedule rs WHERE rs.rep_id = " + // + reportID); + String q_sql = Globals.getLoadScheduleData(); + q_sql = q_sql.replace("[reportID]", reportID); + query.append(q_sql); + + if(!AppUtils.isAdminUser(request)) + query.append(" and rs.sched_user_id = " + getScheduleUserID()); + if(nvl(getScheduleID()).length()>0) { + query.append(" and rs.schedule_id = " + getScheduleID()); + } + query.append(" order by rs.run_date desc "); + + DataSet ds = DbUtils + .executeQuery(query.toString()); + + if (ds.getRowCount() > 0) { + schedEnabled = nvl(ds.getString(0, 0), "N"); + startDate = nvl(ds.getString(0, 1)); + endDate = nvl(ds.getString(0, 2)); + runDate = nvl(ds.getString(0, 3)); + runHour = nvl(ds.getString(0, 4), "12"); + runMin = nvl(ds.getString(0, 5), "00"); + runAMPM = nvl(ds.getString(0, 6), "AM"); + recurrence = nvl(ds.getString(0, 7)); + conditional = nvl(ds.getString(0, 8), "N"); + //conditionSQL = nvl(ds.getString(0, 9)); + notify_type = nvl(ds.getString(0, 9), "1"); + downloadLimit = nvl(ds.getString(0, 10), "1000"); + //if(nvl(ds.getString(0, 13).) + formFields = nvl(ds.getString(0, 11)); + setScheduleID(ds.getString(0, 12)); + endHour = nvl(ds.getString(0, 13), "11"); + endMin = nvl(ds.getString(0, 14), "45"); + endAMPM = nvl(ds.getString(0, 15), "PM"); + encryptMode = nvl(ds.getString(0, "encrypt_yn"), "N"); + attachment = nvl(ds.getString(0, "attachment_yn"), "Y"); + conditionSQL = loadConditionalSQL(getScheduleID()); + } else { // if + //DataSet dsSeq = DbUtils.executeQuery("select SEQ_CR_REPORT_SCHEDULE.nextval from dual" ); + String n_sql = Globals.getNewScheduleData(); + DataSet dsSeq = DbUtils.executeQuery(n_sql); + String schedule_id = dsSeq.getString(0,0); + setScheduleID(schedule_id); + } + if(getScheduleID().length() > 0) { + //ds = DbUtils + // .executeQuery("SELECT rsu.user_id, fuser.last_name||', '||fuser.first_name, fuser.login_id FROM cr_report_schedule_users rsu, fn_user fuser WHERE rsu.rep_id = " + // + reportID + " AND rsu.schedule_id = " + getScheduleID() + " and rsu.user_id IS NOT NULL and rsu.user_id = fuser.user_id"); + + String t_sql = Globals.getLoadScheduleGetId(); + t_sql = t_sql.replace("[reportID]", reportID); + t_sql = t_sql.replace("[getScheduleID()]", getScheduleID()); + + ds = DbUtils.executeQuery(t_sql); + + for (int i = 0; i < ds.getRowCount(); i++){ + String nameToDisplay = ds.getString(i, 1); + if (Globals.getUseLoginIdInSchedYN()!= null && Globals.getUseLoginIdInSchedYN().equals("Y")) { + nameToDisplay = ds.getString(i, 2); + } + if(nameToDisplay!=null && nameToDisplay.length() > 0) + emailToUsers.add(new IdNameValue(ds.getString(i, 0), nameToDisplay)); + else + emailToUsers.add(new IdNameValue(ds.getString(i, 0), ds.getString(i, 1))); + } + Collections.sort(emailToUsers, new NameComparator()); + + //ds = DbUtils + // .executeQuery("SELECT rsu.role_id FROM cr_report_schedule_users rsu WHERE rsu.rep_id = " + // + reportID + " AND rsu.schedule_id = " + getScheduleID() + " AND rsu.role_id IS NOT NULL"); + + String r_sql = Globals.getLoadScheduleUsers(); + r_sql = r_sql.replace("[reportID]", reportID); + r_sql = r_sql.replace("[getScheduleID()]", getScheduleID()); + + ds = DbUtils.executeQuery(r_sql); + + for (int i = 0; i < ds.getRowCount(); i++) + emailToRoles.add(new IdNameValue(ds.getString(i, 0), AppUtils.getRoleName(ds + .getString(i, 0)))); + Collections.sort(emailToRoles, new NameComparator()); + + infoUpdated = false; + } + } catch (Exception e) { + throw new RuntimeException( + "[ReportSchedule.loadScheduleData] Unable to load Report " + reportID + + " schedule. Error: " + e.getMessage()); + } + } // loadScheduleData + + private void newScheduleData() { + try { + //DataSet dsSeq = DbUtils.executeQuery("select SEQ_CR_REPORT_SCHEDULE.nextval from dual" ); + String sql = Globals.getNewScheduleData(); + DataSet dsSeq = DbUtils.executeQuery(sql); + + String schedule_id = dsSeq.getString(0,0); + setScheduleID(schedule_id); + } catch (Exception e) { + throw new RuntimeException( + "[ReportSchedule.newScheduleData] Unable to load Report " + reportID + + " schedule. Error: " + e.getMessage()); + } + } // newScheduleData + + private String parseScheduleSQL(HttpServletRequest request, String sql) throws RaptorException { + DataSet ds = null; + + logger.debug(EELFLoggerDelegate.debugLogger, (sql)); + String[] reqParameters = Globals.getRequestParams().split(","); + String[] sessionParameters = Globals.getSessionParams().split(","); + String[] scheduleSessionParameters = Globals.getSessionParamsForScheduling().split(","); + javax.servlet.http.HttpSession session = request.getSession(); + ReportRuntime rr = (ReportRuntime) session.getAttribute(AppConstants.SI_REPORT_RUNTIME); + String userId = AppUtils.getUserID(request); + String dbType = ""; + String dbInfo = rr.getDBInfo(); + ReportParamValues paramValues = rr.getReportParamValues(); + int fieldCount = 0; + // For Daytona removing all formfields which has null param value + Pattern re1 = null; + Matcher matcher = null; + int index = 0; + int posFormField = 0; + int posAnd = 0; + if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { + try { + org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo(); + dbType = remDbInfo.getDBType(dbInfo); + } catch (Exception ex) { + throw new RaptorException(ex); + } + } + + sql = sql + " "; + sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ss][Ee][Ll][Ee][Cc][Tt]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" SELECT "); + sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Rr][Ee]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" WHERE "); + sql = Pattern.compile("(^[\r\n]*|([\\s]))[Aa][Nn][Dd]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" AND "); + + if (rr.getFormFieldList() != null) { + for (Iterator iter = rr.getFormFieldList().getFormField().iterator(); iter.hasNext();) { + + FormFieldType fft = (FormFieldType) iter.next(); + String fieldId = fft.getFieldId(); + String fieldDisplay = rr.getFormFieldDisplayName(fft); + if(!fft.getFieldType().equals(FormField.FFT_BLANK)) { + if (paramValues.isParameterMultiValue(fieldId)) { + String replaceValue = rr.formatListValue(fieldDisplay, nvl(paramValues.getParamValue(fieldId)), null, false, + true, null, paramValues.getParamBaseSQL(fieldId)); + if(replaceValue.length() > 0) { + sql = Utils.replaceInString(sql, fieldDisplay, replaceValue); + } else { + fieldCount++; + if(fieldCount == 1) { + //sql = sql + " "; + //sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ss][Ee][Ll][Ee][Cc][Tt]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" SELECT "); + //sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Rr][Ee]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" WHERE "); + //sql = Pattern.compile("(^[\r\n]*|([\\s]))[Aa][Nn][Dd]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" AND "); + } + //sql = getReportSQL(); + while(sql.indexOf(fieldDisplay) > 0) { +/* sql = Utils.replaceInString(sql, "SELECT ", "select "); + sql = Utils.replaceInString(sql, "WHERE", "where"); + sql = Utils.replaceInString(sql, " AND ", " and "); +*/ + re1 = Pattern.compile("(^[\r\n]|[\\s])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL); + //re1 = Pattern.compile("(^[\r\n]|[\\s])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\]", Pattern.DOTALL); +/* posFormField = sql.indexOf(fieldDisplay); + posAnd = sql.lastIndexOf("and", posFormField); + if(posAnd < 0) posAnd = 0; + else if (posAnd > 2) posAnd = posAnd - 2; + matcher = re1.matcher(sql); +*/ + posFormField = sql.indexOf(fieldDisplay); + int posSelectField = sql.lastIndexOf("SELECT ", posFormField); + int whereField = sql.indexOf(" WHERE" , posSelectField); + int andField = 0; + if(posFormField > whereField) + andField = sql.lastIndexOf(" AND ", posFormField); + if (posFormField > andField && andField > whereField) + posAnd = andField; + else + posAnd = 0; + matcher = re1.matcher(sql); + + + if (posAnd > 0 && matcher.find(posAnd-1)) { + //sql = Utils.replaceInString(sql, matcher.group(), " "); + matcher = re1.matcher(sql); + index = sql!=null?sql.lastIndexOf("["+fft.getFieldName()+"]"):-1; + + if(andField>0) + index = andField; + else + index = whereField; + if(index >= 0 && matcher.find(index-1)) { + sql = sql.replace(matcher.group(), " "); + } + } else { + + //sql = sql.replace + re1 = Pattern.compile("(^[\r\n]|[\\s])WHERE(.*?[^\r\n]*)\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL); + matcher = re1.matcher(sql); + if(matcher.find(whereField-1)) { + matcher = re1.matcher(sql); + index = sql!=null?sql.lastIndexOf("["+fft.getFieldName()+"]"):-1; + if(index >= 0 && matcher.find(index-30)) { + sql = sql.replace(matcher.group(), " WHERE 1=1 "); + } + //sql = Utils.replaceInString(sql, matcher.group(), " where 1=1 "); + } /*else { + replaceValue = formatListValue("", Utils + .oracleSafe(nvl(paramValues.getParamValue(fieldId))), null, false, + true, null, paramValues.getParamBaseSQL(fieldId)); + sql = Utils.replaceInString(sql, fieldDisplay, replaceValue); + }*/ + + } + } + } + + //sql = Utils.replaceInString(sql, " select ", " SELECT "); + //sql = Utils.replaceInString(sql, " where ", " WHERE "); + //sql = Utils.replaceInString(sql, " and ", " AND "); + + } else { + String paramValue = ""; + if(paramValues.isParameterTextAreaValueAndModified(fieldId)) { + String value = ""; + value = nvl(paramValues + .getParamValue(fieldId)); +// value = Utils.oracleSafe(nvl(value)); +// if (!(dbType.equals("DAYTONA") && sql.trim().toUpperCase().startsWith("SELECT"))) { +// value = "('" + Utils.replaceInString(value, ",", "'|'") + "')"; +// value = Utils.replaceInString(value, "|", ","); +// paramValue = XSSFilter.filterRequestOnlyScript(value); +// } else if (nvl(value.trim()).length()>0) { +// value = "('" + Utils.replaceInString(value, ",", "'|'") + "')"; +// value = Utils.replaceInString(value, "|", ","); +// paramValue = XSSFilter.filterRequestOnlyScript(value); +// } + paramValue = value; + } else + paramValue = nvl(paramValues + .getParamValue(fieldId)); + + if (paramValue!=null && paramValue.length() > 0) { + if(paramValue.toLowerCase().trim().startsWith("select ")) { + paramValue = Utils.replaceInString(paramValue, "[LOGGED_USERID]", userId); + paramValue = Utils.replaceInString(paramValue, "[USERID]", userId); + paramValue = Utils.replaceInString(paramValue, "[USER_ID]", userId); + + paramValue = Utils.replaceInString(paramValue, "''", "'"); + ds = ConnectionUtils.getDataSet(paramValue, dbInfo); + if (ds.getRowCount() > 0) paramValue = ds.getString(0, 0); + } + logger.debug(EELFLoggerDelegate.debugLogger, ("SQLSQLBASED B4^^^^^^^^^ " + sql + " " + fft.getValidationType() + " " + fft.getFieldName() + " " + fft.getFieldId())); + if(fft!=null && (fft.getValidationType()!=null && (fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) ||fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC) ||fft.getValidationType().equals(FormField.VT_DATE) ))) { + //System.out.println("paramValues.getParamValue(fieldId_Hr) Inside if " + fft.getValidationType() + " " + fieldDisplay); + if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR)) { + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue) +((nvl(paramValues + .getParamValue(fieldId+"_Hr") ).length()>0)?" "+addZero(nvl(paramValues + .getParamValue(fieldId+"_Hr") ) ):"")); + } + else if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN)) { +/* System.out.println("paramValues.getParamValue(fieldId_Hr)" + paramValues + .getParamValue(fieldId+"_Hr") + " " + paramValues + .getParamValue(fieldId+"_Min")) ; +*/ sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue) + ((nvl(paramValues + .getParamValue(fieldId+"_Hr") ).length()>0)?" "+addZero(nvl(paramValues + .getParamValue(fieldId+"_Hr") ) ):"") + ((nvl(paramValues + .getParamValue(fieldId+"_Min") ).length()>0)?":" + addZero(nvl(paramValues + .getParamValue(fieldId+"_Min") ) ) : "") ) ; + } + else if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) { + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue) + ((nvl(paramValues + .getParamValue(fieldId+"_Hr") ).length()>0)?" "+addZero(nvl(paramValues + .getParamValue(fieldId+"_Hr") ) ):"") + ((nvl(paramValues + .getParamValue(fieldId+"_Min") ).length()>0)?":" + addZero(nvl(paramValues + .getParamValue(fieldId+"_Min") ) ) : "") + ((nvl(paramValues + .getParamValue(fieldId+"_Sec") ).length()>0)?":"+addZero(nvl(paramValues + .getParamValue(fieldId+"_Sec") ) ) : "" ) ) ; + } else { + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + } + + + } else { + if(paramValue!=null && paramValue.length() > 0) { + if(sql.indexOf("'"+fieldDisplay+"'")!=-1 || sql.indexOf("'"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"'")!=-1 + || sql.indexOf("'%"+fieldDisplay+"%'")!=-1 || sql.indexOf("'%"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"%'")!=-1 + || sql.indexOf("'_"+fieldDisplay+"_'")!=-1 || sql.indexOf("'_"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"_'")!=-1 + || sql.indexOf("'%_"+fieldDisplay+"_%'")!=-1 || sql.indexOf("^"+fieldDisplay+"^")!=-1 || sql.indexOf("'%_"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"_%'")!=-1) { + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + } else { + if(sql.indexOf(fieldDisplay)!=-1) { + if(nvl(paramValue).length()>0) { + try { + double vD = Double.parseDouble(paramValue); + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + + } catch (NumberFormatException ex) { + if (/*dbType.equals("DAYTONA") &&*/ sql.trim().toUpperCase().startsWith("SELECT")) { + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + } else + throw new UserDefinedException("Expected number, Given String for the form field \"" + fieldDisplay+"\""); + } + /*sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL"));*/ + } else + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + + } + } + } + else { + if (dbType.equals("DAYTONA") && sql.trim().toUpperCase().startsWith("SELECT")) { + sql = sql + " "; + re1 = Pattern.compile("(^[\r\n]|[\\s]|[^0-9a-zA-Z])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL); + posFormField = sql.indexOf(fieldDisplay); + posAnd = sql.lastIndexOf(" AND ", posFormField); + if(posAnd < 0) posAnd = 0; + else if (posAnd > 2) posAnd = posAnd - 2; + matcher = re1.matcher(sql); + if (matcher.find(posAnd)) { + sql = sql.replace(matcher.group(), ""); + } + } else { + sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl( + paramValue, "NULL")); + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + } + } + } + + } + + if (dbType.equals("DAYTONA") && sql.trim().toUpperCase().startsWith("SELECT")) { + sql = sql + " "; + re1 = Pattern.compile("(^[\r\n]|[\\s]|[^0-9a-zA-Z])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL); //+[\'\\)|\'|\\s] + posFormField = sql.indexOf(fieldDisplay); + posAnd = sql.lastIndexOf(" AND ", posFormField); + if(posAnd < 0) posAnd = 0; + else if (posAnd > 2) posAnd = posAnd - 2; + matcher = re1.matcher(sql); + if (matcher.find(posAnd)) { + sql = sql.replace(matcher.group(), " "); + } + } else { + + logger.debug(EELFLoggerDelegate.debugLogger, ("ParamValue |" + paramValue + "| Sql |" + sql + "| Multi Value |" + paramValues.isParameterMultiValue(fieldId))); + sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl( + paramValue, "NULL")); + sql = Utils.replaceInString(sql, fieldDisplay , nvl( + paramValue, "NULL")); + logger.debug(EELFLoggerDelegate.debugLogger, ("SQLSQLBASED AFTER^^^^^^^^^ " + sql)); + } + + } // else + } // if BLANK + } // for + if(request != null ) { + for (int i = 0; i < reqParameters.length; i++) { + if(!reqParameters[i].startsWith("ff")) { + if (nvl(request.getParameter(reqParameters[i].toUpperCase())).length() > 0) + sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i].toUpperCase()) ); + } + else + sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) ); + } + + for (int i = 0; i < scheduleSessionParameters.length; i++) { + if(nvl(request.getParameter(scheduleSessionParameters[i])).trim().length()>0 ) + sql = Utils.replaceInString(sql, "[" + scheduleSessionParameters[i].toUpperCase()+"]", request.getParameter(scheduleSessionParameters[i]) ); + } + } + if(session != null ) { + for (int i = 0; i < sessionParameters.length; i++) { + //if(!sessionParameters[i].startsWith("ff")) + // paramValue = Utils.replaceInString(paramValue, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i].toUpperCase()) ); + // else { + logger.debug(EELFLoggerDelegate.debugLogger, (" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + (String)session.getAttribute(sessionParameters[i]))); + sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) ); + //} + } + } + } else { + logger.debug(EELFLoggerDelegate.debugLogger, ("BEFORE LOGGED USERID REPLACE " + sql)); + //sql = Utils.replaceInString(sql, "'[logged_userId]'", "'"+userId+"'"); + //debugLogger.debug("Replacing string 2 " + sql); + sql = Utils.replaceInString(sql, "[LOGGED_USERID]", userId); + sql = Utils.replaceInString(sql, "[USERID]", userId); + sql = Utils.replaceInString(sql, "[USER_ID]", userId); + logger.debug(EELFLoggerDelegate.debugLogger, ("AFTER LOGGED USERID REPLACE " + sql)); + // Added for Simon's GM Project where they need to get page_id in their query + logger.debug(EELFLoggerDelegate.debugLogger, ("SQLSQLBASED no formfields " + sql)); + if(request != null ) { + for (int i = 0; i < reqParameters.length; i++) { + sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) ); + } + } + if(session != null ) { + for (int i = 0; i < sessionParameters.length; i++) { + logger.debug(EELFLoggerDelegate.debugLogger, (" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + (String)session.getAttribute(sessionParameters[i]))); + sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) ); + } + } + } + // if it is not multiple select and ParamValue is empty this is the place it can be replaced. + sql = Utils.replaceInString(sql, "[LOGGED_USERID]", userId); + sql = Utils.replaceInString(sql, "[USERID]", userId); + sql = Utils.replaceInString(sql, "[USER_ID]", userId); + logger.debug(EELFLoggerDelegate.debugLogger, ("SQLSQLBASED no formfields after" + sql)); + //debugLogger.debug("Replacing String 2 "+ sql); + //debugLogger.debug("Replaced String " + sql); + + sql = Pattern.compile("([\n][\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" "); + return sql; + + } + public void persistScheduleData(Connection conn, HttpServletRequest request) throws RaptorException { + if (!infoUpdated) + return; + if (reportID.equals("-1")) + return; + + + try { + String sched_id = ""; + StringBuffer query = new StringBuffer(""); + query.append(" SELECT 1 FROM cr_report_schedule WHERE rep_id = " + reportID + " and schedule_id = " + getScheduleID()); + if(!AppUtils.isAdminUser(request)) + query.append(" and sched_user_id = " + getScheduleUserID()); + DataSet ds = DbUtils.executeQuery(conn, query.toString()); + if (ds.getRowCount() > 0) { + StringBuffer sb = new StringBuffer(); + sb.append("UPDATE cr_report_schedule SET enabled_yn = '"); + sb.append(getSchedEnabled()); + sb.append("', start_date = "); + if (getStartDate().length() > 0) { + sb.append("TO_DATE('"); + sb.append(getStartDate()); + sb.append("', 'MM/DD/YYYY')"); + } else + sb.append("NULL"); + sb.append(", end_date = "); + if (getEndDate().length() > 0) { + sb.append("TO_DATE('"); + sb.append(getEndDate()); + sb.append(" "); + sb.append(getEndHour()); + sb.append(":"); + sb.append(getEndMin()); + sb.append(" "); + sb.append(getEndAMPM()); + sb.append("', 'MM/DD/YYYY HH:MI AM')"); + } else + sb.append("NULL"); + sb.append(", run_date = "); + if (getRunDate().length() > 0) { + sb.append("TO_DATE('"); + sb.append(getRunDate()); + sb.append(" "); + sb.append(getRunHour()); + sb.append(":"); + sb.append(getRunMin()); + sb.append(" "); + sb.append(getRunAMPM()); + sb.append("', 'MM/DD/YYYY HH:MI AM')"); + } else + sb.append("NULL"); + sb.append(", recurrence = "); + if (getRecurrence().length() > 0) { + sb.append("'"); + sb.append(getRecurrence()); + sb.append("'"); + } else + sb.append("NULL"); + sb.append(", conditional_yn = '"); + sb.append(getConditional()); + //sb.append("', condition_sql = "); + sb.append("'"); +/* if (getConditionSQL().length() > 0) { + sb.append("'"); + sb.append(parseScheduleSQL(request, Utils.oracleSafe(getConditionSQL()))); + sb.append("'"); + } else + sb.append("NULL"); +*/ + sb.append(", notify_type = "); + sb.append(getNotify_type()); + sb.append(", encrypt_yn = '"); + sb.append(getEncryptMode()+"'"); + sb.append(", attachment_yn = '"); + sb.append(getAttachmentMode()+"'"); + sb.append(", max_row = "); + sb.append(getDownloadLimit()); + sb.append(", initial_formFields = '"); + sb.append(getFormFields()+"'"); + sb.append(", processed_formfields = ''"); + sb.append(" WHERE rep_id = "); + sb.append(reportID + " and sched_user_id = "); + sb.append(getScheduleUserID()); + sb.append(" and schedule_id = "); + sb.append(getScheduleID()); + + DbUtils.executeUpdate(conn, sb.toString()); + } else { + //DataSet dsSeq = DbUtils.executeQuery("select seq_cr_report_schedule.nextval from dual " ); + String w_sql = Globals.getNewScheduleData(); + DataSet dsSeq = DbUtils.executeQuery(w_sql); + String schedule_id = dsSeq.getString(0,0); + setScheduleID(schedule_id); + StringBuffer sb = new StringBuffer(); + sb.append("INSERT INTO cr_report_schedule (schedule_id, sched_user_id, rep_id, enabled_yn, start_date, end_date, run_date, recurrence, conditional_yn, notify_type, max_row, initial_formfields, encrypt_yn, attachment_yn) VALUES("); + sb.append(getScheduleID() + ", "); + sb.append(getScheduleUserID() + ", "); + sb.append(reportID); + sb.append(", '"); + sb.append(getSchedEnabled()); + sb.append("', "); + if (getStartDate().length() > 0) { + sb.append("TO_DATE('"); + sb.append(getStartDate()); + sb.append("', 'MM/DD/YYYY')"); + } else + sb.append("NULL"); + sb.append(", "); + if (getEndDate().length() > 0) { + sb.append("TO_DATE('"); + sb.append(getEndDate()); + sb.append(" "); + sb.append(getEndHour()); + sb.append(":"); + sb.append(getEndMin()); + sb.append(" "); + sb.append(getEndAMPM()); + sb.append("', 'MM/DD/YYYY HH:MI AM')"); + } else + sb.append("NULL"); + sb.append(", "); + if (getRunDate().length() > 0) { + sb.append("TO_DATE('"); + sb.append(getRunDate()); + sb.append(" "); + sb.append(getRunHour()); + sb.append(":"); + sb.append(getRunMin()); + sb.append(" "); + sb.append(getRunAMPM()); + sb.append("', 'MM/DD/YYYY HH:MI AM')"); + } else + sb.append("NULL"); + sb.append(", "); + if (getRecurrence().length() > 0) { + sb.append("'"); + sb.append(getRecurrence()); + sb.append("'"); + } else + sb.append("NULL"); + sb.append(", '"); + sb.append(getConditional()); + sb.append("', "); +/* if (getConditionSQL().length() > 0) { + sb.append("'"); + sb.append(parseScheduleSQL(request, Utils.oracleSafe(getConditionSQL()))); + sb.append("'"); + } else + sb.append("NULL"); + sb.append(", "); +*/ + sb.append(getNotify_type()); + sb.append(", "); + sb.append(getDownloadLimit()); + sb.append(", '"); + sb.append(getFormFields()+"'"); + sb.append(",'"); + sb.append(getEncryptMode()+"'"); + sb.append(",'"); + sb.append(getAttachmentMode()+"'"); + sb.append(")"); + DbUtils.executeUpdate(conn, sb.toString()); + + } // else + + + //DbUtils.executeUpdate(conn, + // "DELETE cr_report_schedule_users WHERE rep_id = " + reportID+ " and schedule_id = " + getScheduleID()); + + String d_sql = Globals.getExecuteUpdate(); + d_sql = d_sql.replace("[reportID]", reportID); + d_sql = d_sql.replace("[getScheduleID()]", getScheduleID()); + + DbUtils.executeUpdate(conn, d_sql); + + for (int i = 0; i < emailToUsers.size(); i++){ + //DbUtils.executeUpdate(conn, + // "INSERT INTO cr_report_schedule_users (schedule_id, rep_id, user_id, role_id, order_no) VALUES(" + // + getScheduleID() + ", " + // + reportID + ", " + // + ((IdNameValue) emailToUsers.get(i)).getId() + ", NULL, " + // + (i + 1) + ")"); + + String sql = Globals.getExecuteUpdateUsers(); + sql = sql.replace("[getScheduleID()]", getScheduleID()); + sql = sql.replace("[reportID]", reportID); + sql = sql.replace("[emailToUsers.get(i)).getId()]", ((IdNameValue) emailToUsers.get(i)).getId()); + sql = sql.replace("[(i + 1)]", String.valueOf(i + 1)); + DbUtils.executeUpdate(conn, sql); + + } + for (int i = 0; i < emailToRoles.size(); i++){ + //DbUtils.executeUpdate(conn, + // "INSERT INTO cr_report_schedule_users (schedule_id, rep_id, user_id, role_id, order_no) VALUES(" + // + getScheduleID() +", " + // + reportID + ", NULL, " + // + ((IdNameValue) emailToRoles.get(i)).getId() + ", " + // + (emailToUsers.size() + i + 1) + ")"); + + String sql = Globals.getExecuteUpdateRoles(); + sql = sql.replace("[getScheduleID()]", getScheduleID()); + sql = sql.replace("[reportID]", reportID); + sql = sql.replace("[emailToRoles.get(i)).getId()]", ((IdNameValue) emailToRoles.get(i)).getId()); + sql = sql.replace("[((emailToUsers.size() + i + 1)]", String.valueOf(emailToUsers.size() + i + 1)); + + DbUtils.executeUpdate(conn, sql); + } + //if (conn == null) + DbUtils.commitTransaction(conn); + + persistConditionSql(conn, getScheduleID(), parseScheduleSQL(request, getConditionSQL())); + + + logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] DB update report " + reportID + " - schedule data updated")); + //DbUtils.executeUpdate(conn, + // "INSERT into cr_schedule_activity_log (schedule_id, notes, run_time) values ("+getScheduleID()+",'Submitted:Schedule',TO_DATE('"+ getRunDate()+" "+ getRunHour()+":"+getRunMin()+" "+getRunAMPM()+"', 'MM/DD/YYYY HH:MI AM'))"); + String e_sql = Globals.getExecuteUpdateActivity(); + e_sql = e_sql.replace("[getScheduleID()]", getScheduleID()); + e_sql = e_sql.replace("[getRunDate()]", getRunDate()); + e_sql = e_sql.replace("[getRunHour()]", getRunHour()); + e_sql = e_sql.replace("[getRunMin()]", getRunMin()); + e_sql = e_sql.replace("[getRunAMPM()]", getRunAMPM()); + + DbUtils.executeUpdate(conn, e_sql); + + infoUpdated = false; + + } catch (RaptorException e) { + if (conn != null) + DbUtils.rollbackTransaction(conn); + throw e; + } // catch + + } // persistScheduleData + + //deleting the schedule - Start + public void deleteScheduleData(Connection conn) throws RaptorException { + if (reportID.equals("-1")) + return; + + Connection connection = (conn != null) ? conn : DbUtils.startTransaction(); + String sched_id = ""; + try { + //DataSet ds = DbUtils.executeQuery(connection, + // "SELECT 1 FROM cr_report_schedule WHERE rep_id = " + reportID +" and sched_user_id = " + getScheduleUserID() + " and schedule_id = " + getScheduleID()); + String a_sql = Globals.getDeleteScheduleData(); + a_sql = a_sql.replace("[reportID]", reportID); + a_sql = a_sql.replace("[getScheduleUserID()]", getScheduleUserID()); + a_sql = a_sql.replace("[getScheduleID()]", getScheduleID()); + DataSet ds = DbUtils.executeQuery(connection, a_sql); + + if (ds.getRowCount() > 0) { + //DbUtils.executeUpdate(connection, + // "DELETE cr_report_schedule_users WHERE rep_id = " + reportID+ " and schedule_id = " + getScheduleID()); + String b_sql = Globals.getDeleteScheduleDataUsers(); + b_sql = b_sql.replace("[reportID]", reportID); + b_sql = b_sql.replace("[getScheduleID()]", getScheduleID()); + + DbUtils.executeUpdate(connection, b_sql); + + StringBuffer sb = new StringBuffer(); + String c_sql = Globals.getDeleteScheduleDataId(); + c_sql = c_sql.replace("[reportID]", reportID); + c_sql = c_sql.replace("[getScheduleUserID()]", getScheduleUserID()); + c_sql = c_sql.replace("[getScheduleID()]", getScheduleID()); + + sb.append(c_sql); + //sb.append("DELETE FROM cr_report_schedule where rep_id = " + reportID +" and sched_user_id = " + getScheduleUserID() + " and schedule_id = " + getScheduleID()); + + DbUtils.executeUpdate(connection, sb.toString()); + } + if (conn == null) + DbUtils.commitTransaction(connection); + + logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] DB update report " + reportID + " - schedule data deleted")); + } catch (RaptorException e) { + if (conn == null) + DbUtils.rollbackTransaction(connection); + throw e; + } // catch + finally { + if (conn == null) + DbUtils.clearConnection(connection); + } + } //deleteScheduleData + + public String getScheduleUserID() { + return scheduleUserID; + } + + public void setScheduleUserID(String scheduleUserID) { + this.scheduleUserID = scheduleUserID; + } + + public String getScheduleID() { + return nvl(scheduleID); + } + + public void setScheduleID(String scheduleID) { + this.scheduleID = scheduleID; + } + + public String getEndAMPM() { + return endAMPM; + } + + public void setEndAMPM(String endAMPM) { + if (nvl(endAMPM).equals(this.endAMPM)) + return; + infoUpdated = true; + this.endAMPM = nvl(endAMPM, "PM"); + } + + public String getEndHour() { + return endHour; + } + + public void setEndHour(String endHour) { + if (nvl(endHour).equals(this.endHour)) + return; + infoUpdated = true; + this.endHour = nvl(endHour, "11"); + } + + public String getEndMin() { + return endMin; + } + + public void setEndMin(String endMin) { + if (nvl(endMin).equals(this.endMin)) + return; + infoUpdated = true; + this.endMin = nvl(endMin, "45"); + } + + public static boolean isNull(String a) { + if ((a == null) || (a.length() == 0) || a.equalsIgnoreCase("null")) + return true; + else + return false; + } + + public String addZero(String num) { + int numInt = 0; + try { + numInt = Integer.parseInt(num); + }catch(NumberFormatException ex){ + numInt = 0; + } + if(numInt < 10) return "0"+numInt; + else return ""+numInt; + } + + public static String loadConditionalSQL(String scheduleId) + throws RaptorException { + StringBuffer sb = new StringBuffer(); + + PreparedStatement stmt = null; + + ResultSet rs = null; + String condition_sql = ""; + Connection connection = null; + + try { + connection = DbUtils.getConnection(); + + //String sql = "SELECT condition_large_sql FROM cr_report_schedule WHERE schedule_id=?"; + String sql = Globals.getLoadCondSql(); + stmt = connection.prepareStatement(sql); + stmt.setString(1,scheduleId); + rs = stmt.executeQuery(); + if(Globals.isWeblogicServer()) { + java.sql.Clob clob= null; + Object obj = null; + if (rs.next()) { + clob = rs.getClob(1); + } + else + throw new RuntimeException("Schedule ID " + scheduleId + " not found in the database"); + + int len = 0; + char[] buffer = new char[512]; + Reader in = null; + in = new InputStreamReader(clob.getAsciiStream()); + // if(obj instanceof oracle.sql.CLOB) { + // in = ((oracle.sql.CLOB) obj).getCharacterStream(); + // } else if (obj instanceof weblogic.jdbc.wrapper.Clob) { + // in = ((weblogic.jdbc.base.BaseClob) obj).getCharacterStream(); + // } + while ((len = in.read(buffer)) != -1) + sb.append(buffer, 0, len); + in.close(); + } else if (Globals.isPostgreSQL() || Globals.isMySQL()) { + String clob= null; + Object obj = null; + if (rs.next()) { + sb.append(rs.getString(1)); + } + else + throw new RaptorException("Schedule ID " + scheduleId + " not found in the database"); + } else { + /*oracle.sql.CLOB clob = null; + if (rs.next()) + clob = (oracle.sql.CLOB) rs.getObject(1); + else + throw new RuntimeException("Schedule ID " + scheduleId + " not found in the database"); + int len = 0; + char[] buffer = new char[512]; + Reader in = null; + if(clob!=null) { + in = clob.getCharacterStream(); + while ((len = in.read(buffer)) != -1) + sb.append(buffer, 0, len); + in.close(); + }*/ + throw new RaptorException("only maria db support for this "); + + } + } catch (SQLException ex) { + try { + StringBuffer query = new StringBuffer(""); + + query.append(" SELECT condition_sql FROM cr_report_schedule WHERE schedule_id = " + scheduleId); + DataSet ds = DbUtils.executeQuery(query.toString()); + if(ds.getRowCount()>0) { + condition_sql = ds.getString(0,0); + } + return condition_sql; + //throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } catch (RaptorException e) { + DbUtils.rollbackTransaction(connection); + throw e; + } // catch + + finally { + DbUtils.clearConnection(connection); + } + + } catch (IOException ex) { + throw new RaptorRuntimeException (ex.getMessage(), ex.getCause()); + } finally { + try { + if (connection != null) + DbUtils.clearConnection(connection); + if(rs!=null) + rs.close(); + if(stmt!=null) + stmt.close(); + } catch (SQLException ex) { + throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } + } + return sb.toString(); + } // loadConditionalSQL + + private static void persistConditionSql(Connection connection, String scheduleId, String conditional_sql) throws RaptorException { + PreparedStatement stmt = null; + ResultSet rs = null; + + try { + //String sql = "update cr_report_schedule set condition_large_sql = EMPTY_CLOB() where schedule_id = " + scheduleId; + String sql = Globals.getPersistCondSqlUpdate(); + sql = sql.replace("[scheduleId]", scheduleId); + + DbUtils.executeUpdate(sql); + //sql = "SELECT condition_large_sql FROM cr_report_schedule cr WHERE schedule_id=? FOR UPDATE"; + sql = Globals.getPersistCondSqlLarge(); + stmt = connection.prepareStatement(sql); + stmt.setString(1,scheduleId); + rs = stmt.executeQuery(); + Writer out = null; + /*if(Globals.isWeblogicServer()) { + java.sql.Clob clob = null; + if (rs.next()) + clob = rs.getClob(1); + else + throw new RuntimeException("Schedule ID " + scheduleId + " not found in the database"); + + if (clob.length() > conditional_sql.length()) + clob.truncate(0); + //clob.trim(reportXML.length()); + out = ((weblogic.jdbc.vendor.oracle.OracleThinClob)clob).getCharacterOutputStream(); + } else*/ + if (Globals.isPostgreSQL() || Globals.isMySQL()) { + if (rs.next()) { + rs.updateString(1,conditional_sql); + rs.updateRow(); + //sb.append(rs.getString(1)); + } + else + throw new RaptorException("Schedule ID " + scheduleId + " not found in the database"); + } else {/* + oracle.sql.CLOB clob = null; + if (rs.next()) + clob = (oracle.sql.CLOB) rs.getObject(1); + else + throw new RuntimeException("Schedule ID " + scheduleId + " not found in the database"); + + if (clob.length() > conditional_sql.length()) + clob.trim(conditional_sql.length()); + out = clob.getCharacterOutputStream();*/ + throw new RaptorException("only maria db support for this "); + + } + out.write(conditional_sql); + out.flush(); + out.close(); + } catch (RaptorException ex) { + if(ex.getMessage().indexOf("invalid identifier")!= -1) { + try { + //String sql = "update cr_report_schedule set condition_sql = ? where schedule_id = " + scheduleId; + String sql = Globals.getPersistCondSqlSet(); + sql = sql.replace("[scheduleId]", scheduleId); + stmt = connection.prepareStatement(sql); + stmt.setString(1,conditional_sql); + stmt.executeUpdate(); + connection.commit(); + } catch (SQLException ex1) { + try { + connection.rollback(); + } catch (SQLException ex2) {} + + } + } else { + try { + connection.rollback(); + } catch (SQLException ex2) { + throw new ReportSQLException (ex2.getMessage(), ex2.getCause()); + } + } + } catch (SQLException ex) { + try { + connection.rollback(); + } catch (SQLException ex2) { + throw new ReportSQLException (ex2.getMessage(), ex2.getCause()); + } + } catch (IOException ex) { + throw new RaptorRuntimeException (ex.getMessage(), ex.getCause()); + } finally { + try { + if(rs!=null) + rs.close(); + if(stmt!=null) + stmt.close(); + } catch (SQLException ex) { + throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } + } + } // persistConditionSql + + /** + * Used to get encryption mode + * @return the encryptMode + */ + public String getEncryptMode() { + return encryptMode; + } + + /** + * Used to set encryption mode + * @param encryptMode the encryptMode to set + */ + public void setEncryptMode(String encryptMode) { + this.encryptMode = encryptMode; + infoUpdated = true; + } + + + /** + * Used to get Attachment mode + * @return the attachment + */ + public String getAttachmentMode() { + return attachment; + } + + public boolean isAttachmentMode() { + return nvl(attachment).toUpperCase().startsWith("Y"); + } + + /** + * Used to set Attachment mode + * @param attachment to set + */ + public void setAttachmentMode(String attachment) { + this.attachment = attachment; + infoUpdated = true; + } +} // ReportSchedule diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/SecurityEntry.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/SecurityEntry.java new file mode 100644 index 0000000..4feddd6 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/SecurityEntry.java @@ -0,0 +1,44 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.definition; + +import org.openecomp.portalsdk.analytics.model.base.IdNameValue; + +public class SecurityEntry extends IdNameValue { + private boolean readOnly = true; + + public SecurityEntry() { + super(); + } + + public SecurityEntry(String id, String name, boolean readOnly) { + super(id, name); + setReadOnly(readOnly); + } // SecurityEntry + + public boolean isReadOnly() { + return readOnly; + } + + public void setReadOnly(boolean readOnly) { + this.readOnly = readOnly; + } + +} // SecurityEntry diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableJoin.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableJoin.java new file mode 100644 index 0000000..6022d5a --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableJoin.java @@ -0,0 +1,67 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.definition; + +import org.openecomp.portalsdk.analytics.RaptorObject; + +public class TableJoin extends RaptorObject { + private String srcTableName = null; + + private String destTableName = null; + + private String joinExpr = null; + + public TableJoin() { + super(); + } + + public TableJoin(String srcTableName, String destTableName, String joinExpr) { + this(); + + setSrcTableName(srcTableName); + setDestTableName(destTableName); + setJoinExpr(joinExpr); + } // TableJoin + + public String getSrcTableName() { + return srcTableName; + } + + public String getDestTableName() { + return destTableName; + } + + public String getJoinExpr() { + return joinExpr; + } + + public void setSrcTableName(String srcTableName) { + this.srcTableName = srcTableName; + } + + public void setDestTableName(String destTableName) { + this.destTableName = destTableName; + } + + public void setJoinExpr(String joinExpr) { + this.joinExpr = joinExpr; + } + +} // TableJoin diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableSource.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableSource.java new file mode 100644 index 0000000..dc5b385 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableSource.java @@ -0,0 +1,101 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.definition; + +import org.openecomp.portalsdk.analytics.RaptorObject; + +public class TableSource extends RaptorObject { + private String tableName = null; + + private String displayName = null; + + private String pkFields = null; + + private String viewAction = null; + + private String isLargeData = null; + + private String filterSql = null; + + public TableSource() { + super(); + } + + public TableSource(String tableName, String displayName, String pkFields, + String viewAction, String isLargeData, String filterSql) { + this(); + + setTableName(tableName); + setDisplayName(displayName); + setPkFields(pkFields); + setViewAction(viewAction); + setIsLargeData(isLargeData); + setFilterSql(filterSql); + } // TableSource + + public String getTableName() { + return tableName; + } + + public String getDisplayName() { + return displayName; + } + + public String getPkFields() { + return pkFields; + } + + public String getViewAction() { + return viewAction; + } + + public String getIsLargeData() { + return isLargeData; + } + + public String getFilterSql() { + return filterSql; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public void setPkFields(String pkFields) { + this.pkFields = pkFields; + } + + public void setViewAction(String viewAction) { + this.viewAction = viewAction; + } + + public void setIsLargeData(String isLargeData) { + this.isLargeData = isLargeData; + } + + public void setFilterSql(String filterSql) { + this.filterSql = filterSql; + } + +} // TableSource diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PageEvent.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PageEvent.java new file mode 100644 index 0000000..34e3806 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PageEvent.java @@ -0,0 +1,256 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.pdf; + +import java.awt.Color; +import java.io.File; +import java.io.IOException; +import java.net.MalformedURLException; + +import org.openecomp.portalsdk.analytics.system.AppUtils; +import org.openecomp.portalsdk.analytics.system.Globals; + +import com.lowagie.text.BadElementException; +import com.lowagie.text.Cell; +import com.lowagie.text.Document; +import com.lowagie.text.ExceptionConverter; +import com.lowagie.text.Font; +import com.lowagie.text.FontFactory; +import com.lowagie.text.Image; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Rectangle; +import com.lowagie.text.pdf.PdfContentByte; +import com.lowagie.text.pdf.PdfDestination; +import com.lowagie.text.pdf.PdfOutline; +import com.lowagie.text.pdf.PdfPCell; +import com.lowagie.text.pdf.PdfPTable; +import com.lowagie.text.pdf.PdfPageEventHelper; +import com.lowagie.text.pdf.PdfWriter; + +class PageEvent extends PdfPageEventHelper { + private PdfBean pb; + private int pageNo = 0; + private int omit_page_count = 0; + private int DEFAULT_LOGO_SIZE = 100; + + public PageEvent(PdfBean pb) { + this.pb = pb; + } + + private int getWidthEntries(int howManyLogos){ + int widthEntries = 0; + + if(howManyLogos == 2) + widthEntries = 3; + else + if(howManyLogos == 1) + widthEntries = 2; + else + widthEntries = 0; + + return widthEntries; + } + + private int getHowManyLogos(){ + int howManyLogos = 0; + + if(AppUtils.isNotEmpty(pb.getLogo1Url()) && !pb.getLogo1Url().equalsIgnoreCase("")) + howManyLogos ++; + + if(AppUtils.isNotEmpty(pb.getLogo2Url()) && !pb.getLogo2Url().equalsIgnoreCase("")) + howManyLogos ++; + + return howManyLogos; + } + + private float[] fillWidthsArray(int howManyLogos){ + float[] widthsArray = new float[howManyLogos + 1]; + + //If one logo, we will need two columns in the header[left log, spacer] + if(howManyLogos == 1){ + widthsArray = new float[2]; + widthsArray[0] = 0.1f; + widthsArray[1] = 0.1f; + } + //If two logs, we will need three columns in the header [left log, spacer, right log] + else + if(howManyLogos == 2){ + widthsArray = new float[3]; + widthsArray[0] = 0.1f; + widthsArray[1] = 0.5f; + widthsArray[2] = 0.1f; + } + + return widthsArray; + } + public void onStartPage(PdfWriter writer, Document document) { + + Font font = FontFactory.getFont(Globals.getFooterFontFamily(), Globals.getFooterFontSize(), Font.NORMAL, Color.BLACK); + int howManyLogos = getHowManyLogos(); + + //No need to draw anything in the header if no logo was set in the report. + if(howManyLogos == 0) + return; + + float[] widths = fillWidthsArray(howManyLogos); + + PdfPTable foot = new PdfPTable(widths); + + if(AppUtils.isNotEmpty(pb.getLogo1Url()) && !pb.getLogo1Url().equalsIgnoreCase("")) + addLogo(foot, font, pb.getLogo1Url().substring(pb.getLogo1Url().indexOf("|") + 1).trim(), Cell.ALIGN_LEFT, pb.getLogo1Size() == null ? DEFAULT_LOGO_SIZE : pb.getLogo1Size()); + + PdfPCell spacingCell = new PdfPCell(); + spacingCell.setBorderColor(Color.WHITE); + foot.addCell(spacingCell); + + //Using logo1 size for now - use logo2 size if it is required to deal it separately. + if(AppUtils.isNotEmpty(pb.getLogo2Url()) && !pb.getLogo2Url().equalsIgnoreCase("")) + addLogo(foot, font, pb.getLogo2Url().substring(pb.getLogo2Url().indexOf("|") + 1).trim(), Cell.ALIGN_RIGHT, pb.getLogo2Size() == null ? DEFAULT_LOGO_SIZE : pb.getLogo2Size()); + + foot.setTotalWidth(getPageWidth(document)); + foot.writeSelectedRows(0, -1, 36, 600, writer.getDirectContent()); + } + + public void onEndPage(PdfWriter writer, Document document) { + + Font font = FontFactory.getFont(Globals.getFooterFontFamily(), Globals.getFooterFontSize(), Font.NORMAL, Color.BLACK); + + try { + + // footer + float[] f = { 1f, 0.4f, 1f }; + PdfPTable foot = new PdfPTable(f); + foot.getDefaultCell().setBorderWidth(0); + foot.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER); + foot.getDefaultCell().setVerticalAlignment(Rectangle.ALIGN_BOTTOM); + + foot.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_LEFT); + addLeftFooter(foot, font); + + foot.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER); + addPageNumber(foot, font, pb.isPageNumberAtFooter(), document.getPageNumber()); + + foot.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_RIGHT); + foot.getDefaultCell().setNoWrap(true); + + foot.addCell(new Paragraph(" " + PdfReportHandler.currentTime(pb.getTimestampPattern()), font)); + + foot.setTotalWidth(getPageWidth(document)); + foot.writeSelectedRows(0, -1, document.leftMargin(), document.bottomMargin(), writer.getDirectContent()); + + // bookmark + pageNo++; + PdfContentByte cb = writer.getDirectContent(); + PdfDestination destination = new PdfDestination(PdfDestination.FITH); + String bookmark = "Data Page " + (pageNo - omit_page_count); + if (pageNo == 1) { + if (pb.isCoverPageIncluded()) { + bookmark = "Cover Page"; + omit_page_count++; + } else if (pb.isDisplayChart()) { + bookmark = "Chart"; + omit_page_count++; + } + } + if (pageNo == 2 && pb.isCoverPageIncluded() && pb.isDisplayChart()) { + bookmark = "Chart"; + omit_page_count++; + } + + PdfOutline outline = new PdfOutline(cb.getRootOutline(), destination, bookmark); + + } catch (Exception e) { + throw new ExceptionConverter(e); + } + } + + private void addPageNumber(PdfPTable table, Font font, boolean isAdd, int pageNum) { + if (isAdd) + table.addCell(new Paragraph(Globals.getWordBeforePageNumber() + " " + pageNum + " " + Globals.getWordAfterPageNumber(), font)); + else + table.addCell(""); + } + + private void addLeftFooter(PdfPTable table, Font font) { + Font font1 = new Font(font); + font1.setSize(Globals.getAttProprieraryFontSize()); + + if (isEmpty(pb.getLeftFooter())) + table.addCell(new Paragraph(" " + Globals.getAttProprietary(), font1)); + else + table.addCell(new Paragraph(pb.getLeftFooter(), font)); + } + + private void addHeaderDummy(PdfPTable table, Font font) { + Font font1 = new Font(font); + font1.setSize(Globals.getAttProprieraryFontSize()); + + table.addCell(new Paragraph("Header row", font1)); + } + + private void addLogo(PdfPTable table, Font font, String imgSrc, int alignment, int absoluteSize) { + + Image img = null; + try { + img = Image.getInstance(pb.getFullWebContextPath() + AppUtils.getImgFolderURL() + File.separator + imgSrc); + } catch (BadElementException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + img = null; + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + img = null; + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + + } + if(img == null){ + //log that the input file couldnt be loaded - + } + else{ + //img.scaleAbsolute(absoluteSize, absoluteSize); + img.scalePercent(absoluteSize, absoluteSize); + PdfPCell cell = new PdfPCell(img); + cell.setBorderColor(Color.WHITE); + cell.setHorizontalAlignment(alignment); + table.addCell(cell); + } + + } + + public static float getPageWidth(Document doc) { + return doc.getPageSize().width() - doc.leftMargin() - doc.rightMargin(); + } + + public static float getPageHeight(Document doc) { + return doc.getPageSize().height() - doc.topMargin() - doc.bottomMargin(); + } + + private float getHeadTopMargin(Document doc, PdfPTable table) { + return doc.getPageSize().height() - doc.topMargin() + table.getTotalHeight(); + } + + private boolean isEmpty(String str) { + return str == null || str.trim().length() == 0; + } + +} // PageEvent diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PdfBean.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PdfBean.java new file mode 100644 index 0000000..31b2643 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PdfBean.java @@ -0,0 +1,242 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.pdf; + + +public class PdfBean { + + public static final int NUMBER_IN_HEADER = 0; + public static final int NUMBER_IN_FOOTER = 1; + public static final int NUMBER_IN_BOTH = 2; + + private boolean alternateColor; + private boolean isPortrait; + private boolean isCoverPageIncluded; + private boolean isDisplayChart; + private int currentPage; + private int whereToShowPageNumber; + private String userId; + private String timestampPattern; + private String title; + private String leftFooter; + private String pagesize; + private boolean isAttachmentOfEmail; + private String logo1Url; + private Integer logo1Size; + private String logo2Url; + private Integer logo2Size; + private String fullWebContextPath; + + /** + * @return the leftFooter + */ + public String getLeftFooter() { + return leftFooter; + } + /** + * @param leftFooter the leftFooter to set + */ + public void setLeftFooter(String leftFooter) { + this.leftFooter = leftFooter; + } + /** + * @return the title + */ + public String getTitle() { + return title; + } + /** + * @param title the title to set + */ + public void setTitle(String title) { + this.title = title; + } + /** + * @return the alternateColor + */ + public boolean isAlternateColor() { + return alternateColor; + } + /** + * @param alternateColor the alternateColor to set + */ + public void setAlternateColor(boolean alternateColor) { + this.alternateColor = alternateColor; + } + /** + * @return the currentPage + */ + public int getCurrentPage() { + return currentPage; + } + /** + * @param currentPage the currentPage to set + */ + public void setCurrentPage(int currentPage) { + this.currentPage = currentPage; + } + /** + * @return the isPortrait + */ + public boolean isPortrait() { + return isPortrait; + } + /** + * @param isPortrait the isPortrait to set + */ + public void setPortrait(boolean isPortrait) { + this.isPortrait = isPortrait; + } + /** + * @return the timestampPattern + */ + public String getTimestampPattern() { + return timestampPattern; + } + /** + * @param timestampPattern the timestampPattern to set + */ + public void setTimestampPattern(String timestampPattern) { + this.timestampPattern = timestampPattern; + } + /** + * @return the userId + */ + public String getUserId() { + return userId; + } + /** + * @param userId the userId to set + */ + public void setUserId(String userId) { + this.userId = userId; + } + /** + * @return the whereToShowPageNummber + */ + public int getWhereToShowPageNumber() { + return whereToShowPageNumber; + } + /** + * @param whereToShowPageNumber the whereToShowPageNumber to set + */ + public void setWhereToShowPageNumber(int whereToShowPageNumber) { + this.whereToShowPageNumber = whereToShowPageNumber; + } + + public boolean isPageNumberAtHeader() { + return getWhereToShowPageNumber()==NUMBER_IN_BOTH || + getWhereToShowPageNumber()==NUMBER_IN_HEADER; + } + + public boolean isPageNumberAtFooter() { + return getWhereToShowPageNumber()==NUMBER_IN_FOOTER || + getWhereToShowPageNumber()==NUMBER_IN_BOTH; + } + + /** + * @return the isCoverPageIncluded + */ + public boolean isCoverPageIncluded() { + return isCoverPageIncluded; + } + /** + * @param isCoverPageIncluded the isCoverPageIncluded to set + */ + public void setCoverPageIncluded(boolean isCoverPageIncluded) { + this.isCoverPageIncluded = isCoverPageIncluded; + } + + public String toString() { + return getTitle()+ " " + + getCurrentPage() + " " + + getTimestampPattern() + " " + + getUserId()+ " " + + getWhereToShowPageNumber()+ " " + + isPortrait() + " " + isAlternateColor(); + } + /** + * @return the isDisplayChart + */ + public boolean isDisplayChart() { + return isDisplayChart; + } + /** + * @param isDisplayChart the isDisplayChart to set + */ + public void setDisplayChart(boolean isDisplayChart) { + this.isDisplayChart = isDisplayChart; + } + /** + * @return the pagesize + */ + public String getPagesize() { + return pagesize; + } + /** + * @param pagesize the pagesize to set + */ + public void setPagesize(String pagesize) { + this.pagesize = pagesize; + } + + public String getLogo1Url() { + return logo1Url; + } + public void setLogo1Url(String logo1Url) { + this.logo1Url = logo1Url; + } + + public String getLogo2Url() { + return logo2Url; + } + public void setLogo2Url(String logo2Url) { + this.logo2Url = logo2Url; + } + + public void setAttachmentOfEmail(boolean isAttachmentOfEmail) { + this.isAttachmentOfEmail = isAttachmentOfEmail; + } + + public boolean isAttachmentOfEmail() { + + return isAttachmentOfEmail; + } + public Integer getLogo1Size() { + return logo1Size; + } + public void setLogo1Size(Integer logo1Size) { + this.logo1Size = logo1Size; + } + public Integer getLogo2Size() { + return logo2Size; + } + public void setLogo2Size(Integer logo2Size) { + this.logo2Size = logo2Size; + } + public String getFullWebContextPath() { + return fullWebContextPath; + } + public void setFullWebContextPath(String fullWebContextPath) { + this.fullWebContextPath = fullWebContextPath; + } + + +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PdfReportHandler.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PdfReportHandler.java new file mode 100644 index 0000000..deac806 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/pdf/PdfReportHandler.java @@ -0,0 +1,1890 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +/* =========================================================================================== + + * This class is part of RAPTOR (Rapid Application Programming Tool for OLAP Reporting) + * Raptor : This tool is used to generate different kinds of reports with lot of utilities + * =========================================================================================== + * + * ------------------------------------------------------------------------------------------- + * PdfReportHandler.java - This class is used to generate reports in PDF using iText + * ------------------------------------------------------------------------------------------- + * + * + * Changes + * ------- + * 14-Jul-2009 : Version 8.4 (Sundar);
      + *
    • Dashboard reports can be downloaded with each report occupying separate page including its charts.
    • + *
    + * + */ +package org.openecomp.portalsdk.analytics.model.pdf; + +import java.awt.Color; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.OutputStream; +import java.io.StringReader; +import java.net.MalformedURLException; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.TimeZone; +import java.util.TreeMap; +import java.util.Vector; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.error.ReportSQLException; +import org.openecomp.portalsdk.analytics.model.ReportHandler; +import org.openecomp.portalsdk.analytics.model.ReportLoader; +import org.openecomp.portalsdk.analytics.model.base.IdNameValue; +import org.openecomp.portalsdk.analytics.model.definition.ReportDefinition; +import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime; +import org.openecomp.portalsdk.analytics.system.AppUtils; +import org.openecomp.portalsdk.analytics.system.ConnectionUtils; +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.AppConstants; +import org.openecomp.portalsdk.analytics.util.DataSet; +import org.openecomp.portalsdk.analytics.util.HtmlStripper; +import org.openecomp.portalsdk.analytics.util.Utils; +import org.openecomp.portalsdk.analytics.view.ColumnHeader; +import org.openecomp.portalsdk.analytics.view.ColumnHeaderRow; +import org.openecomp.portalsdk.analytics.view.DataRow; +import org.openecomp.portalsdk.analytics.view.DataValue; +import org.openecomp.portalsdk.analytics.view.HtmlFormatter; +import org.openecomp.portalsdk.analytics.view.ReportData; +import org.openecomp.portalsdk.analytics.view.RowHeader; +import org.openecomp.portalsdk.analytics.view.RowHeaderCol; +import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; + +import com.lowagie.text.BadElementException; +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.DocumentException; +import com.lowagie.text.Element; +import com.lowagie.text.ElementTags; +import com.lowagie.text.Font; +import com.lowagie.text.FontFactory; +import com.lowagie.text.Image; +import com.lowagie.text.PageSize; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Phrase; +import com.lowagie.text.Rectangle; +import com.lowagie.text.html.simpleparser.HTMLWorker; +import com.lowagie.text.html.simpleparser.StyleSheet; +import com.lowagie.text.pdf.PdfPCell; +import com.lowagie.text.pdf.PdfPTable; +import com.lowagie.text.pdf.PdfWriter; + + +public class PdfReportHandler extends org.openecomp.portalsdk.analytics.RaptorObject{ + + /** + * + */ + private PdfBean pb; + private HtmlStripper strip = new HtmlStripper(); + private static final int RetryCreateNewImage = 3; + private int retryCreateNewImageCount=0; + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PdfReportHandler.class); + + private String FONT_FAMILY = "Arial"; + private int FONT_SIZE = 9; + + public PdfReportHandler() { } + + public void createPdfFileContent(HttpServletRequest request, HttpServletResponse response, int type) throws IOException, RaptorException { + + Document document = new Document(); + ReportHandler rh = new ReportHandler(); + String formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date()); + String pdfFName = ""; + String user_id = AppUtils.getUserID(request); + response.reset(); + response.setContentType("application/pdf"); + OutputStream outStream = response.getOutputStream(); + + String formattedReportName = ""; + PdfWriter writer = null; + ReportRuntime firstReportRuntimeObj = null; + int returnValue = 0; + + ReportRuntime rr = null; + if(rr==null) rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); + + boolean isDashboard = false; + if ((request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null) && ( ((String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)).equals(rr.getReportID())) ) { + isDashboard = true; + } + if(isDashboard) { + try { + String reportID = (String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID); + ReportRuntime rrDash = rh.loadReportRuntime(request, reportID, true, 1); + pb = preparePdfBean(request,rrDash); + + // Setting pb Values + document.setPageSize(PageSize.getRectangle(pb.getPagesize())); + if(!pb.isPortrait()) // get this from properties file + document.setPageSize(document.getPageSize().rotate()); + + // + writer = PdfWriter.getInstance(document, response.getOutputStream()); + writer.setPageEvent(new PageEvent(pb));//header,footer,bookmark + document.open(); + + formattedReportName = new HtmlStripper().stripSpecialCharacters(rrDash.getReportName()); + if(pb.isAttachmentOfEmail()) + response.setHeader("Content-disposition", "inline"); + else + response.setHeader("Content-disposition", "attachment;filename="+ formattedReportName+formattedDate+user_id+".pdf"); + + pdfFName = "dashboard"+formattedReportName+formattedDate+user_id+".pdf"; + Map reportRuntimeMap = null; + Map reportDataMap = null; + Map reportDisplayTypeMap = null; + + reportRuntimeMap = (TreeMap) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP); + reportDataMap = (TreeMap) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP); + reportDisplayTypeMap = (TreeMap) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP); + + if(reportRuntimeMap!=null) { + //ServletOutputStream sos = response.getOutputStream(); + Set setReportRuntime = reportRuntimeMap.entrySet(); + Set setReportDataMap = reportDataMap.entrySet(); + Set setReportDisplayTypeMap = reportDisplayTypeMap.entrySet(); + + Iterator iter2 = setReportDataMap.iterator(); + Iterator iter3 = setReportDisplayTypeMap.iterator(); + int count = 0; + for(Iterator iter = setReportRuntime.iterator(); iter.hasNext(); ) { + count++; + Map.Entry entryData = (Entry) iter2.next(); + Map.Entry entry = (Entry) iter.next(); + Map.Entry entryCheckChart = (Entry) iter3.next(); + //String rep_id = (String) entry.getKey(); + ReportRuntime rrDashRep = (ReportRuntime) entry.getValue(); + + if(count == 1) { + firstReportRuntimeObj = (ReportRuntime) entry.getValue(); + if(pb.isCoverPageIncluded()) { + document = paintDashboardCoverPage(document, rrDash, firstReportRuntimeObj, request); + } + } + ReportData rdDashRep = (ReportData) entryData.getValue(); + int col = 0; + //pb.setDisplayChart(nvl(rr.getChartType()).trim().length()>0 && rr.getDisplayChart()); + if( ((rrDashRep.getChartType()).trim().length()>0 && rrDashRep.getDisplayChart()) && entryCheckChart.getValue().toString().equals("c")) { + document.newPage(); + pb.setTitle(nvl(rrDashRep.getReportTitle()).length()>0?rrDashRep.getReportTitle():rrDashRep.getReportName()); + paintPdfImage(request, document,AppUtils.getTempFolderPath()+"cr_"+ pb.getUserId()+"_"+request.getSession().getId()+"_"+rrDashRep.getReportID()+".png", rrDashRep); + } else { + document.newPage(); + pb.setTitle(nvl(rrDashRep.getReportTitle()).length()>0?rrDashRep.getReportTitle():rrDashRep.getReportName()); + paintPdfData(request, document,rdDashRep,rrDashRep, ""); + } + } + + } + } catch (DocumentException dex) {dex.printStackTrace();} + catch (RaptorException rex) {rex.printStackTrace();} + } else { + + //ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); + //ReportData rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA); + rr = null; + ReportData rd = null; + String parent = ""; + int parentFlag = 0; + if(!nvl(request.getParameter("parent"), "").equals("N")) parent = nvl(request.getParameter("parent"), ""); + if(parent.startsWith("parent_")) parentFlag = 1; + if(parentFlag == 1) { + rr = (ReportRuntime) request.getSession().getAttribute(parent+"_rr"); + rd = (ReportData) request.getSession().getAttribute(parent+"_rd"); + } + if(rr==null) rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); + if(rd==null) rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA); + + pb = preparePdfBean(request,rr); + FONT_FAMILY = rr.getPDFFont(); + FONT_SIZE = rr.getPDFFontSize(); + //System.out.println(pb); + + formattedReportName = new HtmlStripper().stripSpecialCharacters(rr.getReportName()); + + + + response.setContentType("application/pdf"); + if(pb.isAttachmentOfEmail()) + response.setHeader("Content-disposition", "inline"); + else + response.setHeader("Content-disposition", "attachment;filename="+ formattedReportName+formattedDate+user_id+".pdf"); + + document.setPageSize(PageSize.getRectangle(pb.getPagesize())); + + if(!pb.isPortrait()) // get this from properties file + document.setPageSize(document.getPageSize().rotate()); + + try { + + writer = PdfWriter.getInstance(document, outStream); + writer.setPageEvent(new PageEvent(pb));//header,footer,bookmark + document.open(); + + //System.out.println("Document 1 " + document); + if(pb.isCoverPageIncluded()) { + document = paintCoverPage(document, rr, request); + } + + //boolean isImageRotate = false; + //System.out.println("Document 2 " + document); + + if(pb.isDisplayChart()) { + paintPdfImage(request, document,AppUtils.getTempFolderPath()+"cr_"+ pb.getUserId()+"_"+request.getSession().getId()+"_"+rr.getReportID()+".png", rr); + } + //System.out.println("Document 4" + document); + + document.newPage(); + if(type == 3 && rr.getSemaphoreList()==null && !(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) ) { //type = 3 is whole + String sql_whole = (String) request.getAttribute(AppConstants.RI_REPORT_SQL_WHOLE); + returnValue = paintPdfData(request, document, rd, rr, sql_whole); + } else if(type == 2) { + returnValue = paintPdfData(request, document, rd, rr, ""); + } else { + //String sql_whole = (String) request.getAttribute(AppConstants.RI_REPORT_SQL_WHOLE); + int downloadLimit = (rr.getMaxRowsInExcelDownload()>0)?rr.getMaxRowsInExcelDownload():Globals.getDownloadLimit(); + String action = request.getParameter(AppConstants.RI_ACTION); + + if(!(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) && !action.endsWith("session")) + rd = rr.loadReportData(-1, AppUtils.getUserID(request), downloadLimit,request, false /*download*/); + if(rr.getSemaphoreList()!=null) { + rd = rr.loadReportData(-1, AppUtils.getUserID(request), downloadLimit,request, true); + returnValue = paintPdfData(request, document, rd, rr, ""); + } else { + returnValue = paintPdfData(request, document, rd, rr, rr.getWholeSQL()); + } + + + } + + + //paintPdfData(document,rd,rr); + + + } catch (DocumentException de) { + de.printStackTrace(); + //System.err.println("document: " + de.getMessage()); + } + + } + document.close(); + int mb = 1024*1024; + Runtime runtime = Runtime.getRuntime(); + logger.debug(EELFLoggerDelegate.debugLogger, ("##### Heap utilization statistics [MB] #####")); + logger.debug(EELFLoggerDelegate.debugLogger, ("Used Memory:" + + (runtime.maxMemory() - runtime.freeMemory()) / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("Free Memory:" + + runtime.freeMemory() / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("Total Memory:" + runtime.totalMemory() / mb)); + logger.debug(EELFLoggerDelegate.debugLogger, ("Max Memory:" + runtime.maxMemory() / mb)); + + } + + private Document paintCoverPage(Document doc, ReportRuntime rr, HttpServletRequest request) throws IOException, DocumentException { + + //System.out.println("PDFREPORTHANDLER STARTED ... " ); + if(nvl(rr.getPdfImg()).length()>0) { + Image image1 = Image.getInstance(AppUtils.getExcelTemplatePath()+"../../"+AppUtils.getImgFolderURL()+rr.getPdfImg()); + image1.scalePercent(20f, 20f); + doc.add(image1); + } + float firstColumnSize = Globals.getCoverPageFirstColumnSize(); + float[] relativeWidths = {firstColumnSize,1f-firstColumnSize}; + PdfPTable table = new PdfPTable(relativeWidths); + table.getDefaultCell().setBorderWidth(0); + addEmptyRows(table,6); + HTMLWorker worker = new HTMLWorker(doc); + StyleSheet style = new StyleSheet(); + style.loadTagStyle("body", "leading", "16,0"); + StringBuffer reportDescrBuf = new StringBuffer(""); + ArrayList descr = HTMLWorker.parseToList(new StringReader(nvl(rr.getReportDescr())), style); + ArrayList paraList = null; + if(nvl(rr.getReportTitle()).length()>0) { + add2Cells(table,"Report Title : ",nvl(rr.getReportTitle())); + } else { + add2Cells(table,"Report Name : ",nvl(rr.getReportName())); + } + if((descr!=null && descr.size()>0)) { + paraList = (com.lowagie.text.Paragraph)descr.get(0); + for (int i=0 ; i0) { + String nameValue[] = Globals.getSessionInfoForTheCoverPage().split(","); + String name=nameValue[0]; + String value=nameValue[1]; + add2Cells(table,name+" : ",(AppUtils.getRequestNvlValue(request, value).length()>0?AppUtils.getRequestNvlValue(request, value):nvl((String)request.getSession().getAttribute(value)))); + } + + if(Globals.isCreatedOwnerInfoNeeded()) { + add2Cells(table,"Created By : ",nvl(AppUtils.getUserName(rr.getCreateID()))); + add2Cells(table,"Owner : ",nvl(AppUtils.getUserName(rr.getOwnerID()))); + } + if(Globals.displayLoginIdForDownloadedBy()) + add2Cells(table,"Downloaded by : ",nvl(AppUtils.getUserBackdoorLoginId(request))); + else + add2Cells(table,"Downloaded by : ",nvl(AppUtils.getUserName(AppUtils.getUserID(request)))); + + addEmptyRows(table,1); + + boolean isFirstRow = true; + ArrayList al = rr.getParamNameValuePairsforPDFExcel(request, 1); + if(al.size()<=0) { + al = (ArrayList) request.getSession().getAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO); + } + + Iterator it = al.iterator(); + addEmptyRows(table,1); + //if(!Globals.customizeFormFieldInfo()) { + if(rr.getFormFieldComments(request).length()<=0) { + while(it.hasNext()) { + + if(isFirstRow) { + add2Cells(table, "Run-time Criteria : ", " "); + isFirstRow = false; + } + + IdNameValue value = (IdNameValue)it.next(); + if(!value.getId().trim().equals("BLANK")) + //System.out.println("PDFREPORTHANDLER " + value.getId()+" : "+value.getName()); + add2Cells(table, value.getId()+" : ",value.getName().replaceAll("~",",")); + //add2Cells(table, rr.getFormFieldComments(request), " "); + } + addEmptyRows(table,1); + doc.add(table); + + } else { + it = al.iterator(); + if(it.hasNext()) { + //add2Cells(table, "Run-time Criteria : ", " "); + addEmptyRows(table,1); + doc.add(table); + //com.lowagie.text.html.HtmlParser.parse(doc, new StringReader(rr.getFormFieldComments(request))); + ArrayList p = HTMLWorker.parseToList(new StringReader(rr.getFormFieldComments(request).replaceAll("~",",")), style); + + for (int k = 0; k < p.size(); ++k){ + doc.add((com.lowagie.text.Element)p.get(k)); + } + } + } + + return doc; + } + + + private Document paintDashboardCoverPage(Document doc, ReportRuntime rrDashRep, ReportRuntime firstReportRuntimeObj, HttpServletRequest request) throws IOException, DocumentException { + + //System.out.println("PDFREPORTHANDLER STARTED ... " ); + float firstColumnSize = Globals.getCoverPageFirstColumnSize(); + float[] relativeWidths = {firstColumnSize,1f-firstColumnSize}; + PdfPTable table = new PdfPTable(relativeWidths); + table.getDefaultCell().setBorderWidth(0); + addEmptyRows(table,6); + + add2Cells(table,"Report Name : ",rrDashRep.getReportName()); + add2Cells(table,"Description : ",rrDashRep.getReportDescr()); + if(Globals.getSessionInfoForTheCoverPage().length()>0) { + String nameValue[] = Globals.getSessionInfoForTheCoverPage().split(","); + String name=nameValue[0]; + String value=nameValue[1]; + add2Cells(table,name+" : ",(AppUtils.getRequestNvlValue(request, value).length()>0?AppUtils.getRequestNvlValue(request, value):nvl((String)request.getSession().getAttribute(value)))); + } + + if(Globals.isCreatedOwnerInfoNeeded()) { + add2Cells(table,"Created By : ",AppUtils.getUserName(rrDashRep.getCreateID())); + add2Cells(table,"Owner : ",AppUtils.getUserName(rrDashRep.getOwnerID())); + } + if(Globals.displayLoginIdForDownloadedBy()) + add2Cells(table,"Downloaded by : ",AppUtils.getUserBackdoorLoginId(request)); + else + add2Cells(table,"Downloaded by : ",AppUtils.getUserName(request)); + + addEmptyRows(table,1); + + boolean isFirstRow = true; + ArrayList al = firstReportRuntimeObj.getParamNameValuePairsforPDFExcel(request, 2); + Iterator it = al.iterator(); + addEmptyRows(table,1); + //if(!Globals.customizeFormFieldInfo()) { + if(firstReportRuntimeObj.getFormFieldComments(request).length()<=0) { + while(it.hasNext()) { + + if(isFirstRow) { + add2Cells(table, "Run-time Criteria : ", " "); + isFirstRow = false; + } + + IdNameValue value = (IdNameValue)it.next(); + if(!value.getId().trim().equals("BLANK")) + //System.out.println("PDFREPORTHANDLER " + value.getId()+" : "+value.getName()); + add2Cells(table, value.getId()+" : ",value.getName()); + //add2Cells(table, rr.getFormFieldComments(request), " "); + } + addEmptyRows(table,1); + doc.add(table); + + } else { + it = al.iterator(); + if(it.hasNext()) { + //add2Cells(table, "Run-time Criteria : ", " "); + addEmptyRows(table,1); + doc.add(table); + //com.lowagie.text.html.HtmlParser.parse(doc, new StringReader(rr.getFormFieldComments(request))); + HTMLWorker worker = new HTMLWorker(doc); + StyleSheet style = new StyleSheet(); + style.loadTagStyle("body", "leading", "16,0"); + ArrayList p = HTMLWorker.parseToList(new StringReader(firstReportRuntimeObj.getFormFieldComments(request)), style); + + for (int k = 0; k < p.size(); ++k){ + doc.add((com.lowagie.text.Element)p.get(k)); + } + } + } + + return doc; + } + + + public static void addEmptyRows(PdfPTable table, int rows) throws DocumentException { + for (int i=0; i0?AppUtils.getRequestNvlValue(request, "multiplePieOrder").equals("row"):rr.isMultiplePieOrderByRow())) ); + additionalChartOptionsMap.put("multiplePieLabelDisplay", AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplay").length()>0? AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplay"):rr.getMultiplePieLabelDisplay()); + additionalChartOptionsMap.put("chartDisplay", new Boolean(AppUtils.getRequestNvlValue(request, "chartDisplay").length()>0? AppUtils.getRequestNvlValue(request, "chartDisplay").equals("3D"):rr.isChartDisplayIn3D())); + } else if (chartType.equals(AppConstants.GT_BAR_3D)) { + additionalChartOptionsMap.put("chartOrientation", new Boolean((AppUtils.getRequestNvlValue(request, "chartOrientation").length()>0?AppUtils.getRequestNvlValue(request, "chartOrientation").equals("vertical"):rr.isVerticalOrientation())) ); + additionalChartOptionsMap.put("secondaryChartRenderer", AppUtils.getRequestNvlValue(request, "secondaryChartRenderer").length()>0? AppUtils.getRequestNvlValue(request, "secondaryChartRenderer"):rr.getSecondaryChartRenderer()); + additionalChartOptionsMap.put("chartDisplay", new Boolean(AppUtils.getRequestNvlValue(request, "chartDisplay").length()>0? AppUtils.getRequestNvlValue(request, "chartDisplay").equals("3D"):rr.isChartDisplayIn3D())); + additionalChartOptionsMap.put("lastSeriesALineChart", new Boolean(rr.isLastSeriesALineChart())); + } else if (chartType.equals(AppConstants.GT_LINE)) { + additionalChartOptionsMap.put("chartOrientation", new Boolean((AppUtils.getRequestNvlValue(request, "chartOrientation").length()>0?AppUtils.getRequestNvlValue(request, "chartOrientation").equals("vertical"):rr.isVerticalOrientation())) ); + //additionalChartOptionsMap.put("secondaryChartRenderer", AppUtils.getRequestNvlValue(request, "secondaryChartRenderer").length()>0? AppUtils.getRequestNvlValue(request, "secondaryChartRenderer"):rr.getSecondaryChartRenderer()); + additionalChartOptionsMap.put("chartDisplay", new Boolean(AppUtils.getRequestNvlValue(request, "chartDisplay").length()>0? AppUtils.getRequestNvlValue(request, "chartDisplay").equals("3D"):rr.isChartDisplayIn3D())); + additionalChartOptionsMap.put("lastSeriesABarChart", new Boolean(rr.isLastSeriesABarChart())); + } else if (chartType.equals(AppConstants.GT_TIME_DIFFERENCE_CHART)) { + additionalChartOptionsMap.put("intervalFromDate",AppUtils.getRequestNvlValue(request, "intervalFromDate").length()>0?AppUtils.getRequestNvlValue(request, "intervalFromDate"):rr.getIntervalFromdate()); + additionalChartOptionsMap.put("intervalToDate", AppUtils.getRequestNvlValue(request, "intervalToDate").length()>0? AppUtils.getRequestNvlValue(request, "intervalToDate"):rr.getIntervalTodate()); + additionalChartOptionsMap.put("intervalLabel", AppUtils.getRequestNvlValue(request, "intervalLabel").length()>0? AppUtils.getRequestNvlValue(request, "intervalLabel"):rr.getIntervalLabel()); + } else if (chartType.equals(AppConstants.GT_REGRESSION)) { + additionalChartOptionsMap.put("regressionType",AppUtils.getRequestNvlValue(request, "regressionType").length()>0?AppUtils.getRequestNvlValue(request, "regressionType"):rr.getLinearRegression()); + additionalChartOptionsMap.put("linearRegressionColor",nvl(rr.getLinearRegressionColor())); + additionalChartOptionsMap.put("expRegressionColor",nvl(rr.getExponentialRegressionColor())); + additionalChartOptionsMap.put("maxRegression",nvl(rr.getCustomizedRegressionPoint())); + } else if (chartType.equals(AppConstants.GT_STACK_BAR) ||chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR) || chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR_LINES) + || chartType.equals(AppConstants.GT_STACKED_VERT_BAR) || chartType.equals(AppConstants.GT_STACKED_VERT_BAR_LINES) + ) { + additionalChartOptionsMap.put("overlayItemValue",new Boolean(nvl(rr.getOverlayItemValueOnStackBar()).equals("Y"))); + } + additionalChartOptionsMap.put("legendPosition", nvl(rr.getLegendPosition())); + additionalChartOptionsMap.put("hideToolTips", new Boolean(rr.hideChartToolTips())); + additionalChartOptionsMap.put("hideLegend", new Boolean(AppUtils.getRequestNvlValue(request, "hideLegend").length()>0? AppUtils.getRequestNvlValue(request, "hideLegend").equals("Y"):rr.hideChartLegend())); + additionalChartOptionsMap.put("labelAngle", nvl(rr.getLegendLabelAngle())); + additionalChartOptionsMap.put("maxLabelsInDomainAxis", nvl(rr.getMaxLabelsInDomainAxis())); + additionalChartOptionsMap.put("rangeAxisLowerLimit", nvl(rr.getRangeAxisLowerLimit())); + additionalChartOptionsMap.put("rangeAxisUpperLimit", nvl(rr.getRangeAxisUpperLimit())); + + + boolean totalOnChart = false; + totalOnChart = AppUtils.getRequestNvlValue(request, "totalOnChart").equals("Y"); + String filename = null; + ArrayList graphURL = new ArrayList(); + ArrayList chartNames = new ArrayList(); + ArrayList fileNames = new ArrayList(); + List l = rr.getAllColumns(); + List lGroups = rr.getAllChartGroups(); + HashMap mapYAxis = rr.getAllChartYAxis(rr.getReportParamValues()); + String chartLeftAxisLabel = rr.getFormFieldFilled(nvl(rr.getChartLeftAxisLabel())); + String chartRightAxisLabel = rr.getFormFieldFilled(nvl(rr.getChartRightAxisLabel())); + int displayTotalOnChart = 0; + HashMap formValues = Globals.getRequestParamtersMap(request, false); + + for (Iterator iterC = l.iterator(); iterC.hasNext();) { + DataColumnType dc = (DataColumnType) iterC.next(); + if(nvl(dc.getColName()).equals(AppConstants.RI_CHART_TOTAL_COL)) { + displayTotalOnChart = 1; + } + } + + String legendColumnName = (rr.getChartLegendColumn()!=null)?rr.getChartLegendColumn().getDisplayName():"Legend Column"; + + + + if(ds!=null) + { + if(rr.hasSeriesColumn() && chartType.equals(AppConstants.GT_TIME_SERIES) && (lGroups==null || lGroups.size() <= 0)) { /** Check whether Report has only category columns if so then all the columns will open in seperate chart - sundar**/ + for (int i=0; i0) + tempChartGroupCurrent = chartGroupOrg.substring(0,chartGroupOrg.lastIndexOf("|")); + if(i>0) tempChartGroupPrev = ((String) lGroups.get(i-1)).substring(0,((String) lGroups.get(i-1)).lastIndexOf("|")); + //System.out.println("TEMPCHARTGROUP " + tempChartGroupCurrent + " " + tempChartGroupPrev); + if(tempChartGroupCurrent.equals(tempChartGroupPrev)) continue; + //System.out.println("CHARTGROUPORG " + chartGroupOrg + " " + lGroups) ; + //String chartGroup = chartGroupOrg.substring(0,chartGroupOrg.lastIndexOf("|")); + String chartGroup = chartGroupOrg; + + //System.out.println("$$$$CHARTGROUP in JSP " +chartGroup+ " "+ chartGroupOrg ); + //System.out.println(" rr.getChartGroupDisplayNamesList(chartGroup) " + rr.getChartGroupDisplayNamesList(chartGroup)); + //System.out.println(" rr.getChartGroupColumnColorsList(chartGroup) " + rr.getChartGroupColumnColorsList(chartGroup)); + //System.out.println(" rr.getChartGroupColumnAxisList(chartGroup) " + rr.getChartGroupColumnAxisList(chartGroup)); + //System.out.println(" rr.getChartGroupValueColumnAxisList(chartGroupOrg) " + rr.getChartGroupValueColumnAxisList(chartGroupOrg)); + + downloadFileName = AppUtils.getTempFolderPath()+"cr_"+pb.getUserId()+"_"+request.getSession().getId()+"_"+rr.getReportID()+"_"+i+".png"; + String chartTitle = (Globals.getDisplayChartTitle()? (chartGroup!=null && chartGroup.indexOf("|") > 0 ?chartGroup.substring(0,chartGroup.lastIndexOf("|")):rr.getReportName()):""); + chartTitle = rr.getFormFieldFilled(chartTitle); + String leftAxisLabel = ""; + //if(!rr.isChartMultiSeries()) { + if(!rr.isMultiSeries()) { + leftAxisLabel = ((chartYAxis!=null && chartYAxis.indexOf("|") > 0) ? chartYAxis.substring(0,chartYAxis.lastIndexOf("|")): chartLeftAxisLabel ); + } else { + leftAxisLabel = chartLeftAxisLabel; + } + + filename = null;/*(String) ChartGen.generateChart( chartType, + request.getSession(), + ds, + legendColumnName, + leftAxisLabel, + chartRightAxisLabel, + ((chartType.indexOf("Stacked")>0 || chartType.equals(AppConstants.GT_PIE_MULTIPLE) || chartType.equals(AppConstants.GT_BAR_3D))?rr.getChartDisplayNamesList(AppConstants.CHART_ALL_COLUMNS, formValues):rr.getChartGroupDisplayNamesList(chartGroup, formValues)), + ((chartType.indexOf("Stacked")>0 || chartType.equals(AppConstants.GT_PIE_MULTIPLE) || chartType.equals(AppConstants.GT_BAR_3D))?rr.getChartColumnColorsList(AppConstants.CHART_ALL_COLUMNS, formValues):rr.getChartGroupColumnColorsList(chartGroup, formValues)), + ((chartType.indexOf("Stacked")>0 || chartType.equals(AppConstants.GT_PIE_MULTIPLE) || chartType.equals(AppConstants.GT_BAR_3D))?rr.getChartValueColumnAxisList(AppConstants.CHART_ALL_COLUMNS, formValues):rr.getChartGroupValueColumnAxisList(chartGroupOrg, formValues)), + "", + chartTitle, + null, + rr.getChartWidthAsInt(), + rr.getChartHeightAsInt(), + ((chartType.indexOf("Stacked")>0 || chartType.equals(AppConstants.GT_PIE_MULTIPLE))?rr.getChartValueColumnsList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS, formValues):rr.getChartGroupValueColumnAxisList(chartGroupOrg, formValues)), + rr.hasSeriesColumn(), + //rr.isChartMultiSeries(), + rr.isMultiSeries(), + rr.getAllColumns(), + downloadFileName, + totalOnChart, + AppConstants.WEB_VERSION deviceType, + additionalChartOptionsMap, + true + );*/ + try { + Image image = Image.getInstance(downloadFileName); + images.add(image); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + catch (BadElementException e) { + e.printStackTrace(); + + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + if(!chartType.equals(AppConstants.GT_PIE_MULTIPLE)) { + for (int i=0; i 0))) { + + if(/*chartType.equals(AppConstants.GT_TIME_SERIES) && */rr.getChartDisplayNamesList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS, formValues)!=null && rr.getChartDisplayNamesList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS, formValues).size()>0) { + downloadFileName = AppUtils.getTempFolderPath()+"cr_"+ pb.getUserId()+"_"+request.getSession().getId()+"_"+rr.getReportID()+"_All.png"; + String chartTitle = Globals.getDisplayChartTitle()? rr.getReportName():""; + chartTitle = rr.getFormFieldFilled(chartTitle); + + filename = null;/*(String) ChartGen.generateChart( chartType, + request.getSession(), + ds, + legendColumnName, + chartLeftAxisLabel, + chartRightAxisLabel, + rr.getChartDisplayNamesList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS, formValues), + rr.getChartColumnColorsList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS, formValues), + rr.getChartValueColumnAxisList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS, formValues), + "", + chartTitle, + null, + rr.getChartWidthAsInt(), + rr.getChartHeightAsInt(), + rr.getChartValueColumnsList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS, formValues), + rr.hasSeriesColumn(), + //rr.isChartMultiSeries(), + rr.isMultiSeries(), + rr.getAllColumns(), + downloadFileName, + totalOnChart, + AppConstants.WEB_VERSION, + additionalChartOptionsMap, + true + ); +*/ try { + Image image = Image.getInstance(downloadFileName); + images.add(image); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + catch (BadElementException e) { + e.printStackTrace(); + + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } // Stacked Chart Check + } // else no Series Column + + }// if(ds!=null) + + }catch (Exception e) { + e.printStackTrace(); + } +// System.out.println("Total Images " + images.size()); + return images.size()>0?images:null; + + } + +/* + private boolean isImageRotate(Document doc, Image image) { + + System.out.println("image size="+image.getWidthPercentage()+ " "+ image.scaledWidth()+ + " "+image.scaledHeight()+" "+image.getXYRatio()); + System.out.println("page size = "+ doc.getPageSize().width() + " " +doc.getPageSize().height() +" "+ + doc.topMargin() + " " +doc.bottomMargin() + " " + doc.leftMargin() + " " + + doc.rightMargin()); + System.out.println(image.scaledWidth()/image.scaledHeight()); + System.out.println((PageEvent.getPageWidth(doc)/PageEvent.getPageHeight(doc))); +// System.out.println(doc.getPageSize().getRotation()); + + float image_w = image.scaledWidth(); + float image_h = image.scaledHeight(); + float image_ratio = image_w/image_h; + + float page_w = PageEvent.getPageWidth(doc); + float page_h = PageEvent.getPageHeight(doc); + float page_ratio = page_w/page_h; + + return (image_w > page_w && image_ratio > page_ratio) || + (image_h > page_h && image_ratio < page_ratio); + + } + +*/ + private final int DEFAULT_PDF_DISPLAY_WIDTH = 10; + private int paintPdfData(HttpServletRequest request, Document document, ReportData rd, ReportRuntime rr, String sql_whole) throws DocumentException, RaptorException, IOException { + + int mb = 1024*1024; + Runtime runtime = Runtime.getRuntime(); + int returnValue = 0; + sql_whole = rr.getWholeSQL(); + if(rd.getDataRowCount() >= rr.getReportDataSize()) { + sql_whole=""; + } + float f[] = getRelativeWidths(rd, rr.getReportType().equals(AppConstants.RT_CROSSTAB)); + PdfPTable table = new PdfPTable(f); + table.setWidthPercentage(100f); + table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER); + table.getDefaultCell().setVerticalAlignment(Rectangle.ALIGN_BOTTOM); + + ReportDefinition rdef = (new ReportHandler()).loadReportDefinition(request, rr.getReportID()); + + List allColumns = rdef.getAllColumns(); + + float[] repotWidths = new float[rdef.getVisibleColumnCount()]; + int columnIdx = 0; + float pdfDisplayWidth = 0; + for(Iterator iter = allColumns.iterator(); iter.hasNext();){ + DataColumnType dct = (DataColumnType) iter.next(); + if(dct.isVisible()) { + + if(dct.getPdfDisplayWidthInPxls() == null || dct.getPdfDisplayWidthInPxls().equals("") || dct.getPdfDisplayWidthInPxls().startsWith("null")) + pdfDisplayWidth = DEFAULT_PDF_DISPLAY_WIDTH; + else + pdfDisplayWidth = Float.parseFloat(dct.getPdfDisplayWidthInPxls()); + + repotWidths [columnIdx++] = pdfDisplayWidth; + } + } + + table.setWidths(repotWidths); + + //table.setH + + //TODO: check title and subtitle + HttpSession session = request.getSession(); + String drilldown_index = (String) session.getAttribute("drilldown_index"); + int index = 0; + try { + index = Integer.parseInt(drilldown_index); + } catch (NumberFormatException ex) { + index = 0; + } + String titleRep = (String) session.getAttribute("TITLE_"+index); + String subtitle = (String) session.getAttribute("SUBTITLE_"+index); + + if(nvl(titleRep).length()>0 && nvl(subtitle).length()>0) + table.setHeaderRows(3); + else if (nvl(titleRep).length()>0) + table.setHeaderRows(2); + else + table.setHeaderRows(1); + table = paintPdfReportHeader(request, document, table, rr, f); + paintPdfTableHeader(document, rd, table); + + int idx = 0; + int fragmentsize = 30; //for memory management + + ResultSet rs = null; + Connection conn = null; + Statement st = null; + ResultSetMetaData rsmd = null; + rd.reportDataRows.resetNext(); + DataRow dr = rd.reportDataRows.getNext(); + + //addRowHeader(table,dr,idx,rd); + + //addRowColumns(table,dr,idx); + if(nvl(sql_whole).length() >0 && rr.getReportType().equals(AppConstants.RT_LINEAR)) { + try { + conn = ConnectionUtils.getConnection(rr.getDbInfo()); + st = conn.createStatement(); + logger.debug(EELFLoggerDelegate.debugLogger, ("************* Map Whole SQL *************")); + logger.debug(EELFLoggerDelegate.debugLogger, (sql_whole)); + logger.debug(EELFLoggerDelegate.debugLogger, ("*****************************************")); + rs = st.executeQuery(sql_whole); + rsmd = rs.getMetaData(); + int numberOfColumns = rsmd.getColumnCount(); + HashMap colHash = new HashMap(); + dr = null; + int j = 0; + int rowCount = 0; + String title = ""; + while(rs.next()) { + +/* if(runtime.freeMemory()/mb <= ((runtime.maxMemory()/mb)*Globals.getMemoryThreshold()/100) ) { + returnValue = 1; + String cellValue = Globals.getUserDefinedMessageForMemoryLimitReached() + " "+ rowCount +" records out of " + rr.getReportDataSize() + " were downloaded to PDF."; + Font cellFont = FontFactory.getFont(Globals.getDataFontFamily(), + Globals.getDataFontSize(), + Font.NORMAL, Color.BLACK); + PdfPCell cell = new PdfPCell(new Paragraph(cellValue,cellFont)); + table.addCell(cell); + document.add(table); + return returnValue; + } +*/ rowCount++; + colHash = new HashMap(); + for (int i = 1; i <= numberOfColumns; i++) { + colHash.put(rsmd.getColumnName(i), rs.getString(i)); + } + rd.reportDataRows.resetNext(); + + dr = rd.reportDataRows.getNext(); + + j = 0; + /*if(rd.reportTotalRowHeaderCols!=null) { + + HtmlFormatter rfmt = dr.getRowFormatter(); + + Font cellFont = FontFactory.getFont(Globals.getDataFontFamily(), + Globals.getDataFontSize(), + Font.NORMAL, Color.BLACK); + if(rfmt != null) { + cellFormatterFont(rfmt,cellFont); + } + + String cellValue = new Integer(rowCount).toString(); + PdfPCell cell = new PdfPCell(new Paragraph(cellValue,cellFont)); + + //row background color can be overwritten by cell background color + cell.setBackgroundColor(getRowBackgroundColor(dr, idx)); + + cell.setHorizontalAlignment(Rectangle.ALIGN_CENTER); + + if(rfmt != null) { + formatterCell(rfmt,cell); + } + table.addCell(cell); + }*/ + + for (dr.resetNext(); dr.hasNext();j++) { + DataValue dv = dr.getNext(); + /*if(j == 0) { + HtmlFormatter cfmt = dv.getCellFormatter(); + HtmlFormatter rfmt = dv.getRowFormatter(); + + Font cellFont = FontFactory.getFont(Globals.getDataFontFamily(), + Globals.getDataFontSize(), + Font.NORMAL, Color.BLACK); + if(cfmt!= null) { + cellFormatterFont(cfmt,cellFont); + } + else if(rfmt != null) { + cellFormatterFont(rfmt,cellFont); + } + else { + if(dv.isBold()) { + cellFont.setStyle(Font.BOLD); + } + } + + //String cellValue = strip.stripHtml(value.trim()); + PdfPCell cell = new PdfPCell(new Paragraph(rowCount+"",cellFont)); + + //row background color can be overwritten by cell background color + cell.setBackgroundColor(getRowBackgroundColor(dr, idx)); + + if(nvl(dv.getAlignment()).trim().length()>0) + cell.setHorizontalAlignment(ElementTags.alignmentValue(dv.getAlignment())); + else + cell.setHorizontalAlignment(Rectangle.ALIGN_CENTER); + + if(cfmt!= null) { + formatterCell(cfmt,cell); + } + else if(rfmt != null) { + formatterCell(rfmt,cell); + } + table.addCell(cell); + }*/ + + //for (chr.resetNext(); chr.hasNext();) { + //ColumnHeader ch = chr.getNext(); + String value = nvl((String)colHash.get(dv.getColId().toUpperCase())); + if(dv.isVisible()) { + + HtmlFormatter cfmt = dv.getCellFormatter(); + HtmlFormatter rfmt = dv.getRowFormatter(); + + Font cellFont = FontFactory.getFont(FONT_FAMILY, + FONT_SIZE, + Font.NORMAL, Color.BLACK); + if(cfmt!= null) { + cellFormatterFont(cfmt,cellFont); + } + else if(rfmt != null) { + cellFormatterFont(rfmt,cellFont); + } + else { + if(dv.isBold()) { + cellFont.setStyle(Font.BOLD); + } + } + + String cellValue = strip.stripHtml(value.trim()); + PdfPCell cell = new PdfPCell(new Paragraph(cellValue,cellFont)); + + //row background color can be overwritten by cell background color + cell.setBackgroundColor(getRowBackgroundColor(dr, idx)); + + if(nvl(dv.getAlignment()).trim().length()>0) + cell.setHorizontalAlignment(ElementTags.alignmentValue(dv.getAlignment())); + else + cell.setHorizontalAlignment(Rectangle.ALIGN_CENTER); + + if(cfmt!= null) { + formatterCell(cfmt,cell); + } + else if(rfmt != null) { + formatterCell(rfmt,cell); + } + + + + table.addCell(cell); + + }//if isVisible() + + + } + + } + if(rd.reportDataTotalRow!=null) { + for (rd.reportDataTotalRow.resetNext(); rd.reportDataTotalRow.hasNext();idx++) { + dr = rd.reportDataTotalRow.getNext(); + table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER); + Font rowHeaderFont = FontFactory.getFont(FONT_FAMILY, + FONT_SIZE, + Font.NORMAL, Color.BLACK); + rowHeaderFont.setStyle(Font.BOLD); + rowHeaderFont.setSize(FONT_SIZE+1f); + table.getDefaultCell().setBackgroundColor(getRowBackgroundColor(dr, idx)); + table.addCell(new Paragraph("Total",rowHeaderFont)); + + + addTotalRowColumns(table,dr,idx); + if (idx % fragmentsize == fragmentsize - 1) { + document.add(table); + table.deleteBodyRows(); + table.setSkipFirstHeader(true); + } + + } + } + } catch (SQLException ex) { + throw new RaptorException(ex); + } catch (ReportSQLException ex) { + throw new RaptorException(ex); + } catch (Exception ex) { + if(!(ex.getCause() instanceof java.net.SocketException) ) + throw new RaptorException (ex); + } finally { + try { + if(conn!=null) + conn.close(); + if(st!=null) + st.close(); + if(rs!=null) + rs.close(); + } catch (SQLException ex) { + throw new RaptorException(ex); + } + } + + +// if (idx % fragmentsize == fragmentsize - 1) { +// document.add(table); +// table.deleteBodyRows(); +// table.setSkipFirstHeader(true); +// } + + //document.add(table); + } else { + if(rr.getReportType().equals(AppConstants.RT_LINEAR)) { + int rowCount = 0; + for(rd.reportDataRows.resetNext();rd.reportDataRows.hasNext();idx++) + { + rowCount++; + + /*if(rd.reportTotalRowHeaderCols!=null) { + HtmlFormatter rfmt = dr.getRowFormatter(); + + Font cellFont = FontFactory.getFont(Globals.getDataFontFamily(), + Globals.getDataFontSize(), + Font.NORMAL, Color.BLACK); + if(rfmt != null) { + cellFormatterFont(rfmt,cellFont); + } + + //String cellValue = new Integer(rowCount).toString(); + //PdfPCell cell = new PdfPCell(new Paragraph(cellValue,cellFont)); + + //row background color can be overwritten by cell background color + //cell.setBackgroundColor(getRowBackgroundColor(dr, idx)); + + //cell.setHorizontalAlignment(Rectangle.ALIGN_CENTER); + + //if(rfmt != null) { + //formatterCell(rfmt,cell); + //} + //table.addCell(cell); + }*/ + + + + if(runtime.freeMemory()/mb <= ((runtime.maxMemory()/mb)*Globals.getMemoryThreshold()/100) ) { + returnValue = 1; + } + + dr = rd.reportDataRows.getNext(); + + addRowHeader(table,dr,idx,rd); + + addRowColumns(table,dr,idx); + + if (idx % fragmentsize == fragmentsize - 1) { + document.add(table); + table.deleteBodyRows(); + table.setSkipFirstHeader(true); + } + } + + if(rd.reportDataTotalRow!=null) { + for (rd.reportDataTotalRow.resetNext(); rd.reportDataTotalRow.hasNext();idx++) { + dr = rd.reportDataTotalRow.getNext(); + table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER); + Font rowHeaderFont = FontFactory.getFont(FONT_FAMILY, + FONT_SIZE, + Font.NORMAL, Color.BLACK); + rowHeaderFont.setStyle(Font.BOLD); + rowHeaderFont.setSize(FONT_SIZE+1f); + table.getDefaultCell().setBackgroundColor(getRowBackgroundColor(dr, idx)); + table.addCell(new Paragraph("Total",rowHeaderFont)); + + + addTotalRowColumns(table,dr,idx); + if (idx % fragmentsize == fragmentsize - 1) { + document.add(table); + table.deleteBodyRows(); + table.setSkipFirstHeader(true); + } + + } + } + + } else if (rr.getReportType().equals(AppConstants.RT_CROSSTAB)) { + int rowCount = 0; + List l = rd.getReportDataList(); + boolean first = true; + for (int dataRow = 0; dataRow < l.size(); dataRow++) { + first = true; + rowCount++; + dr = (DataRow) l.get(dataRow); + Vector rowNames = dr.getRowValues(); + for(dr.resetNext(); dr.hasNext(); ) { + + if(first) { + HtmlFormatter rfmt = dr.getRowFormatter(); + + Font cellFont = FontFactory.getFont(FONT_FAMILY, + FONT_SIZE, + Font.NORMAL, Color.BLACK); + if(rfmt != null) { + cellFormatterFont(rfmt,cellFont); + } + String cellValue = ""; + PdfPCell cell = null; + //String cellValue = new Integer(rowCount).toString(); + //PdfPCell cell = new PdfPCell(new Paragraph(cellValue,cellFont)); + //row background color can be overwritten by cell background color + //cell.setBackgroundColor(getRowBackgroundColor(dr, idx)); + + //cell.setHorizontalAlignment(Rectangle.ALIGN_CENTER); + + //if(rfmt != null) { + //formatterCell(rfmt,cell); + // } + //table.addCell(cell); + if(rowNames!=null) { + for(int i=0; i0) { + table.getDefaultCell().setColspan(rh.getColSpan()); + table.getDefaultCell().setBackgroundColor(getRowBackgroundColor(dr, idx)); + table.addCell(new Paragraph(strip.stripHtml(rh.getRowTitle()),rowHeaderFont)); + } + } + } + + private void addRowColumns(PdfPTable table, DataRow dr, int idx) { + + table.getDefaultCell().setColspan(1); + + for(dr.resetNext();dr.hasNext();) + { + DataValue dv = dr.getNext(); + //System.out.println(columnCount +" --> "+dv); + if(dv.isVisible()) { + HtmlFormatter cfmt = dv.getCellFormatter(); + HtmlFormatter rfmt = dv.getRowFormatter(); + + Font cellFont = FontFactory.getFont(FONT_FAMILY, + FONT_SIZE, + Font.NORMAL, Color.BLACK); + if(cfmt!= null) { + cellFormatterFont(cfmt,cellFont); + } + else if(rfmt != null) { + cellFormatterFont(rfmt,cellFont); + } + else { + if(dv.isBold()) { + cellFont.setStyle(Font.BOLD); + } + } + + String cellValue = strip.stripHtml(dv.getDisplayValue().trim()); + PdfPCell cell = new PdfPCell(new Paragraph(cellValue,cellFont)); + + //row background color can be overwritten by cell background color + cell.setBackgroundColor(getRowBackgroundColor(dr, idx)); + + if(nvl(dv.getAlignment()).trim().length()>0) + cell.setHorizontalAlignment(ElementTags.alignmentValue(dv.getAlignment())); + else + cell.setHorizontalAlignment(Rectangle.ALIGN_CENTER); + + if(cfmt!= null) { + formatterCell(cfmt,cell); + } + else if(rfmt != null) { + formatterCell(rfmt,cell); + } + + table.addCell(cell); + + }//if isVisible() + } + } + + + private void addTotalRowColumns(PdfPTable table, DataRow dr, int idx) { + + table.getDefaultCell().setColspan(1); + dr.resetNext(); + dr.getNext(); + for(;dr.hasNext();) + { + DataValue dv = dr.getNext(); + //System.out.println(columnCount +" --> "+dv); + if(dv.isVisible()) { + HtmlFormatter cfmt = dv.getCellFormatter(); + HtmlFormatter rfmt = dv.getRowFormatter(); + + Font cellFont = FontFactory.getFont(FONT_FAMILY, + FONT_SIZE, + Font.NORMAL, Color.BLACK); + if(cfmt!= null) { + cellFormatterFont(cfmt,cellFont); + } + else if(rfmt != null) { + cellFormatterFont(rfmt,cellFont); + } + else { + if(dv.isBold()) { + cellFont.setStyle(Font.BOLD); + } + } + + String cellValue = strip.stripHtml(dv.getDisplayValue().trim()); + PdfPCell cell = new PdfPCell(new Paragraph(cellValue,cellFont)); + + //row background color can be overwritten by cell background color + cell.setBackgroundColor(getRowBackgroundColor(dr, idx)); + + if(nvl(dv.getAlignment()).trim().length()>0) + cell.setHorizontalAlignment(ElementTags.alignmentValue(dv.getAlignment())); + else + cell.setHorizontalAlignment(Rectangle.ALIGN_CENTER); + + if(cfmt!= null) { + formatterCell(cfmt,cell); + } + else if(rfmt != null) { + formatterCell(rfmt,cell); + } + + table.addCell(cell); + + }//if isVisible() + } + } + + + private void formatterCell(HtmlFormatter fmt, PdfPCell cell) { + + if(nvl(fmt.getBgColor()).trim().length()>0) + cell.setBackgroundColor(Color.decode(fmt.getBgColor())); + if(nvl(fmt.getAlignment()).trim().length()>0) + cell.setHorizontalAlignment(ElementTags.alignmentValue(fmt.getAlignment())); + } + + private void cellFormatterFont(HtmlFormatter fmt, Font font) { + + if(fmt.isBold()) + font.setStyle(Font.BOLD); + if(fmt.isItalic()) + font.setStyle(Font.ITALIC); + if(fmt.isUnderline()) + font.setStyle(Font.UNDERLINE); + if(fmt.getFontColor().trim().length()>0) + font.setColor(Color.decode(fmt.getFontColor())); + if(fmt.getFontSize().trim().length()>0) + font.setSize(Float.parseFloat(fmt.getFontSize())-Globals.getDataFontSizeOffset()); +// if(fmt.getFontFace().trim().length()>0) +// cellFont.setFamily() + + } + + private Color getRowBackgroundColor(DataRow dr, int idx) { + + Color color = Color.decode(Globals.getDataDefaultBackgroundHexCode()); + + HtmlFormatter rhf = dr.getRowFormatter(); + if(rhf!=null && nvl(rhf.getBgColor()).trim().length()>0) + + color = Color.decode(rhf.getBgColor()); + + else if(pb.isAlternateColor() && idx%2==0) + + color = Color.decode(Globals.getDataBackgroundAlternateHexCode()); + + return color; + + } + + private int getTotalVisbleColumns(ReportData rd) { + + int totalVisbleColumn = rd.getTotalColumnCount(); + for(rd.reportDataRows.resetNext();rd.reportDataRows.hasNext();) + { + DataRow dr = rd.reportDataRows.getNext(); + for(dr.resetNext();dr.hasNext();) { + DataValue dv = dr.getNext(); + if(!dv.isVisible()) totalVisbleColumn--; + } + + break; + } + + return totalVisbleColumn; + } + + /* + private int getFirstRowIndex(ReportRuntime rr) { + return (pb.getCurrentPage()>0)?pb.getCurrentPage()*rr.getPageSize()+1 : 1; + } + */ + private float[] getRelativeWidths(ReportData rd, boolean crosstab){ + + int totalColumns = getTotalVisbleColumns(rd); + /*if(rd.reportTotalRowHeaderCols!=null) { + totalColumns += 1; + }*/ + if(crosstab) { + totalColumns += 1; + } + + if(totalColumns == 0 ) + totalColumns=1; + + float[] relativeWidths = new float[totalColumns]; + //initial widths are even + for(int i=0; i0) { + //PdfPTable table = new PdfPTable(1); + table.setWidthPercentage(100f); + table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER); + table.getDefaultCell().setVerticalAlignment(Rectangle.ALIGN_BOTTOM); + + + Font font = FontFactory.getFont(FONT_FAMILY, + FONT_SIZE-2f, + Font.BOLD, + Color.BLACK); + + //addEmptyRows(table,1); + table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER); + //table.getDefaultCell().setBackgroundColor(Color.decode(Globals.getDataTableHeaderBackgroundFontColor())); + title = Utils.replaceInString(title, "
    ", " "); + title = Utils.replaceInString(title, "
    ", " "); + title = Utils.replaceInString(title, "
    ", " "); + title = strip.stripHtml(nvl(title).trim()); + //subtitle = Utils.replaceInString(subtitle, "
    ", " "); + //subtitle = Utils.replaceInString(subtitle, "
    ", " "); + //subtitle = Utils.replaceInString(subtitle, "
    ", " "); + //subtitle = strip.stripHtml(nvl(subtitle).trim()); + StyleSheet styles = new StyleSheet(); + + HTMLWorker htmlWorker = new HTMLWorker(document); + ArrayList cc = new ArrayList(); + cc = htmlWorker.parseToList(new StringReader(subtitle), styles); + + Phrase p1 = new Phrase(); + for (int i = 0; i < cc.size(); i++){ + Element elem = (Element)cc.get(i); + ArrayList al = elem.getChunks(); + for (int j = 0; j < al.size(); j++) { + Chunk chunk = (Chunk) al.get(j); + chunk.font().setSize(6.0f); + } + p1.add(elem); + } + //cell = new PdfPCell(p1); + StyleSheet style = new StyleSheet(); + style.loadTagStyle("font", "font-size", "3"); + style.loadTagStyle("font", "size", "3"); + styles.loadStyle("pdfFont1", "size", "11px"); + styles.loadStyle("pdfFont1", "font-size", "11px"); + /*ArrayList p = HTMLWorker.parseToList(new StringReader(nvl(title)), style); + for (int k = 0; k < p.size(); ++k){ + document.add((com.lowagie.text.Element)p.get(k)); + }*/ + //p1.font().setSize(3.0f); + PdfPCell titleCell = new PdfPCell(new Phrase(title, font)); + titleCell.setColspan(rr.getVisibleColumnCount()); + PdfPCell subtitleCell = new PdfPCell(p1); + subtitleCell.setColspan(rr.getVisibleColumnCount()); + titleCell.setHorizontalAlignment(1); + subtitleCell.setHorizontalAlignment(1); + table.addCell(titleCell); + table.addCell(subtitleCell); + //document.add(table); + } + return table; + } + + + private void paintPdfReportFooter(HttpServletRequest request, Document document, ReportRuntime rr, float[] f) + throws DocumentException, IOException { + + HttpSession session = request.getSession(); + String drilldown_index = (String) session.getAttribute("drilldown_index"); + int index = 0; + try { + index = Integer.parseInt(drilldown_index); + } catch (NumberFormatException ex) { + index = 0; + } + + String title = (String) session.getAttribute("FOOTER_"+index); + if(nvl(title).length()>0) { + PdfPTable table = new PdfPTable(1); + table.setWidthPercentage(100f); + table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER); + table.getDefaultCell().setVerticalAlignment(Rectangle.ALIGN_BOTTOM); + + Font font = FontFactory.getFont(FONT_FAMILY, + FONT_SIZE-3f, + Font.BOLD, + Color.BLACK); + + + //addEmptyRows(table,1); + table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER); + //table.getDefaultCell().setBackgroundColor(Color.decode(Globals.getDataTableHeaderBackgroundFontColor())); + /*title = Utils.replaceInString(title, "
    ", " "); + title = Utils.replaceInString(title, "
    ", " "); + title = Utils.replaceInString(title, "
    ", " "); + title = strip.stripHtml(nvl(title).trim());*/ + StyleSheet style = new StyleSheet(); + + HTMLWorker htmlWorker = new HTMLWorker(document); + ArrayList cc = new ArrayList(); + cc = htmlWorker.parseToList(new StringReader(title), style); + + Phrase p1 = new Phrase(); + for (int i = 0; i < cc.size(); i++){ + Element elem = (Element)cc.get(i); + ArrayList al = elem.getChunks(); + for (int j = 0; j < al.size(); j++) { + Chunk chunk = (Chunk) al.get(j); + chunk.font().setSize(6.0f); + } + p1.add(elem); + } + +/* + HTMLWorker.parseToList(new StringReader(nvl(title)), style);*/ + PdfPCell titleCell = new PdfPCell(p1); + titleCell.setHorizontalAlignment(Element.ALIGN_LEFT); + table.addCell(titleCell); + //table. + document.add(table); + } + //return table; + } + + + private void paintPdfTableHeader(Document document, ReportData rd, PdfPTable table) + throws DocumentException { + + Font font = FontFactory.getFont(FONT_FAMILY, + FONT_SIZE+1f, + Font.BOLD, + Color.decode(Globals.getDataTableHeaderFontColor())); + //table.setHeaderRows(1); + table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER); + table.getDefaultCell().setBackgroundColor(Color.decode(Globals.getDataTableHeaderBackgroundFontColor())); + String title = ""; + + boolean firstPass = true; + + /*if(rd.reportTotalRowHeaderCols!=null) { + if(firstPass) { + table.addCell(new Paragraph("No.", font)); + firstPass = false; + } + }*/ + for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();) + { + if(firstPass) { + for(rd.reportRowHeaderCols.resetNext();rd.reportRowHeaderCols.hasNext();) { + /*if(firstPass) { + table.addCell(new Paragraph("No.", font)); + firstPass = false; + } else {*/ + RowHeaderCol rhc = rd.reportRowHeaderCols.getNext(); + title = rhc.getColumnTitle(); + title = Utils.replaceInString(title,"_nl_", " \n"); + table.addCell(new Paragraph(title,font)); + //} + } + } + + ColumnHeaderRow chr = rd.reportColumnHeaderRows.getNext(); + for (chr.resetNext(); chr.hasNext();) { + ColumnHeader ch = chr.getNext(); + //System.out.println(ch); + if(ch.isVisible()) { + title = ch.getColumnTitle(); + title = Utils.replaceInString(title,"_nl_", " \n"); + table.addCell(new Paragraph(title,font)); + } + } + } + } + + public static String currentTime(String pattern) { + try { + SimpleDateFormat oracleDateFormat = new SimpleDateFormat("MM/dd/yyyy kk:mm:ss"); + Date sysdate = oracleDateFormat.parse(ReportLoader.getSystemDateTime()); + SimpleDateFormat dtimestamp = new SimpleDateFormat(Globals.getScheduleDatePattern()); + return dtimestamp.format(sysdate)+" "+Globals.getTimeZone(); + //paramList.add(new IdNameValue("DATE", dtimestamp.format(sysdate)+" "+Globals.getTimeZone())); + } catch(Exception ex) {} + + SimpleDateFormat s = new SimpleDateFormat(pattern); + s.setTimeZone(TimeZone.getTimeZone(Globals.getTimeZone())); + //System.out.println("^^^^^^^^^^^^^^^^^^^^ " + Calendar.getInstance().getTime()); + //System.out.println("^^^^^^^^^^^^^^^^^^^^ " + s.format(Calendar.getInstance().getTime())); + return s.format(Calendar.getInstance().getTime()); + } + + private PdfBean preparePdfBean(HttpServletRequest request,ReportRuntime rr) { + PdfBean pb = new PdfBean(); + + pb.setUserId(AppUtils.getUserID(request)); + + pb.setWhereToShowPageNumber(Globals.getPageNumberPosition()); + pb.setAlternateColor(Globals.isDataAlternateColor()); + pb.setTimestampPattern(Globals.getDatePattern()); + + int temp = -1; + try { + temp = Integer.parseInt(request.getParameter(AppConstants.RI_NEXT_PAGE)); + } catch (NumberFormatException e) {} + pb.setCurrentPage(temp); + + //pb.setPortrait( trueORfalse(request.getParameter("isPortrait"),true)); + pb.setPortrait(trueORfalse(rr.getPDFOrientation() == "portait"?"true":"false", true)); + //pb.setCoverPageIncluded( trueORfalse(request.getParameter("isCoverPageIncluded"), true)); + //if(Globals.isCoverPageNeeded()) { + pb.setCoverPageIncluded(Globals.isCoverPageNeeded()?rr.isPDFCoverPage():false); + //} + pb.setTitle(nvl(request.getParameter("title"))); + pb.setPagesize(nvls(request.getParameter("pagesize"),"LETTER")); + + pb.setLogo1Url(rr.getPDFLogo1()); + pb.setLogo2Url(rr.getPDFLogo2()); + pb.setLogo1Size(rr.getPDFLogo1Size()); + pb.setLogo2Size(rr.getPDFLogo2Size()); + pb.setFullWebContextPath(request.getSession().getServletContext().getRealPath(File.separator)); + + + pb.setDisplayChart(nvl(rr.getChartType()).trim().length()>0 && rr.getDisplayChart()); + + String id = nvl(request.getParameter("pdfAttachmentKey")).trim(); + String log_id = nvl(request.getParameter("log_id")).trim(); + if(id.length()>0 && log_id.length()>0) + pb.setAttachmentOfEmail(true); + + return pb; + } + + private boolean trueORfalse(String str) { + return (str != null) && (str.equalsIgnoreCase("true")); + } + + private boolean trueORfalse(String str,boolean b_default) { + return str==null ? b_default : (str.equalsIgnoreCase("true")); + } + + +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/BarChartOptions.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/BarChartOptions.java new file mode 100644 index 0000000..7e99dc6 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/BarChartOptions.java @@ -0,0 +1,75 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.runtime; + +public class BarChartOptions { + private boolean verticalOrientation; + private boolean stackedChart; + private boolean displayBarControls; + private boolean xAxisDateType; + private boolean minimizeXAxisTickers; + private boolean timeAxis; + private boolean yAxisLogScale; + + public boolean isVerticalOrientation() { + return verticalOrientation; + } + public void setVerticalOrientation(boolean verticalOrientation) { + this.verticalOrientation = verticalOrientation; + } + public boolean isStackedChart() { + return stackedChart; + } + public void setStackedChart(boolean stackedChart) { + this.stackedChart = stackedChart; + } + public boolean isDisplayBarControls() { + return displayBarControls; + } + public void setDisplayBarControls(boolean displayBarControls) { + this.displayBarControls = displayBarControls; + } + public boolean isxAxisDateType() { + return xAxisDateType; + } + public void setxAxisDateType(boolean xAxisDateType) { + this.xAxisDateType = xAxisDateType; + } + public boolean isMinimizeXAxisTickers() { + return minimizeXAxisTickers; + } + public void setMinimizeXAxisTickers(boolean minimizeXAxisTickers) { + this.minimizeXAxisTickers = minimizeXAxisTickers; + } + public boolean isTimeAxis() { + return timeAxis; + } + public void setTimeAxis(boolean timeAxis) { + this.timeAxis = timeAxis; + } + public boolean isyAxisLogScale() { + return yAxisLogScale; + } + public void setyAxisLogScale(boolean yAxisLogScale) { + this.yAxisLogScale = yAxisLogScale; + } + + +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/CategoryAxisJSON.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/CategoryAxisJSON.java new file mode 100644 index 0000000..93fab6e --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/CategoryAxisJSON.java @@ -0,0 +1,24 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.runtime; + +public class CategoryAxisJSON extends IndexValueJSON { + +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartD3Helper.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartD3Helper.java new file mode 100644 index 0000000..c46f48a --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartD3Helper.java @@ -0,0 +1,4064 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.runtime; + +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.text.ParsePosition; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang.time.DateUtils; +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.model.ReportHandler; +import org.openecomp.portalsdk.analytics.model.base.ChartSeqComparator; +import org.openecomp.portalsdk.analytics.system.AppUtils; +import org.openecomp.portalsdk.analytics.system.ConnectionUtils; +import org.openecomp.portalsdk.analytics.util.AppConstants; +import org.openecomp.portalsdk.analytics.util.DataSet; +import org.openecomp.portalsdk.analytics.util.HtmlStripper; +import org.openecomp.portalsdk.analytics.util.Utils; +import org.openecomp.portalsdk.analytics.view.ReportData; +import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType; +import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.web.support.UserUtils; + +public class ChartD3Helper { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ChartD3Helper.class); + + + private ReportRuntime reportRuntime; + private String chartType; + + public static final long HOUR = 3600*1000; + public static final long DAY = 3600*1000*24; + public static final long MONTH = 3600*1000*24*31; + public static final long YEAR = 3600*1000*24*365; + + + public ChartD3Helper() { + + } + + /** + * @return the chartType + */ + public String getChartType() { + return chartType; + } + + /** + * @param chartType the chartType to set + */ + public void setChartType(String chartType) { + this.chartType = chartType; + } + + public ChartD3Helper(ReportRuntime rr) { + this.reportRuntime = rr; + } + + public String createVisualization(String reportID, HttpServletRequest request) throws RaptorException { + //From annotations chart + clearReportRuntimeBackup(request); + + //HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest(); + final Long user_id = new Long((long) UserUtils.getUserId(request)); + //String action = request.getParameter(AppConstants.RI_ACTION); + //String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID); + + ReportHandler rh = new ReportHandler(); + ReportData reportData = null; + HashMap chartOptionsMap = new HashMap(); + try { + if(reportID !=null) { + reportRuntime = rh.loadReportRuntime(request, reportID, true, 1); + setChartType(reportRuntime.getChartType()); + reportData = reportRuntime.loadReportData(0, user_id.toString(), 10000,request, false); + } + + + + String rotateLabelsStr = ""; + rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle()); + if(rotateLabelsStr.toLowerCase().equals("standard")) { + rotateLabelsStr = "0"; + } else if (rotateLabelsStr.toLowerCase().equals("up45")) { + rotateLabelsStr = "45"; + } else if (rotateLabelsStr.toLowerCase().equals("down45")) { + rotateLabelsStr = "-45"; + } else if (rotateLabelsStr.toLowerCase().equals("up90")) { + rotateLabelsStr = "90"; + } else if (rotateLabelsStr.toLowerCase().equals("down90")) { + rotateLabelsStr = "-90"; + } else + rotateLabelsStr = "0"; + + String width = (AppUtils.getRequestNvlValue(request, "width").length()>0?AppUtils.getRequestNvlValue(request, "width"):(AppUtils.nvl(reportRuntime.getChartWidth()).length()>0?reportRuntime.getChartWidth():"700")); + String height = (AppUtils.getRequestNvlValue(request, "height").length()>0?AppUtils.getRequestNvlValue(request, "height"):(AppUtils.nvl(reportRuntime.getChartHeight()).length()>0?reportRuntime.getChartHeight():"300")); + String animationStr = (AppUtils.getRequestNvlValue(request, "animation").length()>0?AppUtils.getRequestNvlValue(request, "animation"):new Boolean(reportRuntime.isAnimateAnimatedChart()).toString()); + + String rotateLabels = (AppUtils.getRequestNvlValue(request, "rotateLabels").length()>0?AppUtils.getRequestNvlValue(request, "rotateLabels"):(rotateLabelsStr.length()>0?rotateLabelsStr:"0")); + String staggerLabelsStr = (AppUtils.getRequestNvlValue(request, "staggerLabels").length()>0?AppUtils.getRequestNvlValue(request, "staggerLabels"):"false"); + String showMaxMinStr = (AppUtils.getRequestNvlValue(request, "showMaxMin").length()>0?AppUtils.getRequestNvlValue(request, "showMaxMin"):"false"); + String showControlsStr = (AppUtils.getRequestNvlValue(request, "showControls").length()>0?AppUtils.getRequestNvlValue(request, "showControls"):new Boolean(reportRuntime.displayBarControls()).toString()); + String showLegendStr = (AppUtils.getRequestNvlValue(request, "showLegend").length()>0?AppUtils.getRequestNvlValue(request, "showLegend"):new Boolean(!new Boolean(reportRuntime.hideChartLegend())).toString()); + String topMarginStr = AppUtils.getRequestNvlValue(request, "topMargin"); + String topMargin = (AppUtils.nvl(topMarginStr).length()<=0)?(reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin().toString():"30"):topMarginStr; + String bottomMarginStr = AppUtils.getRequestNvlValue(request, "bottomMargin"); + String bottomMargin = (AppUtils.nvl(bottomMarginStr).length()<=0)?(reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin().toString():"50"):bottomMarginStr; + String leftMarginStr = AppUtils.getRequestNvlValue(request, "leftMargin"); + String leftMargin = (AppUtils.nvl(leftMarginStr).length()<=0)?(reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin().toString():"100"):leftMarginStr; + String rightMarginStr = AppUtils.getRequestNvlValue(request, "rightMargin"); + String rightMargin = (AppUtils.nvl(rightMarginStr).length()<=0)?(reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin().toString():"160"):rightMarginStr; + String showTitleStr = (AppUtils.getRequestNvlValue(request, "showTitle").length()>0?AppUtils.getRequestNvlValue(request, "showTitle"):new Boolean(reportRuntime.displayChartTitle()).toString()); + String subType = AppUtils.getRequestNvlValue(request, "subType").length()>0?AppUtils.getRequestNvlValue(request, "subType"):(AppUtils.nvl(reportRuntime.getTimeSeriesRender()).equals("area")?reportRuntime.getTimeSeriesRender():""); + String stackedStr = AppUtils.getRequestNvlValue(request, "stacked").length()>0?AppUtils.getRequestNvlValue(request, "stacked"):new Boolean(reportRuntime.isChartStacked()).toString(); + String horizontalBar = AppUtils.getRequestNvlValue(request, "horizontalBar").length()>0?AppUtils.getRequestNvlValue(request, "horizontalBar"):new Boolean(reportRuntime.isHorizontalOrientation()).toString(); + String barRealTimeAxis = AppUtils.getRequestNvlValue(request, "barRealTimeAxis"); + String barReduceXAxisLabels = AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels").length()>0?AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels"):new Boolean(reportRuntime.isLessXaxisTickers()).toString();; + String timeAxis = AppUtils.getRequestNvlValue(request, "timeAxis").length()>0?AppUtils.getRequestNvlValue(request, "timeAxis"):new Boolean(reportRuntime.isTimeAxis()).toString(); + String logScale = AppUtils.getRequestNvlValue(request, "logScale").length()>0?AppUtils.getRequestNvlValue(request, "logScale"):new Boolean(reportRuntime.isLogScale()).toString(); + String precision = AppUtils.getRequestNvlValue(request, "precision").length()>0?AppUtils.getRequestNvlValue(request, "precision"):"2"; + + + chartOptionsMap.put("width", width); + chartOptionsMap.put("height", height); + chartOptionsMap.put("animation", animationStr); + chartOptionsMap.put("rotateLabels", rotateLabels); + chartOptionsMap.put("staggerLabels", staggerLabelsStr); + chartOptionsMap.put("showMaxMin", showMaxMinStr); + chartOptionsMap.put("showControls", showControlsStr); + chartOptionsMap.put("showLegend", showLegendStr); + chartOptionsMap.put("topMargin", topMargin); + chartOptionsMap.put("bottomMargin", bottomMargin); + chartOptionsMap.put("leftMargin", leftMargin); + chartOptionsMap.put("rightMargin", rightMargin); + chartOptionsMap.put("showTitle", showTitleStr); + chartOptionsMap.put("subType", subType); + chartOptionsMap.put("stacked", stackedStr); + chartOptionsMap.put("horizontalBar", horizontalBar); + chartOptionsMap.put("timeAxis", timeAxis); + chartOptionsMap.put("barRealTimeAxis", barRealTimeAxis); + chartOptionsMap.put("barReduceXAxisLabels", barReduceXAxisLabels); + + chartOptionsMap.put("logScale", logScale); + chartOptionsMap.put("precision", precision); + + + } catch (RaptorException ex) { + ex.printStackTrace(); + } + return createVisualization(reportRuntime, chartOptionsMap, request); + } + + public String createVisualization(ReportRuntime reportRuntime, HttpServletRequest request) throws RaptorException { + + String rotateLabelsStr = ""; + rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle()); + if(rotateLabelsStr.toLowerCase().equals("standard")) { + rotateLabelsStr = "0"; + } else if (rotateLabelsStr.toLowerCase().equals("up45")) { + rotateLabelsStr = "45"; + } else if (rotateLabelsStr.toLowerCase().equals("down45")) { + rotateLabelsStr = "-45"; + } else if (rotateLabelsStr.toLowerCase().equals("up90")) { + rotateLabelsStr = "90"; + } else if (rotateLabelsStr.toLowerCase().equals("down90")) { + rotateLabelsStr = "-90"; + } else + rotateLabelsStr = "0"; + + HashMap chartOptionsMap = new HashMap(); + chartOptionsMap.put("width", reportRuntime.getChartWidth()); + chartOptionsMap.put("height", reportRuntime.getChartHeight()); + chartOptionsMap.put("animation", new Boolean(reportRuntime.isAnimateAnimatedChart()).toString()); + chartOptionsMap.put("rotateLabels", rotateLabelsStr); + chartOptionsMap.put("staggerLabels", "false"); + chartOptionsMap.put("showMaxMin", "false"); + chartOptionsMap.put("showControls", new Boolean(reportRuntime.displayBarControls()).toString()); + chartOptionsMap.put("showLegend", new Boolean(!reportRuntime.hideChartLegend()).toString()); + chartOptionsMap.put("topMargin", reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin().toString():"30"); + chartOptionsMap.put("bottomMargin", reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin().toString():"50"); + chartOptionsMap.put("leftMargin", reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin().toString():"100"); + chartOptionsMap.put("rightMargin", reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin().toString():"160"); + chartOptionsMap.put("showTitle", new Boolean(reportRuntime.displayChartTitle()).toString()); + chartOptionsMap.put("subType", (AppUtils.nvl(reportRuntime.getTimeSeriesRender()).equals("area")?reportRuntime.getTimeSeriesRender():"")); + chartOptionsMap.put("stacked", new Boolean(reportRuntime.isChartStacked()).toString()); + chartOptionsMap.put("horizontalBar", new Boolean(reportRuntime.isHorizontalOrientation()).toString()); + chartOptionsMap.put("timeAxis", new Boolean(reportRuntime.isTimeAxis()).toString()); + chartOptionsMap.put("barReduceXAxisLabels", new Boolean(reportRuntime.isLessXaxisTickers()).toString()); + + chartOptionsMap.put("logScale", new Boolean(reportRuntime.isLogScale()).toString()); + chartOptionsMap.put("precision", "2"); + + + + return createVisualization(reportRuntime, chartOptionsMap, request); + } + + public String createVisualization(ReportRuntime reportRuntime, HashMap chartOptionsMap, HttpServletRequest request) throws RaptorException { + + //String width, String height, boolean animation, String rotateLabels, boolean staggerLabels, boolean showMaxMin, boolean showLegend, boolean showControls, String topMargin, String bottomMargin, boolean showTitle, String subType + + String width = chartOptionsMap.get("width"); + String height = chartOptionsMap.get("height"); + boolean animation = getBooleanValue(chartOptionsMap.get("animation"), true); + String rotateLabels = chartOptionsMap.get("rotateLabels"); + boolean staggerLabels = getBooleanValue(chartOptionsMap.get("staggerLabels")); + boolean showMaxMin = getBooleanValue(chartOptionsMap.get("showMaxMin"), false); + boolean showLegend = getBooleanValue(chartOptionsMap.get("showLegend"), true); + boolean showControls = getBooleanValue(chartOptionsMap.get("showControls"), true); + String topMargin = chartOptionsMap.get("topMargin"); + String bottomMargin = chartOptionsMap.get("bottomMargin"); + String leftMargin = chartOptionsMap.get("leftMargin"); + String rightMargin = chartOptionsMap.get("rightMargin"); + boolean showTitle = getBooleanValue(chartOptionsMap.get("showTitle"), true); + String subType = chartOptionsMap.get("subType"); + boolean stacked = getBooleanValue(chartOptionsMap.get("stacked"), false); + boolean horizontalBar = getBooleanValue(chartOptionsMap.get("horizontalBar"), false); + boolean barRealTimeAxis = getBooleanValue(chartOptionsMap.get("barRealTimeAxis"), true); + boolean barReduceXAxisLabels= getBooleanValue(chartOptionsMap.get("barReduceXAxisLabels"), false); + boolean timeAxis = getBooleanValue(chartOptionsMap.get("timeAxis"), true); + + + boolean logScale = getBooleanValue(chartOptionsMap.get("logScale"), false); + + int precision = 2; + + try { + precision = Integer.parseInt(chartOptionsMap.get("precision")); + } catch (NumberFormatException ex) { + + } + + final Long user_id = new Long((long) UserUtils.getUserId(request)); + + HttpSession session = null; + session = request.getSession(); + + String chartType = reportRuntime.getChartType(); + List l = reportRuntime.getAllColumns(); + List lGroups = reportRuntime.getAllChartGroups(); + HashMap mapYAxis = reportRuntime.getAllChartYAxis(reportRuntime.getReportParamValues()); + //ReportParamValues reportParamValues = reportRuntime.getReportParamValues(); + String chartLeftAxisLabel = reportRuntime.getFormFieldFilled(nvl(reportRuntime.getChartLeftAxisLabel())); + String chartRightAxisLabel = reportRuntime.getFormFieldFilled(nvl(reportRuntime.getChartRightAxisLabel())); + + boolean multipleSeries = reportRuntime.isMultiSeries(); + + java.util.HashMap formValues = null; + formValues = getRequestParametersMap(reportRuntime, request); + + + String legendColumnName = (reportRuntime.getChartLegendColumn()!=null)?reportRuntime.getChartLegendColumn().getDisplayName():"Legend Column"; + boolean displayChart = (nvl(chartType).length()>0)&&reportRuntime.getDisplayChart(); + HashMap additionalChartOptionsMap = new HashMap(); + + StringBuffer wholeScript = new StringBuffer(""); + + String title = reportRuntime.getReportTitle(); + + title = parseTitle(title, formValues); + + if(displayChart) { + DataSet ds = null; + try { + if (!(chartType.equals(AppConstants.GT_HIERARCHICAL) || chartType.equals(AppConstants.GT_HIERARCHICAL_SUNBURST) || chartType.equals(AppConstants.GT_ANNOTATION_CHART))) { + ds = (DataSet) loadChartData(new Long(user_id).toString(), request); + } else if(chartType.equals(AppConstants.GT_ANNOTATION_CHART)) { + String reportSQL = reportRuntime.getWholeSQL(); + String dbInfo = reportRuntime.getDBInfo(); + ds = ConnectionUtils.getDataSet(reportSQL, dbInfo); + if(ds.getRowCount()<=0) { + logger.debug(EELFLoggerDelegate.debugLogger, ("********************************************************************************")); + logger.debug(EELFLoggerDelegate.debugLogger, (chartType.toUpperCase()+" - " + "Report ID : " + reportRuntime.getReportID() + " DATA IS EMPTY")); + logger.debug(EELFLoggerDelegate.debugLogger, ("QUERY - " + reportSQL)); + logger.debug(EELFLoggerDelegate.debugLogger, ("********************************************************************************")); + } + } else if(chartType.equals(AppConstants.GT_HIERARCHICAL)||chartType.equals(AppConstants.GT_HIERARCHICAL_SUNBURST)) { + String reportSQL = reportRuntime.getWholeSQL(); + String dbInfo = reportRuntime.getDBInfo(); + ds = ConnectionUtils.getDataSet(reportSQL, dbInfo); + } + } catch (RaptorException ex) { + //throw new RaptorException("Error while loading chart data", ex); + logger.error(EELFLoggerDelegate.debugLogger, ("********************************************************************************")); + logger.error(EELFLoggerDelegate.debugLogger, (chartType.toUpperCase()+" - " + "Report ID : " + reportRuntime.getReportID() + " ERROR THROWN FOR GIVEN QUERY ")); + logger.error(EELFLoggerDelegate.debugLogger, ("QUERY - " + reportRuntime.getWholeSQL())); + logger.error(EELFLoggerDelegate.debugLogger, ("ERROR STACK TRACE" + ex.getMessage())); + logger.error(EELFLoggerDelegate.debugLogger, ("********************************************************************************")); + + } + if(ds==null) { + //displayChart = false; + if(chartType.equals(AppConstants.GT_ANNOTATION_CHART)) + ds = new DataSet(); + else + displayChart = false; + } + if(displayChart) { + + if (chartType.equals(AppConstants.GT_BAR_3D)) { + + // get category if not give the column name for the data column use this to develop series. + boolean hasCategoryAxis = reportRuntime.hasSeriesColumn(); + + boolean hasCustomizedChartColor = false; + int flag = 0; + flag = hasCategoryAxis?1:0; + Object uniqueElements [] = null; + ArrayList uniqueElementsList = new ArrayList(); + Object uniqueXAxisElements[] = null; + ArrayList ts = new ArrayList(); + //Set ts1 = new HashSet(); + ArrayList ts1 = new ArrayList(); + HashMap columnMap = new HashMap(); + String uniqueXAxisStr = ""; + if(!timeAxis){ + for (int i = 0; i < ds.getRowCount(); i++) { + uniqueXAxisStr = ds.getString(i, 0); + ts1.add(uniqueXAxisStr); + } + } + uniqueElementsList.addAll(ts1); + uniqueXAxisElements = ts1.toArray(); + + if(flag == 1) { + StringBuffer catStr = new StringBuffer(""); + String color=""; + for (int i = 0; i < ds.getRowCount(); i++) { + catStr = new StringBuffer(""); + catStr.append(ds.getString(i, 2)); + try { + if(ds.getString(i, "chart_color")!=null) { + color = ds.getString(i, "chart_color"); + hasCustomizedChartColor = true; + catStr.append("|"+color); + } + } catch (ArrayIndexOutOfBoundsException ex) { + //System.out.println("No Chart Color"); + } + + if(catStr.length()>0) { + //duplicates are avoided + if(!ts.contains(catStr.toString())) + ts.add(catStr.toString()); + + } + /* Get Chart LeftAxis Label even from Range Axis definition. */ + DataColumnType dct = null; + for (Iterator iter = l.iterator(); iter.hasNext();) { + dct = (DataColumnType) iter.next(); + if(!(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))) { + if(nvl(chartLeftAxisLabel).length()<=0) { + chartLeftAxisLabel = nvl(dct.getYAxis()); + chartLeftAxisLabel = (chartLeftAxisLabel.indexOf("|")!=-1)?chartLeftAxisLabel.substring(0,chartLeftAxisLabel.indexOf("|")):""; + } + } + } + + } + //Object uniqueElements [] = ts.toArray(); + //SortedSet s = Collections.synchronizedSortedSet(ts); + uniqueElements = ts.toArray(); + } else { + DataColumnType dct = null; + List yTextSeries = reportRuntime.getChartDisplayNamesList(AppConstants.CHART_ALL_COLUMNS, formValues); + //if(columnValuesList.size() == 1) { + for (Iterator iter = l.iterator(); iter.hasNext();) { + dct = (DataColumnType) iter.next(); + + if(!(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))) { + if((dct.isChartSeries()!=null && dct.isChartSeries().booleanValue()) || (dct.getChartSeq()!=null && dct.getChartSeq()>0) ) { + + if(nvl(dct.getChartColor()).length()>0) hasCustomizedChartColor = true; + if(hasCustomizedChartColor) { + //duplicates are avoided + if(!ts.contains(dct.getDisplayName()+"|"+nvl(dct.getChartColor()))) + ts.add(dct.getDisplayName()+"|"+nvl(dct.getChartColor())); + } else { + //duplicates are avoided + if(!ts.contains(dct.getDisplayName())) + ts.add(dct.getDisplayName()); + } + if(nvl(chartLeftAxisLabel).length()<=0) { + chartLeftAxisLabel = nvl(dct.getYAxis()); + chartLeftAxisLabel = (chartLeftAxisLabel.indexOf("|")!=-1)?chartLeftAxisLabel.substring(0,chartLeftAxisLabel.indexOf("|")):""; + } + columnMap.put(dct.getDisplayName(), dct.getColId()); + /* + ts.add(dct.getDisplayName()); + if(nvl(chartLeftAxisLabel).length()<=0) { + chartLeftAxisLabel = nvl(dct.getYAxis()); + chartLeftAxisLabel = (chartLeftAxisLabel.indexOf("|")!=-1)?chartLeftAxisLabel.substring(0,chartLeftAxisLabel.indexOf("|")):""; + } + columnMap.put(dct.getDisplayName(), dct.getColId()); + */ + } + } + + } + //SortedSet s = Collections.synchronizedSortedSet(ts); + uniqueElements = ts.toArray(); + + } + + wholeScript.append("\n"); + wholeScript.append("\n"); + wholeScript.append("\n"); + wholeScript.append("\n"); + wholeScript.append("\n"); + //wholeScript.append("") + wholeScript.append(" \n" ); + wholeScript.append(" \n"); + if(showTitle) + wholeScript.append("

    " + title +"

    "); + + wholeScript.append("
    \n"); + //js files + wholeScript.append(""); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + //wholeScript.append(" \n"); + //wholeScript.append(" \n"); + wholeScript.append(" \n"); + //json + wholeScript.append(" \n"); + + } else if (chartType.equals(AppConstants.GT_TIME_SERIES)) { + + // get category if not give the column name for the data column use this to develop series. + boolean hasCategoryAxis = reportRuntime.hasSeriesColumn(); + + + final int YEARFLAG = 1; + final int MONTHFLAG = 2; + final int DAYFLAG = 3; + final int HOURFLAG = 4; + final int MINFLAG = 5; + final int SECFLAG = 6; + final int MILLISECFLAG = 7; + final int DAYOFTHEWEEKFLAG = 8; + final int FLAGDATE = 9; + + int flag = 0; + flag = hasCategoryAxis?1:0; + String uniqueElements [] = null; + //TreeSet ts = new TreeSet(); + ArrayList ts = new ArrayList(); + HashMap columnMap = new HashMap(); + //check timeAxis + String dateStr = null; + java.util.Date date = null; + if( ds.getRowCount() > 0) { + dateStr = ds.getString(0, 1); + if(!timeAxis) { + date = getDateFromDateStr(dateStr); + if(date!=null) { + reportRuntime.setTimeAxis(true); + timeAxis = reportRuntime.isTimeAxis(); + + + } + } + } + + ArrayList ts1 = new ArrayList(); + ArrayList uniqueElementsList = new ArrayList(); + Object uniqueXAxisElements[] = null; + String uniqueXAxisStr = ""; + if(!timeAxis){ + for (int i = 0; i < ds.getRowCount(); i++) { + uniqueXAxisStr = ds.getString(i, 0); + ts1.add(uniqueXAxisStr); + } + } + uniqueElementsList.addAll(ts1); + uniqueXAxisElements = ts1.toArray(); + //test start + /* int TOTAL = 0; + int VALUE = 0; + int flagNull = 0; + String KEY = ""; + String COLOR = ""; + TreeSet colorList = new TreeSet(); + for (int i = 0; i < ds.getRowCount(); i++) { + VALUE = 0; + try { + VALUE = Integer.parseInt(ds.getString(i, 2)); + TOTAL = TOTAL+VALUE; + } catch (NumberFormatException ex) { + flagNull = 1; + } + KEY = ds.getString(i, 0); + try { + if(ds.getString(i, "chart_color")!=null) { + colorList.add(KEY+"|"+ds.getString(i, "chart_color")); + } + } catch (ArrayIndexOutOfBoundsException ex) { + System.out.println("No Chart Color"); + } + wholeScript.append("{ \""+ "key" +"\":\""+ KEY+"\", \""+ "y" +"\":"+VALUE+"}, \n"); + + } + StringBuffer color = new StringBuffer(""); + if(colorList.size()>0) { + SortedSet s = Collections.synchronizedSortedSet(colorList); + Object[] colorElements = (Object[]) s.toArray(); + + String element = ""; + + for (int i = 0; i < colorElements.length; i++) { + element = ((String)colorElements[i]); + color.append("'"+element.substring(element.indexOf("|")+1)+"',"); + } + color.deleteCharAt(color.length()-1); + }*/ + + //test end + boolean hasCustomizedChartColor = false; + if(flag == 1) { + StringBuffer catStr = new StringBuffer(""); + String color=""; + for (int i = 0; i < ds.getRowCount(); i++) { + catStr = new StringBuffer(""); + catStr.append(ds.getString(i, 2)); + try { + if(ds.getString(i, "chart_color")!=null) { + color = ds.getString(i, "chart_color"); + hasCustomizedChartColor = true; + catStr.append("|"+color); + } + } catch (ArrayIndexOutOfBoundsException ex) { + //System.out.println("No Chart Color"); + } + + if(catStr.length()>0) { + //duplicates are avoided + if(!ts.contains(catStr.toString())) + ts.add(catStr.toString()); + + } + } + //Object uniqueElements [] = ts.toArray(); + //SortedSet s = Collections.synchronizedSortedSet(ts); + //uniqueElements = (String[]) ts.toArray(); + DataColumnType dct = null; + List yTextSeries = reportRuntime.getChartDisplayNamesList(AppConstants.CHART_ALL_COLUMNS, formValues); + if(yTextSeries.size()==1) { + for (Iterator iter = l.iterator(); iter.hasNext();) { + dct = (DataColumnType) iter.next(); + //System.out.println(dct.getDisplayName() + " " + yText); + if(!(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))) { + if(nvl(chartLeftAxisLabel).length()<=0) { + chartLeftAxisLabel = nvl(dct.getYAxis()); + chartLeftAxisLabel = (chartLeftAxisLabel.indexOf("|")!=-1)?chartLeftAxisLabel.substring(0,chartLeftAxisLabel.indexOf("|")):""; + } + } + } + } + Object tempArray[] = ts.toArray(); + uniqueElements = Arrays.copyOf(tempArray, tempArray.length, String[].class); + + } else { + DataColumnType dct = null; + + List yTextSeries = reportRuntime.getChartDisplayNamesList(AppConstants.CHART_ALL_COLUMNS, formValues); + //if(columnValuesList.size() == 1) { + int dctIndex = 0; + for (Iterator iter = l.iterator(); iter.hasNext();) { + dct = (DataColumnType) iter.next(); + //System.out.println(dct.getDisplayName() + " " + yText); + if(!(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))) { + if(yTextSeries.contains((String)dct.getDisplayName())) { + if(nvl(dct.getChartColor()).length()>0) hasCustomizedChartColor = true; + if(hasCustomizedChartColor) { + //duplicates are avoided + if(!ts.contains(dct.getDisplayName()+"|"+nvl(dct.getChartColor()))) + ts.add(dct.getDisplayName()+"|"+nvl(dct.getChartColor())); + } else { + //duplicates are avoided + if(!ts.contains(dct.getDisplayName())) + ts.add(dct.getDisplayName()); + } + if(nvl(chartLeftAxisLabel).length()<=0) { + chartLeftAxisLabel = nvl(dct.getYAxis()); + chartLeftAxisLabel = (chartLeftAxisLabel.indexOf("|")!=-1)?chartLeftAxisLabel.substring(0,chartLeftAxisLabel.indexOf("|")):""; + } + if(nvl(chartRightAxisLabel).length()>0) { + String dctYAxis = nvl(dct.getYAxis()); + String yAxis = (dctYAxis.indexOf("|")!=-1)?dctYAxis.substring(0,dctYAxis.indexOf("|")):dctYAxis; + if(chartRightAxisLabel.equals(yAxis)) { + if(ts.contains(dct.getDisplayName())) { + if(hasCustomizedChartColor) { + ts.set(dctIndex, dct.getDisplayName()+"|R|"+nvl(dct.getChartColor())); + } else { + ts.set(dctIndex, dct.getDisplayName()+"|R"); + } + } + } + } + columnMap.put(dct.getDisplayName(), dct.getColId()); + } + dctIndex++; + } + + } + + //SortedSet s = Collections.synchronizedSortedSet(ts); + Object tempArray[] = ts.toArray(); + uniqueElements = Arrays.copyOf(tempArray, tempArray.length, String[].class); + //uniqueElements = (String[]) ts.toArray(); + + } + + wholeScript.append("\n"); + wholeScript.append("\n"); + wholeScript.append("\n"); + wholeScript.append("\n"); + wholeScript.append("\n"); + wholeScript.append(" \n" ); + + wholeScript.append(" \n"); + + if(showTitle) + wholeScript.append("

    " + title +"

    "); + + + wholeScript.append("
    \n"); + //js files + wholeScript.append("\n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + //wholeScript.append(" \n"); + //if(multipleSeries) + //wholeScript.append(" \n"); + + //json + wholeScript.append(" \n"); + + } else if (chartType.equals(AppConstants.GT_PIE) || chartType.equals(AppConstants.GT_PIE_3D)) { + wholeScript.append("\n"); + wholeScript.append("\n"); + wholeScript.append("\n"); + wholeScript.append("\n"); + wholeScript.append("\n"); + wholeScript.append(" \n" ); + wholeScript.append(" \n"); + + if(showTitle) + wholeScript.append("

    " + title +"

    "); + + wholeScript.append("
    "); + //"\n"); + //js files + wholeScript.append("\n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + + } else if (chartType.equals(AppConstants.GT_ANNOTATION_CHART) || chartType.equals(AppConstants.GT_FLEX_TIME_CHARTS)) { + + boolean timeCharts = chartType.equals(AppConstants.GT_FLEX_TIME_CHARTS); + + String dateStr = null; + java.util.Date date = null; + + final int YEARFLAG = 1; + final int MONTHFLAG = 2; + final int DAYFLAG = 3; + final int HOURFLAG = 4; + final int MINFLAG = 5; + final int SECFLAG = 6; + final int MILLISECFLAG = 7; + final int DAYOFTHEWEEKFLAG = 8; + final int FLAGDATE = 9; + + int flagNoDate = 0; + + int MAXNUM = 0; + int YAXISNUM = 0; + int flagNull = 0; + + double YAXISDOUBLENUM = 0.0; + double MAXDOUBLENUM = 0.0; + int MAXNUMDECIMALPLACES = 0; + + int formatFlag = 0; + + TreeSet dateStrList = new TreeSet(); + // added to store all date elements + SortedSet sortSet = new TreeSet(); + int count = 0; + + int flag = 0; + boolean hasCategoryAxis = reportRuntime.hasSeriesColumn(); + flag = hasCategoryAxis?1:0; + + + String anomalyText = ""; + + StringBuffer dataStrBuf = new StringBuffer(""); + StringBuffer annotationsStrBuf = new StringBuffer(""); + + String xAxisLabel = (reportRuntime.getChartLegendColumn()!=null)?reportRuntime.getChartLegendColumn().getDisplayName():""; + + //finding actual string + String actualText = ""; + DataColumnType dct = null; + for (Iterator iter = l.iterator(); iter.hasNext();) { + dct = (DataColumnType) iter.next(); + if((dct.getChartSeq()!=null && dct.getChartSeq() >=0) && !AppUtils.nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND)) { + //if(AppUtils.nvl(dct.getDisplayName()).toLowerCase().contains("actual")) { + actualText = dct.getDisplayName(); + break; + //} + } + } + + int anomalyRec = 0; + int columnIndex = 1; + ArrayList columnNames = new ArrayList(); + ArrayList columnValues = new ArrayList(); + Set set = null; + String columnName = ""; + String columnValue = ""; + long minDate = 0L; + long maxDate = 0L; + StringBuffer seriesBuffer = new StringBuffer(""); + + for (int i = 0; i < ds.getRowCount(); i++) { + columnNames = new ArrayList(); + columnValues = new ArrayList(); + columnName = ""; + columnValue = ""; + columnIndex = 1; + anomalyText = ""; + dateStr = ds.getString(i, 0); + date = getDateFromDateStr(dateStr); + if(date.getTime() > maxDate ) + maxDate = date.getTime(); + + formatFlag = getFlagFromDateStr(dateStr); + + + for (;columnIndex=0) && !AppUtils.nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND)) { + if((!timeCharts && !AppUtils.nvl(dct.getColId()).toLowerCase().equals("anomaly_text")) && AppUtils.nvl(dct.getColId()).toLowerCase().equals(columnName.toLowerCase())) { + dataStrBuf.append(","+columnValue); + break; + } else if(timeCharts && AppUtils.nvl(dct.getColId()).toLowerCase().equals(columnName.toLowerCase())){ + dataStrBuf.append(","+columnValue); + //break; + } + } + } + } + + dataStrBuf.append("],\n"); + if(!timeCharts) { + if(AppUtils.nvl(anomalyText).length()>0) { + ++anomalyRec; + annotationsStrBuf.append("anns.push( {\n"); + annotationsStrBuf.append(" series: '"+actualText+"',\n"); + annotationsStrBuf.append(" x: moment(\""+dateStr+"\"),\n"); + annotationsStrBuf.append(" shortText: '"+ IntToLetter(anomalyRec).toUpperCase() +"',\n"); + annotationsStrBuf.append(" text: '"+ anomalyText + "'\n"); + annotationsStrBuf.append("});\n"); + //anomalyRec++; + } + + } + } + + //if(!timeCharts) + //anomalyRec = anomalyRec - 1; + + minDate = maxDate - (new Long(reportRuntime.getZoomIn()).longValue()*60*60*1000); + System.out.println(new java.util.Date(maxDate) + " " + new java.util.Date(minDate) + " " + reportRuntime.getZoomIn()); + if(dataStrBuf.lastIndexOf(",")!= -1) + dataStrBuf.deleteCharAt(dataStrBuf.lastIndexOf(",")); + + wholeScript = new StringBuffer(""); + wholeScript.append("\n"); + wholeScript.append("\n"); + wholeScript.append(" \n"); + //wholeScript.append("\n"); + wholeScript.append("\n"); + wholeScript.append("\n"); + wholeScript.append("\n"); + wholeScript.append("\n"); + + wholeScript.append("\n "); + wholeScript.append("\n"); + wholeScript.append("\n"); + wholeScript.append(" \n"); + +/* if(showTitle) + wholeScript.append("

    " + (AppUtils.nvl(reportRuntime.getReportTitle()).length()>0?reportRuntime.getReportTitle():reportRuntime.getReportName()) + "

    \n"); +*/ + wholeScript.append(" \n"); + if(showTitle) { + wholeScript.append(" \n "); + wholeScript.append(" \n "); + } + + wholeScript.append(" \n "); + + wholeScript.append(" \n "); + wholeScript.append(" \n "); + + wholeScript.append(" \n "); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + if(AppUtils.nvl(reportRuntime.getLegendPosition()).length()>=0 && reportRuntime.getLegendPosition().equals("right")) { + wholeScript.append(" \n"); + } + wholeScript.append(" \n"); + if(anomalyRec > 0) { + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + } + wholeScript.append("
    \n "); + wholeScript.append("
    "+title+"
    \n"); + wholeScript.append("
    \n "); + if(AppUtils.nvl(reportRuntime.getLegendPosition()).length()<=0 || reportRuntime.getLegendPosition().equals("top")) { + wholeScript.append("
    \n"); + } + wholeScript.append("
    \n"); + wholeScript.append("
    \n"); + + int heightInt = 0; + if(nvl(height).length() > 0) { + try { + heightInt = new Integer(height).intValue(); + heightInt -= 50; + } catch(Exception ex) { + if(height.endsWith("px")) { + try { + heightInt = new Integer(height.substring(0, height.indexOf("px"))); + heightInt -= 50; + } catch (Exception ex1) { + heightInt = 420; + } + } else { + heightInt = 420; + } + } + } else heightInt = 420; + if(AppUtils.nvl(reportRuntime.getLegendPosition()).length()>=0 && reportRuntime.getLegendPosition().equals("right")) { + wholeScript.append("
    \n"); + wholeScript.append("
    \n"); + wholeScript.append("
    \n"); + wholeScript.append("
    \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n" ); + wholeScript.append(" \n"); + wholeScript.append("
    Anomaly Description
    \n"); + wholeScript.append("
    \n"); + + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(""); + + + } else if (chartType.equals(AppConstants.GT_SCATTER)) { + + wholeScript.append("\n"); + wholeScript.append(" \n" ); + wholeScript.append(" \n"); + wholeScript.append("
    "); + //js files + wholeScript.append("\n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append(" \n"); + wholeScript.append("\n"); + } else if (chartType.equals(AppConstants.GT_HIERARCHICAL_SUNBURST)) { + + StringBuffer dataStr = new StringBuffer(""); + StringBuffer groupBuffer = new StringBuffer(""); + StringBuffer s = new StringBuffer(""); + dataStr.append("{"); + dataStr.append(" \"ss4262\":{\n"); + String mid = ""; + String mid_old = ""; + String level = "-1"; + String level_old = "-1"; + String eid = ""; + for (int i = 0; i < ds.getRowCount(); i++) { + mid = ds.getString(i, "mid"); + level = ds.getString(i, "level1"); + eid = ds.getString(i, "eid"); + if(mid.equals(mid_old)) { + dataStr.append("\""+ eid +"\": 9956,\n"); + } else { + if(dataStr.lastIndexOf(",")!= -1) + dataStr.deleteCharAt(dataStr.lastIndexOf(",")); + //if(Integer.parseInt(level_old)==Integer.parseInt(level)) + //dataStr.append("},\n"); + if (Integer.parseInt(level_old)0) { + /*sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl( + paramValue, "NULL"));*/ + reportSQL = Utils.replaceInString(reportSQL, fieldDisplay, nvl( + paramValue, "NULL")); + } + /*sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl( + paramValue, "NULL"));*/ + reportSQL = Utils.replaceInString(reportSQL, "'" + fieldDisplay + "'", nvl( + paramValue, "NULL")); + reportSQL = Utils.replaceInString(reportSQL, fieldDisplay , nvl( + paramValue, "NULL")); + } + } + logger.debug(EELFLoggerDelegate.debugLogger, ("SQL " + reportSQL)); + String legendCol = "1 a"; + // String valueCol = "1"; + StringBuffer groupCol = new StringBuffer(); + StringBuffer seriesCol = new StringBuffer(); + StringBuffer valueCols = new StringBuffer(); + + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + String colName = getColumnSelectStr(dc, request); + if (nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND)) + legendCol = getSelectExpr(dc, colName)+" " + dc.getColId(); + // if(dc.getChartSeq()>0) + // valueCol = "NVL("+colName+", 0) "+dc.getColId(); + if ((!nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND)) + && (dc.getChartSeq()!=null && dc.getChartSeq().intValue() <= 0) && dc.isGroupBreak()) { + groupCol.append(", "); + groupCol.append(colName + " " + dc.getColId()); + } + } // for + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if(dc.isChartSeries()!=null && dc.isChartSeries().booleanValue()) { + //System.out.println("*****************, "+ " " +getColumnSelectStr(dc, paramValues)+ " "+ getSelectExpr(dc,getColumnSelectStr(dc, paramValues))); + seriesCol.append(", "+ getSelectExpr(dc,getColumnSelectStr(dc, request))+ " " + dc.getColId()); + } + } + + /*for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if(!dc.isChartSeries() && !(nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))) { + //System.out.println("*****************, "+ " " +getColumnSelectStr(dc, paramValues)+ " "+ getSelectExpr(dc,getColumnSelectStr(dc, paramValues))); + seriesCol.append(", "+ formatChartColumn(getSelectExpr(dc,getColumnSelectStr(dc, paramValues)))+ " " + dc.getColId()); + } + }*/ + + for (Iterator iter = chartValueCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + String colName = getColumnSelectStr(dc, request); + String paramValue = ""; + if(AppUtils.nvl(colName).startsWith("[")) { + if (reportRuntime.getFormFieldList() != null) { + for (Iterator iterC = reportRuntime.getFormFieldList().getFormField().iterator(); iterC.hasNext();) { + FormFieldType fft = (FormFieldType) iterC.next(); + String fieldId = fft.getFieldId(); + String fieldDisplay = reportRuntime.getFormFieldDisplayName(fft); + String formfield_value = ""; + if(AppUtils.nvl(fieldDisplay).equals(colName)) { + formfield_value = AppUtils.getRequestNvlValue(request, fieldId); + paramValue = nvl(formfield_value); + } + } + + } + + seriesCol.append("," + (AppUtils.nvl(paramValue).length()>0? paramValue:"null") + " " + dc.getColId()); + } else { + //valueCols.append(", NVL(" + formatChartColumn(colName) + ",0) " + dc.getColId()); + seriesCol.append("," + (AppUtils.nvl(paramValue).length()>0? paramValue:formatChartColumn(colName)) + " " + dc.getColId()); + } + } // for + + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + String colName = dc.getDisplayName(); + String colValue = getColumnSelectStr(dc, request); + //String colName = getColumnSelectStr(dc, formGrid); + if(colName.equals(AppConstants.RI_CHART_TOTAL_COL)) + seriesCol.append(", " + AppConstants.RI_CHART_TOTAL_COL + " " + AppConstants.RI_CHART_TOTAL_COL ); + if (colName.equals(AppConstants.RI_CHART_COLOR)) + seriesCol.append(", " + colValue + " " + AppConstants.RI_CHART_COLOR ); + if(colName.equals(AppConstants.RI_CHART_MARKER_START)) + seriesCol.append(", " + AppConstants.RI_CHART_MARKER_START + " " + AppConstants.RI_CHART_MARKER_START ); + if(colName.equals(AppConstants.RI_CHART_MARKER_END)) + seriesCol.append(", " + AppConstants.RI_CHART_MARKER_END + " " + AppConstants.RI_CHART_MARKER_END ); + if(colName.equals(AppConstants.RI_CHART_MARKER_TEXT_LEFT)) + seriesCol.append(", " + AppConstants.RI_CHART_MARKER_TEXT_LEFT + " " + AppConstants.RI_CHART_MARKER_TEXT_LEFT ); + if(colName.equals(AppConstants.RI_CHART_MARKER_TEXT_RIGHT)) + seriesCol.append(", " + AppConstants.RI_CHART_MARKER_TEXT_RIGHT + " " + AppConstants.RI_CHART_MARKER_TEXT_RIGHT ); + //if(colName.equals(AppConstants.RI_ANOMALY_TEXT)) + //seriesCol.append(", " + AppConstants.RI_ANOMALY_TEXT + " " + AppConstants.RI_ANOMALY_TEXT ); + } + + //debugLogger.debug("ReportSQL Chart " + reportSQL ); + /*for (Iterator iter = chartValueCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + String colName = getColumnSelectStr(dc, paramValues); + //valueCols.append(", NVL(" + formatChartColumn(colName) + ",0) " + dc.getColId()); + valueCols.append("," + formatChartColumn(colName) + " " + dc.getColId()); + } // for + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + String colName = getColumnSelectStr(dc, paramValues); + //if(colName.equals(AppConstants.RI_CHART_TOTAL_COL) || colName.equals(AppConstants.RI_CHART_COLOR)) { + if(colName.equals(AppConstants.RI_CHART_TOTAL_COL)) + valueCols.append(", " + AppConstants.RI_CHART_TOTAL_COL + " " + AppConstants.RI_CHART_TOTAL_COL ); + if (colName.equals(AppConstants.RI_CHART_COLOR)) + valueCols.append(", " + AppConstants.RI_CHART_COLOR + " " + AppConstants.RI_CHART_COLOR ); + if (colName.equals(AppConstants.RI_CHART_INCLUDE)) + valueCols.append(", " + AppConstants.RI_CHART_INCLUDE + " " + AppConstants.RI_CHART_INCLUDE ); + //} + }*/ + String final_sql = ""; + reportSQL = Utils.replaceInString(reportSQL, " from ", " FROM "); + reportSQL = Utils.replaceInString(reportSQL, " From ", " FROM "); + reportSQL = Utils.replaceInString(reportSQL, " select ", " SELECT "); + reportSQL = Utils.replaceInString(reportSQL, " union ", " UNION "); + //reportSQL = reportSQL.replaceAll("[\\s]*\\(", "("); +// if(reportSQL.indexOf("UNION") != -1) { +// if(reportSQL.indexOf("FROM(")!=-1) +// final_sql += " "+reportSQL.substring(reportSQL.indexOf("FROM(") ); +// else if (reportSQL.indexOf("FROM (")!=-1) +// final_sql += " "+reportSQL.substring(reportSQL.indexOf("FROM (") ); +// //TODO ELSE THROW ERROR +// } +// else { +// final_sql += " "+reportSQL.substring(reportSQL.toUpperCase().indexOf(" FROM ")); +// } + int pos = 0; + int pos_first_select = 0; + int pos_dup_select = 0; + int pos_prev_select = 0; + int pos_last_select = 0; + if (reportSQL.indexOf("FROM", pos)!=-1) { + pos = reportSQL.indexOf("FROM", pos); + pos_dup_select = reportSQL.lastIndexOf("SELECT",pos); + pos_first_select = reportSQL.indexOf("SELECT");//,pos); + logger.debug(EELFLoggerDelegate.debugLogger, ("pos_select " + pos_first_select + " " + pos_dup_select)); + if(pos_dup_select > pos_first_select) { + logger.debug(EELFLoggerDelegate.debugLogger, ("********pos_dup_select ********" + pos_dup_select)); + //pos_dup_select1 = pos_dup_select; + pos_prev_select = pos_first_select; + pos_last_select = pos_dup_select; + while (pos_last_select > pos_prev_select) { + logger.debug(EELFLoggerDelegate.debugLogger, ("pos_last , pos_prev " + pos_last_select + " " + pos_prev_select)); + pos = reportSQL.indexOf("FROM", pos+2); + pos_prev_select = pos_last_select; + pos_last_select = reportSQL.lastIndexOf("SELECT",pos); + logger.debug(EELFLoggerDelegate.debugLogger, ("in WHILE LOOP LAST " + pos_last_select)); + } + } + + } + final_sql += " "+reportSQL.substring(pos); + logger.debug(EELFLoggerDelegate.debugLogger, ("Final SQL " + final_sql)); + String sql = "SELECT " + legendCol + ", " + legendCol+"_1" + seriesCol.toString()+ nvl(valueCols.toString(), ", 1") + + groupCol.toString() + + final_sql; + logger.debug(EELFLoggerDelegate.debugLogger, ("Final sql in generateChartSQL " +sql)); + + return sql; + } // generateChartSQL + + private String getColumnSelectStr(DataColumnType dc, HttpServletRequest request) { + //String colName = dc.isCalculated() ? dc.getColName() + // : ((nvl(dc.getTableId()).length() > 0) ? (dc.getTableId() + "." + dc + // .getColName()) : dc.getColName()); + String colName = dc.getColName(); + String paramValue = null; + //if (dc.isCalculated()) { + if (reportRuntime.getFormFieldList() != null) { + for (Iterator iter = reportRuntime.getFormFieldList().getFormField().iterator(); iter.hasNext();) { + FormFieldType fft = (FormFieldType) iter.next(); + String fieldId = fft.getFieldId(); + String fieldDisplay = reportRuntime.getFormFieldDisplayName(fft); + String formfield_value = ""; + formfield_value = AppUtils.getRequestNvlValue(request, fieldId); + paramValue = nvl(formfield_value); + if(paramValue.length()>0) { + /*sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl( + paramValue, "NULL"));*/ + colName = Utils.replaceInString(colName, "'" + fieldDisplay + "'", "'"+nvl( + paramValue, "NULL")+"'"); + colName = Utils.replaceInString(colName, fieldDisplay, nvl( + paramValue, "NULL")); + } + } + return colName; + } + //} + return colName; + } // getColumnSelectStr + + + + public String getSelectExpr(DataColumnType dct) { + // String colName = + // dct.isCalculated()?dct.getColName():((nvl(dct.getTableId()).length()>0)?(dct.getTableId()+"."+dct.getColName()):dct.getColName()); + return getSelectExpr(dct, dct.getColName() /* colName */); + } // getSelectExpr + + private String getSelectExpr(DataColumnType dct, String colName) { + String colType = dct.getColType(); + if (colType.equals(AppConstants.CT_CHAR) + || ((nvl(dct.getColFormat()).length() == 0) && (!colType + .equals(AppConstants.CT_DATE)))) + return colName; + else + return "DATE_FORMAT(" + colName + ", '" + + nvl(dct.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT) + "')"; + } // getSelectExpr + + private String formatChartColumn(String colName) { + logger.debug(EELFLoggerDelegate.debugLogger, ("Format Chart Column Input colName " + colName)); + colName = colName.trim(); + colName = Utils.replaceInString(colName, "TO_CHAR", "to_char"); + colName = Utils.replaceInString(colName, "to_number", "TO_NUMBER"); + //reportSQL = reportSQL.replaceAll("[\\s]*\\(", "("); + colName = colName.replaceAll(",[\\s]*\\(", ",("); + StringBuffer colNameBuf = new StringBuffer(colName); + int pos = 0, posFormatStart = 0, posFormatEnd = 0; + String format = ""; + + if(colNameBuf.indexOf("999")==-1 && colNameBuf.indexOf("990")==-1) { + logger.debug(EELFLoggerDelegate.debugLogger, (" return colName " + colNameBuf.toString())); + return colNameBuf.toString(); + } + + while (colNameBuf.indexOf("to_char")!=-1) { + if(colNameBuf.indexOf("999")!=-1 || colNameBuf.indexOf("990")!=-1) { + pos = colNameBuf.indexOf("to_char"); + colNameBuf.insert(pos, " TO_NUMBER ( CR_RAPTOR.SAFE_TO_NUMBER ("); + pos = colNameBuf.indexOf("to_char"); + colNameBuf.replace(pos, pos+7, "TO_CHAR"); + //colName = Utils.replaceInString(colNameBuf.toString(), "to_char", " TO_NUMBER ( CR_RAPTOR.SAFE_TO_NUMBER ( TO_CHAR "); + logger.debug(EELFLoggerDelegate.debugLogger, ("After adding to_number " + colNameBuf.toString())); + //posFormatStart = colNameBuf.lastIndexOf(",'")+1; + posFormatStart = colNameBuf.indexOf(",'", pos)+1; + posFormatEnd = colNameBuf.indexOf(")",posFormatStart); + logger.debug(EELFLoggerDelegate.debugLogger, (posFormatStart + " " + posFormatEnd + " "+ pos)); + format = colNameBuf.substring(posFormatStart, posFormatEnd); + //posFormatEnd = colNameBuf.indexOf(")",posFormatEnd); + colNameBuf.insert(posFormatEnd+1, " ," + format + ") , "+ format + ")"); + logger.debug(EELFLoggerDelegate.debugLogger, ("colNameBuf " + colNameBuf.toString())); + } + } + logger.debug(EELFLoggerDelegate.debugLogger, (" return colName " + colNameBuf.toString())); + return colNameBuf.toString(); + } + + public List getChartValueColumnsList( int filter, HashMap formValues) { /*filter; all=0;create without new chart =1; createNewChart=2 */ + List reportCols = reportRuntime.getAllColumns(); + + ArrayList chartValueCols = new ArrayList(); + int flag = 0; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + flag = 0; + DataColumnType dc = (DataColumnType) iter.next(); +// if(filter == 2 || filter == 1) { + flag = reportRuntime.getDependsOnFormFieldFlag(dc, formValues); + + if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0 && !(nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))) { + if(nvl(dc.getChartGroup()).length()<=0) { + if( filter == 2 && (dc.isCreateInNewChart()!=null && dc.isCreateInNewChart().booleanValue())) { + chartValueCols.add(dc); + } else if (filter == 1 && (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) { + chartValueCols.add(dc); + } + else if(filter == 0) chartValueCols.add(dc); + } else chartValueCols.add(dc); + } +// } else +// chartValueCols.add(dc); + } // for + Collections.sort(chartValueCols, new ChartSeqComparator()); + return chartValueCols; + } // getChartValueColumnsList + + public String parseTitle(String title, HashMap formValues) { + Set set = formValues.entrySet(); + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + Map.Entry entry = (Entry) iter.next(); + if(title.indexOf("["+ entry.getKey() + "]")!= -1) { + title = Utils.replaceInString(title, "["+entry.getKey()+"]", nvl( + (String) entry.getValue(), "")); + } + } + return title; + } + + public java.util.Date getDateFromDateStr(String dateStr) { + SimpleDateFormat MMDDYYYYFormat = new SimpleDateFormat("MM/dd/yyyy"); + SimpleDateFormat EEEMMDDYYYYFormat = new SimpleDateFormat("EEE, MM/dd/yyyy"); //2012-11-01 00:00:00 + SimpleDateFormat YYYYMMDDFormat = new SimpleDateFormat("yyyy/MM/dd"); + SimpleDateFormat MONYYYYFormat = new SimpleDateFormat("MMM yyyy"); + SimpleDateFormat MMYYYYFormat = new SimpleDateFormat("MM/yyyy"); + SimpleDateFormat MMMMMDDYYYYFormat = new SimpleDateFormat("MMMMM dd, yyyy"); + SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat timestampHrFormat = new SimpleDateFormat("yyyy-MM-dd HH"); + SimpleDateFormat timestampDayFormat = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat DDMONYYYYFormat = new SimpleDateFormat("dd-MMM-yyyy"); + SimpleDateFormat MONTHYYYYFormat = new SimpleDateFormat("MMMMM, yyyy"); + SimpleDateFormat MMDDYYYYHHFormat = new SimpleDateFormat("MM/dd/yyyy HH"); + SimpleDateFormat MMDDYYYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); + SimpleDateFormat MMDDYYYYHHMMFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm"); + SimpleDateFormat YYYYMMDDHHMMSSFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); + SimpleDateFormat YYYYMMDDHHMMFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm"); + SimpleDateFormat DDMONYYYYHHMMSSFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); + SimpleDateFormat DDMONYYYYHHMMFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm"); + SimpleDateFormat MMDDYYFormat = new SimpleDateFormat("MM/dd/yy"); + SimpleDateFormat MMDDYYHHMMFormat = new SimpleDateFormat("MM/dd/yy HH:mm"); + SimpleDateFormat MMDDYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yy HH:mm:ss"); + SimpleDateFormat timestampFormat1 = new SimpleDateFormat("yyyy-M-d.HH.mm. s. S"); + SimpleDateFormat timestamp_W_dash = new SimpleDateFormat("yyyyMMddHHmmss"); + SimpleDateFormat MMDDYYYYHHMMZFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm z"); + SimpleDateFormat YYYYFormat = new SimpleDateFormat("yyyy"); + java.util.Date date = null; + + int formatFlag = 0; + + final int YEARFLAG = 1; + final int MONTHFLAG = 2; + final int DAYFLAG = 3; + final int HOURFLAG = 4; + final int MINFLAG = 5; + final int SECFLAG = 6; + final int MILLISECFLAG = 7; + final int DAYOFTHEWEEKFLAG = 8; + final int FLAGDATE = 9; + /*int yearFlag = 1; + int monthFlag = 2; + int dayFlag = 3; + int hourFlag = 4; + int minFlag = 5; + int secFlag = 6; + int milliSecFlag = 7; + int dayoftheweekFlag = 8; + int flagDate = 10; + */ + + date = MMDDYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + if(date==null) { + date = EEEMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYOFTHEWEEKFLAG; + } + if(date==null) { + date = MMDDYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + if(date==null) { + //MMDDYYYYHHFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = HOURFLAG; + } + if(date==null) { + date = MMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + if(date==null) { + date = YYYYMMDDFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + if(date==null) { + date = timestampFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + if(date==null) { + date = timestampHrFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = HOURFLAG; + } + if(date==null) { + date = timestampDayFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + + if(date==null) { + date = MONYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MONTHFLAG; + } + if(date==null) { + date = MMYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MONTHFLAG; + } + if(date==null) { + date = MMMMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + if(date==null) { + date = MONTHYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MONTHFLAG; + } + + if(date==null) { + date = YYYYMMDDHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + + if(date==null) { + date = YYYYMMDDHHMMFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + + if(date==null) { + date = DDMONYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + + if(date==null) { + date = DDMONYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + + if(date==null) { + date = DDMONYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + + if(date==null) { + date = MMDDYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + + if(date==null) { + date = MMDDYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + + if(date==null) { + date = MMDDYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + + if(date==null) { + date = timestampFormat1.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + + if(date==null) { + date = MMDDYYYYHHMMZFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + + if(date==null) { + date = YYYYFormat.parse(dateStr, new ParsePosition(0)); + /* Some random numbers should not satisfy this year format. */ + if(dateStr.length()>4) date = null; + if(date!=null) formatFlag = YEARFLAG; + } + if(date==null) { + date = timestamp_W_dash.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + if(date==null) + date = null; + return date; + } + + public int getFlagFromDateStr(String dateStr) { + SimpleDateFormat MMDDYYYYFormat = new SimpleDateFormat("MM/dd/yyyy"); + SimpleDateFormat EEEMMDDYYYYFormat = new SimpleDateFormat("EEE, MM/dd/yyyy"); //2012-11-01 00:00:00 + SimpleDateFormat YYYYMMDDFormat = new SimpleDateFormat("yyyy/MM/dd"); + SimpleDateFormat MONYYYYFormat = new SimpleDateFormat("MMM yyyy"); + SimpleDateFormat MMYYYYFormat = new SimpleDateFormat("MM/yyyy"); + SimpleDateFormat MMMMMDDYYYYFormat = new SimpleDateFormat("MMMMM dd, yyyy"); + SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat timestampHrFormat = new SimpleDateFormat("yyyy-MM-dd HH"); + SimpleDateFormat timestampDayFormat = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat DDMONYYYYFormat = new SimpleDateFormat("dd-MMM-yyyy"); + SimpleDateFormat MONTHYYYYFormat = new SimpleDateFormat("MMMMM, yyyy"); + SimpleDateFormat MMDDYYYYHHFormat = new SimpleDateFormat("MM/dd/yyyy HH"); + SimpleDateFormat MMDDYYYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); + SimpleDateFormat MMDDYYYYHHMMFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm"); + SimpleDateFormat YYYYMMDDHHMMSSFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); + SimpleDateFormat YYYYMMDDHHMMFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm"); + SimpleDateFormat DDMONYYYYHHMMSSFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); + SimpleDateFormat DDMONYYYYHHMMFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm"); + SimpleDateFormat MMDDYYFormat = new SimpleDateFormat("MM/dd/yy"); + SimpleDateFormat MMDDYYHHMMFormat = new SimpleDateFormat("MM/dd/yy HH:mm"); + SimpleDateFormat MMDDYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yy HH:mm:ss"); + SimpleDateFormat timestampFormat1 = new SimpleDateFormat("yyyy-M-d.HH.mm. s. S"); + SimpleDateFormat timestamp_W_dash = new SimpleDateFormat("yyyyMMddHHmmss"); + SimpleDateFormat MMDDYYYYHHMMZFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm z"); + SimpleDateFormat YYYYFormat = new SimpleDateFormat("yyyy"); + java.util.Date date = null; + + int formatFlag = 0; + + final int YEARFLAG = 1; + final int MONTHFLAG = 2; + final int DAYFLAG = 3; + final int HOURFLAG = 4; + final int MINFLAG = 5; + final int SECFLAG = 6; + final int MILLISECFLAG = 7; + final int DAYOFTHEWEEKFLAG = 8; + final int FLAGDATE = 9; + /*int yearFlag = 1; + int monthFlag = 2; + int dayFlag = 3; + int hourFlag = 4; + int minFlag = 5; + int secFlag = 6; + int milliSecFlag = 7; + int dayoftheweekFlag = 8; + int flagDate = 10; + */ + + date = MMDDYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + if(date==null) { + date = EEEMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYOFTHEWEEKFLAG; + } + if(date==null) { + date = MMDDYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + if(date==null) { + //MMDDYYYYHHFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = HOURFLAG; + } + if(date==null) { + date = MMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + if(date==null) { + date = YYYYMMDDFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + if(date==null) { + date = timestampFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + if(date==null) { + date = timestampHrFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = HOURFLAG; + } + if(date==null) { + date = timestampDayFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + if(date==null) { + date = MONYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MONTHFLAG; + } + if(date==null) { + date = MMYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MONTHFLAG; + } + if(date==null) { + date = MMMMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + if(date==null) { + date = MONTHYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MONTHFLAG; + } + + if(date==null) { + date = YYYYMMDDHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + + if(date==null) { + date = YYYYMMDDHHMMFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + + if(date==null) { + date = DDMONYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + + if(date==null) { + date = DDMONYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + + if(date==null) { + date = DDMONYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + + if(date==null) { + date = MMDDYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + + if(date==null) { + date = MMDDYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + + if(date==null) { + date = MMDDYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + + if(date==null) { + date = timestampFormat1.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + + if(date==null) { + date = MMDDYYYYHHMMZFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + + if(date==null) { + date = YYYYFormat.parse(dateStr, new ParsePosition(0)); + /* Some random numbers should not satisfy this year format. */ + if(dateStr.length()>4) date = null; + if(date!=null) formatFlag = YEARFLAG; + } + if(date==null) { + date = timestamp_W_dash.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + if(date==null) + date = null; + return formatFlag; + } + + public static String[] reverse(String[] arr) { + List list = Arrays.asList(arr); + Collections.reverse(list); + return (String[])list.toArray(); + } + + public int getNumberOfDecimalPlaces(double num) { + Double d = num; + String[] splitter = d.toString().split("\\."); + splitter[0].length(); // Before Decimal Count + splitter[1].length(); // After Decimal Count + return splitter[1].length(); + } + + public boolean getBooleanValue(String s) { + return getBooleanValue(s,null); + } + + public boolean getBooleanValue(String s, Boolean defaultValue) { + s = nvl(s); + if(s.length()<=0 && defaultValue!=null) return defaultValue.booleanValue(); + else if(s.length()<=0) return false; + else { + if(s.toUpperCase().startsWith("Y") || s.toLowerCase().equals("true")) + return true; + else + return false; + } + } + + + public String IntToLetter(int Int) { + if (Int<27){ + return Character.toString((char)(Int+96)); + } else { + if (Int%26==0) { + return IntToLetter((Int/26)-1)+IntToLetter((Int%26)+1); + } else { + return IntToLetter(Int/26)+IntToLetter(Int%26); + } + } + } + + + + + private void clearReportRuntimeBackup(HttpServletRequest request) { + //Session sess = Sessions.getCurrent(true)getCurrent(); + //HttpSession session = (HttpSession)sess.getNativeSession(); + HttpSession session = request.getSession(); + session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST); + request.removeAttribute(AppConstants.DRILLDOWN_INDEX); + session.removeAttribute(AppConstants.DRILLDOWN_INDEX); + request.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX); + session.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX); + Enumeration enum1 = session.getAttributeNames(); + String attributeName = ""; + while(enum1.hasMoreElements()) { + attributeName = enum1.nextElement(); + if(attributeName.startsWith("parent_")) { + session.removeAttribute(attributeName); + } + } + session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST); + session.removeAttribute(AppConstants.SI_BACKUP_FOR_REP_ID); + session.removeAttribute(AppConstants.SI_COLUMN_LOOKUP); + session.removeAttribute(AppConstants.SI_DASHBOARD_REP_ID); + session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP); + session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME); + session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP); + session.removeAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP); + session.removeAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP); + session.removeAttribute(AppConstants.SI_DATA_SIZE_FOR_TEXTFIELD_POPUP); + session.removeAttribute(AppConstants.SI_MAP); + session.removeAttribute(AppConstants.SI_MAP_OBJECT); + session.removeAttribute(AppConstants.SI_REPORT_DEFINITION); + session.removeAttribute(AppConstants.SI_REPORT_RUNTIME); + session.removeAttribute(AppConstants.SI_REPORT_RUN_BACKUP); + session.removeAttribute(AppConstants.SI_REPORT_SCHEDULE); + session.removeAttribute(AppConstants.RI_REPORT_DATA); + session.removeAttribute(AppConstants.RI_CHART_DATA); + session.removeAttribute(AppConstants.SI_FORMFIELD_INFO); + session.removeAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO); + + } // clearReportRuntimeBackup + + + public static synchronized java.util.HashMap getRequestParametersMap(ReportRuntime rr, HttpServletRequest request) + { + HashMap valuesMap = new HashMap(); + + ReportFormFields rff = rr.getReportFormFields(); + + int idx = 0; + FormField ff = null; + + Map fieldNameMap = new HashMap(); + int countOfFields = 0 ; + + + for(rff.resetNext(); rff.hasNext(); idx++) { + ff = rff.getNext(); + fieldNameMap.put(ff.getFieldName(), ff.getFieldDisplayName()); + countOfFields++; + } + + List formParameter = new ArrayList(); + String formField = ""; + for(int i = 0 ; i < rff.size(); i++) { + ff = ((FormField)rff.getFormField(i)); + formField = ff.getFieldName(); + boolean isMultiValue = false; + isMultiValue = ff.getFieldType().equals(FormField.FFT_CHECK_BOX) + || ff.getFieldType().equals(FormField.FFT_LIST_MULTI); + boolean isTextArea = (ff.getFieldType().equals(FormField.FFT_TEXTAREA) && rr.getReportDefType() + .equals(AppConstants.RD_SQL_BASED)); + + if(request.getParameterValues(formField) != null && isMultiValue ) { + String[] vals = request.getParameterValues(formField); + StringBuffer value = new StringBuffer(""); + if(!AppUtils.getRequestFlag(request, AppConstants.RI_RESET_ACTION)) { + + if ( isMultiValue ) { + value.append("("); + } + for(int j = 0 ; j < vals.length; j++) { + if(isMultiValue) value.append("'"); + try { + if(vals[j] !=null && vals[j].length() > 0) { + vals[j] = Utils.oracleSafe(vals[j]); + value.append(java.net.URLDecoder.decode(vals[j], "UTF-8"));// + ","; + } + else + value.append(vals[j]); + } catch (UnsupportedEncodingException ex) {value.append(vals[j]);} + catch (IllegalArgumentException ex1){value.append(vals[j]);} + catch (Exception ex2){ + value.append(vals[j]); + } + + + if(isMultiValue) value.append("'"); + + if(j != vals.length -1) { + value.append(","); + } + } + if(vals.length > 0) { + value.append(")"); + } + } + + //value = value.substring(0 , value.length()); + + valuesMap.put(fieldNameMap.get(formField), value.toString()); + value = new StringBuffer(""); + } else if(request.getParameter(formField) != null) { + if(isTextArea) { + String value = ""; + value = request.getParameter(formField); + + value = Utils.oracleSafe(value); + value = "('" + Utils.replaceInString(value, ",", "'|'") + "')"; + value = Utils.replaceInString(value, "|", ","); + valuesMap.put(fieldNameMap.get(formField), value); + value = ""; + } else { + String value = ""; + if(!AppUtils.getRequestFlag(request, AppConstants.RI_RESET_ACTION)) + value = request.getParameter(formField); + valuesMap.put(fieldNameMap.get(formField), Utils.oracleSafe(value)); + } + + } else { + valuesMap.put(fieldNameMap.get(formField), "" ); + } + + } + + return valuesMap; + + } + +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartGen.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartGen.java new file mode 100644 index 0000000..c395000 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartGen.java @@ -0,0 +1,73 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.runtime; + +import java.io.PrintWriter; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.List; + +import javax.servlet.http.HttpSession; + +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.DataSet; +import org.openecomp.portalsdk.analytics.util.Log; + +public class ChartGen extends org.openecomp.portalsdk.analytics.RaptorObject { + + public static String generateChart(String chartType, HttpSession session, DataSet ds, + String xText, String yLabelLeftAxis, String yLabelRightAxis, List yTextSeries, + List yTextColor, List yTextSeriesAxis, String groupText, String chartTitle, + PrintWriter pw,List columnValuesList, boolean hasCategoryAxis, boolean isMultiSeries, + List allColumnsList, String downloadFileName, boolean totalOnlyChart, int deviceType, HashMap additionalChartOptionsMap) { + return generateChart(chartType, session, ds, xText, yLabelLeftAxis, yLabelRightAxis, + yTextSeries, yTextColor, yTextSeriesAxis, groupText, chartTitle, pw, Globals + .getDefaultChartWidth(), Globals.getDefaultChartHeight(), columnValuesList, hasCategoryAxis, isMultiSeries, allColumnsList, downloadFileName,totalOnlyChart, deviceType, additionalChartOptionsMap); + } // generateChart + + public static String generateChart(String chartType, HttpSession session, DataSet ds, + String xText, String yLabelLeftAxis, String yLabelRightAxis, List yTextSeries, + List yTextColor, List yTextSeriesAxis, String groupText, String chartTitle, + PrintWriter pw, int width, int height, List columnValuesList, boolean hasCategoryAxis, boolean isMultiSeries, + List allColumnsList, String downloadFileName,boolean totalOnlyChart, int deviceType, HashMap additionalChartOptionsMap) { + try { + Class chartGenClass = null; + + + Class[] argumentTypes = { String.class, HttpSession.class, DataSet.class, + String.class, String.class, String.class, List.class, List.class, + List.class, String.class, String.class, PrintWriter.class, int.class, + int.class, List.class, boolean.class, boolean.class, List.class, + String.class, boolean.class, int.class, HashMap.class }; + + Method method = chartGenClass.getMethod("generateChart", argumentTypes); + Object[] arguments = { chartType, session, ds, xText, yLabelLeftAxis, + yLabelRightAxis, yTextSeries, yTextColor, yTextSeriesAxis, groupText, + chartTitle, pw, new Integer(width), new Integer(height), columnValuesList, new Boolean(hasCategoryAxis), new Boolean(isMultiSeries), allColumnsList, downloadFileName, new Boolean(totalOnlyChart), new Integer(deviceType), additionalChartOptionsMap }; + + return (String) method.invoke(chartGenClass, arguments); + } catch (Exception e) { + e.printStackTrace(); + Log.write("ERROR [ChartGen.generateChart] " + e.getMessage()); + return null; + } + } // generateChart + +} // ChartGen diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartJSON.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartJSON.java new file mode 100644 index 0000000..85f8dc8 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartJSON.java @@ -0,0 +1,448 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.runtime; + +import java.util.ArrayList; + +class Row { + private String displayValue; + private String dataType; + private String colId; + //private boolean visible; + + + /*public boolean isVisible() { + return visible; + } + public void setVisible(boolean visible) { + this.visible = visible; + }*/ + public String getDisplayValue() { + return displayValue; + } + public void setDisplayValue(String displayValue) { + this.displayValue = displayValue; + } + public String getDataType() { + return dataType; + } + public void setDataType(String dataType) { + this.dataType = dataType; + } + public String getColId() { + return colId; + } + public void setColId(String colId) { + this.colId = colId; + } + + +} +class IndexValueJSON { + private int index; + private String value; + private String title; + public int getIndex() { + return index; + } + public void setIndex(int index) { + this.index = index; + } + public String getValue() { + return value; + } + public void setValue(String value) { + this.value = value; + } + public String getTitle() { + return title; + } + public void setTitle(String title) { + this.title = title; + } + +} + +class DomainAxisJSON extends IndexValueJSON {} + +class ChartColumnJSON extends IndexValueJSON {} + +class ChartTypeJSON extends IndexValueJSON {} + +class PieChartOptions { + +} + +public class ChartJSON { + + private String reportID; + private String reportName; + private String reportDescr; + private String reportTitle; + private String reportSubTitle; + private ArrayList formFieldList; + private ArrayList chartColumnJSONList; + private String formfield_comments; + private int totalRows; + private String chartSqlWhole; + private boolean chartAvailable; + private ChartTypeJSON chartTypeJSON; + private BarChartOptions barChartOptions; + private PieChartOptions pieChartOptions; + private TimeSeriesChartOptions timeSeriesChartOptions; + private FlexTimeSeriesChartOptions flexTimeSeriesChartOptions; + private CommonChartOptions commonChartOptions; + private String width; + private String height; + private boolean animation; + private String rotateLabels; + private boolean staggerLabels; + private boolean showTitle; + private DomainAxisJSON domainAxisJSON; + private CategoryAxisJSON categoryAxisJSON; + private boolean hasCategoryAxis; + + + public boolean isHasCategoryAxis() { + return hasCategoryAxis; + } + public void setHasCategoryAxis(boolean hasCategoryAxis) { + this.hasCategoryAxis = hasCategoryAxis; + } + private ArrayList rangeAxisList; + private ArrayList > wholeList; + + private String primaryAxisLabel; + private String secondaryAxisLabel; + private String minRange; + private String maxRange; + //private int topMargin; + //private int bottomMargin; + //private int leftMargin; + //private int rightMargin; + + /*private boolean showMaxMin; + private boolean showLegend; + private boolean showControls; + private String topMargin; + private String bottomMargin; + private String leftMargin; + private String rightMargin; + private String subType; + private boolean stacked; + private boolean horizontalBar; + private boolean barRealTimeAxis; + private boolean barReduceXAxisLabels; + private boolean timeAxis;*/ + + public String getReportID() { + return reportID; + } + public void setReportID(String reportID) { + this.reportID = reportID; + } + public String getReportName() { + return reportName; + } + public void setReportName(String reportName) { + this.reportName = reportName; + } + public String getReportDescr() { + return reportDescr; + } + public void setReportDescr(String reportDescr) { + this.reportDescr = reportDescr; + } + public String getReportTitle() { + return reportTitle; + } + public void setReportTitle(String reportTitle) { + this.reportTitle = reportTitle; + } + public String getReportSubTitle() { + return reportSubTitle; + } + public void setReportSubTitle(String reportSubTitle) { + this.reportSubTitle = reportSubTitle; + } + public ArrayList getFormFieldList() { + return formFieldList; + } + public void setFormFieldList(ArrayList formFieldList) { + this.formFieldList = formFieldList; + } + public String getFormfield_comments() { + return formfield_comments; + } + public void setFormfield_comments(String formfield_comments) { + this.formfield_comments = formfield_comments; + } + public int getTotalRows() { + return totalRows; + } + public void setTotalRows(int totalRows) { + this.totalRows = totalRows; + } + public String getChartSqlWhole() { + return chartSqlWhole; + } + public void setChartSqlWhole(String chartSqlWhole) { + this.chartSqlWhole = chartSqlWhole; + } + public boolean isChartAvailable() { + return chartAvailable; + } + public void setChartAvailable(boolean chartAvailable) { + this.chartAvailable = chartAvailable; + } + public String getWidth() { + return width; + } + public void setWidth(String width) { + this.width = width; + } + public String getHeight() { + return height; + } + public void setHeight(String height) { + this.height = height; + } + public boolean isAnimation() { + return animation; + } + public void setAnimation(boolean animation) { + this.animation = animation; + } + public String getRotateLabels() { + return rotateLabels; + } + public void setRotateLabels(String rotateLabels) { + this.rotateLabels = rotateLabels; + } + public boolean isStaggerLabels() { + return staggerLabels; + } + public void setStaggerLabels(boolean staggerLabels) { + this.staggerLabels = staggerLabels; + } + public boolean isShowTitle() { + return showTitle; + } + public void setShowTitle(boolean showTitle) { + this.showTitle = showTitle; + } + /*public boolean isShowMaxMin() { + return showMaxMin; + } + public void setShowMaxMin(boolean showMaxMin) { + this.showMaxMin = showMaxMin; + } + public boolean isShowLegend() { + return showLegend; + } + public void setShowLegend(boolean showLegend) { + this.showLegend = showLegend; + } + public boolean isShowControls() { + return showControls; + } + public void setShowControls(boolean showControls) { + this.showControls = showControls; + } + public String getTopMargin() { + return topMargin; + } + public void setTopMargin(String topMargin) { + this.topMargin = topMargin; + } + public String getBottomMargin() { + return bottomMargin; + } + public void setBottomMargin(String bottomMargin) { + this.bottomMargin = bottomMargin; + } + public String getLeftMargin() { + return leftMargin; + } + public void setLeftMargin(String leftMargin) { + this.leftMargin = leftMargin; + } + public String getRightMargin() { + return rightMargin; + } + public void setRightMargin(String rightMargin) { + this.rightMargin = rightMargin; + } + + public String getSubType() { + return subType; + } + public void setSubType(String subType) { + this.subType = subType; + } + public boolean isStacked() { + return stacked; + } + public void setStacked(boolean stacked) { + this.stacked = stacked; + } + public boolean isHorizontalBar() { + return horizontalBar; + } + public void setHorizontalBar(boolean horizontalBar) { + this.horizontalBar = horizontalBar; + } + public boolean isBarRealTimeAxis() { + return barRealTimeAxis; + } + public void setBarRealTimeAxis(boolean barRealTimeAxis) { + this.barRealTimeAxis = barRealTimeAxis; + } + public boolean isBarReduceXAxisLabels() { + return barReduceXAxisLabels; + } + public void setBarReduceXAxisLabels(boolean barReduceXAxisLabels) { + this.barReduceXAxisLabels = barReduceXAxisLabels; + } + public boolean isTimeAxis() { + return timeAxis; + } + public void setTimeAxis(boolean timeAxis) { + this.timeAxis = timeAxis; + }*/ + public ChartTypeJSON getChartTypeJSON() { + return chartTypeJSON; + } + public void setChartTypeJSON(ChartTypeJSON chartTypeJSON) { + this.chartTypeJSON = chartTypeJSON; + } + public String getChartType() { + return chartTypeJSON.getValue(); + } + public DomainAxisJSON getDomainAxisJSON() { + return domainAxisJSON; + } + public void setDomainAxisJSON(DomainAxisJSON domainAxisJSON) { + this.domainAxisJSON = domainAxisJSON; + } + public CategoryAxisJSON getCategoryAxisJSON() { + return categoryAxisJSON; + } + public void setCategoryAxisJSON(CategoryAxisJSON categoryAxisJSON) { + this.categoryAxisJSON = categoryAxisJSON; + } + public ArrayList getRangeAxisList() { + return rangeAxisList; + } + public void setRangeAxisList(ArrayList rangeAxisList) { + this.rangeAxisList = rangeAxisList; + } + public String getPrimaryAxisLabel() { + return primaryAxisLabel; + } + public void setPrimaryAxisLabel(String primaryAxisLabel) { + this.primaryAxisLabel = primaryAxisLabel; + } + public String getSecondaryAxisLabel() { + return secondaryAxisLabel; + } + public void setSecondaryAxisLabel(String secondaryAxisLabel) { + this.secondaryAxisLabel = secondaryAxisLabel; + } + public String getMinRange() { + return minRange; + } + public void setMinRange(String minRange) { + this.minRange = minRange; + } + public String getMaxRange() { + return maxRange; + } + public void setMaxRange(String maxRange) { + this.maxRange = maxRange; + } + /*public ArrayList getRowList() { + return rowList; + } + public void setRowList(ArrayList rowList) { + this.rowList = rowList; + }*/ + + public ArrayList> getWholeList() { + return wholeList; + } + public void setWholeList(ArrayList> wholeList) { + this.wholeList = wholeList; + } + //private ArrayList reportDataColumns; + //private ArrayList> reportDataRows; + public ArrayList getChartColumnJSONList() { + return chartColumnJSONList; + } + public void setChartColumnJSONList(ArrayList chartColumnJSONList) { + this.chartColumnJSONList = chartColumnJSONList; + } + + public BarChartOptions getBarChartOptions() { + return barChartOptions; + } + public void setBarChartOptions(BarChartOptions barChartOptions) { + this.barChartOptions = barChartOptions; + } + public PieChartOptions getPieChartOptions() { + return pieChartOptions; + } + public void setPieChartOptions(PieChartOptions pieChartOptions) { + this.pieChartOptions = pieChartOptions; + } + public TimeSeriesChartOptions getTimeSeriesChartOptions() { + return timeSeriesChartOptions; + } + public void setTimeSeriesChartOptions(TimeSeriesChartOptions timeSeriesChartOptions) { + this.timeSeriesChartOptions = timeSeriesChartOptions; + } + public FlexTimeSeriesChartOptions getFlexTimeSeriesChartOptions() { + return flexTimeSeriesChartOptions; + } + public void setFlexTimeSeriesChartOptions(FlexTimeSeriesChartOptions flexTimeSeriesChartOptions) { + this.flexTimeSeriesChartOptions = flexTimeSeriesChartOptions; + } + public CommonChartOptions getCommonChartOptions() { + return commonChartOptions; + } + public void setCommonChartOptions(CommonChartOptions commonChartOptions) { + this.commonChartOptions = commonChartOptions; + } + + public String getDomainAxis() { + if(getDomainAxisJSON() !=null) + return getDomainAxisJSON().getValue(); + else + return ""; + } + + public String getCategoryAxis() { + if(getCategoryAxisJSON()!=null) + return getCategoryAxisJSON().getValue(); + else + return ""; + } + +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartJSONHelper.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartJSONHelper.java new file mode 100644 index 0000000..d08626c --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartJSONHelper.java @@ -0,0 +1,1550 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.runtime; + +import java.io.UnsupportedEncodingException; +import java.text.ParsePosition; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.model.ReportHandler; +import org.openecomp.portalsdk.analytics.model.base.ChartSeqComparator; +import org.openecomp.portalsdk.analytics.system.AppUtils; +import org.openecomp.portalsdk.analytics.system.ConnectionUtils; +import org.openecomp.portalsdk.analytics.util.AppConstants; +import org.openecomp.portalsdk.analytics.util.DataSet; +import org.openecomp.portalsdk.analytics.util.Utils; +import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType; +import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.web.support.UserUtils; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + + + +public class ChartJSONHelper { + + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ChartJSONHelper.class); + + private ReportRuntime reportRuntime; + private String chartType; + + public static final long HOUR = 3600*1000; + public static final long DAY = 3600*1000*24; + public static final long MONTH = 3600*1000*24*31; + public static final long YEAR = 3600*1000*24*365; + + + public ChartJSONHelper() { + + } + + /** + * @return the chartType + */ + public String getChartType() { + return chartType; + } + + /** + * @param chartType the chartType to set + */ + public void setChartType(String chartType) { + this.chartType = chartType; + } + + public ChartJSONHelper(ReportRuntime rr) { + this.reportRuntime = rr; + } + + public String generateJSON(String reportID, HttpServletRequest request, boolean showData) throws RaptorException { + //From annotations chart + clearReportRuntimeBackup(request); + + //HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest(); + final Long user_id = new Long((long) UserUtils.getUserId(request)); + //String action = request.getParameter(AppConstants.RI_ACTION); + //String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID); + + ReportHandler rh = new ReportHandler(); + //ReportData reportData = null; + HashMap chartOptionsMap = new HashMap(); + try { + if(reportID !=null) { + reportRuntime = rh.loadReportRuntime(request, reportID, true, 1); + setChartType(reportRuntime.getChartType()); + //reportData = reportRuntime.loadReportData(0, user_id.toString(), 10000,request, false); + } + + + + String rotateLabelsStr = ""; + rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle()); + if(rotateLabelsStr.toLowerCase().equals("standard")) { + rotateLabelsStr = "0"; + } else if (rotateLabelsStr.toLowerCase().equals("up45")) { + rotateLabelsStr = "45"; + } else if (rotateLabelsStr.toLowerCase().equals("down45")) { + rotateLabelsStr = "-45"; + } else if (rotateLabelsStr.toLowerCase().equals("up90")) { + rotateLabelsStr = "90"; + } else if (rotateLabelsStr.toLowerCase().equals("down90")) { + rotateLabelsStr = "-90"; + } else + rotateLabelsStr = "0"; + + String width = (AppUtils.getRequestNvlValue(request, "width").length()>0?AppUtils.getRequestNvlValue(request, "width"):(AppUtils.nvl(reportRuntime.getChartWidth()).length()>0?reportRuntime.getChartWidth():"700")); + String height = (AppUtils.getRequestNvlValue(request, "height").length()>0?AppUtils.getRequestNvlValue(request, "height"):(AppUtils.nvl(reportRuntime.getChartHeight()).length()>0?reportRuntime.getChartHeight():"300")); + String animationStr = (AppUtils.getRequestNvlValue(request, "animation").length()>0?AppUtils.getRequestNvlValue(request, "animation"):new Boolean(reportRuntime.isAnimateAnimatedChart()).toString()); + + String rotateLabels = (AppUtils.getRequestNvlValue(request, "rotateLabels").length()>0?AppUtils.getRequestNvlValue(request, "rotateLabels"):(rotateLabelsStr.length()>0?rotateLabelsStr:"0")); + String staggerLabelsStr = (AppUtils.getRequestNvlValue(request, "staggerLabels").length()>0?AppUtils.getRequestNvlValue(request, "staggerLabels"):"false"); + String showMaxMinStr = (AppUtils.getRequestNvlValue(request, "showMaxMin").length()>0?AppUtils.getRequestNvlValue(request, "showMaxMin"):"false"); + String showControlsStr = (AppUtils.getRequestNvlValue(request, "showControls").length()>0?AppUtils.getRequestNvlValue(request, "showControls"):new Boolean(reportRuntime.displayBarControls()).toString()); + String showLegendStr = (AppUtils.getRequestNvlValue(request, "showLegend").length()>0?AppUtils.getRequestNvlValue(request, "showLegend"):new Boolean(!new Boolean(reportRuntime.hideChartLegend())).toString()); + String topMarginStr = AppUtils.getRequestNvlValue(request, "topMargin"); + String topMargin = (AppUtils.nvl(topMarginStr).length()<=0)?(reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin().toString():"30"):topMarginStr; + String bottomMarginStr = AppUtils.getRequestNvlValue(request, "bottomMargin"); + String bottomMargin = (AppUtils.nvl(bottomMarginStr).length()<=0)?(reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin().toString():"50"):bottomMarginStr; + String leftMarginStr = AppUtils.getRequestNvlValue(request, "leftMargin"); + String leftMargin = (AppUtils.nvl(leftMarginStr).length()<=0)?(reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin().toString():"100"):leftMarginStr; + String rightMarginStr = AppUtils.getRequestNvlValue(request, "rightMargin"); + String rightMargin = (AppUtils.nvl(rightMarginStr).length()<=0)?(reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin().toString():"160"):rightMarginStr; + String showTitleStr = (AppUtils.getRequestNvlValue(request, "showTitle").length()>0?AppUtils.getRequestNvlValue(request, "showTitle"):new Boolean(reportRuntime.displayChartTitle()).toString()); + String subType = AppUtils.getRequestNvlValue(request, "subType").length()>0?AppUtils.getRequestNvlValue(request, "subType"):(AppUtils.nvl(reportRuntime.getTimeSeriesRender()).equals("area")?reportRuntime.getTimeSeriesRender():""); + String stackedStr = AppUtils.getRequestNvlValue(request, "stacked").length()>0?AppUtils.getRequestNvlValue(request, "stacked"):new Boolean(reportRuntime.isChartStacked()).toString(); + String horizontalBar = AppUtils.getRequestNvlValue(request, "horizontalBar").length()>0?AppUtils.getRequestNvlValue(request, "horizontalBar"):new Boolean(reportRuntime.isHorizontalOrientation()).toString(); + String barRealTimeAxis = AppUtils.getRequestNvlValue(request, "barRealTimeAxis"); + String barReduceXAxisLabels = AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels").length()>0?AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels"):new Boolean(reportRuntime.isLessXaxisTickers()).toString();; + String timeAxis = AppUtils.getRequestNvlValue(request, "timeAxis").length()>0?AppUtils.getRequestNvlValue(request, "timeAxis"):new Boolean(reportRuntime.isTimeAxis()).toString(); + String logScale = AppUtils.getRequestNvlValue(request, "logScale").length()>0?AppUtils.getRequestNvlValue(request, "logScale"):new Boolean(reportRuntime.isLogScale()).toString(); + String precision = AppUtils.getRequestNvlValue(request, "precision").length()>0?AppUtils.getRequestNvlValue(request, "precision"):"2"; + + + chartOptionsMap.put("width", width); + chartOptionsMap.put("height", height); + chartOptionsMap.put("animation", animationStr); + chartOptionsMap.put("rotateLabels", rotateLabels); + chartOptionsMap.put("staggerLabels", staggerLabelsStr); + chartOptionsMap.put("showMaxMin", showMaxMinStr); + chartOptionsMap.put("showControls", showControlsStr); + chartOptionsMap.put("showLegend", showLegendStr); + chartOptionsMap.put("topMargin", topMargin); + chartOptionsMap.put("bottomMargin", bottomMargin); + chartOptionsMap.put("leftMargin", leftMargin); + chartOptionsMap.put("rightMargin", rightMargin); + chartOptionsMap.put("showTitle", showTitleStr); + chartOptionsMap.put("subType", subType); + chartOptionsMap.put("stacked", stackedStr); + chartOptionsMap.put("horizontalBar", horizontalBar); + chartOptionsMap.put("timeAxis", timeAxis); + chartOptionsMap.put("barRealTimeAxis", barRealTimeAxis); + chartOptionsMap.put("barReduceXAxisLabels", barReduceXAxisLabels); + + chartOptionsMap.put("logScale", logScale); + chartOptionsMap.put("precision", precision); + + + } catch (RaptorException ex) { + ex.printStackTrace(); + } + return generateJSON(reportRuntime, chartOptionsMap, request, showData); + } + + public String generateJSON(ReportRuntime reportRuntime, HttpServletRequest request, boolean showData) throws RaptorException { + + String rotateLabelsStr = ""; + rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle()); + if(rotateLabelsStr.toLowerCase().equals("standard")) { + rotateLabelsStr = "0"; + } else if (rotateLabelsStr.toLowerCase().equals("up45")) { + rotateLabelsStr = "45"; + } else if (rotateLabelsStr.toLowerCase().equals("down45")) { + rotateLabelsStr = "-45"; + } else if (rotateLabelsStr.toLowerCase().equals("up90")) { + rotateLabelsStr = "90"; + } else if (rotateLabelsStr.toLowerCase().equals("down90")) { + rotateLabelsStr = "-90"; + } else + rotateLabelsStr = "0"; + + HashMap chartOptionsMap = new HashMap(); + chartOptionsMap.put("width", reportRuntime.getChartWidth()); + chartOptionsMap.put("height", reportRuntime.getChartHeight()); + chartOptionsMap.put("animation", new Boolean(reportRuntime.isAnimateAnimatedChart()).toString()); + chartOptionsMap.put("rotateLabels", rotateLabelsStr); + chartOptionsMap.put("staggerLabels", "false"); + chartOptionsMap.put("showMaxMin", "false"); + chartOptionsMap.put("showControls", new Boolean(reportRuntime.displayBarControls()).toString()); + chartOptionsMap.put("showLegend", new Boolean(!reportRuntime.hideChartLegend()).toString()); + chartOptionsMap.put("topMargin", reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin().toString():"30"); + chartOptionsMap.put("bottomMargin", reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin().toString():"50"); + chartOptionsMap.put("leftMargin", reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin().toString():"100"); + chartOptionsMap.put("rightMargin", reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin().toString():"160"); + chartOptionsMap.put("showTitle", new Boolean(reportRuntime.displayChartTitle()).toString()); + chartOptionsMap.put("subType", (AppUtils.nvl(reportRuntime.getTimeSeriesRender()).equals("area")?reportRuntime.getTimeSeriesRender():"")); + chartOptionsMap.put("stacked", new Boolean(reportRuntime.isChartStacked()).toString()); + chartOptionsMap.put("horizontalBar", new Boolean(reportRuntime.isHorizontalOrientation()).toString()); + chartOptionsMap.put("timeAxis", new Boolean(reportRuntime.isTimeAxis()).toString()); + chartOptionsMap.put("barReduceXAxisLabels", new Boolean(reportRuntime.isLessXaxisTickers()).toString()); + + chartOptionsMap.put("logScale", new Boolean(reportRuntime.isLogScale()).toString()); + chartOptionsMap.put("precision", "2"); + + + + return generateJSON(reportRuntime, chartOptionsMap, request, showData); + } + + public String generateJSON(ReportRuntime reportRuntime, HashMap chartOptionsMap, HttpServletRequest request, boolean showData) throws RaptorException { + + //String width, String height, boolean animation, String rotateLabels, boolean staggerLabels, boolean showMaxMin, boolean showLegend, boolean showControls, String topMargin, String bottomMargin, boolean showTitle, String subType + String userId = AppUtils.getUserID(request); + String width = chartOptionsMap.get("width"); + String height = chartOptionsMap.get("height"); + boolean animation = getBooleanValue(chartOptionsMap.get("animation"), true); + String rotateLabels = chartOptionsMap.get("rotateLabels"); + boolean staggerLabels = getBooleanValue(chartOptionsMap.get("staggerLabels")); + boolean showMaxMin = getBooleanValue(chartOptionsMap.get("showMaxMin"), false); + boolean showLegend = getBooleanValue(chartOptionsMap.get("showLegend"), true); + boolean showControls = getBooleanValue(chartOptionsMap.get("showControls"), true); + String topMargin = chartOptionsMap.get("topMargin"); + String bottomMargin = chartOptionsMap.get("bottomMargin"); + String leftMargin = chartOptionsMap.get("leftMargin"); + String rightMargin = chartOptionsMap.get("rightMargin"); + boolean showTitle = getBooleanValue(chartOptionsMap.get("showTitle"), true); + String subType = chartOptionsMap.get("subType"); + boolean stacked = getBooleanValue(chartOptionsMap.get("stacked"), false); + boolean horizontalBar = getBooleanValue(chartOptionsMap.get("horizontalBar"), false); + boolean barRealTimeAxis = getBooleanValue(chartOptionsMap.get("barRealTimeAxis"), true); + boolean barReduceXAxisLabels= getBooleanValue(chartOptionsMap.get("barReduceXAxisLabels"), false); + boolean timeAxis = getBooleanValue(chartOptionsMap.get("timeAxis"), true); + + + boolean logScale = getBooleanValue(chartOptionsMap.get("logScale"), false); + + int precision = 2; + + try { + precision = Integer.parseInt(chartOptionsMap.get("precision")); + } catch (NumberFormatException ex) { + + } + + final Long user_id = new Long((long) UserUtils.getUserId(request)); + + HttpSession session = null; + session = request.getSession(); + String chartType = reportRuntime.getChartType(); + List l = reportRuntime.getAllColumns(); + List lGroups = reportRuntime.getAllChartGroups(); + HashMap mapYAxis = reportRuntime.getAllChartYAxis(reportRuntime.getReportParamValues()); + //ReportParamValues reportParamValues = reportRuntime.getReportParamValues(); + String chartLeftAxisLabel = reportRuntime.getFormFieldFilled(nvl(reportRuntime.getChartLeftAxisLabel())); + String chartRightAxisLabel = reportRuntime.getFormFieldFilled(nvl(reportRuntime.getChartRightAxisLabel())); + + boolean multipleSeries = reportRuntime.isMultiSeries(); + + java.util.HashMap formValues = null; + formValues = getRequestParametersMap(reportRuntime, request); + + + String legendColumnName = (reportRuntime.getChartLegendColumn()!=null)?reportRuntime.getChartLegendColumn().getDisplayName():"Legend Column"; + boolean displayChart = reportRuntime.getDisplayChart(); + HashMap additionalChartOptionsMap = new HashMap(); + + StringBuffer wholeScript = new StringBuffer(""); + + String title = reportRuntime.getReportTitle(); + + title = parseTitle(title, formValues); + ObjectMapper mapper = new ObjectMapper(); + ChartJSON chartJSON = new ChartJSON(); + String sql = ""; + if(displayChart) { + DataSet ds = null; + if(showData) { + + try { + if (!(chartType.equals(AppConstants.GT_HIERARCHICAL) || chartType.equals(AppConstants.GT_HIERARCHICAL_SUNBURST) || chartType.equals(AppConstants.GT_ANNOTATION_CHART))) { + sql = generateChartSQL(userId, request ); + ds = (DataSet) loadChartData(new Long(user_id).toString(), request); + } else if(chartType.equals(AppConstants.GT_ANNOTATION_CHART)) { + sql = reportRuntime.getWholeSQL(); + String reportSQL = reportRuntime.getWholeSQL(); + String dbInfo = reportRuntime.getDBInfo(); + ds = ConnectionUtils.getDataSet(reportSQL, dbInfo); + if(ds.getRowCount()<=0) { + logger.debug(EELFLoggerDelegate.debugLogger, ("********************************************************************************")); + logger.info(EELFLoggerDelegate.debugLogger, (chartType.toUpperCase()+" - " + "Report ID : " + reportRuntime.getReportID() + " DATA IS EMPTY" )); + logger.info(EELFLoggerDelegate.debugLogger, ("QUERY - " + reportSQL)); + logger.info(EELFLoggerDelegate.debugLogger, ("********************************************************************************")); + } + } else if(chartType.equals(AppConstants.GT_HIERARCHICAL)||chartType.equals(AppConstants.GT_HIERARCHICAL_SUNBURST)) { + sql = reportRuntime.getWholeSQL(); + String reportSQL = reportRuntime.getWholeSQL(); + String dbInfo = reportRuntime.getDBInfo(); + ds = ConnectionUtils.getDataSet(reportSQL, dbInfo); + } + } catch (RaptorException ex) { + //throw new RaptorException("Error while loading chart data", ex); + logger.error(EELFLoggerDelegate.debugLogger, ("********************************************************************************")); + logger.error(EELFLoggerDelegate.debugLogger, (chartType.toUpperCase()+" - " + "Report ID : " + reportRuntime.getReportID() + " ERROR THROWN FOR GIVEN QUERY ")); + logger.error(EELFLoggerDelegate.debugLogger, ("QUERY - " + reportRuntime.getWholeSQL())); + logger.error(EELFLoggerDelegate.debugLogger, ("ERROR STACK TRACE" + ex.getMessage())); + logger.error(EELFLoggerDelegate.debugLogger, ("********************************************************************************")); + + } + if(ds==null) { + //displayChart = false; + if(chartType.equals(AppConstants.GT_ANNOTATION_CHART)) + ds = new DataSet(); + else + displayChart = false; + } + } + if(displayChart) { + + chartJSON.setReportID(reportRuntime.getReportID()); + chartJSON.setReportName(reportRuntime.getReportName()); + chartJSON.setReportDescr(reportRuntime.getReportDescr()); + chartJSON.setReportTitle(reportRuntime.getReportTitle()); + chartJSON.setReportSubTitle(reportRuntime.getReportSubTitle()); + + List dcList = reportRuntime.getOnlyVisibleColumns(); + int countIndex = 0; + ArrayList chartColumnJSONList = new ArrayList(); + for(Iterator iter = dcList.iterator(); iter.hasNext(); ) { + ChartColumnJSON ccJSON = new ChartColumnJSON(); + DataColumnType dc = (DataColumnType) iter.next(); + ccJSON.setIndex(countIndex); + ccJSON.setValue(dc.getColId()); + ccJSON.setTitle(dc.getDisplayName()); + countIndex++; + chartColumnJSONList.add(ccJSON); + } + chartJSON.setChartColumnJSONList(chartColumnJSONList); + /* setting formfields show only showForm got triggered*/ + /*ArrayList formFieldValues = new ArrayList(); + ArrayList formFieldJSONList = new ArrayList(); + if(reportRuntime.getReportFormFields()!=null) { + formFieldJSONList = new ArrayList(reportRuntime.getReportFormFields().size()); + for (Iterator iter = reportRuntime.getReportFormFields().iterator(); iter.hasNext();) { + formFieldValues = new ArrayList(); + FormField ff = (FormField) iter.next(); + ff.setDbInfo(reportRuntime.getDbInfo()); + FormFieldJSON ffJSON = new FormFieldJSON(); + ffJSON.setFieldId(ff.getFieldName()); + ffJSON.setFieldType(ff.getFieldType()); + ffJSON.setFieldDisplayName(ff.getFieldDisplayName()); + ffJSON.setHelpText(ff.getHelpText()); + ffJSON.setValidationType(ff.getValidationType()); + //ffJSON.setTriggerOtherFormFields(ff.getDependsOn()); + IdNameList lookup = null; + lookup = ff.getLookupList(); + String selectedValue = ""; + String oldSQL = ""; + IdNameList lookupList = null; + boolean readOnly = false; + if(lookup!=null) { + if(!ff.hasPredefinedList) { + IdNameSql lu = (IdNameSql) lookup; + String SQL = lu.getSql(); + oldSQL = lu.getSql(); + reportRuntime.setTriggerFormFieldCheck( reportRuntime.getReportFormFields(), ff); + ffJSON.setTriggerOtherFormFields(ff.isTriggerOtherFormFields()); + SQL = reportRuntime.parseAndFillReq_Session_UserValues(request, SQL, userId); + SQL = reportRuntime.parseAndFillWithCurrentValues(request, SQL, ff); + String defaultSQL = lu.getDefaultSQL(); + defaultSQL = reportRuntime.parseAndFillReq_Session_UserValues(request, defaultSQL, userId); + defaultSQL = reportRuntime.parseAndFillWithCurrentValues(request, SQL, ff); + lookup = new IdNameSql(-1,SQL,defaultSQL); + + lookupList = lookup; + try { + lookup.loadUserData(0, "", ff.getDbInfo(), ff.getUserId()); + } catch (Exception e ){ e.printStackTrace(); //throw new RaptorRuntimeException(e); + } + } + lookup.trimToSize(); + + String[] requestValue = request.getParameterValues(ff.getFieldName()); + + if(lookup != null && lookup.size() > 0) { + for (lookup.resetNext(); lookup.hasNext();) { + IdNameValue value = lookup.getNext(); + readOnly = value.isReadOnly(); + if(requestValue != null && Arrays.asList(requestValue).contains(value.getId())) { + //if(value.getId().equals(requestValue)) + value.setDefaultValue(true); + } + if(!(ff.getFieldType().equals(FormField.FFT_CHECK_BOX) || ff.getFieldType().equals(FormField.FFT_COMBO_BOX) || ff.getFieldType().equals(FormField.FFT_LIST_BOX) + || ff.getFieldType().equals(FormField.FFT_LIST_MULTI)) && value.isDefaultValue()) + formFieldValues.add(value); + else if(ff.getFieldType().equals(FormField.FFT_CHECK_BOX) || ff.getFieldType().equals(FormField.FFT_COMBO_BOX) || ff.getFieldType().equals(FormField.FFT_LIST_BOX) + || ff.getFieldType().equals(FormField.FFT_LIST_MULTI)) { + formFieldValues.add(value); + } + //break; + } + } else { + if(requestValue!=null && requestValue.length>0) { + IdNameValue value = new IdNameValue(requestValue[0], requestValue[0], true, false); + formFieldValues.add(value); + } + } + + } else { + String[] requestValue = request.getParameterValues(ff.getFieldName()); + if(requestValue!=null && requestValue.length>0) { + IdNameValue value = new IdNameValue(requestValue[0], requestValue[0], true, false); + formFieldValues.add(value); + } + } + if(!ff.hasPredefinedList) { + if(oldSQL != null && !oldSQL.equals("")) { + ((IdNameSql)lookup).setSQL(oldSQL); + } + } + + + + ffJSON.setFormFieldValues(formFieldValues); + formFieldJSONList.add(ffJSON); + } // for + } + chartJSON.setFormFieldList(formFieldJSONList); + chartJSON.setChartSqlWhole(sql);*/ + chartJSON.setChartAvailable(displayChart); + + ChartTypeJSON chartTypeJSON = new ChartTypeJSON(); + chartTypeJSON.setIndex(0); + chartTypeJSON.setTitle(""); + chartTypeJSON.setValue(chartType); + chartJSON.setChartTypeJSON(chartTypeJSON); + chartJSON.setWidth(width); + chartJSON.setHeight(height); + chartJSON.setAnimation(animation); + chartJSON.setRotateLabels(rotateLabels); + chartJSON.setStaggerLabels(staggerLabels); + chartJSON.setShowTitle(showTitle); + DomainAxisJSON domainAxisJSON = new DomainAxisJSON(); + domainAxisJSON.setIndex(0); + if(reportRuntime.getChartLegendColumn()!=null) + domainAxisJSON.setTitle(reportRuntime.getChartLegendColumn().getDisplayName()); + else + domainAxisJSON.setTitle(""); + if(reportRuntime.getChartLegendColumn()!=null) + domainAxisJSON.setValue(reportRuntime.getChartLegendColumn().getColId()); + else + domainAxisJSON.setValue(""); + chartJSON.setDomainAxisJSON(domainAxisJSON); + + + List reportCols = reportRuntime.getAllColumns(); + boolean hasSeriesColumn = false; + //ArrayList + for (Iterator iter = reportCols.iterator(); iter + .hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + if(dct.isChartSeries()!=null && dct.isChartSeries().booleanValue()) { + chartJSON.setHasCategoryAxis(true); + CategoryAxisJSON categoryAxisJSON = new CategoryAxisJSON(); + categoryAxisJSON.setIndex(0); + categoryAxisJSON.setTitle(dct.getDisplayName()); + categoryAxisJSON.setValue(dct.getColId()); + chartJSON.setCategoryAxisJSON(categoryAxisJSON); + } + //allColumns + //.add(new Item(dct.getColId(), dct.getDisplayName())); + } + //chartJSON.setCategoryAxis(categoryAxis); + //chartJSON.set + + List chartValueCols = reportRuntime.getChartValueColumnsList(AppConstants.CHART_ALL_COLUMNS, null); + DataColumnType dct_RangeAxis = null; + //int noChart = 0; + //if(chartValueCols.size()<=0) { + //chartValueCols.addAll(reportCols); + //noChart = 1; + //} + if(chartValueCols.size() <= 0) { + chartValueCols = reportCols; + } + ArrayList rangeAxisJSONList = new ArrayList(); + for (int k = 0; k < chartValueCols.size(); k++) { + dct_RangeAxis = chartValueCols.get(k); + RangeAxisJSON rangeAxisJSON = new RangeAxisJSON(); + + RangeAxisLabelJSON rangeAxisLabelJSON = new RangeAxisLabelJSON(); + rangeAxisLabelJSON.setIndex(0); + rangeAxisLabelJSON.setTitle(dct_RangeAxis.getDisplayName()); + rangeAxisLabelJSON.setValue(dct_RangeAxis.getColId()); + rangeAxisJSON.setRangeAxisLabelJSON(rangeAxisLabelJSON); + RangeLineTypeJSON rangeLineTypeJSON = new RangeLineTypeJSON(); + rangeLineTypeJSON.setIndex(0); + rangeLineTypeJSON.setTitle(""); + rangeLineTypeJSON.setValue(dct_RangeAxis.getChartLineType()); + rangeAxisJSON.setRangeLineTypeJSON(rangeLineTypeJSON); + + RangeColorJSON rangeColorJSON = new RangeColorJSON(); + rangeColorJSON.setIndex(0); + rangeColorJSON.setTitle(""); + rangeColorJSON.setValue(dct_RangeAxis.getChartColor()); + rangeAxisJSON.setRangeColorJSON(rangeColorJSON); + String chartGroup = ""; + chartGroup = AppUtils.nvl(dct_RangeAxis.getChartGroup()); + if(chartGroup.indexOf("|")!=-1) + chartGroup = chartGroup.substring(0, chartGroup.indexOf("|")); + + + rangeAxisJSON.setRangeChartGroup(chartGroup); + String yAxis = ""; + yAxis = AppUtils.nvl(dct_RangeAxis.getYAxis()); + if(yAxis.indexOf("|")!=-1) + yAxis = yAxis.substring(0, yAxis.indexOf("|")); + + rangeAxisJSON.setRangeYAxis(yAxis); + rangeAxisJSON.setShowAsArea((dct_RangeAxis.isIsRangeAxisFilled()!=null && dct_RangeAxis.isIsRangeAxisFilled().booleanValue())?true:false); + rangeAxisJSONList.add(rangeAxisJSON); + } + CommonChartOptions commonChartOptions = new CommonChartOptions(); + commonChartOptions.setLegendPosition(AppUtils.nvl(reportRuntime.getLegendPosition()).length()>0?reportRuntime.getLegendPosition().toLowerCase():"top"); + String legendLabelAngle = ""; + legendLabelAngle = reportRuntime.getLegendLabelAngle().toLowerCase(); + commonChartOptions.setLegendLabelAngle(AppUtils.nvl(legendLabelAngle).length()>0?legendLabelAngle:"up45"); + commonChartOptions.setHideLegend(reportRuntime.hideChartLegend()); + commonChartOptions.setAnimateAnimatedChart(reportRuntime.isAnimateAnimatedChart()); + commonChartOptions.setTopMargin(reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin():new Integer("30")); + commonChartOptions.setBottomMargin(reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin():new Integer("50")); + commonChartOptions.setLeftMargin(reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin():new Integer("100")); + commonChartOptions.setRightMargin(reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin():new Integer("60")); + chartJSON.setCommonChartOptions(commonChartOptions); + + if(chartType.equals(AppConstants.GT_BAR_3D)) { + BarChartOptions barChartOptions = new BarChartOptions(); + barChartOptions.setDisplayBarControls(reportRuntime.displayBarControls()?true:false); + barChartOptions.setMinimizeXAxisTickers(reportRuntime.isLessXaxisTickers()?true:false); + barChartOptions.setStackedChart(reportRuntime.isChartStacked()?true:false); + barChartOptions.setTimeAxis(reportRuntime.isTimeAxis()?true:false); + barChartOptions.setVerticalOrientation(reportRuntime.isVerticalOrientation()?true:false); + barChartOptions.setxAxisDateType(reportRuntime.isXAxisDateType()?true:false); + barChartOptions.setyAxisLogScale(reportRuntime.isLogScale()?true:false); + chartJSON.setBarChartOptions(barChartOptions); + chartJSON.setTimeSeriesChartOptions(null); + chartJSON.setPieChartOptions(null); + chartJSON.setFlexTimeSeriesChartOptions(null); + + } else if(chartType.equals(AppConstants.GT_TIME_SERIES)) { + TimeSeriesChartOptions timeSeriesChartOptions = new TimeSeriesChartOptions(); + timeSeriesChartOptions.setAddXAxisTicker(reportRuntime.isAddXAxisTickers()); + timeSeriesChartOptions.setLineChartRenderer(AppUtils.nvl(reportRuntime.getTimeSeriesRender()).length()>0?reportRuntime.getTimeSeriesRender():"line"); + timeSeriesChartOptions.setMultiSeries(reportRuntime.isMultiSeries()); + timeSeriesChartOptions.setNonTimeAxis(reportRuntime.isTimeAxis()); + timeSeriesChartOptions.setShowXAxisLabel(reportRuntime.isShowXaxisLabel()); + chartJSON.setBarChartOptions(null); + chartJSON.setTimeSeriesChartOptions(timeSeriesChartOptions); + chartJSON.setPieChartOptions(null); + chartJSON.setFlexTimeSeriesChartOptions(null); + } else if(chartType.equals(AppConstants.GT_ANNOTATION_CHART) || chartType.equals(AppConstants.GT_FLEX_TIME_CHARTS)) { + FlexTimeSeriesChartOptions flexTimeSeriesChartOptions = new FlexTimeSeriesChartOptions(); + flexTimeSeriesChartOptions.setZoomIn(reportRuntime.getZoomIn()!=null?reportRuntime.getZoomIn():new Integer("25")); + String timeAxisTypeStr = ""; + timeAxisTypeStr = reportRuntime.getTimeAxisType().toLowerCase(); + flexTimeSeriesChartOptions.setTimeAxisType(timeAxisTypeStr); + chartJSON.setBarChartOptions(null); + chartJSON.setTimeSeriesChartOptions(null); + chartJSON.setPieChartOptions(null); + chartJSON.setFlexTimeSeriesChartOptions(flexTimeSeriesChartOptions); + } + chartJSON.setRangeAxisList(rangeAxisJSONList); + chartJSON.setPrimaryAxisLabel(reportRuntime.getChartLeftAxisLabel()); + chartJSON.setSecondaryAxisLabel(reportRuntime.getChartRightAxisLabel()); + chartJSON.setMinRange(reportRuntime.getRangeAxisLowerLimit()); + chartJSON.setMaxRange(reportRuntime.getRangeAxisUpperLimit()); + + if(showData) { + ArrayList> wholeList = new ArrayList>(); + + ArrayList rowList = new ArrayList(); + if(showData) { + for (int i = 0; i < ds.getRowCount(); i++) { + rowList = new ArrayList(); + for (int j = 0; j0) { + /*sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl( + paramValue, "NULL"));*/ + reportSQL = Utils.replaceInString(reportSQL, fieldDisplay, nvl( + paramValue, "NULL")); + } + /*sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl( + paramValue, "NULL"));*/ + reportSQL = Utils.replaceInString(reportSQL, "'" + fieldDisplay + "'", nvl( + paramValue, "NULL")); + reportSQL = Utils.replaceInString(reportSQL, fieldDisplay , nvl( + paramValue, "NULL")); + } + } + logger.debug(EELFLoggerDelegate.debugLogger, ("SQL " + reportSQL)); + String legendCol = "1 a"; + // String valueCol = "1"; + StringBuffer groupCol = new StringBuffer(); + StringBuffer seriesCol = new StringBuffer(); + StringBuffer valueCols = new StringBuffer(); + + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + String colName = getColumnSelectStr(dc, request); + if (nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND)) + legendCol = getSelectExpr(dc, colName)+" " + dc.getColId(); + // if(dc.getChartSeq()>0) + // valueCol = "NVL("+colName+", 0) "+dc.getColId(); + if ((!nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND)) + && (dc.getChartSeq()!=null && dc.getChartSeq().intValue() <= 0) && dc.isGroupBreak()) { + groupCol.append(", "); + groupCol.append(colName + " " + dc.getColId()); + } + } // for + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if(dc.isChartSeries()!=null && dc.isChartSeries().booleanValue()) { + //System.out.println("*****************, "+ " " +getColumnSelectStr(dc, paramValues)+ " "+ getSelectExpr(dc,getColumnSelectStr(dc, paramValues))); + seriesCol.append(", "+ getSelectExpr(dc,getColumnSelectStr(dc, request))+ " " + dc.getColId()); + } + } + + /*for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + if(!dc.isChartSeries() && !(nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))) { + //System.out.println("*****************, "+ " " +getColumnSelectStr(dc, paramValues)+ " "+ getSelectExpr(dc,getColumnSelectStr(dc, paramValues))); + seriesCol.append(", "+ formatChartColumn(getSelectExpr(dc,getColumnSelectStr(dc, paramValues)))+ " " + dc.getColId()); + } + }*/ + + for (Iterator iter = chartValueCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + String colName = getColumnSelectStr(dc, request); + String paramValue = ""; + if(AppUtils.nvl(colName).startsWith("[")) { + if (reportRuntime.getFormFieldList() != null) { + for (Iterator iterC = reportRuntime.getFormFieldList().getFormField().iterator(); iterC.hasNext();) { + FormFieldType fft = (FormFieldType) iterC.next(); + String fieldId = fft.getFieldId(); + String fieldDisplay = reportRuntime.getFormFieldDisplayName(fft); + String formfield_value = ""; + if(AppUtils.nvl(fieldDisplay).equals(colName)) { + formfield_value = AppUtils.getRequestNvlValue(request, fieldId); + paramValue = nvl(formfield_value); + } + } + + } + + seriesCol.append("," + (AppUtils.nvl(paramValue).length()>0? paramValue:"null") + " " + dc.getColId()); + } else { + //valueCols.append(", NVL(" + formatChartColumn(colName) + ",0) " + dc.getColId()); + seriesCol.append("," + (AppUtils.nvl(paramValue).length()>0? paramValue:formatChartColumn(colName)) + " " + dc.getColId()); + } + } // for + + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + String colName = dc.getDisplayName(); + String colValue = getColumnSelectStr(dc, request); + //String colName = getColumnSelectStr(dc, formGrid); + if(colName.equals(AppConstants.RI_CHART_TOTAL_COL)) + seriesCol.append(", " + AppConstants.RI_CHART_TOTAL_COL + " " + AppConstants.RI_CHART_TOTAL_COL ); + if (colName.equals(AppConstants.RI_CHART_COLOR)) + seriesCol.append(", " + colValue + " " + AppConstants.RI_CHART_COLOR ); + if(colName.equals(AppConstants.RI_CHART_MARKER_START)) + seriesCol.append(", " + AppConstants.RI_CHART_MARKER_START + " " + AppConstants.RI_CHART_MARKER_START ); + if(colName.equals(AppConstants.RI_CHART_MARKER_END)) + seriesCol.append(", " + AppConstants.RI_CHART_MARKER_END + " " + AppConstants.RI_CHART_MARKER_END ); + if(colName.equals(AppConstants.RI_CHART_MARKER_TEXT_LEFT)) + seriesCol.append(", " + AppConstants.RI_CHART_MARKER_TEXT_LEFT + " " + AppConstants.RI_CHART_MARKER_TEXT_LEFT ); + if(colName.equals(AppConstants.RI_CHART_MARKER_TEXT_RIGHT)) + seriesCol.append(", " + AppConstants.RI_CHART_MARKER_TEXT_RIGHT + " " + AppConstants.RI_CHART_MARKER_TEXT_RIGHT ); + //if(colName.equals(AppConstants.RI_ANOMALY_TEXT)) + //seriesCol.append(", " + AppConstants.RI_ANOMALY_TEXT + " " + AppConstants.RI_ANOMALY_TEXT ); + } + + //debugLogger.debug("ReportSQL Chart " + reportSQL ); + /*for (Iterator iter = chartValueCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + String colName = getColumnSelectStr(dc, paramValues); + //valueCols.append(", NVL(" + formatChartColumn(colName) + ",0) " + dc.getColId()); + valueCols.append("," + formatChartColumn(colName) + " " + dc.getColId()); + } // for + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dc = (DataColumnType) iter.next(); + String colName = getColumnSelectStr(dc, paramValues); + //if(colName.equals(AppConstants.RI_CHART_TOTAL_COL) || colName.equals(AppConstants.RI_CHART_COLOR)) { + if(colName.equals(AppConstants.RI_CHART_TOTAL_COL)) + valueCols.append(", " + AppConstants.RI_CHART_TOTAL_COL + " " + AppConstants.RI_CHART_TOTAL_COL ); + if (colName.equals(AppConstants.RI_CHART_COLOR)) + valueCols.append(", " + AppConstants.RI_CHART_COLOR + " " + AppConstants.RI_CHART_COLOR ); + if (colName.equals(AppConstants.RI_CHART_INCLUDE)) + valueCols.append(", " + AppConstants.RI_CHART_INCLUDE + " " + AppConstants.RI_CHART_INCLUDE ); + //} + }*/ + String final_sql = ""; + reportSQL = Utils.replaceInString(reportSQL, " from ", " FROM "); + reportSQL = Utils.replaceInString(reportSQL, " From ", " FROM "); + reportSQL = Utils.replaceInString(reportSQL, " select ", " SELECT "); + reportSQL = Utils.replaceInString(reportSQL, " union ", " UNION "); + //reportSQL = reportSQL.replaceAll("[\\s]*\\(", "("); +// if(reportSQL.indexOf("UNION") != -1) { +// if(reportSQL.indexOf("FROM(")!=-1) +// final_sql += " "+reportSQL.substring(reportSQL.indexOf("FROM(") ); +// else if (reportSQL.indexOf("FROM (")!=-1) +// final_sql += " "+reportSQL.substring(reportSQL.indexOf("FROM (") ); +// //TODO ELSE THROW ERROR +// } +// else { +// final_sql += " "+reportSQL.substring(reportSQL.toUpperCase().indexOf(" FROM ")); +// } + int pos = 0; + int pos_first_select = 0; + int pos_dup_select = 0; + int pos_prev_select = 0; + int pos_last_select = 0; + if (reportSQL.indexOf("FROM", pos)!=-1) { + pos = reportSQL.indexOf("FROM", pos); + pos_dup_select = reportSQL.lastIndexOf("SELECT",pos); + pos_first_select = reportSQL.indexOf("SELECT");//,pos); + logger.debug(EELFLoggerDelegate.debugLogger, ("pos_select " + pos_first_select + " " + pos_dup_select)); + if(pos_dup_select > pos_first_select) { + logger.debug(EELFLoggerDelegate.debugLogger, ("********pos_dup_select ********" + pos_dup_select)); + //pos_dup_select1 = pos_dup_select; + pos_prev_select = pos_first_select; + pos_last_select = pos_dup_select; + while (pos_last_select > pos_prev_select) { + logger.debug(EELFLoggerDelegate.debugLogger, ("pos_last , pos_prev " + pos_last_select + " " + pos_prev_select)); + pos = reportSQL.indexOf("FROM", pos+2); + pos_prev_select = pos_last_select; + pos_last_select = reportSQL.lastIndexOf("SELECT",pos); + logger.debug(EELFLoggerDelegate.debugLogger, ("in WHILE LOOP LAST " + pos_last_select)); + } + } + + } + final_sql += " "+reportSQL.substring(pos); + logger.debug(EELFLoggerDelegate.debugLogger, ("Final SQL " + final_sql)); + String sql = "SELECT " + legendCol + ", " + legendCol+"_1" + seriesCol.toString()+ nvl(valueCols.toString(), ", 1") + + groupCol.toString() + + final_sql; + logger.debug(EELFLoggerDelegate.debugLogger, ("Final sql in generateChartSQL " +sql)); + + return sql; + } // generateChartSQL + + private String getColumnSelectStr(DataColumnType dc, HttpServletRequest request) { + //String colName = dc.isCalculated() ? dc.getColName() + // : ((nvl(dc.getTableId()).length() > 0) ? (dc.getTableId() + "." + dc + // .getColName()) : dc.getColName()); + String colName = dc.getColName(); + String paramValue = null; + //if (dc.isCalculated()) { + if (reportRuntime.getFormFieldList() != null) { + for (Iterator iter = reportRuntime.getFormFieldList().getFormField().iterator(); iter.hasNext();) { + FormFieldType fft = (FormFieldType) iter.next(); + String fieldId = fft.getFieldId(); + String fieldDisplay = reportRuntime.getFormFieldDisplayName(fft); + String formfield_value = ""; + formfield_value = AppUtils.getRequestNvlValue(request, fieldId); + paramValue = nvl(formfield_value); + if(paramValue.length()>0) { + /*sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl( + paramValue, "NULL"));*/ + colName = Utils.replaceInString(colName, "'" + fieldDisplay + "'", "'"+nvl( + paramValue, "NULL")+"'"); + colName = Utils.replaceInString(colName, fieldDisplay, nvl( + paramValue, "NULL")); + } + } + return colName; + } + //} + return colName; + } // getColumnSelectStr + + + + public String getSelectExpr(DataColumnType dct) { + // String colName = + // dct.isCalculated()?dct.getColName():((nvl(dct.getTableId()).length()>0)?(dct.getTableId()+"."+dct.getColName()):dct.getColName()); + return getSelectExpr(dct, dct.getColName() /* colName */); + } // getSelectExpr + + private String getSelectExpr(DataColumnType dct, String colName) { + String colType = dct.getColType(); + if (colType.equals(AppConstants.CT_CHAR) + || ((nvl(dct.getColFormat()).length() == 0) && (!colType + .equals(AppConstants.CT_DATE)))) + return colName; + else + return "TO_CHAR(" + colName + ", '" + + nvl(dct.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT) + "')"; + } // getSelectExpr + + private String formatChartColumn(String colName) { + logger.debug(EELFLoggerDelegate.debugLogger, ("Format Chart Column Input colName " + colName)); + colName = colName.trim(); + colName = Utils.replaceInString(colName, "TO_CHAR", "to_char"); + colName = Utils.replaceInString(colName, "to_number", "TO_NUMBER"); + //reportSQL = reportSQL.replaceAll("[\\s]*\\(", "("); + colName = colName.replaceAll(",[\\s]*\\(", ",("); + StringBuffer colNameBuf = new StringBuffer(colName); + int pos = 0, posFormatStart = 0, posFormatEnd = 0; + String format = ""; + + if(colNameBuf.indexOf("999")==-1 && colNameBuf.indexOf("990")==-1) { + logger.debug(EELFLoggerDelegate.debugLogger, (" return colName " + colNameBuf.toString())); + return colNameBuf.toString(); + } + + while (colNameBuf.indexOf("to_char")!=-1) { + if(colNameBuf.indexOf("999")!=-1 || colNameBuf.indexOf("990")!=-1) { + pos = colNameBuf.indexOf("to_char"); + colNameBuf.insert(pos, " TO_NUMBER ( CR_RAPTOR.SAFE_TO_NUMBER ("); + pos = colNameBuf.indexOf("to_char"); + colNameBuf.replace(pos, pos+7, "TO_CHAR"); + //colName = Utils.replaceInString(colNameBuf.toString(), "to_char", " TO_NUMBER ( CR_RAPTOR.SAFE_TO_NUMBER ( TO_CHAR "); + logger.debug(EELFLoggerDelegate.debugLogger, ("After adding to_number " + colNameBuf.toString())); + //posFormatStart = colNameBuf.lastIndexOf(",'")+1; + posFormatStart = colNameBuf.indexOf(",'", pos)+1; + posFormatEnd = colNameBuf.indexOf(")",posFormatStart); + logger.debug(EELFLoggerDelegate.debugLogger, (posFormatStart + " " + posFormatEnd + " "+ pos)); + format = colNameBuf.substring(posFormatStart, posFormatEnd); + //posFormatEnd = colNameBuf.indexOf(")",posFormatEnd); + colNameBuf.insert(posFormatEnd+1, " ," + format + ") , "+ format + ")"); + logger.debug(EELFLoggerDelegate.debugLogger, ("colNameBuf " + colNameBuf.toString())); + } + } + logger.debug(EELFLoggerDelegate.debugLogger, (" return colName " + colNameBuf.toString())); + return colNameBuf.toString(); + } + + public List getChartValueColumnsList( int filter, HashMap formValues) { /*filter; all=0;create without new chart =1; createNewChart=2 */ + List reportCols = reportRuntime.getAllColumns(); + + ArrayList chartValueCols = new ArrayList(); + int flag = 0; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + flag = 0; + DataColumnType dc = (DataColumnType) iter.next(); +// if(filter == 2 || filter == 1) { + flag = reportRuntime.getDependsOnFormFieldFlag(dc, formValues); + + if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0 && !(nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))) { + if(nvl(dc.getChartGroup()).length()<=0) { + if( filter == 2 && (dc.isCreateInNewChart()!=null && dc.isCreateInNewChart().booleanValue())) { + chartValueCols.add(dc); + } else if (filter == 1 && (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) { + chartValueCols.add(dc); + } + else if(filter == 0) chartValueCols.add(dc); + } else chartValueCols.add(dc); + } +// } else +// chartValueCols.add(dc); + } // for + Collections.sort(chartValueCols, new ChartSeqComparator()); + return chartValueCols; + } // getChartValueColumnsList + + public String parseTitle(String title, HashMap formValues) { + Set set = formValues.entrySet(); + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + Map.Entry entry = (Entry) iter.next(); + if(title.indexOf("["+ entry.getKey() + "]")!= -1) { + title = Utils.replaceInString(title, "["+entry.getKey()+"]", nvl( + (String) entry.getValue(), "")); + } + } + return title; + } + + public java.util.Date getDateFromDateStr(String dateStr) { + SimpleDateFormat MMDDYYYYFormat = new SimpleDateFormat("MM/dd/yyyy"); + SimpleDateFormat EEEMMDDYYYYFormat = new SimpleDateFormat("EEE, MM/dd/yyyy"); //2012-11-01 00:00:00 + SimpleDateFormat YYYYMMDDFormat = new SimpleDateFormat("yyyy/MM/dd"); + SimpleDateFormat MONYYYYFormat = new SimpleDateFormat("MMM yyyy"); + SimpleDateFormat MMYYYYFormat = new SimpleDateFormat("MM/yyyy"); + SimpleDateFormat MMMMMDDYYYYFormat = new SimpleDateFormat("MMMMM dd, yyyy"); + SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat timestampHrFormat = new SimpleDateFormat("yyyy-MM-dd HH"); + SimpleDateFormat timestampDayFormat = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat DDMONYYYYFormat = new SimpleDateFormat("dd-MMM-yyyy"); + SimpleDateFormat MONTHYYYYFormat = new SimpleDateFormat("MMMMM, yyyy"); + SimpleDateFormat MMDDYYYYHHFormat = new SimpleDateFormat("MM/dd/yyyy HH"); + SimpleDateFormat MMDDYYYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); + SimpleDateFormat MMDDYYYYHHMMFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm"); + SimpleDateFormat YYYYMMDDHHMMSSFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); + SimpleDateFormat YYYYMMDDHHMMFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm"); + SimpleDateFormat DDMONYYYYHHMMSSFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); + SimpleDateFormat DDMONYYYYHHMMFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm"); + SimpleDateFormat MMDDYYFormat = new SimpleDateFormat("MM/dd/yy"); + SimpleDateFormat MMDDYYHHMMFormat = new SimpleDateFormat("MM/dd/yy HH:mm"); + SimpleDateFormat MMDDYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yy HH:mm:ss"); + SimpleDateFormat timestampFormat1 = new SimpleDateFormat("yyyy-M-d.HH.mm. s. S"); + SimpleDateFormat MMDDYYYYHHMMZFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm z"); + SimpleDateFormat YYYYFormat = new SimpleDateFormat("yyyy"); + java.util.Date date = null; + + int formatFlag = 0; + + final int YEARFLAG = 1; + final int MONTHFLAG = 2; + final int DAYFLAG = 3; + final int HOURFLAG = 4; + final int MINFLAG = 5; + final int SECFLAG = 6; + final int MILLISECFLAG = 7; + final int DAYOFTHEWEEKFLAG = 8; + final int FLAGDATE = 9; + /*int yearFlag = 1; + int monthFlag = 2; + int dayFlag = 3; + int hourFlag = 4; + int minFlag = 5; + int secFlag = 6; + int milliSecFlag = 7; + int dayoftheweekFlag = 8; + int flagDate = 10; + */ + + date = MMDDYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + if(date==null) { + date = EEEMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYOFTHEWEEKFLAG; + } + if(date==null) { + date = MMDDYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + if(date==null) { + //MMDDYYYYHHFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = HOURFLAG; + } + if(date==null) { + date = MMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + if(date==null) { + date = YYYYMMDDFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + if(date==null) { + date = timestampFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + if(date==null) { + date = timestampHrFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = HOURFLAG; + } + if(date==null) { + date = timestampDayFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + + if(date==null) { + date = MONYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MONTHFLAG; + } + if(date==null) { + date = MMYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MONTHFLAG; + } + if(date==null) { + date = MMMMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + if(date==null) { + date = MONTHYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MONTHFLAG; + } + + if(date==null) { + date = YYYYMMDDHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + + if(date==null) { + date = YYYYMMDDHHMMFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + + if(date==null) { + date = DDMONYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + + if(date==null) { + date = DDMONYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + + if(date==null) { + date = DDMONYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + + if(date==null) { + date = MMDDYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + + if(date==null) { + date = MMDDYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + + if(date==null) { + date = MMDDYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + + if(date==null) { + date = timestampFormat1.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + + if(date==null) { + date = MMDDYYYYHHMMZFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + + if(date==null) { + date = YYYYFormat.parse(dateStr, new ParsePosition(0)); + /* Some random numbers should not satisfy this year format. */ + if(dateStr.length()>4) date = null; + if(date!=null) formatFlag = YEARFLAG; + } + if(date==null) + date = null; + return date; + } + + public int getFlagFromDateStr(String dateStr) { + SimpleDateFormat MMDDYYYYFormat = new SimpleDateFormat("MM/dd/yyyy"); + SimpleDateFormat EEEMMDDYYYYFormat = new SimpleDateFormat("EEE, MM/dd/yyyy"); //2012-11-01 00:00:00 + SimpleDateFormat YYYYMMDDFormat = new SimpleDateFormat("yyyy/MM/dd"); + SimpleDateFormat MONYYYYFormat = new SimpleDateFormat("MMM yyyy"); + SimpleDateFormat MMYYYYFormat = new SimpleDateFormat("MM/yyyy"); + SimpleDateFormat MMMMMDDYYYYFormat = new SimpleDateFormat("MMMMM dd, yyyy"); + SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat timestampHrFormat = new SimpleDateFormat("yyyy-MM-dd HH"); + SimpleDateFormat timestampDayFormat = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat DDMONYYYYFormat = new SimpleDateFormat("dd-MMM-yyyy"); + SimpleDateFormat MONTHYYYYFormat = new SimpleDateFormat("MMMMM, yyyy"); + SimpleDateFormat MMDDYYYYHHFormat = new SimpleDateFormat("MM/dd/yyyy HH"); + SimpleDateFormat MMDDYYYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); + SimpleDateFormat MMDDYYYYHHMMFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm"); + SimpleDateFormat YYYYMMDDHHMMSSFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); + SimpleDateFormat YYYYMMDDHHMMFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm"); + SimpleDateFormat DDMONYYYYHHMMSSFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); + SimpleDateFormat DDMONYYYYHHMMFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm"); + SimpleDateFormat MMDDYYFormat = new SimpleDateFormat("MM/dd/yy"); + SimpleDateFormat MMDDYYHHMMFormat = new SimpleDateFormat("MM/dd/yy HH:mm"); + SimpleDateFormat MMDDYYHHMMSSFormat = new SimpleDateFormat("MM/dd/yy HH:mm:ss"); + SimpleDateFormat timestampFormat1 = new SimpleDateFormat("yyyy-M-d.HH.mm. s. S"); + SimpleDateFormat MMDDYYYYHHMMZFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm z"); + SimpleDateFormat YYYYFormat = new SimpleDateFormat("yyyy"); + java.util.Date date = null; + + int formatFlag = 0; + + final int YEARFLAG = 1; + final int MONTHFLAG = 2; + final int DAYFLAG = 3; + final int HOURFLAG = 4; + final int MINFLAG = 5; + final int SECFLAG = 6; + final int MILLISECFLAG = 7; + final int DAYOFTHEWEEKFLAG = 8; + final int FLAGDATE = 9; + /*int yearFlag = 1; + int monthFlag = 2; + int dayFlag = 3; + int hourFlag = 4; + int minFlag = 5; + int secFlag = 6; + int milliSecFlag = 7; + int dayoftheweekFlag = 8; + int flagDate = 10; + */ + + date = MMDDYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + if(date==null) { + date = EEEMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYOFTHEWEEKFLAG; + } + if(date==null) { + date = MMDDYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + if(date==null) { + //MMDDYYYYHHFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = HOURFLAG; + } + if(date==null) { + date = MMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + if(date==null) { + date = YYYYMMDDFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + if(date==null) { + date = timestampFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + if(date==null) { + date = timestampHrFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = HOURFLAG; + } + if(date==null) { + date = timestampDayFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + if(date==null) { + date = MONYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MONTHFLAG; + } + if(date==null) { + date = MMYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MONTHFLAG; + } + if(date==null) { + date = MMMMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + if(date==null) { + date = MONTHYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MONTHFLAG; + } + + if(date==null) { + date = YYYYMMDDHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + + if(date==null) { + date = YYYYMMDDHHMMFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + + if(date==null) { + date = DDMONYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + + if(date==null) { + date = DDMONYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + + if(date==null) { + date = DDMONYYYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + + if(date==null) { + date = MMDDYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + + if(date==null) { + date = MMDDYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + + if(date==null) { + date = MMDDYYFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = DAYFLAG; + } + + if(date==null) { + date = timestampFormat1.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = SECFLAG; + } + + if(date==null) { + date = MMDDYYYYHHMMZFormat.parse(dateStr, new ParsePosition(0)); + if(date!=null) formatFlag = MINFLAG; + } + + if(date==null) { + date = YYYYFormat.parse(dateStr, new ParsePosition(0)); + /* Some random numbers should not satisfy this year format. */ + if(dateStr.length()>4) date = null; + if(date!=null) formatFlag = YEARFLAG; + } + if(date==null) + date = null; + return formatFlag; + } + + public static String[] reverse(String[] arr) { + List list = Arrays.asList(arr); + Collections.reverse(list); + return (String[])list.toArray(); + } + + public int getNumberOfDecimalPlaces(double num) { + Double d = num; + String[] splitter = d.toString().split("\\."); + splitter[0].length(); // Before Decimal Count + splitter[1].length(); // After Decimal Count + return splitter[1].length(); + } + + public boolean getBooleanValue(String s) { + return getBooleanValue(s,null); + } + + public boolean getBooleanValue(String s, Boolean defaultValue) { + s = nvl(s); + if(s.length()<=0 && defaultValue!=null) return defaultValue.booleanValue(); + else if(s.length()<=0) return false; + else { + if(s.toUpperCase().startsWith("Y") || s.toLowerCase().equals("true")) + return true; + else + return false; + } + } + + + public String IntToLetter(int Int) { + if (Int<27){ + return Character.toString((char)(Int+96)); + } else { + if (Int%26==0) { + return IntToLetter((Int/26)-1)+IntToLetter((Int%26)+1); + } else { + return IntToLetter(Int/26)+IntToLetter(Int%26); + } + } + } + + + + + private void clearReportRuntimeBackup(HttpServletRequest request) { + //Session sess = Sessions.getCurrent(true)getCurrent(); + //HttpSession session = (HttpSession)sess.getNativeSession(); + HttpSession session = request.getSession(); + session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST); + request.removeAttribute(AppConstants.DRILLDOWN_INDEX); + session.removeAttribute(AppConstants.DRILLDOWN_INDEX); + request.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX); + session.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX); + Enumeration enum1 = session.getAttributeNames(); + String attributeName = ""; + while(enum1.hasMoreElements()) { + attributeName = enum1.nextElement(); + if(attributeName.startsWith("parent_")) { + session.removeAttribute(attributeName); + } + } + session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST); + session.removeAttribute(AppConstants.SI_BACKUP_FOR_REP_ID); + session.removeAttribute(AppConstants.SI_COLUMN_LOOKUP); + session.removeAttribute(AppConstants.SI_DASHBOARD_REP_ID); + session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP); + session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME); + session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP); + session.removeAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP); + session.removeAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP); + session.removeAttribute(AppConstants.SI_DATA_SIZE_FOR_TEXTFIELD_POPUP); + session.removeAttribute(AppConstants.SI_MAP); + session.removeAttribute(AppConstants.SI_MAP_OBJECT); + session.removeAttribute(AppConstants.SI_REPORT_DEFINITION); + session.removeAttribute(AppConstants.SI_REPORT_RUNTIME); + session.removeAttribute(AppConstants.SI_REPORT_RUN_BACKUP); + session.removeAttribute(AppConstants.SI_REPORT_SCHEDULE); + session.removeAttribute(AppConstants.RI_REPORT_DATA); + session.removeAttribute(AppConstants.RI_CHART_DATA); + session.removeAttribute(AppConstants.SI_FORMFIELD_INFO); + session.removeAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO); + + } // clearReportRuntimeBackup + + + public static synchronized java.util.HashMap getRequestParametersMap(ReportRuntime rr, HttpServletRequest request) + { + HashMap valuesMap = new HashMap(); + + ReportFormFields rff = rr.getReportFormFields(); + + int idx = 0; + FormField ff = null; + + Map fieldNameMap = new HashMap(); + int countOfFields = 0 ; + + + for(rff.resetNext(); rff.hasNext(); idx++) { + ff = rff.getNext(); + fieldNameMap.put(ff.getFieldName(), ff.getFieldDisplayName()); + countOfFields++; + } + + List formParameter = new ArrayList(); + String formField = ""; + for(int i = 0 ; i < rff.size(); i++) { + ff = ((FormField)rff.getFormField(i)); + formField = ff.getFieldName(); + boolean isMultiValue = false; + isMultiValue = ff.getFieldType().equals(FormField.FFT_CHECK_BOX) + || ff.getFieldType().equals(FormField.FFT_LIST_MULTI); + boolean isTextArea = (ff.getFieldType().equals(FormField.FFT_TEXTAREA) && rr.getReportDefType() + .equals(AppConstants.RD_SQL_BASED)); + + if(request.getParameterValues(formField) != null && isMultiValue ) { + String[] vals = request.getParameterValues(formField); + StringBuffer value = new StringBuffer(""); + if(!AppUtils.getRequestFlag(request, AppConstants.RI_RESET_ACTION)) { + + if ( isMultiValue ) { + value.append("("); + } + for(int j = 0 ; j < vals.length; j++) { + if(isMultiValue) value.append("'"); + try { + if(vals[j] !=null && vals[j].length() > 0) { + vals[j] = Utils.oracleSafe(vals[j]); + value.append(java.net.URLDecoder.decode(vals[j], "UTF-8"));// + ","; + } + else + value.append(vals[j]); + } catch (UnsupportedEncodingException ex) {value.append(vals[j]);} + catch (IllegalArgumentException ex1){value.append(vals[j]);} + catch (Exception ex2){ + value.append(vals[j]); + } + + + if(isMultiValue) value.append("'"); + + if(j != vals.length -1) { + value.append(","); + } + } + if(vals.length > 0) { + value.append(")"); + } + } + + //value = value.substring(0 , value.length()); + + valuesMap.put(fieldNameMap.get(formField), value.toString()); + value = new StringBuffer(""); + } else if(request.getParameter(formField) != null) { + if(isTextArea) { + String value = ""; + value = request.getParameter(formField); + + value = Utils.oracleSafe(value); + value = "('" + Utils.replaceInString(value, ",", "'|'") + "')"; + value = Utils.replaceInString(value, "|", ","); + valuesMap.put(fieldNameMap.get(formField), value); + value = ""; + } else { + String value = ""; + if(!AppUtils.getRequestFlag(request, AppConstants.RI_RESET_ACTION)) + value = request.getParameter(formField); + valuesMap.put(fieldNameMap.get(formField), Utils.oracleSafe(value)); + } + + } else { + valuesMap.put(fieldNameMap.get(formField), "" ); + } + + } + + return valuesMap; + + } + +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartWebRuntime.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartWebRuntime.java new file mode 100644 index 0000000..3fb2440 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ChartWebRuntime.java @@ -0,0 +1,420 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.runtime; + + + + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.openecomp.portalsdk.analytics.error.RaptorException; +import org.openecomp.portalsdk.analytics.model.ReportHandler; +import org.openecomp.portalsdk.analytics.system.AppUtils; +import org.openecomp.portalsdk.analytics.util.AppConstants; +import org.openecomp.portalsdk.analytics.view.ReportData; +import org.openecomp.portalsdk.core.web.support.UserUtils; + + +public class ChartWebRuntime implements Serializable { + + + // Not used - planned to use if Hibernate used as data access layer + private String runningDataQuery = ""; + private String runningCountQuery = ""; + //CONSTANTS FOR QUERY + public final String QRY_COUNT_REPORT = ""; + public final String QRY_DATA_REPORT = ""; + + // Not used planning to use when filter is used + private StringBuffer whereClause = new StringBuffer(""); + // request used to grab request parameters + private HttpServletRequest request; + + + public ReportRuntime reportRuntime; + public ReportData reportData; + + //Used to pass user information + private final Map params = new HashMap(); + + //from chart generator retrieves list of charts to render + public ArrayList chartList; + public ArrayList infoList; + + private String totalSql; + + + // + private String drilldown_index = "0"; + + public List getRolesCommaSeperated(HttpServletRequest request) { + HashMap roles = UserUtils.getRoles(request); + List roleList = null; + StringBuffer roleBuf = new StringBuffer(""); + int count = 0; + if( roles != null ) { + roleList = Arrays.asList(roles.keySet().toArray()); + } + + return roleList; + } + + + public String getUserId(HttpServletRequest request) { + return AppUtils.getUserID(request); + } + + public String generateChart(HttpServletRequest request) { + return generateChart(request, true); + } + + + public String generateChart(HttpServletRequest request, boolean showData) { + //wire variables + //processRecursive(this, this); + long currentTime = System.currentTimeMillis(); + HttpSession session = request.getSession(); + String action = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action")); + boolean genReportData = (!action.equals("chart.json") || action.equals("chart.data.json")); + + + + final Long user_id = new Long((long) UserUtils.getUserId(request)); + + + boolean adminUser = false; + try { + adminUser = AppUtils.isAdminUser(request) || AppUtils.isSuperUser(request); + } catch (RaptorException ex) { + ex.printStackTrace(); + } + List roleList = getRolesCommaSeperated(request); + //final Map params = new HashMap(); + params.put("user_id", user_id); + params.put("role_list", roleList); + //params.put("public_yn", "Y"); + + //String action = request.getParameter(AppConstants.RI_ACTION); + String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID); + + ReportHandler rh = new ReportHandler(); + ReportRuntime rr = null; + try { + if(reportID !=null) + rr = rh.loadReportRuntime(request, reportID, true, 1); + if(rr.getReportType().equals(AppConstants.RT_HIVE)) { + String sql = rr.getReportSQL(); + rr.setWholeSQL(sql); + //if(genReportData) + //reportData = rr.loadHiveLinearReportData(rr.getWholeSQL(),user_id.toString(), 10000,request); + } else { + //if(genReportData) + //reportData = rr.loadReportData(0, user_id.toString(), 10000,request, false /*download*/); + } + } catch (RaptorException ex) { + ex.printStackTrace(); + } + setReportRuntime(rr); + setReportData( reportData); + + reportRuntime = getReportRuntime(); + reportData = getReportData(); + + + HashMap chartOptionsMap = new HashMap(); + + String rotateLabelsStr = ""; + rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle()); + if(rotateLabelsStr.toLowerCase().equals("standard")) { + rotateLabelsStr = "0"; + } else if (rotateLabelsStr.toLowerCase().equals("up45")) { + rotateLabelsStr = "45"; + } else if (rotateLabelsStr.toLowerCase().equals("down45")) { + rotateLabelsStr = "-45"; + } else if (rotateLabelsStr.toLowerCase().equals("up90")) { + rotateLabelsStr = "90"; + } else if (rotateLabelsStr.toLowerCase().equals("down90")) { + rotateLabelsStr = "-90"; + } else + rotateLabelsStr = "0"; + + String width = (AppUtils.getRequestNvlValue(request, "width").length()>0?AppUtils.getRequestNvlValue(request, "width"):(AppUtils.nvl(reportRuntime.getChartWidth()).length()>0?reportRuntime.getChartWidth():"700")); + String height = (AppUtils.getRequestNvlValue(request, "height").length()>0?AppUtils.getRequestNvlValue(request, "height"):(AppUtils.nvl(reportRuntime.getChartHeight()).length()>0?reportRuntime.getChartHeight():"300")); + String animationStr = (AppUtils.getRequestNvlValue(request, "animation").length()>0?AppUtils.getRequestNvlValue(request, "animation"):new Boolean(reportRuntime.isAnimateAnimatedChart()).toString()); + + String rotateLabels = (AppUtils.getRequestNvlValue(request, "rotateLabels").length()>0?AppUtils.getRequestNvlValue(request, "rotateLabels"):(rotateLabelsStr.length()>0?rotateLabelsStr:"0")); + String staggerLabelsStr = (AppUtils.getRequestNvlValue(request, "staggerLabels").length()>0?AppUtils.getRequestNvlValue(request, "staggerLabels"):"false"); + String showMaxMinStr = (AppUtils.getRequestNvlValue(request, "showMaxMin").length()>0?AppUtils.getRequestNvlValue(request, "showMaxMin"):"false"); + String showControlsStr = (AppUtils.getRequestNvlValue(request, "showControls").length()>0?AppUtils.getRequestNvlValue(request, "showControls"):new Boolean(reportRuntime.displayBarControls()).toString()); + String showLegendStr = (AppUtils.getRequestNvlValue(request, "showLegend").length()>0?AppUtils.getRequestNvlValue(request, "showLegend"):new Boolean(!new Boolean(reportRuntime.hideChartLegend())).toString()); + String topMarginStr = AppUtils.getRequestNvlValue(request, "topMargin"); + String topMargin = (AppUtils.nvl(topMarginStr).length()<=0)?(reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin().toString():"30"):topMarginStr; + String bottomMarginStr = AppUtils.getRequestNvlValue(request, "bottomMargin"); + String bottomMargin = (AppUtils.nvl(bottomMarginStr).length()<=0)?(reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin().toString():"50"):bottomMarginStr; + String leftMarginStr = AppUtils.getRequestNvlValue(request, "leftMargin"); + String leftMargin = (AppUtils.nvl(leftMarginStr).length()<=0)?(reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin().toString():"100"):leftMarginStr; + String rightMarginStr = AppUtils.getRequestNvlValue(request, "rightMargin"); + String rightMargin = (AppUtils.nvl(rightMarginStr).length()<=0)?(reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin().toString():"160"):rightMarginStr; + String showTitleStr = (AppUtils.getRequestNvlValue(request, "showTitle").length()>0?AppUtils.getRequestNvlValue(request, "showTitle"):new Boolean(reportRuntime.displayChartTitle()).toString()); + String subType = AppUtils.getRequestNvlValue(request, "subType").length()>0?AppUtils.getRequestNvlValue(request, "subType"):(AppUtils.nvl(reportRuntime.getTimeSeriesRender()).equals("area")?reportRuntime.getTimeSeriesRender():""); + String stackedStr = AppUtils.getRequestNvlValue(request, "stacked").length()>0?AppUtils.getRequestNvlValue(request, "stacked"):new Boolean(reportRuntime.isChartStacked()).toString(); + String horizontalBar = AppUtils.getRequestNvlValue(request, "horizontalBar").length()>0?AppUtils.getRequestNvlValue(request, "horizontalBar"):new Boolean(reportRuntime.isHorizontalOrientation()).toString(); + String barRealTimeAxis = AppUtils.getRequestNvlValue(request, "barRealTimeAxis"); + String barReduceXAxisLabels = AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels").length()>0?AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels"):new Boolean(reportRuntime.isLessXaxisTickers()).toString();; + String timeAxis = AppUtils.getRequestNvlValue(request, "timeAxis").length()>0?AppUtils.getRequestNvlValue(request, "timeAxis"):new Boolean(reportRuntime.isTimeAxis()).toString(); + String logScale = AppUtils.getRequestNvlValue(request, "logScale").length()>0?AppUtils.getRequestNvlValue(request, "logScale"):new Boolean(reportRuntime.isLogScale()).toString(); + String precision = AppUtils.getRequestNvlValue(request, "precision").length()>0?AppUtils.getRequestNvlValue(request, "precision"):"2"; + + /* boolean animation = AppUtils.getRequestFlag(request, "animation"); + boolean staggerLabels = AppUtils.getRequestFlag(request, "staggerLabels"); + boolean showMaxMin = (showMaxMinStr.length()<=0)?false:Boolean.parseBoolean(showMaxMinStr); + boolean showControls = (showControlsStr.length()<=0)?true:Boolean.parseBoolean(showControlsStr); + boolean showLegend = (showLegendStr.length()<=0)?true:Boolean.parseBoolean(showLegendStr); + boolean showTitle = (showTitleStr.length()<=0)?true:Boolean.parseBoolean(showTitleStr); + boolean stacked = (stackedStr.length()<=0)?true:Boolean.parseBoolean(stackedStr); + */ + // Add all options to Map + chartOptionsMap.put("width", width); + chartOptionsMap.put("height", height); + chartOptionsMap.put("animation", animationStr); + chartOptionsMap.put("rotateLabels", rotateLabels); + chartOptionsMap.put("staggerLabels", staggerLabelsStr); + chartOptionsMap.put("showMaxMin", showMaxMinStr); + chartOptionsMap.put("showControls", showControlsStr); + chartOptionsMap.put("showLegend", showLegendStr); + chartOptionsMap.put("topMargin", topMargin); + chartOptionsMap.put("bottomMargin", bottomMargin); + chartOptionsMap.put("leftMargin", leftMargin); + chartOptionsMap.put("rightMargin", rightMargin); + chartOptionsMap.put("showTitle", showTitleStr); + chartOptionsMap.put("subType", subType); + chartOptionsMap.put("stacked", stackedStr); + chartOptionsMap.put("horizontalBar", horizontalBar); + chartOptionsMap.put("timeAxis", timeAxis); + chartOptionsMap.put("barRealTimeAxis", barRealTimeAxis); + chartOptionsMap.put("barReduceXAxisLabels", barReduceXAxisLabels); + + chartOptionsMap.put("logScale", logScale); + chartOptionsMap.put("precision", precision); + + + + if(reportRuntime!=null) { + StringBuffer title = new StringBuffer(""); + title.append(reportRuntime.getReportName()); + } + + if(! (action.equals("chart.json") || action.equals("chart.data.json"))) { + + + //Chart + String chartType = reportRuntime.getChartType(); + return drawD3Charts(chartOptionsMap, request); + //drawD3Charts(); + } else /*if (action.equals("chart.json"))*/ { + String chartType = reportRuntime.getChartType(); + return returnChartJSON(chartOptionsMap, request, showData); + + + } /*else { + + return ("Internal Error Occurred."); + }*/ + + } + + + public String nvl(String s) { + return (s == null) ? "" : s; + } + + /** + * @return the reportRuntime + */ + public ReportRuntime getReportRuntime() { + return reportRuntime; + } + + /** + * @param reportRuntime the reportRuntime to set + */ + public void setReportRuntime(ReportRuntime reportRuntime) { + this.reportRuntime = reportRuntime; + } + + /** + * @return the reportData + */ + public ReportData getReportData() { + return reportData; + } + + /** + * @param reportData the reportData to set + */ + public void setReportData(ReportData reportData) { + this.reportData = reportData; + } + + public boolean isNull(String a) { + if ((a == null) || (a.length() == 0) || a.equalsIgnoreCase("null")) + return true; + else + return false; + } + + + protected String nvl(String s, String sDefault) { + return nvl(s).equals("") ? sDefault : s; + } + + protected static String nvls(String s) { + return (s == null) ? "" : s; + } + + protected static String nvls(String s, String sDefault) { + return nvls(s).equals("") ? sDefault : s; + } + + protected boolean getFlagInBoolean(String s) { + return nvl(s).toUpperCase().startsWith("Y") || nvl(s).toLowerCase().equals("true"); + } + + + /** + * @return the chartList + */ + public ArrayList getChartList() { + return chartList; + } + + /** + * @param chartList the chartList to set + */ + public void setChartList(ArrayList chartList) { + this.chartList = chartList; + } + + /** + * @return the infoList + */ + public ArrayList getInfoList() { + return infoList; + } + + /** + * @param infoList the infoList to set + */ + public void setInfoList(ArrayList infoList) { + this.infoList = infoList; + } + + + + private void clearReportRuntimeBackup(HttpSession session, HttpServletRequest request) { + session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST); + request.removeAttribute(AppConstants.DRILLDOWN_INDEX); + session.removeAttribute(AppConstants.DRILLDOWN_INDEX); + request.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX); + session.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX); + Enumeration enum1 = session.getAttributeNames(); + String attributeName = ""; + while(enum1.hasMoreElements()) { + attributeName = enum1.nextElement(); + if(attributeName.startsWith("parent_")) { + session.removeAttribute(attributeName); + } + } + session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST); + session.removeAttribute(AppConstants.SI_BACKUP_FOR_REP_ID); + session.removeAttribute(AppConstants.SI_COLUMN_LOOKUP); + session.removeAttribute(AppConstants.SI_DASHBOARD_REP_ID); + session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP); + session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME); + session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP); + session.removeAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP); + session.removeAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP); + session.removeAttribute(AppConstants.SI_DATA_SIZE_FOR_TEXTFIELD_POPUP); + session.removeAttribute(AppConstants.SI_MAP); + session.removeAttribute(AppConstants.SI_MAP_OBJECT); + session.removeAttribute(AppConstants.SI_REPORT_DEFINITION); + session.removeAttribute(AppConstants.SI_REPORT_RUNTIME); + session.removeAttribute(AppConstants.SI_REPORT_RUN_BACKUP); + session.removeAttribute(AppConstants.SI_REPORT_SCHEDULE); + session.removeAttribute(AppConstants.RI_REPORT_DATA); + session.removeAttribute(AppConstants.RI_CHART_DATA); + session.removeAttribute(AppConstants.SI_FORMFIELD_INFO); + session.removeAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO); + } // clearReportRuntimeBackup + + + public String getTotalSql() { + return totalSql; + } + + public void setTotalSql(String totalSql) { + this.totalSql = totalSql; + } + + + + /* public void drawD3Charts(HashMap chartOptionsMap) { + drawD3Charts(chartOptionsMap); + + } + */ + + public String drawD3Charts(HashMap chartOptionsMap, HttpServletRequest request) { + + ChartD3Helper chartHelper = new ChartD3Helper(reportRuntime); + chartHelper.setChartType(reportRuntime.getChartType()); + try { + return chartHelper.createVisualization(reportRuntime, chartOptionsMap, request); + } catch(RaptorException ex) { + ex.printStackTrace(); + } + return ""; + + } + + public String returnChartJSON(HashMap chartOptionsMap, HttpServletRequest request, boolean showData) { + + ChartJSONHelper chartJSONHelper = new ChartJSONHelper(reportRuntime); + chartJSONHelper.setChartType(reportRuntime.getChartType()); + try { + return chartJSONHelper.generateJSON(reportRuntime, chartOptionsMap, request, showData); + } catch(RaptorException ex) { + ex.printStackTrace(); + } + return ""; + + } + + } + diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/CommonChartOptions.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/CommonChartOptions.java new file mode 100644 index 0000000..e8ba2ee --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/CommonChartOptions.java @@ -0,0 +1,81 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.runtime; + +public class CommonChartOptions { + + private String legendPosition = "top"; + private String legendLabelAngle = "up45"; + private boolean hideLegend = false; + private boolean animateAnimatedChart = true; + private int topMargin = 30; + private int bottomMargin = 50; + private int leftMargin = 100; + private int rightMargin = 60; + + public String getLegendPosition() { + return legendPosition; + } + public void setLegendPosition(String legendPosition) { + this.legendPosition = legendPosition; + } + public String getLegendLabelAngle() { + return legendLabelAngle; + } + public void setLegendLabelAngle(String legendLabelAngle) { + this.legendLabelAngle = legendLabelAngle; + } + public boolean isHideLegend() { + return hideLegend; + } + public void setHideLegend(boolean hideLegend) { + this.hideLegend = hideLegend; + } + public boolean isAnimateAnimatedChart() { + return animateAnimatedChart; + } + public void setAnimateAnimatedChart(boolean animateAnimatedChart) { + this.animateAnimatedChart = animateAnimatedChart; + } + public int getTopMargin() { + return topMargin; + } + public void setTopMargin(int topMargin) { + this.topMargin = topMargin; + } + public int getBottomMargin() { + return bottomMargin; + } + public void setBottomMargin(int bottomMargin) { + this.bottomMargin = bottomMargin; + } + public int getLeftMargin() { + return leftMargin; + } + public void setLeftMargin(int leftMargin) { + this.leftMargin = leftMargin; + } + public int getRightMargin() { + return rightMargin; + } + public void setRightMargin(int rightMargin) { + this.rightMargin = rightMargin; + } +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ErrorJSONRuntime.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ErrorJSONRuntime.java new file mode 100644 index 0000000..d619c4e --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/ErrorJSONRuntime.java @@ -0,0 +1,43 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.runtime; + +public class ErrorJSONRuntime { + + private String errormessage; + private String stacktrace; + + public String getErrormessage() { + return errormessage; + } + public void setErrormessage(String errormessage) { + this.errormessage = errormessage; + } + public String getStacktrace() { + return stacktrace; + } + public void setStacktrace(String stacktrace) { + this.stacktrace = stacktrace; + } + + + + +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FlexTimeSeriesChartOptions.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FlexTimeSeriesChartOptions.java new file mode 100644 index 0000000..3b3060b --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FlexTimeSeriesChartOptions.java @@ -0,0 +1,38 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +package org.openecomp.portalsdk.analytics.model.runtime; + +public class FlexTimeSeriesChartOptions { + private int zoomIn = 25; + private String timeAxisType = ""; + public int getZoomIn() { + return zoomIn; + } + public void setZoomIn(int zoomIn) { + this.zoomIn = zoomIn; + } + public String getTimeAxisType() { + return timeAxisType; + } + public void setTimeAxisType(String timeAxisType) { + this.timeAxisType = timeAxisType; + } + +} diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FormField.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FormField.java new file mode 100644 index 0000000..ea21567 --- /dev/null +++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/runtime/FormField.java @@ -0,0 +1,2111 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +/* =========================================================================================== + * This class is part of RAPTOR (Rapid Application Programming Tool for OLAP Reporting) + * Raptor : This tool is used to generate different kinds of reports with lot of utilities + * =========================================================================================== + * + * ------------------------------------------------------------------------------------------- + * FormField.java - This class is used to generate all types of form field. + * ------------------------------------------------------------------------------------------- + * + * Created By : Stan Pishamanov + * Modified & Maintained By : Sundar Ramalingam + * + * Changes + * ------- + * 18-Aug-2009 : Version 8.5 (Sundar); Populating predefined formfields bug has been resolved. + * 13-Aug-2009 : Version 8.5 (RS); Form field chaining is supported even for hidden variables. + * 13-Aug-2009 : Version 8.5 (RS); Nothing changed just comment. + * 10-Aug-2009 : Version 9.0 (RS); required logic is added for Multiple Dropdown. + * 06-Aug-2009 : Version 9.0 (RS); B getAjaxHtml is added for converting form field chain from Iframe to AJAX. + * 08-Jun-2009 : Version 8.3 (RS); Hidden formfields now is displayed even when the sql is not provided. + * + */ +package org.openecomp.portalsdk.analytics.model.runtime; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException; +import org.openecomp.portalsdk.analytics.error.UserDefinedException; +import org.openecomp.portalsdk.analytics.model.base.IdNameList; +import org.openecomp.portalsdk.analytics.model.base.IdNameLookup; +import org.openecomp.portalsdk.analytics.model.base.IdNameSql; +import org.openecomp.portalsdk.analytics.model.base.IdNameValue; +import org.openecomp.portalsdk.analytics.system.AppUtils; +import org.openecomp.portalsdk.analytics.system.ConnectionUtils; +import org.openecomp.portalsdk.analytics.system.Globals; +import org.openecomp.portalsdk.analytics.util.DataSet; +import org.openecomp.portalsdk.analytics.util.Utils; +import org.openecomp.portalsdk.analytics.xmlobj.JavascriptItemType; + +public class FormField extends org.openecomp.portalsdk.analytics.RaptorObject implements Serializable { + private static final String HTML_FORM = "formd"; + + private String fieldName = null; + + private String fieldDisplayName = null; + + private String fieldType = FFT_TEXT_W_POPUP; + + private String validationType = VT_NONE; + + private boolean required = false; + + public boolean hasPredefinedList = false; + + private String defaultValue = null; + + private Calendar rangeStartDate = null; + + private Calendar rangeEndDate = null; + + private String rangeStartDateSQL = null; + + private String rangeEndDateSQL = null; + + private String fieldDefaultSQL = null; + + private String multiSelectListSize = null; + + private String helpText = null; + + private IdNameList lookupList = null; + + private String dbInfo = null; + + private String userId = null; + + private boolean visible = true; + + private String dependsOn = null; + + private boolean triggerOtherFormFields = false; + + private boolean triggerThisFormfield = false; + + // Form field types + public static final String FFT_TEXT_W_POPUP = "TEXT_WITH_POPUP"; + + public static final String FFT_TEXT = "TEXT"; + + public static final String FFT_TEXTAREA = "TEXTAREA"; + + public static final String FFT_COMBO_BOX = "COMBO_BOX"; + + public static final String FFT_LIST_BOX = "LIST_BOX"; + + public static final String FFT_RADIO_BTN = "RADIO_BTN"; + + public static final String FFT_CHECK_BOX = "CHECK_BOX"; + + public static final String FFT_LIST_MULTI = "LIST_MULTI_SELECT"; + + public static final String FFT_HIDDEN = "HIDDEN"; + + public static final String FFT_BLANK = "BLANK"; + + // Validation types + public static final String VT_NONE = "NONE"; + + public static final String VT_DATE = "DATE"; + + public static final String VT_TIMESTAMP_HR = "TIMESTAMP_HR"; + + public static final String VT_TIMESTAMP_MIN = "TIMESTAMP_MIN"; + + public static final String VT_TIMESTAMP_SEC = "TIMESTAMP_SEC"; + + public static final String VT_INT = "INTEGER"; + + public static final String VT_INT_POSITIVE = "POSITIVE_INTEGER"; + + public static final String VT_INT_NON_NEGATIVE = "NON_NEGATIVE_INTEGER"; + + public static final String VT_FLOAT = "FLOAT"; + + public static final String VT_FLOAT_POSITIVE = "POSITIVE_FLOAT"; + + public static final String VT_FLOAT_NON_NEGATIVE = "NON_NEGATIVE_FLOAT"; + + private FormField(String fieldName, String fieldDisplayName, String fieldType, + String validationType, boolean required, String defaultValue, String helpText, boolean visible, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate, + String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize ) { + //super(); + this (fieldName,fieldDisplayName,fieldType,validationType,required,defaultValue,helpText, dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize); + setVisible(visible); + } // FormField + + private FormField(String fieldName, String fieldDisplayName, String fieldType, + String validationType, boolean required, String defaultValue, String helpText, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate, + String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize ) { + super(); + setFieldName(fieldName); + setFieldDisplayName(fieldDisplayName); + setFieldType(nvl(fieldType, FFT_TEXT)); + setValidationType(validationType); + setRequired(required); + setDefaultValue(defaultValue); + setHelpText(helpText); + setDependsOn(dependsOn); + setRangeStartDate(rangeStartDate); + setRangeEndDate(rangeEndDate); + setRangeStartDateSQL(rangeStartDateSQL); + setRangeEndDateSQL(rangeEndDateSQL); + setMultiSelectListSize(multiSelectListSize); + } + public FormField(String fieldName, String fieldDisplayName, String fieldType, + String validationType, boolean required, String defaultValue, String helpText, + List predefinedValues, boolean visible, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate, + String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize) { + this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue, + helpText,visible, dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize); + if (predefinedValues != null) + setPredefinedListLookup(predefinedValues); + } // FormField + + public FormField(String fieldName, String fieldDisplayName, String fieldType, + String validationType, boolean required, String defaultValue, String helpText, + String lookupSql, boolean visible, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate, + String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize ) { + this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue, + helpText,visible, dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize); + if (defaultValue!=null && defaultValue.length()>10 && defaultValue.substring(0,10).trim().toLowerCase().startsWith("select")) { + setFieldDefaultSQL(defaultValue); + setDefaultValue(""); + } + setLookupList(new IdNameSql(lookupSql,defaultValue)); + } // FormField + + public FormField(String fieldName, String fieldDisplayName, String fieldType, + String validationType, boolean required, String defaultValue, String helpText, + String dbTableName, String dbIdField, String dbNameField, String dbSortByField, boolean visible, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate, + String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize) { + this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue, + helpText,dbTableName,dbIdField,dbNameField,dbSortByField, dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize); + setVisible(visible); + } + + public FormField(String fieldName, String fieldDisplayName, String fieldType, + String validationType, boolean required, String defaultValue, String helpText, + String dbTableName, String dbIdField, String dbNameField, String dbSortByField, String dependsOn, + Calendar rangeStartDate, Calendar rangeEndDate, + String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize ) { + this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue, + helpText,dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize); + //if(dependsOn !=null){ this.dependsOn = dependsOn; }else { this.dependsOn = "" + if (defaultValue!=null && defaultValue.length()>10 && defaultValue.substring(0,10).trim().toLowerCase().startsWith("select")) { + setFieldDefaultSQL(defaultValue); + setDefaultValue(""); + if(fieldType.equals(FFT_TEXT)) + setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField,defaultValue,true)); + else + setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField,defaultValue,false)); + } + else { + if(fieldType.equals(FFT_TEXT)) + setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField, true)); + else + setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField, false)); + } + + this.setRangeStartDate(rangeStartDate); + this.setRangeEndDate(rangeEndDate); + this.setRangeStartDateSQL(rangeStartDateSQL); + this.setRangeEndDateSQL(rangeEndDateSQL); + + } // FormField + + + private void setPredefinedListLookup(List predefinedValues) { + IdNameList lookup = new IdNameList(); + for (Iterator iter = predefinedValues.iterator(); iter.hasNext();) { + String value = (String) iter.next(); + lookup.addValue(value, value); + } // for + setHasPredefinedList(true); + setLookupList(lookup); + } // setPredefinedListLookup + + public String getFieldName() { + return fieldName; + } + + public String getFieldDisplayName() { + return fieldDisplayName; + } + + public String getFieldType() { + return fieldType; + } + + public String getValidationType() { + return validationType; + } + + public boolean isRequired() { + return required; + } + + public String getDefaultValue() { + return defaultValue; + } + + public String getHelpText() { + return helpText; + } + + public IdNameList getLookupList() { + return lookupList; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public void setFieldDisplayName(String fieldDisplayName) { + this.fieldDisplayName = fieldDisplayName; + } + + public void setFieldType(String fieldType) { + this.fieldType = fieldType; + } + + public void setValidationType(String validationType) { + this.validationType = nvl(validationType, VT_NONE); + } + + public void setRequired(boolean required) { + this.required = required; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + public void setHelpText(String helpText) { + this.helpText = helpText; + } + + public void setLookupList(IdNameList lookupList) { + this.lookupList = lookupList; + } + + public void setDefaultList(IdNameList lookupList) { + this.lookupList = lookupList; + } + + public String getBaseSQL() { + return (lookupList == null) ? null : lookupList.getBaseSQL(); + } // getBaseSQL + + public String getBaseWholeSQL() { + return (lookupList == null) ? null : lookupList.getBaseWholeSQL(); + } // getBaseWholeSQL + + public String getBaseWholeReadonlySQL() { + return (lookupList == null) ? null : lookupList.getBaseWholeReadonlySQL(); + } // getBaseWholeReadonlySQL + + public String getBaseSQLForPDFExcel() { + return (lookupList == null) ? null : lookupList.getBaseSQLForPDFExcel(getFieldType().equals(FFT_LIST_MULTI)||getFieldType().equals(FFT_CHECK_BOX)?true:false); + } // getBaseSQLForPDFExcel + + public String getDisplayNameHtml() { + if (nvl(helpText).length() > 0) + return "" + fieldDisplayName + ""; + else + return fieldDisplayName; + } // getDisplayNameHtml + + /*public String getHtml() throws RaptorRuntimeException { + return getHtml("" , null, null, false); + } // getHtml*/ + + public String getHtml(String fieldValue, HashMap formValues, ReportRuntime rr)throws RaptorRuntimeException { + return getHtml(fieldValue,formValues, rr, false); + } + + public String getHelpLink(String fieldName) { + //return "\"\""; + return ((getHelpText()!=null && getHelpText().length()>0)? "tooltipText=\""+ getHelpText()+"\">": ">"); + //return ((getHelpText()!=null && getHelpText().length()>0)? "": ""); + } + + + public String getCallableAfterChainingJavascript(String fieldName, ReportRuntime rr) { + JavascriptItemType javascriptItemType = null; + StringBuffer callJavascriptText = new StringBuffer(""); + if(rr.getJavascriptList()!=null) { + for (Iterator iter = rr.getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) { + javascriptItemType = (JavascriptItemType)iter.next(); + if(javascriptItemType.getFieldId().equals(fieldName)) { + if(nvl(javascriptItemType.getCallText()).toLowerCase().startsWith("afterchaining")) + callJavascriptText.append(" "+javascriptItemType.getCallText()); + } + } + } + return callJavascriptText.toString()+" "; + } + public String getCallableJavascript(String fieldName, ReportRuntime rr) { + JavascriptItemType javascriptItemType = null; + StringBuffer callJavascriptText = new StringBuffer(""); + if(rr.getJavascriptList()!=null) { + for (Iterator iter = rr.getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) { + javascriptItemType = (JavascriptItemType)iter.next(); + if(javascriptItemType.getFieldId().equals(fieldName)) { + if(!nvl(javascriptItemType.getCallText()).toLowerCase().startsWith("afterchaining")) + callJavascriptText.append(" "+javascriptItemType.getCallText()); + } + } + } + return callJavascriptText.toString()+" "; + } + + public String getCallableOnChangeJavascript(String fieldName, ReportRuntime rr) { + String callText = getCallableJavascript(fieldName, rr); + if(callText != null && callText.trim().toLowerCase().indexOf("onchange")>=0) { + Pattern re1 = Pattern.compile("\\=(.*?)\\)"); + Matcher matcher = re1.matcher(callText); + while (matcher.find()) { + callText = matcher.group(); + if(callText!=null && callText.startsWith("=\"")) { + callText = callText.substring(2); + } else if (callText!=null) + callText = callText.substring(1); + } + callText = callText.replaceAll("this", "documentForm."+fieldName); + } else callText = null; + return callText; + } + + public String getAjaxHtml(String fieldValue, HashMap formValues, ReportRuntime rr, boolean inSchedule) throws RaptorRuntimeException { + fieldValue = nvl(fieldValue, defaultValue); + String readOnly = "ff_readonly"; + try { + if(fieldValue !=null && fieldValue.length() > 0) + fieldValue = java.net.URLDecoder.decode(fieldValue, "UTF-8"); + } catch (UnsupportedEncodingException ex) {} + catch (IllegalArgumentException ex1){} + catch (Exception ex2){} + if (fieldType.equals(FFT_COMBO_BOX)) { + StringBuffer sb = new StringBuffer(); + //System.out.println("COMBO BOX " + fieldName); + String oldSQL = ""; + if (!required) + sb.append("obj.options[obj.options.length] = new Option('-->select value<--','');"); + + IdNameList lookup = getLookupList(); + try { + if(!hasPredefinedList) { + //if(dependsOn != null && dependsOn != "") { + //if(dependsOn != null && dependsOn != "" ) { + IdNameSql lu = (IdNameSql) lookup; + String SQL = ""; + SQL = lu.getSql(); + /*if(nvl(fieldValue,"").length()<=0) + SQL = lu.getSql(); + else + SQL = lu.getBaseSQLForPDFExcel(false); + */ + //System.out.println("FORMFIELD 6666667 First" + ((IdNameSql)lookup).getSql()); + oldSQL = lu.getSql(); + //SQL = Utils.replaceInString(SQL, "[VALUE]", fieldValue); + if(formValues != null) { + Set set = formValues.entrySet(); + String value = ""; + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + Map.Entry entry = (Entry) iter.next(); + value = (String) entry.getValue(); + if(inSchedule) { + try { + value = java.net.URLDecoder.decode(Utils.oracleSafe(value), "UTF-8"); + } catch (UnsupportedEncodingException ex) { + + } + } + if (value!=null && (value.length() <=0 || value.equals("NULL"))) { + value = "NULL"; + SQL = Utils.replaceInString(SQL, "'["+entry.getKey()+"]'", value); + SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value); + } else { + SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value); + } + } + lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL()); + } + //} + lookupList = lookup; + + //} + try { + lookup.loadUserData(0, "", getDbInfo(), getUserId()); + } catch (Exception e ){ e.printStackTrace(); //throw new RaptorRuntimeException(e); + } + } + lookup.trimToSize(); + + String selectedValue = ""; + int count = 0; + for (lookup.resetNext(); lookup.hasNext();) { + IdNameValue value = lookup.getNext(); + if(value != null && value.getId() != null && value.getName() != null ) { + /*if (count == 0 && required) { + selectedValue = value.getId(); + count++; + } else if (nvl(fieldValue).length()>0){ + if (fieldValue != null && fieldValue.equals(value.getId())){ + selectedValue = value.getId(); + } + count++; + } else { + count++; + } */ + if (count == 0) { + if(required){ + selectedValue = value.getId(); + } + count++; + } + sb.append("obj.options[obj.options.length] = new Option('" + Utils.singleQuoteEncode(value.getName())+"','"+Utils.singleQuoteEncode(value.getId())+"');"); + if ((fieldValue != null && fieldValue.equals(value.getId()))){ + sb.append("obj.options[obj.options.length-1].selected=true;"); + selectedValue = value.getId(); + } + if(value.isReadOnly()) + sb.append("obj.disabled=true;"); + else + sb.append("obj.disabled=false;"); + + } + } // for + if (formValues.containsKey(fieldDisplayName)){ + formValues.remove(fieldDisplayName); + } + formValues.put(fieldDisplayName, selectedValue); + } catch (Exception e) { + //throw new RaptorRuntimeException(e); + } + if(!hasPredefinedList) { + if(oldSQL != null && !oldSQL.equals("")) { + ((IdNameSql)lookup).setSQL(oldSQL); + } + } + //System.out.println("FORMFIELD 6666667 " + ((IdNameSql)lookup).getSql()); + if( isVisible()) + return sb.toString(); + else return ""; + } else if (fieldType.equals(FFT_LIST_MULTI)) { + StringBuffer sb = new StringBuffer(); + String oldSQL = ""; + + fieldValue = '|' + fieldValue + '|'; + IdNameList lookup = getLookupList(); + try { + if(!hasPredefinedList) { + //if(dependsOn != null && dependsOn != "") { + //if(dependsOn != null && dependsOn != "" ) { + IdNameSql lu = (IdNameSql) lookup; + String SQL = ""; + SQL = lu.getSql(); + /*if(nvl(fieldValue,"").length()<=0) + SQL = lu.getSql(); + else + SQL = lu.getBaseSQLForPDFExcel(false); + SQL = Utils.replaceInString(SQL, "[VALUE]", fieldValue); + */ + oldSQL = lu.getSql(); + if(formValues != null) { + Set set = formValues.entrySet(); + String value = ""; + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + Map.Entry entry = (Entry) iter.next(); + value = (String) entry.getValue(); + if(inSchedule) { //('1347') + try { + value = java.net.URLDecoder.decode(value, "UTF-8"); + } catch (UnsupportedEncodingException ex) { + + } + } + SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value); + } + lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL()); + } + //} + lookupList = lookup; + //} + + lookup.loadUserData(0, "", getDbInfo(),getUserId()); + } + + for (lookup.resetNext(); lookup.hasNext();) { + IdNameValue value = lookup.getNext(); + sb.append("obj.options[obj.options.length] = new Option('" + Utils.singleQuoteEncode(value.getName()) +"','"+Utils.singleQuoteEncode(value.getId())+"');"); + if (fieldValue.indexOf('|' + value.getId() + '|') >= 0) + sb.append("obj.options[obj.options.length-1].selected=true;"); + if(value.isReadOnly()) + sb.append("obj.disabled=true;"); + else + sb.append("obj.disabled=false;"); + + } // for + + // lookup.clearData(); + } catch (Exception e) { + //throw new RaptorRuntimeException(e); + } + if(!hasPredefinedList) { + if(oldSQL != null && !oldSQL.equals("")) { + ((IdNameSql)lookup).setSQL(oldSQL); + } + } + if(isVisible()) + return sb.toString(); + else + return ""; + } else if (fieldType.equals(FFT_TEXT_W_POPUP)) { + //System.out.println("TEXT POPUP " + fieldName); + String oldSQL = ""; + IdNameValue idNamevalue = null; + String fieldDefValue=""; + String fieldDefDisplay=""; + try { + IdNameList lookup = getLookupList(); + if(dependsOn != null && dependsOn != "" ) { + IdNameSql lu = (IdNameSql) lookup; + String SQL = getBaseWholeSQL(); + if(SQL.toLowerCase().indexOf(readOnly) != -1) { + SQL = getBaseWholeReadonlySQL(); + } + oldSQL = lu.getSql(); + if(formValues != null) { + Set set = formValues.entrySet(); + String value = ""; + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + Map.Entry entry = (Entry) iter.next(); + value = (String) entry.getValue(); + if(inSchedule) { + try { + value = java.net.URLDecoder.decode(Utils.oracleSafe(value), "UTF-8"); + } catch (UnsupportedEncodingException ex) { + + } + } + SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value); +// if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1) { + if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1 || SQL.indexOf("'"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"'")!=-1 + || SQL.indexOf("'%"+"["+entry.getKey()+"]"+"%'")!=-1 || SQL.indexOf("'%"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"%'")!=-1 + || SQL.indexOf("'_"+"["+entry.getKey()+"]"+"_'")!=-1 || SQL.indexOf("'_"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"_'")!=-1 + || SQL.indexOf("'%_"+"["+entry.getKey()+"]"+"_%'")!=-1 || SQL.indexOf("'%_"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"_%'")!=-1) { + + SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", nvl( + value, "NULL")); + } else { + // Added to prevent SQL Injection + if(SQL.indexOf("["+entry.getKey()+"]")!=-1) { + try { + double vD = Double.parseDouble(value); + SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", nvl( + value, "NULL")); + } catch (NumberFormatException ex) { + throw new UserDefinedException("Expected number, Given String for the form field \"" + "["+entry.getKey()+"]"+"\""); + } + } + } + } + if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.trim().length()<=0)) + lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL()); + else + lookup = new IdNameSql(-1,SQL,null); + } + } + //lookupList = lookup; + + if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.trim().length()<=0)) { + lookup.loadUserData(0, "", getDbInfo(), getUserId()); + for (lookup.resetNext(); lookup.hasNext();) { + idNamevalue = lookup.getNext(); + break; + + } + fieldDefValue = nvl(idNamevalue.getId()); + fieldDefDisplay = nvl(idNamevalue.getName()); + } else { + try { + // -2 indicates to run the whole sql for matching value + lookup.loadUserData(-2, "", getDbInfo(), getUserId()); + lookup.trimToSize(); + for (lookup.resetNext(); lookup.hasNext();) { + IdNameValue value = lookup.getNext(); + if(value != null && value.getId() != null && value.getName() != null ) { + fieldDefValue = nvl(value.getId()); + if (fieldValue != null && fieldValue.equals(value.getId())) { + fieldDefDisplay = nvl(value.getName()); + break; + } + else { + fieldDefValue = ""; + fieldDefDisplay = ""; + } + } + } + if (fieldDefDisplay == null || fieldDefDisplay.length()<=0) { + fieldDefDisplay = nvl(fieldDefValue); + } + + if(oldSQL != null && !oldSQL.equals("")) { + ((IdNameSql)lookup).setSQL(oldSQL); + } + + } catch (Exception e) { + //throw new RaptorRuntimeException(e); + } + + + //----- END ---// + + + if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.length()<=0)) { + fieldDefValue = nvl((idNamevalue!=null)?idNamevalue.getId():""); + fieldDefDisplay = nvl((idNamevalue!=null)?idNamevalue.getName():""); + } else { + if(fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.length()<=0) fieldValue=""; + fieldDefValue = nvl(fieldDefValue); + fieldDefDisplay = nvl(fieldDefDisplay); + } + + } + }catch(Exception e) { //throw new RaptorRuntimeException(e); + } + if(isVisible()) { + /* return "\n" + "0 && (dependsOn == null || dependsOn.length()<=0)) { + sb.append((fieldValue!=null)?"obj.value=\""+nvl(fieldValue)+"\";":""); + } else if (lookup != null) { + lookup.loadUserData(0, "", getDbInfo(), getUserId()); + int iCnt = 0; + for (lookup.resetNext(); lookup.hasNext(); iCnt++) { + IdNameValue value = lookup.getNext(); + //System.out.println("HIDDEN " + value.getId() + " " + value.getName()); + sb.append((value!=null)?"obj.value=\""+nvl(value.getId())+"\";":""); + if(value.isReadOnly()) + sb.append("obj.disabled=true;"); + else + sb.append("obj.disabled=false;"); + break; + } // for + if(lookup.size()<=0) { + sb.append("obj.value=\"\""); + + } + } else { + sb.append((fieldValue!=null)?"obj.value=\""+Utils.singleQuoteEncode(nvl(fieldValue))+"\";":""); + } + if(oldSQL != null && !oldSQL.equals("")) { + ((IdNameSql)lookup).setSQL(oldSQL); + } + // lookup.clearData(); + } catch (Exception e) { + //throw new RaptorRuntimeException(e); + } + //if(isVisible()) + return sb.toString() ; + } else if (fieldType.equals(FFT_LIST_BOX)) { + StringBuffer sb = new StringBuffer(); + //System.out.println("COMBO BOX " + fieldName); + String oldSQL = ""; + if (!required) + sb.append("obj.options[obj.options.length] = new Option('-->select value<--','');"); + + IdNameList lookup = getLookupList(); + try { + if(!hasPredefinedList) { + //if(dependsOn != null && dependsOn != "") { + //if(dependsOn != null && dependsOn != "" ) { + IdNameSql lu = (IdNameSql) lookup; + String SQL = ""; + SQL = lu.getSql(); + /*if(nvl(fieldValue,"").length()<=0) + SQL = lu.getSql(); + else + SQL = lu.getBaseSQLForPDFExcel(false); + */ + //System.out.println("FORMFIELD 6666667 First" + ((IdNameSql)lookup).getSql()); + oldSQL = lu.getSql(); + //SQL = Utils.replaceInString(SQL, "[VALUE]", fieldValue); + if(formValues != null) { + Set set = formValues.entrySet(); + String value = ""; + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + Map.Entry entry = (Entry) iter.next(); + value = (String) entry.getValue(); + if(inSchedule) { + try { + value = java.net.URLDecoder.decode(Utils.oracleSafe(value), "UTF-8"); + } catch (UnsupportedEncodingException ex) { + + } + } + if (value!=null && (value.length() <=0 || value.equals("NULL"))) { + value = "NULL"; + SQL = Utils.replaceInString(SQL, "'["+entry.getKey()+"]'", value); + SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value); + } else { + SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value); + } + } + lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL()); + } + //} + lookupList = lookup; + + //} + try { + lookup.loadUserData(0, "", getDbInfo(), getUserId()); + } catch (Exception e ){ e.printStackTrace(); //throw new RaptorRuntimeException(e); + } + } + lookup.trimToSize(); + + String selectedValue = ""; + int count = 0; + for (lookup.resetNext(); lookup.hasNext();) { + IdNameValue value = lookup.getNext(); + if(value != null && value.getId() != null && value.getName() != null ) { + /*if (count == 0 && required) { + selectedValue = value.getId(); + count++; + } else if (nvl(fieldValue).length()>0){ + if (fieldValue != null && fieldValue.equals(value.getId())){ + selectedValue = value.getId(); + } + count++; + } else { + count++; + } */ + if (count == 0) { + if(required){ + selectedValue = value.getId(); + } + count++; + } + sb.append("obj.options[obj.options.length] = new Option('" + Utils.singleQuoteEncode(value.getName())+"','"+Utils.singleQuoteEncode(value.getId())+"');"); + if ((fieldValue != null && fieldValue.equals(value.getId()))){ + sb.append("obj.options[obj.options.length-1].selected=true;"); + selectedValue = value.getId(); + } + if(value.isReadOnly()) + sb.append("obj.disabled=true;"); + else + sb.append("obj.disabled=false;"); + + } + } // for + if (formValues.containsKey(fieldDisplayName)){ + formValues.remove(fieldDisplayName); + } + formValues.put(fieldDisplayName, selectedValue); + } catch (Exception e) { + //throw new RaptorRuntimeException(e); + } + if(!hasPredefinedList) { + if(oldSQL != null && !oldSQL.equals("")) { + ((IdNameSql)lookup).setSQL(oldSQL); + } + } + //System.out.println("FORMFIELD 6666667 " + ((IdNameSql)lookup).getSql()); + if( isVisible()) + return sb.toString(); + else return ""; + } + + return ""; + } + + public String getHtml(String fieldValue, HashMap formValues, ReportRuntime rr, boolean inSchedule) throws RaptorRuntimeException { + fieldValue = nvl(fieldValue, defaultValue); + int MILLIS_IN_DAY = 1000 * 60 * 60 * 24; + String readOnlyInSql = "ff_readonly"; + boolean readOnly = false; + try { + if(fieldValue !=null && fieldValue.length() > 0) + fieldValue = java.net.URLDecoder.decode(fieldValue, "UTF-8"); + } catch (UnsupportedEncodingException ex) {} + catch (IllegalArgumentException ex1){} + catch (Exception ex2){} + //System.out.println(fieldName + " " + fieldType + " " + fieldValue); + if (fieldType.equals(FFT_TEXT_W_POPUP)) { + //System.out.println("TEXT POPUP " + fieldName); + String oldSQL = ""; + IdNameValue idNamevalue = null; + String fieldDefValue=""; + String fieldDefDisplay=""; + IdNameList lookup = null; + try { + lookup = getLookupList(); + if(!hasPredefinedList) { + if(dependsOn != null && dependsOn != "" ) { + IdNameSql lu = (IdNameSql) lookup; + String SQL = getBaseWholeSQL(); + if(SQL.toLowerCase().indexOf(readOnlyInSql) != -1) { + SQL = getBaseWholeReadonlySQL(); + } + oldSQL = lu.getSql(); + if(formValues != null) { + Set set = formValues.entrySet(); + String value = ""; + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + Map.Entry entry = (Entry) iter.next(); + value = (String) entry.getValue(); + SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value); +// if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1) { + if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1 || SQL.indexOf("'"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"'")!=-1 + || SQL.indexOf("'%"+"["+entry.getKey()+"]"+"%'")!=-1 || SQL.indexOf("'%"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"%'")!=-1 + || SQL.indexOf("'_"+"["+entry.getKey()+"]"+"_'")!=-1 || SQL.indexOf("'_"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"_'")!=-1 + || SQL.indexOf("'%_"+"["+entry.getKey()+"]"+"_%'")!=-1 || SQL.indexOf("'%_"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"_%'")!=-1) { + + SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", nvl( + value, "NULL")); + } else { + // Added to prevent SQL Injection + if(SQL.indexOf("["+entry.getKey()+"]")!=-1) { + try { + double vD = Double.parseDouble(value); + SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", nvl( + value, "NULL")); + } catch (NumberFormatException ex) { + throw new UserDefinedException("Expected number, Given String for the form field \"" + "["+entry.getKey()+"]"+"\""); + } + } + } + } + if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.trim().length()<=0)) + lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL()); + else + lookup = new IdNameSql(-1,SQL,null); + } + } + //lookupList = lookup; + + if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.trim().length()<=0)) { + lookup.loadUserData(0, "", getDbInfo(), getUserId()); + for (lookup.resetNext(); lookup.hasNext();) { + idNamevalue = lookup.getNext(); + break; + + } + fieldDefValue = nvl(idNamevalue.getId()); + fieldDefDisplay = nvl(idNamevalue.getName()); + } else { + try { + // -2 indicates to run the whole sql for matching value + lookup.loadUserData(-2, "", getDbInfo(), getUserId()); + } catch (Exception e) { + //throw new RaptorRuntimeException(e); + } + + lookup.trimToSize(); + for (lookup.resetNext(); lookup.hasNext();) { + IdNameValue value = lookup.getNext(); + if(value != null && value.getId() != null && value.getName() != null ) { + fieldDefValue = nvl(value.getId()); + if (fieldValue != null && fieldValue.equals(value.getId())) { + fieldDefDisplay = nvl(value.getName()); + break; + } + else { + fieldDefValue = ""; + fieldDefDisplay = ""; + } + } + } + if (fieldDefDisplay == null || fieldDefDisplay.length()<=0) { + fieldDefDisplay = nvl(fieldDefValue); + } + + + + //----- END ---// + + + if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.length()<=0)) { + fieldDefValue = nvl((idNamevalue!=null)?idNamevalue.getId():""); + fieldDefDisplay = nvl((idNamevalue!=null)?idNamevalue.getName():""); + } else { + if(fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.length()<=0) fieldValue=""; + fieldDefValue = nvl(fieldDefValue); + fieldDefDisplay = nvl(fieldDefDisplay); + } + + } + } else { + lookup.trimToSize(); + for (lookup.resetNext(); lookup.hasNext();) { + IdNameValue value = lookup.getNext(); + if(value != null && value.getId() != null && value.getName() != null ) { + fieldDefValue = nvl(value.getId()); + if (fieldValue != null && fieldValue.equals(value.getId())) { + fieldDefDisplay = nvl(value.getName()); + break; + } + else { + fieldDefValue = ""; + fieldDefDisplay = ""; + } + } + } + if (fieldDefDisplay == null || fieldDefDisplay.length()<=0) { + fieldDefDisplay = nvl(fieldDefValue); + } + } + }catch(Exception e) { //throw new RaptorRuntimeException(e); + } + + if(!hasPredefinedList) { + if(oldSQL != null && !oldSQL.equals("")) { + ((IdNameSql)lookup).setSQL(oldSQL); + } + } + + if(isVisible()) { + /* return "\n" + " \"Loading, "; + + return progress+" \n  \n" + + " 0) { + valueSQL = lu.getSql(); + avail_ReadOnly = (valueSQL.toLowerCase().indexOf(readOnlyInSql)!=-1); + //System.out.println("OLD SQL TEXT" + valueSQL); + //oldSQL = lu.getSql(); + if(formValues != null) { + Set set = formValues.entrySet(); + String value1 = ""; + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + Map.Entry entry = (Entry) iter.next(); + value1 = (String) entry.getValue(); + if (value1.length() <=0) { + value1 = "NULL"; + valueSQL = Utils.replaceInString(valueSQL, "'["+entry.getKey()+"]'", value1); + valueSQL = Utils.replaceInString(valueSQL, "["+entry.getKey()+"]", value1); + } else { + valueSQL = Utils.replaceInString(valueSQL, "["+entry.getKey()+"]", value1); + } + } + // should be value one. + //lookup = new IdNameSql(-1,valueSQL,lu.getDefaultSQL()); + } + } + //lookupList = lookup; + //System.out.println("8888888 88 " + valueSQL); + } + if(valueSQL!=null && valueSQL.length()>0) { + DataSet ds = ConnectionUtils.getDataSet(valueSQL.toString(), dbInfo); + strValue = ds.getString(0,1); + if(avail_ReadOnly) readOnly = ds.getString(0, 2).toUpperCase().startsWith("Y")||ds.getString(0, 2).toUpperCase().startsWith("T");; + } + }catch(Exception e) { //throw new RaptorRuntimeException(e); + } + String returnString = ""; + String timestamp ="", timestamphr = "", timestampmin = "", timestampsec = ""; + + returnString = "0 && (!(fieldValue.toUpperCase().indexOf("SELECT ")!= -1 && fieldValue.toUpperCase().indexOf("FROM")!= -1)) ) { + if(validationType.startsWith("TIMESTAMP")) { + returnString += nvl((fieldValue!=null)?fieldValue.split(" ")[0]:""); + if(fieldValue!=null && fieldValue.length()>0) { + timestamp = (fieldValue.split(" ").length > 1)?fieldValue.split(" ")[1]:""; + String timestampArr[] = timestamp.split(":"); + if((timestampArr.length == 1) || (timestampArr.length == 2) || (timestampArr.length == 3)) + timestamphr = timestampArr[0]; + if((timestampArr.length == 2) || (timestampArr.length == 3)) + timestampmin = timestampArr[1]; + if(timestampArr.length == 3) + timestampsec = timestampArr[2]; + } + + } else returnString += fieldValue; + + } else if(getFieldDefaultSQL()!=null) { + + if(validationType.startsWith("TIMESTAMP")) { + returnString += nvl((strValue.length()>0)?strValue.split(" ")[0]:""); + if(strValue.length()>0) { + timestamp = (strValue.split(" ").length > 1)?strValue.split(" ")[1]:""; + String timestampArr[] = timestamp.split(":"); + if((timestampArr.length == 1) || (timestampArr.length == 2) || (timestampArr.length == 3)) + timestamphr = timestampArr[0]; + if((timestampArr.length == 2) || (timestampArr.length == 3)) + timestampmin = timestampArr[1]; + if(timestampArr.length == 3) + timestampsec = timestampArr[2]; + } + + } else if (nvl(strValue).length()>0) { + returnString += strValue; + } else + returnString += nvl((value!=null)?value.getId():""); + } else if (nvl(strValue).length()>0) { + returnString += strValue; + } else + returnString += nvl((value!=null)?value.getId():""); + + + /*returnString += "\">" + + (validationType.equals(VT_DATE) ? "\n\t\t\t" + + "\n\t\t\t\t" + : ""); */ + + SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy"); + String stRangeText = this.getRangeStartDate() == null ? null : dtf.format(this.getRangeStartDate().getTime()); + String endRangeText = this.getRangeEndDate() == null ? null : dtf.format(this.getRangeEndDate().getTime()); + ///////////////////////// + + //get the date sqls + + //System.out.println("////////////start range date before Start" + this.getRangeStartDateSQL()); + + if (this.getRangeStartDateSQL() != null && this.getRangeStartDateSQL().trim().toLowerCase().startsWith("select")){ + //System.out.println("////////////start range date Starting"); + String SQL = this.getRangeStartDateSQL(); + if(formValues != null) { + Set set = formValues.entrySet(); + String v = ""; + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + Map.Entry entry = (Entry) iter.next(); + v = (String) entry.getValue(); + //System.out.println("///////// key is " + entry.getKey() + " = " + v); + SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", v); + } + + } + //System.out.println("////////////start range date sql created" + SQL); + try{ + DataSet ds = ConnectionUtils.getDataSet(SQL.toString(), dbInfo); + //System.out.println("////////////start range date is : " + ds.get(0)); + dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Calendar tStart = Calendar.getInstance(); + tStart.setTime(dtf.parse(ds.getString(0,0))); + dtf = new SimpleDateFormat("MM/dd/yyyy"); + stRangeText = dtf.format(tStart.getTime().getTime()-MILLIS_IN_DAY); + + }catch(Exception e){ + System.out.println("Exception////////// : start range date is : " + e); + } + } + + if (this.getRangeEndDateSQL() != null && this.getRangeEndDateSQL().trim().toLowerCase().startsWith("select")){ + //System.out.println("////////////end range date Starting"); + String SQL = this.getRangeEndDateSQL(); + if(formValues != null) { + Set set = formValues.entrySet(); + String v = ""; + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + Map.Entry entry = (Entry) iter.next(); + v = (String) entry.getValue(); + SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", v); + } + + } + try{ + DataSet ds = ConnectionUtils.getDataSet(SQL.toString(), dbInfo); + //System.out.println("////////////end range date is : " + ds.get(0)); + dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Calendar tStart = Calendar.getInstance(); + tStart.setTime(dtf.parse(ds.getString(0,0))); + dtf = new SimpleDateFormat("MM/dd/yyyy"); + //endRangeText = dtf.format(tStart.getTime()); + endRangeText = dtf.format(tStart.getTime().getTime()+MILLIS_IN_DAY); + }catch(Exception e){ + System.out.println("Exception////////// : end range date is : " + e); + } + } + + + ////////////////////// + String calendarOnClickMethodCall = ""; + String timeStampStr = ""; + if (stRangeText == null || endRangeText == null) + calendarOnClickMethodCall = "'oCalendar.select(document." + HTML_FORM + "." + fieldName + ", event,\""+ Globals.getCalendarOutputDateFormat() +"\"); return false;'"; + else + calendarOnClickMethodCall = "'oCalendar=new CalendarPopup(\"calendarDiv\", \"calendarFrame\");oCalendar.setCssPrefix(\"raptor\");oCalendar.addDisabledDates(null, \"" + stRangeText + "\"); oCalendar.addDisabledDates(\"" + endRangeText + "\", null); oCalendar.select(document." + HTML_FORM + "." + fieldName + ", event,\""+ Globals.getCalendarOutputDateFormat() +"\"); return false;'"; + returnString += "\" " + getHelpLink(fieldName) + + (validationType.equals(VT_DATE) || validationType.equals(VT_TIMESTAMP_HR) || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC) + ? "\n\t\t\t" + : ""); + if(validationType.equals(VT_TIMESTAMP_HR) || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC) ) { + //Add Hours/Minutes and Seconds. + timeStampStr = " Hour "; + } + //Minutes + if( validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC) ) { + int minutes = 0; + int t_min = 0; + try { + minutes = Integer.parseInt(nvl(rr.getParamValue(fieldName+"_Min"),"0")); + if(minutes == 0) { + if(inSchedule) minutes = Integer.parseInt(nvl(((String)formValues.get(fieldName+"_Min")),"0")); + } + } catch (NumberFormatException ex) {minutes = 0;} + try { + t_min = Integer.parseInt(timestampmin); + } catch (NumberFormatException ex) { t_min = 0;} + + if(minutes <= 0) minutes = t_min; + /*if (formValues.containsKey(fieldDisplayName+"_Min")){ + formValues.remove(fieldDisplayName+"_Min"); + formValues.put(fieldDisplayName+"_Min", minutes); + } else + formValues.put(fieldDisplayName+"_Min", minutes); + */ + timeStampStr += " Min "; + } + //Seconds + if( validationType.equals(VT_TIMESTAMP_SEC) ) { + int seconds = 0; + int t_sec = 0; + try { + seconds = Integer.parseInt(nvl(rr.getParamValue(fieldName+"_Sec"),"0")); + if(seconds == 0) { + if(inSchedule) seconds = Integer.parseInt(nvl(((String)formValues.get(fieldName+"_Sec")),"0")); + } + } catch (NumberFormatException ex) {seconds = 0;} + try { + t_sec = Integer.parseInt(timestampsec); + } catch (NumberFormatException ex) { t_sec = 0;} + + if(seconds <= 0) seconds = t_sec; + /*if (formValues.containsKey(fieldDisplayName+"_Sec")){ + formValues.remove(fieldDisplayName+"_Sec"); + formValues.put(fieldDisplayName+"_Sec", seconds); + } else + formValues.put(fieldDisplayName+"_Sec", seconds); + */ + timeStampStr += " Sec "; + } + + returnString += timeStampStr; + String checkboxStr = ""; + if(inSchedule && (validationType.equals(VT_DATE) || validationType.equals(VT_TIMESTAMP_HR) || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC)) ) { + if(!Globals.isScheduleDateParamAutoIncr()) { + checkboxStr = /*checkboxStr +" "+ */ ""; + } else { + checkboxStr = /*checkboxStr +" "+ */""; + } + /*if(validationType.equals(VT_TIMESTAMP_HR) || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC)) { + checkboxStr = checkboxStr +" "+ ""; + } + if(validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC)) { + checkboxStr = checkboxStr +" "+ ""; + } + if(validationType.equals(VT_TIMESTAMP_SEC)) { + checkboxStr = checkboxStr +" "+ ""; + }*/ + } + if(isVisible()) + return returnString+checkboxStr; + else return ""; + } else if (fieldType.equals(FFT_TEXTAREA)) { + + if(nvl(fieldValue).length()>0) { + fieldValue = Pattern.compile("(^[\r\n])|\\([\\']", Pattern.DOTALL).matcher(fieldValue).replaceAll(""); + fieldValue = Pattern.compile("[\\']\\)", Pattern.DOTALL).matcher(fieldValue).replaceAll(""); + fieldValue = fieldValue.replaceAll("','",","); // changed from "|" + fieldValue = fieldValue.replaceAll("' , '","\r\n"); + } + + if(isVisible()) + return " + +
    +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + +
    + + +
    +
    +
    +
    +
    +
    +
    + +
    + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/broadcast_list.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/broadcast_list.jsp new file mode 100644 index 0000000..2f6c68b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/broadcast_list.jsp @@ -0,0 +1,201 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.util.*" %> +<%@ page import="com.fasterxml.jackson.databind.ObjectMapper" %> +<%@ page import="org.json.JSONObject" %> +<%@ page import="java.io.StringWriter" %> +<%@ page import="org.openecomp.portalsdk.core.web.support.ControllerProperties" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> + + + + +
    +

    + Broadcast Messages +

    +
    + + <%-- Display a table for the broadcast messages of each message location --%> +
    + +
    + {{location.label}} Messages +
    + + + + + + + + + + + + + + + + + {{message.id}} + + + + + + + + + + + +
    No.Message TextStart DateEnd DateSort OrderServerActive?Delete?
    {{$index+1}}{{message.messageText}} + {{message.displayStartDate}} + {{message.displayEndDate}}{{message.sortOrder}}{{message.siteCd}} +
    + +
    +
    +
    +
    +
    + +


    +
    +
    + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/collaborateList.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/collaborateList.jsp new file mode 100644 index 0000000..b1fbfab --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/collaborateList.jsp @@ -0,0 +1,146 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %> + +
    +
    +

    User List

    +
    + + + + + + + + + + + + + + + + + + + + + + +
    User IDLast NameFirst NameEmailUserIdOnline/Offline
    + Offline + Online +
    +
    +
    +
    + Rows Per Page: + +
    +
    + Current Page: + +
    +
    + Total Page(s): + +
    + + +
    + + + + + + + + + + + +
    diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/data_out.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/data_out.jsp new file mode 100644 index 0000000..f3fb7a7 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/data_out.jsp @@ -0,0 +1,20 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +${model.output_string} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_footer.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_footer.jsp new file mode 100644 index 0000000..5a33314 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_footer.jsp @@ -0,0 +1,46 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> + +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> + + + + + +
    +
    + +
    + +
    +
    +
    + + +
    +
    +
    +
    +
    +
    +
    + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp new file mode 100644 index 0000000..05c07f0 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp @@ -0,0 +1,799 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> +<%@ page isELIgnored="false"%> +<%@ page import="org.openecomp.portalsdk.core.util.SystemProperties"%> +<%@ page import="org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties"%> +<%@ page import="org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants"%> +<%@ page import="org.openecomp.portalsdk.core.domain.MenuData"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +" /> +" /> + +<% + String contactUsLink = SystemProperties.getProperty(SystemProperties.CONTACT_US_LINK); + String redirectUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL); + String portalUrl = redirectUrl.substring(0, redirectUrl.lastIndexOf('/')) + "/processSingleSignOn"; + String getAccessLink = redirectUrl.substring(0, redirectUrl.lastIndexOf('/')) + "/get_access"; +%> + + + + +<%@include file="/WEB-INF/fusion/jsp/ebz/loginSnippet.html" %> + +
    +
    + +
    +
    +
    + + +
    +
    +
    +
    +
  • + + ECOMP Portal +
  • +
    +
    + +
    +
    + + +
    + + +
    +
    +
    +
  • + Unable to load menus +
  • +
    + +
    +
  • +
    + + +
    +
  • +
  •  
  • +
    + +
    +
    +
    +
    +
    +
    +
    + +
    +
    + + + +     {{app_name}} + +
    +
    +
    +
    + + + + + +
    +
    +
    +
    +
    +
    +
    +
    + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/loginSnippet.html b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/loginSnippet.html new file mode 100644 index 0000000..0f29ee7 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz/loginSnippet.html @@ -0,0 +1,120 @@ + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template.jsp new file mode 100644 index 0000000..59b61d1 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template.jsp @@ -0,0 +1,45 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%> + + + + + <%@ include file="/WEB-INF/fusion/jsp/meta.jsp" %> + + + +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template_noheader_nofooter.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template_noheader_nofooter.jsp new file mode 100644 index 0000000..98dccb4 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template_noheader_nofooter.jsp @@ -0,0 +1,35 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%> + + + <%@ include file="/WEB-INF/fusion/jsp/meta.jsp" %> + +
    + +
    +
    + +
    +
    + +
    + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template_report_embedded.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template_report_embedded.jsp new file mode 100644 index 0000000..4281a06 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/ebz_template_report_embedded.jsp @@ -0,0 +1,48 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%> + + + <%@ include file="/WEB-INF/fusion/jsp/meta.jsp" %> + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/es_search_demo.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/es_search_demo.jsp new file mode 100644 index 0000000..eae5324 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/es_search_demo.jsp @@ -0,0 +1,97 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> + + + +
    +
    Elastic Search - Corporate Location Data System
    +
    +
    + +   +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    Customer NamePhoneStreetCityStateZIPCLLI
    {{options._source.name}}{{options._source.suggest.payload.tn}}{{options._source.suggest.payload.addr}}{{options._source.suggest.payload.city}}{{options._source.suggest.payload.st}}{{options._source.suggest.payload.zip}}{{options._source.suggest.payload.clli}}
    +
    +
    diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/es_suggest_demo.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/es_suggest_demo.jsp new file mode 100644 index 0000000..05cfaf5 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/es_suggest_demo.jsp @@ -0,0 +1,97 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> + + + +
    +
    Elastic Search - Corporate Location Data System
    +
    +
    + +   +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    Customer NamePhoneStreetCityStateZIPCLLI
    {{options.text}}{{options.payload.tn}}{{options.payload.addr}}{{options.payload.city}}{{options.payload.st}}{{options.payload.zip}}{{options.payload.clli}}
    +
    +
    diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/frame_insert.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/frame_insert.jsp new file mode 100644 index 0000000..5f550c6 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/frame_insert.jsp @@ -0,0 +1,44 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/include.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/include.jsp new file mode 100644 index 0000000..cd6a5e0 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/include.jsp @@ -0,0 +1,30 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="org.openecomp.portalsdk.core.util.SystemProperties" %> +<%@ page import="org.openecomp.portalsdk.core.web.support.AppUtils" %> + +<%@ page import="java.util.LinkedHashMap" %> + + +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/jcs_admin.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/jcs_admin.jsp new file mode 100644 index 0000000..845beac --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/jcs_admin.jsp @@ -0,0 +1,144 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%-- <%@ include file="/WEB-INF/fusion/jsp/include.jsp"%> --%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> + +<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %> + +
    +

    Cache Regions

    + These are the regions which are currently defined in the cache. 'Items' and 'Bytes' refer to the elements currently in memory (not spooled). + You can clear all items for a region by clicking on the Clear icon next to the desired region below. You can also clear all regions which + empties the entire cache.

    + +
    +
    +
    Cache Name
    +
    # of Items
    +
    Bytes
    +
    Status
    +
    Memory Hits
    +
    Aux Hits
    +
    Not Found Misses
    +
    Expired Misses
    +
    Clear?
    +
    Items
    +
    +
    +
    + +
    {{region.size}}
    +
    {{region.byteCount}}
    +
    {{region.status}}
    +
    {{region.hitCountRam}}
    +
    {{region.hitCountAux}}
    +
    {{region.missCountNotFound}}
    +
    {{region.missCountExpired}}
    +
    +
    +
    +
    +
    +
    + +
    Key
    +
    Eternal?
    +
    Created
    +
    Max Life
    +
    Expires
    +
    Clear?
    +
    +
    +
    + + +
    {{item.eternal}}
    +
    {{item.createTime}}
    +
    {{item.maxLifeSeconds}}
    +
    {{item.expiresInSeconds}}
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/meta.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/meta.jsp new file mode 100644 index 0000000..3c4ff52 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/meta.jsp @@ -0,0 +1,36 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> + + + + + + + + + + + + + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal.html b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal.html new file mode 100644 index 0000000..0766cec --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal.html @@ -0,0 +1,324 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal_role.html b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal_role.html new file mode 100644 index 0000000..c163002 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal_role.html @@ -0,0 +1,274 @@ + + + + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal_rolefunction.html b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal_rolefunction.html new file mode 100644 index 0000000..ee0b512 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/popup_modal_rolefunction.html @@ -0,0 +1,87 @@ + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/post_search.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/post_search.jsp new file mode 100644 index 0000000..94d4b0b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/post_search.jsp @@ -0,0 +1,356 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.util.*" %> +<%@ page import="com.fasterxml.jackson.databind.ObjectMapper" %> +<%@ page import="org.json.JSONObject" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %> +<%@ include file="/WEB-INF/fusion/jsp/popup_modal_rolefunction.html" %> +<%@ include file="/WEB-INF/fusion/jsp/popup_modal_role.html" %> + + +
    + +

    WEBPHONE Search

    +
    + Please enter search criteria below:
    + +
    + Last Name:
    + +
    + +
    + First Name:
    + +
    + +
    + UserId:
    + +
    + +
    + Manager OrgUserId:
    + +
    +
    +
    + Organization:
    + +
    + +
    + Email:
    + +
    +
    + +
    + + + +
    +
    + {{noResultsString}} +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    NoNameOrgUserIdOrganizationPhoneEmailImport?
    + {{$index + 1}} + +
    + {{profile.lastName}}, {{profile.firstName}} +
    + + +
    + {{profile.orgUserId}} + + {{profile.orgCode}} + + {{profile.phone}} + + {{profile.email}} + +
    +
    + +
    +
    +
    + Exists +
    +
    +
    + Rows Per Page: + +
    +
    + Current Page: + +
    +
    + Total Page(s): + +
    + +
    + +
    + +
    + + + + +
    + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/profile.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/profile.jsp new file mode 100644 index 0000000..b01fa6b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/profile.jsp @@ -0,0 +1,442 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="org.openecomp.portalsdk.core.domain.User"%> +<%@ page import="org.openecomp.portalsdk.core.web.support.UserUtils"%> + +<%@page import="org.openecomp.portalsdk.core.web.support.ControllerProperties"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> + + + +<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %> + +<%@ include file="/WEB-INF/fusion/jsp/include.jsp"%> + +
    +

    + + +

    Profile Edit

    +
    + +

    Profile Edit

    +
    +
    +

    +
    + +
    + + Please edit the profile details below: 

    + +
    +
    + +
    + +
    +
    + +
    + +
    +
    + +
    + +
    +
    + +
    +
    +
    +
    + +
    + +
    +
    + +
    + +
    +
    + +
    + +
    +
    + +
    +
    +
    +
    + +
    + +
    +
    + +
    + +
    +
    + +
    + +
    +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    + +
    + +
    +
    + + + +
    + + + + + + + + + + + + + + + + +
    NameRemove?
    {{ role.name }} + +
    + + + +
    + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/profile_search.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/profile_search.jsp new file mode 100644 index 0000000..295faf0 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/profile_search.jsp @@ -0,0 +1,104 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %> +
    +
    +

    Profile Search

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    User IDLast NameFirst NameEmailOrgUserIdManager OrgUserIdEditActive?
    {{rowData.id}}{{rowData.lastName}}{{rowData.firstName}}{{rowData.email}}{{rowData.orgUserId}}{{rowData.managerId}} +
    + +
    +
    +
    +
    +
    + Rows Per Page: + +
    +
    + Current Page: + +
    +
    + Total Page(s): + +
    +
    + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role.jsp new file mode 100644 index 0000000..d8e2a01 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role.jsp @@ -0,0 +1,286 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> + +<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %> +<%@ include file="/WEB-INF/fusion/jsp/popup_modal_rolefunction.html" %> +<%@ include file="/WEB-INF/fusion/jsp/popup_modal_role.html" %> + +
    + +
    +
    +

    + + +

    Role Edit

    +
    + +

    Role Create

    +
    +
    +

    +
    + +
    + +
    + Please edit the role details below: 
    + +
    +
    + +
    + +
    +
    + +
    + +
    + +
    + +
    +
    + + +
    + + + + + + + + + + + + + + +
    NameRemove?
    {{ roleFunction.name }} +
    +
    + Manage Role Functions

    + +
    + + +
    + + + + + + + + + + + + + + +
    NameRemove?
    {{ role.name }} +
    +
    + +
    + + + + + + + + + + + + + + +
    Role
    +
    + +
    +
    {{ availableRole.name }}
    +
    +
    + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role_function_list.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role_function_list.jsp new file mode 100644 index 0000000..b957337 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role_function_list.jsp @@ -0,0 +1,213 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> + +<%-- <%@ include file="/WEB-INF/fusion/jsp/include.jsp" %> --%> + +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> + +<%@ include file="/WEB-INF/fusion/jsp/popup_modal_rolefunction.html" %> +<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %> +
    +
    + +

    Role Functions

    + + +

    + +
    + +
    + Click on the edit icon to update a role function, the plus icon to add additional role functions, or the delete icon to remove them. +
    +
    + + + + + + + + + + + + + + + + + +
    NameCodeEdit?Delete?
    {{ availableRoleFunction.name }}{{ availableRoleFunction.code }} + +
    +
    + +
    +
    +
    + + + + + + +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + + +
    + +
    + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role_list.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role_list.jsp new file mode 100644 index 0000000..c27c360 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/role_list.jsp @@ -0,0 +1,139 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> + +<%-- <%@ include file="/WEB-INF/fusion/jsp/include.jsp" %> --%> + +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %> + +
    +

    Roles

    +
    +
    +Click on a Role to view its details. + +
    +
    + + + + + + + + + + + + + + + + + + +
    NamePriorityActive?Delete?
    {{ availableRole.name }}{{ availableRole.priority }} +
    + +
    +
    +
    +
    +
    + +
    + +
    + +
    + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/usage_list.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/usage_list.jsp new file mode 100644 index 0000000..699c1ce --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/usage_list.jsp @@ -0,0 +1,87 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> + +<%-- <%@ include file="/WEB-INF/fusion/jsp/include.jsp" %> --%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %> + +
    +
    +

    + Usage +

    +
    +
    + The following shows all users currently logged into the application. Click the icon to expel a user from the application. + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Current User Sessions
    User IdUser NameEmailLast Access Time (minutes)Time Remaining (minutes)Expel?
    {{user.id}}{{user.lastName}}{{user.email}}{{user.lastAccess}}{{user.remaining}}
    Current Session
    +
    +
    +
    +
    + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/webrtc/collaboration.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/webrtc/collaboration.jsp new file mode 100644 index 0000000..ff6c985 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/jsp/webrtc/collaboration.jsp @@ -0,0 +1,492 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %> + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + +
    + + + + +
    + +
    +
    + + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    + + + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml new file mode 100644 index 0000000..28060a7 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml @@ -0,0 +1,352 @@ + + + + + + + + + + + + seq_fn_user + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + seq_fn_audit_log + + + + + + + + + + + + + seq_fn_role + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + seq_fn_menu + + + + + + + + + + + + + + + + + + + + + + + + seq_fn_menu + + + + + + + + + + + + + + + + + + + + + + + + + + + + seq_fn_broadcast_message + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select distinct md.parentMenu.id from MenuData as md where md.label = :paramLabel and md.label is not null + + + + select distinct md.id from MenuData as md where md.label = :paramLabel + + + + select distinct md.id, md.label, md.parentMenu.id from MenuData as md where md.label is not null + + + + select distinct functionCd from MenuData + + + + select distinct code from RoleFunction + + + + from MenuData where menuSetCode = :menu_set_cd and parentMenu is null + + + FROM UrlsAccessible A where upper(A.urlsAccessibleKey.url) = upper(:current_url) + + + + select firstName, lastName from User where id = :user_id + + + + select email from User where id = :user_id + + + + select id, firstName, lastName from User where active = true order by lastName, firstName + + + + select name from Role where id = :role_id + + + + select id, name from Role order by name + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/RNoteBookIntegration.hbm.xml b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/RNoteBookIntegration.hbm.xml new file mode 100644 index 0000000..6638b4b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/RNoteBookIntegration.hbm.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/Workflow.hbm.xml b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/Workflow.hbm.xml new file mode 100644 index 0000000..3d8852c --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/orm/Workflow.hbm.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/custom_header_include.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/custom_header_include.jsp new file mode 100644 index 0000000..0bd373b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/custom_header_include.jsp @@ -0,0 +1,135 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.*" %> + +<%@ page import="java.net.*" %> + + + + + + +<%@ include file="/WEB-INF/fusion/jsp/include.jsp" %> + +<% + String url = request.getParameter("returnUrl"); + + if (url != null) { + request.setAttribute("returnUrl", URLDecoder.decode(url, "UTF-8")); + } + +%> + + +
    " method="POST" target="_parent"> + +
    + + + + + + + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/custom_js_include.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/custom_js_include.jsp new file mode 100644 index 0000000..5abbb5a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/custom_js_include.jsp @@ -0,0 +1,31 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%-- + + +--%> diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/date_end_field_run_sql.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/date_end_field_run_sql.jsp new file mode 100644 index 0000000..fd2f9c3 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/date_end_field_run_sql.jsp @@ -0,0 +1,38 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.util.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> + + + +
    + + + +
    + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/date_start_field_run_sql.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/date_start_field_run_sql.jsp new file mode 100644 index 0000000..6982726 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/date_start_field_run_sql.jsp @@ -0,0 +1,39 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.util.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> + + + +
    + + + +
    + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/default_field_run_sql.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/default_field_run_sql.jsp new file mode 100644 index 0000000..95c99f3 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/default_field_run_sql.jsp @@ -0,0 +1,39 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.util.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> + + + +
    + + + +
    + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/disclaimer.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/disclaimer.jsp new file mode 100644 index 0000000..d5d2524 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/disclaimer.jsp @@ -0,0 +1,38 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<% if(org.openecomp.portalsdk.analytics.system.Globals.getShowDisclaimer()) { %> + + + + <%if(!org.openecomp.portalsdk.analytics.system.Globals.hideRaptorFooter()) { %> + + + + + <% } %> + + + + + +
     
       
       
     
    + +<% } %> + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/error_include.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/error_include.jsp new file mode 100644 index 0000000..8158e60 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/error_include.jsp @@ -0,0 +1,58 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.util.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.*" %> + +<% ArrayList alErrorList = (ArrayList) request.getAttribute(AppConstants.RI_ERROR_LIST); + if((alErrorList!=null)&&(alErrorList.size()>0)) { %> +
    + + + + +<% for(int i=0; i=0) + sErrorMsg = sErrorMsg.substring(sErrorMsg.indexOf("|")+1); + if((i%2)==0) { %> + +<% } %> + +<% if((i%2)==1) { %> + +<% } + } // for +%> +<% if((alErrorList.size()%2)==1) { %> + + + +<% } %> +
    + Validation Errors Found
    + Following errors need to be corrected to continue: +
    +
  • <%= sErrorMsg %> +
  • +   +
    +<% } // if +%> + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/error_page.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/error_page.jsp new file mode 100644 index 0000000..8ee73be --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/error_page.jsp @@ -0,0 +1,229 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.io.*" %> +<%@ page import="java.util.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.error.UserAccessException"%> +<%@ page import="org.openecomp.portalsdk.analytics.error.RaptorException"%> +<%@ page import="org.openecomp.portalsdk.analytics.error.UserDefinedException"%> +<%@ page isErrorPage="true" %> + + +<% java.lang.Exception ex = (Exception) request.getAttribute(AppConstants.RI_EXCEPTION); %> +<% boolean showEditLink = false; + if(AppUtils.getRequestNvlValue(request, "r_action").equals("report.run")) { + ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); + if(rr!=null) + try { + rr.checkUserWriteAccess(request); + showEditLink = true; + } catch(Exception e) {} + } // if +%> + + + + + + + + + + + Application Error + + + +<%-- jsp:include page="custom_header_include.jsp" flush="true" /--%> + +
    + + + "> + + +
    + + + + +<% if(ex!=null) { %> + <% if(ex instanceof org.openecomp.portalsdk.analytics.error.RaptorSchedularException) { %> + <% if(AppUtils.isAdminUser(request)) { %> + + + + <% } %> + + + + <% } %> + <% if(ex!=null) ex.printStackTrace(); %> + <% if(AppUtils.isAdminUser(request)) { + if ((ex instanceof org.openecomp.portalsdk.analytics.error.ReportSQLException)|| + (request.getAttribute("c_error_sql")!=null && !((String) request.getAttribute("c_error_sql")).trim().equals(""))) { + String sql = ""; + if(ex instanceof org.openecomp.portalsdk.analytics.error.ReportSQLException) + sql = ((org.openecomp.portalsdk.analytics.error.ReportSQLException) ex).getReportSQL(); + else + sql = (String) request.getAttribute("c_error_sql"); %> + <% if (sql!=null && sql.length() > 0) { %> + + + + + + + <% request.setAttribute("c_error_sql", sql); + %> + <% } %> + + + + <% if(request.getAttribute("c_error_url")!=null && !((String) request.getAttribute("c_error_url")).trim().equals("")) { %> + + + + <% } // if %> + <% } else { // reportSQLException + if (ex instanceof RaptorException) { %> + + + + <%} %> + <% } %> + <% } else { + if (ex instanceof UserAccessException) { %> + + + + <% } else if (ex instanceof UserDefinedException) { %> + + + + <% } + } %> + + + +<% } else { %> +<% if(exception instanceof org.openecomp.portalsdk.analytics.error.RaptorSchedularException) { %> + <% if(AppUtils.isAdminUser(request)) { %> + + + + <% } %> + + + <% if(exception!=null) exception.printStackTrace(); %> + +<% } %> +<% if(AppUtils.isAdminUser(request)) { + if ((exception instanceof org.openecomp.portalsdk.analytics.error.ReportSQLException)|| + (request.getAttribute("c_error_sql")!=null && !((String) request.getAttribute("c_error_sql")).trim().equals(""))) { + String sql = ""; + if(exception instanceof org.openecomp.portalsdk.analytics.error.ReportSQLException) + sql = ((org.openecomp.portalsdk.analytics.error.ReportSQLException) ex).getReportSQL(); + else + sql = (String) request.getAttribute("c_error_sql"); %> + <% if (sql!=null && sql.length() > 0) { %> + + + + + + +<% request.setAttribute("c_error_sql", sql); + %> + <% } %> + + + +<% if(request.getAttribute("c_error_url")!=null && !((String) request.getAttribute("c_error_url")).trim().equals("")) { %> + + + +<% } %> +<% } %> +<% } %> + + + +<% if(AppUtils.isAdminUser(request)) { %> + +<% } %> +<% if(exception!=null) exception.printStackTrace(); %> + +<% } // else +%> +
    +<% if(showEditLink) { %> + +<% } %> + Error/User-Alert Message: +
    + Exception Class: <%= (ex!=null && ex instanceof org.openecomp.portalsdk.analytics.error.RaptorSchedularException)?ex.getClass().toString():"" %> +
    Message: <%= (ex!=null && ex instanceof org.openecomp.portalsdk.analytics.error.RaptorSchedularException)?ex.getMessage():"" %> +
    + SQL Execution Error: +
    + <%= sql %> +
    + Error Message:
    + <%= AppUtils.getRequestNvlValue(request, "error_extra_msg") %><%= ex.getMessage() %> +
    + Please ">click here to edit report definition. +
    + Error Message:
    + <%= AppUtils.getRequestNvlValue(request, "error_extra_msg") %><%= ex.getMessage() %> +
    + Error Message:
    + <%= AppUtils.getRequestNvlValue(request, "error_extra_msg") %><%= ex.getMessage() %> +
    + Error Message:
    + <%= AppUtils.getRequestNvlValue(request, "error_extra_msg") %><%= ex.getMessage() %> +
    + ** The system administrator has been notified for this error. +
    + Exception Class: <%= (exception!=null && exception instanceof org.openecomp.portalsdk.analytics.error.RaptorSchedularException)?exception.getClass().toString():"" %> +
    Message: <%= (exception!=null && exception instanceof org.openecomp.portalsdk.analytics.error.RaptorSchedularException)?exception.getMessage():"" %> +
    + SQL Execution Error: +
    + <%= sql %> +
    + Error Message:
    + <%= AppUtils.getRequestNvlValue(request, "error_extra_msg") %><%= ex.getMessage() %> +
    + Please ">click here to edit report definition. +
    + ** The system administrator has been notified for this error. +
    + +
    + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/footer.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/footer.jsp new file mode 100644 index 0000000..c4fbe9e --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/footer.jsp @@ -0,0 +1,25 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> + + + + + +<%----%> diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_drill_down_report.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_drill_down_report.jsp new file mode 100644 index 0000000..5395948 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_drill_down_report.jsp @@ -0,0 +1,601 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.util.*" %> + +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.*" %> + +<% ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION); + List reportCols = rdef.getAllColumns(); + List rFormFields = null; + if(rdef.getFormFieldList()!=null&&rdef.getFormFieldList().getFormField().size()>0) + rFormFields = rdef.getFormFieldList().getFormField(); + + ReportFormFields ddReportFormFields = (ReportFormFields) request.getAttribute(AppConstants.RI_FORM_FIELDS); + + String drillDownSuppress = AppUtils.getRequestNvlValue(request, "drillDownSuppress"); + String drillDownParams = AppUtils.getRequestNvlValue(request, "drillDownParams"); + String drillDownRequest = AppUtils.getRequestNvlValue(request, "drillDownRequest"); + + Hashtable paramDefinitions = new Hashtable(); + StringTokenizer st = new StringTokenizer(drillDownParams, "&"); + //Added for passing request parameters in Drill Down + String[] reqParameters = Globals.getRequestParams().split(","); + int icnt=0; + // + while(st.hasMoreTokens()) { + String param = st.nextToken(); + DrillDownParamDef paramDef = new DrillDownParamDef(param); + if(paramDef.getFieldName().length()>0) + paramDefinitions.put(paramDef.getFieldName(), paramDef); + } // while +%> + + + + Drill-down Parameters Configuration + + + + + + + +
    + + + + + +<% if(ddReportFormFields!=null) + for(ddReportFormFields.resetNext(); ddReportFormFields.hasNext(); ) { + FormField ff = ddReportFormFields.getNext(); + if(!ff.getFieldType().equals(FormField.FFT_BLANK)) { + + DrillDownParamDef paramDef = (DrillDownParamDef) paramDefinitions.get(ff.getFieldName()); + if(paramDef==null) + paramDef = new DrillDownParamDef(""); %> + + <% if (ff!=null && (ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) ) { + %> + + + + + + + + + + + + + + + +<% if(rFormFields!=null) { %> + + + + + + + + +<% } // if + +%> + + <% + paramDef = (DrillDownParamDef) paramDefinitions.get(ff.getFieldName()+"_Hr"); + if(paramDef==null) + paramDef = new DrillDownParamDef(""); + %> + + + + + + + + + + + +<% + if (ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) { +%> + <% + paramDef = (DrillDownParamDef) paramDefinitions.get(ff.getFieldName()+"_Min"); + if(paramDef==null) + paramDef = new DrillDownParamDef(""); + %> + + + + + + + + + + + +<% + } + if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) { +%> + <% + paramDef = (DrillDownParamDef) paramDefinitions.get(ff.getFieldName()+"_Sec"); + if(paramDef==null) + paramDef = new DrillDownParamDef(""); + %> + + + + + + + + + + + +<% + + } + + } else { +%> + + + + + + + + + + + + + + + +<% if(rFormFields!=null) { %> + + + + + + + + +<% } // if + } // else + } // if BLANK + } // for +%> + + + + + + + + + + + + + + + + + <% if(!Globals.getPassRequestParamInDrilldown() && (!(reqParameters.length==1 && reqParameters[0].length()<=0))) { + %> + + + + + <% + icnt=0; + + for (int i = 0; i < reqParameters.length; i++) { + icnt++; + + %> + > + + + + + <% + } //for + %> + + <% + } // if requestParam + %> + + + + + + + +
    + DRILL-DOWN PARAMETERS CONFIGURATION +
    +  <%= ff.getFieldDisplayName() %> +
    +       + >No value + + Accept default +
    +       + >Fixed value + + " onChange="document.dataform.r_<%= ff.getFieldName() %>[1].click();"> +
    +       + >Value of column + + +
    +       + >Value of form field + + +
    +       + >Value set + + Pass the value of the selected column if not empty,
    + otherwise pass the value of the selected form field
    +
    +  <%= ff.getFieldDisplayName() %> (Hour) +
    +       + >No value + + Accept default +
    +       + >Value of column + + + + +
    +  <%= ff.getFieldDisplayName() %> (Minutes) +
    +       + >No value + + Accept default +
    +       + >Value of column + + + + +
    +  <%= ff.getFieldDisplayName() %> (Seconds) +
    +       + >No value + + Accept default +
    +       + >Value of column + + + + +
    +  <%= ff.getFieldDisplayName() %> +
    +       + >No value + + Accept default +
    +       + >Fixed value + + " onChange="document.dataform.r_<%= ff.getFieldName() %>[1].click();"> +
    +       + >Value of column + + +
    +       + >Value of form field + + +
    +       + >Value set + + Pass the value of the selected column if not empty,
    + otherwise pass the value of the selected form field
    +
     
    +  Parameter values not to be passed to the drill-down report
    +       + Suppress values + + +
    separate by | if multiple values
    +
     
    +  Request Parameter values to be passed to the drill-down report
    <%= reqParameters[i]%> + > +
    + Show Drilled Down Report In Popup Window: +
    +
    +

    + + + + +<%! private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %> + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_import_semaphore.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_import_semaphore.jsp new file mode 100644 index 0000000..d73a7fe --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_import_semaphore.jsp @@ -0,0 +1,80 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.util.*" %> + +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.*" %> + +<% ArrayList importedList = (ArrayList) request.getAttribute(AppConstants.RI_DATA_SET); %> + + + + Advanced Display Formatting + + + + + + +
    + + + + + + + + + + + +
     Advanced Display Formatting Import
    +<% if(importedList!=null&&importedList.size()>0) { %> + <%= importedList.size() %> Advanced Display Formattings successfully imported. +<% } else { %> + The selected report does not have Advanced Display Formattings
    + defined. No Advanced Display Formattings were imported. +<% } %> +
    +
    + +
    + + + + + + +<%! private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %> + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_semaphore.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_semaphore.jsp new file mode 100644 index 0000000..39eafb2 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_semaphore.jsp @@ -0,0 +1,419 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.util.*" %> + +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.*" %> + +<% ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION); + + String semaphoreId = AppUtils.getRequestNvlValue(request, "semaphoreId"); + String semaphoreType = AppUtils.getRequestNvlValue(request, "semaphoreType"); + SemaphoreType semaphore = rdef.getSemaphoreById(semaphoreId); + String semaphoreName = null; + List listColumns = rdef.getAllColumns(); + if(semaphore!=null) + semaphoreName = semaphore.getSemaphoreName(); + else + if(rdef.getSemaphoreList()!=null) + semaphoreName = "Display Formatting "+(rdef.getSemaphoreList().getSemaphore().size()+1); + else + semaphoreName = "Display Formatting 1"; + + String submitBtn = AppUtils.getRequestNvlValue(request, "submit_btn"); %> + + + + Advanced Display Formatting + + +<% if(submitBtn.startsWith("Save")) { %> + +<% } %> + +<% if(submitBtn.equals("Save")) { %> + + + Please wait... +<% } else { %> + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<% for(int i = 0; i<3+((semaphore==null)?2:semaphore.getFormatList().getFormat().size()); i++) { + FormatType ft = null; + if(semaphore!=null&&i + > + <% if(i==0) { %> + + <% } else { %> + + + + <% } %> + + + + + + + + + + +<% } // for +%> + + + +
     Advanced Display Formatting Definition
    Display Name: + +
    Apply Formatting To: + <% String sValue = AppConstants.ST_CELL; + if(semaphore!=null) + sValue = nvl(semaphore.getSemaphoreType(), AppConstants.ST_CELL); %> +
     
    Column Value IsBold?Italic?Under-
    line?
    Background ColorFont ColorFont FaceFont Size     Preview     
    + Any Other + "> + + + + + "> + <% sValue = "="; + if(ft!=null) + sValue = nvl(ft.getExpression(), "="); %> + + + "> + + <% boolean bValue = false; + if(ft!=null) + bValue = ft.isBold(); %> + "> + onClick="setBold(<%= i %>)"> + + <% bValue = false; + if(ft!=null) + bValue = ft.isItalic(); %> + "> + onClick="setItalic(<%= i %>)"> + + <% bValue = false; + if(ft!=null) + bValue = ft.isUnderline(); %> + "> + onClick="setUnderline(<%= i %>)"> + + <% sValue = ""; + if(ft!=null) + sValue = nvl(ft.getBgColor()); %> + + + <% sValue = ""; + if(ft!=null) + sValue = nvl(ft.getFontColor()); %> + + + <% sValue = ""; + if(ft!=null) + sValue = nvl(ft.getFontFace()); %> + + + <% sValue = "11"; + if(ft!=null) + sValue = nvl(ft.getFontSize(), "11"); %> + + + Sample +
    +
    + + + +
    + +
    + +<% } // if(submitBtn.equals("Save")) { ... } else { +%> + + + + +<%! private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %> + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_sql.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_sql.jsp new file mode 100644 index 0000000..c685bb1 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_sql.jsp @@ -0,0 +1,55 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.util.*" %> + +<%@ page import="org.openecomp.portalsdk.analytics.system.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.*" %> + + + + <%= nvl((String) request.getAttribute(AppConstants.RI_PAGE_TITLE)) %> + + + + + + + + + + + + + +
    + <%= nvl((String) request.getAttribute(AppConstants.RI_PAGE_SUBTITLE), nvl((String) request.getAttribute(AppConstants.RI_PAGE_TITLE))) %> +
    > + <%= nvl((String) request.getAttribute(AppConstants.RI_FORMATTED_SQL)) %> +
    +
    + +
    +
    + + + +<%! private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %> + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_table_cols.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_table_cols.jsp new file mode 100644 index 0000000..9dec6a5 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_table_cols.jsp @@ -0,0 +1,171 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.util.*" %> + +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.*" %> + +<% String tableName = AppUtils.getRequestValue(request, AppConstants.RI_TABLE_NAME); + String remoteDbPrefix = (String) session.getAttribute("remoteDB"); + Vector tableSources = null; + Vector dbColumns = null; + if(tableName==null) { + tableSources = DataCache.getReportTableSources(remoteDbPrefix); + if(tableSources.size()>0) + tableName = ((TableSource) DataCache.getReportTableSources(remoteDbPrefix).get(0)).getTableName(); + } + if(tableName!=null) + dbColumns = DataCache.getReportTableDbColumns(tableName.toUpperCase(),remoteDbPrefix); + + + boolean isSingleValueChoice = AppUtils.getRequestFlag(request, "single_value"); + boolean includeTableNameInResult = AppUtils.getRequestFlag(request, "return_table_name"); + boolean includeColTypeInResult = AppUtils.getRequestFlag(request, "return_col_type"); %> + + + + Table Columns + + + + + + + + +<% if(! isSingleValueChoice) { %> + +<% } // if +%> + + +
    + + +<% if(isSingleValueChoice) { %> + +<% } %> +<% if(includeTableNameInResult) { %> + +<% } %> +<% if(includeColTypeInResult) { %> + +<% } %> + + + + + + + <% int rNum = 0; + if(dbColumns!=null) + for(rNum=0; rNum + > + + <% if(isSingleValueChoice) { %> + + <% } else { %> + + + <% } // else + %> + + <% } // for + if(rNum==0) { %> + + + + <% } else { // if + %> + + + + <% + } + %> + + + + +
      + <% if(! isSingleValueChoice) { %> +   + <% } %> + + + DB Table Columns +
    <%= (rNum+1) %><%= sDisplay %> + + <%= sDisplay %>
    No columns found for table [<%= tableName %>]
    <%= "CLEAR VALUE" %>
      + <% if(! isSingleValueChoice) { %> +   + <% } %> +  
    + + + +
    + + + + +<%! private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %> + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_testrun_sql.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_testrun_sql.jsp new file mode 100644 index 0000000..a5dbd50 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/popup_testrun_sql.jsp @@ -0,0 +1,103 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.io.*" %> +<%@ page import="java.util.*" %> + +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.*" %> + +<% Exception ex = (Exception) request.getAttribute(AppConstants.RI_EXCEPTION); + DataSet ds = (DataSet) request.getAttribute(AppConstants.RI_DATA_SET); %> + + + +SQL Statement Test Run + + + + + + + + +<% if(ex!=null) { %> + + + +<% } else if(ds!=null) { %> + + + <% for(int c=0; c + + <% } %> + + <% for(int r=0; r + > + + <% for(int c=0; c + + <% } %> + + <% } // for r + if(ds.getRowCount()>Globals.getDefaultPageSize()) { %> + > + + + + <% } else if(ds.getRowCount()==0) { %> + + + + <% } // else if + } // else if +%> + + + +
    +
    +
    + <%= nvl(ex.getMessage(), " ") %> +

    + +
     <%= ds.getColumnName(c) %>
    <%= (r+1) %><%= nvl(ds.getString(r, c), " ") %>
    <%= (Globals.getDefaultPageSize()+1) %>...
    No data found
    +
    +
    + + + +<%! private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %> + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_csv.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_csv.jsp new file mode 100644 index 0000000..8115804 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_csv.jsp @@ -0,0 +1,89 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page trimDirectiveWhitespaces="true" %> +<%@ page import="java.util.*" %><%@ page import="java.text.*" %><%@ page import="java.io.*" %><%@ page import="org.openecomp.portalsdk.analytics.model.*" %><%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %><%@ page import="org.openecomp.portalsdk.analytics.view.*" %><%@ page import="org.openecomp.portalsdk.analytics.system.*" %><%@ page import="org.openecomp.portalsdk.analytics.util.*" %><% + ReportRuntime rr = null; + ReportData rd = null; + String parent = ""; + int parentFlag = 0; + if(!nvl(request.getParameter("parent"), "").equals("N")) parent = nvl(request.getParameter("parent"), ""); + if(parent.startsWith("parent_")) parentFlag = 1; + if(parentFlag == 1) { + rr = (ReportRuntime) request.getSession().getAttribute(parent+"_rr"); + rd = (ReportData) request.getSession().getAttribute(parent+"_rd"); + } + if(rr==null) rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); + if(rd==null) rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA); + String formattedReportName = new HtmlStripper().stripSpecialCharacters(rr.getReportName()); + String formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date()); + String fName = formattedReportName+formattedDate+AppUtils.getUserID(request); + boolean raw = AppUtils.getRequestFlag(request, "raw"); + if(true && !raw) + response.setContentType("application/octet-stream"); + else + response.setContentType("application/csv"); + String fileName = fName+".csv"; + String sql_whole = (String) request.getAttribute(AppConstants.RI_REPORT_SQL_WHOLE); + if(true && !raw) + response.setHeader("Content-disposition","attachment;filename="+fName+".zip"); + else + response.setHeader("Content-disposition","attachment;filename="+fName+".csv"); + try {(new ReportHandler()).createCSVFileContent(out, rd, rr, sql_whole, request,fName); + //out.flush(); + //out.close(); + if(true) { + // response.reset(); + ServletOutputStream outS = response.getOutputStream(); + java.io.File file = null; + if(true && !raw) { + response.setContentType("application/octet-stream"); + response.setHeader("Content-disposition","attachment;filename="+fName+".zip"); + file = new java.io.File(AppUtils.getTempFolderPath()+""+fName+".zip"); + } else { + response.setContentType("application/csv"); + response.setHeader("Content-disposition","attachment;filename="+fName+".csv"); + file = new java.io.File(AppUtils.getTempFolderPath()+""+fName+".csv"); + } + FileInputStream fileIn = new FileInputStream(file); + int c; + while((c=fileIn.read()) != -1){ + outS.write(c); + } + outS.flush(); + outS.close(); + fileIn.close(); + + + /*byte[] outputByte = new byte[4096]; + //copy binary contect to output stream + while(fileIn.read(outputByte, 0, 4096) != -1) { + outS.write(outputByte, 0, 4096); + } + fileIn.close(); + outS.flush(); + outS.close();*/ + } + } catch(Exception e) { + e.printStackTrace(); + Log.write("Fatal error [report_download_csv.jsp]: "+e.getMessage()); + } +%> +<%! private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %> diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_pdf.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_pdf.jsp new file mode 100644 index 0000000..e5ae9dd --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_pdf.jsp @@ -0,0 +1,40 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page trimDirectiveWhitespaces="true" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.pdf.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.view.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.*" %> +<% + ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); + ReportData rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA); + try { + new PdfReportHandler().createPdfFileContent(request,response, 3); + } catch(Exception e) { + Log.write("Fatal error [report_download_pdf.jsp]: "+e.getMessage()); + e.printStackTrace(); + } + out.clear(); + out = pageContext.pushBody(); +%> + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_xls.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_xls.jsp new file mode 100644 index 0000000..a82470d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_download_xls.jsp @@ -0,0 +1,64 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="org.openecomp.portalsdk.analytics.model.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.view.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.*" %> +<% +ReportRuntime rr = null; +ReportData rd = null; +String parent = ""; +int parentFlag = 0; +if(!nvl(request.getParameter("parent"), "").equals("N")) parent = nvl(request.getParameter("parent"), ""); +if(parent.startsWith("parent_")) parentFlag = 1; +if(parentFlag == 1) { + rr = (ReportRuntime) request.getSession().getAttribute(parent+"_rr"); + rd = (ReportData) request.getSession().getAttribute(parent+"_rd"); +} +if(rr==null) rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); +if(rd==null) rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA); + + if(rr != null && rr.getReportType().equals(AppConstants.RT_DASHBOARD)) { + //rr = (ReportRuntime) request.getSession().getAttribute("FirstDashReport"); + } else if (rr == null) + rr = (ReportRuntime) request.getSession().getAttribute("FirstDashReport"); + //rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA); + + //response.setContentType("application/vnd.ms-excel"); + //response.setHeader("Content-disposition","attachment;filename=download_all_"+AppUtils.getUserID(request)+".xls"); + String user_id = AppUtils.getUserID(request); + try { +/* if (rr.getReportType().equals(AppConstants.RT_CROSSTAB)) { + int downloadLimit = (rr.getMaxRowsInExcelDownload()>0)?rr.getMaxRowsInExcelDownload():Globals.getDownloadLimit(); + rd = rr.loadReportData(-1, AppUtils.getUserID(request), downloadLimit,request); + } +*/ + new ReportHandler().createExcelFileContent(out, rd, rr, request, response, user_id, 3); //3 whole + } catch(Exception e) { + e.printStackTrace(); + Log.write("Fatal error [report_download_xls.jsp]: "+e.getMessage()); + } + out.clear(); + out = pageContext.pushBody(); +%> +<%! private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %> + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_ebz.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_ebz.jsp new file mode 100644 index 0000000..8d42b65 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_ebz.jsp @@ -0,0 +1,179 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    Loading...
    +
    +
    +
    + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_import.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_import.jsp new file mode 100644 index 0000000..014f98a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_import.jsp @@ -0,0 +1,69 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.util.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.*" %> + + + + Import + + + + +

    + +
    + + + + + + + + + + + + + +
    + <%= Globals.getBaseTitle() %> > IMPORT REPORT XML +
    + + + +
    +
    + +
    + + + +
    + + + + + + +<%! private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %> + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_sample.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_sample.jsp new file mode 100644 index 0000000..cfbfad1 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_sample.jsp @@ -0,0 +1,40 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +

    Customizable Analytics Dashboard

    + + + + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_search.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_search.jsp new file mode 100644 index 0000000..480bdbc --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_search.jsp @@ -0,0 +1,2432 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> + + + + + + + +
    +
    +
    + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_wizard.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_wizard.jsp new file mode 100644 index 0000000..cdfe943 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/report_wizard.jsp @@ -0,0 +1,309 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%-- + Name: report_wizard.jsp + Use : Master JSP which navigates to specific JSP when different tab is selected. Default it navigates to the wizard_definition.jsp + + Change Log + ========== + + 22-Jun-2009 : Version 8.4 (Sundar); + +
      +
    • Save button is suppressed from showing when wizard is in the last page (Run page).
    • +
    • width of the content_iframe is changed back to default one when navigated from >100% report's run page.
    • +
    +--%> +<%@ page import="java.util.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.controller.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.*" %> + +<%@ page errorPage="error_page.jsp" %> + + + + + + +<% ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION); + + String reportID = rdef.getReportID(); + WizardSequence ws = rdef.getWizardSequence(); + + String curStep = ws.getCurrentStep(); + String curSubStep = ws.getCurrentSubStep(); + + String dbInfo = null; + dbInfo = rdef.getDBInfo(); + int sessionflag = 0; + if(dbInfo == null || dbInfo.length() == 0) { + dbInfo = (String) session.getAttribute("remoteDB"); + sessionflag = 1; + } + session.setAttribute("remoteDB", dbInfo); + if((dbInfo == null) && (request.getParameter("dataSource")!=null)) + session.setAttribute("remoteDB", request.getParameter("dataSource")); + + String title = (reportID.equals("-1")?"Create Report":"Edit Report"); + String navTitle = Globals.getBaseTitle()+" > " + title; + + boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB); + boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED); +%> + +<% + request.setAttribute(AppConstants.SI_REPORT_DEFINITION,rdef); +%> + + + + + + + + + + + + + +
    + +
    +
    +
    + +
    + + + + + + + + + + +
    + + +<% for(ws.resetNext(); ws.hasNext(); ) { + String sTab = ws.getNext(); %> + + + +<% } // for +%> + + +
    " width="9" height="24"> align="center" valign="middle"> + <% if(sTab.equals(curStep)) { %> +  <%= clearSpaces(sTab) %>  + <% } else if(reportID.equals("-1")) { %> +  <%= clearSpaces(sTab) %>  + <% } else { %> +  <%= clearSpaces(sTab) %>  + <% } %> + " width="9" height="24"> 
    +
    + + + + +
    <%= navTitle %>
    +
    <% if(curStep.equals(AppConstants.WS_DEFINITION)) { %> + <% if(sessionflag == 1) dbInfo = ""; %> + +<% } else if(curStep.equals(AppConstants.WS_SQL)) { %> + +<% } else if(curStep.equals(AppConstants.WS_TABLES)&&curSubStep.equals("")) { %> + +<% } else if(curStep.equals(AppConstants.WS_TABLES)&&(curSubStep.equals(AppConstants.WSS_ADD)||curSubStep.equals(AppConstants.WSS_EDIT))) { %> + +<% } else if(curStep.equals(AppConstants.WS_COLUMNS)&&curSubStep.equals("")) { %> + +<% } else if(curStep.equals(AppConstants.WS_COLUMNS)&&curSubStep.equals(AppConstants.WSS_ADD_MULTI)) { %> + +<% } else if(curStep.equals(AppConstants.WS_COLUMNS)&&curSubStep.equals(AppConstants.WSS_ORDER_ALL)) { %> + +<% } else if(curStep.equals(AppConstants.WS_COLUMNS)&&(curSubStep.equals(AppConstants.WSS_ADD)||curSubStep.equals(AppConstants.WSS_EDIT) ||curSubStep.equals(AppConstants.WA_MODIFY))) { %> + +<% } else if(curStep.equals(AppConstants.WS_FORM_FIELDS)&&curSubStep.equals("")||curSubStep.equals(AppConstants.WSS_ADD_BLANK)) { %> + +<% } else if(curStep.equals(AppConstants.WS_FORM_FIELDS)&&(curSubStep.equals(AppConstants.WSS_ADD)||curSubStep.equals(AppConstants.WSS_EDIT))) { %> + +<% } else if(curStep.equals(AppConstants.WS_FILTERS)&&curSubStep.equals("")) { %> + +<% } else if(curStep.equals(AppConstants.WS_FILTERS)&&(curSubStep.equals(AppConstants.WSS_ADD)||curSubStep.equals(AppConstants.WSS_EDIT))) { %> + +<% } else if(curStep.equals(AppConstants.WS_SORTING)&&curSubStep.equals("")) { %> + +<% } else if(curStep.equals(AppConstants.WS_SORTING)&&curSubStep.equals(AppConstants.WSS_ORDER_ALL)) { %> + +<% } else if(curStep.equals(AppConstants.WS_SORTING)&&(curSubStep.equals(AppConstants.WSS_ADD)||curSubStep.equals(AppConstants.WSS_EDIT))) { %> + +<% } else if(curStep.equals(AppConstants.WS_JAVASCRIPT)) { %> + +<% } else if(curStep.equals(AppConstants.WS_CHART)) { %> + +<% } else if(curStep.equals(AppConstants.WS_USER_ACCESS)) { %> + +<% } else if(curStep.equals(AppConstants.WS_SCHEDULE)) { %> + +<% } else if(curStep.equals(AppConstants.WS_REPORT_LOG)) { %> + +<% } else if(curStep.equals(AppConstants.WS_MAP)) { %> + +<% } else if(curStep.equals(AppConstants.WS_DATA_FORECASTING)) { %> + +<% } else { %> + +<% } %> + +
    + + + + + +
    +   + + <% if(! ws.isInitialStep()) { %> + + <% } %> + + <% if(! ws.isFinalStep()) { %> + + + <% } %> +
    +
    + +
    + + + + + +
    +
    +<%----%> + +<%! private String HTMLEncode(String value) { + StringBuffer sb = new StringBuffer(value); + + for(int i=0; i') + sb.replace(i, i+1, ">"); + else if(sb.charAt(i)=='"') + sb.replace(i, i+1, """); + + return sb.toString(); + } // HTMLEncode + + private String clearSpaces(String value) { + StringBuffer sb = new StringBuffer(value); + + for(int i=0; i + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/test_field_run_sql.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/test_field_run_sql.jsp new file mode 100644 index 0000000..2fdcee4 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/test_field_run_sql.jsp @@ -0,0 +1,39 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.util.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> + + + +
    + + + +
    + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/test_run_sql.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/test_run_sql.jsp new file mode 100644 index 0000000..1c30437 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/test_run_sql.jsp @@ -0,0 +1,38 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.util.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> + + + +
    + + + +
    + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_adhoc_schedule.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_adhoc_schedule.jsp new file mode 100644 index 0000000..76fe7a5 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_adhoc_schedule.jsp @@ -0,0 +1,733 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%-- + Name: wizard_adhoc_schedule.jsp + Use : This JSP is used for accepting user parameters for scheduling the report. + + Change Log + ========== + + 28-Aug-2009 : Version 8.4 (Sundar); initFormFields function is removed as it is handled in back end. + 23-Jun-2009 : Version 8.4 (Sundar); + +
      +
    • Bug related to creating startDate variable (in Javascript) for the Validation purpose is fixed.
    • +
    + + +--%> + +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %> +<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %> +<%@ page import="java.util.Vector" %> +<%@ page import="java.util.List" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %> +<%@ page import="java.util.Iterator" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataSourceType" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.DBColumnInfo" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableSource" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportSchedule" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %> + +<% + ReportSchedule reportSchedule = (ReportSchedule) request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE); + ReportDefinition rdefRecurrance = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION); + session.setAttribute("login_id", AppUtils.getUserBackdoorLoginId(request)); + if(reportSchedule==null) reportSchedule = (ReportSchedule) request.getAttribute(AppConstants.SI_REPORT_SCHEDULE); + String remoteDbPrefix = (String) session.getAttribute("remoteDB"); + boolean isSQLAllowed = Globals.getAllowSQLBasedReports(); +%> +<%@page import="java.util.Calendar"%> +<%@page import="java.text.DateFormat"%> +<%@page import="java.text.SimpleDateFormat"%> +<%@page import="java.util.TimeZone"%> +<%@page import="java.util.Date"%> +<%@page import="org.openecomp.portalsdk.analytics.model.ReportLoader"%> + + + + + + + + + + + +
    + <% + Calendar startCalendarDate = Calendar.getInstance(); + startCalendarDate.add(Calendar.DAY_OF_MONTH, - 540); + Calendar endCalendarDate = Calendar.getInstance(); + endCalendarDate.add(Calendar.DAY_OF_MONTH, 540); + SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy"); + SimpleDateFormat oracleDateFormat = new SimpleDateFormat("MM/dd/yyyy kk:mm:ss"); + Date sysdate = oracleDateFormat.parse(ReportLoader.getSystemDateTime()); + SimpleDateFormat dtimestamp = new SimpleDateFormat(Globals.getScheduleDatePattern()); + Calendar systemCalendar = Calendar.getInstance(); + systemCalendar.setTime(sysdate); + Date sysNext15date = oracleDateFormat.parse(ReportLoader.getNext15MinutesOfSystemDateTime()); + //dtimestamp = new SimpleDateFormat(Globals.getScheduleDatePattern()); + Calendar systemNext15Calendar = Calendar.getInstance(); + systemNext15Calendar.setTime(sysNext15date); + Date sysNext30date = oracleDateFormat.parse(ReportLoader.getNext30MinutesOfSystemDateTime()); + //dtimestamp = new SimpleDateFormat(Globals.getScheduleDatePattern()); + Calendar systemNext30Calendar = Calendar.getInstance(); + systemNext30Calendar.setTime(sysNext30date); + + System.out.println(" systemNext15Calendar " + systemNext15Calendar); + System.out.println(" systemNext30Calendar " + systemNext30Calendar); + + //dtimestamp.setTimeZone(TimeZone.getTimeZone(Globals.getTimeZone())); + +%> + + + + + + + + + + + + <%if(nvl(Globals.getScheduleHelpMessage()).length()>0) { %> + + + + <% } %> + + + + + + + + + + + + + + + + + + + + + + + + + + <% if(AppUtils.isAdminUser(request) || isSQLAllowed ) { %> + + + + + + + + + <% } %> + + + + + + + + + + + + + + + +<% List emailToUsers = reportSchedule.getEmailToUsers(); + for(int i=0; i + + + + +<% } // for + List emailToRoles = reportSchedule.getEmailToRoles(); + for(int i=0; i + + + + +<% } // for + + Vector remainingUsers = Utils.getUsersNotInList(emailToUsers,request); + Vector remainingRoles = Utils.getRolesNotInList(emailToRoles,request); + if((emailToUsers.size()+emailToRoles.size()==0)||(remainingUsers.size()>0)||(remainingRoles.size()>0)) { %> + + + +<% } // if +%> +
    + <%if(nvl(Globals.getScheduleHelpMessage()).trim().length()>0) { %> + + <% } %> + Please enter Time in <%= Globals.getTimeZone()%>. The Current System Time is <%=dtimestamp.format(sysdate)%> <%=Globals.getTimeZone()%> +
    +
    +

    Report Desc: + <%= Globals.getScheduleHelpMessage() %>

    +
    +
    Schedule Emails: + toolTipText="This is used for the enabling or disabling the scheduling feature for this report."/>Yes +   + toolTipText="This is used for the enabling or disabling the scheduling feature for this report."/>No + +
    Email Attachment: + + <%if(!rdefRecurrance.getReportType().equals(AppConstants.RT_HIVE)) {%> + toolTipText="Provides the capability to attach reports as PDF format to the email."/>PDF Attachment +    + toolTipText="Provides the capability to attach reports as Excel format to the email."/>Excel Attachment +    + <% } %> + toolTipText="Provides the capability to attach reports as Excel format to the email."/>Excelx Attachment +    + toolTipText="Provides the capability to attach reports as CSV format to the email."/>CSV Attachment + <%if(!rdefRecurrance.getReportType().equals(AppConstants.RT_HIVE)) {%> + <% if(nvl(Globals.getShellScriptDir()).length()>1) { %> + toolTipText="Provides the capability to send only links to the generated report in the email."/>Link to Generated report + <% } %> + <% } %> + + +
    Recurrence: + +
    First Schedule Date: + + + +       + + + + <%= Globals.getTimeZone()%> + + +
    Last Schedule Date: + + + +       + + + + <%= Globals.getTimeZone()%> + + +
    Use Condition: + > Send Emails Only When Condition Is Met +
    Condition SQL: + + +   +
    Max rows in attachment: + + +
    + Form Fields +

    <%= (i==0)?"Email To: ":" " %> + <%= userValue.getName() %> +       + +
    <%= (emailToUsers.size()==0&&i==0)?"Email To: ":" " %>Everyone With Role:  + <%= roleValue.getName() %> +       + +
    + + + + <% if ( nvl(Globals.getEncryptedSMTPServer(),"").length() > 0 ) { %> + + <% } %> + <% if (Globals.generateSchedReportsInFileSystem()) { %> + + <% } %> + +
    <%= (emailToUsers.size()+emailToRoles.size()==0)?"Email To: ":" " %> +<% if(remainingUsers.size()>0) { %> + +<% } else { %> + No user emails available +<% } %> +       +<% if(remainingRoles.size()>0) { %> + +<% } else { %> + No roles available +<% } %> + + Encrypt Attachment + toolTipText="Choose the encryption mode."/>Yes +    + toolTipText="Choose the encryption mode."/>No + Send as Attachment + toolTipText="Send As Attachment"/>Yes +    + toolTipText="Store it in file system."/>No +
    +
    + + +
    + + + + + + +<%! + private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } +%> diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_chart.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_chart.jsp new file mode 100644 index 0000000..959adc2 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_chart.jsp @@ -0,0 +1,1335 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%-- + Name: wizard_chart.jsp + Use : This JSP is invoked when chart tab is selected. This is used for creating chart configuration for the report. + + Change Log + ========== + + 12-Aug-2009 : Version 8.5 (Sundar); +
      +
    • For Line Chart Category can be configured. For this UI is added.
    • +
    • Line Chart can be displayed as 3D or 2D.
    • +
    + 29-Jun-2009 : Version 8.4 (Sundar); +
      +
    • For Bar Chart Last Series/Category can be configured as Line Chart or Bar Chart. For this UI is added.
    • +
    • UI options for compare to prev year chart has been added.
    • +
    + + 23-Jun-2009 : Version 8.4 (Sundar); +
      +
    • Hiding/ Unhiding parameters based on chart type is checked throughly and missing elements were added.
    • +
    • Table width is made 100% for special input parameters
    • +
    + + 22-Jun-2009 : Version 8.4 (Sundar); + +
      +
    • Calendar JS and CSS were added to this page as it is used in customizable input parameters for Time Difference Chart.
    • +
    • JS method and configurable input parameters were added for Multiple Pie Chart, Bar Chart 3D, Pareto, Time Difference Chart and Multiple + Time Series Chart.
    • +
    +--%> +<%@page import="org.openecomp.portalsdk.analytics.model.runtime.FormField"%> +<%@page import="org.openecomp.portalsdk.analytics.model.runtime.ReportFormFields"%> +<%@page import="org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime"%> +<%@page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue"%> +<%@page import="org.openecomp.portalsdk.analytics.model.DataCache"%> +<%@page import="org.openecomp.portalsdk.analytics.model.ReportHandler"%> +<%@page import="java.util.Vector"%> +<%@ page import="java.util.List" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="java.util.Iterator" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %> +<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.Reports"%> + +<% + ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION); + WizardSequence ws = rdef.getWizardSequence(); + boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB); + boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED) || rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED_DATAMIN); + + String legendColId = null; + String valueColId = null; + + //String firstColId = null; + //String firstNumColId = null; + + List reportCols = rdef.getAllColumns(); + List chartValueCols = rdef.getChartValueColumnsList(AppConstants.CHART_ALL_COLUMNS, null); + + ArrayList unusedNumCols = new ArrayList(reportCols.size()); + int numColsCount = 0; + for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) { + DataColumnType dct = (DataColumnType) iter.next(); + + if(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND)) + legendColId = dct.getColId(); + + if(isSQLBased||nvl(dct.getColType()).equals(AppConstants.CT_NUMBER)) { + numColsCount++; + if(nvl(dct.getColOnChart()).length()==0) //dct.getChartSeq()<0) + unusedNumCols.add(dct); + } // if + +/* if(dct.getChartSeq()>0) + valueColId = dct.getColId(); + + if(firstColId==null) + firstColId = dct.getColId(); + if(firstNumColId==null) + if(isSQLBased) + firstNumColId = dct.getColId(); + else + if(nvl(dct.getColType()).equals(AppConstants.CT_NUMBER)) + firstNumColId = dct.getColId();*/ + } // for + + String chartType = nvl(rdef.getChartType()); %> + + + + + + + + +
    + + + + + + +<% if(numColsCount==0) { %> + + + + + + + +<% } else { %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<% if(chartValueCols.size()==0) { %> + + + + + +<% } else { + int count = 1; + String colIdx = ""; + for(Iterator iterV=chartValueCols.iterator(); iterV.hasNext(); count++) { + colIdx = ""; + DataColumnType dctV = (DataColumnType) iterV.next(); + colIdx = dctV.getColId(); + int colAxisIdx = 0; + boolean newChart = false; + try { + colAxisIdx = Integer.parseInt(dctV.getColOnChart()); + } catch(Exception e) {} + newChart = (dctV.isCreateInNewChart()!=null)?dctV.isCreateInNewChart().booleanValue():false; + %> + + + + + + + + +<% } // for + } // else (chartValueCols.size()==0) + if(unusedNumCols.size()>0) { %> + + + + + + +<% } // if(unusedNumCols.size()==0) + if(chartValueCols.size()>1 || rdef.hasSeriesColumn()) { %> + + + + + + + + +<% } // if(chartValueCols.size()>1) +%> + + + + + + + +<%! + private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } +%> + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_log.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_log.jsp new file mode 100644 index 0000000..2b17038 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_log.jsp @@ -0,0 +1,109 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %> +<%@ page import="java.util.List" %> +<%@ page import="java.util.Iterator" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %> +<%@ page import="java.util.Vector" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.ReportLoader" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.ReportWrapper" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.FormField" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.Log" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportLogEntry" %> +<% + ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION); + WizardSequence ws = rdef.getWizardSequence(); + String curSubStep = ws.getCurrentSubStep(); + String reportID = rdef.getReportID(); + boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB); + boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED); + +%> + +<% String errorMsg = null; + Vector reportLogEntries = null; + try { + reportLogEntries = ReportLoader.loadReportLogEntries(reportID); + } catch(Exception e) { + Log.write("ERROR [wizard_log.jsp] Unable to load report log entries. Exception: "+e.getMessage()); + errorMsg = "ERROR: Unable to load report log entries from the database "; + } %> + +
    Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %>
    No numeric columns found - chart not available
    + + + + + + +
    Chart Type: + + > +  Do NOT allow user to change chart type at runtime +
    +
    Chart Width (px): + " size="10" maxlength="4">
    Chart Height (px): + " size="10" maxlength="4">
    Domain Axis: +
    Category: +
    last Category display As Line Chart + + > +
    last Category display As Bar Chart + + > +
    Multi Series + 0? (AppUtils.getRequestNvlValue(request, "multiSeries").equals("Y")? " checked ":""): (rdef.isMultiSeries() ? " checked ":" checked ")) %>>Yes + 0? (AppUtils.getRequestNvlValue(request, "multiSeries").equals("N")? " checked ":""): (!rdef.isMultiSeries() ? " checked":"")) %>>No +
    Range Axis: + + <% String sValue = ""; %> + +
    Range Axis <%= count %>: + + <% if(count>1) { %> +   + + <% } %> +   + + <% + String chartGroupOrg = dctV.getChartGroup(); + String yAxisGroup = dctV.getYAxis(); + String chartGroup = (chartGroupOrg!=null && chartGroupOrg.length()>0 && chartGroupOrg.indexOf("|")!= -1)?chartGroupOrg.substring(0,chartGroupOrg.lastIndexOf("|")):""; + String yAxis = (yAxisGroup!=null && yAxisGroup.length()>0 && yAxisGroup.indexOf("|")!= -1)?yAxisGroup.substring(0,yAxisGroup.lastIndexOf("|")):""; + %> +
    + Chart Title:"/> + YAxis:"/> +
    + +
    + <% String sValue = nvl(dctV.getChartColor()); %> + + + <% if(count>1) { %> +
    + > +  Create in New Chart +
    + 0)?" checked":"" %>> +  Use secondary axis (Line chart only) + <% } %> +  
    Add Values Column: + + + <% String sValue = ""; %> + + + +  Use secondary axis (Line chart only) +
    Primary Axis Label: + +  (Multi-series Chart Only)
    Secondary Axis Label: + +  (Multi-series Chart Only)
      + Note: Some chart types (like Pie) will only display Series 1 Values.
    + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + +<% int iCount = 0; + if(reportLogEntries!=null) + for(Iterator iter=reportLogEntries.iterator(); iter.hasNext(); iCount++) { + ReportLogEntry logEntry = (ReportLogEntry) iter.next(); %> + > + + + + + + + + +<% } // for + if(errorMsg!=null) { %> + + + +<% } else if(iCount==0) { %> + + + +<% } else { %> + + + +<% } // if +%> +
    Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %>
      No  Date/TimeUser NameActionExecution TimeRun
    <%= iCount+1 %><%= logEntry.getLogTime() %><%= logEntry.getUserName() %><%= logEntry.getAction() %><%= logEntry.getTimeTaken() %><%= logEntry.getRunIcon() %>
    <%= errorMsg %>
    No log entries found
    + +
    +
    + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_map.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_map.jsp new file mode 100644 index 0000000..50fe1da --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_map.jsp @@ -0,0 +1,424 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %> +<%@ page import="java.util.List" %> +<%@ page import="java.util.Iterator" %> +<%@page import="org.openecomp.portalsdk.analytics.xmlobj.ReportMap"%> +<% + ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION); + WizardSequence ws = rdef.getWizardSequence(); + boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB); + boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED); + ReportMap repMap = rdef.getReportMap(); + String addressColumn = ""; + String latColumn = ""; + String longColumn = ""; + String legendColumn = ""; + String colorColumn = ""; + String dataColumn = ""; + String isMapAllowed = ""; + String addAddress = "N"; + String useDefaultSize = ""; + String width = ""; + String height = ""; + + int reportMapSize = 0; + if (repMap != null){ + if (repMap.getAddressColumn() != null) + addressColumn = repMap.getAddressColumn(); + + if (repMap.getDataColumn() != null) + dataColumn = repMap.getDataColumn(); + if (repMap.getIsMapAllowedYN() != null) + isMapAllowed = repMap.getIsMapAllowedYN(); + if (repMap.getAddAddressInDataYN() != null) + addAddress = repMap.getAddAddressInDataYN(); + if (repMap.getLatColumn() != null) + latColumn = repMap.getLatColumn(); + if (repMap.getLongColumn() != null) + longColumn = repMap.getLongColumn(); + if (repMap.getColorColumn() != null) + colorColumn = repMap.getColorColumn(); + if (repMap.getLegendColumn() != null) + legendColumn = repMap.getLegendColumn(); + if (repMap.getUseDefaultSize() != null) + useDefaultSize = repMap.getUseDefaultSize(); + if (repMap.getHeight() != null) + height = repMap.getHeight(); + if (repMap.getWidth() != null) + width = repMap.getWidth(); + + reportMapSize = repMap.getMarkers().size(); + } + +%> +<%@page import="org.openecomp.portalsdk.analytics.xmlobj.Marker"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<% for (int i = 1; repMap != null && i < repMap.getMarkers().size(); i ++){ + Marker marker = (Marker) repMap.getMarkers().get(i); +%> + + + + + + + + + + <%}%> + + + +
    Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %>
    Map Enabled ? + checked <%} %>/> +
    Default Size ? + checked <%} %>/> + Height + + + + Width + +  
    Lat Column + + + + Long Column + + + + Color Column + + + + Legend Column + + + +
      + +
    Data Header + + Display Column + + + + + Remove +  
    +
    + + + + + + +<%! + private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } +%> diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_run.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_run.jsp new file mode 100644 index 0000000..688e7ff --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_run.jsp @@ -0,0 +1,74 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %> +<%@ page import="java.util.List" %> +<%@ page import="java.util.Iterator" %> +<% + ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION); + WizardSequence ws = rdef.getWizardSequence(); +%> + + + + + + + + + +
    Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %>
    + + + + + + + + + + +
    + + SQL Click here to view the generated SQL  + +
    + + Report definition successfully completed.
    +
    + + + Run +
    +
     
    +
    +
    + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule.jsp new file mode 100644 index 0000000..b8d1ad1 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule.jsp @@ -0,0 +1,376 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %> +<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %> +<%@ page import="java.util.Vector" %> +<%@ page import="java.util.List" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %> +<%@ page import="java.util.Iterator" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataSourceType" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.DBColumnInfo" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableSource" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportSchedule" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %> + +<% + ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION); + WizardSequence ws = rdef.getWizardSequence(); + ReportSchedule reportSchedule = rdef.getReportSchedule(); + String remoteDbPrefix = (String) session.getAttribute("remoteDB"); + boolean isSQLAllowed = Globals.getAllowSQLBasedReports(); + +%> +<%@page import="java.util.Calendar"%> +<%@page import="java.text.DateFormat"%> +<%@page import="java.text.SimpleDateFormat"%> +<%@page import="java.util.TimeZone"%> +<%@page import="java.util.Date"%> +<%@page import="org.openecomp.portalsdk.analytics.model.ReportLoader"%> + + + + + + + <% + Calendar startCalendarDate = Calendar.getInstance(); + startCalendarDate.add(Calendar.DAY_OF_MONTH, - 540); + Calendar endCalendarDate = Calendar.getInstance(); + endCalendarDate.add(Calendar.DAY_OF_MONTH, 540); + SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy"); + SimpleDateFormat oracleDateFormat = new SimpleDateFormat("MM/dd/yyyy kk:mm:ss"); + Date sysdate = oracleDateFormat.parse(ReportLoader.getSystemDateTime()); + SimpleDateFormat dtimestamp = new SimpleDateFormat(Globals.getScheduleDatePattern()); + //dtimestamp.setTimeZone(TimeZone.getTimeZone(Globals.getTimeZone())); + + + + + %> + + + + <% if(request.getAttribute("schedule_only")!=null) { %> + + + + <% } %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <% if(AppUtils.isAdminUser(request) || isSQLAllowed ) { %> + + + + + + + + + <% } %> + + + + + + + + + +<% List emailToUsers = reportSchedule.getEmailToUsers(); + for(int i=0; i + + + + +<% } // for + List emailToRoles = reportSchedule.getEmailToRoles(); + for(int i=0; i + + + + +<% } // for + + Vector remainingUsers = Utils.getUsersNotInList(emailToUsers,request); + Vector remainingRoles = Utils.getRolesNotInList(emailToRoles,request); + if((emailToUsers.size()+emailToRoles.size()==0)||(remainingUsers.size()>0)||(remainingRoles.size()>0)) { %> + + + + +<% } // if +%> +
    Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %>
    Please enter Time in <%= Globals.getTimeZone()%>. The Current System Time is <%=dtimestamp.format(sysdate)%> <%=Globals.getTimeZone()%>
    +
    +

    Quick Help: +

    +
    +
    Schedule Emails: + />Yes +   + />No +
    Email Attachment: + + />PDF Attachment +    + />Excel Attachment + + +
    Recurrence: +
    Start Date: + + + +       + + + + +
    End Date: + + + +
    Use Condition: + > Send Emails Only When Condition Is Met +
    Condition SQL:SELECT 1 FROM DUAL WHERE EXISTS (
    + + ) +      + +   +
    Max rows in attachment: + +
    <%= (i==0)?"Email To: ":" " %> + <%= userValue.getName() %> +       + +
    <%= (emailToUsers.size()==0&&i==0)?"Email To: ":" " %>Everyone With Role:  + <%= roleValue.getName() %> +       + +
    <%= (emailToUsers.size()+emailToRoles.size()==0)?"Email To: ":" " %> +<% if(remainingUsers.size()>0) { %> + +<% } else { %> + No user emails available +<% } %> +       +<% if(remainingRoles.size()>0) { %> + +<% } else { %> + No roles available +<% } %> +
    +
    + + + +<%! + private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } +%> diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_formfield_include.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_formfield_include.jsp new file mode 100644 index 0000000..206e23d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_formfield_include.jsp @@ -0,0 +1,754 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%-- + Name: wizard_schedule_formfield_include.jsp + Use : Shows formfield of the report in the schedule page. + + Change Log + ========== + + 28-Aug-2009 : Version 8.5.1 (Sundar); Checkbox and Radio button are also handled. + 18-Aug-2009 : Version 8.5.1 (Sundar); + + a) ajax.js is loaded in startup for AJAX functionality. + b) showArgPopupNew is modified as per report_form.jsp + c) Ajax function is added very similiar to report_form.jsp + d) "auto" bug is resolved. + +14-Jul-2009 : Version 8.4 (Sundar); + +
      +
    • Shows the form field of the first Dashboard report in schedule page if the report is dashboard.
    • +
    +--%> +<%@ page import="java.io.*" %> +<%@ page import="java.util.*" %> +<%@ page import="java.text.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.ReportHandler" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.JavascriptItemType"%> +<%@ page import="java.util.regex.*"%> +<%@ page import="javax.servlet.http.*"%> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportSchedule" %> + + +<% + ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION); + ReportHandler rh = new ReportHandler(); + ReportRuntime rr = rh.loadReportRuntime(request, rdef.getReportID()); + request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr); + boolean isDashboard = rr.isDashboardType(); + ReportFormFields rff = rr.getReportFormFields(); + ReportFormFields rff1 = (ReportFormFields) rff.clone(); + ReportFormFields rff2 = (ReportFormFields) rff.clone(); + ReportFormFields rff5 = (ReportFormFields) rff.clone(); + boolean isFirstTime = nvl(request.getParameter("refresh")).toUpperCase().startsWith("Y"); + ReportSchedule reportSchedule = (ReportSchedule) request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE); + + int dashboardFlag = 0; + ReportRuntime rr1 = null; + java.text.SimpleDateFormat sdf = null; + +%> + + + +<%--=(rr.getJavascriptElement()!=null && rr.getJavascriptElement().length()>0)?rr.getJavascriptElement().replaceAll("formd","forma"):""--%> + + <% + if(rr.getReportType().equals(AppConstants.RT_DASHBOARD)) { + dashboardFlag = 1; + String strHTML = rr.getDashboardLayoutHTML(); //getdashboardLayoutHTML(); + String rep_id = parseAndGetFirstReportID(strHTML); + ReportHandler rh1 = new ReportHandler(); + rr1 = null; + int requestFlag = 1; + try { + rr1 = rh1.loadReportRuntime(request, rep_id, true, requestFlag); + } catch(Exception e) { + } + rff = rr1.getReportFormFields(); + } + %> + <%if((dashboardFlag == 0 && rr.needFormInput()) || (dashboardFlag == 1 && rr1.needFormInput())) { %> + + + + Please input values into the Form Fields for email attachment. Note those fields user must provide value can not leave as blank. + + + <% + int colidx = 0; + java.util.HashMap paramsMap = Globals.getRequestParamtersMap(request, false); + java.util.HashMap getScheduleMap = getFormFieldsHashMap (request, reportSchedule.getFormFields()); + java.util.HashMap paramsScheduleMap = Globals.getRequestParametersMap(request, getScheduleMap); + for (int i = 0; i < rff.size(); i ++){ + FormField ff = (FormField) rff.get(i); + ff.setDbInfo(rr.getDbInfo()); + ff.setUserId(AppUtils.getUserID(request)); + if(ff.getFieldType().equals(FormField.FFT_HIDDEN)) { + %> + <% + if(nvl(reportSchedule.getFormFields()).length() <= 0) + out.println(ff.getHtml(rr.getParamValue(ff.getFieldName()), paramsMap, rr, true)); + else + out.println(ff.getHtml(getParameterString(request, ff.getFieldName(), getScheduleMap), paramsScheduleMap, rr, true).replaceAll("formd","forma")); + + + %> + <% } + if(!ff.getFieldType().equals(FormField.FFT_HIDDEN) && ff.isVisible()) { + + %> + <%if (colidx == 0){%><%}%> + + + + <%colidx++;%> + <%if (colidx == rr.getNumFormColsAsInt()){%><%colidx=0;}%> + <% } + } //for %> +
    + + <%if (!ff.getFieldType().equals(FormField.FFT_BLANK)){%> + <%= ff.getDisplayNameHtml() %>: + <%}%> + + + <%-- ff.getHtml(rr.getParamValue(ff.getFieldName()), paramsMap,rr, true).replaceAll("formd","forma") --%> + <% + if(nvl(reportSchedule.getFormFields()).length() <= 0) + out.println(ff.getHtml(rr.getParamValue(ff.getFieldName()), paramsMap, rr, true).replaceAll("formd","forma")); + else + out.println(ff.getHtml(getParameterString(request, ff.getFieldName(), getScheduleMap), paramsScheduleMap, rr, true).replaceAll("formd","forma")); + %> +
    + + +<% } //if(rr.needFormInput()) %> + + + + +<% /* if(request.getAttribute(AppConstants.RI_REPORT_DATA) == null){ */ %> + + +<%! private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } + private String getCallableJavascriptForSubmit(ReportRuntime rr) { + JavascriptItemType javascriptItemType = null; + StringBuffer callJavascriptText = new StringBuffer(""); + if(rr.getJavascriptList()!=null) { + for (Iterator iter = rr.getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) { + javascriptItemType = (JavascriptItemType)iter.next(); + if(javascriptItemType.getFieldId().equals("os1")) { + callJavascriptText.append(" "+javascriptItemType.getCallText()); + break; + } + } + } + return callJavascriptText.toString(); + } + + private HashMap getFormFieldsHashMap (HttpServletRequest request, String formFieldsString) { + String splitName[] = null; + ArrayList keyValue = new ArrayList(); + HashMap keyValueMap = new HashMap(); + String newValue = ""; + //System.out.println("Request Str "+ formFieldsString); + StringTokenizer st = null; + StringTokenizer st2 = null; + String key1 = ""; + String value = ""; + + if(formFieldsString.length() > 0) { + st = new StringTokenizer(formFieldsString, "&"); + while (st.hasMoreTokens()) { + keyValue.add(st.nextToken()); + } + if(keyValue.size() > 0) { + + for (int num = 0; num < keyValue.size(); num++) { + st2 = new StringTokenizer((String) keyValue.get(num), "="); + while(st2.hasMoreTokens()) { + key1 = ""; value = ""; + key1 = st2.nextToken(); + key1 = Utils.replaceInString(key1, "_auto", ""); + try { + value = st2.nextToken(); + }catch (NoSuchElementException ex) { value = "";} + if(!keyValueMap.containsKey(key1)) + keyValueMap.put(key1,value); + else { + String value1 = (String) keyValueMap.get(key1); + value = value+"|"+value1; + keyValueMap.put(key1,value); + } + } + } + + } + } + return keyValueMap; + } + + private String getParameterString (HttpServletRequest request, String key, HashMap keyValueMap) { + String newValue = ""; + if(keyValueMap.containsKey(key)) { + //System.out.println("VALUE IN MAP IS " +key+ " "+ (String) keyValueMap.get(key)); + newValue = XSSFilter.filterRequestOnlyScript((String) keyValueMap.get(key)); + if(nvl(newValue).length()<=0) { + newValue = XSSFilter.filterRequestOnlyScript((String) keyValueMap.get(key+"_auto")); + } + } + return newValue; + } + private String parseAndGetFirstReportID(String strHTML) { + String sourcestring = strHTML; + //System.out.println("String HTML1 " + strHTML); + Pattern re = Pattern.compile("\\[(.*?)\\]"); //\\[(.*?)\\] + Matcher m = re.matcher(sourcestring); + int mIdx = 0; + while (m.find()){ + for( int groupIdx = 0; groupIdx < m.groupCount(); groupIdx++ ){ + String str = m.group(groupIdx); + //System.out.println("REP ID1 " + str.substring(str.indexOf("#")+1, str.length()-1)) ; + return str.substring(str.indexOf("#")+1, str.length()-1); + } + mIdx++; + + }return ""; + } +%> diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_multiple.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_multiple.jsp new file mode 100644 index 0000000..70c9812 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_multiple.jsp @@ -0,0 +1,157 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.util.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.controller.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.*" %> + +<%@ page errorPage="error_page.jsp" %> +<%! +class ValueComparator implements Comparator { + public int compare(Object o1, Object o2) { + Map.Entry e1 = (Map.Entry) o1; + Map.Entry e2 = (Map.Entry) o2; + Comparable c1 = (Comparable)e1.getValue(); + Comparable c2 = (Comparable)e2.getValue(); + return c1.compareTo(c2); + } +} +%> +<% +HashMap hashMap = ReportLoader.loadReportsToSchedule(request); +ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION); +if(rdef ==null) rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION); +Set mapSet = hashMap.entrySet(); +List entrylist = new ArrayList(mapSet); +Collections.sort(entrylist, new ValueComparator()); +Map.Entry me; +session.removeAttribute(AppConstants.SI_REPORT_SCHEDULE); +session.removeAttribute(AppConstants.SI_REPORT_DEFINITION); +ReportSchedule reportSchedule = (ReportSchedule) session.getAttribute(AppConstants.SI_REPORT_SCHEDULE); +%> + + + + + + +


    +<% if (rdef == null || request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE) == null) {%> + +
    + + + + + + + + +
    + + + + + + <% if(request.getAttribute("message")!=null) { %> + + + + <% } %> +
    <%= "Scheduling Report" %>
    <%= (String) request.getAttribute("message") %>
    +
    Reports: + <% if (rdef !=null && request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE) != null ) {%> + <%= rdef.getReportName()%> + <% } else { %> + + <% } %> + +
    +
    +<% } %> +<% if(reportSchedule!=null) { %> + +<% } %> + + + + + +<%----%> + +<%! private String HTMLEncode(String value) { + StringBuffer sb = new StringBuffer(value); + + for(int i=0; i') + sb.replace(i, i+1, ">"); + else if(sb.charAt(i)=='"') + sb.replace(i, i+1, """); + + return sb.toString(); + } // HTMLEncode + + private String clearSpaces(String value) { + StringBuffer sb = new StringBuffer(value); + + for(int i=0; i + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_only.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_only.jsp new file mode 100644 index 0000000..ad3c612 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_only.jsp @@ -0,0 +1,172 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.util.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.controller.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.*" %> + +<%@ page errorPage="error_page.jsp" %> + + + +<% ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION); + + String reportID = rdef.getReportID(); + + + + String dbInfo = null; + dbInfo = rdef.getDBInfo(); + int sessionflag = 0; + if(dbInfo == null || dbInfo.length() == 0) { + dbInfo = (String) session.getAttribute("remoteDB"); + sessionflag = 1; + } + session.setAttribute("remoteDB", dbInfo); + if((dbInfo == null) && (request.getParameter("dataSource")!=null)) + session.setAttribute("remoteDB", request.getParameter("dataSource")); + + StringBuffer title = new StringBuffer(""); + title.append(Globals.getBaseTitle()+" > "+(reportID.equals("-1")?"Create Report":"Schedule Report")); + title.append(" > "+rdef.getReportName()); + + boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB); + boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED); +%> + +<% + request.setAttribute(AppConstants.SI_REPORT_DEFINITION,rdef); +%> + + + + + + + + + + + + +
    + +
    +
    +
    +
    + + + + + + + + + + + +
    + + + + + <% if(request.getAttribute("message")!=null) { %> + + + + <% } %> +
    <%= title.toString() %>
    <%= (String) request.getAttribute("message") %>
    +
    + +
    + + + + + +
    +   + + + <%----%> + +
    +
    +
    + + +
    +
    +<%----%> + +<%! private String HTMLEncode(String value) { + StringBuffer sb = new StringBuffer(value); + + for(int i=0; i') + sb.replace(i, i+1, ">"); + else if(sb.charAt(i)=='"') + sb.replace(i, i+1, """); + + return sb.toString(); + } // HTMLEncode + + private String clearSpaces(String value) { + StringBuffer sb = new StringBuffer(value); + + for(int i=0; i + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_only_from_search.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_only_from_search.jsp new file mode 100644 index 0000000..af951cc --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_schedule_only_from_search.jsp @@ -0,0 +1,173 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="java.util.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.controller.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.*" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.*" %> + +<%@ page errorPage="error_page.jsp" %> + + + +<% ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION); + + String reportID = rdef.getReportID(); + + + + String dbInfo = null; + dbInfo = rdef.getDBInfo(); + int sessionflag = 0; + if(dbInfo == null || dbInfo.length() == 0) { + dbInfo = (String) session.getAttribute("remoteDB"); + sessionflag = 1; + } + session.setAttribute("remoteDB", dbInfo); + if((dbInfo == null) && (request.getParameter("dataSource")!=null)) + session.setAttribute("remoteDB", request.getParameter("dataSource")); + + StringBuffer title = new StringBuffer(""); + title.append(Globals.getBaseTitle()+" > "+(reportID.equals("-1")?"Create Report":"Schedule Report")); + title.append(" > "+rdef.getReportName()); + + boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB); + boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED); +%> + +<% + request.setAttribute(AppConstants.SI_REPORT_DEFINITION,rdef); +%> + + + + + + + + + + + + +
    + +
    +
    +
    +
    + + + + + + + + + + + +
    + + <% if(request.getAttribute("message")!=null) { %> + + + + <% } %> + + + + +
    <%= (String) request.getAttribute("message") %>
    <%= title.toString() %>
    +
    + +
    + + + + + +
    +   + + + <%----%> + +
    +
    +
    + + +
    +
    +<%----%> + +<%! private String HTMLEncode(String value) { + StringBuffer sb = new StringBuffer(value); + + for(int i=0; i') + sb.replace(i, i+1, ">"); + else if(sb.charAt(i)=='"') + sb.replace(i, i+1, """); + + return sb.toString(); + } // HTMLEncode + + private String clearSpaces(String value) { + StringBuffer sb = new StringBuffer(value); + + for(int i=0; i + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_edit.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_edit.jsp new file mode 100644 index 0000000..18c450b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_edit.jsp @@ -0,0 +1,86 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %> +<%@ page import="java.util.List" %> +<%@ page import="java.util.Iterator" %> +<% + ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION); + WizardSequence ws = rdef.getWizardSequence(); + String curSubStep = ws.getCurrentSubStep(); + boolean isEdit = curSubStep.equals(AppConstants.WSS_EDIT); + DataColumnType currColumn = null; + if(isEdit) + currColumn = rdef.getColumnById(AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID)); %> + + + + + + + + + + + + + +
    Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %><%= curSubStep.equals(AppConstants.WSS_EDIT)?"Edit Sorting":(curSubStep.equals(AppConstants.WSS_ADD)?"Add Sorting":"") %>
    + Sort By Column: + + <% if(isEdit) { %> + <%= currColumn.getDisplayName() %> + <% } else { %> + + <% } // else + %> +
    Sort Type: + +
    +
    + + + +<%! + private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } +%> diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_list.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_list.jsp new file mode 100644 index 0000000..63bf9cd --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_list.jsp @@ -0,0 +1,116 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %> +<%@ page import="java.util.List" %> +<%@ page import="java.util.Iterator" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %> +<%@ page import="java.util.Vector" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.ReportLoader" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.ReportWrapper" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.FormField" %> +<%@ page import="java.util.Collections" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.OrderSeqComparator" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.OrderBySeqComparator" %> + +<% + ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION); + WizardSequence ws = rdef.getWizardSequence(); + String curSubStep = ws.getCurrentSubStep(); + String reportID = rdef.getReportID(); + boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB); + boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED); + List reportCols = rdef.getAllColumns(); + Collections.sort(reportCols, new OrderSeqComparator()); + int numSortCols = rdef.getNumSortColumns(); %> + + + + + + + + + + + +<% int iCount = 0; + Collections.sort(reportCols,new OrderBySeqComparator()); + for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) { + DataColumnType dct = (DataColumnType) iter.next(); + if(dct.getOrderBySeq()>0) { %> + > + + + + + + + +<% + iCount++; + } // if + } // for + Collections.sort(reportCols, new OrderSeqComparator()); +%> +<% if(numSortCols==0) { %> + + + +<% } %> +
    Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %>
    Sort OrderSort By ColumnSort TypeRe-order + <% if(numSortCols + + +
    + <% } %> + + <% if(numSortCols +
    + <% } %> +
    <%= iCount+1 %><%= dct.getDisplayName() %><%= dct.getOrderByAscDesc().equals(AppConstants.SO_ASC)?"Ascending":"Descending" %> +<% if(iCount==0) { %> + +<% } else { %> + +<% } %> +<% if(iCount==numSortCols-1) { %> + +<% } else { %> + +<% } %> +
    No sorting defined
    +
    + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_order_all.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_order_all.jsp new file mode 100644 index 0000000..9e04f2b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sorting_order_all.jsp @@ -0,0 +1,112 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %> +<%@ page import="java.util.List" %> +<%@ page import="java.util.Iterator" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %> +<%@ page import="java.util.Vector" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.ReportLoader" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.ReportWrapper" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.FormField" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.OrderBySeqComparator" %> +<%@ page import="java.util.Collections" %> +<% + ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION); + WizardSequence ws = rdef.getWizardSequence(); + String curSubStep = ws.getCurrentSubStep(); + String reportID = rdef.getReportID(); + boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB); + boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED); + +%> + + + + + + + + + + +<% int icnt = 0; + for(Iterator iter=rdef.getAllColumns().iterator(); iter.hasNext(); icnt++) { + DataColumnType dct = (DataColumnType) iter.next(); %> + > + + + + + +<% } // for +%> +
    Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %> - <%= curSubStep %>
      No  ColumnSort OrderSort Type
    <%= icnt+1 %><%= dct.getDisplayName() %> + + "> + + +
    + + +
    + + + +<%! + private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } +%> + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sql_def.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sql_def.jsp new file mode 100644 index 0000000..d8152c0 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_sql_def.jsp @@ -0,0 +1,226 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %> +<%@ page import="java.util.List" %> +<%@ page import="java.util.Iterator" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %> +<%@ page import="java.util.Vector" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.ReportLoader" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.ReportWrapper" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.runtime.FormField" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.OrderBySeqComparator" %> +<%@ page import="java.util.Collections" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableSource" %> +<% + ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION); + WizardSequence ws = rdef.getWizardSequence(); + String curSubStep = ws.getCurrentSubStep(); + String reportID = rdef.getReportID(); + boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB); + boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED); + +%> + + + + + + + + + + + + + + + + + +
    Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %>
    +  Report SQL:
    + <% boolean sqlValidated = (nvl(AppUtils.getRequestValue(request, "sqlValidated"), nvl(rdef.getReportSQL())).length()>0); + if(request.getAttribute(AppConstants.RI_ERROR_LIST)!=null) + sqlValidated = false; + + String sql = nvl(rdef.getReportSQL(), "SELECT "); + if(! sqlValidated) + sql = nvl(AppUtils.getRequestValue(request, "reportSQL"), sql); %> + "> +   +
    +  Keyword Assistance
    + +       SELECT  DISTINCT 
    +       FROM 
    +       WHERE 
    +       GROUP BY 
    +       HAVING 
    +       ORDER BY  ASC  DESC 
    +
    +       UNION  ALL  INTERSECT  MINUS 
    +
    +       AND  OR  NOT  EXISTS 
    +       IS  NULL  IN  BETWEEN 
    +
    +       COUNT(  SUM(  AVG(  MAX(  MIN( 
    +
    +       NVL(  DECODE(  SYSDATE 
    +       TO_CHAR(  TO_NUMBER(  TO_DATE( 
    +       TRUNC(  ROUND(  ABS( 
    +       SUBSTR(  REPLACE(  LOWER(  UPPER( 
    +       LTRIM(  RTRIM(  LPAD(  RPAD( 
    +
    +
    + + +   + +   + +   + +
    You need to click the "Validate SQL" button in order to store the SQL before going forward
    +
    + + + +<%! + private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } +%> diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_tables_edit.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_tables_edit.jsp new file mode 100644 index 0000000..88ecda3 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_tables_edit.jsp @@ -0,0 +1,369 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %> +<%@ page import="java.util.Vector" %> +<%@ page import="java.util.List" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %> +<%@ page import="java.util.Iterator" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataSourceType" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.DBColumnInfo" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableSource" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableJoin" %> +<%@ page import="org.openecomp.portalsdk.analytics.error.UserDefinedException"%> + +<% + ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION); + WizardSequence ws = rdef.getWizardSequence(); + String curSubStep = ws.getCurrentSubStep(); + boolean isEdit = curSubStep.equals(AppConstants.WSS_EDIT); + DataSourceType currTable = null; + if(isEdit) + currTable = rdef.getTableById(AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID)); + Vector reportTableSources = (isEdit)?DataCache.getReportTableSources((String) session.getAttribute("remoteDB")):DataCache.getReportTableSources(AppUtils.getUserRoles(request),((String) session.getAttribute("remoteDB")), AppUtils.getUserID(request), request); + if(reportTableSources.size()<=0) { + request.setAttribute(AppConstants.RI_EXCEPTION, new Exception("Please add table name to the raptor table for generating report")); + throw new UserDefinedException("Please add table name to the raptor table for generating report"); + } + Vector reportTableJoins = (isEdit)?DataCache.getReportTableJoins():DataCache.getReportTableJoins(AppUtils.getUserRoles(request)); %> + +<% if(! isEdit) { %> + +<% } %> + + + + + + + + + + + + + + + +<% if(rdef.getDataSourceList().getDataSource().size()>(isEdit?1:0)) { + String outerJoinType = (isEdit?rdef.getOuterJoinType(currTable):""); %> + + + + + + + + + + <% if(isEdit) { %> + + <%} %> + + + + + +<% } %> +
    Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %> - <%= curSubStep %>
    Table Name + <% if(isEdit) { + String tName = null; + for(int i=0; i + <%= nvl(tName, currTable.getTableName()) %> + + <% } else { %> + + <% } %> + +
    Display Name +
    Join To Table + <% if(isEdit) { %> + <% if(currTable.getRefTableId()==null){%> + --- Table Not Joined --- + <%} else { %> + <%=rdef.getTableById(currTable.getRefTableId()).getDisplayName() %> +
    on : <%=currTable.getRefDefinition() %> + <%} %> + + + <% } else { %> + + <% } %> +
    All availabe Join Options + +
    Join Type + +
    +
    + + + +<%! + private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } +%> diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_tables_list.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_tables_list.jsp new file mode 100644 index 0000000..47fd435 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_tables_list.jsp @@ -0,0 +1,85 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %> +<%@ page import="java.util.Vector" %> +<%@ page import="java.util.List" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %> +<%@ page import="java.util.Iterator" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataSourceType" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.DBColumnInfo" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableSource" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableJoin" %> + +<% + ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION); + WizardSequence ws = rdef.getWizardSequence(); + String curSubStep = ws.getCurrentSubStep(); +%> + + + + + + + + + +<% int iCount = 0; + for(Iterator iter=rdef.getDataSourceList().getDataSource().iterator(); iter.hasNext(); iCount++) { + DataSourceType dst = (DataSourceType) iter.next(); %> + > + + + + + +<% } %> +<% if(iCount==0) { %> + + + +<% } %> +
    Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %>
      No  Table
    <%= iCount+1 %><%= nvl(dst.getDisplayName()).length()>0?dst.getDisplayName():dst.getTableName()%>
    No tables defined
    +
    + + + +<%! private String nvl(String s) { return (s==null)?"":s; } + private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } +%> + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_user_access.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_user_access.jsp new file mode 100644 index 0000000..b5c6804 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/fusion/raptor/wizard_user_access.jsp @@ -0,0 +1,184 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %> +<%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> +<%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %> +<%@ page import="java.util.Vector" %> +<%@ page import="java.util.List" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %> +<%@ page import="java.util.Iterator" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataSourceType" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.DBColumnInfo" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableSource" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType" %> +<%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableJoin" %> +<%@ page import="org.openecomp.portalsdk.analytics.model.definition.SecurityEntry" %> +<%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %> + +<% + ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION); + WizardSequence ws = rdef.getWizardSequence(); + String curSubStep = ws.getCurrentSubStep(); +%> + + + + + + + + + + + + + + + + + + + + + + +
    Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %>
    Created By: <%= AppUtils.getUserName(rdef.getCreateID()) %>Created Date: <%= rdef.getCreateDate() %>
    Last Updated By: <%= AppUtils.getUserName(rdef.getUpdateID()) %>Last Updated: <%= rdef.getUpdateDate() %>
    Report Owner: + + Public? (All users can run the report) + +
    +
    + + + + + + + + + + + + +<% int iCount = 0; + Vector reportUsers = rdef.getReportUsers(request); + for(Iterator iter=reportUsers.iterator(); iter.hasNext(); iCount++) { + SecurityEntry rUser = (SecurityEntry) iter.next(); %> + "> + + + + + + +<% } // for +// if(iCount==0) { %> + +<% //} + Vector remainingUsers = Utils.getUsersNotInList(reportUsers,request); + if(remainingUsers.size()>0) { %> + + +<% } // if +%> + +
    Report Users
      No  User NameRun AccessEdit AccessRemove
    <%= iCount+1 %><%= rUser.getName() %>" alt="<%= rUser.isReadOnly()?"Grant":"Revoke" %> edit access" width="16" height="16" border="0" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= rUser.isReadOnly()?AppConstants.WA_GRANT_USER:AppConstants.WA_REVOKE_USER %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= rUser.getId() %>';">
    Grant Access To  + +
    +
    + + + + + + + + + + + + +<% iCount = 0; + Vector reportRoles = rdef.getReportRoles(request); + for(Iterator iter=reportRoles.iterator(); iter.hasNext(); iCount++) { + SecurityEntry rRole = (SecurityEntry) iter.next(); %> + "> + + + + + + +<% } // for +// if(iCount==0) { %> + +<% //} + Vector remainingRoles = Utils.getRolesNotInList(reportRoles,request); + if(remainingRoles.size()>0) { %> + + +<% } // if +%> + +
    Report Roles
      No  Role NameRun AccessEdit AccessRemove
    <%= iCount+1 %><%= rRole.getName() %>" alt="<%= rRole.isReadOnly()?"Grant":"Revoke" %> edit access" width="16" height="16" border="0" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= rRole.isReadOnly()?AppConstants.WA_GRANT_ROLE:AppConstants.WA_REVOKE_ROLE %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= rRole.getId() %>';">
    Grant Access To  + +
    +
    + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/error.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/error.jsp new file mode 100644 index 0000000..2a48507 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/error.jsp @@ -0,0 +1,20 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +${errMsg} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/leafletMap.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/leafletMap.jsp new file mode 100644 index 0000000..77981f7 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/leafletMap.jsp @@ -0,0 +1,288 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> + + + + + + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + +
    SiteUsage
    + + + + + + + + + +
    LinkUsage
    +
    + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/login_external.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/login_external.jsp new file mode 100644 index 0000000..b4e3c09 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/login_external.jsp @@ -0,0 +1,154 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ page import="org.openecomp.portalsdk.core.util.SystemProperties" %> + +" /> + + + + + + + Login + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    + +

    ECOMP Portal

    + + +
    +
    + + +
    +
    +                + +
    +
    +
    +






    + +
    + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/net_map.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/net_map.jsp new file mode 100644 index 0000000..2a34146 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/net_map.jsp @@ -0,0 +1,38 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> + + + + + + + + + +
    + +
    + + + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/user_profile.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/user_profile.jsp new file mode 100644 index 0000000..cb5c4e3 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/user_profile.jsp @@ -0,0 +1,84 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ include file="/WEB-INF/fusion/jsp/popup_modal.html" %> +
    +
    +

    Profile Search

    +
    + + + + + + + + + + + + + + + + + + + + + + +
    User IDLast NameFirst NameEmailOrgUserIdManager OrgUserId
    {{rowData.id}}{{rowData.last_name}}{{rowData.first_name}}{{rowData.email}}{{rowData.orgUserId}}{{rowData.org_manager_userid}}
    +
    +
    +
    + Rows Per Page: + +
    +
    + Current Page: + +
    +
    + Total Page(s): + +
    +
    + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/welcome.jsp b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/welcome.jsp new file mode 100644 index 0000000..a609621 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/jsp/welcome.jsp @@ -0,0 +1,630 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + Welcome ${sessionScope.user.firstName} ${sessionScope.user.lastName}  + (Last Login:  ${lastLogin}) +
    + +
    +
    +
    +
    +
    + +
    + + + + +
    + +
    +
    + +
    +
    +
    + +
    +
    + +
    + +
    + +
    + +
    + +
    + +
    +
    +
      +
    • {{Daytab.title}}
    • +
    +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
      +
    • {{TrafficTab.title}}
    • +
    +
    +
    +
    + + + + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + +
    JQuery + +
    Animated Map + +
    Chat Session + +
    +
    +
    +
    +
    + +
    + + + + + + + + + +
    + +
    + + +
    + +
    +
    +
    +
    + +
    + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/web.xml b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..fcbe840 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,17 @@ + + + + ecomp-sdk-app + + + + + + 7 + COOKIE + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.js new file mode 100644 index 0000000..2778fc5 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.js @@ -0,0 +1,4121 @@ +/** + * @license AngularJS v1.5.0 + * (c) 2010-2016 Google, Inc. http://angularjs.org + * License: MIT + */ +(function(window, angular, undefined) {'use strict'; + +/* jshint ignore:start */ +var noop = angular.noop; +var copy = angular.copy; +var extend = angular.extend; +var jqLite = angular.element; +var forEach = angular.forEach; +var isArray = angular.isArray; +var isString = angular.isString; +var isObject = angular.isObject; +var isUndefined = angular.isUndefined; +var isDefined = angular.isDefined; +var isFunction = angular.isFunction; +var isElement = angular.isElement; + +var ELEMENT_NODE = 1; +var COMMENT_NODE = 8; + +var ADD_CLASS_SUFFIX = '-add'; +var REMOVE_CLASS_SUFFIX = '-remove'; +var EVENT_CLASS_PREFIX = 'ng-'; +var ACTIVE_CLASS_SUFFIX = '-active'; +var PREPARE_CLASS_SUFFIX = '-prepare'; + +var NG_ANIMATE_CLASSNAME = 'ng-animate'; +var NG_ANIMATE_CHILDREN_DATA = '$$ngAnimateChildren'; + +// Detect proper transitionend/animationend event names. +var CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMATIONEND_EVENT; + +// If unprefixed events are not supported but webkit-prefixed are, use the latter. +// Otherwise, just use W3C names, browsers not supporting them at all will just ignore them. +// Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend` +// but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`. +// Register both events in case `window.onanimationend` is not supported because of that, +// do the same for `transitionend` as Safari is likely to exhibit similar behavior. +// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit +// therefore there is no reason to test anymore for other vendor prefixes: +// http://caniuse.com/#search=transition +if (isUndefined(window.ontransitionend) && isDefined(window.onwebkittransitionend)) { + CSS_PREFIX = '-webkit-'; + TRANSITION_PROP = 'WebkitTransition'; + TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend'; +} else { + TRANSITION_PROP = 'transition'; + TRANSITIONEND_EVENT = 'transitionend'; +} + +if (isUndefined(window.onanimationend) && isDefined(window.onwebkitanimationend)) { + CSS_PREFIX = '-webkit-'; + ANIMATION_PROP = 'WebkitAnimation'; + ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend'; +} else { + ANIMATION_PROP = 'animation'; + ANIMATIONEND_EVENT = 'animationend'; +} + +var DURATION_KEY = 'Duration'; +var PROPERTY_KEY = 'Property'; +var DELAY_KEY = 'Delay'; +var TIMING_KEY = 'TimingFunction'; +var ANIMATION_ITERATION_COUNT_KEY = 'IterationCount'; +var ANIMATION_PLAYSTATE_KEY = 'PlayState'; +var SAFE_FAST_FORWARD_DURATION_VALUE = 9999; + +var ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY; +var ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY; +var TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY; +var TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY; + +var isPromiseLike = function(p) { + return p && p.then ? true : false; +}; + +var ngMinErr = angular.$$minErr('ng'); +function assertArg(arg, name, reason) { + if (!arg) { + throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required")); + } + return arg; +} + +function mergeClasses(a,b) { + if (!a && !b) return ''; + if (!a) return b; + if (!b) return a; + if (isArray(a)) a = a.join(' '); + if (isArray(b)) b = b.join(' '); + return a + ' ' + b; +} + +function packageStyles(options) { + var styles = {}; + if (options && (options.to || options.from)) { + styles.to = options.to; + styles.from = options.from; + } + return styles; +} + +function pendClasses(classes, fix, isPrefix) { + var className = ''; + classes = isArray(classes) + ? classes + : classes && isString(classes) && classes.length + ? classes.split(/\s+/) + : []; + forEach(classes, function(klass, i) { + if (klass && klass.length > 0) { + className += (i > 0) ? ' ' : ''; + className += isPrefix ? fix + klass + : klass + fix; + } + }); + return className; +} + +function removeFromArray(arr, val) { + var index = arr.indexOf(val); + if (val >= 0) { + arr.splice(index, 1); + } +} + +function stripCommentsFromElement(element) { + if (element instanceof jqLite) { + switch (element.length) { + case 0: + return []; + break; + + case 1: + // there is no point of stripping anything if the element + // is the only element within the jqLite wrapper. + // (it's important that we retain the element instance.) + if (element[0].nodeType === ELEMENT_NODE) { + return element; + } + break; + + default: + return jqLite(extractElementNode(element)); + break; + } + } + + if (element.nodeType === ELEMENT_NODE) { + return jqLite(element); + } +} + +function extractElementNode(element) { + if (!element[0]) return element; + for (var i = 0; i < element.length; i++) { + var elm = element[i]; + if (elm.nodeType == ELEMENT_NODE) { + return elm; + } + } +} + +function $$addClass($$jqLite, element, className) { + forEach(element, function(elm) { + $$jqLite.addClass(elm, className); + }); +} + +function $$removeClass($$jqLite, element, className) { + forEach(element, function(elm) { + $$jqLite.removeClass(elm, className); + }); +} + +function applyAnimationClassesFactory($$jqLite) { + return function(element, options) { + if (options.addClass) { + $$addClass($$jqLite, element, options.addClass); + options.addClass = null; + } + if (options.removeClass) { + $$removeClass($$jqLite, element, options.removeClass); + options.removeClass = null; + } + } +} + +function prepareAnimationOptions(options) { + options = options || {}; + if (!options.$$prepared) { + var domOperation = options.domOperation || noop; + options.domOperation = function() { + options.$$domOperationFired = true; + domOperation(); + domOperation = noop; + }; + options.$$prepared = true; + } + return options; +} + +function applyAnimationStyles(element, options) { + applyAnimationFromStyles(element, options); + applyAnimationToStyles(element, options); +} + +function applyAnimationFromStyles(element, options) { + if (options.from) { + element.css(options.from); + options.from = null; + } +} + +function applyAnimationToStyles(element, options) { + if (options.to) { + element.css(options.to); + options.to = null; + } +} + +function mergeAnimationDetails(element, oldAnimation, newAnimation) { + var target = oldAnimation.options || {}; + var newOptions = newAnimation.options || {}; + + var toAdd = (target.addClass || '') + ' ' + (newOptions.addClass || ''); + var toRemove = (target.removeClass || '') + ' ' + (newOptions.removeClass || ''); + var classes = resolveElementClasses(element.attr('class'), toAdd, toRemove); + + if (newOptions.preparationClasses) { + target.preparationClasses = concatWithSpace(newOptions.preparationClasses, target.preparationClasses); + delete newOptions.preparationClasses; + } + + // noop is basically when there is no callback; otherwise something has been set + var realDomOperation = target.domOperation !== noop ? target.domOperation : null; + + extend(target, newOptions); + + // TODO(matsko or sreeramu): proper fix is to maintain all animation callback in array and call at last,but now only leave has the callback so no issue with this. + if (realDomOperation) { + target.domOperation = realDomOperation; + } + + if (classes.addClass) { + target.addClass = classes.addClass; + } else { + target.addClass = null; + } + + if (classes.removeClass) { + target.removeClass = classes.removeClass; + } else { + target.removeClass = null; + } + + oldAnimation.addClass = target.addClass; + oldAnimation.removeClass = target.removeClass; + + return target; +} + +function resolveElementClasses(existing, toAdd, toRemove) { + var ADD_CLASS = 1; + var REMOVE_CLASS = -1; + + var flags = {}; + existing = splitClassesToLookup(existing); + + toAdd = splitClassesToLookup(toAdd); + forEach(toAdd, function(value, key) { + flags[key] = ADD_CLASS; + }); + + toRemove = splitClassesToLookup(toRemove); + forEach(toRemove, function(value, key) { + flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS; + }); + + var classes = { + addClass: '', + removeClass: '' + }; + + forEach(flags, function(val, klass) { + var prop, allow; + if (val === ADD_CLASS) { + prop = 'addClass'; + allow = !existing[klass]; + } else if (val === REMOVE_CLASS) { + prop = 'removeClass'; + allow = existing[klass]; + } + if (allow) { + if (classes[prop].length) { + classes[prop] += ' '; + } + classes[prop] += klass; + } + }); + + function splitClassesToLookup(classes) { + if (isString(classes)) { + classes = classes.split(' '); + } + + var obj = {}; + forEach(classes, function(klass) { + // sometimes the split leaves empty string values + // incase extra spaces were applied to the options + if (klass.length) { + obj[klass] = true; + } + }); + return obj; + } + + return classes; +} + +function getDomNode(element) { + return (element instanceof angular.element) ? element[0] : element; +} + +function applyGeneratedPreparationClasses(element, event, options) { + var classes = ''; + if (event) { + classes = pendClasses(event, EVENT_CLASS_PREFIX, true); + } + if (options.addClass) { + classes = concatWithSpace(classes, pendClasses(options.addClass, ADD_CLASS_SUFFIX)); + } + if (options.removeClass) { + classes = concatWithSpace(classes, pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX)); + } + if (classes.length) { + options.preparationClasses = classes; + element.addClass(classes); + } +} + +function clearGeneratedClasses(element, options) { + if (options.preparationClasses) { + element.removeClass(options.preparationClasses); + options.preparationClasses = null; + } + if (options.activeClasses) { + element.removeClass(options.activeClasses); + options.activeClasses = null; + } +} + +function blockTransitions(node, duration) { + // we use a negative delay value since it performs blocking + // yet it doesn't kill any existing transitions running on the + // same element which makes this safe for class-based animations + var value = duration ? '-' + duration + 's' : ''; + applyInlineStyle(node, [TRANSITION_DELAY_PROP, value]); + return [TRANSITION_DELAY_PROP, value]; +} + +function blockKeyframeAnimations(node, applyBlock) { + var value = applyBlock ? 'paused' : ''; + var key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY; + applyInlineStyle(node, [key, value]); + return [key, value]; +} + +function applyInlineStyle(node, styleTuple) { + var prop = styleTuple[0]; + var value = styleTuple[1]; + node.style[prop] = value; +} + +function concatWithSpace(a,b) { + if (!a) return b; + if (!b) return a; + return a + ' ' + b; +} + +var $$rAFSchedulerFactory = ['$$rAF', function($$rAF) { + var queue, cancelFn; + + function scheduler(tasks) { + // we make a copy since RAFScheduler mutates the state + // of the passed in array variable and this would be difficult + // to track down on the outside code + queue = queue.concat(tasks); + nextTick(); + } + + queue = scheduler.queue = []; + + /* waitUntilQuiet does two things: + * 1. It will run the FINAL `fn` value only when an uncanceled RAF has passed through + * 2. It will delay the next wave of tasks from running until the quiet `fn` has run. + * + * The motivation here is that animation code can request more time from the scheduler + * before the next wave runs. This allows for certain DOM properties such as classes to + * be resolved in time for the next animation to run. + */ + scheduler.waitUntilQuiet = function(fn) { + if (cancelFn) cancelFn(); + + cancelFn = $$rAF(function() { + cancelFn = null; + fn(); + nextTick(); + }); + }; + + return scheduler; + + function nextTick() { + if (!queue.length) return; + + var items = queue.shift(); + for (var i = 0; i < items.length; i++) { + items[i](); + } + + if (!cancelFn) { + $$rAF(function() { + if (!cancelFn) nextTick(); + }); + } + } +}]; + +/** + * @ngdoc directive + * @name ngAnimateChildren + * @restrict AE + * @element ANY + * + * @description + * + * ngAnimateChildren allows you to specify that children of this element should animate even if any + * of the children's parents are currently animating. By default, when an element has an active `enter`, `leave`, or `move` + * (structural) animation, child elements that also have an active structural animation are not animated. + * + * Note that even if `ngAnimteChildren` is set, no child animations will run when the parent element is removed from the DOM (`leave` animation). + * + * + * @param {string} ngAnimateChildren If the value is empty, `true` or `on`, + * then child animations are allowed. If the value is `false`, child animations are not allowed. + * + * @example + * + +
    + + +
    +
    +
    + List of items: +
    Item {{item}}
    +
    +
    +
    +
    + + + .container.ng-enter, + .container.ng-leave { + transition: all ease 1.5s; + } + + .container.ng-enter, + .container.ng-leave-active { + opacity: 0; + } + + .container.ng-leave, + .container.ng-enter-active { + opacity: 1; + } + + .item { + background: firebrick; + color: #FFF; + margin-bottom: 10px; + } + + .item.ng-enter, + .item.ng-leave { + transition: transform 1.5s ease; + } + + .item.ng-enter { + transform: translateX(50px); + } + + .item.ng-enter-active { + transform: translateX(0); + } + + + angular.module('ngAnimateChildren', ['ngAnimate']) + .controller('mainController', function() { + this.animateChildren = false; + this.enterElement = false; + }); + +
    + */ +var $$AnimateChildrenDirective = ['$interpolate', function($interpolate) { + return { + link: function(scope, element, attrs) { + var val = attrs.ngAnimateChildren; + if (angular.isString(val) && val.length === 0) { //empty attribute + element.data(NG_ANIMATE_CHILDREN_DATA, true); + } else { + // Interpolate and set the value, so that it is available to + // animations that run right after compilation + setData($interpolate(val)(scope)); + attrs.$observe('ngAnimateChildren', setData); + } + + function setData(value) { + value = value === 'on' || value === 'true'; + element.data(NG_ANIMATE_CHILDREN_DATA, value); + } + } + }; +}]; + +var ANIMATE_TIMER_KEY = '$$animateCss'; + +/** + * @ngdoc service + * @name $animateCss + * @kind object + * + * @description + * The `$animateCss` service is a useful utility to trigger customized CSS-based transitions/keyframes + * from a JavaScript-based animation or directly from a directive. The purpose of `$animateCss` is NOT + * to side-step how `$animate` and ngAnimate work, but the goal is to allow pre-existing animations or + * directives to create more complex animations that can be purely driven using CSS code. + * + * Note that only browsers that support CSS transitions and/or keyframe animations are capable of + * rendering animations triggered via `$animateCss` (bad news for IE9 and lower). + * + * ## Usage + * Once again, `$animateCss` is designed to be used inside of a registered JavaScript animation that + * is powered by ngAnimate. It is possible to use `$animateCss` directly inside of a directive, however, + * any automatic control over cancelling animations and/or preventing animations from being run on + * child elements will not be handled by Angular. For this to work as expected, please use `$animate` to + * trigger the animation and then setup a JavaScript animation that injects `$animateCss` to trigger + * the CSS animation. + * + * The example below shows how we can create a folding animation on an element using `ng-if`: + * + * ```html + * + *
    + * This element will go BOOM + *
    + * + * ``` + * + * Now we create the **JavaScript animation** that will trigger the CSS transition: + * + * ```js + * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) { + * return { + * enter: function(element, doneFn) { + * var height = element[0].offsetHeight; + * return $animateCss(element, { + * from: { height:'0px' }, + * to: { height:height + 'px' }, + * duration: 1 // one second + * }); + * } + * } + * }]); + * ``` + * + * ## More Advanced Uses + * + * `$animateCss` is the underlying code that ngAnimate uses to power **CSS-based animations** behind the scenes. Therefore CSS hooks + * like `.ng-EVENT`, `.ng-EVENT-active`, `.ng-EVENT-stagger` are all features that can be triggered using `$animateCss` via JavaScript code. + * + * This also means that just about any combination of adding classes, removing classes, setting styles, dynamically setting a keyframe animation, + * applying a hardcoded duration or delay value, changing the animation easing or applying a stagger animation are all options that work with + * `$animateCss`. The service itself is smart enough to figure out the combination of options and examine the element styling properties in order + * to provide a working animation that will run in CSS. + * + * The example below showcases a more advanced version of the `.fold-animation` from the example above: + * + * ```js + * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) { + * return { + * enter: function(element, doneFn) { + * var height = element[0].offsetHeight; + * return $animateCss(element, { + * addClass: 'red large-text pulse-twice', + * easing: 'ease-out', + * from: { height:'0px' }, + * to: { height:height + 'px' }, + * duration: 1 // one second + * }); + * } + * } + * }]); + * ``` + * + * Since we're adding/removing CSS classes then the CSS transition will also pick those up: + * + * ```css + * /* since a hardcoded duration value of 1 was provided in the JavaScript animation code, + * the CSS classes below will be transitioned despite them being defined as regular CSS classes */ + * .red { background:red; } + * .large-text { font-size:20px; } + * + * /* we can also use a keyframe animation and $animateCss will make it work alongside the transition */ + * .pulse-twice { + * animation: 0.5s pulse linear 2; + * -webkit-animation: 0.5s pulse linear 2; + * } + * + * @keyframes pulse { + * from { transform: scale(0.5); } + * to { transform: scale(1.5); } + * } + * + * @-webkit-keyframes pulse { + * from { -webkit-transform: scale(0.5); } + * to { -webkit-transform: scale(1.5); } + * } + * ``` + * + * Given this complex combination of CSS classes, styles and options, `$animateCss` will figure everything out and make the animation happen. + * + * ## How the Options are handled + * + * `$animateCss` is very versatile and intelligent when it comes to figuring out what configurations to apply to the element to ensure the animation + * works with the options provided. Say for example we were adding a class that contained a keyframe value and we wanted to also animate some inline + * styles using the `from` and `to` properties. + * + * ```js + * var animator = $animateCss(element, { + * from: { background:'red' }, + * to: { background:'blue' } + * }); + * animator.start(); + * ``` + * + * ```css + * .rotating-animation { + * animation:0.5s rotate linear; + * -webkit-animation:0.5s rotate linear; + * } + * + * @keyframes rotate { + * from { transform: rotate(0deg); } + * to { transform: rotate(360deg); } + * } + * + * @-webkit-keyframes rotate { + * from { -webkit-transform: rotate(0deg); } + * to { -webkit-transform: rotate(360deg); } + * } + * ``` + * + * The missing pieces here are that we do not have a transition set (within the CSS code nor within the `$animateCss` options) and the duration of the animation is + * going to be detected from what the keyframe styles on the CSS class are. In this event, `$animateCss` will automatically create an inline transition + * style matching the duration detected from the keyframe style (which is present in the CSS class that is being added) and then prepare both the transition + * and keyframe animations to run in parallel on the element. Then when the animation is underway the provided `from` and `to` CSS styles will be applied + * and spread across the transition and keyframe animation. + * + * ## What is returned + * + * `$animateCss` works in two stages: a preparation phase and an animation phase. Therefore when `$animateCss` is first called it will NOT actually + * start the animation. All that is going on here is that the element is being prepared for the animation (which means that the generated CSS classes are + * added and removed on the element). Once `$animateCss` is called it will return an object with the following properties: + * + * ```js + * var animator = $animateCss(element, { ... }); + * ``` + * + * Now what do the contents of our `animator` variable look like: + * + * ```js + * { + * // starts the animation + * start: Function, + * + * // ends (aborts) the animation + * end: Function + * } + * ``` + * + * To actually start the animation we need to run `animation.start()` which will then return a promise that we can hook into to detect when the animation ends. + * If we choose not to run the animation then we MUST run `animation.end()` to perform a cleanup on the element (since some CSS classes and styles may have been + * applied to the element during the preparation phase). Note that all other properties such as duration, delay, transitions and keyframes are just properties + * and that changing them will not reconfigure the parameters of the animation. + * + * ### runner.done() vs runner.then() + * It is documented that `animation.start()` will return a promise object and this is true, however, there is also an additional method available on the + * runner called `.done(callbackFn)`. The done method works the same as `.finally(callbackFn)`, however, it does **not trigger a digest to occur**. + * Therefore, for performance reasons, it's always best to use `runner.done(callback)` instead of `runner.then()`, `runner.catch()` or `runner.finally()` + * unless you really need a digest to kick off afterwards. + * + * Keep in mind that, to make this easier, ngAnimate has tweaked the JS animations API to recognize when a runner instance is returned from $animateCss + * (so there is no need to call `runner.done(doneFn)` inside of your JavaScript animation code). + * Check the {@link ngAnimate.$animateCss#usage animation code above} to see how this works. + * + * @param {DOMElement} element the element that will be animated + * @param {object} options the animation-related options that will be applied during the animation + * + * * `event` - The DOM event (e.g. enter, leave, move). When used, a generated CSS class of `ng-EVENT` and `ng-EVENT-active` will be applied + * to the element during the animation. Multiple events can be provided when spaces are used as a separator. (Note that this will not perform any DOM operation.) + * * `structural` - Indicates that the `ng-` prefix will be added to the event class. Setting to `false` or omitting will turn `ng-EVENT` and + * `ng-EVENT-active` in `EVENT` and `EVENT-active`. Unused if `event` is omitted. + * * `easing` - The CSS easing value that will be applied to the transition or keyframe animation (or both). + * * `transitionStyle` - The raw CSS transition style that will be used (e.g. `1s linear all`). + * * `keyframeStyle` - The raw CSS keyframe animation style that will be used (e.g. `1s my_animation linear`). + * * `from` - The starting CSS styles (a key/value object) that will be applied at the start of the animation. + * * `to` - The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition. + * * `addClass` - A space separated list of CSS classes that will be added to the element and spread across the animation. + * * `removeClass` - A space separated list of CSS classes that will be removed from the element and spread across the animation. + * * `duration` - A number value representing the total duration of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `0` + * is provided then the animation will be skipped entirely. + * * `delay` - A number value representing the total delay of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `true` is + * used then whatever delay value is detected from the CSS classes will be mirrored on the elements styles (e.g. by setting delay true then the style value + * of the element will be `transition-delay: DETECTED_VALUE`). Using `true` is useful when you want the CSS classes and inline styles to all share the same + * CSS delay value. + * * `stagger` - A numeric time value representing the delay between successively animated elements + * ({@link ngAnimate#css-staggering-animations Click here to learn how CSS-based staggering works in ngAnimate.}) + * * `staggerIndex` - The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item in the stagger; therefore when a + * `stagger` option value of `0.1` is used then there will be a stagger delay of `600ms`) + * * `applyClassesEarly` - Whether or not the classes being added or removed will be used when detecting the animation. This is set by `$animate` when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. (Note that this will prevent any transitions from occurring on the classes being added and removed.) + * * `cleanupStyles` - Whether or not the provided `from` and `to` styles will be removed once + * the animation is closed. This is useful for when the styles are used purely for the sake of + * the animation and do not have a lasting visual effect on the element (e.g. a collapse and open animation). + * By default this value is set to `false`. + * + * @return {object} an object with start and end methods and details about the animation. + * + * * `start` - The method to start the animation. This will return a `Promise` when called. + * * `end` - This method will cancel the animation and remove all applied CSS classes and styles. + */ +var ONE_SECOND = 1000; +var BASE_TEN = 10; + +var ELAPSED_TIME_MAX_DECIMAL_PLACES = 3; +var CLOSING_TIME_BUFFER = 1.5; + +var DETECT_CSS_PROPERTIES = { + transitionDuration: TRANSITION_DURATION_PROP, + transitionDelay: TRANSITION_DELAY_PROP, + transitionProperty: TRANSITION_PROP + PROPERTY_KEY, + animationDuration: ANIMATION_DURATION_PROP, + animationDelay: ANIMATION_DELAY_PROP, + animationIterationCount: ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY +}; + +var DETECT_STAGGER_CSS_PROPERTIES = { + transitionDuration: TRANSITION_DURATION_PROP, + transitionDelay: TRANSITION_DELAY_PROP, + animationDuration: ANIMATION_DURATION_PROP, + animationDelay: ANIMATION_DELAY_PROP +}; + +function getCssKeyframeDurationStyle(duration) { + return [ANIMATION_DURATION_PROP, duration + 's']; +} + +function getCssDelayStyle(delay, isKeyframeAnimation) { + var prop = isKeyframeAnimation ? ANIMATION_DELAY_PROP : TRANSITION_DELAY_PROP; + return [prop, delay + 's']; +} + +function computeCssStyles($window, element, properties) { + var styles = Object.create(null); + var detectedStyles = $window.getComputedStyle(element) || {}; + forEach(properties, function(formalStyleName, actualStyleName) { + var val = detectedStyles[formalStyleName]; + if (val) { + var c = val.charAt(0); + + // only numerical-based values have a negative sign or digit as the first value + if (c === '-' || c === '+' || c >= 0) { + val = parseMaxTime(val); + } + + // by setting this to null in the event that the delay is not set or is set directly as 0 + // then we can still allow for negative values to be used later on and not mistake this + // value for being greater than any other negative value. + if (val === 0) { + val = null; + } + styles[actualStyleName] = val; + } + }); + + return styles; +} + +function parseMaxTime(str) { + var maxValue = 0; + var values = str.split(/\s*,\s*/); + forEach(values, function(value) { + // it's always safe to consider only second values and omit `ms` values since + // getComputedStyle will always handle the conversion for us + if (value.charAt(value.length - 1) == 's') { + value = value.substring(0, value.length - 1); + } + value = parseFloat(value) || 0; + maxValue = maxValue ? Math.max(value, maxValue) : value; + }); + return maxValue; +} + +function truthyTimingValue(val) { + return val === 0 || val != null; +} + +function getCssTransitionDurationStyle(duration, applyOnlyDuration) { + var style = TRANSITION_PROP; + var value = duration + 's'; + if (applyOnlyDuration) { + style += DURATION_KEY; + } else { + value += ' linear all'; + } + return [style, value]; +} + +function createLocalCacheLookup() { + var cache = Object.create(null); + return { + flush: function() { + cache = Object.create(null); + }, + + count: function(key) { + var entry = cache[key]; + return entry ? entry.total : 0; + }, + + get: function(key) { + var entry = cache[key]; + return entry && entry.value; + }, + + put: function(key, value) { + if (!cache[key]) { + cache[key] = { total: 1, value: value }; + } else { + cache[key].total++; + } + } + }; +} + +// we do not reassign an already present style value since +// if we detect the style property value again we may be +// detecting styles that were added via the `from` styles. +// We make use of `isDefined` here since an empty string +// or null value (which is what getPropertyValue will return +// for a non-existing style) will still be marked as a valid +// value for the style (a falsy value implies that the style +// is to be removed at the end of the animation). If we had a simple +// "OR" statement then it would not be enough to catch that. +function registerRestorableStyles(backup, node, properties) { + forEach(properties, function(prop) { + backup[prop] = isDefined(backup[prop]) + ? backup[prop] + : node.style.getPropertyValue(prop); + }); +} + +var $AnimateCssProvider = ['$animateProvider', function($animateProvider) { + var gcsLookup = createLocalCacheLookup(); + var gcsStaggerLookup = createLocalCacheLookup(); + + this.$get = ['$window', '$$jqLite', '$$AnimateRunner', '$timeout', + '$$forceReflow', '$sniffer', '$$rAFScheduler', '$$animateQueue', + function($window, $$jqLite, $$AnimateRunner, $timeout, + $$forceReflow, $sniffer, $$rAFScheduler, $$animateQueue) { + + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + + var parentCounter = 0; + function gcsHashFn(node, extraClasses) { + var KEY = "$$ngAnimateParentKey"; + var parentNode = node.parentNode; + var parentID = parentNode[KEY] || (parentNode[KEY] = ++parentCounter); + return parentID + '-' + node.getAttribute('class') + '-' + extraClasses; + } + + function computeCachedCssStyles(node, className, cacheKey, properties) { + var timings = gcsLookup.get(cacheKey); + + if (!timings) { + timings = computeCssStyles($window, node, properties); + if (timings.animationIterationCount === 'infinite') { + timings.animationIterationCount = 1; + } + } + + // we keep putting this in multiple times even though the value and the cacheKey are the same + // because we're keeping an internal tally of how many duplicate animations are detected. + gcsLookup.put(cacheKey, timings); + return timings; + } + + function computeCachedCssStaggerStyles(node, className, cacheKey, properties) { + var stagger; + + // if we have one or more existing matches of matching elements + // containing the same parent + CSS styles (which is how cacheKey works) + // then staggering is possible + if (gcsLookup.count(cacheKey) > 0) { + stagger = gcsStaggerLookup.get(cacheKey); + + if (!stagger) { + var staggerClassName = pendClasses(className, '-stagger'); + + $$jqLite.addClass(node, staggerClassName); + + stagger = computeCssStyles($window, node, properties); + + // force the conversion of a null value to zero incase not set + stagger.animationDuration = Math.max(stagger.animationDuration, 0); + stagger.transitionDuration = Math.max(stagger.transitionDuration, 0); + + $$jqLite.removeClass(node, staggerClassName); + + gcsStaggerLookup.put(cacheKey, stagger); + } + } + + return stagger || {}; + } + + var cancelLastRAFRequest; + var rafWaitQueue = []; + function waitUntilQuiet(callback) { + rafWaitQueue.push(callback); + $$rAFScheduler.waitUntilQuiet(function() { + gcsLookup.flush(); + gcsStaggerLookup.flush(); + + // DO NOT REMOVE THIS LINE OR REFACTOR OUT THE `pageWidth` variable. + // PLEASE EXAMINE THE `$$forceReflow` service to understand why. + var pageWidth = $$forceReflow(); + + // we use a for loop to ensure that if the queue is changed + // during this looping then it will consider new requests + for (var i = 0; i < rafWaitQueue.length; i++) { + rafWaitQueue[i](pageWidth); + } + rafWaitQueue.length = 0; + }); + } + + function computeTimings(node, className, cacheKey) { + var timings = computeCachedCssStyles(node, className, cacheKey, DETECT_CSS_PROPERTIES); + var aD = timings.animationDelay; + var tD = timings.transitionDelay; + timings.maxDelay = aD && tD + ? Math.max(aD, tD) + : (aD || tD); + timings.maxDuration = Math.max( + timings.animationDuration * timings.animationIterationCount, + timings.transitionDuration); + + return timings; + } + + return function init(element, initialOptions) { + // all of the animation functions should create + // a copy of the options data, however, if a + // parent service has already created a copy then + // we should stick to using that + var options = initialOptions || {}; + if (!options.$$prepared) { + options = prepareAnimationOptions(copy(options)); + } + + var restoreStyles = {}; + var node = getDomNode(element); + if (!node + || !node.parentNode + || !$$animateQueue.enabled()) { + return closeAndReturnNoopAnimator(); + } + + var temporaryStyles = []; + var classes = element.attr('class'); + var styles = packageStyles(options); + var animationClosed; + var animationPaused; + var animationCompleted; + var runner; + var runnerHost; + var maxDelay; + var maxDelayTime; + var maxDuration; + var maxDurationTime; + var startTime; + var events = []; + + if (options.duration === 0 || (!$sniffer.animations && !$sniffer.transitions)) { + return closeAndReturnNoopAnimator(); + } + + var method = options.event && isArray(options.event) + ? options.event.join(' ') + : options.event; + + var isStructural = method && options.structural; + var structuralClassName = ''; + var addRemoveClassName = ''; + + if (isStructural) { + structuralClassName = pendClasses(method, EVENT_CLASS_PREFIX, true); + } else if (method) { + structuralClassName = method; + } + + if (options.addClass) { + addRemoveClassName += pendClasses(options.addClass, ADD_CLASS_SUFFIX); + } + + if (options.removeClass) { + if (addRemoveClassName.length) { + addRemoveClassName += ' '; + } + addRemoveClassName += pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX); + } + + // there may be a situation where a structural animation is combined together + // with CSS classes that need to resolve before the animation is computed. + // However this means that there is no explicit CSS code to block the animation + // from happening (by setting 0s none in the class name). If this is the case + // we need to apply the classes before the first rAF so we know to continue if + // there actually is a detected transition or keyframe animation + if (options.applyClassesEarly && addRemoveClassName.length) { + applyAnimationClasses(element, options); + } + + var preparationClasses = [structuralClassName, addRemoveClassName].join(' ').trim(); + var fullClassName = classes + ' ' + preparationClasses; + var activeClasses = pendClasses(preparationClasses, ACTIVE_CLASS_SUFFIX); + var hasToStyles = styles.to && Object.keys(styles.to).length > 0; + var containsKeyframeAnimation = (options.keyframeStyle || '').length > 0; + + // there is no way we can trigger an animation if no styles and + // no classes are being applied which would then trigger a transition, + // unless there a is raw keyframe value that is applied to the element. + if (!containsKeyframeAnimation + && !hasToStyles + && !preparationClasses) { + return closeAndReturnNoopAnimator(); + } + + var cacheKey, stagger; + if (options.stagger > 0) { + var staggerVal = parseFloat(options.stagger); + stagger = { + transitionDelay: staggerVal, + animationDelay: staggerVal, + transitionDuration: 0, + animationDuration: 0 + }; + } else { + cacheKey = gcsHashFn(node, fullClassName); + stagger = computeCachedCssStaggerStyles(node, preparationClasses, cacheKey, DETECT_STAGGER_CSS_PROPERTIES); + } + + if (!options.$$skipPreparationClasses) { + $$jqLite.addClass(element, preparationClasses); + } + + var applyOnlyDuration; + + if (options.transitionStyle) { + var transitionStyle = [TRANSITION_PROP, options.transitionStyle]; + applyInlineStyle(node, transitionStyle); + temporaryStyles.push(transitionStyle); + } + + if (options.duration >= 0) { + applyOnlyDuration = node.style[TRANSITION_PROP].length > 0; + var durationStyle = getCssTransitionDurationStyle(options.duration, applyOnlyDuration); + + // we set the duration so that it will be picked up by getComputedStyle later + applyInlineStyle(node, durationStyle); + temporaryStyles.push(durationStyle); + } + + if (options.keyframeStyle) { + var keyframeStyle = [ANIMATION_PROP, options.keyframeStyle]; + applyInlineStyle(node, keyframeStyle); + temporaryStyles.push(keyframeStyle); + } + + var itemIndex = stagger + ? options.staggerIndex >= 0 + ? options.staggerIndex + : gcsLookup.count(cacheKey) + : 0; + + var isFirst = itemIndex === 0; + + // this is a pre-emptive way of forcing the setup classes to be added and applied INSTANTLY + // without causing any combination of transitions to kick in. By adding a negative delay value + // it forces the setup class' transition to end immediately. We later then remove the negative + // transition delay to allow for the transition to naturally do it's thing. The beauty here is + // that if there is no transition defined then nothing will happen and this will also allow + // other transitions to be stacked on top of each other without any chopping them out. + if (isFirst && !options.skipBlocking) { + blockTransitions(node, SAFE_FAST_FORWARD_DURATION_VALUE); + } + + var timings = computeTimings(node, fullClassName, cacheKey); + var relativeDelay = timings.maxDelay; + maxDelay = Math.max(relativeDelay, 0); + maxDuration = timings.maxDuration; + + var flags = {}; + flags.hasTransitions = timings.transitionDuration > 0; + flags.hasAnimations = timings.animationDuration > 0; + flags.hasTransitionAll = flags.hasTransitions && timings.transitionProperty == 'all'; + flags.applyTransitionDuration = hasToStyles && ( + (flags.hasTransitions && !flags.hasTransitionAll) + || (flags.hasAnimations && !flags.hasTransitions)); + flags.applyAnimationDuration = options.duration && flags.hasAnimations; + flags.applyTransitionDelay = truthyTimingValue(options.delay) && (flags.applyTransitionDuration || flags.hasTransitions); + flags.applyAnimationDelay = truthyTimingValue(options.delay) && flags.hasAnimations; + flags.recalculateTimingStyles = addRemoveClassName.length > 0; + + if (flags.applyTransitionDuration || flags.applyAnimationDuration) { + maxDuration = options.duration ? parseFloat(options.duration) : maxDuration; + + if (flags.applyTransitionDuration) { + flags.hasTransitions = true; + timings.transitionDuration = maxDuration; + applyOnlyDuration = node.style[TRANSITION_PROP + PROPERTY_KEY].length > 0; + temporaryStyles.push(getCssTransitionDurationStyle(maxDuration, applyOnlyDuration)); + } + + if (flags.applyAnimationDuration) { + flags.hasAnimations = true; + timings.animationDuration = maxDuration; + temporaryStyles.push(getCssKeyframeDurationStyle(maxDuration)); + } + } + + if (maxDuration === 0 && !flags.recalculateTimingStyles) { + return closeAndReturnNoopAnimator(); + } + + if (options.delay != null) { + var delayStyle; + if (typeof options.delay !== "boolean") { + delayStyle = parseFloat(options.delay); + // number in options.delay means we have to recalculate the delay for the closing timeout + maxDelay = Math.max(delayStyle, 0); + } + + if (flags.applyTransitionDelay) { + temporaryStyles.push(getCssDelayStyle(delayStyle)); + } + + if (flags.applyAnimationDelay) { + temporaryStyles.push(getCssDelayStyle(delayStyle, true)); + } + } + + // we need to recalculate the delay value since we used a pre-emptive negative + // delay value and the delay value is required for the final event checking. This + // property will ensure that this will happen after the RAF phase has passed. + if (options.duration == null && timings.transitionDuration > 0) { + flags.recalculateTimingStyles = flags.recalculateTimingStyles || isFirst; + } + + maxDelayTime = maxDelay * ONE_SECOND; + maxDurationTime = maxDuration * ONE_SECOND; + if (!options.skipBlocking) { + flags.blockTransition = timings.transitionDuration > 0; + flags.blockKeyframeAnimation = timings.animationDuration > 0 && + stagger.animationDelay > 0 && + stagger.animationDuration === 0; + } + + if (options.from) { + if (options.cleanupStyles) { + registerRestorableStyles(restoreStyles, node, Object.keys(options.from)); + } + applyAnimationFromStyles(element, options); + } + + if (flags.blockTransition || flags.blockKeyframeAnimation) { + applyBlocking(maxDuration); + } else if (!options.skipBlocking) { + blockTransitions(node, false); + } + + // TODO(matsko): for 1.5 change this code to have an animator object for better debugging + return { + $$willAnimate: true, + end: endFn, + start: function() { + if (animationClosed) return; + + runnerHost = { + end: endFn, + cancel: cancelFn, + resume: null, //this will be set during the start() phase + pause: null + }; + + runner = new $$AnimateRunner(runnerHost); + + waitUntilQuiet(start); + + // we don't have access to pause/resume the animation + // since it hasn't run yet. AnimateRunner will therefore + // set noop functions for resume and pause and they will + // later be overridden once the animation is triggered + return runner; + } + }; + + function endFn() { + close(); + } + + function cancelFn() { + close(true); + } + + function close(rejected) { // jshint ignore:line + // if the promise has been called already then we shouldn't close + // the animation again + if (animationClosed || (animationCompleted && animationPaused)) return; + animationClosed = true; + animationPaused = false; + + if (!options.$$skipPreparationClasses) { + $$jqLite.removeClass(element, preparationClasses); + } + $$jqLite.removeClass(element, activeClasses); + + blockKeyframeAnimations(node, false); + blockTransitions(node, false); + + forEach(temporaryStyles, function(entry) { + // There is only one way to remove inline style properties entirely from elements. + // By using `removeProperty` this works, but we need to convert camel-cased CSS + // styles down to hyphenated values. + node.style[entry[0]] = ''; + }); + + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + + if (Object.keys(restoreStyles).length) { + forEach(restoreStyles, function(value, prop) { + value ? node.style.setProperty(prop, value) + : node.style.removeProperty(prop); + }); + } + + // the reason why we have this option is to allow a synchronous closing callback + // that is fired as SOON as the animation ends (when the CSS is removed) or if + // the animation never takes off at all. A good example is a leave animation since + // the element must be removed just after the animation is over or else the element + // will appear on screen for one animation frame causing an overbearing flicker. + if (options.onDone) { + options.onDone(); + } + + if (events && events.length) { + // Remove the transitionend / animationend listener(s) + element.off(events.join(' '), onAnimationProgress); + } + + //Cancel the fallback closing timeout and remove the timer data + var animationTimerData = element.data(ANIMATE_TIMER_KEY); + if (animationTimerData) { + $timeout.cancel(animationTimerData[0].timer); + element.removeData(ANIMATE_TIMER_KEY); + } + + // if the preparation function fails then the promise is not setup + if (runner) { + runner.complete(!rejected); + } + } + + function applyBlocking(duration) { + if (flags.blockTransition) { + blockTransitions(node, duration); + } + + if (flags.blockKeyframeAnimation) { + blockKeyframeAnimations(node, !!duration); + } + } + + function closeAndReturnNoopAnimator() { + runner = new $$AnimateRunner({ + end: endFn, + cancel: cancelFn + }); + + // should flush the cache animation + waitUntilQuiet(noop); + close(); + + return { + $$willAnimate: false, + start: function() { + return runner; + }, + end: endFn + }; + } + + function onAnimationProgress(event) { + event.stopPropagation(); + var ev = event.originalEvent || event; + + // we now always use `Date.now()` due to the recent changes with + // event.timeStamp in Firefox, Webkit and Chrome (see #13494 for more info) + var timeStamp = ev.$manualTimeStamp || Date.now(); + + /* Firefox (or possibly just Gecko) likes to not round values up + * when a ms measurement is used for the animation */ + var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES)); + + /* $manualTimeStamp is a mocked timeStamp value which is set + * within browserTrigger(). This is only here so that tests can + * mock animations properly. Real events fallback to event.timeStamp, + * or, if they don't, then a timeStamp is automatically created for them. + * We're checking to see if the timeStamp surpasses the expected delay, + * but we're using elapsedTime instead of the timeStamp on the 2nd + * pre-condition since animationPauseds sometimes close off early */ + if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) { + // we set this flag to ensure that if the transition is paused then, when resumed, + // the animation will automatically close itself since transitions cannot be paused. + animationCompleted = true; + close(); + } + } + + function start() { + if (animationClosed) return; + if (!node.parentNode) { + close(); + return; + } + + // even though we only pause keyframe animations here the pause flag + // will still happen when transitions are used. Only the transition will + // not be paused since that is not possible. If the animation ends when + // paused then it will not complete until unpaused or cancelled. + var playPause = function(playAnimation) { + if (!animationCompleted) { + animationPaused = !playAnimation; + if (timings.animationDuration) { + var value = blockKeyframeAnimations(node, animationPaused); + animationPaused + ? temporaryStyles.push(value) + : removeFromArray(temporaryStyles, value); + } + } else if (animationPaused && playAnimation) { + animationPaused = false; + close(); + } + }; + + // checking the stagger duration prevents an accidentally cascade of the CSS delay style + // being inherited from the parent. If the transition duration is zero then we can safely + // rely that the delay value is an intentional stagger delay style. + var maxStagger = itemIndex > 0 + && ((timings.transitionDuration && stagger.transitionDuration === 0) || + (timings.animationDuration && stagger.animationDuration === 0)) + && Math.max(stagger.animationDelay, stagger.transitionDelay); + if (maxStagger) { + $timeout(triggerAnimationStart, + Math.floor(maxStagger * itemIndex * ONE_SECOND), + false); + } else { + triggerAnimationStart(); + } + + // this will decorate the existing promise runner with pause/resume methods + runnerHost.resume = function() { + playPause(true); + }; + + runnerHost.pause = function() { + playPause(false); + }; + + function triggerAnimationStart() { + // just incase a stagger animation kicks in when the animation + // itself was cancelled entirely + if (animationClosed) return; + + applyBlocking(false); + + forEach(temporaryStyles, function(entry) { + var key = entry[0]; + var value = entry[1]; + node.style[key] = value; + }); + + applyAnimationClasses(element, options); + $$jqLite.addClass(element, activeClasses); + + if (flags.recalculateTimingStyles) { + fullClassName = node.className + ' ' + preparationClasses; + cacheKey = gcsHashFn(node, fullClassName); + + timings = computeTimings(node, fullClassName, cacheKey); + relativeDelay = timings.maxDelay; + maxDelay = Math.max(relativeDelay, 0); + maxDuration = timings.maxDuration; + + if (maxDuration === 0) { + close(); + return; + } + + flags.hasTransitions = timings.transitionDuration > 0; + flags.hasAnimations = timings.animationDuration > 0; + } + + if (flags.applyAnimationDelay) { + relativeDelay = typeof options.delay !== "boolean" && truthyTimingValue(options.delay) + ? parseFloat(options.delay) + : relativeDelay; + + maxDelay = Math.max(relativeDelay, 0); + timings.animationDelay = relativeDelay; + delayStyle = getCssDelayStyle(relativeDelay, true); + temporaryStyles.push(delayStyle); + node.style[delayStyle[0]] = delayStyle[1]; + } + + maxDelayTime = maxDelay * ONE_SECOND; + maxDurationTime = maxDuration * ONE_SECOND; + + if (options.easing) { + var easeProp, easeVal = options.easing; + if (flags.hasTransitions) { + easeProp = TRANSITION_PROP + TIMING_KEY; + temporaryStyles.push([easeProp, easeVal]); + node.style[easeProp] = easeVal; + } + if (flags.hasAnimations) { + easeProp = ANIMATION_PROP + TIMING_KEY; + temporaryStyles.push([easeProp, easeVal]); + node.style[easeProp] = easeVal; + } + } + + if (timings.transitionDuration) { + events.push(TRANSITIONEND_EVENT); + } + + if (timings.animationDuration) { + events.push(ANIMATIONEND_EVENT); + } + + startTime = Date.now(); + var timerTime = maxDelayTime + CLOSING_TIME_BUFFER * maxDurationTime; + var endTime = startTime + timerTime; + + var animationsData = element.data(ANIMATE_TIMER_KEY) || []; + var setupFallbackTimer = true; + if (animationsData.length) { + var currentTimerData = animationsData[0]; + setupFallbackTimer = endTime > currentTimerData.expectedEndTime; + if (setupFallbackTimer) { + $timeout.cancel(currentTimerData.timer); + } else { + animationsData.push(close); + } + } + + if (setupFallbackTimer) { + var timer = $timeout(onAnimationExpired, timerTime, false); + animationsData[0] = { + timer: timer, + expectedEndTime: endTime + }; + animationsData.push(close); + element.data(ANIMATE_TIMER_KEY, animationsData); + } + + if (events.length) { + element.on(events.join(' '), onAnimationProgress); + } + + if (options.to) { + if (options.cleanupStyles) { + registerRestorableStyles(restoreStyles, node, Object.keys(options.to)); + } + applyAnimationToStyles(element, options); + } + } + + function onAnimationExpired() { + var animationsData = element.data(ANIMATE_TIMER_KEY); + + // this will be false in the event that the element was + // removed from the DOM (via a leave animation or something + // similar) + if (animationsData) { + for (var i = 1; i < animationsData.length; i++) { + animationsData[i](); + } + element.removeData(ANIMATE_TIMER_KEY); + } + } + } + }; + }]; +}]; + +var $$AnimateCssDriverProvider = ['$$animationProvider', function($$animationProvider) { + $$animationProvider.drivers.push('$$animateCssDriver'); + + var NG_ANIMATE_SHIM_CLASS_NAME = 'ng-animate-shim'; + var NG_ANIMATE_ANCHOR_CLASS_NAME = 'ng-anchor'; + + var NG_OUT_ANCHOR_CLASS_NAME = 'ng-anchor-out'; + var NG_IN_ANCHOR_CLASS_NAME = 'ng-anchor-in'; + + function isDocumentFragment(node) { + return node.parentNode && node.parentNode.nodeType === 11; + } + + this.$get = ['$animateCss', '$rootScope', '$$AnimateRunner', '$rootElement', '$sniffer', '$$jqLite', '$document', + function($animateCss, $rootScope, $$AnimateRunner, $rootElement, $sniffer, $$jqLite, $document) { + + // only browsers that support these properties can render animations + if (!$sniffer.animations && !$sniffer.transitions) return noop; + + var bodyNode = $document[0].body; + var rootNode = getDomNode($rootElement); + + var rootBodyElement = jqLite( + // this is to avoid using something that exists outside of the body + // we also special case the doc fragment case because our unit test code + // appends the $rootElement to the body after the app has been bootstrapped + isDocumentFragment(rootNode) || bodyNode.contains(rootNode) ? rootNode : bodyNode + ); + + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + + return function initDriverFn(animationDetails) { + return animationDetails.from && animationDetails.to + ? prepareFromToAnchorAnimation(animationDetails.from, + animationDetails.to, + animationDetails.classes, + animationDetails.anchors) + : prepareRegularAnimation(animationDetails); + }; + + function filterCssClasses(classes) { + //remove all the `ng-` stuff + return classes.replace(/\bng-\S+\b/g, ''); + } + + function getUniqueValues(a, b) { + if (isString(a)) a = a.split(' '); + if (isString(b)) b = b.split(' '); + return a.filter(function(val) { + return b.indexOf(val) === -1; + }).join(' '); + } + + function prepareAnchoredAnimation(classes, outAnchor, inAnchor) { + var clone = jqLite(getDomNode(outAnchor).cloneNode(true)); + var startingClasses = filterCssClasses(getClassVal(clone)); + + outAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME); + inAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME); + + clone.addClass(NG_ANIMATE_ANCHOR_CLASS_NAME); + + rootBodyElement.append(clone); + + var animatorIn, animatorOut = prepareOutAnimation(); + + // the user may not end up using the `out` animation and + // only making use of the `in` animation or vice-versa. + // In either case we should allow this and not assume the + // animation is over unless both animations are not used. + if (!animatorOut) { + animatorIn = prepareInAnimation(); + if (!animatorIn) { + return end(); + } + } + + var startingAnimator = animatorOut || animatorIn; + + return { + start: function() { + var runner; + + var currentAnimation = startingAnimator.start(); + currentAnimation.done(function() { + currentAnimation = null; + if (!animatorIn) { + animatorIn = prepareInAnimation(); + if (animatorIn) { + currentAnimation = animatorIn.start(); + currentAnimation.done(function() { + currentAnimation = null; + end(); + runner.complete(); + }); + return currentAnimation; + } + } + // in the event that there is no `in` animation + end(); + runner.complete(); + }); + + runner = new $$AnimateRunner({ + end: endFn, + cancel: endFn + }); + + return runner; + + function endFn() { + if (currentAnimation) { + currentAnimation.end(); + } + } + } + }; + + function calculateAnchorStyles(anchor) { + var styles = {}; + + var coords = getDomNode(anchor).getBoundingClientRect(); + + // we iterate directly since safari messes up and doesn't return + // all the keys for the coords object when iterated + forEach(['width','height','top','left'], function(key) { + var value = coords[key]; + switch (key) { + case 'top': + value += bodyNode.scrollTop; + break; + case 'left': + value += bodyNode.scrollLeft; + break; + } + styles[key] = Math.floor(value) + 'px'; + }); + return styles; + } + + function prepareOutAnimation() { + var animator = $animateCss(clone, { + addClass: NG_OUT_ANCHOR_CLASS_NAME, + delay: true, + from: calculateAnchorStyles(outAnchor) + }); + + // read the comment within `prepareRegularAnimation` to understand + // why this check is necessary + return animator.$$willAnimate ? animator : null; + } + + function getClassVal(element) { + return element.attr('class') || ''; + } + + function prepareInAnimation() { + var endingClasses = filterCssClasses(getClassVal(inAnchor)); + var toAdd = getUniqueValues(endingClasses, startingClasses); + var toRemove = getUniqueValues(startingClasses, endingClasses); + + var animator = $animateCss(clone, { + to: calculateAnchorStyles(inAnchor), + addClass: NG_IN_ANCHOR_CLASS_NAME + ' ' + toAdd, + removeClass: NG_OUT_ANCHOR_CLASS_NAME + ' ' + toRemove, + delay: true + }); + + // read the comment within `prepareRegularAnimation` to understand + // why this check is necessary + return animator.$$willAnimate ? animator : null; + } + + function end() { + clone.remove(); + outAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME); + inAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME); + } + } + + function prepareFromToAnchorAnimation(from, to, classes, anchors) { + var fromAnimation = prepareRegularAnimation(from, noop); + var toAnimation = prepareRegularAnimation(to, noop); + + var anchorAnimations = []; + forEach(anchors, function(anchor) { + var outElement = anchor['out']; + var inElement = anchor['in']; + var animator = prepareAnchoredAnimation(classes, outElement, inElement); + if (animator) { + anchorAnimations.push(animator); + } + }); + + // no point in doing anything when there are no elements to animate + if (!fromAnimation && !toAnimation && anchorAnimations.length === 0) return; + + return { + start: function() { + var animationRunners = []; + + if (fromAnimation) { + animationRunners.push(fromAnimation.start()); + } + + if (toAnimation) { + animationRunners.push(toAnimation.start()); + } + + forEach(anchorAnimations, function(animation) { + animationRunners.push(animation.start()); + }); + + var runner = new $$AnimateRunner({ + end: endFn, + cancel: endFn // CSS-driven animations cannot be cancelled, only ended + }); + + $$AnimateRunner.all(animationRunners, function(status) { + runner.complete(status); + }); + + return runner; + + function endFn() { + forEach(animationRunners, function(runner) { + runner.end(); + }); + } + } + }; + } + + function prepareRegularAnimation(animationDetails) { + var element = animationDetails.element; + var options = animationDetails.options || {}; + + if (animationDetails.structural) { + options.event = animationDetails.event; + options.structural = true; + options.applyClassesEarly = true; + + // we special case the leave animation since we want to ensure that + // the element is removed as soon as the animation is over. Otherwise + // a flicker might appear or the element may not be removed at all + if (animationDetails.event === 'leave') { + options.onDone = options.domOperation; + } + } + + // We assign the preparationClasses as the actual animation event since + // the internals of $animateCss will just suffix the event token values + // with `-active` to trigger the animation. + if (options.preparationClasses) { + options.event = concatWithSpace(options.event, options.preparationClasses); + } + + var animator = $animateCss(element, options); + + // the driver lookup code inside of $$animation attempts to spawn a + // driver one by one until a driver returns a.$$willAnimate animator object. + // $animateCss will always return an object, however, it will pass in + // a flag as a hint as to whether an animation was detected or not + return animator.$$willAnimate ? animator : null; + } + }]; +}]; + +// TODO(matsko): use caching here to speed things up for detection +// TODO(matsko): add documentation +// by the time... + +var $$AnimateJsProvider = ['$animateProvider', function($animateProvider) { + this.$get = ['$injector', '$$AnimateRunner', '$$jqLite', + function($injector, $$AnimateRunner, $$jqLite) { + + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + // $animateJs(element, 'enter'); + return function(element, event, classes, options) { + var animationClosed = false; + + // the `classes` argument is optional and if it is not used + // then the classes will be resolved from the element's className + // property as well as options.addClass/options.removeClass. + if (arguments.length === 3 && isObject(classes)) { + options = classes; + classes = null; + } + + options = prepareAnimationOptions(options); + if (!classes) { + classes = element.attr('class') || ''; + if (options.addClass) { + classes += ' ' + options.addClass; + } + if (options.removeClass) { + classes += ' ' + options.removeClass; + } + } + + var classesToAdd = options.addClass; + var classesToRemove = options.removeClass; + + // the lookupAnimations function returns a series of animation objects that are + // matched up with one or more of the CSS classes. These animation objects are + // defined via the module.animation factory function. If nothing is detected then + // we don't return anything which then makes $animation query the next driver. + var animations = lookupAnimations(classes); + var before, after; + if (animations.length) { + var afterFn, beforeFn; + if (event == 'leave') { + beforeFn = 'leave'; + afterFn = 'afterLeave'; // TODO(matsko): get rid of this + } else { + beforeFn = 'before' + event.charAt(0).toUpperCase() + event.substr(1); + afterFn = event; + } + + if (event !== 'enter' && event !== 'move') { + before = packageAnimations(element, event, options, animations, beforeFn); + } + after = packageAnimations(element, event, options, animations, afterFn); + } + + // no matching animations + if (!before && !after) return; + + function applyOptions() { + options.domOperation(); + applyAnimationClasses(element, options); + } + + function close() { + animationClosed = true; + applyOptions(); + applyAnimationStyles(element, options); + } + + var runner; + + return { + $$willAnimate: true, + end: function() { + if (runner) { + runner.end(); + } else { + close(); + runner = new $$AnimateRunner(); + runner.complete(true); + } + return runner; + }, + start: function() { + if (runner) { + return runner; + } + + runner = new $$AnimateRunner(); + var closeActiveAnimations; + var chain = []; + + if (before) { + chain.push(function(fn) { + closeActiveAnimations = before(fn); + }); + } + + if (chain.length) { + chain.push(function(fn) { + applyOptions(); + fn(true); + }); + } else { + applyOptions(); + } + + if (after) { + chain.push(function(fn) { + closeActiveAnimations = after(fn); + }); + } + + runner.setHost({ + end: function() { + endAnimations(); + }, + cancel: function() { + endAnimations(true); + } + }); + + $$AnimateRunner.chain(chain, onComplete); + return runner; + + function onComplete(success) { + close(success); + runner.complete(success); + } + + function endAnimations(cancelled) { + if (!animationClosed) { + (closeActiveAnimations || noop)(cancelled); + onComplete(cancelled); + } + } + } + }; + + function executeAnimationFn(fn, element, event, options, onDone) { + var args; + switch (event) { + case 'animate': + args = [element, options.from, options.to, onDone]; + break; + + case 'setClass': + args = [element, classesToAdd, classesToRemove, onDone]; + break; + + case 'addClass': + args = [element, classesToAdd, onDone]; + break; + + case 'removeClass': + args = [element, classesToRemove, onDone]; + break; + + default: + args = [element, onDone]; + break; + } + + args.push(options); + + var value = fn.apply(fn, args); + if (value) { + if (isFunction(value.start)) { + value = value.start(); + } + + if (value instanceof $$AnimateRunner) { + value.done(onDone); + } else if (isFunction(value)) { + // optional onEnd / onCancel callback + return value; + } + } + + return noop; + } + + function groupEventedAnimations(element, event, options, animations, fnName) { + var operations = []; + forEach(animations, function(ani) { + var animation = ani[fnName]; + if (!animation) return; + + // note that all of these animations will run in parallel + operations.push(function() { + var runner; + var endProgressCb; + + var resolved = false; + var onAnimationComplete = function(rejected) { + if (!resolved) { + resolved = true; + (endProgressCb || noop)(rejected); + runner.complete(!rejected); + } + }; + + runner = new $$AnimateRunner({ + end: function() { + onAnimationComplete(); + }, + cancel: function() { + onAnimationComplete(true); + } + }); + + endProgressCb = executeAnimationFn(animation, element, event, options, function(result) { + var cancelled = result === false; + onAnimationComplete(cancelled); + }); + + return runner; + }); + }); + + return operations; + } + + function packageAnimations(element, event, options, animations, fnName) { + var operations = groupEventedAnimations(element, event, options, animations, fnName); + if (operations.length === 0) { + var a,b; + if (fnName === 'beforeSetClass') { + a = groupEventedAnimations(element, 'removeClass', options, animations, 'beforeRemoveClass'); + b = groupEventedAnimations(element, 'addClass', options, animations, 'beforeAddClass'); + } else if (fnName === 'setClass') { + a = groupEventedAnimations(element, 'removeClass', options, animations, 'removeClass'); + b = groupEventedAnimations(element, 'addClass', options, animations, 'addClass'); + } + + if (a) { + operations = operations.concat(a); + } + if (b) { + operations = operations.concat(b); + } + } + + if (operations.length === 0) return; + + // TODO(matsko): add documentation + return function startAnimation(callback) { + var runners = []; + if (operations.length) { + forEach(operations, function(animateFn) { + runners.push(animateFn()); + }); + } + + runners.length ? $$AnimateRunner.all(runners, callback) : callback(); + + return function endFn(reject) { + forEach(runners, function(runner) { + reject ? runner.cancel() : runner.end(); + }); + }; + }; + } + }; + + function lookupAnimations(classes) { + classes = isArray(classes) ? classes : classes.split(' '); + var matches = [], flagMap = {}; + for (var i=0; i < classes.length; i++) { + var klass = classes[i], + animationFactory = $animateProvider.$$registeredAnimations[klass]; + if (animationFactory && !flagMap[klass]) { + matches.push($injector.get(animationFactory)); + flagMap[klass] = true; + } + } + return matches; + } + }]; +}]; + +var $$AnimateJsDriverProvider = ['$$animationProvider', function($$animationProvider) { + $$animationProvider.drivers.push('$$animateJsDriver'); + this.$get = ['$$animateJs', '$$AnimateRunner', function($$animateJs, $$AnimateRunner) { + return function initDriverFn(animationDetails) { + if (animationDetails.from && animationDetails.to) { + var fromAnimation = prepareAnimation(animationDetails.from); + var toAnimation = prepareAnimation(animationDetails.to); + if (!fromAnimation && !toAnimation) return; + + return { + start: function() { + var animationRunners = []; + + if (fromAnimation) { + animationRunners.push(fromAnimation.start()); + } + + if (toAnimation) { + animationRunners.push(toAnimation.start()); + } + + $$AnimateRunner.all(animationRunners, done); + + var runner = new $$AnimateRunner({ + end: endFnFactory(), + cancel: endFnFactory() + }); + + return runner; + + function endFnFactory() { + return function() { + forEach(animationRunners, function(runner) { + // at this point we cannot cancel animations for groups just yet. 1.5+ + runner.end(); + }); + }; + } + + function done(status) { + runner.complete(status); + } + } + }; + } else { + return prepareAnimation(animationDetails); + } + }; + + function prepareAnimation(animationDetails) { + // TODO(matsko): make sure to check for grouped animations and delegate down to normal animations + var element = animationDetails.element; + var event = animationDetails.event; + var options = animationDetails.options; + var classes = animationDetails.classes; + return $$animateJs(element, event, classes, options); + } + }]; +}]; + +var NG_ANIMATE_ATTR_NAME = 'data-ng-animate'; +var NG_ANIMATE_PIN_DATA = '$ngAnimatePin'; +var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) { + var PRE_DIGEST_STATE = 1; + var RUNNING_STATE = 2; + var ONE_SPACE = ' '; + + var rules = this.rules = { + skip: [], + cancel: [], + join: [] + }; + + function makeTruthyCssClassMap(classString) { + if (!classString) { + return null; + } + + var keys = classString.split(ONE_SPACE); + var map = Object.create(null); + + forEach(keys, function(key) { + map[key] = true; + }); + return map; + } + + function hasMatchingClasses(newClassString, currentClassString) { + if (newClassString && currentClassString) { + var currentClassMap = makeTruthyCssClassMap(currentClassString); + return newClassString.split(ONE_SPACE).some(function(className) { + return currentClassMap[className]; + }); + } + } + + function isAllowed(ruleType, element, currentAnimation, previousAnimation) { + return rules[ruleType].some(function(fn) { + return fn(element, currentAnimation, previousAnimation); + }); + } + + function hasAnimationClasses(animation, and) { + var a = (animation.addClass || '').length > 0; + var b = (animation.removeClass || '').length > 0; + return and ? a && b : a || b; + } + + rules.join.push(function(element, newAnimation, currentAnimation) { + // if the new animation is class-based then we can just tack that on + return !newAnimation.structural && hasAnimationClasses(newAnimation); + }); + + rules.skip.push(function(element, newAnimation, currentAnimation) { + // there is no need to animate anything if no classes are being added and + // there is no structural animation that will be triggered + return !newAnimation.structural && !hasAnimationClasses(newAnimation); + }); + + rules.skip.push(function(element, newAnimation, currentAnimation) { + // why should we trigger a new structural animation if the element will + // be removed from the DOM anyway? + return currentAnimation.event == 'leave' && newAnimation.structural; + }); + + rules.skip.push(function(element, newAnimation, currentAnimation) { + // if there is an ongoing current animation then don't even bother running the class-based animation + return currentAnimation.structural && currentAnimation.state === RUNNING_STATE && !newAnimation.structural; + }); + + rules.cancel.push(function(element, newAnimation, currentAnimation) { + // there can never be two structural animations running at the same time + return currentAnimation.structural && newAnimation.structural; + }); + + rules.cancel.push(function(element, newAnimation, currentAnimation) { + // if the previous animation is already running, but the new animation will + // be triggered, but the new animation is structural + return currentAnimation.state === RUNNING_STATE && newAnimation.structural; + }); + + rules.cancel.push(function(element, newAnimation, currentAnimation) { + var nA = newAnimation.addClass; + var nR = newAnimation.removeClass; + var cA = currentAnimation.addClass; + var cR = currentAnimation.removeClass; + + // early detection to save the global CPU shortage :) + if ((isUndefined(nA) && isUndefined(nR)) || (isUndefined(cA) && isUndefined(cR))) { + return false; + } + + return hasMatchingClasses(nA, cR) || hasMatchingClasses(nR, cA); + }); + + this.$get = ['$$rAF', '$rootScope', '$rootElement', '$document', '$$HashMap', + '$$animation', '$$AnimateRunner', '$templateRequest', '$$jqLite', '$$forceReflow', + function($$rAF, $rootScope, $rootElement, $document, $$HashMap, + $$animation, $$AnimateRunner, $templateRequest, $$jqLite, $$forceReflow) { + + var activeAnimationsLookup = new $$HashMap(); + var disabledElementsLookup = new $$HashMap(); + var animationsEnabled = null; + + function postDigestTaskFactory() { + var postDigestCalled = false; + return function(fn) { + // we only issue a call to postDigest before + // it has first passed. This prevents any callbacks + // from not firing once the animation has completed + // since it will be out of the digest cycle. + if (postDigestCalled) { + fn(); + } else { + $rootScope.$$postDigest(function() { + postDigestCalled = true; + fn(); + }); + } + }; + } + + // Wait until all directive and route-related templates are downloaded and + // compiled. The $templateRequest.totalPendingRequests variable keeps track of + // all of the remote templates being currently downloaded. If there are no + // templates currently downloading then the watcher will still fire anyway. + var deregisterWatch = $rootScope.$watch( + function() { return $templateRequest.totalPendingRequests === 0; }, + function(isEmpty) { + if (!isEmpty) return; + deregisterWatch(); + + // Now that all templates have been downloaded, $animate will wait until + // the post digest queue is empty before enabling animations. By having two + // calls to $postDigest calls we can ensure that the flag is enabled at the + // very end of the post digest queue. Since all of the animations in $animate + // use $postDigest, it's important that the code below executes at the end. + // This basically means that the page is fully downloaded and compiled before + // any animations are triggered. + $rootScope.$$postDigest(function() { + $rootScope.$$postDigest(function() { + // we check for null directly in the event that the application already called + // .enabled() with whatever arguments that it provided it with + if (animationsEnabled === null) { + animationsEnabled = true; + } + }); + }); + } + ); + + var callbackRegistry = {}; + + // remember that the classNameFilter is set during the provider/config + // stage therefore we can optimize here and setup a helper function + var classNameFilter = $animateProvider.classNameFilter(); + var isAnimatableClassName = !classNameFilter + ? function() { return true; } + : function(className) { + return classNameFilter.test(className); + }; + + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + + function normalizeAnimationDetails(element, animation) { + return mergeAnimationDetails(element, animation, {}); + } + + // IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259. + var contains = Node.prototype.contains || function(arg) { + // jshint bitwise: false + return this === arg || !!(this.compareDocumentPosition(arg) & 16); + // jshint bitwise: true + }; + + function findCallbacks(parent, element, event) { + var targetNode = getDomNode(element); + var targetParentNode = getDomNode(parent); + + var matches = []; + var entries = callbackRegistry[event]; + if (entries) { + forEach(entries, function(entry) { + if (contains.call(entry.node, targetNode)) { + matches.push(entry.callback); + } else if (event === 'leave' && contains.call(entry.node, targetParentNode)) { + matches.push(entry.callback); + } + }); + } + + return matches; + } + + return { + on: function(event, container, callback) { + var node = extractElementNode(container); + callbackRegistry[event] = callbackRegistry[event] || []; + callbackRegistry[event].push({ + node: node, + callback: callback + }); + }, + + off: function(event, container, callback) { + var entries = callbackRegistry[event]; + if (!entries) return; + + callbackRegistry[event] = arguments.length === 1 + ? null + : filterFromRegistry(entries, container, callback); + + function filterFromRegistry(list, matchContainer, matchCallback) { + var containerNode = extractElementNode(matchContainer); + return list.filter(function(entry) { + var isMatch = entry.node === containerNode && + (!matchCallback || entry.callback === matchCallback); + return !isMatch; + }); + } + }, + + pin: function(element, parentElement) { + assertArg(isElement(element), 'element', 'not an element'); + assertArg(isElement(parentElement), 'parentElement', 'not an element'); + element.data(NG_ANIMATE_PIN_DATA, parentElement); + }, + + push: function(element, event, options, domOperation) { + options = options || {}; + options.domOperation = domOperation; + return queueAnimation(element, event, options); + }, + + // this method has four signatures: + // () - global getter + // (bool) - global setter + // (element) - element getter + // (element, bool) - element setter + enabled: function(element, bool) { + var argCount = arguments.length; + + if (argCount === 0) { + // () - Global getter + bool = !!animationsEnabled; + } else { + var hasElement = isElement(element); + + if (!hasElement) { + // (bool) - Global setter + bool = animationsEnabled = !!element; + } else { + var node = getDomNode(element); + var recordExists = disabledElementsLookup.get(node); + + if (argCount === 1) { + // (element) - Element getter + bool = !recordExists; + } else { + // (element, bool) - Element setter + disabledElementsLookup.put(node, !bool); + } + } + } + + return bool; + } + }; + + function queueAnimation(element, event, initialOptions) { + // we always make a copy of the options since + // there should never be any side effects on + // the input data when running `$animateCss`. + var options = copy(initialOptions); + + var node, parent; + element = stripCommentsFromElement(element); + if (element) { + node = getDomNode(element); + parent = element.parent(); + } + + options = prepareAnimationOptions(options); + + // we create a fake runner with a working promise. + // These methods will become available after the digest has passed + var runner = new $$AnimateRunner(); + + // this is used to trigger callbacks in postDigest mode + var runInNextPostDigestOrNow = postDigestTaskFactory(); + + if (isArray(options.addClass)) { + options.addClass = options.addClass.join(' '); + } + + if (options.addClass && !isString(options.addClass)) { + options.addClass = null; + } + + if (isArray(options.removeClass)) { + options.removeClass = options.removeClass.join(' '); + } + + if (options.removeClass && !isString(options.removeClass)) { + options.removeClass = null; + } + + if (options.from && !isObject(options.from)) { + options.from = null; + } + + if (options.to && !isObject(options.to)) { + options.to = null; + } + + // there are situations where a directive issues an animation for + // a jqLite wrapper that contains only comment nodes... If this + // happens then there is no way we can perform an animation + if (!node) { + close(); + return runner; + } + + var className = [node.className, options.addClass, options.removeClass].join(' '); + if (!isAnimatableClassName(className)) { + close(); + return runner; + } + + var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0; + + // this is a hard disable of all animations for the application or on + // the element itself, therefore there is no need to continue further + // past this point if not enabled + // Animations are also disabled if the document is currently hidden (page is not visible + // to the user), because browsers slow down or do not flush calls to requestAnimationFrame + var skipAnimations = !animationsEnabled || $document[0].hidden || disabledElementsLookup.get(node); + var existingAnimation = (!skipAnimations && activeAnimationsLookup.get(node)) || {}; + var hasExistingAnimation = !!existingAnimation.state; + + // there is no point in traversing the same collection of parent ancestors if a followup + // animation will be run on the same element that already did all that checking work + if (!skipAnimations && (!hasExistingAnimation || existingAnimation.state != PRE_DIGEST_STATE)) { + skipAnimations = !areAnimationsAllowed(element, parent, event); + } + + if (skipAnimations) { + close(); + return runner; + } + + if (isStructural) { + closeChildAnimations(element); + } + + var newAnimation = { + structural: isStructural, + element: element, + event: event, + addClass: options.addClass, + removeClass: options.removeClass, + close: close, + options: options, + runner: runner + }; + + if (hasExistingAnimation) { + var skipAnimationFlag = isAllowed('skip', element, newAnimation, existingAnimation); + if (skipAnimationFlag) { + if (existingAnimation.state === RUNNING_STATE) { + close(); + return runner; + } else { + mergeAnimationDetails(element, existingAnimation, newAnimation); + return existingAnimation.runner; + } + } + var cancelAnimationFlag = isAllowed('cancel', element, newAnimation, existingAnimation); + if (cancelAnimationFlag) { + if (existingAnimation.state === RUNNING_STATE) { + // this will end the animation right away and it is safe + // to do so since the animation is already running and the + // runner callback code will run in async + existingAnimation.runner.end(); + } else if (existingAnimation.structural) { + // this means that the animation is queued into a digest, but + // hasn't started yet. Therefore it is safe to run the close + // method which will call the runner methods in async. + existingAnimation.close(); + } else { + // this will merge the new animation options into existing animation options + mergeAnimationDetails(element, existingAnimation, newAnimation); + + return existingAnimation.runner; + } + } else { + // a joined animation means that this animation will take over the existing one + // so an example would involve a leave animation taking over an enter. Then when + // the postDigest kicks in the enter will be ignored. + var joinAnimationFlag = isAllowed('join', element, newAnimation, existingAnimation); + if (joinAnimationFlag) { + if (existingAnimation.state === RUNNING_STATE) { + normalizeAnimationDetails(element, newAnimation); + } else { + applyGeneratedPreparationClasses(element, isStructural ? event : null, options); + + event = newAnimation.event = existingAnimation.event; + options = mergeAnimationDetails(element, existingAnimation, newAnimation); + + //we return the same runner since only the option values of this animation will + //be fed into the `existingAnimation`. + return existingAnimation.runner; + } + } + } + } else { + // normalization in this case means that it removes redundant CSS classes that + // already exist (addClass) or do not exist (removeClass) on the element + normalizeAnimationDetails(element, newAnimation); + } + + // when the options are merged and cleaned up we may end up not having to do + // an animation at all, therefore we should check this before issuing a post + // digest callback. Structural animations will always run no matter what. + var isValidAnimation = newAnimation.structural; + if (!isValidAnimation) { + // animate (from/to) can be quickly checked first, otherwise we check if any classes are present + isValidAnimation = (newAnimation.event === 'animate' && Object.keys(newAnimation.options.to || {}).length > 0) + || hasAnimationClasses(newAnimation); + } + + if (!isValidAnimation) { + close(); + clearElementAnimationState(element); + return runner; + } + + // the counter keeps track of cancelled animations + var counter = (existingAnimation.counter || 0) + 1; + newAnimation.counter = counter; + + markElementAnimationState(element, PRE_DIGEST_STATE, newAnimation); + + $rootScope.$$postDigest(function() { + var animationDetails = activeAnimationsLookup.get(node); + var animationCancelled = !animationDetails; + animationDetails = animationDetails || {}; + + // if addClass/removeClass is called before something like enter then the + // registered parent element may not be present. The code below will ensure + // that a final value for parent element is obtained + var parentElement = element.parent() || []; + + // animate/structural/class-based animations all have requirements. Otherwise there + // is no point in performing an animation. The parent node must also be set. + var isValidAnimation = parentElement.length > 0 + && (animationDetails.event === 'animate' + || animationDetails.structural + || hasAnimationClasses(animationDetails)); + + // this means that the previous animation was cancelled + // even if the follow-up animation is the same event + if (animationCancelled || animationDetails.counter !== counter || !isValidAnimation) { + // if another animation did not take over then we need + // to make sure that the domOperation and options are + // handled accordingly + if (animationCancelled) { + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + } + + // if the event changed from something like enter to leave then we do + // it, otherwise if it's the same then the end result will be the same too + if (animationCancelled || (isStructural && animationDetails.event !== event)) { + options.domOperation(); + runner.end(); + } + + // in the event that the element animation was not cancelled or a follow-up animation + // isn't allowed to animate from here then we need to clear the state of the element + // so that any future animations won't read the expired animation data. + if (!isValidAnimation) { + clearElementAnimationState(element); + } + + return; + } + + // this combined multiple class to addClass / removeClass into a setClass event + // so long as a structural event did not take over the animation + event = !animationDetails.structural && hasAnimationClasses(animationDetails, true) + ? 'setClass' + : animationDetails.event; + + markElementAnimationState(element, RUNNING_STATE); + var realRunner = $$animation(element, event, animationDetails.options); + + realRunner.done(function(status) { + close(!status); + var animationDetails = activeAnimationsLookup.get(node); + if (animationDetails && animationDetails.counter === counter) { + clearElementAnimationState(getDomNode(element)); + } + notifyProgress(runner, event, 'close', {}); + }); + + // this will update the runner's flow-control events based on + // the `realRunner` object. + runner.setHost(realRunner); + notifyProgress(runner, event, 'start', {}); + }); + + return runner; + + function notifyProgress(runner, event, phase, data) { + runInNextPostDigestOrNow(function() { + var callbacks = findCallbacks(parent, element, event); + if (callbacks.length) { + // do not optimize this call here to RAF because + // we don't know how heavy the callback code here will + // be and if this code is buffered then this can + // lead to a performance regression. + $$rAF(function() { + forEach(callbacks, function(callback) { + callback(element, phase, data); + }); + }); + } + }); + runner.progress(event, phase, data); + } + + function close(reject) { // jshint ignore:line + clearGeneratedClasses(element, options); + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + options.domOperation(); + runner.complete(!reject); + } + } + + function closeChildAnimations(element) { + var node = getDomNode(element); + var children = node.querySelectorAll('[' + NG_ANIMATE_ATTR_NAME + ']'); + forEach(children, function(child) { + var state = parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME)); + var animationDetails = activeAnimationsLookup.get(child); + if (animationDetails) { + switch (state) { + case RUNNING_STATE: + animationDetails.runner.end(); + /* falls through */ + case PRE_DIGEST_STATE: + activeAnimationsLookup.remove(child); + break; + } + } + }); + } + + function clearElementAnimationState(element) { + var node = getDomNode(element); + node.removeAttribute(NG_ANIMATE_ATTR_NAME); + activeAnimationsLookup.remove(node); + } + + function isMatchingElement(nodeOrElmA, nodeOrElmB) { + return getDomNode(nodeOrElmA) === getDomNode(nodeOrElmB); + } + + /** + * This fn returns false if any of the following is true: + * a) animations on any parent element are disabled, and animations on the element aren't explicitly allowed + * b) a parent element has an ongoing structural animation, and animateChildren is false + * c) the element is not a child of the body + * d) the element is not a child of the $rootElement + */ + function areAnimationsAllowed(element, parentElement, event) { + var bodyElement = jqLite($document[0].body); + var bodyElementDetected = isMatchingElement(element, bodyElement) || element[0].nodeName === 'HTML'; + var rootElementDetected = isMatchingElement(element, $rootElement); + var parentAnimationDetected = false; + var animateChildren; + var elementDisabled = disabledElementsLookup.get(getDomNode(element)); + + var parentHost = element.data(NG_ANIMATE_PIN_DATA); + if (parentHost) { + parentElement = parentHost; + } + + while (parentElement && parentElement.length) { + if (!rootElementDetected) { + // angular doesn't want to attempt to animate elements outside of the application + // therefore we need to ensure that the rootElement is an ancestor of the current element + rootElementDetected = isMatchingElement(parentElement, $rootElement); + } + + var parentNode = parentElement[0]; + if (parentNode.nodeType !== ELEMENT_NODE) { + // no point in inspecting the #document element + break; + } + + var details = activeAnimationsLookup.get(parentNode) || {}; + // either an enter, leave or move animation will commence + // therefore we can't allow any animations to take place + // but if a parent animation is class-based then that's ok + if (!parentAnimationDetected) { + var parentElementDisabled = disabledElementsLookup.get(parentNode); + + if (parentElementDisabled === true && elementDisabled !== false) { + // disable animations if the user hasn't explicitly enabled animations on the + // current element + elementDisabled = true; + // element is disabled via parent element, no need to check anything else + break; + } else if (parentElementDisabled === false) { + elementDisabled = false; + } + parentAnimationDetected = details.structural; + } + + if (isUndefined(animateChildren) || animateChildren === true) { + var value = parentElement.data(NG_ANIMATE_CHILDREN_DATA); + if (isDefined(value)) { + animateChildren = value; + } + } + + // there is no need to continue traversing at this point + if (parentAnimationDetected && animateChildren === false) break; + + if (!bodyElementDetected) { + // we also need to ensure that the element is or will be a part of the body element + // otherwise it is pointless to even issue an animation to be rendered + bodyElementDetected = isMatchingElement(parentElement, bodyElement); + } + + if (bodyElementDetected && rootElementDetected) { + // If both body and root have been found, any other checks are pointless, + // as no animation data should live outside the application + break; + } + + if (!rootElementDetected) { + // If no rootElement is detected, check if the parentElement is pinned to another element + parentHost = parentElement.data(NG_ANIMATE_PIN_DATA); + if (parentHost) { + // The pin target element becomes the next parent element + parentElement = parentHost; + continue; + } + } + + parentElement = parentElement.parent(); + } + + var allowAnimation = (!parentAnimationDetected || animateChildren) && elementDisabled !== true; + return allowAnimation && rootElementDetected && bodyElementDetected; + } + + function markElementAnimationState(element, state, details) { + details = details || {}; + details.state = state; + + var node = getDomNode(element); + node.setAttribute(NG_ANIMATE_ATTR_NAME, state); + + var oldValue = activeAnimationsLookup.get(node); + var newValue = oldValue + ? extend(oldValue, details) + : details; + activeAnimationsLookup.put(node, newValue); + } + }]; +}]; + +var $$AnimationProvider = ['$animateProvider', function($animateProvider) { + var NG_ANIMATE_REF_ATTR = 'ng-animate-ref'; + + var drivers = this.drivers = []; + + var RUNNER_STORAGE_KEY = '$$animationRunner'; + + function setRunner(element, runner) { + element.data(RUNNER_STORAGE_KEY, runner); + } + + function removeRunner(element) { + element.removeData(RUNNER_STORAGE_KEY); + } + + function getRunner(element) { + return element.data(RUNNER_STORAGE_KEY); + } + + this.$get = ['$$jqLite', '$rootScope', '$injector', '$$AnimateRunner', '$$HashMap', '$$rAFScheduler', + function($$jqLite, $rootScope, $injector, $$AnimateRunner, $$HashMap, $$rAFScheduler) { + + var animationQueue = []; + var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); + + function sortAnimations(animations) { + var tree = { children: [] }; + var i, lookup = new $$HashMap(); + + // this is done first beforehand so that the hashmap + // is filled with a list of the elements that will be animated + for (i = 0; i < animations.length; i++) { + var animation = animations[i]; + lookup.put(animation.domNode, animations[i] = { + domNode: animation.domNode, + fn: animation.fn, + children: [] + }); + } + + for (i = 0; i < animations.length; i++) { + processNode(animations[i]); + } + + return flatten(tree); + + function processNode(entry) { + if (entry.processed) return entry; + entry.processed = true; + + var elementNode = entry.domNode; + var parentNode = elementNode.parentNode; + lookup.put(elementNode, entry); + + var parentEntry; + while (parentNode) { + parentEntry = lookup.get(parentNode); + if (parentEntry) { + if (!parentEntry.processed) { + parentEntry = processNode(parentEntry); + } + break; + } + parentNode = parentNode.parentNode; + } + + (parentEntry || tree).children.push(entry); + return entry; + } + + function flatten(tree) { + var result = []; + var queue = []; + var i; + + for (i = 0; i < tree.children.length; i++) { + queue.push(tree.children[i]); + } + + var remainingLevelEntries = queue.length; + var nextLevelEntries = 0; + var row = []; + + for (i = 0; i < queue.length; i++) { + var entry = queue[i]; + if (remainingLevelEntries <= 0) { + remainingLevelEntries = nextLevelEntries; + nextLevelEntries = 0; + result.push(row); + row = []; + } + row.push(entry.fn); + entry.children.forEach(function(childEntry) { + nextLevelEntries++; + queue.push(childEntry); + }); + remainingLevelEntries--; + } + + if (row.length) { + result.push(row); + } + + return result; + } + } + + // TODO(matsko): document the signature in a better way + return function(element, event, options) { + options = prepareAnimationOptions(options); + var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0; + + // there is no animation at the current moment, however + // these runner methods will get later updated with the + // methods leading into the driver's end/cancel methods + // for now they just stop the animation from starting + var runner = new $$AnimateRunner({ + end: function() { close(); }, + cancel: function() { close(true); } + }); + + if (!drivers.length) { + close(); + return runner; + } + + setRunner(element, runner); + + var classes = mergeClasses(element.attr('class'), mergeClasses(options.addClass, options.removeClass)); + var tempClasses = options.tempClasses; + if (tempClasses) { + classes += ' ' + tempClasses; + options.tempClasses = null; + } + + var prepareClassName; + if (isStructural) { + prepareClassName = 'ng-' + event + PREPARE_CLASS_SUFFIX; + $$jqLite.addClass(element, prepareClassName); + } + + animationQueue.push({ + // this data is used by the postDigest code and passed into + // the driver step function + element: element, + classes: classes, + event: event, + structural: isStructural, + options: options, + beforeStart: beforeStart, + close: close + }); + + element.on('$destroy', handleDestroyedElement); + + // we only want there to be one function called within the post digest + // block. This way we can group animations for all the animations that + // were apart of the same postDigest flush call. + if (animationQueue.length > 1) return runner; + + $rootScope.$$postDigest(function() { + var animations = []; + forEach(animationQueue, function(entry) { + // the element was destroyed early on which removed the runner + // form its storage. This means we can't animate this element + // at all and it already has been closed due to destruction. + if (getRunner(entry.element)) { + animations.push(entry); + } else { + entry.close(); + } + }); + + // now any future animations will be in another postDigest + animationQueue.length = 0; + + var groupedAnimations = groupAnimations(animations); + var toBeSortedAnimations = []; + + forEach(groupedAnimations, function(animationEntry) { + toBeSortedAnimations.push({ + domNode: getDomNode(animationEntry.from ? animationEntry.from.element : animationEntry.element), + fn: function triggerAnimationStart() { + // it's important that we apply the `ng-animate` CSS class and the + // temporary classes before we do any driver invoking since these + // CSS classes may be required for proper CSS detection. + animationEntry.beforeStart(); + + var startAnimationFn, closeFn = animationEntry.close; + + // in the event that the element was removed before the digest runs or + // during the RAF sequencing then we should not trigger the animation. + var targetElement = animationEntry.anchors + ? (animationEntry.from.element || animationEntry.to.element) + : animationEntry.element; + + if (getRunner(targetElement)) { + var operation = invokeFirstDriver(animationEntry); + if (operation) { + startAnimationFn = operation.start; + } + } + + if (!startAnimationFn) { + closeFn(); + } else { + var animationRunner = startAnimationFn(); + animationRunner.done(function(status) { + closeFn(!status); + }); + updateAnimationRunners(animationEntry, animationRunner); + } + } + }); + }); + + // we need to sort each of the animations in order of parent to child + // relationships. This ensures that the child classes are applied at the + // right time. + $$rAFScheduler(sortAnimations(toBeSortedAnimations)); + }); + + return runner; + + // TODO(matsko): change to reference nodes + function getAnchorNodes(node) { + var SELECTOR = '[' + NG_ANIMATE_REF_ATTR + ']'; + var items = node.hasAttribute(NG_ANIMATE_REF_ATTR) + ? [node] + : node.querySelectorAll(SELECTOR); + var anchors = []; + forEach(items, function(node) { + var attr = node.getAttribute(NG_ANIMATE_REF_ATTR); + if (attr && attr.length) { + anchors.push(node); + } + }); + return anchors; + } + + function groupAnimations(animations) { + var preparedAnimations = []; + var refLookup = {}; + forEach(animations, function(animation, index) { + var element = animation.element; + var node = getDomNode(element); + var event = animation.event; + var enterOrMove = ['enter', 'move'].indexOf(event) >= 0; + var anchorNodes = animation.structural ? getAnchorNodes(node) : []; + + if (anchorNodes.length) { + var direction = enterOrMove ? 'to' : 'from'; + + forEach(anchorNodes, function(anchor) { + var key = anchor.getAttribute(NG_ANIMATE_REF_ATTR); + refLookup[key] = refLookup[key] || {}; + refLookup[key][direction] = { + animationID: index, + element: jqLite(anchor) + }; + }); + } else { + preparedAnimations.push(animation); + } + }); + + var usedIndicesLookup = {}; + var anchorGroups = {}; + forEach(refLookup, function(operations, key) { + var from = operations.from; + var to = operations.to; + + if (!from || !to) { + // only one of these is set therefore we can't have an + // anchor animation since all three pieces are required + var index = from ? from.animationID : to.animationID; + var indexKey = index.toString(); + if (!usedIndicesLookup[indexKey]) { + usedIndicesLookup[indexKey] = true; + preparedAnimations.push(animations[index]); + } + return; + } + + var fromAnimation = animations[from.animationID]; + var toAnimation = animations[to.animationID]; + var lookupKey = from.animationID.toString(); + if (!anchorGroups[lookupKey]) { + var group = anchorGroups[lookupKey] = { + structural: true, + beforeStart: function() { + fromAnimation.beforeStart(); + toAnimation.beforeStart(); + }, + close: function() { + fromAnimation.close(); + toAnimation.close(); + }, + classes: cssClassesIntersection(fromAnimation.classes, toAnimation.classes), + from: fromAnimation, + to: toAnimation, + anchors: [] // TODO(matsko): change to reference nodes + }; + + // the anchor animations require that the from and to elements both have at least + // one shared CSS class which effectively marries the two elements together to use + // the same animation driver and to properly sequence the anchor animation. + if (group.classes.length) { + preparedAnimations.push(group); + } else { + preparedAnimations.push(fromAnimation); + preparedAnimations.push(toAnimation); + } + } + + anchorGroups[lookupKey].anchors.push({ + 'out': from.element, 'in': to.element + }); + }); + + return preparedAnimations; + } + + function cssClassesIntersection(a,b) { + a = a.split(' '); + b = b.split(' '); + var matches = []; + + for (var i = 0; i < a.length; i++) { + var aa = a[i]; + if (aa.substring(0,3) === 'ng-') continue; + + for (var j = 0; j < b.length; j++) { + if (aa === b[j]) { + matches.push(aa); + break; + } + } + } + + return matches.join(' '); + } + + function invokeFirstDriver(animationDetails) { + // we loop in reverse order since the more general drivers (like CSS and JS) + // may attempt more elements, but custom drivers are more particular + for (var i = drivers.length - 1; i >= 0; i--) { + var driverName = drivers[i]; + if (!$injector.has(driverName)) continue; // TODO(matsko): remove this check + + var factory = $injector.get(driverName); + var driver = factory(animationDetails); + if (driver) { + return driver; + } + } + } + + function beforeStart() { + element.addClass(NG_ANIMATE_CLASSNAME); + if (tempClasses) { + $$jqLite.addClass(element, tempClasses); + } + if (prepareClassName) { + $$jqLite.removeClass(element, prepareClassName); + prepareClassName = null; + } + } + + function updateAnimationRunners(animation, newRunner) { + if (animation.from && animation.to) { + update(animation.from.element); + update(animation.to.element); + } else { + update(animation.element); + } + + function update(element) { + getRunner(element).setHost(newRunner); + } + } + + function handleDestroyedElement() { + var runner = getRunner(element); + if (runner && (event !== 'leave' || !options.$$domOperationFired)) { + runner.end(); + } + } + + function close(rejected) { // jshint ignore:line + element.off('$destroy', handleDestroyedElement); + removeRunner(element); + + applyAnimationClasses(element, options); + applyAnimationStyles(element, options); + options.domOperation(); + + if (tempClasses) { + $$jqLite.removeClass(element, tempClasses); + } + + element.removeClass(NG_ANIMATE_CLASSNAME); + runner.complete(!rejected); + } + }; + }]; +}]; + +/** + * @ngdoc directive + * @name ngAnimateSwap + * @restrict A + * @scope + * + * @description + * + * ngAnimateSwap is a animation-oriented directive that allows for the container to + * be removed and entered in whenever the associated expression changes. A + * common usecase for this directive is a rotating banner component which + * contains one image being present at a time. When the active image changes + * then the old image will perform a `leave` animation and the new element + * will be inserted via an `enter` animation. + * + * @example + * + * + *
    + *
    + * {{ number }} + *
    + *
    + *
    + * + * angular.module('ngAnimateSwapExample', ['ngAnimate']) + * .controller('AppCtrl', ['$scope', '$interval', function($scope, $interval) { + * $scope.number = 0; + * $interval(function() { + * $scope.number++; + * }, 1000); + * + * var colors = ['red','blue','green','yellow','orange']; + * $scope.colorClass = function(number) { + * return colors[number % colors.length]; + * }; + * }]); + * + * + * .container { + * height:250px; + * width:250px; + * position:relative; + * overflow:hidden; + * border:2px solid black; + * } + * .container .cell { + * font-size:150px; + * text-align:center; + * line-height:250px; + * position:absolute; + * top:0; + * left:0; + * right:0; + * border-bottom:2px solid black; + * } + * .swap-animation.ng-enter, .swap-animation.ng-leave { + * transition:0.5s linear all; + * } + * .swap-animation.ng-enter { + * top:-250px; + * } + * .swap-animation.ng-enter-active { + * top:0px; + * } + * .swap-animation.ng-leave { + * top:0px; + * } + * .swap-animation.ng-leave-active { + * top:250px; + * } + * .red { background:red; } + * .green { background:green; } + * .blue { background:blue; } + * .yellow { background:yellow; } + * .orange { background:orange; } + * + *
    + */ +var ngAnimateSwapDirective = ['$animate', '$rootScope', function($animate, $rootScope) { + return { + restrict: 'A', + transclude: 'element', + terminal: true, + priority: 600, // we use 600 here to ensure that the directive is caught before others + link: function(scope, $element, attrs, ctrl, $transclude) { + var previousElement, previousScope; + scope.$watchCollection(attrs.ngAnimateSwap || attrs['for'], function(value) { + if (previousElement) { + $animate.leave(previousElement); + } + if (previousScope) { + previousScope.$destroy(); + previousScope = null; + } + if (value || value === 0) { + previousScope = scope.$new(); + $transclude(previousScope, function(element) { + previousElement = element; + $animate.enter(element, null, $element); + }); + } + }); + } + }; +}]; + +/* global angularAnimateModule: true, + + ngAnimateSwapDirective, + $$AnimateAsyncRunFactory, + $$rAFSchedulerFactory, + $$AnimateChildrenDirective, + $$AnimateQueueProvider, + $$AnimationProvider, + $AnimateCssProvider, + $$AnimateCssDriverProvider, + $$AnimateJsProvider, + $$AnimateJsDriverProvider, +*/ + +/** + * @ngdoc module + * @name ngAnimate + * @description + * + * The `ngAnimate` module provides support for CSS-based animations (keyframes and transitions) as well as JavaScript-based animations via + * callback hooks. Animations are not enabled by default, however, by including `ngAnimate` the animation hooks are enabled for an Angular app. + * + *
    + * + * # Usage + * Simply put, there are two ways to make use of animations when ngAnimate is used: by using **CSS** and **JavaScript**. The former works purely based + * using CSS (by using matching CSS selectors/styles) and the latter triggers animations that are registered via `module.animation()`. For + * both CSS and JS animations the sole requirement is to have a matching `CSS class` that exists both in the registered animation and within + * the HTML element that the animation will be triggered on. + * + * ## Directive Support + * The following directives are "animation aware": + * + * | Directive | Supported Animations | + * |----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------| + * | {@link ng.directive:ngRepeat#animations ngRepeat} | enter, leave and move | + * | {@link ngRoute.directive:ngView#animations ngView} | enter and leave | + * | {@link ng.directive:ngInclude#animations ngInclude} | enter and leave | + * | {@link ng.directive:ngSwitch#animations ngSwitch} | enter and leave | + * | {@link ng.directive:ngIf#animations ngIf} | enter and leave | + * | {@link ng.directive:ngClass#animations ngClass} | add and remove (the CSS class(es) present) | + * | {@link ng.directive:ngShow#animations ngShow} & {@link ng.directive:ngHide#animations ngHide} | add and remove (the ng-hide class value) | + * | {@link ng.directive:form#animation-hooks form} & {@link ng.directive:ngModel#animation-hooks ngModel} | add and remove (dirty, pristine, valid, invalid & all other validations) | + * | {@link module:ngMessages#animations ngMessages} | add and remove (ng-active & ng-inactive) | + * | {@link module:ngMessages#animations ngMessage} | enter and leave | + * + * (More information can be found by visiting each the documentation associated with each directive.) + * + * ## CSS-based Animations + * + * CSS-based animations with ngAnimate are unique since they require no JavaScript code at all. By using a CSS class that we reference between our HTML + * and CSS code we can create an animation that will be picked up by Angular when an the underlying directive performs an operation. + * + * The example below shows how an `enter` animation can be made possible on an element using `ng-if`: + * + * ```html + *
    + * Fade me in out + *
    + * + * + * ``` + * + * Notice the CSS class **fade**? We can now create the CSS transition code that references this class: + * + * ```css + * /* The starting CSS styles for the enter animation */ + * .fade.ng-enter { + * transition:0.5s linear all; + * opacity:0; + * } + * + * /* The finishing CSS styles for the enter animation */ + * .fade.ng-enter.ng-enter-active { + * opacity:1; + * } + * ``` + * + * The key thing to remember here is that, depending on the animation event (which each of the directives above trigger depending on what's going on) two + * generated CSS classes will be applied to the element; in the example above we have `.ng-enter` and `.ng-enter-active`. For CSS transitions, the transition + * code **must** be defined within the starting CSS class (in this case `.ng-enter`). The destination class is what the transition will animate towards. + * + * If for example we wanted to create animations for `leave` and `move` (ngRepeat triggers move) then we can do so using the same CSS naming conventions: + * + * ```css + * /* now the element will fade out before it is removed from the DOM */ + * .fade.ng-leave { + * transition:0.5s linear all; + * opacity:1; + * } + * .fade.ng-leave.ng-leave-active { + * opacity:0; + * } + * ``` + * + * We can also make use of **CSS Keyframes** by referencing the keyframe animation within the starting CSS class: + * + * ```css + * /* there is no need to define anything inside of the destination + * CSS class since the keyframe will take charge of the animation */ + * .fade.ng-leave { + * animation: my_fade_animation 0.5s linear; + * -webkit-animation: my_fade_animation 0.5s linear; + * } + * + * @keyframes my_fade_animation { + * from { opacity:1; } + * to { opacity:0; } + * } + * + * @-webkit-keyframes my_fade_animation { + * from { opacity:1; } + * to { opacity:0; } + * } + * ``` + * + * Feel free also mix transitions and keyframes together as well as any other CSS classes on the same element. + * + * ### CSS Class-based Animations + * + * Class-based animations (animations that are triggered via `ngClass`, `ngShow`, `ngHide` and some other directives) have a slightly different + * naming convention. Class-based animations are basic enough that a standard transition or keyframe can be referenced on the class being added + * and removed. + * + * For example if we wanted to do a CSS animation for `ngHide` then we place an animation on the `.ng-hide` CSS class: + * + * ```html + *
    + * Show and hide me + *
    + * + * + * + * ``` + * + * All that is going on here with ngShow/ngHide behind the scenes is the `.ng-hide` class is added/removed (when the hidden state is valid). Since + * ngShow and ngHide are animation aware then we can match up a transition and ngAnimate handles the rest. + * + * In addition the addition and removal of the CSS class, ngAnimate also provides two helper methods that we can use to further decorate the animation + * with CSS styles. + * + * ```html + *
    + * Highlight this box + *
    + * + * + * + * ``` + * + * We can also make use of CSS keyframes by placing them within the CSS classes. + * + * + * ### CSS Staggering Animations + * A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a + * curtain-like effect. The ngAnimate module (versions >=1.2) supports staggering animations and the stagger effect can be + * performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for + * the animation. The style property expected within the stagger class can either be a **transition-delay** or an + * **animation-delay** property (or both if your animation contains both transitions and keyframe animations). + * + * ```css + * .my-animation.ng-enter { + * /* standard transition code */ + * transition: 1s linear all; + * opacity:0; + * } + * .my-animation.ng-enter-stagger { + * /* this will have a 100ms delay between each successive leave animation */ + * transition-delay: 0.1s; + * + * /* As of 1.4.4, this must always be set: it signals ngAnimate + * to not accidentally inherit a delay property from another CSS class */ + * transition-duration: 0s; + * } + * .my-animation.ng-enter.ng-enter-active { + * /* standard transition styles */ + * opacity:1; + * } + * ``` + * + * Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations + * on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this + * are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation + * will also be reset if one or more animation frames have passed since the multiple calls to `$animate` were fired. + * + * The following code will issue the **ng-leave-stagger** event on the element provided: + * + * ```js + * var kids = parent.children(); + * + * $animate.leave(kids[0]); //stagger index=0 + * $animate.leave(kids[1]); //stagger index=1 + * $animate.leave(kids[2]); //stagger index=2 + * $animate.leave(kids[3]); //stagger index=3 + * $animate.leave(kids[4]); //stagger index=4 + * + * window.requestAnimationFrame(function() { + * //stagger has reset itself + * $animate.leave(kids[5]); //stagger index=0 + * $animate.leave(kids[6]); //stagger index=1 + * + * $scope.$digest(); + * }); + * ``` + * + * Stagger animations are currently only supported within CSS-defined animations. + * + * ### The `ng-animate` CSS class + * + * When ngAnimate is animating an element it will apply the `ng-animate` CSS class to the element for the duration of the animation. + * This is a temporary CSS class and it will be removed once the animation is over (for both JavaScript and CSS-based animations). + * + * Therefore, animations can be applied to an element using this temporary class directly via CSS. + * + * ```css + * .zipper.ng-animate { + * transition:0.5s linear all; + * } + * .zipper.ng-enter { + * opacity:0; + * } + * .zipper.ng-enter.ng-enter-active { + * opacity:1; + * } + * .zipper.ng-leave { + * opacity:1; + * } + * .zipper.ng-leave.ng-leave-active { + * opacity:0; + * } + * ``` + * + * (Note that the `ng-animate` CSS class is reserved and it cannot be applied on an element directly since ngAnimate will always remove + * the CSS class once an animation has completed.) + * + * + * ### The `ng-[event]-prepare` class + * + * This is a special class that can be used to prevent unwanted flickering / flash of content before + * the actual animation starts. The class is added as soon as an animation is initialized, but removed + * before the actual animation starts (after waiting for a $digest). + * It is also only added for *structural* animations (`enter`, `move`, and `leave`). + * + * In practice, flickering can appear when nesting elements with structural animations such as `ngIf` + * into elements that have class-based animations such as `ngClass`. + * + * ```html + *
    + *
    + *
    + *
    + *
    + * ``` + * + * It is possible that during the `enter` animation, the `.message` div will be briefly visible before it starts animating. + * In that case, you can add styles to the CSS that make sure the element stays hidden before the animation starts: + * + * ```css + * .message.ng-enter-prepare { + * opacity: 0; + * } + * + * ``` + * + * ## JavaScript-based Animations + * + * ngAnimate also allows for animations to be consumed by JavaScript code. The approach is similar to CSS-based animations (where there is a shared + * CSS class that is referenced in our HTML code) but in addition we need to register the JavaScript animation on the module. By making use of the + * `module.animation()` module function we can register the animation. + * + * Let's see an example of a enter/leave animation using `ngRepeat`: + * + * ```html + *
    + * {{ item }} + *
    + * ``` + * + * See the **slide** CSS class? Let's use that class to define an animation that we'll structure in our module code by using `module.animation`: + * + * ```js + * myModule.animation('.slide', [function() { + * return { + * // make note that other events (like addClass/removeClass) + * // have different function input parameters + * enter: function(element, doneFn) { + * jQuery(element).fadeIn(1000, doneFn); + * + * // remember to call doneFn so that angular + * // knows that the animation has concluded + * }, + * + * move: function(element, doneFn) { + * jQuery(element).fadeIn(1000, doneFn); + * }, + * + * leave: function(element, doneFn) { + * jQuery(element).fadeOut(1000, doneFn); + * } + * } + * }]); + * ``` + * + * The nice thing about JS-based animations is that we can inject other services and make use of advanced animation libraries such as + * greensock.js and velocity.js. + * + * If our animation code class-based (meaning that something like `ngClass`, `ngHide` and `ngShow` triggers it) then we can still define + * our animations inside of the same registered animation, however, the function input arguments are a bit different: + * + * ```html + *
    + * this box is moody + *
    + * + * + * + * ``` + * + * ```js + * myModule.animation('.colorful', [function() { + * return { + * addClass: function(element, className, doneFn) { + * // do some cool animation and call the doneFn + * }, + * removeClass: function(element, className, doneFn) { + * // do some cool animation and call the doneFn + * }, + * setClass: function(element, addedClass, removedClass, doneFn) { + * // do some cool animation and call the doneFn + * } + * } + * }]); + * ``` + * + * ## CSS + JS Animations Together + * + * AngularJS 1.4 and higher has taken steps to make the amalgamation of CSS and JS animations more flexible. However, unlike earlier versions of Angular, + * defining CSS and JS animations to work off of the same CSS class will not work anymore. Therefore the example below will only result in **JS animations taking + * charge of the animation**: + * + * ```html + *
    + * Slide in and out + *
    + * ``` + * + * ```js + * myModule.animation('.slide', [function() { + * return { + * enter: function(element, doneFn) { + * jQuery(element).slideIn(1000, doneFn); + * } + * } + * }]); + * ``` + * + * ```css + * .slide.ng-enter { + * transition:0.5s linear all; + * transform:translateY(-100px); + * } + * .slide.ng-enter.ng-enter-active { + * transform:translateY(0); + * } + * ``` + * + * Does this mean that CSS and JS animations cannot be used together? Do JS-based animations always have higher priority? We can make up for the + * lack of CSS animations by using the `$animateCss` service to trigger our own tweaked-out, CSS-based animations directly from + * our own JS-based animation code: + * + * ```js + * myModule.animation('.slide', ['$animateCss', function($animateCss) { + * return { + * enter: function(element) { +* // this will trigger `.slide.ng-enter` and `.slide.ng-enter-active`. + * return $animateCss(element, { + * event: 'enter', + * structural: true + * }); + * } + * } + * }]); + * ``` + * + * The nice thing here is that we can save bandwidth by sticking to our CSS-based animation code and we don't need to rely on a 3rd-party animation framework. + * + * The `$animateCss` service is very powerful since we can feed in all kinds of extra properties that will be evaluated and fed into a CSS transition or + * keyframe animation. For example if we wanted to animate the height of an element while adding and removing classes then we can do so by providing that + * data into `$animateCss` directly: + * + * ```js + * myModule.animation('.slide', ['$animateCss', function($animateCss) { + * return { + * enter: function(element) { + * return $animateCss(element, { + * event: 'enter', + * structural: true, + * addClass: 'maroon-setting', + * from: { height:0 }, + * to: { height: 200 } + * }); + * } + * } + * }]); + * ``` + * + * Now we can fill in the rest via our transition CSS code: + * + * ```css + * /* the transition tells ngAnimate to make the animation happen */ + * .slide.ng-enter { transition:0.5s linear all; } + * + * /* this extra CSS class will be absorbed into the transition + * since the $animateCss code is adding the class */ + * .maroon-setting { background:red; } + * ``` + * + * And `$animateCss` will figure out the rest. Just make sure to have the `done()` callback fire the `doneFn` function to signal when the animation is over. + * + * To learn more about what's possible be sure to visit the {@link ngAnimate.$animateCss $animateCss service}. + * + * ## Animation Anchoring (via `ng-animate-ref`) + * + * ngAnimate in AngularJS 1.4 comes packed with the ability to cross-animate elements between + * structural areas of an application (like views) by pairing up elements using an attribute + * called `ng-animate-ref`. + * + * Let's say for example we have two views that are managed by `ng-view` and we want to show + * that there is a relationship between two components situated in within these views. By using the + * `ng-animate-ref` attribute we can identify that the two components are paired together and we + * can then attach an animation, which is triggered when the view changes. + * + * Say for example we have the following template code: + * + * ```html + * + *
    + *
    + * + * + * + * + * + * + * + * + * ``` + * + * Now, when the view changes (once the link is clicked), ngAnimate will examine the + * HTML contents to see if there is a match reference between any components in the view + * that is leaving and the view that is entering. It will scan both the view which is being + * removed (leave) and inserted (enter) to see if there are any paired DOM elements that + * contain a matching ref value. + * + * The two images match since they share the same ref value. ngAnimate will now create a + * transport element (which is a clone of the first image element) and it will then attempt + * to animate to the position of the second image element in the next view. For the animation to + * work a special CSS class called `ng-anchor` will be added to the transported element. + * + * We can now attach a transition onto the `.banner.ng-anchor` CSS class and then + * ngAnimate will handle the entire transition for us as well as the addition and removal of + * any changes of CSS classes between the elements: + * + * ```css + * .banner.ng-anchor { + * /* this animation will last for 1 second since there are + * two phases to the animation (an `in` and an `out` phase) */ + * transition:0.5s linear all; + * } + * ``` + * + * We also **must** include animations for the views that are being entered and removed + * (otherwise anchoring wouldn't be possible since the new view would be inserted right away). + * + * ```css + * .view-animation.ng-enter, .view-animation.ng-leave { + * transition:0.5s linear all; + * position:fixed; + * left:0; + * top:0; + * width:100%; + * } + * .view-animation.ng-enter { + * transform:translateX(100%); + * } + * .view-animation.ng-leave, + * .view-animation.ng-enter.ng-enter-active { + * transform:translateX(0%); + * } + * .view-animation.ng-leave.ng-leave-active { + * transform:translateX(-100%); + * } + * ``` + * + * Now we can jump back to the anchor animation. When the animation happens, there are two stages that occur: + * an `out` and an `in` stage. The `out` stage happens first and that is when the element is animated away + * from its origin. Once that animation is over then the `in` stage occurs which animates the + * element to its destination. The reason why there are two animations is to give enough time + * for the enter animation on the new element to be ready. + * + * The example above sets up a transition for both the in and out phases, but we can also target the out or + * in phases directly via `ng-anchor-out` and `ng-anchor-in`. + * + * ```css + * .banner.ng-anchor-out { + * transition: 0.5s linear all; + * + * /* the scale will be applied during the out animation, + * but will be animated away when the in animation runs */ + * transform: scale(1.2); + * } + * + * .banner.ng-anchor-in { + * transition: 1s linear all; + * } + * ``` + * + * + * + * + * ### Anchoring Demo + * + + + Home +
    +
    +
    +
    +
    + + angular.module('anchoringExample', ['ngAnimate', 'ngRoute']) + .config(['$routeProvider', function($routeProvider) { + $routeProvider.when('/', { + templateUrl: 'home.html', + controller: 'HomeController as home' + }); + $routeProvider.when('/profile/:id', { + templateUrl: 'profile.html', + controller: 'ProfileController as profile' + }); + }]) + .run(['$rootScope', function($rootScope) { + $rootScope.records = [ + { id:1, title: "Miss Beulah Roob" }, + { id:2, title: "Trent Morissette" }, + { id:3, title: "Miss Ava Pouros" }, + { id:4, title: "Rod Pouros" }, + { id:5, title: "Abdul Rice" }, + { id:6, title: "Laurie Rutherford Sr." }, + { id:7, title: "Nakia McLaughlin" }, + { id:8, title: "Jordon Blanda DVM" }, + { id:9, title: "Rhoda Hand" }, + { id:10, title: "Alexandrea Sauer" } + ]; + }]) + .controller('HomeController', [function() { + //empty + }]) + .controller('ProfileController', ['$rootScope', '$routeParams', function($rootScope, $routeParams) { + var index = parseInt($routeParams.id, 10); + var record = $rootScope.records[index - 1]; + + this.title = record.title; + this.id = record.id; + }]); + + +

    Welcome to the home page

    +

    Please click on an element

    + + {{ record.title }} + +
    + +
    + {{ profile.title }} +
    +
    + + .record { + display:block; + font-size:20px; + } + .profile { + background:black; + color:white; + font-size:100px; + } + .view-container { + position:relative; + } + .view-container > .view.ng-animate { + position:absolute; + top:0; + left:0; + width:100%; + min-height:500px; + } + .view.ng-enter, .view.ng-leave, + .record.ng-anchor { + transition:0.5s linear all; + } + .view.ng-enter { + transform:translateX(100%); + } + .view.ng-enter.ng-enter-active, .view.ng-leave { + transform:translateX(0%); + } + .view.ng-leave.ng-leave-active { + transform:translateX(-100%); + } + .record.ng-anchor-out { + background:red; + } + +
    + * + * ### How is the element transported? + * + * When an anchor animation occurs, ngAnimate will clone the starting element and position it exactly where the starting + * element is located on screen via absolute positioning. The cloned element will be placed inside of the root element + * of the application (where ng-app was defined) and all of the CSS classes of the starting element will be applied. The + * element will then animate into the `out` and `in` animations and will eventually reach the coordinates and match + * the dimensions of the destination element. During the entire animation a CSS class of `.ng-animate-shim` will be applied + * to both the starting and destination elements in order to hide them from being visible (the CSS styling for the class + * is: `visibility:hidden`). Once the anchor reaches its destination then it will be removed and the destination element + * will become visible since the shim class will be removed. + * + * ### How is the morphing handled? + * + * CSS Anchoring relies on transitions and keyframes and the internal code is intelligent enough to figure out + * what CSS classes differ between the starting element and the destination element. These different CSS classes + * will be added/removed on the anchor element and a transition will be applied (the transition that is provided + * in the anchor class). Long story short, ngAnimate will figure out what classes to add and remove which will + * make the transition of the element as smooth and automatic as possible. Be sure to use simple CSS classes that + * do not rely on DOM nesting structure so that the anchor element appears the same as the starting element (since + * the cloned element is placed inside of root element which is likely close to the body element). + * + * Note that if the root element is on the `` element then the cloned node will be placed inside of body. + * + * + * ## Using $animate in your directive code + * + * So far we've explored how to feed in animations into an Angular application, but how do we trigger animations within our own directives in our application? + * By injecting the `$animate` service into our directive code, we can trigger structural and class-based hooks which can then be consumed by animations. Let's + * imagine we have a greeting box that shows and hides itself when the data changes + * + * ```html + * Hi there + * ``` + * + * ```js + * ngModule.directive('greetingBox', ['$animate', function($animate) { + * return function(scope, element, attrs) { + * attrs.$observe('active', function(value) { + * value ? $animate.addClass(element, 'on') : $animate.removeClass(element, 'on'); + * }); + * }); + * }]); + * ``` + * + * Now the `on` CSS class is added and removed on the greeting box component. Now if we add a CSS class on top of the greeting box element + * in our HTML code then we can trigger a CSS or JS animation to happen. + * + * ```css + * /* normally we would create a CSS class to reference on the element */ + * greeting-box.on { transition:0.5s linear all; background:green; color:white; } + * ``` + * + * The `$animate` service contains a variety of other methods like `enter`, `leave`, `animate` and `setClass`. To learn more about what's + * possible be sure to visit the {@link ng.$animate $animate service API page}. + * + * + * ### Preventing Collisions With Third Party Libraries + * + * Some third-party frameworks place animation duration defaults across many element or className + * selectors in order to make their code small and reuseable. This can lead to issues with ngAnimate, which + * is expecting actual animations on these elements and has to wait for their completion. + * + * You can prevent this unwanted behavior by using a prefix on all your animation classes: + * + * ```css + * /* prefixed with animate- */ + * .animate-fade-add.animate-fade-add-active { + * transition:1s linear all; + * opacity:0; + * } + * ``` + * + * You then configure `$animate` to enforce this prefix: + * + * ```js + * $animateProvider.classNameFilter(/animate-/); + * ``` + * + * This also may provide your application with a speed boost since only specific elements containing CSS class prefix + * will be evaluated for animation when any DOM changes occur in the application. + * + * ## Callbacks and Promises + * + * When `$animate` is called it returns a promise that can be used to capture when the animation has ended. Therefore if we were to trigger + * an animation (within our directive code) then we can continue performing directive and scope related activities after the animation has + * ended by chaining onto the returned promise that animation method returns. + * + * ```js + * // somewhere within the depths of the directive + * $animate.enter(element, parent).then(function() { + * //the animation has completed + * }); + * ``` + * + * (Note that earlier versions of Angular prior to v1.4 required the promise code to be wrapped using `$scope.$apply(...)`. This is not the case + * anymore.) + * + * In addition to the animation promise, we can also make use of animation-related callbacks within our directives and controller code by registering + * an event listener using the `$animate` service. Let's say for example that an animation was triggered on our view + * routing controller to hook into that: + * + * ```js + * ngModule.controller('HomePageController', ['$animate', function($animate) { + * $animate.on('enter', ngViewElement, function(element) { + * // the animation for this route has completed + * }]); + * }]) + * ``` + * + * (Note that you will need to trigger a digest within the callback to get angular to notice any scope-related changes.) + */ + +/** + * @ngdoc service + * @name $animate + * @kind object + * + * @description + * The ngAnimate `$animate` service documentation is the same for the core `$animate` service. + * + * Click here {@link ng.$animate to learn more about animations with `$animate`}. + */ +angular.module('ngAnimate', []) + .directive('ngAnimateSwap', ngAnimateSwapDirective) + + .directive('ngAnimateChildren', $$AnimateChildrenDirective) + .factory('$$rAFScheduler', $$rAFSchedulerFactory) + + .provider('$$animateQueue', $$AnimateQueueProvider) + .provider('$$animation', $$AnimationProvider) + + .provider('$animateCss', $AnimateCssProvider) + .provider('$$animateCssDriver', $$AnimateCssDriverProvider) + + .provider('$$animateJs', $$AnimateJsProvider) + .provider('$$animateJsDriver', $$AnimateJsDriverProvider); + + +})(window, window.angular); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.min.js new file mode 100644 index 0000000..8e8e41d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-animate.min.js @@ -0,0 +1,56 @@ +/* + AngularJS v1.5.0 + (c) 2010-2016 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(D,r,Va){'use strict';function ya(a,b,c){if(!a)throw Ka("areq",b||"?",c||"required");return a}function za(a,b){if(!a&&!b)return"";if(!a)return b;if(!b)return a;ba(a)&&(a=a.join(" "));ba(b)&&(b=b.join(" "));return a+" "+b}function La(a){var b={};a&&(a.to||a.from)&&(b.to=a.to,b.from=a.from);return b}function X(a,b,c){var d="";a=ba(a)?a:a&&R(a)&&a.length?a.split(/\s+/):[];s(a,function(a,g){a&&0=a&&(a=e,e=0,b.push(t),t=[]);t.push(g.fn);g.children.forEach(function(a){e++; +c.push(a)});a--}t.length&&b.push(t);return b}(c)}var M=[],r=U(a);return function(u,A,v){function z(a){a=a.hasAttribute("ng-animate-ref")?[a]:a.querySelectorAll("[ng-animate-ref]");var b=[];s(a,function(a){var c=a.getAttribute("ng-animate-ref");c&&c.length&&b.push(a)});return b}function K(a){var b=[],c={};s(a,function(a,f){var d=G(a.element),h=0<=["enter","move"].indexOf(a.event),d=a.structural?z(d):[];if(d.length){var e=h?"to":"from";s(d,function(a){var b=a.getAttribute("ng-animate-ref");c[b]=c[b]|| +{};c[b][e]={animationID:f,element:I(a)}})}else b.push(a)});var d={},h={};s(c,function(c,e){var l=c.from,t=c.to;if(l&&t){var g=a[l.animationID],E=a[t.animationID],k=l.animationID.toString();if(!h[k]){var z=h[k]={structural:!0,beforeStart:function(){g.beforeStart();E.beforeStart()},close:function(){g.close();E.close()},classes:J(g.classes,E.classes),from:g,to:E,anchors:[]};z.classes.length?b.push(z):(b.push(g),b.push(E))}h[k].anchors.push({out:l.element,"in":t.element})}else l=l?l.animationID:t.animationID, +t=l.toString(),d[t]||(d[t]=!0,b.push(a[l]))});return b}function J(a,b){a=a.split(" ");b=b.split(" ");for(var c=[],d=0;d=P&&b>=O&&(wa=!0,q())}function L(){function b(){if(!A){t(!1);s(m, +function(a){l.style[a[0]]=a[1]});z(a,f);e.addClass(a,ca);if(p.recalculateTimingStyles){ja=l.className+" "+da;ga=r(l,ja);F=v(l,ja,ga);$=F.maxDelay;n=Math.max($,0);O=F.maxDuration;if(0===O){q();return}p.hasTransitions=0B.expectedEndTime)?H.cancel(B.timer):g.push(q)}L&&(k=H(c,k,!1),g[0]={timer:k,expectedEndTime:d},g.push(q),a.data("$$animateCss",g));if(ea.length)a.on(ea.join(" "),E);f.to&&(f.cleanupStyles&&Ga(x,l,Object.keys(f.to)),Ba(a, +f))}}function c(){var b=a.data("$$animateCss");if(b){for(var d=1;dARIA](http://www.w3.org/TR/wai-aria/) + * attributes that convey state or semantic information about the application for users + * of assistive technologies, such as screen readers. + * + *
    + * + * ## Usage + * + * For ngAria to do its magic, simply include the module `ngAria` as a dependency. The following + * directives are supported: + * `ngModel`, `ngChecked`, `ngRequired`, `ngValue`, `ngDisabled`, `ngShow`, `ngHide`, `ngClick`, + * `ngDblClick`, and `ngMessages`. + * + * Below is a more detailed breakdown of the attributes handled by ngAria: + * + * | Directive | Supported Attributes | + * |---------------------------------------------|----------------------------------------------------------------------------------------| + * | {@link ng.directive:ngModel ngModel} | aria-checked, aria-valuemin, aria-valuemax, aria-valuenow, aria-invalid, aria-required, input roles | + * | {@link ng.directive:ngDisabled ngDisabled} | aria-disabled | + * | {@link ng.directive:ngRequired ngRequired} | aria-required | + * | {@link ng.directive:ngChecked ngChecked} | aria-checked | + * | {@link ng.directive:ngValue ngValue} | aria-checked | + * | {@link ng.directive:ngShow ngShow} | aria-hidden | + * | {@link ng.directive:ngHide ngHide} | aria-hidden | + * | {@link ng.directive:ngDblclick ngDblclick} | tabindex | + * | {@link module:ngMessages ngMessages} | aria-live | + * | {@link ng.directive:ngClick ngClick} | tabindex, keypress event, button role | + * + * Find out more information about each directive by reading the + * {@link guide/accessibility ngAria Developer Guide}. + * + * ##Example + * Using ngDisabled with ngAria: + * ```html + * + * ``` + * Becomes: + * ```html + * + * ``` + * + * ##Disabling Attributes + * It's possible to disable individual attributes added by ngAria with the + * {@link ngAria.$ariaProvider#config config} method. For more details, see the + * {@link guide/accessibility Developer Guide}. + */ + /* global -ngAriaModule */ +var ngAriaModule = angular.module('ngAria', ['ng']). + provider('$aria', $AriaProvider); + +/** +* Internal Utilities +*/ +var nodeBlackList = ['BUTTON', 'A', 'INPUT', 'TEXTAREA', 'SELECT', 'DETAILS', 'SUMMARY']; + +var isNodeOneOf = function(elem, nodeTypeArray) { + if (nodeTypeArray.indexOf(elem[0].nodeName) !== -1) { + return true; + } +}; +/** + * @ngdoc provider + * @name $ariaProvider + * + * @description + * + * Used for configuring the ARIA attributes injected and managed by ngAria. + * + * ```js + * angular.module('myApp', ['ngAria'], function config($ariaProvider) { + * $ariaProvider.config({ + * ariaValue: true, + * tabindex: false + * }); + * }); + *``` + * + * ## Dependencies + * Requires the {@link ngAria} module to be installed. + * + */ +function $AriaProvider() { + var config = { + ariaHidden: true, + ariaChecked: true, + ariaDisabled: true, + ariaRequired: true, + ariaInvalid: true, + ariaValue: true, + tabindex: true, + bindKeypress: true, + bindRoleForClick: true + }; + + /** + * @ngdoc method + * @name $ariaProvider#config + * + * @param {object} config object to enable/disable specific ARIA attributes + * + * - **ariaHidden** – `{boolean}` – Enables/disables aria-hidden tags + * - **ariaChecked** – `{boolean}` – Enables/disables aria-checked tags + * - **ariaDisabled** – `{boolean}` – Enables/disables aria-disabled tags + * - **ariaRequired** – `{boolean}` – Enables/disables aria-required tags + * - **ariaInvalid** – `{boolean}` – Enables/disables aria-invalid tags + * - **ariaValue** – `{boolean}` – Enables/disables aria-valuemin, aria-valuemax and aria-valuenow tags + * - **tabindex** – `{boolean}` – Enables/disables tabindex tags + * - **bindKeypress** – `{boolean}` – Enables/disables keypress event binding on `div` and + * `li` elements with ng-click + * - **bindRoleForClick** – `{boolean}` – Adds role=button to non-interactive elements like `div` + * using ng-click, making them more accessible to users of assistive technologies + * + * @description + * Enables/disables various ARIA attributes + */ + this.config = function(newConfig) { + config = angular.extend(config, newConfig); + }; + + function watchExpr(attrName, ariaAttr, nodeBlackList, negate) { + return function(scope, elem, attr) { + var ariaCamelName = attr.$normalize(ariaAttr); + if (config[ariaCamelName] && !isNodeOneOf(elem, nodeBlackList) && !attr[ariaCamelName]) { + scope.$watch(attr[attrName], function(boolVal) { + // ensure boolean value + boolVal = negate ? !boolVal : !!boolVal; + elem.attr(ariaAttr, boolVal); + }); + } + }; + } + /** + * @ngdoc service + * @name $aria + * + * @description + * @priority 200 + * + * The $aria service contains helper methods for applying common + * [ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives. + * + * ngAria injects common accessibility attributes that tell assistive technologies when HTML + * elements are enabled, selected, hidden, and more. To see how this is performed with ngAria, + * let's review a code snippet from ngAria itself: + * + *```js + * ngAriaModule.directive('ngDisabled', ['$aria', function($aria) { + * return $aria.$$watchExpr('ngDisabled', 'aria-disabled', nodeBlackList, false); + * }]) + *``` + * Shown above, the ngAria module creates a directive with the same signature as the + * traditional `ng-disabled` directive. But this ngAria version is dedicated to + * solely managing accessibility attributes on custom elements. The internal `$aria` service is + * used to watch the boolean attribute `ngDisabled`. If it has not been explicitly set by the + * developer, `aria-disabled` is injected as an attribute with its value synchronized to the + * value in `ngDisabled`. + * + * Because ngAria hooks into the `ng-disabled` directive, developers do not have to do + * anything to enable this feature. The `aria-disabled` attribute is automatically managed + * simply as a silent side-effect of using `ng-disabled` with the ngAria module. + * + * The full list of directives that interface with ngAria: + * * **ngModel** + * * **ngChecked** + * * **ngRequired** + * * **ngDisabled** + * * **ngValue** + * * **ngShow** + * * **ngHide** + * * **ngClick** + * * **ngDblclick** + * * **ngMessages** + * + * Read the {@link guide/accessibility ngAria Developer Guide} for a thorough explanation of each + * directive. + * + * + * ## Dependencies + * Requires the {@link ngAria} module to be installed. + */ + this.$get = function() { + return { + config: function(key) { + return config[key]; + }, + $$watchExpr: watchExpr + }; + }; +} + + +ngAriaModule.directive('ngShow', ['$aria', function($aria) { + return $aria.$$watchExpr('ngShow', 'aria-hidden', [], true); +}]) +.directive('ngHide', ['$aria', function($aria) { + return $aria.$$watchExpr('ngHide', 'aria-hidden', [], false); +}]) +.directive('ngValue', ['$aria', function($aria) { + return $aria.$$watchExpr('ngValue', 'aria-checked', nodeBlackList, false); +}]) +.directive('ngChecked', ['$aria', function($aria) { + return $aria.$$watchExpr('ngChecked', 'aria-checked', nodeBlackList, false); +}]) +.directive('ngRequired', ['$aria', function($aria) { + return $aria.$$watchExpr('ngRequired', 'aria-required', nodeBlackList, false); +}]) +.directive('ngModel', ['$aria', function($aria) { + + function shouldAttachAttr(attr, normalizedAttr, elem, allowBlacklistEls) { + return $aria.config(normalizedAttr) && !elem.attr(attr) && (allowBlacklistEls || !isNodeOneOf(elem, nodeBlackList)); + } + + function shouldAttachRole(role, elem) { + // if element does not have role attribute + // AND element type is equal to role (if custom element has a type equaling shape) <-- remove? + // AND element is not INPUT + return !elem.attr('role') && (elem.attr('type') === role) && (elem[0].nodeName !== 'INPUT'); + } + + function getShape(attr, elem) { + var type = attr.type, + role = attr.role; + + return ((type || role) === 'checkbox' || role === 'menuitemcheckbox') ? 'checkbox' : + ((type || role) === 'radio' || role === 'menuitemradio') ? 'radio' : + (type === 'range' || role === 'progressbar' || role === 'slider') ? 'range' : ''; + } + + return { + restrict: 'A', + require: 'ngModel', + priority: 200, //Make sure watches are fired after any other directives that affect the ngModel value + compile: function(elem, attr) { + var shape = getShape(attr, elem); + + return { + pre: function(scope, elem, attr, ngModel) { + if (shape === 'checkbox') { + //Use the input[checkbox] $isEmpty implementation for elements with checkbox roles + ngModel.$isEmpty = function(value) { + return value === false; + }; + } + }, + post: function(scope, elem, attr, ngModel) { + var needsTabIndex = shouldAttachAttr('tabindex', 'tabindex', elem, false); + + function ngAriaWatchModelValue() { + return ngModel.$modelValue; + } + + function getRadioReaction(newVal) { + var boolVal = (attr.value == ngModel.$viewValue); + elem.attr('aria-checked', boolVal); + } + + function getCheckboxReaction() { + elem.attr('aria-checked', !ngModel.$isEmpty(ngModel.$viewValue)); + } + + switch (shape) { + case 'radio': + case 'checkbox': + if (shouldAttachRole(shape, elem)) { + elem.attr('role', shape); + } + if (shouldAttachAttr('aria-checked', 'ariaChecked', elem, false)) { + scope.$watch(ngAriaWatchModelValue, shape === 'radio' ? + getRadioReaction : getCheckboxReaction); + } + if (needsTabIndex) { + elem.attr('tabindex', 0); + } + break; + case 'range': + if (shouldAttachRole(shape, elem)) { + elem.attr('role', 'slider'); + } + if ($aria.config('ariaValue')) { + var needsAriaValuemin = !elem.attr('aria-valuemin') && + (attr.hasOwnProperty('min') || attr.hasOwnProperty('ngMin')); + var needsAriaValuemax = !elem.attr('aria-valuemax') && + (attr.hasOwnProperty('max') || attr.hasOwnProperty('ngMax')); + var needsAriaValuenow = !elem.attr('aria-valuenow'); + + if (needsAriaValuemin) { + attr.$observe('min', function ngAriaValueMinReaction(newVal) { + elem.attr('aria-valuemin', newVal); + }); + } + if (needsAriaValuemax) { + attr.$observe('max', function ngAriaValueMinReaction(newVal) { + elem.attr('aria-valuemax', newVal); + }); + } + if (needsAriaValuenow) { + scope.$watch(ngAriaWatchModelValue, function ngAriaValueNowReaction(newVal) { + elem.attr('aria-valuenow', newVal); + }); + } + } + if (needsTabIndex) { + elem.attr('tabindex', 0); + } + break; + } + + if (!attr.hasOwnProperty('ngRequired') && ngModel.$validators.required + && shouldAttachAttr('aria-required', 'ariaRequired', elem, false)) { + // ngModel.$error.required is undefined on custom controls + attr.$observe('required', function() { + elem.attr('aria-required', !!attr['required']); + }); + } + + if (shouldAttachAttr('aria-invalid', 'ariaInvalid', elem, true)) { + scope.$watch(function ngAriaInvalidWatch() { + return ngModel.$invalid; + }, function ngAriaInvalidReaction(newVal) { + elem.attr('aria-invalid', !!newVal); + }); + } + } + }; + } + }; +}]) +.directive('ngDisabled', ['$aria', function($aria) { + return $aria.$$watchExpr('ngDisabled', 'aria-disabled', nodeBlackList, false); +}]) +.directive('ngMessages', function() { + return { + restrict: 'A', + require: '?ngMessages', + link: function(scope, elem, attr, ngMessages) { + if (!elem.attr('aria-live')) { + elem.attr('aria-live', 'assertive'); + } + } + }; +}) +.directive('ngClick',['$aria', '$parse', function($aria, $parse) { + return { + restrict: 'A', + compile: function(elem, attr) { + var fn = $parse(attr.ngClick, /* interceptorFn */ null, /* expensiveChecks */ true); + return function(scope, elem, attr) { + + if (!isNodeOneOf(elem, nodeBlackList)) { + + if ($aria.config('bindRoleForClick') && !elem.attr('role')) { + elem.attr('role', 'button'); + } + + if ($aria.config('tabindex') && !elem.attr('tabindex')) { + elem.attr('tabindex', 0); + } + + if ($aria.config('bindKeypress') && !attr.ngKeypress) { + elem.on('keypress', function(event) { + var keyCode = event.which || event.keyCode; + if (keyCode === 32 || keyCode === 13) { + scope.$apply(callback); + } + + function callback() { + fn(scope, { $event: event }); + } + }); + } + } + }; + } + }; +}]) +.directive('ngDblclick', ['$aria', function($aria) { + return function(scope, elem, attr) { + if ($aria.config('tabindex') && !elem.attr('tabindex') && !isNodeOneOf(elem, nodeBlackList)) { + elem.attr('tabindex', 0); + } + }; +}]); + + +})(window, window.angular); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.min.js new file mode 100644 index 0000000..cf0fd74 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.min.js @@ -0,0 +1,14 @@ +/* + AngularJS v1.5.0 + (c) 2010-2016 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(s,q,t){'use strict';var f="BUTTON A INPUT TEXTAREA SELECT DETAILS SUMMARY".split(" "),l=function(a,c){if(-1!==c.indexOf(a[0].nodeName))return!0};q.module("ngAria",["ng"]).provider("$aria",function(){function a(a,h,p,n){return function(d,e,b){var g=b.$normalize(h);!c[g]||l(e,p)||b[g]||d.$watch(b[a],function(b){b=n?!b:!!b;e.attr(h,b)})}}var c={ariaHidden:!0,ariaChecked:!0,ariaDisabled:!0,ariaRequired:!0,ariaInvalid:!0,ariaValue:!0,tabindex:!0,bindKeypress:!0,bindRoleForClick:!0};this.config= +function(a){c=q.extend(c,a)};this.$get=function(){return{config:function(a){return c[a]},$$watchExpr:a}}}).directive("ngShow",["$aria",function(a){return a.$$watchExpr("ngShow","aria-hidden",[],!0)}]).directive("ngHide",["$aria",function(a){return a.$$watchExpr("ngHide","aria-hidden",[],!1)}]).directive("ngValue",["$aria",function(a){return a.$$watchExpr("ngValue","aria-checked",f,!1)}]).directive("ngChecked",["$aria",function(a){return a.$$watchExpr("ngChecked","aria-checked",f,!1)}]).directive("ngRequired", +["$aria",function(a){return a.$$watchExpr("ngRequired","aria-required",f,!1)}]).directive("ngModel",["$aria",function(a){function c(c,n,d,e){return a.config(n)&&!d.attr(c)&&(e||!l(d,f))}function m(a,c){return!c.attr("role")&&c.attr("type")===a&&"INPUT"!==c[0].nodeName}function h(a,c){var d=a.type,e=a.role;return"checkbox"===(d||e)||"menuitemcheckbox"===e?"checkbox":"radio"===(d||e)||"menuitemradio"===e?"radio":"range"===d||"progressbar"===e||"slider"===e?"range":""}return{restrict:"A",require:"ngModel", +priority:200,compile:function(f,n){var d=h(n,f);return{pre:function(a,b,c,k){"checkbox"===d&&(k.$isEmpty=function(a){return!1===a})},post:function(e,b,g,k){function f(){return k.$modelValue}function h(a){b.attr("aria-checked",g.value==k.$viewValue)}function n(){b.attr("aria-checked",!k.$isEmpty(k.$viewValue))}var l=c("tabindex","tabindex",b,!1);switch(d){case "radio":case "checkbox":m(d,b)&&b.attr("role",d);c("aria-checked","ariaChecked",b,!1)&&e.$watch(f,"radio"===d?h:n);l&&b.attr("tabindex",0); +break;case "range":m(d,b)&&b.attr("role","slider");if(a.config("ariaValue")){var p=!b.attr("aria-valuemin")&&(g.hasOwnProperty("min")||g.hasOwnProperty("ngMin")),q=!b.attr("aria-valuemax")&&(g.hasOwnProperty("max")||g.hasOwnProperty("ngMax")),r=!b.attr("aria-valuenow");p&&g.$observe("min",function(a){b.attr("aria-valuemin",a)});q&&g.$observe("max",function(a){b.attr("aria-valuemax",a)});r&&e.$watch(f,function(a){b.attr("aria-valuenow",a)})}l&&b.attr("tabindex",0)}!g.hasOwnProperty("ngRequired")&& +k.$validators.required&&c("aria-required","ariaRequired",b,!1)&&g.$observe("required",function(){b.attr("aria-required",!!g.required)});c("aria-invalid","ariaInvalid",b,!0)&&e.$watch(function(){return k.$invalid},function(a){b.attr("aria-invalid",!!a)})}}}}}]).directive("ngDisabled",["$aria",function(a){return a.$$watchExpr("ngDisabled","aria-disabled",f,!1)}]).directive("ngMessages",function(){return{restrict:"A",require:"?ngMessages",link:function(a,c,f,h){c.attr("aria-live")||c.attr("aria-live", +"assertive")}}}).directive("ngClick",["$aria","$parse",function(a,c){return{restrict:"A",compile:function(m,h){var p=c(h.ngClick,null,!0);return function(c,d,e){if(!l(d,f)&&(a.config("bindRoleForClick")&&!d.attr("role")&&d.attr("role","button"),a.config("tabindex")&&!d.attr("tabindex")&&d.attr("tabindex",0),a.config("bindKeypress")&&!e.ngKeypress))d.on("keypress",function(a){function d(){p(c,{$event:a})}var e=a.which||a.keyCode;32!==e&&13!==e||c.$apply(d)})}}}}]).directive("ngDblclick",["$aria",function(a){return function(c, +m,h){!a.config("tabindex")||m.attr("tabindex")||l(m,f)||m.attr("tabindex",0)}}])})(window,window.angular); +//# sourceMappingURL=angular-aria.min.js.map diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.min.js.map b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.min.js.map new file mode 100644 index 0000000..b1db15b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-aria.min.js.map @@ -0,0 +1,8 @@ +{ +"version":3, +"file":"angular-aria.min.js", +"lineCount":13, +"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CA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AJAuB,CAAApB,OAAA,CAAa,UAAb,CAIA,EAJ6B,CAAAhB,CAAAa,KAAA,CAAU,UAAV,CAI7B,EAHFb,CAAAa,KAAA,CAAU,UAAV,CAAsB,CAAtB,CAGE,CAAAuB,CAAApB,OAAA,CAAa,cAAb,CAAA,EAAiC+D,CAAAlE,CAAAkE,WAVvC,EAWI/E,CAAAgF,GAAA,CAAQ,UAAR,CAAoB,QAAQ,CAACC,CAAD,CAAQ,CAMlCC,QAASA,EAAQ,EAAG,CAClBL,CAAA,CAAGjE,CAAH,CAAU,CAAEuE,OAAQF,CAAV,CAAV,CADkB,CALpB,IAAIG,EAAUH,CAAAI,MAAVD,EAAyBH,CAAAG,QACb,GAAhB,GAAIA,CAAJ,EAAkC,EAAlC,GAAsBA,CAAtB,EACExE,CAAA0E,OAAA,CAAaJ,CAAb,CAHgC,CAApC,CAb6B,CAFP,CAFzB,CADwD,CAA5C,CAtJrB,CAAA/C,UAAA,CAwLW,YAxLX,CAwLyB,CAAC,OAAD,CAAU,QAAQ,CAACC,CAAD,CAAQ,CACjD,MAAO,SAAQ,CAACxB,CAAD;AAAQZ,CAAR,CAAca,CAAd,CAAoB,CAC7B,CAAAuB,CAAApB,OAAA,CAAa,UAAb,CAAJ,EAAiChB,CAAAa,KAAA,CAAU,UAAV,CAAjC,EAA2Dd,CAAA,CAAYC,CAAZ,CAAkBF,CAAlB,CAA3D,EACEE,CAAAa,KAAA,CAAU,UAAV,CAAsB,CAAtB,CAF+B,CADc,CAA1B,CAxLzB,CAvMsC,CAArC,CAAD,CAwYGlB,MAxYH,CAwYWA,MAAAC,QAxYX;", +"sources":["angular-aria.js"], +"names":["window","angular","undefined","nodeBlackList","isNodeOneOf","elem","nodeTypeArray","indexOf","nodeName","module","provider","ngAriaModule","$AriaProvider","watchExpr","attrName","ariaAttr","negate","scope","attr","ariaCamelName","$normalize","config","$watch","boolVal","ariaHidden","ariaChecked","ariaDisabled","ariaRequired","ariaInvalid","ariaValue","tabindex","bindKeypress","bindRoleForClick","this.config","newConfig","extend","$get","this.$get","key","$$watchExpr","directive","$aria","shouldAttachAttr","normalizedAttr","allowBlacklistEls","shouldAttachRole","role","getShape","type","restrict","require","priority","compile","shape","pre","ngModel","$isEmpty","ngModel.$isEmpty","value","post","ngAriaWatchModelValue","$modelValue","getRadioReaction","newVal","$viewValue","getCheckboxReaction","needsTabIndex","needsAriaValuemin","hasOwnProperty","needsAriaValuemax","needsAriaValuenow","$observe","ngAriaValueMinReaction","ngAriaValueNowReaction","$validators","required","ngAriaInvalidWatch","$invalid","ngAriaInvalidReaction","link","ngMessages","$parse","fn","ngClick","ngKeypress","on","event","callback","$event","keyCode","which","$apply"] +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.js new file mode 100644 index 0000000..2157ef0 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.js @@ -0,0 +1,322 @@ +/** + * @license AngularJS v1.5.0 + * (c) 2010-2016 Google, Inc. http://angularjs.org + * License: MIT + */ +(function(window, angular, undefined) {'use strict'; + +/** + * @ngdoc module + * @name ngCookies + * @description + * + * # ngCookies + * + * The `ngCookies` module provides a convenient wrapper for reading and writing browser cookies. + * + * + *
    + * + * See {@link ngCookies.$cookies `$cookies`} for usage. + */ + + +angular.module('ngCookies', ['ng']). + /** + * @ngdoc provider + * @name $cookiesProvider + * @description + * Use `$cookiesProvider` to change the default behavior of the {@link ngCookies.$cookies $cookies} service. + * */ + provider('$cookies', [function $CookiesProvider() { + /** + * @ngdoc property + * @name $cookiesProvider#defaults + * @description + * + * Object containing default options to pass when setting cookies. + * + * The object may have following properties: + * + * - **path** - `{string}` - The cookie will be available only for this path and its + * sub-paths. By default, this is the URL that appears in your `` tag. + * - **domain** - `{string}` - The cookie will be available only for this domain and + * its sub-domains. For security reasons the user agent will not accept the cookie + * if the current domain is not a sub-domain of this domain or equal to it. + * - **expires** - `{string|Date}` - String of the form "Wdy, DD Mon YYYY HH:MM:SS GMT" + * or a Date object indicating the exact date/time this cookie will expire. + * - **secure** - `{boolean}` - If `true`, then the cookie will only be available through a + * secured connection. + * + * Note: By default, the address that appears in your `` tag will be used as the path. + * This is important so that cookies will be visible for all routes when html5mode is enabled. + * + **/ + var defaults = this.defaults = {}; + + function calcOptions(options) { + return options ? angular.extend({}, defaults, options) : defaults; + } + + /** + * @ngdoc service + * @name $cookies + * + * @description + * Provides read/write access to browser's cookies. + * + *
    + * Up until Angular 1.3, `$cookies` exposed properties that represented the + * current browser cookie values. In version 1.4, this behavior has changed, and + * `$cookies` now provides a standard api of getters, setters etc. + *
    + * + * Requires the {@link ngCookies `ngCookies`} module to be installed. + * + * @example + * + * ```js + * angular.module('cookiesExample', ['ngCookies']) + * .controller('ExampleController', ['$cookies', function($cookies) { + * // Retrieving a cookie + * var favoriteCookie = $cookies.get('myFavorite'); + * // Setting a cookie + * $cookies.put('myFavorite', 'oatmeal'); + * }]); + * ``` + */ + this.$get = ['$$cookieReader', '$$cookieWriter', function($$cookieReader, $$cookieWriter) { + return { + /** + * @ngdoc method + * @name $cookies#get + * + * @description + * Returns the value of given cookie key + * + * @param {string} key Id to use for lookup. + * @returns {string} Raw cookie value. + */ + get: function(key) { + return $$cookieReader()[key]; + }, + + /** + * @ngdoc method + * @name $cookies#getObject + * + * @description + * Returns the deserialized value of given cookie key + * + * @param {string} key Id to use for lookup. + * @returns {Object} Deserialized cookie value. + */ + getObject: function(key) { + var value = this.get(key); + return value ? angular.fromJson(value) : value; + }, + + /** + * @ngdoc method + * @name $cookies#getAll + * + * @description + * Returns a key value object with all the cookies + * + * @returns {Object} All cookies + */ + getAll: function() { + return $$cookieReader(); + }, + + /** + * @ngdoc method + * @name $cookies#put + * + * @description + * Sets a value for given cookie key + * + * @param {string} key Id for the `value`. + * @param {string} value Raw value to be stored. + * @param {Object=} options Options object. + * See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults} + */ + put: function(key, value, options) { + $$cookieWriter(key, value, calcOptions(options)); + }, + + /** + * @ngdoc method + * @name $cookies#putObject + * + * @description + * Serializes and sets a value for given cookie key + * + * @param {string} key Id for the `value`. + * @param {Object} value Value to be stored. + * @param {Object=} options Options object. + * See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults} + */ + putObject: function(key, value, options) { + this.put(key, angular.toJson(value), options); + }, + + /** + * @ngdoc method + * @name $cookies#remove + * + * @description + * Remove given cookie + * + * @param {string} key Id of the key-value pair to delete. + * @param {Object=} options Options object. + * See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults} + */ + remove: function(key, options) { + $$cookieWriter(key, undefined, calcOptions(options)); + } + }; + }]; + }]); + +angular.module('ngCookies'). +/** + * @ngdoc service + * @name $cookieStore + * @deprecated + * @requires $cookies + * + * @description + * Provides a key-value (string-object) storage, that is backed by session cookies. + * Objects put or retrieved from this storage are automatically serialized or + * deserialized by angular's toJson/fromJson. + * + * Requires the {@link ngCookies `ngCookies`} module to be installed. + * + *
    + * **Note:** The $cookieStore service is **deprecated**. + * Please use the {@link ngCookies.$cookies `$cookies`} service instead. + *
    + * + * @example + * + * ```js + * angular.module('cookieStoreExample', ['ngCookies']) + * .controller('ExampleController', ['$cookieStore', function($cookieStore) { + * // Put cookie + * $cookieStore.put('myFavorite','oatmeal'); + * // Get cookie + * var favoriteCookie = $cookieStore.get('myFavorite'); + * // Removing a cookie + * $cookieStore.remove('myFavorite'); + * }]); + * ``` + */ + factory('$cookieStore', ['$cookies', function($cookies) { + + return { + /** + * @ngdoc method + * @name $cookieStore#get + * + * @description + * Returns the value of given cookie key + * + * @param {string} key Id to use for lookup. + * @returns {Object} Deserialized cookie value, undefined if the cookie does not exist. + */ + get: function(key) { + return $cookies.getObject(key); + }, + + /** + * @ngdoc method + * @name $cookieStore#put + * + * @description + * Sets a value for given cookie key + * + * @param {string} key Id for the `value`. + * @param {Object} value Value to be stored. + */ + put: function(key, value) { + $cookies.putObject(key, value); + }, + + /** + * @ngdoc method + * @name $cookieStore#remove + * + * @description + * Remove given cookie + * + * @param {string} key Id of the key-value pair to delete. + */ + remove: function(key) { + $cookies.remove(key); + } + }; + + }]); + +/** + * @name $$cookieWriter + * @requires $document + * + * @description + * This is a private service for writing cookies + * + * @param {string} name Cookie name + * @param {string=} value Cookie value (if undefined, cookie will be deleted) + * @param {Object=} options Object with options that need to be stored for the cookie. + */ +function $$CookieWriter($document, $log, $browser) { + var cookiePath = $browser.baseHref(); + var rawDocument = $document[0]; + + function buildCookieString(name, value, options) { + var path, expires; + options = options || {}; + expires = options.expires; + path = angular.isDefined(options.path) ? options.path : cookiePath; + if (angular.isUndefined(value)) { + expires = 'Thu, 01 Jan 1970 00:00:00 GMT'; + value = ''; + } + if (angular.isString(expires)) { + expires = new Date(expires); + } + + var str = encodeURIComponent(name) + '=' + encodeURIComponent(value); + str += path ? ';path=' + path : ''; + str += options.domain ? ';domain=' + options.domain : ''; + str += expires ? ';expires=' + expires.toUTCString() : ''; + str += options.secure ? ';secure' : ''; + + // per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum: + // - 300 cookies + // - 20 cookies per unique domain + // - 4096 bytes per cookie + var cookieLength = str.length + 1; + if (cookieLength > 4096) { + $log.warn("Cookie '" + name + + "' possibly not set or overflowed because it was too large (" + + cookieLength + " > 4096 bytes)!"); + } + + return str; + } + + return function(name, value, options) { + rawDocument.cookie = buildCookieString(name, value, options); + }; +} + +$$CookieWriter.$inject = ['$document', '$log', '$browser']; + +angular.module('ngCookies').provider('$$cookieWriter', function $$CookieWriterProvider() { + this.$get = $$CookieWriter; +}); + + +})(window, window.angular); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.min.js new file mode 100644 index 0000000..d0f126a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.min.js @@ -0,0 +1,9 @@ +/* + AngularJS v1.5.0 + (c) 2010-2016 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(p,c,n){'use strict';function l(b,a,g){var d=g.baseHref(),k=b[0];return function(b,e,f){var g,h;f=f||{};h=f.expires;g=c.isDefined(f.path)?f.path:d;c.isUndefined(e)&&(h="Thu, 01 Jan 1970 00:00:00 GMT",e="");c.isString(h)&&(h=new Date(h));e=encodeURIComponent(b)+"="+encodeURIComponent(e);e=e+(g?";path="+g:"")+(f.domain?";domain="+f.domain:"");e+=h?";expires="+h.toUTCString():"";e+=f.secure?";secure":"";f=e.length+1;4096 4096 bytes)!");k.cookie=e}}c.module("ngCookies",["ng"]).provider("$cookies",[function(){var b=this.defaults={};this.$get=["$$cookieReader","$$cookieWriter",function(a,g){return{get:function(d){return a()[d]},getObject:function(d){return(d=this.get(d))?c.fromJson(d):d},getAll:function(){return a()},put:function(d,a,m){g(d,a,m?c.extend({},b,m):b)},putObject:function(d,b,a){this.put(d,c.toJson(b),a)},remove:function(a,k){g(a,n,k?c.extend({},b,k):b)}}}]}]);c.module("ngCookies").factory("$cookieStore", +["$cookies",function(b){return{get:function(a){return b.getObject(a)},put:function(a,c){b.putObject(a,c)},remove:function(a){b.remove(a)}}}]);l.$inject=["$document","$log","$browser"];c.module("ngCookies").provider("$$cookieWriter",function(){this.$get=l})})(window,window.angular); +//# sourceMappingURL=angular-cookies.min.js.map diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.min.js.map b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.min.js.map new file mode 100644 index 0000000..555b510 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-cookies.min.js.map @@ -0,0 +1,8 @@ +{ +"version":3, +"file":"angular-cookies.min.js", +"lineCount":8, +"mappings":"A;;;;;aAKC,SAA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zDqC,CAA7B,CAPxB,CA8JA9B,EAAA2B,OAAA,CAAe,WAAf,CAAAiB,QAAA,CAiCS,cAjCT;AAiCyB,CAAC,UAAD,CAAa,QAAQ,CAACC,CAAD,CAAW,CAErD,MAAO,CAWLX,IAAKA,QAAQ,CAACC,CAAD,CAAM,CACjB,MAAOU,EAAAT,UAAA,CAAmBD,CAAnB,CADU,CAXd,CAyBLI,IAAKA,QAAQ,CAACJ,CAAD,CAAMzB,CAAN,CAAa,CACxBmC,CAAAJ,UAAA,CAAmBN,CAAnB,CAAwBzB,CAAxB,CADwB,CAzBrB,CAsCLiC,OAAQA,QAAQ,CAACR,CAAD,CAAM,CACpBU,CAAAF,OAAA,CAAgBR,CAAhB,CADoB,CAtCjB,CAF8C,CAAhC,CAjCzB,CAqIAjC,EAAA4C,QAAA,CAAyB,CAAC,WAAD,CAAc,MAAd,CAAsB,UAAtB,CAEzB9C,EAAA2B,OAAA,CAAe,WAAf,CAAAC,SAAA,CAAqC,gBAArC,CAAuDmB,QAA+B,EAAG,CACvF,IAAAhB,KAAA,CAAY7B,CAD2E,CAAzF,CAvTsC,CAArC,CAAD,CA4TGH,MA5TH,CA4TWA,MAAAC,QA5TX;", +"sources":["angular-cookies.js"], +"names":["window","angular","undefined","$$CookieWriter","$document","$log","$browser","cookiePath","baseHref","rawDocument","name","value","options","path","expires","isDefined","isUndefined","isString","Date","str","encodeURIComponent","domain","toUTCString","secure","cookieLength","length","warn","cookie","module","provider","$CookiesProvider","defaults","$get","$$cookieReader","$$cookieWriter","get","key","getObject","fromJson","getAll","put","extend","putObject","toJson","remove","factory","$cookies","$inject","$$CookieWriterProvider"] +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-csp.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-csp.css new file mode 100644 index 0000000..23134fd --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-csp.css @@ -0,0 +1,20 @@ + +@charset "UTF-8"; + +[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], +.ng-cloak, .x-ng-cloak, +.ng-hide:not(.ng-hide-animate) { + display: none !important; +} + +ng\:form { + display: block; +} + +.ng-animate-shim { + visibility:hidden; +} + +.ng-anchor { + position:absolute; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.js new file mode 100644 index 0000000..77948fd --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.js @@ -0,0 +1,484 @@ +/** + * @license AngularJS v1.5.0 + * (c) 2010-2016 Google, Inc. http://angularjs.org + * License: MIT + */ + +(function() {'use strict'; + function isFunction(value) {return typeof value === 'function';}; + +/* global: toDebugString: true */ + +function serializeObject(obj) { + var seen = []; + + return JSON.stringify(obj, function(key, val) { + val = toJsonReplacer(key, val); + if (isObject(val)) { + + if (seen.indexOf(val) >= 0) return '...'; + + seen.push(val); + } + return val; + }); +} + +function toDebugString(obj) { + if (typeof obj === 'function') { + return obj.toString().replace(/ \{[\s\S]*$/, ''); + } else if (isUndefined(obj)) { + return 'undefined'; + } else if (typeof obj !== 'string') { + return serializeObject(obj); + } + return obj; +} + +/** + * @description + * + * This object provides a utility for producing rich Error messages within + * Angular. It can be called as follows: + * + * var exampleMinErr = minErr('example'); + * throw exampleMinErr('one', 'This {0} is {1}', foo, bar); + * + * The above creates an instance of minErr in the example namespace. The + * resulting error will have a namespaced error code of example.one. The + * resulting error will replace {0} with the value of foo, and {1} with the + * value of bar. The object is not restricted in the number of arguments it can + * take. + * + * If fewer arguments are specified than necessary for interpolation, the extra + * interpolation markers will be preserved in the final string. + * + * Since data will be parsed statically during a build step, some restrictions + * are applied with respect to how minErr instances are created and called. + * Instances should have names of the form namespaceMinErr for a minErr created + * using minErr('namespace') . Error codes, namespaces and template strings + * should all be static strings, not variables or general expressions. + * + * @param {string} module The namespace to use for the new minErr instance. + * @param {function} ErrorConstructor Custom error constructor to be instantiated when returning + * error from returned function, for cases when a particular type of error is useful. + * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance + */ + +function minErr(module, ErrorConstructor) { + ErrorConstructor = ErrorConstructor || Error; + return function() { + var SKIP_INDEXES = 2; + + var templateArgs = arguments, + code = templateArgs[0], + message = '[' + (module ? module + ':' : '') + code + '] ', + template = templateArgs[1], + paramPrefix, i; + + message += template.replace(/\{\d+\}/g, function(match) { + var index = +match.slice(1, -1), + shiftedIndex = index + SKIP_INDEXES; + + if (shiftedIndex < templateArgs.length) { + return toDebugString(templateArgs[shiftedIndex]); + } + + return match; + }); + + message += '\nhttp://errors.angularjs.org/1.5.0/' + + (module ? module + '/' : '') + code; + + for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') { + message += paramPrefix + 'p' + (i - SKIP_INDEXES) + '=' + + encodeURIComponent(toDebugString(templateArgs[i])); + } + + return new ErrorConstructor(message); + }; +} + +/** + * @ngdoc type + * @name angular.Module + * @module ng + * @description + * + * Interface for configuring angular {@link angular.module modules}. + */ + +function setupModuleLoader(window) { + + var $injectorMinErr = minErr('$injector'); + var ngMinErr = minErr('ng'); + + function ensure(obj, name, factory) { + return obj[name] || (obj[name] = factory()); + } + + var angular = ensure(window, 'angular', Object); + + // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap + angular.$$minErr = angular.$$minErr || minErr; + + return ensure(angular, 'module', function() { + /** @type {Object.} */ + var modules = {}; + + /** + * @ngdoc function + * @name angular.module + * @module ng + * @description + * + * The `angular.module` is a global place for creating, registering and retrieving Angular + * modules. + * All modules (angular core or 3rd party) that should be available to an application must be + * registered using this mechanism. + * + * Passing one argument retrieves an existing {@link angular.Module}, + * whereas passing more than one argument creates a new {@link angular.Module} + * + * + * # Module + * + * A module is a collection of services, directives, controllers, filters, and configuration information. + * `angular.module` is used to configure the {@link auto.$injector $injector}. + * + * ```js + * // Create a new module + * var myModule = angular.module('myModule', []); + * + * // register a new service + * myModule.value('appName', 'MyCoolApp'); + * + * // configure existing services inside initialization blocks. + * myModule.config(['$locationProvider', function($locationProvider) { + * // Configure existing providers + * $locationProvider.hashPrefix('!'); + * }]); + * ``` + * + * Then you can create an injector and load your modules like this: + * + * ```js + * var injector = angular.injector(['ng', 'myModule']) + * ``` + * + * However it's more likely that you'll just use + * {@link ng.directive:ngApp ngApp} or + * {@link angular.bootstrap} to simplify this process for you. + * + * @param {!string} name The name of the module to create or retrieve. + * @param {!Array.=} requires If specified then new module is being created. If + * unspecified then the module is being retrieved for further configuration. + * @param {Function=} configFn Optional configuration function for the module. Same as + * {@link angular.Module#config Module#config()}. + * @returns {angular.Module} new module with the {@link angular.Module} api. + */ + return function module(name, requires, configFn) { + var assertNotHasOwnProperty = function(name, context) { + if (name === 'hasOwnProperty') { + throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context); + } + }; + + assertNotHasOwnProperty(name, 'module'); + if (requires && modules.hasOwnProperty(name)) { + modules[name] = null; + } + return ensure(modules, name, function() { + if (!requires) { + throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " + + "the module name or forgot to load it. If registering a module ensure that you " + + "specify the dependencies as the second argument.", name); + } + + /** @type {!Array.>} */ + var invokeQueue = []; + + /** @type {!Array.} */ + var configBlocks = []; + + /** @type {!Array.} */ + var runBlocks = []; + + var config = invokeLater('$injector', 'invoke', 'push', configBlocks); + + /** @type {angular.Module} */ + var moduleInstance = { + // Private state + _invokeQueue: invokeQueue, + _configBlocks: configBlocks, + _runBlocks: runBlocks, + + /** + * @ngdoc property + * @name angular.Module#requires + * @module ng + * + * @description + * Holds the list of modules which the injector will load before the current module is + * loaded. + */ + requires: requires, + + /** + * @ngdoc property + * @name angular.Module#name + * @module ng + * + * @description + * Name of the module. + */ + name: name, + + + /** + * @ngdoc method + * @name angular.Module#provider + * @module ng + * @param {string} name service name + * @param {Function} providerType Construction function for creating new instance of the + * service. + * @description + * See {@link auto.$provide#provider $provide.provider()}. + */ + provider: invokeLaterAndSetModuleName('$provide', 'provider'), + + /** + * @ngdoc method + * @name angular.Module#factory + * @module ng + * @param {string} name service name + * @param {Function} providerFunction Function for creating new instance of the service. + * @description + * See {@link auto.$provide#factory $provide.factory()}. + */ + factory: invokeLaterAndSetModuleName('$provide', 'factory'), + + /** + * @ngdoc method + * @name angular.Module#service + * @module ng + * @param {string} name service name + * @param {Function} constructor A constructor function that will be instantiated. + * @description + * See {@link auto.$provide#service $provide.service()}. + */ + service: invokeLaterAndSetModuleName('$provide', 'service'), + + /** + * @ngdoc method + * @name angular.Module#value + * @module ng + * @param {string} name service name + * @param {*} object Service instance object. + * @description + * See {@link auto.$provide#value $provide.value()}. + */ + value: invokeLater('$provide', 'value'), + + /** + * @ngdoc method + * @name angular.Module#constant + * @module ng + * @param {string} name constant name + * @param {*} object Constant value. + * @description + * Because the constants are fixed, they get applied before other provide methods. + * See {@link auto.$provide#constant $provide.constant()}. + */ + constant: invokeLater('$provide', 'constant', 'unshift'), + + /** + * @ngdoc method + * @name angular.Module#decorator + * @module ng + * @param {string} The name of the service to decorate. + * @param {Function} This function will be invoked when the service needs to be + * instantiated and should return the decorated service instance. + * @description + * See {@link auto.$provide#decorator $provide.decorator()}. + */ + decorator: invokeLaterAndSetModuleName('$provide', 'decorator'), + + /** + * @ngdoc method + * @name angular.Module#animation + * @module ng + * @param {string} name animation name + * @param {Function} animationFactory Factory function for creating new instance of an + * animation. + * @description + * + * **NOTE**: animations take effect only if the **ngAnimate** module is loaded. + * + * + * Defines an animation hook that can be later used with + * {@link $animate $animate} service and directives that use this service. + * + * ```js + * module.animation('.animation-name', function($inject1, $inject2) { + * return { + * eventName : function(element, done) { + * //code to run the animation + * //once complete, then run done() + * return function cancellationFunction(element) { + * //code to cancel the animation + * } + * } + * } + * }) + * ``` + * + * See {@link ng.$animateProvider#register $animateProvider.register()} and + * {@link ngAnimate ngAnimate module} for more information. + */ + animation: invokeLaterAndSetModuleName('$animateProvider', 'register'), + + /** + * @ngdoc method + * @name angular.Module#filter + * @module ng + * @param {string} name Filter name - this must be a valid angular expression identifier + * @param {Function} filterFactory Factory function for creating new instance of filter. + * @description + * See {@link ng.$filterProvider#register $filterProvider.register()}. + * + *
    + * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`. + * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace + * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores + * (`myapp_subsection_filterx`). + *
    + */ + filter: invokeLaterAndSetModuleName('$filterProvider', 'register'), + + /** + * @ngdoc method + * @name angular.Module#controller + * @module ng + * @param {string|Object} name Controller name, or an object map of controllers where the + * keys are the names and the values are the constructors. + * @param {Function} constructor Controller constructor function. + * @description + * See {@link ng.$controllerProvider#register $controllerProvider.register()}. + */ + controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'), + + /** + * @ngdoc method + * @name angular.Module#directive + * @module ng + * @param {string|Object} name Directive name, or an object map of directives where the + * keys are the names and the values are the factories. + * @param {Function} directiveFactory Factory function for creating new instance of + * directives. + * @description + * See {@link ng.$compileProvider#directive $compileProvider.directive()}. + */ + directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'), + + /** + * @ngdoc method + * @name angular.Module#component + * @module ng + * @param {string} name Name of the component in camel-case (i.e. myComp which will match as my-comp) + * @param {Object} options Component definition object (a simplified + * {@link ng.$compile#directive-definition-object directive definition object}) + * + * @description + * See {@link ng.$compileProvider#component $compileProvider.component()}. + */ + component: invokeLaterAndSetModuleName('$compileProvider', 'component'), + + /** + * @ngdoc method + * @name angular.Module#config + * @module ng + * @param {Function} configFn Execute this function on module load. Useful for service + * configuration. + * @description + * Use this method to register work which needs to be performed on module loading. + * For more about how to configure services, see + * {@link providers#provider-recipe Provider Recipe}. + */ + config: config, + + /** + * @ngdoc method + * @name angular.Module#run + * @module ng + * @param {Function} initializationFn Execute this function after injector creation. + * Useful for application initialization. + * @description + * Use this method to register work which should be performed when the injector is done + * loading all modules. + */ + run: function(block) { + runBlocks.push(block); + return this; + } + }; + + if (configFn) { + config(configFn); + } + + return moduleInstance; + + /** + * @param {string} provider + * @param {string} method + * @param {String=} insertMethod + * @returns {angular.Module} + */ + function invokeLater(provider, method, insertMethod, queue) { + if (!queue) queue = invokeQueue; + return function() { + queue[insertMethod || 'push']([provider, method, arguments]); + return moduleInstance; + }; + } + + /** + * @param {string} provider + * @param {string} method + * @returns {angular.Module} + */ + function invokeLaterAndSetModuleName(provider, method) { + return function(recipeName, factoryFunction) { + if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name; + invokeQueue.push([provider, method, arguments]); + return moduleInstance; + }; + } + }); + }; + }); + +} + +setupModuleLoader(window); +})(window); + +/** + * Closure compiler type information + * + * @typedef { { + * requires: !Array., + * invokeQueue: !Array.>, + * + * service: function(string, Function):angular.Module, + * factory: function(string, Function):angular.Module, + * value: function(string, *):angular.Module, + * + * filter: function(string, Function):angular.Module, + * + * init: function(Function):angular.Module + * } } + */ +angular.Module; + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.min.js new file mode 100644 index 0000000..316ee26 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-loader.min.js @@ -0,0 +1,10 @@ +/* + AngularJS v1.5.0 + (c) 2010-2016 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(){'use strict';function d(b){return function(){var a=arguments[0],e;e="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.5.0/"+(b?b+"/":"")+a;for(a=1;a= line.length) { + index -= line.length; + } else { + return { line: i + 1, column: index + 1 }; + } + } +} +var PARSE_CACHE_FOR_TEXT_LITERALS = Object.create(null); + +function parseTextLiteral(text) { + var cachedFn = PARSE_CACHE_FOR_TEXT_LITERALS[text]; + if (cachedFn != null) { + return cachedFn; + } + function parsedFn(context) { return text; } + parsedFn['$$watchDelegate'] = function watchDelegate(scope, listener, objectEquality) { + var unwatch = scope['$watch'](noop, + function textLiteralWatcher() { + if (isFunction(listener)) { listener.call(null, text, text, scope); } + unwatch(); + }, + objectEquality); + return unwatch; + }; + PARSE_CACHE_FOR_TEXT_LITERALS[text] = parsedFn; + parsedFn['exp'] = text; // Needed to pretend to be $interpolate for tests copied from interpolateSpec.js + parsedFn['expressions'] = []; // Require this to call $compile.$$addBindingInfo() which allows Protractor to find elements by binding. + return parsedFn; +} + +function subtractOffset(expressionFn, offset) { + if (offset === 0) { + return expressionFn; + } + function minusOffset(value) { + return (value == void 0) ? value : value - offset; + } + function parsedFn(context) { return minusOffset(expressionFn(context)); } + var unwatch; + parsedFn['$$watchDelegate'] = function watchDelegate(scope, listener, objectEquality) { + unwatch = scope['$watch'](expressionFn, + function pluralExpressionWatchListener(newValue, oldValue) { + if (isFunction(listener)) { listener.call(null, minusOffset(newValue), minusOffset(oldValue), scope); } + }, + objectEquality); + return unwatch; + }; + return parsedFn; +} + +// NOTE: ADVANCED_OPTIMIZATIONS mode. +// +// This file is compiled with Closure compiler's ADVANCED_OPTIMIZATIONS flag! Be wary of using +// constructs incompatible with that mode. + +/* global $interpolateMinErr: false */ +/* global isFunction: false */ +/* global noop: false */ + +/** + * @constructor + * @private + */ +function MessageSelectorBase(expressionFn, choices) { + var self = this; + this.expressionFn = expressionFn; + this.choices = choices; + if (choices["other"] === void 0) { + throw $interpolateMinErr('reqother', '“other†is a required option.'); + } + this.parsedFn = function(context) { return self.getResult(context); }; + this.parsedFn['$$watchDelegate'] = function $$watchDelegate(scope, listener, objectEquality) { + return self.watchDelegate(scope, listener, objectEquality); + }; + this.parsedFn['exp'] = expressionFn['exp']; + this.parsedFn['expressions'] = expressionFn['expressions']; +} + +MessageSelectorBase.prototype.getMessageFn = function getMessageFn(value) { + return this.choices[this.categorizeValue(value)]; +}; + +MessageSelectorBase.prototype.getResult = function getResult(context) { + return this.getMessageFn(this.expressionFn(context))(context); +}; + +MessageSelectorBase.prototype.watchDelegate = function watchDelegate(scope, listener, objectEquality) { + var watchers = new MessageSelectorWatchers(this, scope, listener, objectEquality); + return function() { watchers.cancelWatch(); }; +}; + +/** + * @constructor + * @private + */ +function MessageSelectorWatchers(msgSelector, scope, listener, objectEquality) { + var self = this; + this.scope = scope; + this.msgSelector = msgSelector; + this.listener = listener; + this.objectEquality = objectEquality; + this.lastMessage = void 0; + this.messageFnWatcher = noop; + var expressionFnListener = function(newValue, oldValue) { return self.expressionFnListener(newValue, oldValue); }; + this.expressionFnWatcher = scope['$watch'](msgSelector.expressionFn, expressionFnListener, objectEquality); +} + +MessageSelectorWatchers.prototype.expressionFnListener = function expressionFnListener(newValue, oldValue) { + var self = this; + this.messageFnWatcher(); + var messageFnListener = function(newMessage, oldMessage) { return self.messageFnListener(newMessage, oldMessage); }; + var messageFn = this.msgSelector.getMessageFn(newValue); + this.messageFnWatcher = this.scope['$watch'](messageFn, messageFnListener, this.objectEquality); +}; + +MessageSelectorWatchers.prototype.messageFnListener = function messageFnListener(newMessage, oldMessage) { + if (isFunction(this.listener)) { + this.listener.call(null, newMessage, newMessage === oldMessage ? newMessage : this.lastMessage, this.scope); + } + this.lastMessage = newMessage; +}; + +MessageSelectorWatchers.prototype.cancelWatch = function cancelWatch() { + this.expressionFnWatcher(); + this.messageFnWatcher(); +}; + +/** + * @constructor + * @extends MessageSelectorBase + * @private + */ +function SelectMessage(expressionFn, choices) { + MessageSelectorBase.call(this, expressionFn, choices); +} + +function SelectMessageProto() {} +SelectMessageProto.prototype = MessageSelectorBase.prototype; + +SelectMessage.prototype = new SelectMessageProto(); +SelectMessage.prototype.categorizeValue = function categorizeSelectValue(value) { + return (this.choices[value] !== void 0) ? value : "other"; +}; + +/** + * @constructor + * @extends MessageSelectorBase + * @private + */ +function PluralMessage(expressionFn, choices, offset, pluralCat) { + MessageSelectorBase.call(this, expressionFn, choices); + this.offset = offset; + this.pluralCat = pluralCat; +} + +function PluralMessageProto() {} +PluralMessageProto.prototype = MessageSelectorBase.prototype; + +PluralMessage.prototype = new PluralMessageProto(); +PluralMessage.prototype.categorizeValue = function categorizePluralValue(value) { + if (isNaN(value)) { + return "other"; + } else if (this.choices[value] !== void 0) { + return value; + } else { + var category = this.pluralCat(value - this.offset); + return (this.choices[category] !== void 0) ? category : "other"; + } +}; + +// NOTE: ADVANCED_OPTIMIZATIONS mode. +// +// This file is compiled with Closure compiler's ADVANCED_OPTIMIZATIONS flag! Be wary of using +// constructs incompatible with that mode. + +/* global $interpolateMinErr: false */ +/* global isFunction: false */ +/* global parseTextLiteral: false */ + +/** + * @constructor + * @private + */ +function InterpolationParts(trustedContext, allOrNothing) { + this.trustedContext = trustedContext; + this.allOrNothing = allOrNothing; + this.textParts = []; + this.expressionFns = []; + this.expressionIndices = []; + this.partialText = ''; + this.concatParts = null; +} + +InterpolationParts.prototype.flushPartialText = function flushPartialText() { + if (this.partialText) { + if (this.concatParts == null) { + this.textParts.push(this.partialText); + } else { + this.textParts.push(this.concatParts.join('')); + this.concatParts = null; + } + this.partialText = ''; + } +}; + +InterpolationParts.prototype.addText = function addText(text) { + if (text.length) { + if (!this.partialText) { + this.partialText = text; + } else if (this.concatParts) { + this.concatParts.push(text); + } else { + this.concatParts = [this.partialText, text]; + } + } +}; + +InterpolationParts.prototype.addExpressionFn = function addExpressionFn(expressionFn) { + this.flushPartialText(); + this.expressionIndices.push(this.textParts.length); + this.expressionFns.push(expressionFn); + this.textParts.push(''); +}; + +InterpolationParts.prototype.getExpressionValues = function getExpressionValues(context) { + var expressionValues = new Array(this.expressionFns.length); + for (var i = 0; i < this.expressionFns.length; i++) { + expressionValues[i] = this.expressionFns[i](context); + } + return expressionValues; +}; + +InterpolationParts.prototype.getResult = function getResult(expressionValues) { + for (var i = 0; i < this.expressionIndices.length; i++) { + var expressionValue = expressionValues[i]; + if (this.allOrNothing && expressionValue === void 0) return; + this.textParts[this.expressionIndices[i]] = expressionValue; + } + return this.textParts.join(''); +}; + + +InterpolationParts.prototype.toParsedFn = function toParsedFn(mustHaveExpression, originalText) { + var self = this; + this.flushPartialText(); + if (mustHaveExpression && this.expressionFns.length === 0) { + return void 0; + } + if (this.textParts.length === 0) { + return parseTextLiteral(''); + } + if (this.trustedContext && this.textParts.length > 1) { + $interpolateMinErr['throwNoconcat'](originalText); + } + if (this.expressionFns.length === 0) { + if (this.textParts.length != 1) { this.errorInParseLogic(); } + return parseTextLiteral(this.textParts[0]); + } + var parsedFn = function(context) { + return self.getResult(self.getExpressionValues(context)); + }; + parsedFn['$$watchDelegate'] = function $$watchDelegate(scope, listener, objectEquality) { + return self.watchDelegate(scope, listener, objectEquality); + }; + + parsedFn['exp'] = originalText; // Needed to pretend to be $interpolate for tests copied from interpolateSpec.js + parsedFn['expressions'] = new Array(this.expressionFns.length); // Require this to call $compile.$$addBindingInfo() which allows Protractor to find elements by binding. + for (var i = 0; i < this.expressionFns.length; i++) { + parsedFn['expressions'][i] = this.expressionFns[i]['exp']; + } + + return parsedFn; +}; + +InterpolationParts.prototype.watchDelegate = function watchDelegate(scope, listener, objectEquality) { + var watcher = new InterpolationPartsWatcher(this, scope, listener, objectEquality); + return function() { watcher.cancelWatch(); }; +}; + +function InterpolationPartsWatcher(interpolationParts, scope, listener, objectEquality) { + this.interpolationParts = interpolationParts; + this.scope = scope; + this.previousResult = (void 0); + this.listener = listener; + var self = this; + this.expressionFnsWatcher = scope['$watchGroup'](interpolationParts.expressionFns, function(newExpressionValues, oldExpressionValues) { + self.watchListener(newExpressionValues, oldExpressionValues); + }); +} + +InterpolationPartsWatcher.prototype.watchListener = function watchListener(newExpressionValues, oldExpressionValues) { + var result = this.interpolationParts.getResult(newExpressionValues); + if (isFunction(this.listener)) { + this.listener.call(null, result, newExpressionValues === oldExpressionValues ? result : this.previousResult, this.scope); + } + this.previousResult = result; +}; + +InterpolationPartsWatcher.prototype.cancelWatch = function cancelWatch() { + this.expressionFnsWatcher(); +}; + +// NOTE: ADVANCED_OPTIMIZATIONS mode. +// +// This file is compiled with Closure compiler's ADVANCED_OPTIMIZATIONS flag! Be wary of using +// constructs incompatible with that mode. + +/* global $interpolateMinErr: false */ +/* global indexToLineAndColumn: false */ +/* global InterpolationParts: false */ +/* global PluralMessage: false */ +/* global SelectMessage: false */ +/* global subtractOffset: false */ + +// The params src and dst are exactly one of two types: NestedParserState or MessageFormatParser. +// This function is fully optimized by V8. (inspect via IRHydra or --trace-deopt.) +// The idea behind writing it this way is to avoid repeating oneself. This is the ONE place where +// the parser state that is saved/restored when parsing nested mustaches is specified. +function copyNestedParserState(src, dst) { + dst.expressionFn = src.expressionFn; + dst.expressionMinusOffsetFn = src.expressionMinusOffsetFn; + dst.pluralOffset = src.pluralOffset; + dst.choices = src.choices; + dst.choiceKey = src.choiceKey; + dst.interpolationParts = src.interpolationParts; + dst.ruleChoiceKeyword = src.ruleChoiceKeyword; + dst.msgStartIndex = src.msgStartIndex; + dst.expressionStartIndex = src.expressionStartIndex; +} + +function NestedParserState(parser) { + copyNestedParserState(parser, this); +} + +/** + * @constructor + * @private + */ +function MessageFormatParser(text, startIndex, $parse, pluralCat, stringifier, + mustHaveExpression, trustedContext, allOrNothing) { + this.text = text; + this.index = startIndex || 0; + this.$parse = $parse; + this.pluralCat = pluralCat; + this.stringifier = stringifier; + this.mustHaveExpression = !!mustHaveExpression; + this.trustedContext = trustedContext; + this.allOrNothing = !!allOrNothing; + this.expressionFn = null; + this.expressionMinusOffsetFn = null; + this.pluralOffset = null; + this.choices = null; + this.choiceKey = null; + this.interpolationParts = null; + this.msgStartIndex = null; + this.nestedStateStack = []; + this.parsedFn = null; + this.rule = null; + this.ruleStack = null; + this.ruleChoiceKeyword = null; + this.interpNestLevel = null; + this.expressionStartIndex = null; + this.stringStartIndex = null; + this.stringQuote = null; + this.stringInterestsRe = null; + this.angularOperatorStack = null; + this.textPart = null; +} + +// preserve v8 optimization. +var EMPTY_STATE = new NestedParserState(new MessageFormatParser( + /* text= */ '', /* startIndex= */ 0, /* $parse= */ null, /* pluralCat= */ null, /* stringifier= */ null, + /* mustHaveExpression= */ false, /* trustedContext= */ null, /* allOrNothing */ false)); + +MessageFormatParser.prototype.pushState = function pushState() { + this.nestedStateStack.push(new NestedParserState(this)); + copyNestedParserState(EMPTY_STATE, this); +}; + +MessageFormatParser.prototype.popState = function popState() { + if (this.nestedStateStack.length === 0) { + this.errorInParseLogic(); + } + var previousState = this.nestedStateStack.pop(); + copyNestedParserState(previousState, this); +}; + +// Oh my JavaScript! Who knew you couldn't match a regex at a specific +// location in a string but will always search forward?! +// Apparently you'll be growing this ability via the sticky flag (y) in +// ES6. I'll just to work around you for now. +MessageFormatParser.prototype.matchRe = function matchRe(re, search) { + re.lastIndex = this.index; + var match = re.exec(this.text); + if (match != null && (search === true || (match.index == this.index))) { + this.index = re.lastIndex; + return match; + } + return null; +}; + +MessageFormatParser.prototype.searchRe = function searchRe(re) { + return this.matchRe(re, true); +}; + + +MessageFormatParser.prototype.consumeRe = function consumeRe(re) { + // Without the sticky flag, we can't use the .test() method to consume a + // match at the current index. Instead, we'll use the slower .exec() method + // and verify match.index. + return !!this.matchRe(re); +}; + +// Run through our grammar avoiding deeply nested function call chains. +MessageFormatParser.prototype.run = function run(initialRule) { + this.ruleStack = [initialRule]; + do { + this.rule = this.ruleStack.pop(); + while (this.rule) { + this.rule(); + } + this.assertRuleOrNull(this.rule); + } while (this.ruleStack.length > 0); +}; + +MessageFormatParser.prototype.errorInParseLogic = function errorInParseLogic() { + throw $interpolateMinErr('logicbug', + 'The messageformat parser has encountered an internal error. Please file a github issue against the AngularJS project and provide this message text that triggers the bug. Text: “{0}â€', + this.text); +}; + +MessageFormatParser.prototype.assertRuleOrNull = function assertRuleOrNull(rule) { + if (rule === void 0) { + this.errorInParseLogic(); + } +}; + +var NEXT_WORD_RE = /\s*(\w+)\s*/g; +MessageFormatParser.prototype.errorExpecting = function errorExpecting() { + // What was wrong with the syntax? Unsupported type, missing comma, or something else? + var match = this.matchRe(NEXT_WORD_RE), position; + if (match == null) { + position = indexToLineAndColumn(this.text, this.index); + throw $interpolateMinErr('reqarg', + 'Expected one of “plural†or “select†at line {0}, column {1} of text “{2}â€', + position.line, position.column, this.text); + } + var word = match[1]; + if (word == "select" || word == "plural") { + position = indexToLineAndColumn(this.text, this.index); + throw $interpolateMinErr('reqcomma', + 'Expected a comma after the keyword “{0}†at line {1}, column {2} of text “{3}â€', + word, position.line, position.column, this.text); + } else { + position = indexToLineAndColumn(this.text, this.index); + throw $interpolateMinErr('unknarg', + 'Unsupported keyword “{0}†at line {0}, column {1}. Only “plural†and “select†are currently supported. Text: “{3}â€', + word, position.line, position.column, this.text); + } +}; + +var STRING_START_RE = /['"]/g; +MessageFormatParser.prototype.ruleString = function ruleString() { + var match = this.matchRe(STRING_START_RE); + if (match == null) { + var position = indexToLineAndColumn(this.text, this.index); + throw $interpolateMinErr('wantstring', + 'Expected the beginning of a string at line {0}, column {1} in text “{2}â€', + position.line, position.column, this.text); + } + this.startStringAtMatch(match); +}; + +MessageFormatParser.prototype.startStringAtMatch = function startStringAtMatch(match) { + this.stringStartIndex = match.index; + this.stringQuote = match[0]; + this.stringInterestsRe = this.stringQuote == "'" ? SQUOTED_STRING_INTEREST_RE : DQUOTED_STRING_INTEREST_RE; + this.rule = this.ruleInsideString; +}; + +var SQUOTED_STRING_INTEREST_RE = /\\(?:\\|'|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{2}|[0-7]{3}|\r\n|\n|[\s\S])|'/g; +var DQUOTED_STRING_INTEREST_RE = /\\(?:\\|"|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{2}|[0-7]{3}|\r\n|\n|[\s\S])|"/g; +MessageFormatParser.prototype.ruleInsideString = function ruleInsideString() { + var match = this.searchRe(this.stringInterestsRe); + if (match == null) { + var position = indexToLineAndColumn(this.text, this.stringStartIndex); + throw $interpolateMinErr('untermstr', + 'The string beginning at line {0}, column {1} is unterminated in text “{2}â€', + position.line, position.column, this.text); + } + var chars = match[0]; + if (match == this.stringQuote) { + this.rule = null; + } +}; + +var PLURAL_OR_SELECT_ARG_TYPE_RE = /\s*(plural|select)\s*,\s*/g; +MessageFormatParser.prototype.rulePluralOrSelect = function rulePluralOrSelect() { + var match = this.searchRe(PLURAL_OR_SELECT_ARG_TYPE_RE); + if (match == null) { + this.errorExpecting(); + } + var argType = match[1]; + switch (argType) { + case "plural": this.rule = this.rulePluralStyle; break; + case "select": this.rule = this.ruleSelectStyle; break; + default: this.errorInParseLogic(); + } +}; + +MessageFormatParser.prototype.rulePluralStyle = function rulePluralStyle() { + this.choices = Object.create(null); + this.ruleChoiceKeyword = this.rulePluralValueOrKeyword; + this.rule = this.rulePluralOffset; +}; + +MessageFormatParser.prototype.ruleSelectStyle = function ruleSelectStyle() { + this.choices = Object.create(null); + this.ruleChoiceKeyword = this.ruleSelectKeyword; + this.rule = this.ruleSelectKeyword; +}; + +var NUMBER_RE = /[0]|(?:[1-9][0-9]*)/g; +var PLURAL_OFFSET_RE = new RegExp("\\s*offset\\s*:\\s*(" + NUMBER_RE.source + ")", "g"); + +MessageFormatParser.prototype.rulePluralOffset = function rulePluralOffset() { + var match = this.matchRe(PLURAL_OFFSET_RE); + this.pluralOffset = (match == null) ? 0 : parseInt(match[1], 10); + this.expressionMinusOffsetFn = subtractOffset(this.expressionFn, this.pluralOffset); + this.rule = this.rulePluralValueOrKeyword; +}; + +MessageFormatParser.prototype.assertChoiceKeyIsNew = function assertChoiceKeyIsNew(choiceKey, index) { + if (this.choices[choiceKey] !== void 0) { + var position = indexToLineAndColumn(this.text, index); + throw $interpolateMinErr('dupvalue', + 'The choice “{0}†is specified more than once. Duplicate key is at line {1}, column {2} in text “{3}â€', + choiceKey, position.line, position.column, this.text); + } +}; + +var SELECT_KEYWORD = /\s*(\w+)/g; +MessageFormatParser.prototype.ruleSelectKeyword = function ruleSelectKeyword() { + var match = this.matchRe(SELECT_KEYWORD); + if (match == null) { + this.parsedFn = new SelectMessage(this.expressionFn, this.choices).parsedFn; + this.rule = null; + return; + } + this.choiceKey = match[1]; + this.assertChoiceKeyIsNew(this.choiceKey, match.index); + this.rule = this.ruleMessageText; +}; + +var EXPLICIT_VALUE_OR_KEYWORD_RE = new RegExp("\\s*(?:(?:=(" + NUMBER_RE.source + "))|(\\w+))", "g"); +MessageFormatParser.prototype.rulePluralValueOrKeyword = function rulePluralValueOrKeyword() { + var match = this.matchRe(EXPLICIT_VALUE_OR_KEYWORD_RE); + if (match == null) { + this.parsedFn = new PluralMessage(this.expressionFn, this.choices, this.pluralOffset, this.pluralCat).parsedFn; + this.rule = null; + return; + } + if (match[1] != null) { + this.choiceKey = parseInt(match[1], 10); + } else { + this.choiceKey = match[2]; + } + this.assertChoiceKeyIsNew(this.choiceKey, match.index); + this.rule = this.ruleMessageText; +}; + +var BRACE_OPEN_RE = /\s*{/g; +var BRACE_CLOSE_RE = /}/g; +MessageFormatParser.prototype.ruleMessageText = function ruleMessageText() { + if (!this.consumeRe(BRACE_OPEN_RE)) { + var position = indexToLineAndColumn(this.text, this.index); + throw $interpolateMinErr('reqopenbrace', + 'The plural choice “{0}†must be followed by a message in braces at line {1}, column {2} in text “{3}â€', + this.choiceKey, position.line, position.column, this.text); + } + this.msgStartIndex = this.index; + this.interpolationParts = new InterpolationParts(this.trustedContext, this.allOrNothing); + this.rule = this.ruleInInterpolationOrMessageText; +}; + +// Note: Since "\" is used as an escape character, don't allow it to be part of the +// startSymbol/endSymbol when I add the feature to allow them to be redefined. +var INTERP_OR_END_MESSAGE_RE = /\\.|{{|}/g; +var INTERP_OR_PLURALVALUE_OR_END_MESSAGE_RE = /\\.|{{|#|}/g; +var ESCAPE_OR_MUSTACHE_BEGIN_RE = /\\.|{{/g; +MessageFormatParser.prototype.advanceInInterpolationOrMessageText = function advanceInInterpolationOrMessageText() { + var currentIndex = this.index, match, re; + if (this.ruleChoiceKeyword == null) { // interpolation + match = this.searchRe(ESCAPE_OR_MUSTACHE_BEGIN_RE); + if (match == null) { // End of interpolation text. Nothing more to process. + this.textPart = this.text.substring(currentIndex); + this.index = this.text.length; + return null; + } + } else { + match = this.searchRe(this.ruleChoiceKeyword == this.rulePluralValueOrKeyword ? + INTERP_OR_PLURALVALUE_OR_END_MESSAGE_RE : INTERP_OR_END_MESSAGE_RE); + if (match == null) { + var position = indexToLineAndColumn(this.text, this.msgStartIndex); + throw $interpolateMinErr('reqendbrace', + 'The plural/select choice “{0}†message starting at line {1}, column {2} does not have an ending closing brace. Text “{3}â€', + this.choiceKey, position.line, position.column, this.text); + } + } + // match is non-null. + var token = match[0]; + this.textPart = this.text.substring(currentIndex, match.index); + return token; +}; + +MessageFormatParser.prototype.ruleInInterpolationOrMessageText = function ruleInInterpolationOrMessageText() { + var currentIndex = this.index; + var token = this.advanceInInterpolationOrMessageText(); + if (token == null) { + // End of interpolation text. Nothing more to process. + this.index = this.text.length; + this.interpolationParts.addText(this.text.substring(currentIndex)); + this.rule = null; + return; + } + if (token[0] == "\\") { + // unescape next character and continue + this.interpolationParts.addText(this.textPart + token[1]); + return; + } + this.interpolationParts.addText(this.textPart); + if (token == "{{") { + this.pushState(); + this.ruleStack.push(this.ruleEndMustacheInInterpolationOrMessage); + this.rule = this.ruleEnteredMustache; + } else if (token == "}") { + this.choices[this.choiceKey] = this.interpolationParts.toParsedFn(/*mustHaveExpression=*/false, this.text); + this.rule = this.ruleChoiceKeyword; + } else if (token == "#") { + this.interpolationParts.addExpressionFn(this.expressionMinusOffsetFn); + } else { + this.errorInParseLogic(); + } +}; + +MessageFormatParser.prototype.ruleInterpolate = function ruleInterpolate() { + this.interpolationParts = new InterpolationParts(this.trustedContext, this.allOrNothing); + this.rule = this.ruleInInterpolation; +}; + +MessageFormatParser.prototype.ruleInInterpolation = function ruleInInterpolation() { + var currentIndex = this.index; + var match = this.searchRe(ESCAPE_OR_MUSTACHE_BEGIN_RE); + if (match == null) { + // End of interpolation text. Nothing more to process. + this.index = this.text.length; + this.interpolationParts.addText(this.text.substring(currentIndex)); + this.parsedFn = this.interpolationParts.toParsedFn(this.mustHaveExpression, this.text); + this.rule = null; + return; + } + var token = match[0]; + if (token[0] == "\\") { + // unescape next character and continue + this.interpolationParts.addText(this.text.substring(currentIndex, match.index) + token[1]); + return; + } + this.interpolationParts.addText(this.text.substring(currentIndex, match.index)); + this.pushState(); + this.ruleStack.push(this.ruleInterpolationEndMustache); + this.rule = this.ruleEnteredMustache; +}; + +MessageFormatParser.prototype.ruleInterpolationEndMustache = function ruleInterpolationEndMustache() { + var expressionFn = this.parsedFn; + this.popState(); + this.interpolationParts.addExpressionFn(expressionFn); + this.rule = this.ruleInInterpolation; +}; + +MessageFormatParser.prototype.ruleEnteredMustache = function ruleEnteredMustache() { + this.parsedFn = null; + this.ruleStack.push(this.ruleEndMustache); + this.rule = this.ruleAngularExpression; +}; + +MessageFormatParser.prototype.ruleEndMustacheInInterpolationOrMessage = function ruleEndMustacheInInterpolationOrMessage() { + var expressionFn = this.parsedFn; + this.popState(); + this.interpolationParts.addExpressionFn(expressionFn); + this.rule = this.ruleInInterpolationOrMessageText; +}; + + + +var INTERP_END_RE = /\s*}}/g; +MessageFormatParser.prototype.ruleEndMustache = function ruleEndMustache() { + var match = this.matchRe(INTERP_END_RE); + if (match == null) { + var position = indexToLineAndColumn(this.text, this.index); + throw $interpolateMinErr('reqendinterp', + 'Expecting end of interpolation symbol, “{0}â€, at line {1}, column {2} in text “{3}â€', + '}}', position.line, position.column, this.text); + } + if (this.parsedFn == null) { + // If we parsed a MessageFormat extension, (e.g. select/plural today, maybe more some other + // day), then the result *has* to be a string and those rules would have already set + // this.parsedFn. If there was no MessageFormat extension, then there is no requirement to + // stringify the result and parsedFn isn't set. We set it here. While we could have set it + // unconditionally when exiting the Angular expression, I intend for us to not just replace + // $interpolate, but also to replace $parse in a future version (so ng-bind can work), and in + // such a case we do not want to unnecessarily stringify something if it's not going to be used + // in a string context. + this.parsedFn = this.$parse(this.expressionFn, this.stringifier); + this.parsedFn['exp'] = this.expressionFn['exp']; // Needed to pretend to be $interpolate for tests copied from interpolateSpec.js + this.parsedFn['expressions'] = this.expressionFn['expressions']; // Require this to call $compile.$$addBindingInfo() which allows Protractor to find elements by binding. + } + this.rule = null; +}; + +MessageFormatParser.prototype.ruleAngularExpression = function ruleAngularExpression() { + this.angularOperatorStack = []; + this.expressionStartIndex = this.index; + this.rule = this.ruleInAngularExpression; +}; + +function getEndOperator(opBegin) { + switch (opBegin) { + case "{": return "}"; + case "[": return "]"; + case "(": return ")"; + default: return null; + } +} + +function getBeginOperator(opEnd) { + switch (opEnd) { + case "}": return "{"; + case "]": return "["; + case ")": return "("; + default: return null; + } +} + +// TODO(chirayu): The interpolation endSymbol must also be accounted for. It +// just so happens that "}" is an operator so it's in the list below. But we +// should support any other type of start/end interpolation symbol. +var INTERESTING_OPERATORS_RE = /[[\]{}()'",]/g; +MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularExpression() { + var startIndex = this.index; + var match = this.searchRe(INTERESTING_OPERATORS_RE); + var position; + if (match == null) { + if (this.angularOperatorStack.length === 0) { + // This is the end of the Angular expression so this is actually a + // success. Note that when inside an interpolation, this means we even + // consumed the closing interpolation symbols if they were curlies. This + // is NOT an error at this point but will become an error further up the + // stack when the part that saw the opening curlies is unable to find the + // closing ones. + this.index = this.text.length; + this.expressionFn = this.$parse(this.text.substring(this.expressionStartIndex, this.index)); + // Needed to pretend to be $interpolate for tests copied from interpolateSpec.js + this.expressionFn['exp'] = this.text.substring(this.expressionStartIndex, this.index); + this.expressionFn['expressions'] = this.expressionFn['expressions']; + this.rule = null; + return; + } + var innermostOperator = this.angularOperatorStack[0]; + throw $interpolateMinErr('badexpr', + 'Unexpected end of Angular expression. Expecting operator “{0}†at the end of the text “{1}â€', + this.getEndOperator(innermostOperator), this.text); + } + var operator = match[0]; + if (operator == "'" || operator == '"') { + this.ruleStack.push(this.ruleInAngularExpression); + this.startStringAtMatch(match); + return; + } + if (operator == ",") { + if (this.trustedContext) { + position = indexToLineAndColumn(this.text, this.index); + throw $interpolateMinErr('unsafe', + 'Use of select/plural MessageFormat syntax is currently disallowed in a secure context ({0}). At line {1}, column {2} of text “{3}â€', + this.trustedContext, position.line, position.column, this.text); + } + // only the top level comma has relevance. + if (this.angularOperatorStack.length === 0) { + // todo: does this need to be trimmed? + this.expressionFn = this.$parse(this.text.substring(this.expressionStartIndex, match.index)); + // Needed to pretend to be $interpolate for tests copied from interpolateSpec.js + this.expressionFn['exp'] = this.text.substring(this.expressionStartIndex, match.index); + this.expressionFn['expressions'] = this.expressionFn['expressions']; + this.rule = null; + this.rule = this.rulePluralOrSelect; + } + return; + } + if (getEndOperator(operator) != null) { + this.angularOperatorStack.unshift(operator); + return; + } + var beginOperator = getBeginOperator(operator); + if (beginOperator == null) { + this.errorInParseLogic(); + } + if (this.angularOperatorStack.length > 0) { + if (beginOperator == this.angularOperatorStack[0]) { + this.angularOperatorStack.shift(); + return; + } + position = indexToLineAndColumn(this.text, this.index); + throw $interpolateMinErr('badexpr', + 'Unexpected operator “{0}†at line {1}, column {2} in text. Was expecting “{3}â€. Text: “{4}â€', + operator, position.line, position.column, getEndOperator(this.angularOperatorStack[0]), this.text); + } + // We are trying to pop off the operator stack but there really isn't anything to pop off. + this.index = match.index; + this.expressionFn = this.$parse(this.text.substring(this.expressionStartIndex, this.index)); + // Needed to pretend to be $interpolate for tests copied from interpolateSpec.js + this.expressionFn['exp'] = this.text.substring(this.expressionStartIndex, this.index); + this.expressionFn['expressions'] = this.expressionFn['expressions']; + this.rule = null; +}; + +// NOTE: ADVANCED_OPTIMIZATIONS mode. +// +// This file is compiled with Closure compiler's ADVANCED_OPTIMIZATIONS flag! Be wary of using +// constructs incompatible with that mode. + +/* global $interpolateMinErr: false */ +/* global MessageFormatParser: false */ +/* global stringify: false */ + +/** + * @ngdoc service + * @name $$messageFormat + * + * @description + * Angular internal service to recognize MessageFormat extensions in interpolation expressions. + * For more information, see: + * https://docs.google.com/a/google.com/document/d/1pbtW2yvtmFBikfRrJd8VAsabiFkKezmYZ_PbgdjQOVU/edit + * + * ## Example + * + * + * + *
    + *
    + * {{recipients.length, plural, offset:1 + * =0 {{{sender.name}} gave no gifts (\#=#)} + * =1 {{{sender.name}} gave one gift to {{recipients[0].name}} (\#=#)} + * one {{{sender.name}} gave {{recipients[0].name}} and one other person a gift (\#=#)} + * other {{{sender.name}} gave {{recipients[0].name}} and # other people a gift (\#=#)} + * }} + *
    + *
    + * + * + * function Person(name, gender) { + * this.name = name; + * this.gender = gender; + * } + * + * var alice = new Person("Alice", "female"), + * bob = new Person("Bob", "male"), + * charlie = new Person("Charlie", "male"), + * harry = new Person("Harry Potter", "male"); + * + * angular.module('msgFmtExample', ['ngMessageFormat']) + * .controller('AppController', ['$scope', function($scope) { + * $scope.recipients = [alice, bob, charlie]; + * $scope.sender = harry; + * $scope.decreaseRecipients = function() { + * --$scope.recipients.length; + * }; + * }]); + * + * + * + * describe('MessageFormat plural', function() { + * it('should pluralize initial values', function() { + * var messageElem = element(by.binding('recipients.length')), decreaseRecipientsBtn = element(by.id('decreaseRecipients')); + * expect(messageElem.getText()).toEqual('Harry Potter gave Alice and 2 other people a gift (#=2)'); + * decreaseRecipientsBtn.click(); + * expect(messageElem.getText()).toEqual('Harry Potter gave Alice and one other person a gift (#=1)'); + * decreaseRecipientsBtn.click(); + * expect(messageElem.getText()).toEqual('Harry Potter gave one gift to Alice (#=0)'); + * decreaseRecipientsBtn.click(); + * expect(messageElem.getText()).toEqual('Harry Potter gave no gifts (#=-1)'); + * }); + * }); + * + *
    + */ +var $$MessageFormatFactory = ['$parse', '$locale', '$sce', '$exceptionHandler', function $$messageFormat( + $parse, $locale, $sce, $exceptionHandler) { + + function getStringifier(trustedContext, allOrNothing, text) { + return function stringifier(value) { + try { + value = trustedContext ? $sce['getTrusted'](trustedContext, value) : $sce['valueOf'](value); + return allOrNothing && (value === void 0) ? value : stringify(value); + } catch (err) { + $exceptionHandler($interpolateMinErr['interr'](text, err)); + } + }; + } + + function interpolate(text, mustHaveExpression, trustedContext, allOrNothing) { + var stringifier = getStringifier(trustedContext, allOrNothing, text); + var parser = new MessageFormatParser(text, 0, $parse, $locale['pluralCat'], stringifier, + mustHaveExpression, trustedContext, allOrNothing); + parser.run(parser.ruleInterpolate); + return parser.parsedFn; + } + + return { + 'interpolate': interpolate + }; +}]; + +var $$interpolateDecorator = ['$$messageFormat', '$delegate', function $$interpolateDecorator($$messageFormat, $interpolate) { + if ($interpolate['startSymbol']() != "{{" || $interpolate['endSymbol']() != "}}") { + throw $interpolateMinErr('nochgmustache', 'angular-message-format.js currently does not allow you to use custom start and end symbols for interpolation.'); + } + var interpolate = $$messageFormat['interpolate']; + interpolate['startSymbol'] = $interpolate['startSymbol']; + interpolate['endSymbol'] = $interpolate['endSymbol']; + return interpolate; +}]; + + +/** + * @ngdoc module + * @name ngMessageFormat + * @packageName angular-message-format + * @description + */ +var module = window['angular']['module']('ngMessageFormat', ['ng']); +module['factory']('$$messageFormat', $$MessageFormatFactory); +module['config'](['$provide', function($provide) { + $provide['decorator']('$interpolate', $$interpolateDecorator); +}]); + + +})(window, window.angular); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.min.js new file mode 100644 index 0000000..f85a587 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-message-format.min.js @@ -0,0 +1,26 @@ +/* + AngularJS v1.5.0 + (c) 2010-2016 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(h){'use strict';function C(a){if(null==a)return"";switch(typeof a){case "string":return a;case "number":return""+a;default:return D(a)}}function f(a,b){for(var d=a.split(/\n/g),k=0;k=c.length)b-=c.length;else return{h:k+1,f:b+1}}}function t(a){function b(){return a}var d=u[a];if(null!=d)return d;b.$$watchDelegate=function(b,d,c){var e=b.$watch(v,function(){m(d)&&d.call(null,a,a,b);e()},c);return e};u[a]=b;b.exp=a;b.expressions=[];return b}function F(a,b){function d(a){return void 0== +a?a:a-b}function c(b){return d(a(b))}if(0===b)return a;var e;c.$$watchDelegate=function(b,c,k){return e=b.$watch(a,function(a,k){m(c)&&c.call(null,d(a),d(k),b)},k)};return c}function l(a,b){var d=this;this.b=a;this.e=b;if(void 0===b.other)throw e("reqother");this.d=function(a){return d.D(a)};this.d.$$watchDelegate=function(a,b,c){return d.P(a,b,c)};this.d.exp=a.exp;this.d.expressions=a.expressions}function n(a,b,d,c){var e=this;this.scope=b;this.oa=a;this.v=d;this.qa=c;this.U=void 0;this.K=v;this.ka= +b.$watch(a.b,function(a){return e.ja(a)},c)}function p(a,b){l.call(this,a,b)}function w(){}function q(a,b,d,c){l.call(this,a,b);this.offset=d;this.M=c}function x(){}function g(a,b){this.u=a;this.B=b;this.i=[];this.g=[];this.J=[];this.s="";this.q=null}function r(a,b,d){this.c=a;this.scope=b;this.W=void 0;this.v=d;var c=this;this.la=b.$watchGroup(a.g,function(a,b){c.Ea(a,b)})}function s(a,b){b.b=a.b;b.C=a.C;b.w=a.w;b.e=a.e;b.k=a.k;b.c=a.c;b.n=a.n;b.F=a.F;b.l=a.l}function y(a){s(a,this)}function c(a, +b,d,c,e,E,f,g){this.text=a;this.index=b||0;this.A=d;this.M=c;this.Da=e;this.pa=!!E;this.u=f;this.B=!!g;this.F=this.c=this.k=this.e=this.w=this.C=this.b=null;this.L=[];this.G=this.j=this.ca=this.O=this.da=this.l=this.n=this.o=this.a=this.d=null}function z(a){switch(a){case "{":return"}";case "[":return"]";case "(":return")";default:return null}}function G(a){switch(a){case "}":return"{";case "]":return"[";case ")":return"(";default:return null}}var e=h.angular.$interpolateMinErr,v=h.angular.noop,m= +h.angular.isFunction,D=h.angular.toJson,u=Object.create(null);l.prototype.T=function(a){return this.e[this.R(a)]};l.prototype.D=function(a){return this.T(this.b(a))(a)};l.prototype.P=function(a,b,d){var c=new n(this,a,b,d);return function(){c.I()}};n.prototype.ja=function(a){var b=this;this.K();a=this.oa.T(a);this.K=this.scope.$watch(a,function(a,c){return b.na(a,c)},this.qa)};n.prototype.na=function(a,b){m(this.v)&&this.v.call(null,a,a===b?a:this.U,this.scope);this.U=a};n.prototype.I=function(){this.ka(); +this.K()};w.prototype=l.prototype;p.prototype=new w;p.prototype.R=function(a){return void 0!==this.e[a]?a:"other"};x.prototype=l.prototype;q.prototype=new x;q.prototype.R=function(a){if(isNaN(a))return"other";if(void 0!==this.e[a])return a;a=this.M(a-this.offset);return void 0!==this.e[a]?a:"other"};g.prototype.S=function(){this.s&&(null==this.q?this.i.push(this.s):(this.i.push(this.q.join("")),this.q=null),this.s="")};g.prototype.p=function(a){a.length&&(this.s?this.q?this.q.push(a):this.q=[this.s, +a]:this.s=a)};g.prototype.H=function(a){this.S();this.J.push(this.i.length);this.g.push(a);this.i.push("")};g.prototype.ma=function(a){for(var b=Array(this.g.length),d=0;d + * + *
    + *
    You did not enter a field
    + *
    + * Your email must be between 5 and 100 characters long + *
    + *
    + * + * ``` + * + * Now whatever key/value entries are present within the provided object (in this case `$error`) then + * the ngMessages directive will render the inner first ngMessage directive (depending if the key values + * match the attribute value present on each ngMessage directive). In other words, if your errors + * object contains the following data: + * + * ```javascript + * + * myField.$error = { minlength : true, required : true }; + * ``` + * + * Then the `required` message will be displayed first. When required is false then the `minlength` message + * will be displayed right after (since these messages are ordered this way in the template HTML code). + * The prioritization of each message is determined by what order they're present in the DOM. + * Therefore, instead of having custom JavaScript code determine the priority of what errors are + * present before others, the presentation of the errors are handled within the template. + * + * By default, ngMessages will only display one error at a time. However, if you wish to display all + * messages then the `ng-messages-multiple` attribute flag can be used on the element containing the + * ngMessages directive to make this happen. + * + * ```html + * + *
    ...
    + * + * + * ... + * ``` + * + * ## Reusing and Overriding Messages + * In addition to prioritization, ngMessages also allows for including messages from a remote or an inline + * template. This allows for generic collection of messages to be reused across multiple parts of an + * application. + * + * ```html + * + * + *
    + *
    + *
    + * ``` + * + * However, including generic messages may not be useful enough to match all input fields, therefore, + * `ngMessages` provides the ability to override messages defined in the remote template by redefining + * them within the directive container. + * + * ```html + * + * + * + *
    + * + * + *
    + * + *
    You did not enter your email address
    + * + * + *
    Your email address is invalid
    + * + * + *
    + *
    + *
    + * ``` + * + * In the example HTML code above the message that is set on required will override the corresponding + * required message defined within the remote template. Therefore, with particular input fields (such + * email addresses, date fields, autocomplete inputs, etc...), specialized error messages can be applied + * while more generic messages can be used to handle other, more general input errors. + * + * ## Dynamic Messaging + * ngMessages also supports using expressions to dynamically change key values. Using arrays and + * repeaters to list messages is also supported. This means that the code below will be able to + * fully adapt itself and display the appropriate message when any of the expression data changes: + * + * ```html + *
    + * + *
    + *
    You did not enter your email address
    + *
    + * + *
    {{ errorMessage.text }}
    + *
    + *
    + *
    + * ``` + * + * The `errorMessage.type` expression can be a string value or it can be an array so + * that multiple errors can be associated with a single error message: + * + * ```html + * + *
    + *
    You did not enter your email address
    + *
    + * Your email must be between 5 and 100 characters long + *
    + *
    + * ``` + * + * Feel free to use other structural directives such as ng-if and ng-switch to further control + * what messages are active and when. Be careful, if you place ng-message on the same element + * as these structural directives, Angular may not be able to determine if a message is active + * or not. Therefore it is best to place the ng-message on a child element of the structural + * directive. + * + * ```html + *
    + *
    + *
    Please enter something
    + *
    + *
    + * ``` + * + * ## Animations + * If the `ngAnimate` module is active within the application then the `ngMessages`, `ngMessage` and + * `ngMessageExp` directives will trigger animations whenever any messages are added and removed from + * the DOM by the `ngMessages` directive. + * + * Whenever the `ngMessages` directive contains one or more visible messages then the `.ng-active` CSS + * class will be added to the element. The `.ng-inactive` CSS class will be applied when there are no + * messages present. Therefore, CSS transitions and keyframes as well as JavaScript animations can + * hook into the animations whenever these classes are added/removed. + * + * Let's say that our HTML code for our messages container looks like so: + * + * ```html + * + * ``` + * + * Then the CSS animation code for the message container looks like so: + * + * ```css + * .my-messages { + * transition:1s linear all; + * } + * .my-messages.ng-active { + * // messages are visible + * } + * .my-messages.ng-inactive { + * // messages are hidden + * } + * ``` + * + * Whenever an inner message is attached (becomes visible) or removed (becomes hidden) then the enter + * and leave animation is triggered for each particular element bound to the `ngMessage` directive. + * + * Therefore, the CSS code for the inner messages looks like so: + * + * ```css + * .some-message { + * transition:1s linear all; + * } + * + * .some-message.ng-enter {} + * .some-message.ng-enter.ng-enter-active {} + * + * .some-message.ng-leave {} + * .some-message.ng-leave.ng-leave-active {} + * ``` + * + * {@link ngAnimate Click here} to learn how to use JavaScript animations or to learn more about ngAnimate. + */ +angular.module('ngMessages', []) + + /** + * @ngdoc directive + * @module ngMessages + * @name ngMessages + * @restrict AE + * + * @description + * `ngMessages` is a directive that is designed to show and hide messages based on the state + * of a key/value object that it listens on. The directive itself complements error message + * reporting with the `ngModel` $error object (which stores a key/value state of validation errors). + * + * `ngMessages` manages the state of internal messages within its container element. The internal + * messages use the `ngMessage` directive and will be inserted/removed from the page depending + * on if they're present within the key/value object. By default, only one message will be displayed + * at a time and this depends on the prioritization of the messages within the template. (This can + * be changed by using the `ng-messages-multiple` or `multiple` attribute on the directive container.) + * + * A remote template can also be used to promote message reusability and messages can also be + * overridden. + * + * {@link module:ngMessages Click here} to learn more about `ngMessages` and `ngMessage`. + * + * @usage + * ```html + * + * + * ... + * ... + * ... + * + * + * + * + * ... + * ... + * ... + * + * ``` + * + * @param {string} ngMessages an angular expression evaluating to a key/value object + * (this is typically the $error object on an ngModel instance). + * @param {string=} ngMessagesMultiple|multiple when set, all messages will be displayed with true + * + * @example + * + * + *
    + * + *
    myForm.myName.$error = {{ myForm.myName.$error | json }}
    + * + *
    + *
    You did not enter a field
    + *
    Your field is too short
    + *
    Your field is too long
    + *
    + *
    + *
    + * + * angular.module('ngMessagesExample', ['ngMessages']); + * + *
    + */ + .directive('ngMessages', ['$animate', function($animate) { + var ACTIVE_CLASS = 'ng-active'; + var INACTIVE_CLASS = 'ng-inactive'; + + return { + require: 'ngMessages', + restrict: 'AE', + controller: ['$element', '$scope', '$attrs', function($element, $scope, $attrs) { + var ctrl = this; + var latestKey = 0; + var nextAttachId = 0; + + this.getAttachId = function getAttachId() { return nextAttachId++; }; + + var messages = this.messages = {}; + var renderLater, cachedCollection; + + this.render = function(collection) { + collection = collection || {}; + + renderLater = false; + cachedCollection = collection; + + // this is true if the attribute is empty or if the attribute value is truthy + var multiple = isAttrTruthy($scope, $attrs.ngMessagesMultiple) || + isAttrTruthy($scope, $attrs.multiple); + + var unmatchedMessages = []; + var matchedKeys = {}; + var messageItem = ctrl.head; + var messageFound = false; + var totalMessages = 0; + + // we use != instead of !== to allow for both undefined and null values + while (messageItem != null) { + totalMessages++; + var messageCtrl = messageItem.message; + + var messageUsed = false; + if (!messageFound) { + forEach(collection, function(value, key) { + if (!messageUsed && truthy(value) && messageCtrl.test(key)) { + // this is to prevent the same error name from showing up twice + if (matchedKeys[key]) return; + matchedKeys[key] = true; + + messageUsed = true; + messageCtrl.attach(); + } + }); + } + + if (messageUsed) { + // unless we want to display multiple messages then we should + // set a flag here to avoid displaying the next message in the list + messageFound = !multiple; + } else { + unmatchedMessages.push(messageCtrl); + } + + messageItem = messageItem.next; + } + + forEach(unmatchedMessages, function(messageCtrl) { + messageCtrl.detach(); + }); + + unmatchedMessages.length !== totalMessages + ? $animate.setClass($element, ACTIVE_CLASS, INACTIVE_CLASS) + : $animate.setClass($element, INACTIVE_CLASS, ACTIVE_CLASS); + }; + + $scope.$watchCollection($attrs.ngMessages || $attrs['for'], ctrl.render); + + this.reRender = function() { + if (!renderLater) { + renderLater = true; + $scope.$evalAsync(function() { + if (renderLater) { + cachedCollection && ctrl.render(cachedCollection); + } + }); + } + }; + + this.register = function(comment, messageCtrl) { + var nextKey = latestKey.toString(); + messages[nextKey] = { + message: messageCtrl + }; + insertMessageNode($element[0], comment, nextKey); + comment.$$ngMessageNode = nextKey; + latestKey++; + + ctrl.reRender(); + }; + + this.deregister = function(comment) { + var key = comment.$$ngMessageNode; + delete comment.$$ngMessageNode; + removeMessageNode($element[0], comment, key); + delete messages[key]; + ctrl.reRender(); + }; + + function findPreviousMessage(parent, comment) { + var prevNode = comment; + var parentLookup = []; + while (prevNode && prevNode !== parent) { + var prevKey = prevNode.$$ngMessageNode; + if (prevKey && prevKey.length) { + return messages[prevKey]; + } + + // dive deeper into the DOM and examine its children for any ngMessage + // comments that may be in an element that appears deeper in the list + if (prevNode.childNodes.length && parentLookup.indexOf(prevNode) == -1) { + parentLookup.push(prevNode); + prevNode = prevNode.childNodes[prevNode.childNodes.length - 1]; + } else { + prevNode = prevNode.previousSibling || prevNode.parentNode; + } + } + } + + function insertMessageNode(parent, comment, key) { + var messageNode = messages[key]; + if (!ctrl.head) { + ctrl.head = messageNode; + } else { + var match = findPreviousMessage(parent, comment); + if (match) { + messageNode.next = match.next; + match.next = messageNode; + } else { + messageNode.next = ctrl.head; + ctrl.head = messageNode; + } + } + } + + function removeMessageNode(parent, comment, key) { + var messageNode = messages[key]; + + var match = findPreviousMessage(parent, comment); + if (match) { + match.next = messageNode.next; + } else { + ctrl.head = messageNode.next; + } + } + }] + }; + + function isAttrTruthy(scope, attr) { + return (isString(attr) && attr.length === 0) || //empty attribute + truthy(scope.$eval(attr)); + } + + function truthy(val) { + return isString(val) ? val.length : !!val; + } + }]) + + /** + * @ngdoc directive + * @name ngMessagesInclude + * @restrict AE + * @scope + * + * @description + * `ngMessagesInclude` is a directive with the purpose to import existing ngMessage template + * code from a remote template and place the downloaded template code into the exact spot + * that the ngMessagesInclude directive is placed within the ngMessages container. This allows + * for a series of pre-defined messages to be reused and also allows for the developer to + * determine what messages are overridden due to the placement of the ngMessagesInclude directive. + * + * @usage + * ```html + * + * + * ... + * + * + * + * + * ... + * + * ``` + * + * {@link module:ngMessages Click here} to learn more about `ngMessages` and `ngMessage`. + * + * @param {string} ngMessagesInclude|src a string value corresponding to the remote template. + */ + .directive('ngMessagesInclude', + ['$templateRequest', '$document', '$compile', function($templateRequest, $document, $compile) { + + return { + restrict: 'AE', + require: '^^ngMessages', // we only require this for validation sake + link: function($scope, element, attrs) { + var src = attrs.ngMessagesInclude || attrs.src; + $templateRequest(src).then(function(html) { + $compile(html)($scope, function(contents) { + element.after(contents); + + // the anchor is placed for debugging purposes + var anchor = jqLite($document[0].createComment(' ngMessagesInclude: ' + src + ' ')); + element.after(anchor); + + // we don't want to pollute the DOM anymore by keeping an empty directive element + element.remove(); + }); + }); + } + }; + }]) + + /** + * @ngdoc directive + * @name ngMessage + * @restrict AE + * @scope + * + * @description + * `ngMessage` is a directive with the purpose to show and hide a particular message. + * For `ngMessage` to operate, a parent `ngMessages` directive on a parent DOM element + * must be situated since it determines which messages are visible based on the state + * of the provided key/value map that `ngMessages` listens on. + * + * More information about using `ngMessage` can be found in the + * {@link module:ngMessages `ngMessages` module documentation}. + * + * @usage + * ```html + * + * + * ... + * ... + * + * + * + * + * ... + * ... + * + * ``` + * + * @param {expression} ngMessage|when a string value corresponding to the message key. + */ + .directive('ngMessage', ngMessageDirectiveFactory()) + + + /** + * @ngdoc directive + * @name ngMessageExp + * @restrict AE + * @priority 1 + * @scope + * + * @description + * `ngMessageExp` is a directive with the purpose to show and hide a particular message. + * For `ngMessageExp` to operate, a parent `ngMessages` directive on a parent DOM element + * must be situated since it determines which messages are visible based on the state + * of the provided key/value map that `ngMessages` listens on. + * + * @usage + * ```html + * + * + * ... + * + * + * + * + * ... + * + * ``` + * + * {@link module:ngMessages Click here} to learn more about `ngMessages` and `ngMessage`. + * + * @param {expression} ngMessageExp|whenExp an expression value corresponding to the message key. + */ + .directive('ngMessageExp', ngMessageDirectiveFactory()); + +function ngMessageDirectiveFactory() { + return ['$animate', function($animate) { + return { + restrict: 'AE', + transclude: 'element', + priority: 1, // must run before ngBind, otherwise the text is set on the comment + terminal: true, + require: '^^ngMessages', + link: function(scope, element, attrs, ngMessagesCtrl, $transclude) { + var commentNode = element[0]; + + var records; + var staticExp = attrs.ngMessage || attrs.when; + var dynamicExp = attrs.ngMessageExp || attrs.whenExp; + var assignRecords = function(items) { + records = items + ? (isArray(items) + ? items + : items.split(/[\s,]+/)) + : null; + ngMessagesCtrl.reRender(); + }; + + if (dynamicExp) { + assignRecords(scope.$eval(dynamicExp)); + scope.$watchCollection(dynamicExp, assignRecords); + } else { + assignRecords(staticExp); + } + + var currentElement, messageCtrl; + ngMessagesCtrl.register(commentNode, messageCtrl = { + test: function(name) { + return contains(records, name); + }, + attach: function() { + if (!currentElement) { + $transclude(scope, function(elm) { + $animate.enter(elm, null, element); + currentElement = elm; + + // Each time we attach this node to a message we get a new id that we can match + // when we are destroying the node later. + var $$attachId = currentElement.$$attachId = ngMessagesCtrl.getAttachId(); + + // in the event that the parent element is destroyed + // by any other structural directive then it's time + // to deregister the message from the controller + currentElement.on('$destroy', function() { + if (currentElement && currentElement.$$attachId === $$attachId) { + ngMessagesCtrl.deregister(commentNode); + messageCtrl.detach(); + } + }); + }); + } + }, + detach: function() { + if (currentElement) { + var elm = currentElement; + currentElement = null; + $animate.leave(elm); + } + } + }); + } + }; + }]; + + function contains(collection, key) { + if (collection) { + return isArray(collection) + ? collection.indexOf(key) >= 0 + : collection.hasOwnProperty(key); + } + } +} + + +})(window, window.angular); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.min.js new file mode 100644 index 0000000..19f59cc --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.min.js @@ -0,0 +1,12 @@ +/* + AngularJS v1.5.0 + (c) 2010-2016 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(A,d,B){'use strict';function l(){return["$animate",function(v){return{restrict:"AE",transclude:"element",priority:1,terminal:!0,require:"^^ngMessages",link:function(n,r,a,b,m){var k=r[0],f,p=a.ngMessage||a.when;a=a.ngMessageExp||a.whenExp;var d=function(a){f=a?w(a)?a:a.split(/[\s,]+/):null;b.reRender()};a?(d(n.$eval(a)),n.$watchCollection(a,d)):d(p);var e,q;b.register(k,q={test:function(a){var g=f;a=g?w(g)?0<=g.indexOf(a):g.hasOwnProperty(a):void 0;return a},attach:function(){e||m(n,function(a){v.enter(a, +null,r);e=a;var g=e.$$attachId=b.getAttachId();e.on("$destroy",function(){e&&e.$$attachId===g&&(b.deregister(k),q.detach())})})},detach:function(){if(e){var a=e;e=null;v.leave(a)}}})}}}]}var w=d.isArray,x=d.forEach,y=d.isString,z=d.element;d.module("ngMessages",[]).directive("ngMessages",["$animate",function(d){function n(a,b){return y(b)&&0===b.length||r(a.$eval(b))}function r(a){return y(a)?a.length:!!a}return{require:"ngMessages",restrict:"AE",controller:["$element","$scope","$attrs",function(a, +b,m){function k(a,b){for(var c=b,f=[];c&&c!==a;){var h=c.$$ngMessageNode;if(h&&h.length)return e[h];c.childNodes.length&&-1==f.indexOf(c)?(f.push(c),c=c.childNodes[c.childNodes.length-1]):c=c.previousSibling||c.parentNode}}var f=this,p=0,l=0;this.getAttachId=function(){return l++};var e=this.messages={},q,s;this.render=function(g){g=g||{};q=!1;s=g;for(var e=n(b,m.ngMessagesMultiple)||n(b,m.multiple),c=[],k={},h=f.head,p=!1,l=0;null!=h;){l++;var t=h.message,u=!1;p||x(g,function(a,c){!u&&r(a)&&t.test(c)&& +!k[c]&&(u=k[c]=!0,t.attach())});u?p=!e:c.push(t);h=h.next}x(c,function(a){a.detach()});c.length!==l?d.setClass(a,"ng-active","ng-inactive"):d.setClass(a,"ng-inactive","ng-active")};b.$watchCollection(m.ngMessages||m["for"],f.render);this.reRender=function(){q||(q=!0,b.$evalAsync(function(){q&&s&&f.render(s)}))};this.register=function(g,b){var c=p.toString();e[c]={message:b};var d=a[0],h=e[c];f.head?(d=k(d,g))?(h.next=d.next,d.next=h):(h.next=f.head,f.head=h):f.head=h;g.$$ngMessageNode=c;p++;f.reRender()}; +this.deregister=function(b){var d=b.$$ngMessageNode;delete b.$$ngMessageNode;var c=e[d];(b=k(a[0],b))?b.next=c.next:f.head=c.next;delete e[d];f.reRender()}}]}}]).directive("ngMessagesInclude",["$templateRequest","$document","$compile",function(d,n,l){return{restrict:"AE",require:"^^ngMessages",link:function(a,b,m){var k=m.ngMessagesInclude||m.src;d(k).then(function(d){l(d)(a,function(a){b.after(a);a=z(n[0].createComment(" ngMessagesInclude: "+k+" "));b.after(a);b.remove()})})}}}]).directive("ngMessage", +l()).directive("ngMessageExp",l())})(window,window.angular); +//# sourceMappingURL=angular-messages.min.js.map diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.min.js.map b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.min.js.map new file mode 100644 index 0000000..0cb2a94 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-messages.min.js.map @@ -0,0 +1,8 @@ +{ +"version":3, +"file":"angular-messages.min.js", +"lineCount":11, +"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CA0lBtCC,QAASA,EAAyB,EAAG,CACnC,MAAO,CAAC,UAAD,CAAa,QAAQ,CAACC,CAAD,CAAW,CACrC,MAAO,CACLC,SAAU,IADL,CAELC,WAAY,SAFP,CAGLC,SAAU,CAHL,CAILC,SAAU,CAAA,CAJL,CAKLC,QAAS,cALJ,CAMLC,KAAMA,QAAQ,CAACC,CAAD,CAAQC,CAAR,CAAiBC,CAAjB,CAAwBC,CAAxB,CAAwCC,CAAxC,CAAqD,CACjE,IAAIC,EAAcJ,CAAA,CAAQ,CAAR,CAAlB,CAEIK,CAFJ,CAGIC,EAAYL,CAAAM,UAAZD,EAA+BL,CAAAO,KAC/BC,EAAAA,CAAaR,CAAAS,aAAbD,EAAmCR,CAAAU,QACvC,KAAIC,EAAgBA,QAAQ,CAACC,CAAD,CAAQ,CAClCR,CAAA,CAAUQ,CAAA,CACHC,CAAA,CAAQD,CAAR,CAAA,CACKA,CADL,CAEKA,CAAAE,MAAA,CAAY,QAAZ,CAHF,CAIJ,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EArW7B,CAnPsC,CAArC,CAAD,CAyqBGH,MAzqBH,CAyqBWA,MAAAC,QAzqBX;", +"sources":["angular-messages.js"], +"names":["window","angular","undefined","ngMessageDirectiveFactory","$animate","restrict","transclude","priority","terminal","require","link","scope","element","attrs","ngMessagesCtrl","$transclude","commentNode","records","staticExp","ngMessage","when","dynamicExp","ngMessageExp","whenExp","assignRecords","items","isArray","split","reRender","$eval","$watchCollection","currentElement","messageCtrl","register","test","name","collection","indexOf","hasOwnProperty","attach","elm","enter","$$attachId","getAttachId","on","deregister","detach","leave","forEach","isString","jqLite","module","directive","isAttrTruthy","attr","length","truthy","val","controller","$element","$scope","$attrs","findPreviousMessage","parent","comment","prevNode","parentLookup","prevKey","$$ngMessageNode","messages","childNodes","push","previousSibling","parentNode","ctrl","latestKey","nextAttachId","this.getAttachId","renderLater","cachedCollection","render","this.render","multiple","ngMessagesMultiple","unmatchedMessages","matchedKeys","messageItem","head","messageFound","totalMessages","message","messageUsed","value","key","next","setClass","ACTIVE_CLASS","INACTIVE_CLASS","ngMessages","this.reRender","$evalAsync","this.register","nextKey","toString","messageNode","match","this.deregister","$templateRequest","$document","$compile","src","ngMessagesInclude","then","html","contents","after","anchor","createComment","remove"] +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-mocks.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-mocks.js new file mode 100644 index 0000000..34d3608 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-mocks.js @@ -0,0 +1,2842 @@ +/** + * @license AngularJS v1.5.0 + * (c) 2010-2016 Google, Inc. http://angularjs.org + * License: MIT + */ +(function(window, angular, undefined) { + +'use strict'; + +/** + * @ngdoc object + * @name angular.mock + * @description + * + * Namespace from 'angular-mocks.js' which contains testing related code. + */ +angular.mock = {}; + +/** + * ! This is a private undocumented service ! + * + * @name $browser + * + * @description + * This service is a mock implementation of {@link ng.$browser}. It provides fake + * implementation for commonly used browser apis that are hard to test, e.g. setTimeout, xhr, + * cookies, etc... + * + * The api of this service is the same as that of the real {@link ng.$browser $browser}, except + * that there are several helper methods available which can be used in tests. + */ +angular.mock.$BrowserProvider = function() { + this.$get = function() { + return new angular.mock.$Browser(); + }; +}; + +angular.mock.$Browser = function() { + var self = this; + + this.isMock = true; + self.$$url = "http://server/"; + self.$$lastUrl = self.$$url; // used by url polling fn + self.pollFns = []; + + // TODO(vojta): remove this temporary api + self.$$completeOutstandingRequest = angular.noop; + self.$$incOutstandingRequestCount = angular.noop; + + + // register url polling fn + + self.onUrlChange = function(listener) { + self.pollFns.push( + function() { + if (self.$$lastUrl !== self.$$url || self.$$state !== self.$$lastState) { + self.$$lastUrl = self.$$url; + self.$$lastState = self.$$state; + listener(self.$$url, self.$$state); + } + } + ); + + return listener; + }; + + self.$$applicationDestroyed = angular.noop; + self.$$checkUrlChange = angular.noop; + + self.deferredFns = []; + self.deferredNextId = 0; + + self.defer = function(fn, delay) { + delay = delay || 0; + self.deferredFns.push({time:(self.defer.now + delay), fn:fn, id: self.deferredNextId}); + self.deferredFns.sort(function(a, b) { return a.time - b.time;}); + return self.deferredNextId++; + }; + + + /** + * @name $browser#defer.now + * + * @description + * Current milliseconds mock time. + */ + self.defer.now = 0; + + + self.defer.cancel = function(deferId) { + var fnIndex; + + angular.forEach(self.deferredFns, function(fn, index) { + if (fn.id === deferId) fnIndex = index; + }); + + if (angular.isDefined(fnIndex)) { + self.deferredFns.splice(fnIndex, 1); + return true; + } + + return false; + }; + + + /** + * @name $browser#defer.flush + * + * @description + * Flushes all pending requests and executes the defer callbacks. + * + * @param {number=} number of milliseconds to flush. See {@link #defer.now} + */ + self.defer.flush = function(delay) { + if (angular.isDefined(delay)) { + self.defer.now += delay; + } else { + if (self.deferredFns.length) { + self.defer.now = self.deferredFns[self.deferredFns.length - 1].time; + } else { + throw new Error('No deferred tasks to be flushed'); + } + } + + while (self.deferredFns.length && self.deferredFns[0].time <= self.defer.now) { + self.deferredFns.shift().fn(); + } + }; + + self.$$baseHref = '/'; + self.baseHref = function() { + return this.$$baseHref; + }; +}; +angular.mock.$Browser.prototype = { + +/** + * @name $browser#poll + * + * @description + * run all fns in pollFns + */ + poll: function poll() { + angular.forEach(this.pollFns, function(pollFn) { + pollFn(); + }); + }, + + url: function(url, replace, state) { + if (angular.isUndefined(state)) { + state = null; + } + if (url) { + this.$$url = url; + // Native pushState serializes & copies the object; simulate it. + this.$$state = angular.copy(state); + return this; + } + + return this.$$url; + }, + + state: function() { + return this.$$state; + }, + + notifyWhenNoOutstandingRequests: function(fn) { + fn(); + } +}; + + +/** + * @ngdoc provider + * @name $exceptionHandlerProvider + * + * @description + * Configures the mock implementation of {@link ng.$exceptionHandler} to rethrow or to log errors + * passed to the `$exceptionHandler`. + */ + +/** + * @ngdoc service + * @name $exceptionHandler + * + * @description + * Mock implementation of {@link ng.$exceptionHandler} that rethrows or logs errors passed + * to it. See {@link ngMock.$exceptionHandlerProvider $exceptionHandlerProvider} for configuration + * information. + * + * + * ```js + * describe('$exceptionHandlerProvider', function() { + * + * it('should capture log messages and exceptions', function() { + * + * module(function($exceptionHandlerProvider) { + * $exceptionHandlerProvider.mode('log'); + * }); + * + * inject(function($log, $exceptionHandler, $timeout) { + * $timeout(function() { $log.log(1); }); + * $timeout(function() { $log.log(2); throw 'banana peel'; }); + * $timeout(function() { $log.log(3); }); + * expect($exceptionHandler.errors).toEqual([]); + * expect($log.assertEmpty()); + * $timeout.flush(); + * expect($exceptionHandler.errors).toEqual(['banana peel']); + * expect($log.log.logs).toEqual([[1], [2], [3]]); + * }); + * }); + * }); + * ``` + */ + +angular.mock.$ExceptionHandlerProvider = function() { + var handler; + + /** + * @ngdoc method + * @name $exceptionHandlerProvider#mode + * + * @description + * Sets the logging mode. + * + * @param {string} mode Mode of operation, defaults to `rethrow`. + * + * - `log`: Sometimes it is desirable to test that an error is thrown, for this case the `log` + * mode stores an array of errors in `$exceptionHandler.errors`, to allow later + * assertion of them. See {@link ngMock.$log#assertEmpty assertEmpty()} and + * {@link ngMock.$log#reset reset()} + * - `rethrow`: If any errors are passed to the handler in tests, it typically means that there + * is a bug in the application or test, so this mock will make these tests fail. + * For any implementations that expect exceptions to be thrown, the `rethrow` mode + * will also maintain a log of thrown errors. + */ + this.mode = function(mode) { + + switch (mode) { + case 'log': + case 'rethrow': + var errors = []; + handler = function(e) { + if (arguments.length == 1) { + errors.push(e); + } else { + errors.push([].slice.call(arguments, 0)); + } + if (mode === "rethrow") { + throw e; + } + }; + handler.errors = errors; + break; + default: + throw new Error("Unknown mode '" + mode + "', only 'log'/'rethrow' modes are allowed!"); + } + }; + + this.$get = function() { + return handler; + }; + + this.mode('rethrow'); +}; + + +/** + * @ngdoc service + * @name $log + * + * @description + * Mock implementation of {@link ng.$log} that gathers all logged messages in arrays + * (one array per logging level). These arrays are exposed as `logs` property of each of the + * level-specific log function, e.g. for level `error` the array is exposed as `$log.error.logs`. + * + */ +angular.mock.$LogProvider = function() { + var debug = true; + + function concat(array1, array2, index) { + return array1.concat(Array.prototype.slice.call(array2, index)); + } + + this.debugEnabled = function(flag) { + if (angular.isDefined(flag)) { + debug = flag; + return this; + } else { + return debug; + } + }; + + this.$get = function() { + var $log = { + log: function() { $log.log.logs.push(concat([], arguments, 0)); }, + warn: function() { $log.warn.logs.push(concat([], arguments, 0)); }, + info: function() { $log.info.logs.push(concat([], arguments, 0)); }, + error: function() { $log.error.logs.push(concat([], arguments, 0)); }, + debug: function() { + if (debug) { + $log.debug.logs.push(concat([], arguments, 0)); + } + } + }; + + /** + * @ngdoc method + * @name $log#reset + * + * @description + * Reset all of the logging arrays to empty. + */ + $log.reset = function() { + /** + * @ngdoc property + * @name $log#log.logs + * + * @description + * Array of messages logged using {@link ng.$log#log `log()`}. + * + * @example + * ```js + * $log.log('Some Log'); + * var first = $log.log.logs.unshift(); + * ``` + */ + $log.log.logs = []; + /** + * @ngdoc property + * @name $log#info.logs + * + * @description + * Array of messages logged using {@link ng.$log#info `info()`}. + * + * @example + * ```js + * $log.info('Some Info'); + * var first = $log.info.logs.unshift(); + * ``` + */ + $log.info.logs = []; + /** + * @ngdoc property + * @name $log#warn.logs + * + * @description + * Array of messages logged using {@link ng.$log#warn `warn()`}. + * + * @example + * ```js + * $log.warn('Some Warning'); + * var first = $log.warn.logs.unshift(); + * ``` + */ + $log.warn.logs = []; + /** + * @ngdoc property + * @name $log#error.logs + * + * @description + * Array of messages logged using {@link ng.$log#error `error()`}. + * + * @example + * ```js + * $log.error('Some Error'); + * var first = $log.error.logs.unshift(); + * ``` + */ + $log.error.logs = []; + /** + * @ngdoc property + * @name $log#debug.logs + * + * @description + * Array of messages logged using {@link ng.$log#debug `debug()`}. + * + * @example + * ```js + * $log.debug('Some Error'); + * var first = $log.debug.logs.unshift(); + * ``` + */ + $log.debug.logs = []; + }; + + /** + * @ngdoc method + * @name $log#assertEmpty + * + * @description + * Assert that all of the logging methods have no logged messages. If any messages are present, + * an exception is thrown. + */ + $log.assertEmpty = function() { + var errors = []; + angular.forEach(['error', 'warn', 'info', 'log', 'debug'], function(logLevel) { + angular.forEach($log[logLevel].logs, function(log) { + angular.forEach(log, function(logItem) { + errors.push('MOCK $log (' + logLevel + '): ' + String(logItem) + '\n' + + (logItem.stack || '')); + }); + }); + }); + if (errors.length) { + errors.unshift("Expected $log to be empty! Either a message was logged unexpectedly, or " + + "an expected log message was not checked and removed:"); + errors.push(''); + throw new Error(errors.join('\n---------\n')); + } + }; + + $log.reset(); + return $log; + }; +}; + + +/** + * @ngdoc service + * @name $interval + * + * @description + * Mock implementation of the $interval service. + * + * Use {@link ngMock.$interval#flush `$interval.flush(millis)`} to + * move forward by `millis` milliseconds and trigger any functions scheduled to run in that + * time. + * + * @param {function()} fn A function that should be called repeatedly. + * @param {number} delay Number of milliseconds between each function call. + * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat + * indefinitely. + * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise + * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block. + * @param {...*=} Pass additional parameters to the executed function. + * @returns {promise} A promise which will be notified on each iteration. + */ +angular.mock.$IntervalProvider = function() { + this.$get = ['$browser', '$rootScope', '$q', '$$q', + function($browser, $rootScope, $q, $$q) { + var repeatFns = [], + nextRepeatId = 0, + now = 0; + + var $interval = function(fn, delay, count, invokeApply) { + var hasParams = arguments.length > 4, + args = hasParams ? Array.prototype.slice.call(arguments, 4) : [], + iteration = 0, + skipApply = (angular.isDefined(invokeApply) && !invokeApply), + deferred = (skipApply ? $$q : $q).defer(), + promise = deferred.promise; + + count = (angular.isDefined(count)) ? count : 0; + promise.then(null, null, (!hasParams) ? fn : function() { + fn.apply(null, args); + }); + + promise.$$intervalId = nextRepeatId; + + function tick() { + deferred.notify(iteration++); + + if (count > 0 && iteration >= count) { + var fnIndex; + deferred.resolve(iteration); + + angular.forEach(repeatFns, function(fn, index) { + if (fn.id === promise.$$intervalId) fnIndex = index; + }); + + if (angular.isDefined(fnIndex)) { + repeatFns.splice(fnIndex, 1); + } + } + + if (skipApply) { + $browser.defer.flush(); + } else { + $rootScope.$apply(); + } + } + + repeatFns.push({ + nextTime:(now + delay), + delay: delay, + fn: tick, + id: nextRepeatId, + deferred: deferred + }); + repeatFns.sort(function(a, b) { return a.nextTime - b.nextTime;}); + + nextRepeatId++; + return promise; + }; + /** + * @ngdoc method + * @name $interval#cancel + * + * @description + * Cancels a task associated with the `promise`. + * + * @param {promise} promise A promise from calling the `$interval` function. + * @returns {boolean} Returns `true` if the task was successfully cancelled. + */ + $interval.cancel = function(promise) { + if (!promise) return false; + var fnIndex; + + angular.forEach(repeatFns, function(fn, index) { + if (fn.id === promise.$$intervalId) fnIndex = index; + }); + + if (angular.isDefined(fnIndex)) { + repeatFns[fnIndex].deferred.reject('canceled'); + repeatFns.splice(fnIndex, 1); + return true; + } + + return false; + }; + + /** + * @ngdoc method + * @name $interval#flush + * @description + * + * Runs interval tasks scheduled to be run in the next `millis` milliseconds. + * + * @param {number=} millis maximum timeout amount to flush up until. + * + * @return {number} The amount of time moved forward. + */ + $interval.flush = function(millis) { + now += millis; + while (repeatFns.length && repeatFns[0].nextTime <= now) { + var task = repeatFns[0]; + task.fn(); + task.nextTime += task.delay; + repeatFns.sort(function(a, b) { return a.nextTime - b.nextTime;}); + } + return millis; + }; + + return $interval; + }]; +}; + + +/* jshint -W101 */ +/* The R_ISO8061_STR regex is never going to fit into the 100 char limit! + * This directive should go inside the anonymous function but a bug in JSHint means that it would + * not be enacted early enough to prevent the warning. + */ +var R_ISO8061_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?:\:?(\d\d)(?:\:?(\d\d)(?:\.(\d{3}))?)?)?(Z|([+-])(\d\d):?(\d\d)))?$/; + +function jsonStringToDate(string) { + var match; + if (match = string.match(R_ISO8061_STR)) { + var date = new Date(0), + tzHour = 0, + tzMin = 0; + if (match[9]) { + tzHour = toInt(match[9] + match[10]); + tzMin = toInt(match[9] + match[11]); + } + date.setUTCFullYear(toInt(match[1]), toInt(match[2]) - 1, toInt(match[3])); + date.setUTCHours(toInt(match[4] || 0) - tzHour, + toInt(match[5] || 0) - tzMin, + toInt(match[6] || 0), + toInt(match[7] || 0)); + return date; + } + return string; +} + +function toInt(str) { + return parseInt(str, 10); +} + +function padNumber(num, digits, trim) { + var neg = ''; + if (num < 0) { + neg = '-'; + num = -num; + } + num = '' + num; + while (num.length < digits) num = '0' + num; + if (trim) { + num = num.substr(num.length - digits); + } + return neg + num; +} + + +/** + * @ngdoc type + * @name angular.mock.TzDate + * @description + * + * *NOTE*: this is not an injectable instance, just a globally available mock class of `Date`. + * + * Mock of the Date type which has its timezone specified via constructor arg. + * + * The main purpose is to create Date-like instances with timezone fixed to the specified timezone + * offset, so that we can test code that depends on local timezone settings without dependency on + * the time zone settings of the machine where the code is running. + * + * @param {number} offset Offset of the *desired* timezone in hours (fractions will be honored) + * @param {(number|string)} timestamp Timestamp representing the desired time in *UTC* + * + * @example + * !!!! WARNING !!!!! + * This is not a complete Date object so only methods that were implemented can be called safely. + * To make matters worse, TzDate instances inherit stuff from Date via a prototype. + * + * We do our best to intercept calls to "unimplemented" methods, but since the list of methods is + * incomplete we might be missing some non-standard methods. This can result in errors like: + * "Date.prototype.foo called on incompatible Object". + * + * ```js + * var newYearInBratislava = new TzDate(-1, '2009-12-31T23:00:00Z'); + * newYearInBratislava.getTimezoneOffset() => -60; + * newYearInBratislava.getFullYear() => 2010; + * newYearInBratislava.getMonth() => 0; + * newYearInBratislava.getDate() => 1; + * newYearInBratislava.getHours() => 0; + * newYearInBratislava.getMinutes() => 0; + * newYearInBratislava.getSeconds() => 0; + * ``` + * + */ +angular.mock.TzDate = function(offset, timestamp) { + var self = new Date(0); + if (angular.isString(timestamp)) { + var tsStr = timestamp; + + self.origDate = jsonStringToDate(timestamp); + + timestamp = self.origDate.getTime(); + if (isNaN(timestamp)) { + throw { + name: "Illegal Argument", + message: "Arg '" + tsStr + "' passed into TzDate constructor is not a valid date string" + }; + } + } else { + self.origDate = new Date(timestamp); + } + + var localOffset = new Date(timestamp).getTimezoneOffset(); + self.offsetDiff = localOffset * 60 * 1000 - offset * 1000 * 60 * 60; + self.date = new Date(timestamp + self.offsetDiff); + + self.getTime = function() { + return self.date.getTime() - self.offsetDiff; + }; + + self.toLocaleDateString = function() { + return self.date.toLocaleDateString(); + }; + + self.getFullYear = function() { + return self.date.getFullYear(); + }; + + self.getMonth = function() { + return self.date.getMonth(); + }; + + self.getDate = function() { + return self.date.getDate(); + }; + + self.getHours = function() { + return self.date.getHours(); + }; + + self.getMinutes = function() { + return self.date.getMinutes(); + }; + + self.getSeconds = function() { + return self.date.getSeconds(); + }; + + self.getMilliseconds = function() { + return self.date.getMilliseconds(); + }; + + self.getTimezoneOffset = function() { + return offset * 60; + }; + + self.getUTCFullYear = function() { + return self.origDate.getUTCFullYear(); + }; + + self.getUTCMonth = function() { + return self.origDate.getUTCMonth(); + }; + + self.getUTCDate = function() { + return self.origDate.getUTCDate(); + }; + + self.getUTCHours = function() { + return self.origDate.getUTCHours(); + }; + + self.getUTCMinutes = function() { + return self.origDate.getUTCMinutes(); + }; + + self.getUTCSeconds = function() { + return self.origDate.getUTCSeconds(); + }; + + self.getUTCMilliseconds = function() { + return self.origDate.getUTCMilliseconds(); + }; + + self.getDay = function() { + return self.date.getDay(); + }; + + // provide this method only on browsers that already have it + if (self.toISOString) { + self.toISOString = function() { + return padNumber(self.origDate.getUTCFullYear(), 4) + '-' + + padNumber(self.origDate.getUTCMonth() + 1, 2) + '-' + + padNumber(self.origDate.getUTCDate(), 2) + 'T' + + padNumber(self.origDate.getUTCHours(), 2) + ':' + + padNumber(self.origDate.getUTCMinutes(), 2) + ':' + + padNumber(self.origDate.getUTCSeconds(), 2) + '.' + + padNumber(self.origDate.getUTCMilliseconds(), 3) + 'Z'; + }; + } + + //hide all methods not implemented in this mock that the Date prototype exposes + var unimplementedMethods = ['getUTCDay', + 'getYear', 'setDate', 'setFullYear', 'setHours', 'setMilliseconds', + 'setMinutes', 'setMonth', 'setSeconds', 'setTime', 'setUTCDate', 'setUTCFullYear', + 'setUTCHours', 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', + 'setYear', 'toDateString', 'toGMTString', 'toJSON', 'toLocaleFormat', 'toLocaleString', + 'toLocaleTimeString', 'toSource', 'toString', 'toTimeString', 'toUTCString', 'valueOf']; + + angular.forEach(unimplementedMethods, function(methodName) { + self[methodName] = function() { + throw new Error("Method '" + methodName + "' is not implemented in the TzDate mock"); + }; + }); + + return self; +}; + +//make "tzDateInstance instanceof Date" return true +angular.mock.TzDate.prototype = Date.prototype; +/* jshint +W101 */ + + +/** + * @ngdoc service + * @name $animate + * + * @description + * Mock implementation of the {@link ng.$animate `$animate`} service. Exposes two additional methods + * for testing animations. + */ +angular.mock.animate = angular.module('ngAnimateMock', ['ng']) + + .config(['$provide', function($provide) { + + $provide.factory('$$forceReflow', function() { + function reflowFn() { + reflowFn.totalReflows++; + } + reflowFn.totalReflows = 0; + return reflowFn; + }); + + $provide.factory('$$animateAsyncRun', function() { + var queue = []; + var queueFn = function() { + return function(fn) { + queue.push(fn); + }; + }; + queueFn.flush = function() { + if (queue.length === 0) return false; + + for (var i = 0; i < queue.length; i++) { + queue[i](); + } + queue = []; + + return true; + }; + return queueFn; + }); + + $provide.decorator('$$animateJs', ['$delegate', function($delegate) { + var runners = []; + + var animateJsConstructor = function() { + var animator = $delegate.apply($delegate, arguments); + // If no javascript animation is found, animator is undefined + if (animator) { + runners.push(animator); + } + return animator; + }; + + animateJsConstructor.$closeAndFlush = function() { + runners.forEach(function(runner) { + runner.end(); + }); + runners = []; + }; + + return animateJsConstructor; + }]); + + $provide.decorator('$animateCss', ['$delegate', function($delegate) { + var runners = []; + + var animateCssConstructor = function(element, options) { + var animator = $delegate(element, options); + runners.push(animator); + return animator; + }; + + animateCssConstructor.$closeAndFlush = function() { + runners.forEach(function(runner) { + runner.end(); + }); + runners = []; + }; + + return animateCssConstructor; + }]); + + $provide.decorator('$animate', ['$delegate', '$timeout', '$browser', '$$rAF', '$animateCss', '$$animateJs', + '$$forceReflow', '$$animateAsyncRun', '$rootScope', + function($delegate, $timeout, $browser, $$rAF, $animateCss, $$animateJs, + $$forceReflow, $$animateAsyncRun, $rootScope) { + var animate = { + queue: [], + cancel: $delegate.cancel, + on: $delegate.on, + off: $delegate.off, + pin: $delegate.pin, + get reflows() { + return $$forceReflow.totalReflows; + }, + enabled: $delegate.enabled, + /** + * @ngdoc method + * @name $animate#closeAndFlush + * @description + * + * This method will close all pending animations (both {@link ngAnimate#javascript-based-animations Javascript} + * and {@link ngAnimate.$animateCss CSS}) and it will also flush any remaining animation frames and/or callbacks. + */ + closeAndFlush: function() { + // we allow the flush command to swallow the errors + // because depending on whether CSS or JS animations are + // used, there may not be a RAF flush. The primary flush + // at the end of this function must throw an exception + // because it will track if there were pending animations + this.flush(true); + $animateCss.$closeAndFlush(); + $$animateJs.$closeAndFlush(); + this.flush(); + }, + /** + * @ngdoc method + * @name $animate#flush + * @description + * + * This method is used to flush the pending callbacks and animation frames to either start + * an animation or conclude an animation. Note that this will not actually close an + * actively running animation (see {@link ngMock.$animate#closeAndFlush `closeAndFlush()`} for that). + */ + flush: function(hideErrors) { + $rootScope.$digest(); + + var doNextRun, somethingFlushed = false; + do { + doNextRun = false; + + if ($$rAF.queue.length) { + $$rAF.flush(); + doNextRun = somethingFlushed = true; + } + + if ($$animateAsyncRun.flush()) { + doNextRun = somethingFlushed = true; + } + } while (doNextRun); + + if (!somethingFlushed && !hideErrors) { + throw new Error('No pending animations ready to be closed or flushed'); + } + + $rootScope.$digest(); + } + }; + + angular.forEach( + ['animate','enter','leave','move','addClass','removeClass','setClass'], function(method) { + animate[method] = function() { + animate.queue.push({ + event: method, + element: arguments[0], + options: arguments[arguments.length - 1], + args: arguments + }); + return $delegate[method].apply($delegate, arguments); + }; + }); + + return animate; + }]); + + }]); + + +/** + * @ngdoc function + * @name angular.mock.dump + * @description + * + * *NOTE*: this is not an injectable instance, just a globally available function. + * + * Method for serializing common angular objects (scope, elements, etc..) into strings, useful for + * debugging. + * + * This method is also available on window, where it can be used to display objects on debug + * console. + * + * @param {*} object - any object to turn into string. + * @return {string} a serialized string of the argument + */ +angular.mock.dump = function(object) { + return serialize(object); + + function serialize(object) { + var out; + + if (angular.isElement(object)) { + object = angular.element(object); + out = angular.element('
    '); + angular.forEach(object, function(element) { + out.append(angular.element(element).clone()); + }); + out = out.html(); + } else if (angular.isArray(object)) { + out = []; + angular.forEach(object, function(o) { + out.push(serialize(o)); + }); + out = '[ ' + out.join(', ') + ' ]'; + } else if (angular.isObject(object)) { + if (angular.isFunction(object.$eval) && angular.isFunction(object.$apply)) { + out = serializeScope(object); + } else if (object instanceof Error) { + out = object.stack || ('' + object.name + ': ' + object.message); + } else { + // TODO(i): this prevents methods being logged, + // we should have a better way to serialize objects + out = angular.toJson(object, true); + } + } else { + out = String(object); + } + + return out; + } + + function serializeScope(scope, offset) { + offset = offset || ' '; + var log = [offset + 'Scope(' + scope.$id + '): {']; + for (var key in scope) { + if (Object.prototype.hasOwnProperty.call(scope, key) && !key.match(/^(\$|this)/)) { + log.push(' ' + key + ': ' + angular.toJson(scope[key])); + } + } + var child = scope.$$childHead; + while (child) { + log.push(serializeScope(child, offset + ' ')); + child = child.$$nextSibling; + } + log.push('}'); + return log.join('\n' + offset); + } +}; + +/** + * @ngdoc service + * @name $httpBackend + * @description + * Fake HTTP backend implementation suitable for unit testing applications that use the + * {@link ng.$http $http service}. + * + * *Note*: For fake HTTP backend implementation suitable for end-to-end testing or backend-less + * development please see {@link ngMockE2E.$httpBackend e2e $httpBackend mock}. + * + * During unit testing, we want our unit tests to run quickly and have no external dependencies so + * we don’t want to send [XHR](https://developer.mozilla.org/en/xmlhttprequest) or + * [JSONP](http://en.wikipedia.org/wiki/JSONP) requests to a real server. All we really need is + * to verify whether a certain request has been sent or not, or alternatively just let the + * application make requests, respond with pre-trained responses and assert that the end result is + * what we expect it to be. + * + * This mock implementation can be used to respond with static or dynamic responses via the + * `expect` and `when` apis and their shortcuts (`expectGET`, `whenPOST`, etc). + * + * When an Angular application needs some data from a server, it calls the $http service, which + * sends the request to a real server using $httpBackend service. With dependency injection, it is + * easy to inject $httpBackend mock (which has the same API as $httpBackend) and use it to verify + * the requests and respond with some testing data without sending a request to a real server. + * + * There are two ways to specify what test data should be returned as http responses by the mock + * backend when the code under test makes http requests: + * + * - `$httpBackend.expect` - specifies a request expectation + * - `$httpBackend.when` - specifies a backend definition + * + * + * ## Request Expectations vs Backend Definitions + * + * Request expectations provide a way to make assertions about requests made by the application and + * to define responses for those requests. The test will fail if the expected requests are not made + * or they are made in the wrong order. + * + * Backend definitions allow you to define a fake backend for your application which doesn't assert + * if a particular request was made or not, it just returns a trained response if a request is made. + * The test will pass whether or not the request gets made during testing. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Request expectationsBackend definitions
    Syntax.expect(...).respond(...).when(...).respond(...)
    Typical usagestrict unit testsloose (black-box) unit testing
    Fulfills multiple requestsNOYES
    Order of requests mattersYESNO
    Request requiredYESNO
    Response requiredoptional (see below)YES
    + * + * In cases where both backend definitions and request expectations are specified during unit + * testing, the request expectations are evaluated first. + * + * If a request expectation has no response specified, the algorithm will search your backend + * definitions for an appropriate response. + * + * If a request didn't match any expectation or if the expectation doesn't have the response + * defined, the backend definitions are evaluated in sequential order to see if any of them match + * the request. The response from the first matched definition is returned. + * + * + * ## Flushing HTTP requests + * + * The $httpBackend used in production always responds to requests asynchronously. If we preserved + * this behavior in unit testing, we'd have to create async unit tests, which are hard to write, + * to follow and to maintain. But neither can the testing mock respond synchronously; that would + * change the execution of the code under test. For this reason, the mock $httpBackend has a + * `flush()` method, which allows the test to explicitly flush pending requests. This preserves + * the async api of the backend, while allowing the test to execute synchronously. + * + * + * ## Unit testing with mock $httpBackend + * The following code shows how to setup and use the mock backend when unit testing a controller. + * First we create the controller under test: + * + ```js + // The module code + angular + .module('MyApp', []) + .controller('MyController', MyController); + + // The controller code + function MyController($scope, $http) { + var authToken; + + $http.get('/auth.py').then(function(response) { + authToken = response.headers('A-Token'); + $scope.user = response.data; + }); + + $scope.saveMessage = function(message) { + var headers = { 'Authorization': authToken }; + $scope.status = 'Saving...'; + + $http.post('/add-msg.py', message, { headers: headers } ).then(function(response) { + $scope.status = ''; + }).catch(function() { + $scope.status = 'Failed...'; + }); + }; + } + ``` + * + * Now we setup the mock backend and create the test specs: + * + ```js + // testing controller + describe('MyController', function() { + var $httpBackend, $rootScope, createController, authRequestHandler; + + // Set up the module + beforeEach(module('MyApp')); + + beforeEach(inject(function($injector) { + // Set up the mock http service responses + $httpBackend = $injector.get('$httpBackend'); + // backend definition common for all tests + authRequestHandler = $httpBackend.when('GET', '/auth.py') + .respond({userId: 'userX'}, {'A-Token': 'xxx'}); + + // Get hold of a scope (i.e. the root scope) + $rootScope = $injector.get('$rootScope'); + // The $controller service is used to create instances of controllers + var $controller = $injector.get('$controller'); + + createController = function() { + return $controller('MyController', {'$scope' : $rootScope }); + }; + })); + + + afterEach(function() { + $httpBackend.verifyNoOutstandingExpectation(); + $httpBackend.verifyNoOutstandingRequest(); + }); + + + it('should fetch authentication token', function() { + $httpBackend.expectGET('/auth.py'); + var controller = createController(); + $httpBackend.flush(); + }); + + + it('should fail authentication', function() { + + // Notice how you can change the response even after it was set + authRequestHandler.respond(401, ''); + + $httpBackend.expectGET('/auth.py'); + var controller = createController(); + $httpBackend.flush(); + expect($rootScope.status).toBe('Failed...'); + }); + + + it('should send msg to server', function() { + var controller = createController(); + $httpBackend.flush(); + + // now you don’t care about the authentication, but + // the controller will still send the request and + // $httpBackend will respond without you having to + // specify the expectation and response for this request + + $httpBackend.expectPOST('/add-msg.py', 'message content').respond(201, ''); + $rootScope.saveMessage('message content'); + expect($rootScope.status).toBe('Saving...'); + $httpBackend.flush(); + expect($rootScope.status).toBe(''); + }); + + + it('should send auth header', function() { + var controller = createController(); + $httpBackend.flush(); + + $httpBackend.expectPOST('/add-msg.py', undefined, function(headers) { + // check if the header was sent, if it wasn't the expectation won't + // match the request and the test will fail + return headers['Authorization'] == 'xxx'; + }).respond(201, ''); + + $rootScope.saveMessage('whatever'); + $httpBackend.flush(); + }); + }); + ``` + * + * ## Dynamic responses + * + * You define a response to a request by chaining a call to `respond()` onto a definition or expectation. + * If you provide a **callback** as the first parameter to `respond(callback)` then you can dynamically generate + * a response based on the properties of the request. + * + * The `callback` function should be of the form `function(method, url, data, headers, params)`. + * + * ### Query parameters + * + * By default, query parameters on request URLs are parsed into the `params` object. So a request URL + * of `/list?q=searchstr&orderby=-name` would set `params` to be `{q: 'searchstr', orderby: '-name'}`. + * + * ### Regex parameter matching + * + * If an expectation or definition uses a **regex** to match the URL, you can provide an array of **keys** via a + * `params` argument. The index of each **key** in the array will match the index of a **group** in the + * **regex**. + * + * The `params` object in the **callback** will now have properties with these keys, which hold the value of the + * corresponding **group** in the **regex**. + * + * This also applies to the `when` and `expect` shortcut methods. + * + * + * ```js + * $httpBackend.expect('GET', /\/user\/(.+)/, undefined, undefined, ['id']) + * .respond(function(method, url, data, headers, params) { + * // for requested url of '/user/1234' params is {id: '1234'} + * }); + * + * $httpBackend.whenPATCH(/\/user\/(.+)\/article\/(.+)/, undefined, undefined, ['user', 'article']) + * .respond(function(method, url, data, headers, params) { + * // for url of '/user/1234/article/567' params is {user: '1234', article: '567'} + * }); + * ``` + * + * ## Matching route requests + * + * For extra convenience, `whenRoute` and `expectRoute` shortcuts are available. These methods offer colon + * delimited matching of the url path, ignoring the query string. This allows declarations + * similar to how application routes are configured with `$routeProvider`. Because these methods convert + * the definition url to regex, declaration order is important. Combined with query parameter parsing, + * the following is possible: + * + ```js + $httpBackend.whenRoute('GET', '/users/:id') + .respond(function(method, url, data, headers, params) { + return [200, MockUserList[Number(params.id)]]; + }); + + $httpBackend.whenRoute('GET', '/users') + .respond(function(method, url, data, headers, params) { + var userList = angular.copy(MockUserList), + defaultSort = 'lastName', + count, pages, isPrevious, isNext; + + // paged api response '/v1/users?page=2' + params.page = Number(params.page) || 1; + + // query for last names '/v1/users?q=Archer' + if (params.q) { + userList = $filter('filter')({lastName: params.q}); + } + + pages = Math.ceil(userList.length / pagingLength); + isPrevious = params.page > 1; + isNext = params.page < pages; + + return [200, { + count: userList.length, + previous: isPrevious, + next: isNext, + // sort field -> '/v1/users?sortBy=firstName' + results: $filter('orderBy')(userList, params.sortBy || defaultSort) + .splice((params.page - 1) * pagingLength, pagingLength) + }]; + }); + ``` + */ +angular.mock.$HttpBackendProvider = function() { + this.$get = ['$rootScope', '$timeout', createHttpBackendMock]; +}; + +/** + * General factory function for $httpBackend mock. + * Returns instance for unit testing (when no arguments specified): + * - passing through is disabled + * - auto flushing is disabled + * + * Returns instance for e2e testing (when `$delegate` and `$browser` specified): + * - passing through (delegating request to real backend) is enabled + * - auto flushing is enabled + * + * @param {Object=} $delegate Real $httpBackend instance (allow passing through if specified) + * @param {Object=} $browser Auto-flushing enabled if specified + * @return {Object} Instance of $httpBackend mock + */ +function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) { + var definitions = [], + expectations = [], + responses = [], + responsesPush = angular.bind(responses, responses.push), + copy = angular.copy; + + function createResponse(status, data, headers, statusText) { + if (angular.isFunction(status)) return status; + + return function() { + return angular.isNumber(status) + ? [status, data, headers, statusText] + : [200, status, data, headers]; + }; + } + + // TODO(vojta): change params to: method, url, data, headers, callback + function $httpBackend(method, url, data, callback, headers, timeout, withCredentials) { + var xhr = new MockXhr(), + expectation = expectations[0], + wasExpected = false; + + function prettyPrint(data) { + return (angular.isString(data) || angular.isFunction(data) || data instanceof RegExp) + ? data + : angular.toJson(data); + } + + function wrapResponse(wrapped) { + if (!$browser && timeout) { + timeout.then ? timeout.then(handleTimeout) : $timeout(handleTimeout, timeout); + } + + return handleResponse; + + function handleResponse() { + var response = wrapped.response(method, url, data, headers, wrapped.params(url)); + xhr.$$respHeaders = response[2]; + callback(copy(response[0]), copy(response[1]), xhr.getAllResponseHeaders(), + copy(response[3] || '')); + } + + function handleTimeout() { + for (var i = 0, ii = responses.length; i < ii; i++) { + if (responses[i] === handleResponse) { + responses.splice(i, 1); + callback(-1, undefined, ''); + break; + } + } + } + } + + if (expectation && expectation.match(method, url)) { + if (!expectation.matchData(data)) { + throw new Error('Expected ' + expectation + ' with different data\n' + + 'EXPECTED: ' + prettyPrint(expectation.data) + '\nGOT: ' + data); + } + + if (!expectation.matchHeaders(headers)) { + throw new Error('Expected ' + expectation + ' with different headers\n' + + 'EXPECTED: ' + prettyPrint(expectation.headers) + '\nGOT: ' + + prettyPrint(headers)); + } + + expectations.shift(); + + if (expectation.response) { + responses.push(wrapResponse(expectation)); + return; + } + wasExpected = true; + } + + var i = -1, definition; + while ((definition = definitions[++i])) { + if (definition.match(method, url, data, headers || {})) { + if (definition.response) { + // if $browser specified, we do auto flush all requests + ($browser ? $browser.defer : responsesPush)(wrapResponse(definition)); + } else if (definition.passThrough) { + $delegate(method, url, data, callback, headers, timeout, withCredentials); + } else throw new Error('No response defined !'); + return; + } + } + throw wasExpected ? + new Error('No response defined !') : + new Error('Unexpected request: ' + method + ' ' + url + '\n' + + (expectation ? 'Expected ' + expectation : 'No more request expected')); + } + + /** + * @ngdoc method + * @name $httpBackend#when + * @description + * Creates a new backend definition. + * + * @param {string} method HTTP method. + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(string|RegExp|function(string))=} data HTTP request body or function that receives + * data string and returns true if the data is as expected. + * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header + * object and returns true if the headers match the current definition. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. + * @returns {requestHandler} Returns an object with `respond` method that controls how a matched + * request is handled. You can save this object for later use and invoke `respond` again in + * order to change how a matched request is handled. + * + * - respond – + * `{function([status,] data[, headers, statusText]) + * | function(function(method, url, data, headers, params)}` + * – The respond method takes a set of static data to be returned or a function that can + * return an array containing response status (number), response data (string), response + * headers (Object), and the text for the status (string). The respond method returns the + * `requestHandler` object for possible overrides. + */ + $httpBackend.when = function(method, url, data, headers, keys) { + var definition = new MockHttpExpectation(method, url, data, headers, keys), + chain = { + respond: function(status, data, headers, statusText) { + definition.passThrough = undefined; + definition.response = createResponse(status, data, headers, statusText); + return chain; + } + }; + + if ($browser) { + chain.passThrough = function() { + definition.response = undefined; + definition.passThrough = true; + return chain; + }; + } + + definitions.push(definition); + return chain; + }; + + /** + * @ngdoc method + * @name $httpBackend#whenGET + * @description + * Creates a new backend definition for GET requests. For more info see `when()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(Object|function(Object))=} headers HTTP headers. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. + * @returns {requestHandler} Returns an object with `respond` method that controls how a matched + * request is handled. You can save this object for later use and invoke `respond` again in + * order to change how a matched request is handled. + */ + + /** + * @ngdoc method + * @name $httpBackend#whenHEAD + * @description + * Creates a new backend definition for HEAD requests. For more info see `when()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(Object|function(Object))=} headers HTTP headers. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. + * @returns {requestHandler} Returns an object with `respond` method that controls how a matched + * request is handled. You can save this object for later use and invoke `respond` again in + * order to change how a matched request is handled. + */ + + /** + * @ngdoc method + * @name $httpBackend#whenDELETE + * @description + * Creates a new backend definition for DELETE requests. For more info see `when()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(Object|function(Object))=} headers HTTP headers. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. + * @returns {requestHandler} Returns an object with `respond` method that controls how a matched + * request is handled. You can save this object for later use and invoke `respond` again in + * order to change how a matched request is handled. + */ + + /** + * @ngdoc method + * @name $httpBackend#whenPOST + * @description + * Creates a new backend definition for POST requests. For more info see `when()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(string|RegExp|function(string))=} data HTTP request body or function that receives + * data string and returns true if the data is as expected. + * @param {(Object|function(Object))=} headers HTTP headers. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. + * @returns {requestHandler} Returns an object with `respond` method that controls how a matched + * request is handled. You can save this object for later use and invoke `respond` again in + * order to change how a matched request is handled. + */ + + /** + * @ngdoc method + * @name $httpBackend#whenPUT + * @description + * Creates a new backend definition for PUT requests. For more info see `when()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(string|RegExp|function(string))=} data HTTP request body or function that receives + * data string and returns true if the data is as expected. + * @param {(Object|function(Object))=} headers HTTP headers. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. + * @returns {requestHandler} Returns an object with `respond` method that controls how a matched + * request is handled. You can save this object for later use and invoke `respond` again in + * order to change how a matched request is handled. + */ + + /** + * @ngdoc method + * @name $httpBackend#whenJSONP + * @description + * Creates a new backend definition for JSONP requests. For more info see `when()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. + * @returns {requestHandler} Returns an object with `respond` method that controls how a matched + * request is handled. You can save this object for later use and invoke `respond` again in + * order to change how a matched request is handled. + */ + createShortMethods('when'); + + /** + * @ngdoc method + * @name $httpBackend#whenRoute + * @description + * Creates a new backend definition that compares only with the requested route. + * + * @param {string} method HTTP method. + * @param {string} url HTTP url string that supports colon param matching. + * @returns {requestHandler} Returns an object with `respond` method that controls how a matched + * request is handled. You can save this object for later use and invoke `respond` again in + * order to change how a matched request is handled. See #when for more info. + */ + $httpBackend.whenRoute = function(method, url) { + var pathObj = parseRoute(url); + return $httpBackend.when(method, pathObj.regexp, undefined, undefined, pathObj.keys); + }; + + function parseRoute(url) { + var ret = { + regexp: url + }, + keys = ret.keys = []; + + if (!url || !angular.isString(url)) return ret; + + url = url + .replace(/([().])/g, '\\$1') + .replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option) { + var optional = option === '?' ? option : null; + var star = option === '*' ? option : null; + keys.push({ name: key, optional: !!optional }); + slash = slash || ''; + return '' + + (optional ? '' : slash) + + '(?:' + + (optional ? slash : '') + + (star && '(.+?)' || '([^/]+)') + + (optional || '') + + ')' + + (optional || ''); + }) + .replace(/([\/$\*])/g, '\\$1'); + + ret.regexp = new RegExp('^' + url, 'i'); + return ret; + } + + /** + * @ngdoc method + * @name $httpBackend#expect + * @description + * Creates a new request expectation. + * + * @param {string} method HTTP method. + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that + * receives data string and returns true if the data is as expected, or Object if request body + * is in JSON format. + * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header + * object and returns true if the headers match the current expectation. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. + * @returns {requestHandler} Returns an object with `respond` method that controls how a matched + * request is handled. You can save this object for later use and invoke `respond` again in + * order to change how a matched request is handled. + * + * - respond – + * `{function([status,] data[, headers, statusText]) + * | function(function(method, url, data, headers, params)}` + * – The respond method takes a set of static data to be returned or a function that can + * return an array containing response status (number), response data (string), response + * headers (Object), and the text for the status (string). The respond method returns the + * `requestHandler` object for possible overrides. + */ + $httpBackend.expect = function(method, url, data, headers, keys) { + var expectation = new MockHttpExpectation(method, url, data, headers, keys), + chain = { + respond: function(status, data, headers, statusText) { + expectation.response = createResponse(status, data, headers, statusText); + return chain; + } + }; + + expectations.push(expectation); + return chain; + }; + + /** + * @ngdoc method + * @name $httpBackend#expectGET + * @description + * Creates a new request expectation for GET requests. For more info see `expect()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {Object=} headers HTTP headers. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. + * @returns {requestHandler} Returns an object with `respond` method that controls how a matched + * request is handled. You can save this object for later use and invoke `respond` again in + * order to change how a matched request is handled. See #expect for more info. + */ + + /** + * @ngdoc method + * @name $httpBackend#expectHEAD + * @description + * Creates a new request expectation for HEAD requests. For more info see `expect()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {Object=} headers HTTP headers. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. + * @returns {requestHandler} Returns an object with `respond` method that controls how a matched + * request is handled. You can save this object for later use and invoke `respond` again in + * order to change how a matched request is handled. + */ + + /** + * @ngdoc method + * @name $httpBackend#expectDELETE + * @description + * Creates a new request expectation for DELETE requests. For more info see `expect()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {Object=} headers HTTP headers. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. + * @returns {requestHandler} Returns an object with `respond` method that controls how a matched + * request is handled. You can save this object for later use and invoke `respond` again in + * order to change how a matched request is handled. + */ + + /** + * @ngdoc method + * @name $httpBackend#expectPOST + * @description + * Creates a new request expectation for POST requests. For more info see `expect()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that + * receives data string and returns true if the data is as expected, or Object if request body + * is in JSON format. + * @param {Object=} headers HTTP headers. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. + * @returns {requestHandler} Returns an object with `respond` method that controls how a matched + * request is handled. You can save this object for later use and invoke `respond` again in + * order to change how a matched request is handled. + */ + + /** + * @ngdoc method + * @name $httpBackend#expectPUT + * @description + * Creates a new request expectation for PUT requests. For more info see `expect()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that + * receives data string and returns true if the data is as expected, or Object if request body + * is in JSON format. + * @param {Object=} headers HTTP headers. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. + * @returns {requestHandler} Returns an object with `respond` method that controls how a matched + * request is handled. You can save this object for later use and invoke `respond` again in + * order to change how a matched request is handled. + */ + + /** + * @ngdoc method + * @name $httpBackend#expectPATCH + * @description + * Creates a new request expectation for PATCH requests. For more info see `expect()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that + * receives data string and returns true if the data is as expected, or Object if request body + * is in JSON format. + * @param {Object=} headers HTTP headers. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. + * @returns {requestHandler} Returns an object with `respond` method that controls how a matched + * request is handled. You can save this object for later use and invoke `respond` again in + * order to change how a matched request is handled. + */ + + /** + * @ngdoc method + * @name $httpBackend#expectJSONP + * @description + * Creates a new request expectation for JSONP requests. For more info see `expect()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives an url + * and returns true if the url matches the current definition. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described above. + * @returns {requestHandler} Returns an object with `respond` method that controls how a matched + * request is handled. You can save this object for later use and invoke `respond` again in + * order to change how a matched request is handled. + */ + createShortMethods('expect'); + + /** + * @ngdoc method + * @name $httpBackend#expectRoute + * @description + * Creates a new request expectation that compares only with the requested route. + * + * @param {string} method HTTP method. + * @param {string} url HTTP url string that supports colon param matching. + * @returns {requestHandler} Returns an object with `respond` method that controls how a matched + * request is handled. You can save this object for later use and invoke `respond` again in + * order to change how a matched request is handled. See #expect for more info. + */ + $httpBackend.expectRoute = function(method, url) { + var pathObj = parseRoute(url); + return $httpBackend.expect(method, pathObj.regexp, undefined, undefined, pathObj.keys); + }; + + + /** + * @ngdoc method + * @name $httpBackend#flush + * @description + * Flushes all pending requests using the trained responses. + * + * @param {number=} count Number of responses to flush (in the order they arrived). If undefined, + * all pending requests will be flushed. If there are no pending requests when the flush method + * is called an exception is thrown (as this typically a sign of programming error). + */ + $httpBackend.flush = function(count, digest) { + if (digest !== false) $rootScope.$digest(); + if (!responses.length) throw new Error('No pending request to flush !'); + + if (angular.isDefined(count) && count !== null) { + while (count--) { + if (!responses.length) throw new Error('No more pending request to flush !'); + responses.shift()(); + } + } else { + while (responses.length) { + responses.shift()(); + } + } + $httpBackend.verifyNoOutstandingExpectation(digest); + }; + + + /** + * @ngdoc method + * @name $httpBackend#verifyNoOutstandingExpectation + * @description + * Verifies that all of the requests defined via the `expect` api were made. If any of the + * requests were not made, verifyNoOutstandingExpectation throws an exception. + * + * Typically, you would call this method following each test case that asserts requests using an + * "afterEach" clause. + * + * ```js + * afterEach($httpBackend.verifyNoOutstandingExpectation); + * ``` + */ + $httpBackend.verifyNoOutstandingExpectation = function(digest) { + if (digest !== false) $rootScope.$digest(); + if (expectations.length) { + throw new Error('Unsatisfied requests: ' + expectations.join(', ')); + } + }; + + + /** + * @ngdoc method + * @name $httpBackend#verifyNoOutstandingRequest + * @description + * Verifies that there are no outstanding requests that need to be flushed. + * + * Typically, you would call this method following each test case that asserts requests using an + * "afterEach" clause. + * + * ```js + * afterEach($httpBackend.verifyNoOutstandingRequest); + * ``` + */ + $httpBackend.verifyNoOutstandingRequest = function() { + if (responses.length) { + throw new Error('Unflushed requests: ' + responses.length); + } + }; + + + /** + * @ngdoc method + * @name $httpBackend#resetExpectations + * @description + * Resets all request expectations, but preserves all backend definitions. Typically, you would + * call resetExpectations during a multiple-phase test when you want to reuse the same instance of + * $httpBackend mock. + */ + $httpBackend.resetExpectations = function() { + expectations.length = 0; + responses.length = 0; + }; + + return $httpBackend; + + + function createShortMethods(prefix) { + angular.forEach(['GET', 'DELETE', 'JSONP', 'HEAD'], function(method) { + $httpBackend[prefix + method] = function(url, headers, keys) { + return $httpBackend[prefix](method, url, undefined, headers, keys); + }; + }); + + angular.forEach(['PUT', 'POST', 'PATCH'], function(method) { + $httpBackend[prefix + method] = function(url, data, headers, keys) { + return $httpBackend[prefix](method, url, data, headers, keys); + }; + }); + } +} + +function MockHttpExpectation(method, url, data, headers, keys) { + + this.data = data; + this.headers = headers; + + this.match = function(m, u, d, h) { + if (method != m) return false; + if (!this.matchUrl(u)) return false; + if (angular.isDefined(d) && !this.matchData(d)) return false; + if (angular.isDefined(h) && !this.matchHeaders(h)) return false; + return true; + }; + + this.matchUrl = function(u) { + if (!url) return true; + if (angular.isFunction(url.test)) return url.test(u); + if (angular.isFunction(url)) return url(u); + return url == u; + }; + + this.matchHeaders = function(h) { + if (angular.isUndefined(headers)) return true; + if (angular.isFunction(headers)) return headers(h); + return angular.equals(headers, h); + }; + + this.matchData = function(d) { + if (angular.isUndefined(data)) return true; + if (data && angular.isFunction(data.test)) return data.test(d); + if (data && angular.isFunction(data)) return data(d); + if (data && !angular.isString(data)) { + return angular.equals(angular.fromJson(angular.toJson(data)), angular.fromJson(d)); + } + return data == d; + }; + + this.toString = function() { + return method + ' ' + url; + }; + + this.params = function(u) { + return angular.extend(parseQuery(), pathParams()); + + function pathParams() { + var keyObj = {}; + if (!url || !angular.isFunction(url.test) || !keys || keys.length === 0) return keyObj; + + var m = url.exec(u); + if (!m) return keyObj; + for (var i = 1, len = m.length; i < len; ++i) { + var key = keys[i - 1]; + var val = m[i]; + if (key && val) { + keyObj[key.name || key] = val; + } + } + + return keyObj; + } + + function parseQuery() { + var obj = {}, key_value, key, + queryStr = u.indexOf('?') > -1 + ? u.substring(u.indexOf('?') + 1) + : ""; + + angular.forEach(queryStr.split('&'), function(keyValue) { + if (keyValue) { + key_value = keyValue.replace(/\+/g,'%20').split('='); + key = tryDecodeURIComponent(key_value[0]); + if (angular.isDefined(key)) { + var val = angular.isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true; + if (!hasOwnProperty.call(obj, key)) { + obj[key] = val; + } else if (angular.isArray(obj[key])) { + obj[key].push(val); + } else { + obj[key] = [obj[key],val]; + } + } + } + }); + return obj; + } + function tryDecodeURIComponent(value) { + try { + return decodeURIComponent(value); + } catch (e) { + // Ignore any invalid uri component + } + } + }; +} + +function createMockXhr() { + return new MockXhr(); +} + +function MockXhr() { + + // hack for testing $http, $httpBackend + MockXhr.$$lastInstance = this; + + this.open = function(method, url, async) { + this.$$method = method; + this.$$url = url; + this.$$async = async; + this.$$reqHeaders = {}; + this.$$respHeaders = {}; + }; + + this.send = function(data) { + this.$$data = data; + }; + + this.setRequestHeader = function(key, value) { + this.$$reqHeaders[key] = value; + }; + + this.getResponseHeader = function(name) { + // the lookup must be case insensitive, + // that's why we try two quick lookups first and full scan last + var header = this.$$respHeaders[name]; + if (header) return header; + + name = angular.lowercase(name); + header = this.$$respHeaders[name]; + if (header) return header; + + header = undefined; + angular.forEach(this.$$respHeaders, function(headerVal, headerName) { + if (!header && angular.lowercase(headerName) == name) header = headerVal; + }); + return header; + }; + + this.getAllResponseHeaders = function() { + var lines = []; + + angular.forEach(this.$$respHeaders, function(value, key) { + lines.push(key + ': ' + value); + }); + return lines.join('\n'); + }; + + this.abort = angular.noop; +} + + +/** + * @ngdoc service + * @name $timeout + * @description + * + * This service is just a simple decorator for {@link ng.$timeout $timeout} service + * that adds a "flush" and "verifyNoPendingTasks" methods. + */ + +angular.mock.$TimeoutDecorator = ['$delegate', '$browser', function($delegate, $browser) { + + /** + * @ngdoc method + * @name $timeout#flush + * @description + * + * Flushes the queue of pending tasks. + * + * @param {number=} delay maximum timeout amount to flush up until + */ + $delegate.flush = function(delay) { + $browser.defer.flush(delay); + }; + + /** + * @ngdoc method + * @name $timeout#verifyNoPendingTasks + * @description + * + * Verifies that there are no pending tasks that need to be flushed. + */ + $delegate.verifyNoPendingTasks = function() { + if ($browser.deferredFns.length) { + throw new Error('Deferred tasks to flush (' + $browser.deferredFns.length + '): ' + + formatPendingTasksAsString($browser.deferredFns)); + } + }; + + function formatPendingTasksAsString(tasks) { + var result = []; + angular.forEach(tasks, function(task) { + result.push('{id: ' + task.id + ', ' + 'time: ' + task.time + '}'); + }); + + return result.join(', '); + } + + return $delegate; +}]; + +angular.mock.$RAFDecorator = ['$delegate', function($delegate) { + var rafFn = function(fn) { + var index = rafFn.queue.length; + rafFn.queue.push(fn); + return function() { + rafFn.queue.splice(index, 1); + }; + }; + + rafFn.queue = []; + rafFn.supported = $delegate.supported; + + rafFn.flush = function() { + if (rafFn.queue.length === 0) { + throw new Error('No rAF callbacks present'); + } + + var length = rafFn.queue.length; + for (var i = 0; i < length; i++) { + rafFn.queue[i](); + } + + rafFn.queue = rafFn.queue.slice(i); + }; + + return rafFn; +}]; + +/** + * + */ +angular.mock.$RootElementProvider = function() { + this.$get = function() { + return angular.element('
    '); + }; +}; + +/** + * @ngdoc service + * @name $controller + * @description + * A decorator for {@link ng.$controller} with additional `bindings` parameter, useful when testing + * controllers of directives that use {@link $compile#-bindtocontroller- `bindToController`}. + * + * + * ## Example + * + * ```js + * + * // Directive definition ... + * + * myMod.directive('myDirective', { + * controller: 'MyDirectiveController', + * bindToController: { + * name: '@' + * } + * }); + * + * + * // Controller definition ... + * + * myMod.controller('MyDirectiveController', ['$log', function($log) { + * $log.info(this.name); + * })]; + * + * + * // In a test ... + * + * describe('myDirectiveController', function() { + * it('should write the bound name to the log', inject(function($controller, $log) { + * var ctrl = $controller('MyDirectiveController', { /* no locals */ }, { name: 'Clark Kent' }); + * expect(ctrl.name).toEqual('Clark Kent'); + * expect($log.info.logs).toEqual(['Clark Kent']); + * }); + * }); + * + * ``` + * + * @param {Function|string} constructor If called with a function then it's considered to be the + * controller constructor function. Otherwise it's considered to be a string which is used + * to retrieve the controller constructor using the following steps: + * + * * check if a controller with given name is registered via `$controllerProvider` + * * check if evaluating the string on the current scope returns a constructor + * * if $controllerProvider#allowGlobals, check `window[constructor]` on the global + * `window` object (not recommended) + * + * The string can use the `controller as property` syntax, where the controller instance is published + * as the specified property on the `scope`; the `scope` must be injected into `locals` param for this + * to work correctly. + * + * @param {Object} locals Injection locals for Controller. + * @param {Object=} bindings Properties to add to the controller before invoking the constructor. This is used + * to simulate the `bindToController` feature and simplify certain kinds of tests. + * @return {Object} Instance of given controller. + */ +angular.mock.$ControllerDecorator = ['$delegate', function($delegate) { + return function(expression, locals, later, ident) { + if (later && typeof later === 'object') { + var create = $delegate(expression, locals, true, ident); + angular.extend(create.instance, later); + return create(); + } + return $delegate(expression, locals, later, ident); + }; +}]; + +/** + * @ngdoc service + * @name $componentController + * @description + * A service that can be used to create instances of component controllers. + *
    + * Be aware that the controller will be instantiated and attached to the scope as specified in + * the component definition object. That means that you must always provide a `$scope` object + * in the `locals` param. + *
    + * @param {string} componentName the name of the component whose controller we want to instantiate + * @param {Object} locals Injection locals for Controller. + * @param {Object=} bindings Properties to add to the controller before invoking the constructor. This is used + * to simulate the `bindToController` feature and simplify certain kinds of tests. + * @param {string=} ident Override the property name to use when attaching the controller to the scope. + * @return {Object} Instance of requested controller. + */ +angular.mock.$ComponentControllerProvider = ['$compileProvider', function($compileProvider) { + return { + $get: ['$controller','$injector', function($controller,$injector) { + return function $componentController(componentName, locals, bindings, ident) { + // get all directives associated to the component name + var directives = $injector.get(componentName + 'Directive'); + // look for those directives that are components + var candidateDirectives = directives.filter(function(directiveInfo) { + // components have controller, controllerAs and restrict:'E' + return directiveInfo.controller && directiveInfo.controllerAs && directiveInfo.restrict === 'E'; + }); + // check if valid directives found + if (candidateDirectives.length === 0) { + throw new Error('No component found'); + } + if (candidateDirectives.length > 1) { + throw new Error('Too many components found'); + } + // get the info of the component + var directiveInfo = candidateDirectives[0]; + return $controller(directiveInfo.controller, locals, bindings, ident || directiveInfo.controllerAs); + }; + }] + }; +}]; + + +/** + * @ngdoc module + * @name ngMock + * @packageName angular-mocks + * @description + * + * # ngMock + * + * The `ngMock` module provides support to inject and mock Angular services into unit tests. + * In addition, ngMock also extends various core ng services such that they can be + * inspected and controlled in a synchronous manner within test code. + * + * + *
    + * + */ +angular.module('ngMock', ['ng']).provider({ + $browser: angular.mock.$BrowserProvider, + $exceptionHandler: angular.mock.$ExceptionHandlerProvider, + $log: angular.mock.$LogProvider, + $interval: angular.mock.$IntervalProvider, + $httpBackend: angular.mock.$HttpBackendProvider, + $rootElement: angular.mock.$RootElementProvider, + $componentController: angular.mock.$ComponentControllerProvider +}).config(['$provide', function($provide) { + $provide.decorator('$timeout', angular.mock.$TimeoutDecorator); + $provide.decorator('$$rAF', angular.mock.$RAFDecorator); + $provide.decorator('$rootScope', angular.mock.$RootScopeDecorator); + $provide.decorator('$controller', angular.mock.$ControllerDecorator); +}]); + +/** + * @ngdoc module + * @name ngMockE2E + * @module ngMockE2E + * @packageName angular-mocks + * @description + * + * The `ngMockE2E` is an angular module which contains mocks suitable for end-to-end testing. + * Currently there is only one mock present in this module - + * the {@link ngMockE2E.$httpBackend e2e $httpBackend} mock. + */ +angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { + $provide.decorator('$httpBackend', angular.mock.e2e.$httpBackendDecorator); +}]); + +/** + * @ngdoc service + * @name $httpBackend + * @module ngMockE2E + * @description + * Fake HTTP backend implementation suitable for end-to-end testing or backend-less development of + * applications that use the {@link ng.$http $http service}. + * + * *Note*: For fake http backend implementation suitable for unit testing please see + * {@link ngMock.$httpBackend unit-testing $httpBackend mock}. + * + * This implementation can be used to respond with static or dynamic responses via the `when` api + * and its shortcuts (`whenGET`, `whenPOST`, etc) and optionally pass through requests to the + * real $httpBackend for specific requests (e.g. to interact with certain remote apis or to fetch + * templates from a webserver). + * + * As opposed to unit-testing, in an end-to-end testing scenario or in scenario when an application + * is being developed with the real backend api replaced with a mock, it is often desirable for + * certain category of requests to bypass the mock and issue a real http request (e.g. to fetch + * templates or static files from the webserver). To configure the backend with this behavior + * use the `passThrough` request handler of `when` instead of `respond`. + * + * Additionally, we don't want to manually have to flush mocked out requests like we do during unit + * testing. For this reason the e2e $httpBackend flushes mocked out requests + * automatically, closely simulating the behavior of the XMLHttpRequest object. + * + * To setup the application to run with this http backend, you have to create a module that depends + * on the `ngMockE2E` and your application modules and defines the fake backend: + * + * ```js + * myAppDev = angular.module('myAppDev', ['myApp', 'ngMockE2E']); + * myAppDev.run(function($httpBackend) { + * phones = [{name: 'phone1'}, {name: 'phone2'}]; + * + * // returns the current list of phones + * $httpBackend.whenGET('/phones').respond(phones); + * + * // adds a new phone to the phones array + * $httpBackend.whenPOST('/phones').respond(function(method, url, data) { + * var phone = angular.fromJson(data); + * phones.push(phone); + * return [200, phone, {}]; + * }); + * $httpBackend.whenGET(/^\/templates\//).passThrough(); + * //... + * }); + * ``` + * + * Afterwards, bootstrap your app with this new module. + */ + +/** + * @ngdoc method + * @name $httpBackend#when + * @module ngMockE2E + * @description + * Creates a new backend definition. + * + * @param {string} method HTTP method. + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(string|RegExp)=} data HTTP request body. + * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header + * object and returns true if the headers match the current definition. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on + * {@link ngMock.$httpBackend $httpBackend mock}. + * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that + * control how a matched request is handled. You can save this object for later use and invoke + * `respond` or `passThrough` again in order to change how a matched request is handled. + * + * - respond – + * `{function([status,] data[, headers, statusText]) + * | function(function(method, url, data, headers, params)}` + * – The respond method takes a set of static data to be returned or a function that can return + * an array containing response status (number), response data (string), response headers + * (Object), and the text for the status (string). + * - passThrough – `{function()}` – Any request matching a backend definition with + * `passThrough` handler will be passed through to the real backend (an XHR request will be made + * to the server.) + * - Both methods return the `requestHandler` object for possible overrides. + */ + +/** + * @ngdoc method + * @name $httpBackend#whenGET + * @module ngMockE2E + * @description + * Creates a new backend definition for GET requests. For more info see `when()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(Object|function(Object))=} headers HTTP headers. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on + * {@link ngMock.$httpBackend $httpBackend mock}. + * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that + * control how a matched request is handled. You can save this object for later use and invoke + * `respond` or `passThrough` again in order to change how a matched request is handled. + */ + +/** + * @ngdoc method + * @name $httpBackend#whenHEAD + * @module ngMockE2E + * @description + * Creates a new backend definition for HEAD requests. For more info see `when()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(Object|function(Object))=} headers HTTP headers. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on + * {@link ngMock.$httpBackend $httpBackend mock}. + * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that + * control how a matched request is handled. You can save this object for later use and invoke + * `respond` or `passThrough` again in order to change how a matched request is handled. + */ + +/** + * @ngdoc method + * @name $httpBackend#whenDELETE + * @module ngMockE2E + * @description + * Creates a new backend definition for DELETE requests. For more info see `when()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(Object|function(Object))=} headers HTTP headers. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on + * {@link ngMock.$httpBackend $httpBackend mock}. + * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that + * control how a matched request is handled. You can save this object for later use and invoke + * `respond` or `passThrough` again in order to change how a matched request is handled. + */ + +/** + * @ngdoc method + * @name $httpBackend#whenPOST + * @module ngMockE2E + * @description + * Creates a new backend definition for POST requests. For more info see `when()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(string|RegExp)=} data HTTP request body. + * @param {(Object|function(Object))=} headers HTTP headers. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on + * {@link ngMock.$httpBackend $httpBackend mock}. + * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that + * control how a matched request is handled. You can save this object for later use and invoke + * `respond` or `passThrough` again in order to change how a matched request is handled. + */ + +/** + * @ngdoc method + * @name $httpBackend#whenPUT + * @module ngMockE2E + * @description + * Creates a new backend definition for PUT requests. For more info see `when()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(string|RegExp)=} data HTTP request body. + * @param {(Object|function(Object))=} headers HTTP headers. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on + * {@link ngMock.$httpBackend $httpBackend mock}. + * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that + * control how a matched request is handled. You can save this object for later use and invoke + * `respond` or `passThrough` again in order to change how a matched request is handled. + */ + +/** + * @ngdoc method + * @name $httpBackend#whenPATCH + * @module ngMockE2E + * @description + * Creates a new backend definition for PATCH requests. For more info see `when()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(string|RegExp)=} data HTTP request body. + * @param {(Object|function(Object))=} headers HTTP headers. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on + * {@link ngMock.$httpBackend $httpBackend mock}. + * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that + * control how a matched request is handled. You can save this object for later use and invoke + * `respond` or `passThrough` again in order to change how a matched request is handled. + */ + +/** + * @ngdoc method + * @name $httpBackend#whenJSONP + * @module ngMockE2E + * @description + * Creates a new backend definition for JSONP requests. For more info see `when()`. + * + * @param {string|RegExp|function(string)} url HTTP url or function that receives a url + * and returns true if the url matches the current definition. + * @param {(Array)=} keys Array of keys to assign to regex matches in request url described on + * {@link ngMock.$httpBackend $httpBackend mock}. + * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that + * control how a matched request is handled. You can save this object for later use and invoke + * `respond` or `passThrough` again in order to change how a matched request is handled. + */ +/** + * @ngdoc method + * @name $httpBackend#whenRoute + * @module ngMockE2E + * @description + * Creates a new backend definition that compares only with the requested route. + * + * @param {string} method HTTP method. + * @param {string} url HTTP url string that supports colon param matching. + * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that + * control how a matched request is handled. You can save this object for later use and invoke + * `respond` or `passThrough` again in order to change how a matched request is handled. + */ +angular.mock.e2e = {}; +angular.mock.e2e.$httpBackendDecorator = + ['$rootScope', '$timeout', '$delegate', '$browser', createHttpBackendMock]; + + +/** + * @ngdoc type + * @name $rootScope.Scope + * @module ngMock + * @description + * {@link ng.$rootScope.Scope Scope} type decorated with helper methods useful for testing. These + * methods are automatically available on any {@link ng.$rootScope.Scope Scope} instance when + * `ngMock` module is loaded. + * + * In addition to all the regular `Scope` methods, the following helper methods are available: + */ +angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) { + + var $rootScopePrototype = Object.getPrototypeOf($delegate); + + $rootScopePrototype.$countChildScopes = countChildScopes; + $rootScopePrototype.$countWatchers = countWatchers; + + return $delegate; + + // ------------------------------------------------------------------------------------------ // + + /** + * @ngdoc method + * @name $rootScope.Scope#$countChildScopes + * @module ngMock + * @description + * Counts all the direct and indirect child scopes of the current scope. + * + * The current scope is excluded from the count. The count includes all isolate child scopes. + * + * @returns {number} Total number of child scopes. + */ + function countChildScopes() { + // jshint validthis: true + var count = 0; // exclude the current scope + var pendingChildHeads = [this.$$childHead]; + var currentScope; + + while (pendingChildHeads.length) { + currentScope = pendingChildHeads.shift(); + + while (currentScope) { + count += 1; + pendingChildHeads.push(currentScope.$$childHead); + currentScope = currentScope.$$nextSibling; + } + } + + return count; + } + + + /** + * @ngdoc method + * @name $rootScope.Scope#$countWatchers + * @module ngMock + * @description + * Counts all the watchers of direct and indirect child scopes of the current scope. + * + * The watchers of the current scope are included in the count and so are all the watchers of + * isolate child scopes. + * + * @returns {number} Total number of watchers. + */ + function countWatchers() { + // jshint validthis: true + var count = this.$$watchers ? this.$$watchers.length : 0; // include the current scope + var pendingChildHeads = [this.$$childHead]; + var currentScope; + + while (pendingChildHeads.length) { + currentScope = pendingChildHeads.shift(); + + while (currentScope) { + count += currentScope.$$watchers ? currentScope.$$watchers.length : 0; + pendingChildHeads.push(currentScope.$$childHead); + currentScope = currentScope.$$nextSibling; + } + } + + return count; + } +}]; + + +if (window.jasmine || window.mocha) { + + var currentSpec = null, + annotatedFunctions = [], + isSpecRunning = function() { + return !!currentSpec; + }; + + angular.mock.$$annotate = angular.injector.$$annotate; + angular.injector.$$annotate = function(fn) { + if (typeof fn === 'function' && !fn.$inject) { + annotatedFunctions.push(fn); + } + return angular.mock.$$annotate.apply(this, arguments); + }; + + + (window.beforeEach || window.setup)(function() { + annotatedFunctions = []; + currentSpec = this; + }); + + (window.afterEach || window.teardown)(function() { + var injector = currentSpec.$injector; + + annotatedFunctions.forEach(function(fn) { + delete fn.$inject; + }); + + angular.forEach(currentSpec.$modules, function(module) { + if (module && module.$$hashKey) { + module.$$hashKey = undefined; + } + }); + + currentSpec.$injector = null; + currentSpec.$modules = null; + currentSpec.$providerInjector = null; + currentSpec = null; + + if (injector) { + injector.get('$rootElement').off(); + injector.get('$rootScope').$destroy(); + } + + // clean up jquery's fragment cache + angular.forEach(angular.element.fragments, function(val, key) { + delete angular.element.fragments[key]; + }); + + MockXhr.$$lastInstance = null; + + angular.forEach(angular.callbacks, function(val, key) { + delete angular.callbacks[key]; + }); + angular.callbacks.counter = 0; + }); + + /** + * @ngdoc function + * @name angular.mock.module + * @description + * + * *NOTE*: This function is also published on window for easy access.
    + * *NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha + * + * This function registers a module configuration code. It collects the configuration information + * which will be used when the injector is created by {@link angular.mock.inject inject}. + * + * See {@link angular.mock.inject inject} for usage example + * + * @param {...(string|Function|Object)} fns any number of modules which are represented as string + * aliases or as anonymous module initialization functions. The modules are used to + * configure the injector. The 'ng' and 'ngMock' modules are automatically loaded. If an + * object literal is passed each key-value pair will be registered on the module via + * {@link auto.$provide $provide}.value, the key being the string name (or token) to associate + * with the value on the injector. + */ + window.module = angular.mock.module = function() { + var moduleFns = Array.prototype.slice.call(arguments, 0); + return isSpecRunning() ? workFn() : workFn; + ///////////////////// + function workFn() { + if (currentSpec.$injector) { + throw new Error('Injector already created, can not register a module!'); + } else { + var fn, modules = currentSpec.$modules || (currentSpec.$modules = []); + angular.forEach(moduleFns, function(module) { + if (angular.isObject(module) && !angular.isArray(module)) { + fn = function($provide) { + angular.forEach(module, function(value, key) { + $provide.value(key, value); + }); + }; + } else { + fn = module; + } + if (currentSpec.$providerInjector) { + currentSpec.$providerInjector.invoke(fn); + } else { + modules.push(fn); + } + }); + } + } + }; + + /** + * @ngdoc function + * @name angular.mock.inject + * @description + * + * *NOTE*: This function is also published on window for easy access.
    + * *NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha + * + * The inject function wraps a function into an injectable function. The inject() creates new + * instance of {@link auto.$injector $injector} per test, which is then used for + * resolving references. + * + * + * ## Resolving References (Underscore Wrapping) + * Often, we would like to inject a reference once, in a `beforeEach()` block and reuse this + * in multiple `it()` clauses. To be able to do this we must assign the reference to a variable + * that is declared in the scope of the `describe()` block. Since we would, most likely, want + * the variable to have the same name of the reference we have a problem, since the parameter + * to the `inject()` function would hide the outer variable. + * + * To help with this, the injected parameters can, optionally, be enclosed with underscores. + * These are ignored by the injector when the reference name is resolved. + * + * For example, the parameter `_myService_` would be resolved as the reference `myService`. + * Since it is available in the function body as _myService_, we can then assign it to a variable + * defined in an outer scope. + * + * ``` + * // Defined out reference variable outside + * var myService; + * + * // Wrap the parameter in underscores + * beforeEach( inject( function(_myService_){ + * myService = _myService_; + * })); + * + * // Use myService in a series of tests. + * it('makes use of myService', function() { + * myService.doStuff(); + * }); + * + * ``` + * + * See also {@link angular.mock.module angular.mock.module} + * + * ## Example + * Example of what a typical jasmine tests looks like with the inject method. + * ```js + * + * angular.module('myApplicationModule', []) + * .value('mode', 'app') + * .value('version', 'v1.0.1'); + * + * + * describe('MyApp', function() { + * + * // You need to load modules that you want to test, + * // it loads only the "ng" module by default. + * beforeEach(module('myApplicationModule')); + * + * + * // inject() is used to inject arguments of all given functions + * it('should provide a version', inject(function(mode, version) { + * expect(version).toEqual('v1.0.1'); + * expect(mode).toEqual('app'); + * })); + * + * + * // The inject and module method can also be used inside of the it or beforeEach + * it('should override a version and test the new version is injected', function() { + * // module() takes functions or strings (module aliases) + * module(function($provide) { + * $provide.value('version', 'overridden'); // override version here + * }); + * + * inject(function(version) { + * expect(version).toEqual('overridden'); + * }); + * }); + * }); + * + * ``` + * + * @param {...Function} fns any number of functions which will be injected using the injector. + */ + + + + var ErrorAddingDeclarationLocationStack = function(e, errorForStack) { + this.message = e.message; + this.name = e.name; + if (e.line) this.line = e.line; + if (e.sourceId) this.sourceId = e.sourceId; + if (e.stack && errorForStack) + this.stack = e.stack + '\n' + errorForStack.stack; + if (e.stackArray) this.stackArray = e.stackArray; + }; + ErrorAddingDeclarationLocationStack.prototype.toString = Error.prototype.toString; + + window.inject = angular.mock.inject = function() { + var blockFns = Array.prototype.slice.call(arguments, 0); + var errorForStack = new Error('Declaration Location'); + return isSpecRunning() ? workFn.call(currentSpec) : workFn; + ///////////////////// + function workFn() { + var modules = currentSpec.$modules || []; + var strictDi = !!currentSpec.$injectorStrict; + modules.unshift(function($injector) { + currentSpec.$providerInjector = $injector; + }); + modules.unshift('ngMock'); + modules.unshift('ng'); + var injector = currentSpec.$injector; + if (!injector) { + if (strictDi) { + // If strictDi is enabled, annotate the providerInjector blocks + angular.forEach(modules, function(moduleFn) { + if (typeof moduleFn === "function") { + angular.injector.$$annotate(moduleFn); + } + }); + } + injector = currentSpec.$injector = angular.injector(modules, strictDi); + currentSpec.$injectorStrict = strictDi; + } + for (var i = 0, ii = blockFns.length; i < ii; i++) { + if (currentSpec.$injectorStrict) { + // If the injector is strict / strictDi, and the spec wants to inject using automatic + // annotation, then annotate the function here. + injector.annotate(blockFns[i]); + } + try { + /* jshint -W040 *//* Jasmine explicitly provides a `this` object when calling functions */ + injector.invoke(blockFns[i] || angular.noop, this); + /* jshint +W040 */ + } catch (e) { + if (e.stack && errorForStack) { + throw new ErrorAddingDeclarationLocationStack(e, errorForStack); + } + throw e; + } finally { + errorForStack = null; + } + } + } + }; + + + angular.mock.inject.strictDi = function(value) { + value = arguments.length ? !!value : true; + return isSpecRunning() ? workFn() : workFn; + + function workFn() { + if (value !== currentSpec.$injectorStrict) { + if (currentSpec.$injector) { + throw new Error('Injector already created, can not modify strict annotations'); + } else { + currentSpec.$injectorStrict = value; + } + } + } + }; +} + + +})(window, window.angular); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.js new file mode 100644 index 0000000..444be83 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.js @@ -0,0 +1,768 @@ +/** + * @license AngularJS v1.5.0 + * (c) 2010-2016 Google, Inc. http://angularjs.org + * License: MIT + */ +(function(window, angular, undefined) {'use strict'; + +var $resourceMinErr = angular.$$minErr('$resource'); + +// Helper functions and regex to lookup a dotted path on an object +// stopping at undefined/null. The path must be composed of ASCII +// identifiers (just like $parse) +var MEMBER_NAME_REGEX = /^(\.[a-zA-Z_$@][0-9a-zA-Z_$@]*)+$/; + +function isValidDottedPath(path) { + return (path != null && path !== '' && path !== 'hasOwnProperty' && + MEMBER_NAME_REGEX.test('.' + path)); +} + +function lookupDottedPath(obj, path) { + if (!isValidDottedPath(path)) { + throw $resourceMinErr('badmember', 'Dotted member path "@{0}" is invalid.', path); + } + var keys = path.split('.'); + for (var i = 0, ii = keys.length; i < ii && angular.isDefined(obj); i++) { + var key = keys[i]; + obj = (obj !== null) ? obj[key] : undefined; + } + return obj; +} + +/** + * Create a shallow copy of an object and clear other fields from the destination + */ +function shallowClearAndCopy(src, dst) { + dst = dst || {}; + + angular.forEach(dst, function(value, key) { + delete dst[key]; + }); + + for (var key in src) { + if (src.hasOwnProperty(key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) { + dst[key] = src[key]; + } + } + + return dst; +} + +/** + * @ngdoc module + * @name ngResource + * @description + * + * # ngResource + * + * The `ngResource` module provides interaction support with RESTful services + * via the $resource service. + * + * + *
    + * + * See {@link ngResource.$resource `$resource`} for usage. + */ + +/** + * @ngdoc service + * @name $resource + * @requires $http + * @requires ng.$log + * @requires $q + * @requires ng.$timeout + * + * @description + * A factory which creates a resource object that lets you interact with + * [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources. + * + * The returned resource object has action methods which provide high-level behaviors without + * the need to interact with the low level {@link ng.$http $http} service. + * + * Requires the {@link ngResource `ngResource`} module to be installed. + * + * By default, trailing slashes will be stripped from the calculated URLs, + * which can pose problems with server backends that do not expect that + * behavior. This can be disabled by configuring the `$resourceProvider` like + * this: + * + * ```js + app.config(['$resourceProvider', function($resourceProvider) { + // Don't strip trailing slashes from calculated URLs + $resourceProvider.defaults.stripTrailingSlashes = false; + }]); + * ``` + * + * @param {string} url A parameterized URL template with parameters prefixed by `:` as in + * `/user/:username`. If you are using a URL with a port number (e.g. + * `http://example.com:8080/api`), it will be respected. + * + * If you are using a url with a suffix, just add the suffix, like this: + * `$resource('http://example.com/resource.json')` or `$resource('http://example.com/:id.json')` + * or even `$resource('http://example.com/resource/:resource_id.:format')` + * If the parameter before the suffix is empty, :resource_id in this case, then the `/.` will be + * collapsed down to a single `.`. If you need this sequence to appear and not collapse then you + * can escape it with `/\.`. + * + * @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in + * `actions` methods. If a parameter value is a function, it will be executed every time + * when a param value needs to be obtained for a request (unless the param was overridden). + * + * Each key value in the parameter object is first bound to url template if present and then any + * excess keys are appended to the url search query after the `?`. + * + * Given a template `/path/:verb` and parameter `{verb:'greet', salutation:'Hello'}` results in + * URL `/path/greet?salutation=Hello`. + * + * If the parameter value is prefixed with `@` then the value for that parameter will be extracted + * from the corresponding property on the `data` object (provided when calling an action method). + * For example, if the `defaultParam` object is `{someParam: '@someProp'}` then the value of + * `someParam` will be `data.someProp`. + * + * @param {Object.=} actions Hash with declaration of custom actions that should extend + * the default set of resource actions. The declaration should be created in the format of {@link + * ng.$http#usage $http.config}: + * + * {action1: {method:?, params:?, isArray:?, headers:?, ...}, + * action2: {method:?, params:?, isArray:?, headers:?, ...}, + * ...} + * + * Where: + * + * - **`action`** – {string} – The name of action. This name becomes the name of the method on + * your resource object. + * - **`method`** – {string} – Case insensitive HTTP method (e.g. `GET`, `POST`, `PUT`, + * `DELETE`, `JSONP`, etc). + * - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of + * the parameter value is a function, it will be executed every time when a param value needs to + * be obtained for a request (unless the param was overridden). + * - **`url`** – {string} – action specific `url` override. The url templating is supported just + * like for the resource-level urls. + * - **`isArray`** – {boolean=} – If true then the returned object for this action is an array, + * see `returns` section. + * - **`transformRequest`** – + * `{function(data, headersGetter)|Array.}` – + * transform function or an array of such functions. The transform function takes the http + * request body and headers and returns its transformed (typically serialized) version. + * By default, transformRequest will contain one function that checks if the request data is + * an object and serializes to using `angular.toJson`. To prevent this behavior, set + * `transformRequest` to an empty array: `transformRequest: []` + * - **`transformResponse`** – + * `{function(data, headersGetter)|Array.}` – + * transform function or an array of such functions. The transform function takes the http + * response body and headers and returns its transformed (typically deserialized) version. + * By default, transformResponse will contain one function that checks if the response looks + * like a JSON string and deserializes it using `angular.fromJson`. To prevent this behavior, + * set `transformResponse` to an empty array: `transformResponse: []` + * - **`cache`** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the + * GET request, otherwise if a cache instance built with + * {@link ng.$cacheFactory $cacheFactory}, this cache will be used for + * caching. + * - **`timeout`** – `{number}` – timeout in milliseconds.
    + * **Note:** In contrast to {@link ng.$http#usage $http.config}, {@link ng.$q promises} are + * **not** supported in $resource, because the same value would be used for multiple requests. + * If you are looking for a way to cancel requests, you should use the `cancellable` option. + * - **`cancellable`** – `{boolean}` – if set to true, the request made by a "non-instance" call + * will be cancelled (if not already completed) by calling `$cancelRequest()` on the call's + * return value. Calling `$cancelRequest()` for a non-cancellable or an already + * completed/cancelled request will have no effect.
    + * - **`withCredentials`** - `{boolean}` - whether to set the `withCredentials` flag on the + * XHR object. See + * [requests with credentials](https://developer.mozilla.org/en/http_access_control#section_5) + * for more information. + * - **`responseType`** - `{string}` - see + * [requestType](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType). + * - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods - + * `response` and `responseError`. Both `response` and `responseError` interceptors get called + * with `http response` object. See {@link ng.$http $http interceptors}. + * + * @param {Object} options Hash with custom settings that should extend the + * default `$resourceProvider` behavior. The supported options are: + * + * - **`stripTrailingSlashes`** – {boolean} – If true then the trailing + * slashes from any calculated URL will be stripped. (Defaults to true.) + * - **`cancellable`** – {boolean} – If true, the request made by a "non-instance" call will be + * cancelled (if not already completed) by calling `$cancelRequest()` on the call's return value. + * This can be overwritten per action. (Defaults to false.) + * + * @returns {Object} A resource "class" object with methods for the default set of resource actions + * optionally extended with custom `actions`. The default set contains these actions: + * ```js + * { 'get': {method:'GET'}, + * 'save': {method:'POST'}, + * 'query': {method:'GET', isArray:true}, + * 'remove': {method:'DELETE'}, + * 'delete': {method:'DELETE'} }; + * ``` + * + * Calling these methods invoke an {@link ng.$http} with the specified http method, + * destination and parameters. When the data is returned from the server then the object is an + * instance of the resource class. The actions `save`, `remove` and `delete` are available on it + * as methods with the `$` prefix. This allows you to easily perform CRUD operations (create, + * read, update, delete) on server-side data like this: + * ```js + * var User = $resource('/user/:userId', {userId:'@id'}); + * var user = User.get({userId:123}, function() { + * user.abc = true; + * user.$save(); + * }); + * ``` + * + * It is important to realize that invoking a $resource object method immediately returns an + * empty reference (object or array depending on `isArray`). Once the data is returned from the + * server the existing reference is populated with the actual data. This is a useful trick since + * usually the resource is assigned to a model which is then rendered by the view. Having an empty + * object results in no rendering, once the data arrives from the server then the object is + * populated with the data and the view automatically re-renders itself showing the new data. This + * means that in most cases one never has to write a callback function for the action methods. + * + * The action methods on the class object or instance object can be invoked with the following + * parameters: + * + * - HTTP GET "class" actions: `Resource.action([parameters], [success], [error])` + * - non-GET "class" actions: `Resource.action([parameters], postData, [success], [error])` + * - non-GET instance actions: `instance.$action([parameters], [success], [error])` + * + * + * Success callback is called with (value, responseHeaders) arguments, where the value is + * the populated resource instance or collection object. The error callback is called + * with (httpResponse) argument. + * + * Class actions return empty instance (with additional properties below). + * Instance actions return promise of the action. + * + * The Resource instances and collections have these additional properties: + * + * - `$promise`: the {@link ng.$q promise} of the original server interaction that created this + * instance or collection. + * + * On success, the promise is resolved with the same resource instance or collection object, + * updated with data from server. This makes it easy to use in + * {@link ngRoute.$routeProvider resolve section of $routeProvider.when()} to defer view + * rendering until the resource(s) are loaded. + * + * On failure, the promise is rejected with the {@link ng.$http http response} object, without + * the `resource` property. + * + * If an interceptor object was provided, the promise will instead be resolved with the value + * returned by the interceptor. + * + * - `$resolved`: `true` after first server interaction is completed (either with success or + * rejection), `false` before that. Knowing if the Resource has been resolved is useful in + * data-binding. + * + * The Resource instances and collections have these additional methods: + * + * - `$cancelRequest`: If there is a cancellable, pending request related to the instance or + * collection, calling this method will abort the request. + * + * @example + * + * # Credit card resource + * + * ```js + // Define CreditCard class + var CreditCard = $resource('/user/:userId/card/:cardId', + {userId:123, cardId:'@id'}, { + charge: {method:'POST', params:{charge:true}} + }); + + // We can retrieve a collection from the server + var cards = CreditCard.query(function() { + // GET: /user/123/card + // server returns: [ {id:456, number:'1234', name:'Smith'} ]; + + var card = cards[0]; + // each item is an instance of CreditCard + expect(card instanceof CreditCard).toEqual(true); + card.name = "J. Smith"; + // non GET methods are mapped onto the instances + card.$save(); + // POST: /user/123/card/456 {id:456, number:'1234', name:'J. Smith'} + // server returns: {id:456, number:'1234', name: 'J. Smith'}; + + // our custom method is mapped as well. + card.$charge({amount:9.99}); + // POST: /user/123/card/456?amount=9.99&charge=true {id:456, number:'1234', name:'J. Smith'} + }); + + // we can create an instance as well + var newCard = new CreditCard({number:'0123'}); + newCard.name = "Mike Smith"; + newCard.$save(); + // POST: /user/123/card {number:'0123', name:'Mike Smith'} + // server returns: {id:789, number:'0123', name: 'Mike Smith'}; + expect(newCard.id).toEqual(789); + * ``` + * + * The object returned from this function execution is a resource "class" which has "static" method + * for each action in the definition. + * + * Calling these methods invoke `$http` on the `url` template with the given `method`, `params` and + * `headers`. + * + * @example + * + * # User resource + * + * When the data is returned from the server then the object is an instance of the resource type and + * all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD + * operations (create, read, update, delete) on server-side data. + + ```js + var User = $resource('/user/:userId', {userId:'@id'}); + User.get({userId:123}, function(user) { + user.abc = true; + user.$save(); + }); + ``` + * + * It's worth noting that the success callback for `get`, `query` and other methods gets passed + * in the response that came from the server as well as $http header getter function, so one + * could rewrite the above example and get access to http headers as: + * + ```js + var User = $resource('/user/:userId', {userId:'@id'}); + User.get({userId:123}, function(user, getResponseHeaders){ + user.abc = true; + user.$save(function(user, putResponseHeaders) { + //user => saved user object + //putResponseHeaders => $http header getter + }); + }); + ``` + * + * You can also access the raw `$http` promise via the `$promise` property on the object returned + * + ``` + var User = $resource('/user/:userId', {userId:'@id'}); + User.get({userId:123}) + .$promise.then(function(user) { + $scope.user = user; + }); + ``` + * + * @example + * + * # Creating a custom 'PUT' request + * + * In this example we create a custom method on our resource to make a PUT request + * ```js + * var app = angular.module('app', ['ngResource', 'ngRoute']); + * + * // Some APIs expect a PUT request in the format URL/object/ID + * // Here we are creating an 'update' method + * app.factory('Notes', ['$resource', function($resource) { + * return $resource('/notes/:id', null, + * { + * 'update': { method:'PUT' } + * }); + * }]); + * + * // In our controller we get the ID from the URL using ngRoute and $routeParams + * // We pass in $routeParams and our Notes factory along with $scope + * app.controller('NotesCtrl', ['$scope', '$routeParams', 'Notes', + function($scope, $routeParams, Notes) { + * // First get a note object from the factory + * var note = Notes.get({ id:$routeParams.id }); + * $id = note.id; + * + * // Now call update passing in the ID first then the object you are updating + * Notes.update({ id:$id }, note); + * + * // This will PUT /notes/ID with the note object in the request payload + * }]); + * ``` + * + * @example + * + * # Cancelling requests + * + * If an action's configuration specifies that it is cancellable, you can cancel the request related + * to an instance or collection (as long as it is a result of a "non-instance" call): + * + ```js + // ...defining the `Hotel` resource... + var Hotel = $resource('/api/hotel/:id', {id: '@id'}, { + // Let's make the `query()` method cancellable + query: {method: 'get', isArray: true, cancellable: true} + }); + + // ...somewhere in the PlanVacationController... + ... + this.onDestinationChanged = function onDestinationChanged(destination) { + // We don't care about any pending request for hotels + // in a different destination any more + this.availableHotels.$cancelRequest(); + + // Let's query for hotels in '' + // (calls: /api/hotel?location=) + this.availableHotels = Hotel.query({location: destination}); + }; + ``` + * + */ +angular.module('ngResource', ['ng']). + provider('$resource', function() { + var PROTOCOL_AND_DOMAIN_REGEX = /^https?:\/\/[^\/]*/; + var provider = this; + + this.defaults = { + // Strip slashes by default + stripTrailingSlashes: true, + + // Default actions configuration + actions: { + 'get': {method: 'GET'}, + 'save': {method: 'POST'}, + 'query': {method: 'GET', isArray: true}, + 'remove': {method: 'DELETE'}, + 'delete': {method: 'DELETE'} + } + }; + + this.$get = ['$http', '$log', '$q', '$timeout', function($http, $log, $q, $timeout) { + + var noop = angular.noop, + forEach = angular.forEach, + extend = angular.extend, + copy = angular.copy, + isFunction = angular.isFunction; + + /** + * We need our custom method because encodeURIComponent is too aggressive and doesn't follow + * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set + * (pchar) allowed in path segments: + * segment = *pchar + * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" + * pct-encoded = "%" HEXDIG HEXDIG + * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" + * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" + * / "*" / "+" / "," / ";" / "=" + */ + function encodeUriSegment(val) { + return encodeUriQuery(val, true). + replace(/%26/gi, '&'). + replace(/%3D/gi, '='). + replace(/%2B/gi, '+'); + } + + + /** + * This method is intended for encoding *key* or *value* parts of query component. We need a + * custom method because encodeURIComponent is too aggressive and encodes stuff that doesn't + * have to be encoded per http://tools.ietf.org/html/rfc3986: + * query = *( pchar / "/" / "?" ) + * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" + * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" + * pct-encoded = "%" HEXDIG HEXDIG + * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" + * / "*" / "+" / "," / ";" / "=" + */ + function encodeUriQuery(val, pctEncodeSpaces) { + return encodeURIComponent(val). + replace(/%40/gi, '@'). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, (pctEncodeSpaces ? '%20' : '+')); + } + + function Route(template, defaults) { + this.template = template; + this.defaults = extend({}, provider.defaults, defaults); + this.urlParams = {}; + } + + Route.prototype = { + setUrlParams: function(config, params, actionUrl) { + var self = this, + url = actionUrl || self.template, + val, + encodedVal, + protocolAndDomain = ''; + + var urlParams = self.urlParams = {}; + forEach(url.split(/\W/), function(param) { + if (param === 'hasOwnProperty') { + throw $resourceMinErr('badname', "hasOwnProperty is not a valid parameter name."); + } + if (!(new RegExp("^\\d+$").test(param)) && param && + (new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) { + urlParams[param] = { + isQueryParamValue: (new RegExp("\\?.*=:" + param + "(?:\\W|$)")).test(url) + }; + } + }); + url = url.replace(/\\:/g, ':'); + url = url.replace(PROTOCOL_AND_DOMAIN_REGEX, function(match) { + protocolAndDomain = match; + return ''; + }); + + params = params || {}; + forEach(self.urlParams, function(paramInfo, urlParam) { + val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam]; + if (angular.isDefined(val) && val !== null) { + if (paramInfo.isQueryParamValue) { + encodedVal = encodeUriQuery(val, true); + } else { + encodedVal = encodeUriSegment(val); + } + url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), function(match, p1) { + return encodedVal + p1; + }); + } else { + url = url.replace(new RegExp("(\/?):" + urlParam + "(\\W|$)", "g"), function(match, + leadingSlashes, tail) { + if (tail.charAt(0) == '/') { + return tail; + } else { + return leadingSlashes + tail; + } + }); + } + }); + + // strip trailing slashes and set the url (unless this behavior is specifically disabled) + if (self.defaults.stripTrailingSlashes) { + url = url.replace(/\/+$/, '') || '/'; + } + + // then replace collapse `/.` if found in the last URL path segment before the query + // E.g. `http://url.com/id./format?q=x` becomes `http://url.com/id.format?q=x` + url = url.replace(/\/\.(?=\w+($|\?))/, '.'); + // replace escaped `/\.` with `/.` + config.url = protocolAndDomain + url.replace(/\/\\\./, '/.'); + + + // set params - delegate param encoding to $http + forEach(params, function(value, key) { + if (!self.urlParams[key]) { + config.params = config.params || {}; + config.params[key] = value; + } + }); + } + }; + + + function resourceFactory(url, paramDefaults, actions, options) { + var route = new Route(url, options); + + actions = extend({}, provider.defaults.actions, actions); + + function extractParams(data, actionParams) { + var ids = {}; + actionParams = extend({}, paramDefaults, actionParams); + forEach(actionParams, function(value, key) { + if (isFunction(value)) { value = value(); } + ids[key] = value && value.charAt && value.charAt(0) == '@' ? + lookupDottedPath(data, value.substr(1)) : value; + }); + return ids; + } + + function defaultResponseInterceptor(response) { + return response.resource; + } + + function Resource(value) { + shallowClearAndCopy(value || {}, this); + } + + Resource.prototype.toJSON = function() { + var data = extend({}, this); + delete data.$promise; + delete data.$resolved; + return data; + }; + + forEach(actions, function(action, name) { + var hasBody = /^(POST|PUT|PATCH)$/i.test(action.method); + var numericTimeout = action.timeout; + var cancellable = angular.isDefined(action.cancellable) ? action.cancellable : + (options && angular.isDefined(options.cancellable)) ? options.cancellable : + provider.defaults.cancellable; + + if (numericTimeout && !angular.isNumber(numericTimeout)) { + $log.debug('ngResource:\n' + + ' Only numeric values are allowed as `timeout`.\n' + + ' Promises are not supported in $resource, because the same value would ' + + 'be used for multiple requests. If you are looking for a way to cancel ' + + 'requests, you should use the `cancellable` option.'); + delete action.timeout; + numericTimeout = null; + } + + Resource[name] = function(a1, a2, a3, a4) { + var params = {}, data, success, error; + + /* jshint -W086 */ /* (purposefully fall through case statements) */ + switch (arguments.length) { + case 4: + error = a4; + success = a3; + //fallthrough + case 3: + case 2: + if (isFunction(a2)) { + if (isFunction(a1)) { + success = a1; + error = a2; + break; + } + + success = a2; + error = a3; + //fallthrough + } else { + params = a1; + data = a2; + success = a3; + break; + } + case 1: + if (isFunction(a1)) success = a1; + else if (hasBody) data = a1; + else params = a1; + break; + case 0: break; + default: + throw $resourceMinErr('badargs', + "Expected up to 4 arguments [params, data, success, error], got {0} arguments", + arguments.length); + } + /* jshint +W086 */ /* (purposefully fall through case statements) */ + + var isInstanceCall = this instanceof Resource; + var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data)); + var httpConfig = {}; + var responseInterceptor = action.interceptor && action.interceptor.response || + defaultResponseInterceptor; + var responseErrorInterceptor = action.interceptor && action.interceptor.responseError || + undefined; + var timeoutDeferred; + var numericTimeoutPromise; + + forEach(action, function(value, key) { + switch (key) { + default: + httpConfig[key] = copy(value); + break; + case 'params': + case 'isArray': + case 'interceptor': + case 'cancellable': + break; + } + }); + + if (!isInstanceCall && cancellable) { + timeoutDeferred = $q.defer(); + httpConfig.timeout = timeoutDeferred.promise; + + if (numericTimeout) { + numericTimeoutPromise = $timeout(timeoutDeferred.resolve, numericTimeout); + } + } + + if (hasBody) httpConfig.data = data; + route.setUrlParams(httpConfig, + extend({}, extractParams(data, action.params || {}), params), + action.url); + + var promise = $http(httpConfig).then(function(response) { + var data = response.data; + + if (data) { + // Need to convert action.isArray to boolean in case it is undefined + // jshint -W018 + if (angular.isArray(data) !== (!!action.isArray)) { + throw $resourceMinErr('badcfg', + 'Error in resource configuration for action `{0}`. Expected response to ' + + 'contain an {1} but got an {2} (Request: {3} {4})', name, action.isArray ? 'array' : 'object', + angular.isArray(data) ? 'array' : 'object', httpConfig.method, httpConfig.url); + } + // jshint +W018 + if (action.isArray) { + value.length = 0; + forEach(data, function(item) { + if (typeof item === "object") { + value.push(new Resource(item)); + } else { + // Valid JSON values may be string literals, and these should not be converted + // into objects. These items will not have access to the Resource prototype + // methods, but unfortunately there + value.push(item); + } + }); + } else { + var promise = value.$promise; // Save the promise + shallowClearAndCopy(data, value); + value.$promise = promise; // Restore the promise + } + } + response.resource = value; + + return response; + }, function(response) { + (error || noop)(response); + return $q.reject(response); + }); + + promise.finally(function() { + value.$resolved = true; + if (!isInstanceCall && cancellable) { + value.$cancelRequest = angular.noop; + $timeout.cancel(numericTimeoutPromise); + timeoutDeferred = numericTimeoutPromise = httpConfig.timeout = null; + } + }); + + promise = promise.then( + function(response) { + var value = responseInterceptor(response); + (success || noop)(value, response.headers); + return value; + }, + responseErrorInterceptor); + + if (!isInstanceCall) { + // we are creating instance / collection + // - set the initial promise + // - return the instance / collection + value.$promise = promise; + value.$resolved = false; + if (cancellable) value.$cancelRequest = timeoutDeferred.resolve; + + return value; + } + + // instance call + return promise; + }; + + + Resource.prototype['$' + name] = function(params, success, error) { + if (isFunction(params)) { + error = success; success = params; params = {}; + } + var result = Resource[name].call(this, params, this, success, error); + return result.$promise || result; + }; + }); + + Resource.bind = function(additionalParamDefaults) { + return resourceFactory(url, extend({}, paramDefaults, additionalParamDefaults), actions); + }; + + return Resource; + } + + return resourceFactory; + }]; + }); + + +})(window, window.angular); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.min.js new file mode 100644 index 0000000..306657d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-resource.min.js @@ -0,0 +1,15 @@ +/* + AngularJS v1.5.0 + (c) 2010-2016 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(Q,d,G){'use strict';function H(t,g){g=g||{};d.forEach(g,function(d,q){delete g[q]});for(var q in t)!t.hasOwnProperty(q)||"$"===q.charAt(0)&&"$"===q.charAt(1)||(g[q]=t[q]);return g}var z=d.$$minErr("$resource"),N=/^(\.[a-zA-Z_$@][0-9a-zA-Z_$@]*)+$/;d.module("ngResource",["ng"]).provider("$resource",function(){var t=/^https?:\/\/[^\/]*/,g=this;this.defaults={stripTrailingSlashes:!0,actions:{get:{method:"GET"},save:{method:"POST"},query:{method:"GET",isArray:!0},remove:{method:"DELETE"},"delete":{method:"DELETE"}}}; +this.$get=["$http","$log","$q","$timeout",function(q,M,I,J){function A(d,h){return encodeURIComponent(d).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,h?"%20":"+")}function B(d,h){this.template=d;this.defaults=v({},g.defaults,h);this.urlParams={}}function K(e,h,n,k){function c(a,b){var c={};b=v({},h,b);u(b,function(b,h){x(b)&&(b=b());var f;if(b&&b.charAt&&"@"==b.charAt(0)){f=a;var l=b.substr(1);if(null==l||""===l||"hasOwnProperty"===l||!N.test("."+ +l))throw z("badmember",l);for(var l=l.split("."),m=0,k=l.length;m + */ + /* global -ngRouteModule */ +var ngRouteModule = angular.module('ngRoute', ['ng']). + provider('$route', $RouteProvider), + $routeMinErr = angular.$$minErr('ngRoute'); + +/** + * @ngdoc provider + * @name $routeProvider + * + * @description + * + * Used for configuring routes. + * + * ## Example + * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`. + * + * ## Dependencies + * Requires the {@link ngRoute `ngRoute`} module to be installed. + */ +function $RouteProvider() { + function inherit(parent, extra) { + return angular.extend(Object.create(parent), extra); + } + + var routes = {}; + + /** + * @ngdoc method + * @name $routeProvider#when + * + * @param {string} path Route path (matched against `$location.path`). If `$location.path` + * contains redundant trailing slash or is missing one, the route will still match and the + * `$location.path` will be updated to add or drop the trailing slash to exactly match the + * route definition. + * + * * `path` can contain named groups starting with a colon: e.g. `:name`. All characters up + * to the next slash are matched and stored in `$routeParams` under the given `name` + * when the route matches. + * * `path` can contain named groups starting with a colon and ending with a star: + * e.g.`:name*`. All characters are eagerly stored in `$routeParams` under the given `name` + * when the route matches. + * * `path` can contain optional named groups with a question mark: e.g.`:name?`. + * + * For example, routes like `/color/:color/largecode/:largecode*\/edit` will match + * `/color/brown/largecode/code/with/slashes/edit` and extract: + * + * * `color: brown` + * * `largecode: code/with/slashes`. + * + * + * @param {Object} route Mapping information to be assigned to `$route.current` on route + * match. + * + * Object properties: + * + * - `controller` – `{(string|function()=}` – Controller fn that should be associated with + * newly created scope or the name of a {@link angular.Module#controller registered + * controller} if passed as a string. + * - `controllerAs` – `{string=}` – An identifier name for a reference to the controller. + * If present, the controller will be published to scope under the `controllerAs` name. + * - `template` – `{string=|function()=}` – html template as a string or a function that + * returns an html template as a string which should be used by {@link + * ngRoute.directive:ngView ngView} or {@link ng.directive:ngInclude ngInclude} directives. + * This property takes precedence over `templateUrl`. + * + * If `template` is a function, it will be called with the following parameters: + * + * - `{Array.}` - route parameters extracted from the current + * `$location.path()` by applying the current route + * + * - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html + * template that should be used by {@link ngRoute.directive:ngView ngView}. + * + * If `templateUrl` is a function, it will be called with the following parameters: + * + * - `{Array.}` - route parameters extracted from the current + * `$location.path()` by applying the current route + * + * - `resolve` - `{Object.=}` - An optional map of dependencies which should + * be injected into the controller. If any of these dependencies are promises, the router + * will wait for them all to be resolved or one to be rejected before the controller is + * instantiated. + * If all the promises are resolved successfully, the values of the resolved promises are + * injected and {@link ngRoute.$route#$routeChangeSuccess $routeChangeSuccess} event is + * fired. If any of the promises are rejected the + * {@link ngRoute.$route#$routeChangeError $routeChangeError} event is fired. + * For easier access to the resolved dependencies from the template, the `resolve` map will + * be available on the scope of the route, under `$resolve` (by default) or a custom name + * specified by the `resolveAs` property (see below). This can be particularly useful, when + * working with {@link angular.Module#component components} as route templates.
    + *
    + * **Note:** If your scope already contains a property with this name, it will be hidden + * or overwritten. Make sure, you specify an appropriate name for this property, that + * does not collide with other properties on the scope. + *
    + * The map object is: + * + * - `key` – `{string}`: a name of a dependency to be injected into the controller. + * - `factory` - `{string|function}`: If `string` then it is an alias for a service. + * Otherwise if function, then it is {@link auto.$injector#invoke injected} + * and the return value is treated as the dependency. If the result is a promise, it is + * resolved before its value is injected into the controller. Be aware that + * `ngRoute.$routeParams` will still refer to the previous route within these resolve + * functions. Use `$route.current.params` to access the new route parameters, instead. + * + * - `resolveAs` - `{string=}` - The name under which the `resolve` map will be available on + * the scope of the route. If omitted, defaults to `$resolve`. + * + * - `redirectTo` – `{(string|function())=}` – value to update + * {@link ng.$location $location} path with and trigger route redirection. + * + * If `redirectTo` is a function, it will be called with the following parameters: + * + * - `{Object.}` - route parameters extracted from the current + * `$location.path()` by applying the current route templateUrl. + * - `{string}` - current `$location.path()` + * - `{Object}` - current `$location.search()` + * + * The custom `redirectTo` function is expected to return a string which will be used + * to update `$location.path()` and `$location.search()`. + * + * - `[reloadOnSearch=true]` - `{boolean=}` - reload route when only `$location.search()` + * or `$location.hash()` changes. + * + * If the option is set to `false` and url in the browser changes, then + * `$routeUpdate` event is broadcasted on the root scope. + * + * - `[caseInsensitiveMatch=false]` - `{boolean=}` - match routes without being case sensitive + * + * If the option is set to `true`, then the particular route can be matched without being + * case sensitive + * + * @returns {Object} self + * + * @description + * Adds a new route definition to the `$route` service. + */ + this.when = function(path, route) { + //copy original route object to preserve params inherited from proto chain + var routeCopy = angular.copy(route); + if (angular.isUndefined(routeCopy.reloadOnSearch)) { + routeCopy.reloadOnSearch = true; + } + if (angular.isUndefined(routeCopy.caseInsensitiveMatch)) { + routeCopy.caseInsensitiveMatch = this.caseInsensitiveMatch; + } + routes[path] = angular.extend( + routeCopy, + path && pathRegExp(path, routeCopy) + ); + + // create redirection for trailing slashes + if (path) { + var redirectPath = (path[path.length - 1] == '/') + ? path.substr(0, path.length - 1) + : path + '/'; + + routes[redirectPath] = angular.extend( + {redirectTo: path}, + pathRegExp(redirectPath, routeCopy) + ); + } + + return this; + }; + + /** + * @ngdoc property + * @name $routeProvider#caseInsensitiveMatch + * @description + * + * A boolean property indicating if routes defined + * using this provider should be matched using a case insensitive + * algorithm. Defaults to `false`. + */ + this.caseInsensitiveMatch = false; + + /** + * @param path {string} path + * @param opts {Object} options + * @return {?Object} + * + * @description + * Normalizes the given path, returning a regular expression + * and the original path. + * + * Inspired by pathRexp in visionmedia/express/lib/utils.js. + */ + function pathRegExp(path, opts) { + var insensitive = opts.caseInsensitiveMatch, + ret = { + originalPath: path, + regexp: path + }, + keys = ret.keys = []; + + path = path + .replace(/([().])/g, '\\$1') + .replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option) { + var optional = option === '?' ? option : null; + var star = option === '*' ? option : null; + keys.push({ name: key, optional: !!optional }); + slash = slash || ''; + return '' + + (optional ? '' : slash) + + '(?:' + + (optional ? slash : '') + + (star && '(.+?)' || '([^/]+)') + + (optional || '') + + ')' + + (optional || ''); + }) + .replace(/([\/$\*])/g, '\\$1'); + + ret.regexp = new RegExp('^' + path + '$', insensitive ? 'i' : ''); + return ret; + } + + /** + * @ngdoc method + * @name $routeProvider#otherwise + * + * @description + * Sets route definition that will be used on route change when no other route definition + * is matched. + * + * @param {Object|string} params Mapping information to be assigned to `$route.current`. + * If called with a string, the value maps to `redirectTo`. + * @returns {Object} self + */ + this.otherwise = function(params) { + if (typeof params === 'string') { + params = {redirectTo: params}; + } + this.when(null, params); + return this; + }; + + + this.$get = ['$rootScope', + '$location', + '$routeParams', + '$q', + '$injector', + '$templateRequest', + '$sce', + function($rootScope, $location, $routeParams, $q, $injector, $templateRequest, $sce) { + + /** + * @ngdoc service + * @name $route + * @requires $location + * @requires $routeParams + * + * @property {Object} current Reference to the current route definition. + * The route definition contains: + * + * - `controller`: The controller constructor as defined in the route definition. + * - `locals`: A map of locals which is used by {@link ng.$controller $controller} service for + * controller instantiation. The `locals` contain + * the resolved values of the `resolve` map. Additionally the `locals` also contain: + * + * - `$scope` - The current route scope. + * - `$template` - The current route template HTML. + * + * The `locals` will be assigned to the route scope's `$resolve` property. You can override + * the property name, using `resolveAs` in the route definition. See + * {@link ngRoute.$routeProvider $routeProvider} for more info. + * + * @property {Object} routes Object with all route configuration Objects as its properties. + * + * @description + * `$route` is used for deep-linking URLs to controllers and views (HTML partials). + * It watches `$location.url()` and tries to map the path to an existing route definition. + * + * Requires the {@link ngRoute `ngRoute`} module to be installed. + * + * You can define routes through {@link ngRoute.$routeProvider $routeProvider}'s API. + * + * The `$route` service is typically used in conjunction with the + * {@link ngRoute.directive:ngView `ngView`} directive and the + * {@link ngRoute.$routeParams `$routeParams`} service. + * + * @example + * This example shows how changing the URL hash causes the `$route` to match a route against the + * URL, and the `ngView` pulls in the partial. + * + * + * + *
    + * Choose: + * Moby | + * Moby: Ch1 | + * Gatsby | + * Gatsby: Ch4 | + * Scarlet Letter
    + * + *
    + * + *
    + * + *
    $location.path() = {{$location.path()}}
    + *
    $route.current.templateUrl = {{$route.current.templateUrl}}
    + *
    $route.current.params = {{$route.current.params}}
    + *
    $route.current.scope.name = {{$route.current.scope.name}}
    + *
    $routeParams = {{$routeParams}}
    + *
    + *
    + * + * + * controller: {{name}}
    + * Book Id: {{params.bookId}}
    + *
    + * + * + * controller: {{name}}
    + * Book Id: {{params.bookId}}
    + * Chapter Id: {{params.chapterId}} + *
    + * + * + * angular.module('ngRouteExample', ['ngRoute']) + * + * .controller('MainController', function($scope, $route, $routeParams, $location) { + * $scope.$route = $route; + * $scope.$location = $location; + * $scope.$routeParams = $routeParams; + * }) + * + * .controller('BookController', function($scope, $routeParams) { + * $scope.name = "BookController"; + * $scope.params = $routeParams; + * }) + * + * .controller('ChapterController', function($scope, $routeParams) { + * $scope.name = "ChapterController"; + * $scope.params = $routeParams; + * }) + * + * .config(function($routeProvider, $locationProvider) { + * $routeProvider + * .when('/Book/:bookId', { + * templateUrl: 'book.html', + * controller: 'BookController', + * resolve: { + * // I will cause a 1 second delay + * delay: function($q, $timeout) { + * var delay = $q.defer(); + * $timeout(delay.resolve, 1000); + * return delay.promise; + * } + * } + * }) + * .when('/Book/:bookId/ch/:chapterId', { + * templateUrl: 'chapter.html', + * controller: 'ChapterController' + * }); + * + * // configure html5 to get links working on jsfiddle + * $locationProvider.html5Mode(true); + * }); + * + * + * + * + * it('should load and compile correct template', function() { + * element(by.linkText('Moby: Ch1')).click(); + * var content = element(by.css('[ng-view]')).getText(); + * expect(content).toMatch(/controller\: ChapterController/); + * expect(content).toMatch(/Book Id\: Moby/); + * expect(content).toMatch(/Chapter Id\: 1/); + * + * element(by.partialLinkText('Scarlet')).click(); + * + * content = element(by.css('[ng-view]')).getText(); + * expect(content).toMatch(/controller\: BookController/); + * expect(content).toMatch(/Book Id\: Scarlet/); + * }); + * + *
    + */ + + /** + * @ngdoc event + * @name $route#$routeChangeStart + * @eventType broadcast on root scope + * @description + * Broadcasted before a route change. At this point the route services starts + * resolving all of the dependencies needed for the route change to occur. + * Typically this involves fetching the view template as well as any dependencies + * defined in `resolve` route property. Once all of the dependencies are resolved + * `$routeChangeSuccess` is fired. + * + * The route change (and the `$location` change that triggered it) can be prevented + * by calling `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} + * for more details about event object. + * + * @param {Object} angularEvent Synthetic event object. + * @param {Route} next Future route information. + * @param {Route} current Current route information. + */ + + /** + * @ngdoc event + * @name $route#$routeChangeSuccess + * @eventType broadcast on root scope + * @description + * Broadcasted after a route change has happened successfully. + * The `resolve` dependencies are now available in the `current.locals` property. + * + * {@link ngRoute.directive:ngView ngView} listens for the directive + * to instantiate the controller and render the view. + * + * @param {Object} angularEvent Synthetic event object. + * @param {Route} current Current route information. + * @param {Route|Undefined} previous Previous route information, or undefined if current is + * first route entered. + */ + + /** + * @ngdoc event + * @name $route#$routeChangeError + * @eventType broadcast on root scope + * @description + * Broadcasted if any of the resolve promises are rejected. + * + * @param {Object} angularEvent Synthetic event object + * @param {Route} current Current route information. + * @param {Route} previous Previous route information. + * @param {Route} rejection Rejection of the promise. Usually the error of the failed promise. + */ + + /** + * @ngdoc event + * @name $route#$routeUpdate + * @eventType broadcast on root scope + * @description + * The `reloadOnSearch` property has been set to false, and we are reusing the same + * instance of the Controller. + * + * @param {Object} angularEvent Synthetic event object + * @param {Route} current Current/previous route information. + */ + + var forceReload = false, + preparedRoute, + preparedRouteIsUpdateOnly, + $route = { + routes: routes, + + /** + * @ngdoc method + * @name $route#reload + * + * @description + * Causes `$route` service to reload the current route even if + * {@link ng.$location $location} hasn't changed. + * + * As a result of that, {@link ngRoute.directive:ngView ngView} + * creates new scope and reinstantiates the controller. + */ + reload: function() { + forceReload = true; + + var fakeLocationEvent = { + defaultPrevented: false, + preventDefault: function fakePreventDefault() { + this.defaultPrevented = true; + forceReload = false; + } + }; + + $rootScope.$evalAsync(function() { + prepareRoute(fakeLocationEvent); + if (!fakeLocationEvent.defaultPrevented) commitRoute(); + }); + }, + + /** + * @ngdoc method + * @name $route#updateParams + * + * @description + * Causes `$route` service to update the current URL, replacing + * current route parameters with those specified in `newParams`. + * Provided property names that match the route's path segment + * definitions will be interpolated into the location's path, while + * remaining properties will be treated as query params. + * + * @param {!Object} newParams mapping of URL parameter names to values + */ + updateParams: function(newParams) { + if (this.current && this.current.$$route) { + newParams = angular.extend({}, this.current.params, newParams); + $location.path(interpolate(this.current.$$route.originalPath, newParams)); + // interpolate modifies newParams, only query params are left + $location.search(newParams); + } else { + throw $routeMinErr('norout', 'Tried updating route when with no current route'); + } + } + }; + + $rootScope.$on('$locationChangeStart', prepareRoute); + $rootScope.$on('$locationChangeSuccess', commitRoute); + + return $route; + + ///////////////////////////////////////////////////// + + /** + * @param on {string} current url + * @param route {Object} route regexp to match the url against + * @return {?Object} + * + * @description + * Check if the route matches the current url. + * + * Inspired by match in + * visionmedia/express/lib/router/router.js. + */ + function switchRouteMatcher(on, route) { + var keys = route.keys, + params = {}; + + if (!route.regexp) return null; + + var m = route.regexp.exec(on); + if (!m) return null; + + for (var i = 1, len = m.length; i < len; ++i) { + var key = keys[i - 1]; + + var val = m[i]; + + if (key && val) { + params[key.name] = val; + } + } + return params; + } + + function prepareRoute($locationEvent) { + var lastRoute = $route.current; + + preparedRoute = parseRoute(); + preparedRouteIsUpdateOnly = preparedRoute && lastRoute && preparedRoute.$$route === lastRoute.$$route + && angular.equals(preparedRoute.pathParams, lastRoute.pathParams) + && !preparedRoute.reloadOnSearch && !forceReload; + + if (!preparedRouteIsUpdateOnly && (lastRoute || preparedRoute)) { + if ($rootScope.$broadcast('$routeChangeStart', preparedRoute, lastRoute).defaultPrevented) { + if ($locationEvent) { + $locationEvent.preventDefault(); + } + } + } + } + + function commitRoute() { + var lastRoute = $route.current; + var nextRoute = preparedRoute; + + if (preparedRouteIsUpdateOnly) { + lastRoute.params = nextRoute.params; + angular.copy(lastRoute.params, $routeParams); + $rootScope.$broadcast('$routeUpdate', lastRoute); + } else if (nextRoute || lastRoute) { + forceReload = false; + $route.current = nextRoute; + if (nextRoute) { + if (nextRoute.redirectTo) { + if (angular.isString(nextRoute.redirectTo)) { + $location.path(interpolate(nextRoute.redirectTo, nextRoute.params)).search(nextRoute.params) + .replace(); + } else { + $location.url(nextRoute.redirectTo(nextRoute.pathParams, $location.path(), $location.search())) + .replace(); + } + } + } + + $q.when(nextRoute). + then(function() { + if (nextRoute) { + var locals = angular.extend({}, nextRoute.resolve), + template, templateUrl; + + angular.forEach(locals, function(value, key) { + locals[key] = angular.isString(value) ? + $injector.get(value) : $injector.invoke(value, null, null, key); + }); + + if (angular.isDefined(template = nextRoute.template)) { + if (angular.isFunction(template)) { + template = template(nextRoute.params); + } + } else if (angular.isDefined(templateUrl = nextRoute.templateUrl)) { + if (angular.isFunction(templateUrl)) { + templateUrl = templateUrl(nextRoute.params); + } + if (angular.isDefined(templateUrl)) { + nextRoute.loadedTemplateUrl = $sce.valueOf(templateUrl); + template = $templateRequest(templateUrl); + } + } + if (angular.isDefined(template)) { + locals['$template'] = template; + } + return $q.all(locals); + } + }). + then(function(locals) { + // after route change + if (nextRoute == $route.current) { + if (nextRoute) { + nextRoute.locals = locals; + angular.copy(nextRoute.params, $routeParams); + } + $rootScope.$broadcast('$routeChangeSuccess', nextRoute, lastRoute); + } + }, function(error) { + if (nextRoute == $route.current) { + $rootScope.$broadcast('$routeChangeError', nextRoute, lastRoute, error); + } + }); + } + } + + + /** + * @returns {Object} the current active route, by matching it against the URL + */ + function parseRoute() { + // Match a route + var params, match; + angular.forEach(routes, function(route, path) { + if (!match && (params = switchRouteMatcher($location.path(), route))) { + match = inherit(route, { + params: angular.extend({}, $location.search(), params), + pathParams: params}); + match.$$route = route; + } + }); + // No route matched; fallback to "otherwise" route + return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}}); + } + + /** + * @returns {string} interpolation of the redirect path with the parameters + */ + function interpolate(string, params) { + var result = []; + angular.forEach((string || '').split(':'), function(segment, i) { + if (i === 0) { + result.push(segment); + } else { + var segmentMatch = segment.match(/(\w+)(?:[?*])?(.*)/); + var key = segmentMatch[1]; + result.push(params[key]); + result.push(segmentMatch[2] || ''); + delete params[key]; + } + }); + return result.join(''); + } + }]; +} + +ngRouteModule.provider('$routeParams', $RouteParamsProvider); + + +/** + * @ngdoc service + * @name $routeParams + * @requires $route + * + * @description + * The `$routeParams` service allows you to retrieve the current set of route parameters. + * + * Requires the {@link ngRoute `ngRoute`} module to be installed. + * + * The route parameters are a combination of {@link ng.$location `$location`}'s + * {@link ng.$location#search `search()`} and {@link ng.$location#path `path()`}. + * The `path` parameters are extracted when the {@link ngRoute.$route `$route`} path is matched. + * + * In case of parameter name collision, `path` params take precedence over `search` params. + * + * The service guarantees that the identity of the `$routeParams` object will remain unchanged + * (but its properties will likely change) even when a route change occurs. + * + * Note that the `$routeParams` are only updated *after* a route change completes successfully. + * This means that you cannot rely on `$routeParams` being correct in route resolve functions. + * Instead you can use `$route.current.params` to access the new route's parameters. + * + * @example + * ```js + * // Given: + * // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby + * // Route: /Chapter/:chapterId/Section/:sectionId + * // + * // Then + * $routeParams ==> {chapterId:'1', sectionId:'2', search:'moby'} + * ``` + */ +function $RouteParamsProvider() { + this.$get = function() { return {}; }; +} + +ngRouteModule.directive('ngView', ngViewFactory); +ngRouteModule.directive('ngView', ngViewFillContentFactory); + + +/** + * @ngdoc directive + * @name ngView + * @restrict ECA + * + * @description + * # Overview + * `ngView` is a directive that complements the {@link ngRoute.$route $route} service by + * including the rendered template of the current route into the main layout (`index.html`) file. + * Every time the current route changes, the included view changes with it according to the + * configuration of the `$route` service. + * + * Requires the {@link ngRoute `ngRoute`} module to be installed. + * + * @animations + * enter - animation is used to bring new content into the browser. + * leave - animation is used to animate existing content away. + * + * The enter and leave animation occur concurrently. + * + * @scope + * @priority 400 + * @param {string=} onload Expression to evaluate whenever the view updates. + * + * @param {string=} autoscroll Whether `ngView` should call {@link ng.$anchorScroll + * $anchorScroll} to scroll the viewport after the view is updated. + * + * - If the attribute is not set, disable scrolling. + * - If the attribute is set without value, enable scrolling. + * - Otherwise enable scrolling only if the `autoscroll` attribute value evaluated + * as an expression yields a truthy value. + * @example + + +
    + Choose: + Moby | + Moby: Ch1 | + Gatsby | + Gatsby: Ch4 | + Scarlet Letter
    + +
    +
    +
    +
    + +
    $location.path() = {{main.$location.path()}}
    +
    $route.current.templateUrl = {{main.$route.current.templateUrl}}
    +
    $route.current.params = {{main.$route.current.params}}
    +
    $routeParams = {{main.$routeParams}}
    +
    +
    + + +
    + controller: {{book.name}}
    + Book Id: {{book.params.bookId}}
    +
    +
    + + +
    + controller: {{chapter.name}}
    + Book Id: {{chapter.params.bookId}}
    + Chapter Id: {{chapter.params.chapterId}} +
    +
    + + + .view-animate-container { + position:relative; + height:100px!important; + background:white; + border:1px solid black; + height:40px; + overflow:hidden; + } + + .view-animate { + padding:10px; + } + + .view-animate.ng-enter, .view-animate.ng-leave { + transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; + + display:block; + width:100%; + border-left:1px solid black; + + position:absolute; + top:0; + left:0; + right:0; + bottom:0; + padding:10px; + } + + .view-animate.ng-enter { + left:100%; + } + .view-animate.ng-enter.ng-enter-active { + left:0; + } + .view-animate.ng-leave.ng-leave-active { + left:-100%; + } + + + + angular.module('ngViewExample', ['ngRoute', 'ngAnimate']) + .config(['$routeProvider', '$locationProvider', + function($routeProvider, $locationProvider) { + $routeProvider + .when('/Book/:bookId', { + templateUrl: 'book.html', + controller: 'BookCtrl', + controllerAs: 'book' + }) + .when('/Book/:bookId/ch/:chapterId', { + templateUrl: 'chapter.html', + controller: 'ChapterCtrl', + controllerAs: 'chapter' + }); + + $locationProvider.html5Mode(true); + }]) + .controller('MainCtrl', ['$route', '$routeParams', '$location', + function($route, $routeParams, $location) { + this.$route = $route; + this.$location = $location; + this.$routeParams = $routeParams; + }]) + .controller('BookCtrl', ['$routeParams', function($routeParams) { + this.name = "BookCtrl"; + this.params = $routeParams; + }]) + .controller('ChapterCtrl', ['$routeParams', function($routeParams) { + this.name = "ChapterCtrl"; + this.params = $routeParams; + }]); + + + + + it('should load and compile correct template', function() { + element(by.linkText('Moby: Ch1')).click(); + var content = element(by.css('[ng-view]')).getText(); + expect(content).toMatch(/controller\: ChapterCtrl/); + expect(content).toMatch(/Book Id\: Moby/); + expect(content).toMatch(/Chapter Id\: 1/); + + element(by.partialLinkText('Scarlet')).click(); + + content = element(by.css('[ng-view]')).getText(); + expect(content).toMatch(/controller\: BookCtrl/); + expect(content).toMatch(/Book Id\: Scarlet/); + }); + +
    + */ + + +/** + * @ngdoc event + * @name ngView#$viewContentLoaded + * @eventType emit on the current ngView scope + * @description + * Emitted every time the ngView content is reloaded. + */ +ngViewFactory.$inject = ['$route', '$anchorScroll', '$animate']; +function ngViewFactory($route, $anchorScroll, $animate) { + return { + restrict: 'ECA', + terminal: true, + priority: 400, + transclude: 'element', + link: function(scope, $element, attr, ctrl, $transclude) { + var currentScope, + currentElement, + previousLeaveAnimation, + autoScrollExp = attr.autoscroll, + onloadExp = attr.onload || ''; + + scope.$on('$routeChangeSuccess', update); + update(); + + function cleanupLastView() { + if (previousLeaveAnimation) { + $animate.cancel(previousLeaveAnimation); + previousLeaveAnimation = null; + } + + if (currentScope) { + currentScope.$destroy(); + currentScope = null; + } + if (currentElement) { + previousLeaveAnimation = $animate.leave(currentElement); + previousLeaveAnimation.then(function() { + previousLeaveAnimation = null; + }); + currentElement = null; + } + } + + function update() { + var locals = $route.current && $route.current.locals, + template = locals && locals.$template; + + if (angular.isDefined(template)) { + var newScope = scope.$new(); + var current = $route.current; + + // Note: This will also link all children of ng-view that were contained in the original + // html. If that content contains controllers, ... they could pollute/change the scope. + // However, using ng-view on an element with additional content does not make sense... + // Note: We can't remove them in the cloneAttchFn of $transclude as that + // function is called before linking the content, which would apply child + // directives to non existing elements. + var clone = $transclude(newScope, function(clone) { + $animate.enter(clone, null, currentElement || $element).then(function onNgViewEnter() { + if (angular.isDefined(autoScrollExp) + && (!autoScrollExp || scope.$eval(autoScrollExp))) { + $anchorScroll(); + } + }); + cleanupLastView(); + }); + + currentElement = clone; + currentScope = current.scope = newScope; + currentScope.$emit('$viewContentLoaded'); + currentScope.$eval(onloadExp); + } else { + cleanupLastView(); + } + } + } + }; +} + +// This directive is called during the $transclude call of the first `ngView` directive. +// It will replace and compile the content of the element with the loaded template. +// We need this directive so that the element content is already filled when +// the link function of another directive on the same element as ngView +// is called. +ngViewFillContentFactory.$inject = ['$compile', '$controller', '$route']; +function ngViewFillContentFactory($compile, $controller, $route) { + return { + restrict: 'ECA', + priority: -400, + link: function(scope, $element) { + var current = $route.current, + locals = current.locals; + + $element.html(locals.$template); + + var link = $compile($element.contents()); + + if (current.controller) { + locals.$scope = scope; + var controller = $controller(current.controller, locals); + if (current.controllerAs) { + scope[current.controllerAs] = controller; + } + $element.data('$ngControllerController', controller); + $element.children().data('$ngControllerController', controller); + } + scope[current.resolveAs || '$resolve'] = locals; + + link(scope); + } + }; +} + + +})(window, window.angular); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.min.js new file mode 100644 index 0000000..4d0d018 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-route.min.js @@ -0,0 +1,15 @@ +/* + AngularJS v1.5.0 + (c) 2010-2016 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(r,d,C){'use strict';function x(s,h,g){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(a,c,b,f,y){function k(){n&&(g.cancel(n),n=null);l&&(l.$destroy(),l=null);m&&(n=g.leave(m),n.then(function(){n=null}),m=null)}function z(){var b=s.current&&s.current.locals;if(d.isDefined(b&&b.$template)){var b=a.$new(),f=s.current;m=y(b,function(b){g.enter(b,null,m||c).then(function(){!d.isDefined(u)||u&&!a.$eval(u)||h()});k()});l=f.scope=b;l.$emit("$viewContentLoaded"); +l.$eval(v)}else k()}var l,m,n,u=b.autoscroll,v=b.onload||"";a.$on("$routeChangeSuccess",z);z()}}}function A(d,h,g){return{restrict:"ECA",priority:-400,link:function(a,c){var b=g.current,f=b.locals;c.html(f.$template);var y=d(c.contents());if(b.controller){f.$scope=a;var k=h(b.controller,f);b.controllerAs&&(a[b.controllerAs]=k);c.data("$ngControllerController",k);c.children().data("$ngControllerController",k)}a[b.resolveAs||"$resolve"]=f;y(a)}}}r=d.module("ngRoute",["ng"]).provider("$route",function(){function s(a, +c){return d.extend(Object.create(a),c)}function h(a,d){var b=d.caseInsensitiveMatch,f={originalPath:a,regexp:a},g=f.keys=[];a=a.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)([\?\*])?/g,function(a,d,b,c){a="?"===c?c:null;c="*"===c?c:null;g.push({name:b,optional:!!a});d=d||"";return""+(a?"":d)+"(?:"+(a?d:"")+(c&&"(.+?)"||"([^/]+)")+(a||"")+")"+(a||"")}).replace(/([\/$\*])/g,"\\$1");f.regexp=new RegExp("^"+a+"$",b?"i":"");return f}var g={};this.when=function(a,c){var b=d.copy(c);d.isUndefined(b.reloadOnSearch)&& +(b.reloadOnSearch=!0);d.isUndefined(b.caseInsensitiveMatch)&&(b.caseInsensitiveMatch=this.caseInsensitiveMatch);g[a]=d.extend(b,a&&h(a,b));if(a){var f="/"==a[a.length-1]?a.substr(0,a.length-1):a+"/";g[f]=d.extend({redirectTo:a},h(f,b))}return this};this.caseInsensitiveMatch=!1;this.otherwise=function(a){"string"===typeof a&&(a={redirectTo:a});this.when(null,a);return this};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce",function(a,c,b,f,h,k,r){function l(b){var e= +t.current;(x=(p=n())&&e&&p.$$route===e.$$route&&d.equals(p.pathParams,e.pathParams)&&!p.reloadOnSearch&&!v)||!e&&!p||a.$broadcast("$routeChangeStart",p,e).defaultPrevented&&b&&b.preventDefault()}function m(){var w=t.current,e=p;if(x)w.params=e.params,d.copy(w.params,b),a.$broadcast("$routeUpdate",w);else if(e||w)v=!1,(t.current=e)&&e.redirectTo&&(d.isString(e.redirectTo)?c.path(u(e.redirectTo,e.params)).search(e.params).replace():c.url(e.redirectTo(e.pathParams,c.path(),c.search())).replace()),f.when(e).then(function(){if(e){var a= +d.extend({},e.resolve),b,c;d.forEach(a,function(b,e){a[e]=d.isString(b)?h.get(b):h.invoke(b,null,null,e)});d.isDefined(b=e.template)?d.isFunction(b)&&(b=b(e.params)):d.isDefined(c=e.templateUrl)&&(d.isFunction(c)&&(c=c(e.params)),d.isDefined(c)&&(e.loadedTemplateUrl=r.valueOf(c),b=k(c)));d.isDefined(b)&&(a.$template=b);return f.all(a)}}).then(function(c){e==t.current&&(e&&(e.locals=c,d.copy(e.params,b)),a.$broadcast("$routeChangeSuccess",e,w))},function(b){e==t.current&&a.$broadcast("$routeChangeError", +e,w,b)})}function n(){var a,b;d.forEach(g,function(f,g){var q;if(q=!b){var h=c.path();q=f.keys;var l={};if(f.regexp)if(h=f.regexp.exec(h)){for(var k=1,n=h.length;k + * + * See {@link ngSanitize.$sanitize `$sanitize`} for usage. + */ + +/** + * @ngdoc service + * @name $sanitize + * @kind function + * + * @description + * Sanitizes an html string by stripping all potentially dangerous tokens. + * + * The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are + * then serialized back to properly escaped html string. This means that no unsafe input can make + * it into the returned string. + * + * The whitelist for URL sanitization of attribute values is configured using the functions + * `aHrefSanitizationWhitelist` and `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider + * `$compileProvider`}. + * + * The input may also contain SVG markup if this is enabled via {@link $sanitizeProvider}. + * + * @param {string} html HTML input. + * @returns {string} Sanitized HTML. + * + * @example + + + +
    + Snippet: + + + + + + + + + + + + + + + + + + + + + + + + + +
    DirectiveHowSourceRendered
    ng-bind-htmlAutomatically uses $sanitize
    <div ng-bind-html="snippet">
    </div>
    ng-bind-htmlBypass $sanitize by explicitly trusting the dangerous value +
    <div ng-bind-html="deliberatelyTrustDangerousSnippet()">
    +</div>
    +
    ng-bindAutomatically escapes
    <div ng-bind="snippet">
    </div>
    +
    +
    + + it('should sanitize the html snippet by default', function() { + expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()). + toBe('

    an html\nclick here\nsnippet

    '); + }); + + it('should inline raw snippet if bound to a trusted value', function() { + expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()). + toBe("

    an html\n" + + "click here\n" + + "snippet

    "); + }); + + it('should escape snippet without any filter', function() { + expect(element(by.css('#bind-default div')).getInnerHtml()). + toBe("<p style=\"color:blue\">an html\n" + + "<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" + + "snippet</p>"); + }); + + it('should update', function() { + element(by.model('snippet')).clear(); + element(by.model('snippet')).sendKeys('new text'); + expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()). + toBe('new text'); + expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe( + 'new text'); + expect(element(by.css('#bind-default div')).getInnerHtml()).toBe( + "new <b onclick=\"alert(1)\">text</b>"); + }); +
    +
    + */ + + +/** + * @ngdoc provider + * @name $sanitizeProvider + * + * @description + * Creates and configures {@link $sanitize} instance. + */ +function $SanitizeProvider() { + var svgEnabled = false; + + this.$get = ['$$sanitizeUri', function($$sanitizeUri) { + if (svgEnabled) { + angular.extend(validElements, svgElements); + } + return function(html) { + var buf = []; + htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) { + return !/^unsafe:/.test($$sanitizeUri(uri, isImage)); + })); + return buf.join(''); + }; + }]; + + + /** + * @ngdoc method + * @name $sanitizeProvider#enableSvg + * @kind function + * + * @description + * Enables a subset of svg to be supported by the sanitizer. + * + *
    + *

    By enabling this setting without taking other precautions, you might expose your + * application to click-hijacking attacks. In these attacks, sanitized svg elements could be positioned + * outside of the containing element and be rendered over other elements on the page (e.g. a login + * link). Such behavior can then result in phishing incidents.

    + * + *

    To protect against these, explicitly setup `overflow: hidden` css rule for all potential svg + * tags within the sanitized content:

    + * + *
    + * + *
    
    +   *   .rootOfTheIncludedContent svg {
    +   *     overflow: hidden !important;
    +   *   }
    +   *   
    + *
    + * + * @param {boolean=} regexp New regexp to whitelist urls with. + * @returns {boolean|ng.$sanitizeProvider} Returns the currently configured value if called + * without an argument or self for chaining otherwise. + */ + this.enableSvg = function(enableSvg) { + if (angular.isDefined(enableSvg)) { + svgEnabled = enableSvg; + return this; + } else { + return svgEnabled; + } + }; +} + +function sanitizeText(chars) { + var buf = []; + var writer = htmlSanitizeWriter(buf, angular.noop); + writer.chars(chars); + return buf.join(''); +} + + +// Regular Expressions for parsing tags and attributes +var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, + // Match everything outside of normal chars and " (quote character) + NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g; + + +// Good source of info about elements and attributes +// http://dev.w3.org/html5/spec/Overview.html#semantics +// http://simon.html5.org/html-elements + +// Safe Void Elements - HTML5 +// http://dev.w3.org/html5/spec/Overview.html#void-elements +var voidElements = toMap("area,br,col,hr,img,wbr"); + +// Elements that you can, intentionally, leave open (and which close themselves) +// http://dev.w3.org/html5/spec/Overview.html#optional-tags +var optionalEndTagBlockElements = toMap("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"), + optionalEndTagInlineElements = toMap("rp,rt"), + optionalEndTagElements = angular.extend({}, + optionalEndTagInlineElements, + optionalEndTagBlockElements); + +// Safe Block Elements - HTML5 +var blockElements = angular.extend({}, optionalEndTagBlockElements, toMap("address,article," + + "aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5," + + "h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul")); + +// Inline Elements - HTML5 +var inlineElements = angular.extend({}, optionalEndTagInlineElements, toMap("a,abbr,acronym,b," + + "bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s," + + "samp,small,span,strike,strong,sub,sup,time,tt,u,var")); + +// SVG Elements +// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Elements +// Note: the elements animate,animateColor,animateMotion,animateTransform,set are intentionally omitted. +// They can potentially allow for arbitrary javascript to be executed. See #11290 +var svgElements = toMap("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph," + + "hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline," + + "radialGradient,rect,stop,svg,switch,text,title,tspan"); + +// Blocked Elements (will be stripped) +var blockedElements = toMap("script,style"); + +var validElements = angular.extend({}, + voidElements, + blockElements, + inlineElements, + optionalEndTagElements); + +//Attributes that have href and hence need to be sanitized +var uriAttrs = toMap("background,cite,href,longdesc,src,xlink:href"); + +var htmlAttrs = toMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' + + 'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' + + 'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' + + 'scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,' + + 'valign,value,vspace,width'); + +// SVG attributes (without "id" and "name" attributes) +// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Attributes +var svgAttrs = toMap('accent-height,accumulate,additive,alphabetic,arabic-form,ascent,' + + 'baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,' + + 'cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,' + + 'font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,' + + 'height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,' + + 'marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,' + + 'max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,' + + 'path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,' + + 'requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,' + + 'stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,' + + 'stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,' + + 'stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,' + + 'underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,' + + 'width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,' + + 'xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan', true); + +var validAttrs = angular.extend({}, + uriAttrs, + svgAttrs, + htmlAttrs); + +function toMap(str, lowercaseKeys) { + var obj = {}, items = str.split(','), i; + for (i = 0; i < items.length; i++) { + obj[lowercaseKeys ? angular.lowercase(items[i]) : items[i]] = true; + } + return obj; +} + +var inertBodyElement; +(function(window) { + var doc; + if (window.document && window.document.implementation) { + doc = window.document.implementation.createHTMLDocument("inert"); + } else { + throw $sanitizeMinErr('noinert', "Can't create an inert html document"); + } + var docElement = doc.documentElement || doc.getDocumentElement(); + var bodyElements = docElement.getElementsByTagName('body'); + + // usually there should be only one body element in the document, but IE doesn't have any, so we need to create one + if (bodyElements.length === 1) { + inertBodyElement = bodyElements[0]; + } else { + var html = doc.createElement('html'); + inertBodyElement = doc.createElement('body'); + html.appendChild(inertBodyElement); + doc.appendChild(html); + } +})(window); + +/** + * @example + * htmlParser(htmlString, { + * start: function(tag, attrs) {}, + * end: function(tag) {}, + * chars: function(text) {}, + * comment: function(text) {} + * }); + * + * @param {string} html string + * @param {object} handler + */ +function htmlParser(html, handler) { + if (html === null || html === undefined) { + html = ''; + } else if (typeof html !== 'string') { + html = '' + html; + } + inertBodyElement.innerHTML = html; + + //mXSS protection + var mXSSAttempts = 5; + do { + if (mXSSAttempts === 0) { + throw $sanitizeMinErr('uinput', "Failed to sanitize html because the input is unstable"); + } + mXSSAttempts--; + + // strip custom-namespaced attributes on IE<=11 + if (document.documentMode <= 11) { + stripCustomNsAttrs(inertBodyElement); + } + html = inertBodyElement.innerHTML; //trigger mXSS + inertBodyElement.innerHTML = html; + } while (html !== inertBodyElement.innerHTML); + + var node = inertBodyElement.firstChild; + while (node) { + switch (node.nodeType) { + case 1: // ELEMENT_NODE + handler.start(node.nodeName.toLowerCase(), attrToMap(node.attributes)); + break; + case 3: // TEXT NODE + handler.chars(node.textContent); + break; + } + + var nextNode; + if (!(nextNode = node.firstChild)) { + if (node.nodeType == 1) { + handler.end(node.nodeName.toLowerCase()); + } + nextNode = node.nextSibling; + if (!nextNode) { + while (nextNode == null) { + node = node.parentNode; + if (node === inertBodyElement) break; + nextNode = node.nextSibling; + if (node.nodeType == 1) { + handler.end(node.nodeName.toLowerCase()); + } + } + } + } + node = nextNode; + } + + while (node = inertBodyElement.firstChild) { + inertBodyElement.removeChild(node); + } +} + +function attrToMap(attrs) { + var map = {}; + for (var i = 0, ii = attrs.length; i < ii; i++) { + var attr = attrs[i]; + map[attr.name] = attr.value; + } + return map; +} + + +/** + * Escapes all potentially dangerous characters, so that the + * resulting string can be safely inserted into attribute or + * element text. + * @param value + * @returns {string} escaped text + */ +function encodeEntities(value) { + return value. + replace(/&/g, '&'). + replace(SURROGATE_PAIR_REGEXP, function(value) { + var hi = value.charCodeAt(0); + var low = value.charCodeAt(1); + return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';'; + }). + replace(NON_ALPHANUMERIC_REGEXP, function(value) { + return '&#' + value.charCodeAt(0) + ';'; + }). + replace(//g, '>'); +} + +/** + * create an HTML/XML writer which writes to buffer + * @param {Array} buf use buf.join('') to get out sanitized html string + * @returns {object} in the form of { + * start: function(tag, attrs) {}, + * end: function(tag) {}, + * chars: function(text) {}, + * comment: function(text) {} + * } + */ +function htmlSanitizeWriter(buf, uriValidator) { + var ignoreCurrentElement = false; + var out = angular.bind(buf, buf.push); + return { + start: function(tag, attrs) { + tag = angular.lowercase(tag); + if (!ignoreCurrentElement && blockedElements[tag]) { + ignoreCurrentElement = tag; + } + if (!ignoreCurrentElement && validElements[tag] === true) { + out('<'); + out(tag); + angular.forEach(attrs, function(value, key) { + var lkey=angular.lowercase(key); + var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background'); + if (validAttrs[lkey] === true && + (uriAttrs[lkey] !== true || uriValidator(value, isImage))) { + out(' '); + out(key); + out('="'); + out(encodeEntities(value)); + out('"'); + } + }); + out('>'); + } + }, + end: function(tag) { + tag = angular.lowercase(tag); + if (!ignoreCurrentElement && validElements[tag] === true && voidElements[tag] !== true) { + out(''); + } + if (tag == ignoreCurrentElement) { + ignoreCurrentElement = false; + } + }, + chars: function(chars) { + if (!ignoreCurrentElement) { + out(encodeEntities(chars)); + } + } + }; +} + + +/** + * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' attribute to declare + * ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo'). This is undesirable since we don't want + * to allow any of these custom attributes. This method strips them all. + * + * @param node Root element to process + */ +function stripCustomNsAttrs(node) { + if (node.nodeType === Node.ELEMENT_NODE) { + var attrs = node.attributes; + for (var i = 0, l = attrs.length; i < l; i++) { + var attrNode = attrs[i]; + var attrName = attrNode.name.toLowerCase(); + if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) { + node.removeAttributeNode(attrNode); + i--; + l--; + } + } + } + + var nextNode = node.firstChild; + if (nextNode) { + stripCustomNsAttrs(nextNode); + } + + nextNode = node.nextSibling; + if (nextNode) { + stripCustomNsAttrs(nextNode); + } +} + + + +// define ngSanitize module and register $sanitize service +angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider); + +/* global sanitizeText: false */ + +/** + * @ngdoc filter + * @name linky + * @kind function + * + * @description + * Finds links in text input and turns them into html links. Supports `http/https/ftp/mailto` and + * plain email address links. + * + * Requires the {@link ngSanitize `ngSanitize`} module to be installed. + * + * @param {string} text Input text. + * @param {string} target Window (`_blank|_self|_parent|_top`) or named frame to open links in. + * @param {object|function(url)} [attributes] Add custom attributes to the link element. + * + * Can be one of: + * + * - `object`: A map of attributes + * - `function`: Takes the url as a parameter and returns a map of attributes + * + * If the map of attributes contains a value for `target`, it overrides the value of + * the target parameter. + * + * + * @returns {string} Html-linkified and {@link $sanitize sanitized} text. + * + * @usage + + * + * @example + + +
    + Snippet: + + + + + + + + + + + + + + + + + + + + + + + + + + +
    FilterSourceRendered
    linky filter +
    <div ng-bind-html="snippet | linky">
    </div>
    +
    +
    +
    linky target +
    <div ng-bind-html="snippetWithSingleURL | linky:'_blank'">
    </div>
    +
    +
    +
    linky custom attributes +
    <div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}">
    </div>
    +
    +
    +
    no filter
    <div ng-bind="snippet">
    </div>
    + + + angular.module('linkyExample', ['ngSanitize']) + .controller('ExampleController', ['$scope', function($scope) { + $scope.snippet = + 'Pretty text with some links:\n'+ + 'http://angularjs.org/,\n'+ + 'mailto:us@somewhere.org,\n'+ + 'another@somewhere.org,\n'+ + 'and one more: ftp://127.0.0.1/.'; + $scope.snippetWithSingleURL = 'http://angularjs.org/'; + }]); + + + it('should linkify the snippet with urls', function() { + expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()). + toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' + + 'another@somewhere.org, and one more: ftp://127.0.0.1/.'); + expect(element.all(by.css('#linky-filter a')).count()).toEqual(4); + }); + + it('should not linkify snippet without the linky filter', function() { + expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()). + toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' + + 'another@somewhere.org, and one more: ftp://127.0.0.1/.'); + expect(element.all(by.css('#escaped-html a')).count()).toEqual(0); + }); + + it('should update', function() { + element(by.model('snippet')).clear(); + element(by.model('snippet')).sendKeys('new http://link.'); + expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()). + toBe('new http://link.'); + expect(element.all(by.css('#linky-filter a')).count()).toEqual(1); + expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()) + .toBe('new http://link.'); + }); + + it('should work with the target property', function() { + expect(element(by.id('linky-target')). + element(by.binding("snippetWithSingleURL | linky:'_blank'")).getText()). + toBe('http://angularjs.org/'); + expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank'); + }); + + it('should optionally add custom attributes', function() { + expect(element(by.id('linky-custom-attributes')). + element(by.binding("snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}")).getText()). + toBe('http://angularjs.org/'); + expect(element(by.css('#linky-custom-attributes a')).getAttribute('rel')).toEqual('nofollow'); + }); + + + */ +angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) { + var LINKY_URL_REGEXP = + /((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i, + MAILTO_REGEXP = /^mailto:/i; + + var linkyMinErr = angular.$$minErr('linky'); + var isString = angular.isString; + + return function(text, target, attributes) { + if (text == null || text === '') return text; + if (!isString(text)) throw linkyMinErr('notstring', 'Expected string but received: {0}', text); + + var match; + var raw = text; + var html = []; + var url; + var i; + while ((match = raw.match(LINKY_URL_REGEXP))) { + // We can not end in these as they are sometimes found at the end of the sentence + url = match[0]; + // if we did not match ftp/http/www/mailto then assume mailto + if (!match[2] && !match[4]) { + url = (match[3] ? 'http://' : 'mailto:') + url; + } + i = match.index; + addText(raw.substr(0, i)); + addLink(url, match[0].replace(MAILTO_REGEXP, '')); + raw = raw.substring(i + match[0].length); + } + addText(raw); + return $sanitize(html.join('')); + + function addText(text) { + if (!text) { + return; + } + html.push(sanitizeText(text)); + } + + function addLink(url, text) { + var key; + html.push(''); + addText(text); + html.push(''); + } + }; +}]); + + +})(window, window.angular); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.min.js new file mode 100644 index 0000000..135d5a0 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.min.js @@ -0,0 +1,15 @@ +/* + AngularJS v1.5.0 + (c) 2010-2016 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(A,e,B){'use strict';function C(a){var c=[];v(c,e.noop).chars(a);return c.join("")}function h(a,c){var b={},d=a.split(","),l;for(l=0;l=document.documentMode&&n(g);a=g.innerHTML;g.innerHTML=a}while(a!==g.innerHTML);for(b=g.firstChild;b;){switch(b.nodeType){case 1:c.start(b.nodeName.toLowerCase(),E(b.attributes)); +break;case 3:c.chars(b.textContent)}var d;if(!(d=b.firstChild)&&(1==b.nodeType&&c.end(b.nodeName.toLowerCase()),d=b.nextSibling,!d))for(;null==d;){b=b.parentNode;if(b===g)break;d=b.nextSibling;1==b.nodeType&&c.end(b.nodeName.toLowerCase())}b=d}for(;b=g.firstChild;)g.removeChild(b)}function E(a){for(var c={},b=0,d=a.length;b/g,">")}function v(a,c){var b=!1,d=e.bind(a,a.push);return{start:function(a,f){a=e.lowercase(a);!b&&H[a]&&(b=a);b||!0!==t[a]||(d("<"),d(a),e.forEach(f,function(b,f){var g=e.lowercase(f),h="img"===a&&"src"===g||"background"===g;!0!==I[g]||!0===y[g]&&!c(b,h)||(d(" "),d(f),d('="'),d(x(b)),d('"'))}),d(">"))},end:function(a){a=e.lowercase(a);b||!0!==t[a]||!0===z[a]||(d(""));a== +b&&(b=!1)},chars:function(a){b||d(x(a))}}}function n(a){if(a.nodeType===Node.ELEMENT_NODE)for(var c=a.attributes,b=0,d=c.length;b"\u201d\u2019]/i,b=/^mailto:/i,d=e.$$minErr("linky"),g=e.isString;return function(f,h,m){function k(a){a&&p.push(C(a))}function q(a,b){var c;p.push("');k(b);p.push("")}if(null==f||""===f)return f;if(!g(f))throw d("notstring",f);for(var r=f,p=[],s,n;f=r.match(c);)s=f[0],f[2]||f[4]||(s=(f[3]?"http://":"mailto:")+s),n=f.index,k(r.substr(0,n)),q(s,f[0].replace(b,"")),r=r.substring(n+f[0].length);k(r);return a(p.join(""))}}])})(window,window.angular); +//# sourceMappingURL=angular-sanitize.min.js.map diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.min.js.map b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.min.js.map new file mode 100644 index 0000000..7276abd --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-sanitize.min.js.map @@ -0,0 +1,8 @@ +{ +"version":3, +"file":"angular-sanitize.min.js", +"lineCount":14, +"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,IAAZ,CAAkB,QAAlB,CADV,CAEU,IAFV,CAGAkE,EAAA,CAAQF,CAAR,CACA9F,EAAAwC,KAAA,CAAU,MAAV,CAtB0B,CA9B5B,GAAY,IAAZ,EAAIsD,CAAJ,EAA6B,EAA7B,GAAoBA,CAApB,CAAiC,MAAOA,EACxC,IAAK,CAAAD,CAAA,CAASC,CAAT,CAAL,CAAqB,KAAMF,EAAA,CAAY,WAAZ,CAA8DE,CAA9D,CAAN,CAOrB,IAJA,IAAIO,EAAMP,CAAV,CACI9F,EAAO,EADX,CAEIkG,CAFJ,CAGItG,CACJ,CAAQ0G,CAAR,CAAgBD,CAAAC,MAAA,CAAUZ,CAAV,CAAhB,CAAA,CAEEQ,CAQA,CARMI,CAAA,CAAM,CAAN,CAQN,CANKA,CAAA,CAAM,CAAN,CAML,EANkBA,CAAA,CAAM,CAAN,CAMlB,GALEJ,CAKF,EALSI,CAAA,CAAM,CAAN,CAAA,CAAW,SAAX,CAAuB,SAKhC,EAL6CJ,CAK7C,EAHAtG,CAGA,CAHI0G,CAAAC,MAGJ,CAFAP,CAAA,CAAQK,CAAAG,OAAA,CAAW,CAAX,CAAc5G,CAAd,CAAR,CAEA,CADAqG,CAAA,CAAQC,CAAR,CAAaI,CAAA,CAAM,CAAN,CAAAxE,QAAA,CAAiB6D,CAAjB,CAAgC,EAAhC,CAAb,CACA,CAAAU,CAAA,CAAMA,CAAAI,UAAA,CAAc7G,CAAd,CAAkB0G,CAAA,CAAM,CAAN,CAAAzG,OAAlB,CAERmG,EAAA,CAAQK,CAAR,CACA,OAAOZ,EAAA,CAAUzF,CAAAX,KAAA,CAAU,EAAV,CAAV,CAtBiC,CARmC,CAAlC,CAA7C,CApoBsC,CAArC,CAAD,CAusBGT,MAvsBH,CAusBWA,MAAAC,QAvsBX;", +"sources":["angular-sanitize.js"], +"names":["window","angular","undefined","sanitizeText","chars","buf","htmlSanitizeWriter","writer","noop","join","toMap","str","lowercaseKeys","obj","items","split","i","length","lowercase","htmlParser","html","handler","inertBodyElement","innerHTML","mXSSAttempts","$sanitizeMinErr","document","documentMode","stripCustomNsAttrs","node","firstChild","nodeType","start","nodeName","toLowerCase","attrToMap","attributes","textContent","nextNode","end","nextSibling","parentNode","removeChild","attrs","map","ii","attr","name","value","encodeEntities","replace","SURROGATE_PAIR_REGEXP","hi","charCodeAt","low","NON_ALPHANUMERIC_REGEXP","uriValidator","ignoreCurrentElement","out","bind","push","tag","blockedElements","validElements","forEach","key","lkey","isImage","validAttrs","uriAttrs","voidElements","Node","ELEMENT_NODE","l","attrNode","attrName","indexOf","removeAttributeNode","$$minErr","optionalEndTagBlockElements","optionalEndTagInlineElements","optionalEndTagElements","extend","blockElements","inlineElements","svgElements","htmlAttrs","svgAttrs","implementation","doc","createHTMLDocument","bodyElements","getElementsByTagName","documentElement","getDocumentElement","createElement","appendChild","module","provider","$SanitizeProvider","svgEnabled","$get","$$sanitizeUri","uri","test","enableSvg","this.enableSvg","isDefined","filter","$sanitize","LINKY_URL_REGEXP","MAILTO_REGEXP","linkyMinErr","isString","text","target","addText","addLink","url","isFunction","isObject","raw","match","index","substr","substring"] +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-scenario.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-scenario.js new file mode 100644 index 0000000..20af805 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/external/angular-1.5/angular-scenario.js @@ -0,0 +1,41849 @@ +/*! + * jQuery JavaScript Library v2.1.1 + * http://jquery.com/ + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * + * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2014-05-01T17:11Z + */ + +(function( global, factory ) {'use strict'; + + if ( typeof module === "object" && typeof module.exports === "object" ) { + // For CommonJS and CommonJS-like environments where a proper window is present, + // execute the factory and get jQuery + // For environments that do not inherently posses a window with a document + // (such as Node.js), expose a jQuery-making factory as module.exports + // This accentuates the need for the creation of a real window + // e.g. var jQuery = require("jquery")(window); + // See ticket #14549 for more info + module.exports = global.document ? + factory( global, true ) : + function( w ) { + if ( !w.document ) { + throw new Error( "jQuery requires a window with a document" ); + } + return factory( w ); + }; + } else { + factory( global ); + } + +// Pass this if window is not defined yet +}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { + +// Can't do this because several apps including ASP.NET trace +// the stack via arguments.caller.callee and Firefox dies if +// you try to trace through "use strict" call chains. (#13335) +// Support: Firefox 18+ +// + +var arr = []; + +var slice = arr.slice; + +var concat = arr.concat; + +var push = arr.push; + +var indexOf = arr.indexOf; + +var class2type = {}; + +var toString = class2type.toString; + +var hasOwn = class2type.hasOwnProperty; + +var support = {}; + + + +var + // Use the correct document accordingly with window argument (sandbox) + document = window.document, + + version = "2.1.1", + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); + }, + + // Support: Android<4.1 + // Make sure we trim BOM and NBSP + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([\da-z])/gi, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }; + +jQuery.fn = jQuery.prototype = { + // The current version of jQuery being used + jquery: version, + + constructor: jQuery, + + // Start with an empty selector + selector: "", + + // The default length of a jQuery object is 0 + length: 0, + + toArray: function() { + return slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num != null ? + + // Return just the one element from the set + ( num < 0 ? this[ num + this.length ] : this[ num ] ) : + + // Return all the elements in a clean array + slice.call( this ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + ret.context = this.context; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: arr.sort, + splice: arr.splice +}; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + + // skip the boolean and the target + target = arguments[ i ] || {}; + i++; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( i === length ) { + target = this; + i--; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + // Unique for each copy of jQuery on the page + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), + + // Assume jQuery is ready without the ready module + isReady: true, + + error: function( msg ) { + throw new Error( msg ); + }, + + noop: function() {}, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray, + + isWindow: function( obj ) { + return obj != null && obj === obj.window; + }, + + isNumeric: function( obj ) { + // parseFloat NaNs numeric-cast false positives (null|true|false|"") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0; + }, + + isPlainObject: function( obj ) { + // Not plain objects: + // - Any object or value whose internal [[Class]] property is not "[object Object]" + // - DOM nodes + // - window + if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + if ( obj.constructor && + !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { + return false; + } + + // If the function hasn't returned already, we're confident that + // |obj| is a plain object, created by {} or constructed with new Object + return true; + }, + + isEmptyObject: function( obj ) { + var name; + for ( name in obj ) { + return false; + } + return true; + }, + + type: function( obj ) { + if ( obj == null ) { + return obj + ""; + } + // Support: Android < 4.0, iOS < 6 (functionish RegExp) + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call(obj) ] || "object" : + typeof obj; + }, + + // Evaluates a script in a global context + globalEval: function( code ) { + var script, + indirect = eval; + + code = jQuery.trim( code ); + + if ( code ) { + // If the code includes a valid, prologue position + // strict mode pragma, execute code by injecting a + // script tag into the document. + if ( code.indexOf("use strict") === 1 ) { + script = document.createElement("script"); + script.text = code; + document.head.appendChild( script ).parentNode.removeChild( script ); + } else { + // Otherwise, avoid the DOM node creation, insertion + // and removal by using an indirect global eval + indirect( code ); + } + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + // args is for internal usage only + each: function( obj, callback, args ) { + var value, + i = 0, + length = obj.length, + isArray = isArraylike( obj ); + + if ( args ) { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } + } + + return obj; + }, + + // Support: Android<4.1 + trim: function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArraylike( Object(arr) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + return arr == null ? -1 : indexOf.call( arr, elem, i ); + }, + + merge: function( first, second ) { + var len = +second.length, + j = 0, + i = first.length; + + for ( ; j < len; j++ ) { + first[ i++ ] = second[ j ]; + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], + i = 0, + length = elems.length, + callbackExpect = !invert; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, + i = 0, + length = elems.length, + isArray = isArraylike( elems ), + ret = []; + + // Go through the array, translating each of the items to their new values + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + } + + // Flatten any nested arrays + return concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + now: Date.now, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support +}); + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +function isArraylike( obj ) { + var length = obj.length, + type = jQuery.type( obj ); + + if ( type === "function" || jQuery.isWindow( obj ) ) { + return false; + } + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; +} +var Sizzle = +/*! + * Sizzle CSS Selector Engine v1.10.19 + * http://sizzlejs.com/ + * + * Copyright 2013 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2014-04-18 + */ +(function( window ) { + +var i, + support, + Expr, + getText, + isXML, + tokenize, + compile, + select, + outermostContext, + sortInput, + hasDuplicate, + + // Local document vars + setDocument, + document, + docElem, + documentIsHTML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + + // Instance-specific data + expando = "sizzle" + -(new Date()), + preferredDoc = window.document, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }, + + // General-purpose constants + strundefined = typeof undefined, + MAX_NEGATIVE = 1 << 31, + + // Instance methods + hasOwn = ({}).hasOwnProperty, + arr = [], + pop = arr.pop, + push_native = arr.push, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf if we can't use a native one + indexOf = arr.indexOf || function( elem ) { + var i = 0, + len = this.length; + for ( ; i < len; i++ ) { + if ( this[i] === elem ) { + return i; + } + } + return -1; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + // http://www.w3.org/TR/css3-syntax/#characters + characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", + + // Loosely modeled on CSS identifier characters + // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors + // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = characterEncoding.replace( "w", "w#" ), + + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + + "*\\]", + + pseudos = ":(" + characterEncoding + ")(?:\\((" + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), + + rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + characterEncoding + ")" ), + "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), + "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rnative = /^[^{]+\{\s*\[native \w/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + rescape = /'|\\/g, + + // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), + funescape = function( _, escaped, escapedWhitespace ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + // Support: Firefox<24 + // Workaround erroneous numeric interpretation of +"0x" + return high !== high || escapedWhitespace ? + escaped : + high < 0 ? + // BMP codepoint + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }; + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + (arr = slice.call( preferredDoc.childNodes )), + preferredDoc.childNodes + ); + // Support: Android<4.0 + // Detect silently failing push.apply + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + push_native.apply( target, slice.call(els) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length, + i = 0; + // Can't trust NodeList.length + while ( (target[j++] = els[i++]) ) {} + target.length = j - 1; + } + }; +} + +function Sizzle( selector, context, results, seed ) { + var match, elem, m, nodeType, + // QSA vars + i, groups, old, nid, newContext, newSelector; + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + + context = context || document; + results = results || []; + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { + return []; + } + + if ( documentIsHTML && !seed ) { + + // Shortcuts + if ( (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document (jQuery #6963) + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + contains( context, elem ) && elem.id === m ) { + results.push( elem ); + return results; + } + } + + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // QSA path + if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { + nid = old = expando; + newContext = context; + newSelector = nodeType === 9 && selector; + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + groups = tokenize( selector ); + + if ( (old = context.getAttribute("id")) ) { + nid = old.replace( rescape, "\\$&" ); + } else { + context.setAttribute( "id", nid ); + } + nid = "[id='" + nid + "'] "; + + i = groups.length; + while ( i-- ) { + groups[i] = nid + toSelector( groups[i] ); + } + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; + newSelector = groups.join(","); + } + + if ( newSelector ) { + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute("id"); + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Create key-value caches of limited size + * @returns {Function(string, Object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key + " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key + " " ] = value); + } + return cache; +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created div and expects a boolean result + */ +function assert( fn ) { + var div = document.createElement("div"); + + try { + return !!fn( div ); + } catch (e) { + return false; + } finally { + // Remove from its parent by default + if ( div.parentNode ) { + div.parentNode.removeChild( div ); + } + // release memory in IE + div = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split("|"), + i = attrs.length; + + while ( i-- ) { + Expr.attrHandle[ arr[i] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + ( ~b.sourceIndex || MAX_NEGATIVE ) - + ( ~a.sourceIndex || MAX_NEGATIVE ); + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for positionals + * @param {Function} fn + */ +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Checks a node for validity as a Sizzle context + * @param {Element|Object=} context + * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value + */ +function testContext( context ) { + return context && typeof context.getElementsByTagName !== strundefined && context; +} + +// Expose support vars for convenience +support = Sizzle.support = {}; + +/** + * Detects XML nodes + * @param {Element|Object} elem An element or a document + * @returns {Boolean} True iff elem is a non-HTML XML node + */ +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var hasCompare, + doc = node ? node.ownerDocument || node : preferredDoc, + parent = doc.defaultView; + + // If no document and documentElement is available, return + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Set our document + document = doc; + docElem = doc.documentElement; + + // Support tests + documentIsHTML = !isXML( doc ); + + // Support: IE>8 + // If iframe document is assigned to "document" variable and if iframe has been reloaded, + // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 + // IE6-8 do not support the defaultView property so parent will be undefined + if ( parent && parent !== parent.top ) { + // IE11 does not have attachEvent, so all must suffer + if ( parent.addEventListener ) { + parent.addEventListener( "unload", function() { + setDocument(); + }, false ); + } else if ( parent.attachEvent ) { + parent.attachEvent( "onunload", function() { + setDocument(); + }); + } + } + + /* Attributes + ---------------------------------------------------------------------- */ + + // Support: IE<8 + // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) + support.attributes = assert(function( div ) { + div.className = "i"; + return !div.getAttribute("className"); + }); + + /* getElement(s)By* + ---------------------------------------------------------------------- */ + + // Check if getElementsByTagName("*") returns only elements + support.getElementsByTagName = assert(function( div ) { + div.appendChild( doc.createComment("") ); + return !div.getElementsByTagName("*").length; + }); + + // Check if getElementsByClassName can be trusted + support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) { + div.innerHTML = "
    "; + + // Support: Safari<4 + // Catch class over-caching + div.firstChild.className = "i"; + // Support: Opera<10 + // Catch gEBCN failure to find non-leading classes + return div.getElementsByClassName("i").length === 2; + }); + + // Support: IE<10 + // Check if getElementById returns elements by name + // The broken getElementById methods don't pick up programatically-set names, + // so use a roundabout getElementsByName test + support.getById = assert(function( div ) { + docElem.appendChild( div ).id = expando; + return !doc.getElementsByName || !doc.getElementsByName( expando ).length; + }); + + // ID find and filter + if ( support.getById ) { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== strundefined && documentIsHTML ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [ m ] : []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute("id") === attrId; + }; + }; + } else { + // Support: IE6/7 + // getElementById is not reliable as a find shortcut + delete Expr.find["ID"]; + + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); + return node && node.value === attrId; + }; + }; + } + + // Tag + Expr.find["TAG"] = support.getElementsByTagName ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== strundefined ) { + return context.getElementsByTagName( tag ); + } + } : + function( tag, context ) { + var elem, + tmp = [], + i = 0, + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + while ( (elem = results[i++]) ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Class + Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { + if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { + return context.getElementsByClassName( className ); + } + }; + + /* QSA/matchesSelector + ---------------------------------------------------------------------- */ + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21) + // We allow this because of a bug in IE8/9 that throws an error + // whenever `document.activeElement` is accessed on an iframe + // So, we allow :focus to pass through QSA all the time to avoid the IE error + // See http://bugs.jquery.com/ticket/13378 + rbuggyQSA = []; + + if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explicitly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + div.innerHTML = ""; + + // Support: IE8, Opera 11-12.16 + // Nothing should be selected when empty strings follow ^= or $= or *= + // The test attribute must be unknown in Opera but "safe" for WinRT + // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section + if ( div.querySelectorAll("[msallowclip^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); + } + + // Support: IE8 + // Boolean attributes and "value" are not treated correctly + if ( !div.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + }); + + assert(function( div ) { + // Support: Windows 8 Native Apps + // The type and name attributes are restricted during .innerHTML assignment + var input = doc.createElement("input"); + input.setAttribute( "type", "hidden" ); + div.appendChild( input ).setAttribute( "name", "D" ); + + // Support: IE8 + // Enforce case-sensitivity of name attribute + if ( div.querySelectorAll("[name=d]").length ) { + rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":enabled").length ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + div.querySelectorAll("*,:x"); + rbuggyQSA.push(",.*:"); + }); + } + + if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || + docElem.webkitMatchesSelector || + docElem.mozMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector) )) ) { + + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( div, "div" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( div, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + }); + } + + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); + rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); + + /* Contains + ---------------------------------------------------------------------- */ + hasCompare = rnative.test( docElem.compareDocumentPosition ); + + // Element contains another + // Purposefully does not implement inclusive descendent + // As in, an element does not contain itself + contains = hasCompare || rnative.test( docElem.contains ) ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + /* Sorting + ---------------------------------------------------------------------- */ + + // Document order sorting + sortOrder = hasCompare ? + function( a, b ) { + + // Flag for duplicate removal + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + // Sort on method existence if only one input has compareDocumentPosition + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; + if ( compare ) { + return compare; + } + + // Calculate position if both inputs belong to the same document + compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? + a.compareDocumentPosition( b ) : + + // Otherwise we know they are disconnected + 1; + + // Disconnected nodes + if ( compare & 1 || + (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { + + // Choose the first element that is related to our preferred document + if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { + return -1; + } + if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { + return 1; + } + + // Maintain original order + return sortInput ? + ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + 0; + } + + return compare & 4 ? -1 : 1; + } : + function( a, b ) { + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // Parentless nodes are either documents or disconnected + if ( !aup || !bup ) { + return a === doc ? -1 : + b === doc ? 1 : + aup ? -1 : + bup ? 1 : + sortInput ? + ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + return doc; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + if ( support.matchesSelector && documentIsHTML && + ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { + + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch(e) {} + } + + return Sizzle( expr, document, null, [ elem ] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + var fn = Expr.attrHandle[ name.toLowerCase() ], + // Don't get fooled by Object.prototype properties (jQuery #13807) + val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? + fn( elem, name, !documentIsHTML ) : + undefined; + + return val !== undefined ? + val : + support.attributes || !documentIsHTML ? + elem.getAttribute( name ) : + (val = elem.getAttributeNode(name)) && val.specified ? + val.value : + null; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Document sorting and removing duplicates + * @param {ArrayLike} results + */ +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + j = 0, + i = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + sortInput = !support.sortStable && results.slice( 0 ); + results.sort( sortOrder ); + + if ( hasDuplicate ) { + while ( (elem = results[i++]) ) { + if ( elem === results[ i ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + // Clear input after sorting to release objects + // See https://github.com/jquery/sizzle/pull/225 + sortInput = null; + + return results; +}; + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + while ( (node = elem[i++]) ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (jQuery #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + attrHandle: {}, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1].slice( 0, 3 ) === "nth" ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[6] && match[2]; + + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[3] ) { + match[2] = match[4] || match[5] || ""; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeNameSelector ) { + var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + return nodeNameSelector === "*" ? + function() { return true; } : + function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.slice( -check.length ) === check : + operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache, outerCache, node, diff, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + // Seek `elem` from a previously-cached index + outerCache = parent[ expando ] || (parent[ expando ] = {}); + cache = outerCache[ type ] || []; + nodeIndex = cache[0] === dirruns && cache[1]; + diff = cache[0] === dirruns && cache[2]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + (diff = nodeIndex = 0) || start.pop()) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + outerCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + // Use previously-cached element index if available + } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { + diff = cache[1]; + + // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) + } else { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || + (diff = nodeIndex = 0) || start.pop()) ) { + + if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { + // Cache the index of each encountered element + if ( useCache ) { + (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf.call( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + // lang value must be a valid identifier + if ( !ridentifier.test(lang || "") ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsHTML ? + elem.lang : + elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), + // but not by others (comment: 8; processing instruction: 7; etc.) + // nodeType < 6 works because attributes (2) do not appear as children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeType < 6 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + + // Support: IE<8 + // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); + }, + + // Position-in-collection + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +// Easy API for creating new setFilters +function setFilters() {} +setFilters.prototype = Expr.filters = Expr.pseudos; +Expr.setFilters = new setFilters(); + +tokenize = Sizzle.tokenize = function( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( (tokens = []) ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push({ + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, " " ) + }); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + matched = match.shift(); + tokens.push({ + value: matched, + type: type, + matches: match + }); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +}; + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + checkNonElements = base && dir === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var oldCache, outerCache, + newCache = [ dirruns, doneName ]; + + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + if ( (oldCache = outerCache[ dir ]) && + oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { + + // Assign to newCache so results back-propagate to previous elements + return (newCache[ 2 ] = oldCache[ 2 ]); + } else { + // Reuse newcache so results back-propagate to previous elements + outerCache[ dir ] = newCache; + + // A match means we're done; a fail means we have to keep checking + if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { + return true; + } + } + } + } + } + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf.call( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) + ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, outermost ) { + var elem, j, matcher, + matchedCount = 0, + i = "0", + unmatched = seed && [], + setMatched = [], + contextBackup = outermostContext, + // We must always have either seed elements or outermost context + elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), + len = elems.length; + + if ( outermost ) { + outermostContext = context !== document && context; + } + + // Add elements passing elementMatchers directly to results + // Keep `i` a string if there are no elements so `matchedCount` will be "00" below + // Support: IE<9, Safari + // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id + for ( ; i !== len && (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + while ( (matcher = elementMatchers[j++]) ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // Apply set filters to unmatched elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + j = 0; + while ( (matcher = setMatchers[j++]) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !match ) { + match = tokenize( selector ); + } + i = match.length; + while ( i-- ) { + cached = matcherFromTokens( match[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + + // Save selector and tokenization + cached.selector = selector; + } + return cached; +}; + +/** + * A low-level selection function that works with Sizzle's compiled + * selector functions + * @param {String|Function} selector A selector or a pre-compiled + * selector function built with Sizzle.compile + * @param {Element} context + * @param {Array} [results] + * @param {Array} [seed] A set of elements to match against + */ +select = Sizzle.select = function( selector, context, results, seed ) { + var i, tokens, token, type, find, + compiled = typeof selector === "function" && selector, + match = !seed && tokenize( (selector = compiled.selector || selector) ); + + results = results || []; + + // Try to minimize operations if there is no seed and only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + support.getById && context.nodeType === 9 && documentIsHTML && + Expr.relative[ tokens[1].type ] ) { + + context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; + if ( !context ) { + return results; + + // Precompiled matchers will still verify ancestry, so step up a level + } else if ( compiled ) { + context = context.parentNode; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; + } + + break; + } + } + } + } + + // Compile and execute a filtering function if one is not provided + // Provide `match` to avoid retokenization if we modified the selector above + ( compiled || compile( selector, match ) )( + seed, + context, + !documentIsHTML, + results, + rsibling.test( selector ) && testContext( context.parentNode ) || context + ); + return results; +}; + +// One-time assignments + +// Sort stability +support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; + +// Support: Chrome<14 +// Always assume duplicates if they aren't passed to the comparison function +support.detectDuplicates = !!hasDuplicate; + +// Initialize against the default document +setDocument(); + +// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) +// Detached nodes confoundingly follow *each other* +support.sortDetached = assert(function( div1 ) { + // Should return 1, but returns 4 (following) + return div1.compareDocumentPosition( document.createElement("div") ) & 1; +}); + +// Support: IE<8 +// Prevent attribute/property "interpolation" +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !assert(function( div ) { + div.innerHTML = ""; + return div.firstChild.getAttribute("href") === "#" ; +}) ) { + addHandle( "type|href|height|width", function( elem, name, isXML ) { + if ( !isXML ) { + return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); + } + }); +} + +// Support: IE<9 +// Use defaultValue in place of getAttribute("value") +if ( !support.attributes || !assert(function( div ) { + div.innerHTML = ""; + div.firstChild.setAttribute( "value", "" ); + return div.firstChild.getAttribute( "value" ) === ""; +}) ) { + addHandle( "value", function( elem, name, isXML ) { + if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { + return elem.defaultValue; + } + }); +} + +// Support: IE<9 +// Use getAttributeNode to fetch booleans when getAttribute lies +if ( !assert(function( div ) { + return div.getAttribute("disabled") == null; +}) ) { + addHandle( booleans, function( elem, name, isXML ) { + var val; + if ( !isXML ) { + return elem[ name ] === true ? name.toLowerCase() : + (val = elem.getAttributeNode( name )) && val.specified ? + val.value : + null; + } + }); +} + +return Sizzle; + +})( window ); + + + +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.pseudos; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + + +var rneedsContext = jQuery.expr.match.needsContext; + +var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); + + + +var risSimple = /^.[^:#\[\.,]*$/; + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, not ) { + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep( elements, function( elem, i ) { + /* jshint -W018 */ + return !!qualifier.call( elem, i, elem ) !== not; + }); + + } + + if ( qualifier.nodeType ) { + return jQuery.grep( elements, function( elem ) { + return ( elem === qualifier ) !== not; + }); + + } + + if ( typeof qualifier === "string" ) { + if ( risSimple.test( qualifier ) ) { + return jQuery.filter( qualifier, elements, not ); + } + + qualifier = jQuery.filter( qualifier, elements ); + } + + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) >= 0 ) !== not; + }); +} + +jQuery.filter = function( expr, elems, not ) { + var elem = elems[ 0 ]; + + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 && elem.nodeType === 1 ? + jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : + jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + })); +}; + +jQuery.fn.extend({ + find: function( selector ) { + var i, + len = this.length, + ret = [], + self = this; + + if ( typeof selector !== "string" ) { + return this.pushStack( jQuery( selector ).filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }) ); + } + + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, self[ i ], ret ); + } + + // Needed because $( selector, context ) becomes $( context ).find( selector ) + ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); + ret.selector = this.selector ? this.selector + " " + selector : selector; + return ret; + }, + filter: function( selector ) { + return this.pushStack( winnow(this, selector || [], false) ); + }, + not: function( selector ) { + return this.pushStack( winnow(this, selector || [], true) ); + }, + is: function( selector ) { + return !!winnow( + this, + + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + typeof selector === "string" && rneedsContext.test( selector ) ? + jQuery( selector ) : + selector || [], + false + ).length; + } +}); + + +// Initialize a jQuery object + + +// A central reference to the root jQuery(document) +var rootjQuery, + + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, + + init = jQuery.fn.init = function( selector, context ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + + // scripts is true for back-compat + // Intentionally let the error be thrown if parseHTML is not present + jQuery.merge( this, jQuery.parseHTML( + match[1], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return typeof rootjQuery.ready !== "undefined" ? + rootjQuery.ready( selector ) : + // Execute immediately if ready is not present + selector( jQuery ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }; + +// Give the init function the jQuery prototype for later instantiation +init.prototype = jQuery.fn; + +// Initialize central reference +rootjQuery = jQuery( document ); + + +var rparentsprev = /^(?:parents|prev(?:Until|All))/, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.extend({ + dir: function( elem, dir, until ) { + var matched = [], + truncate = until !== undefined; + + while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) { + if ( elem.nodeType === 1 ) { + if ( truncate && jQuery( elem ).is( until ) ) { + break; + } + matched.push( elem ); + } + } + return matched; + }, + + sibling: function( n, elem ) { + var matched = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + matched.push( n ); + } + } + + return matched; + } +}); + +jQuery.fn.extend({ + has: function( target ) { + var targets = jQuery( target, this ), + l = targets.length; + + return this.filter(function() { + var i = 0; + for ( ; i < l; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + matched = [], + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( ; i < l; i++ ) { + for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { + // Always skip document fragments + if ( cur.nodeType < 11 && (pos ? + pos.index(cur) > -1 : + + // Don't pass non-elements to Sizzle + cur.nodeType === 1 && + jQuery.find.matchesSelector(cur, selectors)) ) { + + matched.push( cur ); + break; + } + } + } + + return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return indexOf.call( jQuery( elem ), this[ 0 ] ); + } + + // Locate the position of the desired element + return indexOf.call( this, + + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[ 0 ] : elem + ); + }, + + add: function( selector, context ) { + return this.pushStack( + jQuery.unique( + jQuery.merge( this.get(), jQuery( selector, context ) ) + ) + ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter(selector) + ); + } +}); + +function sibling( cur, dir ) { + while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {} + return cur; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return elem.contentDocument || jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var matched = jQuery.map( this, fn, until ); + + if ( name.slice( -5 ) !== "Until" ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + matched = jQuery.filter( selector, matched ); + } + + if ( this.length > 1 ) { + // Remove duplicates + if ( !guaranteedUnique[ name ] ) { + jQuery.unique( matched ); + } + + // Reverse order for parents* and prev-derivatives + if ( rparentsprev.test( name ) ) { + matched.reverse(); + } + } + + return this.pushStack( matched ); + }; +}); +var rnotwhite = (/\S+/g); + + + +// String to Object options format cache +var optionsCache = {}; + +// Convert String-formatted options into Object-formatted ones and store in cache +function createOptions( options ) { + var object = optionsCache[ options ] = {}; + jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { + object[ flag ] = true; + }); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + ( optionsCache[ options ] || createOptions( options ) ) : + jQuery.extend( {}, options ); + + var // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list was already fired + fired, + // Flag to know if list is currently firing + firing, + // First callback to fire (used internally by add and fireWith) + firingStart, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = !options.once && [], + // Fire callbacks + fire = function( data ) { + memory = options.memory && data; + fired = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + firing = true; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { + memory = false; // To prevent further calls using add + break; + } + } + firing = false; + if ( list ) { + if ( stack ) { + if ( stack.length ) { + fire( stack.shift() ); + } + } else if ( memory ) { + list = []; + } else { + self.disable(); + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + // First, we save the current length + var start = list.length; + (function add( args ) { + jQuery.each( args, function( _, arg ) { + var type = jQuery.type( arg ); + if ( type === "function" ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && type !== "string" ) { + // Inspect recursively + add( arg ); + } + }); + })( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away + } else if ( memory ) { + firingStart = start; + fire( memory ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + jQuery.each( arguments, function( _, arg ) { + var index; + while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + // Handle firing indexes + if ( firing ) { + if ( index <= firingLength ) { + firingLength--; + } + if ( index <= firingIndex ) { + firingIndex--; + } + } + } + }); + } + return this; + }, + // Check if a given callback is in the list. + // If no argument is given, return whether or not list has callbacks attached. + has: function( fn ) { + return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); + }, + // Remove all callbacks from the list + empty: function() { + list = []; + firingLength = 0; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( list && ( !fired || stack ) ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + if ( firing ) { + stack.push( args ); + } else { + fire( args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; + + +jQuery.extend({ + + Deferred: function( func ) { + var tuples = [ + // action, add listener, listener list, final state + [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], + [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], + [ "notify", "progress", jQuery.Callbacks("memory") ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + return jQuery.Deferred(function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; + // deferred[ done | fail | progress ] for forwarding actions to newDefer + deferred[ tuple[1] ](function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); + } + }); + }); + fns = null; + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Keep pipe for back-compat + promise.pipe = promise.then; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 3 ]; + + // promise[ done | fail | progress ] = list.add + promise[ tuple[1] ] = list.add; + + // Handle state + if ( stateString ) { + list.add(function() { + // state = [ resolved | rejected ] + state = stateString; + + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + } + + // deferred[ resolve | reject | notify ] + deferred[ tuple[0] ] = function() { + deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); + return this; + }; + deferred[ tuple[0] + "With" ] = list.fireWith; + }); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0, + resolveValues = slice.call( arguments ), + length = resolveValues.length, + + // the count of uncompleted subordinates + remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, + + // the master Deferred. If resolveValues consist of only a single Deferred, just use that. + deferred = remaining === 1 ? subordinate : jQuery.Deferred(), + + // Update function for both resolve and progress values + updateFunc = function( i, contexts, values ) { + return function( value ) { + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; + if ( values === progressValues ) { + deferred.notifyWith( contexts, values ); + } else if ( !( --remaining ) ) { + deferred.resolveWith( contexts, values ); + } + }; + }, + + progressValues, progressContexts, resolveContexts; + + // add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { + resolveValues[ i ].promise() + .done( updateFunc( i, resolveContexts, resolveValues ) ) + .fail( deferred.reject ) + .progress( updateFunc( i, progressContexts, progressValues ) ); + } else { + --remaining; + } + } + } + + // if we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); + } + + return deferred.promise(); + } +}); + + +// The deferred used on DOM ready +var readyList; + +jQuery.fn.ready = function( fn ) { + // Add the callback + jQuery.ready.promise().done( fn ); + + return this; +}; + +jQuery.extend({ + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.triggerHandler ) { + jQuery( document ).triggerHandler( "ready" ); + jQuery( document ).off( "ready" ); + } + } +}); + +/** + * The ready event handler and self cleanup method + */ +function completed() { + document.removeEventListener( "DOMContentLoaded", completed, false ); + window.removeEventListener( "load", completed, false ); + jQuery.ready(); +} + +jQuery.ready.promise = function( obj ) { + if ( !readyList ) { + + readyList = jQuery.Deferred(); + + // Catch cases where $(document).ready() is called after the browser event has already occurred. + // we once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + setTimeout( jQuery.ready ); + + } else { + + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed, false ); + } + } + return readyList.promise( obj ); +}; + +// Kick off the DOM ready check even if the user does not +jQuery.ready.promise(); + + + + +// Multifunctional method to get and set values of a collection +// The value/s can optionally be executed if it's a function +var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + len = elems.length, + bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === "object" ) { + chainable = true; + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !jQuery.isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < len; i++ ) { + fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); + } + } + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + len ? fn( elems[0], key ) : emptyGet; +}; + + +/** + * Determines whether an object can have data + */ +jQuery.acceptData = function( owner ) { + // Accepts only: + // - Node + // - Node.ELEMENT_NODE + // - Node.DOCUMENT_NODE + // - Object + // - Any + /* jshint -W018 */ + return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); +}; + + +function Data() { + // Support: Android < 4, + // Old WebKit does not have Object.preventExtensions/freeze method, + // return new empty object instead with no [[set]] accessor + Object.defineProperty( this.cache = {}, 0, { + get: function() { + return {}; + } + }); + + this.expando = jQuery.expando + Math.random(); +} + +Data.uid = 1; +Data.accepts = jQuery.acceptData; + +Data.prototype = { + key: function( owner ) { + // We can accept data for non-element nodes in modern browsers, + // but we should not, see #8335. + // Always return the key for a frozen object. + if ( !Data.accepts( owner ) ) { + return 0; + } + + var descriptor = {}, + // Check if the owner object already has a cache key + unlock = owner[ this.expando ]; + + // If not, create one + if ( !unlock ) { + unlock = Data.uid++; + + // Secure it in a non-enumerable, non-writable property + try { + descriptor[ this.expando ] = { value: unlock }; + Object.defineProperties( owner, descriptor ); + + // Support: Android < 4 + // Fallback to a less secure definition + } catch ( e ) { + descriptor[ this.expando ] = unlock; + jQuery.extend( owner, descriptor ); + } + } + + // Ensure the cache object + if ( !this.cache[ unlock ] ) { + this.cache[ unlock ] = {}; + } + + return unlock; + }, + set: function( owner, data, value ) { + var prop, + // There may be an unlock assigned to this node, + // if there is no entry for this "owner", create one inline + // and set the unlock as though an owner entry had always existed + unlock = this.key( owner ), + cache = this.cache[ unlock ]; + + // Handle: [ owner, key, value ] args + if ( typeof data === "string" ) { + cache[ data ] = value; + + // Handle: [ owner, { properties } ] args + } else { + // Fresh assignments by object are shallow copied + if ( jQuery.isEmptyObject( cache ) ) { + jQuery.extend( this.cache[ unlock ], data ); + // Otherwise, copy the properties one-by-one to the cache object + } else { + for ( prop in data ) { + cache[ prop ] = data[ prop ]; + } + } + } + return cache; + }, + get: function( owner, key ) { + // Either a valid cache is found, or will be created. + // New caches will be created and the unlock returned, + // allowing direct access to the newly created + // empty data object. A valid owner object must be provided. + var cache = this.cache[ this.key( owner ) ]; + + return key === undefined ? + cache : cache[ key ]; + }, + access: function( owner, key, value ) { + var stored; + // In cases where either: + // + // 1. No key was specified + // 2. A string key was specified, but no value provided + // + // Take the "read" path and allow the get method to determine + // which value to return, respectively either: + // + // 1. The entire cache object + // 2. The data stored at the key + // + if ( key === undefined || + ((key && typeof key === "string") && value === undefined) ) { + + stored = this.get( owner, key ); + + return stored !== undefined ? + stored : this.get( owner, jQuery.camelCase(key) ); + } + + // [*]When the key is not a string, or both a key and value + // are specified, set or extend (existing objects) with either: + // + // 1. An object of properties + // 2. A key and value + // + this.set( owner, key, value ); + + // Since the "set" path can have two possible entry points + // return the expected data based on which path was taken[*] + return value !== undefined ? value : key; + }, + remove: function( owner, key ) { + var i, name, camel, + unlock = this.key( owner ), + cache = this.cache[ unlock ]; + + if ( key === undefined ) { + this.cache[ unlock ] = {}; + + } else { + // Support array or space separated string of keys + if ( jQuery.isArray( key ) ) { + // If "name" is an array of keys... + // When data is initially created, via ("key", "val") signature, + // keys will be converted to camelCase. + // Since there is no way to tell _how_ a key was added, remove + // both plain key and camelCase key. #12786 + // This will only penalize the array argument path. + name = key.concat( key.map( jQuery.camelCase ) ); + } else { + camel = jQuery.camelCase( key ); + // Try the string as a key before any manipulation + if ( key in cache ) { + name = [ key, camel ]; + } else { + // If a key with the spaces exists, use it. + // Otherwise, create an array by matching non-whitespace + name = camel; + name = name in cache ? + [ name ] : ( name.match( rnotwhite ) || [] ); + } + } + + i = name.length; + while ( i-- ) { + delete cache[ name[ i ] ]; + } + } + }, + hasData: function( owner ) { + return !jQuery.isEmptyObject( + this.cache[ owner[ this.expando ] ] || {} + ); + }, + discard: function( owner ) { + if ( owner[ this.expando ] ) { + delete this.cache[ owner[ this.expando ] ]; + } + } +}; +var data_priv = new Data(); + +var data_user = new Data(); + + + +/* + Implementation Summary + + 1. Enforce API surface and semantic compatibility with 1.9.x branch + 2. Improve the module's maintainability by reducing the storage + paths to a single mechanism. + 3. Use the same single mechanism to support "private" and "user" data. + 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) + 5. Avoid exposing implementation details on user objects (eg. expando properties) + 6. Provide a clear path for implementation upgrade to WeakMap in 2014 +*/ +var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, + rmultiDash = /([A-Z])/g; + +function dataAttr( elem, key, data ) { + var name; + + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + data_user.set( elem, key, data ); + } else { + data = undefined; + } + } + return data; +} + +jQuery.extend({ + hasData: function( elem ) { + return data_user.hasData( elem ) || data_priv.hasData( elem ); + }, + + data: function( elem, name, data ) { + return data_user.access( elem, name, data ); + }, + + removeData: function( elem, name ) { + data_user.remove( elem, name ); + }, + + // TODO: Now that all calls to _data and _removeData have been replaced + // with direct calls to data_priv methods, these can be deprecated. + _data: function( elem, name, data ) { + return data_priv.access( elem, name, data ); + }, + + _removeData: function( elem, name ) { + data_priv.remove( elem, name ); + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var i, name, data, + elem = this[ 0 ], + attrs = elem && elem.attributes; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = data_user.get( elem ); + + if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) { + i = attrs.length; + while ( i-- ) { + + // Support: IE11+ + // The attrs elements can be null (#14894) + if ( attrs[ i ] ) { + name = attrs[ i ].name; + if ( name.indexOf( "data-" ) === 0 ) { + name = jQuery.camelCase( name.slice(5) ); + dataAttr( elem, name, data[ name ] ); + } + } + } + data_priv.set( elem, "hasDataAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each(function() { + data_user.set( this, key ); + }); + } + + return access( this, function( value ) { + var data, + camelKey = jQuery.camelCase( key ); + + // The calling jQuery object (element matches) is not empty + // (and therefore has an element appears at this[ 0 ]) and the + // `value` parameter was not undefined. An empty jQuery object + // will result in `undefined` for elem = this[ 0 ] which will + // throw an exception if an attempt to read a data cache is made. + if ( elem && value === undefined ) { + // Attempt to get data from the cache + // with the key as-is + data = data_user.get( elem, key ); + if ( data !== undefined ) { + return data; + } + + // Attempt to get data from the cache + // with the key camelized + data = data_user.get( elem, camelKey ); + if ( data !== undefined ) { + return data; + } + + // Attempt to "discover" the data in + // HTML5 custom data-* attrs + data = dataAttr( elem, camelKey, undefined ); + if ( data !== undefined ) { + return data; + } + + // We tried really hard, but the data doesn't exist. + return; + } + + // Set the data... + this.each(function() { + // First, attempt to store a copy or reference of any + // data that might've been store with a camelCased key. + var data = data_user.get( this, camelKey ); + + // For HTML5 data-* attribute interop, we have to + // store property names with dashes in a camelCase form. + // This might not apply to all properties...* + data_user.set( this, camelKey, value ); + + // *... In the case of properties that might _actually_ + // have dashes, we need to also store a copy of that + // unchanged property. + if ( key.indexOf("-") !== -1 && data !== undefined ) { + data_user.set( this, key, value ); + } + }); + }, null, value, arguments.length > 1, null, true ); + }, + + removeData: function( key ) { + return this.each(function() { + data_user.remove( this, key ); + }); + } +}); + + +jQuery.extend({ + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = data_priv.get( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || jQuery.isArray( data ) ) { + queue = data_priv.access( elem, type, jQuery.makeArray(data) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // not intended for public consumption - generates a queueHooks object, or returns the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return data_priv.get( elem, key ) || data_priv.access( elem, key, { + empty: jQuery.Callbacks("once memory").add(function() { + data_priv.remove( elem, [ type + "queue", key ] ); + }) + }); + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } + + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); + + // ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while ( i-- ) { + tmp = data_priv.get( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +}); +var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; + +var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; + +var isHidden = function( elem, el ) { + // isHidden might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); + }; + +var rcheckableType = (/^(?:checkbox|radio)$/i); + + + +(function() { + var fragment = document.createDocumentFragment(), + div = fragment.appendChild( document.createElement( "div" ) ), + input = document.createElement( "input" ); + + // #11217 - WebKit loses check when the name is after the checked attribute + // Support: Windows Web Apps (WWA) + // `name` and `type` need .setAttribute for WWA + input.setAttribute( "type", "radio" ); + input.setAttribute( "checked", "checked" ); + input.setAttribute( "name", "t" ); + + div.appendChild( input ); + + // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 + // old WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Make sure textarea (and checkbox) defaultValue is properly cloned + // Support: IE9-IE11+ + div.innerHTML = ""; + support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; +})(); +var strundefined = typeof undefined; + + + +support.focusinBubbles = "onfocusin" in window; + + +var + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + + var handleObjIn, eventHandle, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = data_priv.get( elem ); + + // Don't attach events to noData or text/comment nodes (but allow plain objects) + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !(events = elemData.events) ) { + events = elemData.events = {}; + } + if ( !(eventHandle = elemData.handle) ) { + eventHandle = elemData.handle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ? + jQuery.event.dispatch.apply( elem, arguments ) : undefined; + }; + } + + // Handle multiple events separated by a space + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // There *must* be a type, no attaching namespace-only handlers + if ( !type ) { + continue; + } + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !(handlers = events[ type ]) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var j, origCount, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = data_priv.hasData( elem ) && data_priv.get( elem ); + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + delete elemData.handle; + data_priv.remove( elem, "events" ); + } + }, + + trigger: function( event, data, elem, onlyHandlers ) { + + var i, cur, tmp, bubbleType, ontype, handle, special, + eventPath = [ elem || document ], + type = hasOwn.call( event, "type" ) ? event.type : event, + namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf(".") >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf(":") < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) + event.isTrigger = onlyHandlers ? 2 : 3; + event.namespace = namespaces.join("."); + event.namespace_re = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === (elem.ownerDocument || document) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && handle.apply && jQuery.acceptData( cur ) ) { + event.result = handle.apply( cur, data ); + if ( event.result === false ) { + event.preventDefault(); + } + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && + jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + elem[ type ](); + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event ); + + var i, j, ret, matched, handleObj, + handlerQueue = [], + args = slice.call( arguments ), + handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( (event.result = ret) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var i, matches, sel, handleObj, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + // Black-hole SVG instance trees (#13180) + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { + + for ( ; cur !== this; cur = cur.parentNode || this ) { + + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.disabled !== true || event.type !== "click" ) { + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matches[ sel ] === undefined ) { + matches[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) >= 0 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matches[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, handlers: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( delegateCount < handlers.length ) { + handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); + } + + return handlerQueue; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var eventDoc, doc, body, + button = original.button; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, copy, + type = event.type, + originalEvent = event, + fixHook = this.fixHooks[ type ]; + + if ( !fixHook ) { + this.fixHooks[ type ] = fixHook = + rmouseEvent.test( type ) ? this.mouseHooks : + rkeyEvent.test( type ) ? this.keyHooks : + {}; + } + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = new jQuery.Event( originalEvent ); + + i = copy.length; + while ( i-- ) { + prop = copy[ i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Support: Cordova 2.5 (WebKit) (#13255) + // All events should have a target; Cordova deviceready doesn't + if ( !event.target ) { + event.target = document; + } + + // Support: Safari 6.0+, Chrome < 28 + // Target should not be a text node (#504, #13143) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; + }, + + special: { + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + focus: { + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== safeActiveElement() && this.focus ) { + this.focus(); + return false; + } + }, + delegateType: "focusin" + }, + blur: { + trigger: function() { + if ( this === safeActiveElement() && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: "focusout" + }, + click: { + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { + this.click(); + return false; + } + }, + + // For cross-browser consistency, don't fire native .click() on links + _default: function( event ) { + return jQuery.nodeName( event.target, "a" ); + } + }, + + beforeunload: { + postDispatch: function( event ) { + + // Support: Firefox 20+ + // Firefox doesn't alert if the returnValue field is not set. + if ( event.result !== undefined && event.originalEvent ) { + event.originalEvent.returnValue = event.result; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { + type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +jQuery.removeEvent = function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } +}; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = src.defaultPrevented || + src.defaultPrevented === undefined && + // Support: Android < 4.0 + src.returnValue === false ? + returnTrue : + returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + + if ( e && e.preventDefault ) { + e.preventDefault(); + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + + if ( e && e.stopPropagation ) { + e.stopPropagation(); + } + }, + stopImmediatePropagation: function() { + var e = this.originalEvent; + + this.isImmediatePropagationStopped = returnTrue; + + if ( e && e.stopImmediatePropagation ) { + e.stopImmediatePropagation(); + } + + this.stopPropagation(); + } +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +// Support: Chrome 15+ +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout", + pointerenter: "pointerover", + pointerleave: "pointerout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// Create "bubbling" focus and blur events +// Support: Firefox, Chrome, Safari +if ( !support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler on the document while someone wants focusin/focusout + var handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + var doc = this.ownerDocument || this, + attaches = data_priv.access( doc, fix ); + + if ( !attaches ) { + doc.addEventListener( orig, handler, true ); + } + data_priv.access( doc, fix, ( attaches || 0 ) + 1 ); + }, + teardown: function() { + var doc = this.ownerDocument || this, + attaches = data_priv.access( doc, fix ) - 1; + + if ( !attaches ) { + doc.removeEventListener( orig, handler, true ); + data_priv.remove( doc, fix ); + + } else { + data_priv.access( doc, fix, attaches ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + var elem = this[0]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +}); + + +var + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + rtagName = /<([\w:]+)/, + rhtml = /<|&#?\w+;/, + rnoInnerhtml = /<(?:script|style|link)/i, + // checked="checked" or checked + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, + rscriptType = /^$|\/(?:java|ecma)script/i, + rscriptTypeMasked = /^true\/(.*)/, + rcleanScript = /^\s*\s*$/g, + + // We have to close these tags to support XHTML (#13200) + wrapMap = { + + // Support: IE 9 + option: [ 1, "" ], + + thead: [ 1, "", "
    " ], + col: [ 2, "", "
    " ], + tr: [ 2, "", "
    " ], + td: [ 3, "", "
    " ], + + _default: [ 0, "", "" ] + }; + +// Support: IE 9 +wrapMap.optgroup = wrapMap.option; + +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +// Support: 1.x compatibility +// Manipulating tables requires a tbody +function manipulationTarget( elem, content ) { + return jQuery.nodeName( elem, "table" ) && + jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? + + elem.getElementsByTagName("tbody")[0] || + elem.appendChild( elem.ownerDocument.createElement("tbody") ) : + elem; +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + + if ( match ) { + elem.type = match[ 1 ]; + } else { + elem.removeAttribute("type"); + } + + return elem; +} + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + data_priv.set( + elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" ) + ); + } +} + +function cloneCopyEvent( src, dest ) { + var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; + + if ( dest.nodeType !== 1 ) { + return; + } + + // 1. Copy private data: events, handlers, etc. + if ( data_priv.hasData( src ) ) { + pdataOld = data_priv.access( src ); + pdataCur = data_priv.set( dest, pdataOld ); + events = pdataOld.events; + + if ( events ) { + delete pdataCur.handle; + pdataCur.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + } + + // 2. Copy user data + if ( data_user.hasData( src ) ) { + udataOld = data_user.access( src ); + udataCur = jQuery.extend( {}, udataOld ); + + data_user.set( dest, udataCur ); + } +} + +function getAll( context, tag ) { + var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) : + context.querySelectorAll ? context.querySelectorAll( tag || "*" ) : + []; + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], ret ) : + ret; +} + +// Support: IE >= 9 +function fixInput( src, dest ) { + var nodeName = dest.nodeName.toLowerCase(); + + // Fails to persist the checked state of a cloned checkbox or radio button. + if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + dest.checked = src.checked; + + // Fails to return the selected option to the default selected state when cloning options + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var i, l, srcElements, destElements, + clone = elem.cloneNode( true ), + inPage = jQuery.contains( elem.ownerDocument, elem ); + + // Support: IE >= 9 + // Fix Cloning issues + if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && + !jQuery.isXMLDoc( elem ) ) { + + // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + fixInput( srcElements[ i ], destElements[ i ] ); + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + cloneCopyEvent( srcElements[ i ], destElements[ i ] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + // Return the cloned set + return clone; + }, + + buildFragment: function( elems, context, scripts, selection ) { + var elem, tmp, tag, wrap, contains, j, + fragment = context.createDocumentFragment(), + nodes = [], + i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + // Support: QtWebKit + // jQuery.merge because push.apply(_, arraylike) throws + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || fragment.appendChild( context.createElement("div") ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[ 2 ]; + + // Descend through wrappers to the right content + j = wrap[ 0 ]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Support: QtWebKit + // jQuery.merge because push.apply(_, arraylike) throws + jQuery.merge( nodes, tmp.childNodes ); + + // Remember the top-level container + tmp = fragment.firstChild; + + // Fixes #12346 + // Support: Webkit, IE + tmp.textContent = ""; + } + } + } + + // Remove wrapper from fragment + fragment.textContent = ""; + + i = 0; + while ( (elem = nodes[ i++ ]) ) { + + // #4087 - If origin and destination elements are the same, and this is + // that element, do not do anything + if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( fragment.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( (elem = tmp[ j++ ]) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + return fragment; + }, + + cleanData: function( elems ) { + var data, elem, type, key, + special = jQuery.event.special, + i = 0; + + for ( ; (elem = elems[ i ]) !== undefined; i++ ) { + if ( jQuery.acceptData( elem ) ) { + key = elem[ data_priv.expando ]; + + if ( key && (data = data_priv.cache[ key ]) ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + if ( data_priv.cache[ key ] ) { + // Discard any remaining `private` data + delete data_priv.cache[ key ]; + } + } + } + // Discard any remaining `user` data + delete data_user.cache[ elem[ data_user.expando ] ]; + } + } +}); + +jQuery.fn.extend({ + text: function( value ) { + return access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().each(function() { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.textContent = value; + } + }); + }, null, value, arguments.length ); + }, + + append: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + }); + }, + + before: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + }); + }, + + after: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + }); + }, + + remove: function( selector, keepData /* Internal Use Only */ ) { + var elem, + elems = selector ? jQuery.filter( selector, this ) : this, + i = 0; + + for ( ; (elem = elems[i]) != null; i++ ) { + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem ) ); + } + + if ( elem.parentNode ) { + if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { + setGlobalEval( getAll( elem, "script" ) ); + } + elem.parentNode.removeChild( elem ); + } + } + + return this; + }, + + empty: function() { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + if ( elem.nodeType === 1 ) { + + // Prevent memory leaks + jQuery.cleanData( getAll( elem, false ) ); + + // Remove any remaining nodes + elem.textContent = ""; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map(function() { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, + + html: function( value ) { + return access( this, function( value ) { + var elem = this[ 0 ] || {}, + i = 0, + l = this.length; + + if ( value === undefined && elem.nodeType === 1 ) { + return elem.innerHTML; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, "<$1>" ); + + try { + for ( ; i < l; i++ ) { + elem = this[ i ] || {}; + + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch( e ) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function() { + var arg = arguments[ 0 ]; + + // Make the changes, replacing each context element with the new content + this.domManip( arguments, function( elem ) { + arg = this.parentNode; + + jQuery.cleanData( getAll( this ) ); + + if ( arg ) { + arg.replaceChild( elem, this ); + } + }); + + // Force removal if there was no new content (e.g., from empty arguments) + return arg && (arg.length || arg.nodeType) ? this : this.remove(); + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, callback ) { + + // Flatten any nested arrays + args = concat.apply( [], args ); + + var fragment, first, scripts, hasScripts, node, doc, + i = 0, + l = this.length, + set = this, + iNoClone = l - 1, + value = args[ 0 ], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || + ( l > 1 && typeof value === "string" && + !support.checkClone && rchecked.test( value ) ) ) { + return this.each(function( index ) { + var self = set.eq( index ); + if ( isFunction ) { + args[ 0 ] = value.call( this, index, self.html() ); + } + self.domManip( args, callback ); + }); + } + + if ( l ) { + fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + if ( first ) { + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + // Support: QtWebKit + // jQuery.merge because push.apply(_, arraylike) throws + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( this[ i ], node, i ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) { + + if ( node.src ) { + // Optional AJAX dependency, but won't run scripts if not present + if ( jQuery._evalUrl ) { + jQuery._evalUrl( node.src ); + } + } else { + jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) ); + } + } + } + } + } + } + + return this; + } +}); + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1, + i = 0; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone( true ); + jQuery( insert[ i ] )[ original ]( elems ); + + // Support: QtWebKit + // .get() because push.apply(_, arraylike) throws + push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +}); + + +var iframe, + elemdisplay = {}; + +/** + * Retrieve the actual display of a element + * @param {String} name nodeName of the element + * @param {Object} doc Document object + */ +// Called only from within defaultDisplay +function actualDisplay( name, doc ) { + var style, + elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), + + // getDefaultComputedStyle might be reliably used only on attached element + display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? + + // Use of this method is a temporary fix (more like optmization) until something better comes along, + // since it was removed from specification and supported only in FF + style.display : jQuery.css( elem[ 0 ], "display" ); + + // We don't have any data stored on the element, + // so use "detach" method as fast way to get rid of the element + elem.detach(); + + return display; +} + +/** + * Try to determine the default display value of an element + * @param {String} nodeName + */ +function defaultDisplay( nodeName ) { + var doc = document, + display = elemdisplay[ nodeName ]; + + if ( !display ) { + display = actualDisplay( nodeName, doc ); + + // If the simple way fails, read from inside an iframe + if ( display === "none" || !display ) { + + // Use the already-created iframe if possible + iframe = (iframe || jQuery( "
    + + + + + + --> + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook-viz.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook-viz.html new file mode 100644 index 0000000..3c0afd2 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook-viz.html @@ -0,0 +1,26 @@ + +
    + + +
    + + +
    diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook.htm b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook.htm new file mode 100644 index 0000000..bfd74ad --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebook.htm @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebookInputs.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebookInputs.html new file mode 100644 index 0000000..0a28b50 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/notebook-integration/scripts/view-models/notebookInputs.html @@ -0,0 +1,90 @@ + + + + + + + + + + +
    +
    +
    +
    + +
    +
    + + + + + + +
    +
    +
    + +
    + +
    + +
    + +
    +
    + +
    + +
    + + + Remove +
    +
    +
    +
    + + + + +
    + +
    + Submit +
    + + + +
    + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/att_angular_gridster/angular-gridster.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/att_angular_gridster/angular-gridster.js new file mode 100644 index 0000000..985fa43 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/att_angular_gridster/angular-gridster.js @@ -0,0 +1,2244 @@ +/*global define:true*/ +(function(root, factory) { + + 'use strict'; + + if (typeof define === 'function' && define.amd) { + // AMD + define(['angular'], factory); + } else if (typeof exports === 'object') { + // CommonJS + module.exports = factory(require('angular')); + } else { + // Browser, nothing "exported". Only registered as a module with angular. + factory(root.angular); + } +}(this, function(angular) { + + 'use strict'; + + var ie8 = false; + + var getInternetExplorerVersion = function () + // Returns the version of Internet Explorer >4 or + // undefined(indicating the use of another browser). + { + var isIE10 = (eval("/*@cc_on!@*/false") && document.documentMode === 10); + if (isIE10) { + return 10; + } + var v = 3, + div = document.createElement('div'), + all = div.getElementsByTagName('i'); + do { + div.innerHTML = ''; + } while (all[0]); + return v > 4 ? v : undefined; + }; + + var browserVersion = getInternetExplorerVersion(); + + if (browserVersion && browserVersion < 9) { + ie8 = true; + } + + // This returned angular module 'gridster' is what is exported. + return angular.module('attGridsterLib', []) + + .constant('gridsterConfig', { + columns: 6, // number of columns in the grid + pushing: true, // whether to push other items out of the way + floating: true, // whether to automatically float items up so they stack + swapping: true, // whether or not to have items switch places instead of push down if they are the same size + width: 'auto', // width of the grid. "auto" will expand the grid to its parent container + colWidth: 'auto', // width of grid columns. "auto" will divide the width of the grid evenly among the columns + rowHeight: 'match', // height of grid rows. 'match' will make it the same as the column width, a numeric value will be interpreted as pixels, '/2' is half the column width, '*5' is five times the column width, etc. + margins: [10, 10], // margins in between grid items + outerMargin: false, + isMobile: false, // toggle mobile view + mobileBreakPoint: 100, // width threshold to toggle mobile mode + mobileModeEnabled: true, // whether or not to toggle mobile mode when screen width is less than mobileBreakPoint + minColumns: 1, // minimum amount of columns the grid can scale down to + minRows: 1, // minimum amount of rows to show if the grid is empty + maxRows: 100, // maximum amount of rows in the grid + defaultSizeX: 1, // default width of an item in columns + defaultSizeY: 1, // default height of an item in rows + minSizeX: 1, // minimum column width of an item + maxSizeX: null, // maximum column width of an item + minSizeY: 1, // minumum row height of an item + maxSizeY: null, // maximum row height of an item + saveGridItemCalculatedHeightInMobile: false, // grid item height in mobile display. true- to use the calculated height by sizeY given + resizable: { // options to pass to resizable handler + enabled: false, + handles: ['s', 'e', 'n', 'w', 'se', 'ne', 'sw', 'nw'] + }, + draggable: { // options to pass to draggable handler + enabled: true, + scrollSensitivity: 20, // Distance in pixels from the edge of the viewport after which the viewport should scroll, relative to pointer + scrollSpeed: 15 // Speed at which the window should scroll once the mouse pointer gets within scrollSensitivity distance + } + }) + + .controller('GridsterCtrl', ['gridsterConfig', '$timeout', + function(gridsterConfig, $timeout) { + + var gridster = this; + + /** + * Create options from gridsterConfig constant + */ + angular.extend(this, gridsterConfig); + + this.resizable = angular.extend({}, gridsterConfig.resizable || {}); + this.draggable = angular.extend({}, gridsterConfig.draggable || {}); + + var flag = false; + this.layoutChanged = function() { + if (flag) { + return; + } + flag = true; + $timeout(function() { + flag = false; + if (gridster.loaded) { + gridster.floatItemsUp(); + } + gridster.updateHeight(gridster.movingItem ? gridster.movingItem.sizeY : 0); + }, 30); + }; + + /** + * A positional array of the items in the grid + */ + this.grid = []; + + /** + * Clean up after yourself + */ + this.destroy = function() { + // empty the grid to cut back on the possibility + // of circular references + if (this.grid) { + this.grid = []; + } + this.$element = null; + }; + + /** + * Overrides default options + * + * @param {Object} options The options to override + */ + this.setOptions = function(options) { + if (!options) { + return; + } + + options = angular.extend({}, options); + + // all this to avoid using jQuery... + if (options.draggable) { + angular.extend(this.draggable, options.draggable); + delete(options.draggable); + } + if (options.resizable) { + angular.extend(this.resizable, options.resizable); + delete(options.resizable); + } + + angular.extend(this, options); + + if (!this.margins || this.margins.length !== 2) { + this.margins = [0, 0]; + } else { + for (var x = 0, l = this.margins.length; x < l; ++x) { + this.margins[x] = parseInt(this.margins[x], 10); + if (isNaN(this.margins[x])) { + this.margins[x] = 0; + } + } + } + }; + + /** + * Check if item can occupy a specified position in the grid + * + * @param {Object} item The item in question + * @param {Number} row The row index + * @param {Number} column The column index + * @returns {Boolean} True if if item fits + */ + this.canItemOccupy = function(item, row, column) { + return row > -1 && column > -1 && item.sizeX + column <= this.columns && item.sizeY + row <= this.maxRows; + }; + + /** + * Set the item in the first suitable position + * + * @param {Object} item The item to insert + */ + this.autoSetItemPosition = function(item) { + // walk through each row and column looking for a place it will fit + for (var rowIndex = 0; rowIndex < this.maxRows; ++rowIndex) { + for (var colIndex = 0; colIndex < this.columns; ++colIndex) { + // only insert if position is not already taken and it can fit + var items = this.getItems(rowIndex, colIndex, item.sizeX, item.sizeY, item); + if (items.length === 0 && this.canItemOccupy(item, rowIndex, colIndex)) { + this.putItem(item, rowIndex, colIndex); + return; + } + } + } + throw new Error('Unable to place item!'); + }; + + /** + * Gets items at a specific coordinate + * + * @param {Number} row + * @param {Number} column + * @param {Number} sizeX + * @param {Number} sizeY + * @param {Array} excludeItems An array of items to exclude from selection + * @returns {Array} Items that match the criteria + */ + this.getItems = function(row, column, sizeX, sizeY, excludeItems) { + var items = []; + if (!sizeX || !sizeY) { + sizeX = sizeY = 1; + } + if (excludeItems && !(excludeItems instanceof Array)) { + excludeItems = [excludeItems]; + } + for (var h = 0; h < sizeY; ++h) { + for (var w = 0; w < sizeX; ++w) { + var item = this.getItem(row + h, column + w, excludeItems); + if (item && (!excludeItems || excludeItems.indexOf(item) === -1) && items.indexOf(item) === -1) { + items.push(item); + } + } + } + return items; + }; + + /** + * @param {Array} items + * @returns {Object} An item that represents the bounding box of the items + */ + this.getBoundingBox = function(items) { + + if (items.length === 0) { + return null; + } + if (items.length === 1) { + return { + row: items[0].row, + col: items[0].col, + sizeY: items[0].sizeY, + sizeX: items[0].sizeX + }; + } + + var maxRow = 0; + var maxCol = 0; + var minRow = 9999; + var minCol = 9999; + + for (var i = 0, l = items.length; i < l; ++i) { + var item = items[i]; + minRow = Math.min(item.row, minRow); + minCol = Math.min(item.col, minCol); + maxRow = Math.max(item.row + item.sizeY, maxRow); + maxCol = Math.max(item.col + item.sizeX, maxCol); + } + + return { + row: minRow, + col: minCol, + sizeY: maxRow - minRow, + sizeX: maxCol - minCol + }; + }; + + + /** + * Removes an item from the grid + * + * @param {Object} item + */ + this.removeItem = function(item) { + for (var rowIndex = 0, l = this.grid.length; rowIndex < l; ++rowIndex) { + var columns = this.grid[rowIndex]; + if (!columns) { + continue; + } + var index = columns.indexOf(item); + if (index !== -1) { + columns[index] = null; + break; + } + } + this.layoutChanged(); + }; + + /** + * Returns the item at a specified coordinate + * + * @param {Number} row + * @param {Number} column + * @param {Array} excludeItems Items to exclude from selection + * @returns {Object} The matched item or null + */ + this.getItem = function(row, column, excludeItems) { + if (excludeItems && !(excludeItems instanceof Array)) { + excludeItems = [excludeItems]; + } + var sizeY = 1; + while (row > -1) { + var sizeX = 1, + col = column; + while (col > -1) { + var items = this.grid[row]; + if (items) { + var item = items[col]; + if (item && (!excludeItems || excludeItems.indexOf(item) === -1) && item.sizeX >= sizeX && item.sizeY >= sizeY) { + return item; + } + } + ++sizeX; + --col; + } + --row; + ++sizeY; + } + return null; + }; + + /** + * Insert an array of items into the grid + * + * @param {Array} items An array of items to insert + */ + this.putItems = function(items) { + for (var i = 0, l = items.length; i < l; ++i) { + this.putItem(items[i]); + } + }; + + /** + * Insert a single item into the grid + * + * @param {Object} item The item to insert + * @param {Number} row (Optional) Specifies the items row index + * @param {Number} column (Optional) Specifies the items column index + * @param {Array} ignoreItems + */ + this.putItem = function(item, row, column, ignoreItems) { + // auto place item if no row specified + if (typeof row === 'undefined' || row === null) { + row = item.row; + column = item.col; + if (typeof row === 'undefined' || row === null) { + this.autoSetItemPosition(item); + return; + } + } + + // keep item within allowed bounds + if (!this.canItemOccupy(item, row, column)) { + column = Math.min(this.columns - item.sizeX, Math.max(0, column)); + row = Math.min(this.maxRows - item.sizeY, Math.max(0, row)); + } + + // check if item is already in grid + if (item.oldRow !== null && typeof item.oldRow !== 'undefined') { + var samePosition = item.oldRow === row && item.oldColumn === column; + var inGrid = this.grid[row] && this.grid[row][column] === item; + if (samePosition && inGrid) { + item.row = row; + item.col = column; + return; + } else { + // remove from old position + var oldRow = this.grid[item.oldRow]; + if (oldRow && oldRow[item.oldColumn] === item) { + delete oldRow[item.oldColumn]; + } + } + } + + item.oldRow = item.row = row; + item.oldColumn = item.col = column; + + this.moveOverlappingItems(item, ignoreItems); + + if (!this.grid[row]) { + this.grid[row] = []; + } + this.grid[row][column] = item; + + if (this.movingItem === item) { + this.floatItemUp(item); + } + this.layoutChanged(); + }; + + /** + * Trade row and column if item1 with item2 + * + * @param {Object} item1 + * @param {Object} item2 + */ + this.swapItems = function(item1, item2) { + this.grid[item1.row][item1.col] = item2; + this.grid[item2.row][item2.col] = item1; + + var item1Row = item1.row; + var item1Col = item1.col; + item1.row = item2.row; + item1.col = item2.col; + item2.row = item1Row; + item2.col = item1Col; + }; + + /** + * Prevents items from being overlapped + * + * @param {Object} item The item that should remain + * @param {Array} ignoreItems + */ + this.moveOverlappingItems = function(item, ignoreItems) { + // don't move item, so ignore it + if (!ignoreItems) { + ignoreItems = [item]; + } else if (ignoreItems.indexOf(item) === -1) { + ignoreItems = ignoreItems.slice(0); + ignoreItems.push(item); + } + + // get the items in the space occupied by the item's coordinates + var overlappingItems = this.getItems( + item.row, + item.col, + item.sizeX, + item.sizeY, + ignoreItems + ); + this.moveItemsDown(overlappingItems, item.row + item.sizeY, ignoreItems); + }; + + /** + * Moves an array of items to a specified row + * + * @param {Array} items The items to move + * @param {Number} newRow The target row + * @param {Array} ignoreItems + */ + this.moveItemsDown = function(items, newRow, ignoreItems) { + if (!items || items.length === 0) { + return; + } + items.sort(function(a, b) { + return a.row - b.row; + }); + + ignoreItems = ignoreItems ? ignoreItems.slice(0) : []; + var topRows = {}, + item, i, l; + + // calculate the top rows in each column + for (i = 0, l = items.length; i < l; ++i) { + item = items[i]; + var topRow = topRows[item.col]; + if (typeof topRow === 'undefined' || item.row < topRow) { + topRows[item.col] = item.row; + } + } + + // move each item down from the top row in its column to the row + for (i = 0, l = items.length; i < l; ++i) { + item = items[i]; + var rowsToMove = newRow - topRows[item.col]; + this.moveItemDown(item, item.row + rowsToMove, ignoreItems); + ignoreItems.push(item); + } + }; + + /** + * Moves an item down to a specified row + * + * @param {Object} item The item to move + * @param {Number} newRow The target row + * @param {Array} ignoreItems + */ + this.moveItemDown = function(item, newRow, ignoreItems) { + if (item.row >= newRow) { + return; + } + while (item.row < newRow) { + ++item.row; + this.moveOverlappingItems(item, ignoreItems); + } + this.putItem(item, item.row, item.col, ignoreItems); + }; + + /** + * Moves all items up as much as possible + */ + this.floatItemsUp = function() { + if (this.floating === false) { + return; + } + for (var rowIndex = 0, l = this.grid.length; rowIndex < l; ++rowIndex) { + var columns = this.grid[rowIndex]; + if (!columns) { + continue; + } + for (var colIndex = 0, len = columns.length; colIndex < len; ++colIndex) { + var item = columns[colIndex]; + if (item) { + this.floatItemUp(item); + } + } + } + }; + + /** + * Float an item up to the most suitable row + * + * @param {Object} item The item to move + */ + this.floatItemUp = function(item) { + if (this.floating === false) { + return; + } + var colIndex = item.col, + sizeY = item.sizeY, + sizeX = item.sizeX, + bestRow = null, + bestColumn = null, + rowIndex = item.row - 1; + + while (rowIndex > -1) { + var items = this.getItems(rowIndex, colIndex, sizeX, sizeY, item); + if (items.length !== 0) { + break; + } + bestRow = rowIndex; + bestColumn = colIndex; + --rowIndex; + } + if (bestRow !== null) { + this.putItem(item, bestRow, bestColumn); + } + }; + + /** + * Update gridsters height + * + * @param {Number} plus (Optional) Additional height to add + */ + this.updateHeight = function(plus) { + var maxHeight = this.minRows; + plus = plus || 0; + for (var rowIndex = this.grid.length; rowIndex >= 0; --rowIndex) { + var columns = this.grid[rowIndex]; + if (!columns) { + continue; + } + for (var colIndex = 0, len = columns.length; colIndex < len; ++colIndex) { + if (columns[colIndex]) { + maxHeight = Math.max(maxHeight, rowIndex + plus + columns[colIndex].sizeY); + } + } + } + this.gridHeight = this.maxRows - maxHeight > 0 ? Math.min(this.maxRows, maxHeight) : Math.max(this.maxRows, maxHeight); + }; + + /** + * Returns the number of rows that will fit in given amount of pixels + * + * @param {Number} pixels + * @param {Boolean} ceilOrFloor (Optional) Determines rounding method + */ + this.pixelsToRows = function(pixels, ceilOrFloor) { + if (ceilOrFloor === true) { + return Math.ceil(pixels / this.curRowHeight); + } else if (ceilOrFloor === false) { + return Math.floor(pixels / this.curRowHeight); + } + + return Math.round(pixels / this.curRowHeight); + }; + + /** + * Returns the number of columns that will fit in a given amount of pixels + * + * @param {Number} pixels + * @param {Boolean} ceilOrFloor (Optional) Determines rounding method + * @returns {Number} The number of columns + */ + this.pixelsToColumns = function(pixels, ceilOrFloor) { + if (ceilOrFloor === true) { + return Math.ceil(pixels / this.curColWidth); + } else if (ceilOrFloor === false) { + return Math.floor(pixels / this.curColWidth); + } + + return Math.round(pixels / this.curColWidth); + }; + } + ]) + + .directive('gridsterPreview', function() { + return { + replace: true, + scope: true, + require: '^gridster', + template: '
    ', + link: function(scope, $el, attrs, gridster) { + + /** + * @returns {Object} style object for preview element + */ + scope.previewStyle = function() { + + if (!gridster.movingItem) { + return { + display: 'none' + }; + } + + return { + display: 'block', + height: (gridster.movingItem.sizeY * gridster.curRowHeight - gridster.margins[0]) + 'px', + width: (gridster.movingItem.sizeX * gridster.curColWidth - gridster.margins[1]) + 'px', + top: (gridster.movingItem.row * gridster.curRowHeight + (gridster.outerMargin ? gridster.margins[0] : 0)) + 'px', + left: (gridster.movingItem.col * gridster.curColWidth + (gridster.outerMargin ? gridster.margins[1] : 0)) + 'px' + }; + }; + } + }; + }) + + /** + * The gridster directive + * + * @param {Function} $timeout + * @param {Object} $window + * @param {Object} $rootScope + * @param {Function} gridsterDebounce + */ + .directive('gridster', ['$timeout', '$window', '$rootScope', 'gridsterDebounce', + function($timeout, $window, $rootScope, gridsterDebounce) { + return { + scope: true, + restrict: 'EAC', + controller: 'GridsterCtrl', + controllerAs: 'gridster', + compile: function($tplElem) { + + $tplElem.prepend('
    '); + + return function(scope, $elem, attrs, gridster) { + gridster.loaded = false; + + gridster.$element = $elem; + + scope.gridster = gridster; + + $elem.addClass('gridster'); + + var isVisible = function(ele) { + return ele.style.visibility !== 'hidden' && ele.style.display !== 'none'; + }; + + function refresh(config) { + gridster.setOptions(config); + + if (!isVisible($elem[0])) { + return; + } + + // resolve "auto" & "match" values + if (gridster.width === 'auto') { + gridster.curWidth = $elem[0].offsetWidth || parseInt($elem.css('width'), 10); + } else { + gridster.curWidth = gridster.width; + } + + if (gridster.colWidth === 'auto') { + gridster.curColWidth = (gridster.curWidth + (gridster.outerMargin ? -gridster.margins[1] : gridster.margins[1])) / gridster.columns; + } else { + gridster.curColWidth = gridster.colWidth; + } + + gridster.curRowHeight = gridster.rowHeight; + if (typeof gridster.rowHeight === 'string') { + if (gridster.rowHeight === 'match') { + gridster.curRowHeight = Math.round(gridster.curColWidth); + } else if (gridster.rowHeight.indexOf('*') !== -1) { + gridster.curRowHeight = Math.round(gridster.curColWidth * gridster.rowHeight.replace('*', '').replace(' ', '')); + } else if (gridster.rowHeight.indexOf('/') !== -1) { + gridster.curRowHeight = Math.round(gridster.curColWidth / gridster.rowHeight.replace('/', '').replace(' ', '')); + } + } + + gridster.isMobile = gridster.mobileModeEnabled && gridster.curWidth <= gridster.mobileBreakPoint; + + // loop through all items and reset their CSS + for (var rowIndex = 0, l = gridster.grid.length; rowIndex < l; ++rowIndex) { + var columns = gridster.grid[rowIndex]; + if (!columns) { + continue; + } + + for (var colIndex = 0, len = columns.length; colIndex < len; ++colIndex) { + if (columns[colIndex]) { + var item = columns[colIndex]; + item.setElementPosition(); + item.setElementSizeY(); + item.setElementSizeX(); + } + } + } + + updateHeight(); + } + + var optionsKey = attrs.gridster; + if (optionsKey) { + scope.$parent.$watch(optionsKey, function(newConfig) { + refresh(newConfig); + }, true); + } else { + refresh({}); + } + + scope.$watch(function() { + return gridster.loaded; + }, function() { + if (gridster.loaded) { + $elem.addClass('gridster-loaded'); + } else { + $elem.removeClass('gridster-loaded'); + } + }); + + scope.$watch(function() { + return gridster.isMobile; + }, function() { + if (gridster.isMobile) { + $elem.addClass('gridster-mobile').removeClass('gridster-desktop'); + } else { + $elem.removeClass('gridster-mobile').addClass('gridster-desktop'); + } + $rootScope.$broadcast('gridster-mobile-changed', gridster); + }); + + scope.$watch(function() { + return gridster.draggable; + }, function() { + $rootScope.$broadcast('gridster-draggable-changed', gridster); + }, true); + + scope.$watch(function() { + return gridster.resizable; + }, function() { + $rootScope.$broadcast('gridster-resizable-changed', gridster); + }, true); + + function updateHeight() { + if(gridster.gridHeight){ //need to put this check, otherwise fail in IE8 + $elem.css('height', (gridster.gridHeight * gridster.curRowHeight) + (gridster.outerMargin ? gridster.margins[0] : -gridster.margins[0]) + 'px'); + } + } + + scope.$watch(function() { + return gridster.gridHeight; + }, updateHeight); + + scope.$watch(function() { + return gridster.movingItem; + }, function() { + gridster.updateHeight(gridster.movingItem ? gridster.movingItem.sizeY : 0); + }); + + var prevWidth = $elem[0].offsetWidth || parseInt($elem.css('width'), 10); + + var resize = function() { + var width = $elem[0].offsetWidth || parseInt($elem.css('width'), 10); + + if (!width || width === prevWidth || gridster.movingItem) { + return; + } + prevWidth = width; + + if (gridster.loaded) { + $elem.removeClass('gridster-loaded'); + } + + refresh(); + + if (gridster.loaded) { + $elem.addClass('gridster-loaded'); + } + + $rootScope.$broadcast('gridster-resized', [width, $elem[0].offsetHeight], gridster); + }; + + // track element width changes any way we can + var onResize = gridsterDebounce(function onResize() { + resize(); + $timeout(function() { + scope.$apply(); + }); + }, 100); + + scope.$watch(function() { + return isVisible($elem[0]); + }, onResize); + + // see https://github.com/sdecima/javascript-detect-element-resize + if (typeof window.addResizeListener === 'function') { + window.addResizeListener($elem[0], onResize); + } else { + scope.$watch(function() { + return $elem[0].offsetWidth || parseInt($elem.css('width'), 10); + }, resize); + } + var $win = angular.element($window); + $win.on('resize', onResize); + + // be sure to cleanup + scope.$on('$destroy', function() { + gridster.destroy(); + $win.off('resize', onResize); + if (typeof window.removeResizeListener === 'function') { + window.removeResizeListener($elem[0], onResize); + } + }); + + // allow a little time to place items before floating up + $timeout(function() { + scope.$watch('gridster.floating', function() { + gridster.floatItemsUp(); + }); + gridster.loaded = true; + }, 100); + }; + } + }; + } + ]) + + .controller('GridsterItemCtrl', function() { + this.$element = null; + this.gridster = null; + this.row = null; + this.col = null; + this.sizeX = null; + this.sizeY = null; + this.minSizeX = 0; + this.minSizeY = 0; + this.maxSizeX = null; + this.maxSizeY = null; + + this.init = function($element, gridster) { + this.$element = $element; + this.gridster = gridster; + this.sizeX = gridster.defaultSizeX; + this.sizeY = gridster.defaultSizeY; + }; + + this.destroy = function() { + // set these to null to avoid the possibility of circular references + this.gridster = null; + this.$element = null; + }; + + /** + * Returns the items most important attributes + */ + this.toJSON = function() { + return { + row: this.row, + col: this.col, + sizeY: this.sizeY, + sizeX: this.sizeX + }; + }; + + this.isMoving = function() { + return this.gridster.movingItem === this; + }; + + /** + * Set the items position + * + * @param {Number} row + * @param {Number} column + */ + this.setPosition = function(row, column) { + this.gridster.putItem(this, row, column); + + if (!this.isMoving()) { + this.setElementPosition(); + } + }; + + /** + * Sets a specified size property + * + * @param {String} key Can be either "x" or "y" + * @param {Number} value The size amount + * @param {Boolean} preventMove + */ + this.setSize = function(key, value, preventMove) { + key = key.toUpperCase(); + var camelCase = 'size' + key, + titleCase = 'Size' + key; + if (value === '') { + return; + } + value = parseInt(value, 10); + if (isNaN(value) || value === 0) { + value = this.gridster['default' + titleCase]; + } + var max = key === 'X' ? this.gridster.columns : this.gridster.maxRows; + if (this['max' + titleCase]) { + max = Math.min(this['max' + titleCase], max); + } + if (this.gridster['max' + titleCase]) { + max = Math.min(this.gridster['max' + titleCase], max); + } + if (key === 'X' && this.cols) { + max -= this.cols; + } else if (key === 'Y' && this.rows) { + max -= this.rows; + } + + var min = 0; + if (this['min' + titleCase]) { + min = Math.max(this['min' + titleCase], min); + } + if (this.gridster['min' + titleCase]) { + min = Math.max(this.gridster['min' + titleCase], min); + } + + value = Math.max(Math.min(value, max), min); + + var changed = (this[camelCase] !== value || (this['old' + titleCase] && this['old' + titleCase] !== value)); + this['old' + titleCase] = this[camelCase] = value; + + if (!this.isMoving()) { + this['setElement' + titleCase](); + } + if (!preventMove && changed) { + this.gridster.moveOverlappingItems(this); + this.gridster.layoutChanged(); + } + + return changed; + }; + + /** + * Sets the items sizeY property + * + * @param {Number} rows + * @param {Boolean} preventMove + */ + this.setSizeY = function(rows, preventMove) { + return this.setSize('Y', rows, preventMove); + }; + + /** + * Sets the items sizeX property + * + * @param {Number} columns + * @param {Boolean} preventMove + */ + this.setSizeX = function(columns, preventMove) { + return this.setSize('X', columns, preventMove); + }; + + /** + * Sets an elements position on the page + */ + this.setElementPosition = function() { + if (this.gridster.isMobile) { + this.$element.css({ + marginLeft: this.gridster.margins[0] + 'px', + marginRight: this.gridster.margins[0] + 'px', + marginTop: this.gridster.margins[1] + 'px', + marginBottom: this.gridster.margins[1] + 'px', + top: '', + left: '' + }); + } else { + this.$element.css({ + margin: 0, + top: (this.row * this.gridster.curRowHeight + (this.gridster.outerMargin ? this.gridster.margins[0] : 0)) + 'px', + left: (this.col * this.gridster.curColWidth + (this.gridster.outerMargin ? this.gridster.margins[1] : 0)) + 'px' + }); + } + }; + + /** + * Sets an elements height + */ + this.setElementSizeY = function() { + if (this.gridster.isMobile && !this.gridster.saveGridItemCalculatedHeightInMobile) { + this.$element.css('height', ''); + } else { + var computedHeight = (this.sizeY * this.gridster.curRowHeight - this.gridster.margins[0]) + 'px'; + //this.$element.css('height', computedHeight); + this.$element.attr('style', this.$element.attr('style') + '; ' + 'height: '+computedHeight+' !important;'); + } + }; + + /** + * Sets an elements width + */ + this.setElementSizeX = function() { + if (this.gridster.isMobile) { + this.$element.css('width', ''); + } else { + this.$element.css('width', (this.sizeX * this.gridster.curColWidth - this.gridster.margins[1]) + 'px'); + } + }; + + /** + * Gets an element's width + */ + this.getElementSizeX = function() { + return (this.sizeX * this.gridster.curColWidth - this.gridster.margins[1]); + }; + + /** + * Gets an element's height + */ + this.getElementSizeY = function() { + return (this.sizeY * this.gridster.curRowHeight - this.gridster.margins[0]); + }; + + }) + + .factory('GridsterTouch', [function() { + return function GridsterTouch(target, startEvent, moveEvent, endEvent) { + var lastXYById = {}; + + // Opera doesn't have Object.keys so we use this wrapper + var numberOfKeys = function(theObject) { + if (Object.keys) { + return Object.keys(theObject).length; + } + + var n = 0, + key; + for (key in theObject) { + ++n; + } + + return n; + }; + + // this calculates the delta needed to convert pageX/Y to offsetX/Y because offsetX/Y don't exist in the TouchEvent object or in Firefox's MouseEvent object + var computeDocumentToElementDelta = function(theElement) { + var elementLeft = 0; + var elementTop = 0; + var oldIEUserAgent = navigator.userAgent.match(/\bMSIE\b/); + + for (var offsetElement = theElement; offsetElement != null; offsetElement = offsetElement.offsetParent) { + // the following is a major hack for versions of IE less than 8 to avoid an apparent problem on the IEBlog with double-counting the offsets + // this may not be a general solution to IE7's problem with offsetLeft/offsetParent + if (oldIEUserAgent && + (!document.documentMode || document.documentMode < 8) && + offsetElement.currentStyle.position === 'relative' && offsetElement.offsetParent && offsetElement.offsetParent.currentStyle.position === 'relative' && offsetElement.offsetLeft === offsetElement.offsetParent.offsetLeft) { + // add only the top + elementTop += offsetElement.offsetTop; + } else { + elementLeft += offsetElement.offsetLeft; + elementTop += offsetElement.offsetTop; + } + } + + return { + x: elementLeft, + y: elementTop + }; + }; + + // cache the delta from the document to our event target (reinitialized each mousedown/MSPointerDown/touchstart) + var documentToTargetDelta = computeDocumentToElementDelta(target); + + // common event handler for the mouse/pointer/touch models and their down/start, move, up/end, and cancel events + var doEvent = function(theEvtObj) { + + if (theEvtObj.type === 'mousemove' && numberOfKeys(lastXYById) === 0) { + return; + } + + var prevent = true; + + var pointerList = theEvtObj.changedTouches ? theEvtObj.changedTouches : [theEvtObj]; + + for (var i = 0; i < pointerList.length; ++i) { + var pointerObj = pointerList[i]; + var pointerId = (typeof pointerObj.identifier !== 'undefined') ? pointerObj.identifier : (typeof pointerObj.pointerId !== 'undefined') ? pointerObj.pointerId : 1; + + // use the pageX/Y coordinates to compute target-relative coordinates when we have them (in ie < 9, we need to do a little work to put them there) + if (typeof pointerObj.pageX === 'undefined') { + + // initialize assuming our source element is our target + if(!ie8){ + pointerObj.pageX = pointerObj.offsetX + documentToTargetDelta.x; + pointerObj.pageY = pointerObj.offsetY + documentToTargetDelta.y; + } + else{ + pointerObj.pageX = pointerObj.clientX; + pointerObj.pageY = pointerObj.clientY; + } + + if (pointerObj.srcElement.offsetParent === target && document.documentMode && document.documentMode === 8 && pointerObj.type === 'mousedown') { + // source element is a child piece of VML, we're in IE8, and we've not called setCapture yet - add the origin of the source element + pointerObj.pageX += pointerObj.srcElement.offsetLeft; + pointerObj.pageY += pointerObj.srcElement.offsetTop; + } else if (pointerObj.srcElement !== target && !document.documentMode || document.documentMode < 8) { + // source element isn't the target (most likely it's a child piece of VML) and we're in a version of IE before IE8 - + // the offsetX/Y values are unpredictable so use the clientX/Y values and adjust by the scroll offsets of its parents + // to get the document-relative coordinates (the same as pageX/Y) + var sx = -2, + sy = -2; // adjust for old IE's 2-pixel border + for (var scrollElement = pointerObj.srcElement; scrollElement !== null; scrollElement = scrollElement.parentNode) { + sx += scrollElement.scrollLeft ? scrollElement.scrollLeft : 0; + sy += scrollElement.scrollTop ? scrollElement.scrollTop : 0; + } + + pointerObj.pageX = pointerObj.clientX + sx; + pointerObj.pageY = pointerObj.clientY + sy; + } + } + + + var pageX = pointerObj.pageX; + var pageY = pointerObj.pageY; + + if (theEvtObj.type.match(/(start|down)$/i)) { + // clause for processing MSPointerDown, touchstart, and mousedown + + // refresh the document-to-target delta on start in case the target has moved relative to document + documentToTargetDelta = computeDocumentToElementDelta(target); + + // protect against failing to get an up or end on this pointerId + if (lastXYById[pointerId]) { + if (endEvent) { + endEvent({ + target: theEvtObj.target, + which: theEvtObj.which, + pointerId: pointerId, + pageX: pageX, + pageY: pageY + }); + } + + delete lastXYById[pointerId]; + } + + if (startEvent) { + if (prevent) { + prevent = startEvent({ + target: theEvtObj.target, + which: theEvtObj.which, + pointerId: pointerId, + pageX: pageX, + pageY: pageY + }); + } + } + + // init last page positions for this pointer + lastXYById[pointerId] = { + x: pageX, + y: pageY + }; + + // IE pointer model + if (target.msSetPointerCapture) { + target.msSetPointerCapture(pointerId); + } else if (theEvtObj.type === 'mousedown' && numberOfKeys(lastXYById) === 1) { + if (useSetReleaseCapture) { + target.setCapture(true); + } else { + document.addEventListener('mousemove', doEvent, false); + document.addEventListener('mouseup', doEvent, false); + } + } + } else if (theEvtObj.type.match(/move$/i)) { + // clause handles mousemove, MSPointerMove, and touchmove + + if (lastXYById[pointerId] && !(lastXYById[pointerId].x === pageX && lastXYById[pointerId].y === pageY)) { + // only extend if the pointer is down and it's not the same as the last point + + if (moveEvent && prevent) { + prevent = moveEvent({ + target: theEvtObj.target, + which: theEvtObj.which, + pointerId: pointerId, + pageX: pageX, + pageY: pageY + }); + } + + // update last page positions for this pointer + lastXYById[pointerId].x = pageX; + lastXYById[pointerId].y = pageY; + } + } else if (lastXYById[pointerId] && theEvtObj.type.match(/(up|end|cancel)$/i)) { + // clause handles up/end/cancel + + if (endEvent && prevent) { + prevent = endEvent({ + target: theEvtObj.target, + which: theEvtObj.which, + pointerId: pointerId, + pageX: pageX, + pageY: pageY + }); + } + + // delete last page positions for this pointer + delete lastXYById[pointerId]; + + // in the Microsoft pointer model, release the capture for this pointer + // in the mouse model, release the capture or remove document-level event handlers if there are no down points + // nothing is required for the iOS touch model because capture is implied on touchstart + if (target.msReleasePointerCapture) { + target.msReleasePointerCapture(pointerId); + } else if (theEvtObj.type === 'mouseup' && numberOfKeys(lastXYById) === 0) { + if (useSetReleaseCapture) { + target.releaseCapture(); + } else { + document.removeEventListener('mousemove', doEvent, false); + document.removeEventListener('mouseup', doEvent, false); + } + } + } + } + + if (prevent) { + if (theEvtObj.preventDefault) { + theEvtObj.preventDefault(); + } + + if (theEvtObj.preventManipulation) { + theEvtObj.preventManipulation(); + } + + if (theEvtObj.preventMouseEvent) { + theEvtObj.preventMouseEvent(); + } + } + }; + + var useSetReleaseCapture = false; + // saving the settings for contentZooming and touchaction before activation + var contentZooming, msTouchAction; + + this.enable = function() { + + if (window.navigator.msPointerEnabled) { + // Microsoft pointer model + target.addEventListener('MSPointerDown', doEvent, false); + target.addEventListener('MSPointerMove', doEvent, false); + target.addEventListener('MSPointerUp', doEvent, false); + target.addEventListener('MSPointerCancel', doEvent, false); + + // css way to prevent panning in our target area + if (typeof target.style.msContentZooming !== 'undefined') { + contentZooming = target.style.msContentZooming; + target.style.msContentZooming = 'none'; + } + + // new in Windows Consumer Preview: css way to prevent all built-in touch actions on our target + // without this, you cannot touch draw on the element because IE will intercept the touch events + if (typeof target.style.msTouchAction !== 'undefined') { + msTouchAction = target.style.msTouchAction; + target.style.msTouchAction = 'none'; + } + } else if (target.addEventListener) { + // iOS touch model + target.addEventListener('touchstart', doEvent, false); + target.addEventListener('touchmove', doEvent, false); + target.addEventListener('touchend', doEvent, false); + target.addEventListener('touchcancel', doEvent, false); + + // mouse model + target.addEventListener('mousedown', doEvent, false); + + // mouse model with capture + // rejecting gecko because, unlike ie, firefox does not send events to target when the mouse is outside target + if (target.setCapture && !window.navigator.userAgent.match(/\bGecko\b/)) { + useSetReleaseCapture = true; + + target.addEventListener('mousemove', doEvent, false); + target.addEventListener('mouseup', doEvent, false); + } + } else if (target.attachEvent && target.setCapture) { + // legacy IE mode - mouse with capture + useSetReleaseCapture = true; + target.attachEvent('onmousedown', function() { + doEvent(window.event); + window.event.returnValue = false; + return false; + }); + target.attachEvent('onmousemove', function() { + doEvent(window.event); + window.event.returnValue = false; + return false; + }); + target.attachEvent('onmouseup', function() { + doEvent(window.event); + window.event.returnValue = false; + return false; + }); + } + }; + + this.disable = function() { + if (window.navigator.msPointerEnabled) { + // Microsoft pointer model + target.removeEventListener('MSPointerDown', doEvent, false); + target.removeEventListener('MSPointerMove', doEvent, false); + target.removeEventListener('MSPointerUp', doEvent, false); + target.removeEventListener('MSPointerCancel', doEvent, false); + + // reset zooming to saved value + if (contentZooming) { + target.style.msContentZooming = contentZooming; + } + + // reset touch action setting + if (msTouchAction) { + target.style.msTouchAction = msTouchAction; + } + } else if (target.removeEventListener) { + // iOS touch model + target.removeEventListener('touchstart', doEvent, false); + target.removeEventListener('touchmove', doEvent, false); + target.removeEventListener('touchend', doEvent, false); + target.removeEventListener('touchcancel', doEvent, false); + + // mouse model + target.removeEventListener('mousedown', doEvent, false); + + // mouse model with capture + // rejecting gecko because, unlike ie, firefox does not send events to target when the mouse is outside target + if (target.setCapture && !window.navigator.userAgent.match(/\bGecko\b/)) { + useSetReleaseCapture = true; + + target.removeEventListener('mousemove', doEvent, false); + target.removeEventListener('mouseup', doEvent, false); + } + } else if (target.detachEvent && target.setCapture) { + // legacy IE mode - mouse with capture + useSetReleaseCapture = true; + target.detachEvent('onmousedown'); + target.detachEvent('onmousemove'); + target.detachEvent('onmouseup'); + } + }; + + return this; + }; + }]) + + .factory('GridsterDraggable', ['$document', '$timeout', '$window', 'GridsterTouch', + function($document, $timeout, $window, GridsterTouch) { + function GridsterDraggable($el, scope, gridster, item, itemOptions) { + + var elmX, elmY, elmW, elmH, + + mouseX = 0, + mouseY = 0, + lastMouseX = 0, + lastMouseY = 0, + mOffX = 0, + mOffY = 0, + + minTop = 0, + maxTop = 9999, + minLeft = 0, + realdocument = $document[0]; + + var originalCol, originalRow; + var inputTags = ['select', 'input', 'textarea', 'button']; + + var gridsterItemDragElement = $el[0].querySelector('[gridster-item-drag]'); + //console.log(gridsterItemDragElement); + var isDraggableAreaDefined = gridsterItemDragElement?true:false; + //console.log(isDraggableAreaDefined); + + function mouseDown(e) { + + if(ie8){ + e.target = window.event.srcElement; + e.which = window.event.button; + } + + if(isDraggableAreaDefined && (!gridsterItemDragElement.contains(e.target))){ + return false; + } + + if (inputTags.indexOf(e.target.nodeName.toLowerCase()) !== -1) { + return false; + } + + var $target = angular.element(e.target); + + // exit, if a resize handle was hit + if ($target.hasClass('gridster-item-resizable-handler')) { + return false; + } + + // exit, if the target has it's own click event + if ($target.attr('onclick') || $target.attr('ng-click')) { + return false; + } + + // only works if you have jQuery + if ($target.closest && $target.closest('.gridster-no-drag').length) { + return false; + } + + switch (e.which) { + case 1: + // left mouse button + break; + case 2: + case 3: + // right or middle mouse button + return; + } + + lastMouseX = e.pageX; + lastMouseY = e.pageY; + + elmX = parseInt($el.css('left'), 10); + elmY = parseInt($el.css('top'), 10); + elmW = $el[0].offsetWidth; + elmH = $el[0].offsetHeight; + + originalCol = item.col; + originalRow = item.row; + + dragStart(e); + + return true; + } + + function mouseMove(e) { + if (!$el.hasClass('gridster-item-moving') || $el.hasClass('gridster-item-resizing')) { + return false; + } + + var maxLeft = gridster.curWidth - 1; + + // Get the current mouse position. + mouseX = e.pageX; + mouseY = e.pageY; + + // Get the deltas + var diffX = mouseX - lastMouseX + mOffX; + var diffY = mouseY - lastMouseY + mOffY; + mOffX = mOffY = 0; + + // Update last processed mouse positions. + lastMouseX = mouseX; + lastMouseY = mouseY; + + var dX = diffX, + dY = diffY; + if (elmX + dX < minLeft) { + diffX = minLeft - elmX; + mOffX = dX - diffX; + } else if (elmX + elmW + dX > maxLeft) { + diffX = maxLeft - elmX - elmW; + mOffX = dX - diffX; + } + + if (elmY + dY < minTop) { + diffY = minTop - elmY; + mOffY = dY - diffY; + } else if (elmY + elmH + dY > maxTop) { + diffY = maxTop - elmY - elmH; + mOffY = dY - diffY; + } + elmX += diffX; + elmY += diffY; + + // set new position + $el.css({ + 'top': elmY + 'px', + 'left': elmX + 'px' + }); + + drag(e); + + return true; + } + + function mouseUp(e) { + if (!$el.hasClass('gridster-item-moving') || $el.hasClass('gridster-item-resizing')) { + return false; + } + + mOffX = mOffY = 0; + + dragStop(e); + + return true; + } + + function dragStart(event) { + $el.addClass('gridster-item-moving'); + gridster.movingItem = item; + + gridster.updateHeight(item.sizeY); + scope.$apply(function() { + if (gridster.draggable && gridster.draggable.start) { + gridster.draggable.start(event, $el, itemOptions); + } + }); + } + + function drag(event) { + var oldRow = item.row, + oldCol = item.col, + hasCallback = gridster.draggable && gridster.draggable.drag, + scrollSensitivity = gridster.draggable.scrollSensitivity, + scrollSpeed = gridster.draggable.scrollSpeed; + + var row = gridster.pixelsToRows(elmY); + var col = gridster.pixelsToColumns(elmX); + + var itemsInTheWay = gridster.getItems(row, col, item.sizeX, item.sizeY, item); + var hasItemsInTheWay = itemsInTheWay.length !== 0; + + if (gridster.swapping === true && hasItemsInTheWay) { + var boundingBoxItem = gridster.getBoundingBox(itemsInTheWay), + sameSize = boundingBoxItem.sizeX === item.sizeX && boundingBoxItem.sizeY === item.sizeY, + sameRow = boundingBoxItem.row === oldRow, + sameCol = boundingBoxItem.col === oldCol, + samePosition = boundingBoxItem.row === row && boundingBoxItem.col === col, + inline = sameRow || sameCol; + + if (sameSize && itemsInTheWay.length === 1) { + if (samePosition) { + gridster.swapItems(item, itemsInTheWay[0]); + } else if (inline) { + return; + } + } else if (boundingBoxItem.sizeX <= item.sizeX && boundingBoxItem.sizeY <= item.sizeY && inline) { + var emptyRow = item.row <= row ? item.row : row + item.sizeY, + emptyCol = item.col <= col ? item.col : col + item.sizeX, + rowOffset = emptyRow - boundingBoxItem.row, + colOffset = emptyCol - boundingBoxItem.col; + + for (var i = 0, l = itemsInTheWay.length; i < l; ++i) { + var itemInTheWay = itemsInTheWay[i]; + + var itemsInFreeSpace = gridster.getItems( + itemInTheWay.row + rowOffset, + itemInTheWay.col + colOffset, + itemInTheWay.sizeX, + itemInTheWay.sizeY, + item + ); + + if (itemsInFreeSpace.length === 0) { + gridster.putItem(itemInTheWay, itemInTheWay.row + rowOffset, itemInTheWay.col + colOffset); + } + } + } + } + + if (gridster.pushing !== false || !hasItemsInTheWay) { + item.row = row; + item.col = col; + } + + if(($window.navigator.appName === 'Microsoft Internet Explorer' && !ie8) || $window.navigator.userAgent.indexOf("Firefox")!==-1){ + if (event.pageY - realdocument.documentElement.scrollTop < scrollSensitivity) { + realdocument.documentElement.scrollTop = realdocument.documentElement.scrollTop - scrollSpeed; + } else if ($window.innerHeight - (event.pageY - realdocument.documentElement.scrollTop) < scrollSensitivity) { + realdocument.documentElement.scrollTop = realdocument.documentElement.scrollTop + scrollSpeed; + } + } + else{ + if (event.pageY - realdocument.body.scrollTop < scrollSensitivity) { + realdocument.body.scrollTop = realdocument.body.scrollTop - scrollSpeed; + } else if ($window.innerHeight - (event.pageY - realdocument.body.scrollTop) < scrollSensitivity) { + realdocument.body.scrollTop = realdocument.body.scrollTop + scrollSpeed; + } + } + + + + if (event.pageX - realdocument.body.scrollLeft < scrollSensitivity) { + realdocument.body.scrollLeft = realdocument.body.scrollLeft - scrollSpeed; + } else if ($window.innerWidth - (event.pageX - realdocument.body.scrollLeft) < scrollSensitivity) { + realdocument.body.scrollLeft = realdocument.body.scrollLeft + scrollSpeed; + } + + if (hasCallback || oldRow !== item.row || oldCol !== item.col) { + scope.$apply(function() { + if (hasCallback) { + gridster.draggable.drag(event, $el, itemOptions); + } + }); + } + } + + function dragStop(event) { + $el.removeClass('gridster-item-moving'); + var row = gridster.pixelsToRows(elmY); + var col = gridster.pixelsToColumns(elmX); + if (gridster.pushing !== false || gridster.getItems(row, col, item.sizeX, item.sizeY, item).length === 0) { + item.row = row; + item.col = col; + } + gridster.movingItem = null; + item.setPosition(item.row, item.col); + + scope.$apply(function() { + if (gridster.draggable && gridster.draggable.stop) { + gridster.draggable.stop(event, $el, itemOptions); + } + }); + } + + var enabled = null; + var $dragHandles = null; + var unifiedInputs = []; + + this.enable = function() { + if (enabled === true) { + return; + } + + // disable and timeout required for some template rendering + $timeout(function() { + // disable any existing draghandles + for (var u = 0, ul = unifiedInputs.length; u < ul; ++u) { + unifiedInputs[u].disable(); + } + unifiedInputs = []; + + if (gridster.draggable && gridster.draggable.handle) { + $dragHandles = angular.element($el[0].querySelectorAll(gridster.draggable.handle)); + if ($dragHandles.length === 0) { + // fall back to element if handle not found... + $dragHandles = $el; + } + } else { + $dragHandles = $el; + } + + for (var h = 0, hl = $dragHandles.length; h < hl; ++h) { + unifiedInputs[h] = new GridsterTouch($dragHandles[h], mouseDown, mouseMove, mouseUp); + unifiedInputs[h].enable(); + } + + enabled = true; + }); + }; + + this.disable = function() { + if (enabled === false) { + return; + } + + // timeout to avoid race contition with the enable timeout + $timeout(function() { + + for (var u = 0, ul = unifiedInputs.length; u < ul; ++u) { + unifiedInputs[u].disable(); + } + + unifiedInputs = []; + enabled = false; + }); + }; + + this.toggle = function(enabled) { + if (enabled) { + this.enable(); + } else { + this.disable(); + } + }; + + this.destroy = function() { + this.disable(); + }; + } + + return GridsterDraggable; + } + ]) + + .factory('GridsterResizable', ['GridsterTouch', function(GridsterTouch) { + function GridsterResizable($el, scope, gridster, item, itemOptions) { + + function ResizeHandle(handleClass) { + + var hClass = handleClass; + + var elmX, elmY, elmW, elmH, + + mouseX = 0, + mouseY = 0, + lastMouseX = 0, + lastMouseY = 0, + mOffX = 0, + mOffY = 0, + + minTop = 0, + maxTop = 9999, + minLeft = 0; + + var getMinHeight = function() { + return (item.minSizeY ? item.minSizeY : 1) * gridster.curRowHeight - gridster.margins[0]; + }; + var getMinWidth = function() { + return (item.minSizeX ? item.minSizeX : 1) * gridster.curColWidth - gridster.margins[1]; + }; + + var originalWidth, originalHeight; + var savedDraggable; + + function mouseDown(e) { + switch (e.which) { + case 1: + // left mouse button + break; + case 2: + case 3: + // right or middle mouse button + return; + } + + // save the draggable setting to restore after resize + savedDraggable = gridster.draggable.enabled; + if (savedDraggable) { + gridster.draggable.enabled = false; + scope.$broadcast('gridster-draggable-changed', gridster); + } + + // Get the current mouse position. + lastMouseX = e.pageX; + lastMouseY = e.pageY; + + // Record current widget dimensions + elmX = parseInt($el.css('left'), 10); + elmY = parseInt($el.css('top'), 10); + elmW = $el[0].offsetWidth; + elmH = $el[0].offsetHeight; + + originalWidth = item.sizeX; + originalHeight = item.sizeY; + + resizeStart(e); + + return true; + } + + function resizeStart(e) { + $el.addClass('gridster-item-moving'); + $el.addClass('gridster-item-resizing'); + + gridster.movingItem = item; + + item.setElementSizeX(); + item.setElementSizeY(); + item.setElementPosition(); + gridster.updateHeight(1); + + scope.$apply(function() { + // callback + if (gridster.resizable && gridster.resizable.start) { + gridster.resizable.start(e, $el, itemOptions); // options is the item model + } + }); + } + + function mouseMove(e) { + var maxLeft = gridster.curWidth - 1; + + // Get the current mouse position. + mouseX = e.pageX; + mouseY = e.pageY; + + // Get the deltas + var diffX = mouseX - lastMouseX + mOffX; + var diffY = mouseY - lastMouseY + mOffY; + mOffX = mOffY = 0; + + // Update last processed mouse positions. + lastMouseX = mouseX; + lastMouseY = mouseY; + + var dY = diffY, + dX = diffX; + + if (hClass.indexOf('n') >= 0) { + if (elmH - dY < getMinHeight()) { + diffY = elmH - getMinHeight(); + mOffY = dY - diffY; + } else if (elmY + dY < minTop) { + diffY = minTop - elmY; + mOffY = dY - diffY; + } + elmY += diffY; + elmH -= diffY; + } + if (hClass.indexOf('s') >= 0) { + if (elmH + dY < getMinHeight()) { + diffY = getMinHeight() - elmH; + mOffY = dY - diffY; + } else if (elmY + elmH + dY > maxTop) { + diffY = maxTop - elmY - elmH; + mOffY = dY - diffY; + } + elmH += diffY; + } + if (hClass.indexOf('w') >= 0) { + if (elmW - dX < getMinWidth()) { + diffX = elmW - getMinWidth(); + mOffX = dX - diffX; + } else if (elmX + dX < minLeft) { + diffX = minLeft - elmX; + mOffX = dX - diffX; + } + elmX += diffX; + elmW -= diffX; + } + if (hClass.indexOf('e') >= 0) { + if (elmW + dX < getMinWidth()) { + diffX = getMinWidth() - elmW; + mOffX = dX - diffX; + } else if (elmX + elmW + dX > maxLeft) { + diffX = maxLeft - elmX - elmW; + mOffX = dX - diffX; + } + elmW += diffX; + } + + // set new position + $el.css({ + 'top': elmY + 'px', + 'left': elmX + 'px', + 'width': elmW + 'px', + 'height': elmH + 'px' + }); + + resize(e); + + return true; + } + + function mouseUp(e) { + // restore draggable setting to its original state + if (gridster.draggable.enabled !== savedDraggable) { + gridster.draggable.enabled = savedDraggable; + scope.$broadcast('gridster-draggable-changed', gridster); + } + + mOffX = mOffY = 0; + + resizeStop(e); + + return true; + } + + function resize(e) { + var oldRow = item.row, + oldCol = item.col, + oldSizeX = item.sizeX, + oldSizeY = item.sizeY, + hasCallback = gridster.resizable && gridster.resizable.resize; + + var col = item.col; + // only change column if grabbing left edge + if (['w', 'nw', 'sw'].indexOf(handleClass) !== -1) { + col = gridster.pixelsToColumns(elmX, false); + } + + var row = item.row; + // only change row if grabbing top edge + if (['n', 'ne', 'nw'].indexOf(handleClass) !== -1) { + row = gridster.pixelsToRows(elmY, false); + } + + var sizeX = item.sizeX; + // only change row if grabbing left or right edge + if (['n', 's'].indexOf(handleClass) === -1) { + sizeX = gridster.pixelsToColumns(elmW, true); + } + + var sizeY = item.sizeY; + // only change row if grabbing top or bottom edge + if (['e', 'w'].indexOf(handleClass) === -1) { + sizeY = gridster.pixelsToRows(elmH, true); + } + + if (gridster.pushing !== false || gridster.getItems(row, col, sizeX, sizeY, item).length === 0) { + item.row = row; + item.col = col; + item.sizeX = sizeX; + item.sizeY = sizeY; + } + var isChanged = item.row !== oldRow || item.col !== oldCol || item.sizeX !== oldSizeX || item.sizeY !== oldSizeY; + + if (hasCallback || isChanged) { + scope.$apply(function() { + if (hasCallback) { + gridster.resizable.resize(e, $el, itemOptions); // options is the item model + } + }); + } + } + + function resizeStop(e) { + $el.removeClass('gridster-item-moving'); + $el.removeClass('gridster-item-resizing'); + + gridster.movingItem = null; + + item.setPosition(item.row, item.col); + item.setSizeY(item.sizeY); + item.setSizeX(item.sizeX); + + scope.$apply(function() { + if (gridster.resizable && gridster.resizable.stop) { + gridster.resizable.stop(e, $el, itemOptions); // options is the item model + } + }); + } + + var $dragHandle = null; + var unifiedInput; + + this.enable = function() { + if (!$dragHandle) { + $dragHandle = angular.element('
    '); + $el.append($dragHandle); + } + + unifiedInput = new GridsterTouch($dragHandle[0], mouseDown, mouseMove, mouseUp); + unifiedInput.enable(); + }; + + this.disable = function() { + if ($dragHandle) { + $dragHandle.remove(); + $dragHandle = null; + } + + unifiedInput.disable(); + unifiedInput = undefined; + }; + + this.destroy = function() { + this.disable(); + }; + } + + var handles = []; + var handlesOpts = gridster.resizable.handles; + if (typeof handlesOpts === 'string') { + handlesOpts = gridster.resizable.handles.split(','); + } + var enabled = false; + + for (var c = 0, l = handlesOpts.length; c < l; c++) { + handles.push(new ResizeHandle(handlesOpts[c])); + } + + this.enable = function() { + if (enabled) { + return; + } + for (var c = 0, l = handles.length; c < l; c++) { + handles[c].enable(); + } + enabled = true; + }; + + this.disable = function() { + if (!enabled) { + return; + } + for (var c = 0, l = handles.length; c < l; c++) { + handles[c].disable(); + } + enabled = false; + }; + + this.toggle = function(enabled) { + if (enabled) { + this.enable(); + } else { + this.disable(); + } + }; + + this.destroy = function() { + for (var c = 0, l = handles.length; c < l; c++) { + handles[c].destroy(); + } + }; + } + return GridsterResizable; + }]) + + .factory('gridsterDebounce', function() { + return function gridsterDebounce(func, wait, immediate) { + var timeout; + return function() { + var context = this, + args = arguments; + var later = function() { + timeout = null; + if (!immediate) { + func.apply(context, args); + } + }; + var callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) { + func.apply(context, args); + } + }; + }; + }) + + /** + * GridsterItem directive + * @param $parse + * @param GridsterDraggable + * @param GridsterResizable + * @param gridsterDebounce + */ + .directive('gridsterItem', ['$parse', 'GridsterDraggable', 'GridsterResizable', 'gridsterDebounce', + function($parse, GridsterDraggable, GridsterResizable, gridsterDebounce) { + return { + scope: true, + restrict: 'EA', + controller: 'GridsterItemCtrl', + controllerAs: 'gridsterItem', + require: ['^gridster', 'gridsterItem'], + link: function(scope, $el, attrs, controllers) { + var optionsKey = attrs.gridsterItem, + options; + + var gridster = controllers[0], + item = controllers[1]; + + scope.gridster = gridster; + + + // bind the item's position properties + // options can be an object specified by gridster-item="object" + // or the options can be the element html attributes object + if (optionsKey) { + var $optionsGetter = $parse(optionsKey); + options = $optionsGetter(scope) || {}; + if (!options && $optionsGetter.assign) { + options = { + row: item.row, + col: item.col, + sizeX: item.sizeX, + sizeY: item.sizeY, + minSizeX: 0, + minSizeY: 0, + maxSizeX: null, + maxSizeY: null + }; + $optionsGetter.assign(scope, options); + } + } else { + options = attrs; + } + + item.init($el, gridster); + + $el.addClass('gridster-item'); + + var aspects = ['minSizeX', 'maxSizeX', 'minSizeY', 'maxSizeY', 'sizeX', 'sizeY', 'row', 'col'], + $getters = {}; + + var expressions = []; + var aspectFn = function(aspect) { + var expression; + if (typeof options[aspect] === 'string') { + // watch the expression in the scope + expression = options[aspect]; + } else if (typeof options[aspect.toLowerCase()] === 'string') { + // watch the expression in the scope + expression = options[aspect.toLowerCase()]; + } else if (optionsKey) { + // watch the expression on the options object in the scope + expression = optionsKey + '.' + aspect; + } else { + return; + } + expressions.push('"' + aspect + '":' + expression); + $getters[aspect] = $parse(expression); + + // initial set + var val = $getters[aspect](scope); + if (typeof val === 'number') { + item[aspect] = val; + } + }; + + for (var i = 0, l = aspects.length; i < l; ++i) { + aspectFn(aspects[i]); + } + + var watchExpressions = '{' + expressions.join(',') + '}'; + + // when the value changes externally, update the internal item object + scope.$watchCollection(watchExpressions, function(newVals, oldVals) { + for (var aspect in newVals) { + var newVal = newVals[aspect]; + var oldVal = oldVals[aspect]; + if (oldVal === newVal) { + continue; + } + newVal = parseInt(newVal, 10); + if (!isNaN(newVal)) { + item[aspect] = newVal; + } + } + }); + + function positionChanged() { + // call setPosition so the element and gridster controller are updated + item.setPosition(item.row, item.col); + + // when internal item position changes, update externally bound values + if ($getters.row && $getters.row.assign) { + $getters.row.assign(scope, item.row); + } + if ($getters.col && $getters.col.assign) { + $getters.col.assign(scope, item.col); + } + } + scope.$watch(function() { + return item.row + ',' + item.col; + }, positionChanged); + + function sizeChanged() { + var changedX = item.setSizeX(item.sizeX, true); + if (changedX && $getters.sizeX && $getters.sizeX.assign) { + $getters.sizeX.assign(scope, item.sizeX); + } + var changedY = item.setSizeY(item.sizeY, true); + if (changedY && $getters.sizeY && $getters.sizeY.assign) { + $getters.sizeY.assign(scope, item.sizeY); + } + + if (changedX || changedY) { + item.gridster.moveOverlappingItems(item); + gridster.layoutChanged(); + scope.$broadcast('gridster-item-resized', item); + } + } + + scope.$watch(function() { + return item.sizeY + ',' + item.sizeX + ',' + item.minSizeX + ',' + item.maxSizeX + ',' + item.minSizeY + ',' + item.maxSizeY; + }, sizeChanged); + + var draggable = new GridsterDraggable($el, scope, gridster, item, options); + var resizable = new GridsterResizable($el, scope, gridster, item, options); + + var updateResizable = function() { + resizable.toggle(!gridster.isMobile && gridster.resizable && gridster.resizable.enabled); + }; + updateResizable(); + + var updateDraggable = function() { + draggable.toggle(!gridster.isMobile && gridster.draggable && gridster.draggable.enabled); + }; + updateDraggable(); + + scope.$on('gridster-draggable-changed', updateDraggable); + scope.$on('gridster-resizable-changed', updateResizable); + scope.$on('gridster-resized', updateResizable); + scope.$on('gridster-mobile-changed', function() { + updateResizable(); + updateDraggable(); + }); + + function whichTransitionEvent() { + var el = document.createElement('div'); + var transitions = { + 'transition': 'transitionend', + 'OTransition': 'oTransitionEnd', + 'MozTransition': 'transitionend', + 'WebkitTransition': 'webkitTransitionEnd' + }; + for (var t in transitions) { + if (el.style[t] !== undefined) { + return transitions[t]; + } + } + } + + var debouncedTransitionEndPublisher = gridsterDebounce(function() { + scope.$apply(function() { + scope.$broadcast('gridster-item-transition-end', item); + }); + }, 50); + + if(whichTransitionEvent()){ //check for IE8, as it evaluates to null + $el.on(whichTransitionEvent(), debouncedTransitionEndPublisher); + } + + scope.$broadcast('gridster-item-initialized', item); + + return scope.$on('$destroy', function() { + try { + resizable.destroy(); + draggable.destroy(); + } catch (e) {} + + try { + gridster.removeItem(item); + } catch (e) {} + + try { + item.destroy(); + } catch (e) {} + }); + } + }; + } + ]) + + .directive('gridsterNoDrag', function() { + return { + restrict: 'A', + link: function(scope, $element) { + $element.addClass('gridster-no-drag'); + } + }; + }) + + ; + +})); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/att_angular_gridster/ui-gridster-tpls.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/att_angular_gridster/ui-gridster-tpls.js new file mode 100644 index 0000000..3ca3db7 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/att_angular_gridster/ui-gridster-tpls.js @@ -0,0 +1,168 @@ +/** +* FileName ui-gridster +* Version 0.0.1 +* Build number ad58c6f4f8f8fd7f04ac457f95d76f09 +* Date 08/17/2015 +*/ + + +(function(angular, window){ +angular.module("att.gridster", ["att.gridster.tpls", "att.gridster.utilities","att.gridster.gridster"]); +angular.module("att.gridster.tpls", ["template/gridster/gridster.html","template/gridster/gridsterItem.html","template/gridster/gridsterItemBody.html","template/gridster/gridsterItemFooter.html","template/gridster/gridsterItemHeader.html"]); +angular.module('att.gridster.utilities', []) + .factory('$extendObj', [function() { + var _extendDeep = function(dst) { + angular.forEach(arguments, function(obj) { + if (obj !== dst) { + angular.forEach(obj, function(value, key) { + if (dst[key] && dst[key].constructor && dst[key].constructor === Object) { + _extendDeep(dst[key], value); + } else { + dst[key] = value; + } + }); + } + }); + return dst; + }; + return { + extendDeep: _extendDeep + }; + }]); + +angular.module('att.gridster.gridster', ['attGridsterLib', 'att.gridster.utilities']) + .config(['$compileProvider', function($compileProvider) { + $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|javascript):/); + }]) + .constant('attGridsterConfig', + { + columns: 3, + margins: [10, 10], + outerMargin: true, + pushing: true, + floating: true, + swapping: true, + draggable: { + enabled: true + } + }) + .directive('attGridster', ['attGridsterConfig', '$extendObj', function(attGridsterConfig, $extendObj) { + return { + restrict: 'EA', + scope: { + attGridsterOptions: '=?' + }, + templateUrl: 'template/gridster/gridster.html', + replace: false, + transclude: true, + controller: [function() {}], + link: function(scope) { + if (angular.isDefined(scope.attGridsterOptions)) { + attGridsterConfig = $extendObj.extendDeep(attGridsterConfig, scope.attGridsterOptions); + } + scope.attGridsterConfig = attGridsterConfig; + } + }; + }]) + .directive('attGridsterItem', ['$timeout', function($timeout) { + return { + restrict: 'EA', + require: ['^attGridster'], + scope: { + attGridsterItem: '=' + }, + templateUrl: 'template/gridster/gridsterItem.html', + replace: false, + transclude: true, + controller: [function() {}] + }; + }]) + .directive('attGridsterItemHeader', [function() { + return { + restrict: 'EA', + require: ['^attGridsterItem'], + scope: { + headerText: '@', + subHeaderText: '@?' + }, + templateUrl: 'template/gridster/gridsterItemHeader.html', + replace: true, + transclude: true, + link: function(scope, element) { + if (angular.isDefined(scope.subHeaderText) && scope.subHeaderText) { + angular.element(element[0].querySelector('span.gridster-item-sub-header-content')).attr("tabindex", "0"); + angular.element(element[0].querySelector('span.gridster-item-sub-header-content')).attr("aria-label", scope.subHeaderText); + } + } + }; + }]) + .directive('attGridsterItemBody', [function() { + return { + restrict: 'EA', + require: ['^attGridsterItem'], + scope: {}, + templateUrl: 'template/gridster/gridsterItemBody.html', + replace: true, + transclude: true + }; + }]) + .directive('attGridsterItemFooter', ['$location', function($location) { + return { + restrict: 'EA', + require: ['^attGridsterItem'], + scope: { + attGridsterItemFooterLink: '@?' + }, + templateUrl: 'template/gridster/gridsterItemFooter.html', + replace: true, + transclude: true, + controller: ['$scope', function($scope) { + $scope.clickOnFooterLink = function(evt) { + evt.preventDefault(); + evt.stopPropagation(); + if ($scope.attGridsterItemFooterLink) { + $location.url($scope.attGridsterItemFooterLink); + } + }; + }], + link: function(scope, element) { + if (angular.isDefined(scope.attGridsterItemFooterLink) && scope.attGridsterItemFooterLink) { + element.attr("role", "link"); + } + } + }; + }]); +angular.module("template/gridster/gridster.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/gridster/gridster.html", + "
    "); +}]); + +angular.module("template/gridster/gridsterItem.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/gridster/gridsterItem.html", + "
    "); +}]); + +angular.module("template/gridster/gridsterItemBody.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/gridster/gridsterItemBody.html", + "
    "); +}]); + +angular.module("template/gridster/gridsterItemFooter.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/gridster/gridsterItemFooter.html", + "
    \n" + + " \n" + + "
    "); +}]); + +angular.module("template/gridster/gridsterItemHeader.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/gridster/gridsterItemHeader.html", + "
    \n" + + " \"||\"\n" + + " {{headerText}}\n" + + " {{subHeaderText}}\n" + + "
    \n" + + "
    "); +}]); + +return {} +})(angular, window); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/adminController.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/adminController.js new file mode 100644 index 0000000..a99be9f --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/adminController.js @@ -0,0 +1,65 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.config(function($routeProvider) { + $routeProvider + + + .when('/role_function_list', { + templateUrl: 'app/fusion/scripts/view-models/profile-page/role_function_list.html', + controller: 'roleFunctionListController' + }) + + .when('/admin_menu_edit', { + templateUrl: 'app/fusion/scripts/view-models/profile-page/admin_menu_edit.html', + controller: 'AdminMenuEditController' + }) + .when('/role/:roleId', { + templateUrl: 'app/fusion/scripts/view-models/profile-page/role.html', + controller: 'roleController' + }) + .when('/jcs_admin', { + templateUrl: 'app/fusion/scripts/view-models/profile-page/jcs_admin.html', + controller: 'cacheAdminController' + }) + .when('/broadcast_list', { + templateUrl: 'app/fusion/scripts/view-models/profile-page/broadcast_list.html', + controller: 'broadcastListController' + }) + .when('/broadcast/:messageLocationId/:messageLocation/:messageId', { + templateUrl: 'app/fusion/scripts/view-models/profile-page/broadcast.html', + controller: 'broadcastController' + }) + .when('/broadcast/:messageLocationId/:messageLocation', { + templateUrl: 'app/fusion/scripts/view-models/profile-page/broadcast.html', + controller: 'broadcastController' + }) + .when('/collaborate_list', { + templateUrl: 'app/fusion/scripts/view-models/profile-page/collaborate_list.html', + controller: 'collaborateListController' + }) + .when('/usage_list', { + templateUrl: 'app/fusion/scripts/view-models/profile-page/usage_list.html', + controller: 'usageListController' + }) + .otherwise({ + templateUrl: 'app/fusion/scripts/view-models/profile-page/role_list.html', + controller : "roleListController" + }); +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/admin_menu_edit.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/admin_menu_edit.js new file mode 100644 index 0000000..54d58a4 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/admin_menu_edit.js @@ -0,0 +1,230 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('AdminMenuEditController', function ($scope, AdminService, modalService, $modal, $route){ + $( "#dialog" ).hide(); + +/* AdminService.getRoleFunctionList().then(function(data){ + + var j = data; + $scope.data = JSON.parse(j.data); + $scope.availableRoleFunctions =JSON.parse($scope.data.availableRoleFunctions); + + //$scope.resetMenu(); + + },function(error){ + console.log("failed"); + reloadPageOnce(); + });*/ + $scope.init = function () { + $scope.numberOfRecordstoShow=20; + AdminService.getFnMenuItems().then(function(data){ + var j = data; + $scope.data =JSON.parse(j.data); + $scope.fnMenuItems =($scope.data.fnMenuItems); + + },function(error){ + console.log("failed"); + //reloadPageOnce(); + }); + } + $scope.init(); + $scope.mapActiveStatus = function(status){ + if(status) + status = "Y"; + else + status = "N"; + return status; + + }; + + + $scope.addNewFnMenuItemModalPopup = function(availableFnMenuItem) { + $scope.editFnMenuItem = null; + var modalInstance = $modal.open({ + templateUrl: 'fn_menu_add_popup.html', + controller: 'fn_menu_popupController', + resolve: { + message: function () { + var message = { + availableFnMenuItem: $scope.editFnMenuItem + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.availableFnMenuItems=response.availableFnMenuItems; + $route.reload(); + }); + }; + + $scope.removeMenuItem = function(fnMenuItem) { + modalService.popupConfirmWin("Confirm","You are about to delete the menu item "+fnMenuItem.label+". Do you want to continue?", + function(){ + var uuu = "admin_fn_menu/removeMenuItem.htm"; + var postData={fnMenuItem: fnMenuItem}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.fnMenuItem=data.fnMenuItem;}); + $route.reload(); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + + }; + + $scope.editRoleFunction = null; + var dialog = null; + $scope.editRoleFunctionPopup = function(availableRoleFunction) { + $scope.editRoleFunction = availableRoleFunction; + $( "#dialog" ).dialog({ + modal: true + }); + }; + + $scope.editMenuItemModalPopup = function(availableFnMenuItem) { + $scope.editFnMenuItem = availableFnMenuItem; + var modalInstance = $modal.open({ + templateUrl: 'fn_menu_add_popup.html', + controller: 'fn_menu_popupController', + resolve: { + message: function () { + var message = { + availableFnMenuItem: $scope.editFnMenuItem + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + $scope.availableFnMenuItems=response.availableFnMenuItems; + $route.reload(); + }); + }; + + $scope.editRoleFunctionModalPopup = function(availableRoleFunction) { + $scope.editRoleFunction = availableRoleFunction; + var modalInstance = $modal.open({ + templateUrl: 'edit_role_function_popup.html', + controller: 'rolefunctionpopupController', + resolve: { + message: function () { + var message = { + availableRoleFunction: $scope.editRoleFunction + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.availableRoleFunctions=response.availableRoleFunctions; + }); + }; + + $scope.addNewRoleFunctionModalPopup = function(availableRoleFunction) { + $scope.editRoleFunction = null; + var modalInstance = $modal.open({ + templateUrl: 'edit_role_function_popup.html', + controller: 'rolefunctionpopupController', + resolve: { + message: function () { + var message = { + availableRoleFunction: $scope.editRoleFunction + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.availableRoleFunctions=response.availableRoleFunctions; + }); + }; + + $scope.addNewRoleFunctionPopup = function() { + $scope.editRoleFunction = null; + $( "#dialog" ).dialog({ + modal: true + }); + }; + + $scope.saveRoleFunction = function(availableRoleFunction) { + var uuu = "role_function_list/saveRoleFunction.htm"; + var postData={availableRoleFunction: availableRoleFunction}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.availableRoleFunctions=[];$scope.$apply(); + $scope.availableRoleFunctions=data.availableRoleFunctions;}); + //alert("Update Successful.") ; + console.log($scope.availableRoleFunctions); + + $scope.editRoleFunction = null; + $( "#dialog" ).dialog("close"); + }, + error : function(data){ + modalService.showFailure("Fail","Error while saving."); + } + }); + }; + + + $scope.removeRole = function(availableRoleFunction) { + modalService.popupConfirmWin("Confirm","You are about to delete the role function "+availableRoleFunction.name+". Do you want to continue?", + function(){ + var uuu = "role_function_list/removeRoleFunction.htm"; + var postData={availableRoleFunction: availableRoleFunction}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.availableRoleFunctions=data.availableRoleFunctions;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + + }; + +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/ase-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/ase-controller.js new file mode 100644 index 0000000..45fc31a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/ase-controller.js @@ -0,0 +1,22 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('aseCtrl', function ($scope){ +/* do nothing yet*/ +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/broadcast-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/broadcast-controller.js new file mode 100644 index 0000000..77ee22f --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/broadcast-controller.js @@ -0,0 +1,79 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('broadcastController', function ($scope, modalService, $modal,AdminService,$routeParams){ + //$scope.broadcastMessage=${broadcastMessage}; + //$scope.broadcastSites=${broadcastSites}; + //console.log($scope.broadcastMessage); + $scope.broadcastMessage=[]; + $scope.broadcastSites=[]; + AdminService.getBroadcast($routeParams.messageLocationId, $routeParams.messageLocation, $routeParams.messageId).then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.broadcastMessage=JSON.parse($scope.data.broadcastMessage); + $scope.broadcastSites=JSON.parse($scope.data.broadcastSites); + console.log($scope.broadcastMessage); + console.log($scope.broadcastMessage.id); + console.log($scope.broadcastSites); + //$scope.resetMenu(); + + },function(error){ + console.log("failed"); + reloadPageOnce(); + }); + + $scope.save = function() { + var uuu = "broadcast/save"; + var postData={broadcastMessage: $scope.broadcastMessage}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + window.location.href = "admin#/broadcast_list"; + }, + error : function(data){ + modalService.showFailure("Fail","Error while saving."); + } + }); + }; + + $scope.close = function() { + window.location.href = "admin#/broadcast_list"; +}; + +}); + +$(function() { + $( "#startDatepicker" ).datepicker(); + $( "#endDatepicker" ).datepicker(); + + $( "#startDatepicker" ).change(function() { + var tempStartDate = moment($( "#startDatepicker" ).val()).format('YYYY-MM-DD hh:mm:ss.S'); + $( "#startDateHidden" ).val(tempStartDate.toString()); + //alert( $( "#startDateHidden" ).val() ); + }); + $( "#endDatepicker" ).change(function() { + var tempEndDate = moment($( "#endDatepicker" ).val()).format('YYYY-MM-DD hh:mm:ss.S'); + $( "#endDateHidden" ).val(tempEndDate.toString()); + //alert( $( "#endDateHidden" ).val() ); + }); +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/broadcast-list-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/broadcast-list-controller.js new file mode 100644 index 0000000..cb10a29 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/broadcast-list-controller.js @@ -0,0 +1,120 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('broadcastListController', function ($scope, modalService, $modal,AdminService){ + //$scope.broadcastMessage=${broadcastMessage}; + //$scope.broadcastSites=${broadcastSites}; + //console.log($scope.broadcastMessage); + var messagesMap = {}; + AdminService.getBroadcastList().then(function(data){ + + var j = data; + $scope.data = JSON.parse(j.data); + $scope.messagesList=(($scope.data.messagesList===null) ? [""]:$scope.data.messagesList); + $scope.messageLocations=(($scope.data.messageLocations===null) ? [""]:$scope.data.messageLocations); + console.log("messages: "+$scope.messagesList); + console.log("location: "+$scope.messageLocations); + $.each($scope.messageLocations, function(i, a){ + //var result = []; + angular.forEach($scope.messagesList, function(value, key) { + if (key+'' === a.value+'') { + //var objsJSON = JSON.parse(value); + + $.each(value, function(i, a){ + var startDateLong = a.startDate; + var tempStartDate = new Date(startDateLong); + tempStartDate = moment(tempStartDate).format('DD MMM YYYY hh:mmA zz');//03 Jun 2013 04:15PM EDT + a.displayStartDate=tempStartDate.toString(); + + var endDateLong = a.endDate; + var tempEndDate = new Date(endDateLong); + tempEndDate = moment(tempEndDate).format('DD MMM YYYY hh:mmA zz');//03 Jun 2013 04:15PM EDT + a.displayEndDate=tempEndDate.toString(); + }); + a.messages = value; + } + }); + console.log(a.messages); + }); + + //$scope.resetMenu(); + + },function(error){ + console.log("failed"); + reloadPageOnce(); + }); + + + $scope.editMessage = function(location) { + + editMessage(location.value, location.label); + }; + + $scope.toggleActive = function(broadcastMessage) { + + //alert('deleted'+role.name); + var uuu = "broadcast_list/toggleActive"; + var postData={broadcastMessage:broadcastMessage}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + //window.location.reload(); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while toggling: "+ data.responseText); + + } + }); + + + }; + + $scope.remove = function(broadcastMessage) { + + //alert('deleted'+role.name); + var uuu = "broadcast_list/remove"; + var postData={broadcastMessage:broadcastMessage}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + window.location.reload(); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + + }; + +}); + +function editMessage(messageLocationId, messageLocation, messageId) { + window.location='admin#/broadcast/'+messageLocationId + '/' + messageLocation + ((messageId != null) ? '/' + messageId : ''); +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/collaborate-list-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/collaborate-list-controller.js new file mode 100644 index 0000000..5b0b934 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/collaborate-list-controller.js @@ -0,0 +1,63 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller("collaborateListController", function ($scope,$http,modalService, $modal,AdminService) { + // Table Data + AdminService.getCollaborateList().then(function(data){ + + var j = data; + $scope.tableData = JSON.parse(j.data); + //$scope.resetMenu(); + + },function(error){ + console.log("failed"); + reloadPageOnce(); + }); + + $scope.viewPerPage = 20; + $scope.scrollViewsPerPage = 2; + $scope.currentPage = 1; + $scope.totalPage; + $scope.searchCategory = ""; + $scope.searchString = ""; + /* modalService.showSuccess('','Modal Sample') ; */ + for(x in $scope.tableData){ + if($scope.tableData[x].active_yn=='Y') + $scope.tableData[x].active_yn=true; + else + $scope.tableData[x].active_yn=false; + } + $scope.openCollaboration = function(chatId){ + openInNewTab('collaboration?chat_id=' + chatId); + } + + $scope.toggleProfileActive = function(profileId) { + modalService.popupConfirmWin("Confirm","You are about to change user's active status. Do you want to continue?", + function(){ + $http.get("profile/toggleProfileActive?profile_id="+profileId).success(function(){}); + + }) + }; + +}); + +function openInNewTab(url) { + var win = window.open(url, '_blank'); + win.focus(); +}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/fn_menu_add_popup_controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/fn_menu_add_popup_controller.js new file mode 100644 index 0000000..e017994 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/fn_menu_add_popup_controller.js @@ -0,0 +1,281 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +var fn_menu_popupController = function ($scope, $modalInstance, message, $http){ /// examine the LeftMenuService + if(message.availableFnMenuItem==null) + $scope.label='Add New Menu Item' + + else{ + $scope.label='Edit Menu Item' + //$scope.disableParentId=true; + } + + $scope.getParentData = function(){ + var uuu = "admin_fn_menu/get_parent_list" + $.ajax({ + type : 'GET', + url : uuu, + dataType: 'json', // data type expected from server + contentType: 'application/json', + //data: JSON.stringify(postData), // data type sent to server + success : function(data){ + $scope.$apply(function(){ + //$scope.availableRoleFunctions=[];$scope.$apply(); + $scope.parentListSelectData=data; // data from server + menuItems = $scope.parentListSelectData; + var heirarchicalMenuItems = []; + var children = []; + for ( var i=0; i b[prop]) { + return 1; + } else if (a[prop] < b[prop]) { + return -1; + } + return 0; + } + + }; + + $scope.getParentLabel = function(parentId, parentListSelectData){ + var element; + element = parentListSelectData[0]; + for (var i=0; i=0) + $scope.importProfileList.splice(index, 1); + } + }; + + $scope.prepareProfileSelection = function() { + if($scope.importProfileList) + $.each($scope.importProfileList, function(i, profile){ + $scope.preparePostSearchBean(profile); + }); + ; + } + + $scope.preparePostSearchBean = function(profile) { + //console.log('Importing: '+profile.orgUserId); + //console.log('ngexistinguser:'+$scope.ngexistingUsers[profile.orgUserId]) + if($scope.postSearchBean.selected==null){ + $scope.postSearchBean.selected=[]; + $scope.postSearchBean.postOrgUserId=[]; + $scope.postSearchBean.postHrid=[]; + $scope.postSearchBean.postFirstName=[]; + $scope.postSearchBean.postLastName=[]; + $scope.postSearchBean.postOrgCode=[]; + $scope.postSearchBean.postPhone=[]; + $scope.postSearchBean.postEmail=[]; + $scope.postSearchBean.postAddress1=[]; + $scope.postSearchBean.postAddress2=[]; + $scope.postSearchBean.postCity=[]; + $scope.postSearchBean.postState=[]; + $scope.postSearchBean.postZipCode=[]; + $scope.postSearchBean.postLocationClli=[]; + $scope.postSearchBean.postBusinessCountryCode=[]; + $scope.postSearchBean.postBusinessCountryName=[]; + $scope.postSearchBean.postDepartment=[]; + $scope.postSearchBean.postDepartmentName=[]; + $scope.postSearchBean.postBusinessUnit=[]; + $scope.postSearchBean.postBusinessUnitName=[]; + $scope.postSearchBean.postJobTitle=[]; + $scope.postSearchBean.postOrgManagerUserId=[]; + $scope.postSearchBean.postCommandChain=[]; + $scope.postSearchBean.postCompanyCode=[]; + $scope.postSearchBean.postCompany=[]; + $scope.postSearchBean.postCostCenter=[]; + $scope.postSearchBean.postSiloStatus=[]; + $scope.postSearchBean.postFinancialLocCode=[]; + } + + $scope.postSearchBean.selected.push(profile.orgUserId); + $scope.postSearchBean.postOrgUserId.push(profile.orgUserId); + $scope.postSearchBean.postHrid.push(profile.hrid); + $scope.postSearchBean.postFirstName.push(profile.firstName); + $scope.postSearchBean.postLastName.push(profile.lastName); + $scope.postSearchBean.postOrgCode.push(profile.orgCode); + $scope.postSearchBean.postPhone.push(profile.phone); + $scope.postSearchBean.postEmail.push(profile.email); + $scope.postSearchBean.postAddress1.push(profile.address1); + $scope.postSearchBean.postAddress2.push(profile.address2); + $scope.postSearchBean.postCity.push(profile.city); + $scope.postSearchBean.postState.push(profile.state); + if(profile.zipCodeSuffix==null) + $scope.postSearchBean.postZipCode.push(profile.zipCode); + else + $scope.postSearchBean.postZipCode.push(profile.zipCode+'-'+profile.zipCodeSuffix); + $scope.postSearchBean.postLocationClli.push(profile.locationClli); + $scope.postSearchBean.postBusinessCountryCode.push(profile.businessCountryCode); + $scope.postSearchBean.postBusinessCountryName.push(profile.businessCountryName); + $scope.postSearchBean.postDepartment.push(profile.department); + $scope.postSearchBean.postDepartmentName.push(profile.departmentName); + $scope.postSearchBean.postBusinessUnit.push(profile.businessUnit); + $scope.postSearchBean.postBusinessUnitName.push(profile.businessUnitName); + $scope.postSearchBean.postJobTitle.push(profile.jobTitle); + $scope.postSearchBean.postOrgManagerUserId.push(profile.orgManagerUserId); + $scope.postSearchBean.postCommandChain.push(profile.commandChain); + $scope.postSearchBean.postCompanyCode.push(profile.companyCode); + $scope.postSearchBean.postCompany.push(profile.company); + $scope.postSearchBean.postCostCenter.push(profile.costCenter); + $scope.postSearchBean.postSiloStatus.push(profile.siloStatus); + $scope.postSearchBean.postFinancialLocCode.push(profile.financialLocCode); + }; + +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profile-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profile-controller.js new file mode 100644 index 0000000..aa0066b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profile-controller.js @@ -0,0 +1,286 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('profileController', function ($scope,$http,ProfileService,$routeParams,modalService){ + $scope.tableData=[]; + $scope.profile=[]; + $scope.ociavailableRoles=[]; + $scope.ociTimeZones; + $scope.ociCountries; + var stateList=[]; + $scope.availableRoles = []; + $scope.timeZones = []; + $scope.selectedTimeZone = null; + $scope.countries = []; + $scope.selectedCountry = null; + + ProfileService.getProfileDetail($routeParams.profileId).then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.profile =JSON.parse($scope.data.profile); + $scope.ociavailableRoles =JSON.parse($scope.data.availableRoles); + $scope.ociTimeZones=JSON.parse($scope.data.timeZones); + $scope.ociCountries=JSON.parse($scope.data.countries); + stateList=JSON.parse($scope.data.stateList); + $scope.orgUserId=$scope.profile.orgUserId; + $scope.orgManagerUserId=$scope.profile.orgManagerUserId; + + + if($scope.ociavailableRoles) + $.each($scope.ociavailableRoles, function(i, a){ + var availableRole = a; + availableRole.selected = false; + $.each($scope.profile.roles, function(j, b){ + if(a.id === b.id) { + availableRole.selected = true; + } + }); + $scope.availableRoles.push(availableRole); + }); + ; + + /*$scope.ociTimeZones = ${model.timeZones};*/ + + if($scope.ociTimeZones){ + $.each($scope.ociTimeZones, function(i, a){ + var timeZone = {"index":i, "value":a.value, "title":a.label}; + $scope.timeZones.push(timeZone); + if($scope.profile.timeZoneId !== null && a.value === $scope.profile.timeZoneId.toString()){ + $scope.selectedTimeZone = timeZone; + } + }); + }; + + /*$scope.ociCountries = ${model.countries};*/ + + //alert($scope.ociCountries[0].label); + if($scope.ociCountries) + $.each($scope.ociCountries, function(i, a){ + var country = {"index":i, "value":a.value, "title":a.label}; + $scope.countries.push(country); + if(a.value === $scope.profile.country){ + $scope.selectedCountry = country; + } + }); + ; + + /*var stateList=${model.stateList};*/ + //alert(stateList[0].label); + stateList = stateList== null? []: stateList; + var selectedState= $scope.profile.state ? $scope.profile.state:""; + $scope.stateList = initDropdownWithLookUp(stateList,selectedState ); + + //$scope.resetMenu(); + },function(error){ + console.log("failed"); + reloadPageOnce(); + }); + + /*$scope.profile=${model.profile};*/ + $scope.orgUserId=$scope.profile.orgUserId; + $scope.orgManagerUserId=$scope.profile.orgManagerUserId; + + $scope.viewPerPage = 2; + $scope.currentPage = 1; + $scope.totalPage; + $scope.searchCategory = ""; + $scope.searchString = ""; + + $( "#dialog" ).hide(); + + /*$scope.ociavailableRoles=${model.availableRoles};*/ + //modalService.showFailure('Error','') ; + + + $scope.saveProfile = function() { + var uuu = "profile/saveProfile?profile_id=" + $routeParams.profileId; + var postData={profile: $scope.profile, + selectedCountry:$scope.selectedCountry!=null?$scope.selectedCountry.value:"", + selectedState:$scope.stateList.selected!=null?$scope.stateList.selected.value:"", + selectedTimeZone:$scope.selectedTimeZone!=null?$scope.selectedTimeZone.value:"" + }; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + modalService.showSuccess("Success","Update Successful."); + }, + error : function(data){ + modalService.showFailure("Fail","Error while saving."); + } + }); + }; + + $scope.addNewRolePopup = function(role) { + $( "#dialog" ).dialog({ + modal: true, + width: 500, + height:600 + }); + $(".ui-dialog").css("z-index",2001); + $(".ui-dialog-titlebar").hide(); + }; + + $scope.toggleRole = function(selected,availableRole) { + $scope.profileTemp=$scope.profile; + $scope.profile={}; + //alert('toggleRole: '+selected); + if(!selected) { + //remove role + var uuu = "profile/removeRole?profile_id=" + $routeParams.profileId; + modalService.popupConfirmWinWithCancel("Confirm","You are about to remove the role "+availableRole.name+" from the profile for "+$scope.profile.firstName+" "+$scope.profile.lastName+". Do you want to continue?", + function(){ + var postData={role:availableRole}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.profile=data;}); + }, + error : function(data){ + $scope.$apply(function(){$scope.profile=$scope.profileTemp;}); + modalService.showFailure("Fail","Error while saving."); + } + }); + }, + function(){ + availableRole.selected=!availableRole.selected; + }); + + + } else { + //add role + var uuu = "profile/addNewRole?profile_id=" + $routeParams.profileId; + modalService.popupConfirmWinWithCancel("Confirm","You are about to add the role "+availableRole.name+" from the profile for "+$scope.profile.firstName+" "+$scope.profile.lastName+". Do you want to continue?", + function(){ + var postData={role:availableRole}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.profile=data;}); + }, + error : function(data){ + $scope.$apply(function(){$scope.profile=$scope.profileTemp;}); + modalService.showFailure("Fail","Error while saving."); + } + }); + + },function(){ + availableRole.selected=!availableRole.selected; + }) + + } + + + }; + + $scope.removeRole = function(role) { + + + modalService.popupConfirmWin("Confirm","You are about to remove the role "+role.name+" from the profile for "+$scope.profile.firstName+" "+$scope.profile.lastName+". Do you want to continue?", + function(){ + $scope.profileTemp=$scope.profile; + $scope.profile={}; + var uuu = "profile/removeRole?profile_id=" + $routeParams.profileId; + var postData={role:role}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.profile=data; + $.each($scope.availableRoles, function(k, c){ + if(c.id === role.id) { + c.selected = false; + } + }); + }); + + }, + error : function(data){ + $scope.$apply(function(){$scope.profile=$scope.profileTemp;}); + modalService.showFailure("Fail","Error while saving."); + } + }); + + }) + + + }; + + function initDropdownWithLookUp(arr,selectedValue){ + var dropdownArray=[]; + var selected = null; + if(arr){ + for(var i = 0,l = arr.length; i < l; i++) { + var option = { + "index" : i , + "value" : arr[i].value, + "title" : arr[i].label + }; + dropdownArray.push(option); + if(arr[i].value === selectedValue){ + selected = option; + } + } + } + var dropDown={}; + dropDown.options = dropdownArray; + dropDown.selected = selected; + return dropDown; + }; + + $scope.doRolePopup = function() { + var modalInstance = $modal.open({ + templateUrl: 'roles_popup.html', + controller: 'rolepopupController', + resolve: { + message: function () { + var message ={ + availableRoles: $scope.availableRoles + }; + return message; + } + } + }); + modalInstance.result.then(function (opts) { + if(opts!=null){ + $scope.profile=opts.profile; + } + }); + } + + $scope.close = function(){ + $('#dialog').dialog('close'); + } + +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profile-search-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profile-search-controller.js new file mode 100644 index 0000000..6da82dc --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profile-search-controller.js @@ -0,0 +1,80 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('profileSearchCtrl', function($scope, $http,ProfileService,modalService){ + + $scope.showInput = true; + $scope.totalPages1 = 5; + $scope.viewPerPage1 = 8; + $scope.currentPage1 = 1; + + $scope.$watch('viewPerPage1', function(val) { + ProfileService.getProfilePagination($scope.currentPage1, val).then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.tableData =JSON.parse($scope.data.profileList); + $scope.totalPages1 =JSON.parse($scope.data.totalPage); + for(x in $scope.tableData){ + if($scope.tableData[x].active_yn=='Y') + $scope.tableData[x].active_yn=true; + else + $scope.tableData[x].active_yn=false; + } + },function(error){ + console.log("failed"); + reloadPageOnce(); + }); + + }); + + $scope.customHandler = function(num) { + $scope.currentPage1 = num; + ProfileService.getProfilePagination($scope.currentPage1,$scope.viewPerPage1).then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.tableData =JSON.parse($scope.data.profileList); + $scope.totalPages1 =JSON.parse($scope.data.totalPage); + for(x in $scope.tableData){ + if($scope.tableData[x].active_yn=='Y') + $scope.tableData[x].active_yn=true; + else + $scope.tableData[x].active_yn=false; + } + },function(error){ + console.log("failed"); + reloadPageOnce(); + }); + + }; + + $scope.editRow = function(profileId){ + window.location = 'userProfile#/profile/' + profileId; + }; + + $scope.toggleProfileActive = function(rowData) { + modalService.popupConfirmWinWithCancel("Confirm","You are about to change user's active status. Do you want to continue?", + function(){ + $http.get("profile/toggleProfileActive?profile_id="+rowData.id).success(function(){}); + }, + function(){ + rowData.active=!rowData.active; + }) + }; + +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profileController.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profileController.js new file mode 100644 index 0000000..4b30e40 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/profileController.js @@ -0,0 +1,38 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.config(function($routeProvider) { + $routeProvider + .when('/profile/:profileId', { + templateUrl: 'app/fusion/scripts/view-models/profile-page/profile_detail.html', + controller: 'profileController' + }) + .when('/post_search', { + templateUrl: 'app/fusion/scripts/view-models/profile-page/post_search.html', + controller: 'postSearchCtrl' + }) + .when('/self_profile', { + templateUrl: 'app/fusion/scripts/view-models/profile-page/self_profile.html', + controller: 'selfProfileController' + }) + .otherwise({ + templateUrl: 'app/fusion/scripts/view-models/profile-page/profile_search.html', + controller : "profileSearchCtrl" + }); +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-controller.js new file mode 100644 index 0000000..50913af --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-controller.js @@ -0,0 +1,226 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('roleController', function ($scope, modalService, $modal, AdminService,$routeParams){ + //$scope.role=${role}; + //console.log($scope.role.roleFunctions); + + $( "#dialogRoleFunction" ).hide(); + $( "#dialogChildRole" ).hide(); + + //$scope.ociavailableRoleFunctions=${availableRoleFunctions}; + + AdminService.getRole($routeParams.roleId).then(function(data){ + + var j = data; + $scope.data = JSON.parse(j.data); + + $scope.role =JSON.parse($scope.data.role); + console.log($scope.role); + + $scope.ociavailableRoleFunctions =JSON.parse($scope.data.availableRoleFunctions); + console.log($scope.ociavailableRoleFunctions); + $scope.availableRoleFunctions=[]; + + if($scope.ociavailableRoleFunctions) + $.each($scope.ociavailableRoleFunctions, function(i, a){ + var availableRoleFunction = a; + availableRoleFunction.selected = false; + $.each($scope.role.roleFunctions, function(j, b){ + if(a.code === b.code) { + availableRoleFunction.selected = true; + } + }); + $scope.availableRoleFunctions.push(availableRoleFunction); + }); + + + $scope.ociavailableRoles=JSON.parse($scope.data.availableRoles); + console.log($scope.ociavailableRoles); + console.log("testing roles if exist"); + $scope.availableRoles=[]; + + if($scope.ociavailableRoles) + $.each($scope.ociavailableRoles, function(i, a){ + var availableRole = a; + availableRole.selected = false; + if($scope.role.childRoles){ + $.each($scope.role.childRoles, function(j, b){ + if(a.id === b.id) { + availableRole.selected = true; + } + }); + }; + $scope.availableRoles.push(availableRole); + }); + + + },function(error){ + console.log("failed"); + reloadPageOnce(); + }); + + $scope.saveRole = function() { + var exists = false; + for(x in $scope.availableRoles){ + console.log($scope.availableRoles[x].name); + if($scope.availableRoles[x].name==$scope.role.name){ + modalService.showFailure("Warning", "Role already exists."); + exists = true; + //$modalInstance.close({availableRoleFunctions:message.availableRoleFunctions}); + } + } + if(!exists){ + var uuu = "role/saveRole.htm?role_id="+$routeParams.roleId; + var postData={role: $scope.role, childRoles: $scope.role.childRoles, roleFunctions : $scope.role.roleFunctions}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + modalService.showSuccess("Success","Update Successful."); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while saving."); + } + }); + } + + }; + + $scope.addNewRoleFunctionModalPopup = function() { + var modalInstance = $modal.open({ + templateUrl: 'role_functions_popup.html', + controller: 'rolepopupController', + backdrop: 'static', + resolve: { + roleId: function () { + return $routeParams.roleId; + }, + role: function () { + return $scope.role; + }, + availableRoles: function () { + return $scope.ociavailableRoles; + }, + availableRoleFunctions: function () { + return $scope.ociavailableRoleFunctions; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.role=response.role; + }); + }; + + $scope.addNewChildRoleModalPopup = function() { + var modalInstance = $modal.open({ + templateUrl: 'child_roles_popup.html', + controller: 'rolepopupController', + backdrop: 'static', + resolve: { + roleId: function () { + return $routeParams.roleId; + }, + role: function () { + return $scope.role; + }, + availableRoles: function () { + return $scope.ociavailableRoles; + }, + availableRoleFunctions: function () { + return $scope.ociavailableRoleFunctions; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + $scope.role=response.role; + }); + }; + + + + $scope.removeRoleFunction = function(roleFunction) { + modalService.popupConfirmWin("Confirm","You are about to remove the role function "+roleFunction.name+" from the role for "+$scope.role.name+". Do you want to continue?", + function(){ + var uuu = "role/removeRoleFunction.htm?role_id=" + $routeParams.roleId; + var postData={roleFunction:roleFunction}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.role=data.role; + $.each($scope.availableRoleFunctions, function(k, c){ + if(c.code === roleFunction.code) { + c.selected = false; + } + }); + }); + + }, + error : function(data){ + modalService.showFailure("Fail","Error while saving."); + } + }); + + }) + + }; + + $scope.removeChildRole = function(childRole) { + modalService.popupConfirmWin("Confirm","You are about to remove the child role "+childRole.name+" from the role for "+$scope.role.name+". Do you want to continue?", + function(){ + var uuu = "role/removeChildRole.htm?role_id=" + $routeParams.roleId; + var postData={childRole:childRole}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.role=data.role; + $.each($scope.availableRoles, function(k, c){ + if(c.id === childRole.id) { + c.selected = false; + } + }); + }); + + }, + error : function(data){ + modalService.showFailure("Fail","Error while saving."); + } + }); + + }) + + }; + +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-function-list-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-function-list-controller.js new file mode 100644 index 0000000..eedac3e --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-function-list-controller.js @@ -0,0 +1,157 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('roleFunctionListController', function ($scope, AdminService, modalService, $modal){ + $( "#dialog" ).hide(); + + AdminService.getRoleFunctionList().then(function(data){ + + var j = data; + $scope.data = JSON.parse(j.data); + $scope.availableRoleFunctions =JSON.parse($scope.data.availableRoleFunctions); + + //$scope.resetMenu(); + + },function(error){ + console.log("failed"); + reloadPageOnce(); + }); + + $scope.editRoleFunction = null; + var dialog = null; + $scope.editRoleFunctionPopup = function(availableRoleFunction) { + $scope.editRoleFunction = availableRoleFunction; + $( "#dialog" ).dialog({ + modal: true + }); + }; + + $scope.editRoleFunctionModalPopup = function(availableRoleFunction) { + $scope.editRoleFunction = availableRoleFunction; + $scope.availableRoleFunctionsTemp=$scope.availableRoleFunctions; + $scope.availableRoleFunctions={}; + var modalInstance = $modal.open({ + templateUrl: 'edit_role_function_popup.html', + controller: 'rolefunctionpopupController', + resolve: { + message: function () { + var message = { + availableRoleFunction: $scope.editRoleFunction, + availableRoleFunctions: $scope.availableRoleFunctionsTemp + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + if(response!=null) + $scope.availableRoleFunctions=response.availableRoleFunctions; + else + $scope.availableRoleFunctions=$scope.availableRoleFunctionsTemp; + }); + }; + + $scope.addNewRoleFunctionModalPopup = function(availableRoleFunction) { + $scope.editRoleFunction = null; + $scope.availableRoleFunctionsTemp=$scope.availableRoleFunctions; + $scope.availableRoleFunctions={}; + var modalInstance = $modal.open({ + templateUrl: 'edit_role_function_popup.html', + controller: 'rolefunctionpopupController', + resolve: { + message: function () { + var message = { + availableRoleFunction: $scope.editRoleFunction, + availableRoleFunctions: $scope.availableRoleFunctionsTemp + }; + return message; + } + } + }); + modalInstance.result.then(function(response){ + console.log('response', response); + if(response!=null) + $scope.availableRoleFunctions=response.availableRoleFunctions; + else + $scope.availableRoleFunctions=$scope.availableRoleFunctionsTemp; + }); + }; + + $scope.addNewRoleFunctionPopup = function() { + $scope.editRoleFunction = null; + $( "#dialog" ).dialog({ + modal: true + }); + }; + + $scope.saveRoleFunction = function(availableRoleFunction) { + var uuu = "role_function_list/saveRoleFunction.htm"; + var postData={availableRoleFunction: availableRoleFunction}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.availableRoleFunctions=[];$scope.$apply(); + $scope.availableRoleFunctions=data.availableRoleFunctions;}); + //alert("Update Successful.") ; + console.log($scope.availableRoleFunctions); + + $scope.editRoleFunction = null; + $( "#dialog" ).dialog("close"); + }, + error : function(data){ + modalService.showFailure("Fail","Error while saving."); + } + }); + }; + + + $scope.removeRole = function(availableRoleFunction) { + modalService.popupConfirmWin("Confirm","You are about to delete the role function "+availableRoleFunction.name+". Do you want to continue?", + function(){ + $scope.availableRoleFunctionsTemp=$scope.availableRoleFunctions; + $scope.availableRoleFunctions={}; + var uuu = "role_function_list/removeRoleFunction.htm"; + var postData={availableRoleFunction: availableRoleFunction}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.availableRoleFunctions=data.availableRoleFunctions;}); + }, + error : function(data){ + console.log(data); + $scope.$apply(function(){$scope.availableRoleFunctions=$scope.availableRoleFunctionsTemp;}); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + + }; + +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-list-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-list-controller.js new file mode 100644 index 0000000..a16d61e --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/role-list-controller.js @@ -0,0 +1,102 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('roleListController', function ($scope,AdminService,modalService){ + + AdminService.getRoles().then(function(data){ + + var j = data; + $scope.data = JSON.parse(j.data); + $scope.availableRoles =JSON.parse($scope.data.availableRoles); + + //$scope.resetMenu(); + + },function(error){ + console.log("failed"); + reloadPageOnce(); + }); + + //console.log($scope.availableRoles); + $scope.toggleRole = function(selected,availableRole) { + //alert('toggleRole: '+selected); + var toggleType = null; + if(selected) { + toggleType = "activate"; + } else { + toggleType = "inactivate"; + } + + modalService.popupConfirmWinWithCancel("Confirm","You are about to "+toggleType+" the test role "+availableRole.name+". Do you want to continue?", + function(){ + var uuu = "role_list/toggleRole"; + + var postData={role:availableRole}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + console.log(data); + $scope.$apply(function(){$scope.availableRoles=data.availableRoles;}); + console.log($scope.availableRoles); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while saving."); + } + }); + + }, + function(){ + availableRole.active=!availableRole.active; + }) + + + }; + + $scope.removeRole = function(role) { + + modalService.popupConfirmWin("Confirm","You are about to delete the role "+role.name+". Do you want to continue?", + function(){ + var uuu = "role_list/removeRole"; + var postData={role:role}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.availableRoles=data.availableRoles;}); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while deleting: "+ data.responseText); + } + }); + + }) + + + }; + + +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/rolefunctionpopupController.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/rolefunctionpopupController.js new file mode 100644 index 0000000..14aea22 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/rolefunctionpopupController.js @@ -0,0 +1,84 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +var rolefunctionpopupController = function ($scope, modalService, $modalInstance, message, $http,AdminService){ + if(message.availableRoleFunction==null) { + $scope.label='Add Role Function'; + var tempText = ""; + } + else{ + $scope.label='Edit Role Function' + $scope.disableCd=true; + var tempText = new String(message.availableRoleFunction.name); + $scope.editRoleFunction = message.availableRoleFunction; + } + + $scope.tempText = tempText; + + $scope.saveRoleFunction = function(availableRoleFunction) { + var uuu = "role_function_list/saveRoleFunction.htm"; + var postData={availableRoleFunction: availableRoleFunction}; + + if(availableRoleFunction==null){ + modalService.showFailure("Warning", "Please enter valid role function details."); + } + var exists = false; + for(x in message.availableRoleFunctions){ + console.log(message.availableRoleFunctions[x].name); + if(message.availableRoleFunctions[x].name==availableRoleFunction.name){ + modalService.showFailure("Warning", "Role Function already exists."); + exists = true; + availableRoleFunction.name = $scope.tempText; + } + } + + if(!exists && availableRoleFunction.name.trim() != '' && availableRoleFunction.code.trim() != ''){ + $http.post(uuu, JSON.stringify(postData)).then(function(res){ + console.log("data"); +// console.log(res.data); +// $scope.availableRoleFunctionsTemp = res.data.availableRoleFunctions; + AdminService.getRoleFunctionList().then(function(data){ + + var j = data; + $scope.data = JSON.parse(j.data); + $scope.availableRoleFunctions =JSON.parse($scope.data.availableRoleFunctions); + + //$scope.resetMenu(); + $modalInstance.close(); + },function(error){ + console.log("failed"); + reloadPageOnce(); + $modalInstance.close(); + }); + + + }); + + + + + } + }; + + + + $scope.close = function() { + $modalInstance.close(); + }; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/rolepopupmodelController.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/rolepopupmodelController.js new file mode 100644 index 0000000..f8ecfad --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/rolepopupmodelController.js @@ -0,0 +1,205 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +var rolepopupController = function ($scope, $modalInstance, role, roleId, availableRoles, availableRoleFunctions,AdminService,modalService){ + + $scope.role = role; + console.log($scope.role); + if($scope.role.childRoles==null){ + $scope.role.childRoles=[]; + } + + $scope.ociavailableRoles=availableRoles; + console.log($scope.ociavailableRoles); + + $scope.availableRoles=[]; + if($scope.ociavailableRoles) + $.each($scope.ociavailableRoles, function(i, a){ + var availableRole = a; + availableRole.selected = false; + if($scope.role.childRoles){ + $.each($scope.role.childRoles, function(j, b){ + if(a.id === b.id) { + availableRole.selected = true; + } + }); + }; + $scope.availableRoles.push(availableRole); + }); + + $scope.ociavailableRoleFunctions = availableRoleFunctions; + console.log($scope.ociavailableRoleFunctions); + $scope.availableRoleFunctions = []; + if($scope.ociavailableRoleFunctions) + $.each($scope.ociavailableRoleFunctions, function(i, a){ + var availableRoleFunction = a; + availableRoleFunction.selected = false; + $.each($scope.role.roleFunctions, function(j, b){ + if(a.code === b.code) { + availableRoleFunction.selected = true; + } + }); + $scope.availableRoleFunctions.push(availableRoleFunction); + }); + //$scope.resetMenu(); + + $scope.toggleRoleFunction = function(selected,availableRoleFunction) { + //alert('toggleRole: '+selected); + + if(!selected) { + //remove role function + if(role.id==null){ + var index = $scope.role.roleFunctions.indexOf(availableRoleFunction); + if(index>=0) + $scope.role.roleFunctions.splice(index, 1); + return; + } + var uuu = "role/removeRoleFunction.htm?role_id=" + roleId; + modalService.popupConfirmWinWithCancel("Confirm","You are about to remove the role function "+availableRoleFunction.name+" from the role for "+$scope.role.name+". Do you want to continue?", + function(){ + var postData={roleFunction:availableRoleFunction}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.role=data.role;}); + }, + error : function(data){ + modalService.showFailure("Fail","Error while saving."); + } + }); + + }, + function(){ + availableRoleFunction.selected=!availableRoleFunction.selected; + }) + + } else { + //add role function + if(role.id==null){ + $scope.role.roleFunctions.push(availableRoleFunction); + return; + } + var uuu = "role/addRoleFunction.htm?role_id=" + roleId; + + modalService.popupConfirmWinWithCancel("Confirm","You are about to add the role function "+availableRoleFunction.name+" to the role for "+$scope.role.name+". Do you want to continue?", + function(){ + var postData={roleFunction:availableRoleFunction}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.role=data.role;}); + }, + error : function(data){ + modalService.showFailure("Fail","Error while saving."); + } + }); + + }, + function(){ + availableRoleFunction.selected=!availableRoleFunction.selected; + }) + } + + + }; + + $scope.toggleChildRole = function(selected,availableRole) { + //alert('toggleRole: '+selected); + + if(!selected) { + //remove role + if(role.id==null){ + var index = $scope.role.childRoles.indexOf(availableRole); + if(index>=0) + $scope.role.childRoles.splice(index, 1); + return; + } + var uuu = "role/removeChildRole.htm?role_id=" + roleId; + + modalService.popupConfirmWinWithCancel("Confirm","You are about to remove the child role "+availableRole.name+" from the role for "+$scope.role.name+". Do you want to continue?", + function(){ + var postData={childRole:availableRole}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + console.log('role',data.role); + $scope.$apply(function(){$scope.role=data.role;}); + }, + error : function(data){ + modalService.showFailure("Fail","Error while saving."); + } + }); + + }, + function(){ + availableRole.selected=true; + }) + + } else { + //add role + if(role.id==null){ + $scope.role.childRoles.push(availableRole); + return; + } + var uuu = "role/addChildRole.htm?role_id=" + roleId; + + modalService.popupConfirmWinWithCancel("Confirm","You are about to add the child role "+availableRole.name+" to the role for "+$scope.role.name+". Do you want to continue?", + function(){ + var postData={childRole:availableRole}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.role=data.role;}); + }, + error : function(data){ + modalService.showFailure("Fail","Error while saving."); + } + }); + + }, + function(){ + availableRole.selected=false; + }) + } + + + }; + + $scope.close = function() { + console.log('role', $scope.role); + $modalInstance.close({role:$scope.role}); + }; + +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/self-profile-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/self-profile-controller.js new file mode 100644 index 0000000..b82dae3 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/self-profile-controller.js @@ -0,0 +1,284 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('selfProfileController', function ($scope,$http,ProfileService,$routeParams,modalService){ + $scope.tableData=[]; + $scope.profile=[]; + $scope.ociavailableRoles=[]; + $scope.ociTimeZones; + $scope.ociCountries; + var stateList=[]; + $scope.availableRoles = []; + $scope.timeZones = []; + $scope.selectedTimeZone = null; + $scope.countries = []; + $scope.selectedCountry = null; + $scope.isUserSystemAdmin = false; + + ProfileService.getSelfProfileDetail().then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.profile =JSON.parse($scope.data.profile); + $scope.profileId = $scope.profile.id; + $scope.ociavailableRoles =JSON.parse($scope.data.availableRoles); + $scope.ociTimeZones=JSON.parse($scope.data.timeZones); + $scope.ociCountries=JSON.parse($scope.data.countries); + stateList=JSON.parse($scope.data.stateList); + $scope.orgUserId=$scope.profile.orgUserId; + $scope.orgManagerUserId=$scope.profile.orgManagerUserId; + + if($scope.ociavailableRoles) + $.each($scope.ociavailableRoles, function(i, a){ + var availableRole = a; + availableRole.selected = false; + $.each($scope.profile.roles, function(j, b){ + if(a.id === b.id) { + availableRole.selected = true; + if(a.id === 1){ + $scope.isUserSystemAdmin = true; + } + } + }); + $scope.availableRoles.push(availableRole); + }); + ; + + /*$scope.ociTimeZones = ${model.timeZones};*/ + + if($scope.ociTimeZones){ + $.each($scope.ociTimeZones, function(i, a){ + var timeZone = {"index":i, "value":a.value, "title":a.label}; + $scope.timeZones.push(timeZone); + if($scope.profile.timeZoneId !== null && a.value === $scope.profile.timeZoneId.toString()){ + $scope.selectedTimeZone = timeZone; + } + }); + }; + + /*$scope.ociCountries = ${model.countries};*/ + + //alert($scope.ociCountries[0].label); + if($scope.ociCountries) + $.each($scope.ociCountries, function(i, a){ + var country = {"index":i, "value":a.value, "title":a.label}; + $scope.countries.push(country); + if(a.value === $scope.profile.country){ + $scope.selectedCountry = country; + } + }); + ; + + /*var stateList=${model.stateList};*/ + //alert(stateList[0].label); + stateList = stateList== null? []: stateList; + var selectedState= $scope.profile.state ? $scope.profile.state:""; + $scope.stateList = initDropdownWithLookUp(stateList,selectedState ); + + //$scope.resetMenu(); + },function(error){ + console.log("failed"); + reloadPageOnce(); + }); + + /*$scope.profile=${model.profile};*/ + $scope.orgUserId=$scope.profile.orgUserId; + $scope.orgManagerUserId=$scope.profile.orgManagerUserId; + + $scope.viewPerPage = 2; + $scope.currentPage = 1; + $scope.totalPage; + $scope.searchCategory = ""; + $scope.searchString = ""; + + $( "#dialog" ).hide(); + + /*$scope.ociavailableRoles=${model.availableRoles};*/ + //modalService.showFailure('Error','') ; + + + $scope.saveProfile = function() { + var uuu = "profile/saveProfile?profile_id=" + $scope.profileId;; + var postData={profile: $scope.profile, + selectedCountry:$scope.selectedCountry!=null?$scope.selectedCountry.value:"", + selectedState:$scope.stateList.selected!=null?$scope.stateList.selected.value:"", + selectedTimeZone:$scope.selectedTimeZone!=null?$scope.selectedTimeZone.value:"" + }; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + modalService.showSuccess("Success","Update Successful."); + }, + error : function(data){ + modalService.showFailure("Fail","Error while saving."); + } + }); + }; + + $scope.addNewRolePopup = function(role) { + $( "#dialog" ).dialog({ + modal: true, + width: 500, + height:600 + }); + + $(".ui-dialog").css("z-index",10002); + $(".ui-dialog-titlebar").hide(); + }; + + $scope.toggleRole = function(selected,availableRole) { + //alert('toggleRole: '+selected); + if(!selected) { + //remove role + var uuu = "profile/removeRole?profile_id=" + $scope.profileId;; + modalService.popupConfirmWinWithCancel("Confirm","You are about to remove the role "+availableRole.name+" from the profile for "+$scope.profile.firstName+" "+$scope.profile.lastName+". Do you want to continue?", + function(){ + var postData={role:availableRole}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.profile=data;}); + }, + error : function(data){ + modalService.showFailure("Fail","Error while saving."); + } + }); + }, + function(){ + availableRole.selected=!availableRole.selected; + }); + + + } else { + //add role + var uuu = "profile/addNewRole?profile_id=" + $scope.profileId;; + modalService.popupConfirmWinWithCancel("Confirm","You are about to add the role "+availableRole.name+" from the profile for "+$scope.profile.firstName+" "+$scope.profile.lastName+". Do you want to continue?", + function(){ + var postData={role:availableRole}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){$scope.profile=data;}); + }, + error : function(data){ + modalService.showFailure("Fail","Error while saving."); + } + }); + + },function(){ + availableRole.selected=!availableRole.selected; + }) + + } + + + }; + + $scope.removeRole = function(role) { + + + modalService.popupConfirmWin("Confirm","You are about to remove the role "+role.name+" from the profile for "+$scope.profile.firstName+" "+$scope.profile.lastName+". Do you want to continue?", + function(){ + var uuu = "profile/removeRole?profile_id=" + $scope.profileId;; + var postData={role:role}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.profile=data; + $.each($scope.availableRoles, function(k, c){ + if(c.id === role.id) { + c.selected = false; + } + }); + }); + + }, + error : function(data){ + modalService.showFailure("Fail","Error while saving."); + } + }); + + }) + + + }; + + function initDropdownWithLookUp(arr,selectedValue){ + var dropdownArray=[]; + var selected = null; + if(arr){ + for(var i = 0,l = arr.length; i < l; i++) { + var option = { + "index" : i , + "value" : arr[i].value, + "title" : arr[i].label + }; + dropdownArray.push(option); + if(arr[i].value === selectedValue){ + selected = option; + } + } + } + var dropDown={}; + dropDown.options = dropdownArray; + dropDown.selected = selected; + return dropDown; + }; + + $scope.doRolePopup = function() { + var modalInstance = $modal.open({ + templateUrl: 'roles_popup.html', + controller: 'rolepopupController', + resolve: { + message: function () { + var message ={ + availableRoles: $scope.availableRoles + }; + return message; + } + } + }); + modalInstance.result.then(function (opts) { + if(opts!=null){ + $scope.profile=opts.profile; + } + }); + } + + $scope.close = function(){ + $('#dialog').dialog('close'); + } + +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/usage-list-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/usage-list-controller.js new file mode 100644 index 0000000..b495b93 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/usage-list-controller.js @@ -0,0 +1,41 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('usageListController', function ($scope,$interval,$http,$modal,modalService,AdminService){ + + AdminService.getUsageList().then(function(data){ + + var j = data; + $scope.data = JSON.parse(j.data); + $scope.users =$scope.data; + //$scope.resetMenu(); + + },function(error){ + console.log("failed"); + reloadPageOnce(); + }); + + $scope.removeSession = function(sessionId) { + modalService.popupConfirmWin("Confirm","You are about to expel this user from the application. All of their unsaved data will be lost. Do you want to continue?", + function(){ + $http.get("usage_list/removeSession?deleteSessionId="+sessionId).success(function(response){$scope.users=response;}); + }) + + } +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowApp.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowApp.js new file mode 100644 index 0000000..0a5c801 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowApp.js @@ -0,0 +1,24 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +angular.module('att.abs.helper', []); +angular.module('quantum', []); + +var app=angular.module("workflowApp", ["att.abs", "att.abs.helper","modalServices", + "att.gridster","checklist-model","ngRoute", "ui.bootstrap"]); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowController.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowController.js new file mode 100644 index 0000000..169a886 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowController.js @@ -0,0 +1,509 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('workflowsController', function($scope, $http, $uibModal, $log, modalService, $modal) { + + $scope.viewPerPage = 5; + $scope.scrollViewsPerPage = 20; + $scope.currentPage = 2; + $scope.totalPage; + $scope.searchCategory = ""; + $scope.searchString = ""; + $scope.radio = { + value: "" + }; + + + $scope.showModal = false; + $scope.toggleModal = function(){ + $scope.showModal = !$scope.showModal; + }; + + $scope.workflow = {}; + $scope.workflow.active = "true"; + + $scope.updateAllWorkflowStatus = function() { + angular.forEach($scope.workflows,function(value){ + $scope.checkWorkflowStatus(value); + }) + } + + $scope.fetchWorkflowsList = function() { + $http.get('workflows/list').then(function(workflowList){ + console.log('Got new list from server = ' + workflowList.data); + $scope.workflows = workflowList.data; + $scope.updateAllWorkflowStatus(); + }); + }; + + $scope.addNewWorkflow = function(newWorkflow) { + $http.post('workflows/addWorkflow/', JSON.stringify(newWorkflow)).success(function() { + $scope.fetchWorkflowsList(); + }); + + $scope.workflow.name = ''; + + }; + + $scope.updateWorkflow = function (workflowToEdit) { + //workflowToEdit.active='true'; + var modalInstance = $uibModal.open({ + animation: $scope.animationsEnabled, + templateUrl: 'app/fusion/scripts/view-models/workflows/workflow-new.html', + //size : modalSize, + controller: ['$scope', '$uibModalInstance', '$http', function ($scope, $uibModalInstance, $http) { + $scope.workflow = workflowToEdit; + $scope.ok = function() { + console.log('Updating existing workflow ... ' + JSON.stringify($scope.workflow)); + $http.post('workflows/editWorkflow/', JSON.stringify($scope.workflow)).then(function(returnedWorkflow){ + console.log('Returned Workflow = ' + JSON.stringify(returnedWorkflow)); + $uibModalInstance.close($scope.workflow); + }); + }; + + $scope.cancel = function() { + $uibModalInstance.dismiss(); + }; + }], + //End of inner controller + resolve: { + workflow: function() { + console.log('Passing ' + JSON.stringify($scope.workflow)); + return $scope.workflow; + } + } + }); + + modalInstance.result.then(function (editedWorkFlow) { + //Need to convert to proper date - later + delete editedWorkFlow.created; + delete editedWorkFlow.updated; + + delete editedWorkFlow.createdBy; + delete editedWorkFlow.modifiedBy; + + console.log('selected Item ' + JSON.stringify(editedWorkFlow)); + $scope.$emit('workflowAdded', editedWorkFlow); + + }, function () { + $log.info('Modal dismissed at: ' + new Date()); + }); + }; + + $scope.reset = function(){ + console.log("Resetting ...."); + }; + + $scope.update = function(){ + console.log("updating ...."); + }; + + $scope.createWorkflow = function (modalSize) { + + var modalInstance = $uibModal.open({ + animation: $scope.animationsEnabled, + templateUrl: 'app/fusion/scripts/view-models/workflows/workflow-new.html', + size : modalSize, + controller: ['$scope', '$uibModalInstance', '$http', function ($scope, $uibModalInstance, $http) { + $scope.workflow = {}; + $scope.workflow.active = 'true'; + $scope.ok = function() { + console.log('Saving new workflow ... ' + JSON.stringify($scope.workflow)); + $http.post('workflows/addWorkflow/', JSON.stringify($scope.workflow)).then(function(returnedWorkflow){ + console.log('Returned Workflow = ' + JSON.stringify(returnedWorkflow)); + $uibModalInstance.close($scope.workflow); + }); + }; +/* console.log(size);*/ + $scope.cancel = function() { + $uibModalInstance.dismiss(); + }; + }], + //End of inner controller + resolve: { + workflow: function() { + console.log('Passing ' + JSON.stringify($scope.workflow)); + return $scope.workflow; + } + } + }); + + modalInstance.result.then(function (newWorkflow) { + console.log('selected Item ' + JSON.stringify(newWorkflow)); + $scope.$emit('workflowAdded', newWorkflow); + + }, function () { + $log.info('Modal dismissed at: ' + new Date()); + }); + };//End of createWorkflow function + + + $scope.removeWorkflow = function(workflowToRemove){ + var modalInstance = $uibModal.open({ + animation: $scope.animationsEnabled, + templateUrl: 'app/fusion/scripts/view-models/workflows/workflow-remove.html', + controller: ['$scope', '$uibModalInstance', '$http', function ($scope, $uibModalInstance, $http) { + $scope.workflowToRemove = workflowToRemove; + $scope.ok = function() { + console.log('Removing workflow ... ' + JSON.stringify($scope.workflowToRemove) + ' on client request.'); + $http.post('workflows/removeWorkflow/', JSON.stringify($scope.workflowToRemove.id)).then(function(){ + console.log('Workflow successfully removed !!!'); + $uibModalInstance.close(); + }); + }; + + $scope.cancel = function() { + $uibModalInstance.dismiss(); + }; + }] + }); + + modalInstance.result.then(function () { + $scope.$emit('workflowRemoved'); + }, function () { + $log.info('Modal dismissed at: ' + new Date()); + }); + + }; + + + + $scope.scheduleWorkflow = function(workflowToSchedule){ + var modalInstance = $uibModal.open({ + animation: $scope.animationsEnabled, + templateUrl: 'app/fusion/scripts/view-models/workflows/workflow-schedule.html', + size:'lg', + + controller: ['$scope', '$uibModalInstance', '$http','dateFilter', function ($scope, $uibModalInstance, $http,dateFilter) { + + $scope.workflowToSchedule = workflowToSchedule; + $scope.dt = new Date(); + $scope.dt2 = new Date(); + $scope.dateformat = 'MM/dd/yyyy', + $scope.datetimeformat = "hh:mm a"; + + $scope.recurrenceOptions =[{ + index:0, value:'One-Time', title:'One-Time' + },{ + index:1, value: 'Hourly',title:'Hourly' + },{ + index:2, value: 'Daily',title:'Daily' + },{ + index:3, value: 'Weekly',title:'Weekly' + }] + $scope.selectRecurrenceOpt = $scope.recurrenceOptions[0]; + + $scope.hours = []; + for (var i=0; i<24; i++){ + var newObj={} + newObj.index = i; + newObj.value = ""+i; + newObj.title = ""+i; + $scope.hours.push(newObj); + } + + $scope.minutes = []; + for (var i=0; i<60; i++){ + var newObj={} + newObj.index = i; + newObj.value = ""+i; + newObj.title = ""+i; + $scope.minutes.push(newObj); + } + + $scope.AMPMOptions =[ + { + index:0, value:'AM', title:'AM' + },{ + index:1, value: 'PM',title:'PM' + }] + + $scope.selectFirstHour =$scope.hours[0]; + $scope.selectFirstMinute =$scope.minutes[0]; + + $scope.selectLastHour =$scope.hours[0]; + $scope.selectLastMinute =$scope.minutes[0]; + + $scope.selectStartAMPMOption=$scope.AMPMOptions[0]; + $scope.selectLastAMPMOption=$scope.AMPMOptions[0]; + + var GenerateCronExpression = function(trigger_dt, RecurrenceOpt) { + var CRON_sec = trigger_dt.getSeconds(); + var CRON_min = trigger_dt.getMinutes(); + var CRON_hr = trigger_dt.getHours(); + var CRON_date= trigger_dt.getDate(); + var CRON_month = trigger_dt.toLocaleString('en-US', {month: 'short'}).toUpperCase(); + var CRON_day = trigger_dt.toLocaleString('en-US', {weekday: 'short'}).toUpperCase(); + var CRON_year = trigger_dt.getFullYear(); + if (RecurrenceOpt ==="One-Time") { + CRON_day = '?' + } else { + if (RecurrenceOpt ==="Hourly") { + CRON_hr = '*'; + CRON_date = '*' + CRON_month = '*' + CRON_day = '?' + CRON_year = '*' + } else if (RecurrenceOpt ==="Daily") { + CRON_date = '*' + CRON_month = '*' + CRON_day = '?' + CRON_year = '*' + } else if (RecurrenceOpt ==="Weekly") { + CRON_date = '*' + CRON_month = '*' + CRON_year = '*' + } + } + + var CRON_Expression = [CRON_sec, CRON_min, CRON_hr, CRON_date, CRON_month, CRON_day, CRON_year]; + return CRON_Expression.join(" "); + } + + $scope.ok = function() { + + // DateTime for the start time: it should be noted that the start time + // for a CRON job should be prior to the trigger time. + $scope.trigger_dt = new Date( $scope.dt.getFullYear() + + "-" + ("0"+($scope.dt.getMonth()+1)).slice(-2) + + "-" +("0"+ $scope.dt.getDate()).slice(-2) + + " " + ("0" + $scope.selectFirstHour.value).slice(-2) + + ":" +("0" + $scope.selectFirstMinute.value).slice(-2) + + ":00.0"); + + $scope.startDateTime_CRON = GenerateCronExpression($scope.trigger_dt, $scope.selectRecurrenceOpt.value) + + //roll back the the start date time by 30 seconds (start time should be 30 seconds prior to trigger time) + dt_st = new Date($scope.trigger_dt - 30*1000) + + startDateTime = dt_st.getFullYear() + + "-" + ("0"+(dt_st.getMonth()+1)).slice(-2) + + "-" +("0"+ dt_st.getDate()).slice(-2) + + " " + ("0" + dt_st.getHours()).slice(-2) + + ":" +("0" + dt_st.getMinutes()).slice(-2) + + ":" + ("0" + dt_st.getSeconds()).slice(-2) +".0"; + $scope.startDateTime = startDateTime; + + $scope.endDateTime = $scope.dt2.getFullYear() + + "-" + ("0"+($scope.dt2.getMonth()+1)).slice(-2) + + "-" +("0"+ $scope.dt2.getDate()).slice(-2) + + " " + ("0"+ $scope.selectLastHour.value).slice(-2) + + ":" +("0" + $scope.selectLastMinute.value).slice(-2) + + ":00.0" + + $scope.WorkflowScheduleObject = {}; + $scope.WorkflowScheduleObject['startDateTime_CRON'] = $scope.startDateTime_CRON; + $scope.WorkflowScheduleObject['startDateTime'] = $scope.startDateTime; + $scope.WorkflowScheduleObject['endDateTime'] = $scope.endDateTime; + $scope.WorkflowScheduleObject['workflowKey'] = $scope.workflowToSchedule.workflowKey; + $scope.WorkflowScheduleObject['recurrence'] = $scope.selectRecurrenceOpt.value; + $scope.WorkflowScheduleObject['workflow_arguments'] = "test"; + $scope.WorkflowScheduleObject['workflow_server_url'] = $scope.workflowToSchedule.runLink; + + + TimeFromNowToStart = new Date($scope.startDateTime)-new Date() + TimeStartToEnd = new Date($scope.endDateTime)-new Date($scope.startDateTime) + + if (TimeFromNowToStart<=0) { + console.log("invalid start time input") + alert("Please ensure the scheduled start date time is later than current time.") + return; + } + if (TimeStartToEnd<=0) { + console.log("invalid end time input") + alert("Please ensure the schduled end date time is later than the start time.") + return; + } + // if successful then save and close + $scope.saveCronJob($scope.WorkflowScheduleObject); + $uibModalInstance.close(); + + }; + + $scope.saveCronJob = function(cronJobData){ + + console.log('saving cron job data: ' + cronJobData); + var uuu = "workflows/saveCronJob.htm"; + var postData={cronJobDataObj: cronJobData}; + $.ajax({ + type : 'POST', + url : uuu, + //dataType: 'json', // data type expected from server + contentType: 'application/json', + data: JSON.stringify(postData), // data type sent to server + success : function(data){ + $scope.$apply(function(){ + //$scope.availableRoleFunctions=[];$scope.$apply(); + // new // $scope.availableFnMenuItems=data.availableFnMenuItems; + } + ); + //alert("Update Successful.") ; + //$scope.editRoleFunction = null; + // new /// $modalInstance.close({availableFnMenuItems:$scope.availableRoleFunctions}); + }, + error : function(data){ + alert("Error while saving."); + } + }); + + }; + + $scope.cancel = function() { + console.log("cancel triggered") + $uibModalInstance.dismiss(); + }; + }] + }); + + modalInstance.result.then(function () { + $scope.$emit('workflowRemoved'); + }, function () { + $log.info('Modal dismissed at: ' + new Date()); + }); + + }; + + + + + + + + + $scope.previewWorkflow = function(workflowToPreview,modalSize){ + var modalInstance = $uibModal.open({ + animation: $scope.animationsEnabled, + templateUrl: 'app/fusion/scripts/view-models/workflows/workflow-preview.html', + size:modalSize, + controller: ['$scope', '$uibModalInstance', '$http', function ($scope, $uibModalInstance, $http) { + $scope.workflowToPreview = workflowToPreview; + console.log('previewWorkFlow invoked'); + console.log($scope.workflowToPreview); + + $scope.cancel = function() { + $uibModalInstance.dismiss(); + }; + }] + }); + + modalInstance.result.then(function () { + $scope.$emit('workflowRemoved'); + }, function () { + $log.info('Modal dismissed at: ' + new Date()); + }); + + }; + + + /* change work flow status based on the boolean variable "suspendBool" which corresponds whether + * we would like to suspend or activate a workflow specified by key. */ + $scope.changeWorkflowStatus = function(workflowToChangeStatus,suspendBool){ + if (workflowToChangeStatus!==null) { + var statusUrl= workflowToChangeStatus.runLink+"/engine-rest/process-definition/key/"+workflowToChangeStatus.workflowKey + var suspendedUrl= statusUrl+"/suspended" + var xmlHttp = new XMLHttpRequest(); + xmlHttp.open('PUT', suspendedUrl, false); + xmlHttp.setRequestHeader('Content-Type', 'application/json;charset=UTF-8'); + xmlHttp.onload = function() { + if (suspendBool) { + console.log("process definition is now suspended"); + workflowToChangeStatus.active="false" + } else { + console.log("process definition is now activated"); + workflowToChangeStatus.active="true" + } + }; + xmlHttp.send(JSON.stringify({ + "suspended" : suspendBool, + "includeProcessInstances" : true, + "executionDate" : "2013-11-21T10:49:45" + })); + } + + }; + + $scope.activateWorkflow = function(workflowToActivate){ + $scope.changeWorkflowStatus(workflowToActivate,false) + + }; + + $scope.suspendWorkflow = function(workflowToActivate){ + $scope.changeWorkflowStatus(workflowToActivate,true) + }; + + $scope.checkWorkflowStatus = function(workflow) { + if (workflow!==null) { + var statusUrl= workflow.runLink+"/engine-rest/process-definition/key/"+workflow.workflowKey + var xmlHttp3 = new XMLHttpRequest(); + xmlHttp3.open('GET', statusUrl, true); + xmlHttp3.withCredentials = true; + xmlHttp3.send(); + xmlHttp3.onreadystatechange = function() { + if (xmlHttp3.readyState == 4 && xmlHttp3.status == 200) { + // do something with the response in the variable data + var temp = JSON.parse(xmlHttp3.responseText) + if (temp.suspended == false){ + console.log("Activated") + workflow.active="true" + } else { + console.log("Suspended") + workflow.active="false" + } + } + } + } + }; + + $scope.StartWorkflowInstance = function(workflowToStart){ + if (workflowToStart!==null) { + var statusUrl= workflowToStart.runLink+"/engine-rest/process-definition/key/"+workflowToStart.workflowKey + var suspendedUrl= statusUrl+"/submit-form" + var xmlHttp = new XMLHttpRequest(); + xmlHttp.open('POST', suspendedUrl, false); + xmlHttp.setRequestHeader('Content-Type', 'application/json;charset=UTF-8'); + xmlHttp.onload = function() { + }; + xmlHttp.send(JSON.stringify({ + "variables": { + "customerId": {"value":"asdasda","type":"String"}, + "amount":{"value":"100","type":"String"} + } + })); + } + + }; + + + $scope.$on('workflowAdded', function(event, newWorkflow) { + console.log("New Workflow to be added in list scope " + JSON.stringify(newWorkflow)); + //$scope.workflows.push(newWorkflow); + $scope.fetchWorkflowsList(); + console.log('newly added workflow = ' + JSON.stringify(newWorkflow)); + }); + + $scope.$on('workflowRemoved', function(event) { + $scope.fetchWorkflowsList(); + }); + + $scope.fetchWorkflowsList(); + + + +}); + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowRouting.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowRouting.js new file mode 100644 index 0000000..81fe4e2 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/controllers/workflows/workflowRouting.js @@ -0,0 +1,26 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.config(function($routeProvider) { + $routeProvider + .when('/all', { + templateUrl: 'app/fusion/scripts/view-models/workflows/workflow-listing.html', + controller: 'workflowsController' + }) +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/footer.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/footer.js new file mode 100644 index 0000000..a2dab75 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/footer.js @@ -0,0 +1,30 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.directive('qFooter', function () { + return { + restrict: 'A', //This menas that it will be used as an attribute and NOT as an element. I don't like creating custom HTML elements + replace: false, + templateUrl: "app/fusion/scripts/view-models/footer.html", + controller: ['$scope', '$filter', function ($scope, $filter) { + // Your behaviour goes here :) + }] + } +}); + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/header.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/header.js new file mode 100644 index 0000000..bc90d20 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/header.js @@ -0,0 +1,504 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.directive('qHeader', function () { + return { + restrict: 'A', //This menas that it will be used as an attribute and NOT as an element. I don't like creating custom HTML elements + replace: false, + templateUrl: "app/fusion/scripts/view-models/header.html", + controller: ['$scope', '$filter','$http','$timeout', '$log','UserInfoService', '$window', '$cookies', function ($scope, $filter, $http, $timeout, $log,UserInfoService, $window, $cookies) { + + /*Define fields*/ + $scope.userName; + $scope.userFirstName; + $scope.redirectUrl; + $scope.contactUsUrl; + $scope.getAccessUrl; + $scope.childData=[]; + $scope.parentData=[]; + $scope.menuItems = []; + $scope.loadMenufail=false; + $scope.megaMenuDataObject=[]; + $scope.activeClickSubMenu = { + x: '' + }; + $scope.activeClickMenu = { + x: '' + }; + $scope.favoritesMenuItems = []; + $scope.favoriteItemsCount = 0; + $scope.showFavorites = false; + $scope.emptyFavorites = false; + $scope.favoritesWindow = false; + + /*Menu Structure*/ + var menuStructureConvert = function(menuItems) { + console.log(menuItems); + $scope.megaMenuDataObjectTemp = + [ + { + text: "ECOMP", + children: menuItems + }, + { + text: "Help", + children: [ + { + text:"Contact Us", + url:$scope.contactUsUrl + }, + { + text:"Get Access", + url:$scope.getAccessUrl + }] + } + ]; + return $scope.megaMenuDataObjectTemp; + }; + + /***************functions**************/ + /*Put user info into fields*/ + $scope.inputUserInfo = function(userInfo){ + if (typeof(userInfo) != "undefined" && userInfo!=null && userInfo!=''){ + if(typeof(userInfo.USER_FIRST_NAME) != "undefined" && userInfo.USER_FIRST_NAME!=null){ + $scope.userFirstName = userInfo.USER_FIRST_NAME; + } + } + } + /*getting user info from session*/ + $scope.getUserNameFromSession = function(){ + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (res) { + $scope.contactUsUrl=res.contactUsLink; + $scope.userName = res.userName; + $scope.userFirstName = res.firstName; + $scope.redirectUrl = res.portalUrl; + $scope.getAccessUrl = res.getAccessUrl; + }); + } + $scope.getTopMenuStaticInfo=function() { + var promise = UserInfoService.getFunctionalMenuStaticDetailShareContext(); + promise.then( + function(res) { + if(res==null || res==''){ + $log.info('failed getting static User information'); + $scope.getUserNameFromSession(); + }else{ + $log.info('Received static User information'); + + var resData = res; + console.log(resData); + $scope.inputUserInfo(resData); + $scope.userName = $scope.firstName+ ' '+ $scope.lastName; + } + }, + function(err) { + $log.info('failed getting static User information'); + } + ); + } + + $scope.returnToPortal=function(){ + window.location.href = $scope.redirectUrl; + } + + var unflatten = function( array, parent, tree ){ + tree = typeof tree !== 'undefined' ? tree : []; + parent = typeof parent !== 'undefined' ? parent : { menuId: null }; + var children = _.filter( array, function(child){ return child.parentMenuId == parent.menuId; }); + if( !_.isEmpty( children ) ){ + if( parent.menuId === null ){ + tree = children; + }else{ + parent['children'] = children + } + _.each( children, function( child ){ unflatten( array, child ) } ); + } + return tree; + } + + $scope.getMenu=function() { + $scope.getTopMenuStaticInfo(); + $http({ + method: "GET", + url: 'get_functional_menu', +// TIMEOUT USED FOR LOCAL TESTING ONLY +// timeout: 100 + }).success(function (response) { + + if (response == '101: Timeout') { + $log.debug('Timeout attempting to get_functional_menu'); + $scope.megaMenuDataObject = menuStructureConvert(""); +// $scope.createErrorMenu(); + //$scope.loadMenufail=true; + } else { + if(typeof response != 'undefined' && response.length!=0 && typeof response[0] != 'undefined' && typeof response[0].error!="undefined"){ + $log.debug('Timeout attempting to get_functional_menu'); + $scope.menuItems = unflatten( response); + $scope.megaMenuDataObject = menuStructureConvert($scope.menuItems); +// $scope.createErrorMenu(); + //$scope.loadMenufail=true; + }else{ + $scope.loadMenufail=false; + $scope.contactUsURL = response.contactUsLink; + $log.debug('functional_menu',response); + $scope.megaMenuDataObject = menuStructureConvert(""); + } + } + }).error(function (response){ + $scope.megaMenuDataObject = menuStructureConvert(""); +// $scope.createErrorMenu(); + //$scope.loadMenufail=true; + $log.debug('REST API failed get_functional_menu...'); + }); + + } + + $scope.adjustHeader=function() { + $scope.showHeader = ($cookies.show_app_header == undefined ? true : $cookies.show_app_header); + + if($scope.showHeader == true) { + $scope.drawer_margin_top = 70; + $scope.drawer_custom_top = 54; + $scope.toggle_drawer_top = 55; + } + else { + + $scope.drawer_margin_top = 60; + $scope.drawer_custom_top = 0; + $scope.toggle_drawer_top = 10; + } + + } + + $scope.getMenu(); + $scope.adjustHeader(); + +/* **************************************************************************/ +/* Logic for the favorite menus is here */ + + $scope.loadFavorites = function () { + $log.debug('loadFavorites has happened.'); + if ($scope.favoritesMenuItems == '') { + $scope.generateFavoriteItems(); + $log.debug('loadFavorites is calling generateFavoriteItems()'); + } else { + $log.debug('loadFavorites is NOT calling generateFavoriteItems()'); + } + } + + $scope.goToUrl = function (item) { + $log.info("goToUrl called") + $log.info(item); + + var url = item.url; + var restrictedApp = item.restrictedApp; + $log.debug('Restricted app status is: ' + restrictedApp); + if (!url) { + $log.info('No url found for this application, doing nothing..'); + return; + } + if (restrictedApp) { + $window.open(url, '_blank'); + } else { + $window.open(url, '_self'); + } + + } + + $scope.submenuLevelAction = function(index, column) { + if ($scope.favoritesMenuItems == '') { + $scope.generateFavoriteItems(); + $log.debug('submenuLevelAction is calling generateFavoriteItems()'); + } + $log.debug('item hovered/clicked: ' + index + '; column = ' + column); + if (column == 2) { // 2 is Design + $scope.favoritesWindow = false; + $scope.showFavorites = false; + $scope.emptyFavorites = false; + } + if (index=='Favorites' && $scope.favoriteItemsCount != 0) { + $log.debug('Showing Favorites window'); + $scope.favoritesWindow = true; + $scope.showFavorites = true; + $scope.emptyFavorites = false; + } + if (index=='Favorites' && $scope.favoriteItemsCount == 0) { + $log.debug('Hiding Favorites window in favor of No Favorites Window'); + $scope.favoritesWindow = true; + $scope.showFavorites = false; + $scope.emptyFavorites = true; + } + if (column > 2) { + $scope.favoritesWindow = false; + $scope.showFavorites = false; + $scope.emptyFavorites = false; + } + }; + + $scope.hideFavoritesWindow = function() { + $log.debug('$scope.hideFavoritesWindow has been called'); + $scope.showFavorites = false; + $scope.emptyFavorites = false; + } + + $scope.isUrlFavorite = function (menuId) { +// $log.debug('array objects in menu favorites = ' + $scope.favoriteItemsCount + '; menuId=' + menuId); + var jsonMenu = JSON.stringify($scope.favoritesMenuItems); + var isMenuFavorite = jsonMenu.indexOf('menuId\":' + menuId); + if (isMenuFavorite==-1) { + return false; + } else { + return true; + } + + } + + $scope.generateFavoriteItems = function() { + $http({ + method: "GET", + url: 'get_favorites', +// TIMEOUT USED FOR LOCAL TESTING ONLY +// timeout: 100 + }).success(function (response) { + if (response == '101: Timeout') { + $log.error('Timeout attempting to get_favorites_menu'); + } else { + if(typeof response != 'undefined' && response.length!=0 && typeof response[0] != 'undefined' && typeof response[0].error!="undefined"){ + $log.error('REST API failed get_favorites' + response); + }else{ + $log.debug('get_favorites = ' + JSON.stringify(response)); + $scope.favoritesMenuItems = response; + $scope.favoriteItemsCount = Object.keys($scope.favoritesMenuItems).length; + $log.info('number of favorite menus: ' + $scope.favoriteItemsCount); + } + } + }).error(function (response){ + $log.error('REST API failed get_favorites' + response); +//createFavoriteErrorMenu() USED FOR LOCAL TESTING ONLY +// $scope.createFavoriteErrorMenu(); + }); + } + + $scope.createFavoriteErrorMenu=function() { + $scope.favoritesMenuItems = []; + $scope.favoriteItemsCount = Object.keys($scope.favoritesMenuItems).length; + $log.info('number of favorite menus: ' + $scope.favoriteItemsCount); + } + + /* end of Favorite Menu code */ + /* **************************************************************************/ + + + /* **************************************************************************/ + // THIS IS USED FOR LOCAL TESTING ONLY + /* **************************************************************************/ + $scope.createErrorMenu=function() { + $log.debug('Creating fake menu now...'); +// $scope.loadMenufail=true; + $scope.menuItems = [ + { + "menuId": 1, + "column": 2, + "text": "Design", + "parentMenuId": null, + "url": "" + }, + { + "menuId": 2, + "column": 3, + "text": "Infrastructure Ordering", + "parentMenuId": null, + "url": "" + }, + { + "menuId": 3, + "column": 4, + "text": "Service Creation", + "parentMenuId": null, + "url": "" + }, + { + "menuId": 4, + "column": 5, + "text": "Service Mgmt", + "parentMenuId": null, + "url": "" + }, + { + "menuId": 90, + "column": 1, + "text": "Google", + "parentMenuId": 1, + "url": "" + }, + { + "menuId": 91, + "column": 1, + "text": "Mike Little's Coffee Cup", + "parentMenuId": 2, + "url": "" + }, + { + "menuId": 92, + "column": 2, + "text": "Andy and his Astrophotgraphy", + "parentMenuId": 3, + "url": "" + }, + { + "menuId": 93, + "column": 1, + "text": "JSONLint", + "parentMenuId": 4, + "url": "" + }, + { + "menuId": 94, + "column": 2, + "text": "HROneStop", + "parentMenuId": 4, + "url": "" + }, + { + "menuId": 95, + "column": 2, + "text": "4th Level App4a R16", + "parentMenuId": 4, + "url": "" + }, + { + "menuId": 96, + "column": 3, + "text": "3rd Level App1c R200", + "parentMenuId": 4, + "url": "" + }, + { + "menuId": 97, + "column": 1, + "text": "3rd Level App4b R16", + "parentMenuId": 5, + "url": "" + }, + { + "menuId": 98, + "column": 2, + "text": "3rd Level App2b R16", + "parentMenuId": 5, + "url": "" + }, + { + "menuId": 99, + "column": 1, + "text": "Favorites", + "parentMenuId": null, + "url": "" + } + ]; + $scope.menuItems = unflatten( $scope.menuItems ); + //remove this + $scope.megaMenuDataObject = menuStructureConvert($scope.menuItems); + } + }] + } +}); + +app.filter("ellipsis", function(){ + return function(text, length){ + if (text) { + var ellipsis = text.length > length ? "..." : ""; + return text.slice(0, length) + ellipsis; + }; + return text; + } +}); + +function reloadPageOnce() { + if( window.localStorage ) + { + if( !localStorage.getItem('firstLoad') ) + { + localStorage['firstLoad'] = true; + window.location.reload(); + } + else + localStorage.removeItem('firstLoad'); + } +} +app.controller('loginSnippetCtrl', function ($scope,$http, $log,UserInfoService){ + /*Define fields*/ + $scope.userProfile={ + firstName:'', + lastName:'', + fullName:'', + email:'', + userid:'' + } + /*Put user info into fields*/ + $scope.inputUserInfo = function(userInfo){ + if (typeof(userInfo) != "undefined" && userInfo!=null && userInfo!=''){ + if (typeof(userInfo.USER_FIRST_NAME) != "undefined" && userInfo.USER_FIRST_NAME!=null && userInfo.USER_FIRST_NAME!='') + $scope.userProfile.firstName = userInfo.USER_FIRST_NAME; + if (typeof(userInfo.USER_LAST_NAME) != "undefined" && userInfo.USER_LAST_NAME!=null && userInfo.USER_LAST_NAME!='') + $scope.userProfile.lastName = userInfo.USER_LAST_NAME; + if (typeof(userInfo.USER_EMAIL) != "undefined" && userInfo.USER_EMAIL!=null && userInfo.USER_EMAIL!='') + $scope.userProfile.email = userInfo.USER_EMAIL; + if (typeof(userInfo.USER_ORGUSERID) != "undefined" && userInfo.USER_ORGUSERID!=null && userInfo.USER_ORGUSERID!='') + $scope.userProfile.userid = userInfo.USER_ORGUSERID; + } + } + /*getting user info from session*/ + $scope.getUserNameFromSession = function(){ + UserInfoService.getFunctionalMenuStaticDetailSession() + .then(function (response) { + $scope.userProfile.fullName = response.userName; + $scope.userProfile.userid = response.userid; + $scope.userProfile.email = response.email; + }); + } + /*getting user info from shared context*/ + $scope.getUserName=function() { + var promise = UserInfoService.getFunctionalMenuStaticDetailShareContext(); + promise.then( + function(res) { + if(res==null || res==''){ + $log.info('Getting User information from session'); + $scope.getUserNameFromSession(); + + }else{ + $log.info('Received User information from shared context',res); + var resData = res; + console.log(resData); + $scope.inputUserInfo(resData); + $scope.userProfile.fullName = $scope.userProfile.firstName+ ' '+ $scope.userProfile.lastName; + } + }, + function(err) { + console.log('error'); + } + ); + }; + /*call the get user info function*/ + try{ + $scope.getUserName(); + }catch(err){ + $log.info('Error while getting User information',err); + } +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/leftMenu.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/leftMenu.js new file mode 100644 index 0000000..737cb80 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/directives/leftMenu.js @@ -0,0 +1,203 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + +app.directive('qMenu', function () { + return { + restrict: 'A', //This menas that it will be used as an attribute and NOT as an element. I don't like creating custom HTML elements + replace: false, + templateUrl: "app/fusion/scripts/view-models/left_menu.html", + controller: ['$scope', '$filter','$http','$timeout','$cookies','LeftMenuService', function ($scope, $filter, $http,$timeout,$cookies,LeftMenuService) { + + $scope.leftChildData=[]; + $scope.leftParentData=[]; + $scope.leftMenuItems = []; + $scope.app_name = ""; + $scope.app_name_full; + LeftMenuService.getLeftMenu().then(function(response){ + var j = response; + try{ + if(j && j !== "null" && j!== "undefined"){ + $scope.leftParentData = JSON.parse(j.data); + $scope.leftChildData = JSON.parse(j.data2); + }else{ + throw "Get Left Menu respsone is not an object/is empty"; + } + try{ + var leftChildItemList = $scope.leftChildData; + var pageUrl = window.location.href.split('/')[window.location.href.split('/').length-1]; + var leftParentList =$scope.leftParentData; + for (var i = 0; i < leftParentList.length; i++) { + $scope.item = { + parentLabel : leftParentList[i].label, + parentAction : leftParentList[i].action, + parentImageSrc : leftParentList[i].imageSrc, + open:pageUrl==leftParentList[i].action?true:false, + childItemList : leftChildItemList[i] + } + $scope.leftMenuItems.push($scope.item); + }; + }catch(err){ + console.log("error happened while trying to set left menu structure"+err); + } + }catch (e) { + console.log("error happened while trying to get left menu items"+e); + reloadPageOnce(); + return; + } + },function(error){ + console.log("error happened while calling getLeftMenu"+error); + }); + + LeftMenuService.getAppName().then(function(response){ + var j = response; + try{ + if(j && j !== "null" && j!== "undefined"){ + console.log("app name is " + $scope.app_name); + $scope.app_name_full = j.data; + var processed_app_name = j.data; + var n = processed_app_name.length; + if (n > 15) { + n = 15; + } + $scope.app_name = processed_app_name.substr(0, n); + }else{ + throw "Get app_name respsone is not an object/is empty"; + } + }catch (e) { + console.log("error happened while trying to get app name "+e); + return; + } + },function(error){ + console.log("error happened while calling getAppName "+error); + }); + + $scope.adjustHeader=function() { + $scope.showHeader = ($cookies.show_app_header == undefined ? true : $cookies.show_app_header); + + if($scope.showHeader == true) { + $scope.drawer_margin_top = 50; + $scope.drawer_custom_top = 20; + $scope.toggle_drawer_top = 55; + } + else { + + $scope.drawer_margin_top = 0; + $scope.drawer_custom_top = 0; + $scope.toggle_drawer_top = 0; + } + + + }; + + $scope.adjustHLeftMenu = function (type){ + $scope.showHeader = ($cookies.show_app_header == undefined ? true : $cookies.show_app_header); + + if($scope.showHeader == true) { + $scope.drawer_margin_top = 60; + $scope.drawer_custom_top = 54; + $scope.toggle_drawer_top = 55; + } + else { + + $scope.drawer_margin_top = 50; + $scope.drawer_custom_top = 0; + $scope.toggle_drawer_top = 10; + } + if(type=='burgerIcon'){ + return { "top": $scope.toggle_drawer_top+"px"}; + }else if(type=='leftMenu'){ + return { "margin-top": $scope.drawer_margin_top+"px"}; + }else + return; + } + $scope.adjustHeader(); + $scope.drawerOpen = true; + + $scope.toggleDrawer = function() { + $scope.drawerOpen = !($scope.drawerOpen); + if ($scope.drawerOpen) { + // setCookie('drawerOpen','open',30); + $scope.arrowShow = true; + + + if (document.getElementById('fnMenueContent')!=null) + document.getElementById('fnMenueContent').style.marginLeft = "0px"; + + if (document.getElementById('rightContentAdmin')!=null) + document.getElementById('rightContentAdmin').style.marginLeft = "210px"; + + else if (document.getElementById('rightContentProfile')!=null) + document.getElementById('rightContentProfile').style.marginLeft = "210px"; + + + + } else { + + $scope.arrowShow = false; + + if (document.getElementById('fnMenueContent')!=null) + document.getElementById('fnMenueContent').style.marginLeft = "-150px"; + + if (document.getElementById('rightContentAdmin')!=null) { + document.getElementById('rightContentAdmin').style.marginLeft = "50px"; + + } + + else if (document.getElementById('rightContentProfile')!=null) + document.getElementById('rightContentProfile').style.marginLeft = "50px"; + + + + + } + }; + + $timeout(function() { + detectScrollEvent(); + }, 800); + }] + } + +}); +$(window).scroll(function() { + if ($('.att-drawer').is(':visible')) { + detectScrollEvent(); + } + +}); + +function detectScrollEvent() { + try{ + var footerOff = $('#footerContainer').offset().top; + var headOff = $('#headerContainer').offset().top; + var winHeight = $(window).height(); + if ((footerOff - headOff) <= winHeight) { + $('.att-drawer').css({ + "height" : footerOff - headOff - 55 + }); + } else { + $('.att-drawer').css({ + "height" : "94vh" + }); + } + }catch(err){ + console.log(err) + } +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/jquery.resize.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/jquery.resize.js new file mode 100644 index 0000000..1ebd6c9 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/jquery.resize.js @@ -0,0 +1,139 @@ +/*! + * jquery.resize.js 0.0.1 - https://github.com/yckart/jquery.resize.js + * Resize-event for DOM-Nodes + * + * @see http://workingdraft.de/113/ + * @see http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/ + * + * Copyright (c) 2013 Yannick Albert (http://yckart.com) + * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php). + * 2013/04/01 + */ + +(function(factory) { + if(typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else if(typeof exports === 'object') { + // Node/CommonJS style for Browserify + module.exports = factory; + } else { + // Browser globals + factory(jQuery); + } +}(function($) { + + function addFlowListener(element, type, fn) { + var flow = type == 'over'; + element.addEventListener('OverflowEvent' in window ? 'overflowchanged' : type + 'flow', function(e) { + if(e.type == (type + 'flow') || ((e.orient == 0 && e.horizontalOverflow == flow) || (e.orient == 1 && e.verticalOverflow == flow) || (e.orient == 2 && e.horizontalOverflow == flow && e.verticalOverflow == flow))) { + e.flow = type; + return fn.call(this, e); + } + }, false); + }; + + function fireEvent(element, type, data, options) { + var options = options || {}, + event = document.createEvent('Event'); + event.initEvent(type, 'bubbles' in options ? options.bubbles : true, 'cancelable' in options ? options.cancelable : true); + for(var z in data) event[z] = data[z]; + element.dispatchEvent(event); + }; + + $.event.special.resize = { + setup: function() { + var element = this; + var resize = 'onresize' in element; + if(!resize && !element._resizeSensor) { + var sensor = element._resizeSensor = document.createElement('div'); + sensor.className = 'resize-sensor'; + sensor.innerHTML = '
    '; + + var x = 0, + y = 0, + first = sensor.firstElementChild.firstChild, + last = sensor.lastElementChild.firstChild, + matchFlow = function(event) { + var change = false, + width = element.offsetWidth; + if(x != width) { + first.style.width = width - 1 + 'px'; + last.style.width = width + 1 + 'px'; + change = true; + x = width; + } + var height = element.offsetHeight; + if(y != height) { + first.style.height = height - 1 + 'px'; + last.style.height = height + 1 + 'px'; + change = true; + y = height; + } + if(change && event.currentTarget != element) fireEvent(element, 'resize'); + }; + + if(getComputedStyle(element).position == 'static') { + element.style.position = 'relative'; + element._resizeSensor._resetPosition = true; + } + addFlowListener(sensor, 'over', matchFlow); + addFlowListener(sensor, 'under', matchFlow); + addFlowListener(sensor.firstElementChild, 'over', matchFlow); + addFlowListener(sensor.lastElementChild, 'under', matchFlow); + element.appendChild(sensor); + matchFlow({}); + } + var events = element._flowEvents || (element._flowEvents = []); + if(events.indexOf(handler) == -1) events.push(handler); + if(!resize) element.addEventListener('resize', handler, false); + element.onresize = function(e) { + events.forEach(function(fn) { + fn.call(element, e); + }); + }; + }, + + teardown: function() { + var element = this; + var index = element._flowEvents.indexOf(handler); + if(index > -1) element._flowEvents.splice(index, 1); + if(!element._flowEvents.length) { + var sensor = element._resizeSensor; + if(sensor) { + element.removeChild(sensor); + if(sensor._resetPosition) element.style.position = 'static'; + delete element._resizeSensor; + } + if('onresize' in element) element.onresize = null; + delete element._flowEvents; + } + element.removeEventListener('resize', handler); + } + }; + + $.fn.extend({ + resize: function(fn) { + return fn ? this.bind("resize", fn) : this.trigger("resize"); + }, + + unresize: function(fn) { + return this.unbind("resize", fn); + } + }); + + + function handler(event) { + var orgEvent = event || window.event, + args = [].slice.call(arguments, 1); + + event = $.event.fix(orgEvent); + event.type = "resize"; + + // Add event to the front of the arguments + args.unshift(event); + + return($.event.dispatch || $.event.handle).apply(this, args); + } + +})); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/debug.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/debug.js new file mode 100644 index 0000000..eff36a2 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/debug.js @@ -0,0 +1,329 @@ +/** + * debugData + * + * Pass me a data structure {} and I'll output all the key/value pairs - recursively + * + * @example var HTML = debugData( oElem.style, "Element.style", { keys: "top,left,width,height", recurse: true, sort: true, display: true, returnHTML: true }); + * + * @param Object o_Data A JSON-style data structure + * @param String s_Title Title for dialog (optional) + * @param Hash options Pass additional options in a hash + */ +function debugData (o_Data, s_Title, options) { + options = options || {}; + var + str=(s_Title||s_Title==='' ? s_Title : 'DATA') + , dType=$.type(o_Data) + // maintain backward compatibility with OLD 'recurseData' param + , recurse=($.type(options)==='boolean' ? options : options.recurse !==false) + , keys=(options.keys?','+options.keys+',':false) + , display=options.display !==false + , html=options.returnHTML !==false + , sort=!!options.sort + , prefix=options.indent ? ' ' : '' + , D=[], i=0 // Array to hold data, i=counter + , hasSubKeys = false + , k, t, skip, x, type // loop vars + ; + if (dType!=='object' && dType!=='array') { + if (options.display) alert( (s_Title || 'debugData') +': '+ o_Data ); + return o_Data; + } + if (dType==='object' && $.isPlainObject(o_Data)) + dType='hash'; + + if (o_Data.jquery) { + str=s_Title+'jQuery Collection ('+ o_Data.length +')\n context="'+ o_Data.context +'"'; + } + else if (o_Data.nodeName) { + str=s_Title+o_Data.tagName; + var id = o_Data.id, cls=o_Data.className, src=o_Data.src, hrf=o_Data.href; + if (id) str+='\n id="'+ id+'"'; + if (cls) str+='\n class="'+ cls+'"'; + if (src) str+='\n src="'+ src+'"'; + if (hrf) str+='\n href="'+ hrf+'"'; + } + else { + parse(o_Data,prefix,dType); // recursive parsing + if (sort && !hasSubKeys) D.sort(); // sort by keyName - but NOT if has subKeys! + if (str) str += '\n***'+ '****************************'.substr(0,str.length) +'\n'; + str += D.join('\n'); // add line-breaks + } + + if (display) alert(str); // display data + if (html) str=str.replace(/\n/g, '
    ').replace(/ /g, '  '); // format as HTML + return str; + + function parse ( data, prefix, parentType ) { + var first = true; + try { + $.each( data, function (key, val) { + skip = (keys && keys.indexOf(','+key+',') === -1); + type = $.type(val); + if (type==='object' && $.isPlainObject(val)) + type = 'hash'; + k = prefix + (first ? ' ' : ', '); + first = false; + + if (parentType!=='array') // no key-names for array items + k += key+': '; // NOT an array + + if (type==="date" || type==="regexp") { + val = val.toString(); + type = "string"; + } + if (type==="string") { // STRING + if (!skip) D[i++] = k +'"'+ val +'"'; + } + // NULL, UNDEFINED, NUMBER or BOOLEAN + else if (/^(null|undefined|number|boolean)/.test(type)) { + if (!skip) D[i++] = k + val; + } + else if (type==="function") { // FUNCTION + if (!skip) D[i++] = k +'function()'; + } + else if (type==="array") { // ARRAY + if (!skip) { + D[i++] = k +'['; + parse( val, prefix+' ',type); // RECURSE + D[i++] = prefix +' ]'; + } + } + else if (val.jquery) { // JQUERY OBJECT + if (!skip) D[i++] = k +'jQuery ('+ val.length +') context="'+ val.context +'"'; + } + else if (val.nodeName) { // DOM ELEMENT + var id = val.id, cls=val.className, src=val.src, hrf=val.href; + if (skip) D[i++] = k +' '+ + id ? 'id="'+ id+'"' : + src ? 'src="'+ src+'"' : + hrf ? 'href="'+ hrf+'"' : + cls ? 'class="'+cls+'"' : + ''; + } + else if (type==="hash") { // JSON + if (!recurse || $.isEmptyObject(val)) { // show an empty hash + if (!skip) D[i++] = k +'{ }'; + } + else { // recurse into JSON hash - indent output + D[i++] = k +'{'; + parse( val, prefix+' ',type); // RECURSE + D[i++] = prefix +' }'; + } + } + else { // OBJECT + if (!skip) D[i++] = k +'OBJECT'; // NOT a hash + } + }); + } catch (e) {} + } +}; + +function debugStackTrace (s_Title, options) { + var + callstack = [] + , isCallstackPopulated = false + ; + try { + i.dont.exist += 0; // doesn't exist- that's the point + } catch(e) { + if (e.stack) { // Firefox + var lines = e.stack.split('\n'); + for (var i=0, len=lines.length; i') + .html( content.replace(/\n/g, '
    ').replace(/ /g, '  ') ) // format as HTML + .css( options.css ) + ; +}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery-latest.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery-latest.js new file mode 100644 index 0000000..1c998ba --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery-latest.js @@ -0,0 +1,9555 @@ +/*! + * jQuery JavaScript Library v1.9.0 + * http://jquery.com/ + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * + * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2013-1-14 + */ +(function( window, undefined ) { +"use strict"; +var + // A central reference to the root jQuery(document) + rootjQuery, + + // The deferred used on DOM ready + readyList, + + // Use the correct document accordingly with window argument (sandbox) + document = window.document, + location = window.location, + + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$, + + // [[Class]] -> type pairs + class2type = {}, + + // List of deleted data cache ids, so we can reuse them + core_deletedIds = [], + + core_version = "1.9.0", + + // Save a reference to some core methods + core_concat = core_deletedIds.concat, + core_push = core_deletedIds.push, + core_slice = core_deletedIds.slice, + core_indexOf = core_deletedIds.indexOf, + core_toString = class2type.toString, + core_hasOwn = class2type.hasOwnProperty, + core_trim = core_version.trim, + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context, rootjQuery ); + }, + + // Used for matching numbers + core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, + + // Used for splitting on whitespace + core_rnotwhite = /\S+/g, + + // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/, + + // Match a standalone tag + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, + + // JSON RegExp + rvalidchars = /^[\],:{}\s]*$/, + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, + rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, + rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([\da-z])/gi, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }, + + // The ready event handler and self cleanup method + DOMContentLoaded = function() { + if ( document.addEventListener ) { + document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + jQuery.ready(); + } else if ( document.readyState === "complete" ) { + // we're here because readyState === "complete" in oldIE + // which is good enough for us to call the dom ready! + document.detachEvent( "onreadystatechange", DOMContentLoaded ); + jQuery.ready(); + } + }; + +jQuery.fn = jQuery.prototype = { + // The current version of jQuery being used + jquery: core_version, + + constructor: jQuery, + init: function( selector, context, rootjQuery ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + + // scripts is true for back-compat + jQuery.merge( this, jQuery.parseHTML( + match[1], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }, + + // Start with an empty selector + selector: "", + + // The default length of a jQuery object is 0 + length: 0, + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + toArray: function() { + return core_slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + ret.context = this.context; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + ready: function( fn ) { + // Add the callback + jQuery.ready.promise().done( fn ); + + return this; + }, + + slice: function() { + return this.pushStack( core_slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: core_push, + sort: [].sort, + splice: [].splice +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + noConflict: function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger("ready").off("ready"); + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + isWindow: function( obj ) { + return obj != null && obj == obj.window; + }, + + isNumeric: function( obj ) { + return !isNaN( parseFloat(obj) ) && isFinite( obj ); + }, + + type: function( obj ) { + if ( obj == null ) { + return String( obj ); + } + return typeof obj === "object" || typeof obj === "function" ? + class2type[ core_toString.call(obj) ] || "object" : + typeof obj; + }, + + isPlainObject: function( obj ) { + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !core_hasOwn.call(obj, "constructor") && + !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + + var key; + for ( key in obj ) {} + + return key === undefined || core_hasOwn.call( obj, key ); + }, + + isEmptyObject: function( obj ) { + var name; + for ( name in obj ) { + return false; + } + return true; + }, + + error: function( msg ) { + throw new Error( msg ); + }, + + // data: string of html + // context (optional): If specified, the fragment will be created in this context, defaults to document + // keepScripts (optional): If true, will include scripts passed in the html string + parseHTML: function( data, context, keepScripts ) { + if ( !data || typeof data !== "string" ) { + return null; + } + if ( typeof context === "boolean" ) { + keepScripts = context; + context = false; + } + context = context || document; + + var parsed = rsingleTag.exec( data ), + scripts = !keepScripts && []; + + // Single tag + if ( parsed ) { + return [ context.createElement( parsed[1] ) ]; + } + + parsed = jQuery.buildFragment( [ data ], context, scripts ); + if ( scripts ) { + jQuery( scripts ).remove(); + } + return jQuery.merge( [], parsed.childNodes ); + }, + + parseJSON: function( data ) { + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + return window.JSON.parse( data ); + } + + if ( data === null ) { + return data; + } + + if ( typeof data === "string" ) { + + // Make sure leading/trailing whitespace is removed (IE can't handle it) + data = jQuery.trim( data ); + + if ( data ) { + // Make sure the incoming data is actual JSON + // Logic borrowed from http://json.org/json2.js + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) + .replace( rvalidtokens, "]" ) + .replace( rvalidbraces, "")) ) { + + return ( new Function( "return " + data ) )(); + } + } + } + + jQuery.error( "Invalid JSON: " + data ); + }, + + // Cross-browser xml parsing + parseXML: function( data ) { + var xml, tmp; + if ( !data || typeof data !== "string" ) { + return null; + } + try { + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + } catch( e ) { + xml = undefined; + } + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; + }, + + noop: function() {}, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && jQuery.trim( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + // args is for internal usage only + each: function( obj, callback, args ) { + var value, + i = 0, + length = obj.length, + isArray = isArraylike( obj ); + + if ( args ) { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } + } + + return obj; + }, + + // Use native String.trim function wherever possible + trim: core_trim && !core_trim.call("\uFEFF\xA0") ? + function( text ) { + return text == null ? + "" : + core_trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArraylike( Object(arr) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + core_push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + var len; + + if ( arr ) { + if ( core_indexOf ) { + return core_indexOf.call( arr, elem, i ); + } + + len = arr.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in arr && arr[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var l = second.length, + i = first.length, + j = 0; + + if ( typeof l === "number" ) { + for ( ; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, inv ) { + var retVal, + ret = [], + i = 0, + length = elems.length; + inv = !!inv; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { + ret.push( elems[ i ] ); + } + } + + return ret; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, + i = 0, + length = elems.length, + isArray = isArraylike( elems ), + ret = []; + + // Go through the array, translating each of the items to their + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + } + + // Flatten any nested arrays + return core_concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = core_slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + // Multifunctional method to get and set values of a collection + // The value/s can optionally be executed if it's a function + access: function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + length = elems.length, + bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === "object" ) { + chainable = true; + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !jQuery.isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < length; i++ ) { + fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); + } + } + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + length ? fn( elems[0], key ) : emptyGet; + }, + + now: function() { + return ( new Date() ).getTime(); + } +}); + +jQuery.ready.promise = function( obj ) { + if ( !readyList ) { + + readyList = jQuery.Deferred(); + + // Catch cases where $(document).ready() is called after the browser event has already occurred. + // we once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + setTimeout( jQuery.ready ); + + // Standards-based browsers support DOMContentLoaded + } else if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", jQuery.ready, false ); + + // If IE event model is used + } else { + // Ensure firing before onload, maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", DOMContentLoaded ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", jQuery.ready ); + + // If IE and not a frame + // continually check to see if the document is ready + var top = false; + + try { + top = window.frameElement == null && document.documentElement; + } catch(e) {} + + if ( top && top.doScroll ) { + (function doScrollCheck() { + if ( !jQuery.isReady ) { + + try { + // Use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + top.doScroll("left"); + } catch(e) { + return setTimeout( doScrollCheck, 50 ); + } + + // and execute any waiting functions + jQuery.ready(); + } + })(); + } + } + } + return readyList.promise( obj ); +}; + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +function isArraylike( obj ) { + var length = obj.length, + type = jQuery.type( obj ); + + if ( jQuery.isWindow( obj ) ) { + return false; + } + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === "array" || type !== "function" && + ( length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj ); +} + +// All jQuery objects should point back to these +rootjQuery = jQuery(document); +// String to Object options format cache +var optionsCache = {}; + +// Convert String-formatted options into Object-formatted ones and store in cache +function createOptions( options ) { + var object = optionsCache[ options ] = {}; + jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { + object[ flag ] = true; + }); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + ( optionsCache[ options ] || createOptions( options ) ) : + jQuery.extend( {}, options ); + + var // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list was already fired + fired, + // Flag to know if list is currently firing + firing, + // First callback to fire (used internally by add and fireWith) + firingStart, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = !options.once && [], + // Fire callbacks + fire = function( data ) { + memory = options.memory && data; + fired = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + firing = true; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { + memory = false; // To prevent further calls using add + break; + } + } + firing = false; + if ( list ) { + if ( stack ) { + if ( stack.length ) { + fire( stack.shift() ); + } + } else if ( memory ) { + list = []; + } else { + self.disable(); + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + // First, we save the current length + var start = list.length; + (function add( args ) { + jQuery.each( args, function( _, arg ) { + var type = jQuery.type( arg ); + if ( type === "function" ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && type !== "string" ) { + // Inspect recursively + add( arg ); + } + }); + })( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away + } else if ( memory ) { + firingStart = start; + fire( memory ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + jQuery.each( arguments, function( _, arg ) { + var index; + while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + // Handle firing indexes + if ( firing ) { + if ( index <= firingLength ) { + firingLength--; + } + if ( index <= firingIndex ) { + firingIndex--; + } + } + } + }); + } + return this; + }, + // Control if a given callback is in the list + has: function( fn ) { + return jQuery.inArray( fn, list ) > -1; + }, + // Remove all callbacks from the list + empty: function() { + list = []; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + if ( list && ( !fired || stack ) ) { + if ( firing ) { + stack.push( args ); + } else { + fire( args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; +jQuery.extend({ + + Deferred: function( func ) { + var tuples = [ + // action, add listener, listener list, final state + [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], + [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], + [ "notify", "progress", jQuery.Callbacks("memory") ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + return jQuery.Deferred(function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + var action = tuple[ 0 ], + fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; + // deferred[ done | fail | progress ] for forwarding actions to newDefer + deferred[ tuple[1] ](function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); + } + }); + }); + fns = null; + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Keep pipe for back-compat + promise.pipe = promise.then; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 3 ]; + + // promise[ done | fail | progress ] = list.add + promise[ tuple[1] ] = list.add; + + // Handle state + if ( stateString ) { + list.add(function() { + // state = [ resolved | rejected ] + state = stateString; + + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + } + + // deferred[ resolve | reject | notify ] + deferred[ tuple[0] ] = function() { + deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); + return this; + }; + deferred[ tuple[0] + "With" ] = list.fireWith; + }); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0, + resolveValues = core_slice.call( arguments ), + length = resolveValues.length, + + // the count of uncompleted subordinates + remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, + + // the master Deferred. If resolveValues consist of only a single Deferred, just use that. + deferred = remaining === 1 ? subordinate : jQuery.Deferred(), + + // Update function for both resolve and progress values + updateFunc = function( i, contexts, values ) { + return function( value ) { + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; + if( values === progressValues ) { + deferred.notifyWith( contexts, values ); + } else if ( !( --remaining ) ) { + deferred.resolveWith( contexts, values ); + } + }; + }, + + progressValues, progressContexts, resolveContexts; + + // add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { + resolveValues[ i ].promise() + .done( updateFunc( i, resolveContexts, resolveValues ) ) + .fail( deferred.reject ) + .progress( updateFunc( i, progressContexts, progressValues ) ); + } else { + --remaining; + } + } + } + + // if we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); + } + + return deferred.promise(); + } +}); +jQuery.support = (function() { + + var support, all, a, select, opt, input, fragment, eventName, isSupported, i, + div = document.createElement("div"); + + // Setup + div.setAttribute( "className", "t" ); + div.innerHTML = "
    a"; + + // Support tests won't run in some limited or non-browser environments + all = div.getElementsByTagName("*"); + a = div.getElementsByTagName("a")[ 0 ]; + if ( !all || !a || !all.length ) { + return {}; + } + + // First batch of tests + select = document.createElement("select"); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName("input")[ 0 ]; + + a.style.cssText = "top:1px;float:left;opacity:.5"; + support = { + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + getSetAttribute: div.className !== "t", + + // IE strips leading whitespace when .innerHTML is used + leadingWhitespace: div.firstChild.nodeType === 3, + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + tbody: !div.getElementsByTagName("tbody").length, + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + htmlSerialize: !!div.getElementsByTagName("link").length, + + // Get the style information from getAttribute + // (IE uses .cssText instead) + style: /top/.test( a.getAttribute("style") ), + + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + hrefNormalized: a.getAttribute("href") === "/a", + + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + opacity: /^0.5/.test( a.style.opacity ), + + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + cssFloat: !!a.style.cssFloat, + + // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) + checkOn: !!input.value, + + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + optSelected: opt.selected, + + // Tests for enctype support on a form (#6743) + enctype: !!document.createElement("form").enctype, + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", + + // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode + boxModel: document.compatMode === "CSS1Compat", + + // Will be defined later + deleteExpando: true, + noCloneEvent: true, + inlineBlockNeedsLayout: false, + shrinkWrapBlocks: false, + reliableMarginRight: true, + boxSizingReliable: true, + pixelPosition: false + }; + + // Make sure checked status is properly cloned + input.checked = true; + support.noCloneChecked = input.cloneNode( true ).checked; + + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as disabled) + select.disabled = true; + support.optDisabled = !opt.disabled; + + // Support: IE<9 + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + + // Check if we can trust getAttribute("value") + input = document.createElement("input"); + input.setAttribute( "value", "" ); + support.input = input.getAttribute( "value" ) === ""; + + // Check if an input maintains its value after becoming a radio + input.value = "t"; + input.setAttribute( "type", "radio" ); + support.radioValue = input.value === "t"; + + // #11217 - WebKit loses check when the name is after the checked attribute + input.setAttribute( "checked", "t" ); + input.setAttribute( "name", "t" ); + + fragment = document.createDocumentFragment(); + fragment.appendChild( input ); + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; + + // WebKit doesn't clone checked state correctly in fragments + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE<9 + // Opera does not clone events (and typeof div.attachEvent === undefined). + // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() + if ( div.attachEvent ) { + div.attachEvent( "onclick", function() { + support.noCloneEvent = false; + }); + + div.cloneNode( true ).click(); + } + + // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event) + // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php + for ( i in { submit: true, change: true, focusin: true }) { + div.setAttribute( eventName = "on" + i, "t" ); + + support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false; + } + + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; + + // Run tests that need a body at doc ready + jQuery(function() { + var container, marginDiv, tds, + divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", + body = document.getElementsByTagName("body")[0]; + + if ( !body ) { + // Return for frameset docs that don't have a body + return; + } + + container = document.createElement("div"); + container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; + + body.appendChild( container ).appendChild( div ); + + // Support: IE8 + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + div.innerHTML = "
    t
    "; + tds = div.getElementsByTagName("td"); + tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; + isSupported = ( tds[ 0 ].offsetHeight === 0 ); + + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; + + // Support: IE8 + // Check if empty table cells still have offsetWidth/Height + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); + + // Check box-sizing and margin behavior + div.innerHTML = ""; + div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; + support.boxSizing = ( div.offsetWidth === 4 ); + support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); + + // Use window.getComputedStyle because jsdom on node.js will break without it. + if ( window.getComputedStyle ) { + support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; + support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; + + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. (#3333) + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + marginDiv = div.appendChild( document.createElement("div") ); + marginDiv.style.cssText = div.style.cssText = divReset; + marginDiv.style.marginRight = marginDiv.style.width = "0"; + div.style.width = "1px"; + + support.reliableMarginRight = + !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); + } + + if ( typeof div.style.zoom !== "undefined" ) { + // Support: IE<8 + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + div.innerHTML = ""; + div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; + support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); + + // Support: IE6 + // Check if elements with layout shrink-wrap their children + div.style.display = "block"; + div.innerHTML = "
    "; + div.firstChild.style.width = "5px"; + support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); + + // Prevent IE 6 from affecting layout for positioned elements #11048 + // Prevent IE from shrinking the body in IE 7 mode #12869 + body.style.zoom = 1; + } + + body.removeChild( container ); + + // Null elements to avoid leaks in IE + container = div = tds = marginDiv = null; + }); + + // Null elements to avoid leaks in IE + all = select = fragment = opt = a = input = null; + + return support; +})(); + +var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, + rmultiDash = /([A-Z])/g; + +function internalData( elem, name, data, pvt /* Internal Use Only */ ){ + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, ret, + internalKey = jQuery.expando, + getByName = typeof name === "string", + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++; + } else { + id = internalKey; + } + } + + if ( !cache[ id ] ) { + cache[ id ] = {}; + + // Avoids exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + if ( !isNode ) { + cache[ id ].toJSON = jQuery.noop; + } + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } + + thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } + + thisCache = thisCache.data; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( getByName ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; +} + +function internalRemoveData( elem, name, pvt /* For internal use only */ ){ + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, i, l, + + isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + id = isNode ? elem[ jQuery.expando ] : jQuery.expando; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + + thisCache = pvt ? cache[ id ] : cache[ id ].data; + + if ( thisCache ) { + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split(" "); + } + } + } else { + // If "name" is an array of keys... + // When data is initially created, via ("key", "val") signature, + // keys will be converted to camelCase. + // Since there is no way to tell _how_ a key was added, remove + // both plain key and camelCase key. #12786 + // This will only penalize the array argument path. + name = name.concat( jQuery.map( name, jQuery.camelCase ) ); + } + + for ( i = 0, l = name.length; i < l; i++ ) { + delete thisCache[ name[i] ]; + } + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject( cache[ id ] ) ) { + return; + } + } + + // Destroy the cache + if ( isNode ) { + jQuery.cleanData( [ elem ], true ); + + // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) + } else if ( jQuery.support.deleteExpando || cache != cache.window ) { + delete cache[ id ]; + + // When all else fails, null + } else { + cache[ id ] = null; + } +} + +jQuery.extend({ + cache: {}, + + // Unique for each copy of jQuery on the page + // Non-digits removed to match rinlinejQuery + expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), + + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "embed": true, + // Ban all objects except for Flash (which handle expandos) + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", + "applet": true + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data ) { + return internalData( elem, name, data, false ); + }, + + removeData: function( elem, name ) { + return internalRemoveData( elem, name, false ); + }, + + // For internal use only. + _data: function( elem, name, data ) { + return internalData( elem, name, data, true ); + }, + + _removeData: function( elem, name ) { + return internalRemoveData( elem, name, true ); + }, + + // A method for determining if a DOM node can handle the data expando + acceptData: function( elem ) { + var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; + + // nodes accept data unless otherwise specified; rejection can be conditional + return !noData || noData !== true && elem.getAttribute("classid") === noData; + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var attrs, name, + elem = this[0], + i = 0, + data = null; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = jQuery.data( elem ); + + if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { + attrs = elem.attributes; + for ( ; i < attrs.length; i++ ) { + name = attrs[i].name; + + if ( !name.indexOf( "data-" ) ) { + name = jQuery.camelCase( name.substring(5) ); + + dataAttr( elem, name, data[ name ] ); + } + } + jQuery._data( elem, "parsedAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + return jQuery.access( this, function( value ) { + + if ( value === undefined ) { + // Try to fetch any internally stored data first + return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null; + } + + this.each(function() { + jQuery.data( this, key, value ); + }); + }, null, value, arguments.length > 1, null, true ); + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + +// checks a cache object for emptiness +function isEmptyDataObject( obj ) { + var name; + for ( name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } + + return true; +} +jQuery.extend({ + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || jQuery.isArray(data) ) { + queue = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + hooks.cur = fn; + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // not intended for public consumption - generates a queueHooks object, or returns the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return jQuery._data( elem, key ) || jQuery._data( elem, key, { + empty: jQuery.Callbacks("once memory").add(function() { + jQuery._removeData( elem, type + "queue" ); + jQuery._removeData( elem, key ); + }) + }); + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } + + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); + + // ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = setTimeout( next, time ); + hooks.stop = function() { + clearTimeout( timeout ); + }; + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while( i-- ) { + tmp = jQuery._data( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +}); +var nodeHook, boolHook, + rclass = /[\t\r\n]/g, + rreturn = /\r/g, + rfocusable = /^(?:input|select|textarea|button|object)$/i, + rclickable = /^(?:a|area)$/i, + rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i, + ruseDefault = /^(?:checked|selected)$/i, + getSetAttribute = jQuery.support.getSetAttribute, + getSetInput = jQuery.support.input; + +jQuery.fn.extend({ + attr: function( name, value ) { + return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each(function() { + jQuery.removeAttr( this, name ); + }); + }, + + prop: function( name, value ) { + return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} + }); + }, + + addClass: function( value ) { + var classes, elem, cur, clazz, j, + i = 0, + len = this.length, + proceed = typeof value === "string" && value; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call( this, j, this.className ) ); + }); + } + + if ( proceed ) { + // The disjunction here is for better compressibility (see removeClass) + classes = ( value || "" ).match( core_rnotwhite ) || []; + + for ( ; i < len; i++ ) { + elem = this[ i ]; + cur = elem.nodeType === 1 && ( elem.className ? + ( " " + elem.className + " " ).replace( rclass, " " ) : + " " + ); + + if ( cur ) { + j = 0; + while ( (clazz = classes[j++]) ) { + if ( cur.indexOf( " " + clazz + " " ) < 0 ) { + cur += clazz + " "; + } + } + elem.className = jQuery.trim( cur ); + + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classes, elem, cur, clazz, j, + i = 0, + len = this.length, + proceed = arguments.length === 0 || typeof value === "string" && value; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call( this, j, this.className ) ); + }); + } + if ( proceed ) { + classes = ( value || "" ).match( core_rnotwhite ) || []; + + for ( ; i < len; i++ ) { + elem = this[ i ]; + // This expression is here for better compressibility (see addClass) + cur = elem.nodeType === 1 && ( elem.className ? + ( " " + elem.className + " " ).replace( rclass, " " ) : + "" + ); + + if ( cur ) { + j = 0; + while ( (clazz = classes[j++]) ) { + // Remove *all* instances + while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { + cur = cur.replace( " " + clazz + " ", " " ); + } + } + elem.className = value ? jQuery.trim( cur ) : ""; + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value, + isBool = typeof stateVal === "boolean"; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + }); + } + + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, + i = 0, + self = jQuery( this ), + state = stateVal, + classNames = value.match( core_rnotwhite ) || []; + + while ( (className = classNames[ i++ ]) ) { + // check each className given, space separated list + state = isBool ? state : !self.hasClass( className ); + self[ state ? "addClass" : "removeClass" ]( className ); + } + + // Toggle whole class name + } else if ( type === "undefined" || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery._data( this, "__className__", this.className ); + } + + // If the element has a class name or if we're passed "false", + // then remove the whole classname (if there was one, the above saved it). + // Otherwise bring back whatever was previously saved (if anything), + // falling back to the empty string if nothing was stored. + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; + } + }); + }, + + hasClass: function( selector ) { + var className = " " + selector + " ", + i = 0, + l = this.length; + for ( ; i < l; i++ ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { + return true; + } + } + + return false; + }, + + val: function( value ) { + var hooks, ret, isFunction, + elem = this[0]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; + } + + ret = elem.value; + + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each(function( i ) { + var val, + self = jQuery(this); + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, self.val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { + val += ""; + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map(val, function ( value ) { + return value == null ? "" : value + ""; + }); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + }); + } +}); + +jQuery.extend({ + valHooks: { + option: { + get: function( elem ) { + // attributes.value is undefined in Blackberry 4.7 but + // uses .value. See #6932 + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; + } + }, + select: { + get: function( elem ) { + var value, option, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one" || index < 0, + values = one ? null : [], + max = one ? index + 1 : options.length, + i = index < 0 ? + max : + one ? index : 0; + + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; + + // oldIE doesn't update selected after form reset (#2551) + if ( ( option.selected || i === index ) && + // Don't return options that are disabled or in a disabled optgroup + ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && + ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + }, + + set: function( elem, value ) { + var values = jQuery.makeArray( value ); + + jQuery(elem).find("option").each(function() { + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; + }); + + if ( !values.length ) { + elem.selectedIndex = -1; + } + return values; + } + } + }, + + attr: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + // All attributes are lowercase + // Grab necessary hook if one is defined + if ( notxml ) { + name = name.toLowerCase(); + hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); + } + + if ( value !== undefined ) { + + if ( value === null ) { + jQuery.removeAttr( elem, name ); + + } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + elem.setAttribute( name, value + "" ); + return value; + } + + } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + + // In IE9+, Flash objects don't have .getAttribute (#12945) + // Support: IE9+ + if ( typeof elem.getAttribute !== "undefined" ) { + ret = elem.getAttribute( name ); + } + + // Non-existent attributes return null, we normalize to undefined + return ret == null ? + undefined : + ret; + } + }, + + removeAttr: function( elem, value ) { + var name, propName, + i = 0, + attrNames = value && value.match( core_rnotwhite ); + + if ( attrNames && elem.nodeType === 1 ) { + while ( (name = attrNames[i++]) ) { + propName = jQuery.propFix[ name ] || name; + + // Boolean attributes get special treatment (#10870) + if ( rboolean.test( name ) ) { + // Set corresponding property to false for boolean attributes + // Also clear defaultChecked/defaultSelected (if appropriate) for IE<8 + if ( !getSetAttribute && ruseDefault.test( name ) ) { + elem[ jQuery.camelCase( "default-" + name ) ] = + elem[ propName ] = false; + } else { + elem[ propName ] = false; + } + + // See #9699 for explanation of this approach (setting first, then removal) + } else { + jQuery.attr( elem, name, "" ); + } + + elem.removeAttribute( getSetAttribute ? name : propName ); + } + } + }, + + attrHooks: { + type: { + set: function( elem, value ) { + if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to default in case type is set after value during creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + } + }, + + propFix: { + tabindex: "tabIndex", + readonly: "readOnly", + "for": "htmlFor", + "class": "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable" + }, + + prop: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + return ( elem[ name ] = value ); + } + + } else { + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + return elem[ name ]; + } + } + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + var attributeNode = elem.getAttributeNode("tabindex"); + + return attributeNode && attributeNode.specified ? + parseInt( attributeNode.value, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + undefined; + } + } + } +}); + +// Hook for boolean attributes +boolHook = { + get: function( elem, name ) { + var + // Use .prop to determine if this attribute is understood as boolean + prop = jQuery.prop( elem, name ), + + // Fetch it accordingly + attr = typeof prop === "boolean" && elem.getAttribute( name ), + detail = typeof prop === "boolean" ? + + getSetInput && getSetAttribute ? + attr != null : + // oldIE fabricates an empty string for missing boolean attributes + // and conflates checked/selected into attroperties + ruseDefault.test( name ) ? + elem[ jQuery.camelCase( "default-" + name ) ] : + !!attr : + + // fetch an attribute node for properties not recognized as boolean + elem.getAttributeNode( name ); + + return detail && detail.value !== false ? + name.toLowerCase() : + undefined; + }, + set: function( elem, value, name ) { + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { + // IE<8 needs the *property* name + elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); + + // Use defaultChecked and defaultSelected for oldIE + } else { + elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; + } + + return name; + } +}; + +// fix oldIE value attroperty +if ( !getSetInput || !getSetAttribute ) { + jQuery.attrHooks.value = { + get: function( elem, name ) { + var ret = elem.getAttributeNode( name ); + return jQuery.nodeName( elem, "input" ) ? + + // Ignore the value *property* by using defaultValue + elem.defaultValue : + + ret && ret.specified ? ret.value : undefined; + }, + set: function( elem, value, name ) { + if ( jQuery.nodeName( elem, "input" ) ) { + // Does not return so that setAttribute is also used + elem.defaultValue = value; + } else { + // Use nodeHook if defined (#1954); otherwise setAttribute is fine + return nodeHook && nodeHook.set( elem, value, name ); + } + } + }; +} + +// IE6/7 do not support getting/setting some attributes with get/setAttribute +if ( !getSetAttribute ) { + + // Use this for any attribute in IE6/7 + // This fixes almost every IE6/7 issue + nodeHook = jQuery.valHooks.button = { + get: function( elem, name ) { + var ret = elem.getAttributeNode( name ); + return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ? + ret.value : + undefined; + }, + set: function( elem, value, name ) { + // Set the existing or create a new attribute node + var ret = elem.getAttributeNode( name ); + if ( !ret ) { + elem.setAttributeNode( + (ret = elem.ownerDocument.createAttribute( name )) + ); + } + + ret.value = value += ""; + + // Break association with cloned elements by also using setAttribute (#9646) + return name === "value" || value === elem.getAttribute( name ) ? + value : + undefined; + } + }; + + // Set contenteditable to false on removals(#10429) + // Setting to empty string throws an error as an invalid value + jQuery.attrHooks.contenteditable = { + get: nodeHook.get, + set: function( elem, value, name ) { + nodeHook.set( elem, value === "" ? false : value, name ); + } + }; + + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } + } + }); + }); +} + + +// Some attributes require a special call on IE +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !jQuery.support.hrefNormalized ) { + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + get: function( elem ) { + var ret = elem.getAttribute( name, 2 ); + return ret == null ? undefined : ret; + } + }); + }); + + // href/src property should get the full normalized URL (#10299/#12915) + jQuery.each([ "href", "src" ], function( i, name ) { + jQuery.propHooks[ name ] = { + get: function( elem ) { + return elem.getAttribute( name, 4 ); + } + }; + }); +} + +if ( !jQuery.support.style ) { + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Note: IE uppercases css property names, but if we were to .toLowerCase() + // .cssText, that would destroy case senstitivity in URL's, like in "background" + return elem.style.cssText || undefined; + }, + set: function( elem, value ) { + return ( elem.style.cssText = value + "" ); + } + }; +} + +// Safari mis-reports the default selected property of an option +// Accessing the parent's selectedIndex property fixes it +if ( !jQuery.support.optSelected ) { + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { + get: function( elem ) { + var parent = elem.parentNode; + + if ( parent ) { + parent.selectedIndex; + + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + return null; + } + }); +} + +// IE6/7 call enctype encoding +if ( !jQuery.support.enctype ) { + jQuery.propFix.enctype = "encoding"; +} + +// Radios and checkboxes getter/setter +if ( !jQuery.support.checkOn ) { + jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + get: function( elem ) { + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + } + }; + }); +} +jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + } + } + }); +}); +var rformElems = /^(?:input|select|textarea)$/i, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + + var handleObjIn, eventHandle, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + // Don't attach events to noData or text/comment nodes (but allow plain objects) + elemData = elem.nodeType !== 3 && elem.nodeType !== 8 && jQuery._data( elem ); + + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !(events = elemData.events) ) { + events = elemData.events = {}; + } + if ( !(eventHandle = elemData.handle) ) { + eventHandle = elemData.handle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + // jQuery(...).bind("mouseover mouseout", fn); + types = ( types || "" ).match( core_rnotwhite ) || [""]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !(handlers = events[ type ]) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var j, origCount, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = jQuery.hasData( elem ) && jQuery._data( elem ); + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( core_rnotwhite ) || [""]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + delete elemData.handle; + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery._removeData( elem, "events" ); + } + }, + + trigger: function( event, data, elem, onlyHandlers ) { + + var i, cur, tmp, bubbleType, ontype, handle, special, + eventPath = [ elem || document ], + type = event.type || event, + namespaces = event.namespace ? event.namespace.split(".") : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf(".") >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf(":") < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + event.isTrigger = true; + event.namespace = namespaces.join("."); + event.namespace_re = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === (elem.ownerDocument || document) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { + event.preventDefault(); + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + try { + elem[ type ](); + } catch ( e ) { + // IE<9 dies on focus/blur to hidden element (#1486,#12518) + // only reproducible on winXP IE8 native, not IE9 in IE8 mode + } + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event ); + + var i, j, ret, matched, handleObj, + handlerQueue = [], + args = core_slice.call( arguments ), + handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( (event.result = ret) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var i, matches, sel, handleObj, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + // Black-hole SVG instance trees (#13180) + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { + + for ( ; cur != this; cur = cur.parentNode || this ) { + + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.disabled !== true || event.type !== "click" ) { + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matches[ sel ] === undefined ) { + matches[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) >= 0 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matches[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, handlers: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( delegateCount < handlers.length ) { + handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); + } + + return handlerQueue; + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, + originalEvent = event, + fixHook = jQuery.event.fixHooks[ event.type ] || {}, + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = new jQuery.Event( originalEvent ); + + i = copy.length; + while ( i-- ) { + prop = copy[ i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Support: IE<9 + // Fix target property (#1925) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Support: Chrome 23+, Safari? + // Target should not be a text node (#504, #13143) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // Support: IE<9 + // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) + event.metaKey = !!event.metaKey; + + return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var eventDoc, doc, body, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + special: { + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + click: { + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { + this.click(); + return false; + } + } + }, + focus: { + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== document.activeElement && this.focus ) { + try { + this.focus(); + return false; + } catch ( e ) { + // Support: IE<9 + // If we error on focus to hidden element (#1486, #12518), + // let .trigger() run the handlers + } + } + }, + delegateType: "focusin" + }, + blur: { + trigger: function() { + if ( this === document.activeElement && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: "focusout" + }, + + beforeunload: { + postDispatch: function( event ) { + + // Even when returnValue equals to undefined Firefox will still show alert + if ( event.result !== undefined ) { + event.originalEvent.returnValue = event.result; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + var name = "on" + type; + + if ( elem.detachEvent ) { + + // #8545, #7054, preventing memory leaks for custom events in IE6-8 + // detachEvent needed property on element, by name of that event, to properly expose it to GC + if ( typeof elem[ name ] === "undefined" ) { + elem[ name ] = null; + } + + elem.detachEvent( name, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + if ( !e ) { + return; + } + + // If preventDefault exists, run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // Support: IE + // Otherwise set the returnValue property of the original event to false + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + if ( !e ) { + return; + } + // If stopPropagation exists, run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + + // Support: IE + // Set the cancelBubble property of the original event to true + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + } +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// IE submit delegation +if ( !jQuery.support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !jQuery._data( form, "submitBubbles" ) ) { + jQuery.event.add( form, "submit._submit", function( event ) { + event._submit_bubble = true; + }); + jQuery._data( form, "submitBubbles", true ); + } + }); + // return undefined since we don't need an event listener + }, + + postDispatch: function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( event._submit_bubble ) { + delete event._submit_bubble; + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + } + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !jQuery.support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + } + // Allow triggered, simulated change events (#11500) + jQuery.event.simulate( "change", this, event, true ); + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + jQuery._data( elem, "changeBubbles", true ); + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return !rformElems.test( this.nodeName ); + } + }; +} + +// Create "bubbling" focus and blur events +if ( !jQuery.support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler while someone wants focusin/focusout + var attaches = 0, + handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + if ( attaches++ === 0 ) { + document.addEventListener( orig, handler, true ); + } + }, + teardown: function() { + if ( --attaches === 0 ) { + document.removeEventListener( orig, handler, true ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, + + delegate: function( selector, types, data, fn ) { + return this.on( types, selector, data, fn ); + }, + undelegate: function( selector, types, fn ) { + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + var elem = this[0]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + }, + + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } +}); + +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; + + if ( rkeyEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; + } + + if ( rmouseEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; + } +}); +/*! + * Sizzle CSS Selector Engine + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license + * http://sizzlejs.com/ + */ +(function( window, undefined ) { + +var i, + cachedruns, + Expr, + getText, + isXML, + compile, + hasDuplicate, + outermostContext, + + // Local document vars + setDocument, + document, + docElem, + documentIsXML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + sortOrder, + + // Instance-specific data + expando = "sizzle" + -(new Date()), + preferredDoc = window.document, + support = {}, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + + // General-purpose constants + strundefined = typeof undefined, + MAX_NEGATIVE = 1 << 31, + + // Array methods + arr = [], + pop = arr.pop, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf if we can't use a native one + indexOf = arr.indexOf || function( elem ) { + var i = 0, + len = this.length; + for ( ; i < len; i++ ) { + if ( this[i] === elem ) { + return i; + } + } + return -1; + }, + + + // Regular expressions + + // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + // http://www.w3.org/TR/css3-syntax/#characters + characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", + + // Loosely modeled on CSS identifier characters + // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors + // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = characterEncoding.replace( "w", "w#" ), + + // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors + operators = "([*^$|!~]?=)", + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", + + // Prefer arguments quoted, + // then not containing pseudos/brackets, + // then attribute selectors/non-parenthetical expressions, + // then anything else + // These preferences are here to reduce the number of selectors + // needing tokenize in the PSEUDO preFilter + pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + characterEncoding + ")" ), + "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), + "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), + "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rsibling = /[\x20\t\r\n\f]*[+~]/, + + rnative = /\{\s*\[native code\]\s*\}/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rescape = /'|\\/g, + rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, + + // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g, + funescape = function( _, escaped ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + return high !== high ? + escaped : + // BMP codepoint + high < 0 ? + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }; + +// Use a stripped-down slice if we can't use a native one +try { + slice.call( docElem.childNodes, 0 )[0].nodeType; +} catch ( e ) { + slice = function( i ) { + var elem, + results = []; + for ( ; (elem = this[i]); i++ ) { + results.push( elem ); + } + return results; + }; +} + +/** + * For feature detection + * @param {Function} fn The function to test for native support + */ +function isNative( fn ) { + return rnative.test( fn + "" ); +} + +/** + * Create key-value caches of limited size + * @returns {Function(string, Object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var cache, + keys = []; + + return (cache = function( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key += " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key ] = value); + }); +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created div and expects a boolean result + */ +function assert( fn ) { + var div = document.createElement("div"); + + try { + return fn( div ); + } catch (e) { + return false; + } finally { + // release memory in IE + div = null; + } +} + +function Sizzle( selector, context, results, seed ) { + var match, elem, m, nodeType, + // QSA vars + i, groups, old, nid, newContext, newSelector; + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + + context = context || document; + results = results || []; + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { + return []; + } + + if ( !documentIsXML && !seed ) { + + // Shortcuts + if ( (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + contains( context, elem ) && elem.id === m ) { + results.push( elem ); + return results; + } + } + + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); + return results; + + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) { + push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); + return results; + } + } + + // QSA path + if ( support.qsa && !rbuggyQSA.test(selector) ) { + old = true; + nid = expando; + newContext = context; + newSelector = nodeType === 9 && selector; + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + groups = tokenize( selector ); + + if ( (old = context.getAttribute("id")) ) { + nid = old.replace( rescape, "\\$&" ); + } else { + context.setAttribute( "id", nid ); + } + nid = "[id='" + nid + "'] "; + + i = groups.length; + while ( i-- ) { + groups[i] = nid + toSelector( groups[i] ); + } + newContext = rsibling.test( selector ) && context.parentNode || context; + newSelector = groups.join(","); + } + + if ( newSelector ) { + try { + push.apply( results, slice.call( newContext.querySelectorAll( + newSelector + ), 0 ) ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute("id"); + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Detect xml + * @param {Element|Object} elem An element or a document + */ +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var doc = node ? node.ownerDocument || node : preferredDoc; + + // If no document and documentElement is available, return + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Set our document + document = doc; + docElem = doc.documentElement; + + // Support tests + documentIsXML = isXML( doc ); + + // Check if getElementsByTagName("*") returns only elements + support.tagNameNoComments = assert(function( div ) { + div.appendChild( doc.createComment("") ); + return !div.getElementsByTagName("*").length; + }); + + // Check if attributes should be retrieved by attribute nodes + support.attributes = assert(function( div ) { + div.innerHTML = ""; + var type = typeof div.lastChild.getAttribute("multiple"); + // IE8 returns a string for some attributes even when not present + return type !== "boolean" && type !== "string"; + }); + + // Check if getElementsByClassName can be trusted + support.getByClassName = assert(function( div ) { + // Opera can't find a second classname (in 9.6) + div.innerHTML = ""; + if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { + return false; + } + + // Safari 3.2 caches class attributes and doesn't catch changes + div.lastChild.className = "e"; + return div.getElementsByClassName("e").length === 2; + }); + + // Check if getElementById returns elements by name + // Check if getElementsByName privileges form controls or returns elements by ID + support.getByName = assert(function( div ) { + // Inject content + div.id = expando + 0; + div.innerHTML = "
    "; + docElem.insertBefore( div, docElem.firstChild ); + + // Test + var pass = doc.getElementsByName && + // buggy browsers will return fewer than the correct 2 + doc.getElementsByName( expando ).length === 2 + + // buggy browsers will return more than the correct 0 + doc.getElementsByName( expando + 0 ).length; + support.getIdNotName = !doc.getElementById( expando ); + + // Cleanup + docElem.removeChild( div ); + + return pass; + }); + + // IE6/7 return modified attributes + Expr.attrHandle = assert(function( div ) { + div.innerHTML = ""; + return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && + div.firstChild.getAttribute("href") === "#"; + }) ? + {} : + { + "href": function( elem ) { + return elem.getAttribute( "href", 2 ); + }, + "type": function( elem ) { + return elem.getAttribute("type"); + } + }; + + // ID find and filter + if ( support.getIdNotName ) { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== strundefined && !documentIsXML ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute("id") === attrId; + }; + }; + } else { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== strundefined && !documentIsXML ) { + var m = context.getElementById( id ); + + return m ? + m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? + [m] : + undefined : + []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); + return node && node.value === attrId; + }; + }; + } + + // Tag + Expr.find["TAG"] = support.tagNameNoComments ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== strundefined ) { + return context.getElementsByTagName( tag ); + } + } : + function( tag, context ) { + var elem, + tmp = [], + i = 0, + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + for ( ; (elem = results[i]); i++ ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Name + Expr.find["NAME"] = support.getByName && function( tag, context ) { + if ( typeof context.getElementsByName !== strundefined ) { + return context.getElementsByName( name ); + } + }; + + // Class + Expr.find["CLASS"] = support.getByClassName && function( className, context ) { + if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) { + return context.getElementsByClassName( className ); + } + }; + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21), + // no need to also add to buggyMatches since matches checks buggyQSA + // A support test would require too much code (would include document ready) + rbuggyQSA = [ ":focus" ]; + + if ( (support.qsa = isNative(doc.querySelectorAll)) ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explictly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + div.innerHTML = ""; + + // IE8 - Some boolean attributes are not treated correctly + if ( !div.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + }); + + assert(function( div ) { + + // Opera 10-12/IE8 - ^= $= *= and empty values + // Should not select anything + div.innerHTML = ""; + if ( div.querySelectorAll("[i^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":enabled").length ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + div.querySelectorAll("*,:x"); + rbuggyQSA.push(",.*:"); + }); + } + + if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector || + docElem.mozMatchesSelector || + docElem.webkitMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector) )) ) { + + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( div, "div" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( div, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + }); + } + + rbuggyQSA = new RegExp( rbuggyQSA.join("|") ); + rbuggyMatches = new RegExp( rbuggyMatches.join("|") ); + + // Element contains another + // Purposefully does not implement inclusive descendent + // As in, an element does not contain itself + contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + // Document order sorting + sortOrder = docElem.compareDocumentPosition ? + function( a, b ) { + var compare; + + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) { + if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) { + if ( a === doc || contains( preferredDoc, a ) ) { + return -1; + } + if ( b === doc || contains( preferredDoc, b ) ) { + return 1; + } + return 0; + } + return compare & 4 ? -1 : 1; + } + + return a.compareDocumentPosition ? -1 : 1; + } : + function( a, b ) { + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // The nodes are identical, we can exit early + if ( a === b ) { + hasDuplicate = true; + return 0; + + // Fallback to using sourceIndex (in IE) if it's available on both nodes + } else if ( a.sourceIndex && b.sourceIndex ) { + return ( ~b.sourceIndex || MAX_NEGATIVE ) - ( contains( preferredDoc, a ) && ~a.sourceIndex || MAX_NEGATIVE ); + + // Parentless nodes are either documents or disconnected + } else if ( !aup || !bup ) { + return a === doc ? -1 : + b === doc ? 1 : + aup ? -1 : + bup ? 1 : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + // Always assume the presence of duplicates if sort doesn't + // pass them to our comparison function (as in Google Chrome). + hasDuplicate = false; + [0, 0].sort( sortOrder ); + support.detectDuplicates = hasDuplicate; + + return document; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + // rbuggyQSA always contains :focus, so no need for an existence check + if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) { + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch(e) {} + } + + return Sizzle( expr, document, null, [elem] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + var val; + + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + if ( !documentIsXML ) { + name = name.toLowerCase(); + } + if ( (val = Expr.attrHandle[ name ]) ) { + return val( elem ); + } + if ( documentIsXML || support.attributes ) { + return elem.getAttribute( name ); + } + return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ? + name : + val && val.specified ? val.value : null; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +// Document sorting and removing duplicates +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + i = 1, + j = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + results.sort( sortOrder ); + + if ( hasDuplicate ) { + for ( ; (elem = results[i]); i++ ) { + if ( elem === results[ i - 1 ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + return results; +}; + +function siblingCheck( a, b ) { + var cur = a && b && a.nextSibling; + + for ( ; cur; cur = cur.nextSibling ) { + if ( cur === b ) { + return -1; + } + } + + return a ? 1 : -1; +} + +// Returns a function to use in pseudos for input types +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +// Returns a function to use in pseudos for buttons +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +// Returns a function to use in pseudos for positionals +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + for ( ; (node = elem[i]); i++ ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (see #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1].slice( 0, 3 ) === "nth" ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[5] && match[2]; + + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[4] ) { + match[2] = match[4]; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeName ) { + if ( nodeName === "*" ) { + return function() { return true; }; + } + + nodeName = nodeName.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.substr( result.length - check.length ) === check : + operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache, outerCache, node, diff, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + // Seek `elem` from a previously-cached index + outerCache = parent[ expando ] || (parent[ expando ] = {}); + cache = outerCache[ type ] || []; + nodeIndex = cache[0] === dirruns && cache[1]; + diff = cache[0] === dirruns && cache[2]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + (diff = nodeIndex = 0) || start.pop()) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + outerCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + // Use previously-cached element index if available + } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { + diff = cache[1]; + + // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) + } else { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || + (diff = nodeIndex = 0) || start.pop()) ) { + + if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { + // Cache the index of each encountered element + if ( useCache ) { + (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf.call( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + // lang value must be a valid identifider + if ( !ridentifier.test(lang || "") ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsXML ? + elem.getAttribute("xml:lang") || elem.getAttribute("lang") : + elem.lang) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), + // not comment, processing instructions, or others + // Thanks to Diego Perini for the nodeName shortcut + // Greater than "@" means alpha characters (specifically not starting with "#" or "?") + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) + // use getAttribute instead to test this case + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); + }, + + // Position-in-collection + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +function tokenize( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( tokens = [] ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push( { + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, " " ) + } ); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + matched = match.shift(); + tokens.push( { + value: matched, + type: type, + matches: match + } ); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +} + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + checkNonElements = base && combinator.dir === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var data, cache, outerCache, + dirkey = dirruns + " " + doneName; + + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { + if ( (data = cache[1]) === true || data === cachedruns ) { + return data === true; + } + } else { + cache = outerCache[ dir ] = [ dirkey ]; + cache[1] = matcher( elem, context, xml ) || cachedruns; + if ( cache[1] === true ) { + return true; + } + } + } + } + } + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf.call( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + // A counter to specify which element is currently being matched + var matcherCachedRuns = 0, + bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, expandContext ) { + var elem, j, matcher, + setMatched = [], + matchedCount = 0, + i = "0", + unmatched = seed && [], + outermost = expandContext != null, + contextBackup = outermostContext, + // We must always have either seed elements or context + elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), + // Nested matchers should use non-integer dirruns + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); + + if ( outermost ) { + outermostContext = context !== document && context; + cachedruns = matcherCachedRuns; + } + + // Add elements passing elementMatchers directly to results + for ( ; (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + for ( j = 0; (matcher = elementMatchers[j]); j++ ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + cachedruns = ++matcherCachedRuns; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // Apply set filters to unmatched elements + // `i` starts as a string, so matchedCount would equal "00" if there are no elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + for ( j = 0; (matcher = setMatchers[j]); j++ ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !group ) { + group = tokenize( selector ); + } + i = group.length; + while ( i-- ) { + cached = matcherFromTokens( group[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + } + return cached; +}; + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function select( selector, context, results, seed ) { + var i, tokens, token, type, find, + match = tokenize( selector ); + + if ( !seed ) { + // Try to minimize operations if there is only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + context.nodeType === 9 && !documentIsXML && + Expr.relative[ tokens[1].type ] ) { + + context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0]; + if ( !context ) { + return results; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + for ( i = matchExpr["needsContext"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && context.parentNode || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, slice.call( seed, 0 ) ); + return results; + } + + break; + } + } + } + } + } + + // Compile and execute a filtering function + // Provide `match` to avoid retokenization if we modified the selector above + compile( selector, match )( + seed, + context, + documentIsXML, + results, + rsibling.test( selector ) + ); + return results; +} + +// Deprecated +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Easy API for creating new setFilters +function setFilters() {} +Expr.filters = setFilters.prototype = Expr.pseudos; +Expr.setFilters = new setFilters(); + +// Initialize with the default document +setDocument(); + +// Override sizzle attribute retrieval +Sizzle.attr = jQuery.attr; +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.pseudos; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + +})( window ); +var runtil = /Until$/, + rparentsprev = /^(?:parents|prev(?:Until|All))/, + isSimple = /^.[^:#\[\.,]*$/, + rneedsContext = jQuery.expr.match.needsContext, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend({ + find: function( selector ) { + var i, ret, self; + + if ( typeof selector !== "string" ) { + self = this; + return this.pushStack( jQuery( selector ).filter(function() { + for ( i = 0; i < self.length; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }) ); + } + + ret = []; + for ( i = 0; i < this.length; i++ ) { + jQuery.find( selector, this[ i ], ret ); + } + + // Needed because $( selector, context ) becomes $( context ).find( selector ) + ret = this.pushStack( jQuery.unique( ret ) ); + ret.selector = ( this.selector ? this.selector + " " : "" ) + selector; + return ret; + }, + + has: function( target ) { + var i, + targets = jQuery( target, this ), + len = targets.length; + + return this.filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + not: function( selector ) { + return this.pushStack( winnow(this, selector, false) ); + }, + + filter: function( selector ) { + return this.pushStack( winnow(this, selector, true) ); + }, + + is: function( selector ) { + return !!selector && ( + typeof selector === "string" ? + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + rneedsContext.test( selector ) ? + jQuery( selector, this.context ).index( this[0] ) >= 0 : + jQuery.filter( selector, this ).length > 0 : + this.filter( selector ).length > 0 ); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + ret = [], + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( ; i < l; i++ ) { + cur = this[i]; + + while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { + ret.push( cur ); + break; + } + cur = cur.parentNode; + } + } + + return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + var set = typeof selector === "string" ? + jQuery( selector, context ) : + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), + all = jQuery.merge( this.get(), set ); + + return this.pushStack( jQuery.unique(all) ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter(selector) + ); + } +}); + +jQuery.fn.andSelf = jQuery.fn.addBack; + +function sibling( cur, dir ) { + do { + cur = cur[ dir ]; + } while ( cur && cur.nodeType !== 1 ); + + return cur; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( !runtil.test( name ) ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; + + if ( this.length > 1 && rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + + return this.pushStack( ret ); + }; +}); + +jQuery.extend({ + filter: function( expr, elems, not ) { + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 ? + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : + jQuery.find.matches(expr, elems); + }, + + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, keep ) { + + // Can't pass null or undefined to indexOf in Firefox 4 + // Set to 0 to skip string check + qualifier = qualifier || 0; + + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep(elements, function( elem, i ) { + var retVal = !!qualifier.call( elem, i, elem ); + return retVal === keep; + }); + + } else if ( qualifier.nodeType ) { + return jQuery.grep(elements, function( elem ) { + return ( elem === qualifier ) === keep; + }); + + } else if ( typeof qualifier === "string" ) { + var filtered = jQuery.grep(elements, function( elem ) { + return elem.nodeType === 1; + }); + + if ( isSimple.test( qualifier ) ) { + return jQuery.filter(qualifier, filtered, !keep); + } else { + qualifier = jQuery.filter( qualifier, filtered ); + } + } + + return jQuery.grep(elements, function( elem ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; + }); +} +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, + rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + rtagName = /<([\w:]+)/, + rtbody = /\s*$/g, + + // We have to close these tags to support XHTML (#13200) + wrapMap = { + option: [ 1, "" ], + legend: [ 1, "
    ", "
    " ], + area: [ 1, "", "" ], + param: [ 1, "", "" ], + thead: [ 1, "", "
    " ], + tr: [ 2, "", "
    " ], + col: [ 2, "", "
    " ], + td: [ 3, "", "
    " ], + + // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, + // unless wrapped in a div with non-breaking characters in front of it. + _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
    ", "
    " ] + }, + safeFragment = createSafeFragment( document ), + fragmentDiv = safeFragment.appendChild( document.createElement("div") ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +jQuery.fn.extend({ + text: function( value ) { + return jQuery.access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); + }, null, value, arguments.length ); + }, + + wrapAll: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapAll( html.call(this, i) ); + }); + } + + if ( this[0] ) { + // The elements to wrap the target around + var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); + + if ( this[0].parentNode ) { + wrap.insertBefore( this[0] ); + } + + wrap.map(function() { + var elem = this; + + while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { + elem = elem.firstChild; + } + + return elem; + }).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapInner( html.call(this, i) ); + }); + } + + return this.each(function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + }); + }, + + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); + + return this.each(function(i) { + jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); + }); + }, + + unwrap: function() { + return this.parent().each(function() { + if ( !jQuery.nodeName( this, "body" ) ) { + jQuery( this ).replaceWith( this.childNodes ); + } + }).end(); + }, + + append: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.insertBefore( elem, this.firstChild ); + } + }); + }, + + before: function() { + return this.domManip( arguments, false, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + }); + }, + + after: function() { + return this.domManip( arguments, false, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + }); + }, + + // keepData is for internal use only--do not document + remove: function( selector, keepData ) { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) { + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem ) ); + } + + if ( elem.parentNode ) { + if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { + setGlobalEval( getAll( elem, "script" ) ); + } + elem.parentNode.removeChild( elem ); + } + } + } + + return this; + }, + + empty: function() { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + } + + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + + // If this is a select, ensure that it displays empty (#12336) + // Support: IE<9 + if ( elem.options && jQuery.nodeName( elem, "select" ) ) { + elem.options.length = 0; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function () { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, + + html: function( value ) { + return jQuery.access( this, function( value ) { + var elem = this[0] || {}, + i = 0, + l = this.length; + + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, "" ) : + undefined; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && + ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && + !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, "<$1>" ); + + try { + for (; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + elem = this[i] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch(e) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function( value ) { + var isFunc = jQuery.isFunction( value ); + + // Make sure that the elements are removed from the DOM before they are inserted + // this can help fix replacing a parent with child elements + if ( !isFunc && typeof value !== "string" ) { + value = jQuery( value ).not( this ).detach(); + } + + return this.domManip( [ value ], true, function( elem ) { + var next = this.nextSibling, + parent = this.parentNode; + + if ( parent && this.nodeType === 1 || this.nodeType === 11 ) { + + jQuery( this ).remove(); + + if ( next ) { + next.parentNode.insertBefore( elem, next ); + } else { + parent.appendChild( elem ); + } + } + }); + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, table, callback ) { + + // Flatten any nested arrays + args = core_concat.apply( [], args ); + + var fragment, first, scripts, hasScripts, node, doc, + i = 0, + l = this.length, + set = this, + iNoClone = l - 1, + value = args[0], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { + return this.each(function( index ) { + var self = set.eq( index ); + if ( isFunction ) { + args[0] = value.call( this, index, table ? self.html() : undefined ); + } + self.domManip( args, table, callback ); + }); + } + + if ( l ) { + fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + if ( first ) { + table = table && jQuery.nodeName( first, "tr" ); + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( + table && jQuery.nodeName( this[i], "table" ) ? + findOrAppend( this[i], "tbody" ) : + this[i], + node, + i + ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { + + if ( node.src ) { + // Hope ajax is available... + jQuery.ajax({ + url: node.src, + type: "GET", + dataType: "script", + async: false, + global: false, + "throws": true + }); + } else { + jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); + } + } + } + } + + // Fix #11809: Avoid leaking memory + fragment = first = null; + } + } + + return this; + } +}); + +function findOrAppend( elem, tag ) { + return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + var attr = elem.getAttributeNode("type"); + elem.type = ( attr && attr.specified ) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + if ( match ) { + elem.type = match[1]; + } else { + elem.removeAttribute("type"); + } + return elem; +} + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var elem, + i = 0; + for ( ; (elem = elems[i]) != null; i++ ) { + jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); + } +} + +function cloneCopyEvent( src, dest ) { + + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; + + if ( events ) { + delete curData.handle; + curData.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } +} + +function fixCloneNodeIssues( src, dest ) { + var nodeName, data, e; + + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + nodeName = dest.nodeName.toLowerCase(); + + // IE6-8 copies events bound via attachEvent when using cloneNode. + if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { + data = jQuery._data( dest ); + + for ( e in data.events ) { + jQuery.removeEvent( dest, e, data.handle ); + } + + // Event data gets referenced instead of copied if the expando gets copied too + dest.removeAttribute( jQuery.expando ); + } + + // IE blanks contents when cloning scripts, and tries to evaluate newly-set text + if ( nodeName === "script" && dest.text !== src.text ) { + disableScript( dest ).text = src.text; + restoreScript( dest ); + + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + } else if ( nodeName === "object" ) { + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; + } + + // This path appears unavoidable for IE9. When cloning an object + // element in IE9, the outerHTML strategy above is not sufficient. + // If the src has innerHTML and the destination does not, + // copy the src.innerHTML into the dest.innerHTML. #10324 + if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { + dest.innerHTML = src.innerHTML; + } + + } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set + + dest.defaultChecked = dest.checked = src.checked; + + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; + } + + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === "option" ) { + dest.defaultSelected = dest.selected = src.defaultSelected; + + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + i = 0, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone(true); + jQuery( insert[i] )[ original ]( elems ); + + // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() + core_push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +}); + +function getAll( context, tag ) { + var elems, elem, + i = 0, + found = typeof context.getElementsByTagName !== "undefined" ? context.getElementsByTagName( tag || "*" ) : + typeof context.querySelectorAll !== "undefined" ? context.querySelectorAll( tag || "*" ) : + undefined; + + if ( !found ) { + for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { + if ( !tag || jQuery.nodeName( elem, tag ) ) { + found.push( elem ); + } else { + jQuery.merge( found, getAll( elem, tag ) ); + } + } + } + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], found ) : + found; +} + +// Used in buildFragment, fixes the defaultChecked property +function fixDefaultChecked( elem ) { + if ( manipulation_rcheckableType.test( elem.type ) ) { + elem.defaultChecked = elem.checked; + } +} + +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var destElements, srcElements, node, i, clone, + inPage = jQuery.contains( elem.ownerDocument, elem ); + + if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { + clone = elem.cloneNode( true ); + + // IE<=8 does not properly clone detached, unknown element nodes + } else { + fragmentDiv.innerHTML = elem.outerHTML; + fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + } + + if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { + + // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + // Fix all IE cloning issues + for ( i = 0; (node = srcElements[i]) != null; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + fixCloneNodeIssues( node, destElements[i] ); + } + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0; (node = srcElements[i]) != null; i++ ) { + cloneCopyEvent( node, destElements[i] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + destElements = srcElements = node = null; + + // Return the cloned set + return clone; + }, + + buildFragment: function( elems, context, scripts, selection ) { + var contains, elem, tag, tmp, wrap, tbody, j, + l = elems.length, + + // Ensure a safe fragment + safe = createSafeFragment( context ), + + nodes = [], + i = 0; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || safe.appendChild( context.createElement("div") ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + + tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; + + // Descend through wrappers to the right content + j = wrap[0]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Manually add leading whitespace removed by IE + if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); + } + + // Remove IE's autoinserted from table fragments + if ( !jQuery.support.tbody ) { + + // String was a , *may* have spurious + elem = tag === "table" && !rtbody.test( elem ) ? + tmp.firstChild : + + // String was a bare or + wrap[1] === "
    " && !rtbody.test( elem ) ? + tmp : + 0; + + j = elem && elem.childNodes.length; + while ( j-- ) { + if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { + elem.removeChild( tbody ); + } + } + } + + jQuery.merge( nodes, tmp.childNodes ); + + // Fix #12392 for WebKit and IE > 9 + tmp.textContent = ""; + + // Fix #12392 for oldIE + while ( tmp.firstChild ) { + tmp.removeChild( tmp.firstChild ); + } + + // Remember the top-level container for proper cleanup + tmp = safe.lastChild; + } + } + } + + // Fix #11356: Clear elements from fragment + if ( tmp ) { + safe.removeChild( tmp ); + } + + // Reset defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + if ( !jQuery.support.appendChecked ) { + jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); + } + + i = 0; + while ( (elem = nodes[ i++ ]) ) { + + // #4087 - If origin and destination elements are the same, and this is + // that element, do not do anything + if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( safe.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( (elem = tmp[ j++ ]) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + tmp = null; + + return safe; + }, + + cleanData: function( elems, /* internal */ acceptData ) { + var data, id, elem, type, + i = 0, + internalKey = jQuery.expando, + cache = jQuery.cache, + deleteExpando = jQuery.support.deleteExpando, + special = jQuery.event.special; + + for ( ; (elem = elems[i]) != null; i++ ) { + + if ( acceptData || jQuery.acceptData( elem ) ) { + + id = elem[ internalKey ]; + data = id && cache[ id ]; + + if ( data ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Remove cache only if it was not already removed by jQuery.event.remove + if ( cache[ id ] ) { + + delete cache[ id ]; + + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( deleteExpando ) { + delete elem[ internalKey ]; + + } else if ( typeof elem.removeAttribute !== "undefined" ) { + elem.removeAttribute( internalKey ); + + } else { + elem[ internalKey ] = null; + } + + core_deletedIds.push( id ); + } + } + } + } + } +}); +var curCSS, getStyles, iframe, + ralpha = /alpha\([^)]*\)/i, + ropacity = /opacity\s*=\s*([^)]*)/, + rposition = /^(top|right|bottom|left)$/, + // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" + // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + rmargin = /^margin/, + rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), + rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), + rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), + elemdisplay = { BODY: "block" }, + + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: 0, + fontWeight: 400 + }, + + cssExpand = [ "Top", "Right", "Bottom", "Left" ], + cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; + +// return a css property mapped to a potentially vendor prefixed property +function vendorPropName( style, name ) { + + // shortcut for names that are not vendor prefixed + if ( name in style ) { + return name; + } + + // check for vendor prefixed names + var capName = name.charAt(0).toUpperCase() + name.slice(1), + origName = name, + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in style ) { + return name; + } + } + + return origName; +} + +function isHidden( elem, el ) { + // isHidden might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); +} + +function showHide( elements, show ) { + var elem, + values = [], + index = 0, + length = elements.length; + + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + values[ index ] = jQuery._data( elem, "olddisplay" ); + if ( show ) { + // Reset the inline display of this element to learn if it is + // being hidden by cascaded rules or not + if ( !values[ index ] && elem.style.display === "none" ) { + elem.style.display = ""; + } + + // Set elements which have been overridden with display: none + // in a stylesheet to whatever the default browser style is + // for such an element + if ( elem.style.display === "" && isHidden( elem ) ) { + values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); + } + } else if ( !values[ index ] && !isHidden( elem ) ) { + jQuery._data( elem, "olddisplay", jQuery.css( elem, "display" ) ); + } + } + + // Set the display of most of the elements in a second loop + // to avoid the constant reflow + for ( index = 0; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + if ( !show || elem.style.display === "none" || elem.style.display === "" ) { + elem.style.display = show ? values[ index ] || "" : "none"; + } + } + + return elements; +} + +jQuery.fn.extend({ + css: function( name, value ) { + return jQuery.access( this, function( elem, name, value ) { + var styles, len, + map = {}, + i = 0; + + if ( jQuery.isArray( name ) ) { + styles = getStyles( elem ); + len = name.length; + + for ( ; i < len; i++ ) { + map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); + } + + return map; + } + + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + }, + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state ) { + var bool = typeof state === "boolean"; + + return this.each(function() { + if ( bool ? state : isHidden( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + }); + } +}); + +jQuery.extend({ + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + } + } + } + }, + + // Exclude the following css properties to add px + cssNumber: { + "columnCount": true, + "fillOpacity": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + // normalize float css property + "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" + }, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, hooks, + origName = jQuery.camelCase( name ), + style = elem.style; + + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // convert relative number strings (+= or -=) to relative numbers. #7345 + if ( type === "string" && (ret = rrelNum.exec( value )) ) { + value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); + // Fixes bug #9237 + type = "number"; + } + + // Make sure that NaN and null values aren't set. See: #7116 + if ( value == null || type === "number" && isNaN( value ) ) { + return; + } + + // If a number was passed in, add 'px' to the (except for certain CSS properties) + if ( type === "number" && !jQuery.cssNumber[ origName ] ) { + value += "px"; + } + + // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, + // but it would mean to define eight (for every problematic property) identical functions + if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { + style[ name ] = "inherit"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { + + // Wrapped to prevent IE from throwing errors when 'invalid' values are provided + // Fixes bug #5509 + try { + style[ name ] = value; + } catch(e) {} + } + + } else { + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, extra, styles ) { + var val, num, hooks, + origName = jQuery.camelCase( name ); + + // Make sure that we're working with the right name + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name, styles ); + } + + //convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Return, converting to number if forced or a qualifier was provided and val looks numeric + if ( extra ) { + num = parseFloat( val ); + return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; + } + return val; + }, + + // A method for quickly swapping in/out CSS properties to get correct calculations + swap: function( elem, options, callback, args ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.apply( elem, args || [] ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; + } +}); + +// NOTE: we've included the "window" in window.getComputedStyle +// because jsdom on node.js will break without it. +if ( window.getComputedStyle ) { + getStyles = function( elem ) { + return window.getComputedStyle( elem, null ); + }; + + curCSS = function( elem, name, _computed ) { + var width, minWidth, maxWidth, + computed = _computed || getStyles( elem ), + + // getPropertyValue is only needed for .css('filter') in IE9, see #12537 + ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, + style = elem.style; + + if ( computed ) { + + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right + // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels + // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values + if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { + + // Remember the original values + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + // Put in the new values to get a computed value out + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + // Revert the changed values + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret; + }; +} else if ( document.documentElement.currentStyle ) { + getStyles = function( elem ) { + return elem.currentStyle; + }; + + curCSS = function( elem, name, _computed ) { + var left, rs, rsLeft, + computed = _computed || getStyles( elem ), + ret = computed ? computed[ name ] : undefined, + style = elem.style; + + // Avoid setting ret to empty string here + // so we don't default to auto + if ( ret == null && style && style[ name ] ) { + ret = style[ name ]; + } + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + // but not position css attributes, as those are proportional to the parent element instead + // and we can't measure the parent instead because it might trigger a "stacking dolls" problem + if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { + + // Remember the original values + left = style.left; + rs = elem.runtimeStyle; + rsLeft = rs && rs.left; + + // Put in the new values to get a computed value out + if ( rsLeft ) { + rs.left = elem.currentStyle.left; + } + style.left = name === "fontSize" ? "1em" : ret; + ret = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + if ( rsLeft ) { + rs.left = rsLeft; + } + } + + return ret === "" ? "auto" : ret; + }; +} + +function setPositiveNumber( elem, value, subtract ) { + var matches = rnumsplit.exec( value ); + return matches ? + // Guard against undefined "subtract", e.g., when used as in cssHooks + Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : + value; +} + +function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { + var i = extra === ( isBorderBox ? "border" : "content" ) ? + // If we already have the right measurement, avoid augmentation + 4 : + // Otherwise initialize for horizontal or vertical properties + name === "width" ? 1 : 0, + + val = 0; + + for ( ; i < 4; i += 2 ) { + // both box models exclude margin, so add it if we want it + if ( extra === "margin" ) { + val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); + } + + if ( isBorderBox ) { + // border-box includes padding, so remove it if we want content + if ( extra === "content" ) { + val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + } + + // at this point, extra isn't border nor margin, so remove border + if ( extra !== "margin" ) { + val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } else { + // at this point, extra isn't content, so add padding + val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + + // at this point, extra isn't content nor padding, so add border + if ( extra !== "padding" ) { + val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } + } + + return val; +} + +function getWidthOrHeight( elem, name, extra ) { + + // Start with offset property, which is equivalent to the border-box value + var valueIsBorderBox = true, + val = name === "width" ? elem.offsetWidth : elem.offsetHeight, + styles = getStyles( elem ), + isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + + // some non-html elements return undefined for offsetWidth, so check for null/undefined + // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 + // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 + if ( val <= 0 || val == null ) { + // Fall back to computed then uncomputed css if necessary + val = curCSS( elem, name, styles ); + if ( val < 0 || val == null ) { + val = elem.style[ name ]; + } + + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test(val) ) { + return val; + } + + // we need the check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable elem.style + valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); + + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + } + + // use the active box-sizing model to add/subtract irrelevant styles + return ( val + + augmentWidthOrHeight( + elem, + name, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox, + styles + ) + ) + "px"; +} + +// Try to determine the default display value of an element +function css_defaultDisplay( nodeName ) { + var doc = document, + display = elemdisplay[ nodeName ]; + + if ( !display ) { + display = actualDisplay( nodeName, doc ); + + // If the simple way fails, read from inside an iframe + if ( display === "none" || !display ) { + // Use the already-created iframe if possible + iframe = ( iframe || + jQuery("' : ''); + inst._keyEvent = false; + return html; + }, + + /* Generate the month and year header. */ + _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, + secondary, monthNames, monthNamesShort) { + var changeMonth = this._get(inst, 'changeMonth'); + var changeYear = this._get(inst, 'changeYear'); + var showMonthAfterYear = this._get(inst, 'showMonthAfterYear'); + var html = '
    '; + var monthHtml = ''; + // month selection + if (secondary || !changeMonth) + monthHtml += '' + monthNames[drawMonth] + ''; + else { + var inMinYear = (minDate && minDate.getFullYear() == drawYear); + var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); + monthHtml += ''; + } + if (!showMonthAfterYear) + html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : ''); + // year selection + if ( !inst.yearshtml ) { + inst.yearshtml = ''; + if (secondary || !changeYear) + html += '' + drawYear + ''; + else { + // determine range of years to display + var years = this._get(inst, 'yearRange').split(':'); + var thisYear = new Date().getFullYear(); + var determineYear = function(value) { + var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) : + (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) : + parseInt(value, 10))); + return (isNaN(year) ? thisYear : year); + }; + var year = determineYear(years[0]); + var endYear = Math.max(year, determineYear(years[1] || '')); + year = (minDate ? Math.max(year, minDate.getFullYear()) : year); + endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); + inst.yearshtml += ''; + + html += inst.yearshtml; + inst.yearshtml = null; + } + } + html += this._get(inst, 'yearSuffix'); + if (showMonthAfterYear) + html += (secondary || !(changeMonth && changeYear) ? ' ' : '') + monthHtml; + html += '
    '; // Close datepicker_header + return html; + }, + + /* Adjust one of the date sub-fields. */ + _adjustInstDate: function(inst, offset, period) { + var year = inst.drawYear + (period == 'Y' ? offset : 0); + var month = inst.drawMonth + (period == 'M' ? offset : 0); + var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + + (period == 'D' ? offset : 0); + var date = this._restrictMinMax(inst, + this._daylightSavingAdjust(new Date(year, month, day))); + inst.selectedDay = date.getDate(); + inst.drawMonth = inst.selectedMonth = date.getMonth(); + inst.drawYear = inst.selectedYear = date.getFullYear(); + if (period == 'M' || period == 'Y') + this._notifyChange(inst); + }, + + /* Ensure a date is within any min/max bounds. */ + _restrictMinMax: function(inst, date) { + var minDate = this._getMinMaxDate(inst, 'min'); + var maxDate = this._getMinMaxDate(inst, 'max'); + var newDate = (minDate && date < minDate ? minDate : date); + newDate = (maxDate && newDate > maxDate ? maxDate : newDate); + return newDate; + }, + + /* Notify change of month/year. */ + _notifyChange: function(inst) { + var onChange = this._get(inst, 'onChangeMonthYear'); + if (onChange) + onChange.apply((inst.input ? inst.input[0] : null), + [inst.selectedYear, inst.selectedMonth + 1, inst]); + }, + + /* Determine the number of months to show. */ + _getNumberOfMonths: function(inst) { + var numMonths = this._get(inst, 'numberOfMonths'); + return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths)); + }, + + /* Determine the current maximum date - ensure no time components are set. */ + _getMinMaxDate: function(inst, minMax) { + return this._determineDate(inst, this._get(inst, minMax + 'Date'), null); + }, + + /* Find the number of days in a given month. */ + _getDaysInMonth: function(year, month) { + return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); + }, + + /* Find the day of the week of the first of a month. */ + _getFirstDayOfMonth: function(year, month) { + return new Date(year, month, 1).getDay(); + }, + + /* Determines if we should allow a "next/prev" month display change. */ + _canAdjustMonth: function(inst, offset, curYear, curMonth) { + var numMonths = this._getNumberOfMonths(inst); + var date = this._daylightSavingAdjust(new Date(curYear, + curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); + if (offset < 0) + date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); + return this._isInRange(inst, date); + }, + + /* Is the given date in the accepted range? */ + _isInRange: function(inst, date) { + var minDate = this._getMinMaxDate(inst, 'min'); + var maxDate = this._getMinMaxDate(inst, 'max'); + return ((!minDate || date.getTime() >= minDate.getTime()) && + (!maxDate || date.getTime() <= maxDate.getTime())); + }, + + /* Provide the configuration settings for formatting/parsing. */ + _getFormatConfig: function(inst) { + var shortYearCutoff = this._get(inst, 'shortYearCutoff'); + shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : + new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); + return {shortYearCutoff: shortYearCutoff, + dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'), + monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')}; + }, + + /* Format the given date for display. */ + _formatDate: function(inst, day, month, year) { + if (!day) { + inst.currentDay = inst.selectedDay; + inst.currentMonth = inst.selectedMonth; + inst.currentYear = inst.selectedYear; + } + var date = (day ? (typeof day == 'object' ? day : + this._daylightSavingAdjust(new Date(year, month, day))) : + this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); + return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst)); + } +}); + +/* + * Bind hover events for datepicker elements. + * Done via delegate so the binding only occurs once in the lifetime of the parent div. + * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. + */ +function bindHover(dpDiv) { + var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a'; + return dpDiv.delegate(selector, 'mouseout', function() { + $(this).removeClass('ui-state-hover'); + if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover'); + if (this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover'); + }) + .delegate(selector, 'mouseover', function(){ + if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) { + $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); + $(this).addClass('ui-state-hover'); + if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover'); + if (this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover'); + } + }); +} + +/* jQuery extend now ignores nulls! */ +function extendRemove(target, props) { + $.extend(target, props); + for (var name in props) + if (props[name] == null || props[name] == undefined) + target[name] = props[name]; + return target; +}; + +/* Invoke the datepicker functionality. + @param options string - a command, optionally followed by additional parameters or + Object - settings for attaching new datepicker functionality + @return jQuery object */ +$.fn.datepicker = function(options){ + + /* Verify an empty collection wasn't passed - Fixes #6976 */ + if ( !this.length ) { + return this; + } + + /* Initialise the date picker. */ + if (!$.datepicker.initialized) { + $(document).mousedown($.datepicker._checkExternalClick). + find(document.body).append($.datepicker.dpDiv); + $.datepicker.initialized = true; + } + + var otherArgs = Array.prototype.slice.call(arguments, 1); + if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget')) + return $.datepicker['_' + options + 'Datepicker']. + apply($.datepicker, [this[0]].concat(otherArgs)); + if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string') + return $.datepicker['_' + options + 'Datepicker']. + apply($.datepicker, [this[0]].concat(otherArgs)); + return this.each(function() { + typeof options == 'string' ? + $.datepicker['_' + options + 'Datepicker']. + apply($.datepicker, [this].concat(otherArgs)) : + $.datepicker._attachDatepicker(this, options); + }); +}; + +$.datepicker = new Datepicker(); // singleton instance +$.datepicker.initialized = false; +$.datepicker.uuid = new Date().getTime(); +$.datepicker.version = "1.9.2"; + +// Workaround for #4055 +// Add another global to avoid noConflict issues with inline event handlers +window['DP_jQuery_' + dpuuid] = $; + +})(jQuery); +(function( $, undefined ) { + +var uiDialogClasses = "ui-dialog ui-widget ui-widget-content ui-corner-all ", + sizeRelatedOptions = { + buttons: true, + height: true, + maxHeight: true, + maxWidth: true, + minHeight: true, + minWidth: true, + width: true + }, + resizableRelatedOptions = { + maxHeight: true, + maxWidth: true, + minHeight: true, + minWidth: true + }; + +$.widget("ui.dialog", { + version: "1.9.2", + options: { + autoOpen: true, + buttons: {}, + closeOnEscape: true, + closeText: "close", + dialogClass: "", + draggable: true, + hide: null, + height: "auto", + maxHeight: false, + maxWidth: false, + minHeight: 150, + minWidth: 150, + modal: false, + position: { + my: "center", + at: "center", + of: window, + collision: "fit", + // ensure that the titlebar is never outside the document + using: function( pos ) { + var topOffset = $( this ).css( pos ).offset().top; + if ( topOffset < 0 ) { + $( this ).css( "top", pos.top - topOffset ); + } + } + }, + resizable: true, + show: null, + stack: true, + title: "", + width: 300, + zIndex: 1000 + }, + + _create: function() { + this.originalTitle = this.element.attr( "title" ); + // #5742 - .attr() might return a DOMElement + if ( typeof this.originalTitle !== "string" ) { + this.originalTitle = ""; + } + this.oldPosition = { + parent: this.element.parent(), + index: this.element.parent().children().index( this.element ) + }; + this.options.title = this.options.title || this.originalTitle; + var that = this, + options = this.options, + + title = options.title || " ", + uiDialog, + uiDialogTitlebar, + uiDialogTitlebarClose, + uiDialogTitle, + uiDialogButtonPane; + + uiDialog = ( this.uiDialog = $( "
    " ) ) + .addClass( uiDialogClasses + options.dialogClass ) + .css({ + display: "none", + outline: 0, // TODO: move to stylesheet + zIndex: options.zIndex + }) + // setting tabIndex makes the div focusable + .attr( "tabIndex", -1) + .keydown(function( event ) { + if ( options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && + event.keyCode === $.ui.keyCode.ESCAPE ) { + that.close( event ); + event.preventDefault(); + } + }) + .mousedown(function( event ) { + that.moveToTop( false, event ); + }) + .appendTo( "body" ); + + this.element + .show() + .removeAttr( "title" ) + .addClass( "ui-dialog-content ui-widget-content" ) + .appendTo( uiDialog ); + + uiDialogTitlebar = ( this.uiDialogTitlebar = $( "
    " ) ) + .addClass( "ui-dialog-titlebar ui-widget-header " + + "ui-corner-all ui-helper-clearfix" ) + .bind( "mousedown", function() { + // Dialog isn't getting focus when dragging (#8063) + uiDialog.focus(); + }) + .prependTo( uiDialog ); + + uiDialogTitlebarClose = $( "" ) + .addClass( "ui-dialog-titlebar-close ui-corner-all" ) + .attr( "role", "button" ) + .click(function( event ) { + event.preventDefault(); + that.close( event ); + }) + .appendTo( uiDialogTitlebar ); + + ( this.uiDialogTitlebarCloseText = $( "" ) ) + .addClass( "ui-icon ui-icon-closethick" ) + .text( options.closeText ) + .appendTo( uiDialogTitlebarClose ); + + uiDialogTitle = $( "" ) + .uniqueId() + .addClass( "ui-dialog-title" ) + .html( title ) + .prependTo( uiDialogTitlebar ); + + uiDialogButtonPane = ( this.uiDialogButtonPane = $( "
    " ) ) + .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" ); + + ( this.uiButtonSet = $( "
    " ) ) + .addClass( "ui-dialog-buttonset" ) + .appendTo( uiDialogButtonPane ); + + uiDialog.attr({ + role: "dialog", + "aria-labelledby": uiDialogTitle.attr( "id" ) + }); + + uiDialogTitlebar.find( "*" ).add( uiDialogTitlebar ).disableSelection(); + this._hoverable( uiDialogTitlebarClose ); + this._focusable( uiDialogTitlebarClose ); + + if ( options.draggable && $.fn.draggable ) { + this._makeDraggable(); + } + if ( options.resizable && $.fn.resizable ) { + this._makeResizable(); + } + + this._createButtons( options.buttons ); + this._isOpen = false; + + if ( $.fn.bgiframe ) { + uiDialog.bgiframe(); + } + + // prevent tabbing out of modal dialogs + this._on( uiDialog, { keydown: function( event ) { + if ( !options.modal || event.keyCode !== $.ui.keyCode.TAB ) { + return; + } + + var tabbables = $( ":tabbable", uiDialog ), + first = tabbables.filter( ":first" ), + last = tabbables.filter( ":last" ); + + if ( event.target === last[0] && !event.shiftKey ) { + first.focus( 1 ); + return false; + } else if ( event.target === first[0] && event.shiftKey ) { + last.focus( 1 ); + return false; + } + }}); + }, + + _init: function() { + if ( this.options.autoOpen ) { + this.open(); + } + }, + + _destroy: function() { + var next, + oldPosition = this.oldPosition; + + if ( this.overlay ) { + this.overlay.destroy(); + } + this.uiDialog.hide(); + this.element + .removeClass( "ui-dialog-content ui-widget-content" ) + .hide() + .appendTo( "body" ); + this.uiDialog.remove(); + + if ( this.originalTitle ) { + this.element.attr( "title", this.originalTitle ); + } + + next = oldPosition.parent.children().eq( oldPosition.index ); + // Don't try to place the dialog next to itself (#8613) + if ( next.length && next[ 0 ] !== this.element[ 0 ] ) { + next.before( this.element ); + } else { + oldPosition.parent.append( this.element ); + } + }, + + widget: function() { + return this.uiDialog; + }, + + close: function( event ) { + var that = this, + maxZ, thisZ; + + if ( !this._isOpen ) { + return; + } + + if ( false === this._trigger( "beforeClose", event ) ) { + return; + } + + this._isOpen = false; + + if ( this.overlay ) { + this.overlay.destroy(); + } + + if ( this.options.hide ) { + this._hide( this.uiDialog, this.options.hide, function() { + that._trigger( "close", event ); + }); + } else { + this.uiDialog.hide(); + this._trigger( "close", event ); + } + + $.ui.dialog.overlay.resize(); + + // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) + if ( this.options.modal ) { + maxZ = 0; + $( ".ui-dialog" ).each(function() { + if ( this !== that.uiDialog[0] ) { + thisZ = $( this ).css( "z-index" ); + if ( !isNaN( thisZ ) ) { + maxZ = Math.max( maxZ, thisZ ); + } + } + }); + $.ui.dialog.maxZ = maxZ; + } + + return this; + }, + + isOpen: function() { + return this._isOpen; + }, + + // the force parameter allows us to move modal dialogs to their correct + // position on open + moveToTop: function( force, event ) { + var options = this.options, + saveScroll; + + if ( ( options.modal && !force ) || + ( !options.stack && !options.modal ) ) { + return this._trigger( "focus", event ); + } + + if ( options.zIndex > $.ui.dialog.maxZ ) { + $.ui.dialog.maxZ = options.zIndex; + } + if ( this.overlay ) { + $.ui.dialog.maxZ += 1; + $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ; + this.overlay.$el.css( "z-index", $.ui.dialog.overlay.maxZ ); + } + + // Save and then restore scroll + // Opera 9.5+ resets when parent z-index is changed. + // http://bugs.jqueryui.com/ticket/3193 + saveScroll = { + scrollTop: this.element.scrollTop(), + scrollLeft: this.element.scrollLeft() + }; + $.ui.dialog.maxZ += 1; + this.uiDialog.css( "z-index", $.ui.dialog.maxZ ); + this.element.attr( saveScroll ); + this._trigger( "focus", event ); + + return this; + }, + + open: function() { + if ( this._isOpen ) { + return; + } + + var hasFocus, + options = this.options, + uiDialog = this.uiDialog; + + this._size(); + this._position( options.position ); + uiDialog.show( options.show ); + this.overlay = options.modal ? new $.ui.dialog.overlay( this ) : null; + this.moveToTop( true ); + + // set focus to the first tabbable element in the content area or the first button + // if there are no tabbable elements, set focus on the dialog itself + hasFocus = this.element.find( ":tabbable" ); + if ( !hasFocus.length ) { + hasFocus = this.uiDialogButtonPane.find( ":tabbable" ); + if ( !hasFocus.length ) { + hasFocus = uiDialog; + } + } + hasFocus.eq( 0 ).focus(); + + this._isOpen = true; + this._trigger( "open" ); + + return this; + }, + + _createButtons: function( buttons ) { + var that = this, + hasButtons = false; + + // if we already have a button pane, remove it + this.uiDialogButtonPane.remove(); + this.uiButtonSet.empty(); + + if ( typeof buttons === "object" && buttons !== null ) { + $.each( buttons, function() { + return !(hasButtons = true); + }); + } + if ( hasButtons ) { + $.each( buttons, function( name, props ) { + var button, click; + props = $.isFunction( props ) ? + { click: props, text: name } : + props; + // Default to a non-submitting button + props = $.extend( { type: "button" }, props ); + // Change the context for the click callback to be the main element + click = props.click; + props.click = function() { + click.apply( that.element[0], arguments ); + }; + button = $( "", props ) + .appendTo( that.uiButtonSet ); + if ( $.fn.button ) { + button.button(); + } + }); + this.uiDialog.addClass( "ui-dialog-buttons" ); + this.uiDialogButtonPane.appendTo( this.uiDialog ); + } else { + this.uiDialog.removeClass( "ui-dialog-buttons" ); + } + }, + + _makeDraggable: function() { + var that = this, + options = this.options; + + function filteredUi( ui ) { + return { + position: ui.position, + offset: ui.offset + }; + } + + this.uiDialog.draggable({ + cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", + handle: ".ui-dialog-titlebar", + containment: "document", + start: function( event, ui ) { + $( this ) + .addClass( "ui-dialog-dragging" ); + that._trigger( "dragStart", event, filteredUi( ui ) ); + }, + drag: function( event, ui ) { + that._trigger( "drag", event, filteredUi( ui ) ); + }, + stop: function( event, ui ) { + options.position = [ + ui.position.left - that.document.scrollLeft(), + ui.position.top - that.document.scrollTop() + ]; + $( this ) + .removeClass( "ui-dialog-dragging" ); + that._trigger( "dragStop", event, filteredUi( ui ) ); + $.ui.dialog.overlay.resize(); + } + }); + }, + + _makeResizable: function( handles ) { + handles = (handles === undefined ? this.options.resizable : handles); + var that = this, + options = this.options, + // .ui-resizable has position: relative defined in the stylesheet + // but dialogs have to use absolute or fixed positioning + position = this.uiDialog.css( "position" ), + resizeHandles = typeof handles === 'string' ? + handles : + "n,e,s,w,se,sw,ne,nw"; + + function filteredUi( ui ) { + return { + originalPosition: ui.originalPosition, + originalSize: ui.originalSize, + position: ui.position, + size: ui.size + }; + } + + this.uiDialog.resizable({ + cancel: ".ui-dialog-content", + containment: "document", + alsoResize: this.element, + maxWidth: options.maxWidth, + maxHeight: options.maxHeight, + minWidth: options.minWidth, + minHeight: this._minHeight(), + handles: resizeHandles, + start: function( event, ui ) { + $( this ).addClass( "ui-dialog-resizing" ); + that._trigger( "resizeStart", event, filteredUi( ui ) ); + }, + resize: function( event, ui ) { + that._trigger( "resize", event, filteredUi( ui ) ); + }, + stop: function( event, ui ) { + $( this ).removeClass( "ui-dialog-resizing" ); + options.height = $( this ).height(); + options.width = $( this ).width(); + that._trigger( "resizeStop", event, filteredUi( ui ) ); + $.ui.dialog.overlay.resize(); + } + }) + .css( "position", position ) + .find( ".ui-resizable-se" ) + .addClass( "ui-icon ui-icon-grip-diagonal-se" ); + }, + + _minHeight: function() { + var options = this.options; + + if ( options.height === "auto" ) { + return options.minHeight; + } else { + return Math.min( options.minHeight, options.height ); + } + }, + + _position: function( position ) { + var myAt = [], + offset = [ 0, 0 ], + isVisible; + + if ( position ) { + // deep extending converts arrays to objects in jQuery <= 1.3.2 :-( + // if (typeof position == 'string' || $.isArray(position)) { + // myAt = $.isArray(position) ? position : position.split(' '); + + if ( typeof position === "string" || (typeof position === "object" && "0" in position ) ) { + myAt = position.split ? position.split( " " ) : [ position[ 0 ], position[ 1 ] ]; + if ( myAt.length === 1 ) { + myAt[ 1 ] = myAt[ 0 ]; + } + + $.each( [ "left", "top" ], function( i, offsetPosition ) { + if ( +myAt[ i ] === myAt[ i ] ) { + offset[ i ] = myAt[ i ]; + myAt[ i ] = offsetPosition; + } + }); + + position = { + my: myAt[0] + (offset[0] < 0 ? offset[0] : "+" + offset[0]) + " " + + myAt[1] + (offset[1] < 0 ? offset[1] : "+" + offset[1]), + at: myAt.join( " " ) + }; + } + + position = $.extend( {}, $.ui.dialog.prototype.options.position, position ); + } else { + position = $.ui.dialog.prototype.options.position; + } + + // need to show the dialog to get the actual offset in the position plugin + isVisible = this.uiDialog.is( ":visible" ); + if ( !isVisible ) { + this.uiDialog.show(); + } + this.uiDialog.position( position ); + if ( !isVisible ) { + this.uiDialog.hide(); + } + }, + + _setOptions: function( options ) { + var that = this, + resizableOptions = {}, + resize = false; + + $.each( options, function( key, value ) { + that._setOption( key, value ); + + if ( key in sizeRelatedOptions ) { + resize = true; + } + if ( key in resizableRelatedOptions ) { + resizableOptions[ key ] = value; + } + }); + + if ( resize ) { + this._size(); + } + if ( this.uiDialog.is( ":data(resizable)" ) ) { + this.uiDialog.resizable( "option", resizableOptions ); + } + }, + + _setOption: function( key, value ) { + var isDraggable, isResizable, + uiDialog = this.uiDialog; + + switch ( key ) { + case "buttons": + this._createButtons( value ); + break; + case "closeText": + // ensure that we always pass a string + this.uiDialogTitlebarCloseText.text( "" + value ); + break; + case "dialogClass": + uiDialog + .removeClass( this.options.dialogClass ) + .addClass( uiDialogClasses + value ); + break; + case "disabled": + if ( value ) { + uiDialog.addClass( "ui-dialog-disabled" ); + } else { + uiDialog.removeClass( "ui-dialog-disabled" ); + } + break; + case "draggable": + isDraggable = uiDialog.is( ":data(draggable)" ); + if ( isDraggable && !value ) { + uiDialog.draggable( "destroy" ); + } + + if ( !isDraggable && value ) { + this._makeDraggable(); + } + break; + case "position": + this._position( value ); + break; + case "resizable": + // currently resizable, becoming non-resizable + isResizable = uiDialog.is( ":data(resizable)" ); + if ( isResizable && !value ) { + uiDialog.resizable( "destroy" ); + } + + // currently resizable, changing handles + if ( isResizable && typeof value === "string" ) { + uiDialog.resizable( "option", "handles", value ); + } + + // currently non-resizable, becoming resizable + if ( !isResizable && value !== false ) { + this._makeResizable( value ); + } + break; + case "title": + // convert whatever was passed in o a string, for html() to not throw up + $( ".ui-dialog-title", this.uiDialogTitlebar ) + .html( "" + ( value || " " ) ); + break; + } + + this._super( key, value ); + }, + + _size: function() { + /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content + * divs will both have width and height set, so we need to reset them + */ + var nonContentHeight, minContentHeight, autoHeight, + options = this.options, + isVisible = this.uiDialog.is( ":visible" ); + + // reset content sizing + this.element.show().css({ + width: "auto", + minHeight: 0, + height: 0 + }); + + if ( options.minWidth > options.width ) { + options.width = options.minWidth; + } + + // reset wrapper sizing + // determine the height of all the non-content elements + nonContentHeight = this.uiDialog.css({ + height: "auto", + width: options.width + }) + .outerHeight(); + minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); + + if ( options.height === "auto" ) { + // only needed for IE6 support + if ( $.support.minHeight ) { + this.element.css({ + minHeight: minContentHeight, + height: "auto" + }); + } else { + this.uiDialog.show(); + autoHeight = this.element.css( "height", "auto" ).height(); + if ( !isVisible ) { + this.uiDialog.hide(); + } + this.element.height( Math.max( autoHeight, minContentHeight ) ); + } + } else { + this.element.height( Math.max( options.height - nonContentHeight, 0 ) ); + } + + if (this.uiDialog.is( ":data(resizable)" ) ) { + this.uiDialog.resizable( "option", "minHeight", this._minHeight() ); + } + } +}); + +$.extend($.ui.dialog, { + uuid: 0, + maxZ: 0, + + getTitleId: function($el) { + var id = $el.attr( "id" ); + if ( !id ) { + this.uuid += 1; + id = this.uuid; + } + return "ui-dialog-title-" + id; + }, + + overlay: function( dialog ) { + this.$el = $.ui.dialog.overlay.create( dialog ); + } +}); + +$.extend( $.ui.dialog.overlay, { + instances: [], + // reuse old instances due to IE memory leak with alpha transparency (see #5185) + oldInstances: [], + maxZ: 0, + events: $.map( + "focus,mousedown,mouseup,keydown,keypress,click".split( "," ), + function( event ) { + return event + ".dialog-overlay"; + } + ).join( " " ), + create: function( dialog ) { + if ( this.instances.length === 0 ) { + // prevent use of anchors and inputs + // we use a setTimeout in case the overlay is created from an + // event that we're going to be cancelling (see #2804) + setTimeout(function() { + // handle $(el).dialog().dialog('close') (see #4065) + if ( $.ui.dialog.overlay.instances.length ) { + $( document ).bind( $.ui.dialog.overlay.events, function( event ) { + // stop events if the z-index of the target is < the z-index of the overlay + // we cannot return true when we don't want to cancel the event (#3523) + if ( $( event.target ).zIndex() < $.ui.dialog.overlay.maxZ ) { + return false; + } + }); + } + }, 1 ); + + // handle window resize + $( window ).bind( "resize.dialog-overlay", $.ui.dialog.overlay.resize ); + } + + var $el = ( this.oldInstances.pop() || $( "
    " ).addClass( "ui-widget-overlay" ) ); + + // allow closing by pressing the escape key + $( document ).bind( "keydown.dialog-overlay", function( event ) { + var instances = $.ui.dialog.overlay.instances; + // only react to the event if we're the top overlay + if ( instances.length !== 0 && instances[ instances.length - 1 ] === $el && + dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && + event.keyCode === $.ui.keyCode.ESCAPE ) { + + dialog.close( event ); + event.preventDefault(); + } + }); + + $el.appendTo( document.body ).css({ + width: this.width(), + height: this.height() + }); + + if ( $.fn.bgiframe ) { + $el.bgiframe(); + } + + this.instances.push( $el ); + return $el; + }, + + destroy: function( $el ) { + var indexOf = $.inArray( $el, this.instances ), + maxZ = 0; + + if ( indexOf !== -1 ) { + this.oldInstances.push( this.instances.splice( indexOf, 1 )[ 0 ] ); + } + + if ( this.instances.length === 0 ) { + $( [ document, window ] ).unbind( ".dialog-overlay" ); + } + + $el.height( 0 ).width( 0 ).remove(); + + // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) + $.each( this.instances, function() { + maxZ = Math.max( maxZ, this.css( "z-index" ) ); + }); + this.maxZ = maxZ; + }, + + height: function() { + var scrollHeight, + offsetHeight; + // handle IE + if ( $.ui.ie ) { + scrollHeight = Math.max( + document.documentElement.scrollHeight, + document.body.scrollHeight + ); + offsetHeight = Math.max( + document.documentElement.offsetHeight, + document.body.offsetHeight + ); + + if ( scrollHeight < offsetHeight ) { + return $( window ).height() + "px"; + } else { + return scrollHeight + "px"; + } + // handle "good" browsers + } else { + return $( document ).height() + "px"; + } + }, + + width: function() { + var scrollWidth, + offsetWidth; + // handle IE + if ( $.ui.ie ) { + scrollWidth = Math.max( + document.documentElement.scrollWidth, + document.body.scrollWidth + ); + offsetWidth = Math.max( + document.documentElement.offsetWidth, + document.body.offsetWidth + ); + + if ( scrollWidth < offsetWidth ) { + return $( window ).width() + "px"; + } else { + return scrollWidth + "px"; + } + // handle "good" browsers + } else { + return $( document ).width() + "px"; + } + }, + + resize: function() { + /* If the dialog is draggable and the user drags it past the + * right edge of the window, the document becomes wider so we + * need to stretch the overlay. If the user then drags the + * dialog back to the left, the document will become narrower, + * so we need to shrink the overlay to the appropriate size. + * This is handled by shrinking the overlay before setting it + * to the full document size. + */ + var $overlays = $( [] ); + $.each( $.ui.dialog.overlay.instances, function() { + $overlays = $overlays.add( this ); + }); + + $overlays.css({ + width: 0, + height: 0 + }).css({ + width: $.ui.dialog.overlay.width(), + height: $.ui.dialog.overlay.height() + }); + } +}); + +$.extend( $.ui.dialog.overlay.prototype, { + destroy: function() { + $.ui.dialog.overlay.destroy( this.$el ); + } +}); + +}( jQuery ) ); +(function( $, undefined ) { + +$.widget("ui.draggable", $.ui.mouse, { + version: "1.9.2", + widgetEventPrefix: "drag", + options: { + addClasses: true, + appendTo: "parent", + axis: false, + connectToSortable: false, + containment: false, + cursor: "auto", + cursorAt: false, + grid: false, + handle: false, + helper: "original", + iframeFix: false, + opacity: false, + refreshPositions: false, + revert: false, + revertDuration: 500, + scope: "default", + scroll: true, + scrollSensitivity: 20, + scrollSpeed: 20, + snap: false, + snapMode: "both", + snapTolerance: 20, + stack: false, + zIndex: false + }, + _create: function() { + + if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position"))) + this.element[0].style.position = 'relative'; + + (this.options.addClasses && this.element.addClass("ui-draggable")); + (this.options.disabled && this.element.addClass("ui-draggable-disabled")); + + this._mouseInit(); + + }, + + _destroy: function() { + this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" ); + this._mouseDestroy(); + }, + + _mouseCapture: function(event) { + + var o = this.options; + + // among others, prevent a drag on a resizable-handle + if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle')) + return false; + + //Quit if we're not on a valid handle + this.handle = this._getHandle(event); + if (!this.handle) + return false; + + $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { + $('
    ') + .css({ + width: this.offsetWidth+"px", height: this.offsetHeight+"px", + position: "absolute", opacity: "0.001", zIndex: 1000 + }) + .css($(this).offset()) + .appendTo("body"); + }); + + return true; + + }, + + _mouseStart: function(event) { + + var o = this.options; + + //Create and append the visible helper + this.helper = this._createHelper(event); + + this.helper.addClass("ui-draggable-dragging"); + + //Cache the helper size + this._cacheHelperProportions(); + + //If ddmanager is used for droppables, set the global draggable + if($.ui.ddmanager) + $.ui.ddmanager.current = this; + + /* + * - Position generation - + * This block generates everything position related - it's the core of draggables. + */ + + //Cache the margins of the original element + this._cacheMargins(); + + //Store the helper's css position + this.cssPosition = this.helper.css("position"); + this.scrollParent = this.helper.scrollParent(); + + //The element's absolute position on the page minus margins + this.offset = this.positionAbs = this.element.offset(); + this.offset = { + top: this.offset.top - this.margins.top, + left: this.offset.left - this.margins.left + }; + + $.extend(this.offset, { + click: { //Where the click happened, relative to the element + left: event.pageX - this.offset.left, + top: event.pageY - this.offset.top + }, + parent: this._getParentOffset(), + relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper + }); + + //Generate the original position + this.originalPosition = this.position = this._generatePosition(event); + this.originalPageX = event.pageX; + this.originalPageY = event.pageY; + + //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied + (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); + + //Set a containment if given in the options + if(o.containment) + this._setContainment(); + + //Trigger event + callbacks + if(this._trigger("start", event) === false) { + this._clear(); + return false; + } + + //Recache the helper size + this._cacheHelperProportions(); + + //Prepare the droppable offsets + if ($.ui.ddmanager && !o.dropBehaviour) + $.ui.ddmanager.prepareOffsets(this, event); + + + this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position + + //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003) + if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event); + + return true; + }, + + _mouseDrag: function(event, noPropagation) { + + //Compute the helpers position + this.position = this._generatePosition(event); + this.positionAbs = this._convertPositionTo("absolute"); + + //Call plugins and callbacks and use the resulting position if something is returned + if (!noPropagation) { + var ui = this._uiHash(); + if(this._trigger('drag', event, ui) === false) { + this._mouseUp({}); + return false; + } + this.position = ui.position; + } + + if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; + if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; + if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); + + return false; + }, + + _mouseStop: function(event) { + + //If we are using droppables, inform the manager about the drop + var dropped = false; + if ($.ui.ddmanager && !this.options.dropBehaviour) + dropped = $.ui.ddmanager.drop(this, event); + + //if a drop comes from outside (a sortable) + if(this.dropped) { + dropped = this.dropped; + this.dropped = false; + } + + //if the original element is no longer in the DOM don't bother to continue (see #8269) + var element = this.element[0], elementInDom = false; + while ( element && (element = element.parentNode) ) { + if (element == document ) { + elementInDom = true; + } + } + if ( !elementInDom && this.options.helper === "original" ) + return false; + + if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { + var that = this; + $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { + if(that._trigger("stop", event) !== false) { + that._clear(); + } + }); + } else { + if(this._trigger("stop", event) !== false) { + this._clear(); + } + } + + return false; + }, + + _mouseUp: function(event) { + //Remove frame helpers + $("div.ui-draggable-iframeFix").each(function() { + this.parentNode.removeChild(this); + }); + + //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) + if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event); + + return $.ui.mouse.prototype._mouseUp.call(this, event); + }, + + cancel: function() { + + if(this.helper.is(".ui-draggable-dragging")) { + this._mouseUp({}); + } else { + this._clear(); + } + + return this; + + }, + + _getHandle: function(event) { + + var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false; + $(this.options.handle, this.element) + .find("*") + .andSelf() + .each(function() { + if(this == event.target) handle = true; + }); + + return handle; + + }, + + _createHelper: function(event) { + + var o = this.options; + var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element); + + if(!helper.parents('body').length) + helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo)); + + if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) + helper.css("position", "absolute"); + + return helper; + + }, + + _adjustOffsetFromHelper: function(obj) { + if (typeof obj == 'string') { + obj = obj.split(' '); + } + if ($.isArray(obj)) { + obj = {left: +obj[0], top: +obj[1] || 0}; + } + if ('left' in obj) { + this.offset.click.left = obj.left + this.margins.left; + } + if ('right' in obj) { + this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; + } + if ('top' in obj) { + this.offset.click.top = obj.top + this.margins.top; + } + if ('bottom' in obj) { + this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; + } + }, + + _getParentOffset: function() { + + //Get the offsetParent and cache its position + this.offsetParent = this.helper.offsetParent(); + var po = this.offsetParent.offset(); + + // This is a special case where we need to modify a offset calculated on start, since the following happened: + // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent + // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that + // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag + if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) { + po.left += this.scrollParent.scrollLeft(); + po.top += this.scrollParent.scrollTop(); + } + + if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information + || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix + po = { top: 0, left: 0 }; + + return { + top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), + left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) + }; + + }, + + _getRelativeOffset: function() { + + if(this.cssPosition == "relative") { + var p = this.element.position(); + return { + top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), + left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() + }; + } else { + return { top: 0, left: 0 }; + } + + }, + + _cacheMargins: function() { + this.margins = { + left: (parseInt(this.element.css("marginLeft"),10) || 0), + top: (parseInt(this.element.css("marginTop"),10) || 0), + right: (parseInt(this.element.css("marginRight"),10) || 0), + bottom: (parseInt(this.element.css("marginBottom"),10) || 0) + }; + }, + + _cacheHelperProportions: function() { + this.helperProportions = { + width: this.helper.outerWidth(), + height: this.helper.outerHeight() + }; + }, + + _setContainment: function() { + + var o = this.options; + if(o.containment == 'parent') o.containment = this.helper[0].parentNode; + if(o.containment == 'document' || o.containment == 'window') this.containment = [ + o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, + o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, + (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, + (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top + ]; + + if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) { + var c = $(o.containment); + var ce = c[0]; if(!ce) return; + var co = c.offset(); + var over = ($(ce).css("overflow") != 'hidden'); + + this.containment = [ + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0), + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0), + (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right, + (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom + ]; + this.relative_container = c; + + } else if(o.containment.constructor == Array) { + this.containment = o.containment; + } + + }, + + _convertPositionTo: function(d, pos) { + + if(!pos) pos = this.position; + var mod = d == "absolute" ? 1 : -1; + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + + return { + top: ( + pos.top // The absolute mouse position + + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent + + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) + - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) + ), + left: ( + pos.left // The absolute mouse position + + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent + + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) + - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) + ) + }; + + }, + + _generatePosition: function(event) { + + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + var pageX = event.pageX; + var pageY = event.pageY; + + /* + * - Position constraining - + * Constrain the position to a mix of grid, containment. + */ + + if(this.originalPosition) { //If we are not dragging yet, we won't check for options + var containment; + if(this.containment) { + if (this.relative_container){ + var co = this.relative_container.offset(); + containment = [ this.containment[0] + co.left, + this.containment[1] + co.top, + this.containment[2] + co.left, + this.containment[3] + co.top ]; + } + else { + containment = this.containment; + } + + if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left; + if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top; + if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left; + if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top; + } + + if(o.grid) { + //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950) + var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; + pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; + + var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX; + pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; + } + + } + + return { + top: ( + pageY // The absolute mouse position + - this.offset.click.top // Click offset (relative to the element) + - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent + - this.offset.parent.top // The offsetParent's offset without borders (offset + border) + + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) + ), + left: ( + pageX // The absolute mouse position + - this.offset.click.left // Click offset (relative to the element) + - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent + - this.offset.parent.left // The offsetParent's offset without borders (offset + border) + + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) + ) + }; + + }, + + _clear: function() { + this.helper.removeClass("ui-draggable-dragging"); + if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove(); + //if($.ui.ddmanager) $.ui.ddmanager.current = null; + this.helper = null; + this.cancelHelperRemoval = false; + }, + + // From now on bulk stuff - mainly helpers + + _trigger: function(type, event, ui) { + ui = ui || this._uiHash(); + $.ui.plugin.call(this, type, [event, ui]); + if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins + return $.Widget.prototype._trigger.call(this, type, event, ui); + }, + + plugins: {}, + + _uiHash: function(event) { + return { + helper: this.helper, + position: this.position, + originalPosition: this.originalPosition, + offset: this.positionAbs + }; + } + +}); + +$.ui.plugin.add("draggable", "connectToSortable", { + start: function(event, ui) { + + var inst = $(this).data("draggable"), o = inst.options, + uiSortable = $.extend({}, ui, { item: inst.element }); + inst.sortables = []; + $(o.connectToSortable).each(function() { + var sortable = $.data(this, 'sortable'); + if (sortable && !sortable.options.disabled) { + inst.sortables.push({ + instance: sortable, + shouldRevert: sortable.options.revert + }); + sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page). + sortable._trigger("activate", event, uiSortable); + } + }); + + }, + stop: function(event, ui) { + + //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper + var inst = $(this).data("draggable"), + uiSortable = $.extend({}, ui, { item: inst.element }); + + $.each(inst.sortables, function() { + if(this.instance.isOver) { + + this.instance.isOver = 0; + + inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance + this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) + + //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid' + if(this.shouldRevert) this.instance.options.revert = true; + + //Trigger the stop of the sortable + this.instance._mouseStop(event); + + this.instance.options.helper = this.instance.options._helper; + + //If the helper has been the original item, restore properties in the sortable + if(inst.options.helper == 'original') + this.instance.currentItem.css({ top: 'auto', left: 'auto' }); + + } else { + this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance + this.instance._trigger("deactivate", event, uiSortable); + } + + }); + + }, + drag: function(event, ui) { + + var inst = $(this).data("draggable"), that = this; + + var checkPos = function(o) { + var dyClick = this.offset.click.top, dxClick = this.offset.click.left; + var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left; + var itemHeight = o.height, itemWidth = o.width; + var itemTop = o.top, itemLeft = o.left; + + return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth); + }; + + $.each(inst.sortables, function(i) { + + var innermostIntersecting = false; + var thisSortable = this; + //Copy over some variables to allow calling the sortable's native _intersectsWith + this.instance.positionAbs = inst.positionAbs; + this.instance.helperProportions = inst.helperProportions; + this.instance.offset.click = inst.offset.click; + + if(this.instance._intersectsWith(this.instance.containerCache)) { + innermostIntersecting = true; + $.each(inst.sortables, function () { + this.instance.positionAbs = inst.positionAbs; + this.instance.helperProportions = inst.helperProportions; + this.instance.offset.click = inst.offset.click; + if (this != thisSortable + && this.instance._intersectsWith(this.instance.containerCache) + && $.ui.contains(thisSortable.instance.element[0], this.instance.element[0])) + innermostIntersecting = false; + return innermostIntersecting; + }); + } + + + if(innermostIntersecting) { + //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once + if(!this.instance.isOver) { + + this.instance.isOver = 1; + //Now we fake the start of dragging for the sortable instance, + //by cloning the list group item, appending it to the sortable and using it as inst.currentItem + //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one) + this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true); + this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it + this.instance.options.helper = function() { return ui.helper[0]; }; + + event.target = this.instance.currentItem[0]; + this.instance._mouseCapture(event, true); + this.instance._mouseStart(event, true, true); + + //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes + this.instance.offset.click.top = inst.offset.click.top; + this.instance.offset.click.left = inst.offset.click.left; + this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left; + this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top; + + inst._trigger("toSortable", event); + inst.dropped = this.instance.element; //draggable revert needs that + //hack so receive/update callbacks work (mostly) + inst.currentItem = inst.element; + this.instance.fromOutside = inst; + + } + + //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable + if(this.instance.currentItem) this.instance._mouseDrag(event); + + } else { + + //If it doesn't intersect with the sortable, and it intersected before, + //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval + if(this.instance.isOver) { + + this.instance.isOver = 0; + this.instance.cancelHelperRemoval = true; + + //Prevent reverting on this forced stop + this.instance.options.revert = false; + + // The out event needs to be triggered independently + this.instance._trigger('out', event, this.instance._uiHash(this.instance)); + + this.instance._mouseStop(event, true); + this.instance.options.helper = this.instance.options._helper; + + //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size + this.instance.currentItem.remove(); + if(this.instance.placeholder) this.instance.placeholder.remove(); + + inst._trigger("fromSortable", event); + inst.dropped = false; //draggable revert needs that + } + + }; + + }); + + } +}); + +$.ui.plugin.add("draggable", "cursor", { + start: function(event, ui) { + var t = $('body'), o = $(this).data('draggable').options; + if (t.css("cursor")) o._cursor = t.css("cursor"); + t.css("cursor", o.cursor); + }, + stop: function(event, ui) { + var o = $(this).data('draggable').options; + if (o._cursor) $('body').css("cursor", o._cursor); + } +}); + +$.ui.plugin.add("draggable", "opacity", { + start: function(event, ui) { + var t = $(ui.helper), o = $(this).data('draggable').options; + if(t.css("opacity")) o._opacity = t.css("opacity"); + t.css('opacity', o.opacity); + }, + stop: function(event, ui) { + var o = $(this).data('draggable').options; + if(o._opacity) $(ui.helper).css('opacity', o._opacity); + } +}); + +$.ui.plugin.add("draggable", "scroll", { + start: function(event, ui) { + var i = $(this).data("draggable"); + if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset(); + }, + drag: function(event, ui) { + + var i = $(this).data("draggable"), o = i.options, scrolled = false; + + if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') { + + if(!o.axis || o.axis != 'x') { + if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) + i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed; + else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) + i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed; + } + + if(!o.axis || o.axis != 'y') { + if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) + i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed; + else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) + i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed; + } + + } else { + + if(!o.axis || o.axis != 'x') { + if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) + scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); + else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) + scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); + } + + if(!o.axis || o.axis != 'y') { + if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) + scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); + else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) + scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); + } + + } + + if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) + $.ui.ddmanager.prepareOffsets(i, event); + + } +}); + +$.ui.plugin.add("draggable", "snap", { + start: function(event, ui) { + + var i = $(this).data("draggable"), o = i.options; + i.snapElements = []; + + $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() { + var $t = $(this); var $o = $t.offset(); + if(this != i.element[0]) i.snapElements.push({ + item: this, + width: $t.outerWidth(), height: $t.outerHeight(), + top: $o.top, left: $o.left + }); + }); + + }, + drag: function(event, ui) { + + var inst = $(this).data("draggable"), o = inst.options; + var d = o.snapTolerance; + + var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, + y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; + + for (var i = inst.snapElements.length - 1; i >= 0; i--){ + + var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width, + t = inst.snapElements[i].top, b = t + inst.snapElements[i].height; + + //Yes, I know, this is insane ;) + if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) { + if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); + inst.snapElements[i].snapping = false; + continue; + } + + if(o.snapMode != 'inner') { + var ts = Math.abs(t - y2) <= d; + var bs = Math.abs(b - y1) <= d; + var ls = Math.abs(l - x2) <= d; + var rs = Math.abs(r - x1) <= d; + if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top; + if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top; + if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left; + if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left; + } + + var first = (ts || bs || ls || rs); + + if(o.snapMode != 'outer') { + var ts = Math.abs(t - y1) <= d; + var bs = Math.abs(b - y2) <= d; + var ls = Math.abs(l - x1) <= d; + var rs = Math.abs(r - x2) <= d; + if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top; + if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top; + if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left; + if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left; + } + + if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) + (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); + inst.snapElements[i].snapping = (ts || bs || ls || rs || first); + + }; + + } +}); + +$.ui.plugin.add("draggable", "stack", { + start: function(event, ui) { + + var o = $(this).data("draggable").options; + + var group = $.makeArray($(o.stack)).sort(function(a,b) { + return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0); + }); + if (!group.length) { return; } + + var min = parseInt(group[0].style.zIndex) || 0; + $(group).each(function(i) { + this.style.zIndex = min + i; + }); + + this[0].style.zIndex = min + group.length; + + } +}); + +$.ui.plugin.add("draggable", "zIndex", { + start: function(event, ui) { + var t = $(ui.helper), o = $(this).data("draggable").options; + if(t.css("zIndex")) o._zIndex = t.css("zIndex"); + t.css('zIndex', o.zIndex); + }, + stop: function(event, ui) { + var o = $(this).data("draggable").options; + if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex); + } +}); + +})(jQuery); +(function( $, undefined ) { + +$.widget("ui.droppable", { + version: "1.9.2", + widgetEventPrefix: "drop", + options: { + accept: '*', + activeClass: false, + addClasses: true, + greedy: false, + hoverClass: false, + scope: 'default', + tolerance: 'intersect' + }, + _create: function() { + + var o = this.options, accept = o.accept; + this.isover = 0; this.isout = 1; + + this.accept = $.isFunction(accept) ? accept : function(d) { + return d.is(accept); + }; + + //Store the droppable's proportions + this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight }; + + // Add the reference and positions to the manager + $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || []; + $.ui.ddmanager.droppables[o.scope].push(this); + + (o.addClasses && this.element.addClass("ui-droppable")); + + }, + + _destroy: function() { + var drop = $.ui.ddmanager.droppables[this.options.scope]; + for ( var i = 0; i < drop.length; i++ ) + if ( drop[i] == this ) + drop.splice(i, 1); + + this.element.removeClass("ui-droppable ui-droppable-disabled"); + }, + + _setOption: function(key, value) { + + if(key == 'accept') { + this.accept = $.isFunction(value) ? value : function(d) { + return d.is(value); + }; + } + $.Widget.prototype._setOption.apply(this, arguments); + }, + + _activate: function(event) { + var draggable = $.ui.ddmanager.current; + if(this.options.activeClass) this.element.addClass(this.options.activeClass); + (draggable && this._trigger('activate', event, this.ui(draggable))); + }, + + _deactivate: function(event) { + var draggable = $.ui.ddmanager.current; + if(this.options.activeClass) this.element.removeClass(this.options.activeClass); + (draggable && this._trigger('deactivate', event, this.ui(draggable))); + }, + + _over: function(event) { + + var draggable = $.ui.ddmanager.current; + if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element + + if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { + if(this.options.hoverClass) this.element.addClass(this.options.hoverClass); + this._trigger('over', event, this.ui(draggable)); + } + + }, + + _out: function(event) { + + var draggable = $.ui.ddmanager.current; + if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element + + if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { + if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); + this._trigger('out', event, this.ui(draggable)); + } + + }, + + _drop: function(event,custom) { + + var draggable = custom || $.ui.ddmanager.current; + if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element + + var childrenIntersection = false; + this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() { + var inst = $.data(this, 'droppable'); + if( + inst.options.greedy + && !inst.options.disabled + && inst.options.scope == draggable.options.scope + && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) + && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance) + ) { childrenIntersection = true; return false; } + }); + if(childrenIntersection) return false; + + if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { + if(this.options.activeClass) this.element.removeClass(this.options.activeClass); + if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); + this._trigger('drop', event, this.ui(draggable)); + return this.element; + } + + return false; + + }, + + ui: function(c) { + return { + draggable: (c.currentItem || c.element), + helper: c.helper, + position: c.position, + offset: c.positionAbs + }; + } + +}); + +$.ui.intersect = function(draggable, droppable, toleranceMode) { + + if (!droppable.offset) return false; + + var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width, + y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height; + var l = droppable.offset.left, r = l + droppable.proportions.width, + t = droppable.offset.top, b = t + droppable.proportions.height; + + switch (toleranceMode) { + case 'fit': + return (l <= x1 && x2 <= r + && t <= y1 && y2 <= b); + break; + case 'intersect': + return (l < x1 + (draggable.helperProportions.width / 2) // Right Half + && x2 - (draggable.helperProportions.width / 2) < r // Left Half + && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half + && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half + break; + case 'pointer': + var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left), + draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top), + isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width); + return isOver; + break; + case 'touch': + return ( + (y1 >= t && y1 <= b) || // Top edge touching + (y2 >= t && y2 <= b) || // Bottom edge touching + (y1 < t && y2 > b) // Surrounded vertically + ) && ( + (x1 >= l && x1 <= r) || // Left edge touching + (x2 >= l && x2 <= r) || // Right edge touching + (x1 < l && x2 > r) // Surrounded horizontally + ); + break; + default: + return false; + break; + } + +}; + +/* + This manager tracks offsets of draggables and droppables +*/ +$.ui.ddmanager = { + current: null, + droppables: { 'default': [] }, + prepareOffsets: function(t, event) { + + var m = $.ui.ddmanager.droppables[t.options.scope] || []; + var type = event ? event.type : null; // workaround for #2317 + var list = (t.currentItem || t.element).find(":data(droppable)").andSelf(); + + droppablesLoop: for (var i = 0; i < m.length; i++) { + + if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted + for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item + m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue + + if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables + + m[i].offset = m[i].element.offset(); + m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }; + + } + + }, + drop: function(draggable, event) { + + var dropped = false; + $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { + + if(!this.options) return; + if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) + dropped = this._drop.call(this, event) || dropped; + + if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { + this.isout = 1; this.isover = 0; + this._deactivate.call(this, event); + } + + }); + return dropped; + + }, + dragStart: function( draggable, event ) { + //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003) + draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() { + if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); + }); + }, + drag: function(draggable, event) { + + //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. + if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event); + + //Run through all droppables and check their positions based on specific tolerance options + $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { + + if(this.options.disabled || this.greedyChild || !this.visible) return; + var intersects = $.ui.intersect(draggable, this, this.options.tolerance); + + var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null); + if(!c) return; + + var parentInstance; + if (this.options.greedy) { + // find droppable parents with same scope + var scope = this.options.scope; + var parent = this.element.parents(':data(droppable)').filter(function () { + return $.data(this, 'droppable').options.scope === scope; + }); + + if (parent.length) { + parentInstance = $.data(parent[0], 'droppable'); + parentInstance.greedyChild = (c == 'isover' ? 1 : 0); + } + } + + // we just moved into a greedy child + if (parentInstance && c == 'isover') { + parentInstance['isover'] = 0; + parentInstance['isout'] = 1; + parentInstance._out.call(parentInstance, event); + } + + this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0; + this[c == "isover" ? "_over" : "_out"].call(this, event); + + // we just moved out of a greedy child + if (parentInstance && c == 'isout') { + parentInstance['isout'] = 0; + parentInstance['isover'] = 1; + parentInstance._over.call(parentInstance, event); + } + }); + + }, + dragStop: function( draggable, event ) { + draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" ); + //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003) + if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); + } +}; + +})(jQuery); +;(jQuery.effects || (function($, undefined) { + +var backCompat = $.uiBackCompat !== false, + // prefix used for storing data on .data() + dataSpace = "ui-effects-"; + +$.effects = { + effect: {} +}; + +/*! + * jQuery Color Animations v2.0.0 + * http://jquery.com/ + * + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + * + * Date: Mon Aug 13 13:41:02 2012 -0500 + */ +(function( jQuery, undefined ) { + + var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor".split(" "), + + // plusequals test for += 100 -= 100 + rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, + // a set of RE's that can match strings and generate color tuples. + stringParsers = [{ + re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, + parse: function( execResult ) { + return [ + execResult[ 1 ], + execResult[ 2 ], + execResult[ 3 ], + execResult[ 4 ] + ]; + } + }, { + re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, + parse: function( execResult ) { + return [ + execResult[ 1 ] * 2.55, + execResult[ 2 ] * 2.55, + execResult[ 3 ] * 2.55, + execResult[ 4 ] + ]; + } + }, { + // this regex ignores A-F because it's compared against an already lowercased string + re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, + parse: function( execResult ) { + return [ + parseInt( execResult[ 1 ], 16 ), + parseInt( execResult[ 2 ], 16 ), + parseInt( execResult[ 3 ], 16 ) + ]; + } + }, { + // this regex ignores A-F because it's compared against an already lowercased string + re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, + parse: function( execResult ) { + return [ + parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), + parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), + parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ) + ]; + } + }, { + re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, + space: "hsla", + parse: function( execResult ) { + return [ + execResult[ 1 ], + execResult[ 2 ] / 100, + execResult[ 3 ] / 100, + execResult[ 4 ] + ]; + } + }], + + // jQuery.Color( ) + color = jQuery.Color = function( color, green, blue, alpha ) { + return new jQuery.Color.fn.parse( color, green, blue, alpha ); + }, + spaces = { + rgba: { + props: { + red: { + idx: 0, + type: "byte" + }, + green: { + idx: 1, + type: "byte" + }, + blue: { + idx: 2, + type: "byte" + } + } + }, + + hsla: { + props: { + hue: { + idx: 0, + type: "degrees" + }, + saturation: { + idx: 1, + type: "percent" + }, + lightness: { + idx: 2, + type: "percent" + } + } + } + }, + propTypes = { + "byte": { + floor: true, + max: 255 + }, + "percent": { + max: 1 + }, + "degrees": { + mod: 360, + floor: true + } + }, + support = color.support = {}, + + // element for support tests + supportElem = jQuery( "

    " )[ 0 ], + + // colors = jQuery.Color.names + colors, + + // local aliases of functions called often + each = jQuery.each; + +// determine rgba support immediately +supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; +support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; + +// define cache name and alpha properties +// for rgba and hsla spaces +each( spaces, function( spaceName, space ) { + space.cache = "_" + spaceName; + space.props.alpha = { + idx: 3, + type: "percent", + def: 1 + }; +}); + +function clamp( value, prop, allowEmpty ) { + var type = propTypes[ prop.type ] || {}; + + if ( value == null ) { + return (allowEmpty || !prop.def) ? null : prop.def; + } + + // ~~ is an short way of doing floor for positive numbers + value = type.floor ? ~~value : parseFloat( value ); + + // IE will pass in empty strings as value for alpha, + // which will hit this case + if ( isNaN( value ) ) { + return prop.def; + } + + if ( type.mod ) { + // we add mod before modding to make sure that negatives values + // get converted properly: -10 -> 350 + return (value + type.mod) % type.mod; + } + + // for now all property types without mod have min and max + return 0 > value ? 0 : type.max < value ? type.max : value; +} + +function stringParse( string ) { + var inst = color(), + rgba = inst._rgba = []; + + string = string.toLowerCase(); + + each( stringParsers, function( i, parser ) { + var parsed, + match = parser.re.exec( string ), + values = match && parser.parse( match ), + spaceName = parser.space || "rgba"; + + if ( values ) { + parsed = inst[ spaceName ]( values ); + + // if this was an rgba parse the assignment might happen twice + // oh well.... + inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; + rgba = inst._rgba = parsed._rgba; + + // exit each( stringParsers ) here because we matched + return false; + } + }); + + // Found a stringParser that handled it + if ( rgba.length ) { + + // if this came from a parsed string, force "transparent" when alpha is 0 + // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) + if ( rgba.join() === "0,0,0,0" ) { + jQuery.extend( rgba, colors.transparent ); + } + return inst; + } + + // named colors + return colors[ string ]; +} + +color.fn = jQuery.extend( color.prototype, { + parse: function( red, green, blue, alpha ) { + if ( red === undefined ) { + this._rgba = [ null, null, null, null ]; + return this; + } + if ( red.jquery || red.nodeType ) { + red = jQuery( red ).css( green ); + green = undefined; + } + + var inst = this, + type = jQuery.type( red ), + rgba = this._rgba = []; + + // more than 1 argument specified - assume ( red, green, blue, alpha ) + if ( green !== undefined ) { + red = [ red, green, blue, alpha ]; + type = "array"; + } + + if ( type === "string" ) { + return this.parse( stringParse( red ) || colors._default ); + } + + if ( type === "array" ) { + each( spaces.rgba.props, function( key, prop ) { + rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); + }); + return this; + } + + if ( type === "object" ) { + if ( red instanceof color ) { + each( spaces, function( spaceName, space ) { + if ( red[ space.cache ] ) { + inst[ space.cache ] = red[ space.cache ].slice(); + } + }); + } else { + each( spaces, function( spaceName, space ) { + var cache = space.cache; + each( space.props, function( key, prop ) { + + // if the cache doesn't exist, and we know how to convert + if ( !inst[ cache ] && space.to ) { + + // if the value was null, we don't need to copy it + // if the key was alpha, we don't need to copy it either + if ( key === "alpha" || red[ key ] == null ) { + return; + } + inst[ cache ] = space.to( inst._rgba ); + } + + // this is the only case where we allow nulls for ALL properties. + // call clamp with alwaysAllowEmpty + inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); + }); + + // everything defined but alpha? + if ( inst[ cache ] && $.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { + // use the default of 1 + inst[ cache ][ 3 ] = 1; + if ( space.from ) { + inst._rgba = space.from( inst[ cache ] ); + } + } + }); + } + return this; + } + }, + is: function( compare ) { + var is = color( compare ), + same = true, + inst = this; + + each( spaces, function( _, space ) { + var localCache, + isCache = is[ space.cache ]; + if (isCache) { + localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; + each( space.props, function( _, prop ) { + if ( isCache[ prop.idx ] != null ) { + same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); + return same; + } + }); + } + return same; + }); + return same; + }, + _space: function() { + var used = [], + inst = this; + each( spaces, function( spaceName, space ) { + if ( inst[ space.cache ] ) { + used.push( spaceName ); + } + }); + return used.pop(); + }, + transition: function( other, distance ) { + var end = color( other ), + spaceName = end._space(), + space = spaces[ spaceName ], + startColor = this.alpha() === 0 ? color( "transparent" ) : this, + start = startColor[ space.cache ] || space.to( startColor._rgba ), + result = start.slice(); + + end = end[ space.cache ]; + each( space.props, function( key, prop ) { + var index = prop.idx, + startValue = start[ index ], + endValue = end[ index ], + type = propTypes[ prop.type ] || {}; + + // if null, don't override start value + if ( endValue === null ) { + return; + } + // if null - use end + if ( startValue === null ) { + result[ index ] = endValue; + } else { + if ( type.mod ) { + if ( endValue - startValue > type.mod / 2 ) { + startValue += type.mod; + } else if ( startValue - endValue > type.mod / 2 ) { + startValue -= type.mod; + } + } + result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); + } + }); + return this[ spaceName ]( result ); + }, + blend: function( opaque ) { + // if we are already opaque - return ourself + if ( this._rgba[ 3 ] === 1 ) { + return this; + } + + var rgb = this._rgba.slice(), + a = rgb.pop(), + blend = color( opaque )._rgba; + + return color( jQuery.map( rgb, function( v, i ) { + return ( 1 - a ) * blend[ i ] + a * v; + })); + }, + toRgbaString: function() { + var prefix = "rgba(", + rgba = jQuery.map( this._rgba, function( v, i ) { + return v == null ? ( i > 2 ? 1 : 0 ) : v; + }); + + if ( rgba[ 3 ] === 1 ) { + rgba.pop(); + prefix = "rgb("; + } + + return prefix + rgba.join() + ")"; + }, + toHslaString: function() { + var prefix = "hsla(", + hsla = jQuery.map( this.hsla(), function( v, i ) { + if ( v == null ) { + v = i > 2 ? 1 : 0; + } + + // catch 1 and 2 + if ( i && i < 3 ) { + v = Math.round( v * 100 ) + "%"; + } + return v; + }); + + if ( hsla[ 3 ] === 1 ) { + hsla.pop(); + prefix = "hsl("; + } + return prefix + hsla.join() + ")"; + }, + toHexString: function( includeAlpha ) { + var rgba = this._rgba.slice(), + alpha = rgba.pop(); + + if ( includeAlpha ) { + rgba.push( ~~( alpha * 255 ) ); + } + + return "#" + jQuery.map( rgba, function( v ) { + + // default to 0 when nulls exist + v = ( v || 0 ).toString( 16 ); + return v.length === 1 ? "0" + v : v; + }).join(""); + }, + toString: function() { + return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); + } +}); +color.fn.parse.prototype = color.fn; + +// hsla conversions adapted from: +// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 + +function hue2rgb( p, q, h ) { + h = ( h + 1 ) % 1; + if ( h * 6 < 1 ) { + return p + (q - p) * h * 6; + } + if ( h * 2 < 1) { + return q; + } + if ( h * 3 < 2 ) { + return p + (q - p) * ((2/3) - h) * 6; + } + return p; +} + +spaces.hsla.to = function ( rgba ) { + if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { + return [ null, null, null, rgba[ 3 ] ]; + } + var r = rgba[ 0 ] / 255, + g = rgba[ 1 ] / 255, + b = rgba[ 2 ] / 255, + a = rgba[ 3 ], + max = Math.max( r, g, b ), + min = Math.min( r, g, b ), + diff = max - min, + add = max + min, + l = add * 0.5, + h, s; + + if ( min === max ) { + h = 0; + } else if ( r === max ) { + h = ( 60 * ( g - b ) / diff ) + 360; + } else if ( g === max ) { + h = ( 60 * ( b - r ) / diff ) + 120; + } else { + h = ( 60 * ( r - g ) / diff ) + 240; + } + + if ( l === 0 || l === 1 ) { + s = l; + } else if ( l <= 0.5 ) { + s = diff / add; + } else { + s = diff / ( 2 - add ); + } + return [ Math.round(h) % 360, s, l, a == null ? 1 : a ]; +}; + +spaces.hsla.from = function ( hsla ) { + if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { + return [ null, null, null, hsla[ 3 ] ]; + } + var h = hsla[ 0 ] / 360, + s = hsla[ 1 ], + l = hsla[ 2 ], + a = hsla[ 3 ], + q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, + p = 2 * l - q; + + return [ + Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), + Math.round( hue2rgb( p, q, h ) * 255 ), + Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), + a + ]; +}; + + +each( spaces, function( spaceName, space ) { + var props = space.props, + cache = space.cache, + to = space.to, + from = space.from; + + // makes rgba() and hsla() + color.fn[ spaceName ] = function( value ) { + + // generate a cache for this space if it doesn't exist + if ( to && !this[ cache ] ) { + this[ cache ] = to( this._rgba ); + } + if ( value === undefined ) { + return this[ cache ].slice(); + } + + var ret, + type = jQuery.type( value ), + arr = ( type === "array" || type === "object" ) ? value : arguments, + local = this[ cache ].slice(); + + each( props, function( key, prop ) { + var val = arr[ type === "object" ? key : prop.idx ]; + if ( val == null ) { + val = local[ prop.idx ]; + } + local[ prop.idx ] = clamp( val, prop ); + }); + + if ( from ) { + ret = color( from( local ) ); + ret[ cache ] = local; + return ret; + } else { + return color( local ); + } + }; + + // makes red() green() blue() alpha() hue() saturation() lightness() + each( props, function( key, prop ) { + // alpha is included in more than one space + if ( color.fn[ key ] ) { + return; + } + color.fn[ key ] = function( value ) { + var vtype = jQuery.type( value ), + fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ), + local = this[ fn ](), + cur = local[ prop.idx ], + match; + + if ( vtype === "undefined" ) { + return cur; + } + + if ( vtype === "function" ) { + value = value.call( this, cur ); + vtype = jQuery.type( value ); + } + if ( value == null && prop.empty ) { + return this; + } + if ( vtype === "string" ) { + match = rplusequals.exec( value ); + if ( match ) { + value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); + } + } + local[ prop.idx ] = value; + return this[ fn ]( local ); + }; + }); +}); + +// add .fx.step functions +each( stepHooks, function( i, hook ) { + jQuery.cssHooks[ hook ] = { + set: function( elem, value ) { + var parsed, curElem, + backgroundColor = ""; + + if ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) { + value = color( parsed || value ); + if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { + curElem = hook === "backgroundColor" ? elem.parentNode : elem; + while ( + (backgroundColor === "" || backgroundColor === "transparent") && + curElem && curElem.style + ) { + try { + backgroundColor = jQuery.css( curElem, "backgroundColor" ); + curElem = curElem.parentNode; + } catch ( e ) { + } + } + + value = value.blend( backgroundColor && backgroundColor !== "transparent" ? + backgroundColor : + "_default" ); + } + + value = value.toRgbaString(); + } + try { + elem.style[ hook ] = value; + } catch( error ) { + // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' + } + } + }; + jQuery.fx.step[ hook ] = function( fx ) { + if ( !fx.colorInit ) { + fx.start = color( fx.elem, hook ); + fx.end = color( fx.end ); + fx.colorInit = true; + } + jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); + }; +}); + +jQuery.cssHooks.borderColor = { + expand: function( value ) { + var expanded = {}; + + each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) { + expanded[ "border" + part + "Color" ] = value; + }); + return expanded; + } +}; + +// Basic color names only. +// Usage of any of the other color names requires adding yourself or including +// jquery.color.svg-names.js. +colors = jQuery.Color.names = { + // 4.1. Basic color keywords + aqua: "#00ffff", + black: "#000000", + blue: "#0000ff", + fuchsia: "#ff00ff", + gray: "#808080", + green: "#008000", + lime: "#00ff00", + maroon: "#800000", + navy: "#000080", + olive: "#808000", + purple: "#800080", + red: "#ff0000", + silver: "#c0c0c0", + teal: "#008080", + white: "#ffffff", + yellow: "#ffff00", + + // 4.2.3. "transparent" color keyword + transparent: [ null, null, null, 0 ], + + _default: "#ffffff" +}; + +})( jQuery ); + + + +/******************************************************************************/ +/****************************** CLASS ANIMATIONS ******************************/ +/******************************************************************************/ +(function() { + +var classAnimationActions = [ "add", "remove", "toggle" ], + shorthandStyles = { + border: 1, + borderBottom: 1, + borderColor: 1, + borderLeft: 1, + borderRight: 1, + borderTop: 1, + borderWidth: 1, + margin: 1, + padding: 1 + }; + +$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) { + $.fx.step[ prop ] = function( fx ) { + if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) { + jQuery.style( fx.elem, prop, fx.end ); + fx.setAttr = true; + } + }; +}); + +function getElementStyles() { + var style = this.ownerDocument.defaultView ? + this.ownerDocument.defaultView.getComputedStyle( this, null ) : + this.currentStyle, + newStyle = {}, + key, + len; + + // webkit enumerates style porperties + if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { + len = style.length; + while ( len-- ) { + key = style[ len ]; + if ( typeof style[ key ] === "string" ) { + newStyle[ $.camelCase( key ) ] = style[ key ]; + } + } + } else { + for ( key in style ) { + if ( typeof style[ key ] === "string" ) { + newStyle[ key ] = style[ key ]; + } + } + } + + return newStyle; +} + + +function styleDifference( oldStyle, newStyle ) { + var diff = {}, + name, value; + + for ( name in newStyle ) { + value = newStyle[ name ]; + if ( oldStyle[ name ] !== value ) { + if ( !shorthandStyles[ name ] ) { + if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { + diff[ name ] = value; + } + } + } + } + + return diff; +} + +$.effects.animateClass = function( value, duration, easing, callback ) { + var o = $.speed( duration, easing, callback ); + + return this.queue( function() { + var animated = $( this ), + baseClass = animated.attr( "class" ) || "", + applyClassChange, + allAnimations = o.children ? animated.find( "*" ).andSelf() : animated; + + // map the animated objects to store the original styles. + allAnimations = allAnimations.map(function() { + var el = $( this ); + return { + el: el, + start: getElementStyles.call( this ) + }; + }); + + // apply class change + applyClassChange = function() { + $.each( classAnimationActions, function(i, action) { + if ( value[ action ] ) { + animated[ action + "Class" ]( value[ action ] ); + } + }); + }; + applyClassChange(); + + // map all animated objects again - calculate new styles and diff + allAnimations = allAnimations.map(function() { + this.end = getElementStyles.call( this.el[ 0 ] ); + this.diff = styleDifference( this.start, this.end ); + return this; + }); + + // apply original class + animated.attr( "class", baseClass ); + + // map all animated objects again - this time collecting a promise + allAnimations = allAnimations.map(function() { + var styleInfo = this, + dfd = $.Deferred(), + opts = jQuery.extend({}, o, { + queue: false, + complete: function() { + dfd.resolve( styleInfo ); + } + }); + + this.el.animate( this.diff, opts ); + return dfd.promise(); + }); + + // once all animations have completed: + $.when.apply( $, allAnimations.get() ).done(function() { + + // set the final class + applyClassChange(); + + // for each animated element, + // clear all css properties that were animated + $.each( arguments, function() { + var el = this.el; + $.each( this.diff, function(key) { + el.css( key, '' ); + }); + }); + + // this is guarnteed to be there if you use jQuery.speed() + // it also handles dequeuing the next anim... + o.complete.call( animated[ 0 ] ); + }); + }); +}; + +$.fn.extend({ + _addClass: $.fn.addClass, + addClass: function( classNames, speed, easing, callback ) { + return speed ? + $.effects.animateClass.call( this, + { add: classNames }, speed, easing, callback ) : + this._addClass( classNames ); + }, + + _removeClass: $.fn.removeClass, + removeClass: function( classNames, speed, easing, callback ) { + return speed ? + $.effects.animateClass.call( this, + { remove: classNames }, speed, easing, callback ) : + this._removeClass( classNames ); + }, + + _toggleClass: $.fn.toggleClass, + toggleClass: function( classNames, force, speed, easing, callback ) { + if ( typeof force === "boolean" || force === undefined ) { + if ( !speed ) { + // without speed parameter + return this._toggleClass( classNames, force ); + } else { + return $.effects.animateClass.call( this, + (force ? { add: classNames } : { remove: classNames }), + speed, easing, callback ); + } + } else { + // without force parameter + return $.effects.animateClass.call( this, + { toggle: classNames }, force, speed, easing ); + } + }, + + switchClass: function( remove, add, speed, easing, callback) { + return $.effects.animateClass.call( this, { + add: add, + remove: remove + }, speed, easing, callback ); + } +}); + +})(); + +/******************************************************************************/ +/*********************************** EFFECTS **********************************/ +/******************************************************************************/ + +(function() { + +$.extend( $.effects, { + version: "1.9.2", + + // Saves a set of properties in a data storage + save: function( element, set ) { + for( var i=0; i < set.length; i++ ) { + if ( set[ i ] !== null ) { + element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); + } + } + }, + + // Restores a set of previously saved properties from a data storage + restore: function( element, set ) { + var val, i; + for( i=0; i < set.length; i++ ) { + if ( set[ i ] !== null ) { + val = element.data( dataSpace + set[ i ] ); + // support: jQuery 1.6.2 + // http://bugs.jquery.com/ticket/9917 + // jQuery 1.6.2 incorrectly returns undefined for any falsy value. + // We can't differentiate between "" and 0 here, so we just assume + // empty string since it's likely to be a more common value... + if ( val === undefined ) { + val = ""; + } + element.css( set[ i ], val ); + } + } + }, + + setMode: function( el, mode ) { + if (mode === "toggle") { + mode = el.is( ":hidden" ) ? "show" : "hide"; + } + return mode; + }, + + // Translates a [top,left] array into a baseline value + // this should be a little more flexible in the future to handle a string & hash + getBaseline: function( origin, original ) { + var y, x; + switch ( origin[ 0 ] ) { + case "top": y = 0; break; + case "middle": y = 0.5; break; + case "bottom": y = 1; break; + default: y = origin[ 0 ] / original.height; + } + switch ( origin[ 1 ] ) { + case "left": x = 0; break; + case "center": x = 0.5; break; + case "right": x = 1; break; + default: x = origin[ 1 ] / original.width; + } + return { + x: x, + y: y + }; + }, + + // Wraps the element around a wrapper that copies position properties + createWrapper: function( element ) { + + // if the element is already wrapped, return it + if ( element.parent().is( ".ui-effects-wrapper" )) { + return element.parent(); + } + + // wrap the element + var props = { + width: element.outerWidth(true), + height: element.outerHeight(true), + "float": element.css( "float" ) + }, + wrapper = $( "

    " ) + .addClass( "ui-effects-wrapper" ) + .css({ + fontSize: "100%", + background: "transparent", + border: "none", + margin: 0, + padding: 0 + }), + // Store the size in case width/height are defined in % - Fixes #5245 + size = { + width: element.width(), + height: element.height() + }, + active = document.activeElement; + + // support: Firefox + // Firefox incorrectly exposes anonymous content + // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 + try { + active.id; + } catch( e ) { + active = document.body; + } + + element.wrap( wrapper ); + + // Fixes #7595 - Elements lose focus when wrapped. + if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { + $( active ).focus(); + } + + wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element + + // transfer positioning properties to the wrapper + if ( element.css( "position" ) === "static" ) { + wrapper.css({ position: "relative" }); + element.css({ position: "relative" }); + } else { + $.extend( props, { + position: element.css( "position" ), + zIndex: element.css( "z-index" ) + }); + $.each([ "top", "left", "bottom", "right" ], function(i, pos) { + props[ pos ] = element.css( pos ); + if ( isNaN( parseInt( props[ pos ], 10 ) ) ) { + props[ pos ] = "auto"; + } + }); + element.css({ + position: "relative", + top: 0, + left: 0, + right: "auto", + bottom: "auto" + }); + } + element.css(size); + + return wrapper.css( props ).show(); + }, + + removeWrapper: function( element ) { + var active = document.activeElement; + + if ( element.parent().is( ".ui-effects-wrapper" ) ) { + element.parent().replaceWith( element ); + + // Fixes #7595 - Elements lose focus when wrapped. + if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { + $( active ).focus(); + } + } + + + return element; + }, + + setTransition: function( element, list, factor, value ) { + value = value || {}; + $.each( list, function( i, x ) { + var unit = element.cssUnit( x ); + if ( unit[ 0 ] > 0 ) { + value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; + } + }); + return value; + } +}); + +// return an effect options object for the given parameters: +function _normalizeArguments( effect, options, speed, callback ) { + + // allow passing all options as the first parameter + if ( $.isPlainObject( effect ) ) { + options = effect; + effect = effect.effect; + } + + // convert to an object + effect = { effect: effect }; + + // catch (effect, null, ...) + if ( options == null ) { + options = {}; + } + + // catch (effect, callback) + if ( $.isFunction( options ) ) { + callback = options; + speed = null; + options = {}; + } + + // catch (effect, speed, ?) + if ( typeof options === "number" || $.fx.speeds[ options ] ) { + callback = speed; + speed = options; + options = {}; + } + + // catch (effect, options, callback) + if ( $.isFunction( speed ) ) { + callback = speed; + speed = null; + } + + // add options to effect + if ( options ) { + $.extend( effect, options ); + } + + speed = speed || options.duration; + effect.duration = $.fx.off ? 0 : + typeof speed === "number" ? speed : + speed in $.fx.speeds ? $.fx.speeds[ speed ] : + $.fx.speeds._default; + + effect.complete = callback || options.complete; + + return effect; +} + +function standardSpeed( speed ) { + // valid standard speeds + if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) { + return true; + } + + // invalid strings - treat as "normal" speed + if ( typeof speed === "string" && !$.effects.effect[ speed ] ) { + // TODO: remove in 2.0 (#7115) + if ( backCompat && $.effects[ speed ] ) { + return false; + } + return true; + } + + return false; +} + +$.fn.extend({ + effect: function( /* effect, options, speed, callback */ ) { + var args = _normalizeArguments.apply( this, arguments ), + mode = args.mode, + queue = args.queue, + effectMethod = $.effects.effect[ args.effect ], + + // DEPRECATED: remove in 2.0 (#7115) + oldEffectMethod = !effectMethod && backCompat && $.effects[ args.effect ]; + + if ( $.fx.off || !( effectMethod || oldEffectMethod ) ) { + // delegate to the original method (e.g., .show()) if possible + if ( mode ) { + return this[ mode ]( args.duration, args.complete ); + } else { + return this.each( function() { + if ( args.complete ) { + args.complete.call( this ); + } + }); + } + } + + function run( next ) { + var elem = $( this ), + complete = args.complete, + mode = args.mode; + + function done() { + if ( $.isFunction( complete ) ) { + complete.call( elem[0] ); + } + if ( $.isFunction( next ) ) { + next(); + } + } + + // if the element is hiddden and mode is hide, + // or element is visible and mode is show + if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { + done(); + } else { + effectMethod.call( elem[0], args, done ); + } + } + + // TODO: remove this check in 2.0, effectMethod will always be true + if ( effectMethod ) { + return queue === false ? this.each( run ) : this.queue( queue || "fx", run ); + } else { + // DEPRECATED: remove in 2.0 (#7115) + return oldEffectMethod.call(this, { + options: args, + duration: args.duration, + callback: args.complete, + mode: args.mode + }); + } + }, + + _show: $.fn.show, + show: function( speed ) { + if ( standardSpeed( speed ) ) { + return this._show.apply( this, arguments ); + } else { + var args = _normalizeArguments.apply( this, arguments ); + args.mode = "show"; + return this.effect.call( this, args ); + } + }, + + _hide: $.fn.hide, + hide: function( speed ) { + if ( standardSpeed( speed ) ) { + return this._hide.apply( this, arguments ); + } else { + var args = _normalizeArguments.apply( this, arguments ); + args.mode = "hide"; + return this.effect.call( this, args ); + } + }, + + // jQuery core overloads toggle and creates _toggle + __toggle: $.fn.toggle, + toggle: function( speed ) { + if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) { + return this.__toggle.apply( this, arguments ); + } else { + var args = _normalizeArguments.apply( this, arguments ); + args.mode = "toggle"; + return this.effect.call( this, args ); + } + }, + + // helper functions + cssUnit: function(key) { + var style = this.css( key ), + val = []; + + $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { + if ( style.indexOf( unit ) > 0 ) { + val = [ parseFloat( style ), unit ]; + } + }); + return val; + } +}); + +})(); + +/******************************************************************************/ +/*********************************** EASING ***********************************/ +/******************************************************************************/ + +(function() { + +// based on easing equations from Robert Penner (http://www.robertpenner.com/easing) + +var baseEasings = {}; + +$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { + baseEasings[ name ] = function( p ) { + return Math.pow( p, i + 2 ); + }; +}); + +$.extend( baseEasings, { + Sine: function ( p ) { + return 1 - Math.cos( p * Math.PI / 2 ); + }, + Circ: function ( p ) { + return 1 - Math.sqrt( 1 - p * p ); + }, + Elastic: function( p ) { + return p === 0 || p === 1 ? p : + -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 ); + }, + Back: function( p ) { + return p * p * ( 3 * p - 2 ); + }, + Bounce: function ( p ) { + var pow2, + bounce = 4; + + while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} + return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); + } +}); + +$.each( baseEasings, function( name, easeIn ) { + $.easing[ "easeIn" + name ] = easeIn; + $.easing[ "easeOut" + name ] = function( p ) { + return 1 - easeIn( 1 - p ); + }; + $.easing[ "easeInOut" + name ] = function( p ) { + return p < 0.5 ? + easeIn( p * 2 ) / 2 : + 1 - easeIn( p * -2 + 2 ) / 2; + }; +}); + +})(); + +})(jQuery)); +(function( $, undefined ) { + +var rvertical = /up|down|vertical/, + rpositivemotion = /up|left|vertical|horizontal/; + +$.effects.effect.blind = function( o, done ) { + // Create element + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "height", "width" ], + mode = $.effects.setMode( el, o.mode || "hide" ), + direction = o.direction || "up", + vertical = rvertical.test( direction ), + ref = vertical ? "height" : "width", + ref2 = vertical ? "top" : "left", + motion = rpositivemotion.test( direction ), + animation = {}, + show = mode === "show", + wrapper, distance, margin; + + // if already wrapped, the wrapper's properties are my property. #6245 + if ( el.parent().is( ".ui-effects-wrapper" ) ) { + $.effects.save( el.parent(), props ); + } else { + $.effects.save( el, props ); + } + el.show(); + wrapper = $.effects.createWrapper( el ).css({ + overflow: "hidden" + }); + + distance = wrapper[ ref ](); + margin = parseFloat( wrapper.css( ref2 ) ) || 0; + + animation[ ref ] = show ? distance : 0; + if ( !motion ) { + el + .css( vertical ? "bottom" : "right", 0 ) + .css( vertical ? "top" : "left", "auto" ) + .css({ position: "absolute" }); + + animation[ ref2 ] = show ? margin : distance + margin; + } + + // start at 0 if we are showing + if ( show ) { + wrapper.css( ref, 0 ); + if ( ! motion ) { + wrapper.css( ref2, margin + distance ); + } + } + + // Animate + wrapper.animate( animation, { + duration: o.duration, + easing: o.easing, + queue: false, + complete: function() { + if ( mode === "hide" ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + } + }); + +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.bounce = function( o, done ) { + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "height", "width" ], + + // defaults: + mode = $.effects.setMode( el, o.mode || "effect" ), + hide = mode === "hide", + show = mode === "show", + direction = o.direction || "up", + distance = o.distance, + times = o.times || 5, + + // number of internal animations + anims = times * 2 + ( show || hide ? 1 : 0 ), + speed = o.duration / anims, + easing = o.easing, + + // utility: + ref = ( direction === "up" || direction === "down" ) ? "top" : "left", + motion = ( direction === "up" || direction === "left" ), + i, + upAnim, + downAnim, + + // we will need to re-assemble the queue to stack our animations in place + queue = el.queue(), + queuelen = queue.length; + + // Avoid touching opacity to prevent clearType and PNG issues in IE + if ( show || hide ) { + props.push( "opacity" ); + } + + $.effects.save( el, props ); + el.show(); + $.effects.createWrapper( el ); // Create Wrapper + + // default distance for the BIGGEST bounce is the outer Distance / 3 + if ( !distance ) { + distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3; + } + + if ( show ) { + downAnim = { opacity: 1 }; + downAnim[ ref ] = 0; + + // if we are showing, force opacity 0 and set the initial position + // then do the "first" animation + el.css( "opacity", 0 ) + .css( ref, motion ? -distance * 2 : distance * 2 ) + .animate( downAnim, speed, easing ); + } + + // start at the smallest distance if we are hiding + if ( hide ) { + distance = distance / Math.pow( 2, times - 1 ); + } + + downAnim = {}; + downAnim[ ref ] = 0; + // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here + for ( i = 0; i < times; i++ ) { + upAnim = {}; + upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; + + el.animate( upAnim, speed, easing ) + .animate( downAnim, speed, easing ); + + distance = hide ? distance * 2 : distance / 2; + } + + // Last Bounce when Hiding + if ( hide ) { + upAnim = { opacity: 0 }; + upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; + + el.animate( upAnim, speed, easing ); + } + + el.queue(function() { + if ( hide ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + }); + + // inject all the animations we just queued to be first in line (after "inprogress") + if ( queuelen > 1) { + queue.splice.apply( queue, + [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); + } + el.dequeue(); + +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.clip = function( o, done ) { + // Create element + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "height", "width" ], + mode = $.effects.setMode( el, o.mode || "hide" ), + show = mode === "show", + direction = o.direction || "vertical", + vert = direction === "vertical", + size = vert ? "height" : "width", + position = vert ? "top" : "left", + animation = {}, + wrapper, animate, distance; + + // Save & Show + $.effects.save( el, props ); + el.show(); + + // Create Wrapper + wrapper = $.effects.createWrapper( el ).css({ + overflow: "hidden" + }); + animate = ( el[0].tagName === "IMG" ) ? wrapper : el; + distance = animate[ size ](); + + // Shift + if ( show ) { + animate.css( size, 0 ); + animate.css( position, distance / 2 ); + } + + // Create Animation Object: + animation[ size ] = show ? distance : 0; + animation[ position ] = show ? 0 : distance / 2; + + // Animate + animate.animate( animation, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + if ( !show ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + } + }); + +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.drop = function( o, done ) { + + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ], + mode = $.effects.setMode( el, o.mode || "hide" ), + show = mode === "show", + direction = o.direction || "left", + ref = ( direction === "up" || direction === "down" ) ? "top" : "left", + motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg", + animation = { + opacity: show ? 1 : 0 + }, + distance; + + // Adjust + $.effects.save( el, props ); + el.show(); + $.effects.createWrapper( el ); + + distance = o.distance || el[ ref === "top" ? "outerHeight": "outerWidth" ]( true ) / 2; + + if ( show ) { + el + .css( "opacity", 0 ) + .css( ref, motion === "pos" ? -distance : distance ); + } + + // Animation + animation[ ref ] = ( show ? + ( motion === "pos" ? "+=" : "-=" ) : + ( motion === "pos" ? "-=" : "+=" ) ) + + distance; + + // Animate + el.animate( animation, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + if ( mode === "hide" ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + } + }); +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.explode = function( o, done ) { + + var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3, + cells = rows, + el = $( this ), + mode = $.effects.setMode( el, o.mode || "hide" ), + show = mode === "show", + + // show and then visibility:hidden the element before calculating offset + offset = el.show().css( "visibility", "hidden" ).offset(), + + // width and height of a piece + width = Math.ceil( el.outerWidth() / cells ), + height = Math.ceil( el.outerHeight() / rows ), + pieces = [], + + // loop + i, j, left, top, mx, my; + + // children animate complete: + function childComplete() { + pieces.push( this ); + if ( pieces.length === rows * cells ) { + animComplete(); + } + } + + // clone the element for each row and cell. + for( i = 0; i < rows ; i++ ) { // ===> + top = offset.top + i * height; + my = i - ( rows - 1 ) / 2 ; + + for( j = 0; j < cells ; j++ ) { // ||| + left = offset.left + j * width; + mx = j - ( cells - 1 ) / 2 ; + + // Create a clone of the now hidden main element that will be absolute positioned + // within a wrapper div off the -left and -top equal to size of our pieces + el + .clone() + .appendTo( "body" ) + .wrap( "
    " ) + .css({ + position: "absolute", + visibility: "visible", + left: -j * width, + top: -i * height + }) + + // select the wrapper - make it overflow: hidden and absolute positioned based on + // where the original was located +left and +top equal to the size of pieces + .parent() + .addClass( "ui-effects-explode" ) + .css({ + position: "absolute", + overflow: "hidden", + width: width, + height: height, + left: left + ( show ? mx * width : 0 ), + top: top + ( show ? my * height : 0 ), + opacity: show ? 0 : 1 + }).animate({ + left: left + ( show ? 0 : mx * width ), + top: top + ( show ? 0 : my * height ), + opacity: show ? 1 : 0 + }, o.duration || 500, o.easing, childComplete ); + } + } + + function animComplete() { + el.css({ + visibility: "visible" + }); + $( pieces ).remove(); + if ( !show ) { + el.hide(); + } + done(); + } +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.fade = function( o, done ) { + var el = $( this ), + mode = $.effects.setMode( el, o.mode || "toggle" ); + + el.animate({ + opacity: mode + }, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: done + }); +}; + +})( jQuery ); +(function( $, undefined ) { + +$.effects.effect.fold = function( o, done ) { + + // Create element + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "height", "width" ], + mode = $.effects.setMode( el, o.mode || "hide" ), + show = mode === "show", + hide = mode === "hide", + size = o.size || 15, + percent = /([0-9]+)%/.exec( size ), + horizFirst = !!o.horizFirst, + widthFirst = show !== horizFirst, + ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ], + duration = o.duration / 2, + wrapper, distance, + animation1 = {}, + animation2 = {}; + + $.effects.save( el, props ); + el.show(); + + // Create Wrapper + wrapper = $.effects.createWrapper( el ).css({ + overflow: "hidden" + }); + distance = widthFirst ? + [ wrapper.width(), wrapper.height() ] : + [ wrapper.height(), wrapper.width() ]; + + if ( percent ) { + size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ]; + } + if ( show ) { + wrapper.css( horizFirst ? { + height: 0, + width: size + } : { + height: size, + width: 0 + }); + } + + // Animation + animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size; + animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0; + + // Animate + wrapper + .animate( animation1, duration, o.easing ) + .animate( animation2, duration, o.easing, function() { + if ( hide ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + }); + +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.highlight = function( o, done ) { + var elem = $( this ), + props = [ "backgroundImage", "backgroundColor", "opacity" ], + mode = $.effects.setMode( elem, o.mode || "show" ), + animation = { + backgroundColor: elem.css( "backgroundColor" ) + }; + + if (mode === "hide") { + animation.opacity = 0; + } + + $.effects.save( elem, props ); + + elem + .show() + .css({ + backgroundImage: "none", + backgroundColor: o.color || "#ffff99" + }) + .animate( animation, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + if ( mode === "hide" ) { + elem.hide(); + } + $.effects.restore( elem, props ); + done(); + } + }); +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.pulsate = function( o, done ) { + var elem = $( this ), + mode = $.effects.setMode( elem, o.mode || "show" ), + show = mode === "show", + hide = mode === "hide", + showhide = ( show || mode === "hide" ), + + // showing or hiding leaves of the "last" animation + anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ), + duration = o.duration / anims, + animateTo = 0, + queue = elem.queue(), + queuelen = queue.length, + i; + + if ( show || !elem.is(":visible")) { + elem.css( "opacity", 0 ).show(); + animateTo = 1; + } + + // anims - 1 opacity "toggles" + for ( i = 1; i < anims; i++ ) { + elem.animate({ + opacity: animateTo + }, duration, o.easing ); + animateTo = 1 - animateTo; + } + + elem.animate({ + opacity: animateTo + }, duration, o.easing); + + elem.queue(function() { + if ( hide ) { + elem.hide(); + } + done(); + }); + + // We just queued up "anims" animations, we need to put them next in the queue + if ( queuelen > 1 ) { + queue.splice.apply( queue, + [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); + } + elem.dequeue(); +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.puff = function( o, done ) { + var elem = $( this ), + mode = $.effects.setMode( elem, o.mode || "hide" ), + hide = mode === "hide", + percent = parseInt( o.percent, 10 ) || 150, + factor = percent / 100, + original = { + height: elem.height(), + width: elem.width(), + outerHeight: elem.outerHeight(), + outerWidth: elem.outerWidth() + }; + + $.extend( o, { + effect: "scale", + queue: false, + fade: true, + mode: mode, + complete: done, + percent: hide ? percent : 100, + from: hide ? + original : + { + height: original.height * factor, + width: original.width * factor, + outerHeight: original.outerHeight * factor, + outerWidth: original.outerWidth * factor + } + }); + + elem.effect( o ); +}; + +$.effects.effect.scale = function( o, done ) { + + // Create element + var el = $( this ), + options = $.extend( true, {}, o ), + mode = $.effects.setMode( el, o.mode || "effect" ), + percent = parseInt( o.percent, 10 ) || + ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ), + direction = o.direction || "both", + origin = o.origin, + original = { + height: el.height(), + width: el.width(), + outerHeight: el.outerHeight(), + outerWidth: el.outerWidth() + }, + factor = { + y: direction !== "horizontal" ? (percent / 100) : 1, + x: direction !== "vertical" ? (percent / 100) : 1 + }; + + // We are going to pass this effect to the size effect: + options.effect = "size"; + options.queue = false; + options.complete = done; + + // Set default origin and restore for show/hide + if ( mode !== "effect" ) { + options.origin = origin || ["middle","center"]; + options.restore = true; + } + + options.from = o.from || ( mode === "show" ? { + height: 0, + width: 0, + outerHeight: 0, + outerWidth: 0 + } : original ); + options.to = { + height: original.height * factor.y, + width: original.width * factor.x, + outerHeight: original.outerHeight * factor.y, + outerWidth: original.outerWidth * factor.x + }; + + // Fade option to support puff + if ( options.fade ) { + if ( mode === "show" ) { + options.from.opacity = 0; + options.to.opacity = 1; + } + if ( mode === "hide" ) { + options.from.opacity = 1; + options.to.opacity = 0; + } + } + + // Animate + el.effect( options ); + +}; + +$.effects.effect.size = function( o, done ) { + + // Create element + var original, baseline, factor, + el = $( this ), + props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ], + + // Always restore + props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ], + + // Copy for children + props2 = [ "width", "height", "overflow" ], + cProps = [ "fontSize" ], + vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ], + hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ], + + // Set options + mode = $.effects.setMode( el, o.mode || "effect" ), + restore = o.restore || mode !== "effect", + scale = o.scale || "both", + origin = o.origin || [ "middle", "center" ], + position = el.css( "position" ), + props = restore ? props0 : props1, + zero = { + height: 0, + width: 0, + outerHeight: 0, + outerWidth: 0 + }; + + if ( mode === "show" ) { + el.show(); + } + original = { + height: el.height(), + width: el.width(), + outerHeight: el.outerHeight(), + outerWidth: el.outerWidth() + }; + + if ( o.mode === "toggle" && mode === "show" ) { + el.from = o.to || zero; + el.to = o.from || original; + } else { + el.from = o.from || ( mode === "show" ? zero : original ); + el.to = o.to || ( mode === "hide" ? zero : original ); + } + + // Set scaling factor + factor = { + from: { + y: el.from.height / original.height, + x: el.from.width / original.width + }, + to: { + y: el.to.height / original.height, + x: el.to.width / original.width + } + }; + + // Scale the css box + if ( scale === "box" || scale === "both" ) { + + // Vertical props scaling + if ( factor.from.y !== factor.to.y ) { + props = props.concat( vProps ); + el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from ); + el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to ); + } + + // Horizontal props scaling + if ( factor.from.x !== factor.to.x ) { + props = props.concat( hProps ); + el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from ); + el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to ); + } + } + + // Scale the content + if ( scale === "content" || scale === "both" ) { + + // Vertical props scaling + if ( factor.from.y !== factor.to.y ) { + props = props.concat( cProps ).concat( props2 ); + el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from ); + el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to ); + } + } + + $.effects.save( el, props ); + el.show(); + $.effects.createWrapper( el ); + el.css( "overflow", "hidden" ).css( el.from ); + + // Adjust + if (origin) { // Calculate baseline shifts + baseline = $.effects.getBaseline( origin, original ); + el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y; + el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x; + el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y; + el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x; + } + el.css( el.from ); // set top & left + + // Animate + if ( scale === "content" || scale === "both" ) { // Scale the children + + // Add margins/font-size + vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps); + hProps = hProps.concat([ "marginLeft", "marginRight" ]); + props2 = props0.concat(vProps).concat(hProps); + + el.find( "*[width]" ).each( function(){ + var child = $( this ), + c_original = { + height: child.height(), + width: child.width(), + outerHeight: child.outerHeight(), + outerWidth: child.outerWidth() + }; + if (restore) { + $.effects.save(child, props2); + } + + child.from = { + height: c_original.height * factor.from.y, + width: c_original.width * factor.from.x, + outerHeight: c_original.outerHeight * factor.from.y, + outerWidth: c_original.outerWidth * factor.from.x + }; + child.to = { + height: c_original.height * factor.to.y, + width: c_original.width * factor.to.x, + outerHeight: c_original.height * factor.to.y, + outerWidth: c_original.width * factor.to.x + }; + + // Vertical props scaling + if ( factor.from.y !== factor.to.y ) { + child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from ); + child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to ); + } + + // Horizontal props scaling + if ( factor.from.x !== factor.to.x ) { + child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from ); + child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to ); + } + + // Animate children + child.css( child.from ); + child.animate( child.to, o.duration, o.easing, function() { + + // Restore children + if ( restore ) { + $.effects.restore( child, props2 ); + } + }); + }); + } + + // Animate + el.animate( el.to, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + if ( el.to.opacity === 0 ) { + el.css( "opacity", el.from.opacity ); + } + if( mode === "hide" ) { + el.hide(); + } + $.effects.restore( el, props ); + if ( !restore ) { + + // we need to calculate our new positioning based on the scaling + if ( position === "static" ) { + el.css({ + position: "relative", + top: el.to.top, + left: el.to.left + }); + } else { + $.each([ "top", "left" ], function( idx, pos ) { + el.css( pos, function( _, str ) { + var val = parseInt( str, 10 ), + toRef = idx ? el.to.left : el.to.top; + + // if original was "auto", recalculate the new value from wrapper + if ( str === "auto" ) { + return toRef + "px"; + } + + return val + toRef + "px"; + }); + }); + } + } + + $.effects.removeWrapper( el ); + done(); + } + }); + +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.shake = function( o, done ) { + + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "height", "width" ], + mode = $.effects.setMode( el, o.mode || "effect" ), + direction = o.direction || "left", + distance = o.distance || 20, + times = o.times || 3, + anims = times * 2 + 1, + speed = Math.round(o.duration/anims), + ref = (direction === "up" || direction === "down") ? "top" : "left", + positiveMotion = (direction === "up" || direction === "left"), + animation = {}, + animation1 = {}, + animation2 = {}, + i, + + // we will need to re-assemble the queue to stack our animations in place + queue = el.queue(), + queuelen = queue.length; + + $.effects.save( el, props ); + el.show(); + $.effects.createWrapper( el ); + + // Animation + animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance; + animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2; + animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2; + + // Animate + el.animate( animation, speed, o.easing ); + + // Shakes + for ( i = 1; i < times; i++ ) { + el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing ); + } + el + .animate( animation1, speed, o.easing ) + .animate( animation, speed / 2, o.easing ) + .queue(function() { + if ( mode === "hide" ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + }); + + // inject all the animations we just queued to be first in line (after "inprogress") + if ( queuelen > 1) { + queue.splice.apply( queue, + [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); + } + el.dequeue(); + +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.slide = function( o, done ) { + + // Create element + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "width", "height" ], + mode = $.effects.setMode( el, o.mode || "show" ), + show = mode === "show", + direction = o.direction || "left", + ref = (direction === "up" || direction === "down") ? "top" : "left", + positiveMotion = (direction === "up" || direction === "left"), + distance, + animation = {}; + + // Adjust + $.effects.save( el, props ); + el.show(); + distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ); + + $.effects.createWrapper( el ).css({ + overflow: "hidden" + }); + + if ( show ) { + el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance ); + } + + // Animation + animation[ ref ] = ( show ? + ( positiveMotion ? "+=" : "-=") : + ( positiveMotion ? "-=" : "+=")) + + distance; + + // Animate + el.animate( animation, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + if ( mode === "hide" ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + } + }); +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.transfer = function( o, done ) { + var elem = $( this ), + target = $( o.to ), + targetFixed = target.css( "position" ) === "fixed", + body = $("body"), + fixTop = targetFixed ? body.scrollTop() : 0, + fixLeft = targetFixed ? body.scrollLeft() : 0, + endPosition = target.offset(), + animation = { + top: endPosition.top - fixTop , + left: endPosition.left - fixLeft , + height: target.innerHeight(), + width: target.innerWidth() + }, + startPosition = elem.offset(), + transfer = $( '
    ' ) + .appendTo( document.body ) + .addClass( o.className ) + .css({ + top: startPosition.top - fixTop , + left: startPosition.left - fixLeft , + height: elem.innerHeight(), + width: elem.innerWidth(), + position: targetFixed ? "fixed" : "absolute" + }) + .animate( animation, o.duration, o.easing, function() { + transfer.remove(); + done(); + }); +}; + +})(jQuery); +(function( $, undefined ) { + +var mouseHandled = false; + +$.widget( "ui.menu", { + version: "1.9.2", + defaultElement: "
      ", + delay: 300, + options: { + icons: { + submenu: "ui-icon-carat-1-e" + }, + menus: "ul", + position: { + my: "left top", + at: "right top" + }, + role: "menu", + + // callbacks + blur: null, + focus: null, + select: null + }, + + _create: function() { + this.activeMenu = this.element; + this.element + .uniqueId() + .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) + .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length ) + .attr({ + role: this.options.role, + tabIndex: 0 + }) + // need to catch all clicks on disabled menu + // not possible through _on + .bind( "click" + this.eventNamespace, $.proxy(function( event ) { + if ( this.options.disabled ) { + event.preventDefault(); + } + }, this )); + + if ( this.options.disabled ) { + this.element + .addClass( "ui-state-disabled" ) + .attr( "aria-disabled", "true" ); + } + + this._on({ + // Prevent focus from sticking to links inside menu after clicking + // them (focus should always stay on UL during navigation). + "mousedown .ui-menu-item > a": function( event ) { + event.preventDefault(); + }, + "click .ui-state-disabled > a": function( event ) { + event.preventDefault(); + }, + "click .ui-menu-item:has(a)": function( event ) { + var target = $( event.target ).closest( ".ui-menu-item" ); + if ( !mouseHandled && target.not( ".ui-state-disabled" ).length ) { + mouseHandled = true; + + this.select( event ); + // Open submenu on click + if ( target.has( ".ui-menu" ).length ) { + this.expand( event ); + } else if ( !this.element.is( ":focus" ) ) { + // Redirect focus to the menu + this.element.trigger( "focus", [ true ] ); + + // If the active item is on the top level, let it stay active. + // Otherwise, blur the active item since it is no longer visible. + if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) { + clearTimeout( this.timer ); + } + } + } + }, + "mouseenter .ui-menu-item": function( event ) { + var target = $( event.currentTarget ); + // Remove ui-state-active class from siblings of the newly focused menu item + // to avoid a jump caused by adjacent elements both having a class with a border + target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" ); + this.focus( event, target ); + }, + mouseleave: "collapseAll", + "mouseleave .ui-menu": "collapseAll", + focus: function( event, keepActiveItem ) { + // If there's already an active item, keep it active + // If not, activate the first item + var item = this.active || this.element.children( ".ui-menu-item" ).eq( 0 ); + + if ( !keepActiveItem ) { + this.focus( event, item ); + } + }, + blur: function( event ) { + this._delay(function() { + if ( !$.contains( this.element[0], this.document[0].activeElement ) ) { + this.collapseAll( event ); + } + }); + }, + keydown: "_keydown" + }); + + this.refresh(); + + // Clicks outside of a menu collapse any open menus + this._on( this.document, { + click: function( event ) { + if ( !$( event.target ).closest( ".ui-menu" ).length ) { + this.collapseAll( event ); + } + + // Reset the mouseHandled flag + mouseHandled = false; + } + }); + }, + + _destroy: function() { + // Destroy (sub)menus + this.element + .removeAttr( "aria-activedescendant" ) + .find( ".ui-menu" ).andSelf() + .removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" ) + .removeAttr( "role" ) + .removeAttr( "tabIndex" ) + .removeAttr( "aria-labelledby" ) + .removeAttr( "aria-expanded" ) + .removeAttr( "aria-hidden" ) + .removeAttr( "aria-disabled" ) + .removeUniqueId() + .show(); + + // Destroy menu items + this.element.find( ".ui-menu-item" ) + .removeClass( "ui-menu-item" ) + .removeAttr( "role" ) + .removeAttr( "aria-disabled" ) + .children( "a" ) + .removeUniqueId() + .removeClass( "ui-corner-all ui-state-hover" ) + .removeAttr( "tabIndex" ) + .removeAttr( "role" ) + .removeAttr( "aria-haspopup" ) + .children().each( function() { + var elem = $( this ); + if ( elem.data( "ui-menu-submenu-carat" ) ) { + elem.remove(); + } + }); + + // Destroy menu dividers + this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" ); + }, + + _keydown: function( event ) { + var match, prev, character, skip, regex, + preventDefault = true; + + function escape( value ) { + return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ); + } + + switch ( event.keyCode ) { + case $.ui.keyCode.PAGE_UP: + this.previousPage( event ); + break; + case $.ui.keyCode.PAGE_DOWN: + this.nextPage( event ); + break; + case $.ui.keyCode.HOME: + this._move( "first", "first", event ); + break; + case $.ui.keyCode.END: + this._move( "last", "last", event ); + break; + case $.ui.keyCode.UP: + this.previous( event ); + break; + case $.ui.keyCode.DOWN: + this.next( event ); + break; + case $.ui.keyCode.LEFT: + this.collapse( event ); + break; + case $.ui.keyCode.RIGHT: + if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { + this.expand( event ); + } + break; + case $.ui.keyCode.ENTER: + case $.ui.keyCode.SPACE: + this._activate( event ); + break; + case $.ui.keyCode.ESCAPE: + this.collapse( event ); + break; + default: + preventDefault = false; + prev = this.previousFilter || ""; + character = String.fromCharCode( event.keyCode ); + skip = false; + + clearTimeout( this.filterTimer ); + + if ( character === prev ) { + skip = true; + } else { + character = prev + character; + } + + regex = new RegExp( "^" + escape( character ), "i" ); + match = this.activeMenu.children( ".ui-menu-item" ).filter(function() { + return regex.test( $( this ).children( "a" ).text() ); + }); + match = skip && match.index( this.active.next() ) !== -1 ? + this.active.nextAll( ".ui-menu-item" ) : + match; + + // If no matches on the current filter, reset to the last character pressed + // to move down the menu to the first item that starts with that character + if ( !match.length ) { + character = String.fromCharCode( event.keyCode ); + regex = new RegExp( "^" + escape( character ), "i" ); + match = this.activeMenu.children( ".ui-menu-item" ).filter(function() { + return regex.test( $( this ).children( "a" ).text() ); + }); + } + + if ( match.length ) { + this.focus( event, match ); + if ( match.length > 1 ) { + this.previousFilter = character; + this.filterTimer = this._delay(function() { + delete this.previousFilter; + }, 1000 ); + } else { + delete this.previousFilter; + } + } else { + delete this.previousFilter; + } + } + + if ( preventDefault ) { + event.preventDefault(); + } + }, + + _activate: function( event ) { + if ( !this.active.is( ".ui-state-disabled" ) ) { + if ( this.active.children( "a[aria-haspopup='true']" ).length ) { + this.expand( event ); + } else { + this.select( event ); + } + } + }, + + refresh: function() { + var menus, + icon = this.options.icons.submenu, + submenus = this.element.find( this.options.menus ); + + // Initialize nested menus + submenus.filter( ":not(.ui-menu)" ) + .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) + .hide() + .attr({ + role: this.options.role, + "aria-hidden": "true", + "aria-expanded": "false" + }) + .each(function() { + var menu = $( this ), + item = menu.prev( "a" ), + submenuCarat = $( "" ) + .addClass( "ui-menu-icon ui-icon " + icon ) + .data( "ui-menu-submenu-carat", true ); + + item + .attr( "aria-haspopup", "true" ) + .prepend( submenuCarat ); + menu.attr( "aria-labelledby", item.attr( "id" ) ); + }); + + menus = submenus.add( this.element ); + + // Don't refresh list items that are already adapted + menus.children( ":not(.ui-menu-item):has(a)" ) + .addClass( "ui-menu-item" ) + .attr( "role", "presentation" ) + .children( "a" ) + .uniqueId() + .addClass( "ui-corner-all" ) + .attr({ + tabIndex: -1, + role: this._itemRole() + }); + + // Initialize unlinked menu-items containing spaces and/or dashes only as dividers + menus.children( ":not(.ui-menu-item)" ).each(function() { + var item = $( this ); + // hyphen, em dash, en dash + if ( !/[^\-—–\s]/.test( item.text() ) ) { + item.addClass( "ui-widget-content ui-menu-divider" ); + } + }); + + // Add aria-disabled attribute to any disabled menu item + menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" ); + + // If the active item has been removed, blur the menu + if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { + this.blur(); + } + }, + + _itemRole: function() { + return { + menu: "menuitem", + listbox: "option" + }[ this.options.role ]; + }, + + focus: function( event, item ) { + var nested, focused; + this.blur( event, event && event.type === "focus" ); + + this._scrollIntoView( item ); + + this.active = item.first(); + focused = this.active.children( "a" ).addClass( "ui-state-focus" ); + // Only update aria-activedescendant if there's a role + // otherwise we assume focus is managed elsewhere + if ( this.options.role ) { + this.element.attr( "aria-activedescendant", focused.attr( "id" ) ); + } + + // Highlight active parent menu item, if any + this.active + .parent() + .closest( ".ui-menu-item" ) + .children( "a:first" ) + .addClass( "ui-state-active" ); + + if ( event && event.type === "keydown" ) { + this._close(); + } else { + this.timer = this._delay(function() { + this._close(); + }, this.delay ); + } + + nested = item.children( ".ui-menu" ); + if ( nested.length && ( /^mouse/.test( event.type ) ) ) { + this._startOpening(nested); + } + this.activeMenu = item.parent(); + + this._trigger( "focus", event, { item: item } ); + }, + + _scrollIntoView: function( item ) { + var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; + if ( this._hasScroll() ) { + borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0; + paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0; + offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; + scroll = this.activeMenu.scrollTop(); + elementHeight = this.activeMenu.height(); + itemHeight = item.height(); + + if ( offset < 0 ) { + this.activeMenu.scrollTop( scroll + offset ); + } else if ( offset + itemHeight > elementHeight ) { + this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight ); + } + } + }, + + blur: function( event, fromFocus ) { + if ( !fromFocus ) { + clearTimeout( this.timer ); + } + + if ( !this.active ) { + return; + } + + this.active.children( "a" ).removeClass( "ui-state-focus" ); + this.active = null; + + this._trigger( "blur", event, { item: this.active } ); + }, + + _startOpening: function( submenu ) { + clearTimeout( this.timer ); + + // Don't open if already open fixes a Firefox bug that caused a .5 pixel + // shift in the submenu position when mousing over the carat icon + if ( submenu.attr( "aria-hidden" ) !== "true" ) { + return; + } + + this.timer = this._delay(function() { + this._close(); + this._open( submenu ); + }, this.delay ); + }, + + _open: function( submenu ) { + var position = $.extend({ + of: this.active + }, this.options.position ); + + clearTimeout( this.timer ); + this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) ) + .hide() + .attr( "aria-hidden", "true" ); + + submenu + .show() + .removeAttr( "aria-hidden" ) + .attr( "aria-expanded", "true" ) + .position( position ); + }, + + collapseAll: function( event, all ) { + clearTimeout( this.timer ); + this.timer = this._delay(function() { + // If we were passed an event, look for the submenu that contains the event + var currentMenu = all ? this.element : + $( event && event.target ).closest( this.element.find( ".ui-menu" ) ); + + // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway + if ( !currentMenu.length ) { + currentMenu = this.element; + } + + this._close( currentMenu ); + + this.blur( event ); + this.activeMenu = currentMenu; + }, this.delay ); + }, + + // With no arguments, closes the currently active menu - if nothing is active + // it closes all menus. If passed an argument, it will search for menus BELOW + _close: function( startMenu ) { + if ( !startMenu ) { + startMenu = this.active ? this.active.parent() : this.element; + } + + startMenu + .find( ".ui-menu" ) + .hide() + .attr( "aria-hidden", "true" ) + .attr( "aria-expanded", "false" ) + .end() + .find( "a.ui-state-active" ) + .removeClass( "ui-state-active" ); + }, + + collapse: function( event ) { + var newItem = this.active && + this.active.parent().closest( ".ui-menu-item", this.element ); + if ( newItem && newItem.length ) { + this._close(); + this.focus( event, newItem ); + } + }, + + expand: function( event ) { + var newItem = this.active && + this.active + .children( ".ui-menu " ) + .children( ".ui-menu-item" ) + .first(); + + if ( newItem && newItem.length ) { + this._open( newItem.parent() ); + + // Delay so Firefox will not hide activedescendant change in expanding submenu from AT + this._delay(function() { + this.focus( event, newItem ); + }); + } + }, + + next: function( event ) { + this._move( "next", "first", event ); + }, + + previous: function( event ) { + this._move( "prev", "last", event ); + }, + + isFirstItem: function() { + return this.active && !this.active.prevAll( ".ui-menu-item" ).length; + }, + + isLastItem: function() { + return this.active && !this.active.nextAll( ".ui-menu-item" ).length; + }, + + _move: function( direction, filter, event ) { + var next; + if ( this.active ) { + if ( direction === "first" || direction === "last" ) { + next = this.active + [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" ) + .eq( -1 ); + } else { + next = this.active + [ direction + "All" ]( ".ui-menu-item" ) + .eq( 0 ); + } + } + if ( !next || !next.length || !this.active ) { + next = this.activeMenu.children( ".ui-menu-item" )[ filter ](); + } + + this.focus( event, next ); + }, + + nextPage: function( event ) { + var item, base, height; + + if ( !this.active ) { + this.next( event ); + return; + } + if ( this.isLastItem() ) { + return; + } + if ( this._hasScroll() ) { + base = this.active.offset().top; + height = this.element.height(); + this.active.nextAll( ".ui-menu-item" ).each(function() { + item = $( this ); + return item.offset().top - base - height < 0; + }); + + this.focus( event, item ); + } else { + this.focus( event, this.activeMenu.children( ".ui-menu-item" ) + [ !this.active ? "first" : "last" ]() ); + } + }, + + previousPage: function( event ) { + var item, base, height; + if ( !this.active ) { + this.next( event ); + return; + } + if ( this.isFirstItem() ) { + return; + } + if ( this._hasScroll() ) { + base = this.active.offset().top; + height = this.element.height(); + this.active.prevAll( ".ui-menu-item" ).each(function() { + item = $( this ); + return item.offset().top - base + height > 0; + }); + + this.focus( event, item ); + } else { + this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() ); + } + }, + + _hasScroll: function() { + return this.element.outerHeight() < this.element.prop( "scrollHeight" ); + }, + + select: function( event ) { + // TODO: It should never be possible to not have an active item at this + // point, but the tests don't trigger mouseenter before click. + this.active = this.active || $( event.target ).closest( ".ui-menu-item" ); + var ui = { item: this.active }; + if ( !this.active.has( ".ui-menu" ).length ) { + this.collapseAll( event, true ); + } + this._trigger( "select", event, ui ); + } +}); + +}( jQuery )); +(function( $, undefined ) { + +$.widget( "ui.progressbar", { + version: "1.9.2", + options: { + value: 0, + max: 100 + }, + + min: 0, + + _create: function() { + this.element + .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) + .attr({ + role: "progressbar", + "aria-valuemin": this.min, + "aria-valuemax": this.options.max, + "aria-valuenow": this._value() + }); + + this.valueDiv = $( "
      " ) + .appendTo( this.element ); + + this.oldValue = this._value(); + this._refreshValue(); + }, + + _destroy: function() { + this.element + .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) + .removeAttr( "role" ) + .removeAttr( "aria-valuemin" ) + .removeAttr( "aria-valuemax" ) + .removeAttr( "aria-valuenow" ); + + this.valueDiv.remove(); + }, + + value: function( newValue ) { + if ( newValue === undefined ) { + return this._value(); + } + + this._setOption( "value", newValue ); + return this; + }, + + _setOption: function( key, value ) { + if ( key === "value" ) { + this.options.value = value; + this._refreshValue(); + if ( this._value() === this.options.max ) { + this._trigger( "complete" ); + } + } + + this._super( key, value ); + }, + + _value: function() { + var val = this.options.value; + // normalize invalid value + if ( typeof val !== "number" ) { + val = 0; + } + return Math.min( this.options.max, Math.max( this.min, val ) ); + }, + + _percentage: function() { + return 100 * this._value() / this.options.max; + }, + + _refreshValue: function() { + var value = this.value(), + percentage = this._percentage(); + + if ( this.oldValue !== value ) { + this.oldValue = value; + this._trigger( "change" ); + } + + this.valueDiv + .toggle( value > this.min ) + .toggleClass( "ui-corner-right", value === this.options.max ) + .width( percentage.toFixed(0) + "%" ); + this.element.attr( "aria-valuenow", value ); + } +}); + +})( jQuery ); +(function( $, undefined ) { + +$.widget("ui.resizable", $.ui.mouse, { + version: "1.9.2", + widgetEventPrefix: "resize", + options: { + alsoResize: false, + animate: false, + animateDuration: "slow", + animateEasing: "swing", + aspectRatio: false, + autoHide: false, + containment: false, + ghost: false, + grid: false, + handles: "e,s,se", + helper: false, + maxHeight: null, + maxWidth: null, + minHeight: 10, + minWidth: 10, + zIndex: 1000 + }, + _create: function() { + + var that = this, o = this.options; + this.element.addClass("ui-resizable"); + + $.extend(this, { + _aspectRatio: !!(o.aspectRatio), + aspectRatio: o.aspectRatio, + originalElement: this.element, + _proportionallyResizeElements: [], + _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null + }); + + //Wrap the element if it cannot hold child nodes + if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) { + + //Create a wrapper element and set the wrapper to the new current internal element + this.element.wrap( + $('
      ').css({ + position: this.element.css('position'), + width: this.element.outerWidth(), + height: this.element.outerHeight(), + top: this.element.css('top'), + left: this.element.css('left') + }) + ); + + //Overwrite the original this.element + this.element = this.element.parent().data( + "resizable", this.element.data('resizable') + ); + + this.elementIsWrapper = true; + + //Move margins to the wrapper + this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") }); + this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0}); + + //Prevent Safari textarea resize + this.originalResizeStyle = this.originalElement.css('resize'); + this.originalElement.css('resize', 'none'); + + //Push the actual element to our proportionallyResize internal array + this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' })); + + // avoid IE jump (hard set the margin) + this.originalElement.css({ margin: this.originalElement.css('margin') }); + + // fix handlers offset + this._proportionallyResize(); + + } + + this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' }); + if(this.handles.constructor == String) { + + if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw'; + var n = this.handles.split(","); this.handles = {}; + + for(var i = 0; i < n.length; i++) { + + var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle; + var axis = $('
      '); + + // Apply zIndex to all handles - see #7960 + axis.css({ zIndex: o.zIndex }); + + //TODO : What's going on here? + if ('se' == handle) { + axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se'); + }; + + //Insert into internal handles object and append to element + this.handles[handle] = '.ui-resizable-'+handle; + this.element.append(axis); + } + + } + + this._renderAxis = function(target) { + + target = target || this.element; + + for(var i in this.handles) { + + if(this.handles[i].constructor == String) + this.handles[i] = $(this.handles[i], this.element).show(); + + //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls) + if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) { + + var axis = $(this.handles[i], this.element), padWrapper = 0; + + //Checking the correct pad and border + padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth(); + + //The padding type i have to apply... + var padPos = [ 'padding', + /ne|nw|n/.test(i) ? 'Top' : + /se|sw|s/.test(i) ? 'Bottom' : + /^e$/.test(i) ? 'Right' : 'Left' ].join(""); + + target.css(padPos, padWrapper); + + this._proportionallyResize(); + + } + + //TODO: What's that good for? There's not anything to be executed left + if(!$(this.handles[i]).length) + continue; + + } + }; + + //TODO: make renderAxis a prototype function + this._renderAxis(this.element); + + this._handles = $('.ui-resizable-handle', this.element) + .disableSelection(); + + //Matching axis name + this._handles.mouseover(function() { + if (!that.resizing) { + if (this.className) + var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); + //Axis, default = se + that.axis = axis && axis[1] ? axis[1] : 'se'; + } + }); + + //If we want to auto hide the elements + if (o.autoHide) { + this._handles.hide(); + $(this.element) + .addClass("ui-resizable-autohide") + .mouseenter(function() { + if (o.disabled) return; + $(this).removeClass("ui-resizable-autohide"); + that._handles.show(); + }) + .mouseleave(function(){ + if (o.disabled) return; + if (!that.resizing) { + $(this).addClass("ui-resizable-autohide"); + that._handles.hide(); + } + }); + } + + //Initialize the mouse interaction + this._mouseInit(); + + }, + + _destroy: function() { + + this._mouseDestroy(); + + var _destroy = function(exp) { + $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing") + .removeData("resizable").removeData("ui-resizable").unbind(".resizable").find('.ui-resizable-handle').remove(); + }; + + //TODO: Unwrap at same DOM position + if (this.elementIsWrapper) { + _destroy(this.element); + var wrapper = this.element; + this.originalElement.css({ + position: wrapper.css('position'), + width: wrapper.outerWidth(), + height: wrapper.outerHeight(), + top: wrapper.css('top'), + left: wrapper.css('left') + }).insertAfter( wrapper ); + wrapper.remove(); + } + + this.originalElement.css('resize', this.originalResizeStyle); + _destroy(this.originalElement); + + return this; + }, + + _mouseCapture: function(event) { + var handle = false; + for (var i in this.handles) { + if ($(this.handles[i])[0] == event.target) { + handle = true; + } + } + + return !this.options.disabled && handle; + }, + + _mouseStart: function(event) { + + var o = this.options, iniPos = this.element.position(), el = this.element; + + this.resizing = true; + this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() }; + + // bugfix for http://dev.jquery.com/ticket/1749 + if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) { + el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left }); + } + + this._renderProxy(); + + var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top')); + + if (o.containment) { + curleft += $(o.containment).scrollLeft() || 0; + curtop += $(o.containment).scrollTop() || 0; + } + + //Store needed variables + this.offset = this.helper.offset(); + this.position = { left: curleft, top: curtop }; + this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; + this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; + this.originalPosition = { left: curleft, top: curtop }; + this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() }; + this.originalMousePosition = { left: event.pageX, top: event.pageY }; + + //Aspect Ratio + this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1); + + var cursor = $('.ui-resizable-' + this.axis).css('cursor'); + $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor); + + el.addClass("ui-resizable-resizing"); + this._propagate("start", event); + return true; + }, + + _mouseDrag: function(event) { + + //Increase performance, avoid regex + var el = this.helper, o = this.options, props = {}, + that = this, smp = this.originalMousePosition, a = this.axis; + + var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0; + var trigger = this._change[a]; + if (!trigger) return false; + + // Calculate the attrs that will be change + var data = trigger.apply(this, [event, dx, dy]); + + // Put this in the mouseDrag handler since the user can start pressing shift while resizing + this._updateVirtualBoundaries(event.shiftKey); + if (this._aspectRatio || event.shiftKey) + data = this._updateRatio(data, event); + + data = this._respectSize(data, event); + + // plugins callbacks need to be called first + this._propagate("resize", event); + + el.css({ + top: this.position.top + "px", left: this.position.left + "px", + width: this.size.width + "px", height: this.size.height + "px" + }); + + if (!this._helper && this._proportionallyResizeElements.length) + this._proportionallyResize(); + + this._updateCache(data); + + // calling the user callback at the end + this._trigger('resize', event, this.ui()); + + return false; + }, + + _mouseStop: function(event) { + + this.resizing = false; + var o = this.options, that = this; + + if(this._helper) { + var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), + soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height, + soffsetw = ista ? 0 : that.sizeDiff.width; + + var s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) }, + left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null, + top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null; + + if (!o.animate) + this.element.css($.extend(s, { top: top, left: left })); + + that.helper.height(that.size.height); + that.helper.width(that.size.width); + + if (this._helper && !o.animate) this._proportionallyResize(); + } + + $('body').css('cursor', 'auto'); + + this.element.removeClass("ui-resizable-resizing"); + + this._propagate("stop", event); + + if (this._helper) this.helper.remove(); + return false; + + }, + + _updateVirtualBoundaries: function(forceAspectRatio) { + var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b; + + b = { + minWidth: isNumber(o.minWidth) ? o.minWidth : 0, + maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity, + minHeight: isNumber(o.minHeight) ? o.minHeight : 0, + maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity + }; + + if(this._aspectRatio || forceAspectRatio) { + // We want to create an enclosing box whose aspect ration is the requested one + // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension + pMinWidth = b.minHeight * this.aspectRatio; + pMinHeight = b.minWidth / this.aspectRatio; + pMaxWidth = b.maxHeight * this.aspectRatio; + pMaxHeight = b.maxWidth / this.aspectRatio; + + if(pMinWidth > b.minWidth) b.minWidth = pMinWidth; + if(pMinHeight > b.minHeight) b.minHeight = pMinHeight; + if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth; + if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight; + } + this._vBoundaries = b; + }, + + _updateCache: function(data) { + var o = this.options; + this.offset = this.helper.offset(); + if (isNumber(data.left)) this.position.left = data.left; + if (isNumber(data.top)) this.position.top = data.top; + if (isNumber(data.height)) this.size.height = data.height; + if (isNumber(data.width)) this.size.width = data.width; + }, + + _updateRatio: function(data, event) { + + var o = this.options, cpos = this.position, csize = this.size, a = this.axis; + + if (isNumber(data.height)) data.width = (data.height * this.aspectRatio); + else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio); + + if (a == 'sw') { + data.left = cpos.left + (csize.width - data.width); + data.top = null; + } + if (a == 'nw') { + data.top = cpos.top + (csize.height - data.height); + data.left = cpos.left + (csize.width - data.width); + } + + return data; + }, + + _respectSize: function(data, event) { + + var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis, + ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), + isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height); + + if (isminw) data.width = o.minWidth; + if (isminh) data.height = o.minHeight; + if (ismaxw) data.width = o.maxWidth; + if (ismaxh) data.height = o.maxHeight; + + var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height; + var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); + + if (isminw && cw) data.left = dw - o.minWidth; + if (ismaxw && cw) data.left = dw - o.maxWidth; + if (isminh && ch) data.top = dh - o.minHeight; + if (ismaxh && ch) data.top = dh - o.maxHeight; + + // fixing jump error on top/left - bug #2330 + var isNotwh = !data.width && !data.height; + if (isNotwh && !data.left && data.top) data.top = null; + else if (isNotwh && !data.top && data.left) data.left = null; + + return data; + }, + + _proportionallyResize: function() { + + var o = this.options; + if (!this._proportionallyResizeElements.length) return; + var element = this.helper || this.element; + + for (var i=0; i < this._proportionallyResizeElements.length; i++) { + + var prel = this._proportionallyResizeElements[i]; + + if (!this.borderDif) { + var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')], + p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')]; + + this.borderDif = $.map(b, function(v, i) { + var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0; + return border + padding; + }); + } + + prel.css({ + height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0, + width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0 + }); + + }; + + }, + + _renderProxy: function() { + + var el = this.element, o = this.options; + this.elementOffset = el.offset(); + + if(this._helper) { + + this.helper = this.helper || $('
      '); + + // fix ie6 offset TODO: This seems broken + var ie6offset = ($.ui.ie6 ? 1 : 0), + pxyoffset = ( $.ui.ie6 ? 2 : -1 ); + + this.helper.addClass(this._helper).css({ + width: this.element.outerWidth() + pxyoffset, + height: this.element.outerHeight() + pxyoffset, + position: 'absolute', + left: this.elementOffset.left - ie6offset +'px', + top: this.elementOffset.top - ie6offset +'px', + zIndex: ++o.zIndex //TODO: Don't modify option + }); + + this.helper + .appendTo("body") + .disableSelection(); + + } else { + this.helper = this.element; + } + + }, + + _change: { + e: function(event, dx, dy) { + return { width: this.originalSize.width + dx }; + }, + w: function(event, dx, dy) { + var o = this.options, cs = this.originalSize, sp = this.originalPosition; + return { left: sp.left + dx, width: cs.width - dx }; + }, + n: function(event, dx, dy) { + var o = this.options, cs = this.originalSize, sp = this.originalPosition; + return { top: sp.top + dy, height: cs.height - dy }; + }, + s: function(event, dx, dy) { + return { height: this.originalSize.height + dy }; + }, + se: function(event, dx, dy) { + return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); + }, + sw: function(event, dx, dy) { + return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); + }, + ne: function(event, dx, dy) { + return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); + }, + nw: function(event, dx, dy) { + return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); + } + }, + + _propagate: function(n, event) { + $.ui.plugin.call(this, n, [event, this.ui()]); + (n != "resize" && this._trigger(n, event, this.ui())); + }, + + plugins: {}, + + ui: function() { + return { + originalElement: this.originalElement, + element: this.element, + helper: this.helper, + position: this.position, + size: this.size, + originalSize: this.originalSize, + originalPosition: this.originalPosition + }; + } + +}); + +/* + * Resizable Extensions + */ + +$.ui.plugin.add("resizable", "alsoResize", { + + start: function (event, ui) { + var that = $(this).data("resizable"), o = that.options; + + var _store = function (exp) { + $(exp).each(function() { + var el = $(this); + el.data("resizable-alsoresize", { + width: parseInt(el.width(), 10), height: parseInt(el.height(), 10), + left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10) + }); + }); + }; + + if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) { + if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } + else { $.each(o.alsoResize, function (exp) { _store(exp); }); } + }else{ + _store(o.alsoResize); + } + }, + + resize: function (event, ui) { + var that = $(this).data("resizable"), o = that.options, os = that.originalSize, op = that.originalPosition; + + var delta = { + height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0, + top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0 + }, + + _alsoResize = function (exp, c) { + $(exp).each(function() { + var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, + css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left']; + + $.each(css, function (i, prop) { + var sum = (start[prop]||0) + (delta[prop]||0); + if (sum && sum >= 0) + style[prop] = sum || null; + }); + + el.css(style); + }); + }; + + if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { + $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); }); + }else{ + _alsoResize(o.alsoResize); + } + }, + + stop: function (event, ui) { + $(this).removeData("resizable-alsoresize"); + } +}); + +$.ui.plugin.add("resizable", "animate", { + + stop: function(event, ui) { + var that = $(this).data("resizable"), o = that.options; + + var pr = that._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), + soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height, + soffsetw = ista ? 0 : that.sizeDiff.width; + + var style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) }, + left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null, + top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null; + + that.element.animate( + $.extend(style, top && left ? { top: top, left: left } : {}), { + duration: o.animateDuration, + easing: o.animateEasing, + step: function() { + + var data = { + width: parseInt(that.element.css('width'), 10), + height: parseInt(that.element.css('height'), 10), + top: parseInt(that.element.css('top'), 10), + left: parseInt(that.element.css('left'), 10) + }; + + if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height }); + + // propagating resize, and updating values for each animation step + that._updateCache(data); + that._propagate("resize", event); + + } + } + ); + } + +}); + +$.ui.plugin.add("resizable", "containment", { + + start: function(event, ui) { + var that = $(this).data("resizable"), o = that.options, el = that.element; + var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc; + if (!ce) return; + + that.containerElement = $(ce); + + if (/document/.test(oc) || oc == document) { + that.containerOffset = { left: 0, top: 0 }; + that.containerPosition = { left: 0, top: 0 }; + + that.parentData = { + element: $(document), left: 0, top: 0, + width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight + }; + } + + // i'm a node, so compute top, left, right, bottom + else { + var element = $(ce), p = []; + $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); }); + + that.containerOffset = element.offset(); + that.containerPosition = element.position(); + that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) }; + + var co = that.containerOffset, ch = that.containerSize.height, cw = that.containerSize.width, + width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch); + + that.parentData = { + element: ce, left: co.left, top: co.top, width: width, height: height + }; + } + }, + + resize: function(event, ui) { + var that = $(this).data("resizable"), o = that.options, + ps = that.containerSize, co = that.containerOffset, cs = that.size, cp = that.position, + pRatio = that._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = that.containerElement; + + if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co; + + if (cp.left < (that._helper ? co.left : 0)) { + that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left)); + if (pRatio) that.size.height = that.size.width / that.aspectRatio; + that.position.left = o.helper ? co.left : 0; + } + + if (cp.top < (that._helper ? co.top : 0)) { + that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top); + if (pRatio) that.size.width = that.size.height * that.aspectRatio; + that.position.top = that._helper ? co.top : 0; + } + + that.offset.left = that.parentData.left+that.position.left; + that.offset.top = that.parentData.top+that.position.top; + + var woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width ), + hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height ); + + var isParent = that.containerElement.get(0) == that.element.parent().get(0), + isOffsetRelative = /relative|absolute/.test(that.containerElement.css('position')); + + if(isParent && isOffsetRelative) woset -= that.parentData.left; + + if (woset + that.size.width >= that.parentData.width) { + that.size.width = that.parentData.width - woset; + if (pRatio) that.size.height = that.size.width / that.aspectRatio; + } + + if (hoset + that.size.height >= that.parentData.height) { + that.size.height = that.parentData.height - hoset; + if (pRatio) that.size.width = that.size.height * that.aspectRatio; + } + }, + + stop: function(event, ui){ + var that = $(this).data("resizable"), o = that.options, cp = that.position, + co = that.containerOffset, cop = that.containerPosition, ce = that.containerElement; + + var helper = $(that.helper), ho = helper.offset(), w = helper.outerWidth() - that.sizeDiff.width, h = helper.outerHeight() - that.sizeDiff.height; + + if (that._helper && !o.animate && (/relative/).test(ce.css('position'))) + $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); + + if (that._helper && !o.animate && (/static/).test(ce.css('position'))) + $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); + + } +}); + +$.ui.plugin.add("resizable", "ghost", { + + start: function(event, ui) { + + var that = $(this).data("resizable"), o = that.options, cs = that.size; + + that.ghost = that.originalElement.clone(); + that.ghost + .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }) + .addClass('ui-resizable-ghost') + .addClass(typeof o.ghost == 'string' ? o.ghost : ''); + + that.ghost.appendTo(that.helper); + + }, + + resize: function(event, ui){ + var that = $(this).data("resizable"), o = that.options; + if (that.ghost) that.ghost.css({ position: 'relative', height: that.size.height, width: that.size.width }); + }, + + stop: function(event, ui){ + var that = $(this).data("resizable"), o = that.options; + if (that.ghost && that.helper) that.helper.get(0).removeChild(that.ghost.get(0)); + } + +}); + +$.ui.plugin.add("resizable", "grid", { + + resize: function(event, ui) { + var that = $(this).data("resizable"), o = that.options, cs = that.size, os = that.originalSize, op = that.originalPosition, a = that.axis, ratio = o._aspectRatio || event.shiftKey; + o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid; + var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1); + + if (/^(se|s|e)$/.test(a)) { + that.size.width = os.width + ox; + that.size.height = os.height + oy; + } + else if (/^(ne)$/.test(a)) { + that.size.width = os.width + ox; + that.size.height = os.height + oy; + that.position.top = op.top - oy; + } + else if (/^(sw)$/.test(a)) { + that.size.width = os.width + ox; + that.size.height = os.height + oy; + that.position.left = op.left - ox; + } + else { + that.size.width = os.width + ox; + that.size.height = os.height + oy; + that.position.top = op.top - oy; + that.position.left = op.left - ox; + } + } + +}); + +var num = function(v) { + return parseInt(v, 10) || 0; +}; + +var isNumber = function(value) { + return !isNaN(parseInt(value, 10)); +}; + +})(jQuery); +(function( $, undefined ) { + +$.widget("ui.selectable", $.ui.mouse, { + version: "1.9.2", + options: { + appendTo: 'body', + autoRefresh: true, + distance: 0, + filter: '*', + tolerance: 'touch' + }, + _create: function() { + var that = this; + + this.element.addClass("ui-selectable"); + + this.dragged = false; + + // cache selectee children based on filter + var selectees; + this.refresh = function() { + selectees = $(that.options.filter, that.element[0]); + selectees.addClass("ui-selectee"); + selectees.each(function() { + var $this = $(this); + var pos = $this.offset(); + $.data(this, "selectable-item", { + element: this, + $element: $this, + left: pos.left, + top: pos.top, + right: pos.left + $this.outerWidth(), + bottom: pos.top + $this.outerHeight(), + startselected: false, + selected: $this.hasClass('ui-selected'), + selecting: $this.hasClass('ui-selecting'), + unselecting: $this.hasClass('ui-unselecting') + }); + }); + }; + this.refresh(); + + this.selectees = selectees.addClass("ui-selectee"); + + this._mouseInit(); + + this.helper = $("
      "); + }, + + _destroy: function() { + this.selectees + .removeClass("ui-selectee") + .removeData("selectable-item"); + this.element + .removeClass("ui-selectable ui-selectable-disabled"); + this._mouseDestroy(); + }, + + _mouseStart: function(event) { + var that = this; + + this.opos = [event.pageX, event.pageY]; + + if (this.options.disabled) + return; + + var options = this.options; + + this.selectees = $(options.filter, this.element[0]); + + this._trigger("start", event); + + $(options.appendTo).append(this.helper); + // position helper (lasso) + this.helper.css({ + "left": event.clientX, + "top": event.clientY, + "width": 0, + "height": 0 + }); + + if (options.autoRefresh) { + this.refresh(); + } + + this.selectees.filter('.ui-selected').each(function() { + var selectee = $.data(this, "selectable-item"); + selectee.startselected = true; + if (!event.metaKey && !event.ctrlKey) { + selectee.$element.removeClass('ui-selected'); + selectee.selected = false; + selectee.$element.addClass('ui-unselecting'); + selectee.unselecting = true; + // selectable UNSELECTING callback + that._trigger("unselecting", event, { + unselecting: selectee.element + }); + } + }); + + $(event.target).parents().andSelf().each(function() { + var selectee = $.data(this, "selectable-item"); + if (selectee) { + var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected'); + selectee.$element + .removeClass(doSelect ? "ui-unselecting" : "ui-selected") + .addClass(doSelect ? "ui-selecting" : "ui-unselecting"); + selectee.unselecting = !doSelect; + selectee.selecting = doSelect; + selectee.selected = doSelect; + // selectable (UN)SELECTING callback + if (doSelect) { + that._trigger("selecting", event, { + selecting: selectee.element + }); + } else { + that._trigger("unselecting", event, { + unselecting: selectee.element + }); + } + return false; + } + }); + + }, + + _mouseDrag: function(event) { + var that = this; + this.dragged = true; + + if (this.options.disabled) + return; + + var options = this.options; + + var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY; + if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; } + if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; } + this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1}); + + this.selectees.each(function() { + var selectee = $.data(this, "selectable-item"); + //prevent helper from being selected if appendTo: selectable + if (!selectee || selectee.element == that.element[0]) + return; + var hit = false; + if (options.tolerance == 'touch') { + hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) ); + } else if (options.tolerance == 'fit') { + hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2); + } + + if (hit) { + // SELECT + if (selectee.selected) { + selectee.$element.removeClass('ui-selected'); + selectee.selected = false; + } + if (selectee.unselecting) { + selectee.$element.removeClass('ui-unselecting'); + selectee.unselecting = false; + } + if (!selectee.selecting) { + selectee.$element.addClass('ui-selecting'); + selectee.selecting = true; + // selectable SELECTING callback + that._trigger("selecting", event, { + selecting: selectee.element + }); + } + } else { + // UNSELECT + if (selectee.selecting) { + if ((event.metaKey || event.ctrlKey) && selectee.startselected) { + selectee.$element.removeClass('ui-selecting'); + selectee.selecting = false; + selectee.$element.addClass('ui-selected'); + selectee.selected = true; + } else { + selectee.$element.removeClass('ui-selecting'); + selectee.selecting = false; + if (selectee.startselected) { + selectee.$element.addClass('ui-unselecting'); + selectee.unselecting = true; + } + // selectable UNSELECTING callback + that._trigger("unselecting", event, { + unselecting: selectee.element + }); + } + } + if (selectee.selected) { + if (!event.metaKey && !event.ctrlKey && !selectee.startselected) { + selectee.$element.removeClass('ui-selected'); + selectee.selected = false; + + selectee.$element.addClass('ui-unselecting'); + selectee.unselecting = true; + // selectable UNSELECTING callback + that._trigger("unselecting", event, { + unselecting: selectee.element + }); + } + } + } + }); + + return false; + }, + + _mouseStop: function(event) { + var that = this; + + this.dragged = false; + + var options = this.options; + + $('.ui-unselecting', this.element[0]).each(function() { + var selectee = $.data(this, "selectable-item"); + selectee.$element.removeClass('ui-unselecting'); + selectee.unselecting = false; + selectee.startselected = false; + that._trigger("unselected", event, { + unselected: selectee.element + }); + }); + $('.ui-selecting', this.element[0]).each(function() { + var selectee = $.data(this, "selectable-item"); + selectee.$element.removeClass('ui-selecting').addClass('ui-selected'); + selectee.selecting = false; + selectee.selected = true; + selectee.startselected = true; + that._trigger("selected", event, { + selected: selectee.element + }); + }); + this._trigger("stop", event); + + this.helper.remove(); + + return false; + } + +}); + +})(jQuery); +(function( $, undefined ) { + +// number of pages in a slider +// (how many times can you page up/down to go through the whole range) +var numPages = 5; + +$.widget( "ui.slider", $.ui.mouse, { + version: "1.9.2", + widgetEventPrefix: "slide", + + options: { + animate: false, + distance: 0, + max: 100, + min: 0, + orientation: "horizontal", + range: false, + step: 1, + value: 0, + values: null + }, + + _create: function() { + var i, handleCount, + o = this.options, + existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ), + handle = "", + handles = []; + + this._keySliding = false; + this._mouseSliding = false; + this._animateOff = true; + this._handleIndex = null; + this._detectOrientation(); + this._mouseInit(); + + this.element + .addClass( "ui-slider" + + " ui-slider-" + this.orientation + + " ui-widget" + + " ui-widget-content" + + " ui-corner-all" + + ( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) ); + + this.range = $([]); + + if ( o.range ) { + if ( o.range === true ) { + if ( !o.values ) { + o.values = [ this._valueMin(), this._valueMin() ]; + } + if ( o.values.length && o.values.length !== 2 ) { + o.values = [ o.values[0], o.values[0] ]; + } + } + + this.range = $( "
      " ) + .appendTo( this.element ) + .addClass( "ui-slider-range" + + // note: this isn't the most fittingly semantic framework class for this element, + // but worked best visually with a variety of themes + " ui-widget-header" + + ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) ); + } + + handleCount = ( o.values && o.values.length ) || 1; + + for ( i = existingHandles.length; i < handleCount; i++ ) { + handles.push( handle ); + } + + this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) ); + + this.handle = this.handles.eq( 0 ); + + this.handles.add( this.range ).filter( "a" ) + .click(function( event ) { + event.preventDefault(); + }) + .mouseenter(function() { + if ( !o.disabled ) { + $( this ).addClass( "ui-state-hover" ); + } + }) + .mouseleave(function() { + $( this ).removeClass( "ui-state-hover" ); + }) + .focus(function() { + if ( !o.disabled ) { + $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" ); + $( this ).addClass( "ui-state-focus" ); + } else { + $( this ).blur(); + } + }) + .blur(function() { + $( this ).removeClass( "ui-state-focus" ); + }); + + this.handles.each(function( i ) { + $( this ).data( "ui-slider-handle-index", i ); + }); + + this._on( this.handles, { + keydown: function( event ) { + var allowed, curVal, newVal, step, + index = $( event.target ).data( "ui-slider-handle-index" ); + + switch ( event.keyCode ) { + case $.ui.keyCode.HOME: + case $.ui.keyCode.END: + case $.ui.keyCode.PAGE_UP: + case $.ui.keyCode.PAGE_DOWN: + case $.ui.keyCode.UP: + case $.ui.keyCode.RIGHT: + case $.ui.keyCode.DOWN: + case $.ui.keyCode.LEFT: + event.preventDefault(); + if ( !this._keySliding ) { + this._keySliding = true; + $( event.target ).addClass( "ui-state-active" ); + allowed = this._start( event, index ); + if ( allowed === false ) { + return; + } + } + break; + } + + step = this.options.step; + if ( this.options.values && this.options.values.length ) { + curVal = newVal = this.values( index ); + } else { + curVal = newVal = this.value(); + } + + switch ( event.keyCode ) { + case $.ui.keyCode.HOME: + newVal = this._valueMin(); + break; + case $.ui.keyCode.END: + newVal = this._valueMax(); + break; + case $.ui.keyCode.PAGE_UP: + newVal = this._trimAlignValue( curVal + ( (this._valueMax() - this._valueMin()) / numPages ) ); + break; + case $.ui.keyCode.PAGE_DOWN: + newVal = this._trimAlignValue( curVal - ( (this._valueMax() - this._valueMin()) / numPages ) ); + break; + case $.ui.keyCode.UP: + case $.ui.keyCode.RIGHT: + if ( curVal === this._valueMax() ) { + return; + } + newVal = this._trimAlignValue( curVal + step ); + break; + case $.ui.keyCode.DOWN: + case $.ui.keyCode.LEFT: + if ( curVal === this._valueMin() ) { + return; + } + newVal = this._trimAlignValue( curVal - step ); + break; + } + + this._slide( event, index, newVal ); + }, + keyup: function( event ) { + var index = $( event.target ).data( "ui-slider-handle-index" ); + + if ( this._keySliding ) { + this._keySliding = false; + this._stop( event, index ); + this._change( event, index ); + $( event.target ).removeClass( "ui-state-active" ); + } + } + }); + + this._refreshValue(); + + this._animateOff = false; + }, + + _destroy: function() { + this.handles.remove(); + this.range.remove(); + + this.element + .removeClass( "ui-slider" + + " ui-slider-horizontal" + + " ui-slider-vertical" + + " ui-slider-disabled" + + " ui-widget" + + " ui-widget-content" + + " ui-corner-all" ); + + this._mouseDestroy(); + }, + + _mouseCapture: function( event ) { + var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle, + that = this, + o = this.options; + + if ( o.disabled ) { + return false; + } + + this.elementSize = { + width: this.element.outerWidth(), + height: this.element.outerHeight() + }; + this.elementOffset = this.element.offset(); + + position = { x: event.pageX, y: event.pageY }; + normValue = this._normValueFromMouse( position ); + distance = this._valueMax() - this._valueMin() + 1; + this.handles.each(function( i ) { + var thisDistance = Math.abs( normValue - that.values(i) ); + if ( distance > thisDistance ) { + distance = thisDistance; + closestHandle = $( this ); + index = i; + } + }); + + // workaround for bug #3736 (if both handles of a range are at 0, + // the first is always used as the one with least distance, + // and moving it is obviously prevented by preventing negative ranges) + if( o.range === true && this.values(1) === o.min ) { + index += 1; + closestHandle = $( this.handles[index] ); + } + + allowed = this._start( event, index ); + if ( allowed === false ) { + return false; + } + this._mouseSliding = true; + + this._handleIndex = index; + + closestHandle + .addClass( "ui-state-active" ) + .focus(); + + offset = closestHandle.offset(); + mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" ); + this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { + left: event.pageX - offset.left - ( closestHandle.width() / 2 ), + top: event.pageY - offset.top - + ( closestHandle.height() / 2 ) - + ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) - + ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) + + ( parseInt( closestHandle.css("marginTop"), 10 ) || 0) + }; + + if ( !this.handles.hasClass( "ui-state-hover" ) ) { + this._slide( event, index, normValue ); + } + this._animateOff = true; + return true; + }, + + _mouseStart: function() { + return true; + }, + + _mouseDrag: function( event ) { + var position = { x: event.pageX, y: event.pageY }, + normValue = this._normValueFromMouse( position ); + + this._slide( event, this._handleIndex, normValue ); + + return false; + }, + + _mouseStop: function( event ) { + this.handles.removeClass( "ui-state-active" ); + this._mouseSliding = false; + + this._stop( event, this._handleIndex ); + this._change( event, this._handleIndex ); + + this._handleIndex = null; + this._clickOffset = null; + this._animateOff = false; + + return false; + }, + + _detectOrientation: function() { + this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; + }, + + _normValueFromMouse: function( position ) { + var pixelTotal, + pixelMouse, + percentMouse, + valueTotal, + valueMouse; + + if ( this.orientation === "horizontal" ) { + pixelTotal = this.elementSize.width; + pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 ); + } else { + pixelTotal = this.elementSize.height; + pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 ); + } + + percentMouse = ( pixelMouse / pixelTotal ); + if ( percentMouse > 1 ) { + percentMouse = 1; + } + if ( percentMouse < 0 ) { + percentMouse = 0; + } + if ( this.orientation === "vertical" ) { + percentMouse = 1 - percentMouse; + } + + valueTotal = this._valueMax() - this._valueMin(); + valueMouse = this._valueMin() + percentMouse * valueTotal; + + return this._trimAlignValue( valueMouse ); + }, + + _start: function( event, index ) { + var uiHash = { + handle: this.handles[ index ], + value: this.value() + }; + if ( this.options.values && this.options.values.length ) { + uiHash.value = this.values( index ); + uiHash.values = this.values(); + } + return this._trigger( "start", event, uiHash ); + }, + + _slide: function( event, index, newVal ) { + var otherVal, + newValues, + allowed; + + if ( this.options.values && this.options.values.length ) { + otherVal = this.values( index ? 0 : 1 ); + + if ( ( this.options.values.length === 2 && this.options.range === true ) && + ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) ) + ) { + newVal = otherVal; + } + + if ( newVal !== this.values( index ) ) { + newValues = this.values(); + newValues[ index ] = newVal; + // A slide can be canceled by returning false from the slide callback + allowed = this._trigger( "slide", event, { + handle: this.handles[ index ], + value: newVal, + values: newValues + } ); + otherVal = this.values( index ? 0 : 1 ); + if ( allowed !== false ) { + this.values( index, newVal, true ); + } + } + } else { + if ( newVal !== this.value() ) { + // A slide can be canceled by returning false from the slide callback + allowed = this._trigger( "slide", event, { + handle: this.handles[ index ], + value: newVal + } ); + if ( allowed !== false ) { + this.value( newVal ); + } + } + } + }, + + _stop: function( event, index ) { + var uiHash = { + handle: this.handles[ index ], + value: this.value() + }; + if ( this.options.values && this.options.values.length ) { + uiHash.value = this.values( index ); + uiHash.values = this.values(); + } + + this._trigger( "stop", event, uiHash ); + }, + + _change: function( event, index ) { + if ( !this._keySliding && !this._mouseSliding ) { + var uiHash = { + handle: this.handles[ index ], + value: this.value() + }; + if ( this.options.values && this.options.values.length ) { + uiHash.value = this.values( index ); + uiHash.values = this.values(); + } + + this._trigger( "change", event, uiHash ); + } + }, + + value: function( newValue ) { + if ( arguments.length ) { + this.options.value = this._trimAlignValue( newValue ); + this._refreshValue(); + this._change( null, 0 ); + return; + } + + return this._value(); + }, + + values: function( index, newValue ) { + var vals, + newValues, + i; + + if ( arguments.length > 1 ) { + this.options.values[ index ] = this._trimAlignValue( newValue ); + this._refreshValue(); + this._change( null, index ); + return; + } + + if ( arguments.length ) { + if ( $.isArray( arguments[ 0 ] ) ) { + vals = this.options.values; + newValues = arguments[ 0 ]; + for ( i = 0; i < vals.length; i += 1 ) { + vals[ i ] = this._trimAlignValue( newValues[ i ] ); + this._change( null, i ); + } + this._refreshValue(); + } else { + if ( this.options.values && this.options.values.length ) { + return this._values( index ); + } else { + return this.value(); + } + } + } else { + return this._values(); + } + }, + + _setOption: function( key, value ) { + var i, + valsLength = 0; + + if ( $.isArray( this.options.values ) ) { + valsLength = this.options.values.length; + } + + $.Widget.prototype._setOption.apply( this, arguments ); + + switch ( key ) { + case "disabled": + if ( value ) { + this.handles.filter( ".ui-state-focus" ).blur(); + this.handles.removeClass( "ui-state-hover" ); + this.handles.prop( "disabled", true ); + this.element.addClass( "ui-disabled" ); + } else { + this.handles.prop( "disabled", false ); + this.element.removeClass( "ui-disabled" ); + } + break; + case "orientation": + this._detectOrientation(); + this.element + .removeClass( "ui-slider-horizontal ui-slider-vertical" ) + .addClass( "ui-slider-" + this.orientation ); + this._refreshValue(); + break; + case "value": + this._animateOff = true; + this._refreshValue(); + this._change( null, 0 ); + this._animateOff = false; + break; + case "values": + this._animateOff = true; + this._refreshValue(); + for ( i = 0; i < valsLength; i += 1 ) { + this._change( null, i ); + } + this._animateOff = false; + break; + case "min": + case "max": + this._animateOff = true; + this._refreshValue(); + this._animateOff = false; + break; + } + }, + + //internal value getter + // _value() returns value trimmed by min and max, aligned by step + _value: function() { + var val = this.options.value; + val = this._trimAlignValue( val ); + + return val; + }, + + //internal values getter + // _values() returns array of values trimmed by min and max, aligned by step + // _values( index ) returns single value trimmed by min and max, aligned by step + _values: function( index ) { + var val, + vals, + i; + + if ( arguments.length ) { + val = this.options.values[ index ]; + val = this._trimAlignValue( val ); + + return val; + } else { + // .slice() creates a copy of the array + // this copy gets trimmed by min and max and then returned + vals = this.options.values.slice(); + for ( i = 0; i < vals.length; i+= 1) { + vals[ i ] = this._trimAlignValue( vals[ i ] ); + } + + return vals; + } + }, + + // returns the step-aligned value that val is closest to, between (inclusive) min and max + _trimAlignValue: function( val ) { + if ( val <= this._valueMin() ) { + return this._valueMin(); + } + if ( val >= this._valueMax() ) { + return this._valueMax(); + } + var step = ( this.options.step > 0 ) ? this.options.step : 1, + valModStep = (val - this._valueMin()) % step, + alignValue = val - valModStep; + + if ( Math.abs(valModStep) * 2 >= step ) { + alignValue += ( valModStep > 0 ) ? step : ( -step ); + } + + // Since JavaScript has problems with large floats, round + // the final value to 5 digits after the decimal point (see #4124) + return parseFloat( alignValue.toFixed(5) ); + }, + + _valueMin: function() { + return this.options.min; + }, + + _valueMax: function() { + return this.options.max; + }, + + _refreshValue: function() { + var lastValPercent, valPercent, value, valueMin, valueMax, + oRange = this.options.range, + o = this.options, + that = this, + animate = ( !this._animateOff ) ? o.animate : false, + _set = {}; + + if ( this.options.values && this.options.values.length ) { + this.handles.each(function( i ) { + valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100; + _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; + $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); + if ( that.options.range === true ) { + if ( that.orientation === "horizontal" ) { + if ( i === 0 ) { + that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate ); + } + if ( i === 1 ) { + that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); + } + } else { + if ( i === 0 ) { + that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate ); + } + if ( i === 1 ) { + that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); + } + } + } + lastValPercent = valPercent; + }); + } else { + value = this.value(); + valueMin = this._valueMin(); + valueMax = this._valueMax(); + valPercent = ( valueMax !== valueMin ) ? + ( value - valueMin ) / ( valueMax - valueMin ) * 100 : + 0; + _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; + this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); + + if ( oRange === "min" && this.orientation === "horizontal" ) { + this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate ); + } + if ( oRange === "max" && this.orientation === "horizontal" ) { + this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); + } + if ( oRange === "min" && this.orientation === "vertical" ) { + this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate ); + } + if ( oRange === "max" && this.orientation === "vertical" ) { + this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); + } + } + } + +}); + +}(jQuery)); +(function( $, undefined ) { + +$.widget("ui.sortable", $.ui.mouse, { + version: "1.9.2", + widgetEventPrefix: "sort", + ready: false, + options: { + appendTo: "parent", + axis: false, + connectWith: false, + containment: false, + cursor: 'auto', + cursorAt: false, + dropOnEmpty: true, + forcePlaceholderSize: false, + forceHelperSize: false, + grid: false, + handle: false, + helper: "original", + items: '> *', + opacity: false, + placeholder: false, + revert: false, + scroll: true, + scrollSensitivity: 20, + scrollSpeed: 20, + scope: "default", + tolerance: "intersect", + zIndex: 1000 + }, + _create: function() { + + var o = this.options; + this.containerCache = {}; + this.element.addClass("ui-sortable"); + + //Get the items + this.refresh(); + + //Let's determine if the items are being displayed horizontally + this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false; + + //Let's determine the parent's offset + this.offset = this.element.offset(); + + //Initialize mouse events for interaction + this._mouseInit(); + + //We're ready to go + this.ready = true + + }, + + _destroy: function() { + this.element + .removeClass("ui-sortable ui-sortable-disabled"); + this._mouseDestroy(); + + for ( var i = this.items.length - 1; i >= 0; i-- ) + this.items[i].item.removeData(this.widgetName + "-item"); + + return this; + }, + + _setOption: function(key, value){ + if ( key === "disabled" ) { + this.options[ key ] = value; + + this.widget().toggleClass( "ui-sortable-disabled", !!value ); + } else { + // Don't call widget base _setOption for disable as it adds ui-state-disabled class + $.Widget.prototype._setOption.apply(this, arguments); + } + }, + + _mouseCapture: function(event, overrideHandle) { + var that = this; + + if (this.reverting) { + return false; + } + + if(this.options.disabled || this.options.type == 'static') return false; + + //We have to refresh the items data once first + this._refreshItems(event); + + //Find out if the clicked node (or one of its parents) is a actual item in this.items + var currentItem = null, nodes = $(event.target).parents().each(function() { + if($.data(this, that.widgetName + '-item') == that) { + currentItem = $(this); + return false; + } + }); + if($.data(event.target, that.widgetName + '-item') == that) currentItem = $(event.target); + + if(!currentItem) return false; + if(this.options.handle && !overrideHandle) { + var validHandle = false; + + $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; }); + if(!validHandle) return false; + } + + this.currentItem = currentItem; + this._removeCurrentsFromItems(); + return true; + + }, + + _mouseStart: function(event, overrideHandle, noActivation) { + + var o = this.options; + this.currentContainer = this; + + //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture + this.refreshPositions(); + + //Create and append the visible helper + this.helper = this._createHelper(event); + + //Cache the helper size + this._cacheHelperProportions(); + + /* + * - Position generation - + * This block generates everything position related - it's the core of draggables. + */ + + //Cache the margins of the original element + this._cacheMargins(); + + //Get the next scrolling parent + this.scrollParent = this.helper.scrollParent(); + + //The element's absolute position on the page minus margins + this.offset = this.currentItem.offset(); + this.offset = { + top: this.offset.top - this.margins.top, + left: this.offset.left - this.margins.left + }; + + $.extend(this.offset, { + click: { //Where the click happened, relative to the element + left: event.pageX - this.offset.left, + top: event.pageY - this.offset.top + }, + parent: this._getParentOffset(), + relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper + }); + + // Only after we got the offset, we can change the helper's position to absolute + // TODO: Still need to figure out a way to make relative sorting possible + this.helper.css("position", "absolute"); + this.cssPosition = this.helper.css("position"); + + //Generate the original position + this.originalPosition = this._generatePosition(event); + this.originalPageX = event.pageX; + this.originalPageY = event.pageY; + + //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied + (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); + + //Cache the former DOM position + this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; + + //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way + if(this.helper[0] != this.currentItem[0]) { + this.currentItem.hide(); + } + + //Create the placeholder + this._createPlaceholder(); + + //Set a containment if given in the options + if(o.containment) + this._setContainment(); + + if(o.cursor) { // cursor option + if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor"); + $('body').css("cursor", o.cursor); + } + + if(o.opacity) { // opacity option + if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity"); + this.helper.css("opacity", o.opacity); + } + + if(o.zIndex) { // zIndex option + if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex"); + this.helper.css("zIndex", o.zIndex); + } + + //Prepare scrolling + if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') + this.overflowOffset = this.scrollParent.offset(); + + //Call callbacks + this._trigger("start", event, this._uiHash()); + + //Recache the helper size + if(!this._preserveHelperProportions) + this._cacheHelperProportions(); + + + //Post 'activate' events to possible containers + if(!noActivation) { + for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, this._uiHash(this)); } + } + + //Prepare possible droppables + if($.ui.ddmanager) + $.ui.ddmanager.current = this; + + if ($.ui.ddmanager && !o.dropBehaviour) + $.ui.ddmanager.prepareOffsets(this, event); + + this.dragging = true; + + this.helper.addClass("ui-sortable-helper"); + this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position + return true; + + }, + + _mouseDrag: function(event) { + + //Compute the helpers position + this.position = this._generatePosition(event); + this.positionAbs = this._convertPositionTo("absolute"); + + if (!this.lastPositionAbs) { + this.lastPositionAbs = this.positionAbs; + } + + //Do scrolling + if(this.options.scroll) { + var o = this.options, scrolled = false; + if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') { + + if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) + this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; + else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) + this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; + + if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) + this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed; + else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) + this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; + + } else { + + if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) + scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); + else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) + scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); + + if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) + scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); + else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) + scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); + + } + + if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) + $.ui.ddmanager.prepareOffsets(this, event); + } + + //Regenerate the absolute position used for position checks + this.positionAbs = this._convertPositionTo("absolute"); + + //Set the helper position + if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; + if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; + + //Rearrange + for (var i = this.items.length - 1; i >= 0; i--) { + + //Cache variables and intersection, continue if no intersection + var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item); + if (!intersection) continue; + + // Only put the placeholder inside the current Container, skip all + // items form other containers. This works because when moving + // an item from one container to another the + // currentContainer is switched before the placeholder is moved. + // + // Without this moving items in "sub-sortables" can cause the placeholder to jitter + // beetween the outer and inner container. + if (item.instance !== this.currentContainer) continue; + + if (itemElement != this.currentItem[0] //cannot intersect with itself + && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before + && !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked + && (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true) + //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container + ) { + + this.direction = intersection == 1 ? "down" : "up"; + + if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) { + this._rearrange(event, item); + } else { + break; + } + + this._trigger("change", event, this._uiHash()); + break; + } + } + + //Post events to containers + this._contactContainers(event); + + //Interconnect with droppables + if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); + + //Call callbacks + this._trigger('sort', event, this._uiHash()); + + this.lastPositionAbs = this.positionAbs; + return false; + + }, + + _mouseStop: function(event, noPropagation) { + + if(!event) return; + + //If we are using droppables, inform the manager about the drop + if ($.ui.ddmanager && !this.options.dropBehaviour) + $.ui.ddmanager.drop(this, event); + + if(this.options.revert) { + var that = this; + var cur = this.placeholder.offset(); + + this.reverting = true; + + $(this.helper).animate({ + left: cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), + top: cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) + }, parseInt(this.options.revert, 10) || 500, function() { + that._clear(event); + }); + } else { + this._clear(event, noPropagation); + } + + return false; + + }, + + cancel: function() { + + if(this.dragging) { + + this._mouseUp({ target: null }); + + if(this.options.helper == "original") + this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); + else + this.currentItem.show(); + + //Post deactivating events to containers + for (var i = this.containers.length - 1; i >= 0; i--){ + this.containers[i]._trigger("deactivate", null, this._uiHash(this)); + if(this.containers[i].containerCache.over) { + this.containers[i]._trigger("out", null, this._uiHash(this)); + this.containers[i].containerCache.over = 0; + } + } + + } + + if (this.placeholder) { + //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! + if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]); + if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove(); + + $.extend(this, { + helper: null, + dragging: false, + reverting: false, + _noFinalSort: null + }); + + if(this.domPosition.prev) { + $(this.domPosition.prev).after(this.currentItem); + } else { + $(this.domPosition.parent).prepend(this.currentItem); + } + } + + return this; + + }, + + serialize: function(o) { + + var items = this._getItemsAsjQuery(o && o.connected); + var str = []; o = o || {}; + + $(items).each(function() { + var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/)); + if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2])); + }); + + if(!str.length && o.key) { + str.push(o.key + '='); + } + + return str.join('&'); + + }, + + toArray: function(o) { + + var items = this._getItemsAsjQuery(o && o.connected); + var ret = []; o = o || {}; + + items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); }); + return ret; + + }, + + /* Be careful with the following core functions */ + _intersectsWith: function(item) { + + var x1 = this.positionAbs.left, + x2 = x1 + this.helperProportions.width, + y1 = this.positionAbs.top, + y2 = y1 + this.helperProportions.height; + + var l = item.left, + r = l + item.width, + t = item.top, + b = t + item.height; + + var dyClick = this.offset.click.top, + dxClick = this.offset.click.left; + + var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r; + + if( this.options.tolerance == "pointer" + || this.options.forcePointerForContainers + || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height']) + ) { + return isOverElement; + } else { + + return (l < x1 + (this.helperProportions.width / 2) // Right Half + && x2 - (this.helperProportions.width / 2) < r // Left Half + && t < y1 + (this.helperProportions.height / 2) // Bottom Half + && y2 - (this.helperProportions.height / 2) < b ); // Top Half + + } + }, + + _intersectsWithPointer: function(item) { + + var isOverElementHeight = (this.options.axis === 'x') || $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), + isOverElementWidth = (this.options.axis === 'y') || $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), + isOverElement = isOverElementHeight && isOverElementWidth, + verticalDirection = this._getDragVerticalDirection(), + horizontalDirection = this._getDragHorizontalDirection(); + + if (!isOverElement) + return false; + + return this.floating ? + ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 ) + : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) ); + + }, + + _intersectsWithSides: function(item) { + + var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height), + isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width), + verticalDirection = this._getDragVerticalDirection(), + horizontalDirection = this._getDragHorizontalDirection(); + + if (this.floating && horizontalDirection) { + return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf)); + } else { + return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf)); + } + + }, + + _getDragVerticalDirection: function() { + var delta = this.positionAbs.top - this.lastPositionAbs.top; + return delta != 0 && (delta > 0 ? "down" : "up"); + }, + + _getDragHorizontalDirection: function() { + var delta = this.positionAbs.left - this.lastPositionAbs.left; + return delta != 0 && (delta > 0 ? "right" : "left"); + }, + + refresh: function(event) { + this._refreshItems(event); + this.refreshPositions(); + return this; + }, + + _connectWith: function() { + var options = this.options; + return options.connectWith.constructor == String + ? [options.connectWith] + : options.connectWith; + }, + + _getItemsAsjQuery: function(connected) { + + var items = []; + var queries = []; + var connectWith = this._connectWith(); + + if(connectWith && connected) { + for (var i = connectWith.length - 1; i >= 0; i--){ + var cur = $(connectWith[i]); + for (var j = cur.length - 1; j >= 0; j--){ + var inst = $.data(cur[j], this.widgetName); + if(inst && inst != this && !inst.options.disabled) { + queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]); + } + }; + }; + } + + queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]); + + for (var i = queries.length - 1; i >= 0; i--){ + queries[i][0].each(function() { + items.push(this); + }); + }; + + return $(items); + + }, + + _removeCurrentsFromItems: function() { + + var list = this.currentItem.find(":data(" + this.widgetName + "-item)"); + + this.items = $.grep(this.items, function (item) { + for (var j=0; j < list.length; j++) { + if(list[j] == item.item[0]) + return false; + }; + return true; + }); + + }, + + _refreshItems: function(event) { + + this.items = []; + this.containers = [this]; + var items = this.items; + var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]]; + var connectWith = this._connectWith(); + + if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down + for (var i = connectWith.length - 1; i >= 0; i--){ + var cur = $(connectWith[i]); + for (var j = cur.length - 1; j >= 0; j--){ + var inst = $.data(cur[j], this.widgetName); + if(inst && inst != this && !inst.options.disabled) { + queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]); + this.containers.push(inst); + } + }; + }; + } + + for (var i = queries.length - 1; i >= 0; i--) { + var targetData = queries[i][1]; + var _queries = queries[i][0]; + + for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) { + var item = $(_queries[j]); + + item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager) + + items.push({ + item: item, + instance: targetData, + width: 0, height: 0, + left: 0, top: 0 + }); + }; + }; + + }, + + refreshPositions: function(fast) { + + //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change + if(this.offsetParent && this.helper) { + this.offset.parent = this._getParentOffset(); + } + + for (var i = this.items.length - 1; i >= 0; i--){ + var item = this.items[i]; + + //We ignore calculating positions of all connected containers when we're not over them + if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0]) + continue; + + var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; + + if (!fast) { + item.width = t.outerWidth(); + item.height = t.outerHeight(); + } + + var p = t.offset(); + item.left = p.left; + item.top = p.top; + }; + + if(this.options.custom && this.options.custom.refreshContainers) { + this.options.custom.refreshContainers.call(this); + } else { + for (var i = this.containers.length - 1; i >= 0; i--){ + var p = this.containers[i].element.offset(); + this.containers[i].containerCache.left = p.left; + this.containers[i].containerCache.top = p.top; + this.containers[i].containerCache.width = this.containers[i].element.outerWidth(); + this.containers[i].containerCache.height = this.containers[i].element.outerHeight(); + }; + } + + return this; + }, + + _createPlaceholder: function(that) { + that = that || this; + var o = that.options; + + if(!o.placeholder || o.placeholder.constructor == String) { + var className = o.placeholder; + o.placeholder = { + element: function() { + + var el = $(document.createElement(that.currentItem[0].nodeName)) + .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder") + .removeClass("ui-sortable-helper")[0]; + + if(!className) + el.style.visibility = "hidden"; + + return el; + }, + update: function(container, p) { + + // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that + // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified + if(className && !o.forcePlaceholderSize) return; + + //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item + if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css('paddingTop')||0, 10) - parseInt(that.currentItem.css('paddingBottom')||0, 10)); }; + if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css('paddingLeft')||0, 10) - parseInt(that.currentItem.css('paddingRight')||0, 10)); }; + } + }; + } + + //Create the placeholder + that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem)); + + //Append it after the actual current item + that.currentItem.after(that.placeholder); + + //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) + o.placeholder.update(that, that.placeholder); + + }, + + _contactContainers: function(event) { + + // get innermost container that intersects with item + var innermostContainer = null, innermostIndex = null; + + + for (var i = this.containers.length - 1; i >= 0; i--){ + + // never consider a container that's located within the item itself + if($.contains(this.currentItem[0], this.containers[i].element[0])) + continue; + + if(this._intersectsWith(this.containers[i].containerCache)) { + + // if we've already found a container and it's more "inner" than this, then continue + if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) + continue; + + innermostContainer = this.containers[i]; + innermostIndex = i; + + } else { + // container doesn't intersect. trigger "out" event if necessary + if(this.containers[i].containerCache.over) { + this.containers[i]._trigger("out", event, this._uiHash(this)); + this.containers[i].containerCache.over = 0; + } + } + + } + + // if no intersecting containers found, return + if(!innermostContainer) return; + + // move the item into the container if it's not there already + if(this.containers.length === 1) { + this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); + this.containers[innermostIndex].containerCache.over = 1; + } else { + + //When entering a new container, we will find the item with the least distance and append our item near it + var dist = 10000; var itemWithLeastDistance = null; + var posProperty = this.containers[innermostIndex].floating ? 'left' : 'top'; + var sizeProperty = this.containers[innermostIndex].floating ? 'width' : 'height'; + var base = this.positionAbs[posProperty] + this.offset.click[posProperty]; + for (var j = this.items.length - 1; j >= 0; j--) { + if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue; + if(this.items[j].item[0] == this.currentItem[0]) continue; + var cur = this.items[j].item.offset()[posProperty]; + var nearBottom = false; + if(Math.abs(cur - base) > Math.abs(cur + this.items[j][sizeProperty] - base)){ + nearBottom = true; + cur += this.items[j][sizeProperty]; + } + + if(Math.abs(cur - base) < dist) { + dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j]; + this.direction = nearBottom ? "up": "down"; + } + } + + if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled + return; + + this.currentContainer = this.containers[innermostIndex]; + itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true); + this._trigger("change", event, this._uiHash()); + this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); + + //Update the placeholder + this.options.placeholder.update(this.currentContainer, this.placeholder); + + this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); + this.containers[innermostIndex].containerCache.over = 1; + } + + + }, + + _createHelper: function(event) { + + var o = this.options; + var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem); + + if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already + $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); + + if(helper[0] == this.currentItem[0]) + this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") }; + + if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width()); + if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height()); + + return helper; + + }, + + _adjustOffsetFromHelper: function(obj) { + if (typeof obj == 'string') { + obj = obj.split(' '); + } + if ($.isArray(obj)) { + obj = {left: +obj[0], top: +obj[1] || 0}; + } + if ('left' in obj) { + this.offset.click.left = obj.left + this.margins.left; + } + if ('right' in obj) { + this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; + } + if ('top' in obj) { + this.offset.click.top = obj.top + this.margins.top; + } + if ('bottom' in obj) { + this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; + } + }, + + _getParentOffset: function() { + + + //Get the offsetParent and cache its position + this.offsetParent = this.helper.offsetParent(); + var po = this.offsetParent.offset(); + + // This is a special case where we need to modify a offset calculated on start, since the following happened: + // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent + // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that + // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag + if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) { + po.left += this.scrollParent.scrollLeft(); + po.top += this.scrollParent.scrollTop(); + } + + if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information + || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix + po = { top: 0, left: 0 }; + + return { + top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), + left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) + }; + + }, + + _getRelativeOffset: function() { + + if(this.cssPosition == "relative") { + var p = this.currentItem.position(); + return { + top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), + left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() + }; + } else { + return { top: 0, left: 0 }; + } + + }, + + _cacheMargins: function() { + this.margins = { + left: (parseInt(this.currentItem.css("marginLeft"),10) || 0), + top: (parseInt(this.currentItem.css("marginTop"),10) || 0) + }; + }, + + _cacheHelperProportions: function() { + this.helperProportions = { + width: this.helper.outerWidth(), + height: this.helper.outerHeight() + }; + }, + + _setContainment: function() { + + var o = this.options; + if(o.containment == 'parent') o.containment = this.helper[0].parentNode; + if(o.containment == 'document' || o.containment == 'window') this.containment = [ + 0 - this.offset.relative.left - this.offset.parent.left, + 0 - this.offset.relative.top - this.offset.parent.top, + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top + ]; + + if(!(/^(document|window|parent)$/).test(o.containment)) { + var ce = $(o.containment)[0]; + var co = $(o.containment).offset(); + var over = ($(ce).css("overflow") != 'hidden'); + + this.containment = [ + co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, + co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, + co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left, + co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top + ]; + } + + }, + + _convertPositionTo: function(d, pos) { + + if(!pos) pos = this.position; + var mod = d == "absolute" ? 1 : -1; + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + + return { + top: ( + pos.top // The absolute mouse position + + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent + + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) + - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) + ), + left: ( + pos.left // The absolute mouse position + + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent + + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) + - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) + ) + }; + + }, + + _generatePosition: function(event) { + + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + + // This is another very weird special case that only happens for relative elements: + // 1. If the css position is relative + // 2. and the scroll parent is the document or similar to the offset parent + // we have to refresh the relative offset during the scroll so there are no jumps + if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { + this.offset.relative = this._getRelativeOffset(); + } + + var pageX = event.pageX; + var pageY = event.pageY; + + /* + * - Position constraining - + * Constrain the position to a mix of grid, containment. + */ + + if(this.originalPosition) { //If we are not dragging yet, we won't check for options + + if(this.containment) { + if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left; + if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top; + if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left; + if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top; + } + + if(o.grid) { + var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; + pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; + + var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; + pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; + } + + } + + return { + top: ( + pageY // The absolute mouse position + - this.offset.click.top // Click offset (relative to the element) + - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent + - this.offset.parent.top // The offsetParent's offset without borders (offset + border) + + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) + ), + left: ( + pageX // The absolute mouse position + - this.offset.click.left // Click offset (relative to the element) + - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent + - this.offset.parent.left // The offsetParent's offset without borders (offset + border) + + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) + ) + }; + + }, + + _rearrange: function(event, i, a, hardRefresh) { + + a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling)); + + //Various things done here to improve the performance: + // 1. we create a setTimeout, that calls refreshPositions + // 2. on the instance, we have a counter variable, that get's higher after every append + // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same + // 4. this lets only the last addition to the timeout stack through + this.counter = this.counter ? ++this.counter : 1; + var counter = this.counter; + + this._delay(function() { + if(counter == this.counter) this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove + }); + + }, + + _clear: function(event, noPropagation) { + + this.reverting = false; + // We delay all events that have to be triggered to after the point where the placeholder has been removed and + // everything else normalized again + var delayedTriggers = []; + + // We first have to update the dom position of the actual currentItem + // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088) + if(!this._noFinalSort && this.currentItem.parent().length) this.placeholder.before(this.currentItem); + this._noFinalSort = null; + + if(this.helper[0] == this.currentItem[0]) { + for(var i in this._storedCSS) { + if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = ''; + } + this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); + } else { + this.currentItem.show(); + } + + if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); }); + if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed + + // Check if the items Container has Changed and trigger appropriate + // events. + if (this !== this.currentContainer) { + if(!noPropagation) { + delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); }); + delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer)); + delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer)); + } + } + + + //Post events to containers + for (var i = this.containers.length - 1; i >= 0; i--){ + if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i])); + if(this.containers[i].containerCache.over) { + delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i])); + this.containers[i].containerCache.over = 0; + } + } + + //Do what was originally in plugins + if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor + if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity + if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index + + this.dragging = false; + if(this.cancelHelperRemoval) { + if(!noPropagation) { + this._trigger("beforeStop", event, this._uiHash()); + for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events + this._trigger("stop", event, this._uiHash()); + } + + this.fromOutside = false; + return false; + } + + if(!noPropagation) this._trigger("beforeStop", event, this._uiHash()); + + //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! + this.placeholder[0].parentNode.removeChild(this.placeholder[0]); + + if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null; + + if(!noPropagation) { + for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events + this._trigger("stop", event, this._uiHash()); + } + + this.fromOutside = false; + return true; + + }, + + _trigger: function() { + if ($.Widget.prototype._trigger.apply(this, arguments) === false) { + this.cancel(); + } + }, + + _uiHash: function(_inst) { + var inst = _inst || this; + return { + helper: inst.helper, + placeholder: inst.placeholder || $([]), + position: inst.position, + originalPosition: inst.originalPosition, + offset: inst.positionAbs, + item: inst.currentItem, + sender: _inst ? _inst.element : null + }; + } + +}); + +})(jQuery); +(function( $ ) { + +function modifier( fn ) { + return function() { + var previous = this.element.val(); + fn.apply( this, arguments ); + this._refresh(); + if ( previous !== this.element.val() ) { + this._trigger( "change" ); + } + }; +} + +$.widget( "ui.spinner", { + version: "1.9.2", + defaultElement: "", + widgetEventPrefix: "spin", + options: { + culture: null, + icons: { + down: "ui-icon-triangle-1-s", + up: "ui-icon-triangle-1-n" + }, + incremental: true, + max: null, + min: null, + numberFormat: null, + page: 10, + step: 1, + + change: null, + spin: null, + start: null, + stop: null + }, + + _create: function() { + // handle string values that need to be parsed + this._setOption( "max", this.options.max ); + this._setOption( "min", this.options.min ); + this._setOption( "step", this.options.step ); + + // format the value, but don't constrain + this._value( this.element.val(), true ); + + this._draw(); + this._on( this._events ); + this._refresh(); + + // turning off autocomplete prevents the browser from remembering the + // value when navigating through history, so we re-enable autocomplete + // if the page is unloaded before the widget is destroyed. #7790 + this._on( this.window, { + beforeunload: function() { + this.element.removeAttr( "autocomplete" ); + } + }); + }, + + _getCreateOptions: function() { + var options = {}, + element = this.element; + + $.each( [ "min", "max", "step" ], function( i, option ) { + var value = element.attr( option ); + if ( value !== undefined && value.length ) { + options[ option ] = value; + } + }); + + return options; + }, + + _events: { + keydown: function( event ) { + if ( this._start( event ) && this._keydown( event ) ) { + event.preventDefault(); + } + }, + keyup: "_stop", + focus: function() { + this.previous = this.element.val(); + }, + blur: function( event ) { + if ( this.cancelBlur ) { + delete this.cancelBlur; + return; + } + + this._refresh(); + if ( this.previous !== this.element.val() ) { + this._trigger( "change", event ); + } + }, + mousewheel: function( event, delta ) { + if ( !delta ) { + return; + } + if ( !this.spinning && !this._start( event ) ) { + return false; + } + + this._spin( (delta > 0 ? 1 : -1) * this.options.step, event ); + clearTimeout( this.mousewheelTimer ); + this.mousewheelTimer = this._delay(function() { + if ( this.spinning ) { + this._stop( event ); + } + }, 100 ); + event.preventDefault(); + }, + "mousedown .ui-spinner-button": function( event ) { + var previous; + + // We never want the buttons to have focus; whenever the user is + // interacting with the spinner, the focus should be on the input. + // If the input is focused then this.previous is properly set from + // when the input first received focus. If the input is not focused + // then we need to set this.previous based on the value before spinning. + previous = this.element[0] === this.document[0].activeElement ? + this.previous : this.element.val(); + function checkFocus() { + var isActive = this.element[0] === this.document[0].activeElement; + if ( !isActive ) { + this.element.focus(); + this.previous = previous; + // support: IE + // IE sets focus asynchronously, so we need to check if focus + // moved off of the input because the user clicked on the button. + this._delay(function() { + this.previous = previous; + }); + } + } + + // ensure focus is on (or stays on) the text field + event.preventDefault(); + checkFocus.call( this ); + + // support: IE + // IE doesn't prevent moving focus even with event.preventDefault() + // so we set a flag to know when we should ignore the blur event + // and check (again) if focus moved off of the input. + this.cancelBlur = true; + this._delay(function() { + delete this.cancelBlur; + checkFocus.call( this ); + }); + + if ( this._start( event ) === false ) { + return; + } + + this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event ); + }, + "mouseup .ui-spinner-button": "_stop", + "mouseenter .ui-spinner-button": function( event ) { + // button will add ui-state-active if mouse was down while mouseleave and kept down + if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) { + return; + } + + if ( this._start( event ) === false ) { + return false; + } + this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event ); + }, + // TODO: do we really want to consider this a stop? + // shouldn't we just stop the repeater and wait until mouseup before + // we trigger the stop event? + "mouseleave .ui-spinner-button": "_stop" + }, + + _draw: function() { + var uiSpinner = this.uiSpinner = this.element + .addClass( "ui-spinner-input" ) + .attr( "autocomplete", "off" ) + .wrap( this._uiSpinnerHtml() ) + .parent() + // add buttons + .append( this._buttonHtml() ); + + this.element.attr( "role", "spinbutton" ); + + // button bindings + this.buttons = uiSpinner.find( ".ui-spinner-button" ) + .attr( "tabIndex", -1 ) + .button() + .removeClass( "ui-corner-all" ); + + // IE 6 doesn't understand height: 50% for the buttons + // unless the wrapper has an explicit height + if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) && + uiSpinner.height() > 0 ) { + uiSpinner.height( uiSpinner.height() ); + } + + // disable spinner if element was already disabled + if ( this.options.disabled ) { + this.disable(); + } + }, + + _keydown: function( event ) { + var options = this.options, + keyCode = $.ui.keyCode; + + switch ( event.keyCode ) { + case keyCode.UP: + this._repeat( null, 1, event ); + return true; + case keyCode.DOWN: + this._repeat( null, -1, event ); + return true; + case keyCode.PAGE_UP: + this._repeat( null, options.page, event ); + return true; + case keyCode.PAGE_DOWN: + this._repeat( null, -options.page, event ); + return true; + } + + return false; + }, + + _uiSpinnerHtml: function() { + return ""; + }, + + _buttonHtml: function() { + return "" + + "" + + "" + + "" + + "" + + "" + + ""; + }, + + _start: function( event ) { + if ( !this.spinning && this._trigger( "start", event ) === false ) { + return false; + } + + if ( !this.counter ) { + this.counter = 1; + } + this.spinning = true; + return true; + }, + + _repeat: function( i, steps, event ) { + i = i || 500; + + clearTimeout( this.timer ); + this.timer = this._delay(function() { + this._repeat( 40, steps, event ); + }, i ); + + this._spin( steps * this.options.step, event ); + }, + + _spin: function( step, event ) { + var value = this.value() || 0; + + if ( !this.counter ) { + this.counter = 1; + } + + value = this._adjustValue( value + step * this._increment( this.counter ) ); + + if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) { + this._value( value ); + this.counter++; + } + }, + + _increment: function( i ) { + var incremental = this.options.incremental; + + if ( incremental ) { + return $.isFunction( incremental ) ? + incremental( i ) : + Math.floor( i*i*i/50000 - i*i/500 + 17*i/200 + 1 ); + } + + return 1; + }, + + _precision: function() { + var precision = this._precisionOf( this.options.step ); + if ( this.options.min !== null ) { + precision = Math.max( precision, this._precisionOf( this.options.min ) ); + } + return precision; + }, + + _precisionOf: function( num ) { + var str = num.toString(), + decimal = str.indexOf( "." ); + return decimal === -1 ? 0 : str.length - decimal - 1; + }, + + _adjustValue: function( value ) { + var base, aboveMin, + options = this.options; + + // make sure we're at a valid step + // - find out where we are relative to the base (min or 0) + base = options.min !== null ? options.min : 0; + aboveMin = value - base; + // - round to the nearest step + aboveMin = Math.round(aboveMin / options.step) * options.step; + // - rounding is based on 0, so adjust back to our base + value = base + aboveMin; + + // fix precision from bad JS floating point math + value = parseFloat( value.toFixed( this._precision() ) ); + + // clamp the value + if ( options.max !== null && value > options.max) { + return options.max; + } + if ( options.min !== null && value < options.min ) { + return options.min; + } + + return value; + }, + + _stop: function( event ) { + if ( !this.spinning ) { + return; + } + + clearTimeout( this.timer ); + clearTimeout( this.mousewheelTimer ); + this.counter = 0; + this.spinning = false; + this._trigger( "stop", event ); + }, + + _setOption: function( key, value ) { + if ( key === "culture" || key === "numberFormat" ) { + var prevValue = this._parse( this.element.val() ); + this.options[ key ] = value; + this.element.val( this._format( prevValue ) ); + return; + } + + if ( key === "max" || key === "min" || key === "step" ) { + if ( typeof value === "string" ) { + value = this._parse( value ); + } + } + + this._super( key, value ); + + if ( key === "disabled" ) { + if ( value ) { + this.element.prop( "disabled", true ); + this.buttons.button( "disable" ); + } else { + this.element.prop( "disabled", false ); + this.buttons.button( "enable" ); + } + } + }, + + _setOptions: modifier(function( options ) { + this._super( options ); + this._value( this.element.val() ); + }), + + _parse: function( val ) { + if ( typeof val === "string" && val !== "" ) { + val = window.Globalize && this.options.numberFormat ? + Globalize.parseFloat( val, 10, this.options.culture ) : +val; + } + return val === "" || isNaN( val ) ? null : val; + }, + + _format: function( value ) { + if ( value === "" ) { + return ""; + } + return window.Globalize && this.options.numberFormat ? + Globalize.format( value, this.options.numberFormat, this.options.culture ) : + value; + }, + + _refresh: function() { + this.element.attr({ + "aria-valuemin": this.options.min, + "aria-valuemax": this.options.max, + // TODO: what should we do with values that can't be parsed? + "aria-valuenow": this._parse( this.element.val() ) + }); + }, + + // update the value without triggering change + _value: function( value, allowAny ) { + var parsed; + if ( value !== "" ) { + parsed = this._parse( value ); + if ( parsed !== null ) { + if ( !allowAny ) { + parsed = this._adjustValue( parsed ); + } + value = this._format( parsed ); + } + } + this.element.val( value ); + this._refresh(); + }, + + _destroy: function() { + this.element + .removeClass( "ui-spinner-input" ) + .prop( "disabled", false ) + .removeAttr( "autocomplete" ) + .removeAttr( "role" ) + .removeAttr( "aria-valuemin" ) + .removeAttr( "aria-valuemax" ) + .removeAttr( "aria-valuenow" ); + this.uiSpinner.replaceWith( this.element ); + }, + + stepUp: modifier(function( steps ) { + this._stepUp( steps ); + }), + _stepUp: function( steps ) { + this._spin( (steps || 1) * this.options.step ); + }, + + stepDown: modifier(function( steps ) { + this._stepDown( steps ); + }), + _stepDown: function( steps ) { + this._spin( (steps || 1) * -this.options.step ); + }, + + pageUp: modifier(function( pages ) { + this._stepUp( (pages || 1) * this.options.page ); + }), + + pageDown: modifier(function( pages ) { + this._stepDown( (pages || 1) * this.options.page ); + }), + + value: function( newVal ) { + if ( !arguments.length ) { + return this._parse( this.element.val() ); + } + modifier( this._value ).call( this, newVal ); + }, + + widget: function() { + return this.uiSpinner; + } +}); + +}( jQuery ) ); +(function( $, undefined ) { + +var tabId = 0, + rhash = /#.*$/; + +function getNextTabId() { + return ++tabId; +} + +function isLocal( anchor ) { + return anchor.hash.length > 1 && + anchor.href.replace( rhash, "" ) === + location.href.replace( rhash, "" ) + // support: Safari 5.1 + // Safari 5.1 doesn't encode spaces in window.location + // but it does encode spaces from anchors (#8777) + .replace( /\s/g, "%20" ); +} + +$.widget( "ui.tabs", { + version: "1.9.2", + delay: 300, + options: { + active: null, + collapsible: false, + event: "click", + heightStyle: "content", + hide: null, + show: null, + + // callbacks + activate: null, + beforeActivate: null, + beforeLoad: null, + load: null + }, + + _create: function() { + var that = this, + options = this.options, + active = options.active, + locationHash = location.hash.substring( 1 ); + + this.running = false; + + this.element + .addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" ) + .toggleClass( "ui-tabs-collapsible", options.collapsible ) + // Prevent users from focusing disabled tabs via click + .delegate( ".ui-tabs-nav > li", "mousedown" + this.eventNamespace, function( event ) { + if ( $( this ).is( ".ui-state-disabled" ) ) { + event.preventDefault(); + } + }) + // support: IE <9 + // Preventing the default action in mousedown doesn't prevent IE + // from focusing the element, so if the anchor gets focused, blur. + // We don't have to worry about focusing the previously focused + // element since clicking on a non-focusable element should focus + // the body anyway. + .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() { + if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) { + this.blur(); + } + }); + + this._processTabs(); + + if ( active === null ) { + // check the fragment identifier in the URL + if ( locationHash ) { + this.tabs.each(function( i, tab ) { + if ( $( tab ).attr( "aria-controls" ) === locationHash ) { + active = i; + return false; + } + }); + } + + // check for a tab marked active via a class + if ( active === null ) { + active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); + } + + // no active tab, set to false + if ( active === null || active === -1 ) { + active = this.tabs.length ? 0 : false; + } + } + + // handle numbers: negative, out of range + if ( active !== false ) { + active = this.tabs.index( this.tabs.eq( active ) ); + if ( active === -1 ) { + active = options.collapsible ? false : 0; + } + } + options.active = active; + + // don't allow collapsible: false and active: false + if ( !options.collapsible && options.active === false && this.anchors.length ) { + options.active = 0; + } + + // Take disabling tabs via class attribute from HTML + // into account and update option properly. + if ( $.isArray( options.disabled ) ) { + options.disabled = $.unique( options.disabled.concat( + $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { + return that.tabs.index( li ); + }) + ) ).sort(); + } + + // check for length avoids error when initializing empty list + if ( this.options.active !== false && this.anchors.length ) { + this.active = this._findActive( this.options.active ); + } else { + this.active = $(); + } + + this._refresh(); + + if ( this.active.length ) { + this.load( options.active ); + } + }, + + _getCreateEventData: function() { + return { + tab: this.active, + panel: !this.active.length ? $() : this._getPanelForTab( this.active ) + }; + }, + + _tabKeydown: function( event ) { + var focusedTab = $( this.document[0].activeElement ).closest( "li" ), + selectedIndex = this.tabs.index( focusedTab ), + goingForward = true; + + if ( this._handlePageNav( event ) ) { + return; + } + + switch ( event.keyCode ) { + case $.ui.keyCode.RIGHT: + case $.ui.keyCode.DOWN: + selectedIndex++; + break; + case $.ui.keyCode.UP: + case $.ui.keyCode.LEFT: + goingForward = false; + selectedIndex--; + break; + case $.ui.keyCode.END: + selectedIndex = this.anchors.length - 1; + break; + case $.ui.keyCode.HOME: + selectedIndex = 0; + break; + case $.ui.keyCode.SPACE: + // Activate only, no collapsing + event.preventDefault(); + clearTimeout( this.activating ); + this._activate( selectedIndex ); + return; + case $.ui.keyCode.ENTER: + // Toggle (cancel delayed activation, allow collapsing) + event.preventDefault(); + clearTimeout( this.activating ); + // Determine if we should collapse or activate + this._activate( selectedIndex === this.options.active ? false : selectedIndex ); + return; + default: + return; + } + + // Focus the appropriate tab, based on which key was pressed + event.preventDefault(); + clearTimeout( this.activating ); + selectedIndex = this._focusNextTab( selectedIndex, goingForward ); + + // Navigating with control key will prevent automatic activation + if ( !event.ctrlKey ) { + // Update aria-selected immediately so that AT think the tab is already selected. + // Otherwise AT may confuse the user by stating that they need to activate the tab, + // but the tab will already be activated by the time the announcement finishes. + focusedTab.attr( "aria-selected", "false" ); + this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" ); + + this.activating = this._delay(function() { + this.option( "active", selectedIndex ); + }, this.delay ); + } + }, + + _panelKeydown: function( event ) { + if ( this._handlePageNav( event ) ) { + return; + } + + // Ctrl+up moves focus to the current tab + if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { + event.preventDefault(); + this.active.focus(); + } + }, + + // Alt+page up/down moves focus to the previous/next tab (and activates) + _handlePageNav: function( event ) { + if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) { + this._activate( this._focusNextTab( this.options.active - 1, false ) ); + return true; + } + if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) { + this._activate( this._focusNextTab( this.options.active + 1, true ) ); + return true; + } + }, + + _findNextTab: function( index, goingForward ) { + var lastTabIndex = this.tabs.length - 1; + + function constrain() { + if ( index > lastTabIndex ) { + index = 0; + } + if ( index < 0 ) { + index = lastTabIndex; + } + return index; + } + + while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) { + index = goingForward ? index + 1 : index - 1; + } + + return index; + }, + + _focusNextTab: function( index, goingForward ) { + index = this._findNextTab( index, goingForward ); + this.tabs.eq( index ).focus(); + return index; + }, + + _setOption: function( key, value ) { + if ( key === "active" ) { + // _activate() will handle invalid values and update this.options + this._activate( value ); + return; + } + + if ( key === "disabled" ) { + // don't use the widget factory's disabled handling + this._setupDisabled( value ); + return; + } + + this._super( key, value); + + if ( key === "collapsible" ) { + this.element.toggleClass( "ui-tabs-collapsible", value ); + // Setting collapsible: false while collapsed; open first panel + if ( !value && this.options.active === false ) { + this._activate( 0 ); + } + } + + if ( key === "event" ) { + this._setupEvents( value ); + } + + if ( key === "heightStyle" ) { + this._setupHeightStyle( value ); + } + }, + + _tabId: function( tab ) { + return tab.attr( "aria-controls" ) || "ui-tabs-" + getNextTabId(); + }, + + _sanitizeSelector: function( hash ) { + return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : ""; + }, + + refresh: function() { + var options = this.options, + lis = this.tablist.children( ":has(a[href])" ); + + // get disabled tabs from class attribute from HTML + // this will get converted to a boolean if needed in _refresh() + options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) { + return lis.index( tab ); + }); + + this._processTabs(); + + // was collapsed or no tabs + if ( options.active === false || !this.anchors.length ) { + options.active = false; + this.active = $(); + // was active, but active tab is gone + } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) { + // all remaining tabs are disabled + if ( this.tabs.length === options.disabled.length ) { + options.active = false; + this.active = $(); + // activate previous tab + } else { + this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) ); + } + // was active, active tab still exists + } else { + // make sure active index is correct + options.active = this.tabs.index( this.active ); + } + + this._refresh(); + }, + + _refresh: function() { + this._setupDisabled( this.options.disabled ); + this._setupEvents( this.options.event ); + this._setupHeightStyle( this.options.heightStyle ); + + this.tabs.not( this.active ).attr({ + "aria-selected": "false", + tabIndex: -1 + }); + this.panels.not( this._getPanelForTab( this.active ) ) + .hide() + .attr({ + "aria-expanded": "false", + "aria-hidden": "true" + }); + + // Make sure one tab is in the tab order + if ( !this.active.length ) { + this.tabs.eq( 0 ).attr( "tabIndex", 0 ); + } else { + this.active + .addClass( "ui-tabs-active ui-state-active" ) + .attr({ + "aria-selected": "true", + tabIndex: 0 + }); + this._getPanelForTab( this.active ) + .show() + .attr({ + "aria-expanded": "true", + "aria-hidden": "false" + }); + } + }, + + _processTabs: function() { + var that = this; + + this.tablist = this._getList() + .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ) + .attr( "role", "tablist" ); + + this.tabs = this.tablist.find( "> li:has(a[href])" ) + .addClass( "ui-state-default ui-corner-top" ) + .attr({ + role: "tab", + tabIndex: -1 + }); + + this.anchors = this.tabs.map(function() { + return $( "a", this )[ 0 ]; + }) + .addClass( "ui-tabs-anchor" ) + .attr({ + role: "presentation", + tabIndex: -1 + }); + + this.panels = $(); + + this.anchors.each(function( i, anchor ) { + var selector, panel, panelId, + anchorId = $( anchor ).uniqueId().attr( "id" ), + tab = $( anchor ).closest( "li" ), + originalAriaControls = tab.attr( "aria-controls" ); + + // inline tab + if ( isLocal( anchor ) ) { + selector = anchor.hash; + panel = that.element.find( that._sanitizeSelector( selector ) ); + // remote tab + } else { + panelId = that._tabId( tab ); + selector = "#" + panelId; + panel = that.element.find( selector ); + if ( !panel.length ) { + panel = that._createPanel( panelId ); + panel.insertAfter( that.panels[ i - 1 ] || that.tablist ); + } + panel.attr( "aria-live", "polite" ); + } + + if ( panel.length) { + that.panels = that.panels.add( panel ); + } + if ( originalAriaControls ) { + tab.data( "ui-tabs-aria-controls", originalAriaControls ); + } + tab.attr({ + "aria-controls": selector.substring( 1 ), + "aria-labelledby": anchorId + }); + panel.attr( "aria-labelledby", anchorId ); + }); + + this.panels + .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) + .attr( "role", "tabpanel" ); + }, + + // allow overriding how to find the list for rare usage scenarios (#7715) + _getList: function() { + return this.element.find( "ol,ul" ).eq( 0 ); + }, + + _createPanel: function( id ) { + return $( "
      " ) + .attr( "id", id ) + .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) + .data( "ui-tabs-destroy", true ); + }, + + _setupDisabled: function( disabled ) { + if ( $.isArray( disabled ) ) { + if ( !disabled.length ) { + disabled = false; + } else if ( disabled.length === this.anchors.length ) { + disabled = true; + } + } + + // disable tabs + for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) { + if ( disabled === true || $.inArray( i, disabled ) !== -1 ) { + $( li ) + .addClass( "ui-state-disabled" ) + .attr( "aria-disabled", "true" ); + } else { + $( li ) + .removeClass( "ui-state-disabled" ) + .removeAttr( "aria-disabled" ); + } + } + + this.options.disabled = disabled; + }, + + _setupEvents: function( event ) { + var events = { + click: function( event ) { + event.preventDefault(); + } + }; + if ( event ) { + $.each( event.split(" "), function( index, eventName ) { + events[ eventName ] = "_eventHandler"; + }); + } + + this._off( this.anchors.add( this.tabs ).add( this.panels ) ); + this._on( this.anchors, events ); + this._on( this.tabs, { keydown: "_tabKeydown" } ); + this._on( this.panels, { keydown: "_panelKeydown" } ); + + this._focusable( this.tabs ); + this._hoverable( this.tabs ); + }, + + _setupHeightStyle: function( heightStyle ) { + var maxHeight, overflow, + parent = this.element.parent(); + + if ( heightStyle === "fill" ) { + // IE 6 treats height like minHeight, so we need to turn off overflow + // in order to get a reliable height + // we use the minHeight support test because we assume that only + // browsers that don't support minHeight will treat height as minHeight + if ( !$.support.minHeight ) { + overflow = parent.css( "overflow" ); + parent.css( "overflow", "hidden"); + } + maxHeight = parent.height(); + this.element.siblings( ":visible" ).each(function() { + var elem = $( this ), + position = elem.css( "position" ); + + if ( position === "absolute" || position === "fixed" ) { + return; + } + maxHeight -= elem.outerHeight( true ); + }); + if ( overflow ) { + parent.css( "overflow", overflow ); + } + + this.element.children().not( this.panels ).each(function() { + maxHeight -= $( this ).outerHeight( true ); + }); + + this.panels.each(function() { + $( this ).height( Math.max( 0, maxHeight - + $( this ).innerHeight() + $( this ).height() ) ); + }) + .css( "overflow", "auto" ); + } else if ( heightStyle === "auto" ) { + maxHeight = 0; + this.panels.each(function() { + maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); + }).height( maxHeight ); + } + }, + + _eventHandler: function( event ) { + var options = this.options, + active = this.active, + anchor = $( event.currentTarget ), + tab = anchor.closest( "li" ), + clickedIsActive = tab[ 0 ] === active[ 0 ], + collapsing = clickedIsActive && options.collapsible, + toShow = collapsing ? $() : this._getPanelForTab( tab ), + toHide = !active.length ? $() : this._getPanelForTab( active ), + eventData = { + oldTab: active, + oldPanel: toHide, + newTab: collapsing ? $() : tab, + newPanel: toShow + }; + + event.preventDefault(); + + if ( tab.hasClass( "ui-state-disabled" ) || + // tab is already loading + tab.hasClass( "ui-tabs-loading" ) || + // can't switch durning an animation + this.running || + // click on active header, but not collapsible + ( clickedIsActive && !options.collapsible ) || + // allow canceling activation + ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { + return; + } + + options.active = collapsing ? false : this.tabs.index( tab ); + + this.active = clickedIsActive ? $() : tab; + if ( this.xhr ) { + this.xhr.abort(); + } + + if ( !toHide.length && !toShow.length ) { + $.error( "jQuery UI Tabs: Mismatching fragment identifier." ); + } + + if ( toShow.length ) { + this.load( this.tabs.index( tab ), event ); + } + this._toggle( event, eventData ); + }, + + // handles show/hide for selecting tabs + _toggle: function( event, eventData ) { + var that = this, + toShow = eventData.newPanel, + toHide = eventData.oldPanel; + + this.running = true; + + function complete() { + that.running = false; + that._trigger( "activate", event, eventData ); + } + + function show() { + eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" ); + + if ( toShow.length && that.options.show ) { + that._show( toShow, that.options.show, complete ); + } else { + toShow.show(); + complete(); + } + } + + // start out by hiding, then showing, then completing + if ( toHide.length && this.options.hide ) { + this._hide( toHide, this.options.hide, function() { + eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); + show(); + }); + } else { + eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); + toHide.hide(); + show(); + } + + toHide.attr({ + "aria-expanded": "false", + "aria-hidden": "true" + }); + eventData.oldTab.attr( "aria-selected", "false" ); + // If we're switching tabs, remove the old tab from the tab order. + // If we're opening from collapsed state, remove the previous tab from the tab order. + // If we're collapsing, then keep the collapsing tab in the tab order. + if ( toShow.length && toHide.length ) { + eventData.oldTab.attr( "tabIndex", -1 ); + } else if ( toShow.length ) { + this.tabs.filter(function() { + return $( this ).attr( "tabIndex" ) === 0; + }) + .attr( "tabIndex", -1 ); + } + + toShow.attr({ + "aria-expanded": "true", + "aria-hidden": "false" + }); + eventData.newTab.attr({ + "aria-selected": "true", + tabIndex: 0 + }); + }, + + _activate: function( index ) { + var anchor, + active = this._findActive( index ); + + // trying to activate the already active panel + if ( active[ 0 ] === this.active[ 0 ] ) { + return; + } + + // trying to collapse, simulate a click on the current active header + if ( !active.length ) { + active = this.active; + } + + anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; + this._eventHandler({ + target: anchor, + currentTarget: anchor, + preventDefault: $.noop + }); + }, + + _findActive: function( index ) { + return index === false ? $() : this.tabs.eq( index ); + }, + + _getIndex: function( index ) { + // meta-function to give users option to provide a href string instead of a numerical index. + if ( typeof index === "string" ) { + index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) ); + } + + return index; + }, + + _destroy: function() { + if ( this.xhr ) { + this.xhr.abort(); + } + + this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" ); + + this.tablist + .removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ) + .removeAttr( "role" ); + + this.anchors + .removeClass( "ui-tabs-anchor" ) + .removeAttr( "role" ) + .removeAttr( "tabIndex" ) + .removeData( "href.tabs" ) + .removeData( "load.tabs" ) + .removeUniqueId(); + + this.tabs.add( this.panels ).each(function() { + if ( $.data( this, "ui-tabs-destroy" ) ) { + $( this ).remove(); + } else { + $( this ) + .removeClass( "ui-state-default ui-state-active ui-state-disabled " + + "ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" ) + .removeAttr( "tabIndex" ) + .removeAttr( "aria-live" ) + .removeAttr( "aria-busy" ) + .removeAttr( "aria-selected" ) + .removeAttr( "aria-labelledby" ) + .removeAttr( "aria-hidden" ) + .removeAttr( "aria-expanded" ) + .removeAttr( "role" ); + } + }); + + this.tabs.each(function() { + var li = $( this ), + prev = li.data( "ui-tabs-aria-controls" ); + if ( prev ) { + li.attr( "aria-controls", prev ); + } else { + li.removeAttr( "aria-controls" ); + } + }); + + this.panels.show(); + + if ( this.options.heightStyle !== "content" ) { + this.panels.css( "height", "" ); + } + }, + + enable: function( index ) { + var disabled = this.options.disabled; + if ( disabled === false ) { + return; + } + + if ( index === undefined ) { + disabled = false; + } else { + index = this._getIndex( index ); + if ( $.isArray( disabled ) ) { + disabled = $.map( disabled, function( num ) { + return num !== index ? num : null; + }); + } else { + disabled = $.map( this.tabs, function( li, num ) { + return num !== index ? num : null; + }); + } + } + this._setupDisabled( disabled ); + }, + + disable: function( index ) { + var disabled = this.options.disabled; + if ( disabled === true ) { + return; + } + + if ( index === undefined ) { + disabled = true; + } else { + index = this._getIndex( index ); + if ( $.inArray( index, disabled ) !== -1 ) { + return; + } + if ( $.isArray( disabled ) ) { + disabled = $.merge( [ index ], disabled ).sort(); + } else { + disabled = [ index ]; + } + } + this._setupDisabled( disabled ); + }, + + load: function( index, event ) { + index = this._getIndex( index ); + var that = this, + tab = this.tabs.eq( index ), + anchor = tab.find( ".ui-tabs-anchor" ), + panel = this._getPanelForTab( tab ), + eventData = { + tab: tab, + panel: panel + }; + + // not remote + if ( isLocal( anchor[ 0 ] ) ) { + return; + } + + this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) ); + + // support: jQuery <1.8 + // jQuery <1.8 returns false if the request is canceled in beforeSend, + // but as of 1.8, $.ajax() always returns a jqXHR object. + if ( this.xhr && this.xhr.statusText !== "canceled" ) { + tab.addClass( "ui-tabs-loading" ); + panel.attr( "aria-busy", "true" ); + + this.xhr + .success(function( response ) { + // support: jQuery <1.8 + // http://bugs.jquery.com/ticket/11778 + setTimeout(function() { + panel.html( response ); + that._trigger( "load", event, eventData ); + }, 1 ); + }) + .complete(function( jqXHR, status ) { + // support: jQuery <1.8 + // http://bugs.jquery.com/ticket/11778 + setTimeout(function() { + if ( status === "abort" ) { + that.panels.stop( false, true ); + } + + tab.removeClass( "ui-tabs-loading" ); + panel.removeAttr( "aria-busy" ); + + if ( jqXHR === that.xhr ) { + delete that.xhr; + } + }, 1 ); + }); + } + }, + + // TODO: Remove this function in 1.10 when ajaxOptions is removed + _ajaxSettings: function( anchor, event, eventData ) { + var that = this; + return { + url: anchor.attr( "href" ), + beforeSend: function( jqXHR, settings ) { + return that._trigger( "beforeLoad", event, + $.extend( { jqXHR : jqXHR, ajaxSettings: settings }, eventData ) ); + } + }; + }, + + _getPanelForTab: function( tab ) { + var id = $( tab ).attr( "aria-controls" ); + return this.element.find( this._sanitizeSelector( "#" + id ) ); + } +}); + +// DEPRECATED +if ( $.uiBackCompat !== false ) { + + // helper method for a lot of the back compat extensions + $.ui.tabs.prototype._ui = function( tab, panel ) { + return { + tab: tab, + panel: panel, + index: this.anchors.index( tab ) + }; + }; + + // url method + $.widget( "ui.tabs", $.ui.tabs, { + url: function( index, url ) { + this.anchors.eq( index ).attr( "href", url ); + } + }); + + // TODO: Remove _ajaxSettings() method when removing this extension + // ajaxOptions and cache options + $.widget( "ui.tabs", $.ui.tabs, { + options: { + ajaxOptions: null, + cache: false + }, + + _create: function() { + this._super(); + + var that = this; + + this._on({ tabsbeforeload: function( event, ui ) { + // tab is already cached + if ( $.data( ui.tab[ 0 ], "cache.tabs" ) ) { + event.preventDefault(); + return; + } + + ui.jqXHR.success(function() { + if ( that.options.cache ) { + $.data( ui.tab[ 0 ], "cache.tabs", true ); + } + }); + }}); + }, + + _ajaxSettings: function( anchor, event, ui ) { + var ajaxOptions = this.options.ajaxOptions; + return $.extend( {}, ajaxOptions, { + error: function( xhr, status ) { + try { + // Passing index avoid a race condition when this method is + // called after the user has selected another tab. + // Pass the anchor that initiated this request allows + // loadError to manipulate the tab content panel via $(a.hash) + ajaxOptions.error( + xhr, status, ui.tab.closest( "li" ).index(), ui.tab[ 0 ] ); + } + catch ( error ) {} + } + }, this._superApply( arguments ) ); + }, + + _setOption: function( key, value ) { + // reset cache if switching from cached to not cached + if ( key === "cache" && value === false ) { + this.anchors.removeData( "cache.tabs" ); + } + this._super( key, value ); + }, + + _destroy: function() { + this.anchors.removeData( "cache.tabs" ); + this._super(); + }, + + url: function( index ){ + this.anchors.eq( index ).removeData( "cache.tabs" ); + this._superApply( arguments ); + } + }); + + // abort method + $.widget( "ui.tabs", $.ui.tabs, { + abort: function() { + if ( this.xhr ) { + this.xhr.abort(); + } + } + }); + + // spinner + $.widget( "ui.tabs", $.ui.tabs, { + options: { + spinner: "Loading…" + }, + _create: function() { + this._super(); + this._on({ + tabsbeforeload: function( event, ui ) { + // Don't react to nested tabs or tabs that don't use a spinner + if ( event.target !== this.element[ 0 ] || + !this.options.spinner ) { + return; + } + + var span = ui.tab.find( "span" ), + html = span.html(); + span.html( this.options.spinner ); + ui.jqXHR.complete(function() { + span.html( html ); + }); + } + }); + } + }); + + // enable/disable events + $.widget( "ui.tabs", $.ui.tabs, { + options: { + enable: null, + disable: null + }, + + enable: function( index ) { + var options = this.options, + trigger; + + if ( index && options.disabled === true || + ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) !== -1 ) ) { + trigger = true; + } + + this._superApply( arguments ); + + if ( trigger ) { + this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); + } + }, + + disable: function( index ) { + var options = this.options, + trigger; + + if ( index && options.disabled === false || + ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) === -1 ) ) { + trigger = true; + } + + this._superApply( arguments ); + + if ( trigger ) { + this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); + } + } + }); + + // add/remove methods and events + $.widget( "ui.tabs", $.ui.tabs, { + options: { + add: null, + remove: null, + tabTemplate: "
    • #{label}
    • " + }, + + add: function( url, label, index ) { + if ( index === undefined ) { + index = this.anchors.length; + } + + var doInsertAfter, panel, + options = this.options, + li = $( options.tabTemplate + .replace( /#\{href\}/g, url ) + .replace( /#\{label\}/g, label ) ), + id = !url.indexOf( "#" ) ? + url.replace( "#", "" ) : + this._tabId( li ); + + li.addClass( "ui-state-default ui-corner-top" ).data( "ui-tabs-destroy", true ); + li.attr( "aria-controls", id ); + + doInsertAfter = index >= this.tabs.length; + + // try to find an existing element before creating a new one + panel = this.element.find( "#" + id ); + if ( !panel.length ) { + panel = this._createPanel( id ); + if ( doInsertAfter ) { + if ( index > 0 ) { + panel.insertAfter( this.panels.eq( -1 ) ); + } else { + panel.appendTo( this.element ); + } + } else { + panel.insertBefore( this.panels[ index ] ); + } + } + panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ).hide(); + + if ( doInsertAfter ) { + li.appendTo( this.tablist ); + } else { + li.insertBefore( this.tabs[ index ] ); + } + + options.disabled = $.map( options.disabled, function( n ) { + return n >= index ? ++n : n; + }); + + this.refresh(); + if ( this.tabs.length === 1 && options.active === false ) { + this.option( "active", 0 ); + } + + this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); + return this; + }, + + remove: function( index ) { + index = this._getIndex( index ); + var options = this.options, + tab = this.tabs.eq( index ).remove(), + panel = this._getPanelForTab( tab ).remove(); + + // If selected tab was removed focus tab to the right or + // in case the last tab was removed the tab to the left. + // We check for more than 2 tabs, because if there are only 2, + // then when we remove this tab, there will only be one tab left + // so we don't need to detect which tab to activate. + if ( tab.hasClass( "ui-tabs-active" ) && this.anchors.length > 2 ) { + this._activate( index + ( index + 1 < this.anchors.length ? 1 : -1 ) ); + } + + options.disabled = $.map( + $.grep( options.disabled, function( n ) { + return n !== index; + }), + function( n ) { + return n >= index ? --n : n; + }); + + this.refresh(); + + this._trigger( "remove", null, this._ui( tab.find( "a" )[ 0 ], panel[ 0 ] ) ); + return this; + } + }); + + // length method + $.widget( "ui.tabs", $.ui.tabs, { + length: function() { + return this.anchors.length; + } + }); + + // panel ids (idPrefix option + title attribute) + $.widget( "ui.tabs", $.ui.tabs, { + options: { + idPrefix: "ui-tabs-" + }, + + _tabId: function( tab ) { + var a = tab.is( "li" ) ? tab.find( "a[href]" ) : tab; + a = a[0]; + return $( a ).closest( "li" ).attr( "aria-controls" ) || + a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF\-]/g, "" ) || + this.options.idPrefix + getNextTabId(); + } + }); + + // _createPanel method + $.widget( "ui.tabs", $.ui.tabs, { + options: { + panelTemplate: "
      " + }, + + _createPanel: function( id ) { + return $( this.options.panelTemplate ) + .attr( "id", id ) + .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) + .data( "ui-tabs-destroy", true ); + } + }); + + // selected option + $.widget( "ui.tabs", $.ui.tabs, { + _create: function() { + var options = this.options; + if ( options.active === null && options.selected !== undefined ) { + options.active = options.selected === -1 ? false : options.selected; + } + this._super(); + options.selected = options.active; + if ( options.selected === false ) { + options.selected = -1; + } + }, + + _setOption: function( key, value ) { + if ( key !== "selected" ) { + return this._super( key, value ); + } + + var options = this.options; + this._super( "active", value === -1 ? false : value ); + options.selected = options.active; + if ( options.selected === false ) { + options.selected = -1; + } + }, + + _eventHandler: function() { + this._superApply( arguments ); + this.options.selected = this.options.active; + if ( this.options.selected === false ) { + this.options.selected = -1; + } + } + }); + + // show and select event + $.widget( "ui.tabs", $.ui.tabs, { + options: { + show: null, + select: null + }, + _create: function() { + this._super(); + if ( this.options.active !== false ) { + this._trigger( "show", null, this._ui( + this.active.find( ".ui-tabs-anchor" )[ 0 ], + this._getPanelForTab( this.active )[ 0 ] ) ); + } + }, + _trigger: function( type, event, data ) { + var tab, panel, + ret = this._superApply( arguments ); + + if ( !ret ) { + return false; + } + + if ( type === "beforeActivate" ) { + tab = data.newTab.length ? data.newTab : data.oldTab; + panel = data.newPanel.length ? data.newPanel : data.oldPanel; + ret = this._super( "select", event, { + tab: tab.find( ".ui-tabs-anchor" )[ 0], + panel: panel[ 0 ], + index: tab.closest( "li" ).index() + }); + } else if ( type === "activate" && data.newTab.length ) { + ret = this._super( "show", event, { + tab: data.newTab.find( ".ui-tabs-anchor" )[ 0 ], + panel: data.newPanel[ 0 ], + index: data.newTab.closest( "li" ).index() + }); + } + return ret; + } + }); + + // select method + $.widget( "ui.tabs", $.ui.tabs, { + select: function( index ) { + index = this._getIndex( index ); + if ( index === -1 ) { + if ( this.options.collapsible && this.options.selected !== -1 ) { + index = this.options.selected; + } else { + return; + } + } + this.anchors.eq( index ).trigger( this.options.event + this.eventNamespace ); + } + }); + + // cookie option + (function() { + + var listId = 0; + + $.widget( "ui.tabs", $.ui.tabs, { + options: { + cookie: null // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true } + }, + _create: function() { + var options = this.options, + active; + if ( options.active == null && options.cookie ) { + active = parseInt( this._cookie(), 10 ); + if ( active === -1 ) { + active = false; + } + options.active = active; + } + this._super(); + }, + _cookie: function( active ) { + var cookie = [ this.cookie || + ( this.cookie = this.options.cookie.name || "ui-tabs-" + (++listId) ) ]; + if ( arguments.length ) { + cookie.push( active === false ? -1 : active ); + cookie.push( this.options.cookie ); + } + return $.cookie.apply( null, cookie ); + }, + _refresh: function() { + this._super(); + if ( this.options.cookie ) { + this._cookie( this.options.active, this.options.cookie ); + } + }, + _eventHandler: function() { + this._superApply( arguments ); + if ( this.options.cookie ) { + this._cookie( this.options.active, this.options.cookie ); + } + }, + _destroy: function() { + this._super(); + if ( this.options.cookie ) { + this._cookie( null, this.options.cookie ); + } + } + }); + + })(); + + // load event + $.widget( "ui.tabs", $.ui.tabs, { + _trigger: function( type, event, data ) { + var _data = $.extend( {}, data ); + if ( type === "load" ) { + _data.panel = _data.panel[ 0 ]; + _data.tab = _data.tab.find( ".ui-tabs-anchor" )[ 0 ]; + } + return this._super( type, event, _data ); + } + }); + + // fx option + // The new animation options (show, hide) conflict with the old show callback. + // The old fx option wins over show/hide anyway (always favor back-compat). + // If a user wants to use the new animation API, they must give up the old API. + $.widget( "ui.tabs", $.ui.tabs, { + options: { + fx: null // e.g. { height: "toggle", opacity: "toggle", duration: 200 } + }, + + _getFx: function() { + var hide, show, + fx = this.options.fx; + + if ( fx ) { + if ( $.isArray( fx ) ) { + hide = fx[ 0 ]; + show = fx[ 1 ]; + } else { + hide = show = fx; + } + } + + return fx ? { show: show, hide: hide } : null; + }, + + _toggle: function( event, eventData ) { + var that = this, + toShow = eventData.newPanel, + toHide = eventData.oldPanel, + fx = this._getFx(); + + if ( !fx ) { + return this._super( event, eventData ); + } + + that.running = true; + + function complete() { + that.running = false; + that._trigger( "activate", event, eventData ); + } + + function show() { + eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" ); + + if ( toShow.length && fx.show ) { + toShow + .animate( fx.show, fx.show.duration, function() { + complete(); + }); + } else { + toShow.show(); + complete(); + } + } + + // start out by hiding, then showing, then completing + if ( toHide.length && fx.hide ) { + toHide.animate( fx.hide, fx.hide.duration, function() { + eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); + show(); + }); + } else { + eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); + toHide.hide(); + show(); + } + } + }); +} + +})( jQuery ); +(function( $ ) { + +var increments = 0; + +function addDescribedBy( elem, id ) { + var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ); + describedby.push( id ); + elem + .data( "ui-tooltip-id", id ) + .attr( "aria-describedby", $.trim( describedby.join( " " ) ) ); +} + +function removeDescribedBy( elem ) { + var id = elem.data( "ui-tooltip-id" ), + describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ), + index = $.inArray( id, describedby ); + if ( index !== -1 ) { + describedby.splice( index, 1 ); + } + + elem.removeData( "ui-tooltip-id" ); + describedby = $.trim( describedby.join( " " ) ); + if ( describedby ) { + elem.attr( "aria-describedby", describedby ); + } else { + elem.removeAttr( "aria-describedby" ); + } +} + +$.widget( "ui.tooltip", { + version: "1.9.2", + options: { + content: function() { + return $( this ).attr( "title" ); + }, + hide: true, + // Disabled elements have inconsistent behavior across browsers (#8661) + items: "[title]:not([disabled])", + position: { + my: "left top+15", + at: "left bottom", + collision: "flipfit flip" + }, + show: true, + tooltipClass: null, + track: false, + + // callbacks + close: null, + open: null + }, + + _create: function() { + this._on({ + mouseover: "open", + focusin: "open" + }); + + // IDs of generated tooltips, needed for destroy + this.tooltips = {}; + // IDs of parent tooltips where we removed the title attribute + this.parents = {}; + + if ( this.options.disabled ) { + this._disable(); + } + }, + + _setOption: function( key, value ) { + var that = this; + + if ( key === "disabled" ) { + this[ value ? "_disable" : "_enable" ](); + this.options[ key ] = value; + // disable element style changes + return; + } + + this._super( key, value ); + + if ( key === "content" ) { + $.each( this.tooltips, function( id, element ) { + that._updateContent( element ); + }); + } + }, + + _disable: function() { + var that = this; + + // close open tooltips + $.each( this.tooltips, function( id, element ) { + var event = $.Event( "blur" ); + event.target = event.currentTarget = element[0]; + that.close( event, true ); + }); + + // remove title attributes to prevent native tooltips + this.element.find( this.options.items ).andSelf().each(function() { + var element = $( this ); + if ( element.is( "[title]" ) ) { + element + .data( "ui-tooltip-title", element.attr( "title" ) ) + .attr( "title", "" ); + } + }); + }, + + _enable: function() { + // restore title attributes + this.element.find( this.options.items ).andSelf().each(function() { + var element = $( this ); + if ( element.data( "ui-tooltip-title" ) ) { + element.attr( "title", element.data( "ui-tooltip-title" ) ); + } + }); + }, + + open: function( event ) { + var that = this, + target = $( event ? event.target : this.element ) + // we need closest here due to mouseover bubbling, + // but always pointing at the same event target + .closest( this.options.items ); + + // No element to show a tooltip for or the tooltip is already open + if ( !target.length || target.data( "ui-tooltip-id" ) ) { + return; + } + + if ( target.attr( "title" ) ) { + target.data( "ui-tooltip-title", target.attr( "title" ) ); + } + + target.data( "ui-tooltip-open", true ); + + // kill parent tooltips, custom or native, for hover + if ( event && event.type === "mouseover" ) { + target.parents().each(function() { + var parent = $( this ), + blurEvent; + if ( parent.data( "ui-tooltip-open" ) ) { + blurEvent = $.Event( "blur" ); + blurEvent.target = blurEvent.currentTarget = this; + that.close( blurEvent, true ); + } + if ( parent.attr( "title" ) ) { + parent.uniqueId(); + that.parents[ this.id ] = { + element: this, + title: parent.attr( "title" ) + }; + parent.attr( "title", "" ); + } + }); + } + + this._updateContent( target, event ); + }, + + _updateContent: function( target, event ) { + var content, + contentOption = this.options.content, + that = this, + eventType = event ? event.type : null; + + if ( typeof contentOption === "string" ) { + return this._open( event, target, contentOption ); + } + + content = contentOption.call( target[0], function( response ) { + // ignore async response if tooltip was closed already + if ( !target.data( "ui-tooltip-open" ) ) { + return; + } + // IE may instantly serve a cached response for ajax requests + // delay this call to _open so the other call to _open runs first + that._delay(function() { + // jQuery creates a special event for focusin when it doesn't + // exist natively. To improve performance, the native event + // object is reused and the type is changed. Therefore, we can't + // rely on the type being correct after the event finished + // bubbling, so we set it back to the previous value. (#8740) + if ( event ) { + event.type = eventType; + } + this._open( event, target, response ); + }); + }); + if ( content ) { + this._open( event, target, content ); + } + }, + + _open: function( event, target, content ) { + var tooltip, events, delayedShow, + positionOption = $.extend( {}, this.options.position ); + + if ( !content ) { + return; + } + + // Content can be updated multiple times. If the tooltip already + // exists, then just update the content and bail. + tooltip = this._find( target ); + if ( tooltip.length ) { + tooltip.find( ".ui-tooltip-content" ).html( content ); + return; + } + + // if we have a title, clear it to prevent the native tooltip + // we have to check first to avoid defining a title if none exists + // (we don't want to cause an element to start matching [title]) + // + // We use removeAttr only for key events, to allow IE to export the correct + // accessible attributes. For mouse events, set to empty string to avoid + // native tooltip showing up (happens only when removing inside mouseover). + if ( target.is( "[title]" ) ) { + if ( event && event.type === "mouseover" ) { + target.attr( "title", "" ); + } else { + target.removeAttr( "title" ); + } + } + + tooltip = this._tooltip( target ); + addDescribedBy( target, tooltip.attr( "id" ) ); + tooltip.find( ".ui-tooltip-content" ).html( content ); + + function position( event ) { + positionOption.of = event; + if ( tooltip.is( ":hidden" ) ) { + return; + } + tooltip.position( positionOption ); + } + if ( this.options.track && event && /^mouse/.test( event.type ) ) { + this._on( this.document, { + mousemove: position + }); + // trigger once to override element-relative positioning + position( event ); + } else { + tooltip.position( $.extend({ + of: target + }, this.options.position ) ); + } + + tooltip.hide(); + + this._show( tooltip, this.options.show ); + // Handle tracking tooltips that are shown with a delay (#8644). As soon + // as the tooltip is visible, position the tooltip using the most recent + // event. + if ( this.options.show && this.options.show.delay ) { + delayedShow = setInterval(function() { + if ( tooltip.is( ":visible" ) ) { + position( positionOption.of ); + clearInterval( delayedShow ); + } + }, $.fx.interval ); + } + + this._trigger( "open", event, { tooltip: tooltip } ); + + events = { + keyup: function( event ) { + if ( event.keyCode === $.ui.keyCode.ESCAPE ) { + var fakeEvent = $.Event(event); + fakeEvent.currentTarget = target[0]; + this.close( fakeEvent, true ); + } + }, + remove: function() { + this._removeTooltip( tooltip ); + } + }; + if ( !event || event.type === "mouseover" ) { + events.mouseleave = "close"; + } + if ( !event || event.type === "focusin" ) { + events.focusout = "close"; + } + this._on( true, target, events ); + }, + + close: function( event ) { + var that = this, + target = $( event ? event.currentTarget : this.element ), + tooltip = this._find( target ); + + // disabling closes the tooltip, so we need to track when we're closing + // to avoid an infinite loop in case the tooltip becomes disabled on close + if ( this.closing ) { + return; + } + + // only set title if we had one before (see comment in _open()) + if ( target.data( "ui-tooltip-title" ) ) { + target.attr( "title", target.data( "ui-tooltip-title" ) ); + } + + removeDescribedBy( target ); + + tooltip.stop( true ); + this._hide( tooltip, this.options.hide, function() { + that._removeTooltip( $( this ) ); + }); + + target.removeData( "ui-tooltip-open" ); + this._off( target, "mouseleave focusout keyup" ); + // Remove 'remove' binding only on delegated targets + if ( target[0] !== this.element[0] ) { + this._off( target, "remove" ); + } + this._off( this.document, "mousemove" ); + + if ( event && event.type === "mouseleave" ) { + $.each( this.parents, function( id, parent ) { + $( parent.element ).attr( "title", parent.title ); + delete that.parents[ id ]; + }); + } + + this.closing = true; + this._trigger( "close", event, { tooltip: tooltip } ); + this.closing = false; + }, + + _tooltip: function( element ) { + var id = "ui-tooltip-" + increments++, + tooltip = $( "
      " ) + .attr({ + id: id, + role: "tooltip" + }) + .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " + + ( this.options.tooltipClass || "" ) ); + $( "
      " ) + .addClass( "ui-tooltip-content" ) + .appendTo( tooltip ); + tooltip.appendTo( this.document[0].body ); + if ( $.fn.bgiframe ) { + tooltip.bgiframe(); + } + this.tooltips[ id ] = element; + return tooltip; + }, + + _find: function( target ) { + var id = target.data( "ui-tooltip-id" ); + return id ? $( "#" + id ) : $(); + }, + + _removeTooltip: function( tooltip ) { + tooltip.remove(); + delete this.tooltips[ tooltip.attr( "id" ) ]; + }, + + _destroy: function() { + var that = this; + + // close open tooltips + $.each( this.tooltips, function( id, element ) { + // Delegate to close method to handle common cleanup + var event = $.Event( "blur" ); + event.target = event.currentTarget = element[0]; + that.close( event, true ); + + // Remove immediately; destroying an open tooltip doesn't use the + // hide animation + $( "#" + id ).remove(); + + // Restore the title + if ( element.data( "ui-tooltip-title" ) ) { + element.attr( "title", element.data( "ui-tooltip-title" ) ); + element.removeData( "ui-tooltip-title" ); + } + }); + } +}); + +}( jQuery ) ); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery.layout-latest.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery.layout-latest.js new file mode 100644 index 0000000..434724d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/layout/jquery.layout-latest.js @@ -0,0 +1,6086 @@ +/** + * @preserve + * jquery.layout 1.4.3 + * $Date: 2015/03/13 22:37:04 $ + * $Rev: 1.0403 $ + * + * Copyright (c) 2014 Kevin Dalman (http://jquery-dev.com) + * Based on work by Fabrizio Balliano (http://www.fabrizioballiano.net) + * + * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html) + * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses. + * + * SEE: http://layout.jquery-dev.com/LICENSE.txt + * + * Changelog: http://layout.jquery-dev.com/changelog.cfm + * + * Docs: http://layout.jquery-dev.com/documentation.html + * Tips: http://layout.jquery-dev.com/tips.html + * Help: http://groups.google.com/group/jquery-ui-layout + */ + +/* JavaDoc Info: http://code.google.com/closure/compiler/docs/js-for-compiler.html + * {!Object} non-nullable type (never NULL) + * {?string} nullable type (sometimes NULL) - default for {Object} + * {number=} optional parameter + * {*} ALL types + */ +/* TODO for jQ 2.0 + * change .andSelf() to .addBack() + * check $.fn.disableSelection - this is in jQuery UI 1.9.x + */ + +// NOTE: For best readability, view with a fixed-width font and tabs equal to 4-chars + +;(function ($) { + +// alias Math methods - used a lot! +var min = Math.min +, max = Math.max +, round = Math.floor + +, isStr = function (v) { return $.type(v) === "string"; } + + /** + * @param {!Object} Instance + * @param {Array.} a_fn + */ +, runPluginCallbacks = function (Instance, a_fn) { + if ($.isArray(a_fn)) + for (var i=0, c=a_fn.length; i
      ').appendTo("body") + , d = { width: $c.outerWidth - $c[0].clientWidth, height: 100 - $c[0].clientHeight }; + $c.remove(); + window.scrollbarWidth = d.width; + window.scrollbarHeight = d.height; + return dim.match(/^(width|height)$/) ? d[dim] : d; + } + + +, disableTextSelection: function () { + var $d = $(document) + , s = 'textSelectionDisabled' + , x = 'textSelectionInitialized' + ; + if ($.fn.disableSelection) { + if (!$d.data(x)) // document hasn't been initialized yet + $d.on('mouseup', $.layout.enableTextSelection ).data(x, true); + if (!$d.data(s)) + $d.disableSelection().data(s, true); + } + } +, enableTextSelection: function () { + var $d = $(document) + , s = 'textSelectionDisabled'; + if ($.fn.enableSelection && $d.data(s)) + $d.enableSelection().data(s, false); + } + + + /** + * Returns hash container 'display' and 'visibility' + * + * @see $.swap() - swaps CSS, runs callback, resets CSS + * @param {!Object} $E jQuery element + * @param {boolean=} [force=false] Run even if display != none + * @return {!Object} Returns current style props, if applicable + */ +, showInvisibly: function ($E, force) { + if ($E && $E.length && (force || $E.css("display") === "none")) { // only if not *already hidden* + var s = $E[0].style + // save ONLY the 'style' props because that is what we must restore + , CSS = { display: s.display || '', visibility: s.visibility || '' }; + // show element 'invisibly' so can be measured + $E.css({ display: "block", visibility: "hidden" }); + return CSS; + } + return {}; + } + + /** + * Returns data for setting size of an element (container or a pane). + * + * @see _create(), onWindowResize() for container, plus others for pane + * @return JSON Returns a hash of all dimensions: top, bottom, left, right, outerWidth, innerHeight, etc + */ +, getElementDimensions: function ($E, inset) { + var + // dimensions hash - start with current data IF passed + d = { css: {}, inset: {} } + , x = d.css // CSS hash + , i = { bottom: 0 } // TEMP insets (bottom = complier hack) + , N = $.layout.cssNum + , R = Math.round + , off = $E.offset() + , b, p, ei // TEMP border, padding + ; + d.offsetLeft = off.left; + d.offsetTop = off.top; + + if (!inset) inset = {}; // simplify logic below + + $.each("Left,Right,Top,Bottom".split(","), function (idx, e) { // e = edge + b = x["border" + e] = $.layout.borderWidth($E, e); + p = x["padding"+ e] = $.layout.cssNum($E, "padding"+e); + ei = e.toLowerCase(); + d.inset[ei] = inset[ei] >= 0 ? inset[ei] : p; // any missing insetX value = paddingX + i[ei] = d.inset[ei] + b; // total offset of content from outer side + }); + + x.width = R($E.width()); + x.height = R($E.height()); + x.top = N($E,"top",true); + x.bottom = N($E,"bottom",true); + x.left = N($E,"left",true); + x.right = N($E,"right",true); + + d.outerWidth = R($E.outerWidth()); + d.outerHeight = R($E.outerHeight()); + // calc the TRUE inner-dimensions, even in quirks-mode! + d.innerWidth = max(0, d.outerWidth - i.left - i.right); + d.innerHeight = max(0, d.outerHeight - i.top - i.bottom); + // layoutWidth/Height is used in calcs for manual resizing + // layoutW/H only differs from innerW/H when in quirks-mode - then is like outerW/H + d.layoutWidth = R($E.innerWidth()); + d.layoutHeight = R($E.innerHeight()); + + //if ($E.prop('tagName') === 'BODY') { debugData( d, $E.prop('tagName') ); } // DEBUG + + //d.visible = $E.is(":visible");// && x.width > 0 && x.height > 0; + + return d; + } + +, getElementStyles: function ($E, list) { + var + CSS = {} + , style = $E[0].style + , props = list.split(",") + , sides = "Top,Bottom,Left,Right".split(",") + , attrs = "Color,Style,Width".split(",") + , p, s, a, i, j, k + ; + for (i=0; i < props.length; i++) { + p = props[i]; + if (p.match(/(border|padding|margin)$/)) + for (j=0; j < 4; j++) { + s = sides[j]; + if (p === "border") + for (k=0; k < 3; k++) { + a = attrs[k]; + CSS[p+s+a] = style[p+s+a]; + } + else + CSS[p+s] = style[p+s]; + } + else + CSS[p] = style[p]; + }; + return CSS + } + + /** + * Return the innerWidth for the current browser/doctype + * + * @see initPanes(), sizeMidPanes(), initHandles(), sizeHandles() + * @param {Array.} $E Must pass a jQuery object - first element is processed + * @param {number=} outerWidth (optional) Can pass a width, allowing calculations BEFORE element is resized + * @return {number} Returns the innerWidth of the elem by subtracting padding and borders + */ +, cssWidth: function ($E, outerWidth) { + // a 'calculated' outerHeight can be passed so borders and/or padding are removed if needed + if (outerWidth <= 0) return 0; + + var lb = $.layout.browser + , bs = !lb.boxModel ? "border-box" : lb.boxSizing ? $E.css("boxSizing") : "content-box" + , b = $.layout.borderWidth + , n = $.layout.cssNum + , W = outerWidth + ; + // strip border and/or padding from outerWidth to get CSS Width + if (bs !== "border-box") + W -= (b($E, "Left") + b($E, "Right")); + if (bs === "content-box") + W -= (n($E, "paddingLeft") + n($E, "paddingRight")); + return max(0,W); + } + + /** + * Return the innerHeight for the current browser/doctype + * + * @see initPanes(), sizeMidPanes(), initHandles(), sizeHandles() + * @param {Array.} $E Must pass a jQuery object - first element is processed + * @param {number=} outerHeight (optional) Can pass a width, allowing calculations BEFORE element is resized + * @return {number} Returns the innerHeight of the elem by subtracting padding and borders + */ +, cssHeight: function ($E, outerHeight) { + // a 'calculated' outerHeight can be passed so borders and/or padding are removed if needed + if (outerHeight <= 0) return 0; + + var lb = $.layout.browser + , bs = !lb.boxModel ? "border-box" : lb.boxSizing ? $E.css("boxSizing") : "content-box" + , b = $.layout.borderWidth + , n = $.layout.cssNum + , H = outerHeight + ; + // strip border and/or padding from outerHeight to get CSS Height + if (bs !== "border-box") + H -= (b($E, "Top") + b($E, "Bottom")); + if (bs === "content-box") + H -= (n($E, "paddingTop") + n($E, "paddingBottom")); + return max(0,H); + } + + /** + * Returns the 'current CSS numeric value' for a CSS property - 0 if property does not exist + * + * @see Called by many methods + * @param {Array.} $E Must pass a jQuery object - first element is processed + * @param {string} prop The name of the CSS property, eg: top, width, etc. + * @param {boolean=} [allowAuto=false] true = return 'auto' if that is value; false = return 0 + * @return {(string|number)} Usually used to get an integer value for position (top, left) or size (height, width) + */ +, cssNum: function ($E, prop, allowAuto) { + if (!$E.jquery) $E = $($E); + var CSS = $.layout.showInvisibly($E) + , p = $.css($E[0], prop, true) + , v = allowAuto && p=="auto" ? p : Math.round(parseFloat(p) || 0); + $E.css( CSS ); // RESET + return v; + } + +, borderWidth: function (el, side) { + if (el.jquery) el = el[0]; + var b = "border"+ side.substr(0,1).toUpperCase() + side.substr(1); // left => Left + return $.css(el, b+"Style", true) === "none" ? 0 : Math.round(parseFloat($.css(el, b+"Width", true)) || 0); + } + + /** + * Mouse-tracking utility - FUTURE REFERENCE + * + * init: if (!window.mouse) { + * window.mouse = { x: 0, y: 0 }; + * $(document).mousemove( $.layout.trackMouse ); + * } + * + * @param {Object} evt + * +, trackMouse: function (evt) { + window.mouse = { x: evt.clientX, y: evt.clientY }; + } + */ + + /** + * SUBROUTINE for preventPrematureSlideClose option + * + * @param {Object} evt + * @param {Object=} el + */ +, isMouseOverElem: function (evt, el) { + var + $E = $(el || this) + , d = $E.offset() + , T = d.top + , L = d.left + , R = L + $E.outerWidth() + , B = T + $E.outerHeight() + , x = evt.pageX // evt.clientX ? + , y = evt.pageY // evt.clientY ? + ; + // if X & Y are < 0, probably means is over an open SELECT + return ($.layout.browser.msie && x < 0 && y < 0) || ((x >= L && x <= R) && (y >= T && y <= B)); + } + + /** + * Message/Logging Utility + * + * @example $.layout.msg("My message"); // log text + * @example $.layout.msg("My message", true); // alert text + * @example $.layout.msg({ foo: "bar" }, "Title"); // log hash-data, with custom title + * @example $.layout.msg({ foo: "bar" }, true, "Title", { sort: false }); -OR- + * @example $.layout.msg({ foo: "bar" }, "Title", { sort: false, display: true }); // alert hash-data + * + * @param {(Object|string)} info String message OR Hash/Array + * @param {(Boolean|string|Object)=} [popup=false] True means alert-box - can be skipped + * @param {(Object|string)=} [debugTitle=""] Title for Hash data - can be skipped + * @param {Object=} [debugOpts] Extra options for debug output + */ +, msg: function (info, popup, debugTitle, debugOpts) { + if ($.isPlainObject(info) && window.debugData) { + if (typeof popup === "string") { + debugOpts = debugTitle; + debugTitle = popup; + } + else if (typeof debugTitle === "object") { + debugOpts = debugTitle; + debugTitle = null; + } + var t = debugTitle || "log( )" + , o = $.extend({ sort: false, returnHTML: false, display: false }, debugOpts); + if (popup === true || o.display) + debugData( info, t, o ); + else if (window.console) + console.log(debugData( info, t, o )); + } + else if (popup) + alert(info); + else if (window.console) + console.log(info); + else { + var id = "#layoutLogger" + , $l = $(id); + if (!$l.length) + $l = createLog(); + $l.children("ul").append('
    • '+ info.replace(/\/g,">") +'
    • '); + } + + function createLog () { + var pos = $.support.fixedPosition ? 'fixed' : 'absolute' + , $e = $('
      ' + + '
      ' + + 'XLayout console.log
      ' + + '
        ' + + '
        ' + ).appendTo("body"); + $e.css('left', $(window).width() - $e.outerWidth() - 5) + if ($.ui.draggable) $e.draggable({ handle: ':first-child' }); + return $e; + }; + } + +}; + + +/* + * $.layout.browser REPLACES removed $.browser, with extra data + * Parsing code here adapted from jQuery 1.8 $.browse + */ +(function(){ + var u = navigator.userAgent.toLowerCase() + , m = /(chrome)[ \/]([\w.]+)/.exec( u ) + || /(webkit)[ \/]([\w.]+)/.exec( u ) + || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( u ) + || /(msie) ([\w.]+)/.exec( u ) + || u.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( u ) + || [] + , b = m[1] || "" + , v = m[2] || 0 + , ie = b === "msie" + , cm = document.compatMode + , $s = $.support + , bs = $s.boxSizing !== undefined ? $s.boxSizing : $s.boxSizingReliable + , bm = !ie || !cm || cm === "CSS1Compat" || $s.boxModel || false + , lb = $.layout.browser = { + version: v + , safari: b === "webkit" // webkit (NOT chrome) = safari + , webkit: b === "chrome" // chrome = webkit + , msie: ie + , isIE6: ie && v == 6 + // ONLY IE reverts to old box-model - Note that compatMode was deprecated as of IE8 + , boxModel: bm + , boxSizing: !!(typeof bs === "function" ? bs() : bs) + }; + ; + if (b) lb[b] = true; // set CURRENT browser + /* OLD versions of jQuery only set $.support.boxModel after page is loaded + * so if this is IE, use support.boxModel to test for quirks-mode (ONLY IE changes boxModel) */ + if (!bm && !cm) $(function(){ lb.boxModel = $s.boxModel; }); +})(); + + +// DEFAULT OPTIONS +$.layout.defaults = { +/* + * LAYOUT & LAYOUT-CONTAINER OPTIONS + * - none of these options are applicable to individual panes + */ + name: "" // Not required, but useful for buttons and used for the state-cookie +, containerClass: "ui-layout-container" // layout-container element +, inset: null // custom container-inset values (override padding) +, scrollToBookmarkOnLoad: true // after creating a layout, scroll to bookmark in URL (.../page.htm#myBookmark) +, resizeWithWindow: true // bind thisLayout.resizeAll() to the window.resize event +, resizeWithWindowDelay: 200 // delay calling resizeAll because makes window resizing very jerky +, resizeWithWindowMaxDelay: 0 // 0 = none - force resize every XX ms while window is being resized +, maskPanesEarly: false // true = create pane-masks on resizer.mouseDown instead of waiting for resizer.dragstart +, onresizeall_start: null // CALLBACK when resizeAll() STARTS - NOT pane-specific +, onresizeall_end: null // CALLBACK when resizeAll() ENDS - NOT pane-specific +, onload_start: null // CALLBACK when Layout inits - after options initialized, but before elements +, onload_end: null // CALLBACK when Layout inits - after EVERYTHING has been initialized +, onunload_start: null // CALLBACK when Layout is destroyed OR onWindowUnload +, onunload_end: null // CALLBACK when Layout is destroyed OR onWindowUnload +, initPanes: true // false = DO NOT initialize the panes onLoad - will init later +, showErrorMessages: true // enables fatal error messages to warn developers of common errors +, showDebugMessages: false // display console-and-alert debug msgs - IF this Layout version _has_ debugging code! +// Changing this zIndex value will cause other zIndex values to automatically change +, zIndex: null // the PANE zIndex - resizers and masks will be +1 +// DO NOT CHANGE the zIndex values below unless you clearly understand their relationships +, zIndexes: { // set _default_ z-index values here... + pane_normal: 0 // normal z-index for panes + , content_mask: 1 // applied to overlays used to mask content INSIDE panes during resizing + , resizer_normal: 2 // normal z-index for resizer-bars + , pane_sliding: 100 // applied to *BOTH* the pane and its resizer when a pane is 'slid open' + , pane_animate: 1000 // applied to the pane when being animated - not applied to the resizer + , resizer_drag: 10000 // applied to the CLONED resizer-bar when being 'dragged' + } +, errors: { + pane: "pane" // description of "layout pane element" - used only in error messages + , selector: "selector" // description of "jQuery-selector" - used only in error messages + , addButtonError: "Error Adding Button\nInvalid " + , containerMissing: "UI Layout Initialization Error\nThe specified layout-container does not exist." + , centerPaneMissing: "UI Layout Initialization Error\nThe center-pane element does not exist.\nThe center-pane is a required element." + , noContainerHeight: "UI Layout Initialization Warning\nThe layout-container \"CONTAINER\" has no height.\nTherefore the layout is 0-height and hence 'invisible'!" + , callbackError: "UI Layout Callback Error\nThe EVENT callback is not a valid function." + } +/* + * PANE DEFAULT SETTINGS + * - settings under the 'panes' key become the default settings for *all panes* + * - ALL pane-options can also be set specifically for each panes, which will override these 'default values' + */ +, panes: { // default options for 'all panes' - will be overridden by 'per-pane settings' + applyDemoStyles: false // NOTE: renamed from applyDefaultStyles for clarity + , closable: true // pane can open & close + , resizable: true // when open, pane can be resized + , slidable: true // when closed, pane can 'slide open' over other panes - closes on mouse-out + , initClosed: false // true = init pane as 'closed' + , initHidden: false // true = init pane as 'hidden' - no resizer-bar/spacing + // SELECTORS + //, paneSelector: "" // MUST be pane-specific - jQuery selector for pane + , contentSelector: ".ui-layout-content" // INNER div/element to auto-size so only it scrolls, not the entire pane! + , contentIgnoreSelector: ".ui-layout-ignore" // element(s) to 'ignore' when measuring 'content' + , findNestedContent: false // true = $P.find(contentSelector), false = $P.children(contentSelector) + // GENERIC ROOT-CLASSES - for auto-generated classNames + , paneClass: "ui-layout-pane" // Layout Pane + , resizerClass: "ui-layout-resizer" // Resizer Bar + , togglerClass: "ui-layout-toggler" // Toggler Button + , buttonClass: "ui-layout-button" // CUSTOM Buttons - eg: '[ui-layout-button]-toggle/-open/-close/-pin' + // ELEMENT SIZE & SPACING + //, size: 100 // MUST be pane-specific -initial size of pane + , minSize: 0 // when manually resizing a pane + , maxSize: 0 // ditto, 0 = no limit + , spacing_open: 6 // space between pane and adjacent panes - when pane is 'open' + , spacing_closed: 6 // ditto - when pane is 'closed' + , togglerLength_open: 50 // Length = WIDTH of toggler button on north/south sides - HEIGHT on east/west sides + , togglerLength_closed: 50 // 100% OR -1 means 'full height/width of resizer bar' - 0 means 'hidden' + , togglerAlign_open: "center" // top/left, bottom/right, center, OR... + , togglerAlign_closed: "center" // 1 => nn = offset from top/left, -1 => -nn == offset from bottom/right + , togglerContent_open: "" // text or HTML to put INSIDE the toggler + , togglerContent_closed: "" // ditto + // RESIZING OPTIONS + , resizerDblClickToggle: true // + , autoResize: true // IF size is 'auto' or a percentage, then recalc 'pixel size' whenever the layout resizes + , autoReopen: true // IF a pane was auto-closed due to noRoom, reopen it when there is room? False = leave it closed + , resizerDragOpacity: 1 // option for ui.draggable + //, resizerCursor: "" // MUST be pane-specific - cursor when over resizer-bar + , maskContents: false // true = add DIV-mask over-or-inside this pane so can 'drag' over IFRAMES + , maskObjects: false // true = add IFRAME-mask over-or-inside this pane to cover objects/applets - content-mask will overlay this mask + , maskZindex: null // will override zIndexes.content_mask if specified - not applicable to iframe-panes + , resizingGrid: false // grid size that the resizers will snap-to during resizing, eg: [20,20] + , livePaneResizing: false // true = LIVE Resizing as resizer is dragged + , liveContentResizing: false // true = re-measure header/footer heights as resizer is dragged + , liveResizingTolerance: 1 // how many px change before pane resizes, to control performance + // SLIDING OPTIONS + , sliderCursor: "pointer" // cursor when resizer-bar will trigger 'sliding' + , slideTrigger_open: "click" // click, dblclick, mouseenter + , slideTrigger_close: "mouseleave"// click, mouseleave + , slideDelay_open: 300 // applies only for mouseenter event - 0 = instant open + , slideDelay_close: 300 // applies only for mouseleave event (300ms is the minimum!) + , hideTogglerOnSlide: false // when pane is slid-open, should the toggler show? + , preventQuickSlideClose: $.layout.browser.webkit // Chrome triggers slideClosed as it is opening + , preventPrematureSlideClose: false // handle incorrect mouseleave trigger, like when over a SELECT-list in IE + // PANE-SPECIFIC TIPS & MESSAGES + , tips: { + Open: "Open" // eg: "Open Pane" + , Close: "Close" + , Resize: "Resize" + , Slide: "Slide Open" + , Pin: "Pin" + , Unpin: "Un-Pin" + , noRoomToOpen: "Not enough room to show this panel." // alert if user tries to open a pane that cannot + , minSizeWarning: "Panel has reached its minimum size" // displays in browser statusbar + , maxSizeWarning: "Panel has reached its maximum size" // ditto + } + // HOT-KEYS & MISC + , showOverflowOnHover: false // will bind allowOverflow() utility to pane.onMouseOver + , enableCursorHotkey: true // enabled 'cursor' hotkeys + //, customHotkey: "" // MUST be pane-specific - EITHER a charCode OR a character + , customHotkeyModifier: "SHIFT" // either 'SHIFT', 'CTRL' or 'CTRL+SHIFT' - NOT 'ALT' + // PANE ANIMATION + // NOTE: fxSss_open, fxSss_close & fxSss_size options (eg: fxName_open) are auto-generated if not passed + , fxName: "slide" // ('none' or blank), slide, drop, scale -- only relevant to 'open' & 'close', NOT 'size' + , fxSpeed: null // slow, normal, fast, 200, nnn - if passed, will OVERRIDE fxSettings.duration + , fxSettings: {} // can be passed, eg: { easing: "easeOutBounce", duration: 1500 } + , fxOpacityFix: true // tries to fix opacity in IE to restore anti-aliasing after animation + , animatePaneSizing: false // true = animate resizing after dragging resizer-bar OR sizePane() is called + /* NOTE: Action-specific FX options are auto-generated from the options above if not specifically set: + fxName_open: "slide" // 'Open' pane animation + fnName_close: "slide" // 'Close' pane animation + fxName_size: "slide" // 'Size' pane animation - when animatePaneSizing = true + fxSpeed_open: null + fxSpeed_close: null + fxSpeed_size: null + fxSettings_open: {} + fxSettings_close: {} + fxSettings_size: {} + */ + // CHILD/NESTED LAYOUTS + , children: null // Layout-options for nested/child layout - even {} is valid as options + , containerSelector: '' // if child is NOT 'directly nested', a selector to find it/them (can have more than one child layout!) + , initChildren: true // true = child layout will be created as soon as _this_ layout completes initialization + , destroyChildren: true // true = destroy child-layout if this pane is destroyed + , resizeChildren: true // true = trigger child-layout.resizeAll() when this pane is resized + // EVENT TRIGGERING + , triggerEventsOnLoad: false // true = trigger onopen OR onclose callbacks when layout initializes + , triggerEventsDuringLiveResize: true // true = trigger onresize callback REPEATEDLY if livePaneResizing==true + // PANE CALLBACKS + , onshow_start: null // CALLBACK when pane STARTS to Show - BEFORE onopen/onhide_start + , onshow_end: null // CALLBACK when pane ENDS being Shown - AFTER onopen/onhide_end + , onhide_start: null // CALLBACK when pane STARTS to Close - BEFORE onclose_start + , onhide_end: null // CALLBACK when pane ENDS being Closed - AFTER onclose_end + , onopen_start: null // CALLBACK when pane STARTS to Open + , onopen_end: null // CALLBACK when pane ENDS being Opened + , onclose_start: null // CALLBACK when pane STARTS to Close + , onclose_end: null // CALLBACK when pane ENDS being Closed + , onresize_start: null // CALLBACK when pane STARTS being Resized ***FOR ANY REASON*** + , onresize_end: null // CALLBACK when pane ENDS being Resized ***FOR ANY REASON*** + , onsizecontent_start: null // CALLBACK when sizing of content-element STARTS + , onsizecontent_end: null // CALLBACK when sizing of content-element ENDS + , onswap_start: null // CALLBACK when pane STARTS to Swap + , onswap_end: null // CALLBACK when pane ENDS being Swapped + , ondrag_start: null // CALLBACK when pane STARTS being ***MANUALLY*** Resized + , ondrag_end: null // CALLBACK when pane ENDS being ***MANUALLY*** Resized + } +/* + * PANE-SPECIFIC SETTINGS + * - options listed below MUST be specified per-pane - they CANNOT be set under 'panes' + * - all options under the 'panes' key can also be set specifically for any pane + * - most options under the 'panes' key apply only to 'border-panes' - NOT the the center-pane + */ +, north: { + paneSelector: ".ui-layout-north" + , size: "auto" // eg: "auto", "30%", .30, 200 + , resizerCursor: "n-resize" // custom = url(myCursor.cur) + , customHotkey: "" // EITHER a charCode (43) OR a character ("o") + } +, south: { + paneSelector: ".ui-layout-south" + , size: "50%"//"auto" + , resizerCursor: "s-resize" + , customHotkey: "" + , initClosed: true + } +, east: { + paneSelector: ".ui-layout-east" + , size: "5%"//200 + , resizerCursor: "e-resize" + , customHotkey: "" + } +, west: { + paneSelector: ".ui-layout-west" + , size: "70%" //200 + , resizerCursor: "w-resize" + , customHotkey: "" + , initClosed: true + } +, center: { + paneSelector: ".ui-layout-center" + , size: "30%"//"auto" + , minWidth: 0 + , minHeight: 0 + } +}; + +$.layout.optionsMap = { + // layout/global options - NOT pane-options + layout: ("name,instanceKey,stateManagement,effects,inset,zIndexes,errors," + + "zIndex,scrollToBookmarkOnLoad,showErrorMessages,maskPanesEarly," + + "outset,resizeWithWindow,resizeWithWindowDelay,resizeWithWindowMaxDelay," + + "onresizeall,onresizeall_start,onresizeall_end,onload,onload_start,onload_end,onunload,onunload_start,onunload_end").split(",") +// borderPanes: [ ALL options that are NOT specified as 'layout' ] + // default.panes options that apply to the center-pane (most options apply _only_ to border-panes) +, center: ("paneClass,contentSelector,contentIgnoreSelector,findNestedContent,applyDemoStyles,triggerEventsOnLoad," + + "showOverflowOnHover,maskContents,maskObjects,liveContentResizing," + + "containerSelector,children,initChildren,resizeChildren,destroyChildren," + + "onresize,onresize_start,onresize_end,onsizecontent,onsizecontent_start,onsizecontent_end").split(",") + // options that MUST be specifically set 'per-pane' - CANNOT set in the panes (defaults) key +, noDefault: ("paneSelector,resizerCursor,customHotkey").split(",") +}; + +/** + * Processes options passed in converts flat-format data into subkey (JSON) format + * In flat-format, subkeys are _currently_ separated with 2 underscores, like north__optName + * Plugins may also call this method so they can transform their own data + * + * @param {!Object} hash Data/options passed by user - may be a single level or nested levels + * @param {boolean=} [addKeys=false] Should the primary layout.options keys be added if they do not exist? + * @return {Object} Returns hash of minWidth & minHeight + */ +$.layout.transformData = function (hash, addKeys) { + var json = addKeys ? { panes: {}, center: {} } : {} // init return object + , branch, optKey, keys, key, val, i, c; + + if (typeof hash !== "object") return json; // no options passed + + // convert all 'flat-keys' to 'sub-key' format + for (optKey in hash) { + branch = json; + val = hash[ optKey ]; + keys = optKey.split("__"); // eg: west__size or north__fxSettings__duration + c = keys.length - 1; + // convert underscore-delimited to subkeys + for (i=0; i <= c; i++) { + key = keys[i]; + if (i === c) { // last key = value + if ($.isPlainObject( val )) + branch[key] = $.layout.transformData( val ); // RECURSE + else + branch[key] = val; + } + else { + if (!branch[key]) + branch[key] = {}; // create the subkey + // recurse to sub-key for next loop - if not done + branch = branch[key]; + } + } + } + return json; +}; + +// INTERNAL CONFIG DATA - DO NOT CHANGE THIS! +$.layout.backwardCompatibility = { + // data used by renameOldOptions() + map: { + // OLD Option Name: NEW Option Name + applyDefaultStyles: "applyDemoStyles" + // CHILD/NESTED LAYOUTS + , childOptions: "children" + , initChildLayout: "initChildren" + , destroyChildLayout: "destroyChildren" + , resizeChildLayout: "resizeChildren" + , resizeNestedLayout: "resizeChildren" + // MISC Options + , resizeWhileDragging: "livePaneResizing" + , resizeContentWhileDragging: "liveContentResizing" + , triggerEventsWhileDragging: "triggerEventsDuringLiveResize" + , maskIframesOnResize: "maskContents" + // STATE MANAGEMENT + , useStateCookie: "stateManagement.enabled" + , "cookie.autoLoad": "stateManagement.autoLoad" + , "cookie.autoSave": "stateManagement.autoSave" + , "cookie.keys": "stateManagement.stateKeys" + , "cookie.name": "stateManagement.cookie.name" + , "cookie.domain": "stateManagement.cookie.domain" + , "cookie.path": "stateManagement.cookie.path" + , "cookie.expires": "stateManagement.cookie.expires" + , "cookie.secure": "stateManagement.cookie.secure" + // OLD Language options + , noRoomToOpenTip: "tips.noRoomToOpen" + , togglerTip_open: "tips.Close" // open = Close + , togglerTip_closed: "tips.Open" // closed = Open + , resizerTip: "tips.Resize" + , sliderTip: "tips.Slide" + } + +/** +* @param {Object} opts +*/ +, renameOptions: function (opts) { + var map = $.layout.backwardCompatibility.map + , oldData, newData, value + ; + for (var itemPath in map) { + oldData = getBranch( itemPath ); + value = oldData.branch[ oldData.key ]; + if (value !== undefined) { + newData = getBranch( map[itemPath], true ); + newData.branch[ newData.key ] = value; + delete oldData.branch[ oldData.key ]; + } + } + + /** + * @param {string} path + * @param {boolean=} [create=false] Create path if does not exist + */ + function getBranch (path, create) { + var a = path.split(".") // split keys into array + , c = a.length - 1 + , D = { branch: opts, key: a[c] } // init branch at top & set key (last item) + , i = 0, k, undef; + for (; i 0) { + if (autoHide && $E.data('autoHidden') && $E.innerHeight() > 0) { + $E.show().data('autoHidden', false); + if (!browser.mozilla) // FireFox refreshes iframes - IE does not + // make hidden, then visible to 'refresh' display after animation + $E.css(_c.hidden).css(_c.visible); + } + } + else if (autoHide && !$E.data('autoHidden')) + $E.hide().data('autoHidden', true); + } + + /** + * @param {(string|!Object)} el + * @param {number=} outerHeight + * @param {boolean=} [autoHide=false] + */ +, setOuterHeight = function (el, outerHeight, autoHide) { + var $E = el, h; + if (isStr(el)) $E = $Ps[el]; // west + else if (!el.jquery) $E = $(el); + h = cssH($E, outerHeight); + $E.css({ height: h, visibility: "visible" }); // may have been 'hidden' by sizeContent + if (h > 0 && $E.innerWidth() > 0) { + if (autoHide && $E.data('autoHidden')) { + $E.show().data('autoHidden', false); + if (!browser.mozilla) // FireFox refreshes iframes - IE does not + $E.css(_c.hidden).css(_c.visible); + } + } + else if (autoHide && !$E.data('autoHidden')) + $E.hide().data('autoHidden', true); + } + + + /** + * Converts any 'size' params to a pixel/integer size, if not already + * If 'auto' or a decimal/percentage is passed as 'size', a pixel-size is calculated + * + /** + * @param {string} pane + * @param {(string|number)=} size + * @param {string=} [dir] + * @return {number} + */ +, _parseSize = function (pane, size, dir) { + if (!dir) dir = _c[pane].dir; + + if (isStr(size) && size.match(/%/)) + size = (size === '100%') ? -1 : parseInt(size, 10) / 100; // convert % to decimal + + if (size === 0) + return 0; + else if (size >= 1) + return parseInt(size, 10); + + var o = options, avail = 0; + if (dir=="horz") // north or south or center.minHeight + avail = sC.innerHeight - ($Ps.north ? o.north.spacing_open : 0) - ($Ps.south ? o.south.spacing_open : 0); + else if (dir=="vert") // east or west or center.minWidth + avail = sC.innerWidth - ($Ps.west ? o.west.spacing_open : 0) - ($Ps.east ? o.east.spacing_open : 0); + + if (size === -1) // -1 == 100% + return avail; + else if (size > 0) // percentage, eg: .25 + return round(avail * size); + else if (pane=="center") + return 0; + else { // size < 0 || size=='auto' || size==Missing || size==Invalid + // auto-size the pane + var dim = (dir === "horz" ? "height" : "width") + , $P = $Ps[pane] + , $C = dim === 'height' ? $Cs[pane] : false + , vis = $.layout.showInvisibly($P) // show pane invisibly if hidden + , szP = $P.css(dim) // SAVE current pane size + , szC = $C ? $C.css(dim) : 0 // SAVE current content size + ; + $P.css(dim, "auto"); + if ($C) $C.css(dim, "auto"); + size = (dim === "height") ? $P.outerHeight() : $P.outerWidth(); // MEASURE + $P.css(dim, szP).css(vis); // RESET size & visibility + if ($C) $C.css(dim, szC); + return size; + } + } + + /** + * Calculates current 'size' (outer-width or outer-height) of a border-pane - optionally with 'pane-spacing' added + * + * @param {(string|!Object)} pane + * @param {boolean=} [inclSpace=false] + * @return {number} Returns EITHER Width for east/west panes OR Height for north/south panes + */ +, getPaneSize = function (pane, inclSpace) { + var + $P = $Ps[pane] + , o = options[pane] + , s = state[pane] + , oSp = (inclSpace ? o.spacing_open : 0) + , cSp = (inclSpace ? o.spacing_closed : 0) + ; + if (!$P || s.isHidden) + return 0; + else if (s.isClosed || (s.isSliding && inclSpace)) + return cSp; + else if (_c[pane].dir === "horz") + return $P.outerHeight() + oSp; + else // dir === "vert" + return $P.outerWidth() + oSp; + } + + /** + * Calculate min/max pane dimensions and limits for resizing + * + * @param {string} pane + * @param {boolean=} [slide=false] + */ +, setSizeLimits = function (pane, slide) { + if (!isInitialized()) return; + var + o = options[pane] + , s = state[pane] + , c = _c[pane] + , dir = c.dir + , type = c.sizeType.toLowerCase() + , isSliding = (slide != undefined ? slide : s.isSliding) // only open() passes 'slide' param + , $P = $Ps[pane] + , paneSpacing = o.spacing_open + // measure the pane on the *opposite side* from this pane + , altPane = _c.oppositeEdge[pane] + , altS = state[altPane] + , $altP = $Ps[altPane] + , altPaneSize = (!$altP || altS.isVisible===false || altS.isSliding ? 0 : (dir=="horz" ? $altP.outerHeight() : $altP.outerWidth())) + , altPaneSpacing = ((!$altP || altS.isHidden ? 0 : options[altPane][ altS.isClosed !== false ? "spacing_closed" : "spacing_open" ]) || 0) + // limitSize prevents this pane from 'overlapping' opposite pane + , containerSize = (dir=="horz" ? sC.innerHeight : sC.innerWidth) + , minCenterDims = cssMinDims("center") + , minCenterSize = dir=="horz" ? max(options.center.minHeight, minCenterDims.minHeight) : max(options.center.minWidth, minCenterDims.minWidth) + // if pane is 'sliding', then ignore center and alt-pane sizes - because 'overlays' them + , limitSize = (containerSize - paneSpacing - (isSliding ? 0 : (_parseSize("center", minCenterSize, dir) + altPaneSize + altPaneSpacing))) + , minSize = s.minSize = max( _parseSize(pane, o.minSize), cssMinDims(pane).minSize ) + , maxSize = s.maxSize = min( (o.maxSize ? _parseSize(pane, o.maxSize) : 100000), limitSize ) + , r = s.resizerPosition = {} // used to set resizing limits + , top = sC.inset.top + , left = sC.inset.left + , W = sC.innerWidth + , H = sC.innerHeight + , rW = o.spacing_open // subtract resizer-width to get top/left position for south/east + ; + switch (pane) { + case "north": r.min = top + minSize; + r.max = top + maxSize; + break; + case "west": r.min = left + minSize; + r.max = left + maxSize; + break; + case "south": r.min = top + H - maxSize - rW; + r.max = top + H - minSize - rW; + break; + case "east": r.min = left + W - maxSize - rW; + r.max = left + W - minSize - rW; + break; + }; + } + + /** + * Returns data for setting the size/position of center pane. Also used to set Height for east/west panes + * + * @return JSON Returns a hash of all dimensions: top, bottom, left, right, (outer) width and (outer) height + */ +, calcNewCenterPaneDims = function () { + var d = { + top: getPaneSize("north", true) // true = include 'spacing' value for pane + , bottom: getPaneSize("south", true) + , left: getPaneSize("west", true) + , right: getPaneSize("east", true) + , width: 0 + , height: 0 + }; + + // NOTE: sC = state.container + // calc center-pane outer dimensions + d.width = sC.innerWidth - d.left - d.right; // outerWidth + d.height = sC.innerHeight - d.bottom - d.top; // outerHeight + // add the 'container border/padding' to get final positions relative to the container + d.top += sC.inset.top; + d.bottom += sC.inset.bottom; + d.left += sC.inset.left; + d.right += sC.inset.right; + + return d; + } + + + /** + * @param {!Object} el + * @param {boolean=} [allStates=false] + */ +, getHoverClasses = function (el, allStates) { + var + $El = $(el) + , type = $El.data("layoutRole") + , pane = $El.data("layoutEdge") + , o = options[pane] + , root = o[type +"Class"] + , _pane = "-"+ pane // eg: "-west" + , _open = "-open" + , _closed = "-closed" + , _slide = "-sliding" + , _hover = "-hover " // NOTE the trailing space + , _state = $El.hasClass(root+_closed) ? _closed : _open + , _alt = _state === _closed ? _open : _closed + , classes = (root+_hover) + (root+_pane+_hover) + (root+_state+_hover) + (root+_pane+_state+_hover) + ; + if (allStates) // when 'removing' classes, also remove alternate-state classes + classes += (root+_alt+_hover) + (root+_pane+_alt+_hover); + + if (type=="resizer" && $El.hasClass(root+_slide)) + classes += (root+_slide+_hover) + (root+_pane+_slide+_hover); + + return $.trim(classes); + } +, addHover = function (evt, el) { + var $E = $(el || this); + if (evt && $E.data("layoutRole") === "toggler") + evt.stopPropagation(); // prevent triggering 'slide' on Resizer-bar + $E.addClass( getHoverClasses($E) ); + } +, removeHover = function (evt, el) { + var $E = $(el || this); + $E.removeClass( getHoverClasses($E, true) ); + } + +, onResizerEnter = function (evt) { // ALSO called by toggler.mouseenter + var pane = $(this).data("layoutEdge") + , s = state[pane] + , $d = $(document) + ; + // ignore closed-panes and mouse moving back & forth over resizer! + // also ignore if ANY pane is currently resizing + if ( s.isResizing || state.paneResizing ) return; + + if (options.maskPanesEarly) + showMasks( pane, { resizing: true }); + } +, onResizerLeave = function (evt, el) { + var e = el || this // el is only passed when called by the timer + , pane = $(e).data("layoutEdge") + , name = pane +"ResizerLeave" + , $d = $(document) + ; + timer.clear(pane+"_openSlider"); // cancel slideOpen timer, if set + timer.clear(name); // cancel enableSelection timer - may re/set below + // this method calls itself on a timer because it needs to allow + // enough time for dragging to kick-in and set the isResizing flag + // dragging has a 100ms delay set, so this delay must be >100 + if (!el) // 1st call - mouseleave event + timer.set(name, function(){ onResizerLeave(evt, e); }, 200); + // if user is resizing, dragStop will reset everything, so skip it here + else if (options.maskPanesEarly && !state.paneResizing) // 2nd call - by timer + hideMasks(); + } + +/* + * ########################### + * INITIALIZATION METHODS + * ########################### + */ + + /** + * Initialize the layout - called automatically whenever an instance of layout is created + * + * @see none - triggered onInit + * @return mixed true = fully initialized | false = panes not initialized (yet) | 'cancel' = abort + */ +, _create = function () { + // initialize config/options + initOptions(); + var o = options + , s = state; + + // TEMP state so isInitialized returns true during init process + s.creatingLayout = true; + + // init plugins for this layout, if there are any (eg: stateManagement) + runPluginCallbacks( Instance, $.layout.onCreate ); + + // options & state have been initialized, so now run beforeLoad callback + // onload will CANCEL layout creation if it returns false + if (false === _runCallbacks("onload_start")) + return 'cancel'; + + // initialize the container element + _initContainer(); + + // bind hotkey function - keyDown - if required + initHotkeys(); + + // bind window.onunload + $(window).bind("unload."+ sID, unload); + + // init plugins for this layout, if there are any (eg: customButtons) + runPluginCallbacks( Instance, $.layout.onLoad ); + + // if layout elements are hidden, then layout WILL NOT complete initialization! + // initLayoutElements will set initialized=true and run the onload callback IF successful + if (o.initPanes) _initLayoutElements(); + + delete s.creatingLayout; + + return state.initialized; + } + + /** + * Initialize the layout IF not already + * + * @see All methods in Instance run this test + * @return boolean true = layoutElements have been initialized | false = panes are not initialized (yet) + */ +, isInitialized = function () { + if (state.initialized || state.creatingLayout) return true; // already initialized + else return _initLayoutElements(); // try to init panes NOW + } + + /** + * Initialize the layout - called automatically whenever an instance of layout is created + * + * @see _create() & isInitialized + * @param {boolean=} [retry=false] // indicates this is a 2nd try + * @return An object pointer to the instance created + */ +, _initLayoutElements = function (retry) { + // initialize config/options + var o = options; + // CANNOT init panes inside a hidden container! + if (!$N.is(":visible")) { + // handle Chrome bug where popup window 'has no height' + // if layout is BODY element, try again in 50ms + // SEE: http://layout.jquery-dev.com/samples/test_popup_window.html + if ( !retry && browser.webkit && $N[0].tagName === "BODY" ) + setTimeout(function(){ _initLayoutElements(true); }, 50); + return false; + } + + // a center pane is required, so make sure it exists + if (!getPane("center").length) { + return _log( o.errors.centerPaneMissing ); + } + + // TEMP state so isInitialized returns true during init process + state.creatingLayout = true; + + // update Container dims + $.extend(sC, elDims( $N, o.inset )); // passing inset means DO NOT include insetX values + + // initialize all layout elements + initPanes(); // size & position panes - calls initHandles() - which calls initResizable() + + if (o.scrollToBookmarkOnLoad) { + var l = self.location; + if (l.hash) l.replace( l.hash ); // scrollTo Bookmark + } + + // check to see if this layout 'nested' inside a pane + if (Instance.hasParentLayout) + o.resizeWithWindow = false; + // bind resizeAll() for 'this layout instance' to window.resize event + else if (o.resizeWithWindow) + $(window).bind("resize."+ sID, windowResize); + + delete state.creatingLayout; + state.initialized = true; + + // init plugins for this layout, if there are any + runPluginCallbacks( Instance, $.layout.onReady ); + + // now run the onload callback, if exists + _runCallbacks("onload_end"); + + return true; // elements initialized successfully + } + + /** + * Initialize nested layouts for a specific pane - can optionally pass layout-options + * + * @param {(string|Object)} evt_or_pane The pane being opened, ie: north, south, east, or west + * @param {Object=} [opts] Layout-options - if passed, will OVERRRIDE options[pane].children + * @return An object pointer to the layout instance created - or null + */ +, createChildren = function (evt_or_pane, opts) { + var pane = evtPane.call(this, evt_or_pane) + , $P = $Ps[pane] + ; + if (!$P) return; + var $C = $Cs[pane] + , s = state[pane] + , o = options[pane] + , sm = options.stateManagement || {} + , cos = opts ? (o.children = opts) : o.children + ; + if ( $.isPlainObject( cos ) ) + cos = [ cos ]; // convert a hash to a 1-elem array + else if (!cos || !$.isArray( cos )) + return; + + $.each( cos, function (idx, co) { + if ( !$.isPlainObject( co ) ) return; + + // determine which element is supposed to be the 'child container' + // if pane has a 'containerSelector' OR a 'content-div', use those instead of the pane + var $containers = co.containerSelector ? $P.find( co.containerSelector ) : ($C || $P); + + $containers.each(function(){ + var $cont = $(this) + , child = $cont.data("layout") // see if a child-layout ALREADY exists on this element + ; + // if no layout exists, but children are set, try to create the layout now + if (!child) { + // TODO: see about moving this to the stateManagement plugin, as a method + // set a unique child-instance key for this layout, if not already set + setInstanceKey({ container: $cont, options: co }, s ); + // If THIS layout has a hash in stateManagement.autoLoad, + // then see if it also contains state-data for this child-layout + // If so, copy the stateData to child.options.stateManagement.autoLoad + if ( sm.includeChildren && state.stateData[pane] ) { + // THIS layout's state was cached when its state was loaded + var paneChildren = state.stateData[pane].children || {} + , childState = paneChildren[ co.instanceKey ] + , co_sm = co.stateManagement || (co.stateManagement = { autoLoad: true }) + ; + // COPY the stateData into the autoLoad key + if ( co_sm.autoLoad === true && childState ) { + co_sm.autoSave = false; // disable autoSave because saving handled by parent-layout + co_sm.includeChildren = true; // cascade option - FOR NOW + co_sm.autoLoad = $.extend(true, {}, childState); // COPY the state-hash + } + } + + // create the layout + child = $cont.layout( co ); + + // if successful, update data + if (child) { + // add the child and update all layout-pointers + // MAY have already been done by child-layout calling parent.refreshChildren() + refreshChildren( pane, child ); + } + } + }); + }); + } + +, setInstanceKey = function (child, parentPaneState) { + // create a named key for use in state and instance branches + var $c = child.container + , o = child.options + , sm = o.stateManagement + , key = o.instanceKey || $c.data("layoutInstanceKey") + ; + if (!key) key = (sm && sm.cookie ? sm.cookie.name : '') || o.name; // look for a name/key + if (!key) key = "layout"+ (++parentPaneState.childIdx); // if no name/key found, generate one + else key = key.replace(/[^\w-]/gi, '_').replace(/_{2,}/g, '_'); // ensure is valid as a hash key + o.instanceKey = key; + $c.data("layoutInstanceKey", key); // useful if layout is destroyed and then recreated + return key; + } + + /** + * @param {string} pane The pane being opened, ie: north, south, east, or west + * @param {Object=} newChild New child-layout Instance to add to this pane + */ +, refreshChildren = function (pane, newChild) { + var $P = $Ps[pane] + , pC = children[pane] + , s = state[pane] + , o + ; + // check for destroy()ed layouts and update the child pointers & arrays + if ($.isPlainObject( pC )) { + $.each( pC, function (key, child) { + if (child.destroyed) delete pC[key] + }); + // if no more children, remove the children hash + if ($.isEmptyObject( pC )) + pC = children[pane] = null; // clear children hash + } + + // see if there is a directly-nested layout inside this pane + // if there is, then there can be only ONE child-layout, so check that... + if (!newChild && !pC) { + newChild = $P.data("layout"); + } + + // if a newChild instance was passed, add it to children[pane] + if (newChild) { + // update child.state + newChild.hasParentLayout = true; // set parent-flag in child + // instanceKey is a key-name used in both state and children + o = newChild.options; + // set a unique child-instance key for this layout, if not already set + setInstanceKey( newChild, s ); + // add pointer to pane.children hash + if (!pC) pC = children[pane] = {}; // create an empty children hash + pC[ o.instanceKey ] = newChild.container.data("layout"); // add childLayout instance + } + + // ALWAYS refresh the pane.children alias, even if null + Instance[pane].children = children[pane]; + + // if newChild was NOT passed - see if there is a child layout NOW + if (!newChild) { + createChildren(pane); // MAY create a child and re-call this method + } + } + +, windowResize = function () { + var o = options + , delay = Number(o.resizeWithWindowDelay); + if (delay < 10) delay = 100; // MUST have a delay! + // resizing uses a delay-loop because the resize event fires repeatly - except in FF, but delay anyway + timer.clear("winResize"); // if already running + timer.set("winResize", function(){ + timer.clear("winResize"); + timer.clear("winResizeRepeater"); + var dims = elDims( $N, o.inset ); + // only trigger resizeAll() if container has changed size + if (dims.innerWidth !== sC.innerWidth || dims.innerHeight !== sC.innerHeight) + resizeAll(); + }, delay); + // ALSO set fixed-delay timer, if not already running + if (!timer.data["winResizeRepeater"]) setWindowResizeRepeater(); + } + +, setWindowResizeRepeater = function () { + var delay = Number(options.resizeWithWindowMaxDelay); + if (delay > 0) + timer.set("winResizeRepeater", function(){ setWindowResizeRepeater(); resizeAll(); }, delay); + } + +, unload = function () { + var o = options; + + _runCallbacks("onunload_start"); + + // trigger plugin callabacks for this layout (eg: stateManagement) + runPluginCallbacks( Instance, $.layout.onUnload ); + + _runCallbacks("onunload_end"); + } + + /** + * Validate and initialize container CSS and events + * + * @see _create() + */ +, _initContainer = function () { + var + N = $N[0] + , $H = $("html") + , tag = sC.tagName = N.tagName + , id = sC.id = N.id + , cls = sC.className = N.className + , o = options + , name = o.name + , props = "position,margin,padding,border" + , css = "layoutCSS" + , CSS = {} + , hid = "hidden" // used A LOT! + // see if this container is a 'pane' inside an outer-layout + , parent = $N.data("parentLayout") // parent-layout Instance + , pane = $N.data("layoutEdge") // pane-name in parent-layout + , isChild = parent && pane + , num = $.layout.cssNum + , $parent, n + ; + // sC = state.container + sC.selector = $N.selector.split(".slice")[0]; + sC.ref = (o.name ? o.name +' layout / ' : '') + tag + (id ? "#"+id : cls ? '.['+cls+']' : ''); // used in messages + sC.isBody = (tag === "BODY"); + + // try to find a parent-layout + if (!isChild && !sC.isBody) { + $parent = $N.closest("."+ $.layout.defaults.panes.paneClass); + parent = $parent.data("parentLayout"); + pane = $parent.data("layoutEdge"); + isChild = parent && pane; + } + + $N .data({ + layout: Instance + , layoutContainer: sID // FLAG to indicate this is a layout-container - contains unique internal ID + }) + .addClass(o.containerClass) + ; + var layoutMethods = { + destroy: '' + , initPanes: '' + , resizeAll: 'resizeAll' + , resize: 'resizeAll' + }; + // loop hash and bind all methods - include layoutID namespacing + for (name in layoutMethods) { + $N.bind("layout"+ name.toLowerCase() +"."+ sID, Instance[ layoutMethods[name] || name ]); + } + + // if this container is another layout's 'pane', then set child/parent pointers + if (isChild) { + // update parent flag + Instance.hasParentLayout = true; + // set pointers to THIS child-layout (Instance) in parent-layout + parent.refreshChildren( pane, Instance ); + } + + // SAVE original container CSS for use in destroy() + if (!$N.data(css)) { + // handle props like overflow different for BODY & HTML - has 'system default' values + if (sC.isBody) { + // SAVE CSS + $N.data(css, $.extend( styles($N, props), { + height: $N.css("height") + , overflow: $N.css("overflow") + , overflowX: $N.css("overflowX") + , overflowY: $N.css("overflowY") + })); + // ALSO SAVE CSS + $H.data(css, $.extend( styles($H, 'padding'), { + height: "auto" // FF would return a fixed px-size! + , overflow: $H.css("overflow") + , overflowX: $H.css("overflowX") + , overflowY: $H.css("overflowY") + })); + } + else // handle props normally for non-body elements + $N.data(css, styles($N, props+",top,bottom,left,right,width,height,overflow,overflowX,overflowY") ); + } + + try { + // common container CSS + CSS = { + overflow: hid + , overflowX: hid + , overflowY: hid + }; + $N.css( CSS ); + + if (o.inset && !$.isPlainObject(o.inset)) { + // can specify a single number for equal outset all-around + n = parseInt(o.inset, 10) || 0 + o.inset = { + top: n + , bottom: n + , left: n + , right: n + }; + } + + // format html & body if this is a full page layout + if (sC.isBody) { + // if HTML has padding, use this as an outer-spacing around BODY + if (!o.outset) { + // use padding from parent-elem (HTML) as outset + o.outset = { + top: num($H, "paddingTop") + , bottom: num($H, "paddingBottom") + , left: num($H, "paddingLeft") + , right: num($H, "paddingRight") + }; + } + else if (!$.isPlainObject(o.outset)) { + // can specify a single number for equal outset all-around + n = parseInt(o.outset, 10) || 0 + o.outset = { + top: n + , bottom: n + , left: n + , right: n + }; + } + // HTML + $H.css( CSS ).css({ + height: "100%" + , border: "none" // no border or padding allowed when using height = 100% + , padding: 0 // ditto + , margin: 0 + }); + // BODY + if (browser.isIE6) { + // IE6 CANNOT use the trick of setting absolute positioning on all 4 sides - must have 'height' + $N.css({ + width: "100%" + , height: "100%" + , border: "none" // no border or padding allowed when using height = 100% + , padding: 0 // ditto + , margin: 0 + , position: "relative" + }); + // convert body padding to an inset option - the border cannot be measured in IE6! + if (!o.inset) o.inset = elDims( $N ).inset; + } + else { // use absolute positioning for BODY to allow borders & padding without overflow + $N.css({ + width: "auto" + , height: "auto" + , margin: 0 + , position: "absolute" // allows for border and padding on BODY + }); + // apply edge-positioning created above + $N.css( o.outset ); + } + // set current layout-container dimensions + $.extend(sC, elDims( $N, o.inset )); // passing inset means DO NOT include insetX values + } + else { + // container MUST have 'position' + var p = $N.css("position"); + if (!p || !p.match(/(fixed|absolute|relative)/)) + $N.css("position","relative"); + + // set current layout-container dimensions + if ( $N.is(":visible") ) { + $.extend(sC, elDims( $N, o.inset )); // passing inset means DO NOT change insetX (padding) values + if (sC.innerHeight < 1) // container has no 'height' - warn developer + _log( o.errors.noContainerHeight.replace(/CONTAINER/, sC.ref) ); + } + } + + // if container has min-width/height, then enable scrollbar(s) + if ( num($N, "minWidth") ) $N.parent().css("overflowX","auto"); + if ( num($N, "minHeight") ) $N.parent().css("overflowY","auto"); + + } catch (ex) {} + } + + /** + * Bind layout hotkeys - if options enabled + * + * @see _create() and addPane() + * @param {string=} [panes=""] The edge(s) to process + */ +, initHotkeys = function (panes) { + panes = panes ? panes.split(",") : _c.borderPanes; + // bind keyDown to capture hotkeys, if option enabled for ANY pane + $.each(panes, function (i, pane) { + var o = options[pane]; + if (o.enableCursorHotkey || o.customHotkey) { + $(document).bind("keydown."+ sID, keyDown); // only need to bind this ONCE + return false; // BREAK - binding was done + } + }); + } + + /** + * Build final OPTIONS data + * + * @see _create() + */ +, initOptions = function () { + var data, d, pane, key, val, i, c, o; + + // reprocess user's layout-options to have correct options sub-key structure + opts = $.layout.transformData( opts, true ); // panes = default subkey + + // auto-rename old options for backward compatibility + opts = $.layout.backwardCompatibility.renameAllOptions( opts ); + + // if user-options has 'panes' key (pane-defaults), clean it... + if (!$.isEmptyObject(opts.panes)) { + // REMOVE any pane-defaults that MUST be set per-pane + data = $.layout.optionsMap.noDefault; + for (i=0, c=data.length; i 0) { + z.pane_normal = zo; + z.content_mask = max(zo+1, z.content_mask); // MIN = +1 + z.resizer_normal = max(zo+2, z.resizer_normal); // MIN = +2 + } + + // DELETE 'panes' key now that we are done - values were copied to EACH pane + delete options.panes; + + + function createFxOptions ( pane ) { + var o = options[pane] + , d = options.panes; + // ensure fxSettings key to avoid errors + if (!o.fxSettings) o.fxSettings = {}; + if (!d.fxSettings) d.fxSettings = {}; + + $.each(["_open","_close","_size"], function (i,n) { + var + sName = "fxName"+ n + , sSpeed = "fxSpeed"+ n + , sSettings = "fxSettings"+ n + // recalculate fxName according to specificity rules + , fxName = o[sName] = + o[sName] // options.west.fxName_open + || d[sName] // options.panes.fxName_open + || o.fxName // options.west.fxName + || d.fxName // options.panes.fxName + || "none" // MEANS $.layout.defaults.panes.fxName == "" || false || null || 0 + , fxExists = $.effects && ($.effects[fxName] || ($.effects.effect && $.effects.effect[fxName])) + ; + // validate fxName to ensure is valid effect - MUST have effect-config data in options.effects + if (fxName === "none" || !options.effects[fxName] || !fxExists) + fxName = o[sName] = "none"; // effect not loaded OR unrecognized fxName + + // set vars for effects subkeys to simplify logic + var fx = options.effects[fxName] || {} // effects.slide + , fx_all = fx.all || null // effects.slide.all + , fx_pane = fx[pane] || null // effects.slide.west + ; + // create fxSpeed[_open|_close|_size] + o[sSpeed] = + o[sSpeed] // options.west.fxSpeed_open + || d[sSpeed] // options.west.fxSpeed_open + || o.fxSpeed // options.west.fxSpeed + || d.fxSpeed // options.panes.fxSpeed + || null // DEFAULT - let fxSetting.duration control speed + ; + // create fxSettings[_open|_close|_size] + o[sSettings] = $.extend( + true + , {} + , fx_all // effects.slide.all + , fx_pane // effects.slide.west + , d.fxSettings // options.panes.fxSettings + , o.fxSettings // options.west.fxSettings + , d[sSettings] // options.panes.fxSettings_open + , o[sSettings] // options.west.fxSettings_open + ); + }); + + // DONE creating action-specific-settings for this pane, + // so DELETE generic options - are no longer meaningful + delete o.fxName; + delete o.fxSpeed; + delete o.fxSettings; + } + } + + /** + * Initialize module objects, styling, size and position for all panes + * + * @see _initElements() + * @param {string} pane The pane to process + */ +, getPane = function (pane) { + var sel = options[pane].paneSelector + if (sel.substr(0,1)==="#") // ID selector + // NOTE: elements selected 'by ID' DO NOT have to be 'children' + return $N.find(sel).eq(0); + else { // class or other selector + var $P = $N.children(sel).eq(0); + // look for the pane nested inside a 'form' element + return $P.length ? $P : $N.children("form:first").children(sel).eq(0); + } + } + + /** + * @param {Object=} evt + */ +, initPanes = function (evt) { + // stopPropagation if called by trigger("layoutinitpanes") - use evtPane utility + evtPane(evt); + + // NOTE: do north & south FIRST so we can measure their height - do center LAST + $.each(_c.allPanes, function (idx, pane) { + addPane( pane, true ); + }); + + // init the pane-handles NOW in case we have to hide or close the pane below + initHandles(); + + // now that all panes have been initialized and initially-sized, + // make sure there is really enough space available for each pane + $.each(_c.borderPanes, function (i, pane) { + if ($Ps[pane] && state[pane].isVisible) { // pane is OPEN + setSizeLimits(pane); + makePaneFit(pane); // pane may be Closed, Hidden or Resized by makePaneFit() + } + }); + // size center-pane AGAIN in case we 'closed' a border-pane in loop above + sizeMidPanes("center"); + + // Chrome/Webkit sometimes fires callbacks BEFORE it completes resizing! + // Before RC30.3, there was a 10ms delay here, but that caused layout + // to load asynchrously, which is BAD, so try skipping delay for now + + // process pane contents and callbacks, and init/resize child-layout if exists + $.each(_c.allPanes, function (idx, pane) { + afterInitPane(pane); + }); + } + + /** + * Add a pane to the layout - subroutine of initPanes() + * + * @see initPanes() + * @param {string} pane The pane to process + * @param {boolean=} [force=false] Size content after init + */ +, addPane = function (pane, force) { + if ( !force && !isInitialized() ) return; + var + o = options[pane] + , s = state[pane] + , c = _c[pane] + , dir = c.dir + , fx = s.fx + , spacing = o.spacing_open || 0 + , isCenter = (pane === "center") + , CSS = {} + , $P = $Ps[pane] + , size, minSize, maxSize, child + ; + // if pane-pointer already exists, remove the old one first + if ($P) + removePane( pane, false, true, false ); + else + $Cs[pane] = false; // init + + $P = $Ps[pane] = getPane(pane); + if (!$P.length) { + $Ps[pane] = false; // logic + return; + } + + // SAVE original Pane CSS + if (!$P.data("layoutCSS")) { + var props = "position,top,left,bottom,right,width,height,overflow,zIndex,display,backgroundColor,padding,margin,border"; + $P.data("layoutCSS", styles($P, props)); + } + + // create alias for pane data in Instance - initHandles will add more + Instance[pane] = { + name: pane + , pane: $Ps[pane] + , content: $Cs[pane] + , options: options[pane] + , state: state[pane] + , children: children[pane] + }; + + // add classes, attributes & events + $P .data({ + parentLayout: Instance // pointer to Layout Instance + , layoutPane: Instance[pane] // NEW pointer to pane-alias-object + , layoutEdge: pane + , layoutRole: "pane" + }) + .css(c.cssReq).css("zIndex", options.zIndexes.pane_normal) + .css(o.applyDemoStyles ? c.cssDemo : {}) // demo styles + .addClass( o.paneClass +" "+ o.paneClass+"-"+pane ) // default = "ui-layout-pane ui-layout-pane-west" - may be a dupe of 'paneSelector' + .bind("mouseenter."+ sID, addHover ) + .bind("mouseleave."+ sID, removeHover ) + ; + var paneMethods = { + hide: '' + , show: '' + , toggle: '' + , close: '' + , open: '' + , slideOpen: '' + , slideClose: '' + , slideToggle: '' + , size: 'sizePane' + , sizePane: 'sizePane' + , sizeContent: '' + , sizeHandles: '' + , enableClosable: '' + , disableClosable: '' + , enableSlideable: '' + , disableSlideable: '' + , enableResizable: '' + , disableResizable: '' + , swapPanes: 'swapPanes' + , swap: 'swapPanes' + , move: 'swapPanes' + , removePane: 'removePane' + , remove: 'removePane' + , createChildren: '' + , resizeChildren: '' + , resizeAll: 'resizeAll' + , resizeLayout: 'resizeAll' + } + , name; + // loop hash and bind all methods - include layoutID namespacing + for (name in paneMethods) { + $P.bind("layoutpane"+ name.toLowerCase() +"."+ sID, Instance[ paneMethods[name] || name ]); + } + + // see if this pane has a 'scrolling-content element' + initContent(pane, false); // false = do NOT sizeContent() - called later + + if (!isCenter) { + // call _parseSize AFTER applying pane classes & styles - but before making visible (if hidden) + // if o.size is auto or not valid, then MEASURE the pane and use that as its 'size' + size = s.size = _parseSize(pane, o.size); + minSize = _parseSize(pane,o.minSize) || 1; + maxSize = _parseSize(pane,o.maxSize) || 100000; + if (size > 0) size = max(min(size, maxSize), minSize); + s.autoResize = o.autoResize; // used with percentage sizes + + // state for border-panes + s.isClosed = false; // true = pane is closed + s.isSliding = false; // true = pane is currently open by 'sliding' over adjacent panes + s.isResizing= false; // true = pane is in process of being resized + s.isHidden = false; // true = pane is hidden - no spacing, resizer or toggler is visible! + + // array for 'pin buttons' whose classNames are auto-updated on pane-open/-close + if (!s.pins) s.pins = []; + } + // states common to ALL panes + s.tagName = $P[0].tagName; + s.edge = pane; // useful if pane is (or about to be) 'swapped' - easy find out where it is (or is going) + s.noRoom = false; // true = pane 'automatically' hidden due to insufficient room - will unhide automatically + s.isVisible = true; // false = pane is invisible - closed OR hidden - simplify logic + + // init pane positioning + setPanePosition( pane ); + + // if pane is not visible, + if (dir === "horz") // north or south pane + CSS.height = cssH($P, size); + else if (dir === "vert") // east or west pane + CSS.width = cssW($P, size); + //else if (isCenter) {} + + $P.css(CSS); // apply size -- top, bottom & height will be set by sizeMidPanes + if (dir != "horz") sizeMidPanes(pane, true); // true = skipCallback + + // if manually adding a pane AFTER layout initialization, then... + if (state.initialized) { + initHandles( pane ); + initHotkeys( pane ); + } + + // close or hide the pane if specified in settings + if (o.initClosed && o.closable && !o.initHidden) + close(pane, true, true); // true, true = force, noAnimation + else if (o.initHidden || o.initClosed) + hide(pane); // will be completely invisible - no resizer or spacing + else if (!s.noRoom) + // make the pane visible - in case was initially hidden + $P.css("display","block"); + // ELSE setAsOpen() - called later by initHandles() + + // RESET visibility now - pane will appear IF display:block + $P.css("visibility","visible"); + + // check option for auto-handling of pop-ups & drop-downs + if (o.showOverflowOnHover) + $P.hover( allowOverflow, resetOverflow ); + + // if manually adding a pane AFTER layout initialization, then... + if (state.initialized) { + afterInitPane( pane ); + } + } + +, afterInitPane = function (pane) { + var $P = $Ps[pane] + , s = state[pane] + , o = options[pane] + ; + if (!$P) return; + + // see if there is a directly-nested layout inside this pane + if ($P.data("layout")) + refreshChildren( pane, $P.data("layout") ); + + // process pane contents and callbacks, and init/resize child-layout if exists + if (s.isVisible) { // pane is OPEN + if (state.initialized) // this pane was added AFTER layout was created + resizeAll(); // will also sizeContent + else + sizeContent(pane); + + if (o.triggerEventsOnLoad) + _runCallbacks("onresize_end", pane); + else // automatic if onresize called, otherwise call it specifically + // resize child - IF inner-layout already exists (created before this layout) + resizeChildren(pane, true); // a previously existing childLayout + } + + // init childLayouts - even if pane is not visible + if (o.initChildren && o.children) + createChildren(pane); + } + + /** + * @param {string=} panes The pane(s) to process + */ +, setPanePosition = function (panes) { + panes = panes ? panes.split(",") : _c.borderPanes; + + // create toggler DIVs for each pane, and set object pointers for them, eg: $R.north = north toggler DIV + $.each(panes, function (i, pane) { + var $P = $Ps[pane] + , $R = $Rs[pane] + , o = options[pane] + , s = state[pane] + , side = _c[pane].side + , CSS = {} + ; + if (!$P) return; // pane does not exist - skip + + // set css-position to account for container borders & padding + switch (pane) { + case "north": CSS.top = sC.inset.top; + CSS.left = sC.inset.left; + CSS.right = sC.inset.right; + break; + case "south": CSS.bottom = sC.inset.bottom; + CSS.left = sC.inset.left; + CSS.right = sC.inset.right; + break; + case "west": CSS.left = sC.inset.left; // top, bottom & height set by sizeMidPanes() + break; + case "east": CSS.right = sC.inset.right; // ditto + break; + case "center": // top, left, width & height set by sizeMidPanes() + } + // apply position + $P.css(CSS); + + // update resizer position + if ($R && s.isClosed) + $R.css(side, sC.inset[side]); + else if ($R && !s.isHidden) + $R.css(side, sC.inset[side] + getPaneSize(pane)); + }); + } + + /** + * Initialize module objects, styling, size and position for all resize bars and toggler buttons + * + * @see _create() + * @param {string=} [panes=""] The edge(s) to process + */ +, initHandles = function (panes) { + panes = panes ? panes.split(",") : _c.borderPanes; + + // create toggler DIVs for each pane, and set object pointers for them, eg: $R.north = north toggler DIV + $.each(panes, function (i, pane) { + var $P = $Ps[pane]; + $Rs[pane] = false; // INIT + $Ts[pane] = false; + if (!$P) return; // pane does not exist - skip + + var o = options[pane] + , s = state[pane] + , c = _c[pane] + , paneId = o.paneSelector.substr(0,1) === "#" ? o.paneSelector.substr(1) : "" + , rClass = o.resizerClass + , tClass = o.togglerClass + , spacing = (s.isVisible ? o.spacing_open : o.spacing_closed) + , _pane = "-"+ pane // used for classNames + , _state = (s.isVisible ? "-open" : "-closed") // used for classNames + , I = Instance[pane] + // INIT RESIZER BAR + , $R = I.resizer = $Rs[pane] = $("
        ") + // INIT TOGGLER BUTTON + , $T = I.toggler = (o.closable ? $Ts[pane] = $("
        ") : false) + ; + + //if (s.isVisible && o.resizable) ... handled by initResizable + if (!s.isVisible && o.slidable) + $R.attr("title", o.tips.Slide).css("cursor", o.sliderCursor); + + $R // if paneSelector is an ID, then create a matching ID for the resizer, eg: "#paneLeft" => "paneLeft-resizer" + .attr("id", paneId ? paneId +"-resizer" : "" ) + .data({ + parentLayout: Instance + , layoutPane: Instance[pane] // NEW pointer to pane-alias-object + , layoutEdge: pane + , layoutRole: "resizer" + }) + .css(_c.resizers.cssReq).css("zIndex", options.zIndexes.resizer_normal) + .css(o.applyDemoStyles ? _c.resizers.cssDemo : {}) // add demo styles + .addClass(rClass +" "+ rClass+_pane) + .hover(addHover, removeHover) // ALWAYS add hover-classes, even if resizing is not enabled - handle with CSS instead + .hover(onResizerEnter, onResizerLeave) // ALWAYS NEED resizer.mouseleave to balance toggler.mouseenter + .mousedown($.layout.disableTextSelection) // prevent text-selection OUTSIDE resizer + .mouseup($.layout.enableTextSelection) // not really necessary, but just in case + .appendTo($N) // append DIV to container + ; + if ($.fn.disableSelection) + $R.disableSelection(); // prevent text-selection INSIDE resizer + if (o.resizerDblClickToggle) + $R.bind("dblclick."+ sID, toggle ); + + if ($T) { + $T // if paneSelector is an ID, then create a matching ID for the resizer, eg: "#paneLeft" => "#paneLeft-toggler" + .attr("id", paneId ? paneId +"-toggler" : "" ) + .data({ + parentLayout: Instance + , layoutPane: Instance[pane] // NEW pointer to pane-alias-object + , layoutEdge: pane + , layoutRole: "toggler" + }) + .css(_c.togglers.cssReq) // add base/required styles + .css(o.applyDemoStyles ? _c.togglers.cssDemo : {}) // add demo styles + .addClass(tClass +" "+ tClass+_pane) + .hover(addHover, removeHover) // ALWAYS add hover-classes, even if toggling is not enabled - handle with CSS instead + .bind("mouseenter", onResizerEnter) // NEED toggler.mouseenter because mouseenter MAY NOT fire on resizer + .appendTo($R) // append SPAN to resizer DIV + ; + // ADD INNER-SPANS TO TOGGLER + if (o.togglerContent_open) // ui-layout-open + $(""+ o.togglerContent_open +"") + .data({ + layoutEdge: pane + , layoutRole: "togglerContent" + }) + .data("layoutRole", "togglerContent") + .data("layoutEdge", pane) + .addClass("content content-open") + .css("display","none") + .appendTo( $T ) + //.hover( addHover, removeHover ) // use ui-layout-toggler-west-hover .content-open instead! + ; + if (o.togglerContent_closed) // ui-layout-closed + $(""+ o.togglerContent_closed +"") + .data({ + layoutEdge: pane + , layoutRole: "togglerContent" + }) + .addClass("content content-closed") + .css("display","none") + .appendTo( $T ) + //.hover( addHover, removeHover ) // use ui-layout-toggler-west-hover .content-closed instead! + ; + // ADD TOGGLER.click/.hover + enableClosable(pane); + } + + // add Draggable events + initResizable(pane); + + // ADD CLASSNAMES & SLIDE-BINDINGS - eg: class="resizer resizer-west resizer-open" + if (s.isVisible) + setAsOpen(pane); // onOpen will be called, but NOT onResize + else { + setAsClosed(pane); // onClose will be called + bindStartSlidingEvents(pane, true); // will enable events IF option is set + } + + }); + + // SET ALL HANDLE DIMENSIONS + sizeHandles(); + } + + + /** + * Initialize scrolling ui-layout-content div - if exists + * + * @see initPane() - or externally after an Ajax injection + * @param {string} pane The pane to process + * @param {boolean=} [resize=true] Size content after init + */ +, initContent = function (pane, resize) { + if (!isInitialized()) return; + var + o = options[pane] + , sel = o.contentSelector + , I = Instance[pane] + , $P = $Ps[pane] + , $C + ; + if (sel) $C = I.content = $Cs[pane] = (o.findNestedContent) + ? $P.find(sel).eq(0) // match 1-element only + : $P.children(sel).eq(0) + ; + if ($C && $C.length) { + $C.data("layoutRole", "content"); + // SAVE original Content CSS + if (!$C.data("layoutCSS")) + $C.data("layoutCSS", styles($C, "height")); + $C.css( _c.content.cssReq ); + if (o.applyDemoStyles) { + $C.css( _c.content.cssDemo ); // add padding & overflow: auto to content-div + $P.css( _c.content.cssDemoPane ); // REMOVE padding/scrolling from pane + } + // ensure no vertical scrollbar on pane - will mess up measurements + if ($P.css("overflowX").match(/(scroll|auto)/)) { + $P.css("overflow", "hidden"); + } + state[pane].content = {}; // init content state + if (resize !== false) sizeContent(pane); + // sizeContent() is called AFTER init of all elements + } + else + I.content = $Cs[pane] = false; + } + + + /** + * Add resize-bars to all panes that specify it in options + * -dependancy: $.fn.resizable - will skip if not found + * + * @see _create() + * @param {string=} [panes=""] The edge(s) to process + */ +, initResizable = function (panes) { + var draggingAvailable = $.layout.plugins.draggable + , side // set in start() + ; + panes = panes ? panes.split(",") : _c.borderPanes; + + $.each(panes, function (idx, pane) { + var o = options[pane]; + if (!draggingAvailable || !$Ps[pane] || !o.resizable) { + o.resizable = false; + return true; // skip to next + } + + var s = state[pane] + , z = options.zIndexes + , c = _c[pane] + , side = c.dir=="horz" ? "top" : "left" + , $P = $Ps[pane] + , $R = $Rs[pane] + , base = o.resizerClass + , lastPos = 0 // used when live-resizing + , r, live // set in start because may change + // 'drag' classes are applied to the ORIGINAL resizer-bar while dragging is in process + , resizerClass = base+"-drag" // resizer-drag + , resizerPaneClass = base+"-"+pane+"-drag" // resizer-north-drag + // 'helper' class is applied to the CLONED resizer-bar while it is being dragged + , helperClass = base+"-dragging" // resizer-dragging + , helperPaneClass = base+"-"+pane+"-dragging" // resizer-north-dragging + , helperLimitClass = base+"-dragging-limit" // resizer-drag + , helperPaneLimitClass = base+"-"+pane+"-dragging-limit" // resizer-north-drag + , helperClassesSet = false // logic var + ; + + if (!s.isClosed) + $R.attr("title", o.tips.Resize) + .css("cursor", o.resizerCursor); // n-resize, s-resize, etc + + $R.draggable({ + containment: $N[0] // limit resizing to layout container + , axis: (c.dir=="horz" ? "y" : "x") // limit resizing to horz or vert axis + , delay: 0 + , distance: 1 + , grid: o.resizingGrid + // basic format for helper - style it using class: .ui-draggable-dragging + , helper: "clone" + , opacity: o.resizerDragOpacity + , addClasses: false // avoid ui-state-disabled class when disabled + //, iframeFix: o.draggableIframeFix // TODO: consider using when bug is fixed + , zIndex: z.resizer_drag + + , start: function (e, ui) { + // REFRESH options & state pointers in case we used swapPanes + o = options[pane]; + s = state[pane]; + // re-read options + live = o.livePaneResizing; + + // ondrag_start callback - will CANCEL hide if returns false + // TODO: dragging CANNOT be cancelled like this, so see if there is a way? + if (false === _runCallbacks("ondrag_start", pane)) return false; + + s.isResizing = true; // prevent pane from closing while resizing + state.paneResizing = pane; // easy to see if ANY pane is resizing + timer.clear(pane+"_closeSlider"); // just in case already triggered + + // SET RESIZER LIMITS - used in drag() + setSizeLimits(pane); // update pane/resizer state + r = s.resizerPosition; + lastPos = ui.position[ side ] + + $R.addClass( resizerClass +" "+ resizerPaneClass ); // add drag classes + helperClassesSet = false; // reset logic var - see drag() + + // MASK PANES CONTAINING IFRAMES, APPLETS OR OTHER TROUBLESOME ELEMENTS + showMasks( pane, { resizing: true }); + } + + , drag: function (e, ui) { + if (!helperClassesSet) { // can only add classes after clone has been added to the DOM + //$(".ui-draggable-dragging") + ui.helper + .addClass( helperClass +" "+ helperPaneClass ) // add helper classes + .css({ right: "auto", bottom: "auto" }) // fix dir="rtl" issue + .children().css("visibility","hidden") // hide toggler inside dragged resizer-bar + ; + helperClassesSet = true; + // draggable bug!? RE-SET zIndex to prevent E/W resize-bar showing through N/S pane! + if (s.isSliding) $Ps[pane].css("zIndex", z.pane_sliding); + } + // CONTAIN RESIZER-BAR TO RESIZING LIMITS + var limit = 0; + if (ui.position[side] < r.min) { + ui.position[side] = r.min; + limit = -1; + } + else if (ui.position[side] > r.max) { + ui.position[side] = r.max; + limit = 1; + } + // ADD/REMOVE dragging-limit CLASS + if (limit) { + ui.helper.addClass( helperLimitClass +" "+ helperPaneLimitClass ); // at dragging-limit + window.defaultStatus = (limit>0 && pane.match(/(north|west)/)) || (limit<0 && pane.match(/(south|east)/)) ? o.tips.maxSizeWarning : o.tips.minSizeWarning; + } + else { + ui.helper.removeClass( helperLimitClass +" "+ helperPaneLimitClass ); // not at dragging-limit + window.defaultStatus = ""; + } + // DYNAMICALLY RESIZE PANES IF OPTION ENABLED + // won't trigger unless resizer has actually moved! + if (live && Math.abs(ui.position[side] - lastPos) >= o.liveResizingTolerance) { + lastPos = ui.position[side]; + resizePanes(e, ui, pane) + } + } + + , stop: function (e, ui) { + $('body').enableSelection(); // RE-ENABLE TEXT SELECTION + window.defaultStatus = ""; // clear 'resizing limit' message from statusbar + $R.removeClass( resizerClass +" "+ resizerPaneClass ); // remove drag classes from Resizer + s.isResizing = false; + state.paneResizing = false; // easy to see if ANY pane is resizing + resizePanes(e, ui, pane, true); // true = resizingDone + } + + }); + }); + + /** + * resizePanes + * + * Sub-routine called from stop() - and drag() if livePaneResizing + * + * @param {!Object} evt + * @param {!Object} ui + * @param {string} pane + * @param {boolean=} [resizingDone=false] + */ + var resizePanes = function (evt, ui, pane, resizingDone) { + var dragPos = ui.position + , c = _c[pane] + , o = options[pane] + , s = state[pane] + , resizerPos + ; + switch (pane) { + case "north": resizerPos = dragPos.top; break; + case "west": resizerPos = dragPos.left; break; + case "south": resizerPos = sC.layoutHeight - dragPos.top - o.spacing_open; break; + case "east": resizerPos = sC.layoutWidth - dragPos.left - o.spacing_open; break; + }; + // remove container margin from resizer position to get the pane size + var newSize = resizerPos - sC.inset[c.side]; + + // Disable OR Resize Mask(s) created in drag.start + if (!resizingDone) { + // ensure we meet liveResizingTolerance criteria + if (Math.abs(newSize - s.size) < o.liveResizingTolerance) + return; // SKIP resize this time + // resize the pane + manualSizePane(pane, newSize, false, true); // true = noAnimation + sizeMasks(); // resize all visible masks + } + else { // resizingDone + // ondrag_end callback + if (false !== _runCallbacks("ondrag_end", pane)) + manualSizePane(pane, newSize, false, true); // true = noAnimation + hideMasks(true); // true = force hiding all masks even if one is 'sliding' + if (s.isSliding) // RE-SHOW 'object-masks' so objects won't show through sliding pane + showMasks( pane, { resizing: true }); + } + }; + } + + /** + * sizeMask + * + * Needed to overlay a DIV over an IFRAME-pane because mask CANNOT be *inside* the pane + * Called when mask created, and during livePaneResizing + */ +, sizeMask = function () { + var $M = $(this) + , pane = $M.data("layoutMask") // eg: "west" + , s = state[pane] + ; + // only masks over an IFRAME-pane need manual resizing + if (s.tagName == "IFRAME" && s.isVisible) // no need to mask closed/hidden panes + $M.css({ + top: s.offsetTop + , left: s.offsetLeft + , width: s.outerWidth + , height: s.outerHeight + }); + /* ALT Method... + var $P = $Ps[pane]; + $M.css( $P.position() ).css({ width: $P[0].offsetWidth, height: $P[0].offsetHeight }); + */ + } +, sizeMasks = function () { + $Ms.each( sizeMask ); // resize all 'visible' masks + } + + /** + * @param {string} pane The pane being resized, animated or isSliding + * @param {Object=} [args] (optional) Options: which masks to apply, and to which panes + */ +, showMasks = function (pane, args) { + var c = _c[pane] + , panes = ["center"] + , z = options.zIndexes + , a = $.extend({ + objectsOnly: false + , animation: false + , resizing: true + , sliding: state[pane].isSliding + }, args ) + , o, s + ; + if (a.resizing) + panes.push( pane ); + if (a.sliding) + panes.push( _c.oppositeEdge[pane] ); // ADD the oppositeEdge-pane + + if (c.dir === "horz") { + panes.push("west"); + panes.push("east"); + } + + $.each(panes, function(i,p){ + s = state[p]; + o = options[p]; + if (s.isVisible && ( o.maskObjects || (!a.objectsOnly && o.maskContents) )) { + getMasks(p).each(function(){ + sizeMask.call(this); + this.style.zIndex = s.isSliding ? z.pane_sliding+1 : z.pane_normal+1 + this.style.display = "block"; + }); + } + }); + } + + /** + * @param {boolean=} force Hide masks even if a pane is sliding + */ +, hideMasks = function (force) { + // ensure no pane is resizing - could be a timing issue + if (force || !state.paneResizing) { + $Ms.hide(); // hide ALL masks + } + // if ANY pane is sliding, then DO NOT remove masks from panes with maskObjects enabled + else if (!force && !$.isEmptyObject( state.panesSliding )) { + var i = $Ms.length - 1 + , p, $M; + for (; i >= 0; i--) { + $M = $Ms.eq(i); + p = $M.data("layoutMask"); + if (!options[p].maskObjects) { + $M.hide(); + } + } + } + } + + /** + * @param {string} pane + */ +, getMasks = function (pane) { + var $Masks = $([]) + , $M, i = 0, c = $Ms.length + ; + for (; i CSS + if (sC.tagName === "BODY" && ($N = $("html")).data(css)) // RESET CSS + $N.css( $N.data(css) ).removeData(css); + + // trigger plugins for this layout, if there are any + runPluginCallbacks( Instance, $.layout.onDestroy ); + + // trigger state-management and onunload callback + unload(); + + // clear the Instance of everything except for container & options (so could recreate) + // RE-CREATE: myLayout = myLayout.container.layout( myLayout.options ); + for (var n in Instance) + if (!n.match(/^(container|options)$/)) delete Instance[ n ]; + // add a 'destroyed' flag to make it easy to check + Instance.destroyed = true; + + // if this is a child layout, CLEAR the child-pointer in the parent + /* for now the pointer REMAINS, but with only container, options and destroyed keys + if (parentPane) { + var layout = parentPane.pane.data("parentLayout") + , key = layout.options.instanceKey || 'error'; + // THIS SYNTAX MAY BE WRONG! + parentPane.children[key] = layout.children[ parentPane.name ].children[key] = null; + } + */ + + return Instance; // for coding convenience + } + + /** + * Remove a pane from the layout - subroutine of destroy() + * + * @see destroy() + * @param {(string|Object)} evt_or_pane The pane to process + * @param {boolean=} [remove=false] Remove the DOM element? + * @param {boolean=} [skipResize=false] Skip calling resizeAll()? + * @param {boolean=} [destroyChild=true] Destroy Child-layouts? If not passed, obeys options setting + */ +, removePane = function (evt_or_pane, remove, skipResize, destroyChild) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , $P = $Ps[pane] + , $C = $Cs[pane] + , $R = $Rs[pane] + , $T = $Ts[pane] + ; + // NOTE: elements can still exist even after remove() + // so check for missing data(), which is cleared by removed() + if ($P && $.isEmptyObject( $P.data() )) $P = false; + if ($C && $.isEmptyObject( $C.data() )) $C = false; + if ($R && $.isEmptyObject( $R.data() )) $R = false; + if ($T && $.isEmptyObject( $T.data() )) $T = false; + + if ($P) $P.stop(true, true); + + var o = options[pane] + , s = state[pane] + , d = "layout" + , css = "layoutCSS" + , pC = children[pane] + , hasChildren = $.isPlainObject( pC ) && !$.isEmptyObject( pC ) + , destroy = destroyChild !== undefined ? destroyChild : o.destroyChildren + ; + // FIRST destroy the child-layout(s) + if (hasChildren && destroy) { + $.each( pC, function (key, child) { + if (!child.destroyed) + child.destroy(true);// tell child-layout to destroy ALL its child-layouts too + if (child.destroyed) // destroy was successful + delete pC[key]; + }); + // if no more children, remove the children hash + if ($.isEmptyObject( pC )) { + pC = children[pane] = null; // clear children hash + hasChildren = false; + } + } + + // Note: can't 'remove' a pane element with non-destroyed children + if ($P && remove && !hasChildren) + $P.remove(); // remove the pane-element and everything inside it + else if ($P && $P[0]) { + // create list of ALL pane-classes that need to be removed + var root = o.paneClass // default="ui-layout-pane" + , pRoot = root +"-"+ pane // eg: "ui-layout-pane-west" + , _open = "-open" + , _sliding= "-sliding" + , _closed = "-closed" + , classes = [ root, root+_open, root+_closed, root+_sliding, // generic classes + pRoot, pRoot+_open, pRoot+_closed, pRoot+_sliding ] // pane-specific classes + ; + $.merge(classes, getHoverClasses($P, true)); // ADD hover-classes + // remove all Layout classes from pane-element + $P .removeClass( classes.join(" ") ) // remove ALL pane-classes + .removeData("parentLayout") + .removeData("layoutPane") + .removeData("layoutRole") + .removeData("layoutEdge") + .removeData("autoHidden") // in case set + .unbind("."+ sID) // remove ALL Layout events + // TODO: remove these extra unbind commands when jQuery is fixed + //.unbind("mouseenter"+ sID) + //.unbind("mouseleave"+ sID) + ; + // do NOT reset CSS if this pane/content is STILL the container of a nested layout! + // the nested layout will reset its 'container' CSS when/if it is destroyed + if (hasChildren && $C) { + // a content-div may not have a specific width, so give it one to contain the Layout + $C.width( $C.width() ); + $.each( pC, function (key, child) { + child.resizeAll(); // resize the Layout + }); + } + else if ($C) + $C.css( $C.data(css) ).removeData(css).removeData("layoutRole"); + // remove pane AFTER content in case there was a nested layout + if (!$P.data(d)) + $P.css( $P.data(css) ).removeData(css); + } + + // REMOVE pane resizer and toggler elements + if ($T) $T.remove(); + if ($R) $R.remove(); + + // CLEAR all pointers and state data + Instance[pane] = $Ps[pane] = $Cs[pane] = $Rs[pane] = $Ts[pane] = false; + s = { removed: true }; + + if (!skipResize) + resizeAll(); + } + + +/* + * ########################### + * ACTION METHODS + * ########################### + */ + + /** + * @param {string} pane + */ +, _hidePane = function (pane) { + var $P = $Ps[pane] + , o = options[pane] + , s = $P[0].style + ; + if (o.useOffscreenClose) { + if (!$P.data(_c.offscreenReset)) + $P.data(_c.offscreenReset, { left: s.left, right: s.right }); + $P.css( _c.offscreenCSS ); + } + else + $P.hide().removeData(_c.offscreenReset); + } + + /** + * @param {string} pane + */ +, _showPane = function (pane) { + var $P = $Ps[pane] + , o = options[pane] + , off = _c.offscreenCSS + , old = $P.data(_c.offscreenReset) + , s = $P[0].style + ; + $P .show() // ALWAYS show, just in case + .removeData(_c.offscreenReset); + if (o.useOffscreenClose && old) { + if (s.left == off.left) + s.left = old.left; + if (s.right == off.right) + s.right = old.right; + } + } + + + /** + * Completely 'hides' a pane, including its spacing - as if it does not exist + * The pane is not actually 'removed' from the source, so can use 'show' to un-hide it + * + * @param {(string|Object)} evt_or_pane The pane being hidden, ie: north, south, east, or west + * @param {boolean=} [noAnimation=false] + */ +, hide = function (evt_or_pane, noAnimation) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , o = options[pane] + , s = state[pane] + , $P = $Ps[pane] + , $R = $Rs[pane] + ; + if (pane === "center" || !$P || s.isHidden) return; // pane does not exist OR is already hidden + + // onhide_start callback - will CANCEL hide if returns false + if (state.initialized && false === _runCallbacks("onhide_start", pane)) return; + + s.isSliding = false; // just in case + delete state.panesSliding[pane]; + + // now hide the elements + if ($R) $R.hide(); // hide resizer-bar + if (!state.initialized || s.isClosed) { + s.isClosed = true; // to trigger open-animation on show() + s.isHidden = true; + s.isVisible = false; + if (!state.initialized) + _hidePane(pane); // no animation when loading page + sizeMidPanes(_c[pane].dir === "horz" ? "" : "center"); + if (state.initialized || o.triggerEventsOnLoad) + _runCallbacks("onhide_end", pane); + } + else { + s.isHiding = true; // used by onclose + close(pane, false, noAnimation); // adjust all panes to fit + } + } + + /** + * Show a hidden pane - show as 'closed' by default unless openPane = true + * + * @param {(string|Object)} evt_or_pane The pane being opened, ie: north, south, east, or west + * @param {boolean=} [openPane=false] + * @param {boolean=} [noAnimation=false] + * @param {boolean=} [noAlert=false] + */ +, show = function (evt_or_pane, openPane, noAnimation, noAlert) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , o = options[pane] + , s = state[pane] + , $P = $Ps[pane] + , $R = $Rs[pane] + ; + if (pane === "center" || !$P || !s.isHidden) return; // pane does not exist OR is not hidden + + // onshow_start callback - will CANCEL show if returns false + if (false === _runCallbacks("onshow_start", pane)) return; + + s.isShowing = true; // used by onopen/onclose + //s.isHidden = false; - will be set by open/close - if not cancelled + s.isSliding = false; // just in case + delete state.panesSliding[pane]; + + // now show the elements + //if ($R) $R.show(); - will be shown by open/close + if (openPane === false) + close(pane, true); // true = force + else + open(pane, false, noAnimation, noAlert); // adjust all panes to fit + } + + + /** + * Toggles a pane open/closed by calling either open or close + * + * @param {(string|Object)} evt_or_pane The pane being toggled, ie: north, south, east, or west + * @param {boolean=} [slide=false] + */ +, toggle = function (evt_or_pane, slide) { + if (!isInitialized()) return; + var evt = evtObj(evt_or_pane) + , pane = evtPane.call(this, evt_or_pane) + , s = state[pane] + ; + if (evt) // called from to $R.dblclick OR triggerPaneEvent + evt.stopImmediatePropagation(); + if (s.isHidden) + show(pane); // will call 'open' after unhiding it + else if (s.isClosed) + open(pane, !!slide); + else + close(pane); + } + + + /** + * Utility method used during init or other auto-processes + * + * @param {string} pane The pane being closed + * @param {boolean=} [setHandles=false] + */ +, _closePane = function (pane, setHandles) { + var + $P = $Ps[pane] + , s = state[pane] + ; + _hidePane(pane); + s.isClosed = true; + s.isVisible = false; + if (setHandles) setAsClosed(pane); + } + + /** + * Close the specified pane (animation optional), and resize all other panes as needed + * + * @param {(string|Object)} evt_or_pane The pane being closed, ie: north, south, east, or west + * @param {boolean=} [force=false] + * @param {boolean=} [noAnimation=false] + * @param {boolean=} [skipCallback=false] + */ +, close = function (evt_or_pane, force, noAnimation, skipCallback) { + var pane = evtPane.call(this, evt_or_pane); + if (pane === "center") return; // validate + // if pane has been initialized, but NOT the complete layout, close pane instantly + if (!state.initialized && $Ps[pane]) { + _closePane(pane, true); // INIT pane as closed + return; + } + if (!isInitialized()) return; + + var + $P = $Ps[pane] + , $R = $Rs[pane] + , $T = $Ts[pane] + , o = options[pane] + , s = state[pane] + , c = _c[pane] + , doFX, isShowing, isHiding, wasSliding; + + // QUEUE in case another action/animation is in progress + $N.queue(function( queueNext ){ + + if ( !$P + || (!o.closable && !s.isShowing && !s.isHiding) // invalid request // (!o.resizable && !o.closable) ??? + || (!force && s.isClosed && !s.isShowing) // already closed + ) return queueNext(); + + // onclose_start callback - will CANCEL hide if returns false + // SKIP if just 'showing' a hidden pane as 'closed' + var abort = !s.isShowing && false === _runCallbacks("onclose_start", pane); + + // transfer logic vars to temp vars + isShowing = s.isShowing; + isHiding = s.isHiding; + wasSliding = s.isSliding; + // now clear the logic vars (REQUIRED before aborting) + delete s.isShowing; + delete s.isHiding; + + if (abort) return queueNext(); + + doFX = !noAnimation && !s.isClosed && (o.fxName_close != "none"); + s.isMoving = true; + s.isClosed = true; + s.isVisible = false; + // update isHidden BEFORE sizing panes + if (isHiding) s.isHidden = true; + else if (isShowing) s.isHidden = false; + + if (s.isSliding) // pane is being closed, so UNBIND trigger events + bindStopSlidingEvents(pane, false); // will set isSliding=false + else // resize panes adjacent to this one + sizeMidPanes(_c[pane].dir === "horz" ? "" : "center", false); // false = NOT skipCallback + + // if this pane has a resizer bar, move it NOW - before animation + setAsClosed(pane); + + // CLOSE THE PANE + if (doFX) { // animate the close + lockPaneForFX(pane, true); // need to set left/top so animation will work + $P.hide( o.fxName_close, o.fxSettings_close, o.fxSpeed_close, function () { + lockPaneForFX(pane, false); // undo + if (s.isClosed) close_2(); + queueNext(); + }); + } + else { // hide the pane without animation + _hidePane(pane); + close_2(); + queueNext(); + }; + }); + + // SUBROUTINE + function close_2 () { + s.isMoving = false; + bindStartSlidingEvents(pane, true); // will enable if o.slidable = true + + // if opposite-pane was autoClosed, see if it can be autoOpened now + var altPane = _c.oppositeEdge[pane]; + if (state[ altPane ].noRoom) { + setSizeLimits( altPane ); + makePaneFit( altPane ); + } + + if (!skipCallback && (state.initialized || o.triggerEventsOnLoad)) { + // onclose callback - UNLESS just 'showing' a hidden pane as 'closed' + if (!isShowing) _runCallbacks("onclose_end", pane); + // onhide OR onshow callback + if (isShowing) _runCallbacks("onshow_end", pane); + if (isHiding) _runCallbacks("onhide_end", pane); + } + } + } + + /** + * @param {string} pane The pane just closed, ie: north, south, east, or west + */ +, setAsClosed = function (pane) { + if (!$Rs[pane]) return; // handles not initialized yet! + var + $P = $Ps[pane] + , $R = $Rs[pane] + , $T = $Ts[pane] + , o = options[pane] + , s = state[pane] + , side = _c[pane].side + , rClass = o.resizerClass + , tClass = o.togglerClass + , _pane = "-"+ pane // used for classNames + , _open = "-open" + , _sliding= "-sliding" + , _closed = "-closed" + ; + $R + .css(side, sC.inset[side]) // move the resizer + .removeClass( rClass+_open +" "+ rClass+_pane+_open ) + .removeClass( rClass+_sliding +" "+ rClass+_pane+_sliding ) + .addClass( rClass+_closed +" "+ rClass+_pane+_closed ) + ; + // handle already-hidden panes in case called by swap() or a similar method + if (s.isHidden) $R.hide(); // hide resizer-bar + + // DISABLE 'resizing' when closed - do this BEFORE bindStartSlidingEvents? + if (o.resizable && $.layout.plugins.draggable) + $R + .draggable("disable") + .removeClass("ui-state-disabled") // do NOT apply disabled styling - not suitable here + .css("cursor", "default") + .attr("title","") + ; + + // if pane has a toggler button, adjust that too + if ($T) { + $T + .removeClass( tClass+_open +" "+ tClass+_pane+_open ) + .addClass( tClass+_closed +" "+ tClass+_pane+_closed ) + .attr("title", o.tips.Open) // may be blank + ; + // toggler-content - if exists + $T.children(".content-open").hide(); + $T.children(".content-closed").css("display","block"); + } + + // sync any 'pin buttons' + syncPinBtns(pane, false); + + if (state.initialized) { + // resize 'length' and position togglers for adjacent panes + sizeHandles(); + } + } + + /** + * Open the specified pane (animation optional), and resize all other panes as needed + * + * @param {(string|Object)} evt_or_pane The pane being opened, ie: north, south, east, or west + * @param {boolean=} [slide=false] + * @param {boolean=} [noAnimation=false] + * @param {boolean=} [noAlert=false] + */ +, open = function (evt_or_pane, slide, noAnimation, noAlert) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , $P = $Ps[pane] + , $R = $Rs[pane] + , $T = $Ts[pane] + , o = options[pane] + , s = state[pane] + , c = _c[pane] + , doFX, isShowing + ; + if (pane === "center") return; // validate + // QUEUE in case another action/animation is in progress + $N.queue(function( queueNext ){ + + if ( !$P + || (!o.resizable && !o.closable && !s.isShowing) // invalid request + || (s.isVisible && !s.isSliding) // already open + ) return queueNext(); + + // pane can ALSO be unhidden by just calling show(), so handle this scenario + if (s.isHidden && !s.isShowing) { + queueNext(); // call before show() because it needs the queue free + show(pane, true); + return; + } + + if (s.autoResize && s.size != o.size) // resize pane to original size set in options + sizePane(pane, o.size, true, true, true); // true=skipCallback/noAnimation/forceResize + else + // make sure there is enough space available to open the pane + setSizeLimits(pane, slide); + + // onopen_start callback - will CANCEL open if returns false + var cbReturn = _runCallbacks("onopen_start", pane); + + if (cbReturn === "abort") + return queueNext(); + + // update pane-state again in case options were changed in onopen_start + if (cbReturn !== "NC") // NC = "No Callback" + setSizeLimits(pane, slide); + + if (s.minSize > s.maxSize) { // INSUFFICIENT ROOM FOR PANE TO OPEN! + syncPinBtns(pane, false); // make sure pin-buttons are reset + if (!noAlert && o.tips.noRoomToOpen) + alert(o.tips.noRoomToOpen); + return queueNext(); // ABORT + } + + if (slide) // START Sliding - will set isSliding=true + bindStopSlidingEvents(pane, true); // BIND trigger events to close sliding-pane + else if (s.isSliding) // PIN PANE (stop sliding) - open pane 'normally' instead + bindStopSlidingEvents(pane, false); // UNBIND trigger events - will set isSliding=false + else if (o.slidable) + bindStartSlidingEvents(pane, false); // UNBIND trigger events + + s.noRoom = false; // will be reset by makePaneFit if 'noRoom' + makePaneFit(pane); + + // transfer logic var to temp var + isShowing = s.isShowing; + // now clear the logic var + delete s.isShowing; + + doFX = !noAnimation && s.isClosed && (o.fxName_open != "none"); + s.isMoving = true; + s.isVisible = true; + s.isClosed = false; + // update isHidden BEFORE sizing panes - WHY??? Old? + if (isShowing) s.isHidden = false; + + if (doFX) { // ANIMATE + // mask adjacent panes with objects + lockPaneForFX(pane, true); // need to set left/top so animation will work + $P.show( o.fxName_open, o.fxSettings_open, o.fxSpeed_open, function() { + lockPaneForFX(pane, false); // undo + if (s.isVisible) open_2(); // continue + queueNext(); + }); + } + else { // no animation + _showPane(pane);// just show pane and... + open_2(); // continue + queueNext(); + }; + }); + + // SUBROUTINE + function open_2 () { + s.isMoving = false; + + // cure iframe display issues + _fixIframe(pane); + + // NOTE: if isSliding, then other panes are NOT 'resized' + if (!s.isSliding) { // resize all panes adjacent to this one + sizeMidPanes(_c[pane].dir=="vert" ? "center" : "", false); // false = NOT skipCallback + } + + // set classes, position handles and execute callbacks... + setAsOpen(pane); + }; + + } + + /** + * @param {string} pane The pane just opened, ie: north, south, east, or west + * @param {boolean=} [skipCallback=false] + */ +, setAsOpen = function (pane, skipCallback) { + var + $P = $Ps[pane] + , $R = $Rs[pane] + , $T = $Ts[pane] + , o = options[pane] + , s = state[pane] + , side = _c[pane].side + , rClass = o.resizerClass + , tClass = o.togglerClass + , _pane = "-"+ pane // used for classNames + , _open = "-open" + , _closed = "-closed" + , _sliding= "-sliding" + ; + $R + .css(side, sC.inset[side] + getPaneSize(pane)) // move the resizer + .removeClass( rClass+_closed +" "+ rClass+_pane+_closed ) + .addClass( rClass+_open +" "+ rClass+_pane+_open ) + ; + if (s.isSliding) + $R.addClass( rClass+_sliding +" "+ rClass+_pane+_sliding ) + else // in case 'was sliding' + $R.removeClass( rClass+_sliding +" "+ rClass+_pane+_sliding ) + + removeHover( 0, $R ); // remove hover classes + if (o.resizable && $.layout.plugins.draggable) + $R .draggable("enable") + .css("cursor", o.resizerCursor) + .attr("title", o.tips.Resize); + else if (!s.isSliding) + $R.css("cursor", "default"); // n-resize, s-resize, etc + + // if pane also has a toggler button, adjust that too + if ($T) { + $T .removeClass( tClass+_closed +" "+ tClass+_pane+_closed ) + .addClass( tClass+_open +" "+ tClass+_pane+_open ) + .attr("title", o.tips.Close); // may be blank + removeHover( 0, $T ); // remove hover classes + // toggler-content - if exists + $T.children(".content-closed").hide(); + $T.children(".content-open").css("display","block"); + } + + // sync any 'pin buttons' + syncPinBtns(pane, !s.isSliding); + + // update pane-state dimensions - BEFORE resizing content + $.extend(s, elDims($P)); + + if (state.initialized) { + // resize resizer & toggler sizes for all panes + sizeHandles(); + // resize content every time pane opens - to be sure + sizeContent(pane, true); // true = remeasure headers/footers, even if 'pane.isMoving' + } + + if (!skipCallback && (state.initialized || o.triggerEventsOnLoad) && $P.is(":visible")) { + // onopen callback + _runCallbacks("onopen_end", pane); + // onshow callback - TODO: should this be here? + if (s.isShowing) _runCallbacks("onshow_end", pane); + + // ALSO call onresize because layout-size *may* have changed while pane was closed + if (state.initialized) + _runCallbacks("onresize_end", pane); + } + + // TODO: Somehow sizePane("north") is being called after this point??? + } + + + /** + * slideOpen / slideClose / slideToggle + * + * Pass-though methods for sliding + */ +, slideOpen = function (evt_or_pane) { + if (!isInitialized()) return; + var evt = evtObj(evt_or_pane) + , pane = evtPane.call(this, evt_or_pane) + , s = state[pane] + , delay = options[pane].slideDelay_open + ; + if (pane === "center") return; // validate + // prevent event from triggering on NEW resizer binding created below + if (evt) evt.stopImmediatePropagation(); + + if (s.isClosed && evt && evt.type === "mouseenter" && delay > 0) + // trigger = mouseenter - use a delay + timer.set(pane+"_openSlider", open_NOW, delay); + else + open_NOW(); // will unbind events if is already open + + /** + * SUBROUTINE for timed open + */ + function open_NOW () { + if (!s.isClosed) // skip if no longer closed! + bindStopSlidingEvents(pane, true); // BIND trigger events to close sliding-pane + else if (!s.isMoving) + open(pane, true); // true = slide - open() will handle binding + }; + } + +, slideClose = function (evt_or_pane) { + if (!isInitialized()) return; + var evt = evtObj(evt_or_pane) + , pane = evtPane.call(this, evt_or_pane) + , o = options[pane] + , s = state[pane] + , delay = s.isMoving ? 1000 : 300 // MINIMUM delay - option may override + ; + if (pane === "center") return; // validate + if (s.isClosed || s.isResizing) + return; // skip if already closed OR in process of resizing + else if (o.slideTrigger_close === "click") + close_NOW(); // close immediately onClick + else if (o.preventQuickSlideClose && s.isMoving) + return; // handle Chrome quick-close on slide-open + else if (o.preventPrematureSlideClose && evt && $.layout.isMouseOverElem(evt, $Ps[pane])) + return; // handle incorrect mouseleave trigger, like when over a SELECT-list in IE + else if (evt) // trigger = mouseleave - use a delay + // 1 sec delay if 'opening', else .3 sec + timer.set(pane+"_closeSlider", close_NOW, max(o.slideDelay_close, delay)); + else // called programically + close_NOW(); + + /** + * SUBROUTINE for timed close + */ + function close_NOW () { + if (s.isClosed) // skip 'close' if already closed! + bindStopSlidingEvents(pane, false); // UNBIND trigger events - TODO: is this needed here? + else if (!s.isMoving) + close(pane); // close will handle unbinding + }; + } + + /** + * @param {(string|Object)} evt_or_pane The pane being opened, ie: north, south, east, or west + */ +, slideToggle = function (evt_or_pane) { + var pane = evtPane.call(this, evt_or_pane); + toggle(pane, true); + } + + + /** + * Must set left/top on East/South panes so animation will work properly + * + * @param {string} pane The pane to lock, 'east' or 'south' - any other is ignored! + * @param {boolean} doLock true = set left/top, false = remove + */ +, lockPaneForFX = function (pane, doLock) { + var $P = $Ps[pane] + , s = state[pane] + , o = options[pane] + , z = options.zIndexes + ; + if (doLock) { + showMasks( pane, { animation: true, objectsOnly: true }); + $P.css({ zIndex: z.pane_animate }); // overlay all elements during animation + if (pane=="south") + $P.css({ top: sC.inset.top + sC.innerHeight - $P.outerHeight() }); + else if (pane=="east") + $P.css({ left: sC.inset.left + sC.innerWidth - $P.outerWidth() }); + } + else { // animation DONE - RESET CSS + hideMasks(); + $P.css({ zIndex: (s.isSliding ? z.pane_sliding : z.pane_normal) }); + if (pane=="south") + $P.css({ top: "auto" }); + // if pane is positioned 'off-screen', then DO NOT screw with it! + else if (pane=="east" && !$P.css("left").match(/\-99999/)) + $P.css({ left: "auto" }); + // fix anti-aliasing in IE - only needed for animations that change opacity + if (browser.msie && o.fxOpacityFix && o.fxName_open != "slide" && $P.css("filter") && $P.css("opacity") == 1) + $P[0].style.removeAttribute('filter'); + } + } + + + /** + * Toggle sliding functionality of a specific pane on/off by adding removing 'slide open' trigger + * + * @see open(), close() + * @param {string} pane The pane to enable/disable, 'north', 'south', etc. + * @param {boolean} enable Enable or Disable sliding? + */ +, bindStartSlidingEvents = function (pane, enable) { + var o = options[pane] + , $P = $Ps[pane] + , $R = $Rs[pane] + , evtName = o.slideTrigger_open.toLowerCase() + ; + if (!$R || (enable && !o.slidable)) return; + + // make sure we have a valid event + if (evtName.match(/mouseover/)) + evtName = o.slideTrigger_open = "mouseenter"; + else if (!evtName.match(/(click|dblclick|mouseenter)/)) + evtName = o.slideTrigger_open = "click"; + + // must remove double-click-toggle when using dblclick-slide + if (o.resizerDblClickToggle && evtName.match(/click/)) { + $R[enable ? "unbind" : "bind"]('dblclick.'+ sID, toggle) + } + + $R + // add or remove event + [enable ? "bind" : "unbind"](evtName +'.'+ sID, slideOpen) + // set the appropriate cursor & title/tip + .css("cursor", enable ? o.sliderCursor : "default") + .attr("title", enable ? o.tips.Slide : "") + ; + } + + /** + * Add or remove 'mouseleave' events to 'slide close' when pane is 'sliding' open or closed + * Also increases zIndex when pane is sliding open + * See bindStartSlidingEvents for code to control 'slide open' + * + * @see slideOpen(), slideClose() + * @param {string} pane The pane to process, 'north', 'south', etc. + * @param {boolean} enable Enable or Disable events? + */ +, bindStopSlidingEvents = function (pane, enable) { + var o = options[pane] + , s = state[pane] + , c = _c[pane] + , z = options.zIndexes + , evtName = o.slideTrigger_close.toLowerCase() + , action = (enable ? "bind" : "unbind") + , $P = $Ps[pane] + , $R = $Rs[pane] + ; + timer.clear(pane+"_closeSlider"); // just in case + + if (enable) { + s.isSliding = true; + state.panesSliding[pane] = true; + // remove 'slideOpen' event from resizer + // ALSO will raise the zIndex of the pane & resizer + bindStartSlidingEvents(pane, false); + } + else { + s.isSliding = false; + delete state.panesSliding[pane]; + } + + // RE/SET zIndex - increases when pane is sliding-open, resets to normal when not + $P.css("zIndex", enable ? z.pane_sliding : z.pane_normal); + $R.css("zIndex", enable ? z.pane_sliding+2 : z.resizer_normal); // NOTE: mask = pane_sliding+1 + + // make sure we have a valid event + if (!evtName.match(/(click|mouseleave)/)) + evtName = o.slideTrigger_close = "mouseleave"; // also catches 'mouseout' + + // add/remove slide triggers + $R[action](evtName, slideClose); // base event on resize + // need extra events for mouseleave + if (evtName === "mouseleave") { + // also close on pane.mouseleave + $P[action]("mouseleave."+ sID, slideClose); + // cancel timer when mouse moves between 'pane' and 'resizer' + $R[action]("mouseenter."+ sID, cancelMouseOut); + $P[action]("mouseenter."+ sID, cancelMouseOut); + } + + if (!enable) + timer.clear(pane+"_closeSlider"); + else if (evtName === "click" && !o.resizable) { + // IF pane is not resizable (which already has a cursor and tip) + // then set the a cursor & title/tip on resizer when sliding + $R.css("cursor", enable ? o.sliderCursor : "default"); + $R.attr("title", enable ? o.tips.Close : ""); // use Toggler-tip, eg: "Close Pane" + } + + // SUBROUTINE for mouseleave timer clearing + function cancelMouseOut (evt) { + timer.clear(pane+"_closeSlider"); + evt.stopPropagation(); + } + } + + + /** + * Hides/closes a pane if there is insufficient room - reverses this when there is room again + * MUST have already called setSizeLimits() before calling this method + * + * @param {string} pane The pane being resized + * @param {boolean=} [isOpening=false] Called from onOpen? + * @param {boolean=} [skipCallback=false] Should the onresize callback be run? + * @param {boolean=} [force=false] + */ +, makePaneFit = function (pane, isOpening, skipCallback, force) { + var o = options[pane] + , s = state[pane] + , c = _c[pane] + , $P = $Ps[pane] + , $R = $Rs[pane] + , isSidePane = c.dir==="vert" + , hasRoom = false + ; + // special handling for center & east/west panes + if (pane === "center" || (isSidePane && s.noVerticalRoom)) { + // see if there is enough room to display the pane + // ERROR: hasRoom = s.minHeight <= s.maxHeight && (isSidePane || s.minWidth <= s.maxWidth); + hasRoom = (s.maxHeight >= 0); + if (hasRoom && s.noRoom) { // previously hidden due to noRoom, so show now + _showPane(pane); + if ($R) $R.show(); + s.isVisible = true; + s.noRoom = false; + if (isSidePane) s.noVerticalRoom = false; + _fixIframe(pane); + } + else if (!hasRoom && !s.noRoom) { // not currently hidden, so hide now + _hidePane(pane); + if ($R) $R.hide(); + s.isVisible = false; + s.noRoom = true; + } + } + + // see if there is enough room to fit the border-pane + if (pane === "center") { + // ignore center in this block + } + else if (s.minSize <= s.maxSize) { // pane CAN fit + hasRoom = true; + if (s.size > s.maxSize) // pane is too big - shrink it + sizePane(pane, s.maxSize, skipCallback, true, force); // true = noAnimation + else if (s.size < s.minSize) // pane is too small - enlarge it + sizePane(pane, s.minSize, skipCallback, true, force); // true = noAnimation + // need s.isVisible because new pseudoClose method keeps pane visible, but off-screen + else if ($R && s.isVisible && $P.is(":visible")) { + // make sure resizer-bar is positioned correctly + // handles situation where nested layout was 'hidden' when initialized + var pos = s.size + sC.inset[c.side]; + if ($.layout.cssNum( $R, c.side ) != pos) $R.css( c.side, pos ); + } + + // if was previously hidden due to noRoom, then RESET because NOW there is room + if (s.noRoom) { + // s.noRoom state will be set by open or show + if (s.wasOpen && o.closable) { + if (o.autoReopen) + open(pane, false, true, true); // true = noAnimation, true = noAlert + else // leave the pane closed, so just update state + s.noRoom = false; + } + else + show(pane, s.wasOpen, true, true); // true = noAnimation, true = noAlert + } + } + else { // !hasRoom - pane CANNOT fit + if (!s.noRoom) { // pane not set as noRoom yet, so hide or close it now... + s.noRoom = true; // update state + s.wasOpen = !s.isClosed && !s.isSliding; + if (s.isClosed){} // SKIP + else if (o.closable) // 'close' if possible + close(pane, true, true); // true = force, true = noAnimation + else // 'hide' pane if cannot just be closed + hide(pane, true); // true = noAnimation + } + } + } + + + /** + * manualSizePane is an exposed flow-through method allowing extra code when pane is 'manually resized' + * + * @param {(string|Object)} evt_or_pane The pane being resized + * @param {number} size The *desired* new size for this pane - will be validated + * @param {boolean=} [skipCallback=false] Should the onresize callback be run? + * @param {boolean=} [noAnimation=false] + * @param {boolean=} [force=false] Force resizing even if does not seem necessary + */ +, manualSizePane = function (evt_or_pane, size, skipCallback, noAnimation, force) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , o = options[pane] + , s = state[pane] + // if resizing callbacks have been delayed and resizing is now DONE, force resizing to complete... + , forceResize = force || (o.livePaneResizing && !s.isResizing) + ; + if (pane === "center") return; // validate + // ANY call to manualSizePane disables autoResize - ie, percentage sizing + s.autoResize = false; + // flow-through... + sizePane(pane, size, skipCallback, noAnimation, forceResize); // will animate resize if option enabled + } + + /** + * sizePane is called only by internal methods whenever a pane needs to be resized + * + * @param {(string|Object)} evt_or_pane The pane being resized + * @param {number} size The *desired* new size for this pane - will be validated + * @param {boolean=} [skipCallback=false] Should the onresize callback be run? + * @param {boolean=} [noAnimation=false] + * @param {boolean=} [force=false] Force resizing even if does not seem necessary + */ +, sizePane = function (evt_or_pane, size, skipCallback, noAnimation, force) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) // probably NEVER called from event? + , o = options[pane] + , s = state[pane] + , $P = $Ps[pane] + , $R = $Rs[pane] + , side = _c[pane].side + , dimName = _c[pane].sizeType.toLowerCase() + , skipResizeWhileDragging = s.isResizing && !o.triggerEventsDuringLiveResize + , doFX = noAnimation !== true && o.animatePaneSizing + , oldSize, newSize + ; + if (pane === "center") return; // validate + // QUEUE in case another action/animation is in progress + $N.queue(function( queueNext ){ + // calculate 'current' min/max sizes + setSizeLimits(pane); // update pane-state + oldSize = s.size; + size = _parseSize(pane, size); // handle percentages & auto + size = max(size, _parseSize(pane, o.minSize)); + size = min(size, s.maxSize); + if (size < s.minSize) { // not enough room for pane! + queueNext(); // call before makePaneFit() because it needs the queue free + makePaneFit(pane, false, skipCallback); // will hide or close pane + return; + } + + // IF newSize is same as oldSize, then nothing to do - abort + if (!force && size === oldSize) + return queueNext(); + + s.newSize = size; + + // onresize_start callback CANNOT cancel resizing because this would break the layout! + if (!skipCallback && state.initialized && s.isVisible) + _runCallbacks("onresize_start", pane); + + // resize the pane, and make sure its visible + newSize = cssSize(pane, size); + + if (doFX && $P.is(":visible")) { // ANIMATE + var fx = $.layout.effects.size[pane] || $.layout.effects.size.all + , easing = o.fxSettings_size.easing || fx.easing + , z = options.zIndexes + , props = {}; + props[ dimName ] = newSize +'px'; + s.isMoving = true; + // overlay all elements during animation + $P.css({ zIndex: z.pane_animate }) + .show().animate( props, o.fxSpeed_size, easing, function(){ + // reset zIndex after animation + $P.css({ zIndex: (s.isSliding ? z.pane_sliding : z.pane_normal) }); + s.isMoving = false; + delete s.newSize; + sizePane_2(); // continue + queueNext(); + }); + } + else { // no animation + $P.css( dimName, newSize ); // resize pane + delete s.newSize; + // if pane is visible, then + if ($P.is(":visible")) + sizePane_2(); // continue + else { + // pane is NOT VISIBLE, so just update state data... + // when pane is *next opened*, it will have the new size + s.size = size; // update state.size + //$.extend(s, elDims($P)); // update state dimensions - CANNOT do this when not visible! } + } + queueNext(); + }; + + }); + + // SUBROUTINE + function sizePane_2 () { + /* Panes are sometimes not sized precisely in some browsers!? + * This code will resize the pane up to 3 times to nudge the pane to the correct size + */ + var actual = dimName==='width' ? $P.outerWidth() : $P.outerHeight() + , tries = [{ + pane: pane + , count: 1 + , target: size + , actual: actual + , correct: (size === actual) + , attempt: size + , cssSize: newSize + }] + , lastTry = tries[0] + , thisTry = {} + , msg = 'Inaccurate size after resizing the '+ pane +'-pane.' + ; + while ( !lastTry.correct ) { + thisTry = { pane: pane, count: lastTry.count+1, target: size }; + + if (lastTry.actual > size) + thisTry.attempt = max(0, lastTry.attempt - (lastTry.actual - size)); + else // lastTry.actual < size + thisTry.attempt = max(0, lastTry.attempt + (size - lastTry.actual)); + + thisTry.cssSize = cssSize(pane, thisTry.attempt); + $P.css( dimName, thisTry.cssSize ); + + thisTry.actual = dimName=='width' ? $P.outerWidth() : $P.outerHeight(); + thisTry.correct = (size === thisTry.actual); + + // log attempts and alert the user of this *non-fatal error* (if showDebugMessages) + if ( tries.length === 1) { + _log(msg, false, true); + _log(lastTry, false, true); + } + _log(thisTry, false, true); + // after 4 tries, is as close as its gonna get! + if (tries.length > 3) break; + + tries.push( thisTry ); + lastTry = tries[ tries.length - 1 ]; + } + // END TESTING CODE + + // update pane-state dimensions + s.size = size; + $.extend(s, elDims($P)); + + if (s.isVisible && $P.is(":visible")) { + // reposition the resizer-bar + if ($R) $R.css( side, size + sC.inset[side] ); + // resize the content-div + sizeContent(pane); + } + + if (!skipCallback && !skipResizeWhileDragging && state.initialized && s.isVisible) + _runCallbacks("onresize_end", pane); + + // resize all the adjacent panes, and adjust their toggler buttons + // when skipCallback passed, it means the controlling method will handle 'other panes' + if (!skipCallback) { + // also no callback if live-resize is in progress and NOT triggerEventsDuringLiveResize + if (!s.isSliding) sizeMidPanes(_c[pane].dir=="horz" ? "" : "center", skipResizeWhileDragging, force); + sizeHandles(); + } + + // if opposite-pane was autoClosed, see if it can be autoOpened now + var altPane = _c.oppositeEdge[pane]; + if (size < oldSize && state[ altPane ].noRoom) { + setSizeLimits( altPane ); + makePaneFit( altPane, false, skipCallback ); + } + + // DEBUG - ALERT user/developer so they know there was a sizing problem + if (tries.length > 1) + _log(msg +'\nSee the Error Console for details.', true, true); + } + } + + /** + * @see initPanes(), sizePane(), resizeAll(), open(), close(), hide() + * @param {(Array.|string)} panes The pane(s) being resized, comma-delmited string + * @param {boolean=} [skipCallback=false] Should the onresize callback be run? + * @param {boolean=} [force=false] + */ +, sizeMidPanes = function (panes, skipCallback, force) { + panes = (panes ? panes : "east,west,center").split(","); + + $.each(panes, function (i, pane) { + if (!$Ps[pane]) return; // NO PANE - skip + var + o = options[pane] + , s = state[pane] + , $P = $Ps[pane] + , $R = $Rs[pane] + , isCenter= (pane=="center") + , hasRoom = true + , CSS = {} + // if pane is not visible, show it invisibly NOW rather than for *each call* in this script + , visCSS = $.layout.showInvisibly($P) + + , newCenter = calcNewCenterPaneDims() + ; + + // update pane-state dimensions + $.extend(s, elDims($P)); + + if (pane === "center") { + if (!force && s.isVisible && newCenter.width === s.outerWidth && newCenter.height === s.outerHeight) { + $P.css(visCSS); + return true; // SKIP - pane already the correct size + } + // set state for makePaneFit() logic + $.extend(s, cssMinDims(pane), { + maxWidth: newCenter.width + , maxHeight: newCenter.height + }); + CSS = newCenter; + s.newWidth = CSS.width; + s.newHeight = CSS.height; + // convert OUTER width/height to CSS width/height + CSS.width = cssW($P, CSS.width); + // NEW - allow pane to extend 'below' visible area rather than hide it + CSS.height = cssH($P, CSS.height); + hasRoom = CSS.width >= 0 && CSS.height >= 0; // height >= 0 = ALWAYS TRUE NOW + + // during layout init, try to shrink east/west panes to make room for center + if (!state.initialized && o.minWidth > newCenter.width) { + var + reqPx = o.minWidth - s.outerWidth + , minE = options.east.minSize || 0 + , minW = options.west.minSize || 0 + , sizeE = state.east.size + , sizeW = state.west.size + , newE = sizeE + , newW = sizeW + ; + if (reqPx > 0 && state.east.isVisible && sizeE > minE) { + newE = max( sizeE-minE, sizeE-reqPx ); + reqPx -= sizeE-newE; + } + if (reqPx > 0 && state.west.isVisible && sizeW > minW) { + newW = max( sizeW-minW, sizeW-reqPx ); + reqPx -= sizeW-newW; + } + // IF we found enough extra space, then resize the border panes as calculated + if (reqPx === 0) { + if (sizeE && sizeE != minE) + sizePane('east', newE, true, true, force); // true = skipCallback/noAnimation - initPanes will handle when done + if (sizeW && sizeW != minW) + sizePane('west', newW, true, true, force); // true = skipCallback/noAnimation + // now start over! + sizeMidPanes('center', skipCallback, force); + $P.css(visCSS); + return; // abort this loop + } + } + } + else { // for east and west, set only the height, which is same as center height + // set state.min/maxWidth/Height for makePaneFit() logic + if (s.isVisible && !s.noVerticalRoom) + $.extend(s, elDims($P), cssMinDims(pane)) + if (!force && !s.noVerticalRoom && newCenter.height === s.outerHeight) { + $P.css(visCSS); + return true; // SKIP - pane already the correct size + } + // east/west have same top, bottom & height as center + CSS.top = newCenter.top; + CSS.bottom = newCenter.bottom; + s.newSize = newCenter.height + // NEW - allow pane to extend 'below' visible area rather than hide it + CSS.height = cssH($P, newCenter.height); + s.maxHeight = CSS.height; + hasRoom = (s.maxHeight >= 0); // ALWAYS TRUE NOW + if (!hasRoom) s.noVerticalRoom = true; // makePaneFit() logic + } + + if (hasRoom) { + // resizeAll passes skipCallback because it triggers callbacks after ALL panes are resized + if (!skipCallback && state.initialized) + _runCallbacks("onresize_start", pane); + + $P.css(CSS); // apply the CSS to pane + if (pane !== "center") + sizeHandles(pane); // also update resizer length + if (s.noRoom && !s.isClosed && !s.isHidden) + makePaneFit(pane); // will re-open/show auto-closed/hidden pane + if (s.isVisible) { + $.extend(s, elDims($P)); // update pane dimensions + if (state.initialized) sizeContent(pane); // also resize the contents, if exists + } + } + else if (!s.noRoom && s.isVisible) // no room for pane + makePaneFit(pane); // will hide or close pane + + // reset visibility, if necessary + $P.css(visCSS); + + delete s.newSize; + delete s.newWidth; + delete s.newHeight; + + if (!s.isVisible) + return true; // DONE - next pane + + /* + * Extra CSS for IE6 or IE7 in Quirks-mode - add 'width' to NORTH/SOUTH panes + * Normally these panes have only 'left' & 'right' positions so pane auto-sizes + * ALSO required when pane is an IFRAME because will NOT default to 'full width' + * TODO: Can I use width:100% for a north/south iframe? + * TODO: Sounds like a job for $P.outerWidth( sC.innerWidth ) SETTER METHOD + */ + if (pane === "center") { // finished processing midPanes + var fix = browser.isIE6 || !browser.boxModel; + if ($Ps.north && (fix || state.north.tagName=="IFRAME")) + $Ps.north.css("width", cssW($Ps.north, sC.innerWidth)); + if ($Ps.south && (fix || state.south.tagName=="IFRAME")) + $Ps.south.css("width", cssW($Ps.south, sC.innerWidth)); + } + + // resizeAll passes skipCallback because it triggers callbacks after ALL panes are resized + if (!skipCallback && state.initialized) + _runCallbacks("onresize_end", pane); + }); + } + + + /** + * @see window.onresize(), callbacks or custom code + * @param {(Object|boolean)=} evt_or_refresh If 'true', then also reset pane-positioning + */ +, resizeAll = function (evt_or_refresh) { + var oldW = sC.innerWidth + , oldH = sC.innerHeight + ; + // stopPropagation if called by trigger("layoutdestroy") - use evtPane utility + evtPane(evt_or_refresh); + + // cannot size layout when 'container' is hidden or collapsed + if (!$N.is(":visible")) return; + + if (!state.initialized) { + _initLayoutElements(); + return; // no need to resize since we just initialized! + } + + if (evt_or_refresh === true && $.isPlainObject(options.outset)) { + // update container CSS in case outset option has changed + $N.css( options.outset ); + } + // UPDATE container dimensions + $.extend(sC, elDims( $N, options.inset )); + if (!sC.outerHeight) return; + + // if 'true' passed, refresh pane & handle positioning too + if (evt_or_refresh === true) { + setPanePosition(); + } + + // onresizeall_start will CANCEL resizing if returns false + // state.container has already been set, so user can access this info for calcuations + if (false === _runCallbacks("onresizeall_start")) return false; + + var // see if container is now 'smaller' than before + shrunkH = (sC.innerHeight < oldH) + , shrunkW = (sC.innerWidth < oldW) + , $P, o, s + ; + // NOTE special order for sizing: S-N-E-W + $.each(["south","north","east","west"], function (i, pane) { + if (!$Ps[pane]) return; // no pane - SKIP + o = options[pane]; + s = state[pane]; + if (s.autoResize && s.size != o.size) // resize pane to original size set in options + sizePane(pane, o.size, true, true, true); // true=skipCallback/noAnimation/forceResize + else { + setSizeLimits(pane); + makePaneFit(pane, false, true, true); // true=skipCallback/forceResize + } + }); + + sizeMidPanes("", true, true); // true=skipCallback/forceResize + sizeHandles(); // reposition the toggler elements + + // trigger all individual pane callbacks AFTER layout has finished resizing + $.each(_c.allPanes, function (i, pane) { + $P = $Ps[pane]; + if (!$P) return; // SKIP + if (state[pane].isVisible) // undefined for non-existent panes + _runCallbacks("onresize_end", pane); // callback - if exists + }); + + _runCallbacks("onresizeall_end"); + //_triggerLayoutEvent(pane, 'resizeall'); + } + + /** + * Whenever a pane resizes or opens that has a nested layout, trigger resizeAll + * + * @param {(string|Object)} evt_or_pane The pane just resized or opened + */ +, resizeChildren = function (evt_or_pane, skipRefresh) { + var pane = evtPane.call(this, evt_or_pane); + + if (!options[pane].resizeChildren) return; + + // ensure the pane-children are up-to-date + if (!skipRefresh) refreshChildren( pane ); + var pC = children[pane]; + if ($.isPlainObject( pC )) { + // resize one or more children + $.each( pC, function (key, child) { + if (!child.destroyed) child.resizeAll(); + }); + } + } + + /** + * IF pane has a content-div, then resize all elements inside pane to fit pane-height + * + * @param {(string|Object)} evt_or_panes The pane(s) being resized + * @param {boolean=} [remeasure=false] Should the content (header/footer) be remeasured? + */ +, sizeContent = function (evt_or_panes, remeasure) { + if (!isInitialized()) return; + + var panes = evtPane.call(this, evt_or_panes); + panes = panes ? panes.split(",") : _c.allPanes; + + $.each(panes, function (idx, pane) { + var + $P = $Ps[pane] + , $C = $Cs[pane] + , o = options[pane] + , s = state[pane] + , m = s.content // m = measurements + ; + if (!$P || !$C || !$P.is(":visible")) return true; // NOT VISIBLE - skip + + // if content-element was REMOVED, update OR remove the pointer + if (!$C.length) { + initContent(pane, false); // false = do NOT sizeContent() - already there! + if (!$C) return; // no replacement element found - pointer have been removed + } + + // onsizecontent_start will CANCEL resizing if returns false + if (false === _runCallbacks("onsizecontent_start", pane)) return; + + // skip re-measuring offsets if live-resizing + if ((!s.isMoving && !s.isResizing) || o.liveContentResizing || remeasure || m.top == undefined) { + _measure(); + // if any footers are below pane-bottom, they may not measure correctly, + // so allow pane overflow and re-measure + if (m.hiddenFooters > 0 && $P.css("overflow") === "hidden") { + $P.css("overflow", "visible"); + _measure(); // remeasure while overflowing + $P.css("overflow", "hidden"); + } + } + // NOTE: spaceAbove/Below *includes* the pane paddingTop/Bottom, but not pane.borders + var newH = s.innerHeight - (m.spaceAbove - s.css.paddingTop) - (m.spaceBelow - s.css.paddingBottom); + + if (!$C.is(":visible") || m.height != newH) { + // size the Content element to fit new pane-size - will autoHide if not enough room + setOuterHeight($C, newH, true); // true=autoHide + m.height = newH; // save new height + }; + + if (state.initialized) + _runCallbacks("onsizecontent_end", pane); + + function _below ($E) { + return max(s.css.paddingBottom, (parseInt($E.css("marginBottom"), 10) || 0)); + }; + + function _measure () { + var + ignore = options[pane].contentIgnoreSelector + , $Fs = $C.nextAll().not(".ui-layout-mask").not(ignore || ":lt(0)") // not :lt(0) = ALL + , $Fs_vis = $Fs.filter(':visible') + , $F = $Fs_vis.filter(':last') + ; + m = { + top: $C[0].offsetTop + , height: $C.outerHeight() + , numFooters: $Fs.length + , hiddenFooters: $Fs.length - $Fs_vis.length + , spaceBelow: 0 // correct if no content footer ($E) + } + m.spaceAbove = m.top; // just for state - not used in calc + m.bottom = m.top + m.height; + if ($F.length) + //spaceBelow = (LastFooter.top + LastFooter.height) [footerBottom] - Content.bottom + max(LastFooter.marginBottom, pane.paddingBotom) + m.spaceBelow = ($F[0].offsetTop + $F.outerHeight()) - m.bottom + _below($F); + else // no footer - check marginBottom on Content element itself + m.spaceBelow = _below($C); + }; + }); + } + + + /** + * Called every time a pane is opened, closed, or resized to slide the togglers to 'center' and adjust their length if necessary + * + * @see initHandles(), open(), close(), resizeAll() + * @param {(string|Object)=} evt_or_panes The pane(s) being resized + */ +, sizeHandles = function (evt_or_panes) { + var panes = evtPane.call(this, evt_or_panes) + panes = panes ? panes.split(",") : _c.borderPanes; + + $.each(panes, function (i, pane) { + var + o = options[pane] + , s = state[pane] + , $P = $Ps[pane] + , $R = $Rs[pane] + , $T = $Ts[pane] + , $TC + ; + if (!$P || !$R) return; + + var + dir = _c[pane].dir + , _state = (s.isClosed ? "_closed" : "_open") + , spacing = o["spacing"+ _state] + , togAlign = o["togglerAlign"+ _state] + , togLen = o["togglerLength"+ _state] + , paneLen + , left + , offset + , CSS = {} + ; + + if (spacing === 0) { + $R.hide(); + return; + } + else if (!s.noRoom && !s.isHidden) // skip if resizer was hidden for any reason + $R.show(); // in case was previously hidden + + // Resizer Bar is ALWAYS same width/height of pane it is attached to + if (dir === "horz") { // north/south + //paneLen = $P.outerWidth(); // s.outerWidth || + paneLen = sC.innerWidth; // handle offscreen-panes + s.resizerLength = paneLen; + left = $.layout.cssNum($P, "left") + $R.css({ + width: cssW($R, paneLen) // account for borders & padding + , height: cssH($R, spacing) // ditto + , left: left > -9999 ? left : sC.inset.left // handle offscreen-panes + }); + } + else { // east/west + paneLen = $P.outerHeight(); // s.outerHeight || + s.resizerLength = paneLen; + $R.css({ + height: cssH($R, paneLen) // account for borders & padding + , width: cssW($R, spacing) // ditto + , top: sC.inset.top + getPaneSize("north", true) // TODO: what if no North pane? + //, top: $.layout.cssNum($Ps["center"], "top") + }); + } + + // remove hover classes + removeHover( o, $R ); + + if ($T) { + if (togLen === 0 || (s.isSliding && o.hideTogglerOnSlide)) { + $T.hide(); // always HIDE the toggler when 'sliding' + return; + } + else + $T.show(); // in case was previously hidden + + if (!(togLen > 0) || togLen === "100%" || togLen > paneLen) { + togLen = paneLen; + offset = 0; + } + else { // calculate 'offset' based on options.PANE.togglerAlign_open/closed + if (isStr(togAlign)) { + switch (togAlign) { + case "top": + case "left": offset = 0; + break; + case "bottom": + case "right": offset = paneLen - togLen; + break; + case "middle": + case "center": + default: offset = round((paneLen - togLen) / 2); // 'default' catches typos + } + } + else { // togAlign = number + var x = parseInt(togAlign, 10); // + if (togAlign >= 0) offset = x; + else offset = paneLen - togLen + x; // NOTE: x is negative! + } + } + + if (dir === "horz") { // north/south + var width = cssW($T, togLen); + $T.css({ + width: width // account for borders & padding + , height: cssH($T, spacing) // ditto + , left: offset // TODO: VERIFY that toggler positions correctly for ALL values + , top: 0 + }); + // CENTER the toggler content SPAN + $T.children(".content").each(function(){ + $TC = $(this); + $TC.css("marginLeft", round((width-$TC.outerWidth())/2)); // could be negative + }); + } + else { // east/west + var height = cssH($T, togLen); + $T.css({ + height: height // account for borders & padding + , width: cssW($T, spacing) // ditto + , top: offset // POSITION the toggler + , left: 0 + }); + // CENTER the toggler content SPAN + $T.children(".content").each(function(){ + $TC = $(this); + $TC.css("marginTop", round((height-$TC.outerHeight())/2)); // could be negative + }); + } + + // remove ALL hover classes + removeHover( 0, $T ); + } + + // DONE measuring and sizing this resizer/toggler, so can be 'hidden' now + if (!state.initialized && (o.initHidden || s.isHidden)) { + $R.hide(); + if ($T) $T.hide(); + } + }); + } + + + /** + * @param {(string|Object)} evt_or_pane + */ +, enableClosable = function (evt_or_pane) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , $T = $Ts[pane] + , o = options[pane] + ; + if (!$T) return; + o.closable = true; + $T .bind("click."+ sID, function(evt){ evt.stopPropagation(); toggle(pane); }) + .css("visibility", "visible") + .css("cursor", "pointer") + .attr("title", state[pane].isClosed ? o.tips.Open : o.tips.Close) // may be blank + .show(); + } + /** + * @param {(string|Object)} evt_or_pane + * @param {boolean=} [hide=false] + */ +, disableClosable = function (evt_or_pane, hide) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , $T = $Ts[pane] + ; + if (!$T) return; + options[pane].closable = false; + // is closable is disable, then pane MUST be open! + if (state[pane].isClosed) open(pane, false, true); + $T .unbind("."+ sID) + .css("visibility", hide ? "hidden" : "visible") // instead of hide(), which creates logic issues + .css("cursor", "default") + .attr("title", ""); + } + + + /** + * @param {(string|Object)} evt_or_pane + */ +, enableSlidable = function (evt_or_pane) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , $R = $Rs[pane] + ; + if (!$R || !$R.data('draggable')) return; + options[pane].slidable = true; + if (state[pane].isClosed) + bindStartSlidingEvents(pane, true); + } + /** + * @param {(string|Object)} evt_or_pane + */ +, disableSlidable = function (evt_or_pane) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , $R = $Rs[pane] + ; + if (!$R) return; + options[pane].slidable = false; + if (state[pane].isSliding) + close(pane, false, true); + else { + bindStartSlidingEvents(pane, false); + $R .css("cursor", "default") + .attr("title", ""); + removeHover(null, $R[0]); // in case currently hovered + } + } + + + /** + * @param {(string|Object)} evt_or_pane + */ +, enableResizable = function (evt_or_pane) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , $R = $Rs[pane] + , o = options[pane] + ; + if (!$R || !$R.data('draggable')) return; + o.resizable = true; + $R.draggable("enable"); + if (!state[pane].isClosed) + $R .css("cursor", o.resizerCursor) + .attr("title", o.tips.Resize); + } + /** + * @param {(string|Object)} evt_or_pane + */ +, disableResizable = function (evt_or_pane) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , $R = $Rs[pane] + ; + if (!$R || !$R.data('draggable')) return; + options[pane].resizable = false; + $R .draggable("disable") + .css("cursor", "default") + .attr("title", ""); + removeHover(null, $R[0]); // in case currently hovered + } + + + /** + * Move a pane from source-side (eg, west) to target-side (eg, east) + * If pane exists on target-side, move that to source-side, ie, 'swap' the panes + * + * @param {(string|Object)} evt_or_pane1 The pane/edge being swapped + * @param {string} pane2 ditto + */ +, swapPanes = function (evt_or_pane1, pane2) { + if (!isInitialized()) return; + var pane1 = evtPane.call(this, evt_or_pane1); + // change state.edge NOW so callbacks can know where pane is headed... + state[pane1].edge = pane2; + state[pane2].edge = pane1; + // run these even if NOT state.initialized + if (false === _runCallbacks("onswap_start", pane1) + || false === _runCallbacks("onswap_start", pane2) + ) { + state[pane1].edge = pane1; // reset + state[pane2].edge = pane2; + return; + } + + var + oPane1 = copy( pane1 ) + , oPane2 = copy( pane2 ) + , sizes = {} + ; + sizes[pane1] = oPane1 ? oPane1.state.size : 0; + sizes[pane2] = oPane2 ? oPane2.state.size : 0; + + // clear pointers & state + $Ps[pane1] = false; + $Ps[pane2] = false; + state[pane1] = {}; + state[pane2] = {}; + + // ALWAYS remove the resizer & toggler elements + if ($Ts[pane1]) $Ts[pane1].remove(); + if ($Ts[pane2]) $Ts[pane2].remove(); + if ($Rs[pane1]) $Rs[pane1].remove(); + if ($Rs[pane2]) $Rs[pane2].remove(); + $Rs[pane1] = $Rs[pane2] = $Ts[pane1] = $Ts[pane2] = false; + + // transfer element pointers and data to NEW Layout keys + move( oPane1, pane2 ); + move( oPane2, pane1 ); + + // cleanup objects + oPane1 = oPane2 = sizes = null; + + // make panes 'visible' again + if ($Ps[pane1]) $Ps[pane1].css(_c.visible); + if ($Ps[pane2]) $Ps[pane2].css(_c.visible); + + // fix any size discrepancies caused by swap + resizeAll(); + + // run these even if NOT state.initialized + _runCallbacks("onswap_end", pane1); + _runCallbacks("onswap_end", pane2); + + return; + + function copy (n) { // n = pane + var + $P = $Ps[n] + , $C = $Cs[n] + ; + return !$P ? false : { + pane: n + , P: $P ? $P[0] : false + , C: $C ? $C[0] : false + , state: $.extend(true, {}, state[n]) + , options: $.extend(true, {}, options[n]) + } + }; + + function move (oPane, pane) { + if (!oPane) return; + var + P = oPane.P + , C = oPane.C + , oldPane = oPane.pane + , c = _c[pane] + // save pane-options that should be retained + , s = $.extend(true, {}, state[pane]) + , o = options[pane] + // RETAIN side-specific FX Settings - more below + , fx = { resizerCursor: o.resizerCursor } + , re, size, pos + ; + $.each("fxName,fxSpeed,fxSettings".split(","), function (i, k) { + fx[k +"_open"] = o[k +"_open"]; + fx[k +"_close"] = o[k +"_close"]; + fx[k +"_size"] = o[k +"_size"]; + }); + + // update object pointers and attributes + $Ps[pane] = $(P) + .data({ + layoutPane: Instance[pane] // NEW pointer to pane-alias-object + , layoutEdge: pane + }) + .css(_c.hidden) + .css(c.cssReq) + ; + $Cs[pane] = C ? $(C) : false; + + // set options and state + options[pane] = $.extend(true, {}, oPane.options, fx); + state[pane] = $.extend(true, {}, oPane.state); + + // change classNames on the pane, eg: ui-layout-pane-east ==> ui-layout-pane-west + re = new RegExp(o.paneClass +"-"+ oldPane, "g"); + P.className = P.className.replace(re, o.paneClass +"-"+ pane); + + // ALWAYS regenerate the resizer & toggler elements + initHandles(pane); // create the required resizer & toggler + + // if moving to different orientation, then keep 'target' pane size + if (c.dir != _c[oldPane].dir) { + size = sizes[pane] || 0; + setSizeLimits(pane); // update pane-state + size = max(size, state[pane].minSize); + // use manualSizePane to disable autoResize - not useful after panes are swapped + manualSizePane(pane, size, true, true); // true/true = skipCallback/noAnimation + } + else // move the resizer here + $Rs[pane].css(c.side, sC.inset[c.side] + (state[pane].isVisible ? getPaneSize(pane) : 0)); + + + // ADD CLASSNAMES & SLIDE-BINDINGS + if (oPane.state.isVisible && !s.isVisible) + setAsOpen(pane, true); // true = skipCallback + else { + setAsClosed(pane); + bindStartSlidingEvents(pane, true); // will enable events IF option is set + } + + // DESTROY the object + oPane = null; + }; + } + + + /** + * INTERNAL method to sync pin-buttons when pane is opened or closed + * Unpinned means the pane is 'sliding' - ie, over-top of the adjacent panes + * + * @see open(), setAsOpen(), setAsClosed() + * @param {string} pane These are the params returned to callbacks by layout() + * @param {boolean} doPin True means set the pin 'down', False means 'up' + */ +, syncPinBtns = function (pane, doPin) { + if ($.layout.plugins.buttons) + $.each(state[pane].pins, function (i, selector) { + $.layout.buttons.setPinState(Instance, $(selector), pane, doPin); + }); + } + +; // END var DECLARATIONS + + /** + * Capture keys when enableCursorHotkey - toggle pane if hotkey pressed + * + * @see document.keydown() + */ + function keyDown (evt) { + if (!evt) return true; + var code = evt.keyCode; + if (code < 33) return true; // ignore special keys: ENTER, TAB, etc + + var + PANE = { + 38: "north" // Up Cursor - $.ui.keyCode.UP + , 40: "south" // Down Cursor - $.ui.keyCode.DOWN + , 37: "west" // Left Cursor - $.ui.keyCode.LEFT + , 39: "east" // Right Cursor - $.ui.keyCode.RIGHT + } + , ALT = evt.altKey // no worky! + , SHIFT = evt.shiftKey + , CTRL = evt.ctrlKey + , CURSOR = (CTRL && code >= 37 && code <= 40) + , o, k, m, pane + ; + + if (CURSOR && options[PANE[code]].enableCursorHotkey) // valid cursor-hotkey + pane = PANE[code]; + else if (CTRL || SHIFT) // check to see if this matches a custom-hotkey + $.each(_c.borderPanes, function (i, p) { // loop each pane to check its hotkey + o = options[p]; + k = o.customHotkey; + m = o.customHotkeyModifier; // if missing or invalid, treated as "CTRL+SHIFT" + if ((SHIFT && m=="SHIFT") || (CTRL && m=="CTRL") || (CTRL && SHIFT)) { // Modifier matches + if (k && code === (isNaN(k) || k <= 9 ? k.toUpperCase().charCodeAt(0) : k)) { // Key matches + pane = p; + return false; // BREAK + } + } + }); + + // validate pane + if (!pane || !$Ps[pane] || !options[pane].closable || state[pane].isHidden) + return true; + + toggle(pane); + + evt.stopPropagation(); + evt.returnValue = false; // CANCEL key + return false; + }; + + +/* + * ###################################### + * UTILITY METHODS + * called externally or by initButtons + * ###################################### + */ + + /** + * Change/reset a pane overflow setting & zIndex to allow popups/drop-downs to work + * + * @param {Object=} [el] (optional) Can also be 'bound' to a click, mouseOver, or other event + */ + function allowOverflow (el) { + if (!isInitialized()) return; + if (this && this.tagName) el = this; // BOUND to element + var $P; + if (isStr(el)) + $P = $Ps[el]; + else if ($(el).data("layoutRole")) + $P = $(el); + else + $(el).parents().each(function(){ + if ($(this).data("layoutRole")) { + $P = $(this); + return false; // BREAK + } + }); + if (!$P || !$P.length) return; // INVALID + + var + pane = $P.data("layoutEdge") + , s = state[pane] + ; + + // if pane is already raised, then reset it before doing it again! + // this would happen if allowOverflow is attached to BOTH the pane and an element + if (s.cssSaved) + resetOverflow(pane); // reset previous CSS before continuing + + // if pane is raised by sliding or resizing, or its closed, then abort + if (s.isSliding || s.isResizing || s.isClosed) { + s.cssSaved = false; + return; + } + + var + newCSS = { zIndex: (options.zIndexes.resizer_normal + 1) } + , curCSS = {} + , of = $P.css("overflow") + , ofX = $P.css("overflowX") + , ofY = $P.css("overflowY") + ; + // determine which, if any, overflow settings need to be changed + if (of != "visible") { + curCSS.overflow = of; + newCSS.overflow = "visible"; + } + if (ofX && !ofX.match(/(visible|auto)/)) { + curCSS.overflowX = ofX; + newCSS.overflowX = "visible"; + } + if (ofY && !ofY.match(/(visible|auto)/)) { + curCSS.overflowY = ofX; + newCSS.overflowY = "visible"; + } + + // save the current overflow settings - even if blank! + s.cssSaved = curCSS; + + // apply new CSS to raise zIndex and, if necessary, make overflow 'visible' + $P.css( newCSS ); + + // make sure the zIndex of all other panes is normal + $.each(_c.allPanes, function(i, p) { + if (p != pane) resetOverflow(p); + }); + + }; + /** + * @param {Object=} [el] (optional) Can also be 'bound' to a click, mouseOver, or other event + */ + function resetOverflow (el) { + if (!isInitialized()) return; + if (this && this.tagName) el = this; // BOUND to element + var $P; + if (isStr(el)) + $P = $Ps[el]; + else if ($(el).data("layoutRole")) + $P = $(el); + else + $(el).parents().each(function(){ + if ($(this).data("layoutRole")) { + $P = $(this); + return false; // BREAK + } + }); + if (!$P || !$P.length) return; // INVALID + + var + pane = $P.data("layoutEdge") + , s = state[pane] + , CSS = s.cssSaved || {} + ; + // reset the zIndex + if (!s.isSliding && !s.isResizing) + $P.css("zIndex", options.zIndexes.pane_normal); + + // reset Overflow - if necessary + $P.css( CSS ); + + // clear var + s.cssSaved = false; + }; + +/* + * ##################### + * CREATE/RETURN LAYOUT + * ##################### + */ + + // validate that container exists + var $N = $(this).eq(0); // FIRST matching Container element + if (!$N.length) { + return _log( options.errors.containerMissing ); + }; + + // Users retrieve Instance of a layout with: $N.layout() OR $N.data("layout") + // return the Instance-pointer if layout has already been initialized + if ($N.data("layoutContainer") && $N.data("layout")) + return $N.data("layout"); // cached pointer + + // init global vars + var + $Ps = {} // Panes x5 - set in initPanes() + , $Cs = {} // Content x5 - set in initPanes() + , $Rs = {} // Resizers x4 - set in initHandles() + , $Ts = {} // Togglers x4 - set in initHandles() + , $Ms = $([]) // Masks - up to 2 masks per pane (IFRAME + DIV) + // aliases for code brevity + , sC = state.container // alias for easy access to 'container dimensions' + , sID = state.id // alias for unique layout ID/namespace - eg: "layout435" + ; + + // create Instance object to expose data & option Properties, and primary action Methods + var Instance = { + // layout data + options: options // property - options hash + , state: state // property - dimensions hash + // object pointers + , container: $N // property - object pointers for layout container + , panes: $Ps // property - object pointers for ALL Panes: panes.north, panes.center + , contents: $Cs // property - object pointers for ALL Content: contents.north, contents.center + , resizers: $Rs // property - object pointers for ALL Resizers, eg: resizers.north + , togglers: $Ts // property - object pointers for ALL Togglers, eg: togglers.north + // border-pane open/close + , hide: hide // method - ditto + , show: show // method - ditto + , toggle: toggle // method - pass a 'pane' ("north", "west", etc) + , open: open // method - ditto + , close: close // method - ditto + , slideOpen: slideOpen // method - ditto + , slideClose: slideClose // method - ditto + , slideToggle: slideToggle // method - ditto + // pane actions + , setSizeLimits: setSizeLimits // method - pass a 'pane' - update state min/max data + , _sizePane: sizePane // method -intended for user by plugins only! + , sizePane: manualSizePane // method - pass a 'pane' AND an 'outer-size' in pixels or percent, or 'auto' + , sizeContent: sizeContent // method - pass a 'pane' + , swapPanes: swapPanes // method - pass TWO 'panes' - will swap them + , showMasks: showMasks // method - pass a 'pane' OR list of panes - default = all panes with mask option set + , hideMasks: hideMasks // method - ditto' + // pane element methods + , initContent: initContent // method - ditto + , addPane: addPane // method - pass a 'pane' + , removePane: removePane // method - pass a 'pane' to remove from layout, add 'true' to delete the pane-elem + , createChildren: createChildren // method - pass a 'pane' and (optional) layout-options (OVERRIDES options[pane].children + , refreshChildren: refreshChildren // method - pass a 'pane' and a layout-instance + // special pane option setting + , enableClosable: enableClosable // method - pass a 'pane' + , disableClosable: disableClosable // method - ditto + , enableSlidable: enableSlidable // method - ditto + , disableSlidable: disableSlidable // method - ditto + , enableResizable: enableResizable // method - ditto + , disableResizable: disableResizable// method - ditto + // utility methods for panes + , allowOverflow: allowOverflow // utility - pass calling element (this) + , resetOverflow: resetOverflow // utility - ditto + // layout control + , destroy: destroy // method - no parameters + , initPanes: isInitialized // method - no parameters + , resizeAll: resizeAll // method - no parameters + // callback triggering + , runCallbacks: _runCallbacks // method - pass evtName & pane (if a pane-event), eg: trigger("onopen", "west") + // alias collections of options, state and children - created in addPane and extended elsewhere + , hasParentLayout: false // set by initContainer() + , children: children // pointers to child-layouts, eg: Instance.children.west.layoutName + , north: false // alias group: { name: pane, pane: $Ps[pane], options: options[pane], state: state[pane], children: children[pane] } + , south: false // ditto + , west: false // ditto + , east: false // ditto + , center: false // ditto + }; + + // create the border layout NOW + if (_create() === 'cancel') // onload_start callback returned false to CANCEL layout creation + return null; + else // true OR false -- if layout-elements did NOT init (hidden or do not exist), can auto-init later + return Instance; // return the Instance object + +} + + +})( jQuery ); + + + + +/** + * jquery.layout.state 1.2 + * $Date: 2015/03/13 22:37:04 $ + * + * Copyright (c) 2014 + * Kevin Dalman (http://allpro.net) + * + * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html) + * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses. + * + * @requires: UI Layout 1.4.0 or higher + * @requires: $.ui.cookie (above) + * + * @see: http://groups.google.com/group/jquery-ui-layout + */ +;(function ($) { + +if (!$.layout) return; + + +/** + * UI COOKIE UTILITY + * + * A $.cookie OR $.ui.cookie namespace *should be standard*, but until then... + * This creates $.ui.cookie so Layout does not need the cookie.jquery.js plugin + * NOTE: This utility is REQUIRED by the layout.state plugin + * + * Cookie methods in Layout are created as part of State Management + */ +if (!$.ui) $.ui = {}; +$.ui.cookie = { + + // cookieEnabled is not in DOM specs, but DOES works in all browsers,including IE6 + acceptsCookies: !!navigator.cookieEnabled + +, read: function (name) { + var + c = document.cookie + , cs = c ? c.split(';') : [] + , pair, data, i + ; + for (i=0; pair=cs[i]; i++) { + data = $.trim(pair).split('='); // name=value => [ name, value ] + if (data[0] == name) // found the layout cookie + return decodeURIComponent(data[1]); + } + return null; + } + +, write: function (name, val, cookieOpts) { + var params = "" + , date = "" + , clear = false + , o = cookieOpts || {} + , x = o.expires || null + , t = $.type(x) + ; + if (t === "date") + date = x; + else if (t === "string" && x > 0) { + x = parseInt(x,10); + t = "number"; + } + if (t === "number") { + date = new Date(); + if (x > 0) + date.setDate(date.getDate() + x); + else { + date.setFullYear(1970); + clear = true; + } + } + if (date) params += ";expires="+ date.toUTCString(); + if (o.path) params += ";path="+ o.path; + if (o.domain) params += ";domain="+ o.domain; + if (o.secure) params += ";secure"; + document.cookie = name +"="+ (clear ? "" : encodeURIComponent( val )) + params; // write or clear cookie + } + +, clear: function (name) { + $.ui.cookie.write(name, "", {expires: -1}); + } + +}; +// if cookie.jquery.js is not loaded, create an alias to replicate it +// this may be useful to other plugins or code dependent on that plugin +if (!$.cookie) $.cookie = function (k, v, o) { + var C = $.ui.cookie; + if (v === null) + C.clear(k); + else if (v === undefined) + return C.read(k); + else + C.write(k, v, o); +}; + + + +/** + * State-management options stored in options.stateManagement, which includes a .cookie hash + * Default options saves ALL KEYS for ALL PANES, ie: pane.size, pane.isClosed, pane.isHidden + * + * // STATE/COOKIE OPTIONS + * @example $(el).layout({ + stateManagement: { + enabled: true + , stateKeys: "east.size,west.size,east.isClosed,west.isClosed" + , cookie: { name: "appLayout", path: "/" } + } + }) + * @example $(el).layout({ stateManagement__enabled: true }) // enable auto-state-management using cookies + * @example $(el).layout({ stateManagement__cookie: { name: "appLayout", path: "/" } }) + * @example $(el).layout({ stateManagement__cookie__name: "appLayout", stateManagement__cookie__path: "/" }) + * + * // STATE/COOKIE METHODS + * @example myLayout.saveCookie( "west.isClosed,north.size,south.isHidden", {expires: 7} ); + * @example myLayout.loadCookie(); + * @example myLayout.deleteCookie(); + * @example var JSON = myLayout.readState(); // CURRENT Layout State + * @example var JSON = myLayout.readCookie(); // SAVED Layout State (from cookie) + * @example var JSON = myLayout.state.stateData; // LAST LOADED Layout State (cookie saved in layout.state hash) + * + * CUSTOM STATE-MANAGEMENT (eg, saved in a database) + * @example var JSON = myLayout.readState( "west.isClosed,north.size,south.isHidden" ); + * @example myLayout.loadState( JSON ); + */ + +// tell Layout that the state plugin is available +$.layout.plugins.stateManagement = true; + +// Add State-Management options to layout.defaults +$.layout.defaults.stateManagement = { + enabled: false // true = enable state-management, even if not using cookies +, autoSave: true // Save a state-cookie when page exits? +, autoLoad: true // Load the state-cookie when Layout inits? +, animateLoad: true // animate panes when loading state into an active layout +, includeChildren: true // recurse into child layouts to include their state as well + // List state-data to save - must be pane-specific +, stateKeys: "north.size,south.size,east.size,west.size,"+ + "north.isClosed,south.isClosed,east.isClosed,west.isClosed,"+ + "north.isHidden,south.isHidden,east.isHidden,west.isHidden" +, cookie: { + name: "" // If not specified, will use Layout.name, else just "Layout" + , domain: "" // blank = current domain + , path: "" // blank = current page, "/" = entire website + , expires: "" // 'days' to keep cookie - leave blank for 'session cookie' + , secure: false + } +}; + +// Set stateManagement as a 'layout-option', NOT a 'pane-option' +$.layout.optionsMap.layout.push("stateManagement"); +// Update config so layout does not move options into the pane-default branch (panes) +$.layout.config.optionRootKeys.push("stateManagement"); + +/* + * State Management methods + */ +$.layout.state = { + + /** + * Get the current layout state and save it to a cookie + * + * myLayout.saveCookie( keys, cookieOpts ) + * + * @param {Object} inst + * @param {(string|Array)=} keys + * @param {Object=} cookieOpts + */ + saveCookie: function (inst, keys, cookieOpts) { + var o = inst.options + , sm = o.stateManagement + , oC = $.extend(true, {}, sm.cookie, cookieOpts || null) + , data = inst.state.stateData = inst.readState( keys || sm.stateKeys ) // read current panes-state + ; + $.ui.cookie.write( oC.name || o.name || "Layout", $.layout.state.encodeJSON(data), oC ); + return $.extend(true, {}, data); // return COPY of state.stateData data + } + + /** + * Remove the state cookie + * + * @param {Object} inst + */ +, deleteCookie: function (inst) { + var o = inst.options; + $.ui.cookie.clear( o.stateManagement.cookie.name || o.name || "Layout" ); + } + + /** + * Read & return data from the cookie - as JSON + * + * @param {Object} inst + */ +, readCookie: function (inst) { + var o = inst.options; + var c = $.ui.cookie.read( o.stateManagement.cookie.name || o.name || "Layout" ); + // convert cookie string back to a hash and return it + return c ? $.layout.state.decodeJSON(c) : {}; + } + + /** + * Get data from the cookie and USE IT to loadState + * + * @param {Object} inst + */ +, loadCookie: function (inst) { + var c = $.layout.state.readCookie(inst); // READ the cookie + if (c && !$.isEmptyObject( c )) { + inst.state.stateData = $.extend(true, {}, c); // SET state.stateData + inst.loadState(c); // LOAD the retrieved state + } + return c; + } + + /** + * Update layout options from the cookie, if one exists + * + * @param {Object} inst + * @param {Object=} stateData + * @param {boolean=} animate + */ +, loadState: function (inst, data, opts) { + if (!$.isPlainObject( data ) || $.isEmptyObject( data )) return; + + // normalize data & cache in the state object + data = inst.state.stateData = $.layout.transformData( data ); // panes = default subkey + + // add missing/default state-restore options + var smo = inst.options.stateManagement; + opts = $.extend({ + animateLoad: false //smo.animateLoad + , includeChildren: smo.includeChildren + }, opts ); + + if (!inst.state.initialized) { + /* + * layout NOT initialized, so just update its options + */ + // MUST remove pane.children keys before applying to options + // use a copy so we don't remove keys from original data + var o = $.extend(true, {}, data); + //delete o.center; // center has no state-data - only children + $.each($.layout.config.allPanes, function (idx, pane) { + if (o[pane]) delete o[pane].children; + }); + // update CURRENT layout-options with saved state data + $.extend(true, inst.options, o); + } + else { + /* + * layout already initialized, so modify layout's configuration + */ + var noAnimate = !opts.animateLoad + , o, c, h, state, open + ; + $.each($.layout.config.borderPanes, function (idx, pane) { + o = data[ pane ]; + if (!$.isPlainObject( o )) return; // no key, skip pane + + s = o.size; + c = o.initClosed; + h = o.initHidden; + ar = o.autoResize + state = inst.state[pane]; + open = state.isVisible; + + // reset autoResize + if (ar) + state.autoResize = ar; + // resize BEFORE opening + if (!open) + inst._sizePane(pane, s, false, false, false); // false=skipCallback/noAnimation/forceResize + // open/close as necessary - DO NOT CHANGE THIS ORDER! + if (h === true) inst.hide(pane, noAnimate); + else if (c === true) inst.close(pane, false, noAnimate); + else if (c === false) inst.open (pane, false, noAnimate); + else if (h === false) inst.show (pane, false, noAnimate); + // resize AFTER any other actions + if (open) + inst._sizePane(pane, s, false, false, noAnimate); // animate resize if option passed + }); + + /* + * RECURSE INTO CHILD-LAYOUTS + */ + if (opts.includeChildren) { + var paneStateChildren, childState; + $.each(inst.children, function (pane, paneChildren) { + paneStateChildren = data[pane] ? data[pane].children : 0; + if (paneStateChildren && paneChildren) { + $.each(paneChildren, function (stateKey, child) { + childState = paneStateChildren[stateKey]; + if (child && childState) + child.loadState( childState ); + }); + } + }); + } + } + } + + /** + * Get the *current layout state* and return it as a hash + * + * @param {Object=} inst // Layout instance to get state for + * @param {object=} [opts] // State-Managements override options + */ +, readState: function (inst, opts) { + // backward compatility + if ($.type(opts) === 'string') opts = { keys: opts }; + if (!opts) opts = {}; + var sm = inst.options.stateManagement + , ic = opts.includeChildren + , recurse = ic !== undefined ? ic : sm.includeChildren + , keys = opts.stateKeys || sm.stateKeys + , alt = { isClosed: 'initClosed', isHidden: 'initHidden' } + , state = inst.state + , panes = $.layout.config.allPanes + , data = {} + , pair, pane, key, val + , ps, pC, child, array, count, branch + ; + if ($.isArray(keys)) keys = keys.join(","); + // convert keys to an array and change delimiters from '__' to '.' + keys = keys.replace(/__/g, ".").split(','); + // loop keys and create a data hash + for (var i=0, n=keys.length; i < n; i++) { + pair = keys[i].split("."); + pane = pair[0]; + key = pair[1]; + if ($.inArray(pane, panes) < 0) continue; // bad pane! + val = state[ pane ][ key ]; + if (val == undefined) continue; + if (key=="isClosed" && state[pane]["isSliding"]) + val = true; // if sliding, then *really* isClosed + ( data[pane] || (data[pane]={}) )[ alt[key] ? alt[key] : key ] = val; + } + + // recurse into the child-layouts for each pane + if (recurse) { + $.each(panes, function (idx, pane) { + pC = inst.children[pane]; + ps = state.stateData[pane]; + if ($.isPlainObject( pC ) && !$.isEmptyObject( pC )) { + // ensure a key exists for this 'pane', eg: branch = data.center + branch = data[pane] || (data[pane] = {}); + if (!branch.children) branch.children = {}; + $.each( pC, function (key, child) { + // ONLY read state from an initialize layout + if ( child.state.initialized ) + branch.children[ key ] = $.layout.state.readState( child ); + // if we have PREVIOUS (onLoad) state for this child-layout, KEEP IT! + else if ( ps && ps.children && ps.children[ key ] ) { + branch.children[ key ] = $.extend(true, {}, ps.children[ key ] ); + } + }); + } + }); + } + + return data; + } + + /** + * Stringify a JSON hash so can save in a cookie or db-field + */ +, encodeJSON: function (json) { + var local = window.JSON || {}; + return (local.stringify || stringify)(json); + + function stringify (h) { + var D=[], i=0, k, v, t // k = key, v = value + , a = $.isArray(h) + ; + for (k in h) { + v = h[k]; + t = typeof v; + if (t == 'string') // STRING - add quotes + v = '"'+ v +'"'; + else if (t == 'object') // SUB-KEY - recurse into it + v = parse(v); + D[i++] = (!a ? '"'+ k +'":' : '') + v; + } + return (a ? '[' : '{') + D.join(',') + (a ? ']' : '}'); + }; + } + + /** + * Convert stringified JSON back to a hash object + * @see $.parseJSON(), adding in jQuery 1.4.1 + */ +, decodeJSON: function (str) { + try { return $.parseJSON ? $.parseJSON(str) : window["eval"]("("+ str +")") || {}; } + catch (e) { return {}; } + } + + +, _create: function (inst) { + var s = $.layout.state + , o = inst.options + , sm = o.stateManagement + ; + // ADD State-Management plugin methods to inst + $.extend( inst, { + // readCookie - update options from cookie - returns hash of cookie data + readCookie: function () { return s.readCookie(inst); } + // deleteCookie + , deleteCookie: function () { s.deleteCookie(inst); } + // saveCookie - optionally pass keys-list and cookie-options (hash) + , saveCookie: function (keys, cookieOpts) { return s.saveCookie(inst, keys, cookieOpts); } + // loadCookie - readCookie and use to loadState() - returns hash of cookie data + , loadCookie: function () { return s.loadCookie(inst); } + // loadState - pass a hash of state to use to update options + , loadState: function (stateData, opts) { s.loadState(inst, stateData, opts); } + // readState - returns hash of current layout-state + , readState: function (keys) { return s.readState(inst, keys); } + // add JSON utility methods too... + , encodeJSON: s.encodeJSON + , decodeJSON: s.decodeJSON + }); + + // init state.stateData key, even if plugin is initially disabled + inst.state.stateData = {}; + + // autoLoad MUST BE one of: data-array, data-hash, callback-function, or TRUE + if ( !sm.autoLoad ) return; + + // When state-data exists in the autoLoad key USE IT, + // even if stateManagement.enabled == false + if ($.isPlainObject( sm.autoLoad )) { + if (!$.isEmptyObject( sm.autoLoad )) { + inst.loadState( sm.autoLoad ); + } + } + else if ( sm.enabled ) { + // update the options from cookie or callback + // if options is a function, call it to get stateData + if ($.isFunction( sm.autoLoad )) { + var d = {}; + try { + d = sm.autoLoad( inst, inst.state, inst.options, inst.options.name || '' ); // try to get data from fn + } catch (e) {} + if (d && $.isPlainObject( d ) && !$.isEmptyObject( d )) + inst.loadState(d); + } + else // any other truthy value will trigger loadCookie + inst.loadCookie(); + } + } + +, _unload: function (inst) { + var sm = inst.options.stateManagement; + if (sm.enabled && sm.autoSave) { + // if options is a function, call it to save the stateData + if ($.isFunction( sm.autoSave )) { + try { + sm.autoSave( inst, inst.state, inst.options, inst.options.name || '' ); // try to get data from fn + } catch (e) {} + } + else // any truthy value will trigger saveCookie + inst.saveCookie(); + } + } + +}; + +// add state initialization method to Layout's onCreate array of functions +$.layout.onCreate.push( $.layout.state._create ); +$.layout.onUnload.push( $.layout.state._unload ); + +})( jQuery ); + + + +/** + * @preserve jquery.layout.buttons 1.0 + * $Date: 2015/03/13 22:37:04 $ + * + * Copyright (c) 2011 + * Kevin Dalman (http://allpro.net) + * + * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html) + * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses. + * + * @dependancies: UI Layout 1.3.0.rc30.1 or higher + * + * @support: http://groups.google.com/group/jquery-ui-layout + * + * Docs: [ to come ] + * Tips: [ to come ] + */ +;(function ($) { + +if (!$.layout) return; + + +// tell Layout that the state plugin is available +$.layout.plugins.buttons = true; + +// Add State-Management options to layout.defaults +$.layout.defaults.autoBindCustomButtons = false; +// Set stateManagement as a layout-option, NOT a pane-option +$.layout.optionsMap.layout.push("autoBindCustomButtons"); + +var lang = $.layout.language; + +/* + * Button methods + */ +$.layout.buttons = { + // set data used by multiple methods below + config: { + borderPanes: "north,south,west,east" + } + + /** + * Searches for .ui-layout-button-xxx elements and auto-binds them as layout-buttons + * + * @see _create() + */ +, init: function (inst) { + var pre = "ui-layout-button-" + , layout = inst.options.name || "" + , name; + $.each("toggle,open,close,pin,toggle-slide,open-slide".split(","), function (i, action) { + $.each($.layout.buttons.config.borderPanes.split(","), function (ii, pane) { + $("."+pre+action+"-"+pane).each(function(){ + // if button was previously 'bound', data.layoutName was set, but is blank if layout has no 'name' + name = $(this).data("layoutName") || $(this).attr("layoutName"); + if (name == undefined || name === layout) + inst.bindButton(this, action, pane); + }); + }); + }); + } + + /** + * Helper function to validate params received by addButton utilities + * + * Two classes are added to the element, based on the buttonClass... + * The type of button is appended to create the 2nd className: + * - ui-layout-button-pin + * - ui-layout-pane-button-toggle + * - ui-layout-pane-button-open + * - ui-layout-pane-button-close + * + * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" + * @param {string} pane Name of the pane the button is for: 'north', 'south', etc. + * @return {Array.} If both params valid, the element matching 'selector' in a jQuery wrapper - otherwise returns null + */ +, get: function (inst, selector, pane, action) { + var $E = $(selector) + , o = inst.options + , err = o.showErrorMessages + ; + if (!$E.length) { // element not found + if (err) alert(lang.errButton + lang.selector +": "+ selector); + } + else if ($.layout.buttons.config.borderPanes.indexOf(pane) === -1) { // invalid 'pane' sepecified + if (err) alert(lang.errButton + lang.pane +": "+ pane); + $E = $(""); // NO BUTTON + } + else { // VALID + var btn = o[pane].buttonClass +"-"+ action; + $E .addClass( btn +" "+ btn +"-"+ pane ) + .data("layoutName", o.name); // add layout identifier - even if blank! + } + return $E; + } + + + /** + * NEW syntax for binding layout-buttons - will eventually replace addToggle, addOpen, etc. + * + * @param {(string|!Object)} sel jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" + * @param {string} action + * @param {string} pane + */ +, bind: function (inst, sel, action, pane) { + var _ = $.layout.buttons; + switch (action.toLowerCase()) { + case "toggle": _.addToggle (inst, sel, pane); break; + case "open": _.addOpen (inst, sel, pane); break; + case "close": _.addClose (inst, sel, pane); break; + case "pin": _.addPin (inst, sel, pane); break; + case "toggle-slide": _.addToggle (inst, sel, pane, true); break; + case "open-slide": _.addOpen (inst, sel, pane, true); break; + } + return inst; + } + + /** + * Add a custom Toggler button for a pane + * + * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" + * @param {string} pane Name of the pane the button is for: 'north', 'south', etc. + * @param {boolean=} slide true = slide-open, false = pin-open + */ +, addToggle: function (inst, selector, pane, slide) { + $.layout.buttons.get(inst, selector, pane, "toggle") + .click(function(evt){ + inst.toggle(pane, !!slide); + evt.stopPropagation(); + }); + return inst; + } + + /** + * Add a custom Open button for a pane + * + * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" + * @param {string} pane Name of the pane the button is for: 'north', 'south', etc. + * @param {boolean=} slide true = slide-open, false = pin-open + */ +, addOpen: function (inst, selector, pane, slide) { + $.layout.buttons.get(inst, selector, pane, "open") + .attr("title", lang.Open) + .click(function (evt) { + inst.open(pane, !!slide); + evt.stopPropagation(); + }); + return inst; + } + + /** + * Add a custom Close button for a pane + * + * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" + * @param {string} pane Name of the pane the button is for: 'north', 'south', etc. + */ +, addClose: function (inst, selector, pane) { + $.layout.buttons.get(inst, selector, pane, "close") + .attr("title", lang.Close) + .click(function (evt) { + inst.close(pane); + evt.stopPropagation(); + }); + return inst; + } + + /** + * Add a custom Pin button for a pane + * + * Four classes are added to the element, based on the paneClass for the associated pane... + * Assuming the default paneClass and the pin is 'up', these classes are added for a west-pane pin: + * - ui-layout-pane-pin + * - ui-layout-pane-west-pin + * - ui-layout-pane-pin-up + * - ui-layout-pane-west-pin-up + * + * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" + * @param {string} pane Name of the pane the pin is for: 'north', 'south', etc. + */ +, addPin: function (inst, selector, pane) { + var $E = $.layout.buttons.get(inst, selector, pane, "pin"); + if ($E.length) { + var s = inst.state[pane]; + $E.click(function (evt) { + $.layout.buttons.setPinState(inst, $(this), pane, (s.isSliding || s.isClosed)); + if (s.isSliding || s.isClosed) inst.open( pane ); // change from sliding to open + else inst.close( pane ); // slide-closed + evt.stopPropagation(); + }); + // add up/down pin attributes and classes + $.layout.buttons.setPinState(inst, $E, pane, (!s.isClosed && !s.isSliding)); + // add this pin to the pane data so we can 'sync it' automatically + // PANE.pins key is an array so we can store multiple pins for each pane + s.pins.push( selector ); // just save the selector string + } + return inst; + } + + /** + * Change the class of the pin button to make it look 'up' or 'down' + * + * @see addPin(), syncPins() + * @param {Array.} $Pin The pin-span element in a jQuery wrapper + * @param {string} pane These are the params returned to callbacks by layout() + * @param {boolean} doPin true = set the pin 'down', false = set it 'up' + */ +, setPinState: function (inst, $Pin, pane, doPin) { + var updown = $Pin.attr("pin"); + if (updown && doPin === (updown=="down")) return; // already in correct state + var + pin = inst.options[pane].buttonClass +"-pin" + , side = pin +"-"+ pane + , UP = pin +"-up "+ side +"-up" + , DN = pin +"-down "+side +"-down" + ; + $Pin + .attr("pin", doPin ? "down" : "up") // logic + .attr("title", doPin ? lang.Unpin : lang.Pin) + .removeClass( doPin ? UP : DN ) + .addClass( doPin ? DN : UP ) + ; + } + + /** + * INTERNAL function to sync 'pin buttons' when pane is opened or closed + * Unpinned means the pane is 'sliding' - ie, over-top of the adjacent panes + * + * @see open(), close() + * @param {string} pane These are the params returned to callbacks by layout() + * @param {boolean} doPin True means set the pin 'down', False means 'up' + */ +, syncPinBtns: function (inst, pane, doPin) { + // REAL METHOD IS _INSIDE_ LAYOUT - THIS IS HERE JUST FOR REFERENCE + $.each(state[pane].pins, function (i, selector) { + $.layout.buttons.setPinState(inst, $(selector), pane, doPin); + }); + } + + +, _load: function (inst) { + // ADD Button methods to Layout Instance + $.extend( inst, { + bindButton: function (selector, action, pane) { return $.layout.buttons.bind(inst, selector, action, pane); } + // DEPRECATED METHODS... + , addToggleBtn: function (selector, pane, slide) { return $.layout.buttons.addToggle(inst, selector, pane, slide); } + , addOpenBtn: function (selector, pane, slide) { return $.layout.buttons.addOpen(inst, selector, pane, slide); } + , addCloseBtn: function (selector, pane) { return $.layout.buttons.addClose(inst, selector, pane); } + , addPinBtn: function (selector, pane) { return $.layout.buttons.addPin(inst, selector, pane); } + }); + + // init state array to hold pin-buttons + for (var i=0; i<4; i++) { + var pane = $.layout.buttons.config.borderPanes[i]; + inst.state[pane].pins = []; + } + + // auto-init buttons onLoad if option is enabled + if ( inst.options.autoBindCustomButtons ) + $.layout.buttons.init(inst); + } + +, _unload: function (inst) { + // TODO: unbind all buttons??? + } + +}; + +// add initialization method to Layout's onLoad array of functions +$.layout.onLoad.push( $.layout.buttons._load ); +//$.layout.onUnload.push( $.layout.buttons._unload ); + +})( jQuery ); + + + + +/** + * jquery.layout.browserZoom 1.0 + * $Date: 2015/03/13 22:37:04 $ + * + * Copyright (c) 2012 + * Kevin Dalman (http://allpro.net) + * + * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html) + * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses. + * + * @requires: UI Layout 1.3.0.rc30.1 or higher + * + * @see: http://groups.google.com/group/jquery-ui-layout + * + * TODO: Extend logic to handle other problematic zooming in browsers + * TODO: Add hotkey/mousewheel bindings to _instantly_ respond to these zoom event + */ +(function ($) { + +// tell Layout that the plugin is available +$.layout.plugins.browserZoom = true; + +$.layout.defaults.browserZoomCheckInterval = 1000; +$.layout.optionsMap.layout.push("browserZoomCheckInterval"); + +/* + * browserZoom methods + */ +$.layout.browserZoom = { + + _init: function (inst) { + // abort if browser does not need this check + if ($.layout.browserZoom.ratio() !== false) + $.layout.browserZoom._setTimer(inst); + } + +, _setTimer: function (inst) { + // abort if layout destroyed or browser does not need this check + if (inst.destroyed) return; + var o = inst.options + , s = inst.state + // don't need check if inst has parentLayout, but check occassionally in case parent destroyed! + // MINIMUM 100ms interval, for performance + , ms = inst.hasParentLayout ? 5000 : Math.max( o.browserZoomCheckInterval, 100 ) + ; + // set the timer + setTimeout(function(){ + if (inst.destroyed || !o.resizeWithWindow) return; + var d = $.layout.browserZoom.ratio(); + if (d !== s.browserZoom) { + s.browserZoom = d; + inst.resizeAll(); + } + // set a NEW timeout + $.layout.browserZoom._setTimer(inst); + } + , ms ); + } + +, ratio: function () { + var w = window + , s = screen + , d = document + , dE = d.documentElement || d.body + , b = $.layout.browser + , v = b.version + , r, sW, cW + ; + // we can ignore all browsers that fire window.resize event onZoom + if (!b.msie || v > 8) + return false; // don't need to track zoom + if (s.deviceXDPI && s.systemXDPI) // syntax compiler hack + return calc(s.deviceXDPI, s.systemXDPI); + // everything below is just for future reference! + if (b.webkit && (r = d.body.getBoundingClientRect)) + return calc((r.left - r.right), d.body.offsetWidth); + if (b.webkit && (sW = w.outerWidth)) + return calc(sW, w.innerWidth); + if ((sW = s.width) && (cW = dE.clientWidth)) + return calc(sW, cW); + return false; // no match, so cannot - or don't need to - track zoom + + function calc (x,y) { return (parseInt(x,10) / parseInt(y,10) * 100).toFixed(); } + } + +}; +// add initialization method to Layout's onLoad array of functions +$.layout.onReady.push( $.layout.browserZoom._init ); + + +})( jQuery ); + + + + +/** + * UI Layout Plugin: Slide-Offscreen Animation + * + * Prevent panes from being 'hidden' so that an iframes/objects + * does not reload/refresh when pane 'opens' again. + * This plug-in adds a new animation called "slideOffscreen". + * It is identical to the normal "slide" effect, but avoids hiding the element + * + * Requires Layout 1.3.0.RC30.1 or later for Close offscreen + * Requires Layout 1.3.0.RC30.5 or later for Hide, initClosed & initHidden offscreen + * + * Version: 1.1 - 2012-11-18 + * Author: Kevin Dalman (kevin@jquery-dev.com) + * @preserve jquery.layout.slideOffscreen-1.1.js + */ +;(function ($) { + +// Add a new "slideOffscreen" effect +if ($.effects) { + + // add an option so initClosed and initHidden will work + $.layout.defaults.panes.useOffscreenClose = false; // user must enable when needed + /* set the new animation as the default for all panes + $.layout.defaults.panes.fxName = "slideOffscreen"; + */ + + if ($.layout.plugins) + $.layout.plugins.effects.slideOffscreen = true; + + // dupe 'slide' effect defaults as new effect defaults + $.layout.effects.slideOffscreen = $.extend(true, {}, $.layout.effects.slide); + + // add new effect to jQuery UI + $.effects.slideOffscreen = function(o) { + return this.queue(function(){ + + var fx = $.effects + , opt = o.options + , $el = $(this) + , pane = $el.data('layoutEdge') + , state = $el.data('parentLayout').state + , dist = state[pane].size + , s = this.style + , props = ['top','bottom','left','right'] + // Set options + , mode = fx.setMode($el, opt.mode || 'show') // Set Mode + , show = (mode == 'show') + , dir = opt.direction || 'left' // Default Direction + , ref = (dir == 'up' || dir == 'down') ? 'top' : 'left' + , pos = (dir == 'up' || dir == 'left') + , offscrn = $.layout.config.offscreenCSS || {} + , keyLR = $.layout.config.offscreenReset + , keyTB = 'offscreenResetTop' // only used internally + , animation = {} + ; + // Animation settings + animation[ref] = (show ? (pos ? '+=' : '-=') : (pos ? '-=' : '+=')) + dist; + + if (show) { // show() animation, so save top/bottom but retain left/right set when 'hidden' + $el.data(keyTB, { top: s.top, bottom: s.bottom }); + + // set the top or left offset in preparation for animation + // Note: ALL animations work by shifting the top or left edges + if (pos) { // top (north) or left (west) + $el.css(ref, isNaN(dist) ? "-" + dist : -dist); // Shift outside the left/top edge + } + else { // bottom (south) or right (east) - shift all the way across container + if (dir === 'right') + $el.css({ left: state.container.layoutWidth, right: 'auto' }); + else // dir === bottom + $el.css({ top: state.container.layoutHeight, bottom: 'auto' }); + } + // restore the left/right setting if is a top/bottom animation + if (ref === 'top') + $el.css( $el.data( keyLR ) || {} ); + } + else { // hide() animation, so save ALL CSS + $el.data(keyTB, { top: s.top, bottom: s.bottom }); + $el.data(keyLR, { left: s.left, right: s.right }); + } + + // Animate + $el.show().animate(animation, { queue: false, duration: o.duration, easing: opt.easing, complete: function(){ + // Restore top/bottom + if ($el.data( keyTB )) + $el.css($el.data( keyTB )).removeData( keyTB ); + if (show) // Restore left/right too + $el.css($el.data( keyLR ) || {}).removeData( keyLR ); + else // Move the pane off-screen (left: -99999, right: 'auto') + $el.css( offscrn ); + + if (o.callback) o.callback.apply(this, arguments); // Callback + $el.dequeue(); + }}); + + }); + }; + +} + +})( jQuery ); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/modalService.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/modalService.js new file mode 100644 index 0000000..74c848e --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/modalService.js @@ -0,0 +1,185 @@ +angular.module("modalServices",[]).service('modalService', ['$modal', function ($modal) { + + + this.showSuccess = function(heading, messageBody){ + var modalInstance = $modal.open({ + templateUrl: 'modal_informative.html', + controller: 'modalpopupController', + resolve: { + message: function () { + $(".overlayed").css("display","none"); + $(".loadingId").css("display","none"); + var message = { + title: heading, + text: messageBody + }; + return message; + } + } + }); + }; + this.showFailure = function(heading, messageBody){ + var modalInstance = $modal.open({ + templateUrl: 'modal_warning.html', + controller: 'modalpopupController', + resolve: { + message: function () { + var message = { + title: heading, + text: messageBody + }; + return message; + } + } + }); + }; + + this.showMessage = function(heading, messageBody){ + var modalInstance = $modal.open({ + templateUrl: 'modal_message.html', + controller: 'modalpopupController', + resolve: { + message: function () { + var message = { + title: heading, + text: messageBody + }; + return message; + } + } + }); + }; + + this.showWarning = function(heading, messageBody){ + var modalInstance = $modal.open({ + templateUrl: 'modal_warning_message.html', + controller: 'modalpopupController', + resolve: { + message: function () { + var message = { + title: heading, + text: messageBody + }; + return message; + } + } + }); + }; + + this.popupConfirmWin = function(title, msgBody, callback){ + var modalInstance = $modal.open({ + templateUrl: 'confirmation_informative.html', + controller: 'modalpopupController', + resolve: { + message: function () { + var message = { + title: title, + text: msgBody + }; + return message; + } + } + }); + var args = Array.prototype.slice.call( arguments, 0 ); + args.splice( 0, 3); + modalInstance.result.then(function(){ + callback.apply(null, args); + }, function() { + })['finally'](function(){ + modalInstance = undefined; + }); + + }; + this.popupConfirmWinWithCancel = function(title, msgBody, callback,dismissCallback){ + var modalInstance = $modal.open({ + templateUrl: 'confirmation_informative.html', + controller: 'modalpopupController', + resolve: { + message: function () { + var message = { + title: title, + text: msgBody + }; + return message; + } + } + }); + var args = Array.prototype.slice.call( arguments, 0 ); + args.splice( 0, 3); + modalInstance.result.then(function(){ + callback.apply(null, args); + }, function() { + dismissCallback(); + })['finally'](function(){ + modalInstance = undefined; + }); + + }; + this.popupDeleteConfirmWin = function(title, msgBody, callback, argForCallBack){ + var modalInstance = $modal.open({ + templateUrl: 'confirmation_for_delete.html', + controller: 'modalpopupController', + resolve: { + message: function () { + var message = { + title: title, + text: msgBody + }; + return message; + } + } + }); + + modalInstance.result.then(function(){ + callback(argForCallBack); + }, function() { + })['finally'](function(){ + modalInstance = undefined; + }); + + }; + + this.popupSuccessRedirectWin = function(title, msgBody, redirectUrl){ + var modalInstance = $modal.open({ + templateUrl: 'modal_informative.html', + controller: 'modalpopupController', + resolve: { + message: function () { + var message = { + title: title, + text: msgBody + }; + return message; + } + } + }); + modalInstance.result.then(function() { + }, function() { + window.location.href=redirectUrl; + })['finally'](function(){ + modalInstance = undefined; + }); + }; + + this.popupWarningRedirectWin = function(title, msgBody, redirectUrl){ + var modalInstance = $modal.open({ + templateUrl: 'modal_warning_message.html', + controller: 'modalpopupController', + resolve: { + message: function () { + var message = { + title: title, + text: msgBody + }; + return message; + } + } + }); + modalInstance.result.then(function() { + }, function() { + window.location.href=redirectUrl; + })['finally'](function(){ + modalInstance = undefined; + }); + }; + }]); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/moment.min.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/moment.min.js new file mode 100644 index 0000000..62b1697 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/moment.min.js @@ -0,0 +1,6 @@ +// moment.js +// version : 2.1.0 +// author : Tim Wood +// license : MIT +// momentjs.com +!function(t){function e(t,e){return function(n){return u(t.call(this,n),e)}}function n(t,e){return function(n){return this.lang().ordinal(t.call(this,n),e)}}function s(){}function i(t){a(this,t)}function r(t){var e=t.years||t.year||t.y||0,n=t.months||t.month||t.M||0,s=t.weeks||t.week||t.w||0,i=t.days||t.day||t.d||0,r=t.hours||t.hour||t.h||0,a=t.minutes||t.minute||t.m||0,o=t.seconds||t.second||t.s||0,u=t.milliseconds||t.millisecond||t.ms||0;this._input=t,this._milliseconds=u+1e3*o+6e4*a+36e5*r,this._days=i+7*s,this._months=n+12*e,this._data={},this._bubble()}function a(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function o(t){return 0>t?Math.ceil(t):Math.floor(t)}function u(t,e){for(var n=t+"";n.lengthn;n++)~~t[n]!==~~e[n]&&r++;return r+i}function f(t){return t?ie[t]||t.toLowerCase().replace(/(.)s$/,"$1"):t}function l(t,e){return e.abbr=t,x[t]||(x[t]=new s),x[t].set(e),x[t]}function _(t){if(!t)return H.fn._lang;if(!x[t]&&A)try{require("./lang/"+t)}catch(e){return H.fn._lang}return x[t]}function m(t){return t.match(/\[.*\]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function y(t){var e,n,s=t.match(E);for(e=0,n=s.length;n>e;e++)s[e]=ue[s[e]]?ue[s[e]]:m(s[e]);return function(i){var r="";for(e=0;n>e;e++)r+=s[e]instanceof Function?s[e].call(i,t):s[e];return r}}function M(t,e){function n(e){return t.lang().longDateFormat(e)||e}for(var s=5;s--&&N.test(e);)e=e.replace(N,n);return re[e]||(re[e]=y(e)),re[e](t)}function g(t,e){switch(t){case"DDDD":return V;case"YYYY":return X;case"YYYYY":return $;case"S":case"SS":case"SSS":case"DDD":return I;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return R;case"a":case"A":return _(e._l)._meridiemParse;case"X":return B;case"Z":case"ZZ":return j;case"T":return q;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return J;default:return new RegExp(t.replace("\\",""))}}function p(t){var e=(j.exec(t)||[])[0],n=(e+"").match(ee)||["-",0,0],s=+(60*n[1])+~~n[2];return"+"===n[0]?-s:s}function D(t,e,n){var s,i=n._a;switch(t){case"M":case"MM":i[1]=null==e?0:~~e-1;break;case"MMM":case"MMMM":s=_(n._l).monthsParse(e),null!=s?i[1]=s:n._isValid=!1;break;case"D":case"DD":case"DDD":case"DDDD":null!=e&&(i[2]=~~e);break;case"YY":i[0]=~~e+(~~e>68?1900:2e3);break;case"YYYY":case"YYYYY":i[0]=~~e;break;case"a":case"A":n._isPm=_(n._l).isPM(e);break;case"H":case"HH":case"h":case"hh":i[3]=~~e;break;case"m":case"mm":i[4]=~~e;break;case"s":case"ss":i[5]=~~e;break;case"S":case"SS":case"SSS":i[6]=~~(1e3*("0."+e));break;case"X":n._d=new Date(1e3*parseFloat(e));break;case"Z":case"ZZ":n._useUTC=!0,n._tzm=p(e)}null==e&&(n._isValid=!1)}function Y(t){var e,n,s=[];if(!t._d){for(e=0;7>e;e++)t._a[e]=s[e]=null==t._a[e]?2===e?1:0:t._a[e];s[3]+=~~((t._tzm||0)/60),s[4]+=~~((t._tzm||0)%60),n=new Date(0),t._useUTC?(n.setUTCFullYear(s[0],s[1],s[2]),n.setUTCHours(s[3],s[4],s[5],s[6])):(n.setFullYear(s[0],s[1],s[2]),n.setHours(s[3],s[4],s[5],s[6])),t._d=n}}function w(t){var e,n,s=t._f.match(E),i=t._i;for(t._a=[],e=0;eo&&(u=o,s=n);a(t,s)}function v(t){var e,n=t._i,s=K.exec(n);if(s){for(t._f="YYYY-MM-DD"+(s[2]||" "),e=0;4>e;e++)if(te[e][1].exec(n)){t._f+=te[e][0];break}j.exec(n)&&(t._f+=" Z"),w(t)}else t._d=new Date(n)}function T(e){var n=e._i,s=G.exec(n);n===t?e._d=new Date:s?e._d=new Date(+s[1]):"string"==typeof n?v(e):d(n)?(e._a=n.slice(0),Y(e)):e._d=n instanceof Date?new Date(+n):new Date(n)}function b(t,e,n,s,i){return i.relativeTime(e||1,!!n,t,s)}function S(t,e,n){var s=W(Math.abs(t)/1e3),i=W(s/60),r=W(i/60),a=W(r/24),o=W(a/365),u=45>s&&["s",s]||1===i&&["m"]||45>i&&["mm",i]||1===r&&["h"]||22>r&&["hh",r]||1===a&&["d"]||25>=a&&["dd",a]||45>=a&&["M"]||345>a&&["MM",W(a/30)]||1===o&&["y"]||["yy",o];return u[2]=e,u[3]=t>0,u[4]=n,b.apply({},u)}function F(t,e,n){var s,i=n-e,r=n-t.day();return r>i&&(r-=7),i-7>r&&(r+=7),s=H(t).add("d",r),{week:Math.ceil(s.dayOfYear()/7),year:s.year()}}function O(t){var e=t._i,n=t._f;return null===e||""===e?null:("string"==typeof e&&(t._i=e=_().preparse(e)),H.isMoment(e)?(t=a({},e),t._d=new Date(+e._d)):n?d(n)?k(t):w(t):T(t),new i(t))}function z(t,e){H.fn[t]=H.fn[t+"s"]=function(t){var n=this._isUTC?"UTC":"";return null!=t?(this._d["set"+n+e](t),H.updateOffset(this),this):this._d["get"+n+e]()}}function C(t){H.duration.fn[t]=function(){return this._data[t]}}function L(t,e){H.duration.fn["as"+t]=function(){return+this/e}}for(var H,P,U="2.1.0",W=Math.round,x={},A="undefined"!=typeof module&&module.exports,G=/^\/?Date\((\-?\d+)/i,Z=/(\-)?(\d*)?\.?(\d+)\:(\d+)\:(\d+)\.?(\d{3})?/,E=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,N=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,J=/\d\d?/,I=/\d{1,3}/,V=/\d{3}/,X=/\d{1,4}/,$=/[+\-]?\d{1,6}/,R=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,j=/Z|[\+\-]\d\d:?\d\d/i,q=/T/i,B=/[\+\-]?\d+(\.\d{1,3})?/,K=/^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,Q="YYYY-MM-DDTHH:mm:ssZ",te=[["HH:mm:ss.S",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],ee=/([\+\-]|\d\d)/gi,ne="Date|Hours|Minutes|Seconds|Milliseconds".split("|"),se={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},ie={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",w:"week",M:"month",y:"year"},re={},ae="DDD w W M D d".split(" "),oe="M D H h m s w W".split(" "),ue={M:function(){return this.month()+1},MMM:function(t){return this.lang().monthsShort(this,t)},MMMM:function(t){return this.lang().months(this,t)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(t){return this.lang().weekdaysMin(this,t)},ddd:function(t){return this.lang().weekdaysShort(this,t)},dddd:function(t){return this.lang().weekdays(this,t)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return u(this.year()%100,2)},YYYY:function(){return u(this.year(),4)},YYYYY:function(){return u(this.year(),5)},gg:function(){return u(this.weekYear()%100,2)},gggg:function(){return this.weekYear()},ggggg:function(){return u(this.weekYear(),5)},GG:function(){return u(this.isoWeekYear()%100,2)},GGGG:function(){return this.isoWeekYear()},GGGGG:function(){return u(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return u(~~(this.milliseconds()/10),2)},SSS:function(){return u(this.milliseconds(),3)},Z:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+u(~~(t/60),2)+":"+u(~~t%60,2)},ZZ:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+u(~~(10*t/6),4)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()}};ae.length;)P=ae.pop(),ue[P+"o"]=n(ue[P],P);for(;oe.length;)P=oe.pop(),ue[P+P]=e(ue[P],2);for(ue.DDDD=e(ue.DDD,3),s.prototype={set:function(t){var e,n;for(n in t)e=t[n],"function"==typeof e?this[n]=e:this["_"+n]=e},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(t){return this._months[t.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(t){return this._monthsShort[t.month()]},monthsParse:function(t){var e,n,s;for(this._monthsParse||(this._monthsParse=[]),e=0;12>e;e++)if(this._monthsParse[e]||(n=H([2e3,e]),s="^"+this.months(n,"")+"|^"+this.monthsShort(n,""),this._monthsParse[e]=new RegExp(s.replace(".",""),"i")),this._monthsParse[e].test(t))return e},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(t){return this._weekdays[t.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(t){return this._weekdaysShort[t.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(t){return this._weekdaysMin[t.day()]},weekdaysParse:function(t){var e,n,s;for(this._weekdaysParse||(this._weekdaysParse=[]),e=0;7>e;e++)if(this._weekdaysParse[e]||(n=H([2e3,1]).day(e),s="^"+this.weekdays(n,"")+"|^"+this.weekdaysShort(n,"")+"|^"+this.weekdaysMin(n,""),this._weekdaysParse[e]=new RegExp(s.replace(".",""),"i")),this._weekdaysParse[e].test(t))return e},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(t){var e=this._longDateFormat[t];return!e&&this._longDateFormat[t.toUpperCase()]&&(e=this._longDateFormat[t.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t]=e),e},isPM:function(t){return"p"===(t+"").toLowerCase()[0]},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(t,e){var n=this._calendar[t];return"function"==typeof n?n.apply(e):n},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(t,e,n,s){var i=this._relativeTime[n];return"function"==typeof i?i(t,e,n,s):i.replace(/%d/i,t)},pastFuture:function(t,e){var n=this._relativeTime[t>0?"future":"past"];return"function"==typeof n?n(e):n.replace(/%s/i,e)},ordinal:function(t){return this._ordinal.replace("%d",t)},_ordinal:"%d",preparse:function(t){return t},postformat:function(t){return t},week:function(t){return F(t,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6}},H=function(t,e,n){return O({_i:t,_f:e,_l:n,_isUTC:!1})},H.utc=function(t,e,n){return O({_useUTC:!0,_isUTC:!0,_l:n,_i:t,_f:e})},H.unix=function(t){return H(1e3*t)},H.duration=function(t,e){var n,s,i=H.isDuration(t),a="number"==typeof t,o=i?t._input:a?{}:t,u=Z.exec(t);return a?e?o[e]=t:o.milliseconds=t:u&&(n="-"===u[1]?-1:1,o={y:0,d:~~u[2]*n,h:~~u[3]*n,m:~~u[4]*n,s:~~u[5]*n,ms:~~u[6]*n}),s=new r(o),i&&t.hasOwnProperty("_lang")&&(s._lang=t._lang),s},H.version=U,H.defaultFormat=Q,H.updateOffset=function(){},H.lang=function(t,e){return t?(e?l(t,e):x[t]||_(t),H.duration.fn._lang=H.fn._lang=_(t),void 0):H.fn._lang._abbr},H.langData=function(t){return t&&t._lang&&t._lang._abbr&&(t=t._lang._abbr),_(t)},H.isMoment=function(t){return t instanceof i},H.isDuration=function(t){return t instanceof r},H.fn=i.prototype={clone:function(){return H(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){return M(H(this).utc(),"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var t=this;return[t.year(),t.month(),t.date(),t.hours(),t.minutes(),t.seconds(),t.milliseconds()]},isValid:function(){return null==this._isValid&&(this._isValid=this._a?!c(this._a,(this._isUTC?H.utc(this._a):H(this._a)).toArray()):!isNaN(this._d.getTime())),!!this._isValid},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(t){var e=M(this,t||H.defaultFormat);return this.lang().postformat(e)},add:function(t,e){var n;return n="string"==typeof t?H.duration(+e,t):H.duration(t,e),h(this,n,1),this},subtract:function(t,e){var n;return n="string"==typeof t?H.duration(+e,t):H.duration(t,e),h(this,n,-1),this},diff:function(t,e,n){var s,i,r=this._isUTC?H(t).zone(this._offset||0):H(t).local(),a=6e4*(this.zone()-r.zone());return e=f(e),"year"===e||"month"===e?(s=432e5*(this.daysInMonth()+r.daysInMonth()),i=12*(this.year()-r.year())+(this.month()-r.month()),i+=(this-H(this).startOf("month")-(r-H(r).startOf("month")))/s,i-=6e4*(this.zone()-H(this).startOf("month").zone()-(r.zone()-H(r).startOf("month").zone()))/s,"year"===e&&(i/=12)):(s=this-r,i="second"===e?s/1e3:"minute"===e?s/6e4:"hour"===e?s/36e5:"day"===e?(s-a)/864e5:"week"===e?(s-a)/6048e5:s),n?i:o(i)},from:function(t,e){return H.duration(this.diff(t)).lang(this.lang()._abbr).humanize(!e)},fromNow:function(t){return this.from(H(),t)},calendar:function(){var t=this.diff(H().startOf("day"),"days",!0),e=-6>t?"sameElse":-1>t?"lastWeek":0>t?"lastDay":1>t?"sameDay":2>t?"nextDay":7>t?"nextWeek":"sameElse";return this.format(this.lang().calendar(e,this))},isLeapYear:function(){var t=this.year();return 0===t%4&&0!==t%100||0===t%400},isDST:function(){return this.zone()+H(t).startOf(e)},isBefore:function(t,e){return e="undefined"!=typeof e?e:"millisecond",+this.clone().startOf(e)<+H(t).startOf(e)},isSame:function(t,e){return e="undefined"!=typeof e?e:"millisecond",+this.clone().startOf(e)===+H(t).startOf(e)},min:function(t){return t=H.apply(null,arguments),this>t?this:t},max:function(t){return t=H.apply(null,arguments),t>this?this:t},zone:function(t){var e=this._offset||0;return null==t?this._isUTC?e:this._d.getTimezoneOffset():("string"==typeof t&&(t=p(t)),Math.abs(t)<16&&(t=60*t),this._offset=t,this._isUTC=!0,e!==t&&h(this,H.duration(e-t,"m"),1,!0),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},daysInMonth:function(){return H.utc([this.year(),this.month()+1,0]).date()},dayOfYear:function(t){var e=W((H(this).startOf("day")-H(this).startOf("year"))/864e5)+1;return null==t?e:this.add("d",t-e)},weekYear:function(t){var e=F(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==t?e:this.add("y",t-e)},isoWeekYear:function(t){var e=F(this,1,4).year;return null==t?e:this.add("y",t-e)},week:function(t){var e=this.lang().week(this);return null==t?e:this.add("d",7*(t-e))},isoWeek:function(t){var e=F(this,1,4).week;return null==t?e:this.add("d",7*(t-e))},weekday:function(t){var e=(this._d.getDay()+7-this.lang()._week.dow)%7;return null==t?e:this.add("d",t-e)},isoWeekday:function(t){return null==t?this.day()||7:this.day(this.day()%7?t:t-7)},lang:function(e){return e===t?this._lang:(this._lang=_(e),this)}},P=0;PERROR: ' + evt.data); +} + +function writeToScreen(message) { + var pre = document.createElement("p"); + pre.style.wordWrap = "break-word"; + pre.innerHTML = message; + output.append(pre); +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/page-resource.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/page-resource.js new file mode 100644 index 0000000..8449ecf --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/page-resource.js @@ -0,0 +1,95 @@ +function loadjscssfile(filename, filetype){ + if (filetype=="js"){ //if filename is a external JavaScript file + var done = false; + var script = document.createElement('script'); + script.src = filename; + script.async = false; + document.head.appendChild(script); + }else if (filetype=="css"){ //if filename is an external CSS file + var fileref=document.createElement("link") + fileref.setAttribute("rel", "stylesheet") + fileref.setAttribute("type", "text/css") + fileref.setAttribute("async", false) + fileref.setAttribute("href", filename) + document.head.appendChild(fileref); + } +} + +function loadResource(){ + //css + loadjscssfile("app/fusion/external/ebz/fn-ebz.css", "css"); + loadjscssfile("app/fusion/external/ebz/sandbox/styles/demo.css", "css"); + loadjscssfile("app/fusion/external/ebz/sandbox/styles/base.css", "css"); + loadjscssfile("app/fusion/external/ebz/sandbox/styles/btn.css", "css"); + loadjscssfile("app/fusion/external/ebz/sandbox/styles/dtpk.css", "css"); + loadjscssfile("app/fusion/external/ebz/sandbox/styles/frms.css", "css"); + loadjscssfile("app/fusion/external/ebz/sandbox/styles/sldr.css", "css"); + loadjscssfile("app/fusion/external/ebz/sandbox/styles/style.css", "css"); + loadjscssfile("app/fusion/external/ebz/sandbox/styles/tbs.css", "css"); + loadjscssfile("app/fusion/external/ebz/ebz_header/portal_ebz_header.css", "css"); + loadjscssfile("static/fusion/css/jquery-ui.css", "css"); + + + loadjscssfile("app/fusion/external/ebz/ebz_header/header.css", "css"); + loadjscssfile("app/fusion/external/ebz/ebz_header/footer.css", "css"); + // Basic AngularJS --> + loadjscssfile("app/fusion/external/ebz/angular_js/angular.js", "js"); + loadjscssfile("app/fusion/external/ebz/angular_js/angular-sanitize.js", "js"); + loadjscssfile("app/fusion/external/ebz/angular_js/angular-route.min.js", "js"); + loadjscssfile("app/fusion/external/ebz/angular_js/angular-cookies.js", "js"); + loadjscssfile("app/fusion/external/ebz/angular_js/gestures.js", "js"); + loadjscssfile("app/fusion/external/ebz/angular_js/app.js", "js"); + + loadjscssfile("app/fusion/external/ebz/sandbox/att-abs-tpls.js", "js"); + + // jQuery --> + loadjscssfile("static/js/jquery-1.10.2.js", "js"); + loadjscssfile("static/js/jquery.mask.min.js", "js"); + loadjscssfile("static/js/jquery-ui.js", "js"); + + // AngularJS Gridster --> + loadjscssfile("static/fusion/js/att_angular_gridster/ui-gridster-tpls.js", "js"); + loadjscssfile("static/fusion/js/att_angular_gridster/angular-gridster.js", "js"); + + // AngularJS Config --> + loadjscssfile("app/fusion/external/ebz/angular_js/checklist-model.js", "js"); + + // Utility --> + loadjscssfile("app/fusion/scripts/modalService.js", "js"); + loadjscssfile("app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js", "js"); + + // Controller js --> + loadjscssfile("app/fusion/scripts/controllers/profile-search-controller.js", "js"); + loadjscssfile("app/fusion/scripts/controllers/profile-controller.js", "js"); + loadjscssfile("app/fusion/scripts/controllers/post-search-controller.js", "js"); + loadjscssfile("app/fusion/scripts/controllers/self-profile-controller.js", "js"); + loadjscssfile("app/fusion/scripts/controllers/rolefunctionpopupController.js", "js"); + loadjscssfile("app/fusion/scripts/controllers/modelpopupController.js", "js"); + + // Header and Footer --> + loadjscssfile("app/fusion/scripts/directives/footer.js", "js"); + loadjscssfile("app/fusion/external/ebz/js/footer.js", "js"); + loadjscssfile("app/fusion/scripts/directives/header.js", "js"); + loadjscssfile("app/fusion/scripts/directives/leftMenu.js", "js"); + + // Services --> + loadjscssfile("app/fusion/scripts/services/profileService.js", "js"); + loadjscssfile("app/fusion/scripts/services/userInfoService.js", "js"); + loadjscssfile("app/fusion/scripts/services/leftMenuService.js", "js"); + loadjscssfile("app/fusion/scripts/controllers/profileController.js", "js"); +} + +window.onload = loadResource(); +window.onload = function(){ + var appLoadingInterval = setInterval(function(){ loadApp() }, 500); + var count=0; + function loadApp(){ + count++ + if(typeof angular !== 'undefined') { + angular.bootstrap(document, ['abs']); + clearInterval(appLoadingInterval); + }else if(count>10){ + clearInterval(appLoadingInterval); + } + } +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/sandbox-resources.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/sandbox-resources.html new file mode 100644 index 0000000..d04eba9 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/utils/sandbox-resources.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/admin-page/admin.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/admin-page/admin.html new file mode 100644 index 0000000..f83888d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/admin-page/admin.html @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +
        +
        +
        +
        +
        +
        +
        + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/admin-page/profile.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/admin-page/profile.html new file mode 100644 index 0000000..56c06eb --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/admin-page/profile.html @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + +
        +
        +
        +
        +
        +
        + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/footer.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/footer.html new file mode 100644 index 0000000..5614873 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/footer.html @@ -0,0 +1,42 @@ + + +
        + +
        +
        + +
        + +
        +
        +
        + + +
        +
        + +
        +
        +
        +
        +
        +
        + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/header.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/header.html new file mode 100644 index 0000000..adb5be3 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/header.html @@ -0,0 +1,186 @@ + +
        +
        +
        +
        +
        + + +
        +
        +
        +
        +
      • +
        + ECOMP Portal +
      • +
        +
        + + +
        + + +
        + +
        +
        +
        +
      • + Unable to load menus +
      • +
        +
      • +
        + + +
        +
      • +
      •  
      • +
        + +
        + +
        +
        +
        +
        +
        +
        +
        +
        + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/left_menu.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/left_menu.html new file mode 100644 index 0000000..84ee6ea --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/left_menu.html @@ -0,0 +1,41 @@ + +
        + + + +     {{app_name}} + +
        +
        +
        +
        + + + + + +
        +
        +
        +
        +
        \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/admin_menu_edit.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/admin_menu_edit.html new file mode 100644 index 0000000..ee23635 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/admin_menu_edit.html @@ -0,0 +1,175 @@ + + +
        +
        +
        +

        Admin Menu Items

        +
        +
        + Add menu item here: +
        +
        + +
        +
        +
        + Existing menu items: +
        +
        + + + +
        +
      + +
      +
      + + + +
      Number of records to show: +
      + +
      +
      + + + + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/broadcast.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/broadcast.html new file mode 100644 index 0000000..a14da05 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/broadcast.html @@ -0,0 +1,61 @@ + +
      +
      +

      Broadcast Message Edit

      +
      + +
      + Please edit the broadcast message details below: 

      +
      +
      + +
      +
      +
      +
      + + +
      + +
      +
      + + +
      + +
      +
      + +
      + +
      +
      +
      +
      + +
      +
      + + +
      +
      +
      diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/broadcast_list.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/broadcast_list.html new file mode 100644 index 0000000..e9c4c29 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/broadcast_list.html @@ -0,0 +1,71 @@ + +
      + +
      + +

      Broadcast Messages

      +
      +
      + {{location.label}} Messages +
      + + + + + + + + + + + + + + + + + {{message.id}} + + + + + + + + + + + +
      No.Message TextStart DateEnd DateSort OrderServerActive?Delete?
      {{$index+1}}{{message.messageText}} + {{message.displayStartDate}} + {{message.displayEndDate}}{{message.sortOrder}}{{message.siteCd}} +
      + +
      +
      +
      +
      +
      + +


      +
      +
      +
      diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/collaborate_list.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/collaborate_list.html new file mode 100644 index 0000000..5f07a47 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/collaborate_list.html @@ -0,0 +1,57 @@ + +
      +
      +

      User List

      +
      + + + + + + + + + + + + + + + + + + + + + + +
      User IDLast NameFirst NameEmailUser IDOnline/Offline
      {{rowData.id}}{{rowData.lastName}}{{rowData.firstName}}{{rowData.email}}{{rowData.orgUserId}} + Offline + Online +
      +
      +
      + + + + Add the Chrome Extension for DescktopCapture and refresh page +
      +
      diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/jcs_admin.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/jcs_admin.html new file mode 100644 index 0000000..7da4578 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/jcs_admin.html @@ -0,0 +1,87 @@ + +
      + +

      Cache Regions

      +
      +
      + These are the regions which are currently defined in the cache. 'Items' and 'Bytes' refer to the elements currently in memory (not spooled). + You can clear all items for a region by clicking on the Clear icon next to the desired region below. You can also clear all regions + which empties the entire cache. +
      + +
      +
      +
      Cache Name
      +
      # of Items
      +
      Bytes
      +
      Status
      +
      Memory Hits
      +
      Aux Hits
      +
      Not Found Misses
      +
      Expired Misses
      +
      Clear?
      +
      Items
      +
      +
      +
      + +
      {{region.size}}
      +
      {{region.byteCount}}
      +
      {{region.status}}
      +
      {{region.hitCountRam}}
      +
      {{region.hitCountAux}}
      +
      {{region.missCountNotFound}}
      +
      {{region.missCountExpired}}
      +
      +
      +
      +
      + + +
      +
      +
      + +
      Key
      +
      Eternal?
      +
      Created
      +
      Max Life
      +
      Expires
      +
      Clear?
      +
      +
      +
      + + +
      {{item.eternal}}
      +
      {{item.createTime}}
      +
      {{item.maxLifeSeconds}}
      +
      {{item.expiresInSeconds}}
      +
      +
      +
      +
      +
      +
      +
      +
      +
      diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal.html new file mode 100644 index 0000000..3cde902 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal.html @@ -0,0 +1,282 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_add.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_add.html new file mode 100644 index 0000000..760f10b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_add.html @@ -0,0 +1,155 @@ + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_edit.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_edit.html new file mode 100644 index 0000000..4c23ba6 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_fn_menu_edit.html @@ -0,0 +1,148 @@ + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_role.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_role.html new file mode 100644 index 0000000..4663bd4 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_role.html @@ -0,0 +1,82 @@ + + + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_rolefunction.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_rolefunction.html new file mode 100644 index 0000000..b9e8ef0 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/popup_modal_rolefunction.html @@ -0,0 +1,46 @@ + + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/post_search.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/post_search.html new file mode 100644 index 0000000..2c4846d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/post_search.html @@ -0,0 +1,139 @@ + +
      +

      User Search

      +
      + Please enter search criteria below:
      + +
      + Last Name:
      + +
      + +
      + First Name:
      + +
      + +
      + User ID:
      + +
      + +
      + Manager User ID:
      + +
      +
      +
      + Organization:
      + +
      + +
      + Email:
      + +
      +
      +
      + + + +
      +
      + + {{noResultsString}} + +
      + + + + + + + + + + + + + + + + + + + + + + + + + +
      NoNameOrgUserIdOrganizationPhoneEmailImport?
      + {{$index + 1}} + +
      + {{profile.lastName}}, {{profile.firstName}} +
      + + +
      + {{profile.orgUserId}} + + {{profile.orgCode}} + + {{profile.phone}} + + {{profile.email}} + +
      +
      + +
      +
      +
      + Exists +
      +
      +
      + Rows Per Page: + +
      +
      + Current Page: + +
      +
      + Total Page(s): + +
      + +
      + +
      + +
      + +
      diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/profile_detail.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/profile_detail.html new file mode 100644 index 0000000..c5ef97a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/profile_detail.html @@ -0,0 +1,188 @@ + +
      +
      +

      Profile Edit

      +
      + Please edit the profile details below: 

      + +
      +
      + +
      + +
      +
      + +
      + +
      +
      + +
      +   +
      +
      + +
      +
      +
      +
      + +
      + +
      +
      + +
      + +
      +
      + +
      + +
      +
      + +
      +
      +
      +
      + +
      + +
      +
      + +
      + +
      +
      + +
      + +
      +
      + +
      +
      +
      +
      + +
      + +
      +
      +
      +
      + +
      +
      + +
      + +
      +
      +
      +
      +
      +
      +
      +
      +
      + +
      + +
      + +
      +
      + + + +
      + + + + + + + + + + + + + + + + +
      NameRemove?
      {{ role.name }} + +
      + + + + + + +
      diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/profile_search.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/profile_search.html new file mode 100644 index 0000000..9f49a80 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/profile_search.html @@ -0,0 +1,72 @@ + +
      + +

      Profile Search

      + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      User IDLast NameFirst NameEmailUser IDManager User IDEditActive?
      +
      + +
      +
      + +
      + Records Per Page: + +
      + + + + +
      + +
      diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role.html new file mode 100644 index 0000000..c312f5b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role.html @@ -0,0 +1,118 @@ + +
      +
      + +
      +

      Role Edit

      +
      +
      + Please edit the role details below: 
      + +
      +
      + +
      + +
      +
      + +
      + +
      + +
      + +
      +
      + + +
      + + + + + + + + + + + + + + +
      NameRemove?
      {{ roleFunction.name }} +
      +
      + Manage Role Functions

      + +
      + + +
      + + + + + + + + + + + + + + +
      NameRemove?
      {{ role.name }} +
      +
      + +
      + + + + + + + + + + + + + + +
      Role
      +
      + +
      +
      {{ availableRole.name }}
      +
      +
      +
      diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role_function_list.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role_function_list.html new file mode 100644 index 0000000..b085103 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role_function_list.html @@ -0,0 +1,88 @@ + +
      +
      + +

      Role Functions

      +
      + +
      + +
      +

      + +
      + +
      +
      + Click on the edit icon to update a role function, the plus icon to add additional role functions, or the delete icon to remove them. +
      +
      +
      + + + + + + + + + + + + + + + + + +
      NameCodeEdit?Delete?
      + +
      +
      + +
      +
      +
      + + +
      + +
      +
      + +
      +
      +
      +
      + +
      +
      + + +
      + +
      diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role_list.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role_list.html new file mode 100644 index 0000000..1100cbb --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/role_list.html @@ -0,0 +1,61 @@ + +
      + +

      Roles

      +
      +
      +Click on a Role to view its details. + +
      +
      + + + + + + + + + + + + + + + + + + +
      NamePriorityActive?Delete?
      {{ availableRole.name }}{{ availableRole.priority }} +
      + +
      +
      +
      +
      +
      + +
      + +
      + +
      diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/self_profile.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/self_profile.html new file mode 100644 index 0000000..bc8ddd2 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/self_profile.html @@ -0,0 +1,183 @@ + + + +

      Self Profile

      +
      + Please edit the profile details below: 

      + +
      +
      + +
      + +
      +
      + +
      + +
      +
      + +
      + +
      +
      + +
      +
      +
      +
      + +
      + +
      +
      + +
      + +
      +
      + +
      + +
      +
      + +
      +
      +
      +
      + +
      + +
      +
      + +
      + +
      +
      + +
      + +
      +
      + +
      +
      +
      +
      + +
      + +
      +
      +
      +
      + +
      +
      + +
      + +
      +
      +
      +
      +
      +
      +
      +
      +
      + +
      + +
      + +
      +
      + + + +
      + + + + + + + + + + + + + + + + +
      NameRemove?
      {{ role.name }} + +
      + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/usage_list.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/usage_list.html new file mode 100644 index 0000000..27ae72b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/profile-page/usage_list.html @@ -0,0 +1,64 @@ + +
      +
      +

      Users

      +
      + +
      + The following shows all users currently logged into the application. Click the icon to expel a user from the application. +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Current User Sessions
      User IdUser NameEmailLast Access Time (minutes)Time Remaining (minutes)Expire User Session?
      {{user.id}}{{user.lastName}}{{user.email}}{{user.lastAccess}}{{user.remaining}}
      Current Session
      + +
      +
      +
      +
      diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-landing.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-landing.html new file mode 100644 index 0000000..2b5e3b6 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-landing.html @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      +
      +
      +
      +
      +
      +
      + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-listing.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-listing.html new file mode 100644 index 0000000..ceb8867 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-listing.html @@ -0,0 +1,85 @@ + +
      +
      +
      +
      +

      +

      +
      +
      +
      +
      + +
      +
      +
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      IdNameKeyDescriptionWorkflow Server URLViewActiveCreated Created ByActionScheduleEditDelete?
      {{workflow.id}}{{workflow.name}}{{workflow.workflowKey}}{{workflow.description}}{{workflow.runLink}}
      {{workflow.active}}{{workflow.created}}{{workflow.createdBy}}
      +
      + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-new.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-new.html new file mode 100644 index 0000000..4622b92 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-new.html @@ -0,0 +1,108 @@ + +
      + +
      +
      + +
      + + +
      + + +
      + Workflow Name is required !!! +
      + +
      +
      + + +
      + +
      + + +
      + Workflow Key is required !!! +
      + +
      +
      + + +
      + + +
      + +
      +
      + +
      + +
      + +
      + +
      + Run Link is required !!! + Not valid url! +
      + +
      + + + +
      + +
      + + + Active + Inactive + + +
      +
      + + +
      +
      +
      +
      diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-preview.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-preview.html new file mode 100644 index 0000000..80fece4 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-preview.html @@ -0,0 +1,36 @@ + +
      + +
      +
      + +
      + +
      + +
      +
      +
      +
      diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-remove.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-remove.html new file mode 100644 index 0000000..e21efad --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-remove.html @@ -0,0 +1,38 @@ + +
      + +
      +
      + +
      + +
      + + +
      +
      +
      +
      diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-schedule.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-schedule.html new file mode 100644 index 0000000..aebc04f --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/view-models/workflows/workflow-schedule.html @@ -0,0 +1,116 @@ + +
      + + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + : + + + + + + + +
      + + +
      +
      +
      + + +Pick a date: + +Hour: + +Minute: +
      +
      + +
      +
      + + + +
      +
      +
      +
      +
      + +
      +
      + + +
      +
      +
      +
      + + + +
      +
      +
      diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/webrtc/RTCMultiConnection.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/webrtc/RTCMultiConnection.js new file mode 100644 index 0000000..449e8d5 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/webrtc/RTCMultiConnection.js @@ -0,0 +1,6788 @@ +// Last time updated at Monday, December 21st, 2015, 5:25:26 PM + +// Quick-Demo for newbies: http://jsfiddle.net/c46de0L8/ +// Another simple demo: http://jsfiddle.net/zar6fg60/ + +// Latest file can be found here: https://cdn.webrtc-experiment.com/RTCMultiConnection.js + +// Muaz Khan - www.MuazKhan.com +// MIT License - www.WebRTC-Experiment.com/licence +// Documentation - www.RTCMultiConnection.org/docs +// FAQ - www.RTCMultiConnection.org/FAQ +// Changes log - www.RTCMultiConnection.org/changes-log/ +// Demos - www.WebRTC-Experiment.com/RTCMultiConnection + +// _________________________ +// RTCMultiConnection-v2.2.2 + +(function() { + + // RMC == RTCMultiConnection + // usually page-URL is used as channel-id + // you can always override it! + // www.RTCMultiConnection.org/docs/channel-id/ + window.RMCDefaultChannel = location.href.replace(/\/|:|#|\?|\$|\^|%|\.|`|~|!|\+|@|\[|\||]|\|*. /g, '').split('\n').join('').split('\r').join(''); + + // www.RTCMultiConnection.org/docs/constructor/ + window.RTCMultiConnection = function(channel) { + // an instance of constructor + var connection = this; + + // a reference to RTCMultiSession + var rtcMultiSession; + + // setting default channel or channel passed through constructor + connection.channel = channel || RMCDefaultChannel; + + // to allow single user to join multiple rooms; + // you can change this property at runtime! + connection.isAcceptNewSession = true; + + // www.RTCMultiConnection.org/docs/open/ + connection.open = function(args) { + connection.isAcceptNewSession = false; + + // www.RTCMultiConnection.org/docs/session-initiator/ + // you can always use this property to determine room owner! + connection.isInitiator = true; + + var dontTransmit = false; + + // a channel can contain multiple rooms i.e. sessions + if (args) { + if (isString(args)) { + connection.sessionid = args; + } else { + if (!isNull(args.transmitRoomOnce)) { + connection.transmitRoomOnce = args.transmitRoomOnce; + } + + if (!isNull(args.dontTransmit)) { + dontTransmit = args.dontTransmit; + } + + if (!isNull(args.sessionid)) { + connection.sessionid = args.sessionid; + } + } + } + + // if firebase && if session initiator + if (connection.socket && connection.socket.remove) { + connection.socket.remove(); + } + + if (!connection.sessionid) connection.sessionid = connection.channel; + connection.sessionDescription = { + sessionid: connection.sessionid, + userid: connection.userid, + session: connection.session, + extra: connection.extra + }; + + if (!connection.sessionDescriptions[connection.sessionDescription.sessionid]) { + connection.numberOfSessions++; + connection.sessionDescriptions[connection.sessionDescription.sessionid] = connection.sessionDescription; + } + + // connect with signaling channel + initRTCMultiSession(function() { + // "captureUserMediaOnDemand" is disabled by default. + // invoke "getUserMedia" only when first participant found. + rtcMultiSession.captureUserMediaOnDemand = args ? !!args.captureUserMediaOnDemand : false; + + if (args && args.onMediaCaptured) { + connection.onMediaCaptured = args.onMediaCaptured; + } + + // for session-initiator, user-media is captured as soon as "open" is invoked. + if (!rtcMultiSession.captureUserMediaOnDemand) captureUserMedia(function() { + rtcMultiSession.initSession({ + sessionDescription: connection.sessionDescription, + dontTransmit: dontTransmit + }); + + invokeMediaCaptured(connection); + }); + + if (rtcMultiSession.captureUserMediaOnDemand) { + rtcMultiSession.initSession({ + sessionDescription: connection.sessionDescription, + dontTransmit: dontTransmit + }); + } + }); + return connection.sessionDescription; + }; + + // www.RTCMultiConnection.org/docs/connect/ + connection.connect = function(sessionid) { + // a channel can contain multiple rooms i.e. sessions + if (sessionid) { + connection.sessionid = sessionid; + } + + // connect with signaling channel + initRTCMultiSession(function() { + log('Signaling channel is ready.'); + }); + + return this; + }; + + // www.RTCMultiConnection.org/docs/join/ + connection.join = joinSession; + + // www.RTCMultiConnection.org/docs/send/ + connection.send = function(data, _channel) { + if (connection.numberOfConnectedUsers <= 0) { + // no connections + setTimeout(function() { + // try again + connection.send(data, _channel); + }, 1000); + return; + } + + // send file/data or /text + if (!data) + throw 'No file, data or text message to share.'; + + // connection.send([file1, file2, file3]) + // you can share multiple files, strings or data objects using "send" method! + if (data instanceof Array && !isNull(data[0].size) && !isNull(data[0].type)) { + // this mechanism can cause failure for subsequent packets/data + // on Firefox especially; and on chrome as well! + // todo: need to use setTimeout instead. + for (var i = 0; i < data.length; i++) { + data[i].size && data[i].type && connection.send(data[i], _channel); + } + return; + } + + // File or Blob object MUST have "type" and "size" properties + if (!isNull(data.size) && !isNull(data.type)) { + if (!connection.enableFileSharing) { + throw '"enableFileSharing" boolean MUST be "true" to support file sharing.'; + } + + if (!rtcMultiSession.fileBufferReader) { + initFileBufferReader(connection, function(fbr) { + rtcMultiSession.fileBufferReader = fbr; + connection.send(data, _channel); + }); + return; + } + + var extra = merge({ + userid: connection.userid + }, data.extra || connection.extra); + + rtcMultiSession.fileBufferReader.readAsArrayBuffer(data, function(uuid) { + rtcMultiSession.fileBufferReader.getNextChunk(uuid, function(nextChunk, isLastChunk, extra) { + if (_channel) _channel.send(nextChunk); + else rtcMultiSession.send(nextChunk); + }); + }, extra); + } else { + // to allow longest string messages + // and largest data objects + // or anything of any size! + // to send multiple data objects concurrently! + + TextSender.send({ + text: data, + channel: rtcMultiSession, + _channel: _channel, + connection: connection + }); + } + }; + + function initRTCMultiSession(onSignalingReady) { + if (screenFrame) { + loadScreenFrame(); + } + + // RTCMultiSession is the backbone object; + // this object MUST be initialized once! + if (rtcMultiSession) return onSignalingReady(); + + // your everything is passed over RTCMultiSession constructor! + rtcMultiSession = new RTCMultiSession(connection, onSignalingReady); + } + + connection.disconnect = function() { + if (rtcMultiSession) rtcMultiSession.disconnect(); + rtcMultiSession = null; + }; + + function joinSession(session, joinAs) { + if (isString(session)) { + connection.skipOnNewSession = true; + } + + if (!rtcMultiSession) { + log('Signaling channel is not ready. Connecting...'); + // connect with signaling channel + initRTCMultiSession(function() { + log('Signaling channel is connected. Joining the session again...'); + setTimeout(function() { + joinSession(session, joinAs); + }, 1000); + }); + return; + } + + // connection.join('sessionid'); + if (isString(session)) { + if (connection.sessionDescriptions[session]) { + session = connection.sessionDescriptions[session]; + } else + return setTimeout(function() { + log('Session-Descriptions not found. Rechecking..'); + joinSession(session, joinAs); + }, 1000); + } + + // connection.join('sessionid', { audio: true }); + if (joinAs) { + return captureUserMedia(function() { + session.oneway = true; + joinSession(session); + }, joinAs); + } + + if (!session || !session.userid || !session.sessionid) { + error('missing arguments', arguments); + + var error = 'Invalid data passed over "connection.join" method.'; + connection.onstatechange({ + userid: 'browser', + extra: {}, + name: 'Unexpected data detected.', + reason: error + }); + + throw error; + } + + if (!connection.dontOverrideSession) { + connection.session = session.session; + } + + var extra = connection.extra || session.extra || {}; + + // todo: need to verify that if-block statement works as expected. + // expectations: if it is oneway streaming; or if it is data-only connection + // then, it shouldn't capture user-media on participant's side. + if (session.oneway || isData(session)) { + rtcMultiSession.joinSession(session, extra); + } else { + captureUserMedia(function() { + rtcMultiSession.joinSession(session, extra); + }); + } + } + + var isFirstSession = true; + + // www.RTCMultiConnection.org/docs/captureUserMedia/ + + function captureUserMedia(callback, _session, dontCheckChromExtension) { + // capture user's media resources + var session = _session || connection.session; + + if (isEmpty(session)) { + if (callback) callback(); + return; + } + + // you can force to skip media capturing! + if (connection.dontCaptureUserMedia) { + return callback(); + } + + // if it is data-only connection + // if it is one-way connection and current user is participant + if (isData(session) || (!connection.isInitiator && session.oneway)) { + // www.RTCMultiConnection.org/docs/attachStreams/ + connection.attachStreams = []; + return callback(); + } + + var constraints = { + audio: !!session.audio ? { + mandatory: {}, + optional: [{ + chromeRenderToAssociatedSink: true + }] + } : false, + video: !!session.video + }; + + // if custom audio device is selected + if (connection._mediaSources.audio) { + constraints.audio.optional.push({ + sourceId: connection._mediaSources.audio + }); + } + + // if custom video device is selected + if (connection._mediaSources.video) { + constraints.video = { + optional: [{ + sourceId: connection._mediaSources.video + }] + }; + } + + // for connection.session = {}; + if (!session.screen && !constraints.audio && !constraints.video) { + return callback(); + } + + var screen_constraints = { + audio: false, + video: { + mandatory: { + chromeMediaSource: DetectRTC.screen.chromeMediaSource, + maxWidth: screen.width > 1920 ? screen.width : 1920, + maxHeight: screen.height > 1080 ? screen.height : 1080 + }, + optional: [] + } + }; + + if (isFirefox && session.screen) { + if (location.protocol !== 'https:') { + return error(SCREEN_COMMON_FAILURE); + } + warn(Firefox_Screen_Capturing_Warning); + + screen_constraints.video = merge(screen_constraints.video.mandatory, { + mozMediaSource: 'window', // mozMediaSource is redundant here + mediaSource: 'window' // 'screen' || 'window' + }); + + // Firefox is supporting audio+screen from single getUserMedia request + // audio+video+screen will become audio+screen for Firefox + // because Firefox isn't supporting multi-streams feature version < 38 + // version >38 supports multi-stream sharing. + // we can use: firefoxVersion < 38 + // however capturing audio and screen using single getUserMedia is a better option + if (constraints.audio /* && !session.video */ ) { + screen_constraints.audio = true; + constraints = {}; + } + + delete screen_constraints.video.chromeMediaSource; + } + + // if screen is prompted + if (session.screen) { + if (isChrome && DetectRTC.screen.extensionid != ReservedExtensionID) { + useCustomChromeExtensionForScreenCapturing = true; + } + + if (isChrome && !useCustomChromeExtensionForScreenCapturing && !dontCheckChromExtension && !DetectRTC.screen.sourceId) { + listenEventHandler('message', onIFrameCallback); + + function onIFrameCallback(event) { + if (event.data && event.data.chromeMediaSourceId) { + // this event listener is no more needed + window.removeEventListener('message', onIFrameCallback); + + var sourceId = event.data.chromeMediaSourceId; + + DetectRTC.screen.sourceId = sourceId; + DetectRTC.screen.chromeMediaSource = 'desktop'; + + if (sourceId == 'PermissionDeniedError') { + var mediaStreamError = { + message: location.protocol == 'https:' ? 'User denied to share content of his screen.' : SCREEN_COMMON_FAILURE, + name: 'PermissionDeniedError', + constraintName: screen_constraints, + session: session + }; + currentUserMediaRequest.mutex = false; + DetectRTC.screen.sourceId = null; + return connection.onMediaError(mediaStreamError); + } + + captureUserMedia(callback, _session); + } + + if (event.data && event.data.chromeExtensionStatus) { + warn('Screen capturing extension status is:', event.data.chromeExtensionStatus); + DetectRTC.screen.chromeMediaSource = 'screen'; + captureUserMedia(callback, _session, true); + } + } + + if (!screenFrame) { + loadScreenFrame(); + } + + screenFrame.postMessage(); + return; + } + + // check if screen capturing extension is installed. + if (isChrome && useCustomChromeExtensionForScreenCapturing && !dontCheckChromExtension && DetectRTC.screen.chromeMediaSource == 'screen' && DetectRTC.screen.extensionid) { + if (DetectRTC.screen.extensionid == ReservedExtensionID && document.domain.indexOf('webrtc-experiment.com') == -1) { + return captureUserMedia(callback, _session, true); + } + + log('checking if chrome extension is installed.'); + DetectRTC.screen.getChromeExtensionStatus(function(status) { + if (status == 'installed-enabled') { + DetectRTC.screen.chromeMediaSource = 'desktop'; + } + + captureUserMedia(callback, _session, true); + log('chrome extension is installed?', DetectRTC.screen.chromeMediaSource == 'desktop'); + }); + return; + } + + if (isChrome && useCustomChromeExtensionForScreenCapturing && DetectRTC.screen.chromeMediaSource == 'desktop' && !DetectRTC.screen.sourceId) { + DetectRTC.screen.getSourceId(function(sourceId) { + if (sourceId == 'PermissionDeniedError') { + var mediaStreamError = { + message: 'User denied to share content of his screen.', + name: 'PermissionDeniedError', + constraintName: screen_constraints, + session: session + }; + currentUserMediaRequest.mutex = false; + DetectRTC.screen.chromeMediaSource = 'desktop'; + return connection.onMediaError(mediaStreamError); + } + + if (sourceId == 'No-Response') { + error('Chrome extension seems not available. Make sure that manifest.json#L16 has valid content-script matches pointing to your URL.'); + DetectRTC.screen.chromeMediaSource = 'screen'; + return captureUserMedia(callback, _session, true); + } + + captureUserMedia(callback, _session, true); + }); + return; + } + + if (isChrome && DetectRTC.screen.chromeMediaSource == 'desktop') { + screen_constraints.video.mandatory.chromeMediaSourceId = DetectRTC.screen.sourceId; + } + + var _isFirstSession = isFirstSession; + + _captureUserMedia(screen_constraints, constraints.audio || constraints.video ? function() { + + if (_isFirstSession) isFirstSession = true; + + _captureUserMedia(constraints, callback); + } : callback); + } else _captureUserMedia(constraints, callback, session.audio && !session.video); + + function _captureUserMedia(forcedConstraints, forcedCallback, isRemoveVideoTracks, dontPreventSSLAutoAllowed) { + connection.onstatechange({ + userid: 'browser', + extra: {}, + name: 'fetching-usermedia', + reason: 'About to capture user-media with constraints: ' + toStr(forcedConstraints) + }); + + + if (connection.preventSSLAutoAllowed && !dontPreventSSLAutoAllowed && isChrome) { + // if navigator.customGetUserMediaBar.js is missing + if (!navigator.customGetUserMediaBar) { + loadScript(connection.resources.customGetUserMediaBar, function() { + _captureUserMedia(forcedConstraints, forcedCallback, isRemoveVideoTracks, dontPreventSSLAutoAllowed); + }); + return; + } + + navigator.customGetUserMediaBar(forcedConstraints, function() { + _captureUserMedia(forcedConstraints, forcedCallback, isRemoveVideoTracks, true); + }, function() { + connection.onMediaError({ + name: 'PermissionDeniedError', + message: 'User denied permission.', + constraintName: forcedConstraints, + session: session + }); + }); + return; + } + + var mediaConfig = { + onsuccess: function(stream, returnBack, idInstance, streamid) { + onStreamSuccessCallback(stream, returnBack, idInstance, streamid, forcedConstraints, forcedCallback, isRemoveVideoTracks, screen_constraints, constraints, session); + }, + onerror: function(e, constraintUsed) { + // http://goo.gl/hrwF1a + if (isFirefox) { + if (e == 'PERMISSION_DENIED') { + e = { + message: '', + name: 'PermissionDeniedError', + constraintName: constraintUsed, + session: session + }; + } + } + + if (isFirefox && constraintUsed.video && constraintUsed.video.mozMediaSource) { + mediaStreamError = { + message: Firefox_Screen_Capturing_Warning, + name: e.name || 'PermissionDeniedError', + constraintName: constraintUsed, + session: session + }; + + connection.onMediaError(mediaStreamError); + return; + } + + if (isString(e)) { + return connection.onMediaError({ + message: 'Unknown Error', + name: e, + constraintName: constraintUsed, + session: session + }); + } + + // it seems that chrome 35+ throws "DevicesNotFoundError" exception + // when any of the requested media is either denied or absent + if (e.name && (e.name == 'PermissionDeniedError' || e.name == 'DevicesNotFoundError')) { + var mediaStreamError = 'Either: '; + mediaStreamError += '\n Media resolutions are not permitted.'; + mediaStreamError += '\n Another application is using same media device.'; + mediaStreamError += '\n Media device is not attached or drivers not installed.'; + mediaStreamError += '\n You denied access once and it is still denied.'; + + if (e.message && e.message.length) { + mediaStreamError += '\n ' + e.message; + } + + mediaStreamError = { + message: mediaStreamError, + name: e.name, + constraintName: constraintUsed, + session: session + }; + + connection.onMediaError(mediaStreamError); + + if (isChrome && (session.audio || session.video)) { + // todo: this snippet fails if user has two or more + // microphone/webcam attached. + DetectRTC.load(function() { + // it is possible to check presence of the microphone before using it! + if (session.audio && !DetectRTC.hasMicrophone) { + warn('It seems that you have no microphone attached to your device/system.'); + session.audio = session.audio = false; + + if (!session.video) { + alert('It seems that you are capturing microphone and there is no device available or access is denied. Reloading...'); + location.reload(); + } + } + + // it is possible to check presence of the webcam before using it! + if (session.video && !DetectRTC.hasWebcam) { + warn('It seems that you have no webcam attached to your device/system.'); + session.video = session.video = false; + + if (!session.audio) { + alert('It seems that you are capturing webcam and there is no device available or access is denied. Reloading...'); + location.reload(); + } + } + + if (!DetectRTC.hasMicrophone && !DetectRTC.hasWebcam) { + alert('It seems that either both microphone/webcam are not available or access is denied. Reloading...'); + location.reload(); + } else if (!connection.getUserMediaPromptedOnce) { + // make maximum two tries! + connection.getUserMediaPromptedOnce = true; + captureUserMedia(callback, session); + } + }); + } + } + + if (e.name && e.name == 'ConstraintNotSatisfiedError') { + var mediaStreamError = 'Either: '; + mediaStreamError += '\n You are prompting unknown media resolutions.'; + mediaStreamError += '\n You are using invalid media constraints.'; + + if (e.message && e.message.length) { + mediaStreamError += '\n ' + e.message; + } + + mediaStreamError = { + message: mediaStreamError, + name: e.name, + constraintName: constraintUsed, + session: session + }; + + connection.onMediaError(mediaStreamError); + } + + if (session.screen) { + if (isFirefox) { + error(Firefox_Screen_Capturing_Warning); + } else if (location.protocol !== 'https:') { + if (!isNodeWebkit && (location.protocol == 'file:' || location.protocol == 'http:')) { + error('You cannot use HTTP or file protocol for screen capturing. You must either use HTTPs or chrome extension page or Node-Webkit page.'); + } + } else { + error('Unable to detect actual issue. Maybe "deprecated" screen capturing flag was not set using command line or maybe you clicked "No" button or maybe chrome extension returned invalid "sourceId". Please install chrome-extension: http://bit.ly/webrtc-screen-extension'); + } + } + + currentUserMediaRequest.mutex = false; + + // to make sure same stream can be captured again! + var idInstance = JSON.stringify(constraintUsed); + if (currentUserMediaRequest.streams[idInstance]) { + delete currentUserMediaRequest.streams[idInstance]; + } + }, + mediaConstraints: connection.mediaConstraints || {} + }; + + mediaConfig.constraints = forcedConstraints || constraints; + mediaConfig.connection = connection; + getUserMedia(mediaConfig); + } + } + + function onStreamSuccessCallback(stream, returnBack, idInstance, streamid, forcedConstraints, forcedCallback, isRemoveVideoTracks, screen_constraints, constraints, session) { + if (!streamid) streamid = getRandomString(); + + connection.onstatechange({ + userid: 'browser', + extra: {}, + name: 'usermedia-fetched', + reason: 'Captured user media using constraints: ' + toStr(forcedConstraints) + }); + + if (isRemoveVideoTracks) { + stream = convertToAudioStream(stream); + } + + connection.localStreamids.push(streamid); + stream.onended = function() { + if (streamedObject.mediaElement && !streamedObject.mediaElement.parentNode && document.getElementById(stream.streamid)) { + streamedObject.mediaElement = document.getElementById(stream.streamid); + } + + // when a stream is stopped; it must be removed from "attachStreams" array + connection.attachStreams.forEach(function(_stream, index) { + if (_stream == stream) { + delete connection.attachStreams[index]; + connection.attachStreams = swap(connection.attachStreams); + } + }); + + onStreamEndedHandler(streamedObject, connection); + + if (connection.streams[streamid]) { + connection.removeStream(streamid); + } + + // if user clicks "stop" button to close screen sharing + var _stream = connection.streams[streamid]; + if (_stream && _stream.sockets.length) { + _stream.sockets.forEach(function(socket) { + socket.send({ + streamid: _stream.streamid, + stopped: true + }); + }); + } + + currentUserMediaRequest.mutex = false; + // to make sure same stream can be captured again! + if (currentUserMediaRequest.streams[idInstance]) { + delete currentUserMediaRequest.streams[idInstance]; + } + + // to allow re-capturing of the screen + DetectRTC.screen.sourceId = null; + }; + + if (!isIE) { + stream.streamid = streamid; + stream.isScreen = forcedConstraints == screen_constraints; + stream.isVideo = forcedConstraints == constraints && !!constraints.video; + stream.isAudio = forcedConstraints == constraints && !!constraints.audio && !constraints.video; + + // if muted stream is negotiated + stream.preMuted = { + audio: stream.getAudioTracks().length && !stream.getAudioTracks()[0].enabled, + video: stream.getVideoTracks().length && !stream.getVideoTracks()[0].enabled + }; + } + + var mediaElement = createMediaElement(stream, session); + mediaElement.muted = true; + + var streamedObject = { + stream: stream, + streamid: streamid, + mediaElement: mediaElement, + blobURL: mediaElement.mozSrcObject ? URL.createObjectURL(stream) : mediaElement.src, + type: 'local', + userid: connection.userid, + extra: connection.extra, + session: session, + isVideo: !!stream.isVideo, + isAudio: !!stream.isAudio, + isScreen: !!stream.isScreen, + isInitiator: !!connection.isInitiator, + rtcMultiConnection: connection + }; + + if (isFirstSession) { + connection.attachStreams.push(stream); + } + isFirstSession = false; + + connection.streams[streamid] = connection._getStream(streamedObject); + + if (!returnBack) { + connection.onstream(streamedObject); + } + + if (connection.setDefaultEventsForMediaElement) { + connection.setDefaultEventsForMediaElement(mediaElement, streamid); + } + + if (forcedCallback) forcedCallback(stream, streamedObject); + + if (connection.onspeaking) { + initHark({ + stream: stream, + streamedObject: streamedObject, + connection: connection + }); + } + } + + // www.RTCMultiConnection.org/docs/captureUserMedia/ + connection.captureUserMedia = captureUserMedia; + + // www.RTCMultiConnection.org/docs/leave/ + connection.leave = function(userid) { + if (!rtcMultiSession) return; + + isFirstSession = true; + + if (userid) { + connection.eject(userid); + return; + } + + rtcMultiSession.leave(); + }; + + // www.RTCMultiConnection.org/docs/eject/ + connection.eject = function(userid) { + if (!connection.isInitiator) throw 'Only session-initiator can eject a user.'; + if (!connection.peers[userid]) throw 'You ejected invalid user.'; + connection.peers[userid].sendCustomMessage({ + ejected: true + }); + }; + + // www.RTCMultiConnection.org/docs/close/ + connection.close = function() { + // close entire session + connection.autoCloseEntireSession = true; + connection.leave(); + }; + + // www.RTCMultiConnection.org/docs/renegotiate/ + connection.renegotiate = function(stream, session) { + if (connection.numberOfConnectedUsers <= 0) { + // no connections + setTimeout(function() { + // try again + connection.renegotiate(stream, session); + }, 1000); + return; + } + + rtcMultiSession.addStream({ + renegotiate: session || merge({ + oneway: true + }, connection.session), + stream: stream + }); + }; + + connection.attachExternalStream = function(stream, isScreen) { + var constraints = {}; + if (stream.getAudioTracks && stream.getAudioTracks().length) { + constraints.audio = true; + } + if (stream.getVideoTracks && stream.getVideoTracks().length) { + constraints.video = true; + } + + var screen_constraints = { + video: { + chromeMediaSource: 'fake' + } + }; + var forcedConstraints = isScreen ? screen_constraints : constraints; + onStreamSuccessCallback(stream, false, '', null, forcedConstraints, false, false, screen_constraints, constraints, constraints); + }; + + // www.RTCMultiConnection.org/docs/addStream/ + connection.addStream = function(session, socket) { + // www.RTCMultiConnection.org/docs/renegotiation/ + + if (connection.numberOfConnectedUsers <= 0) { + // no connections + setTimeout(function() { + // try again + connection.addStream(session, socket); + }, 1000); + return; + } + + // renegotiate new media stream + if (session) { + var isOneWayStreamFromParticipant; + if (!connection.isInitiator && session.oneway) { + session.oneway = false; + isOneWayStreamFromParticipant = true; + } + + captureUserMedia(function(stream) { + if (isOneWayStreamFromParticipant) { + session.oneway = true; + } + addStream(stream); + }, session); + } else addStream(); + + function addStream(stream) { + rtcMultiSession.addStream({ + stream: stream, + renegotiate: session || connection.session, + socket: socket + }); + } + }; + + // www.RTCMultiConnection.org/docs/removeStream/ + connection.removeStream = function(streamid, dontRenegotiate) { + if (connection.numberOfConnectedUsers <= 0) { + // no connections + setTimeout(function() { + // try again + connection.removeStream(streamid, dontRenegotiate); + }, 1000); + return; + } + + if (!streamid) streamid = 'all'; + if (!isString(streamid) || streamid.search(/all|audio|video|screen/gi) != -1) { + function _detachStream(_stream, config) { + if (config.local && _stream.type != 'local') return; + if (config.remote && _stream.type != 'remote') return; + + // connection.removeStream({screen:true}); + if (config.screen && !!_stream.isScreen) { + connection.detachStreams.push(_stream.streamid); + } + + // connection.removeStream({audio:true}); + if (config.audio && !!_stream.isAudio) { + connection.detachStreams.push(_stream.streamid); + } + + // connection.removeStream({video:true}); + if (config.video && !!_stream.isVideo) { + connection.detachStreams.push(_stream.streamid); + } + + // connection.removeStream({}); + if (!config.audio && !config.video && !config.screen) { + connection.detachStreams.push(_stream.streamid); + } + + if (connection.detachStreams.indexOf(_stream.streamid) != -1) { + log('removing stream', _stream.streamid); + onStreamEndedHandler(_stream, connection); + + if (config.stop) { + connection.stopMediaStream(_stream.stream); + } + } + } + + for (var stream in connection.streams) { + if (connection._skip.indexOf(stream) == -1) { + _stream = connection.streams[stream]; + + if (streamid == 'all') _detachStream(_stream, { + audio: true, + video: true, + screen: true + }); + + else if (isString(streamid)) { + // connection.removeStream('screen'); + var config = {}; + config[streamid] = true; + _detachStream(_stream, config); + } else _detachStream(_stream, streamid); + } + } + + if (!dontRenegotiate && connection.detachStreams.length) { + connection.renegotiate(); + } + + return; + } + + var stream = connection.streams[streamid]; + + // detach pre-attached streams + if (!stream) return warn('No such stream exists. Stream-id:', streamid); + + // www.RTCMultiConnection.org/docs/detachStreams/ + connection.detachStreams.push(stream.streamid); + + log('removing stream', stream.streamid); + onStreamEndedHandler(stream, connection); + + // todo: how to allow "stop" function? + // connection.stopMediaStream(stream.stream) + + if (!dontRenegotiate) { + connection.renegotiate(); + } + }; + + connection.switchStream = function(session) { + if (connection.numberOfConnectedUsers <= 0) { + // no connections + setTimeout(function() { + // try again + connection.switchStream(session); + }, 1000); + return; + } + + connection.removeStream('all', true); + connection.addStream(session); + }; + + // www.RTCMultiConnection.org/docs/sendCustomMessage/ + connection.sendCustomMessage = function(message) { + if (!rtcMultiSession || !rtcMultiSession.defaultSocket) { + return setTimeout(function() { + connection.sendCustomMessage(message); + }, 1000); + } + + rtcMultiSession.defaultSocket.send({ + customMessage: true, + message: message + }); + }; + + // set RTCMultiConnection defaults on constructor invocation + setDefaults(connection); + }; + + function RTCMultiSession(connection, callbackForSignalingReady) { + var socketObjects = {}; + var sockets = []; + var rtcMultiSession = this; + var participants = {}; + + if (!rtcMultiSession.fileBufferReader && connection.session.data && connection.enableFileSharing) { + initFileBufferReader(connection, function(fbr) { + rtcMultiSession.fileBufferReader = fbr; + }); + } + + var textReceiver = new TextReceiver(connection); + + function onDataChannelMessage(e) { + if (e.data.checkingPresence && connection.channels[e.userid]) { + connection.channels[e.userid].send({ + presenceDetected: true + }); + return; + } + + if (e.data.presenceDetected && connection.peers[e.userid]) { + connection.peers[e.userid].connected = true; + return; + } + + if (e.data.type === 'text') { + textReceiver.receive(e.data, e.userid, e.extra); + } else { + if (connection.autoTranslateText) { + e.original = e.data; + connection.Translator.TranslateText(e.data, function(translatedText) { + e.data = translatedText; + connection.onmessage(e); + }); + } else connection.onmessage(e); + } + } + + function onNewSession(session) { + if (connection.skipOnNewSession) return; + + if (!session.session) session.session = {}; + if (!session.extra) session.extra = {}; + + // todo: make sure this works as expected. + // i.e. "onNewSession" should be fired only for + // sessionid that is passed over "connect" method. + if (connection.sessionid && session.sessionid != connection.sessionid) return; + + if (connection.onNewSession) { + session.join = function(forceSession) { + if (!forceSession) return connection.join(session); + + for (var f in forceSession) { + session.session[f] = forceSession[f]; + } + + // keeping previous state + var isDontCaptureUserMedia = connection.dontCaptureUserMedia; + + connection.dontCaptureUserMedia = false; + connection.captureUserMedia(function() { + connection.dontCaptureUserMedia = true; + connection.join(session); + + // returning back previous state + connection.dontCaptureUserMedia = isDontCaptureUserMedia; + }, forceSession); + }; + if (!session.extra) session.extra = {}; + + return connection.onNewSession(session); + } + + connection.join(session); + } + + function updateSocketForLocalStreams(socket) { + for (var i = 0; i < connection.localStreamids.length; i++) { + var streamid = connection.localStreamids[i]; + if (connection.streams[streamid]) { + // using "sockets" array to keep references of all sockets using + // this media stream; so we can fire "onStreamEndedHandler" among all users. + connection.streams[streamid].sockets.push(socket); + } + } + } + + function newPrivateSocket(_config) { + var socketConfig = { + channel: _config.channel, + onmessage: socketResponse, + onopen: function(_socket) { + if (_socket) socket = _socket; + + if (isofferer && !peer) { + peerConfig.session = connection.session; + if (!peer) peer = new PeerConnection(); + peer.create('offer', peerConfig); + } + + _config.socketIndex = socket.index = sockets.length; + socketObjects[socketConfig.channel] = socket; + sockets[_config.socketIndex] = socket; + + updateSocketForLocalStreams(socket); + + if (!socket.__push) { + socket.__push = socket.send; + socket.send = function(message) { + message.userid = message.userid || connection.userid; + message.extra = message.extra || connection.extra || {}; + + socket.__push(message); + }; + } + } + }; + + socketConfig.callback = function(_socket) { + socket = _socket; + socketConfig.onopen(); + }; + + var socket = connection.openSignalingChannel(socketConfig); + if (socket) socketConfig.onopen(socket); + + var isofferer = _config.isofferer, + peer; + + var peerConfig = { + onopen: onChannelOpened, + onicecandidate: function(candidate) { + if (!connection.candidates) throw 'ICE candidates are mandatory.'; + if (!connection.iceProtocols) throw 'At least one must be true; UDP or TCP.'; + + var iceCandidates = connection.candidates; + + var stun = iceCandidates.stun; + var turn = iceCandidates.turn; + + if (!isNull(iceCandidates.reflexive)) stun = iceCandidates.reflexive; + if (!isNull(iceCandidates.relay)) turn = iceCandidates.relay; + + if (!iceCandidates.host && !!candidate.candidate.match(/a=candidate.*typ host/g)) return; + if (!turn && !!candidate.candidate.match(/a=candidate.*typ relay/g)) return; + if (!stun && !!candidate.candidate.match(/a=candidate.*typ srflx/g)) return; + + var protocol = connection.iceProtocols; + + if (!protocol.udp && !!candidate.candidate.match(/a=candidate.* udp/g)) return; + if (!protocol.tcp && !!candidate.candidate.match(/a=candidate.* tcp/g)) return; + + if (!window.selfNPObject) window.selfNPObject = candidate; + + socket && socket.send({ + candidate: JSON.stringify({ + candidate: candidate.candidate, + sdpMid: candidate.sdpMid, + sdpMLineIndex: candidate.sdpMLineIndex + }) + }); + }, + onmessage: function(data) { + if (!data) return; + + var abToStr = ab2str(data); + if (abToStr.indexOf('"userid":') != -1) { + abToStr = JSON.parse(abToStr); + onDataChannelMessage(abToStr); + } else if (data instanceof ArrayBuffer || data instanceof DataView) { + if (!connection.enableFileSharing) { + throw 'It seems that receiving data is either "Blob" or "File" but file sharing is disabled.'; + } + + if (!rtcMultiSession.fileBufferReader) { + var that = this; + initFileBufferReader(connection, function(fbr) { + rtcMultiSession.fileBufferReader = fbr; + that.onmessage(data); + }); + return; + } + + var fileBufferReader = rtcMultiSession.fileBufferReader; + + fileBufferReader.convertToObject(data, function(chunk) { + if (chunk.maxChunks || chunk.readyForNextChunk) { + // if target peer requested next chunk + if (chunk.readyForNextChunk) { + fileBufferReader.getNextChunk(chunk.uuid, function(nextChunk, isLastChunk, extra) { + rtcMultiSession.send(nextChunk); + }); + return; + } + + // if chunk is received + fileBufferReader.addChunk(chunk, function(promptNextChunk) { + // request next chunk + rtcMultiSession.send(promptNextChunk); + }); + return; + } + + connection.onmessage({ + data: chunk, + userid: _config.userid, + extra: _config.extra + }); + }); + return; + } + }, + onaddstream: function(stream, session) { + session = session || _config.renegotiate || connection.session; + + // if it is data-only connection; then return. + if (isData(session)) return; + + if (session.screen && (session.audio || session.video)) { + if (!_config.gotAudioOrVideo) { + // audio/video are fired earlier than screen + _config.gotAudioOrVideo = true; + session.screen = false; + } else { + // screen stream is always fired later + session.audio = false; + session.video = false; + } + } + + var preMuted = {}; + + if (_config.streaminfo) { + var streaminfo = _config.streaminfo.split('----'); + var strInfo = JSON.parse(streaminfo[streaminfo.length - 1]); + + if (!isIE) { + stream.streamid = strInfo.streamid; + stream.isScreen = !!strInfo.isScreen; + stream.isVideo = !!strInfo.isVideo; + stream.isAudio = !!strInfo.isAudio; + preMuted = strInfo.preMuted; + } + + streaminfo.pop(); + _config.streaminfo = streaminfo.join('----'); + } + + var mediaElement = createMediaElement(stream, merge({ + remote: true + }, session)); + + if (connection.setDefaultEventsForMediaElement) { + connection.setDefaultEventsForMediaElement(mediaElement, stream.streamid); + } + + if (!isPluginRTC && !stream.getVideoTracks().length) { + function eventListener() { + setTimeout(function() { + mediaElement.muted = false; + afterRemoteStreamStartedFlowing({ + mediaElement: mediaElement, + session: session, + stream: stream, + preMuted: preMuted + }); + }, 3000); + + mediaElement.removeEventListener('play', eventListener); + } + return mediaElement.addEventListener('play', eventListener, false); + } + + waitUntilRemoteStreamStartsFlowing({ + mediaElement: mediaElement, + session: session, + stream: stream, + preMuted: preMuted + }); + }, + + onremovestream: function(stream) { + if (stream && stream.streamid) { + stream = connection.streams[stream.streamid]; + if (stream) { + log('on:stream:ended via on:remove:stream', stream); + onStreamEndedHandler(stream, connection); + } + } else log('on:remove:stream', stream); + }, + + onclose: function(e) { + e.extra = _config.extra; + e.userid = _config.userid; + connection.onclose(e); + + // suggested in #71 by "efaj" + if (connection.channels[e.userid]) { + delete connection.channels[e.userid]; + } + }, + onerror: function(e) { + e.extra = _config.extra; + e.userid = _config.userid; + connection.onerror(e); + }, + + oniceconnectionstatechange: function(event) { + log('oniceconnectionstatechange', toStr(event)); + + if (peer.connection && peer.connection.iceConnectionState == 'connected' && peer.connection.iceGatheringState == 'complete' && peer.connection.signalingState == 'stable' && connection.numberOfConnectedUsers == 1) { + connection.onconnected({ + userid: _config.userid, + extra: _config.extra, + peer: connection.peers[_config.userid], + targetuser: _config.userinfo + }); + } + + if (!connection.isInitiator && peer.connection && peer.connection.iceConnectionState == 'connected' && peer.connection.iceGatheringState == 'complete' && peer.connection.signalingState == 'stable' && connection.numberOfConnectedUsers == 1) { + connection.onstatechange({ + userid: _config.userid, + extra: _config.extra, + name: 'connected-with-initiator', + reason: 'ICE connection state seems connected; gathering state is completed; and signaling state is stable.' + }); + } + + if (connection.peers[_config.userid] && connection.peers[_config.userid].oniceconnectionstatechange) { + connection.peers[_config.userid].oniceconnectionstatechange(event); + } + + // if ICE connectivity check is failed; renegotiate or redial + if (connection.peers[_config.userid] && connection.peers[_config.userid].peer.connection.iceConnectionState == 'failed') { + connection.onfailed({ + userid: _config.userid, + extra: _config.extra, + peer: connection.peers[_config.userid], + targetuser: _config.userinfo + }); + } + + if (connection.peers[_config.userid] && connection.peers[_config.userid].peer.connection.iceConnectionState == 'disconnected') { + !peer.connection.renegotiate && connection.ondisconnected({ + userid: _config.userid, + extra: _config.extra, + peer: connection.peers[_config.userid], + targetuser: _config.userinfo + }); + peer.connection.renegotiate = false; + } + + if (!connection.autoReDialOnFailure) return; + + if (connection.peers[_config.userid]) { + if (connection.peers[_config.userid].peer.connection.iceConnectionState != 'disconnected') { + _config.redialing = false; + } + + if (connection.peers[_config.userid].peer.connection.iceConnectionState == 'disconnected' && !_config.redialing) { + _config.redialing = true; + warn('Peer connection is closed.', toStr(connection.peers[_config.userid].peer.connection), 'ReDialing..'); + connection.peers[_config.userid].socket.send({ + redial: true + }); + + // to make sure all old "remote" streams are also removed! + connection.streams.remove({ + remote: true, + userid: _config.userid + }); + } + } + }, + + onsignalingstatechange: function(event) { + log('onsignalingstatechange', toStr(event)); + }, + + attachStreams: connection.dontAttachStream ? [] : connection.attachStreams, + iceServers: connection.iceServers, + rtcConfiguration: connection.rtcConfiguration, + bandwidth: connection.bandwidth, + sdpConstraints: connection.sdpConstraints, + optionalArgument: connection.optionalArgument, + disableDtlsSrtp: connection.disableDtlsSrtp, + dataChannelDict: connection.dataChannelDict, + preferSCTP: connection.preferSCTP, + + onSessionDescription: function(sessionDescription, streaminfo) { + sendsdp({ + sdp: sessionDescription, + socket: socket, + streaminfo: streaminfo + }); + }, + trickleIce: connection.trickleIce, + processSdp: connection.processSdp, + sendStreamId: function(stream) { + socket && socket.send({ + streamid: stream.streamid, + isScreen: !!stream.isScreen, + isAudio: !!stream.isAudio, + isVideo: !!stream.isVideo + }); + }, + rtcMultiConnection: connection + }; + + function waitUntilRemoteStreamStartsFlowing(args) { + // chrome for android may have some features missing + if (isMobileDevice || isPluginRTC || (isNull(connection.waitUntilRemoteStreamStartsFlowing) || !connection.waitUntilRemoteStreamStartsFlowing)) { + return afterRemoteStreamStartedFlowing(args); + } + + if (!args.numberOfTimes) args.numberOfTimes = 0; + args.numberOfTimes++; + + if (!(args.mediaElement.readyState <= HTMLMediaElement.HAVE_CURRENT_DATA || args.mediaElement.paused || args.mediaElement.currentTime <= 0)) { + return afterRemoteStreamStartedFlowing(args); + } + + if (args.numberOfTimes >= 60) { // wait 60 seconds while video is delivered! + return socket.send({ + failedToReceiveRemoteVideo: true, + streamid: args.stream.streamid + }); + } + + setTimeout(function() { + log('Waiting for incoming remote stream to be started flowing: ' + args.numberOfTimes + ' seconds.'); + waitUntilRemoteStreamStartsFlowing(args); + }, 900); + } + + function initFakeChannel() { + if (!connection.fakeDataChannels || connection.channels[_config.userid]) return; + + // for non-data connections; allow fake data sender! + if (!connection.session.data) { + var fakeChannel = { + send: function(data) { + socket.send({ + fakeData: data + }); + }, + readyState: 'open' + }; + // connection.channels['user-id'].send(data); + connection.channels[_config.userid] = { + channel: fakeChannel, + send: function(data) { + this.channel.send(data); + } + }; + peerConfig.onopen(fakeChannel); + } + } + + function afterRemoteStreamStartedFlowing(args) { + var mediaElement = args.mediaElement; + var session = args.session; + var stream = args.stream; + + stream.onended = function() { + if (streamedObject.mediaElement && !streamedObject.mediaElement.parentNode && document.getElementById(stream.streamid)) { + streamedObject.mediaElement = document.getElementById(stream.streamid); + } + + onStreamEndedHandler(streamedObject, connection); + }; + + var streamedObject = { + mediaElement: mediaElement, + + stream: stream, + streamid: stream.streamid, + session: session || connection.session, + + blobURL: isPluginRTC ? '' : mediaElement.mozSrcObject ? URL.createObjectURL(stream) : mediaElement.src, + type: 'remote', + + extra: _config.extra, + userid: _config.userid, + + isVideo: isPluginRTC ? !!session.video : !!stream.isVideo, + isAudio: isPluginRTC ? !!session.audio && !session.video : !!stream.isAudio, + isScreen: !!stream.isScreen, + isInitiator: !!_config.isInitiator, + + rtcMultiConnection: connection, + socket: socket + }; + + // connection.streams['stream-id'].mute({audio:true}) + connection.streams[stream.streamid] = connection._getStream(streamedObject); + connection.onstream(streamedObject); + + if (!isEmpty(args.preMuted) && (args.preMuted.audio || args.preMuted.video)) { + var fakeObject = merge({}, streamedObject); + fakeObject.session = merge(fakeObject.session, args.preMuted); + + fakeObject.isAudio = !!fakeObject.session.audio && !fakeObject.session.video; + fakeObject.isVideo = !!fakeObject.session.video; + fakeObject.isScreen = false; + + connection.onmute(fakeObject); + } + + log('on:add:stream', streamedObject); + + onSessionOpened(); + + if (connection.onspeaking) { + initHark({ + stream: stream, + streamedObject: streamedObject, + connection: connection + }); + } + } + + function onChannelOpened(channel) { + _config.channel = channel; + + // connection.channels['user-id'].send(data); + connection.channels[_config.userid] = { + channel: _config.channel, + send: function(data) { + connection.send(data, this.channel); + } + }; + + connection.onopen({ + extra: _config.extra, + userid: _config.userid, + channel: channel + }); + + // fetch files from file-queue + for (var q in connection.fileQueue) { + connection.send(connection.fileQueue[q], channel); + } + + if (isData(connection.session)) onSessionOpened(); + + if (connection.partOfScreen && connection.partOfScreen.sharing) { + connection.peers[_config.userid].sharePartOfScreen(connection.partOfScreen); + } + } + + function updateSocket() { + // todo: need to check following {if-block} MUST not affect "redial" process + if (socket.userid == _config.userid) + return; + + socket.userid = _config.userid; + sockets[_config.socketIndex] = socket; + + connection.numberOfConnectedUsers++; + // connection.peers['user-id'].addStream({audio:true}) + connection.peers[_config.userid] = { + socket: socket, + peer: peer, + userid: _config.userid, + extra: _config.extra, + userinfo: _config.userinfo, + addStream: function(session00) { + // connection.peers['user-id'].addStream({audio: true, video: true); + + connection.addStream(session00, this.socket); + }, + removeStream: function(streamid) { + if (!connection.streams[streamid]) + return warn('No such stream exists. Stream-id:', streamid); + + this.peer.connection.removeStream(connection.streams[streamid].stream); + this.renegotiate(); + }, + renegotiate: function(stream, session) { + // connection.peers['user-id'].renegotiate(); + + connection.renegotiate(stream, session); + }, + changeBandwidth: function(bandwidth) { + // connection.peers['user-id'].changeBandwidth(); + + if (!bandwidth) throw 'You MUST pass bandwidth object.'; + if (isString(bandwidth)) throw 'Pass object for bandwidth instead of string; e.g. {audio:10, video:20}'; + + // set bandwidth for self + this.peer.bandwidth = bandwidth; + + // ask remote user to synchronize bandwidth + this.socket.send({ + changeBandwidth: true, + bandwidth: bandwidth + }); + }, + sendCustomMessage: function(message) { + // connection.peers['user-id'].sendCustomMessage(); + + this.socket.send({ + customMessage: true, + message: message + }); + }, + onCustomMessage: function(message) { + log('Received "private" message from', this.userid, + isString(message) ? message : toStr(message)); + }, + drop: function(dontSendMessage) { + // connection.peers['user-id'].drop(); + + for (var stream in connection.streams) { + if (connection._skip.indexOf(stream) == -1) { + stream = connection.streams[stream]; + + if (stream.userid == connection.userid && stream.type == 'local') { + this.peer.connection.removeStream(stream.stream); + onStreamEndedHandler(stream, connection); + } + + if (stream.type == 'remote' && stream.userid == this.userid) { + onStreamEndedHandler(stream, connection); + } + } + } + + !dontSendMessage && this.socket.send({ + drop: true + }); + }, + hold: function(holdMLine) { + // connection.peers['user-id'].hold(); + + if (peer.prevCreateType == 'answer') { + this.socket.send({ + unhold: true, + holdMLine: holdMLine || 'both', + takeAction: true + }); + return; + } + + this.socket.send({ + hold: true, + holdMLine: holdMLine || 'both' + }); + + this.peer.hold = true; + this.fireHoldUnHoldEvents({ + kind: holdMLine, + isHold: true, + userid: connection.userid, + remoteUser: this.userid + }); + }, + unhold: function(holdMLine) { + // connection.peers['user-id'].unhold(); + + if (peer.prevCreateType == 'answer') { + this.socket.send({ + unhold: true, + holdMLine: holdMLine || 'both', + takeAction: true + }); + return; + } + + this.socket.send({ + unhold: true, + holdMLine: holdMLine || 'both' + }); + + this.peer.hold = false; + this.fireHoldUnHoldEvents({ + kind: holdMLine, + isHold: false, + userid: connection.userid, + remoteUser: this.userid + }); + }, + fireHoldUnHoldEvents: function(e) { + // this method is for inner usages only! + + var isHold = e.isHold; + var kind = e.kind; + var userid = e.remoteUser || e.userid; + + // hold means inactive a specific media line! + // a media line can contain multiple synced sources (ssrc) + // i.e. a media line can reference multiple tracks! + // that's why hold will affect all relevant tracks in a specific media line! + for (var stream in connection.streams) { + if (connection._skip.indexOf(stream) == -1) { + stream = connection.streams[stream]; + + if (stream.userid == userid) { + // www.RTCMultiConnection.org/docs/onhold/ + if (isHold) + connection.onhold(merge({ + kind: kind + }, stream)); + + // www.RTCMultiConnection.org/docs/onunhold/ + if (!isHold) + connection.onunhold(merge({ + kind: kind + }, stream)); + } + } + } + }, + redial: function() { + // connection.peers['user-id'].redial(); + + // 1st of all; remove all relevant remote media streams + for (var stream in connection.streams) { + if (connection._skip.indexOf(stream) == -1) { + stream = connection.streams[stream]; + + if (stream.userid == this.userid && stream.type == 'remote') { + onStreamEndedHandler(stream, connection); + } + } + } + + log('ReDialing...'); + + socket.send({ + recreatePeer: true + }); + + peer = new PeerConnection(); + peer.create('offer', peerConfig); + }, + sharePartOfScreen: function(args) { + // www.RTCMultiConnection.org/docs/onpartofscreen/ + var that = this; + var lastScreenshot = ''; + + function partOfScreenCapturer() { + // if stopped + if (that.stopPartOfScreenSharing) { + that.stopPartOfScreenSharing = false; + + if (connection.onpartofscreenstopped) { + connection.onpartofscreenstopped(); + } + return; + } + + // if paused + if (that.pausePartOfScreenSharing) { + if (connection.onpartofscreenpaused) { + connection.onpartofscreenpaused(); + } + + return setTimeout(partOfScreenCapturer, args.interval || 200); + } + + capturePartOfScreen({ + element: args.element, + connection: connection, + callback: function(screenshot) { + if (!connection.channels[that.userid]) { + throw 'No such data channel exists.'; + } + + // don't share repeated content + if (screenshot != lastScreenshot) { + lastScreenshot = screenshot; + connection.channels[that.userid].send({ + screenshot: screenshot, + isPartOfScreen: true + }); + } + + // "once" can be used to share single screenshot + !args.once && setTimeout(partOfScreenCapturer, args.interval || 200); + } + }); + } + + partOfScreenCapturer(); + }, + getConnectionStats: function(callback, interval) { + if (!callback) throw 'callback is mandatory.'; + + if (!window.getConnectionStats) { + loadScript(connection.resources.getConnectionStats, invoker); + } else invoker(); + + function invoker() { + RTCPeerConnection.prototype.getConnectionStats = window.getConnectionStats; + peer.connection && peer.connection.getConnectionStats(callback, interval); + } + }, + takeSnapshot: function(callback) { + takeSnapshot({ + userid: this.userid, + connection: connection, + callback: callback + }); + } + }; + } + + function onSessionOpened() { + // original conferencing infrastructure! + if (connection.isInitiator && getLength(participants) && getLength(participants) <= connection.maxParticipantsAllowed) { + if (!connection.session.oneway && !connection.session.broadcast) { + defaultSocket.send({ + sessionid: connection.sessionid, + newParticipant: _config.userid || socket.channel, + userData: { + userid: _config.userid || socket.channel, + extra: _config.extra + } + }); + } + } + + // 1st: renegotiation is supported only on chrome + // 2nd: must not renegotiate same media multiple times + // 3rd: todo: make sure that target-user has no such "renegotiated" media. + if (_config.userinfo.browser == 'chrome' && !_config.renegotiatedOnce) { + // this code snippet is added to make sure that "previously-renegotiated" streams are also + // renegotiated to this new user + for (var rSession in connection.renegotiatedSessions) { + _config.renegotiatedOnce = true; + + if (connection.renegotiatedSessions[rSession] && connection.renegotiatedSessions[rSession].stream) { + connection.peers[_config.userid].renegotiate(connection.renegotiatedSessions[rSession].stream, connection.renegotiatedSessions[rSession].session); + } + } + } + } + + function socketResponse(response) { + if (isRMSDeleted) return; + + if (response.userid == connection.userid) + return; + + if (response.sdp) { + _config.userid = response.userid; + _config.extra = response.extra || {}; + _config.renegotiate = response.renegotiate; + _config.streaminfo = response.streaminfo; + _config.isInitiator = response.isInitiator; + _config.userinfo = response.userinfo; + + var sdp = JSON.parse(response.sdp); + + if (sdp.type == 'offer') { + // to synchronize SCTP or RTP + peerConfig.preferSCTP = !!response.preferSCTP; + connection.fakeDataChannels = !!response.fakeDataChannels; + } + + // initializing fake channel + initFakeChannel(); + + sdpInvoker(sdp, response.labels); + } + + if (response.candidate) { + peer && peer.addIceCandidate(JSON.parse(response.candidate)); + } + + if (response.streamid) { + if (!rtcMultiSession.streamids) { + rtcMultiSession.streamids = {}; + } + if (!rtcMultiSession.streamids[response.streamid]) { + rtcMultiSession.streamids[response.streamid] = response.streamid; + connection.onstreamid(response); + } + } + + if (response.mute || response.unmute) { + if (response.promptMuteUnmute) { + if (!connection.privileges.canMuteRemoteStream) { + connection.onstatechange({ + userid: response.userid, + extra: response.extra, + name: 'mute-request-denied', + reason: response.userid + ' tried to mute your stream; however "privileges.canMuteRemoteStream" is "false".' + }); + return; + } + + if (connection.streams[response.streamid]) { + if (response.mute && !connection.streams[response.streamid].muted) { + connection.streams[response.streamid].mute(response.session); + } + if (response.unmute && connection.streams[response.streamid].muted) { + connection.streams[response.streamid].unmute(response.session); + } + } + } else { + var streamObject = {}; + if (connection.streams[response.streamid]) { + streamObject = connection.streams[response.streamid]; + } + + var session = response.session; + var fakeObject = merge({}, streamObject); + fakeObject.session = session; + + fakeObject.isAudio = !!fakeObject.session.audio && !fakeObject.session.video; + fakeObject.isVideo = !!fakeObject.session.video; + fakeObject.isScreen = !!fakeObject.session.screen; + + if (response.mute) connection.onmute(fakeObject || response); + if (response.unmute) connection.onunmute(fakeObject || response); + } + } + + if (response.isVolumeChanged) { + log('Volume of stream: ' + response.streamid + ' has changed to: ' + response.volume); + if (connection.streams[response.streamid]) { + var mediaElement = connection.streams[response.streamid].mediaElement; + if (mediaElement) mediaElement.volume = response.volume; + } + } + + // to stop local stream + if (response.stopped) { + if (connection.streams[response.streamid]) { + onStreamEndedHandler(connection.streams[response.streamid], connection); + } + } + + // to stop remote stream + if (response.promptStreamStop /* && !connection.isInitiator */ ) { + if (!connection.privileges.canStopRemoteStream) { + connection.onstatechange({ + userid: response.userid, + extra: response.extra, + name: 'stop-request-denied', + reason: response.userid + ' tried to stop your stream; however "privileges.canStopRemoteStream" is "false".' + }); + return; + } + warn('Remote stream has been manually stopped!'); + if (connection.streams[response.streamid]) { + connection.streams[response.streamid].stop(); + } + } + + if (response.left) { + // firefox is unable to stop remote streams + // firefox doesn't auto stop streams when peer.close() is called. + if (isFirefox) { + var userLeft = response.userid; + for (var stream in connection.streams) { + stream = connection.streams[stream]; + if (stream.userid == userLeft) { + connection.stopMediaStream(stream); + onStreamEndedHandler(stream, connection); + } + } + } + + if (peer && peer.connection) { + // todo: verify if-block's 2nd condition + if (peer.connection.signalingState != 'closed' && peer.connection.iceConnectionState.search(/disconnected|failed/gi) == -1) { + peer.connection.close(); + } + peer.connection = null; + } + + if (participants[response.userid]) delete participants[response.userid]; + + if (response.closeEntireSession) { + connection.onSessionClosed(response); + connection.leave(); + return; + } + + connection.remove(response.userid); + + onLeaveHandler({ + userid: response.userid, + extra: response.extra || {}, + entireSessionClosed: !!response.closeEntireSession + }, connection); + } + + // keeping session active even if initiator leaves + if (response.playRoleOfBroadcaster) { + if (response.extra) { + // clone extra-data from initial moderator + connection.extra = merge(connection.extra, response.extra); + } + if (response.participants) { + participants = response.participants; + + // make sure that if 2nd initiator leaves; control is shifted to 3rd person. + if (participants[connection.userid]) { + delete participants[connection.userid]; + } + + if (sockets[0] && sockets[0].userid == response.userid) { + delete sockets[0]; + sockets = swap(sockets); + } + + if (socketObjects[response.userid]) { + delete socketObjects[response.userid]; + } + } + + setTimeout(connection.playRoleOfInitiator, 2000); + } + + if (response.changeBandwidth) { + if (!connection.peers[response.userid]) throw 'No such peer exists.'; + + // synchronize bandwidth + connection.peers[response.userid].peer.bandwidth = response.bandwidth; + + // renegotiate to apply bandwidth + connection.peers[response.userid].renegotiate(); + } + + if (response.customMessage) { + if (!connection.peers[response.userid]) throw 'No such peer exists.'; + if (response.message.ejected) { + if (connection.sessionDescriptions[connection.sessionid].userid != response.userid) { + throw 'only initiator can eject a user.'; + } + // initiator ejected this user + connection.leave(); + + connection.onSessionClosed({ + userid: response.userid, + extra: response.extra || _config.extra, + isEjected: true + }); + } else connection.peers[response.userid].onCustomMessage(response.message); + } + + if (response.drop) { + if (!connection.peers[response.userid]) throw 'No such peer exists.'; + connection.peers[response.userid].drop(true); + connection.peers[response.userid].renegotiate(); + + connection.ondrop(response.userid); + } + + if (response.hold || response.unhold) { + if (!connection.peers[response.userid]) throw 'No such peer exists.'; + + if (response.takeAction) { + connection.peers[response.userid][!!response.hold ? 'hold' : 'unhold'](response.holdMLine); + return; + } + + connection.peers[response.userid].peer.hold = !!response.hold; + connection.peers[response.userid].peer.holdMLine = response.holdMLine; + + socket.send({ + isRenegotiate: true + }); + + connection.peers[response.userid].fireHoldUnHoldEvents({ + kind: response.holdMLine, + isHold: !!response.hold, + userid: response.userid + }); + } + + if (response.isRenegotiate) { + connection.peers[response.userid].renegotiate(null, connection.peers[response.userid].peer.session); + } + + // fake data channels! + if (response.fakeData) { + peerConfig.onmessage(response.fakeData); + } + + // sometimes we don't need to renegotiate e.g. when peers are disconnected + // or if it is firefox + if (response.recreatePeer) { + peer = new PeerConnection(); + } + + // remote video failed either out of ICE gathering process or ICE connectivity check-up + // or IceAgent was unable to locate valid candidates/ports. + if (response.failedToReceiveRemoteVideo) { + log('Remote peer hasn\'t received stream: ' + response.streamid + '. Renegotiating...'); + if (connection.peers[response.userid]) { + connection.peers[response.userid].renegotiate(); + } + } + + if (response.redial) { + if (connection.peers[response.userid]) { + if (connection.peers[response.userid].peer.connection.iceConnectionState != 'disconnected') { + _config.redialing = false; + } + + if (connection.peers[response.userid].peer.connection.iceConnectionState == 'disconnected' && !_config.redialing) { + _config.redialing = true; + + warn('Peer connection is closed.', toStr(connection.peers[response.userid].peer.connection), 'ReDialing..'); + connection.peers[response.userid].redial(); + } + } + } + } + + connection.playRoleOfInitiator = function() { + connection.dontCaptureUserMedia = true; + connection.open(); + sockets = swap(sockets); + connection.dontCaptureUserMedia = false; + }; + + connection.askToShareParticipants = function() { + defaultSocket && defaultSocket.send({ + askToShareParticipants: true + }); + }; + + connection.shareParticipants = function(args) { + var message = { + joinUsers: participants, + userid: connection.userid, + extra: connection.extra + }; + + if (args) { + if (args.dontShareWith) message.dontShareWith = args.dontShareWith; + if (args.shareWith) message.shareWith = args.shareWith; + } + + defaultSocket.send(message); + }; + + function sdpInvoker(sdp, labels) { + if (sdp.type == 'answer') { + peer.setRemoteDescription(sdp); + updateSocket(); + return; + } + if (!_config.renegotiate && sdp.type == 'offer') { + peerConfig.offerDescription = sdp; + + peerConfig.session = connection.session; + if (!peer) peer = new PeerConnection(); + peer.create('answer', peerConfig); + + updateSocket(); + return; + } + + var session = _config.renegotiate; + // detach streams + detachMediaStream(labels, peer.connection); + + if (session.oneway || isData(session)) { + createAnswer(); + delete _config.renegotiate; + } else { + if (_config.capturing) + return; + + _config.capturing = true; + + connection.captureUserMedia(function(stream) { + _config.capturing = false; + + peer.addStream(stream); + + connection.renegotiatedSessions[JSON.stringify(_config.renegotiate)] = { + session: _config.renegotiate, + stream: stream + }; + + delete _config.renegotiate; + + createAnswer(); + }, _config.renegotiate); + } + + function createAnswer() { + peer.recreateAnswer(sdp, session, function(_sdp, streaminfo) { + sendsdp({ + sdp: _sdp, + socket: socket, + streaminfo: streaminfo + }); + connection.detachStreams = []; + }); + } + } + } + + function detachMediaStream(labels, peer) { + if (!labels) return; + for (var i = 0; i < labels.length; i++) { + var label = labels[i]; + if (connection.streams[label]) { + peer.removeStream(connection.streams[label].stream); + } + } + } + + function sendsdp(e) { + e.socket.send({ + sdp: JSON.stringify({ + sdp: e.sdp.sdp, + type: e.sdp.type + }), + renegotiate: !!e.renegotiate ? e.renegotiate : false, + streaminfo: e.streaminfo || '', + labels: e.labels || [], + preferSCTP: !!connection.preferSCTP, + fakeDataChannels: !!connection.fakeDataChannels, + isInitiator: !!connection.isInitiator, + userinfo: { + browser: isFirefox ? 'firefox' : 'chrome' + } + }); + } + + // sharing new user with existing participants + + function onNewParticipant(response) { + var channel = response.newParticipant; + + if (!channel || !!participants[channel] || channel == connection.userid) + return; + + var new_channel = connection.token(); + newPrivateSocket({ + channel: new_channel, + extra: response.userData ? response.userData.extra : response.extra, + userid: response.userData ? response.userData.userid : response.userid + }); + + defaultSocket.send({ + participant: true, + targetUser: channel, + channel: new_channel + }); + } + + // if a user leaves + + function clearSession() { + connection.numberOfConnectedUsers--; + + var alertMessage = { + left: true, + extra: connection.extra || {}, + userid: connection.userid, + sessionid: connection.sessionid + }; + + if (connection.isInitiator) { + // if initiator wants to close entire session + if (connection.autoCloseEntireSession) { + alertMessage.closeEntireSession = true; + } else if (sockets[0]) { + // shift initiation control to another user + sockets[0].send({ + playRoleOfBroadcaster: true, + userid: connection.userid, + extra: connection.extra, + participants: participants + }); + } + } + + sockets.forEach(function(socket, i) { + socket.send(alertMessage); + + if (socketObjects[socket.channel]) { + delete socketObjects[socket.channel]; + } + + delete sockets[i]; + }); + + sockets = swap(sockets); + + connection.refresh(); + + webAudioMediaStreamSources.forEach(function(mediaStreamSource) { + // if source is connected; then chrome will crash on unload. + mediaStreamSource.disconnect(); + }); + + webAudioMediaStreamSources = []; + } + + // www.RTCMultiConnection.org/docs/remove/ + connection.remove = function(userid) { + if (rtcMultiSession.requestsFrom && rtcMultiSession.requestsFrom[userid]) delete rtcMultiSession.requestsFrom[userid]; + + if (connection.peers[userid]) { + if (connection.peers[userid].peer && connection.peers[userid].peer.connection) { + if (connection.peers[userid].peer.connection.signalingState != 'closed') { + connection.peers[userid].peer.connection.close(); + } + connection.peers[userid].peer.connection = null; + } + delete connection.peers[userid]; + } + if (participants[userid]) { + delete participants[userid]; + } + + for (var stream in connection.streams) { + stream = connection.streams[stream]; + if (stream.userid == userid) { + onStreamEndedHandler(stream, connection); + delete connection.streams[stream]; + } + } + + if (socketObjects[userid]) { + delete socketObjects[userid]; + } + }; + + // www.RTCMultiConnection.org/docs/refresh/ + connection.refresh = function() { + // if firebase; remove data from firebase servers + if (connection.isInitiator && !!connection.socket && !!connection.socket.remove) { + connection.socket.remove(); + } + + participants = {}; + + // to stop/remove self streams + for (var i = 0; i < connection.attachStreams.length; i++) { + connection.stopMediaStream(connection.attachStreams[i]); + } + + // to allow capturing of identical streams + currentUserMediaRequest = { + streams: [], + mutex: false, + queueRequests: [] + }; + + rtcMultiSession.isOwnerLeaving = true; + + connection.isInitiator = false; + connection.isAcceptNewSession = true; + connection.attachMediaStreams = []; + connection.sessionDescription = null; + connection.sessionDescriptions = {}; + connection.localStreamids = []; + connection.preRecordedMedias = {}; + connection.snapshots = {}; + + connection.numberOfConnectedUsers = 0; + connection.numberOfSessions = 0; + + connection.attachStreams = []; + connection.detachStreams = []; + connection.fileQueue = {}; + connection.channels = {}; + connection.renegotiatedSessions = {}; + + for (var peer in connection.peers) { + if (peer != connection.userid) { + delete connection.peers[peer]; + } + } + + // to make sure remote streams are also removed! + for (var stream in connection.streams) { + if (connection._skip.indexOf(stream) == -1) { + onStreamEndedHandler(connection.streams[stream], connection); + delete connection.streams[stream]; + } + } + + socketObjects = {}; + sockets = []; + participants = {}; + }; + + // www.RTCMultiConnection.org/docs/reject/ + connection.reject = function(userid) { + if (!isString(userid)) userid = userid.userid; + defaultSocket.send({ + rejectedRequestOf: userid + }); + + // remove relevant data to allow him join again + connection.remove(userid); + }; + + rtcMultiSession.leaveHandler = function(e) { + if (!connection.leaveOnPageUnload) return; + + if (isNull(e.keyCode)) { + return clearSession(); + } + + if (e.keyCode == 116) { + clearSession(); + } + }; + + listenEventHandler('beforeunload', rtcMultiSession.leaveHandler); + listenEventHandler('keyup', rtcMultiSession.leaveHandler); + + rtcMultiSession.onLineOffLineHandler = function() { + if (!navigator.onLine) { + rtcMultiSession.isOffLine = true; + } else if (rtcMultiSession.isOffLine) { + rtcMultiSession.isOffLine = !navigator.onLine; + + // defaultSocket = getDefaultSocketRef(); + + // pending tasks should be resumed? + // sockets should be reconnected? + // peers should be re-established? + } + }; + + listenEventHandler('load', rtcMultiSession.onLineOffLineHandler); + listenEventHandler('online', rtcMultiSession.onLineOffLineHandler); + listenEventHandler('offline', rtcMultiSession.onLineOffLineHandler); + + function onSignalingReady() { + if (rtcMultiSession.signalingReady) return; + rtcMultiSession.signalingReady = true; + + setTimeout(callbackForSignalingReady, 1000); + + if (!connection.isInitiator) { + // as soon as signaling gateway is connected; + // user should check existing rooms! + defaultSocket && defaultSocket.send({ + searchingForRooms: true + }); + } + } + + function joinParticipants(joinUsers) { + for (var user in joinUsers) { + if (!participants[joinUsers[user]]) { + onNewParticipant({ + sessionid: connection.sessionid, + newParticipant: joinUsers[user], + userid: connection.userid, + extra: connection.extra + }); + } + } + } + + function getDefaultSocketRef() { + return connection.openSignalingChannel({ + onmessage: function(response) { + // RMS == RTCMultiSession + if (isRMSDeleted) return; + + // if message is sent by same user + if (response.userid == connection.userid) return; + + if (response.sessionid && response.userid) { + if (!connection.sessionDescriptions[response.sessionid]) { + connection.numberOfSessions++; + connection.sessionDescriptions[response.sessionid] = response; + + // fire "onNewSession" only if: + // 1) "isAcceptNewSession" boolean is true + // 2) "sessionDescriptions" object isn't having same session i.e. to prevent duplicate invocations + if (connection.isAcceptNewSession) { + + if (!connection.dontOverrideSession) { + connection.session = response.session; + } + + onNewSession(response); + } + } + } + + if (response.newParticipant && !connection.isAcceptNewSession && rtcMultiSession.broadcasterid === response.userid) { + if (response.newParticipant != connection.userid) { + onNewParticipant(response); + } + } + + if (getLength(participants) < connection.maxParticipantsAllowed && response.targetUser == connection.userid && response.participant) { + if (connection.peers[response.userid] && !connection.peers[response.userid].peer) { + delete participants[response.userid]; + delete connection.peers[response.userid]; + connection.isAcceptNewSession = true; + return acceptRequest(response); + } + + if (!participants[response.userid]) { + acceptRequest(response); + } + } + + if (response.acceptedRequestOf == connection.userid) { + connection.onstatechange({ + userid: response.userid, + extra: response.extra, + name: 'request-accepted', + reason: response.userid + ' accepted your participation request.' + }); + } + + if (response.rejectedRequestOf == connection.userid) { + connection.onstatechange({ + userid: response.userid, + extra: response.extra, + name: 'request-rejected', + reason: response.userid + ' rejected your participation request.' + }); + } + + if (response.customMessage) { + if (response.message.drop) { + connection.ondrop(response.userid); + + connection.attachStreams = []; + // "drop" should detach all local streams + for (var stream in connection.streams) { + if (connection._skip.indexOf(stream) == -1) { + stream = connection.streams[stream]; + if (stream.type == 'local') { + connection.detachStreams.push(stream.streamid); + onStreamEndedHandler(stream, connection); + } else onStreamEndedHandler(stream, connection); + } + } + + if (response.message.renegotiate) { + // renegotiate; so "peer.removeStream" happens. + connection.renegotiate(); + } + } else if (connection.onCustomMessage) { + connection.onCustomMessage(response.message); + } + } + + if (connection.isInitiator && response.searchingForRooms) { + defaultSocket && defaultSocket.send({ + sessionDescription: connection.sessionDescription, + responseFor: response.userid + }); + } + + if (response.sessionDescription && response.responseFor == connection.userid) { + var sessionDescription = response.sessionDescription; + if (!connection.sessionDescriptions[sessionDescription.sessionid]) { + connection.numberOfSessions++; + connection.sessionDescriptions[sessionDescription.sessionid] = sessionDescription; + } + } + + if (connection.isInitiator && response.askToShareParticipants && defaultSocket) { + connection.shareParticipants({ + shareWith: response.userid + }); + } + + // participants are shared with single user + if (response.shareWith == connection.userid && response.dontShareWith != connection.userid && response.joinUsers) { + joinParticipants(response.joinUsers); + } + + // participants are shared with all users + if (!response.shareWith && response.joinUsers) { + if (response.dontShareWith) { + if (connection.userid != response.dontShareWith) { + joinParticipants(response.joinUsers); + } + } else joinParticipants(response.joinUsers); + } + + if (response.messageFor == connection.userid && response.presenceState) { + if (response.presenceState == 'checking') { + defaultSocket.send({ + messageFor: response.userid, + presenceState: 'available', + _config: response._config + }); + log('participant asked for availability'); + } + + if (response.presenceState == 'available') { + rtcMultiSession.presenceState = 'available'; + + connection.onstatechange({ + userid: 'browser', + extra: {}, + name: 'room-available', + reason: 'Initiator is available and room is active.' + }); + + joinSession(response._config); + } + } + + if (response.donotJoin && response.messageFor == connection.userid) { + log(response.userid, 'is not joining your room.'); + } + + // if initiator disconnects sockets, participants should also disconnect + if (response.isDisconnectSockets) { + log('Disconnecting your sockets because initiator also disconnected his sockets.'); + connection.disconnect(); + } + }, + callback: function(socket) { + socket && this.onopen(socket); + }, + onopen: function(socket) { + if (socket) defaultSocket = socket; + if (onSignalingReady) onSignalingReady(); + + rtcMultiSession.defaultSocket = defaultSocket; + + if (!defaultSocket.__push) { + defaultSocket.__push = defaultSocket.send; + defaultSocket.send = function(message) { + message.userid = message.userid || connection.userid; + message.extra = message.extra || connection.extra || {}; + + defaultSocket.__push(message); + }; + } + } + }); + } + + // default-socket is a common socket shared among all users in a specific channel; + // to share participation requests; room descriptions; and other stuff. + var defaultSocket = getDefaultSocketRef(); + + rtcMultiSession.defaultSocket = defaultSocket; + + if (defaultSocket && onSignalingReady) setTimeout(onSignalingReady, 2000); + + if (connection.session.screen) { + loadScreenFrame(); + } + // CUSTOM CODE // + + /* Commenting this + connection.getExternalIceServers && loadIceFrame(function(iceServers) + { + connection.iceServers = connection.iceServers.concat(iceServers); + }); + */ + + // CUSTOM CODE // + + if (connection.log == false) connection.skipLogs(); + if (connection.onlog) { + log = warn = error = function() { + var log = {}; + var index = 0; + Array.prototype.slice.call(arguments).forEach(function(argument) { + log[index++] = toStr(argument); + }); + toStr = function(str) { + return str; + }; + connection.onlog(log); + }; + } + + function setDirections() { + var userMaxParticipantsAllowed = 0; + + // if user has set a custom max participant setting, remember it + if (connection.maxParticipantsAllowed != 256) { + userMaxParticipantsAllowed = connection.maxParticipantsAllowed; + } + + if (connection.direction == 'one-way') connection.session.oneway = true; + if (connection.direction == 'one-to-one') connection.maxParticipantsAllowed = 1; + if (connection.direction == 'one-to-many') connection.session.broadcast = true; + if (connection.direction == 'many-to-many') { + if (!connection.maxParticipantsAllowed || connection.maxParticipantsAllowed == 1) { + connection.maxParticipantsAllowed = 256; + } + } + + // if user has set a custom max participant setting, set it back + if (userMaxParticipantsAllowed && connection.maxParticipantsAllowed != 1) { + connection.maxParticipantsAllowed = userMaxParticipantsAllowed; + } + } + + // open new session + this.initSession = function(args) { + rtcMultiSession.isOwnerLeaving = false; + + setDirections(); + participants = {}; + + rtcMultiSession.isOwnerLeaving = false; + + if (!isNull(args.transmitRoomOnce)) { + connection.transmitRoomOnce = args.transmitRoomOnce; + } + + function transmit() { + if (defaultSocket && getLength(participants) < connection.maxParticipantsAllowed && !rtcMultiSession.isOwnerLeaving) { + defaultSocket.send(connection.sessionDescription); + } + + if (!connection.transmitRoomOnce && !rtcMultiSession.isOwnerLeaving) + setTimeout(transmit, connection.interval || 3000); + } + + // todo: test and fix next line. + if (!args.dontTransmit /* || connection.transmitRoomOnce */ ) transmit(); + }; + + function joinSession(_config, skipOnStateChange) { + if (rtcMultiSession.donotJoin && rtcMultiSession.donotJoin == _config.sessionid) { + return; + } + + // dontOverrideSession allows you force RTCMultiConnection + // to not override default session for participants; + // by default, session is always overridden and set to the session coming from initiator! + if (!connection.dontOverrideSession) { + connection.session = _config.session || {}; + } + + // make sure that inappropriate users shouldn't receive onNewSession event + rtcMultiSession.broadcasterid = _config.userid; + + if (_config.sessionid) { + // used later to prevent external rooms messages to be used by this user! + connection.sessionid = _config.sessionid; + } + + connection.isAcceptNewSession = false; + + var channel = getRandomString(); + newPrivateSocket({ + channel: channel, + extra: _config.extra || {}, + userid: _config.userid + }); + + var offers = {}; + if (connection.attachStreams.length) { + var stream = connection.attachStreams[connection.attachStreams.length - 1]; + if (!!stream.getAudioTracks && stream.getAudioTracks().length) { + offers.audio = true; + } + if (stream.getVideoTracks().length) { + offers.video = true; + } + } + + if (!isEmpty(offers)) { + log(toStr(offers)); + } else log('Seems data-only connection.'); + + connection.onstatechange({ + userid: _config.userid, + extra: {}, + name: 'connecting-with-initiator', + reason: 'Checking presence of the initiator; and the room.' + }); + + defaultSocket.send({ + participant: true, + channel: channel, + targetUser: _config.userid, + session: connection.session, + offers: { + audio: !!offers.audio, + video: !!offers.video + } + }); + + connection.skipOnNewSession = false; + invokeMediaCaptured(connection); + } + + // join existing session + this.joinSession = function(_config) { + if (!defaultSocket) + return setTimeout(function() { + warn('Default-Socket is not yet initialized.'); + rtcMultiSession.joinSession(_config); + }, 1000); + + _config = _config || {}; + participants = {}; + + rtcMultiSession.presenceState = 'checking'; + + connection.onstatechange({ + userid: _config.userid, + extra: _config.extra || {}, + name: 'detecting-room-presence', + reason: 'Checking presence of the room.' + }); + + function contactInitiator() { + defaultSocket.send({ + messageFor: _config.userid, + presenceState: rtcMultiSession.presenceState, + _config: { + userid: _config.userid, + extra: _config.extra || {}, + sessionid: _config.sessionid, + session: _config.session || false + } + }); + } + contactInitiator(); + + function checker() { + if (rtcMultiSession.presenceState == 'checking') { + warn('Unable to reach initiator. Trying again...'); + contactInitiator(); + setTimeout(function() { + if (rtcMultiSession.presenceState == 'checking') { + connection.onstatechange({ + userid: _config.userid, + extra: _config.extra || {}, + name: 'room-not-available', + reason: 'Initiator seems absent. Waiting for someone to open the room.' + }); + + connection.isAcceptNewSession = true; + setTimeout(checker, 2000); + } + }, 2000); + } + } + + setTimeout(checker, 3000); + }; + + connection.donotJoin = function(sessionid) { + rtcMultiSession.donotJoin = sessionid; + + var session = connection.sessionDescriptions[sessionid]; + if (!session) return; + + defaultSocket.send({ + donotJoin: true, + messageFor: session.userid, + sessionid: sessionid + }); + + participants = {}; + connection.isAcceptNewSession = true; + connection.sessionid = null; + }; + + // send file/data or text message + this.send = function(message, _channel) { + if (!(message instanceof ArrayBuffer || message instanceof DataView)) { + message = str2ab({ + extra: connection.extra, + userid: connection.userid, + data: message + }); + } + + if (_channel) { + if (_channel.readyState == 'open') { + _channel.send(message); + } + return; + } + + for (var dataChannel in connection.channels) { + var channel = connection.channels[dataChannel].channel; + if (channel.readyState == 'open') { + channel.send(message); + } + } + }; + + // leave session + this.leave = function() { + clearSession(); + }; + + // renegotiate new stream + this.addStream = function(e) { + var session = e.renegotiate; + + if (!connection.renegotiatedSessions[JSON.stringify(e.renegotiate)]) { + connection.renegotiatedSessions[JSON.stringify(e.renegotiate)] = { + session: e.renegotiate, + stream: e.stream + }; + } + + if (e.socket) { + if (e.socket.userid != connection.userid) { + addStream(connection.peers[e.socket.userid]); + } + } else { + for (var peer in connection.peers) { + if (peer != connection.userid) { + addStream(connection.peers[peer]); + } + } + } + + function addStream(_peer) { + var socket = _peer.socket; + + if (!socket) { + warn(_peer, 'doesn\'t has socket.'); + return; + } + + updateSocketForLocalStreams(socket); + + if (!_peer || !_peer.peer) { + throw 'No peer to renegotiate.'; + } + + var peer = _peer.peer; + + if (e.stream) { + if (!peer.attachStreams) { + peer.attachStreams = []; + } + + peer.attachStreams.push(e.stream); + } + + // detaching old streams + detachMediaStream(connection.detachStreams, peer.connection); + + if (e.stream && (session.audio || session.video || session.screen)) { + peer.addStream(e.stream); + } + + peer.recreateOffer(session, function(sdp, streaminfo) { + sendsdp({ + sdp: sdp, + socket: socket, + renegotiate: session, + labels: connection.detachStreams, + streaminfo: streaminfo + }); + connection.detachStreams = []; + }); + } + }; + + // www.RTCMultiConnection.org/docs/request/ + connection.request = function(userid, extra) { + connection.captureUserMedia(function() { + // open private socket that will be used to receive offer-sdp + newPrivateSocket({ + channel: connection.userid, + extra: extra || {}, + userid: userid + }); + + // ask other user to create offer-sdp + defaultSocket.send({ + participant: true, + targetUser: userid + }); + }); + }; + + function acceptRequest(response) { + if (!rtcMultiSession.requestsFrom) rtcMultiSession.requestsFrom = {}; + if (rtcMultiSession.requestsFrom[response.userid]) return; + + var obj = { + userid: response.userid, + extra: response.extra, + channel: response.channel || response.userid, + session: response.session || connection.session + }; + + // check how participant is willing to join + if (response.offers) { + if (response.offers.audio && response.offers.video) { + log('target user has both audio/video streams.'); + } else if (response.offers.audio && !response.offers.video) { + log('target user has only audio stream.'); + } else if (!response.offers.audio && response.offers.video) { + log('target user has only video stream.'); + } else { + log('target user has no stream; it seems one-way streaming or data-only connection.'); + } + + var mandatory = connection.sdpConstraints.mandatory; + if (isNull(mandatory.OfferToReceiveAudio)) { + connection.sdpConstraints.mandatory.OfferToReceiveAudio = !!response.offers.audio; + } + if (isNull(mandatory.OfferToReceiveVideo)) { + connection.sdpConstraints.mandatory.OfferToReceiveVideo = !!response.offers.video; + } + + log('target user\'s SDP has?', toStr(connection.sdpConstraints.mandatory)); + } + + rtcMultiSession.requestsFrom[response.userid] = obj; + + // www.RTCMultiConnection.org/docs/onRequest/ + if (connection.onRequest && connection.isInitiator) { + connection.onRequest(obj); + } else _accept(obj); + } + + function _accept(e) { + if (rtcMultiSession.captureUserMediaOnDemand) { + rtcMultiSession.captureUserMediaOnDemand = false; + connection.captureUserMedia(function() { + _accept(e); + + invokeMediaCaptured(connection); + }); + return; + } + + log('accepting request from', e.userid); + participants[e.userid] = e.userid; + newPrivateSocket({ + isofferer: true, + userid: e.userid, + channel: e.channel, + extra: e.extra || {}, + session: e.session || connection.session + }); + } + + // www.RTCMultiConnection.org/docs/accept/ + connection.accept = function(e) { + // for backward compatibility + if (arguments.length > 1 && isString(arguments[0])) { + e = {}; + if (arguments[0]) e.userid = arguments[0]; + if (arguments[1]) e.extra = arguments[1]; + if (arguments[2]) e.channel = arguments[2]; + } + + connection.captureUserMedia(function() { + _accept(e); + }); + }; + + var isRMSDeleted = false; + this.disconnect = function() { + this.isOwnerLeaving = true; + + if (!connection.keepStreamsOpened) { + for (var streamid in connection.localStreams) { + connection.localStreams[streamid].stop(); + } + connection.localStreams = {}; + + currentUserMediaRequest = { + streams: [], + mutex: false, + queueRequests: [] + }; + } + + if (connection.isInitiator) { + defaultSocket.send({ + isDisconnectSockets: true + }); + } + + connection.refresh(); + + rtcMultiSession.defaultSocket = defaultSocket = null; + isRMSDeleted = true; + + connection.ondisconnected({ + userid: connection.userid, + extra: connection.extra, + peer: connection.peers[connection.userid], + isSocketsDisconnected: true + }); + + // if there is any peer still opened; close it. + connection.close(); + + window.removeEventListener('beforeunload', rtcMultiSession.leaveHandler); + window.removeEventListener('keyup', rtcMultiSession.leaveHandler); + + // it will not work, though :) + delete this; + + log('Disconnected your sockets, peers, streams and everything except RTCMultiConnection object.'); + }; + } + + var webAudioMediaStreamSources = []; + + function convertToAudioStream(mediaStream) { + if (!mediaStream) throw 'MediaStream is mandatory.'; + + if (mediaStream.getVideoTracks && !mediaStream.getVideoTracks().length) { + return mediaStream; + } + + var context = new AudioContext(); + var mediaStreamSource = context.createMediaStreamSource(mediaStream); + + var destination = context.createMediaStreamDestination(); + mediaStreamSource.connect(destination); + + webAudioMediaStreamSources.push(mediaStreamSource); + + return destination.stream; + } + + var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0; + var isFirefox = typeof window.InstallTrigger !== 'undefined'; + var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; + var isChrome = !!window.chrome && !isOpera; + var isIE = !!document.documentMode; + + var isPluginRTC = isSafari || isIE; + + var isMobileDevice = !!navigator.userAgent.match(/Android|iPhone|iPad|iPod|BlackBerry|IEMobile/i); + + // detect node-webkit + var isNodeWebkit = !!(window.process && (typeof window.process == 'object') && window.process.versions && window.process.versions['node-webkit']); + + window.MediaStream = window.MediaStream || window.webkitMediaStream; + window.AudioContext = window.AudioContext || window.webkitAudioContext; + + function getRandomString() { + // suggested by @rvulpescu from #154 + if (window.crypto && crypto.getRandomValues && navigator.userAgent.indexOf('Safari') == -1) { + var a = window.crypto.getRandomValues(new Uint32Array(3)), + token = ''; + for (var i = 0, l = a.length; i < l; i++) { + token += a[i].toString(36); + } + return token; + } else { + return (Math.random() * new Date().getTime()).toString(36).replace(/\./g, ''); + } + } + + var chromeVersion = 50; + var matchArray = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./); + if (isChrome && matchArray && matchArray[2]) { + chromeVersion = parseInt(matchArray[2], 10); + } + + var firefoxVersion = 50; + matchArray = navigator.userAgent.match(/Firefox\/(.*)/); + if (isFirefox && matchArray && matchArray[1]) { + firefoxVersion = parseInt(matchArray[1], 10); + } + + function isData(session) { + return !session.audio && !session.video && !session.screen && session.data; + } + + function isNull(obj) { + return typeof obj == 'undefined'; + } + + function isString(obj) { + return typeof obj == 'string'; + } + + function isEmpty(session) { + var length = 0; + for (var s in session) { + length++; + } + return length == 0; + } + + // this method converts array-buffer into string + function ab2str(buf) { + var result = ''; + try { + result = String.fromCharCode.apply(null, new Uint16Array(buf)); + } catch (e) {} + return result; + } + + // this method converts string into array-buffer + function str2ab(str) { + if (!isString(str)) str = JSON.stringify(str); + + var buf = new ArrayBuffer(str.length * 2); // 2 bytes for each char + var bufView = new Uint16Array(buf); + for (var i = 0, strLen = str.length; i < strLen; i++) { + bufView[i] = str.charCodeAt(i); + } + return buf; + } + + function swap(arr) { + var swapped = [], + length = arr.length; + for (var i = 0; i < length; i++) + if (arr[i] && arr[i] !== true) + swapped.push(arr[i]); + return swapped; + } + + function forEach(obj, callback) { + for (var item in obj) { + callback(obj[item], item); + } + } + + var console = window.console || { + log: function() {}, + error: function() {}, + warn: function() {} + }; + + function log() { + console.log(arguments); + } + + function error() { + console.error(arguments); + } + + function warn() { + console.warn(arguments); + } + + if (isChrome || isFirefox || isSafari) { + var log = console.log.bind(console); + var error = console.error.bind(console); + var warn = console.warn.bind(console); + } + + function toStr(obj) { + return JSON.stringify(obj, function(key, value) { + if (value && value.sdp) { + log(value.sdp.type, '\t', value.sdp.sdp); + return ''; + } else return value; + }, '\t'); + } + + function getLength(obj) { + var length = 0; + for (var o in obj) + if (o) length++; + return length; + } + + // Get HTMLAudioElement/HTMLVideoElement accordingly + + function createMediaElement(stream, session) { + var mediaElement = document.createElement(stream.isAudio ? 'audio' : 'video'); + mediaElement.id = stream.streamid; + + if (isPluginRTC) { + var body = (document.body || document.documentElement); + body.insertBefore(mediaElement, body.firstChild); + + setTimeout(function() { + Plugin.attachMediaStream(mediaElement, stream) + }, 1000); + + return Plugin.attachMediaStream(mediaElement, stream); + } + + // "mozSrcObject" is always preferred over "src"!! + mediaElement[isFirefox ? 'mozSrcObject' : 'src'] = isFirefox ? stream : (window.URL || window.webkitURL).createObjectURL(stream); + + mediaElement.controls = true; + mediaElement.autoplay = !!session.remote; + mediaElement.muted = session.remote ? false : true; + + // http://goo.gl/WZ5nFl + // Firefox don't yet support onended for any stream (remote/local) + isFirefox && mediaElement.addEventListener('ended', function() { + stream.onended(); + }, false); + + mediaElement.play(); + + return mediaElement; + } + + var onStreamEndedHandlerFiredFor = {}; + + function onStreamEndedHandler(streamedObject, connection) { + if (streamedObject.mediaElement && !streamedObject.mediaElement.parentNode) return; + + if (onStreamEndedHandlerFiredFor[streamedObject.streamid]) return; + onStreamEndedHandlerFiredFor[streamedObject.streamid] = streamedObject; + connection.onstreamended(streamedObject); + } + + var onLeaveHandlerFiredFor = {}; + + function onLeaveHandler(event, connection) { + if (onLeaveHandlerFiredFor[event.userid]) return; + onLeaveHandlerFiredFor[event.userid] = event; + connection.onleave(event); + } + + function takeSnapshot(args) { + var userid = args.userid; + var connection = args.connection; + + function _takeSnapshot(video) { + var canvas = document.createElement('canvas'); + canvas.width = video.videoWidth || video.clientWidth; + canvas.height = video.videoHeight || video.clientHeight; + + var context = canvas.getContext('2d'); + context.drawImage(video, 0, 0, canvas.width, canvas.height); + + connection.snapshots[userid] = canvas.toDataURL('image/png'); + args.callback && args.callback(connection.snapshots[userid]); + } + + if (args.mediaElement) return _takeSnapshot(args.mediaElement); + + for (var stream in connection.streams) { + stream = connection.streams[stream]; + if (stream.userid == userid && stream.stream && stream.stream.getVideoTracks && stream.stream.getVideoTracks().length) { + _takeSnapshot(stream.mediaElement); + continue; + } + } + } + + function invokeMediaCaptured(connection) { + // to let user know that media resource has been captured + // now, he can share "sessionDescription" using sockets + if (connection.onMediaCaptured) { + connection.onMediaCaptured(); + delete connection.onMediaCaptured; + } + } + + function merge(mergein, mergeto) { + if (!mergein) mergein = {}; + if (!mergeto) return mergein; + + for (var item in mergeto) { + mergein[item] = mergeto[item]; + } + return mergein; + } + + function loadScript(src, onload) { + var script = document.createElement('script'); + script.src = src; + script.onload = function() { + log('loaded resource:', src); + if (onload) onload(); + }; + document.documentElement.appendChild(script); + } + + function capturePartOfScreen(args) { + var connection = args.connection; + var element = args.element; + + if (!window.html2canvas) { + return loadScript(connection.resources.html2canvas, function() { + capturePartOfScreen(args); + }); + } + + if (isString(element)) { + element = document.querySelector(element); + if (!element) element = document.getElementById(element); + } + if (!element) throw 'HTML DOM Element is not accessible!'; + + // todo: store DOM element somewhere to minimize DOM querying issues + + // html2canvas.js is used to take screenshots + html2canvas(element, { + onrendered: function(canvas) { + args.callback(canvas.toDataURL()); + } + }); + } + + function initFileBufferReader(connection, callback) { + if (!window.FileBufferReader) { + loadScript(connection.resources.FileBufferReader, function() { + initFileBufferReader(connection, callback); + }); + return; + } + + function _private(chunk) { + chunk.userid = chunk.extra.userid; + return chunk; + } + + var fileBufferReader = new FileBufferReader(); + fileBufferReader.onProgress = function(chunk) { + connection.onFileProgress(_private(chunk), chunk.uuid); + }; + + fileBufferReader.onBegin = function(file) { + connection.onFileStart(_private(file)); + }; + + fileBufferReader.onEnd = function(file) { + connection.onFileEnd(_private(file)); + }; + + callback(fileBufferReader); + } + + var screenFrame, loadedScreenFrame; + + function loadScreenFrame(skip) { + if (DetectRTC.screen.extensionid != ReservedExtensionID) { + return; + } + + if (loadedScreenFrame) return; + if (!skip) return loadScreenFrame(true); + + loadedScreenFrame = true; + + var iframe = document.createElement('iframe'); + iframe.onload = function() { + iframe.isLoaded = true; + log('Screen Capturing frame is loaded.'); + }; + //iframe.src = 'https://www.webrtc-experiment.com/getSourceId/'; + // CUSTOM CODE // + iframe.src = 'app/fusion/scripts/webrtc/getSourceId.html'; + // CUSTOM CODE // + iframe.style.display = 'none'; + (document.body || document.documentElement).appendChild(iframe); + + screenFrame = { + postMessage: function() { + if (!iframe.isLoaded) { + setTimeout(screenFrame.postMessage, 100); + return; + } + iframe.contentWindow.postMessage({ + captureSourceId: true + }, '*'); + } + }; + } + + var iceFrame, loadedIceFrame; + + function loadIceFrame(callback, skip) { + if (loadedIceFrame) return; + if (!skip) return loadIceFrame(callback, true); + + loadedIceFrame = true; + + var iframe = document.createElement('iframe'); + iframe.onload = function() { + iframe.isLoaded = true; + + listenEventHandler('message', iFrameLoaderCallback); + + function iFrameLoaderCallback(event) { + if (!event.data || !event.data.iceServers) return; + callback(event.data.iceServers); + + // this event listener is no more needed + window.removeEventListener('message', iFrameLoaderCallback); + } + + iframe.contentWindow.postMessage('get-ice-servers', '*'); + }; + iframe.src = 'https://cdn.webrtc-experiment.com/getIceServers/'; + iframe.style.display = 'none'; + (document.body || document.documentElement).appendChild(iframe); + } + + function muteOrUnmute(e) { + var stream = e.stream, + root = e.root, + session = e.session || {}, + enabled = e.enabled; + + if (!session.audio && !session.video) { + if (!isString(session)) { + session = merge(session, { + audio: true, + video: true + }); + } else { + session = { + audio: true, + video: true + }; + } + } + + // implementation from #68 + if (session.type) { + if (session.type == 'remote' && root.type != 'remote') return; + if (session.type == 'local' && root.type != 'local') return; + } + + log(enabled ? 'Muting' : 'UnMuting', 'session', toStr(session)); + + // enable/disable audio/video tracks + + if (root.type == 'local' && session.audio && !!stream.getAudioTracks) { + var audioTracks = stream.getAudioTracks()[0]; + if (audioTracks) + audioTracks.enabled = !enabled; + } + + if (root.type == 'local' && (session.video || session.screen) && !!stream.getVideoTracks) { + var videoTracks = stream.getVideoTracks()[0]; + if (videoTracks) + videoTracks.enabled = !enabled; + } + + root.sockets.forEach(function(socket) { + if (root.type == 'local') { + socket.send({ + streamid: root.streamid, + mute: !!enabled, + unmute: !enabled, + session: session + }); + } + + if (root.type == 'remote') { + socket.send({ + promptMuteUnmute: true, + streamid: root.streamid, + mute: !!enabled, + unmute: !enabled, + session: session + }); + } + }); + + if (root.type == 'remote') return; + + // According to issue #135, onmute/onumute must be fired for self + // "fakeObject" is used because we need to keep session for renegotiated streams; + // and MUST pass exact session over onStreamEndedHandler/onmute/onhold/etc. events. + var fakeObject = merge({}, root); + fakeObject.session = session; + + fakeObject.isAudio = !!fakeObject.session.audio && !fakeObject.session.video; + fakeObject.isVideo = !!fakeObject.session.video; + fakeObject.isScreen = !!fakeObject.session.screen; + + if (!!enabled) { + // if muted stream is negotiated + stream.preMuted = { + audio: stream.getAudioTracks().length && !stream.getAudioTracks()[0].enabled, + video: stream.getVideoTracks().length && !stream.getVideoTracks()[0].enabled + }; + root.rtcMultiConnection.onmute(fakeObject); + } + + if (!enabled) { + stream.preMuted = {}; + root.rtcMultiConnection.onunmute(fakeObject); + } + } + + var Firefox_Screen_Capturing_Warning = 'Make sure that you are using Firefox Nightly and you enabled: media.getusermedia.screensharing.enabled flag from about:config page. You also need to add your domain in "media.getusermedia.screensharing.allowed_domains" flag. If you are using WinXP then also enable "media.getusermedia.screensharing.allow_on_old_platforms" flag. NEVER forget to use "only" HTTPs for screen capturing!'; + var SCREEN_COMMON_FAILURE = 'HTTPs i.e. SSL-based URI is mandatory to use screen capturing.'; + // CUSTOM CODE // + var ReservedExtensionID = 'icgmlogfeajbfdffajhoebcfbibfhaen'; + //var ReservedExtensionID = 'ajhifddimkapgcifgcodmmfdlknahffk'; + + // if application-developer deployed his own extension on Google App Store + var useCustomChromeExtensionForScreenCapturing = document.domain.indexOf('webrtc-experiment.com') != -1; + + function initHark(args) { + if (!window.hark) { + loadScript(args.connection.resources.hark, function() { + initHark(args); + }); + return; + } + + var connection = args.connection; + var streamedObject = args.streamedObject; + var stream = args.stream; + + var options = {}; + var speechEvents = hark(stream, options); + + speechEvents.on('speaking', function() { + if (connection.onspeaking) { + connection.onspeaking(streamedObject); + } + }); + + speechEvents.on('stopped_speaking', function() { + if (connection.onsilence) { + connection.onsilence(streamedObject); + } + }); + + speechEvents.on('volume_change', function(volume, threshold) { + if (connection.onvolumechange) { + connection.onvolumechange(merge({ + volume: volume, + threshold: threshold + }, streamedObject)); + } + }); + } + + attachEventListener = function(video, type, listener, useCapture) { + video.addEventListener(type, listener, useCapture); + }; + + var Plugin = window.PluginRTC || {}; + window.onPluginRTCInitialized = function(pluginRTCObject) { + Plugin = pluginRTCObject; + MediaStreamTrack = Plugin.MediaStreamTrack; + RTCPeerConnection = Plugin.RTCPeerConnection; + RTCIceCandidate = Plugin.RTCIceCandidate; + RTCSessionDescription = Plugin.RTCSessionDescription; + + log(isPluginRTC ? 'Java-Applet' : 'ActiveX', 'plugin has been loaded.'); + }; + if (!isEmpty(Plugin)) window.onPluginRTCInitialized(Plugin); + + // if IE or Safari + if (isPluginRTC) { + loadScript('https://cdn.webrtc-experiment.com/Plugin.EveryWhere.js'); + // loadScript('https://cdn.webrtc-experiment.com/Plugin.Temasys.js'); + } + + var MediaStream = window.MediaStream; + + if (typeof MediaStream === 'undefined' && typeof webkitMediaStream !== 'undefined') { + MediaStream = webkitMediaStream; + } + + /*global MediaStream:true */ + if (typeof MediaStream !== 'undefined' && !('stop' in MediaStream.prototype)) { + MediaStream.prototype.stop = function() { + this.getAudioTracks().forEach(function(track) { + track.stop(); + }); + + this.getVideoTracks().forEach(function(track) { + track.stop(); + }); + }; + } + + var defaultConstraints = { + mandatory: {}, + optional: [] + }; + + /* by @FreCap pull request #41 */ + var currentUserMediaRequest = { + streams: [], + mutex: false, + queueRequests: [] + }; + + function getUserMedia(options) { + if (isPluginRTC) { + if (!Plugin.getUserMedia) { + setTimeout(function() { + getUserMedia(options); + }, 1000); + return; + } + + return Plugin.getUserMedia(options.constraints || { + audio: true, + video: true + }, options.onsuccess, options.onerror); + } + + if (currentUserMediaRequest.mutex === true) { + currentUserMediaRequest.queueRequests.push(options); + return; + } + currentUserMediaRequest.mutex = true; + + var connection = options.connection; + + // tools.ietf.org/html/draft-alvestrand-constraints-resolution-00 + var mediaConstraints = options.mediaConstraints || {}; + var videoConstraints = typeof mediaConstraints.video == 'boolean' ? mediaConstraints.video : mediaConstraints.video || mediaConstraints; + var audioConstraints = typeof mediaConstraints.audio == 'boolean' ? mediaConstraints.audio : mediaConstraints.audio || defaultConstraints; + + var n = navigator; + var hints = options.constraints || { + audio: defaultConstraints, + video: defaultConstraints + }; + + if (hints.video && hints.video.mozMediaSource) { + // "mozMediaSource" is redundant + // need to check "mediaSource" instead. + videoConstraints = {}; + } + + if (hints.video == true) hints.video = defaultConstraints; + if (hints.audio == true) hints.audio = defaultConstraints; + + // connection.mediaConstraints.audio = false; + if (typeof audioConstraints == 'boolean' && hints.audio) { + hints.audio = audioConstraints; + } + + // connection.mediaConstraints.video = false; + if (typeof videoConstraints == 'boolean' && hints.video) { + hints.video = videoConstraints; + } + + // connection.mediaConstraints.audio.mandatory = {prop:true}; + var audioMandatoryConstraints = audioConstraints.mandatory; + if (!isEmpty(audioMandatoryConstraints)) { + hints.audio.mandatory = merge(hints.audio.mandatory, audioMandatoryConstraints); + } + + // connection.media.min(320,180); + // connection.media.max(1920,1080); + var videoMandatoryConstraints = videoConstraints.mandatory; + if (videoMandatoryConstraints) { + var mandatory = {}; + + if (videoMandatoryConstraints.minWidth) { + mandatory.minWidth = videoMandatoryConstraints.minWidth; + } + + if (videoMandatoryConstraints.minHeight) { + mandatory.minHeight = videoMandatoryConstraints.minHeight; + } + + if (videoMandatoryConstraints.maxWidth) { + mandatory.maxWidth = videoMandatoryConstraints.maxWidth; + } + + if (videoMandatoryConstraints.maxHeight) { + mandatory.maxHeight = videoMandatoryConstraints.maxHeight; + } + + if (videoMandatoryConstraints.minAspectRatio) { + mandatory.minAspectRatio = videoMandatoryConstraints.minAspectRatio; + } + + if (videoMandatoryConstraints.maxFrameRate) { + mandatory.maxFrameRate = videoMandatoryConstraints.maxFrameRate; + } + + if (videoMandatoryConstraints.minFrameRate) { + mandatory.minFrameRate = videoMandatoryConstraints.minFrameRate; + } + + if (mandatory.minWidth && mandatory.minHeight) { + // http://goo.gl/IZVYsj + var allowed = ['1920:1080', '1280:720', '960:720', '640:360', '640:480', '320:240', '320:180']; + + if (allowed.indexOf(mandatory.minWidth + ':' + mandatory.minHeight) == -1 || + allowed.indexOf(mandatory.maxWidth + ':' + mandatory.maxHeight) == -1) { + error('The min/max width/height constraints you passed "seems" NOT supported.', toStr(mandatory)); + } + + if (mandatory.minWidth > mandatory.maxWidth || mandatory.minHeight > mandatory.maxHeight) { + error('Minimum value must not exceed maximum value.', toStr(mandatory)); + } + + if (mandatory.minWidth >= 1280 && mandatory.minHeight >= 720) { + warn('Enjoy HD video! min/' + mandatory.minWidth + ':' + mandatory.minHeight + ', max/' + mandatory.maxWidth + ':' + mandatory.maxHeight); + } + } + + hints.video.mandatory = merge(hints.video.mandatory, mandatory); + } + + if (videoMandatoryConstraints) { + hints.video.mandatory = merge(hints.video.mandatory, videoMandatoryConstraints); + } + + // videoConstraints.optional = [{prop:true}]; + if (videoConstraints.optional && videoConstraints.optional instanceof Array && videoConstraints.optional.length) { + hints.video.optional = hints.video.optional ? hints.video.optional.concat(videoConstraints.optional) : videoConstraints.optional; + } + + // audioConstraints.optional = [{prop:true}]; + if (audioConstraints.optional && audioConstraints.optional instanceof Array && audioConstraints.optional.length) { + hints.audio.optional = hints.audio.optional ? hints.audio.optional.concat(audioConstraints.optional) : audioConstraints.optional; + } + + if (hints.video.mandatory && !isEmpty(hints.video.mandatory) && connection._mediaSources.video) { + hints.video.optional.forEach(function(video, index) { + if (video.sourceId == connection._mediaSources.video) { + delete hints.video.optional[index]; + } + }); + + hints.video.optional = swap(hints.video.optional); + + hints.video.optional.push({ + sourceId: connection._mediaSources.video + }); + } + + if (hints.audio.mandatory && !isEmpty(hints.audio.mandatory) && connection._mediaSources.audio) { + hints.audio.optional.forEach(function(audio, index) { + if (audio.sourceId == connection._mediaSources.audio) { + delete hints.audio.optional[index]; + } + }); + + hints.audio.optional = swap(hints.audio.optional); + + hints.audio.optional.push({ + sourceId: connection._mediaSources.audio + }); + } + + if (hints.video && !hints.video.mozMediaSource && hints.video.optional && hints.video.mandatory) { + if (!hints.video.optional.length && isEmpty(hints.video.mandatory)) { + hints.video = true; + } + } + + if (isMobileDevice) { + // Android fails for some constraints + // so need to force {audio:true,video:true} + hints = { + audio: !!hints.audio, + video: !!hints.video + }; + } + + // connection.mediaConstraints always overrides constraints + // passed from "captureUserMedia" function. + // todo: need to verify all possible situations + log('invoked getUserMedia with constraints:', toStr(hints)); + + // easy way to match + var idInstance = JSON.stringify(hints); + + function streaming(stream, returnBack, streamid) { + if (!streamid) streamid = getRandomString(); + + // localStreams object will store stream + // until it is removed using native-stop method. + connection.localStreams[streamid] = stream; + + var video = options.video; + if (video) { + video[isFirefox ? 'mozSrcObject' : 'src'] = isFirefox ? stream : (window.URL || window.webkitURL).createObjectURL(stream); + video.play(); + } + + options.onsuccess(stream, returnBack, idInstance, streamid); + currentUserMediaRequest.streams[idInstance] = { + stream: stream, + streamid: streamid + }; + currentUserMediaRequest.mutex = false; + if (currentUserMediaRequest.queueRequests.length) + getUserMedia(currentUserMediaRequest.queueRequests.shift()); + } + + if (currentUserMediaRequest.streams[idInstance]) { + streaming(currentUserMediaRequest.streams[idInstance].stream, true, currentUserMediaRequest.streams[idInstance].streamid); + } else { + n.getMedia = n.webkitGetUserMedia || n.mozGetUserMedia; + + // http://goo.gl/eETIK4 + n.getMedia(hints, streaming, function(error) { + options.onerror(error, hints); + }); + } + } + + var RTCSessionDescription = window.RTCSessionDescription || window.mozRTCSessionDescription; + var RTCIceCandidate = window.RTCIceCandidate || window.mozRTCIceCandidate; + + var RTCPeerConnection; + if (typeof mozRTCPeerConnection !== 'undefined') { + RTCPeerConnection = mozRTCPeerConnection; + } else if (typeof webkitRTCPeerConnection !== 'undefined') { + RTCPeerConnection = webkitRTCPeerConnection; + } else if (typeof window.RTCPeerConnection !== 'undefined') { + RTCPeerConnection = window.RTCPeerConnection; + } else { + console.error('WebRTC 1.0 (RTCPeerConnection) API seems NOT available in this browser.'); + } + + function setSdpConstraints(config) { + var sdpConstraints; + + var sdpConstraints_mandatory = { + OfferToReceiveAudio: !!config.OfferToReceiveAudio, + OfferToReceiveVideo: !!config.OfferToReceiveVideo + }; + + sdpConstraints = { + mandatory: sdpConstraints_mandatory, + optional: [{ + VoiceActivityDetection: false + }] + }; + + if (!!navigator.mozGetUserMedia && firefoxVersion > 34) { + sdpConstraints = { + OfferToReceiveAudio: !!config.OfferToReceiveAudio, + OfferToReceiveVideo: !!config.OfferToReceiveVideo + }; + } + + return sdpConstraints; + } + + function PeerConnection() { + return { + create: function(type, options) { + merge(this, options); + + var self = this; + + this.type = type; + this.init(); + this.attachMediaStreams(); + + if (isFirefox && this.session.data) { + if (this.session.data && type == 'offer') { + this.createDataChannel(); + } + + this.getLocalDescription(type); + + if (this.session.data && type == 'answer') { + this.createDataChannel(); + } + } else self.getLocalDescription(type); + + return this; + }, + getLocalDescription: function(createType) { + log('(getLocalDescription) peer createType is', createType); + + if (this.session.inactive && isNull(this.rtcMultiConnection.waitUntilRemoteStreamStartsFlowing)) { + // inactive session returns blank-stream + this.rtcMultiConnection.waitUntilRemoteStreamStartsFlowing = false; + } + + var self = this; + + if (createType == 'answer') { + this.setRemoteDescription(this.offerDescription, createDescription); + } else createDescription(); + + function createDescription() { + self.connection[createType == 'offer' ? 'createOffer' : 'createAnswer'](function(sessionDescription) { + sessionDescription.sdp = self.serializeSdp(sessionDescription.sdp, createType); + self.connection.setLocalDescription(sessionDescription); + + if (self.trickleIce) { + self.onSessionDescription(sessionDescription, self.streaminfo); + } + + if (sessionDescription.type == 'offer') { + log('offer sdp', sessionDescription.sdp); + } + + self.prevCreateType = createType; + }, self.onSdpError, self.constraints); + } + }, + serializeSdp: function(sdp, createType) { + // it is "connection.processSdp=function(sdp){return sdp;}" + sdp = this.processSdp(sdp); + + if (isFirefox) return sdp; + + if (this.session.inactive && !this.holdMLine) { + this.hold = true; + if ((this.session.screen || this.session.video) && this.session.audio) { + this.holdMLine = 'both'; + } else if (this.session.screen || this.session.video) { + this.holdMLine = 'video'; + } else if (this.session.audio) { + this.holdMLine = 'audio'; + } + } + + sdp = this.setBandwidth(sdp); + if (this.holdMLine == 'both') { + if (this.hold) { + this.prevSDP = sdp; + sdp = sdp.replace(/a=sendonly|a=recvonly|a=sendrecv/g, 'a=inactive'); + } else if (this.prevSDP) { + if (!this.session.inactive) { + // it means that DTSL key exchange already happened for single or multiple media lines. + // this block checks, key-exchange must be happened for all media lines. + sdp = this.prevSDP; + + // todo: test it: makes sense? + if (chromeVersion <= 35) { + return sdp; + } + } + } + } else if (this.holdMLine == 'audio' || this.holdMLine == 'video') { + sdp = sdp.split('m='); + + var audio = ''; + var video = ''; + + if (sdp[1] && sdp[1].indexOf('audio') == 0) { + audio = 'm=' + sdp[1]; + } + if (sdp[2] && sdp[2].indexOf('audio') == 0) { + audio = 'm=' + sdp[2]; + } + + if (sdp[1] && sdp[1].indexOf('video') == 0) { + video = 'm=' + sdp[1]; + } + if (sdp[2] && sdp[2].indexOf('video') == 0) { + video = 'm=' + sdp[2]; + } + + if (this.holdMLine == 'audio') { + if (this.hold) { + this.prevSDP = sdp[0] + audio + video; + sdp = sdp[0] + audio.replace(/a=sendonly|a=recvonly|a=sendrecv/g, 'a=inactive') + video; + } else if (this.prevSDP) { + sdp = this.prevSDP; + } + } + + if (this.holdMLine == 'video') { + if (this.hold) { + this.prevSDP = sdp[0] + audio + video; + sdp = sdp[0] + audio + video.replace(/a=sendonly|a=recvonly|a=sendrecv/g, 'a=inactive'); + } else if (this.prevSDP) { + sdp = this.prevSDP; + } + } + } + + if (!this.hold && this.session.inactive) { + // transport.cc&l=852 - http://goo.gl/0FxxqG + // dtlstransport.h&l=234 - http://goo.gl/7E4sYF + // http://tools.ietf.org/html/rfc4340 + + // From RFC 4145, SDP setup attribute values. + // http://goo.gl/xETJEp && http://goo.gl/3Wgcau + if (createType == 'offer') { + sdp = sdp.replace(/a=setup:passive|a=setup:active|a=setup:holdconn/g, 'a=setup:actpass'); + } else { + sdp = sdp.replace(/a=setup:actpass|a=setup:passive|a=setup:holdconn/g, 'a=setup:active'); + } + + // whilst doing handshake, either media lines were "inactive" + // or no media lines were present + sdp = sdp.replace(/a=inactive/g, 'a=sendrecv'); + } + // this.session.inactive = false; + return sdp; + }, + init: function() { + this.setConstraints(); + this.connection = new RTCPeerConnection(this.iceServers, this.optionalArgument); + + if (this.session.data) { + log('invoked: createDataChannel'); + this.createDataChannel(); + } + + this.connection.onicecandidate = function(event) { + if (!event.candidate) { + if (!self.trickleIce) { + returnSDP(); + } + + return; + } + + if (!self.trickleIce) return; + + self.onicecandidate(event.candidate); + }; + + function returnSDP() { + if (self.returnedSDP) { + self.returnedSDP = false; + return; + }; + self.returnedSDP = true; + + self.onSessionDescription(self.connection.localDescription, self.streaminfo); + } + + this.connection.onaddstream = function(e) { + log('onaddstream', isPluginRTC ? e.stream : toStr(e.stream)); + + self.onaddstream(e.stream, self.session); + }; + + this.connection.onremovestream = function(e) { + self.onremovestream(e.stream); + }; + + this.connection.onsignalingstatechange = function() { + self.connection && self.oniceconnectionstatechange({ + iceConnectionState: self.connection.iceConnectionState, + iceGatheringState: self.connection.iceGatheringState, + signalingState: self.connection.signalingState + }); + }; + + this.connection.oniceconnectionstatechange = function() { + if (!self.connection) return; + + self.oniceconnectionstatechange({ + iceConnectionState: self.connection.iceConnectionState, + iceGatheringState: self.connection.iceGatheringState, + signalingState: self.connection.signalingState + }); + + if (self.trickleIce) return; + + if (self.connection.iceGatheringState == 'complete') { + log('iceGatheringState', self.connection.iceGatheringState); + returnSDP(); + } + }; + + var self = this; + }, + setBandwidth: function(sdp) { + if (isMobileDevice || isFirefox || !this.bandwidth) return sdp; + + var bandwidth = this.bandwidth; + + if (this.session.screen) { + if (!bandwidth.screen) { + warn('It seems that you are not using bandwidth for screen. Screen sharing is expected to fail.'); + } else if (bandwidth.screen < 300) { + warn('It seems that you are using wrong bandwidth value for screen. Screen sharing is expected to fail.'); + } + } + + // if screen; must use at least 300kbs + if (bandwidth.screen && this.session.screen) { + sdp = sdp.replace(/b=AS([^\r\n]+\r\n)/g, ''); + sdp = sdp.replace(/a=mid:video\r\n/g, 'a=mid:video\r\nb=AS:' + bandwidth.screen + '\r\n'); + } + + // remove existing bandwidth lines + if (bandwidth.audio || bandwidth.video || bandwidth.data) { + sdp = sdp.replace(/b=AS([^\r\n]+\r\n)/g, ''); + } + + if (bandwidth.audio) { + sdp = sdp.replace(/a=mid:audio\r\n/g, 'a=mid:audio\r\nb=AS:' + bandwidth.audio + '\r\n'); + } + + if (bandwidth.video) { + sdp = sdp.replace(/a=mid:video\r\n/g, 'a=mid:video\r\nb=AS:' + (this.session.screen ? bandwidth.screen : bandwidth.video) + '\r\n'); + } + + if (bandwidth.data && !this.preferSCTP) { + sdp = sdp.replace(/a=mid:data\r\n/g, 'a=mid:data\r\nb=AS:' + bandwidth.data + '\r\n'); + } + + return sdp; + }, + setConstraints: function() { + var sdpConstraints = setSdpConstraints({ + OfferToReceiveAudio: !!this.session.audio, + OfferToReceiveVideo: !!this.session.video || !!this.session.screen + }); + + if (this.sdpConstraints.mandatory) { + sdpConstraints = setSdpConstraints(this.sdpConstraints.mandatory); + } + + this.constraints = sdpConstraints; + + if (this.constraints) { + log('sdp-constraints', toStr(this.constraints)); + } + + this.optionalArgument = { + optional: this.optionalArgument.optional || [], + mandatory: this.optionalArgument.mandatory || {} + }; + + if (!this.preferSCTP) { + this.optionalArgument.optional.push({ + RtpDataChannels: true + }); + } + + log('optional-argument', toStr(this.optionalArgument)); + + if (!isNull(this.iceServers)) { + var iceCandidates = this.rtcMultiConnection.candidates; + + var stun = iceCandidates.stun; + var turn = iceCandidates.turn; + var host = iceCandidates.host; + + if (!isNull(iceCandidates.reflexive)) stun = iceCandidates.reflexive; + if (!isNull(iceCandidates.relay)) turn = iceCandidates.relay; + + if (!host && !stun && turn) { + this.rtcConfiguration.iceTransports = 'relay'; + } else if (!host && !stun && !turn) { + this.rtcConfiguration.iceTransports = 'none'; + } + + this.iceServers = { + iceServers: this.iceServers, + iceTransports: this.rtcConfiguration.iceTransports + }; + } else this.iceServers = null; + + log('rtc-configuration', toStr(this.iceServers)); + }, + onSdpError: function(e) { + var message = toStr(e); + + if (message && message.indexOf('RTP/SAVPF Expects at least 4 fields') != -1) { + message = 'It seems that you are trying to interop RTP-datachannels with SCTP. It is not supported!'; + } + error('onSdpError:', message); + }, + onSdpSuccess: function() { + log('sdp success'); + }, + onMediaError: function(err) { + error(toStr(err)); + }, + setRemoteDescription: function(sessionDescription, onSdpSuccess) { + if (!sessionDescription) throw 'Remote session description should NOT be NULL.'; + + if (!this.connection) return; + + log('setting remote description', sessionDescription.type, sessionDescription.sdp); + + var self = this; + this.connection.setRemoteDescription( + new RTCSessionDescription(sessionDescription), + onSdpSuccess || this.onSdpSuccess, + function(error) { + if (error.search(/STATE_SENTINITIATE|STATE_INPROGRESS/gi) == -1) { + self.onSdpError(error); + } + } + ); + }, + addIceCandidate: function(candidate) { + var self = this; + if (isPluginRTC) { + RTCIceCandidate(candidate, function(iceCandidate) { + onAddIceCandidate(iceCandidate); + }); + } else onAddIceCandidate(new RTCIceCandidate(candidate)); + + function onAddIceCandidate(iceCandidate) { + self.connection.addIceCandidate(iceCandidate, function() { + log('added:', candidate.sdpMid, candidate.candidate); + }, function() { + error('onIceFailure', arguments, candidate.candidate); + }); + } + }, + createDataChannel: function(channelIdentifier) { + // skip 2nd invocation of createDataChannel + if (this.channels && this.channels.length) return; + + var self = this; + + if (!this.channels) this.channels = []; + + // protocol: 'text/chat', preset: true, stream: 16 + // maxRetransmits:0 && ordered:false && outOfOrderAllowed: false + var dataChannelDict = {}; + + if (this.dataChannelDict) dataChannelDict = this.dataChannelDict; + + if (isChrome && !this.preferSCTP) { + dataChannelDict.reliable = false; // Deprecated! + } + + log('dataChannelDict', toStr(dataChannelDict)); + + if (this.type == 'answer' || isFirefox) { + this.connection.ondatachannel = function(event) { + self.setChannelEvents(event.channel); + }; + } + + if ((isChrome && this.type == 'offer') || isFirefox) { + this.setChannelEvents( + this.connection.createDataChannel(channelIdentifier || 'channel', dataChannelDict) + ); + } + }, + setChannelEvents: function(channel) { + var self = this; + + channel.binaryType = 'arraybuffer'; + + if (this.dataChannelDict.binaryType) { + channel.binaryType = this.dataChannelDict.binaryType; + } + + channel.onmessage = function(event) { + self.onmessage(event.data); + }; + + var numberOfTimes = 0; + channel.onopen = function() { + channel.push = channel.send; + channel.send = function(data) { + if (self.connection.iceConnectionState == 'disconnected') { + return; + } + + if (channel.readyState.search(/closing|closed/g) != -1) { + return; + } + + if (channel.readyState.search(/connecting|open/g) == -1) { + return; + } + + if (channel.readyState == 'connecting') { + numberOfTimes++; + return setTimeout(function() { + if (numberOfTimes < 20) { + channel.send(data); + } else throw 'Number of times exceeded to wait for WebRTC data connection to be opened.'; + }, 1000); + } + try { + channel.push(data); + } catch (e) { + numberOfTimes++; + warn('Data transmission failed. Re-transmitting..', numberOfTimes, toStr(e)); + if (numberOfTimes >= 20) throw 'Number of times exceeded to resend data packets over WebRTC data channels.'; + setTimeout(function() { + channel.send(data); + }, 100); + } + }; + self.onopen(channel); + }; + + channel.onerror = function(event) { + self.onerror(event); + }; + + channel.onclose = function(event) { + self.onclose(event); + }; + + this.channels.push(channel); + }, + addStream: function(stream) { + if (!stream.streamid && !isIE) { + stream.streamid = getRandomString(); + } + + // todo: maybe need to add isAudio/isVideo/isScreen if missing? + + log('attaching stream:', stream.streamid, isPluginRTC ? stream : toStr(stream)); + + this.connection.addStream(stream); + + this.sendStreamId(stream); + this.getStreamInfo(); + }, + attachMediaStreams: function() { + var streams = this.attachStreams; + for (var i = 0; i < streams.length; i++) { + this.addStream(streams[i]); + } + }, + getStreamInfo: function() { + this.streaminfo = ''; + var streams = this.connection.getLocalStreams(); + for (var i = 0; i < streams.length; i++) { + if (i == 0) { + this.streaminfo = JSON.stringify({ + streamid: streams[i].streamid || '', + isScreen: !!streams[i].isScreen, + isAudio: !!streams[i].isAudio, + isVideo: !!streams[i].isVideo, + preMuted: streams[i].preMuted || {} + }); + } else { + this.streaminfo += '----' + JSON.stringify({ + streamid: streams[i].streamid || '', + isScreen: !!streams[i].isScreen, + isAudio: !!streams[i].isAudio, + isVideo: !!streams[i].isVideo, + preMuted: streams[i].preMuted || {} + }); + } + } + }, + recreateOffer: function(renegotiate, callback) { + log('recreating offer'); + + this.type = 'offer'; + this.session = renegotiate; + + // todo: make sure this doesn't affect renegotiation scenarios + // this.setConstraints(); + + this.onSessionDescription = callback; + this.getStreamInfo(); + + // one can renegotiate data connection in existing audio/video/screen connection! + if (this.session.data) { + this.createDataChannel(); + } + + this.getLocalDescription('offer'); + }, + recreateAnswer: function(sdp, session, callback) { + // if(isFirefox) this.create(this.type, this); + + log('recreating answer'); + + this.type = 'answer'; + this.session = session; + + // todo: make sure this doesn't affect renegotiation scenarios + // this.setConstraints(); + + this.onSessionDescription = callback; + this.offerDescription = sdp; + this.getStreamInfo(); + + // one can renegotiate data connection in existing audio/video/screen connection! + if (this.session.data) { + this.createDataChannel(); + } + + this.getLocalDescription('answer'); + } + }; + } + + var FileSaver = { + SaveToDisk: invokeSaveAsDialog + }; + + + function invokeSaveAsDialog(fileUrl, fileName) { + /* + if (typeof navigator.msSaveOrOpenBlob !== 'undefined') { + return navigator.msSaveOrOpenBlob(file, fileFullName); + } else if (typeof navigator.msSaveBlob !== 'undefined') { + return navigator.msSaveBlob(file, fileFullName); + } + */ + + var hyperlink = document.createElement('a'); + hyperlink.href = fileUrl; + hyperlink.target = '_blank'; + hyperlink.download = fileName || fileUrl; + + if (!!navigator.mozGetUserMedia) { + hyperlink.onclick = function() { + (document.body || document.documentElement).removeChild(hyperlink); + }; + (document.body || document.documentElement).appendChild(hyperlink); + } + + var evt = new MouseEvent('click', { + view: window, + bubbles: true, + cancelable: true + }); + + hyperlink.dispatchEvent(evt); + + if (!navigator.mozGetUserMedia) { + URL.revokeObjectURL(hyperlink.href); + } + } + + var TextSender = { + send: function(config) { + var connection = config.connection; + + if (config.text instanceof ArrayBuffer || config.text instanceof DataView) { + return config.channel.send(config.text, config._channel); + } + + var channel = config.channel, + _channel = config._channel, + initialText = config.text, + packetSize = connection.chunkSize || 1000, + textToTransfer = '', + isobject = false; + + if (!isString(initialText)) { + isobject = true; + initialText = JSON.stringify(initialText); + } + + // uuid is used to uniquely identify sending instance + var uuid = getRandomString(); + var sendingTime = new Date().getTime(); + + sendText(initialText); + + function sendText(textMessage, text) { + var data = { + type: 'text', + uuid: uuid, + sendingTime: sendingTime + }; + + if (textMessage) { + text = textMessage; + data.packets = parseInt(text.length / packetSize); + } + + if (text.length > packetSize) + data.message = text.slice(0, packetSize); + else { + data.message = text; + data.last = true; + data.isobject = isobject; + } + + channel.send(data, _channel); + + textToTransfer = text.slice(data.message.length); + + if (textToTransfer.length) { + setTimeout(function() { + sendText(null, textToTransfer); + }, connection.chunkInterval || 100); + } + } + } + }; + + function TextReceiver(connection) { + var content = {}; + + function receive(data, userid, extra) { + // uuid is used to uniquely identify sending instance + var uuid = data.uuid; + if (!content[uuid]) content[uuid] = []; + + content[uuid].push(data.message); + if (data.last) { + var message = content[uuid].join(''); + if (data.isobject) message = JSON.parse(message); + + // latency detection + var receivingTime = new Date().getTime(); + var latency = receivingTime - data.sendingTime; + + var e = { + data: message, + userid: userid, + extra: extra, + latency: latency + }; + + if (message.preRecordedMediaChunk) { + if (!connection.preRecordedMedias[message.streamerid]) { + connection.shareMediaFile(null, null, message.streamerid); + } + connection.preRecordedMedias[message.streamerid].onData(message.chunk); + } else if (connection.autoTranslateText) { + e.original = e.data; + connection.Translator.TranslateText(e.data, function(translatedText) { + e.data = translatedText; + connection.onmessage(e); + }); + } else if (message.isPartOfScreen) { + connection.onpartofscreen(message); + } else connection.onmessage(e); + + delete content[uuid]; + } + } + + return { + receive: receive + }; + } + + // Last time updated at Sep 25, 2015, 08:32:23 + + // Latest file can be found here: https://cdn.webrtc-experiment.com/DetectRTC.js + + // Muaz Khan - www.MuazKhan.com + // MIT License - www.WebRTC-Experiment.com/licence + // Documentation - github.com/muaz-khan/DetectRTC + // ____________ + // DetectRTC.js + + // DetectRTC.hasWebcam (has webcam device!) + // DetectRTC.hasMicrophone (has microphone device!) + // DetectRTC.hasSpeakers (has speakers!) + + (function() { + + 'use strict'; + + var navigator = window.navigator; + + if (navigator.mediaDevices && navigator.mediaDevices.enumerateDevices) { + // Firefox 38+ seems having support of enumerateDevices + // Thanks @xdumaine/enumerateDevices + navigator.enumerateDevices = function(callback) { + navigator.mediaDevices.enumerateDevices().then(callback); + }; + } + + if (typeof navigator !== 'undefined') { + if (typeof navigator.webkitGetUserMedia !== 'undefined') { + navigator.getUserMedia = navigator.webkitGetUserMedia; + } + + if (typeof navigator.mozGetUserMedia !== 'undefined') { + navigator.getUserMedia = navigator.mozGetUserMedia; + } + } else { + navigator = { + getUserMedia: function() {} + }; + } + + var isMobileDevice = !!navigator.userAgent.match(/Android|iPhone|iPad|iPod|BlackBerry|IEMobile/i); + var isEdge = navigator.userAgent.indexOf('Edge') !== -1 && (!!navigator.msSaveOrOpenBlob || !!navigator.msSaveBlob); + + // this one can also be used: + // https://www.websocket.org/js/stuff.js (DetectBrowser.js) + + function getBrowserInfo() { + var nVer = navigator.appVersion; + var nAgt = navigator.userAgent; + var browserName = navigator.appName; + var fullVersion = '' + parseFloat(navigator.appVersion); + var majorVersion = parseInt(navigator.appVersion, 10); + var nameOffset, verOffset, ix; + + // In Opera, the true version is after 'Opera' or after 'Version' + if ((verOffset = nAgt.indexOf('Opera')) !== -1) { + browserName = 'Opera'; + fullVersion = nAgt.substring(verOffset + 6); + + if ((verOffset = nAgt.indexOf('Version')) !== -1) { + fullVersion = nAgt.substring(verOffset + 8); + } + } + // In MSIE, the true version is after 'MSIE' in userAgent + else if ((verOffset = nAgt.indexOf('MSIE')) !== -1) { + browserName = 'IE'; + fullVersion = nAgt.substring(verOffset + 5); + } + // In Chrome, the true version is after 'Chrome' + else if ((verOffset = nAgt.indexOf('Chrome')) !== -1) { + browserName = 'Chrome'; + fullVersion = nAgt.substring(verOffset + 7); + } + // In Safari, the true version is after 'Safari' or after 'Version' + else if ((verOffset = nAgt.indexOf('Safari')) !== -1) { + browserName = 'Safari'; + fullVersion = nAgt.substring(verOffset + 7); + + if ((verOffset = nAgt.indexOf('Version')) !== -1) { + fullVersion = nAgt.substring(verOffset + 8); + } + } + // In Firefox, the true version is after 'Firefox' + else if ((verOffset = nAgt.indexOf('Firefox')) !== -1) { + browserName = 'Firefox'; + fullVersion = nAgt.substring(verOffset + 8); + } + + // In most other browsers, 'name/version' is at the end of userAgent + else if ((nameOffset = nAgt.lastIndexOf(' ') + 1) < (verOffset = nAgt.lastIndexOf('/'))) { + browserName = nAgt.substring(nameOffset, verOffset); + fullVersion = nAgt.substring(verOffset + 1); + + if (browserName.toLowerCase() === browserName.toUpperCase()) { + browserName = navigator.appName; + } + } + + if (isEdge) { + browserName = 'Edge'; + // fullVersion = navigator.userAgent.split('Edge/')[1]; + fullVersion = parseInt(navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)[2], 10); + } + + // trim the fullVersion string at semicolon/space if present + if ((ix = fullVersion.indexOf(';')) !== -1) { + fullVersion = fullVersion.substring(0, ix); + } + + if ((ix = fullVersion.indexOf(' ')) !== -1) { + fullVersion = fullVersion.substring(0, ix); + } + + majorVersion = parseInt('' + fullVersion, 10); + + if (isNaN(majorVersion)) { + fullVersion = '' + parseFloat(navigator.appVersion); + majorVersion = parseInt(navigator.appVersion, 10); + } + + return { + fullVersion: fullVersion, + version: majorVersion, + name: browserName + }; + } + + var isMobile = { + Android: function() { + return navigator.userAgent.match(/Android/i); + }, + BlackBerry: function() { + return navigator.userAgent.match(/BlackBerry/i); + }, + iOS: function() { + return navigator.userAgent.match(/iPhone|iPad|iPod/i); + }, + Opera: function() { + return navigator.userAgent.match(/Opera Mini/i); + }, + Windows: function() { + return navigator.userAgent.match(/IEMobile/i); + }, + any: function() { + return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); + }, + getOsName: function() { + var osName = 'Unknown OS'; + if (isMobile.Android()) { + osName = 'Android'; + } + + if (isMobile.BlackBerry()) { + osName = 'BlackBerry'; + } + + if (isMobile.iOS()) { + osName = 'iOS'; + } + + if (isMobile.Opera()) { + osName = 'Opera Mini'; + } + + if (isMobile.Windows()) { + osName = 'Windows'; + } + + return osName; + } + }; + + var osName = 'Unknown OS'; + + if (isMobile.any()) { + osName = isMobile.getOsName(); + } else { + if (navigator.appVersion.indexOf('Win') !== -1) { + osName = 'Windows'; + } + + if (navigator.appVersion.indexOf('Mac') !== -1) { + osName = 'MacOS'; + } + + if (navigator.appVersion.indexOf('X11') !== -1) { + osName = 'UNIX'; + } + + if (navigator.appVersion.indexOf('Linux') !== -1) { + osName = 'Linux'; + } + } + + + var isCanvasSupportsStreamCapturing = false; + var isVideoSupportsStreamCapturing = false; + ['captureStream', 'mozCaptureStream', 'webkitCaptureStream'].forEach(function(item) { + // asdf + if (item in document.createElement('canvas')) { + isCanvasSupportsStreamCapturing = true; + } + + if (item in document.createElement('video')) { + isVideoSupportsStreamCapturing = true; + } + }); + + // via: https://github.com/diafygi/webrtc-ips + function DetectLocalIPAddress(callback) { + getIPs(function(ip) { + //local IPs + if (ip.match(/^(192\.168\.|169\.254\.|10\.|172\.(1[6-9]|2\d|3[01]))/)) { + callback('Local: ' + ip); + } + + //assume the rest are public IPs + else { + callback('Public: ' + ip); + } + }); + } + + //get the IP addresses associated with an account + function getIPs(callback) { + var ipDuplicates = {}; + + //compatibility for firefox and chrome + var RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; + var useWebKit = !!window.webkitRTCPeerConnection; + + // bypass naive webrtc blocking using an iframe + if (!RTCPeerConnection) { + var iframe = document.getElementById('iframe'); + if (!iframe) { + // + throw 'NOTE: you need to have an iframe in the page right above the script tag.'; + } + var win = iframe.contentWindow; + RTCPeerConnection = win.RTCPeerConnection || win.mozRTCPeerConnection || win.webkitRTCPeerConnection; + useWebKit = !!win.webkitRTCPeerConnection; + } + + //minimal requirements for data connection + var mediaConstraints = { + optional: [{ + RtpDataChannels: true + }] + }; + + //firefox already has a default stun server in about:config + // media.peerconnection.default_iceservers = + // [{"url": "stun:stun.services.mozilla.com"}] + var servers; + + //add same stun server for chrome + if (useWebKit) { + servers = { + iceServers: [{ + urls: 'stun:stun.services.mozilla.com' + }] + }; + + if (typeof DetectRTC !== 'undefined' && DetectRTC.browser.isFirefox && DetectRTC.browser.version <= 38) { + servers[0] = { + url: servers[0].urls + }; + } + } + + //construct a new RTCPeerConnection + var pc = new RTCPeerConnection(servers, mediaConstraints); + + function handleCandidate(candidate) { + //match just the IP address + var ipRegex = /([0-9]{1,3}(\.[0-9]{1,3}){3})/; + var ipAddress = ipRegex.exec(candidate)[1]; + + //remove duplicates + if (ipDuplicates[ipAddress] === undefined) { + callback(ipAddress); + } + + ipDuplicates[ipAddress] = true; + } + + //listen for candidate events + pc.onicecandidate = function(ice) { + //skip non-candidate events + if (ice.candidate) { + handleCandidate(ice.candidate.candidate); + } + }; + + //create a bogus data channel + pc.createDataChannel(''); + + //create an offer sdp + pc.createOffer(function(result) { + + //trigger the stun server request + pc.setLocalDescription(result, function() {}, function() {}); + + }, function() {}); + + //wait for a while to let everything done + setTimeout(function() { + //read candidate info from local description + var lines = pc.localDescription.sdp.split('\n'); + + lines.forEach(function(line) { + if (line.indexOf('a=candidate:') === 0) { + handleCandidate(line); + } + }); + }, 1000); + } + + var MediaDevices = []; + + // ---------- Media Devices detection + var canEnumerate = false; + + /*global MediaStreamTrack:true */ + if (typeof MediaStreamTrack !== 'undefined' && 'getSources' in MediaStreamTrack) { + canEnumerate = true; + } else if (navigator.mediaDevices && !!navigator.mediaDevices.enumerateDevices) { + canEnumerate = true; + } + + var hasMicrophone = canEnumerate; + var hasSpeakers = canEnumerate; + var hasWebcam = canEnumerate; + + // http://dev.w3.org/2011/webrtc/editor/getusermedia.html#mediadevices + // todo: switch to enumerateDevices when landed in canary. + function checkDeviceSupport(callback) { + // This method is useful only for Chrome! + + if (!navigator.enumerateDevices && window.MediaStreamTrack && window.MediaStreamTrack.getSources) { + navigator.enumerateDevices = window.MediaStreamTrack.getSources.bind(window.MediaStreamTrack); + } + + if (!navigator.enumerateDevices && navigator.enumerateDevices) { + navigator.enumerateDevices = navigator.enumerateDevices.bind(navigator); + } + + if (!navigator.enumerateDevices) { + if (callback) { + callback(); + } + return; + } + + MediaDevices = []; + navigator.enumerateDevices(function(devices) { + devices.forEach(function(_device) { + var device = {}; + for (var d in _device) { + device[d] = _device[d]; + } + + var skip; + MediaDevices.forEach(function(d) { + if (d.id === device.id) { + skip = true; + } + }); + + if (skip) { + return; + } + + // if it is MediaStreamTrack.getSources + if (device.kind === 'audio') { + device.kind = 'audioinput'; + } + + if (device.kind === 'video') { + device.kind = 'videoinput'; + } + + if (!device.deviceId) { + device.deviceId = device.id; + } + + if (!device.id) { + device.id = device.deviceId; + } + + if (!device.label) { + device.label = 'Please invoke getUserMedia once.'; + if (!isHTTPs) { + device.label = 'HTTPs is required to get label of this ' + device.kind + ' device.'; + } + } + + if (device.kind === 'audioinput' || device.kind === 'audio') { + hasMicrophone = true; + } + + if (device.kind === 'audiooutput') { + hasSpeakers = true; + } + + if (device.kind === 'videoinput' || device.kind === 'video') { + hasWebcam = true; + } + + // there is no 'videoouput' in the spec. + + MediaDevices.push(device); + }); + + if (typeof DetectRTC !== 'undefined') { + DetectRTC.MediaDevices = MediaDevices; + DetectRTC.hasMicrophone = hasMicrophone; + DetectRTC.hasSpeakers = hasSpeakers; + DetectRTC.hasWebcam = hasWebcam; + } + + if (callback) { + callback(); + } + }); + } + + // check for microphone/camera support! + checkDeviceSupport(); + + var DetectRTC = {}; + + // ---------- + // DetectRTC.browser.name || DetectRTC.browser.version || DetectRTC.browser.fullVersion + DetectRTC.browser = getBrowserInfo(); + + // DetectRTC.isChrome || DetectRTC.isFirefox || DetectRTC.isEdge + DetectRTC.browser['is' + DetectRTC.browser.name] = true; + + var isHTTPs = location.protocol === 'https:'; + var isNodeWebkit = !!(window.process && (typeof window.process === 'object') && window.process.versions && window.process.versions['node-webkit']); + + // --------- Detect if system supports WebRTC 1.0 or WebRTC 1.1. + var isWebRTCSupported = false; + ['webkitRTCPeerConnection', 'mozRTCPeerConnection', 'RTCIceGatherer'].forEach(function(item) { + if (item in window) { + isWebRTCSupported = true; + } + }); + DetectRTC.isWebRTCSupported = isWebRTCSupported; + + //------- + DetectRTC.isORTCSupported = typeof RTCIceGatherer !== 'undefined'; + + // --------- Detect if system supports screen capturing API + var isScreenCapturingSupported = false; + if (DetectRTC.browser.isChrome && DetectRTC.browser.version >= 35) { + isScreenCapturingSupported = true; + } else if (DetectRTC.browser.isFirefox && DetectRTC.browser.version >= 34) { + isScreenCapturingSupported = true; + } + + if (!isHTTPs) { + isScreenCapturingSupported = false; + } + DetectRTC.isScreenCapturingSupported = isScreenCapturingSupported; + + // --------- Detect if WebAudio API are supported + var webAudio = {}; + ['AudioContext', 'webkitAudioContext', 'mozAudioContext', 'msAudioContext'].forEach(function(item) { + if (webAudio.isSupported && webAudio.isCreateMediaStreamSourceSupported) { + return; + } + if (item in window) { + webAudio.isSupported = true; + + if ('createMediaStreamSource' in window[item].prototype) { + webAudio.isCreateMediaStreamSourceSupported = true; + } + } + }); + DetectRTC.isAudioContextSupported = webAudio.isSupported; + DetectRTC.isCreateMediaStreamSourceSupported = webAudio.isCreateMediaStreamSourceSupported; + + // ---------- Detect if SCTP/RTP channels are supported. + + var isRtpDataChannelsSupported = false; + if (DetectRTC.browser.isChrome && DetectRTC.browser.version > 31) { + isRtpDataChannelsSupported = true; + } + DetectRTC.isRtpDataChannelsSupported = isRtpDataChannelsSupported; + + var isSCTPSupportd = false; + if (DetectRTC.browser.isFirefox && DetectRTC.browser.version > 28) { + isSCTPSupportd = true; + } else if (DetectRTC.browser.isChrome && DetectRTC.browser.version > 25) { + isSCTPSupportd = true; + } else if (DetectRTC.browser.isOpera && DetectRTC.browser.version >= 11) { + isSCTPSupportd = true; + } + DetectRTC.isSctpDataChannelsSupported = isSCTPSupportd; + + // --------- + + DetectRTC.isMobileDevice = isMobileDevice; // "isMobileDevice" boolean is defined in "getBrowserInfo.js" + + // ------ + + DetectRTC.isWebSocketsSupported = 'WebSocket' in window && 2 === window.WebSocket.CLOSING; + DetectRTC.isWebSocketsBlocked = 'Checking'; + + if (DetectRTC.isWebSocketsSupported) { + /* CUSTOM CODE */ + var href = window.location.href; + var hostPatt = new RegExp(window.location.host +"/[^/]*"); + var res = hostPatt.exec(href); + var protocol = window.location.protocol.replace("http","ws"); + + var signalingServerPath = protocol + "//" + res + "/contact"; + var websocket = new WebSocket(signalingServerPath) + // var websocket = new WebSocket('wss://echo.websocket.org:443/'); + /* CUSTOM CODE */ + websocket.onopen = function() { + DetectRTC.isWebSocketsBlocked = false; + + if (DetectRTC.loadCallback) { + DetectRTC.loadCallback(); + } + }; + websocket.onerror = function() { + DetectRTC.isWebSocketsBlocked = true; + + if (DetectRTC.loadCallback) { + DetectRTC.loadCallback(); + } + }; + } + + // ------ + var isGetUserMediaSupported = false; + if (navigator.getUserMedia) { + isGetUserMediaSupported = true; + } else if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { + isGetUserMediaSupported = true; + } + if (DetectRTC.browser.isChrome && DetectRTC.browser.version >= 47 && !isHTTPs) { + DetectRTC.isGetUserMediaSupported = 'Requires HTTPs'; + } + DetectRTC.isGetUserMediaSupported = isGetUserMediaSupported; + + // ----------- + DetectRTC.osName = osName; // "osName" is defined in "detectOSName.js" + + // ---------- + DetectRTC.isCanvasSupportsStreamCapturing = isCanvasSupportsStreamCapturing; + DetectRTC.isVideoSupportsStreamCapturing = isVideoSupportsStreamCapturing; + + // ------ + DetectRTC.DetectLocalIPAddress = DetectLocalIPAddress; + + // ------- + DetectRTC.load = function(callback) { + this.loadCallback = callback; + + checkDeviceSupport(callback); + }; + + DetectRTC.MediaDevices = MediaDevices; + DetectRTC.hasMicrophone = hasMicrophone; + DetectRTC.hasSpeakers = hasSpeakers; + DetectRTC.hasWebcam = hasWebcam; + + // ------ + var isSetSinkIdSupported = false; + if ('setSinkId' in document.createElement('video')) { + isSetSinkIdSupported = true; + } + DetectRTC.isSetSinkIdSupported = isSetSinkIdSupported; + + // ----- + var isRTPSenderReplaceTracksSupported = false; + if (DetectRTC.browser.isFirefox /*&& DetectRTC.browser.version > 39*/ ) { + /*global mozRTCPeerConnection:true */ + if ('getSenders' in mozRTCPeerConnection.prototype) { + isRTPSenderReplaceTracksSupported = true; + } + } else if (DetectRTC.browser.isChrome) { + /*global webkitRTCPeerConnection:true */ + if ('getSenders' in webkitRTCPeerConnection.prototype) { + isRTPSenderReplaceTracksSupported = true; + } + } + DetectRTC.isRTPSenderReplaceTracksSupported = isRTPSenderReplaceTracksSupported; + + //------ + var isRemoteStreamProcessingSupported = false; + if (DetectRTC.browser.isFirefox && DetectRTC.browser.version > 38) { + isRemoteStreamProcessingSupported = true; + } + DetectRTC.isRemoteStreamProcessingSupported = isRemoteStreamProcessingSupported; + + //------- + var isApplyConstraintsSupported = false; + + /*global MediaStreamTrack:true */ + if (typeof MediaStreamTrack !== 'undefined' && 'applyConstraints' in MediaStreamTrack.prototype) { + isApplyConstraintsSupported = true; + } + DetectRTC.isApplyConstraintsSupported = isApplyConstraintsSupported; + + //------- + var isMultiMonitorScreenCapturingSupported = false; + if (DetectRTC.browser.isFirefox && DetectRTC.browser.version >= 43) { + // version 43 merely supports platforms for multi-monitors + // version 44 will support exact multi-monitor selection i.e. you can select any monitor for screen capturing. + isMultiMonitorScreenCapturingSupported = true; + } + DetectRTC.isMultiMonitorScreenCapturingSupported = isMultiMonitorScreenCapturingSupported; + + window.DetectRTC = DetectRTC; + + })(); + + // DetectRTC extender + var screenCallback; + + DetectRTC.screen = { + chromeMediaSource: 'screen', + extensionid: ReservedExtensionID, + getSourceId: function(callback) { + if (!callback) throw '"callback" parameter is mandatory.'; + + // make sure that chrome extension is installed. + if (!!DetectRTC.screen.status) { + onstatus(DetectRTC.screen.status); + } else DetectRTC.screen.getChromeExtensionStatus(onstatus); + + function onstatus(status) { + if (status == 'installed-enabled') { + screenCallback = callback; + window.postMessage('get-sourceId', '*'); + return; + } + + DetectRTC.screen.chromeMediaSource = 'screen'; + callback('No-Response'); // chrome extension isn't available + } + }, + onMessageCallback: function(data) { + if (!(isString(data) || !!data.sourceId)) return; + + log('chrome message', data); + + // "cancel" button is clicked + if (data == 'PermissionDeniedError') { + DetectRTC.screen.chromeMediaSource = 'PermissionDeniedError'; + if (screenCallback) return screenCallback('PermissionDeniedError'); + else throw new Error('PermissionDeniedError'); + } + + // extension notified his presence + if (data == 'rtcmulticonnection-extension-loaded') { + DetectRTC.screen.chromeMediaSource = 'desktop'; + if (DetectRTC.screen.onScreenCapturingExtensionAvailable) { + DetectRTC.screen.onScreenCapturingExtensionAvailable(); + + // make sure that this event isn't fired multiple times + DetectRTC.screen.onScreenCapturingExtensionAvailable = null; + } + } + + // extension shared temp sourceId + if (data.sourceId) { + DetectRTC.screen.sourceId = data.sourceId; + if (screenCallback) screenCallback(DetectRTC.screen.sourceId); + } + }, + getChromeExtensionStatus: function(extensionid, callback) { + function _callback(status) { + DetectRTC.screen.status = status; + callback(status); + } + + if (isFirefox) return _callback('not-chrome'); + + if (arguments.length != 2) { + callback = extensionid; + extensionid = this.extensionid; + } + + var image = document.createElement('img'); + image.src = 'chrome-extension://' + extensionid + '/icon.png'; + image.onload = function() { + DetectRTC.screen.chromeMediaSource = 'screen'; + window.postMessage('are-you-there', '*'); + setTimeout(function() { + if (DetectRTC.screen.chromeMediaSource == 'screen') { + _callback( + DetectRTC.screen.chromeMediaSource == 'desktop' ? 'installed-enabled' : 'installed-disabled' /* if chrome extension isn't permitted for current domain, then it will be installed-disabled all the time even if extension is enabled. */ + ); + } else _callback('installed-enabled'); + }, 2000); + }; + image.onerror = function() { + _callback('not-installed'); + }; + } + }; + + // if IE + if (!window.addEventListener) { + window.addEventListener = function(el, eventName, eventHandler) { + if (!el.attachEvent) return; + el.attachEvent('on' + eventName, eventHandler); + }; + } + + function listenEventHandler(eventName, eventHandler) { + window.removeEventListener(eventName, eventHandler); + window.addEventListener(eventName, eventHandler, false); + } + + window.addEventListener('message', function(event) { + if (event.origin != window.location.origin) { + return; + } + + DetectRTC.screen.onMessageCallback(event.data); + }); + + function setDefaults(connection) { + var DetectRTC = window.DetectRTC || {}; + + // www.RTCMultiConnection.org/docs/userid/ + connection.userid = getRandomString(); + + // www.RTCMultiConnection.org/docs/session/ + connection.session = { + audio: true, + video: true + }; + + // www.RTCMultiConnection.org/docs/maxParticipantsAllowed/ + connection.maxParticipantsAllowed = 256; + + // www.RTCMultiConnection.org/docs/direction/ + // 'many-to-many' / 'one-to-many' / 'one-to-one' / 'one-way' + connection.direction = 'many-to-many'; + + // www.RTCMultiConnection.org/docs/mediaConstraints/ + connection.mediaConstraints = { + mandatory: {}, // kept for backward compatibility + optional: [], // kept for backward compatibility + audio: { + mandatory: {}, + optional: [] + }, + video: { + mandatory: {}, + optional: [] + } + }; + + // www.RTCMultiConnection.org/docs/candidates/ + connection.candidates = { + host: true, + stun: true, + turn: true + }; + + connection.sdpConstraints = {}; + + // as @serhanters proposed in #225 + // it will auto fix "all" renegotiation scenarios + connection.sdpConstraints.mandatory = { + OfferToReceiveAudio: true, + OfferToReceiveVideo: true + }; + + connection.privileges = { + canStopRemoteStream: false, // user can stop remote streams + canMuteRemoteStream: false // user can mute remote streams + }; + + connection.iceProtocols = { + tcp: true, + udp: true + }; + + // www.RTCMultiConnection.org/docs/preferSCTP/ + connection.preferSCTP = isFirefox || chromeVersion >= 32 ? true : false; + connection.chunkInterval = isFirefox || chromeVersion >= 32 ? 100 : 500; // 500ms for RTP and 100ms for SCTP + connection.chunkSize = isFirefox || chromeVersion >= 32 ? 13 * 1000 : 1000; // 1000 chars for RTP and 13000 chars for SCTP + + // www.RTCMultiConnection.org/docs/fakeDataChannels/ + connection.fakeDataChannels = false; + + connection.waitUntilRemoteStreamStartsFlowing = null; // NULL == true + + // auto leave on page unload + connection.leaveOnPageUnload = true; + + // get ICE-servers from XirSys + connection.getExternalIceServers = isChrome; + + // www.RTCMultiConnection.org/docs/UA/ + connection.UA = { + isFirefox: isFirefox, + isChrome: isChrome, + isMobileDevice: isMobileDevice, + version: isChrome ? chromeVersion : firefoxVersion, + isNodeWebkit: isNodeWebkit, + isSafari: isSafari, + isIE: isIE, + isOpera: isOpera + }; + + // file queue: to store previous file objects in memory; + // and stream over newly connected peers + // www.RTCMultiConnection.org/docs/fileQueue/ + connection.fileQueue = {}; + + // this array is aimed to store all renegotiated streams' session-types + connection.renegotiatedSessions = {}; + + // www.RTCMultiConnection.org/docs/channels/ + connection.channels = {}; + + // www.RTCMultiConnection.org/docs/extra/ + connection.extra = {}; + + // www.RTCMultiConnection.org/docs/bandwidth/ + connection.bandwidth = { + screen: 300 // 300kbps (dirty workaround) + }; + + // www.RTCMultiConnection.org/docs/caniuse/ + connection.caniuse = { + RTCPeerConnection: DetectRTC.isWebRTCSupported, + getUserMedia: !!navigator.webkitGetUserMedia || !!navigator.mozGetUserMedia, + AudioContext: DetectRTC.isAudioContextSupported, + + // there is no way to check whether "getUserMedia" flag is enabled or not! + ScreenSharing: DetectRTC.isScreenCapturingSupported, + RtpDataChannels: DetectRTC.isRtpDataChannelsSupported, + SctpDataChannels: DetectRTC.isSctpDataChannelsSupported + }; + + // www.RTCMultiConnection.org/docs/snapshots/ + connection.snapshots = {}; + + // www.WebRTC-Experiment.com/demos/MediaStreamTrack.getSources.html + connection._mediaSources = {}; + + // www.RTCMultiConnection.org/docs/devices/ + connection.devices = {}; + + // www.RTCMultiConnection.org/docs/language/ (to see list of all supported languages) + connection.language = 'en'; + + // www.RTCMultiConnection.org/docs/autoTranslateText/ + connection.autoTranslateText = false; + + // please use your own Google Translate API key + // Google Translate is a paid service. + connection.googKey = 'AIzaSyCgB5hmFY74WYB-EoWkhr9cAGr6TiTHrEE'; + + connection.localStreamids = []; + connection.localStreams = {}; + + // this object stores pre-recorded media streaming uids + // multiple pre-recorded media files can be streamed concurrently. + connection.preRecordedMedias = {}; + + // www.RTCMultiConnection.org/docs/attachStreams/ + connection.attachStreams = []; + + // www.RTCMultiConnection.org/docs/detachStreams/ + connection.detachStreams = []; + + connection.optionalArgument = { + optional: [{ + DtlsSrtpKeyAgreement: true + }, { + googImprovedWifiBwe: true + }, { + googScreencastMinBitrate: 300 + }], + mandatory: {} + }; + + connection.dataChannelDict = {}; + + // www.RTCMultiConnection.org/docs/dontAttachStream/ + connection.dontAttachStream = false; + + // www.RTCMultiConnection.org/docs/dontCaptureUserMedia/ + connection.dontCaptureUserMedia = false; + + // this feature added to keep users privacy and + // make sure HTTPs pages NEVER auto capture users media + // isChrome && location.protocol == 'https:' + connection.preventSSLAutoAllowed = false; + + connection.autoReDialOnFailure = true; + connection.isInitiator = false; + + // access DetectRTC.js features directly! + connection.DetectRTC = DetectRTC; + + // you can falsify it to merge all ICE in SDP and share only SDP! + // such mechanism is useful for SIP/XMPP and XMLHttpRequest signaling + // bug: renegotiation fails if "trickleIce" is false + connection.trickleIce = true; + + // this object stores list of all sessions in current channel + connection.sessionDescriptions = {}; + + // this object stores current user's session-description + // it is set only for initiator + // it is set as soon as "open" method is invoked. + connection.sessionDescription = null; + + // resources used in RTCMultiConnection + connection.resources = { + // CUSTOM CODE // + /* Commenting this block as we do not wasnt external dependencies + * + RecordRTC: 'https://cdn.webrtc-experiment.com/RecordRTC.js', + PreRecordedMediaStreamer: 'https://cdn.webrtc-experiment.com/PreRecordedMediaStreamer.js', + customGetUserMediaBar: 'https://cdn.webrtc-experiment.com/navigator.customGetUserMediaBar.js', + html2canvas: 'https://cdn.webrtc-experiment.com/screenshot.js', + hark: 'https://cdn.webrtc-experiment.com/hark.js', + firebase: 'https://cdn.webrtc-experiment.com/firebase.js', + firebaseio: 'https://webrtc-signaling.firebaseio.com/', + + + + getConnectionStats: 'https://cdn.webrtc-experiment.com/getConnectionStats.js', + FileBufferReader: 'https://cdn.webrtc-experiment.com/FileBufferReader.js' + */ + + // CUSTOM CODE // + + + }; + + // www.RTCMultiConnection.org/docs/body/ + connection.body = document.body || document.documentElement; + connection.screenbody = null;// document.body || document.documentElement; + connection.videobody = null;//document.body || document.documentElement; + + // www.RTCMultiConnection.org/docs/peers/ + connection.peers = {}; + + // www.RTCMultiConnection.org/docs/firebase/ + connection.firebase = 'chat'; + + connection.numberOfSessions = 0; + connection.numberOfConnectedUsers = 0; + + // by default, data-connections will always be getting + // FileBufferReader.js if absent. + connection.enableFileSharing = true; + + // www.RTCMultiConnection.org/docs/autoSaveToDisk/ + // to make sure file-saver dialog is not invoked. + connection.autoSaveToDisk = false; + + connection.processSdp = function(sdp) { + // process sdp here + return sdp; + }; + + // www.RTCMultiConnection.org/docs/onmessage/ + connection.onmessage = function(e) { + log('onmessage', toStr(e)); + }; + + // www.RTCMultiConnection.org/docs/onopen/ + connection.onopen = function(e) { + log('Data connection is opened between you and', e.userid); + }; + + // www.RTCMultiConnection.org/docs/onerror/ + connection.onerror = function(e) { + error(onerror, toStr(e)); + }; + + // www.RTCMultiConnection.org/docs/onclose/ + connection.onclose = function(e) { + warn('onclose', toStr(e)); + + // todo: should we use "stop" or "remove"? + // BTW, it is remote user! + connection.streams.remove({ + userid: e.userid + }); + }; + + var progressHelper = {}; + + // www.RTCMultiConnection.org/docs/onFileStart/ + connection.onFileStart = function(file) { + var div = document.createElement('div'); + div.title = file.name; + div.innerHTML = ' '; + connection.body.insertBefore(div, connection.body.firstChild); + progressHelper[file.uuid] = { + div: div, + progress: div.querySelector('progress'), + label: div.querySelector('label') + }; + progressHelper[file.uuid].progress.max = file.maxChunks; + }; + + // www.RTCMultiConnection.org/docs/onFileProgress/ + connection.onFileProgress = function(chunk) { + var helper = progressHelper[chunk.uuid]; + if (!helper) return; + helper.progress.value = chunk.currentPosition || chunk.maxChunks || helper.progress.max; + updateLabel(helper.progress, helper.label); + }; + + // www.RTCMultiConnection.org/docs/onFileEnd/ + connection.onFileEnd = function(file) { + if (progressHelper[file.uuid]) progressHelper[file.uuid].div.innerHTML = '' + file.name + ''; + + // for backward compatibility + if (connection.onFileSent || connection.onFileReceived) { + if (connection.onFileSent) connection.onFileSent(file, file.uuid); + if (connection.onFileReceived) connection.onFileReceived(file.name, file); + } + }; + + function updateLabel(progress, label) { + if (progress.position == -1) return; + var position = +progress.position.toFixed(2).split('.')[1] || 100; + label.innerHTML = position + '%'; + } + + // www.RTCMultiConnection.org/docs/onstream/ + connection.onstream = function(e) { + // CUSTOM CODE // + + if(e.isVideo || e.isAudio) + { + var videoTag = e.mediaElement; + var videoType = e.type; + var parentDiv = connection.videobody; + + if(videoType == "local") + { + videoTag.style.top = "auto"; + videoTag.style.position = "absolute"; + //videoTag.style.left = (parentDiv.offsetWidth - 160) + "px"; + videoTag.style.height = "150px"; + videoTag.style.width = "150px"; + videoTag.style.zIndex = 1; + + } + else if(videoType == "remote") + { + videoTag.style.top = "auto"; + videoTag.style.position = "absolute"; + videoTag.style.zIndex = -1; + } + + parentDiv.appendChild(videoTag); + } + else if(e.isScreen) + { + var screenTag = e.mediaElement; + var screenType = e.type; + var parentDiv = connection.screenbody; + + if(screenType == "local") + { + // no need to display this because the person sharing his/her screen doesn't have to see whats being shared + // enabled for demo purposes + parentDiv.appendChild(screenTag); + } + else if(screenType == "remote") + { + parentDiv.appendChild(screenTag); + } + + + } + + else + connection.body.insertBefore(e.mediaElement, connection.body.firstChild); + + // CUSTOM CODE // + }; + + // www.RTCMultiConnection.org/docs/onStreamEndedHandler/ + connection.onstreamended = function(e) { + log('onStreamEndedHandler:', e); + + if (!e.mediaElement) { + return warn('Event.mediaElement is undefined', e); + } + if (!e.mediaElement.parentNode) { + e.mediaElement = document.getElementById(e.streamid); + + if (!e.mediaElement) { + return warn('Event.mediaElement is undefined', e); + } + + if (!e.mediaElement.parentNode) { + return warn('Event.mediElement.parentNode is null.', e); + } + } + + e.mediaElement.parentNode.removeChild(e.mediaElement); + }; + + // todo: need to write documentation link + connection.onSessionClosed = function(session) { + if (session.isEjected) { + warn(session.userid, 'ejected you.'); + } else warn('Session has been closed.', session); + }; + + // www.RTCMultiConnection.org/docs/onmute/ + connection.onmute = function(e) { + if (e.isVideo && e.mediaElement) { + e.mediaElement.pause(); + e.mediaElement.setAttribute('poster', e.snapshot || connection.resources.muted); + } + if (e.isAudio && e.mediaElement) { + e.mediaElement.muted = true; + } + }; + + // www.RTCMultiConnection.org/docs/onunmute/ + connection.onunmute = function(e) { + if (e.isVideo && e.mediaElement) { + e.mediaElement.play(); + e.mediaElement.removeAttribute('poster'); + } + if (e.isAudio && e.mediaElement) { + e.mediaElement.muted = false; + } + }; + + // www.RTCMultiConnection.org/docs/onleave/ + connection.onleave = function(e) { + log('onleave', toStr(e)); + }; + + connection.token = getRandomString; + + connection.peers[connection.userid] = { + drop: function() { + connection.drop(); + }, + renegotiate: function() {}, + addStream: function() {}, + hold: function() {}, + unhold: function() {}, + changeBandwidth: function() {}, + sharePartOfScreen: function() {} + }; + + connection._skip = ['stop', 'mute', 'unmute', '_private', '_selectStreams', 'selectFirst', 'selectAll', 'remove']; + + // www.RTCMultiConnection.org/docs/streams/ + connection.streams = { + mute: function(session) { + this._private(session, true); + }, + unmute: function(session) { + this._private(session, false); + }, + _private: function(session, enabled) { + if (session && !isString(session)) { + for (var stream in this) { + if (connection._skip.indexOf(stream) == -1) { + _muteOrUnMute(this[stream], session, enabled); + } + } + + function _muteOrUnMute(stream, session, isMute) { + if (session.local && stream.type != 'local') return; + if (session.remote && stream.type != 'remote') return; + + if (session.isScreen && !stream.isScreen) return; + if (session.isAudio && !stream.isAudio) return; + if (session.isVideo && !stream.isVideo) return; + + if (isMute) stream.mute(session); + else stream.unmute(session); + } + return; + } + + // implementation from #68 + for (var stream in this) { + if (connection._skip.indexOf(stream) == -1) { + this[stream]._private(session, enabled); + } + } + }, + stop: function(type) { + var _stream; + for (var stream in this) { + if (connection._skip.indexOf(stream) == -1) { + _stream = this[stream]; + + if (!type) _stream.stop(); + + else if (isString(type)) { + // connection.streams.stop('screen'); + var config = {}; + config[type] = true; + _stopStream(_stream, config); + } else _stopStream(_stream, type); + } + } + + function _stopStream(_stream, config) { + // connection.streams.stop({ remote: true, userid: 'remote-userid' }); + if (config.userid && _stream.userid != config.userid) return; + + if (config.local && _stream.type != 'local') return; + if (config.remote && _stream.type != 'remote') return; + + if (config.screen && !!_stream.isScreen) { + _stream.stop(); + } + + if (config.audio && !!_stream.isAudio) { + _stream.stop(); + } + + if (config.video && !!_stream.isVideo) { + _stream.stop(); + } + + // connection.streams.stop('local'); + if (!config.audio && !config.video && !config.screen) { + _stream.stop(); + } + } + }, + remove: function(type) { + var _stream; + for (var stream in this) { + if (connection._skip.indexOf(stream) == -1) { + _stream = this[stream]; + + if (!type) _stopAndRemoveStream(_stream, { + local: true, + remote: true + }); + + else if (isString(type)) { + // connection.streams.stop('screen'); + var config = {}; + config[type] = true; + _stopAndRemoveStream(_stream, config); + } else _stopAndRemoveStream(_stream, type); + } + } + + function _stopAndRemoveStream(_stream, config) { + // connection.streams.remove({ remote: true, userid: 'remote-userid' }); + if (config.userid && _stream.userid != config.userid) return; + + if (config.local && _stream.type != 'local') return; + if (config.remote && _stream.type != 'remote') return; + + if (config.screen && !!_stream.isScreen) { + endStream(_stream); + } + + if (config.audio && !!_stream.isAudio) { + endStream(_stream); + } + + if (config.video && !!_stream.isVideo) { + endStream(_stream); + } + + // connection.streams.remove('local'); + if (!config.audio && !config.video && !config.screen) { + endStream(_stream); + } + } + + function endStream(_stream) { + onStreamEndedHandler(_stream, connection); + delete connection.streams[_stream.streamid]; + } + }, + selectFirst: function(args) { + return this._selectStreams(args, false); + }, + selectAll: function(args) { + return this._selectStreams(args, true); + }, + _selectStreams: function(args, all) { + if (!args || isString(args) || isEmpty(args)) throw 'Invalid arguments.'; + + // if userid is used then both local/remote shouldn't be auto-set + if (isNull(args.local) && isNull(args.remote) && isNull(args.userid)) { + args.local = args.remote = true; + } + + if (!args.isAudio && !args.isVideo && !args.isScreen) { + args.isAudio = args.isVideo = args.isScreen = true; + } + + var selectedStreams = []; + for (var stream in this) { + if (connection._skip.indexOf(stream) == -1 && (stream = this[stream]) && ((args.local && stream.type == 'local') || (args.remote && stream.type == 'remote') || (args.userid && stream.userid == args.userid))) { + if (args.isVideo && stream.isVideo) { + selectedStreams.push(stream); + } + + if (args.isAudio && stream.isAudio) { + selectedStreams.push(stream); + } + + if (args.isScreen && stream.isScreen) { + selectedStreams.push(stream); + } + } + } + + return !!all ? selectedStreams : selectedStreams[0]; + } + }; + + var iceServers = []; + + // CUSTOM CODE // + // these servers are provided by research + iceServers.push({ + url: '' /*TODO To test this WebRTC with some open stun and turn test servers*/ + }); + + iceServers.push({ + url: 'turn:207.140.168.120:3478', + credential: 'xxx', + username: 'xxx' + }); + + iceServers.push({ + url: 'turn:207.140.168.120:443?transport=tcp', + credential: 'harmfulmustard', + username: 'ambient' + }); + + /* CHANGED: Fusion: These are servers for testing purposes + + iceServers.push({ + url: 'stun:stun.l.google.com:19302' + }); + + iceServers.push({ + url: 'stun:stun.anyfirewall.com:3478' + }); + + iceServers.push({ + url: 'turn:turn.bistri.com:80', + credential: 'homeo', + username: 'homeo' + }); + + iceServers.push({ + url: 'turn:turn.anyfirewall.com:443?transport=tcp', + credential: 'webrtc', + username: 'webrtc' + }); + + */ + // CUSTOM CODE // + connection.iceServers = iceServers; + + connection.rtcConfiguration = { + iceServers: null, + iceTransports: 'all', // none || relay || all - ref: http://goo.gl/40I39K + peerIdentity: false + }; + + // www.RTCMultiConnection.org/docs/media/ + connection.media = { + min: function(width, height) { + if (!connection.mediaConstraints.video) return; + + if (!connection.mediaConstraints.video.mandatory) { + connection.mediaConstraints.video.mandatory = {}; + } + connection.mediaConstraints.video.mandatory.minWidth = width; + connection.mediaConstraints.video.mandatory.minHeight = height; + }, + max: function(width, height) { + if (!connection.mediaConstraints.video) return; + + if (!connection.mediaConstraints.video.mandatory) { + connection.mediaConstraints.video.mandatory = {}; + } + + connection.mediaConstraints.video.mandatory.maxWidth = width; + connection.mediaConstraints.video.mandatory.maxHeight = height; + } + }; + + connection._getStream = function(event) { + var resultingObject = merge({ + sockets: event.socket ? [event.socket] : [] + }, event); + + resultingObject.stop = function() { + var self = this; + + self.sockets.forEach(function(socket) { + if (self.type == 'local') { + socket.send({ + streamid: self.streamid, + stopped: true + }); + } + + if (self.type == 'remote') { + socket.send({ + promptStreamStop: true, + streamid: self.streamid + }); + } + }); + + if (self.type == 'remote') return; + + var stream = self.stream; + if (stream) self.rtcMultiConnection.stopMediaStream(stream); + }; + + resultingObject.mute = function(session) { + this.muted = true; + this._private(session, true); + }; + + resultingObject.unmute = function(session) { + this.muted = false; + this._private(session, false); + }; + + function muteOrUnmuteLocally(session, isPause, mediaElement) { + if (!mediaElement) return; + var lastPauseState = mediaElement.onpause; + var lastPlayState = mediaElement.onplay; + mediaElement.onpause = mediaElement.onplay = function() {}; + + if (isPause) mediaElement.pause(); + else mediaElement.play(); + + mediaElement.onpause = lastPauseState; + mediaElement.onplay = lastPlayState; + } + + resultingObject._private = function(session, enabled) { + if (session && !isNull(session.sync) && session.sync == false) { + muteOrUnmuteLocally(session, enabled, this.mediaElement); + return; + } + + muteOrUnmute({ + root: this, + session: session, + enabled: enabled, + stream: this.stream + }); + }; + + resultingObject.startRecording = function(session) { + var self = this; + + if (!session) { + session = { + audio: true, + video: true + }; + } + + if (isString(session)) { + session = { + audio: session == 'audio', + video: session == 'video' + }; + } + + if (!window.RecordRTC) { + return loadScript(self.rtcMultiConnection.resources.RecordRTC, function() { + self.startRecording(session); + }); + } + + log('started recording session', session); + + self.videoRecorder = self.audioRecorder = null; + + if (isFirefox) { + // firefox supports both audio/video recording in single webm file + if (session.video) { + self.videoRecorder = RecordRTC(self.stream, { + type: 'video' + }); + } else if (session.audio) { + self.audioRecorder = RecordRTC(self.stream, { + type: 'audio' + }); + } + } else if (isChrome) { + // chrome supports recording in two separate files: WAV and WebM + if (session.video) { + self.videoRecorder = RecordRTC(self.stream, { + type: 'video' + }); + } + + if (session.audio) { + self.audioRecorder = RecordRTC(self.stream, { + type: 'audio' + }); + } + } + + if (self.audioRecorder) { + self.audioRecorder.startRecording(); + } + + if (self.videoRecorder) self.videoRecorder.startRecording(); + }; + + resultingObject.stopRecording = function(callback, session) { + if (!session) { + session = { + audio: true, + video: true + }; + } + + if (isString(session)) { + session = { + audio: session == 'audio', + video: session == 'video' + }; + } + + log('stopped recording session', session); + + var self = this; + + if (session.audio && self.audioRecorder) { + self.audioRecorder.stopRecording(function() { + if (session.video && self.videoRecorder) { + self.videoRecorder.stopRecording(function() { + callback({ + audio: self.audioRecorder.getBlob(), + video: self.videoRecorder.getBlob() + }); + }); + } else callback({ + audio: self.audioRecorder.getBlob() + }); + }); + } else if (session.video && self.videoRecorder) { + self.videoRecorder.stopRecording(function() { + callback({ + video: self.videoRecorder.getBlob() + }); + }); + } + }; + + resultingObject.takeSnapshot = function(callback) { + takeSnapshot({ + mediaElement: this.mediaElement, + userid: this.userid, + connection: connection, + callback: callback + }); + }; + + // redundant: kept only for backward compatibility + resultingObject.streamObject = resultingObject; + + return resultingObject; + }; + + // new RTCMultiConnection().set({properties}).connect() + connection.set = function(properties) { + for (var property in properties) { + this[property] = properties[property]; + } + return this; + }; + + // www.RTCMultiConnection.org/docs/onMediaError/ + connection.onMediaError = function(event) { + error('name', event.name); + error('constraintName', toStr(event.constraintName)); + error('message', event.message); + error('original session', event.session); + }; + + // www.RTCMultiConnection.org/docs/takeSnapshot/ + connection.takeSnapshot = function(userid, callback) { + takeSnapshot({ + userid: userid, + connection: connection, + callback: callback + }); + }; + + connection.saveToDisk = function(blob, fileName) { + if (blob.size && blob.type) FileSaver.SaveToDisk(URL.createObjectURL(blob), fileName || blob.name || blob.type.replace('/', '-') + blob.type.split('/')[1]); + else FileSaver.SaveToDisk(blob, fileName); + }; + + // www.RTCMultiConnection.org/docs/selectDevices/ + connection.selectDevices = function(device1, device2) { + if (device1) select(this.devices[device1]); + if (device2) select(this.devices[device2]); + + function select(device) { + if (!device) return; + connection._mediaSources[device.kind] = device.id; + } + }; + + // www.RTCMultiConnection.org/docs/getDevices/ + connection.getDevices = function(callback) { + // if, not yet fetched. + if (!DetectRTC.MediaDevices.length) { + return setTimeout(function() { + connection.getDevices(callback); + }, 1000); + } + + // loop over all audio/video input/output devices + DetectRTC.MediaDevices.forEach(function(device) { + connection.devices[device.deviceId] = device; + }); + + if (callback) callback(connection.devices); + }; + + connection.getMediaDevices = connection.enumerateDevices = function(callback) { + if (!callback) throw 'callback is mandatory.'; + connection.getDevices(function() { + callback(connection.DetectRTC.MediaDevices); + }); + }; + + // www.RTCMultiConnection.org/docs/onCustomMessage/ + connection.onCustomMessage = function(message) { + log('Custom message', message); + }; + + // www.RTCMultiConnection.org/docs/ondrop/ + connection.ondrop = function(droppedBy) { + log('Media connection is dropped by ' + droppedBy); + }; + + // www.RTCMultiConnection.org/docs/drop/ + connection.drop = function(config) { + config = config || {}; + connection.attachStreams = []; + + // "drop" should detach all local streams + for (var stream in connection.streams) { + if (connection._skip.indexOf(stream) == -1) { + stream = connection.streams[stream]; + if (stream.type == 'local') { + connection.detachStreams.push(stream.streamid); + onStreamEndedHandler(stream, connection); + } else onStreamEndedHandler(stream, connection); + } + } + + // www.RTCMultiConnection.org/docs/sendCustomMessage/ + connection.sendCustomMessage({ + drop: true, + dontRenegotiate: isNull(config.renegotiate) ? true : config.renegotiate + }); + }; + + // www.RTCMultiConnection.org/docs/Translator/ + connection.Translator = { + TranslateText: function(text, callback) { + // if(location.protocol === 'https:') return callback(text); + + var newScript = document.createElement('script'); + newScript.type = 'text/javascript'; + + var sourceText = encodeURIComponent(text); // escape + + var randomNumber = 'method' + connection.token(); + window[randomNumber] = function(response) { + if (response.data && response.data.translations[0] && callback) { + callback(response.data.translations[0].translatedText); + } + + if (response.error && response.error.message == 'Daily Limit Exceeded') { + warn('Text translation failed. Error message: "Daily Limit Exceeded."'); + + // returning original text + callback(text); + } + }; + + var source = 'https://www.googleapis.com/language/translate/v2?key=' + connection.googKey + '&target=' + (connection.language || 'en-US') + '&callback=window.' + randomNumber + '&q=' + sourceText; + newScript.src = source; + document.getElementsByTagName('head')[0].appendChild(newScript); + } + }; + + // you can easily override it by setting it NULL! + connection.setDefaultEventsForMediaElement = function(mediaElement, streamid) { + mediaElement.onpause = function() { + if (connection.streams[streamid] && !connection.streams[streamid].muted) { + connection.streams[streamid].mute(); + } + }; + + // todo: need to make sure that "onplay" EVENT doesn't play self-voice! + mediaElement.onplay = function() { + if (connection.streams[streamid] && connection.streams[streamid].muted) { + connection.streams[streamid].unmute(); + } + }; + + var volumeChangeEventFired = false; + mediaElement.onvolumechange = function() { + if (!volumeChangeEventFired) { + volumeChangeEventFired = true; + connection.streams[streamid] && setTimeout(function() { + var root = connection.streams[streamid]; + connection.streams[streamid].sockets.forEach(function(socket) { + socket.send({ + streamid: root.streamid, + isVolumeChanged: true, + volume: mediaElement.volume + }); + }); + volumeChangeEventFired = false; + }, 2000); + } + }; + }; + + // www.RTCMultiConnection.org/docs/onMediaFile/ + connection.onMediaFile = function(e) { + log('onMediaFile', e); + connection.body.appendChild(e.mediaElement); + }; + + // www.RTCMultiConnection.org/docs/shareMediaFile/ + // this method handles pre-recorded media streaming + connection.shareMediaFile = function(file, video, streamerid) { + streamerid = streamerid || connection.token(); + + if (!PreRecordedMediaStreamer) { + loadScript(connection.resources.PreRecordedMediaStreamer, function() { + connection.shareMediaFile(file, video, streamerid); + }); + return streamerid; + } + + return PreRecordedMediaStreamer.shareMediaFile({ + file: file, + video: video, + streamerid: streamerid, + connection: connection + }); + }; + + // www.RTCMultiConnection.org/docs/onpartofscreen/ + connection.onpartofscreen = function(e) { + var image = document.createElement('img'); + image.src = e.screenshot; + connection.body.appendChild(image); + }; + + connection.skipLogs = function() { + log = error = warn = function() {}; + }; + + // www.RTCMultiConnection.org/docs/hold/ + connection.hold = function(mLine) { + for (var peer in connection.peers) { + connection.peers[peer].hold(mLine); + } + }; + + // www.RTCMultiConnection.org/docs/onhold/ + connection.onhold = function(track) { + log('onhold', track); + + if (track.kind != 'audio') { + track.mediaElement.pause(); + track.mediaElement.setAttribute('poster', track.screenshot || connection.resources.muted); + } + if (track.kind == 'audio') { + track.mediaElement.muted = true; + } + }; + + // www.RTCMultiConnection.org/docs/unhold/ + connection.unhold = function(mLine) { + for (var peer in connection.peers) { + connection.peers[peer].unhold(mLine); + } + }; + + // www.RTCMultiConnection.org/docs/onunhold/ + connection.onunhold = function(track) { + log('onunhold', track); + + if (track.kind != 'audio') { + track.mediaElement.play(); + track.mediaElement.removeAttribute('poster'); + } + if (track.kind != 'audio') { + track.mediaElement.muted = false; + } + }; + + connection.sharePartOfScreen = function(args) { + var lastScreenshot = ''; + + function partOfScreenCapturer() { + // if stopped + if (connection.partOfScreen && !connection.partOfScreen.sharing) { + return; + } + + capturePartOfScreen({ + element: args.element, + connection: connection, + callback: function(screenshot) { + // don't share repeated content + if (screenshot != lastScreenshot) { + lastScreenshot = screenshot; + + for (var channel in connection.channels) { + connection.channels[channel].send({ + screenshot: screenshot, + isPartOfScreen: true + }); + } + } + + // "once" can be used to share single screenshot + !args.once && setTimeout(partOfScreenCapturer, args.interval || 200); + } + }); + } + + partOfScreenCapturer(); + + connection.partOfScreen = merge({ + sharing: true + }, args); + }; + + connection.pausePartOfScreenSharing = function() { + for (var peer in connection.peers) { + connection.peers[peer].pausePartOfScreenSharing = true; + } + + if (connection.partOfScreen) { + connection.partOfScreen.sharing = false; + } + }; + + connection.resumePartOfScreenSharing = function() { + for (var peer in connection.peers) { + connection.peers[peer].pausePartOfScreenSharing = false; + } + + if (connection.partOfScreen) { + connection.partOfScreen.sharing = true; + } + }; + + connection.stopPartOfScreenSharing = function() { + for (var peer in connection.peers) { + connection.peers[peer].stopPartOfScreenSharing = true; + } + + if (connection.partOfScreen) { + connection.partOfScreen.sharing = false; + } + }; + + connection.takeScreenshot = function(element, callback) { + if (!element || !callback) throw 'Invalid number of arguments.'; + + if (!window.html2canvas) { + return loadScript(connection.resources.html2canvas, function() { + connection.takeScreenshot(element); + }); + } + + if (isString(element)) { + element = document.querySelector(element); + if (!element) element = document.getElementById(element); + } + if (!element) throw 'HTML Element is inaccessible!'; + + // html2canvas.js is used to take screenshots + html2canvas(element, { + onrendered: function(canvas) { + callback(canvas.toDataURL()); + } + }); + }; + + // this event is fired when RTCMultiConnection detects that chrome extension + // for screen capturing is installed and available + connection.onScreenCapturingExtensionAvailable = function() { + log('It seems that screen capturing extension is installed and available on your system!'); + }; + + if (!isPluginRTC && DetectRTC.screen.onScreenCapturingExtensionAvailable) { + DetectRTC.screen.onScreenCapturingExtensionAvailable = function() { + connection.onScreenCapturingExtensionAvailable(); + }; + } + + connection.changeBandwidth = function(bandwidth) { + for (var peer in connection.peers) { + connection.peers[peer].changeBandwidth(bandwidth); + } + }; + + connection.convertToAudioStream = function(mediaStream) { + convertToAudioStream(mediaStream); + }; + + connection.onstatechange = function(state) { + log('on:state:change (' + state.userid + '):', state.name + ':', state.reason || ''); + }; + + connection.onfailed = function(event) { + if (!event.peer.numOfRetries) event.peer.numOfRetries = 0; + event.peer.numOfRetries++; + + error('ICE connectivity check is failed. Renegotiating peer connection.'); + event.peer.numOfRetries < 2 && event.peer.renegotiate(); + + if (event.peer.numOfRetries >= 2) event.peer.numOfRetries = 0; + }; + + connection.onconnected = function(event) { + // event.peer.addStream || event.peer.getConnectionStats + log('Peer connection has been established between you and', event.userid); + }; + + connection.ondisconnected = function(event) { + error('Peer connection seems has been disconnected between you and', event.userid); + + if (isEmpty(connection.channels)) return; + if (!connection.channels[event.userid]) return; + + // use WebRTC data channels to detect user's presence + connection.channels[event.userid].send({ + checkingPresence: true + }); + + // wait 5 seconds, if target peer didn't response, simply disconnect + setTimeout(function() { + // iceConnectionState == 'disconnected' occurred out of low-bandwidth + // or internet connectivity issues + if (connection.peers[event.userid].connected) { + delete connection.peers[event.userid].connected; + return; + } + + // to make sure this user's all remote streams are removed. + connection.streams.remove({ + remote: true, + userid: event.userid + }); + + connection.remove(event.userid); + }, 3000); + }; + + connection.onstreamid = function(event) { + // event.isScreen || event.isVideo || event.isAudio + log('got remote streamid', event.streamid, 'from', event.userid); + }; + + connection.stopMediaStream = function(mediaStream) { + if (!mediaStream) throw 'MediaStream argument is mandatory.'; + + if (connection.keepStreamsOpened) { + if (mediaStream.onended) mediaStream.onended(); + return; + } + + // remove stream from "localStreams" object + // when native-stop method invoked. + if (connection.localStreams[mediaStream.streamid]) { + delete connection.localStreams[mediaStream.streamid]; + } + + if (isFirefox) { + // Firefox don't yet support onended for any stream (remote/local) + if (mediaStream.onended) mediaStream.onended(); + } + + // Latest firefox does support mediaStream.getAudioTrack but doesn't support stop on MediaStreamTrack + var checkForMediaStreamTrackStop = Boolean( + (mediaStream.getAudioTracks || mediaStream.getVideoTracks) && ( + (mediaStream.getAudioTracks()[0] && !mediaStream.getAudioTracks()[0].stop) || + (mediaStream.getVideoTracks()[0] && !mediaStream.getVideoTracks()[0].stop) + ) + ); + + if (!mediaStream.getAudioTracks || checkForMediaStreamTrackStop) { + if (mediaStream.stop) { + mediaStream.stop(); + } + return; + } + + if (mediaStream.getAudioTracks().length && mediaStream.getAudioTracks()[0].stop) { + mediaStream.getAudioTracks().forEach(function(track) { + track.stop(); + }); + } + + if (mediaStream.getVideoTracks().length && mediaStream.getVideoTracks()[0].stop) { + mediaStream.getVideoTracks().forEach(function(track) { + track.stop(); + }); + } + }; + + connection.changeBandwidth = function(bandwidth) { + if (!bandwidth || isString(bandwidth) || isEmpty(bandwidth)) { + throw 'Invalid "bandwidth" arguments.'; + } + + forEach(connection.peers, function(peer) { + peer.peer.bandwidth = bandwidth; + }); + + connection.renegotiate(); + }; + + // www.RTCMultiConnection.org/docs/openSignalingChannel/ + // http://goo.gl/uvoIcZ + + // CUSTOM CODE + var href = window.location.href; + var hostPatt = new RegExp(window.location.host +"/[^/]*"); + var res = hostPatt.exec(href); + var protocol = window.location.protocol.replace("http","ws"); + + var signalingServerPath = protocol + "//" + res + "/webrtc"; + var SIGNALING_SERVER = signalingServerPath; //"ws://localhost:80/quantum/webrtc"; //"wss://localhost:80/quantum/webrtc"; --> ws for http and wss for https + + connection.openSignalingChannel = function(config) { + + + config.channel = config.channel || this.channel; + var websocket = new WebSocket(SIGNALING_SERVER); + websocket.channel = config.channel; + websocket.onopen = function() { + websocket.push(JSON.stringify({ + open: true, + channel: config.channel + })); + if (config.callback) + config.callback(websocket); + }; + websocket.onmessage = function(event) { + config.onmessage(JSON.parse(event.data)); + }; + websocket.push = websocket.send; + websocket.send = function(data) { + websocket.push(JSON.stringify({ + data: data, + channel: config.channel + })); + }; + + /* + // make sure firebase.js is loaded + if (!window.Firebase) { + return loadScript(connection.resources.firebase, function() { + connection.openSignalingChannel(config); + }); + } + + var channel = config.channel || connection.channel; + + if (connection.firebase) { + // for custom firebase instances + connection.resources.firebaseio = connection.resources.firebaseio.replace('//chat.', '//' + connection.firebase + '.'); + } + + var firebase = new Firebase(connection.resources.firebaseio + channel); + firebase.channel = channel; + firebase.on('child_added', function(data) { + config.onmessage(data.val()); + }); + + firebase.send = function(data) { + // a quick dirty workaround to make sure firebase + // shouldn't fail for NULL values. + for (var prop in data) { + if (isNull(data[prop]) || typeof data[prop] == 'function') { + data[prop] = false; + } + } + + this.push(data); + }; + + if (!connection.socket) + connection.socket = firebase; + + firebase.onDisconnect().remove(); + + setTimeout(function() { + config.callback(firebase); + }, 1); + + */ + // CUSTOM CODE // + + }; + + connection.Plugin = Plugin; + } + +})(); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/webrtc/getSourceId.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/webrtc/getSourceId.html new file mode 100644 index 0000000..6f66002 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/scripts/webrtc/getSourceId.html @@ -0,0 +1,78 @@ + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/att_angular_gridster/sandbox-gridster.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/att_angular_gridster/sandbox-gridster.css new file mode 100644 index 0000000..a9edba8 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/att_angular_gridster/sandbox-gridster.css @@ -0,0 +1,173 @@ +.gridster { + position: relative; + margin: auto; + /* height: 0 + */} + +.gridster>ul { + margin: 0; + list-style: none; + padding: 0 +} + +.gridster-item { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + list-style: none; + z-index: 2; + position: absolute; + display: none +} + +.gridster-loaded { + -webkit-transition: height .3s; + -moz-transition: height .3s; + -o-transition: height .3s; + transition: height .3s +} + +.gridster-loaded .gridster-item { + display: block; + position: absolute; + -webkit-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s; + -moz-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s; + -o-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s; + transition: opacity .3s, left .3s, top .3s, width .3s, height .3s; + -webkit-transition-delay: 50ms; + -moz-transition-delay: 50ms; + -o-transition-delay: 50ms; + transition-delay: 50ms +} + +.gridster-loaded .gridster-preview-holder { + display: none; + z-index: 1; + position: absolute; + background-color: #067ab4; + /* + background-color: rgb(6, 122, 180); + -ms-filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#067ab4', endColorstr='#067ab4'); IE + opacity: 0.2; + */ + border-color: #fff; + -webkit-transition: width .2s, height .3s; + -moz-transition: width .2s, height .3s; + -o-transition: width .2s, height .3s; + transition: width .2s, height .3s; + -webkit-transition-delay: 50ms; + -moz-transition-delay: 50ms; + -o-transition-delay: 50ms; + transition-delay: 50ms +} + +.gridster-loaded .gridster-item.gridster-item-moving { + -webkit-transition: none; + -moz-transition: none; + -o-transition: none; + transition: none; + opacity: 0.9; +} + +.gridster-mobile { + height: auto !important +} + +.gridster-mobile .gridster-item { + height: auto; + position: static; + float: none +} + +.gridster-item.ng-leave.ng-leave-active { + opacity: 0 +} + +.gridster-item.ng-enter { + opacity: 1 +} + +.gridster-item-moving { + z-index: 3 +} + +.gridster-item-resizable-handler { + position: absolute; + font-size: 1px; + display: block +} + +.handle-se { + cursor: se-resize; + width: 0; + height: 0; + right: 1px; + bottom: 1px; + border-style: solid; + border-width: 0 0 12px 12px; + border-color: transparent +} + +.handle-ne { + cursor: ne-resize; + width: 12px; + height: 12px; + right: 1px; + top: 1px +} + +.handle-nw { + cursor: nw-resize; + width: 12px; + height: 12px; + left: 1px; + top: 1px +} + +.handle-sw { + cursor: sw-resize; + width: 12px; + height: 12px; + left: 1px; + bottom: 1px +} + +.handle-e { + cursor: e-resize; + width: 12px; + bottom: 0; + right: 1px; + top: 0 +} + +.handle-s { + cursor: s-resize; + height: 12px; + right: 0; + bottom: 1px; + left: 0 +} + +.handle-n { + cursor: n-resize; + height: 12px; + right: 0; + top: 1px; + left: 0 +} + +.handle-w { + cursor: w-resize; + width: 12px; + left: 1px; + top: 0; + bottom: 0 +} + +.gridster .gridster-item:hover .gridster-box { + border: 1.5px solid #B3B2B3 +} + +.gridster .gridster-item:hover .handle-se { + border-color: transparent transparent #ccc +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/att_angular_gridster/ui-gridster.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/att_angular_gridster/ui-gridster.css new file mode 100644 index 0000000..827e354 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/att_angular_gridster/ui-gridster.css @@ -0,0 +1,116 @@ +/* ui-gridster.css */ +.gridster-container { + background-color: #EFEFEF; + color: #fff; + border: 1px dashed; + overflow-y: auto; + overflow-x: hidden; } + +/* app css for attGridtser */ +.gridster-item-container { + background-color: #FFFFFF; + position: relative; + margin-left: auto; + margin-right: auto; + min-height: 79px; + height: 100%; } + .gridster-item-container .gridster-item-header { + /* gridster-item Header */ + position: relative; + height: 50px !important; + border: 1px solid #d3d3d3; + border-bottom: 0; + background-color: #E5E5E5; + white-space: nowrap; + text-overflow: ellipsis; + z-index: 1; + -webkit-border-radius: 2px 2px 0 0; + -moz-border-radius: 2px 2px 0 0; + -ms-border-radius: 2px 2px 0 0; + -o-border-radius: 2px 2px 0 0; + border-radius: 2px 2px 0 0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + /* IE6-8 */ } + .gridster-item-container .gridster-item-header .gridster-item-handle { + cursor: move; + margin: 12px; + position: absolute; + top: 0; + left: 0; + border: 0; + vertical-align: middle; + -ms-interpolation-mode: bicubic; + display: block; } + .gridster-item-container .gridster-item-header .gridster-item-header-content { + line-height: 44px; + margin-left: 26px; + font-family: clearviewatt; + font-size: 18px; + color: #444444; + float: left; } + .gridster-item-container .gridster-item-header .gridster-item-sub-header-content { + position: absolute; + top: 29.5px; + left: 26px; + font-family: clearviewatt; + font-size: 12px; + color: #444444; } + .gridster-item-container .gridster-item-header .gridster-item-header-buttons-container { + position: absolute; + right: 10px; + top: 10px; + overflow: hidden; + text-align: right; + height: 30px; + color: #444444; } + .gridster-item-container .gridster-item-body { + /* gridster-item Body */ + position: absolute; + width: 100%; + top: 50px; + left: 0; + right: 0; + bottom: 29px; + border: 1px solid #d3d3d3; + box-sizing: border-box; + overflow: auto; + color: #444444; + /* text-align: center; */ } + .gridster-item-container .gridster-item-footer { + /* gridster-item Footer */ + position: absolute; + bottom: 0; + width: 100%; + height: 29px !important; + text-align: left; + cursor: pointer; + border: 1px solid #d3d3d3; + border-top: 0; + background-color: #F2F2F2; + -webkit-border-radius: 0 0 2px 2px; + -moz-border-radius: 0 0 2px 2px; + -ms-border-radius: 0 0 2px 2px; + -o-border-radius: 0 0 2px 2px; + border-radius: 0 0 2px 2px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + text-decoration: none; + /* IE6-8 */ } + .gridster-item-container .gridster-item-footer:hover { + background-color: #E5E5E5; + color: #565656; + text-decoration: underline; } + .gridster-item-container .gridster-item-footer .gridster-item-footer-content { + line-height: 30px; + font-family: clearviewatt; + font-size: 12px; + color: #565656; + margin: 20px; + text-decoration: none; } + .gridster-item-container .gridster-item-footer .gridster-item-footer-content:hover { + color: #199ddf; + text-decoration: underline; } diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/fusion-sunny.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/fusion-sunny.css new file mode 100644 index 0000000..c830615 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/fusion-sunny.css @@ -0,0 +1,362 @@ + input, textarea, select, div { + font-family: Arial; + font-size: 11px; + font-weight: normal; + } + + form { + margin-top: 5px; + } + + + .applicationWindow { border-width: 0px 0px 1px 0px; + border-style: solid; + border-color: #959595; + box-shadow: inset 0 0 10px #000000; + margin-top: 10px; + margin-bottom: 10px; + margin-left: 10px; + margin-right: 10px; + } + + .feedbackMessage { width: 99%; + font-family: Arial; + font-size: 11px; + color: #1f1f1f; + padding: 3px; + border: 1px #eeb420 solid; + margin: 3px; + background: #fff9e5; + } + + .menubar { + border-width: 0px 0px 0px 1px; border-style: solid; border-color: #959595; + } + + .footer { + /*clear: both;*/ + border-width: 0px 1px 0px 1px; border-style: solid; border-color: #959595; + font-family: Verdana,Arial,Helvetica, sans-serif; + font-size: 9px; + padding: 10px 10px 30px 10px; + background: white; + } + + .pageTitle { + font-family: Arial; + font-size: 18px; + font-weight: bold; + margin-top: 5px; + } + + .content { + border-width: 0px 1px 0px 1px; + border-style: solid; + border-color: #959595; + font-family: Arial; + font-size: 11px; + padding: 5px; + background: white; + /*height: 600px;*/ + } + + .popupContent { + font-family: Arial; + font-size: 11px; + padding: 3px; + } + + .logo { + border-width: 0px 1px 0px 1px; + border-style: solid; + border-color: #959595; + text-align: right; + } + + .sep { + border: 1px solid black + } + + .attLogo { /*position: relative;*/ + float:left; + padding-top: 25px; + padding-left: 25px; + } + + .applicationLogo { float:right; + padding-top: 25px; + padding-right: 25px; + } + + .applinkWhite { font-family: Arial; + font-size: 13px; + font-weight: 900; + color: #FFFFFF; + text-decoration: none; } + + .terms { font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 9px; + } + + .broadcastMessage { color: red; } + .broadcastMessageList { color: red; } + + .button { + margin: 5px 1px 5px 1px; + padding: 3px; } + + .toolbarbutton:hover { + color:#005491; + } + + .headerText { font-family: Arial; + font-size: 15px; + font-weight: 700; + color: #000000; } + + .headerBackground { background: #336699; } + + .errorMessageText { font-family: Arial; + font-size: 11px; + font-weight: bold; + color: red; } + + + .normalText { font-family: Arial; + font-size: 11px; + color: #000000; } + + .normalTextRed { font-family: Arial; + font-size: 11px; + color: red; } + + + .smallNormalText { font-family: Arial; + font-size: 9px; + color: #000000; } + + .tableBorder { border:1px outset teal } + + .validationError { background: #b9eaff; } + + .templatebody { + background: url(../images/body_graphic.jpg) repeat-x; + /*margin: 40px 80px 40px 80px;*/ + } + + /*--------------------- General Content ------------------------------------*/ + + .relative { + position:relative; + } + + .clear{ + clear:both; + } + + .left { + float: left; + } + + .leftCentered{ + float: left; + text-align: center; + } + + .right { + float: right; + } + + .rightAligned{ + text-align: right; + } + + .centered { + text-align: center; + align: center; + } + + + .noWrap{ + white-space:nowrap; + } + + .disabled { + color:gray; + cursor:hand; + } + + /*--------------------- Tab styles -------------------------------------*/ + + .current { + font-weight: bold; + border-width: 1px 1px 1px 1px; + border-color: silver; + border-style: solid; + } + + .subTab { + font-weight:bold; + font-family: Arial; + font-size: 11px; + color: #0F3B82; + } + + + /*--------------------- Grid styles ------------------------------------*/ + + /* Grid navigation and header styles */ + .gridFilterLabel {font-size: 7pt; + font-align: justify; + font-weight: bold; + display: block;} + + .gridFilterText {height: 17px; + font-size: 8pt; + width: 60%; + font-align: justify;} + + .gridNavigationBar { font-family:Arial,Verdana; + font-size:11px; + font-weight:normal; + color:#000; + margin: 0px; + width: 100%; + vertical-align: middle; + } + + .gridNavigationBar .navLinks { float: left; + margin-right:15px; + padding-top: 2px; + height: 19px; + line-height: 19px; + } + + .gridNavigationBar .pageControls { float: left; + margin-right: 15px; + height: 19px; + line-height: 19px; + } + + .gridNavigationBar .pageControls input { font-size: 8pt; + height: 17px; + vertical-align: middle; + } + + .gridNavigationBar .pageInfo { float: right; + vertical-align: middle; + height: 19px; + line-height: 19px; + } + + .gridNavigationBar .pageInfo input { font-size: 8pt; + height: 17px; + vertical-align: middle; + } + + + .gridNavigationBar span { padding: 3px; } + + .gridNavigationBar a { + text-decoration:underline; + color:#000; + font-weight:normal; + } + + .gridNavigationBar img { vertical-align: middle; } + + .gridBulkUpdateRow { + height: 35px; + line-height: 35px; + } + + .gridBulkUpdateRow input { + vertical-align: middle; + } + + + /* dummy class used to lock the form elements of a grid - ex. bulk transaction processing */ + .alwaysEnabled {} + + .hidden { + display: none; + } + + .selectedPage { + background-color:#C4DFFB; + color: white; + border-style: solid; + border-width: 1px; + border-color: gray; + padding-left: 3px; + padding-right: 3px; + vertical-align: middle; + } + + .selectedRow{ + /*background-color:#C4DFFB;*/ + } + + /* Action Item styles */ + .actionList { + margin-left: -20px; + margin-right: -10px; + padding-left: 5px; + } + + .actionList li { + float:left; + padding-left: 3px; + padding-right: 3px; + } + + .actionList li a { + text-decoration:none; + color:#000; + } + + /* Filter Operator List styles */ + + .filterList { + margin: 0px; + } + + .filterList li { + list-style-type: none; + padding:3px 3px 3px 2px; + cursor:hand; + font-size:11px; + } + + .filterList li:hover { + background: #404040; + } + + .filterList li a { + color: #000; + text-decoration: none; + } + + .filterList li:hover a { + color: white; + } + + .filterList li a:hover { + text-decoration: none; + color: white; + } + + .filterListItem a { + text-decoration:none; + padding:3px 2px 3px 2px; + } + + + /*---------------------- Customized ZK Styles ------------------------------*/ + + .z-datebox input, .z-timebox input { + font-family: Arial; + font-size: 11px; + height: 15px; + margin-top:1px; + } diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/jquery-ui.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/jquery-ui.css new file mode 100644 index 0000000..1c22746 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/jquery-ui.css @@ -0,0 +1,1225 @@ +/*! jQuery UI - v1.11.4 - 2015-03-11 +* http://jqueryui.com +* Includes: core.css, accordion.css, autocomplete.css, button.css, datepicker.css, dialog.css, draggable.css, menu.css, progressbar.css, resizable.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css +* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px +* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { + display: none; +} +.ui-helper-hidden-accessible { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; +} +.ui-helper-reset { + margin: 0; + padding: 0; + border: 0; + outline: 0; + line-height: 1.3; + text-decoration: none; + font-size: 100%; + list-style: none; +} +.ui-helper-clearfix:before, +.ui-helper-clearfix:after { + content: ""; + display: table; + border-collapse: collapse; +} +.ui-helper-clearfix:after { + clear: both; +} +.ui-helper-clearfix { + min-height: 0; /* support: IE7 */ +} +.ui-helper-zfix { + width: 100%; + height: 100%; + top: 0; + left: 0; + position: absolute; + opacity: 0; + filter:Alpha(Opacity=0); /* support: IE8 */ +} + +.ui-front { + z-index: 100; +} + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { + cursor: default !important; +} + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { + display: block; + text-indent: -99999px; + overflow: hidden; + background-repeat: no-repeat; +} + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; +} +.ui-accordion .ui-accordion-header { + display: block; + cursor: pointer; + position: relative; + margin: 2px 0 0 0; + padding: .5em .5em .5em .7em; + min-height: 0; /* support: IE7 */ + font-size: 100%; +} +.ui-accordion .ui-accordion-icons { + padding-left: 2.2em; +} +.ui-accordion .ui-accordion-icons .ui-accordion-icons { + padding-left: 2.2em; +} +.ui-accordion .ui-accordion-header .ui-accordion-header-icon { + position: absolute; + left: .5em; + top: 50%; + margin-top: -8px; +} +.ui-accordion .ui-accordion-content { + padding: 1em 2.2em; + border-top: 0; + overflow: auto; +} +.ui-autocomplete { + position: absolute; + top: 0; + left: 0; + cursor: default; +} +.ui-button { + display: inline-block; + position: relative; + padding: 0; + line-height: normal; + margin-right: .1em; + cursor: pointer; + vertical-align: middle; + text-align: center; + overflow: visible; /* removes extra width in IE */ +} +.ui-button, +.ui-button:link, +.ui-button:visited, +.ui-button:hover, +.ui-button:active { + text-decoration: none; +} +/* to make room for the icon, a width needs to be set here */ +.ui-button-icon-only { + width: 2.2em; +} +/* button elements seem to need a little more width */ +button.ui-button-icon-only { + width: 2.4em; +} +.ui-button-icons-only { + width: 3.4em; +} +button.ui-button-icons-only { + width: 3.7em; +} + +/* button text element */ +.ui-button .ui-button-text { + display: block; + line-height: normal; +} +.ui-button-text-only .ui-button-text { + padding: .4em 1em; +} +.ui-button-icon-only .ui-button-text, +.ui-button-icons-only .ui-button-text { + padding: .4em; + text-indent: -9999999px; +} +.ui-button-text-icon-primary .ui-button-text, +.ui-button-text-icons .ui-button-text { + padding: .4em 1em .4em 2.1em; +} +.ui-button-text-icon-secondary .ui-button-text, +.ui-button-text-icons .ui-button-text { + padding: .4em 2.1em .4em 1em; +} +.ui-button-text-icons .ui-button-text { + padding-left: 2.1em; + padding-right: 2.1em; +} +/* no icon support for input elements, provide padding by default */ +input.ui-button { + padding: .4em 1em; +} + +/* button icon element(s) */ +.ui-button-icon-only .ui-icon, +.ui-button-text-icon-primary .ui-icon, +.ui-button-text-icon-secondary .ui-icon, +.ui-button-text-icons .ui-icon, +.ui-button-icons-only .ui-icon { + position: absolute; + top: 50%; + margin-top: -8px; +} +.ui-button-icon-only .ui-icon { + left: 50%; + margin-left: -8px; +} +.ui-button-text-icon-primary .ui-button-icon-primary, +.ui-button-text-icons .ui-button-icon-primary, +.ui-button-icons-only .ui-button-icon-primary { + left: .5em; +} +.ui-button-text-icon-secondary .ui-button-icon-secondary, +.ui-button-text-icons .ui-button-icon-secondary, +.ui-button-icons-only .ui-button-icon-secondary { + right: .5em; +} + +/* button sets */ +.ui-buttonset { + margin-right: 7px; +} +.ui-buttonset .ui-button { + margin-left: 0; + margin-right: -.3em; +} + +/* workarounds */ +/* reset extra padding in Firefox, see h5bp.com/l */ +input.ui-button::-moz-focus-inner, +button.ui-button::-moz-focus-inner { + border: 0; + padding: 0; +} +.ui-datepicker { + width: 17em; + padding: .2em .2em 0; + display: none; +} +.ui-datepicker .ui-datepicker-header { + position: relative; + padding: .2em 0; +} +.ui-datepicker .ui-datepicker-prev, +.ui-datepicker .ui-datepicker-next { + position: absolute; + top: 2px; + width: 1.8em; + height: 1.8em; +} +.ui-datepicker .ui-datepicker-prev-hover, +.ui-datepicker .ui-datepicker-next-hover { + top: 1px; +} +.ui-datepicker .ui-datepicker-prev { + left: 2px; +} +.ui-datepicker .ui-datepicker-next { + right: 2px; +} +.ui-datepicker .ui-datepicker-prev-hover { + left: 1px; +} +.ui-datepicker .ui-datepicker-next-hover { + right: 1px; +} +.ui-datepicker .ui-datepicker-prev span, +.ui-datepicker .ui-datepicker-next span { + display: block; + position: absolute; + left: 50%; + margin-left: -8px; + top: 50%; + margin-top: -8px; +} +.ui-datepicker .ui-datepicker-title { + margin: 0 2.3em; + line-height: 1.8em; + text-align: center; +} +.ui-datepicker .ui-datepicker-title select { + font-size: 1em; + margin: 1px 0; +} +.ui-datepicker select.ui-datepicker-month, +.ui-datepicker select.ui-datepicker-year { + width: 45%; +} +.ui-datepicker table { + width: 100%; + font-size: .9em; + border-collapse: collapse; + margin: 0 0 .4em; +} +.ui-datepicker th { + padding: .7em .3em; + text-align: center; + font-weight: bold; + border: 0; +} +.ui-datepicker td { + border: 0; + padding: 1px; +} +.ui-datepicker td span, +.ui-datepicker td a { + display: block; + padding: .2em; + text-align: right; + text-decoration: none; +} +.ui-datepicker .ui-datepicker-buttonpane { + background-image: none; + margin: .7em 0 0 0; + padding: 0 .2em; + border-left: 0; + border-right: 0; + border-bottom: 0; +} +.ui-datepicker .ui-datepicker-buttonpane button { + float: right; + margin: .5em .2em .4em; + cursor: pointer; + padding: .2em .6em .3em .6em; + width: auto; + overflow: visible; +} +.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { + float: left; +} + +/* with multiple calendars */ +.ui-datepicker.ui-datepicker-multi { + width: auto; +} +.ui-datepicker-multi .ui-datepicker-group { + float: left; +} +.ui-datepicker-multi .ui-datepicker-group table { + width: 95%; + margin: 0 auto .4em; +} +.ui-datepicker-multi-2 .ui-datepicker-group { + width: 50%; +} +.ui-datepicker-multi-3 .ui-datepicker-group { + width: 33.3%; +} +.ui-datepicker-multi-4 .ui-datepicker-group { + width: 25%; +} +.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header, +.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { + border-left-width: 0; +} +.ui-datepicker-multi .ui-datepicker-buttonpane { + clear: left; +} +.ui-datepicker-row-break { + clear: both; + width: 100%; + font-size: 0; +} + +/* RTL support */ +.ui-datepicker-rtl { + direction: rtl; +} +.ui-datepicker-rtl .ui-datepicker-prev { + right: 2px; + left: auto; +} +.ui-datepicker-rtl .ui-datepicker-next { + left: 2px; + right: auto; +} +.ui-datepicker-rtl .ui-datepicker-prev:hover { + right: 1px; + left: auto; +} +.ui-datepicker-rtl .ui-datepicker-next:hover { + left: 1px; + right: auto; +} +.ui-datepicker-rtl .ui-datepicker-buttonpane { + clear: right; +} +.ui-datepicker-rtl .ui-datepicker-buttonpane button { + float: left; +} +.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current, +.ui-datepicker-rtl .ui-datepicker-group { + float: right; +} +.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header, +.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { + border-right-width: 0; + border-left-width: 1px; +} +.ui-dialog { + overflow: hidden; + position: absolute; + top: 0; + left: 0; + padding: .2em; + outline: 0; +} +.ui-dialog .ui-dialog-titlebar { + padding: .4em 1em; + position: relative; +} +.ui-dialog .ui-dialog-title { + float: left; + margin: .1em 0; + white-space: nowrap; + width: 90%; + overflow: hidden; + text-overflow: ellipsis; +} +.ui-dialog .ui-dialog-titlebar-close { + position: absolute; + right: .3em; + top: 50%; + width: 20px; + margin: -10px 0 0 0; + padding: 1px; + height: 20px; +} +.ui-dialog .ui-dialog-content { + position: relative; + border: 0; + padding: .5em 1em; + background: none; + overflow: auto; +} +.ui-dialog .ui-dialog-buttonpane { + text-align: left; + border-width: 1px 0 0 0; + background-image: none; + margin-top: .5em; + padding: .3em 1em .5em .4em; +} +.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { + float: right; +} +.ui-dialog .ui-dialog-buttonpane button { + margin: .5em .4em .5em 0; + cursor: pointer; +} +.ui-dialog .ui-resizable-se { + width: 12px; + height: 12px; + right: -5px; + bottom: -5px; + background-position: 16px 16px; +} +.ui-draggable .ui-dialog-titlebar { + cursor: move; +} +.ui-draggable-handle { + -ms-touch-action: none; + touch-action: none; +} +.ui-menu { + list-style: none; + padding: 0; + margin: 0; + display: block; + outline: none; +} +.ui-menu .ui-menu { + position: absolute; +} +.ui-menu .ui-menu-item { + position: relative; + margin: 0; + padding: 3px 1em 3px .4em; + cursor: pointer; + min-height: 0; /* support: IE7 */ + /* support: IE10, see #8844 */ + list-style-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"); +} +.ui-menu .ui-menu-divider { + margin: 5px 0; + height: 0; + font-size: 0; + line-height: 0; + border-width: 1px 0 0 0; +} +.ui-menu .ui-state-focus, +.ui-menu .ui-state-active { + margin: -1px; +} + +/* icon support */ +.ui-menu-icons { + position: relative; +} +.ui-menu-icons .ui-menu-item { + padding-left: 2em; +} + +/* left-aligned */ +.ui-menu .ui-icon { + position: absolute; + top: 0; + bottom: 0; + left: .2em; + margin: auto 0; +} + +/* right-aligned */ +.ui-menu .ui-menu-icon { + left: auto; + right: 0; +} +.ui-progressbar { + height: 2em; + text-align: left; + overflow: hidden; +} +.ui-progressbar .ui-progressbar-value { + margin: -1px; + height: 100%; +} +.ui-progressbar .ui-progressbar-overlay { + background: url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEA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JXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw=="); + height: 100%; + filter: alpha(opacity=25); /* support: IE8 */ + opacity: 0.25; +} +.ui-progressbar-indeterminate .ui-progressbar-value { + background-image: none; +} +.ui-resizable { + position: relative; +} +.ui-resizable-handle { + position: absolute; + font-size: 0.1px; + display: block; + -ms-touch-action: none; + touch-action: none; +} +.ui-resizable-disabled .ui-resizable-handle, +.ui-resizable-autohide .ui-resizable-handle { + display: none; +} +.ui-resizable-n { + cursor: n-resize; + height: 7px; + width: 100%; + top: -5px; + left: 0; +} +.ui-resizable-s { + cursor: s-resize; + height: 7px; + width: 100%; + bottom: -5px; + left: 0; +} +.ui-resizable-e { + cursor: e-resize; + width: 7px; + right: -5px; + top: 0; + height: 100%; +} +.ui-resizable-w { + cursor: w-resize; + width: 7px; + left: -5px; + top: 0; + height: 100%; +} +.ui-resizable-se { + cursor: se-resize; + width: 12px; + height: 12px; + right: 1px; + bottom: 1px; +} +.ui-resizable-sw { + cursor: sw-resize; + width: 9px; + height: 9px; + left: -5px; + bottom: -5px; +} +.ui-resizable-nw { + cursor: nw-resize; + width: 9px; + height: 9px; + left: -5px; + top: -5px; +} +.ui-resizable-ne { + cursor: ne-resize; + width: 9px; + height: 9px; + right: -5px; + top: -5px; +} +.ui-selectable { + -ms-touch-action: none; + touch-action: none; +} +.ui-selectable-helper { + position: absolute; + z-index: 100; + border: 1px dotted black; +} +.ui-selectmenu-menu { + padding: 0; + margin: 0; + position: absolute; + top: 0; + left: 0; + display: none; +} +.ui-selectmenu-menu .ui-menu { + overflow: auto; + /* Support: IE7 */ + overflow-x: hidden; + padding-bottom: 1px; +} +.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup { + font-size: 1em; + font-weight: bold; + line-height: 1.5; + padding: 2px 0.4em; + margin: 0.5em 0 0 0; + height: auto; + border: 0; +} +.ui-selectmenu-open { + display: block; +} +.ui-selectmenu-button { + display: inline-block; + overflow: hidden; + position: relative; + text-decoration: none; + cursor: pointer; +} +.ui-selectmenu-button span.ui-icon { + right: 0.5em; + left: auto; + margin-top: -8px; + position: absolute; + top: 50%; +} +.ui-selectmenu-button span.ui-selectmenu-text { + text-align: left; + padding: 0.4em 2.1em 0.4em 1em; + display: block; + line-height: 1.4; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.ui-slider { + position: relative; + text-align: left; +} +.ui-slider .ui-slider-handle { + position: absolute; + z-index: 2; + width: 1.2em; + height: 1.2em; + cursor: default; + -ms-touch-action: none; + touch-action: none; +} +.ui-slider .ui-slider-range { + position: absolute; + z-index: 1; + font-size: .7em; + display: block; + border: 0; + background-position: 0 0; +} + +/* support: IE8 - See #6727 */ +.ui-slider.ui-state-disabled .ui-slider-handle, +.ui-slider.ui-state-disabled .ui-slider-range { + filter: inherit; +} + +.ui-slider-horizontal { + height: .8em; +} +.ui-slider-horizontal .ui-slider-handle { + top: -.3em; + margin-left: -.6em; +} +.ui-slider-horizontal .ui-slider-range { + top: 0; + height: 100%; +} +.ui-slider-horizontal .ui-slider-range-min { + left: 0; +} +.ui-slider-horizontal .ui-slider-range-max { + right: 0; +} + +.ui-slider-vertical { + width: .8em; + height: 100px; +} +.ui-slider-vertical .ui-slider-handle { + left: -.3em; + margin-left: 0; + margin-bottom: -.6em; +} +.ui-slider-vertical .ui-slider-range { + left: 0; + width: 100%; +} +.ui-slider-vertical .ui-slider-range-min { + bottom: 0; +} +.ui-slider-vertical .ui-slider-range-max { + top: 0; +} +.ui-sortable-handle { + -ms-touch-action: none; + touch-action: none; +} +.ui-spinner { + position: relative; + display: inline-block; + overflow: hidden; + padding: 0; + vertical-align: middle; +} +.ui-spinner-input { + border: none; + background: none; + color: inherit; + padding: 0; + margin: .2em 0; + vertical-align: middle; + margin-left: .4em; + margin-right: 22px; +} +.ui-spinner-button { + width: 16px; + height: 50%; + font-size: .5em; + padding: 0; + margin: 0; + text-align: center; + position: absolute; + cursor: default; + display: block; + overflow: hidden; + right: 0; +} +/* more specificity required here to override default borders */ +.ui-spinner a.ui-spinner-button { + border-top: none; + border-bottom: none; + border-right: none; +} +/* vertically center icon */ +.ui-spinner .ui-icon { + position: absolute; + margin-top: -8px; + top: 50%; + left: 0; +} +.ui-spinner-up { + top: 0; +} +.ui-spinner-down { + bottom: 0; +} + +/* TR overrides */ +.ui-spinner .ui-icon-triangle-1-s { + /* need to fix icons sprite */ + background-position: -65px -16px; +} +.ui-tabs { + position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ + padding: .2em; +} +.ui-tabs .ui-tabs-nav { + margin: 0; + padding: .2em .2em 0; +} +.ui-tabs .ui-tabs-nav li { + list-style: none; + float: left; + position: relative; + top: 0; + margin: 1px .2em 0 0; + border-bottom-width: 0; + padding: 0; + white-space: nowrap; +} +.ui-tabs .ui-tabs-nav .ui-tabs-anchor { + float: left; + padding: .5em 1em; + text-decoration: none; +} +.ui-tabs .ui-tabs-nav li.ui-tabs-active { + margin-bottom: -1px; + padding-bottom: 1px; +} +.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor, +.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor, +.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor { + cursor: text; +} +.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor { + cursor: pointer; +} +.ui-tabs .ui-tabs-panel { + display: block; + border-width: 0; + padding: 1em 1.4em; + background: none; +} +.ui-tooltip { + padding: 8px; + position: absolute; + z-index: 9999; + max-width: 300px; + -webkit-box-shadow: 0 0 5px #aaa; + box-shadow: 0 0 5px #aaa; +} +body .ui-tooltip { + border-width: 2px; +} + +/* Component containers +----------------------------------*/ +.ui-widget { + font-family: Verdana,Arial,sans-serif; + font-size: 1.1em; +} +.ui-widget .ui-widget { + font-size: 1em; +} +.ui-widget input, +.ui-widget select, +.ui-widget textarea, +.ui-widget button { + font-family: Verdana,Arial,sans-serif; + font-size: 1em; +} +.ui-widget-content { + border: 1px solid #aaaaaa; + background: #ffffff url("images/ui-bg_flat_75_ffffff_40x100.png") 50% 50% repeat-x; + color: #222222; +} +.ui-widget-content a { + color: #222222; +} +.ui-widget-header { + border: 1px solid #aaaaaa; + background: #cccccc url("images/ui-bg_highlight-soft_75_cccccc_1x100.png") 50% 50% repeat-x; + color: #222222; + font-weight: bold; +} +.ui-widget-header a { + color: #222222; +} + +/* Interaction states +----------------------------------*/ +.ui-state-default, +.ui-widget-content .ui-state-default, +.ui-widget-header .ui-state-default { + border: 1px solid #d3d3d3; + background: #e6e6e6 url("images/ui-bg_glass_75_e6e6e6_1x400.png") 50% 50% repeat-x; + font-weight: normal; + color: #555555; +} +.ui-state-default a, +.ui-state-default a:link, +.ui-state-default a:visited { + color: #555555; + text-decoration: none; +} +.ui-state-hover, +.ui-widget-content .ui-state-hover, +.ui-widget-header .ui-state-hover, +.ui-state-focus, +.ui-widget-content .ui-state-focus, +.ui-widget-header .ui-state-focus { + border: 1px solid #999999; + background: #dadada url("images/ui-bg_glass_75_dadada_1x400.png") 50% 50% repeat-x; + font-weight: normal; + color: #212121; +} +.ui-state-hover a, +.ui-state-hover a:hover, +.ui-state-hover a:link, +.ui-state-hover a:visited, +.ui-state-focus a, +.ui-state-focus a:hover, +.ui-state-focus a:link, +.ui-state-focus a:visited { + color: #212121; + text-decoration: none; +} +.ui-state-active, +.ui-widget-content .ui-state-active, +.ui-widget-header .ui-state-active { + border: 1px solid #aaaaaa; + background: #ffffff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x; + font-weight: normal; + color: #212121; +} +.ui-state-active a, +.ui-state-active a:link, +.ui-state-active a:visited { + color: #212121; + text-decoration: none; +} + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, +.ui-widget-content .ui-state-highlight, +.ui-widget-header .ui-state-highlight { + border: 1px solid #fcefa1; + background: #fbf9ee url("images/ui-bg_glass_55_fbf9ee_1x400.png") 50% 50% repeat-x; + color: #363636; +} +.ui-state-highlight a, +.ui-widget-content .ui-state-highlight a, +.ui-widget-header .ui-state-highlight a { + color: #363636; +} +.ui-state-error, +.ui-widget-content .ui-state-error, +.ui-widget-header .ui-state-error { + border: 1px solid #cd0a0a; + background: #fef1ec url("images/ui-bg_glass_95_fef1ec_1x400.png") 50% 50% repeat-x; + color: #cd0a0a; +} +.ui-state-error a, +.ui-widget-content .ui-state-error a, +.ui-widget-header .ui-state-error a { + color: #cd0a0a; +} +.ui-state-error-text, +.ui-widget-content .ui-state-error-text, +.ui-widget-header .ui-state-error-text { + color: #cd0a0a; +} +.ui-priority-primary, +.ui-widget-content .ui-priority-primary, +.ui-widget-header .ui-priority-primary { + font-weight: bold; +} +.ui-priority-secondary, +.ui-widget-content .ui-priority-secondary, +.ui-widget-header .ui-priority-secondary { + opacity: .7; + filter:Alpha(Opacity=70); /* support: IE8 */ + font-weight: normal; +} +.ui-state-disabled, +.ui-widget-content .ui-state-disabled, +.ui-widget-header .ui-state-disabled { + opacity: .35; + filter:Alpha(Opacity=35); /* support: IE8 */ + background-image: none; +} +.ui-state-disabled .ui-icon { + filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */ +} + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { + width: 16px; + height: 16px; +} +.ui-icon, +.ui-widget-content .ui-icon { + background-image: url("images/ui-icons_222222_256x240.png"); +} +.ui-widget-header .ui-icon { + background-image: url("images/ui-icons_222222_256x240.png"); +} +.ui-state-default .ui-icon { + background-image: url("images/ui-icons_888888_256x240.png"); +} +.ui-state-hover .ui-icon, +.ui-state-focus .ui-icon { + background-image: url("images/ui-icons_454545_256x240.png"); +} +.ui-state-active .ui-icon { + background-image: url("images/ui-icons_454545_256x240.png"); +} +.ui-state-highlight .ui-icon { + background-image: url("images/ui-icons_2e83ff_256x240.png"); +} +.ui-state-error .ui-icon, +.ui-state-error-text .ui-icon { + background-image: url("images/ui-icons_cd0a0a_256x240.png"); +} + +/* positioning */ +.ui-icon-blank { background-position: 16px 16px; } +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-on { background-position: -96px -144px; } +.ui-icon-radio-off { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-start { background-position: -80px -160px; } +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-all, +.ui-corner-top, +.ui-corner-left, +.ui-corner-tl { + border-top-left-radius: 4px; +} +.ui-corner-all, +.ui-corner-top, +.ui-corner-right, +.ui-corner-tr { + border-top-right-radius: 4px; +} +.ui-corner-all, +.ui-corner-bottom, +.ui-corner-left, +.ui-corner-bl { + border-bottom-left-radius: 4px; +} +.ui-corner-all, +.ui-corner-bottom, +.ui-corner-right, +.ui-corner-br { + border-bottom-right-radius: 4px; +} + +/* Overlays */ +.ui-widget-overlay { + background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x; + opacity: .3; + filter: Alpha(Opacity=30); /* support: IE8 */ +} +.ui-widget-shadow { + margin: -8px 0 0 -8px; + padding: 8px; + background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x; + opacity: .3; + filter: Alpha(Opacity=30); /* support: IE8 */ + border-radius: 8px; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/layout/layout-default-latest.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/layout/layout-default-latest.css new file mode 100644 index 0000000..aa382de --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/layout/layout-default-latest.css @@ -0,0 +1,224 @@ +/* + * Default Layout Theme + * + * Created for jquery.layout + * + * Copyright (c) 2010 + * Fabrizio Balliano (http://www.fabrizioballiano.net) + * Kevin Dalman (http://allpro.net) + * + * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html) + * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses. + * + * Last Updated: 2010-02-10 + * NOTE: For best code readability, view this with a fixed-space font and tabs equal to 4-chars + */ + +/* + * DEFAULT FONT + * Just to make demo-pages look better - not actually relevant to Layout! + */ +body { + font-family: Geneva, Arial, Helvetica, sans-serif; + font-size: 100%; + *font-size: 80%; +} + +/* + * PANES & CONTENT-DIVs + */ +.ui-layout-pane { /* all 'panes' */ + background: #FFF; + border: 1px solid #BBB; + padding: 10px; + overflow: auto; + /* DO NOT add scrolling (or padding) to 'panes' that have a content-div, + otherwise you may get double-scrollbars - on the pane AND on the content-div + - use ui-layout-wrapper class if pane has a content-div + - use ui-layout-container if pane has an inner-layout + */ + } + /* (scrolling) content-div inside pane allows for fixed header(s) and/or footer(s) */ + .ui-layout-content { + padding: 10px; + position: relative; /* contain floated or positioned elements */ + overflow: auto; /* add scrolling to content-div */ + } + +/* + * UTILITY CLASSES + * Must come AFTER pane-class above so will override + * These classes are NOT auto-generated and are NOT used by Layout + */ +.layout-child-container, +.layout-content-container { + padding: 0; + overflow: hidden; +} +.layout-child-container { + border: 0; /* remove border because inner-layout-panes probably have borders */ +} +.layout-scroll { + overflow: auto; +} +.layout-hide { + display: none; +} + +/* + * RESIZER-BARS + */ +.ui-layout-resizer { /* all 'resizer-bars' */ + background: #DDD; + border: 1px solid #BBB; + border-width: 0; + } + .ui-layout-resizer-drag { /* REAL resizer while resize in progress */ + } + .ui-layout-resizer-hover { /* affects both open and closed states */ + } + /* NOTE: It looks best when 'hover' and 'dragging' are set to the same color, + otherwise color shifts while dragging when bar can't keep up with mouse */ + .ui-layout-resizer-open-hover , /* hover-color to 'resize' */ + .ui-layout-resizer-dragging { /* resizer beging 'dragging' */ + background: #C4E1A4; + } + .ui-layout-resizer-dragging { /* CLONED resizer being dragged */ + border: 1px solid #BBB; + } + .ui-layout-resizer-north-dragging, + .ui-layout-resizer-south-dragging { + border-width: 1px 0; + } + .ui-layout-resizer-west-dragging, + .ui-layout-resizer-east-dragging { + border-width: 0 1px; + } + /* NOTE: Add a 'dragging-limit' color to provide visual feedback when resizer hits min/max size limits */ + .ui-layout-resizer-dragging-limit { /* CLONED resizer at min or max size-limit */ + background: #E1A4A4; /* red */ + } + + .ui-layout-resizer-closed-hover { /* hover-color to 'slide open' */ + background: #EBD5AA; + } + .ui-layout-resizer-sliding { /* resizer when pane is 'slid open' */ + opacity: .10; /* show only a slight shadow */ + filter: alpha(opacity=10); + } + .ui-layout-resizer-sliding-hover { /* sliding resizer - hover */ + opacity: 1.00; /* on-hover, show the resizer-bar normally */ + filter: alpha(opacity=100); + } + /* sliding resizer - add 'outside-border' to resizer on-hover + * this sample illustrates how to target specific panes and states */ + .ui-layout-resizer-north-sliding-hover { border-bottom-width: 1px; } + .ui-layout-resizer-south-sliding-hover { border-top-width: 1px; } + .ui-layout-resizer-west-sliding-hover { border-right-width: 1px; } + .ui-layout-resizer-east-sliding-hover { border-left-width: 1px; } + +/* + * TOGGLER-BUTTONS + */ +.ui-layout-toggler { + border: 1px solid #BBB; /* match pane-border */ + background-color: #BBB; + } + .ui-layout-resizer-hover .ui-layout-toggler { + opacity: .60; + filter: alpha(opacity=60); + } + .ui-layout-toggler-hover , /* need when NOT resizable */ + .ui-layout-resizer-hover .ui-layout-toggler-hover { /* need specificity when IS resizable */ + background-color: #FC6; + opacity: 1.00; + filter: alpha(opacity=100); + } + .ui-layout-toggler-north , + .ui-layout-toggler-south { + border-width: 0 1px; /* left/right borders */ + } + .ui-layout-toggler-west , + .ui-layout-toggler-east { + border-width: 1px 0; /* top/bottom borders */ + } + /* hide the toggler-button when the pane is 'slid open' */ + .ui-layout-resizer-sliding .ui-layout-toggler { + display: none; + } + /* + * style the text we put INSIDE the togglers + */ + .ui-layout-toggler .content { + color: #666; + font-size: 12px; + font-weight: bold; + width: 100%; + padding-bottom: 0.35ex; /* to 'vertically center' text inside text-span */ + } + +/* + * PANE-MASKS + * these styles are hard-coded on mask elems, but are also + * included here as !important to ensure will overrides any generic styles + */ +.ui-layout-mask { + border: none !important; + padding: 0 !important; + margin: 0 !important; + overflow: hidden !important; + position: absolute !important; + opacity: 0 !important; + filter: Alpha(Opacity="0") !important; +} +.ui-layout-mask-inside-pane { /* masks always inside pane EXCEPT when pane is an iframe */ + top: 0 !important; + left: 0 !important; + width: 100% !important; + height: 100% !important; +} +div.ui-layout-mask {} /* standard mask for iframes */ +iframe.ui-layout-mask {} /* extra mask for objects/applets */ + +/* + * Default printing styles + */ +@media print { + /* + * Unless you want to print the layout as it appears onscreen, + * these html/body styles are needed to allow the content to 'flow' + */ + html { + height: auto !important; + overflow: visible !important; + } + body.ui-layout-container { + position: static !important; + top: auto !important; + bottom: auto !important; + left: auto !important; + right: auto !important; + /* only IE6 has container width & height set by Layout */ + _width: auto !important; + _height: auto !important; + } + .ui-layout-resizer, .ui-layout-toggler { + display: none !important; + } + /* + * Default pane print styles disables positioning, borders and backgrounds. + * You can modify these styles however it suit your needs. + */ + .ui-layout-pane { + border: none !important; + background: transparent !important; + position: relative !important; + top: auto !important; + bottom: auto !important; + left: auto !important; + right: auto !important; + width: auto !important; + height: auto !important; + overflow: visible !important; + } +} \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/workflows/workflows.css b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/workflows/workflows.css new file mode 100644 index 0000000..b9d0146 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusion/styles/workflows/workflows.css @@ -0,0 +1,50 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +.scrolling-table{ + width: 1200px; +} +.scrolling-table .scroll-viewport { + height: 200px !important; + width: 99.5% !important; + background-color:white; +} + +.scrolling-table .scroll-overview{ + margin-top:-14px !important; +} + +.scrolling-table .scroll-viewport:hover{ + background-color:white; +} + +.scrolling-table #att-scroll-table-content{ + height:200px; + position: absolute !important; + width:700px; + padding-left: 0px; + padding-top: 0px; + padding-bottom: 0px; + padding-right:5px; +} + +.workflow-popup-body{ + position: relative; + padding: 30px; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/drools-list-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/drools-list-controller.js new file mode 100644 index 0000000..4e62434 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/drools-list-controller.js @@ -0,0 +1,62 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller("droolsListController", function ($scope,$http,droolsService, modalService, $modal) { + // Table Data + droolsService.getDrools().then(function(data){ + + var j = data; + $scope.tableData = JSON.parse(j.data); + //$scope.resetMenu(); + + },function(error){ + console.log("failed"); + reloadPageOnce(); + }); + + $scope.viewPerPage = 20; + $scope.scrollViewsPerPage = 2; + $scope.currentPage = 1; + $scope.totalPage; + $scope.searchCategory = ""; + $scope.searchString = ""; + /* modalService.showSuccess('','Modal Sample') ; */ + for(x in $scope.tableData){ + if($scope.tableData[x].active_yn=='Y') + $scope.tableData[x].active_yn=true; + else + $scope.tableData[x].active_yn=false; + } + $scope.openDialog = function(droolFile){ + droolsService.setSelectedFile(droolFile); + $modal.open({ + templateUrl: 'app/fusionapp/drools/view-models/droolsView.html', + controller: 'droolsViewController' + + }) + } + + + +}); + +function openInNewTab(url) { + var win = window.open(url, '_blank'); + win.focus(); +}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/drools-view-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/drools-view-controller.js new file mode 100644 index 0000000..c475e17 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/drools-view-controller.js @@ -0,0 +1,64 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('droolsViewController', function ($scope,modalService,droolsService){ + + + $scope.resultsString = ""; + // Table Data + droolsService.getDroolDetails(droolsService.getSelectedFile()).then(function(data){ + + var j = data; + $scope.postDroolsBean = JSON.parse(j.data); + //execute($scope.postDroolsBean); + + },function(error){ + console.log("failed"); + //reloadPageOnce(); + }); + + + + $scope.execute = function(postDroolsBean) { + console.log(postDroolsBean); + var uuu = "post_drools/execute"; + var postData={postDroolsBean:postDroolsBean}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + $scope.resultsString=data.resultsString; + console.log($scope.resultsString); + }); + }, + error : function(data){ + console.log(data); + modalService.showFailure("Fail","Error while executing: "+ data.responseText); + } + }); + + }; + + + + }); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/droolsController.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/droolsController.js new file mode 100644 index 0000000..f9c0e23 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/droolsController.js @@ -0,0 +1,30 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.config(function($routeProvider) { + $routeProvider + .when('/view', { + templateUrl: 'app/fusionapp/drools/view-models/droolsView.html', + controller : "droolsViewController" + }) + .otherwise({ + templateUrl: 'app/fusionapp/drools/view-models/droolsList.html', + controller : "droolsListController" + }); +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/controller/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/directives/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/directives/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/services/droolsService.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/services/droolsService.js new file mode 100644 index 0000000..d1dbfa6 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/services/droolsService.js @@ -0,0 +1,76 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.factory('droolsService', function ($http, $q) { + return { + getDrools: function() { + return $http.get('getDrools') + .then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject(response.data); + } + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + + getDroolDetails: function(selectedFile) { + return $http.get('getDroolDetails'+'?selectedFile=' + selectedFile ) + .then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject(response.data); + } + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + + getRole: function(roleId) { + + return $http.get('get_role?role_id=' + roleId) + .then(function(response) { + if (typeof response.data === 'object') { + return response.data; + } else { + return $q.reject(response.data); + } + + }, function(response) { + // something went wrong + return $q.reject(response.data); + }); + }, + + getSelectedFile: function() { + return this.selectedFile; + }, + + setSelectedFile: function(_selectedFile) { + this.selectedFile = _selectedFile; + } + }; +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/utils/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/utils/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsList.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsList.html new file mode 100644 index 0000000..ca06b3c --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsList.html @@ -0,0 +1,47 @@ + +
      +
      +

      Drools List

      +
      + + + + + + + + + + + + + + + + + + +
      Drools File NameClass NameRun Rule
      {{rowData.droolsFile}}{{rowData.className}} +
      +
      +
      +
      + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsSinglePage.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsSinglePage.html new file mode 100644 index 0000000..1d4f1bf --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsSinglePage.html @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      +
      +
      +
      +
      + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsView.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsView.html new file mode 100644 index 0000000..dbe9121 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/droolsView.html @@ -0,0 +1,61 @@ + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/drools/view-models/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/external/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/external/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/fonts/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/fonts/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/images/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/images/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sample-page-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sample-page-controller.js new file mode 100644 index 0000000..0ea98a9 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sample-page-controller.js @@ -0,0 +1,80 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('samplePageController', function($scope, $http,ProfileService,modalService){ + $scope.tableData=[]; + $scope.viewPerPage=20; + $scope.scrollViewPerPage=2; + $scope.currentPage=1; + $scope.totalPage; + $scope.searchCategory; + $scope.searchString=""; + $scope.currentPageNum=1; + ProfileService.getProfilePagination(1,$scope.viewPerPage).then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.tableData =JSON.parse($scope.data.profileList); + $scope.totalPages =JSON.parse($scope.data.totalPage); + for(x in $scope.tableData){ + if($scope.tableData[x].active_yn=='Y') + $scope.tableData[x].active_yn=true; + else + $scope.tableData[x].active_yn=false; + } + //$scope.resetMenu(); + },function(error){ + console.log("failed"); + reloadPageOnce(); + }); + + $scope.$watch('currentPageNum', function(val) { + + ProfileService.getProfilePagination(val,$scope.viewPerPage).then(function(data){ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.tableData =JSON.parse($scope.data.profileList); + $scope.totalPages =JSON.parse($scope.data.totalPage); + for(x in $scope.tableData){ + if($scope.tableData[x].active_yn=='Y') + $scope.tableData[x].active_yn=true; + else + $scope.tableData[x].active_yn=false; + } + //$scope.resetMenu(); + },function(error){ + console.log("failed"); + }); + + }); + + $scope.editRow = function(profileId){ + window.location = 'userProfile#/profile/' + profileId; + } + + $scope.toggleProfileActive = function(rowData) { + modalService.popupConfirmWinWithCancel("Confirm","You are about to change user's active status. Do you want to continue?", + function(){ + $http.get("profile/toggleProfileActive?profile_id="+rowData.id).success(function(){}); + }, + function(){ + rowData.active=!rowData.active; + }) + }; + +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sample-page-iframe-controller.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sample-page-iframe-controller.js new file mode 100644 index 0000000..4ff99cb --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sample-page-iframe-controller.js @@ -0,0 +1,23 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.controller('samplePageWithIframeController', function($scope, $http,ProfileService,modalService){ + + +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sampleController.js b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sampleController.js new file mode 100644 index 0000000..3d3daf5 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/controller/sampleController.js @@ -0,0 +1,30 @@ +/*- + * ================================================================================ + * eCOMP Portal SDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +app.config(function($routeProvider) { + $routeProvider + .when('/iframe', { + templateUrl: 'app/fusionapp/scripts/view-models/sampleWithIframe.html', + controller : "samplePageWithIframeController" + }) + .otherwise({ + templateUrl: 'app/fusionapp/scripts/view-models/sample.html', + controller : "samplePageController" + }); +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/directives/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/directives/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/utils/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/utils/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/sample.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/sample.html new file mode 100644 index 0000000..5b555aa --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/sample.html @@ -0,0 +1,60 @@ + +
      + +

      Profile Search

      + + + + + + + + + + + + + + + + + + + + + + + +
      User IDLast NameFirst NameEmailUser IDManager User ID
      + +
      + Rows Per Page: + +
      +
      + Current Page: + +
      +
      + Total Page(s): + +
      +
      diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/sampleWithIframe.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/sampleWithIframe.html new file mode 100644 index 0000000..612e6a8 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/sampleWithIframe.html @@ -0,0 +1,22 @@ + +
      + +
      diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/singlePageSample.html b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/singlePageSample.html new file mode 100644 index 0000000..7bded9d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/scripts/view-models/singlePageSample.html @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      +
      +
      +
      +
      + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/styles/dummy.txt b/ecomp-sdk/sdk-app/src/main/webapp/app/fusionapp/styles/dummy.txt new file mode 100644 index 0000000..e69de29 diff --git a/ecomp-sdk/sdk-app/src/main/webapp/index.jsp b/ecomp-sdk/sdk-app/src/main/webapp/index.jsp new file mode 100644 index 0000000..f6030c9 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/index.jsp @@ -0,0 +1,24 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + +<%-- Redirected because we can't set the welcome page to a virtual URL. --%> +<%-- Forward to the intended start page to reduce frustration for new users. --%> + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/manifest.jsp b/ecomp-sdk/sdk-app/src/main/webapp/manifest.jsp new file mode 100644 index 0000000..b7345ad --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/manifest.jsp @@ -0,0 +1,47 @@ +<%-- + ================================================================================ + eCOMP Portal SDK + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --%> +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<% + // Read contents of maven-generated manifest file. + final String path = "/META-INF/MANIFEST.MF"; + java.io.InputStream input = getServletContext().getResourceAsStream(path); + java.io.InputStreamReader reader = new java.io.InputStreamReader(input, "UTF-8"); + char [] buf = new char[1024]; + int length = reader.read(buf, 0, buf.length); + final String manifest = new String(buf, 0, length); + reader.close(); + input.close(); +%> + + + + +Manifest + + +

      +Contents of file <%= path %>: +

      +
      +<%= manifest %>
      +
      + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/att_angular_gridster/sandbox-gridster.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/att_angular_gridster/sandbox-gridster.css new file mode 100644 index 0000000..a9edba8 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/att_angular_gridster/sandbox-gridster.css @@ -0,0 +1,173 @@ +.gridster { + position: relative; + margin: auto; + /* height: 0 + */} + +.gridster>ul { + margin: 0; + list-style: none; + padding: 0 +} + +.gridster-item { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + list-style: none; + z-index: 2; + position: absolute; + display: none +} + +.gridster-loaded { + -webkit-transition: height .3s; + -moz-transition: height .3s; + -o-transition: height .3s; + transition: height .3s +} + +.gridster-loaded .gridster-item { + display: block; + position: absolute; + -webkit-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s; + -moz-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s; + -o-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s; + transition: opacity .3s, left .3s, top .3s, width .3s, height .3s; + -webkit-transition-delay: 50ms; + -moz-transition-delay: 50ms; + -o-transition-delay: 50ms; + transition-delay: 50ms +} + +.gridster-loaded .gridster-preview-holder { + display: none; + z-index: 1; + position: absolute; + background-color: #067ab4; + /* + background-color: rgb(6, 122, 180); + -ms-filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#067ab4', endColorstr='#067ab4'); IE + opacity: 0.2; + */ + border-color: #fff; + -webkit-transition: width .2s, height .3s; + -moz-transition: width .2s, height .3s; + -o-transition: width .2s, height .3s; + transition: width .2s, height .3s; + -webkit-transition-delay: 50ms; + -moz-transition-delay: 50ms; + -o-transition-delay: 50ms; + transition-delay: 50ms +} + +.gridster-loaded .gridster-item.gridster-item-moving { + -webkit-transition: none; + -moz-transition: none; + -o-transition: none; + transition: none; + opacity: 0.9; +} + +.gridster-mobile { + height: auto !important +} + +.gridster-mobile .gridster-item { + height: auto; + position: static; + float: none +} + +.gridster-item.ng-leave.ng-leave-active { + opacity: 0 +} + +.gridster-item.ng-enter { + opacity: 1 +} + +.gridster-item-moving { + z-index: 3 +} + +.gridster-item-resizable-handler { + position: absolute; + font-size: 1px; + display: block +} + +.handle-se { + cursor: se-resize; + width: 0; + height: 0; + right: 1px; + bottom: 1px; + border-style: solid; + border-width: 0 0 12px 12px; + border-color: transparent +} + +.handle-ne { + cursor: ne-resize; + width: 12px; + height: 12px; + right: 1px; + top: 1px +} + +.handle-nw { + cursor: nw-resize; + width: 12px; + height: 12px; + left: 1px; + top: 1px +} + +.handle-sw { + cursor: sw-resize; + width: 12px; + height: 12px; + left: 1px; + bottom: 1px +} + +.handle-e { + cursor: e-resize; + width: 12px; + bottom: 0; + right: 1px; + top: 0 +} + +.handle-s { + cursor: s-resize; + height: 12px; + right: 0; + bottom: 1px; + left: 0 +} + +.handle-n { + cursor: n-resize; + height: 12px; + right: 0; + top: 1px; + left: 0 +} + +.handle-w { + cursor: w-resize; + width: 12px; + left: 1px; + top: 0; + bottom: 0 +} + +.gridster .gridster-item:hover .gridster-box { + border: 1.5px solid #B3B2B3 +} + +.gridster .gridster-item:hover .handle-se { + border-color: transparent transparent #ccc +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/att_angular_gridster/ui-gridster.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/att_angular_gridster/ui-gridster.css new file mode 100644 index 0000000..827e354 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/att_angular_gridster/ui-gridster.css @@ -0,0 +1,116 @@ +/* ui-gridster.css */ +.gridster-container { + background-color: #EFEFEF; + color: #fff; + border: 1px dashed; + overflow-y: auto; + overflow-x: hidden; } + +/* app css for attGridtser */ +.gridster-item-container { + background-color: #FFFFFF; + position: relative; + margin-left: auto; + margin-right: auto; + min-height: 79px; + height: 100%; } + .gridster-item-container .gridster-item-header { + /* gridster-item Header */ + position: relative; + height: 50px !important; + border: 1px solid #d3d3d3; + border-bottom: 0; + background-color: #E5E5E5; + white-space: nowrap; + text-overflow: ellipsis; + z-index: 1; + -webkit-border-radius: 2px 2px 0 0; + -moz-border-radius: 2px 2px 0 0; + -ms-border-radius: 2px 2px 0 0; + -o-border-radius: 2px 2px 0 0; + border-radius: 2px 2px 0 0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + /* IE6-8 */ } + .gridster-item-container .gridster-item-header .gridster-item-handle { + cursor: move; + margin: 12px; + position: absolute; + top: 0; + left: 0; + border: 0; + vertical-align: middle; + -ms-interpolation-mode: bicubic; + display: block; } + .gridster-item-container .gridster-item-header .gridster-item-header-content { + line-height: 44px; + margin-left: 26px; + font-family: clearviewatt; + font-size: 18px; + color: #444444; + float: left; } + .gridster-item-container .gridster-item-header .gridster-item-sub-header-content { + position: absolute; + top: 29.5px; + left: 26px; + font-family: clearviewatt; + font-size: 12px; + color: #444444; } + .gridster-item-container .gridster-item-header .gridster-item-header-buttons-container { + position: absolute; + right: 10px; + top: 10px; + overflow: hidden; + text-align: right; + height: 30px; + color: #444444; } + .gridster-item-container .gridster-item-body { + /* gridster-item Body */ + position: absolute; + width: 100%; + top: 50px; + left: 0; + right: 0; + bottom: 29px; + border: 1px solid #d3d3d3; + box-sizing: border-box; + overflow: auto; + color: #444444; + /* text-align: center; */ } + .gridster-item-container .gridster-item-footer { + /* gridster-item Footer */ + position: absolute; + bottom: 0; + width: 100%; + height: 29px !important; + text-align: left; + cursor: pointer; + border: 1px solid #d3d3d3; + border-top: 0; + background-color: #F2F2F2; + -webkit-border-radius: 0 0 2px 2px; + -moz-border-radius: 0 0 2px 2px; + -ms-border-radius: 0 0 2px 2px; + -o-border-radius: 0 0 2px 2px; + border-radius: 0 0 2px 2px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + text-decoration: none; + /* IE6-8 */ } + .gridster-item-container .gridster-item-footer:hover { + background-color: #E5E5E5; + color: #565656; + text-decoration: underline; } + .gridster-item-container .gridster-item-footer .gridster-item-footer-content { + line-height: 30px; + font-family: clearviewatt; + font-size: 12px; + color: #565656; + margin: 20px; + text-decoration: none; } + .gridster-item-container .gridster-item-footer .gridster-item-footer-content:hover { + color: #199ddf; + text-decoration: underline; } diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/fusion-sunny.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/fusion-sunny.css new file mode 100644 index 0000000..c830615 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/fusion-sunny.css @@ -0,0 +1,362 @@ + input, textarea, select, div { + font-family: Arial; + font-size: 11px; + font-weight: normal; + } + + form { + margin-top: 5px; + } + + + .applicationWindow { border-width: 0px 0px 1px 0px; + border-style: solid; + border-color: #959595; + box-shadow: inset 0 0 10px #000000; + margin-top: 10px; + margin-bottom: 10px; + margin-left: 10px; + margin-right: 10px; + } + + .feedbackMessage { width: 99%; + font-family: Arial; + font-size: 11px; + color: #1f1f1f; + padding: 3px; + border: 1px #eeb420 solid; + margin: 3px; + background: #fff9e5; + } + + .menubar { + border-width: 0px 0px 0px 1px; border-style: solid; border-color: #959595; + } + + .footer { + /*clear: both;*/ + border-width: 0px 1px 0px 1px; border-style: solid; border-color: #959595; + font-family: Verdana,Arial,Helvetica, sans-serif; + font-size: 9px; + padding: 10px 10px 30px 10px; + background: white; + } + + .pageTitle { + font-family: Arial; + font-size: 18px; + font-weight: bold; + margin-top: 5px; + } + + .content { + border-width: 0px 1px 0px 1px; + border-style: solid; + border-color: #959595; + font-family: Arial; + font-size: 11px; + padding: 5px; + background: white; + /*height: 600px;*/ + } + + .popupContent { + font-family: Arial; + font-size: 11px; + padding: 3px; + } + + .logo { + border-width: 0px 1px 0px 1px; + border-style: solid; + border-color: #959595; + text-align: right; + } + + .sep { + border: 1px solid black + } + + .attLogo { /*position: relative;*/ + float:left; + padding-top: 25px; + padding-left: 25px; + } + + .applicationLogo { float:right; + padding-top: 25px; + padding-right: 25px; + } + + .applinkWhite { font-family: Arial; + font-size: 13px; + font-weight: 900; + color: #FFFFFF; + text-decoration: none; } + + .terms { font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 9px; + } + + .broadcastMessage { color: red; } + .broadcastMessageList { color: red; } + + .button { + margin: 5px 1px 5px 1px; + padding: 3px; } + + .toolbarbutton:hover { + color:#005491; + } + + .headerText { font-family: Arial; + font-size: 15px; + font-weight: 700; + color: #000000; } + + .headerBackground { background: #336699; } + + .errorMessageText { font-family: Arial; + font-size: 11px; + font-weight: bold; + color: red; } + + + .normalText { font-family: Arial; + font-size: 11px; + color: #000000; } + + .normalTextRed { font-family: Arial; + font-size: 11px; + color: red; } + + + .smallNormalText { font-family: Arial; + font-size: 9px; + color: #000000; } + + .tableBorder { border:1px outset teal } + + .validationError { background: #b9eaff; } + + .templatebody { + background: url(../images/body_graphic.jpg) repeat-x; + /*margin: 40px 80px 40px 80px;*/ + } + + /*--------------------- General Content ------------------------------------*/ + + .relative { + position:relative; + } + + .clear{ + clear:both; + } + + .left { + float: left; + } + + .leftCentered{ + float: left; + text-align: center; + } + + .right { + float: right; + } + + .rightAligned{ + text-align: right; + } + + .centered { + text-align: center; + align: center; + } + + + .noWrap{ + white-space:nowrap; + } + + .disabled { + color:gray; + cursor:hand; + } + + /*--------------------- Tab styles -------------------------------------*/ + + .current { + font-weight: bold; + border-width: 1px 1px 1px 1px; + border-color: silver; + border-style: solid; + } + + .subTab { + font-weight:bold; + font-family: Arial; + font-size: 11px; + color: #0F3B82; + } + + + /*--------------------- Grid styles ------------------------------------*/ + + /* Grid navigation and header styles */ + .gridFilterLabel {font-size: 7pt; + font-align: justify; + font-weight: bold; + display: block;} + + .gridFilterText {height: 17px; + font-size: 8pt; + width: 60%; + font-align: justify;} + + .gridNavigationBar { font-family:Arial,Verdana; + font-size:11px; + font-weight:normal; + color:#000; + margin: 0px; + width: 100%; + vertical-align: middle; + } + + .gridNavigationBar .navLinks { float: left; + margin-right:15px; + padding-top: 2px; + height: 19px; + line-height: 19px; + } + + .gridNavigationBar .pageControls { float: left; + margin-right: 15px; + height: 19px; + line-height: 19px; + } + + .gridNavigationBar .pageControls input { font-size: 8pt; + height: 17px; + vertical-align: middle; + } + + .gridNavigationBar .pageInfo { float: right; + vertical-align: middle; + height: 19px; + line-height: 19px; + } + + .gridNavigationBar .pageInfo input { font-size: 8pt; + height: 17px; + vertical-align: middle; + } + + + .gridNavigationBar span { padding: 3px; } + + .gridNavigationBar a { + text-decoration:underline; + color:#000; + font-weight:normal; + } + + .gridNavigationBar img { vertical-align: middle; } + + .gridBulkUpdateRow { + height: 35px; + line-height: 35px; + } + + .gridBulkUpdateRow input { + vertical-align: middle; + } + + + /* dummy class used to lock the form elements of a grid - ex. bulk transaction processing */ + .alwaysEnabled {} + + .hidden { + display: none; + } + + .selectedPage { + background-color:#C4DFFB; + color: white; + border-style: solid; + border-width: 1px; + border-color: gray; + padding-left: 3px; + padding-right: 3px; + vertical-align: middle; + } + + .selectedRow{ + /*background-color:#C4DFFB;*/ + } + + /* Action Item styles */ + .actionList { + margin-left: -20px; + margin-right: -10px; + padding-left: 5px; + } + + .actionList li { + float:left; + padding-left: 3px; + padding-right: 3px; + } + + .actionList li a { + text-decoration:none; + color:#000; + } + + /* Filter Operator List styles */ + + .filterList { + margin: 0px; + } + + .filterList li { + list-style-type: none; + padding:3px 3px 3px 2px; + cursor:hand; + font-size:11px; + } + + .filterList li:hover { + background: #404040; + } + + .filterList li a { + color: #000; + text-decoration: none; + } + + .filterList li:hover a { + color: white; + } + + .filterList li a:hover { + text-decoration: none; + color: white; + } + + .filterListItem a { + text-decoration:none; + padding:3px 2px 3px 2px; + } + + + /*---------------------- Customized ZK Styles ------------------------------*/ + + .z-datebox input, .z-timebox input { + font-family: Arial; + font-size: 11px; + height: 15px; + margin-top:1px; + } diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/jquery-ui.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/jquery-ui.css new file mode 100644 index 0000000..1c22746 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/jquery-ui.css @@ -0,0 +1,1225 @@ +/*! jQuery UI - v1.11.4 - 2015-03-11 +* http://jqueryui.com +* Includes: core.css, accordion.css, autocomplete.css, button.css, datepicker.css, dialog.css, draggable.css, menu.css, progressbar.css, resizable.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css +* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px +* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { + display: none; +} +.ui-helper-hidden-accessible { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; +} +.ui-helper-reset { + margin: 0; + padding: 0; + border: 0; + outline: 0; + line-height: 1.3; + text-decoration: none; + font-size: 100%; + list-style: none; +} +.ui-helper-clearfix:before, +.ui-helper-clearfix:after { + content: ""; + display: table; + border-collapse: collapse; +} +.ui-helper-clearfix:after { + clear: both; +} +.ui-helper-clearfix { + min-height: 0; /* support: IE7 */ +} +.ui-helper-zfix { + width: 100%; + height: 100%; + top: 0; + left: 0; + position: absolute; + opacity: 0; + filter:Alpha(Opacity=0); /* support: IE8 */ +} + +.ui-front { + z-index: 100; +} + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { + cursor: default !important; +} + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { + display: block; + text-indent: -99999px; + overflow: hidden; + background-repeat: no-repeat; +} + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; +} +.ui-accordion .ui-accordion-header { + display: block; + cursor: pointer; + position: relative; + margin: 2px 0 0 0; + padding: .5em .5em .5em .7em; + min-height: 0; /* support: IE7 */ + font-size: 100%; +} +.ui-accordion .ui-accordion-icons { + padding-left: 2.2em; +} +.ui-accordion .ui-accordion-icons .ui-accordion-icons { + padding-left: 2.2em; +} +.ui-accordion .ui-accordion-header .ui-accordion-header-icon { + position: absolute; + left: .5em; + top: 50%; + margin-top: -8px; +} +.ui-accordion .ui-accordion-content { + padding: 1em 2.2em; + border-top: 0; + overflow: auto; +} +.ui-autocomplete { + position: absolute; + top: 0; + left: 0; + cursor: default; +} +.ui-button { + display: inline-block; + position: relative; + padding: 0; + line-height: normal; + margin-right: .1em; + cursor: pointer; + vertical-align: middle; + text-align: center; + overflow: visible; /* removes extra width in IE */ +} +.ui-button, +.ui-button:link, +.ui-button:visited, +.ui-button:hover, +.ui-button:active { + text-decoration: none; +} +/* to make room for the icon, a width needs to be set here */ +.ui-button-icon-only { + width: 2.2em; +} +/* button elements seem to need a little more width */ +button.ui-button-icon-only { + width: 2.4em; +} +.ui-button-icons-only { + width: 3.4em; +} +button.ui-button-icons-only { + width: 3.7em; +} + +/* button text element */ +.ui-button .ui-button-text { + display: block; + line-height: normal; +} +.ui-button-text-only .ui-button-text { + padding: .4em 1em; +} +.ui-button-icon-only .ui-button-text, +.ui-button-icons-only .ui-button-text { + padding: .4em; + text-indent: -9999999px; +} +.ui-button-text-icon-primary .ui-button-text, +.ui-button-text-icons .ui-button-text { + padding: .4em 1em .4em 2.1em; +} +.ui-button-text-icon-secondary .ui-button-text, +.ui-button-text-icons .ui-button-text { + padding: .4em 2.1em .4em 1em; +} +.ui-button-text-icons .ui-button-text { + padding-left: 2.1em; + padding-right: 2.1em; +} +/* no icon support for input elements, provide padding by default */ +input.ui-button { + padding: .4em 1em; +} + +/* button icon element(s) */ +.ui-button-icon-only .ui-icon, +.ui-button-text-icon-primary .ui-icon, +.ui-button-text-icon-secondary .ui-icon, +.ui-button-text-icons .ui-icon, +.ui-button-icons-only .ui-icon { + position: absolute; + top: 50%; + margin-top: -8px; +} +.ui-button-icon-only .ui-icon { + left: 50%; + margin-left: -8px; +} +.ui-button-text-icon-primary .ui-button-icon-primary, +.ui-button-text-icons .ui-button-icon-primary, +.ui-button-icons-only .ui-button-icon-primary { + left: .5em; +} +.ui-button-text-icon-secondary .ui-button-icon-secondary, +.ui-button-text-icons .ui-button-icon-secondary, +.ui-button-icons-only .ui-button-icon-secondary { + right: .5em; +} + +/* button sets */ +.ui-buttonset { + margin-right: 7px; +} +.ui-buttonset .ui-button { + margin-left: 0; + margin-right: -.3em; +} + +/* workarounds */ +/* reset extra padding in Firefox, see h5bp.com/l */ +input.ui-button::-moz-focus-inner, +button.ui-button::-moz-focus-inner { + border: 0; + padding: 0; +} +.ui-datepicker { + width: 17em; + padding: .2em .2em 0; + display: none; +} +.ui-datepicker .ui-datepicker-header { + position: relative; + padding: .2em 0; +} +.ui-datepicker .ui-datepicker-prev, +.ui-datepicker .ui-datepicker-next { + position: absolute; + top: 2px; + width: 1.8em; + height: 1.8em; +} +.ui-datepicker .ui-datepicker-prev-hover, +.ui-datepicker .ui-datepicker-next-hover { + top: 1px; +} +.ui-datepicker .ui-datepicker-prev { + left: 2px; +} +.ui-datepicker .ui-datepicker-next { + right: 2px; +} +.ui-datepicker .ui-datepicker-prev-hover { + left: 1px; +} +.ui-datepicker .ui-datepicker-next-hover { + right: 1px; +} +.ui-datepicker .ui-datepicker-prev span, +.ui-datepicker .ui-datepicker-next span { + display: block; + position: absolute; + left: 50%; + margin-left: -8px; + top: 50%; + margin-top: -8px; +} +.ui-datepicker .ui-datepicker-title { + margin: 0 2.3em; + line-height: 1.8em; + text-align: center; +} +.ui-datepicker .ui-datepicker-title select { + font-size: 1em; + margin: 1px 0; +} +.ui-datepicker select.ui-datepicker-month, +.ui-datepicker select.ui-datepicker-year { + width: 45%; +} +.ui-datepicker table { + width: 100%; + font-size: .9em; + border-collapse: collapse; + margin: 0 0 .4em; +} +.ui-datepicker th { + padding: .7em .3em; + text-align: center; + font-weight: bold; + border: 0; +} +.ui-datepicker td { + border: 0; + padding: 1px; +} +.ui-datepicker td span, +.ui-datepicker td a { + display: block; + padding: .2em; + text-align: right; + text-decoration: none; +} +.ui-datepicker .ui-datepicker-buttonpane { + background-image: none; + margin: .7em 0 0 0; + padding: 0 .2em; + border-left: 0; + border-right: 0; + border-bottom: 0; +} +.ui-datepicker .ui-datepicker-buttonpane button { + float: right; + margin: .5em .2em .4em; + cursor: pointer; + padding: .2em .6em .3em .6em; + width: auto; + overflow: visible; +} +.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { + float: left; +} + +/* with multiple calendars */ +.ui-datepicker.ui-datepicker-multi { + width: auto; +} +.ui-datepicker-multi .ui-datepicker-group { + float: left; +} +.ui-datepicker-multi .ui-datepicker-group table { + width: 95%; + margin: 0 auto .4em; +} +.ui-datepicker-multi-2 .ui-datepicker-group { + width: 50%; +} +.ui-datepicker-multi-3 .ui-datepicker-group { + width: 33.3%; +} +.ui-datepicker-multi-4 .ui-datepicker-group { + width: 25%; +} +.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header, +.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { + border-left-width: 0; +} +.ui-datepicker-multi .ui-datepicker-buttonpane { + clear: left; +} +.ui-datepicker-row-break { + clear: both; + width: 100%; + font-size: 0; +} + +/* RTL support */ +.ui-datepicker-rtl { + direction: rtl; +} +.ui-datepicker-rtl .ui-datepicker-prev { + right: 2px; + left: auto; +} +.ui-datepicker-rtl .ui-datepicker-next { + left: 2px; + right: auto; +} +.ui-datepicker-rtl .ui-datepicker-prev:hover { + right: 1px; + left: auto; +} +.ui-datepicker-rtl .ui-datepicker-next:hover { + left: 1px; + right: auto; +} +.ui-datepicker-rtl .ui-datepicker-buttonpane { + clear: right; +} +.ui-datepicker-rtl .ui-datepicker-buttonpane button { + float: left; +} +.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current, +.ui-datepicker-rtl .ui-datepicker-group { + float: right; +} +.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header, +.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { + border-right-width: 0; + border-left-width: 1px; +} +.ui-dialog { + overflow: hidden; + position: absolute; + top: 0; + left: 0; + padding: .2em; + outline: 0; +} +.ui-dialog .ui-dialog-titlebar { + padding: .4em 1em; + position: relative; +} +.ui-dialog .ui-dialog-title { + float: left; + margin: .1em 0; + white-space: nowrap; + width: 90%; + overflow: hidden; + text-overflow: ellipsis; +} +.ui-dialog .ui-dialog-titlebar-close { + position: absolute; + right: .3em; + top: 50%; + width: 20px; + margin: -10px 0 0 0; + padding: 1px; + height: 20px; +} +.ui-dialog .ui-dialog-content { + position: relative; + border: 0; + padding: .5em 1em; + background: none; + overflow: auto; +} +.ui-dialog .ui-dialog-buttonpane { + text-align: left; + border-width: 1px 0 0 0; + background-image: none; + margin-top: .5em; + padding: .3em 1em .5em .4em; +} +.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { + float: right; +} +.ui-dialog .ui-dialog-buttonpane button { + margin: .5em .4em .5em 0; + cursor: pointer; +} +.ui-dialog .ui-resizable-se { + width: 12px; + height: 12px; + right: -5px; + bottom: -5px; + background-position: 16px 16px; +} +.ui-draggable .ui-dialog-titlebar { + cursor: move; +} +.ui-draggable-handle { + -ms-touch-action: none; + touch-action: none; +} +.ui-menu { + list-style: none; + padding: 0; + margin: 0; + display: block; + outline: none; +} +.ui-menu .ui-menu { + position: absolute; +} +.ui-menu .ui-menu-item { + position: relative; + margin: 0; + padding: 3px 1em 3px .4em; + cursor: pointer; + min-height: 0; /* support: IE7 */ + /* support: IE10, see #8844 */ + list-style-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"); +} +.ui-menu .ui-menu-divider { + margin: 5px 0; + height: 0; + font-size: 0; + line-height: 0; + border-width: 1px 0 0 0; +} +.ui-menu .ui-state-focus, +.ui-menu .ui-state-active { + margin: -1px; +} + +/* icon support */ +.ui-menu-icons { + position: relative; +} +.ui-menu-icons .ui-menu-item { + padding-left: 2em; +} + +/* left-aligned */ +.ui-menu .ui-icon { + position: absolute; + top: 0; + bottom: 0; + left: .2em; + margin: auto 0; +} + +/* right-aligned */ +.ui-menu .ui-menu-icon { + left: auto; + right: 0; +} +.ui-progressbar { + height: 2em; + text-align: left; + overflow: hidden; +} +.ui-progressbar .ui-progressbar-value { + margin: -1px; + height: 100%; +} +.ui-progressbar .ui-progressbar-overlay { + background: url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6W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2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw=="); + height: 100%; + filter: alpha(opacity=25); /* support: IE8 */ + opacity: 0.25; +} +.ui-progressbar-indeterminate .ui-progressbar-value { + background-image: none; +} +.ui-resizable { + position: relative; +} +.ui-resizable-handle { + position: absolute; + font-size: 0.1px; + display: block; + -ms-touch-action: none; + touch-action: none; +} +.ui-resizable-disabled .ui-resizable-handle, +.ui-resizable-autohide .ui-resizable-handle { + display: none; +} +.ui-resizable-n { + cursor: n-resize; + height: 7px; + width: 100%; + top: -5px; + left: 0; +} +.ui-resizable-s { + cursor: s-resize; + height: 7px; + width: 100%; + bottom: -5px; + left: 0; +} +.ui-resizable-e { + cursor: e-resize; + width: 7px; + right: -5px; + top: 0; + height: 100%; +} +.ui-resizable-w { + cursor: w-resize; + width: 7px; + left: -5px; + top: 0; + height: 100%; +} +.ui-resizable-se { + cursor: se-resize; + width: 12px; + height: 12px; + right: 1px; + bottom: 1px; +} +.ui-resizable-sw { + cursor: sw-resize; + width: 9px; + height: 9px; + left: -5px; + bottom: -5px; +} +.ui-resizable-nw { + cursor: nw-resize; + width: 9px; + height: 9px; + left: -5px; + top: -5px; +} +.ui-resizable-ne { + cursor: ne-resize; + width: 9px; + height: 9px; + right: -5px; + top: -5px; +} +.ui-selectable { + -ms-touch-action: none; + touch-action: none; +} +.ui-selectable-helper { + position: absolute; + z-index: 100; + border: 1px dotted black; +} +.ui-selectmenu-menu { + padding: 0; + margin: 0; + position: absolute; + top: 0; + left: 0; + display: none; +} +.ui-selectmenu-menu .ui-menu { + overflow: auto; + /* Support: IE7 */ + overflow-x: hidden; + padding-bottom: 1px; +} +.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup { + font-size: 1em; + font-weight: bold; + line-height: 1.5; + padding: 2px 0.4em; + margin: 0.5em 0 0 0; + height: auto; + border: 0; +} +.ui-selectmenu-open { + display: block; +} +.ui-selectmenu-button { + display: inline-block; + overflow: hidden; + position: relative; + text-decoration: none; + cursor: pointer; +} +.ui-selectmenu-button span.ui-icon { + right: 0.5em; + left: auto; + margin-top: -8px; + position: absolute; + top: 50%; +} +.ui-selectmenu-button span.ui-selectmenu-text { + text-align: left; + padding: 0.4em 2.1em 0.4em 1em; + display: block; + line-height: 1.4; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.ui-slider { + position: relative; + text-align: left; +} +.ui-slider .ui-slider-handle { + position: absolute; + z-index: 2; + width: 1.2em; + height: 1.2em; + cursor: default; + -ms-touch-action: none; + touch-action: none; +} +.ui-slider .ui-slider-range { + position: absolute; + z-index: 1; + font-size: .7em; + display: block; + border: 0; + background-position: 0 0; +} + +/* support: IE8 - See #6727 */ +.ui-slider.ui-state-disabled .ui-slider-handle, +.ui-slider.ui-state-disabled .ui-slider-range { + filter: inherit; +} + +.ui-slider-horizontal { + height: .8em; +} +.ui-slider-horizontal .ui-slider-handle { + top: -.3em; + margin-left: -.6em; +} +.ui-slider-horizontal .ui-slider-range { + top: 0; + height: 100%; +} +.ui-slider-horizontal .ui-slider-range-min { + left: 0; +} +.ui-slider-horizontal .ui-slider-range-max { + right: 0; +} + +.ui-slider-vertical { + width: .8em; + height: 100px; +} +.ui-slider-vertical .ui-slider-handle { + left: -.3em; + margin-left: 0; + margin-bottom: -.6em; +} +.ui-slider-vertical .ui-slider-range { + left: 0; + width: 100%; +} +.ui-slider-vertical .ui-slider-range-min { + bottom: 0; +} +.ui-slider-vertical .ui-slider-range-max { + top: 0; +} +.ui-sortable-handle { + -ms-touch-action: none; + touch-action: none; +} +.ui-spinner { + position: relative; + display: inline-block; + overflow: hidden; + padding: 0; + vertical-align: middle; +} +.ui-spinner-input { + border: none; + background: none; + color: inherit; + padding: 0; + margin: .2em 0; + vertical-align: middle; + margin-left: .4em; + margin-right: 22px; +} +.ui-spinner-button { + width: 16px; + height: 50%; + font-size: .5em; + padding: 0; + margin: 0; + text-align: center; + position: absolute; + cursor: default; + display: block; + overflow: hidden; + right: 0; +} +/* more specificity required here to override default borders */ +.ui-spinner a.ui-spinner-button { + border-top: none; + border-bottom: none; + border-right: none; +} +/* vertically center icon */ +.ui-spinner .ui-icon { + position: absolute; + margin-top: -8px; + top: 50%; + left: 0; +} +.ui-spinner-up { + top: 0; +} +.ui-spinner-down { + bottom: 0; +} + +/* TR overrides */ +.ui-spinner .ui-icon-triangle-1-s { + /* need to fix icons sprite */ + background-position: -65px -16px; +} +.ui-tabs { + position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ + padding: .2em; +} +.ui-tabs .ui-tabs-nav { + margin: 0; + padding: .2em .2em 0; +} +.ui-tabs .ui-tabs-nav li { + list-style: none; + float: left; + position: relative; + top: 0; + margin: 1px .2em 0 0; + border-bottom-width: 0; + padding: 0; + white-space: nowrap; +} +.ui-tabs .ui-tabs-nav .ui-tabs-anchor { + float: left; + padding: .5em 1em; + text-decoration: none; +} +.ui-tabs .ui-tabs-nav li.ui-tabs-active { + margin-bottom: -1px; + padding-bottom: 1px; +} +.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor, +.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor, +.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor { + cursor: text; +} +.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor { + cursor: pointer; +} +.ui-tabs .ui-tabs-panel { + display: block; + border-width: 0; + padding: 1em 1.4em; + background: none; +} +.ui-tooltip { + padding: 8px; + position: absolute; + z-index: 9999; + max-width: 300px; + -webkit-box-shadow: 0 0 5px #aaa; + box-shadow: 0 0 5px #aaa; +} +body .ui-tooltip { + border-width: 2px; +} + +/* Component containers +----------------------------------*/ +.ui-widget { + font-family: Verdana,Arial,sans-serif; + font-size: 1.1em; +} +.ui-widget .ui-widget { + font-size: 1em; +} +.ui-widget input, +.ui-widget select, +.ui-widget textarea, +.ui-widget button { + font-family: Verdana,Arial,sans-serif; + font-size: 1em; +} +.ui-widget-content { + border: 1px solid #aaaaaa; + background: #ffffff url("images/ui-bg_flat_75_ffffff_40x100.png") 50% 50% repeat-x; + color: #222222; +} +.ui-widget-content a { + color: #222222; +} +.ui-widget-header { + border: 1px solid #aaaaaa; + background: #cccccc url("images/ui-bg_highlight-soft_75_cccccc_1x100.png") 50% 50% repeat-x; + color: #222222; + font-weight: bold; +} +.ui-widget-header a { + color: #222222; +} + +/* Interaction states +----------------------------------*/ +.ui-state-default, +.ui-widget-content .ui-state-default, +.ui-widget-header .ui-state-default { + border: 1px solid #d3d3d3; + background: #e6e6e6 url("images/ui-bg_glass_75_e6e6e6_1x400.png") 50% 50% repeat-x; + font-weight: normal; + color: #555555; +} +.ui-state-default a, +.ui-state-default a:link, +.ui-state-default a:visited { + color: #555555; + text-decoration: none; +} +.ui-state-hover, +.ui-widget-content .ui-state-hover, +.ui-widget-header .ui-state-hover, +.ui-state-focus, +.ui-widget-content .ui-state-focus, +.ui-widget-header .ui-state-focus { + border: 1px solid #999999; + background: #dadada url("images/ui-bg_glass_75_dadada_1x400.png") 50% 50% repeat-x; + font-weight: normal; + color: #212121; +} +.ui-state-hover a, +.ui-state-hover a:hover, +.ui-state-hover a:link, +.ui-state-hover a:visited, +.ui-state-focus a, +.ui-state-focus a:hover, +.ui-state-focus a:link, +.ui-state-focus a:visited { + color: #212121; + text-decoration: none; +} +.ui-state-active, +.ui-widget-content .ui-state-active, +.ui-widget-header .ui-state-active { + border: 1px solid #aaaaaa; + background: #ffffff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x; + font-weight: normal; + color: #212121; +} +.ui-state-active a, +.ui-state-active a:link, +.ui-state-active a:visited { + color: #212121; + text-decoration: none; +} + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, +.ui-widget-content .ui-state-highlight, +.ui-widget-header .ui-state-highlight { + border: 1px solid #fcefa1; + background: #fbf9ee url("images/ui-bg_glass_55_fbf9ee_1x400.png") 50% 50% repeat-x; + color: #363636; +} +.ui-state-highlight a, +.ui-widget-content .ui-state-highlight a, +.ui-widget-header .ui-state-highlight a { + color: #363636; +} +.ui-state-error, +.ui-widget-content .ui-state-error, +.ui-widget-header .ui-state-error { + border: 1px solid #cd0a0a; + background: #fef1ec url("images/ui-bg_glass_95_fef1ec_1x400.png") 50% 50% repeat-x; + color: #cd0a0a; +} +.ui-state-error a, +.ui-widget-content .ui-state-error a, +.ui-widget-header .ui-state-error a { + color: #cd0a0a; +} +.ui-state-error-text, +.ui-widget-content .ui-state-error-text, +.ui-widget-header .ui-state-error-text { + color: #cd0a0a; +} +.ui-priority-primary, +.ui-widget-content .ui-priority-primary, +.ui-widget-header .ui-priority-primary { + font-weight: bold; +} +.ui-priority-secondary, +.ui-widget-content .ui-priority-secondary, +.ui-widget-header .ui-priority-secondary { + opacity: .7; + filter:Alpha(Opacity=70); /* support: IE8 */ + font-weight: normal; +} +.ui-state-disabled, +.ui-widget-content .ui-state-disabled, +.ui-widget-header .ui-state-disabled { + opacity: .35; + filter:Alpha(Opacity=35); /* support: IE8 */ + background-image: none; +} +.ui-state-disabled .ui-icon { + filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */ +} + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { + width: 16px; + height: 16px; +} +.ui-icon, +.ui-widget-content .ui-icon { + background-image: url("images/ui-icons_222222_256x240.png"); +} +.ui-widget-header .ui-icon { + background-image: url("images/ui-icons_222222_256x240.png"); +} +.ui-state-default .ui-icon { + background-image: url("images/ui-icons_888888_256x240.png"); +} +.ui-state-hover .ui-icon, +.ui-state-focus .ui-icon { + background-image: url("images/ui-icons_454545_256x240.png"); +} +.ui-state-active .ui-icon { + background-image: url("images/ui-icons_454545_256x240.png"); +} +.ui-state-highlight .ui-icon { + background-image: url("images/ui-icons_2e83ff_256x240.png"); +} +.ui-state-error .ui-icon, +.ui-state-error-text .ui-icon { + background-image: url("images/ui-icons_cd0a0a_256x240.png"); +} + +/* positioning */ +.ui-icon-blank { background-position: 16px 16px; } +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-on { background-position: -96px -144px; } +.ui-icon-radio-off { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-start { background-position: -80px -160px; } +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-all, +.ui-corner-top, +.ui-corner-left, +.ui-corner-tl { + border-top-left-radius: 4px; +} +.ui-corner-all, +.ui-corner-top, +.ui-corner-right, +.ui-corner-tr { + border-top-right-radius: 4px; +} +.ui-corner-all, +.ui-corner-bottom, +.ui-corner-left, +.ui-corner-bl { + border-bottom-left-radius: 4px; +} +.ui-corner-all, +.ui-corner-bottom, +.ui-corner-right, +.ui-corner-br { + border-bottom-right-radius: 4px; +} + +/* Overlays */ +.ui-widget-overlay { + background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x; + opacity: .3; + filter: Alpha(Opacity=30); /* support: IE8 */ +} +.ui-widget-shadow { + margin: -8px 0 0 -8px; + padding: 8px; + background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x; + opacity: .3; + filter: Alpha(Opacity=30); /* support: IE8 */ + border-radius: 8px; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/layout/layout-default-latest.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/layout/layout-default-latest.css new file mode 100644 index 0000000..aa382de --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/css/layout/layout-default-latest.css @@ -0,0 +1,224 @@ +/* + * Default Layout Theme + * + * Created for jquery.layout + * + * Copyright (c) 2010 + * Fabrizio Balliano (http://www.fabrizioballiano.net) + * Kevin Dalman (http://allpro.net) + * + * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html) + * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses. + * + * Last Updated: 2010-02-10 + * NOTE: For best code readability, view this with a fixed-space font and tabs equal to 4-chars + */ + +/* + * DEFAULT FONT + * Just to make demo-pages look better - not actually relevant to Layout! + */ +body { + font-family: Geneva, Arial, Helvetica, sans-serif; + font-size: 100%; + *font-size: 80%; +} + +/* + * PANES & CONTENT-DIVs + */ +.ui-layout-pane { /* all 'panes' */ + background: #FFF; + border: 1px solid #BBB; + padding: 10px; + overflow: auto; + /* DO NOT add scrolling (or padding) to 'panes' that have a content-div, + otherwise you may get double-scrollbars - on the pane AND on the content-div + - use ui-layout-wrapper class if pane has a content-div + - use ui-layout-container if pane has an inner-layout + */ + } + /* (scrolling) content-div inside pane allows for fixed header(s) and/or footer(s) */ + .ui-layout-content { + padding: 10px; + position: relative; /* contain floated or positioned elements */ + overflow: auto; /* add scrolling to content-div */ + } + +/* + * UTILITY CLASSES + * Must come AFTER pane-class above so will override + * These classes are NOT auto-generated and are NOT used by Layout + */ +.layout-child-container, +.layout-content-container { + padding: 0; + overflow: hidden; +} +.layout-child-container { + border: 0; /* remove border because inner-layout-panes probably have borders */ +} +.layout-scroll { + overflow: auto; +} +.layout-hide { + display: none; +} + +/* + * RESIZER-BARS + */ +.ui-layout-resizer { /* all 'resizer-bars' */ + background: #DDD; + border: 1px solid #BBB; + border-width: 0; + } + .ui-layout-resizer-drag { /* REAL resizer while resize in progress */ + } + .ui-layout-resizer-hover { /* affects both open and closed states */ + } + /* NOTE: It looks best when 'hover' and 'dragging' are set to the same color, + otherwise color shifts while dragging when bar can't keep up with mouse */ + .ui-layout-resizer-open-hover , /* hover-color to 'resize' */ + .ui-layout-resizer-dragging { /* resizer beging 'dragging' */ + background: #C4E1A4; + } + .ui-layout-resizer-dragging { /* CLONED resizer being dragged */ + border: 1px solid #BBB; + } + .ui-layout-resizer-north-dragging, + .ui-layout-resizer-south-dragging { + border-width: 1px 0; + } + .ui-layout-resizer-west-dragging, + .ui-layout-resizer-east-dragging { + border-width: 0 1px; + } + /* NOTE: Add a 'dragging-limit' color to provide visual feedback when resizer hits min/max size limits */ + .ui-layout-resizer-dragging-limit { /* CLONED resizer at min or max size-limit */ + background: #E1A4A4; /* red */ + } + + .ui-layout-resizer-closed-hover { /* hover-color to 'slide open' */ + background: #EBD5AA; + } + .ui-layout-resizer-sliding { /* resizer when pane is 'slid open' */ + opacity: .10; /* show only a slight shadow */ + filter: alpha(opacity=10); + } + .ui-layout-resizer-sliding-hover { /* sliding resizer - hover */ + opacity: 1.00; /* on-hover, show the resizer-bar normally */ + filter: alpha(opacity=100); + } + /* sliding resizer - add 'outside-border' to resizer on-hover + * this sample illustrates how to target specific panes and states */ + .ui-layout-resizer-north-sliding-hover { border-bottom-width: 1px; } + .ui-layout-resizer-south-sliding-hover { border-top-width: 1px; } + .ui-layout-resizer-west-sliding-hover { border-right-width: 1px; } + .ui-layout-resizer-east-sliding-hover { border-left-width: 1px; } + +/* + * TOGGLER-BUTTONS + */ +.ui-layout-toggler { + border: 1px solid #BBB; /* match pane-border */ + background-color: #BBB; + } + .ui-layout-resizer-hover .ui-layout-toggler { + opacity: .60; + filter: alpha(opacity=60); + } + .ui-layout-toggler-hover , /* need when NOT resizable */ + .ui-layout-resizer-hover .ui-layout-toggler-hover { /* need specificity when IS resizable */ + background-color: #FC6; + opacity: 1.00; + filter: alpha(opacity=100); + } + .ui-layout-toggler-north , + .ui-layout-toggler-south { + border-width: 0 1px; /* left/right borders */ + } + .ui-layout-toggler-west , + .ui-layout-toggler-east { + border-width: 1px 0; /* top/bottom borders */ + } + /* hide the toggler-button when the pane is 'slid open' */ + .ui-layout-resizer-sliding .ui-layout-toggler { + display: none; + } + /* + * style the text we put INSIDE the togglers + */ + .ui-layout-toggler .content { + color: #666; + font-size: 12px; + font-weight: bold; + width: 100%; + padding-bottom: 0.35ex; /* to 'vertically center' text inside text-span */ + } + +/* + * PANE-MASKS + * these styles are hard-coded on mask elems, but are also + * included here as !important to ensure will overrides any generic styles + */ +.ui-layout-mask { + border: none !important; + padding: 0 !important; + margin: 0 !important; + overflow: hidden !important; + position: absolute !important; + opacity: 0 !important; + filter: Alpha(Opacity="0") !important; +} +.ui-layout-mask-inside-pane { /* masks always inside pane EXCEPT when pane is an iframe */ + top: 0 !important; + left: 0 !important; + width: 100% !important; + height: 100% !important; +} +div.ui-layout-mask {} /* standard mask for iframes */ +iframe.ui-layout-mask {} /* extra mask for objects/applets */ + +/* + * Default printing styles + */ +@media print { + /* + * Unless you want to print the layout as it appears onscreen, + * these html/body styles are needed to allow the content to 'flow' + */ + html { + height: auto !important; + overflow: visible !important; + } + body.ui-layout-container { + position: static !important; + top: auto !important; + bottom: auto !important; + left: auto !important; + right: auto !important; + /* only IE6 has container width & height set by Layout */ + _width: auto !important; + _height: auto !important; + } + .ui-layout-resizer, .ui-layout-toggler { + display: none !important; + } + /* + * Default pane print styles disables positioning, borders and backgrounds. + * You can modify these styles however it suit your needs. + */ + .ui-layout-pane { + border: none !important; + background: transparent !important; + position: relative !important; + top: auto !important; + bottom: auto !important; + left: auto !important; + right: auto !important; + width: auto !important; + height: auto !important; + overflow: visible !important; + } +} \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/css/nv.d3.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/css/nv.d3.css new file mode 100644 index 0000000..28ccd05 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/css/nv.d3.css @@ -0,0 +1,656 @@ + +/******************** + * HTML CSS + */ + + +.chartWrap { + margin: 0; + padding: 0; + overflow: hidden; +} + + +/******************** + * TOOLTIP CSS + */ + +.nvtooltip { + position: absolute; + background-color: rgba(255,255,255,1); + padding: 10px; + border: 1px solid #ddd; + z-index: 10000; + + font-family: Arial; + font-size: 13px; + + transition: opacity 500ms linear; + -moz-transition: opacity 500ms linear; + -webkit-transition: opacity 500ms linear; + + transition-delay: 500ms; + -moz-transition-delay: 500ms; + -webkit-transition-delay: 500ms; + + -moz-box-shadow: 4px 4px 8px rgba(0,0,0,.5); + -webkit-box-shadow: 4px 4px 8px rgba(0,0,0,.5); + box-shadow: 4px 4px 8px rgba(0,0,0,.5); + + -moz-border-radius: 10px; + border-radius: 10px; + + pointer-events: none; + + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.nvtooltip h3 { + margin: 0; + padding: 0; + text-align: center; +} + +.nvtooltip p { + margin: 0; + padding: 0; + text-align: center; +} + +.nvtooltip span { + display: inline-block; + margin: 2px 0; +} + +.nvtooltip-pending-removal { + position: absolute; + pointer-events: none; +} + + +/******************** + * SVG CSS + */ + + +svg { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + /* Trying to get SVG to act like a greedy block in all browsers */ + display: block; + width:100%; + height:100%; +} + + +svg text { + font: normal 12px Arial; +} + +svg .title { + font: bold 14px Arial; +} + +.nvd3 .nv-background { + fill: white; + fill-opacity: 0; + /* + pointer-events: none; + */ +} + +.nvd3.nv-noData { + font-size: 18px; + font-weight: bolf; +} + + +/********** +* Brush +*/ + +.nv-brush .extent { + fill-opacity: .125; + shape-rendering: crispEdges; +} + + + +/********** +* Legend +*/ + +.nvd3 .nv-legend .nv-series { + cursor: pointer; +} + +.nvd3 .nv-legend .disabled circle { + fill-opacity: 0; +} + + + +/********** +* Axes +*/ + +.nvd3 .nv-axis path { + fill: none; + stroke: #000; + stroke-opacity: .75; + shape-rendering: crispEdges; +} + +.nvd3 .nv-axis path.domain { + stroke-opacity: .75; +} + +.nvd3 .nv-axis.nv-x path.domain { + stroke-opacity: 0; +} + +.nvd3 .nv-axis line { + fill: none; + stroke: #000; + stroke-opacity: .25; + shape-rendering: crispEdges; +} + +.nvd3 .nv-axis line.zero { + stroke-opacity: .75; +} + +.nvd3 .nv-axis .nv-axisMaxMin text { + font-weight: bold; +} + +.nvd3 .x .nv-axis .nv-axisMaxMin text, +.nvd3 .x2 .nv-axis .nv-axisMaxMin text, +.nvd3 .x3 .nv-axis .nv-axisMaxMin text { + text-anchor: middle +} + + + +/********** +* Brush +*/ + +.nv-brush .resize path { + fill: #eee; + stroke: #666; +} + + + +/********** +* Bars +*/ + +.nvd3 .nv-bars .negative rect { + zfill: brown; +} + +.nvd3 .nv-bars rect { + zfill: steelblue; + fill-opacity: .75; + + transition: fill-opacity 250ms linear; + -moz-transition: fill-opacity 250ms linear; + -webkit-transition: fill-opacity 250ms linear; +} + +.nvd3 .nv-bars rect:hover { + fill-opacity: 1; +} + +.nvd3 .nv-bars .hover rect { + fill: lightblue; +} + +.nvd3 .nv-bars text { + fill: rgba(0,0,0,0); +} + +.nvd3 .nv-bars .hover text { + fill: rgba(0,0,0,1); +} + + +/********** +* Bars +*/ + +.nvd3 .nv-multibar .nv-groups rect, +.nvd3 .nv-multibarHorizontal .nv-groups rect, +.nvd3 .nv-discretebar .nv-groups rect { + stroke-opacity: 0; + + transition: fill-opacity 250ms linear; + -moz-transition: fill-opacity 250ms linear; + -webkit-transition: fill-opacity 250ms linear; +} + +.nvd3 .nv-multibar .nv-groups rect:hover, +.nvd3 .nv-multibarHorizontal .nv-groups rect:hover, +.nvd3 .nv-discretebar .nv-groups rect:hover { + fill-opacity: 1; +} + +.nvd3 .nv-discretebar .nv-groups text, +.nvd3 .nv-multibarHorizontal .nv-groups text { + font-weight: bold; + fill: rgba(0,0,0,1); + stroke: rgba(0,0,0,0); +} + +/*********** +* Pie Chart +*/ + +.nvd3.nv-pie path { + stroke-opacity: 0; + + transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear; + -moz-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear; + -webkit-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear; + +} + +.nvd3.nv-pie .nv-slice text { + stroke: #000; + stroke-width: 0; +} + +.nvd3.nv-pie path { + stroke: #fff; + stroke-width: 1px; + stroke-opacity: 1; +} + +.nvd3.nv-pie .hover path { + fill-opacity: .7; +/* + stroke-width: 6px; + stroke-opacity: 1; +*/ +} + +.nvd3.nv-pie .nv-label rect { + fill-opacity: 0; + stroke-opacity: 0; +} + +/********** +* Lines +*/ + +.nvd3 .nv-groups path.nv-line { + fill: none; + stroke-width: 2.5px; + /* + stroke-linecap: round; + shape-rendering: geometricPrecision; + + transition: stroke-width 250ms linear; + -moz-transition: stroke-width 250ms linear; + -webkit-transition: stroke-width 250ms linear; + + transition-delay: 250ms + -moz-transition-delay: 250ms; + -webkit-transition-delay: 250ms; + */ +} + +.nvd3 .nv-groups path.nv-area { + stroke: none; + /* + stroke-linecap: round; + shape-rendering: geometricPrecision; + + stroke-width: 2.5px; + transition: stroke-width 250ms linear; + -moz-transition: stroke-width 250ms linear; + -webkit-transition: stroke-width 250ms linear; + + transition-delay: 250ms + -moz-transition-delay: 250ms; + -webkit-transition-delay: 250ms; + */ +} + +.nvd3 .nv-line.hover path { + stroke-width: 6px; +} + +/* +.nvd3.scatter .groups .point { + fill-opacity: 0.1; + stroke-opacity: 0.1; +} + */ + +.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point { + fill-opacity: 0; + stroke-opacity: 0; +} + +.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point { + fill-opacity: .5 !important; + stroke-opacity: .5 !important; +} + + +.nvd3 .nv-groups .nv-point { + transition: stroke-width 250ms linear, stroke-opacity 250ms linear; + -moz-transition: stroke-width 250ms linear, stroke-opacity 250ms linear; + -webkit-transition: stroke-width 250ms linear, stroke-opacity 250ms linear; +} + +.nvd3.nv-scatter .nv-groups .nv-point.hover, +.nvd3 .nv-groups .nv-point.hover { + stroke-width: 20px; + fill-opacity: .5 !important; + stroke-opacity: .5 !important; +} + + +.nvd3 .nv-point-paths path { + stroke: #aaa; + stroke-opacity: 0; + fill: #eee; + fill-opacity: 0; +} + + + +.nvd3 .nv-indexLine { + cursor: ew-resize; +} + + +/********** +* Distribution +*/ + +.nvd3 .nv-distribution { + pointer-events: none; +} + + + +/********** +* Scatter +*/ + +/* **Attempting to remove this for useVoronoi(false), need to see if it's required anywhere +.nvd3 .nv-groups .nv-point { + pointer-events: none; +} +*/ + +.nvd3 .nv-groups .nv-point.hover { + stroke-width: 20px; + stroke-opacity: .5; +} + +.nvd3 .nv-scatter .nv-point.hover { + fill-opacity: 1; +} + +/* +.nv-group.hover .nv-point { + fill-opacity: 1; +} +*/ + + +/********** +* Stacked Area +*/ + +.nvd3.nv-stackedarea path.nv-area { + fill-opacity: .7; + /* + stroke-opacity: .65; + fill-opacity: 1; + */ + stroke-opacity: 0; + + transition: fill-opacity 250ms linear, stroke-opacity 250ms linear; + -moz-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear; + -webkit-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear; + + /* + transition-delay: 500ms; + -moz-transition-delay: 500ms; + -webkit-transition-delay: 500ms; + */ + +} + +.nvd3.nv-stackedarea path.nv-area.hover { + fill-opacity: .9; + /* + stroke-opacity: .85; + */ +} +/* +.d3stackedarea .groups path { + stroke-opacity: 0; +} + */ + + + +.nvd3.nv-stackedarea .nv-groups .nv-point { + stroke-opacity: 0; + fill-opacity: 0; +} + +.nvd3.nv-stackedarea .nv-groups .nv-point.hover { + stroke-width: 20px; + stroke-opacity: .75; + fill-opacity: 1; +} + + + +/********** +* Line Plus Bar +*/ + +.nvd3.nv-linePlusBar .nv-bar rect { + fill-opacity: .75; +} + +.nvd3.nv-linePlusBar .nv-bar rect:hover { + fill-opacity: 1; +} + + +/********** +* Bullet +*/ + +.nvd3.nv-bullet { font: 10px sans-serif; } +.nvd3.nv-bullet .nv-measure { fill-opacity: .8; } +.nvd3.nv-bullet .nv-measure:hover { fill-opacity: 1; } +.nvd3.nv-bullet .nv-marker { stroke: #000; stroke-width: 2px; } +.nvd3.nv-bullet .nv-markerTriangle { stroke: #000; fill: #fff; stroke-width: 1.5px; } +.nvd3.nv-bullet .nv-tick line { stroke: #666; stroke-width: .5px; } +.nvd3.nv-bullet .nv-range.nv-s0 { fill: #eee; } +.nvd3.nv-bullet .nv-range.nv-s1 { fill: #ddd; } +.nvd3.nv-bullet .nv-range.nv-s2 { fill: #ccc; } +.nvd3.nv-bullet .nv-title { font-size: 14px; font-weight: bold; } +.nvd3.nv-bullet .nv-subtitle { fill: #999; } + + +.nvd3.nv-bullet .nv-range { + fill: #999; + fill-opacity: .4; +} +.nvd3.nv-bullet .nv-range:hover { + fill-opacity: .7; +} + + + +/********** +* Sparkline +*/ + +.nvd3.nv-sparkline path { + fill: none; +} + +.nvd3.nv-sparklineplus g.nv-hoverValue { + pointer-events: none; +} + +.nvd3.nv-sparklineplus .nv-hoverValue line { + stroke: #333; + stroke-width: 1.5px; + } + +.nvd3.nv-sparklineplus, +.nvd3.nv-sparklineplus g { + pointer-events: all; +} + +.nvd3 .nv-hoverArea { + fill-opacity: 0; + stroke-opacity: 0; +} + +.nvd3.nv-sparklineplus .nv-xValue, +.nvd3.nv-sparklineplus .nv-yValue { + /* + stroke: #666; + */ + stroke-width: 0; + font-size: .9em; + font-weight: normal; +} + +.nvd3.nv-sparklineplus .nv-yValue { + stroke: #f66; +} + +.nvd3.nv-sparklineplus .nv-maxValue { + stroke: #2ca02c; + fill: #2ca02c; +} + +.nvd3.nv-sparklineplus .nv-minValue { + stroke: #d62728; + fill: #d62728; +} + +.nvd3.nv-sparklineplus .nv-currentValue { + /* + stroke: #444; + fill: #000; + */ + font-weight: bold; + font-size: 1.1em; +} + +/********** +* historical stock +*/ + +.nvd3.nv-ohlcBar .nv-ticks .nv-tick { + stroke-width: 2px; +} + +.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover { + stroke-width: 4px; +} + +.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive { + stroke: #2ca02c; +} + +.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative { + stroke: #d62728; +} + +.nvd3.nv-historicalStockChart .nv-axis .nv-axislabel { + font-weight: bold; +} + +.nvd3.nv-historicalStockChart .nv-dragTarget { + fill-opacity: 0; + stroke: none; + cursor: move; +} + +.nvd3 .nv-brush .extent { + /* + cursor: ew-resize !important; + */ + fill-opacity: 0 !important; +} + +.nvd3 .nv-brushBackground rect { + stroke: #000; + stroke-width: .4; + fill: #fff; + fill-opacity: .7; +} + + + +/********** +* Indented Tree +*/ + + +/** + * TODO: the following 3 selectors are based on classes used in the example. I should either make them standard and leave them here, or move to a CSS file not included in the library + */ +.nvd3.nv-indentedtree .name { + margin-left: 5px; +} + +.nvd3.nv-indentedtree .clickable { + color: #08C; + cursor: pointer; +} + +.nvd3.nv-indentedtree span.clickable:hover { + color: #005580; + text-decoration: underline; +} + + +.nvd3.nv-indentedtree .nv-childrenCount { + display: inline-block; + margin-left: 5px; +} + +.nvd3.nv-indentedtree .nv-treeicon { + cursor: pointer; + /* + cursor: n-resize; + */ +} + +.nvd3.nv-indentedtree .nv-treeicon.nv-folded { + cursor: pointer; + /* + cursor: s-resize; + */ +} + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/cie.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/cie.js new file mode 100644 index 0000000..45f0132 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/cie.js @@ -0,0 +1,155 @@ +(function(d3) { + var cie = d3.cie = {}; + + cie.lab = function(l, a, b) { + return arguments.length === 1 + ? (l instanceof Lab ? lab(l.l, l.a, l.b) + : (l instanceof Lch ? lch_lab(l.l, l.c, l.h) + : rgb_lab((l = d3.rgb(l)).r, l.g, l.b))) + : lab(+l, +a, +b); + }; + + cie.lch = function(l, c, h) { + return arguments.length === 1 + ? (l instanceof Lch ? lch(l.l, l.c, l.h) + : (l instanceof Lab ? lab_lch(l.l, l.a, l.b) + : lab_lch((l = rgb_lab((l = d3.rgb(l)).r, l.g, l.b)).l, l.a, l.b))) + : lch(+l, +c, +h); + }; + + cie.interpolateLab = function(a, b) { + a = cie.lab(a); + b = cie.lab(b); + var al = a.l, + aa = a.a, + ab = a.b, + bl = b.l - al, + ba = b.a - aa, + bb = b.b - ab; + return function(t) { + return lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + ""; + }; + }; + + cie.interpolateLch = function(a, b) { + a = cie.lch(a); + b = cie.lch(b); + var al = a.l, + ac = a.c, + ah = a.h, + bl = b.l - al, + bc = b.c - ac, + bh = b.h - ah; + if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; // shortest path + return function(t) { + return lch_lab(al + bl * t, ac + bc * t, ah + bh * t) + ""; + }; + }; + + function lab(l, a, b) { + return new Lab(l, a, b); + } + + function Lab(l, a, b) { + this.l = l; + this.a = a; + this.b = b; + } + + Lab.prototype.brighter = function(k) { + return lab(Math.min(100, this.l + K * (arguments.length ? k : 1)), this.a, this.b); + }; + + Lab.prototype.darker = function(k) { + return lab(Math.max(0, this.l - K * (arguments.length ? k : 1)), this.a, this.b); + }; + + Lab.prototype.rgb = function() { + return lab_rgb(this.l, this.a, this.b); + }; + + Lab.prototype.toString = function() { + return this.rgb() + ""; + }; + + function lch(l, c, h) { + return new Lch(l, c, h); + } + + function Lch(l, c, h) { + this.l = l; + this.c = c; + this.h = h; + } + + Lch.prototype.brighter = function(k) { + return lch(Math.min(100, this.l + K * (arguments.length ? k : 1)), this.c, this.h); + }; + + Lch.prototype.darker = function(k) { + return lch(Math.max(0, this.l - K * (arguments.length ? k : 1)), this.c, this.h); + }; + + Lch.prototype.rgb = function() { + return lch_lab(this.l, this.c, this.h).rgb(); + }; + + Lch.prototype.toString = function() { + return this.rgb() + ""; + }; + + // Corresponds roughly to RGB brighter/darker + var K = 18; + + // D65 standard referent + var X = 0.950470, Y = 1, Z = 1.088830; + + function lab_rgb(l, a, b) { + var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200; + x = lab_xyz(x) * X; + y = lab_xyz(y) * Y; + z = lab_xyz(z) * Z; + return d3.rgb( + xyz_rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), + xyz_rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z), + xyz_rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z) + ); + } + + function rgb_lab(r, g, b) { + r = rgb_xyz(r); + g = rgb_xyz(g); + b = rgb_xyz(b); + var x = xyz_lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / X), + y = xyz_lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / Y), + z = xyz_lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / Z); + return lab(116 * y - 16, 500 * (x - y), 200 * (y - z)); + } + + function lab_lch(l, a, b) { + var c = Math.sqrt(a * a + b * b), + h = Math.atan2(b, a) / Math.PI * 180; + return lch(l, c, h); + } + + function lch_lab(l, c, h) { + h = h * Math.PI / 180; + return lab(l, Math.cos(h) * c, Math.sin(h) * c); + } + + function lab_xyz(x) { + return x > 0.206893034 ? x * x * x : (x - 4 / 29) / 7.787037; + } + + function xyz_lab(x) { + return x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29; + } + + function xyz_rgb(r) { + return Math.round(255 * (r <= 0.00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - 0.055)); + } + + function rgb_xyz(r) { + return (r /= 255) <= 0.04045 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4); + } +})(d3); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/colorbrewer.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/colorbrewer.js new file mode 100644 index 0000000..2295527 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/colorbrewer.js @@ -0,0 +1,302 @@ +// This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/). +var colorbrewer = {YlGn: { +3: ["#f7fcb9","#addd8e","#31a354"], +4: ["#ffffcc","#c2e699","#78c679","#238443"], +5: ["#ffffcc","#c2e699","#78c679","#31a354","#006837"], +6: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"], +7: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"], +8: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"], +9: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"] +},YlGnBu: { +3: ["#edf8b1","#7fcdbb","#2c7fb8"], +4: ["#ffffcc","#a1dab4","#41b6c4","#225ea8"], +5: ["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"], +6: ["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"], +7: ["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"], +8: ["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"], +9: ["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"] +},GnBu: { +3: ["#e0f3db","#a8ddb5","#43a2ca"], +4: ["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"], +5: ["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"], +6: ["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"], +7: ["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"], +8: ["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"], +9: ["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"] +},BuGn: { +3: ["#e5f5f9","#99d8c9","#2ca25f"], +4: ["#edf8fb","#b2e2e2","#66c2a4","#238b45"], +5: ["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"], +6: ["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"], +7: ["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"], +8: ["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"], +9: ["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"] +},PuBuGn: { +3: ["#ece2f0","#a6bddb","#1c9099"], +4: ["#f6eff7","#bdc9e1","#67a9cf","#02818a"], +5: ["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"], +6: ["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"], +7: ["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"], +8: ["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"], +9: ["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"] +},PuBu: { +3: ["#ece7f2","#a6bddb","#2b8cbe"], +4: ["#f1eef6","#bdc9e1","#74a9cf","#0570b0"], +5: ["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"], +6: ["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"], +7: ["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"], +8: ["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"], +9: ["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"] +},BuPu: { +3: ["#e0ecf4","#9ebcda","#8856a7"], +4: ["#edf8fb","#b3cde3","#8c96c6","#88419d"], +5: ["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"], +6: ["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"], +7: ["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"], +8: ["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"], +9: ["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"] +},RdPu: { +3: ["#fde0dd","#fa9fb5","#c51b8a"], +4: ["#feebe2","#fbb4b9","#f768a1","#ae017e"], +5: ["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"], +6: ["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"], +7: ["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"], +8: ["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"], +9: ["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"] +},PuRd: { +3: ["#e7e1ef","#c994c7","#dd1c77"], +4: ["#f1eef6","#d7b5d8","#df65b0","#ce1256"], +5: ["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"], +6: ["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"], +7: ["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"], +8: ["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"], +9: ["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"] +},OrRd: { +3: ["#fee8c8","#fdbb84","#e34a33"], +4: ["#fef0d9","#fdcc8a","#fc8d59","#d7301f"], +5: ["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"], +6: ["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"], +7: ["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"], +8: ["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"], +9: ["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"] +},YlOrRd: { +3: ["#ffeda0","#feb24c","#f03b20"], +4: ["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"], +5: ["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"], +6: ["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"], +7: ["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"], +8: ["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"], +9: ["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"] +},YlOrBr: { +3: ["#fff7bc","#fec44f","#d95f0e"], +4: ["#ffffd4","#fed98e","#fe9929","#cc4c02"], +5: ["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"], +6: ["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"], +7: ["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"], +8: ["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"], +9: ["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"] +},Purples: { +3: ["#efedf5","#bcbddc","#756bb1"], +4: ["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"], +5: ["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"], +6: ["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"], +7: ["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"], +8: ["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"], +9: ["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"] +},Blues: { +3: ["#deebf7","#9ecae1","#3182bd"], +4: ["#eff3ff","#bdd7e7","#6baed6","#2171b5"], +5: ["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"], +6: ["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"], +7: ["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"], +8: ["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"], +9: ["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"] +},Greens: { +3: ["#e5f5e0","#a1d99b","#31a354"], +4: ["#edf8e9","#bae4b3","#74c476","#238b45"], +5: ["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"], +6: ["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"], +7: ["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"], +8: ["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"], +9: ["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"] +},Oranges: { +3: ["#fee6ce","#fdae6b","#e6550d"], +4: ["#feedde","#fdbe85","#fd8d3c","#d94701"], +5: ["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"], +6: ["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"], +7: ["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"], +8: ["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"], +9: ["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"] +},Reds: { +3: ["#fee0d2","#fc9272","#de2d26"], +4: ["#fee5d9","#fcae91","#fb6a4a","#cb181d"], +5: ["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"], +6: ["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"], +7: ["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"], +8: ["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"], +9: ["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"] +},Greys: { +3: ["#f0f0f0","#bdbdbd","#636363"], +4: ["#f7f7f7","#cccccc","#969696","#525252"], +5: ["#f7f7f7","#cccccc","#969696","#636363","#252525"], +6: ["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"], +7: ["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"], +8: ["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"], +9: ["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"] +},PuOr: { +3: ["#f1a340","#f7f7f7","#998ec3"], +4: ["#e66101","#fdb863","#b2abd2","#5e3c99"], +5: ["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"], +6: ["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"], +7: ["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"], +8: ["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"], +9: ["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"], +10: ["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"], +11: ["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"] +},BrBG: { +3: ["#d8b365","#f5f5f5","#5ab4ac"], +4: ["#a6611a","#dfc27d","#80cdc1","#018571"], +5: ["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"], +6: ["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"], +7: ["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"], +8: ["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"], +9: ["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"], +10: ["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"], +11: ["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"] +},PRGn: { +3: ["#af8dc3","#f7f7f7","#7fbf7b"], +4: ["#7b3294","#c2a5cf","#a6dba0","#008837"], +5: ["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"], +6: ["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"], +7: ["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"], +8: ["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"], +9: ["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"], +10: ["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"], +11: ["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"] +},PiYG: { +3: ["#e9a3c9","#f7f7f7","#a1d76a"], +4: ["#d01c8b","#f1b6da","#b8e186","#4dac26"], +5: ["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"], +6: ["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"], +7: ["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"], +8: ["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"], +9: ["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"], +10: ["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"], +11: ["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"] +},RdBu: { +3: ["#ef8a62","#f7f7f7","#67a9cf"], +4: ["#ca0020","#f4a582","#92c5de","#0571b0"], +5: ["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"], +6: ["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"], +7: ["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"], +8: ["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"], +9: ["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"], +10: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"], +11: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"] +},RdGy: { +3: ["#ef8a62","#ffffff","#999999"], +4: ["#ca0020","#f4a582","#bababa","#404040"], +5: ["#ca0020","#f4a582","#ffffff","#bababa","#404040"], +6: ["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"], +7: ["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"], +8: ["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"], +9: ["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"], +10: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"], +11: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"] +},RdYlBu: { +3: ["#fc8d59","#ffffbf","#91bfdb"], +4: ["#d7191c","#fdae61","#abd9e9","#2c7bb6"], +5: ["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"], +6: ["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"], +7: ["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"], +8: ["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"], +9: ["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"], +10: ["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"], +11: ["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"] +},Spectral: { +3: ["#fc8d59","#ffffbf","#99d594"], +4: ["#d7191c","#fdae61","#abdda4","#2b83ba"], +5: ["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"], +6: ["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"], +7: ["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"], +8: ["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"], +9: ["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"], +10: ["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"], +11: ["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"] +},RdYlGn: { +3: ["#fc8d59","#ffffbf","#91cf60"], +4: ["#d7191c","#fdae61","#a6d96a","#1a9641"], +5: ["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"], +6: ["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"], +7: ["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"], +8: ["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"], +9: ["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"], +10: ["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"], +11: ["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"] +},Accent: { +3: ["#7fc97f","#beaed4","#fdc086"], +4: ["#7fc97f","#beaed4","#fdc086","#ffff99"], +5: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"], +6: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"], +7: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"], +8: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"] +},Dark2: { +3: ["#1b9e77","#d95f02","#7570b3"], +4: ["#1b9e77","#d95f02","#7570b3","#e7298a"], +5: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"], +6: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"], +7: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"], +8: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"] +},Paired: { +3: ["#a6cee3","#1f78b4","#b2df8a"], +4: ["#a6cee3","#1f78b4","#b2df8a","#33a02c"], +5: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"], +6: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"], +7: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"], +8: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"], +9: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"], +10: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"], +11: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"], +12: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"] +},Pastel1: { +3: ["#fbb4ae","#b3cde3","#ccebc5"], +4: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4"], +5: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"], +6: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"], +7: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"], +8: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"], +9: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"] +},Pastel2: { +3: ["#b3e2cd","#fdcdac","#cbd5e8"], +4: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"], +5: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"], +6: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"], +7: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"], +8: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"] +},Set1: { +3: ["#e41a1c","#377eb8","#4daf4a"], +4: ["#e41a1c","#377eb8","#4daf4a","#984ea3"], +5: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"], +6: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"], +7: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"], +8: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"], +9: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"] +},Set2: { +3: ["#66c2a5","#fc8d62","#8da0cb"], +4: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3"], +5: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"], +6: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f"], +7: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494"], +8: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"] +},Set3: { +3: ["#8dd3c7","#ffffb3","#bebada"], +4: ["#8dd3c7","#ffffb3","#bebada","#fb8072"], +5: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3"], +6: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462"], +7: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"], +8: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5"], +9: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"], +10: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd"], +11: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5"], +12: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"] +}}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/core.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/core.js new file mode 100644 index 0000000..912de8d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/core.js @@ -0,0 +1,122 @@ + +var nv = window.nv || {}; + + +nv.version = '1.1.13b'; +nv.dev = true //set false when in production + +window.nv = nv; + +nv.tooltip = {}; // For the tooltip system +nv.utils = nv.utils || {}; // Utility subsystem +nv.models = {}; //stores all the possible models/components +nv.charts = {}; //stores all the ready to use charts +nv.graphs = []; //stores all the graphs currently on the page +nv.logs = {}; //stores some statistics and potential error messages + +nv.dispatch = d3.dispatch('render_start', 'render_end'); + +// ************************************************************************* +// Development render timers - disabled if dev = false + +if (nv.dev) { + nv.dispatch.on('render_start', function(e) { + nv.logs.startTime = +new Date(); + }); + + nv.dispatch.on('render_end', function(e) { + nv.logs.endTime = +new Date(); + nv.logs.totalTime = nv.logs.endTime - nv.logs.startTime; + nv.log('total', nv.logs.totalTime); // used for development, to keep track of graph generation times + }); +} + +// ******************************************** +// Public Core NV functions + +// Logs all arguments, and returns the last so you can test things in place +// Note: in IE8 console.log is an object not a function, and if modernizr is used +// then calling Function.prototype.bind with with anything other than a function +// causes a TypeError to be thrown. +nv.log = function() { + if (nv.dev && console.log && console.log.apply) + console.log.apply(console, arguments) + else if (nv.dev && typeof console.log == "function" && Function.prototype.bind) { + var log = Function.prototype.bind.call(console.log, console); + log.apply(console, arguments); + } + return arguments[arguments.length - 1]; +}; + + +nv.render = function render(step) { + step = step || 1; // number of graphs to generate in each timeout loop + + nv.render.active = true; + nv.dispatch.render_start(); + + setTimeout(function() { + var chart, graph; + + for (var i = 0; i < step && (graph = nv.render.queue[i]); i++) { + chart = graph.generate(); + if (typeof graph.callback == typeof(Function)) graph.callback(chart); + nv.graphs.push(chart); + } + + nv.render.queue.splice(0, i); + + if (nv.render.queue.length) setTimeout(arguments.callee, 0); + else { nv.render.active = false; nv.dispatch.render_end(); } + }, 0); +}; + +nv.render.active = false; +nv.render.queue = []; + +nv.addGraph = function(obj) { + if (typeof arguments[0] === typeof(Function)) + obj = {generate: arguments[0], callback: arguments[1]}; + + nv.render.queue.push(obj); + + if (!nv.render.active) nv.render(); +}; + +nv.identity = function(d) { return d; }; + +nv.strip = function(s) { return s.replace(/(\s|&)/g,''); }; + +function daysInMonth(month,year) { + return (new Date(year, month+1, 0)).getDate(); +} + +function d3_time_range(floor, step, number) { + return function(t0, t1, dt) { + var time = floor(t0), times = []; + if (time < t0) step(time); + if (dt > 1) { + while (time < t1) { + var date = new Date(+time); + if ((number(date) % dt === 0)) times.push(date); + step(time); + } + } else { + while (time < t1) { times.push(new Date(+time)); step(time); } + } + return times; + }; +} + +d3.time.monthEnd = function(date) { + return new Date(date.getFullYear(), date.getMonth(), 0); +}; + +d3.time.monthEnds = d3_time_range(d3.time.monthEnd, function(date) { + date.setUTCDate(date.getUTCDate() + 1); + date.setDate(daysInMonth(date.getMonth() + 1, date.getFullYear())); + }, function(date) { + return date.getMonth(); + } +); + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/crossfilter.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/crossfilter.js new file mode 100644 index 0000000..1aaabca --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/crossfilter.js @@ -0,0 +1,1180 @@ +(function(exports){ +crossfilter.version = "1.0.3"; +function crossfilter_identity(d) { + return d; +} +crossfilter.permute = permute; + +function permute(array, index) { + for (var i = 0, n = index.length, copy = new Array(n); i < n; ++i) { + copy[i] = array[index[i]]; + } + return copy; +} +var bisect = crossfilter.bisect = bisect_by(crossfilter_identity); + +bisect.by = bisect_by; + +function bisect_by(f) { + + // Locate the insertion point for x in a to maintain sorted order. The + // arguments lo and hi may be used to specify a subset of the array which + // should be considered; by default the entire array is used. If x is already + // present in a, the insertion point will be before (to the left of) any + // existing entries. The return value is suitable for use as the first + // argument to `array.splice` assuming that a is already sorted. + // + // The returned insertion point i partitions the array a into two halves so + // that all v < x for v in a[lo:i] for the left side and all v >= x for v in + // a[i:hi] for the right side. + function bisectLeft(a, x, lo, hi) { + while (lo < hi) { + var mid = lo + hi >> 1; + if (f(a[mid]) < x) lo = mid + 1; + else hi = mid; + } + return lo; + } + + // Similar to bisectLeft, but returns an insertion point which comes after (to + // the right of) any existing entries of x in a. + // + // The returned insertion point i partitions the array into two halves so that + // all v <= x for v in a[lo:i] for the left side and all v > x for v in + // a[i:hi] for the right side. + function bisectRight(a, x, lo, hi) { + while (lo < hi) { + var mid = lo + hi >> 1; + if (x < f(a[mid])) hi = mid; + else lo = mid + 1; + } + return lo; + } + + bisectRight.right = bisectRight; + bisectRight.left = bisectLeft; + return bisectRight; +} +var heap = crossfilter.heap = heap_by(crossfilter_identity); + +heap.by = heap_by; + +function heap_by(f) { + + // Builds a binary heap within the specified array a[lo:hi]. The heap has the + // property such that the parent a[lo+i] is always less than or equal to its + // two children: a[lo+2*i+1] and a[lo+2*i+2]. + function heap(a, lo, hi) { + var n = hi - lo, + i = (n >>> 1) + 1; + while (--i > 0) sift(a, i, n, lo); + return a; + } + + // Sorts the specified array a[lo:hi] in descending order, assuming it is + // already a heap. + function sort(a, lo, hi) { + var n = hi - lo, + t; + while (--n > 0) t = a[lo], a[lo] = a[lo + n], a[lo + n] = t, sift(a, 1, n, lo); + return a; + } + + // Sifts the element a[lo+i-1] down the heap, where the heap is the contiguous + // slice of array a[lo:lo+n]. This method can also be used to update the heap + // incrementally, without incurring the full cost of reconstructing the heap. + function sift(a, i, n, lo) { + var d = a[--lo + i], + x = f(d), + child; + while ((child = i << 1) <= n) { + if (child < n && f(a[lo + child]) > f(a[lo + child + 1])) child++; + if (x <= f(a[lo + child])) break; + a[lo + i] = a[lo + child]; + i = child; + } + a[lo + i] = d; + } + + heap.sort = sort; + return heap; +} +var heapselect = crossfilter.heapselect = heapselect_by(crossfilter_identity); + +heapselect.by = heapselect_by; + +function heapselect_by(f) { + var heap = heap_by(f); + + // Returns a new array containing the top k elements in the array a[lo:hi]. + // The returned array is not sorted, but maintains the heap property. If k is + // greater than hi - lo, then fewer than k elements will be returned. The + // order of elements in a is unchanged by this operation. + function heapselect(a, lo, hi, k) { + var queue = new Array(k = Math.min(hi - lo, k)), + min, + i, + x, + d; + + for (i = 0; i < k; ++i) queue[i] = a[lo++]; + heap(queue, 0, k); + + if (lo < hi) { + min = f(queue[0]); + do { + if (x = f(d = a[lo]) > min) { + queue[0] = d; + min = f(heap(queue, 0, k)[0]); + } + } while (++lo < hi); + } + + return queue; + } + + return heapselect; +} +var insertionsort = crossfilter.insertionsort = insertionsort_by(crossfilter_identity); + +insertionsort.by = insertionsort_by; + +function insertionsort_by(f) { + + function insertionsort(a, lo, hi) { + for (var i = lo + 1; i < hi; ++i) { + for (var j = i, t = a[i], x = f(t); j > lo && f(a[j - 1]) > x; --j) { + a[j] = a[j - 1]; + } + a[j] = t; + } + return a; + } + + return insertionsort; +} +// Algorithm designed by Vladimir Yaroslavskiy. +// Implementation based on the Dart project; see lib/dart/LICENSE for details. + +var quicksort = crossfilter.quicksort = quicksort_by(crossfilter_identity); + +quicksort.by = quicksort_by; + +function quicksort_by(f) { + var insertionsort = insertionsort_by(f); + + function sort(a, lo, hi) { + return (hi - lo < quicksort_sizeThreshold + ? insertionsort + : quicksort)(a, lo, hi); + } + + function quicksort(a, lo, hi) { + + // Compute the two pivots by looking at 5 elements. + var sixth = (hi - lo) / 6 | 0, + i1 = lo + sixth, + i5 = hi - 1 - sixth, + i3 = lo + hi - 1 >> 1, // The midpoint. + i2 = i3 - sixth, + i4 = i3 + sixth; + + var e1 = a[i1], x1 = f(e1), + e2 = a[i2], x2 = f(e2), + e3 = a[i3], x3 = f(e3), + e4 = a[i4], x4 = f(e4), + e5 = a[i5], x5 = f(e5); + + var t; + + // Sort the selected 5 elements using a sorting network. + if (x1 > x2) t = e1, e1 = e2, e2 = t, t = x1, x1 = x2, x2 = t; + if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t; + if (x1 > x3) t = e1, e1 = e3, e3 = t, t = x1, x1 = x3, x3 = t; + if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t; + if (x1 > x4) t = e1, e1 = e4, e4 = t, t = x1, x1 = x4, x4 = t; + if (x3 > x4) t = e3, e3 = e4, e4 = t, t = x3, x3 = x4, x4 = t; + if (x2 > x5) t = e2, e2 = e5, e5 = t, t = x2, x2 = x5, x5 = t; + if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t; + if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t; + + var pivot1 = e2, pivotValue1 = x2, + pivot2 = e4, pivotValue2 = x4; + + // e2 and e4 have been saved in the pivot variables. They will be written + // back, once the partitioning is finished. + a[i1] = e1; + a[i2] = a[lo]; + a[i3] = e3; + a[i4] = a[hi - 1]; + a[i5] = e5; + + var less = lo + 1, // First element in the middle partition. + great = hi - 2; // Last element in the middle partition. + + // Note that for value comparison, <, <=, >= and > coerce to a primitive via + // Object.prototype.valueOf; == and === do not, so in order to be consistent + // with natural order (such as for Date objects), we must do two compares. + var pivotsEqual = pivotValue1 <= pivotValue2 && pivotValue1 >= pivotValue2; + if (pivotsEqual) { + + // Degenerated case where the partitioning becomes a dutch national flag + // problem. + // + // [ | < pivot | == pivot | unpartitioned | > pivot | ] + // ^ ^ ^ ^ ^ + // left less k great right + // + // a[left] and a[right] are undefined and are filled after the + // partitioning. + // + // Invariants: + // 1) for x in ]left, less[ : x < pivot. + // 2) for x in [less, k[ : x == pivot. + // 3) for x in ]great, right[ : x > pivot. + for (var k = less; k <= great; ++k) { + var ek = a[k], xk = f(ek); + if (xk < pivotValue1) { + if (k !== less) { + a[k] = a[less]; + a[less] = ek; + } + ++less; + } else if (xk > pivotValue1) { + + // Find the first element <= pivot in the range [k - 1, great] and + // put [:ek:] there. We know that such an element must exist: + // When k == less, then el3 (which is equal to pivot) lies in the + // interval. Otherwise a[k - 1] == pivot and the search stops at k-1. + // Note that in the latter case invariant 2 will be violated for a + // short amount of time. The invariant will be restored when the + // pivots are put into their final positions. + while (true) { + var greatValue = f(a[great]); + if (greatValue > pivotValue1) { + great--; + // This is the only location in the while-loop where a new + // iteration is started. + continue; + } else if (greatValue < pivotValue1) { + // Triple exchange. + a[k] = a[less]; + a[less++] = a[great]; + a[great--] = ek; + break; + } else { + a[k] = a[great]; + a[great--] = ek; + // Note: if great < k then we will exit the outer loop and fix + // invariant 2 (which we just violated). + break; + } + } + } + } + } else { + + // We partition the list into three parts: + // 1. < pivot1 + // 2. >= pivot1 && <= pivot2 + // 3. > pivot2 + // + // During the loop we have: + // [ | < pivot1 | >= pivot1 && <= pivot2 | unpartitioned | > pivot2 | ] + // ^ ^ ^ ^ ^ + // left less k great right + // + // a[left] and a[right] are undefined and are filled after the + // partitioning. + // + // Invariants: + // 1. for x in ]left, less[ : x < pivot1 + // 2. for x in [less, k[ : pivot1 <= x && x <= pivot2 + // 3. for x in ]great, right[ : x > pivot2 + for (var k = less; k <= great; k++) { + var ek = a[k], xk = f(ek); + if (xk < pivotValue1) { + if (k !== less) { + a[k] = a[less]; + a[less] = ek; + } + ++less; + } else { + if (xk > pivotValue2) { + while (true) { + var greatValue = f(a[great]); + if (greatValue > pivotValue2) { + great--; + if (great < k) break; + // This is the only location inside the loop where a new + // iteration is started. + continue; + } else { + // a[great] <= pivot2. + if (greatValue < pivotValue1) { + // Triple exchange. + a[k] = a[less]; + a[less++] = a[great]; + a[great--] = ek; + } else { + // a[great] >= pivot1. + a[k] = a[great]; + a[great--] = ek; + } + break; + } + } + } + } + } + } + + // Move pivots into their final positions. + // We shrunk the list from both sides (a[left] and a[right] have + // meaningless values in them) and now we move elements from the first + // and third partition into these locations so that we can store the + // pivots. + a[lo] = a[less - 1]; + a[less - 1] = pivot1; + a[hi - 1] = a[great + 1]; + a[great + 1] = pivot2; + + // The list is now partitioned into three partitions: + // [ < pivot1 | >= pivot1 && <= pivot2 | > pivot2 ] + // ^ ^ ^ ^ + // left less great right + + // Recursive descent. (Don't include the pivot values.) + sort(a, lo, less - 1); + sort(a, great + 2, hi); + + if (pivotsEqual) { + // All elements in the second partition are equal to the pivot. No + // need to sort them. + return a; + } + + // In theory it should be enough to call _doSort recursively on the second + // partition. + // The Android source however removes the pivot elements from the recursive + // call if the second partition is too large (more than 2/3 of the list). + if (less < i1 && great > i5) { + var lessValue, greatValue; + while ((lessValue = f(a[less])) <= pivotValue1 && lessValue >= pivotValue1) ++less; + while ((greatValue = f(a[great])) <= pivotValue2 && greatValue >= pivotValue2) --great; + + // Copy paste of the previous 3-way partitioning with adaptions. + // + // We partition the list into three parts: + // 1. == pivot1 + // 2. > pivot1 && < pivot2 + // 3. == pivot2 + // + // During the loop we have: + // [ == pivot1 | > pivot1 && < pivot2 | unpartitioned | == pivot2 ] + // ^ ^ ^ + // less k great + // + // Invariants: + // 1. for x in [ *, less[ : x == pivot1 + // 2. for x in [less, k[ : pivot1 < x && x < pivot2 + // 3. for x in ]great, * ] : x == pivot2 + for (var k = less; k <= great; k++) { + var ek = a[k], xk = f(ek); + if (xk <= pivotValue1 && xk >= pivotValue1) { + if (k !== less) { + a[k] = a[less]; + a[less] = ek; + } + less++; + } else { + if (xk <= pivotValue2 && xk >= pivotValue2) { + while (true) { + var greatValue = f(a[great]); + if (greatValue <= pivotValue2 && greatValue >= pivotValue2) { + great--; + if (great < k) break; + // This is the only location inside the loop where a new + // iteration is started. + continue; + } else { + // a[great] < pivot2. + if (greatValue < pivotValue1) { + // Triple exchange. + a[k] = a[less]; + a[less++] = a[great]; + a[great--] = ek; + } else { + // a[great] == pivot1. + a[k] = a[great]; + a[great--] = ek; + } + break; + } + } + } + } + } + } + + // The second partition has now been cleared of pivot elements and looks + // as follows: + // [ * | > pivot1 && < pivot2 | * ] + // ^ ^ + // less great + // Sort the second partition using recursive descent. + + // The second partition looks as follows: + // [ * | >= pivot1 && <= pivot2 | * ] + // ^ ^ + // less great + // Simply sort it by recursive descent. + + return sort(a, less, great + 1); + } + + return sort; +} + +var quicksort_sizeThreshold = 32; +var crossfilter_array8 = crossfilter_arrayUntyped, + crossfilter_array16 = crossfilter_arrayUntyped, + crossfilter_array32 = crossfilter_arrayUntyped, + crossfilter_arrayLengthen = crossfilter_identity, + crossfilter_arrayWiden = crossfilter_identity; + +if (typeof Uint8Array !== "undefined") { + crossfilter_array8 = function(n) { return new Uint8Array(n); }; + crossfilter_array16 = function(n) { return new Uint16Array(n); }; + crossfilter_array32 = function(n) { return new Uint32Array(n); }; + + crossfilter_arrayLengthen = function(array, length) { + var copy = new array.constructor(length); + copy.set(array); + return copy; + }; + + crossfilter_arrayWiden = function(array, width) { + var copy; + switch (width) { + case 16: copy = crossfilter_array16(array.length); break; + case 32: copy = crossfilter_array32(array.length); break; + default: throw new Error("invalid array width!"); + } + copy.set(array); + return copy; + }; +} + +function crossfilter_arrayUntyped(n) { + return new Array(n); +} +function crossfilter_filterExact(bisect, value) { + return function(values) { + var n = values.length; + return [bisect.left(values, value, 0, n), bisect.right(values, value, 0, n)]; + }; +} + +function crossfilter_filterRange(bisect, range) { + var min = range[0], + max = range[1]; + return function(values) { + var n = values.length; + return [bisect.left(values, min, 0, n), bisect.left(values, max, 0, n)]; + }; +} + +function crossfilter_filterAll(values) { + return [0, values.length]; +} +function crossfilter_null() { + return null; +} +function crossfilter_zero() { + return 0; +} +function crossfilter_reduceIncrement(p) { + return p + 1; +} + +function crossfilter_reduceDecrement(p) { + return p - 1; +} + +function crossfilter_reduceAdd(f) { + return function(p, v) { + return p + +f(v); + }; +} + +function crossfilter_reduceSubtract(f) { + return function(p, v) { + return p - f(v); + }; +} +exports.crossfilter = crossfilter; + +function crossfilter() { + var crossfilter = { + add: add, + dimension: dimension, + groupAll: groupAll, + size: size + }; + + var data = [], // the records + n = 0, // the number of records; data.length + m = 0, // number of dimensions in use + M = 8, // number of dimensions that can fit in `filters` + filters = crossfilter_array8(0), // M bits per record; 1 is filtered out + filterListeners = [], // when the filters change + dataListeners = []; // when data is added + + // Adds the specified new records to this crossfilter. + function add(newData) { + var n0 = n, + n1 = newData.length; + + // If there's actually new data to add… + // Merge the new data into the existing data. + // Lengthen the filter bitset to handle the new records. + // Notify listeners (dimensions and groups) that new data is available. + if (n1) { + data = data.concat(newData); + filters = crossfilter_arrayLengthen(filters, n += n1); + dataListeners.forEach(function(l) { l(newData, n0, n1); }); + } + + return crossfilter; + } + + // Adds a new dimension with the specified value accessor function. + function dimension(value) { + var dimension = { + filter: filter, + filterExact: filterExact, + filterRange: filterRange, + filterAll: filterAll, + top: top, + group: group, + groupAll: groupAll + }; + + var one = 1 << m++, // bit mask, e.g., 00001000 + zero = ~one, // inverted one, e.g., 11110111 + values, // sorted, cached array + index, // value rank ↦ object id + newValues, // temporary array storing newly-added values + newIndex, // temporary array storing newly-added index + sort = quicksort_by(function(i) { return newValues[i]; }), + refilter = crossfilter_filterAll, // for recomputing filter + indexListeners = [], // when data is added + lo0 = 0, + hi0 = 0; + + // Updating a dimension is a two-stage process. First, we must update the + // associated filters for the newly-added records. Once all dimensions have + // updated their filters, the groups are notified to update. + dataListeners.unshift(preAdd); + dataListeners.push(postAdd); + + // Incorporate any existing data into this dimension, and make sure that the + // filter bitset is wide enough to handle the new dimension. + if (m > M) filters = crossfilter_arrayWiden(filters, M <<= 1); + preAdd(data, 0, n); + postAdd(data, 0, n); + + // Incorporates the specified new records into this dimension. + // This function is responsible for updating filters, values, and index. + function preAdd(newData, n0, n1) { + + // Permute new values into natural order using a sorted index. + newValues = newData.map(value); + newIndex = sort(crossfilter_range(n1), 0, n1); + newValues = permute(newValues, newIndex); + + // Bisect newValues to determine which new records are selected. + var bounds = refilter(newValues), lo1 = bounds[0], hi1 = bounds[1], i; + for (i = 0; i < lo1; ++i) filters[newIndex[i] + n0] |= one; + for (i = hi1; i < n1; ++i) filters[newIndex[i] + n0] |= one; + + // If this dimension previously had no data, then we don't need to do the + // more expensive merge operation; use the new values and index as-is. + if (!n0) { + values = newValues; + index = newIndex; + lo0 = lo1; + hi0 = hi1; + return; + } + + var oldValues = values, + oldIndex = index, + i0 = 0, + i1 = 0; + + // Otherwise, create new arrays into which to merge new and old. + values = new Array(n); + index = crossfilter_index(n, n); + + // Merge the old and new sorted values, and old and new index. + for (i = 0; i0 < n0 && i1 < n1; ++i) { + if (oldValues[i0] < newValues[i1]) { + values[i] = oldValues[i0]; + index[i] = oldIndex[i0++]; + } else { + values[i] = newValues[i1]; + index[i] = newIndex[i1++] + n0; + } + } + + // Add any remaining old values. + for (; i0 < n0; ++i0, ++i) { + values[i] = oldValues[i0]; + index[i] = oldIndex[i0]; + } + + // Add any remaining new values. + for (; i1 < n1; ++i1, ++i) { + values[i] = newValues[i1]; + index[i] = newIndex[i1] + n0; + } + + // Bisect again to recompute lo0 and hi0. + bounds = refilter(values), lo0 = bounds[0], hi0 = bounds[1]; + } + + // When all filters have updated, notify index listeners of the new values. + function postAdd(newData, n0, n1) { + indexListeners.forEach(function(l) { l(newValues, newIndex, n0, n1); }); + newValues = newIndex = null; + } + + // Updates the selected values based on the specified bounds [lo, hi]. + // This implementation is used by all the public filter methods. + function filterIndex(bounds) { + var i, + j, + k, + lo1 = bounds[0], + hi1 = bounds[1], + added = [], + removed = []; + + // Fast incremental update based on previous lo index. + if (lo1 < lo0) { + for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { + filters[k = index[i]] ^= one; + added.push(k); + } + } else if (lo1 > lo0) { + for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { + filters[k = index[i]] ^= one; + removed.push(k); + } + } + + // Fast incremental update based on previous hi index. + if (hi1 > hi0) { + for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { + filters[k = index[i]] ^= one; + added.push(k); + } + } else if (hi1 < hi0) { + for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { + filters[k = index[i]] ^= one; + removed.push(k); + } + } + + lo0 = lo1; + hi0 = hi1; + filterListeners.forEach(function(l) { l(one, added, removed); }); + return dimension; + } + + // Filters this dimension using the specified range, value, or null. + // If the range is null, this is equivalent to filterAll. + // If the range is an array, this is equivalent to filterRange. + // Otherwise, this is equivalent to filterExact. + function filter(range) { + return range == null + ? filterAll() : Array.isArray(range) + ? filterRange(range) + : filterExact(range); + } + + // Filters this dimension to select the exact value. + function filterExact(value) { + return filterIndex((refilter = crossfilter_filterExact(bisect, value))(values)); + } + + // Filters this dimension to select the specified range [lo, hi]. + // The lower bound is inclusive, and the upper bound is exclusive. + function filterRange(range) { + return filterIndex((refilter = crossfilter_filterRange(bisect, range))(values)); + } + + // Clears any filters on this dimension. + function filterAll() { + return filterIndex((refilter = crossfilter_filterAll)(values)); + } + + // Returns the top K selected records, based on this dimension's order. + // Note: observes this dimension's filter, unlike group and groupAll. + function top(k) { + var array = [], + i = hi0, + j; + + while (--i >= lo0 && k > 0) { + if (!filters[j = index[i]]) { + array.push(data[j]); + --k; + } + } + + return array; + } + + // Adds a new group to this dimension, using the specified key function. + function group(key) { + var group = { + top: top, + all: all, + reduce: reduce, + reduceCount: reduceCount, + reduceSum: reduceSum, + order: order, + orderNatural: orderNatural, + size: size + }; + + var groups, // array of {key, value} + groupIndex, // object id ↦ group id + groupWidth = 8, + groupCapacity = crossfilter_capacity(groupWidth), + k = 0, // cardinality + select, + heap, + reduceAdd, + reduceRemove, + reduceInitial, + update = crossfilter_null, + reset = crossfilter_null, + resetNeeded = true; + + if (arguments.length < 1) key = crossfilter_identity; + + // The group listens to the crossfilter for when any dimension changes, so + // that it can update the associated reduce values. It must also listen to + // the parent dimension for when data is added, and compute new keys. + filterListeners.push(update); + indexListeners.push(add); + + // Incorporate any existing data into the grouping. + add(values, index, 0, n); + + // Incorporates the specified new values into this group. + // This function is responsible for updating groups and groupIndex. + function add(newValues, newIndex, n0, n1) { + var oldGroups = groups, + reIndex = crossfilter_index(k, groupCapacity), + add = reduceAdd, + initial = reduceInitial, + k0 = k, // old cardinality + i0 = 0, // index of old group + i1 = 0, // index of new record + j, // object id + g0, // old group + x0, // old key + x1, // new key + g, // group to add + x; // key of group to add + + // If a reset is needed, we don't need to update the reduce values. + if (resetNeeded) add = initial = crossfilter_null; + + // Reset the new groups (k is a lower bound). + // Also, make sure that groupIndex exists and is long enough. + groups = new Array(k), k = 0; + groupIndex = k0 > 1 ? crossfilter_arrayLengthen(groupIndex, n) : crossfilter_index(n, groupCapacity); + + // Get the first old key (x0 of g0), if it exists. + if (k0) x0 = (g0 = oldGroups[0]).key; + + // Find the first new key (x1), skipping NaN keys. + while (i1 < n1 && !((x1 = key(newValues[i1])) >= x1)) ++i1; + + // While new keys remain… + while (i1 < n1) { + + // Determine the lesser of the two current keys; new and old. + // If there are no old keys remaining, then always add the new key. + if (g0 && x0 <= x1) { + g = g0, x = x0; + + // Record the new index of the old group. + reIndex[i0] = k; + + // Retrieve the next old key. + if (g0 = oldGroups[++i0]) x0 = g0.key; + } else { + g = {key: x1, value: initial()}, x = x1; + } + + // Add the lesser group. + groups[k] = g; + + // Add any selected records belonging to the added group, while + // advancing the new key and populating the associated group index. + while (!(x1 > x)) { + groupIndex[j = newIndex[i1] + n0] = k; + if (!(filters[j] & zero)) g.value = add(g.value, data[j]); + if (++i1 >= n1) break; + x1 = key(newValues[i1]); + } + + groupIncrement(); + } + + // Add any remaining old groups that were greater than all new keys. + // No incremental reduce is needed; these groups have no new records. + // Also record the new index of the old group. + while (i0 < k0) { + groups[reIndex[i0] = k] = oldGroups[i0++]; + groupIncrement(); + } + + // If we added any new groups before any old groups, + // update the group index of all the old records. + if (k > i0) for (i0 = 0; i0 < n0; ++i0) { + groupIndex[i0] = reIndex[groupIndex[i0]]; + } + + // Modify the update and reset behavior based on the cardinality. + // If the cardinality is less than or equal to one, then the groupIndex + // is not needed. If the cardinality is zero, then there are no records + // and therefore no groups to update or reset. Note that we also must + // change the registered listener to point to the new method. + j = filterListeners.indexOf(update); + if (k > 1) { + update = updateMany; + reset = resetMany; + } else { + if (k === 1) { + update = updateOne; + reset = resetOne; + } else { + update = crossfilter_null; + reset = crossfilter_null; + } + groupIndex = null; + } + filterListeners[j] = update; + + // Count the number of added groups, + // and widen the group index as needed. + function groupIncrement() { + if (++k === groupCapacity) { + reIndex = crossfilter_arrayWiden(reIndex, groupWidth <<= 1); + groupIndex = crossfilter_arrayWiden(groupIndex, groupWidth); + groupCapacity = crossfilter_capacity(groupWidth); + } + } + } + + // Reduces the specified selected or deselected records. + // This function is only used when the cardinality is greater than 1. + function updateMany(filterOne, added, removed) { + if (filterOne === one || resetNeeded) return; + + var i, + k, + n, + g; + + // Add the added values. + for (i = 0, n = added.length; i < n; ++i) { + if (!(filters[k = added[i]] & zero)) { + g = groups[groupIndex[k]]; + g.value = reduceAdd(g.value, data[k]); + } + } + + // Remove the removed values. + for (i = 0, n = removed.length; i < n; ++i) { + if ((filters[k = removed[i]] & zero) === filterOne) { + g = groups[groupIndex[k]]; + g.value = reduceRemove(g.value, data[k]); + } + } + } + + // Reduces the specified selected or deselected records. + // This function is only used when the cardinality is 1. + function updateOne(filterOne, added, removed) { + if (filterOne === one || resetNeeded) return; + + var i, + k, + n, + g = groups[0]; + + // Add the added values. + for (i = 0, n = added.length; i < n; ++i) { + if (!(filters[k = added[i]] & zero)) { + g.value = reduceAdd(g.value, data[k]); + } + } + + // Remove the removed values. + for (i = 0, n = removed.length; i < n; ++i) { + if ((filters[k = removed[i]] & zero) === filterOne) { + g.value = reduceRemove(g.value, data[k]); + } + } + } + + // Recomputes the group reduce values from scratch. + // This function is only used when the cardinality is greater than 1. + function resetMany() { + var i, + g; + + // Reset all group values. + for (i = 0; i < k; ++i) { + groups[i].value = reduceInitial(); + } + + // Add any selected records. + for (i = 0; i < n; ++i) { + if (!(filters[i] & zero)) { + g = groups[groupIndex[i]]; + g.value = reduceAdd(g.value, data[i]); + } + } + } + + // Recomputes the group reduce values from scratch. + // This function is only used when the cardinality is 1. + function resetOne() { + var i, + g = groups[0]; + + // Reset the singleton group values. + g.value = reduceInitial(); + + // Add any selected records. + for (i = 0; i < n; ++i) { + if (!(filters[i] & zero)) { + g.value = reduceAdd(g.value, data[i]); + } + } + } + + // Returns the array of group values, in the dimension's natural order. + function all() { + if (resetNeeded) reset(), resetNeeded = false; + return groups; + } + + // Returns a new array containing the top K group values, in reduce order. + function top(k) { + var top = select(all(), 0, groups.length, k); + return heap.sort(top, 0, top.length); + } + + // Sets the reduce behavior for this group to use the specified functions. + // This method lazily recomputes the reduce values, waiting until needed. + function reduce(add, remove, initial) { + reduceAdd = add; + reduceRemove = remove; + reduceInitial = initial; + resetNeeded = true; + return group; + } + + // A convenience method for reducing by count. + function reduceCount() { + return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero); + } + + // A convenience method for reducing by sum(value). + function reduceSum(value) { + return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero); + } + + // Sets the reduce order, using the specified accessor. + function order(value) { + select = heapselect_by(valueOf); + heap = heap_by(valueOf); + function valueOf(d) { return value(d.value); } + return group; + } + + // A convenience method for natural ordering by reduce value. + function orderNatural() { + return order(crossfilter_identity); + } + + // Returns the cardinality of this group, irrespective of any filters. + function size() { + return k; + } + + return reduceCount().orderNatural(); + } + + // A convenience function for generating a singleton group. + function groupAll() { + var g = group(crossfilter_null), all = g.all; + delete g.all; + delete g.top; + delete g.order; + delete g.orderNatural; + delete g.size; + g.value = function() { return all()[0].value; }; + return g; + } + + return dimension; + } + + // A convenience method for groupAll on a dummy dimension. + // This implementation can be optimized since it is always cardinality 1. + function groupAll() { + var group = { + reduce: reduce, + reduceCount: reduceCount, + reduceSum: reduceSum, + value: value + }; + + var reduceValue, + reduceAdd, + reduceRemove, + reduceInitial, + resetNeeded = true; + + // The group listens to the crossfilter for when any dimension changes, so + // that it can update the reduce value. It must also listen to the parent + // dimension for when data is added. + filterListeners.push(update); + dataListeners.push(add); + + // For consistency; actually a no-op since resetNeeded is true. + add(data, 0, n); + + // Incorporates the specified new values into this group. + function add(newData, n0, n1) { + var i; + + if (resetNeeded) return; + + // Add the added values. + for (i = n0; i < n; ++i) { + if (!filters[i]) { + reduceValue = reduceAdd(reduceValue, data[i]); + } + } + } + + // Reduces the specified selected or deselected records. + function update(filterOne, added, removed) { + var i, + k, + n; + + if (resetNeeded) return; + + // Add the added values. + for (i = 0, n = added.length; i < n; ++i) { + if (!filters[k = added[i]]) { + reduceValue = reduceAdd(reduceValue, data[k]); + } + } + + // Remove the removed values. + for (i = 0, n = removed.length; i < n; ++i) { + if (filters[k = removed[i]] === filterOne) { + reduceValue = reduceRemove(reduceValue, data[k]); + } + } + } + + // Recomputes the group reduce value from scratch. + function reset() { + var i; + + reduceValue = reduceInitial(); + + for (i = 0; i < n; ++i) { + if (!filters[i]) { + reduceValue = reduceAdd(reduceValue, data[i]); + } + } + } + + // Sets the reduce behavior for this group to use the specified functions. + // This method lazily recomputes the reduce value, waiting until needed. + function reduce(add, remove, initial) { + reduceAdd = add; + reduceRemove = remove; + reduceInitial = initial; + resetNeeded = true; + return group; + } + + // A convenience method for reducing by count. + function reduceCount() { + return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero); + } + + // A convenience method for reducing by sum(value). + function reduceSum(value) { + return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero); + } + + // Returns the computed reduce value. + function value() { + if (resetNeeded) reset(), resetNeeded = false; + return reduceValue; + } + + return reduceCount(); + } + + // Returns the number of records in this crossfilter, irrespective of any filters. + function size() { + return n; + } + + return arguments.length + ? add(arguments[0]) + : crossfilter; +} + +// Returns an array of size n, big enough to store ids up to m. +function crossfilter_index(n, m) { + return (m < 0x101 + ? crossfilter_array8 : m < 0x10001 + ? crossfilter_array16 + : crossfilter_array32)(n); +} + +// Constructs a new array of size n, with sequential values from 0 to n - 1. +function crossfilter_range(n) { + var range = crossfilter_index(n, n); + for (var i = -1; ++i < n;) range[i] = i; + return range; +} + +function crossfilter_capacity(w) { + return w === 8 + ? 0x100 : w === 16 + ? 0x10000 + : 0x100000000; +} +})(this); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/crossfilter.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/crossfilter.min.js new file mode 100644 index 0000000..981f0d6 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/crossfilter.min.js @@ -0,0 +1 @@ +(function(a){function b(a){return a}function c(a,b){for(var c=0,d=b.length,e=new Array(d);c>1;a(b[f])>1;c>>1)+1;while(--f>0)d(a,f,e,b);return a}function c(a,b,c){var e=c-b,f;while(--e>0)f=a[b],a[b]=a[b+e],a[b+e]=f,d(a,1,e,b);return a}function d(b,c,d,e){var f=b[--e+c],g=a(f),h;while((h=c<<1)<=d){ha(b[e+h+1])&&h++;if(g<=a(b[e+h]))break;b[e+c]=b[e+h],c=h}b[e+c]=f}return b.sort=c,b}function i(a){function c(c,d,e,f){var g=new Array(f=Math.min(e-d,f)),h,i,j,k;for(i=0;ih)g[0]=k,h=a(b(g,0,f)[0]);while(++dc&&a(b[f-1])>h;--f)b[f]=b[f-1];b[f]=g}return b}return b}function m(a){function c(a,c,e){return(e-c>1,j=i-f,k=i+f,l=b[g],m=a(l),n=b[j],o=a(n),p=b[i],q=a(p),r=b[k],s=a(r),t=b[h],u=a(t),v;m>o&&(v=l,l=n,n=v,v=m,m=o,o=v),s>u&&(v=r,r=t,t=v,v=s,s=u,u=v),m>q&&(v=l,l=p,p=v,v=m,m=q,q=v),o>q&&(v=n,n=p,p=v,v=o,o=q,q=v),m>s&&(v=l,l=r,r=v,v=m,m=s,s=v),q>s&&(v=p,p=r,r=v,v=q,q=s,s=v),o>u&&(v=n,n=t,t=v,v=o,o=u,u=v),o>q&&(v=n,n=p,p=v,v=o,o=q,q=v),s>u&&(v=r,r=t,t=v,v=s,s=u,u=v);var w=n,x=o,y=r,z=s;b[g]=l,b[j]=b[d],b[i]=p,b[k]=b[e-1],b[h]=t;var A=d+1,B=e-2,C=x<=z&&x>=z;if(C)for(var D=A;D<=B;++D){var E=b[D],F=a(E);if(Fx)for(;;){var G=a(b[B]);if(G>x){B--;continue}if(Gz)for(;;){var G=a(b[B]);if(G>z){B--;if(Bh){var H,G;while((H=a(b[A]))<=x&&H>=x)++A;while((G=a(b[B]))<=z&&G>=z)--B;for(var D=A;D<=B;D++){var E=b[D],F=a(E);if(F<=x&&F>=x)D!==A&&(b[D]=b[A],b[A]=E),A++;else if(F<=z&&F>=z)for(;;){var G=a(b[B]);if(G<=z&&G>=z){B--;if(BN)for(b=N,c=Math.min(e,O);bO)for(b=Math.max(e,O),c=f;b=N&&a>0)k[d=D[c]]||(b.push(e[d]),--a);return b}function X(a){function K(b,c,g,i){function Q(){++n===m&&(p=s(p,j<<=1),h=s(h,j),m=G(j))}var o=d,p=E(n,m),t=v,u=F,w=n,y=0,z=0,A,B,C,D,K,L;J&&(t=u=x),d=new Array(n),n=0,h=w>1?r(h,f):E(f,m),w&&(C=(B=o[0]).key);while(z=D))++z;while(zL)){h[A=c[z]+g]=n,k[A]&q||(K.value=t(K.value,e[A]));if(++z>=i)break;D=a(b[z])}Q()}while(yy)for(y=0;y1?(H=M,I=O):(n===1?(H=N,I=P):(H=x,I=x),h=null),l[A]=H}function M(a,b,c){if(a===p||J)return;var f,g,i,j;for(f=0,i=b.length;fj&&(k=s(k,j<<=1)),P(e,0,f),Q(e,0,f),o}function t(){function i(a,d,g){var i;if(h)return;for(i=d;imarching + * squares algorithm. Returns the contour polygon as an array of points. + * + * @param grid a two-input function(x, y) that returns true for values + * inside the contour and false for values outside the contour. + * @param start an optional starting point [x, y] on the grid. + * @returns polygon [[x1, y1], [x2, y2], …] + */ +d3.geom.contour = function(grid, start) { + var s = start || d3_geom_contourStart(grid), // starting point + c = [], // contour polygon + x = s[0], // current x position + y = s[1], // current y position + dx = 0, // next x direction + dy = 0, // next y direction + pdx = NaN, // previous x direction + pdy = NaN, // previous y direction + i = 0; + + do { + // determine marching squares index + i = 0; + if (grid(x-1, y-1)) i += 1; + if (grid(x, y-1)) i += 2; + if (grid(x-1, y )) i += 4; + if (grid(x, y )) i += 8; + + // determine next direction + if (i == 6) { + dx = pdy == -1 ? -1 : 1; + dy = 0; + } else if (i == 9) { + dx = 0; + dy = pdx == 1 ? -1 : 1; + } else { + dx = d3_geom_contourDx[i]; + dy = d3_geom_contourDy[i]; + } + + // update contour polygon + if (dx != pdx && dy != pdy) { + c.push([x, y]); + pdx = dx; + pdy = dy; + } + + x += dx; + y += dy; + } while (s[0] != x || s[1] != y); + + return c; +}; + +// lookup tables for marching directions +var d3_geom_contourDx = [1, 0, 1, 1,-1, 0,-1, 1,0, 0,0,0,-1, 0,-1,NaN], + d3_geom_contourDy = [0,-1, 0, 0, 0,-1, 0, 0,1,-1,1,1, 0,-1, 0,NaN]; + +function d3_geom_contourStart(grid) { + var x = 0, + y = 0; + + // search for a starting point; begin at origin + // and proceed along outward-expanding diagonals + while (true) { + if (grid(x,y)) { + return [x,y]; + } + if (x == 0) { + x = y + 1; + y = 0; + } else { + x = x - 1; + y = y + 1; + } + } +}/** + * Computes the 2D convex hull of a set of points using Graham's scanning + * algorithm. The algorithm has been implemented as described in Cormen, + * Leiserson, and Rivest's Introduction to Algorithms. The running time of + * this algorithm is O(n log n), where n is the number of input points. + * + * @param vertices [[x1, y1], [x2, y2], …] + * @returns polygon [[x1, y1], [x2, y2], …] + */ +d3.geom.hull = function(vertices) { + if (vertices.length < 3) return []; + + var len = vertices.length, + plen = len - 1, + points = [], + stack = [], + i, j, h = 0, x1, y1, x2, y2, u, v, a, sp; + + // find the starting ref point: leftmost point with the minimum y coord + for (i=1; i= (x2*x2 + y2*y2)) { + points[i].index = -1; + } else { + points[u].index = -1; + a = points[i].angle; + u = i; + v = j; + } + } else { + a = points[i].angle; + u = i; + v = j; + } + } + + // initialize the stack + stack.push(h); + for (i=0, j=0; i<2; ++j) { + if (points[j].index != -1) { + stack.push(points[j].index); + i++; + } + } + sp = stack.length; + + // do graham's scan + for (; j 0; +}// Note: requires coordinates to be counterclockwise and convex! +d3.geom.polygon = function(coordinates) { + + coordinates.area = function() { + var i = 0, + n = coordinates.length, + a = coordinates[n - 1][0] * coordinates[0][1], + b = coordinates[n - 1][1] * coordinates[0][0]; + while (++i < n) { + a += coordinates[i - 1][0] * coordinates[i][1]; + b += coordinates[i - 1][1] * coordinates[i][0]; + } + return (b - a) * .5; + }; + + coordinates.centroid = function(k) { + var i = -1, + n = coordinates.length - 1, + x = 0, + y = 0, + a, + b, + c; + if (!arguments.length) k = 1 / (6 * coordinates.area()); + while (++i < n) { + a = coordinates[i]; + b = coordinates[i + 1]; + c = a[0] * b[1] - b[0] * a[1]; + x += (a[0] + b[0]) * c; + y += (a[1] + b[1]) * c; + } + return [x * k, y * k]; + }; + + // The Sutherland-Hodgman clipping algorithm. + coordinates.clip = function(subject) { + var input, + i = -1, + n = coordinates.length, + j, + m, + a = coordinates[n - 1], + b, + c, + d; + while (++i < n) { + input = subject.slice(); + subject.length = 0; + b = coordinates[i]; + c = input[(m = input.length) - 1]; + j = -1; + while (++j < m) { + d = input[j]; + if (d3_geom_polygonInside(d, a, b)) { + if (!d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + subject.push(d); + } else if (d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + c = d; + } + a = b; + } + return subject; + }; + + return coordinates; +}; + +function d3_geom_polygonInside(p, a, b) { + return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]); +} + +// Intersect two infinite lines cd and ab. +function d3_geom_polygonIntersect(c, d, a, b) { + var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0], + y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1], + x13 = x1 - x3, + x21 = x2 - x1, + x43 = x4 - x3, + y13 = y1 - y3, + y21 = y2 - y1, + y43 = y4 - y3, + ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21); + return [x1 + ua * x21, y1 + ua * y21]; +} +// Adapted from Nicolas Garcia Belmonte's JIT implementation: +// http://blog.thejit.org/2010/02/12/voronoi-tessellation/ +// http://blog.thejit.org/assets/voronoijs/voronoi.js +// See lib/jit/LICENSE for details. + +/** + * @param vertices [[x1, y1], [x2, y2], …] + * @returns polygons [[[x1, y1], [x2, y2], …], …] + */ +d3.geom.voronoi = function(vertices) { + var polygons = vertices.map(function() { return []; }); + + // Note: we expect the caller to clip the polygons, if needed. + d3_voronoi_tessellate(vertices, function(e) { + var s1, + s2, + x1, + x2, + y1, + y2; + if (e.a == 1 && e.b >= 0) { + s1 = e.ep.r; + s2 = e.ep.l; + } else { + s1 = e.ep.l; + s2 = e.ep.r; + } + if (e.a == 1) { + y1 = s1 ? s1.y : -1e6; + x1 = e.c - e.b * y1; + y2 = s2 ? s2.y : 1e6; + x2 = e.c - e.b * y2; + } else { + x1 = s1 ? s1.x : -1e6; + y1 = e.c - e.a * x1; + x2 = s2 ? s2.x : 1e6; + y2 = e.c - e.a * x2; + } + var v1 = [x1, y1], + v2 = [x2, y2]; + polygons[e.region.l.index].push(v1, v2); + polygons[e.region.r.index].push(v1, v2); + }); + + // Reconnect the polygon segments into counterclockwise loops. + return polygons.map(function(polygon, i) { + var cx = vertices[i][0], + cy = vertices[i][1]; + polygon.forEach(function(v) { + v.angle = Math.atan2(v[0] - cx, v[1] - cy); + }); + return polygon.sort(function(a, b) { + return a.angle - b.angle; + }).filter(function(d, i) { + return !i || (d.angle - polygon[i - 1].angle > 1e-10); + }); + }); +}; + +var d3_voronoi_opposite = {"l": "r", "r": "l"}; + +function d3_voronoi_tessellate(vertices, callback) { + + var Sites = { + list: vertices + .map(function(v, i) { + return { + index: i, + x: v[0], + y: v[1] + }; + }) + .sort(function(a, b) { + return a.y < b.y ? -1 + : a.y > b.y ? 1 + : a.x < b.x ? -1 + : a.x > b.x ? 1 + : 0; + }), + bottomSite: null + }; + + var EdgeList = { + list: [], + leftEnd: null, + rightEnd: null, + + init: function() { + EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.leftEnd.r = EdgeList.rightEnd; + EdgeList.rightEnd.l = EdgeList.leftEnd; + EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd); + }, + + createHalfEdge: function(edge, side) { + return { + edge: edge, + side: side, + vertex: null, + "l": null, + "r": null + }; + }, + + insert: function(lb, he) { + he.l = lb; + he.r = lb.r; + lb.r.l = he; + lb.r = he; + }, + + leftBound: function(p) { + var he = EdgeList.leftEnd; + do { + he = he.r; + } while (he != EdgeList.rightEnd && Geom.rightOf(he, p)); + he = he.l; + return he; + }, + + del: function(he) { + he.l.r = he.r; + he.r.l = he.l; + he.edge = null; + }, + + right: function(he) { + return he.r; + }, + + left: function(he) { + return he.l; + }, + + leftRegion: function(he) { + return he.edge == null + ? Sites.bottomSite + : he.edge.region[he.side]; + }, + + rightRegion: function(he) { + return he.edge == null + ? Sites.bottomSite + : he.edge.region[d3_voronoi_opposite[he.side]]; + } + }; + + var Geom = { + + bisect: function(s1, s2) { + var newEdge = { + region: {"l": s1, "r": s2}, + ep: {"l": null, "r": null} + }; + + var dx = s2.x - s1.x, + dy = s2.y - s1.y, + adx = dx > 0 ? dx : -dx, + ady = dy > 0 ? dy : -dy; + + newEdge.c = s1.x * dx + s1.y * dy + + (dx * dx + dy * dy) * .5; + + if (adx > ady) { + newEdge.a = 1; + newEdge.b = dy / dx; + newEdge.c /= dx; + } else { + newEdge.b = 1; + newEdge.a = dx / dy; + newEdge.c /= dy; + } + + return newEdge; + }, + + intersect: function(el1, el2) { + var e1 = el1.edge, + e2 = el2.edge; + if (!e1 || !e2 || (e1.region.r == e2.region.r)) { + return null; + } + var d = (e1.a * e2.b) - (e1.b * e2.a); + if (Math.abs(d) < 1e-10) { + return null; + } + var xint = (e1.c * e2.b - e2.c * e1.b) / d, + yint = (e2.c * e1.a - e1.c * e2.a) / d, + e1r = e1.region.r, + e2r = e2.region.r, + el, + e; + if ((e1r.y < e2r.y) || + (e1r.y == e2r.y && e1r.x < e2r.x)) { + el = el1; + e = e1; + } else { + el = el2; + e = e2; + } + var rightOfSite = (xint >= e.region.r.x); + if ((rightOfSite && (el.side == "l")) || + (!rightOfSite && (el.side == "r"))) { + return null; + } + return { + x: xint, + y: yint + }; + }, + + rightOf: function(he, p) { + var e = he.edge, + topsite = e.region.r, + rightOfSite = (p.x > topsite.x); + + if (rightOfSite && (he.side == "l")) { + return 1; + } + if (!rightOfSite && (he.side == "r")) { + return 0; + } + if (e.a == 1) { + var dyp = p.y - topsite.y, + dxp = p.x - topsite.x, + fast = 0, + above = 0; + + if ((!rightOfSite && (e.b < 0)) || + (rightOfSite && (e.b >= 0))) { + above = fast = (dyp >= e.b * dxp); + } else { + above = ((p.x + p.y * e.b) > e.c); + if (e.b < 0) { + above = !above; + } + if (!above) { + fast = 1; + } + } + if (!fast) { + var dxs = topsite.x - e.region.l.x; + above = (e.b * (dxp * dxp - dyp * dyp)) < + (dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b)); + + if (e.b < 0) { + above = !above; + } + } + } else /* e.b == 1 */ { + var yl = e.c - e.a * p.x, + t1 = p.y - yl, + t2 = p.x - topsite.x, + t3 = yl - topsite.y; + + above = (t1 * t1) > (t2 * t2 + t3 * t3); + } + return he.side == "l" ? above : !above; + }, + + endPoint: function(edge, side, site) { + edge.ep[side] = site; + if (!edge.ep[d3_voronoi_opposite[side]]) return; + callback(edge); + }, + + distance: function(s, t) { + var dx = s.x - t.x, + dy = s.y - t.y; + return Math.sqrt(dx * dx + dy * dy); + } + }; + + var EventQueue = { + list: [], + + insert: function(he, site, offset) { + he.vertex = site; + he.ystar = site.y + offset; + for (var i=0, list=EventQueue.list, l=list.length; i next.ystar || + (he.ystar == next.ystar && + site.x > next.vertex.x)) { + continue; + } else { + break; + } + } + list.splice(i, 0, he); + }, + + del: function(he) { + for (var i=0, ls=EventQueue.list, l=ls.length; i top.y) { + temp = bot; + bot = top; + top = temp; + pm = "r"; + } + e = Geom.bisect(bot, top); + bisector = EdgeList.createHalfEdge(e, pm); + EdgeList.insert(llbnd, bisector); + Geom.endPoint(e, d3_voronoi_opposite[pm], v); + p = Geom.intersect(llbnd, bisector); + if (p) { + EventQueue.del(llbnd); + EventQueue.insert(llbnd, p, Geom.distance(p, bot)); + } + p = Geom.intersect(bisector, rrbnd); + if (p) { + EventQueue.insert(bisector, p, Geom.distance(p, bot)); + } + } else { + break; + } + }//end while + + for (lbnd = EdgeList.right(EdgeList.leftEnd); + lbnd != EdgeList.rightEnd; + lbnd = EdgeList.right(lbnd)) { + callback(lbnd.edge); + } +} +/** +* @param vertices [[x1, y1], [x2, y2], …] +* @returns triangles [[[x1, y1], [x2, y2], [x3, y3]], …] + */ +d3.geom.delaunay = function(vertices) { + var edges = vertices.map(function() { return []; }), + triangles = []; + + // Use the Voronoi tessellation to determine Delaunay edges. + d3_voronoi_tessellate(vertices, function(e) { + edges[e.region.l.index].push(vertices[e.region.r.index]); + }); + + // Reconnect the edges into counterclockwise triangles. + edges.forEach(function(edge, i) { + var v = vertices[i], + cx = v[0], + cy = v[1]; + edge.forEach(function(v) { + v.angle = Math.atan2(v[0] - cx, v[1] - cy); + }); + edge.sort(function(a, b) { + return a.angle - b.angle; + }); + for (var j = 0, m = edge.length - 1; j < m; j++) { + triangles.push([v, edge[j], edge[j + 1]]); + } + }); + + return triangles; +}; +/** + * Constructs a new quadtree for the specified array of points. A quadtree is a + * two-dimensional recursive spatial subdivision. This implementation uses + * square partitions, dividing each square into four equally-sized squares. Each + * point exists in a unique node; if multiple points are in the same position, + * some points may be stored on internal nodes rather than leaf nodes. Quadtrees + * can be used to accelerate various spatial operations, such as the Barnes-Hut + * approximation for computing n-body forces, or collision detection. + * + * @param points [[x1, y1], [x2, y2], …] + * @return quadtree root {left: boolean, nodes: […], point: [x, y]} + */ +d3.geom.quadtree = function(points) { + var p, + i = -1, + n = points.length; + + /* Compute bounds. */ + var x1 = Number.POSITIVE_INFINITY, y1 = x1, + x2 = Number.NEGATIVE_INFINITY, y2 = x2; + while (++i < n) { + p = points[i]; + if (p[0] < x1) x1 = p[0]; + if (p[1] < y1) y1 = p[1]; + if (p[0] > x2) x2 = p[0]; + if (p[1] > y2) y2 = p[1]; + } + + /* Squarify the bounds. */ + var dx = x2 - x1, + dy = y2 - y1; + if (dx > dy) y2 = y1 + dx; + else x2 = x1 + dy; + + /** + * @ignore Recursively inserts the specified point p at the node + * n or one of its descendants. The bounds are defined by [x1, + * x2] and [y1, y2]. + */ + function insert(n, p, x1, y1, x2, y2) { + if (isNaN(p[0]) || isNaN(p[1])) return; // ignore invalid points + if (n.leaf) { + var v = n.point; + if (v) { + /* + * If the point at this leaf node is at the same position as the new + * point we are adding, we leave the point associated with the + * internal node while adding the new point to a child node. This + * avoids infinite recursion. + */ + if ((Math.abs(v[0] - p[0]) + Math.abs(v[1] - p[1])) < .01) { + insertChild(n, p, x1, y1, x2, y2); + } else { + n.point = null; + insertChild(n, v, x1, y1, x2, y2); + insertChild(n, p, x1, y1, x2, y2); + } + } else { + n.point = p; + } + } else { + insertChild(n, p, x1, y1, x2, y2); + } + } + + /** + * @ignore Recursively inserts the specified point p into a + * descendant of node n. The bounds are defined by [x1, + * x2] and [y1, y2]. + */ + function insertChild(n, p, x1, y1, x2, y2) { + /* Compute the split point, and the quadrant in which to insert p. */ + var sx = (x1 + x2) * .5, + sy = (y1 + y2) * .5, + right = p[0] >= sx, + bottom = p[1] >= sy, + i = (bottom << 1) + right; + + /* Recursively insert into the child node. */ + n.leaf = false; + n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); + + /* Update the bounds as we recurse. */ + if (right) x1 = sx; else x2 = sx; + if (bottom) y1 = sy; else y2 = sy; + insert(n, p, x1, y1, x2, y2); + } + + /* Create the root node. */ + var root = d3_geom_quadtreeNode(); + + /* Insert all points. */ + i = -1; + while (++i < n) insert(root, points[i], x1, y1, x2, y2); + + /* Register a visitor function for the root. */ + root.visit = function(f) { + d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2); + }; + + return root; +}; + +function d3_geom_quadtreeNode() { + return { + leaf: true, + nodes: [], + point: null + }; +} + +function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { + if (!f(node, x1, y1, x2, y2)) { + var sx = (x1 + x2) * .5, + sy = (y1 + y2) * .5, + children = node.nodes; + if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); + if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); + if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); + if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); + } +} +})() \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.js new file mode 100644 index 0000000..7655eb7 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.js @@ -0,0 +1,5 @@ +!function(){function n(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function t(n){return null===n?0/0:+n}function e(n){return!isNaN(n)}function r(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function u(n){return n.length}function i(n){for(var t=1;n*t%1;)t*=10;return t}function o(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function a(){this._=Object.create(null)}function c(n){return(n+="")===da||n[0]===ma?ma+n:n}function l(n){return(n+="")[0]===ma?n.slice(1):n}function s(n){return c(n)in this._}function f(n){return(n=c(n))in this._&&delete this._[n]}function h(){var n=[];for(var t in this._)n.push(l(t));return n}function g(){var n=0;for(var t in this._)++n;return n}function p(){for(var n in this._)return!1;return!0}function v(){this._=Object.create(null)}function d(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function m(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e=0,r=ya.length;r>e;++e){var u=ya[e]+t;if(u in n)return u}}function y(){}function M(){}function x(n){function t(){for(var t,r=e,u=-1,i=r.length;++ue;e++)for(var u,i=n[e],o=0,a=i.length;a>o;o++)(u=i[o])&&t(u,o,e);return n}function O(n){return xa(n,Aa),n}function Y(n){var t,e;return function(r,u,i){var o,a=n[i].update,c=a.length;for(i!=e&&(e=i,t=0),u>=t&&(t=u+1);!(o=a[t])&&++t0&&(n=n.slice(0,a));var l=Ca.get(n);return l&&(n=l,c=X),a?t?u:r:t?y:i}function V(n,t){return function(e){var r=ta.event;ta.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{ta.event=r}}}function X(n,t){var e=V(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function $(){var n=".dragsuppress-"+ ++qa,t="click"+n,e=ta.select(oa).on("touchmove"+n,b).on("dragstart"+n,b).on("selectstart"+n,b);if(za){var r=ia.style,u=r[za];r[za]="none"}return function(i){if(e.on(n,null),za&&(r[za]=u),i){var o=function(){e.on(t,null)};e.on(t,function(){b(),o()},!0),setTimeout(o,0)}}}function B(n,t){t.changedTouches&&(t=t.changedTouches[0]);var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>La&&(oa.scrollX||oa.scrollY)){e=ta.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var u=e[0][0].getScreenCTM();La=!(u.f||u.e),e.remove()}return La?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(n.getScreenCTM().inverse()),[r.x,r.y]}var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}function W(){return ta.event.changedTouches[0].identifier}function J(){return ta.event.target}function G(){return oa}function K(n){return n>0?1:0>n?-1:0}function Q(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function nt(n){return n>1?0:-1>n?Da:Math.acos(n)}function tt(n){return n>1?ja:-1>n?-ja:Math.asin(n)}function et(n){return((n=Math.exp(n))-1/n)/2}function rt(n){return((n=Math.exp(n))+1/n)/2}function ut(n){return((n=Math.exp(2*n))-1)/(n+1)}function it(n){return(n=Math.sin(n/2))*n}function ot(){}function at(n,t,e){return this instanceof at?(this.h=+n,this.s=+t,void(this.l=+e)):arguments.length<2?n instanceof at?new at(n.h,n.s,n.l):bt(""+n,_t,at):new at(n,t,e)}function ct(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?i+(o-i)*n/60:180>n?o:240>n?i+(o-i)*(240-n)/60:i}function u(n){return Math.round(255*r(n))}var i,o;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,o=.5>=e?e*(1+t):e+t-e*t,i=2*e-o,new mt(u(n+120),u(n),u(n-120))}function lt(n,t,e){return this instanceof lt?(this.h=+n,this.c=+t,void(this.l=+e)):arguments.length<2?n instanceof lt?new lt(n.h,n.c,n.l):n instanceof ft?gt(n.l,n.a,n.b):gt((n=wt((n=ta.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new lt(n,t,e)}function st(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new ft(e,Math.cos(n*=Fa)*t,Math.sin(n)*t)}function ft(n,t,e){return this instanceof ft?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof ft?new ft(n.l,n.a,n.b):n instanceof lt?st(n.h,n.c,n.l):wt((n=mt(n)).r,n.g,n.b):new ft(n,t,e)}function ht(n,t,e){var r=(n+16)/116,u=r+t/500,i=r-e/200;return u=pt(u)*Ja,r=pt(r)*Ga,i=pt(i)*Ka,new mt(dt(3.2404542*u-1.5371385*r-.4985314*i),dt(-.969266*u+1.8760108*r+.041556*i),dt(.0556434*u-.2040259*r+1.0572252*i))}function gt(n,t,e){return n>0?new lt(Math.atan2(e,t)*Ha,Math.sqrt(t*t+e*e),n):new lt(0/0,0/0,n)}function pt(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function vt(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function dt(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function mt(n,t,e){return this instanceof mt?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof mt?new mt(n.r,n.g,n.b):bt(""+n,mt,ct):new mt(n,t,e)}function yt(n){return new mt(n>>16,255&n>>8,255&n)}function Mt(n){return yt(n)+""}function xt(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function bt(n,t,e){var r,u,i,o=0,a=0,c=0;if(r=/([a-z]+)\((.*)\)/i.exec(n))switch(u=r[2].split(","),r[1]){case"hsl":return e(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case"rgb":return t(kt(u[0]),kt(u[1]),kt(u[2]))}return(i=tc.get(n))?t(i.r,i.g,i.b):(null==n||"#"!==n.charAt(0)||isNaN(i=parseInt(n.slice(1),16))||(4===n.length?(o=(3840&i)>>4,o=o>>4|o,a=240&i,a=a>>4|a,c=15&i,c=c<<4|c):7===n.length&&(o=(16711680&i)>>16,a=(65280&i)>>8,c=255&i)),t(o,a,c))}function _t(n,t,e){var r,u,i=Math.min(n/=255,t/=255,e/=255),o=Math.max(n,t,e),a=o-i,c=(o+i)/2;return a?(u=.5>c?a/(o+i):a/(2-o-i),r=n==o?(t-e)/a+(e>t?6:0):t==o?(e-n)/a+2:(n-t)/a+4,r*=60):(r=0/0,u=c>0&&1>c?0:r),new at(r,u,c)}function wt(n,t,e){n=St(n),t=St(t),e=St(e);var r=vt((.4124564*n+.3575761*t+.1804375*e)/Ja),u=vt((.2126729*n+.7151522*t+.072175*e)/Ga),i=vt((.0193339*n+.119192*t+.9503041*e)/Ka);return ft(116*u-16,500*(r-u),200*(u-i))}function St(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function kt(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function Et(n){return"function"==typeof n?n:function(){return n}}function At(n){return n}function Nt(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),Ct(t,e,n,r)}}function Ct(n,t,e,r){function u(){var n,t=c.status;if(!t&&qt(c)||t>=200&&300>t||304===t){try{n=e.call(i,c)}catch(r){return o.error.call(i,r),void 0}o.load.call(i,n)}else o.error.call(i,c)}var i={},o=ta.dispatch("beforesend","progress","load","error"),a={},c=new XMLHttpRequest,l=null;return!oa.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(n)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=u:c.onreadystatechange=function(){c.readyState>3&&u()},c.onprogress=function(n){var t=ta.event;ta.event=n;try{o.progress.call(i,c)}finally{ta.event=t}},i.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",i)},i.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",i):t},i.responseType=function(n){return arguments.length?(l=n,i):l},i.response=function(n){return e=n,i},["get","post"].forEach(function(n){i[n]=function(){return i.send.apply(i,[n].concat(ra(arguments)))}}),i.send=function(e,r,u){if(2===arguments.length&&"function"==typeof r&&(u=r,r=null),c.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),c.setRequestHeader)for(var s in a)c.setRequestHeader(s,a[s]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=l&&(c.responseType=l),null!=u&&i.on("error",u).on("load",function(n){u(null,n)}),o.beforesend.call(i,c),c.send(null==r?null:r),i},i.abort=function(){return c.abort(),i},ta.rebind(i,o,"on"),null==r?i:i.get(zt(r))}function zt(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function qt(n){var t=n.responseType;return t&&"text"!==t?n.response:n.responseText}function Lt(){var n=Tt(),t=Rt()-n;t>24?(isFinite(t)&&(clearTimeout(ic),ic=setTimeout(Lt,t)),uc=0):(uc=1,ac(Lt))}function Tt(){var n=Date.now();for(oc=ec;oc;)n>=oc.t&&(oc.f=oc.c(n-oc.t)),oc=oc.n;return n}function Rt(){for(var n,t=ec,e=1/0;t;)t.f?t=n?n.n=t.n:ec=t.n:(t.t8?function(n){return n/e}:function(n){return n*e},symbol:n}}function Ut(n){var t=n.decimal,e=n.thousands,r=n.grouping,u=n.currency,i=r&&e?function(n,t){for(var u=n.length,i=[],o=0,a=r[0],c=0;u>0&&a>0&&(c+a+1>t&&(a=Math.max(1,t-c)),i.push(n.substring(u-=a,u+a)),!((c+=a+1)>t));)a=r[o=(o+1)%r.length];return i.reverse().join(e)}:At;return function(n){var e=lc.exec(n),r=e[1]||" ",o=e[2]||">",a=e[3]||"-",c=e[4]||"",l=e[5],s=+e[6],f=e[7],h=e[8],g=e[9],p=1,v="",d="",m=!1,y=!0;switch(h&&(h=+h.substring(1)),(l||"0"===r&&"="===o)&&(l=r="0",o="="),g){case"n":f=!0,g="g";break;case"%":p=100,d="%",g="f";break;case"p":p=100,d="%",g="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+g.toLowerCase());case"c":y=!1;case"d":m=!0,h=0;break;case"s":p=-1,g="r"}"$"===c&&(v=u[0],d=u[1]),"r"!=g||h||(g="g"),null!=h&&("g"==g?h=Math.max(1,Math.min(21,h)):("e"==g||"f"==g)&&(h=Math.max(0,Math.min(20,h)))),g=sc.get(g)||jt;var M=l&&f;return function(n){var e=d;if(m&&n%1)return"";var u=0>n||0===n&&0>1/n?(n=-n,"-"):"-"===a?"":a;if(0>p){var c=ta.formatPrefix(n,h);n=c.scale(n),e=c.symbol+d}else n*=p;n=g(n,h);var x,b,_=n.lastIndexOf(".");if(0>_){var w=y?n.lastIndexOf("e"):-1;0>w?(x=n,b=""):(x=n.substring(0,w),b=n.substring(w))}else x=n.substring(0,_),b=t+n.substring(_+1);!l&&f&&(x=i(x,1/0));var S=v.length+x.length+b.length+(M?0:u.length),k=s>S?new Array(S=s-S+1).join(r):"";return M&&(x=i(k+x,k.length?s-b.length:1/0)),u+=v,n=x+b,("<"===o?u+n+k:">"===o?k+u+n:"^"===o?k.substring(0,S>>=1)+u+n+k.substring(S):u+(M?n:k+n))+e}}}function jt(n){return n+""}function Ft(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ht(n,t,e){function r(t){var e=n(t),r=i(e,1);return r-t>t-e?e:r}function u(e){return t(e=n(new hc(e-1)),1),e}function i(n,e){return t(n=new hc(+n),e),n}function o(n,r,i){var o=u(n),a=[];if(i>1)for(;r>o;)e(o)%i||a.push(new Date(+o)),t(o,1);else for(;r>o;)a.push(new Date(+o)),t(o,1);return a}function a(n,t,e){try{hc=Ft;var r=new Ft;return r._=n,o(r,t,e)}finally{hc=Date}}n.floor=n,n.round=r,n.ceil=u,n.offset=i,n.range=o;var c=n.utc=Ot(n);return c.floor=c,c.round=Ot(r),c.ceil=Ot(u),c.offset=Ot(i),c.range=a,n}function Ot(n){return function(t,e){try{hc=Ft;var r=new Ft;return r._=t,n(r,e)._}finally{hc=Date}}}function Yt(n){function t(n){function t(t){for(var e,u,i,o=[],a=-1,c=0;++aa;){if(r>=l)return-1;if(u=t.charCodeAt(a++),37===u){if(o=t.charAt(a++),i=C[o in pc?t.charAt(a++):o],!i||(r=i(n,e,r))<0)return-1}else if(u!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){_.lastIndex=0;var r=_.exec(t.slice(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){x.lastIndex=0;var r=x.exec(t.slice(e));return r?(n.w=b.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){E.lastIndex=0;var r=E.exec(t.slice(e));return r?(n.m=A.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,e){S.lastIndex=0;var r=S.exec(t.slice(e));return r?(n.m=k.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,r){return e(n,N.c.toString(),t,r)}function c(n,t,r){return e(n,N.x.toString(),t,r)}function l(n,t,r){return e(n,N.X.toString(),t,r)}function s(n,t,e){var r=M.get(t.slice(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var f=n.dateTime,h=n.date,g=n.time,p=n.periods,v=n.days,d=n.shortDays,m=n.months,y=n.shortMonths;t.utc=function(n){function e(n){try{hc=Ft;var t=new hc;return t._=n,r(t)}finally{hc=Date}}var r=t(n);return e.parse=function(n){try{hc=Ft;var t=r.parse(n);return t&&t._}finally{hc=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=ce;var M=ta.map(),x=Zt(v),b=Vt(v),_=Zt(d),w=Vt(d),S=Zt(m),k=Vt(m),E=Zt(y),A=Vt(y);p.forEach(function(n,t){M.set(n.toLowerCase(),t)});var N={a:function(n){return d[n.getDay()]},A:function(n){return v[n.getDay()]},b:function(n){return y[n.getMonth()]},B:function(n){return m[n.getMonth()]},c:t(f),d:function(n,t){return It(n.getDate(),t,2)},e:function(n,t){return It(n.getDate(),t,2)},H:function(n,t){return It(n.getHours(),t,2)},I:function(n,t){return It(n.getHours()%12||12,t,2)},j:function(n,t){return It(1+fc.dayOfYear(n),t,3)},L:function(n,t){return It(n.getMilliseconds(),t,3)},m:function(n,t){return It(n.getMonth()+1,t,2)},M:function(n,t){return It(n.getMinutes(),t,2)},p:function(n){return p[+(n.getHours()>=12)]},S:function(n,t){return It(n.getSeconds(),t,2)},U:function(n,t){return It(fc.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return It(fc.mondayOfYear(n),t,2)},x:t(h),X:t(g),y:function(n,t){return It(n.getFullYear()%100,t,2)},Y:function(n,t){return It(n.getFullYear()%1e4,t,4)},Z:oe,"%":function(){return"%"}},C={a:r,A:u,b:i,B:o,c:a,d:ne,e:ne,H:ee,I:ee,j:te,L:ie,m:Qt,M:re,p:s,S:ue,U:$t,w:Xt,W:Bt,x:c,X:l,y:Jt,Y:Wt,Z:Gt,"%":ae};return t}function It(n,t,e){var r=0>n?"-":"",u=(r?-n:n)+"",i=u.length;return r+(e>i?new Array(e-i+1).join(t)+u:u)}function Zt(n){return new RegExp("^(?:"+n.map(ta.requote).join("|")+")","i")}function Vt(n){for(var t=new a,e=-1,r=n.length;++e68?1900:2e3)}function Qt(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function ne(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function te(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function ee(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function re(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function ue(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function ie(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function oe(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=0|va(t)/60,u=va(t)%60;return e+It(r,"0",2)+It(u,"0",2)}function ae(n,t,e){dc.lastIndex=0;var r=dc.exec(t.slice(e,e+1));return r?e+r[0].length:-1}function ce(n){for(var t=n.length,e=-1;++e=0?1:-1,a=o*e,c=Math.cos(t),l=Math.sin(t),s=i*l,f=u*c+s*Math.cos(a),h=s*o*Math.sin(a);_c.add(Math.atan2(h,f)),r=n,u=c,i=l}var t,e,r,u,i;wc.point=function(o,a){wc.point=n,r=(t=o)*Fa,u=Math.cos(a=(e=a)*Fa/2+Da/4),i=Math.sin(a)},wc.lineEnd=function(){n(t,e)}}function ve(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function de(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function me(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function ye(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function Me(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function xe(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function be(n){return[Math.atan2(n[1],n[0]),tt(n[2])]}function _e(n,t){return va(n[0]-t[0])a;++a)u.point((e=n[a])[0],e[1]);return u.lineEnd(),void 0}var c=new Le(e,n,null,!0),l=new Le(e,null,c,!1);c.o=l,i.push(c),o.push(l),c=new Le(r,n,null,!1),l=new Le(r,null,c,!0),c.o=l,i.push(c),o.push(l)}}),o.sort(t),qe(i),qe(o),i.length){for(var a=0,c=e,l=o.length;l>a;++a)o[a].e=c=!c;for(var s,f,h=i[0];;){for(var g=h,p=!0;g.v;)if((g=g.n)===h)return;s=g.z,u.lineStart();do{if(g.v=g.o.v=!0,g.e){if(p)for(var a=0,l=s.length;l>a;++a)u.point((f=s[a])[0],f[1]);else r(g.x,g.n.x,1,u);g=g.n}else{if(p){s=g.p.z;for(var a=s.length-1;a>=0;--a)u.point((f=s[a])[0],f[1])}else r(g.x,g.p.x,-1,u);g=g.p}g=g.o,s=g.z,p=!p}while(!g.v);u.lineEnd()}}}function qe(n){if(t=n.length){for(var t,e,r=0,u=n[0];++r0){for(b||(i.polygonStart(),b=!0),i.lineStart();++o1&&2&t&&e.push(e.pop().concat(e.shift())),g.push(e.filter(Re))}var g,p,v,d=t(i),m=u.invert(r[0],r[1]),y={point:o,lineStart:c,lineEnd:l,polygonStart:function(){y.point=s,y.lineStart=f,y.lineEnd=h,g=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=c,y.lineEnd=l,g=ta.merge(g);var n=He(m,p);g.length?(b||(i.polygonStart(),b=!0),ze(g,Pe,n,e,i)):n&&(b||(i.polygonStart(),b=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),b&&(i.polygonEnd(),b=!1),g=p=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}},M=De(),x=t(M),b=!1;return y}}function Re(n){return n.length>1}function De(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:y,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Pe(n,t){return((n=n.x)[0]<0?n[1]-ja-Ta:ja-n[1])-((t=t.x)[0]<0?t[1]-ja-Ta:ja-t[1])}function Ue(n){var t,e=0/0,r=0/0,u=0/0;return{lineStart:function(){n.lineStart(),t=1},point:function(i,o){var a=i>0?Da:-Da,c=va(i-e);va(c-Da)0?ja:-ja),n.point(u,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(i,r),t=0):u!==a&&c>=Da&&(va(e-u)Ta?Math.atan((Math.sin(t)*(i=Math.cos(r))*Math.sin(e)-Math.sin(r)*(u=Math.cos(t))*Math.sin(n))/(u*i*o)):(t+r)/2}function Fe(n,t,e,r){var u;if(null==n)u=e*ja,r.point(-Da,u),r.point(0,u),r.point(Da,u),r.point(Da,0),r.point(Da,-u),r.point(0,-u),r.point(-Da,-u),r.point(-Da,0),r.point(-Da,u);else if(va(n[0]-t[0])>Ta){var i=n[0]a;++a){var l=t[a],s=l.length;if(s)for(var f=l[0],h=f[0],g=f[1]/2+Da/4,p=Math.sin(g),v=Math.cos(g),d=1;;){d===s&&(d=0),n=l[d];var m=n[0],y=n[1]/2+Da/4,M=Math.sin(y),x=Math.cos(y),b=m-h,_=b>=0?1:-1,w=_*b,S=w>Da,k=p*M;if(_c.add(Math.atan2(k*_*Math.sin(w),v*x+k*Math.cos(w))),i+=S?b+_*Pa:b,S^h>=e^m>=e){var E=me(ve(f),ve(n));xe(E);var A=me(u,E);xe(A);var N=(S^b>=0?-1:1)*tt(A[2]);(r>N||r===N&&(E[0]||E[1]))&&(o+=S^b>=0?1:-1)}if(!d++)break;h=m,p=M,v=x,f=n}}return(-Ta>i||Ta>i&&0>_c)^1&o}function Oe(n){function t(n,t){return Math.cos(n)*Math.cos(t)>i}function e(n){var e,i,c,l,s;return{lineStart:function(){l=c=!1,s=1},point:function(f,h){var g,p=[f,h],v=t(f,h),d=o?v?0:u(f,h):v?u(f+(0>f?Da:-Da),h):0;if(!e&&(l=c=v)&&n.lineStart(),v!==c&&(g=r(e,p),(_e(e,g)||_e(p,g))&&(p[0]+=Ta,p[1]+=Ta,v=t(p[0],p[1]))),v!==c)s=0,v?(n.lineStart(),g=r(p,e),n.point(g[0],g[1])):(g=r(e,p),n.point(g[0],g[1]),n.lineEnd()),e=g;else if(a&&e&&o^v){var m;d&i||!(m=r(p,e,!0))||(s=0,o?(n.lineStart(),n.point(m[0][0],m[0][1]),n.point(m[1][0],m[1][1]),n.lineEnd()):(n.point(m[1][0],m[1][1]),n.lineEnd(),n.lineStart(),n.point(m[0][0],m[0][1])))}!v||e&&_e(e,p)||n.point(p[0],p[1]),e=p,c=v,i=d},lineEnd:function(){c&&n.lineEnd(),e=null},clean:function(){return s|(l&&c)<<1}}}function r(n,t,e){var r=ve(n),u=ve(t),o=[1,0,0],a=me(r,u),c=de(a,a),l=a[0],s=c-l*l;if(!s)return!e&&n;var f=i*c/s,h=-i*l/s,g=me(o,a),p=Me(o,f),v=Me(a,h);ye(p,v);var d=g,m=de(p,d),y=de(d,d),M=m*m-y*(de(p,p)-1);if(!(0>M)){var x=Math.sqrt(M),b=Me(d,(-m-x)/y);if(ye(b,p),b=be(b),!e)return b;var _,w=n[0],S=t[0],k=n[1],E=t[1];w>S&&(_=w,w=S,S=_);var A=S-w,N=va(A-Da)A;if(!N&&k>E&&(_=k,k=E,E=_),C?N?k+E>0^b[1]<(va(b[0]-w)Da^(w<=b[0]&&b[0]<=S)){var z=Me(d,(-m+x)/y);return ye(z,p),[b,be(z)]}}}function u(t,e){var r=o?n:Da-n,u=0;return-r>t?u|=1:t>r&&(u|=2),-r>e?u|=4:e>r&&(u|=8),u}var i=Math.cos(n),o=i>0,a=va(i)>Ta,c=pr(n,6*Fa);return Te(t,e,c,o?[0,-n]:[-Da,n-Da])}function Ye(n,t,e,r){return function(u){var i,o=u.a,a=u.b,c=o.x,l=o.y,s=a.x,f=a.y,h=0,g=1,p=s-c,v=f-l;if(i=n-c,p||!(i>0)){if(i/=p,0>p){if(h>i)return;g>i&&(g=i)}else if(p>0){if(i>g)return;i>h&&(h=i)}if(i=e-c,p||!(0>i)){if(i/=p,0>p){if(i>g)return;i>h&&(h=i)}else if(p>0){if(h>i)return;g>i&&(g=i)}if(i=t-l,v||!(i>0)){if(i/=v,0>v){if(h>i)return;g>i&&(g=i)}else if(v>0){if(i>g)return;i>h&&(h=i)}if(i=r-l,v||!(0>i)){if(i/=v,0>v){if(i>g)return;i>h&&(h=i)}else if(v>0){if(h>i)return;g>i&&(g=i)}return h>0&&(u.a={x:c+h*p,y:l+h*v}),1>g&&(u.b={x:c+g*p,y:l+g*v}),u}}}}}}function Ie(n,t,e,r){function u(r,u){return va(r[0]-n)0?0:3:va(r[0]-e)0?2:1:va(r[1]-t)0?1:0:u>0?3:2}function i(n,t){return o(n.x,t.x)}function o(n,t){var e=u(n,1),r=u(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(a){function c(n){for(var t=0,e=d.length,r=n[1],u=0;e>u;++u)for(var i,o=1,a=d[u],c=a.length,l=a[0];c>o;++o)i=a[o],l[1]<=r?i[1]>r&&Q(l,i,n)>0&&++t:i[1]<=r&&Q(l,i,n)<0&&--t,l=i;return 0!==t}function l(i,a,c,l){var s=0,f=0;if(null==i||(s=u(i,c))!==(f=u(a,c))||o(i,a)<0^c>0){do l.point(0===s||3===s?n:e,s>1?r:t);while((s=(s+c+4)%4)!==f)}else l.point(a[0],a[1])}function s(u,i){return u>=n&&e>=u&&i>=t&&r>=i}function f(n,t){s(n,t)&&a.point(n,t)}function h(){C.point=p,d&&d.push(m=[]),S=!0,w=!1,b=_=0/0}function g(){v&&(p(y,M),x&&w&&A.rejoin(),v.push(A.buffer())),C.point=f,w&&a.lineEnd()}function p(n,t){n=Math.max(-Uc,Math.min(Uc,n)),t=Math.max(-Uc,Math.min(Uc,t));var e=s(n,t);if(d&&m.push([n,t]),S)y=n,M=t,x=e,S=!1,e&&(a.lineStart(),a.point(n,t));else if(e&&w)a.point(n,t);else{var r={a:{x:b,y:_},b:{x:n,y:t}};N(r)?(w||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),k=!1):e&&(a.lineStart(),a.point(n,t),k=!1)}b=n,_=t,w=e}var v,d,m,y,M,x,b,_,w,S,k,E=a,A=De(),N=Ye(n,t,e,r),C={point:f,lineStart:h,lineEnd:g,polygonStart:function(){a=A,v=[],d=[],k=!0},polygonEnd:function(){a=E,v=ta.merge(v);var t=c([n,r]),e=k&&t,u=v.length;(e||u)&&(a.polygonStart(),e&&(a.lineStart(),l(null,null,1,a),a.lineEnd()),u&&ze(v,i,t,l,a),a.polygonEnd()),v=d=m=null}};return C}}function Ze(n){var t=0,e=Da/3,r=or(n),u=r(t,e);return u.parallels=function(n){return arguments.length?r(t=n[0]*Da/180,e=n[1]*Da/180):[180*(t/Da),180*(e/Da)]},u}function Ve(n,t){function e(n,t){var e=Math.sqrt(i-2*u*Math.sin(t))/u;return[e*Math.sin(n*=u),o-e*Math.cos(n)]}var r=Math.sin(n),u=(r+Math.sin(t))/2,i=1+r*(2*u-r),o=Math.sqrt(i)/u;return e.invert=function(n,t){var e=o-t;return[Math.atan2(n,e)/u,tt((i-(n*n+e*e)*u*u)/(2*u))]},e}function Xe(){function n(n,t){Fc+=u*n-r*t,r=n,u=t}var t,e,r,u;Zc.point=function(i,o){Zc.point=n,t=r=i,e=u=o},Zc.lineEnd=function(){n(t,e)}}function $e(n,t){Hc>n&&(Hc=n),n>Yc&&(Yc=n),Oc>t&&(Oc=t),t>Ic&&(Ic=t)}function Be(){function n(n,t){o.push("M",n,",",t,i)}function t(n,t){o.push("M",n,",",t),a.point=e}function e(n,t){o.push("L",n,",",t)}function r(){a.point=n}function u(){o.push("Z")}var i=We(4.5),o=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=u},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return i=We(n),a},result:function(){if(o.length){var n=o.join("");return o=[],n}}};return a}function We(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Je(n,t){Ec+=n,Ac+=t,++Nc}function Ge(){function n(n,r){var u=n-t,i=r-e,o=Math.sqrt(u*u+i*i);Cc+=o*(t+n)/2,zc+=o*(e+r)/2,qc+=o,Je(t=n,e=r)}var t,e;Xc.point=function(r,u){Xc.point=n,Je(t=r,e=u)}}function Ke(){Xc.point=Je}function Qe(){function n(n,t){var e=n-r,i=t-u,o=Math.sqrt(e*e+i*i);Cc+=o*(r+n)/2,zc+=o*(u+t)/2,qc+=o,o=u*n-r*t,Lc+=o*(r+n),Tc+=o*(u+t),Rc+=3*o,Je(r=n,u=t)}var t,e,r,u;Xc.point=function(i,o){Xc.point=n,Je(t=r=i,e=u=o)},Xc.lineEnd=function(){n(t,e)}}function nr(n){function t(t,e){n.moveTo(t+o,e),n.arc(t,e,o,0,Pa)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function u(){a.point=t}function i(){n.closePath()}var o=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:u,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=u,a.point=t},pointRadius:function(n){return o=n,a},result:y};return a}function tr(n){function t(n){return(a?r:e)(n)}function e(t){return ur(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){M=0/0,S.point=i,t.lineStart()}function i(e,r){var i=ve([e,r]),o=n(e,r);u(M,x,y,b,_,w,M=o[0],x=o[1],y=e,b=i[0],_=i[1],w=i[2],a,t),t.point(M,x)}function o(){S.point=e,t.lineEnd()}function c(){r(),S.point=l,S.lineEnd=s}function l(n,t){i(f=n,h=t),g=M,p=x,v=b,d=_,m=w,S.point=i}function s(){u(M,x,y,b,_,w,g,p,f,v,d,m,a,t),S.lineEnd=o,o()}var f,h,g,p,v,d,m,y,M,x,b,_,w,S={point:e,lineStart:r,lineEnd:o,polygonStart:function(){t.polygonStart(),S.lineStart=c},polygonEnd:function(){t.polygonEnd(),S.lineStart=r}};return S}function u(t,e,r,a,c,l,s,f,h,g,p,v,d,m){var y=s-t,M=f-e,x=y*y+M*M;if(x>4*i&&d--){var b=a+g,_=c+p,w=l+v,S=Math.sqrt(b*b+_*_+w*w),k=Math.asin(w/=S),E=va(va(w)-1)i||va((y*z+M*q)/x-.5)>.3||o>a*g+c*p+l*v)&&(u(t,e,r,a,c,l,N,C,E,b/=S,_/=S,w,d,m),m.point(N,C),u(N,C,E,b,_,w,s,f,h,g,p,v,d,m))}}var i=.5,o=Math.cos(30*Fa),a=16;return t.precision=function(n){return arguments.length?(a=(i=n*n)>0&&16,t):Math.sqrt(i)},t}function er(n){var t=tr(function(t,e){return n([t*Ha,e*Ha])});return function(n){return ar(t(n))}}function rr(n){this.stream=n}function ur(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function ir(n){return or(function(){return n})()}function or(n){function t(n){return n=a(n[0]*Fa,n[1]*Fa),[n[0]*h+c,l-n[1]*h]}function e(n){return n=a.invert((n[0]-c)/h,(l-n[1])/h),n&&[n[0]*Ha,n[1]*Ha]}function r(){a=Ne(o=sr(m,y,M),i);var n=i(v,d);return c=g-n[0]*h,l=p+n[1]*h,u()}function u(){return s&&(s.valid=!1,s=null),t}var i,o,a,c,l,s,f=tr(function(n,t){return n=i(n,t),[n[0]*h+c,l-n[1]*h]}),h=150,g=480,p=250,v=0,d=0,m=0,y=0,M=0,x=Pc,b=At,_=null,w=null;return t.stream=function(n){return s&&(s.valid=!1),s=ar(x(o,f(b(n)))),s.valid=!0,s},t.clipAngle=function(n){return arguments.length?(x=null==n?(_=n,Pc):Oe((_=+n)*Fa),u()):_},t.clipExtent=function(n){return arguments.length?(w=n,b=n?Ie(n[0][0],n[0][1],n[1][0],n[1][1]):At,u()):w},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(g=+n[0],p=+n[1],r()):[g,p]},t.center=function(n){return arguments.length?(v=n[0]%360*Fa,d=n[1]%360*Fa,r()):[v*Ha,d*Ha]},t.rotate=function(n){return arguments.length?(m=n[0]%360*Fa,y=n[1]%360*Fa,M=n.length>2?n[2]%360*Fa:0,r()):[m*Ha,y*Ha,M*Ha]},ta.rebind(t,f,"precision"),function(){return i=n.apply(this,arguments),t.invert=i.invert&&e,r()}}function ar(n){return ur(n,function(t,e){n.point(t*Fa,e*Fa)})}function cr(n,t){return[n,t]}function lr(n,t){return[n>Da?n-Pa:-Da>n?n+Pa:n,t]}function sr(n,t,e){return n?t||e?Ne(hr(n),gr(t,e)):hr(n):t||e?gr(t,e):lr}function fr(n){return function(t,e){return t+=n,[t>Da?t-Pa:-Da>t?t+Pa:t,e]}}function hr(n){var t=fr(n);return t.invert=fr(-n),t}function gr(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*r+a*u;return[Math.atan2(c*i-s*o,a*r-l*u),tt(s*i+c*o)]}var r=Math.cos(n),u=Math.sin(n),i=Math.cos(t),o=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*i-c*o;return[Math.atan2(c*i+l*o,a*r+s*u),tt(s*r-a*u)]},e}function pr(n,t){var e=Math.cos(n),r=Math.sin(n);return function(u,i,o,a){var c=o*t;null!=u?(u=vr(e,u),i=vr(e,i),(o>0?i>u:u>i)&&(u+=o*Pa)):(u=n+o*Pa,i=n-.5*c);for(var l,s=u;o>0?s>i:i>s;s-=c)a.point((l=be([e,-r*Math.cos(s),-r*Math.sin(s)]))[0],l[1])}}function vr(n,t){var e=ve(t);e[0]-=n,xe(e);var r=nt(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Ta)%(2*Math.PI)}function dr(n,t,e){var r=ta.range(n,t-Ta,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function mr(n,t,e){var r=ta.range(n,t-Ta,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function yr(n){return n.source}function Mr(n){return n.target}function xr(n,t,e,r){var u=Math.cos(t),i=Math.sin(t),o=Math.cos(r),a=Math.sin(r),c=u*Math.cos(n),l=u*Math.sin(n),s=o*Math.cos(e),f=o*Math.sin(e),h=2*Math.asin(Math.sqrt(it(r-t)+u*o*it(e-n))),g=1/Math.sin(h),p=h?function(n){var t=Math.sin(n*=h)*g,e=Math.sin(h-n)*g,r=e*c+t*s,u=e*l+t*f,o=e*i+t*a;return[Math.atan2(u,r)*Ha,Math.atan2(o,Math.sqrt(r*r+u*u))*Ha]}:function(){return[n*Ha,t*Ha]};return p.distance=h,p}function br(){function n(n,u){var i=Math.sin(u*=Fa),o=Math.cos(u),a=va((n*=Fa)-t),c=Math.cos(a);$c+=Math.atan2(Math.sqrt((a=o*Math.sin(a))*a+(a=r*i-e*o*c)*a),e*i+r*o*c),t=n,e=i,r=o}var t,e,r;Bc.point=function(u,i){t=u*Fa,e=Math.sin(i*=Fa),r=Math.cos(i),Bc.point=n},Bc.lineEnd=function(){Bc.point=Bc.lineEnd=y}}function _r(n,t){function e(t,e){var r=Math.cos(t),u=Math.cos(e),i=n(r*u);return[i*u*Math.sin(t),i*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),u=t(r),i=Math.sin(u),o=Math.cos(u);return[Math.atan2(n*i,r*o),Math.asin(r&&e*i/r)]},e}function wr(n,t){function e(n,t){o>0?-ja+Ta>t&&(t=-ja+Ta):t>ja-Ta&&(t=ja-Ta);var e=o/Math.pow(u(t),i);return[e*Math.sin(i*n),o-e*Math.cos(i*n)]}var r=Math.cos(n),u=function(n){return Math.tan(Da/4+n/2)},i=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(u(t)/u(n)),o=r*Math.pow(u(n),i)/i;return i?(e.invert=function(n,t){var e=o-t,r=K(i)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/i,2*Math.atan(Math.pow(o/r,1/i))-ja]},e):kr}function Sr(n,t){function e(n,t){var e=i-t;return[e*Math.sin(u*n),i-e*Math.cos(u*n)]}var r=Math.cos(n),u=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),i=r/u+n;return va(u)u;u++){for(;r>1&&Q(n[e[r-2]],n[e[r-1]],n[u])<=0;)--r;e[r++]=u}return e.slice(0,r)}function qr(n,t){return n[0]-t[0]||n[1]-t[1]}function Lr(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Tr(n,t,e,r){var u=n[0],i=e[0],o=t[0]-u,a=r[0]-i,c=n[1],l=e[1],s=t[1]-c,f=r[1]-l,h=(a*(c-l)-f*(u-i))/(f*o-a*s);return[u+h*o,c+h*s]}function Rr(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function Dr(){eu(this),this.edge=this.site=this.circle=null}function Pr(n){var t=ol.pop()||new Dr;return t.site=n,t}function Ur(n){$r(n),rl.remove(n),ol.push(n),eu(n)}function jr(n){var t=n.circle,e=t.x,r=t.cy,u={x:e,y:r},i=n.P,o=n.N,a=[n];Ur(n);for(var c=i;c.circle&&va(e-c.circle.x)s;++s)l=a[s],c=a[s-1],Qr(l.edge,c.site,l.site,u);c=a[0],l=a[f-1],l.edge=Gr(c.site,l.site,null,u),Xr(c),Xr(l)}function Fr(n){for(var t,e,r,u,i=n.x,o=n.y,a=rl._;a;)if(r=Hr(a,o)-i,r>Ta)a=a.L;else{if(u=i-Or(a,o),!(u>Ta)){r>-Ta?(t=a.P,e=a):u>-Ta?(t=a,e=a.N):t=e=a;break}if(!a.R){t=a;break}a=a.R}var c=Pr(n);if(rl.insert(t,c),t||e){if(t===e)return $r(t),e=Pr(t.site),rl.insert(c,e),c.edge=e.edge=Gr(t.site,c.site),Xr(t),Xr(e),void 0;if(!e)return c.edge=Gr(t.site,c.site),void 0;$r(t),$r(e);var l=t.site,s=l.x,f=l.y,h=n.x-s,g=n.y-f,p=e.site,v=p.x-s,d=p.y-f,m=2*(h*d-g*v),y=h*h+g*g,M=v*v+d*d,x={x:(d*y-g*M)/m+s,y:(h*M-v*y)/m+f};Qr(e.edge,l,p,x),c.edge=Gr(l,n,null,x),e.edge=Gr(n,p,null,x),Xr(t),Xr(e)}}function Hr(n,t){var e=n.site,r=e.x,u=e.y,i=u-t;if(!i)return r;var o=n.P;if(!o)return-1/0;e=o.site;var a=e.x,c=e.y,l=c-t;if(!l)return a;var s=a-r,f=1/i-1/l,h=s/l;return f?(-h+Math.sqrt(h*h-2*f*(s*s/(-2*l)-c+l/2+u-i/2)))/f+r:(r+a)/2}function Or(n,t){var e=n.N;if(e)return Hr(e,t);var r=n.site;return r.y===t?r.x:1/0}function Yr(n){this.site=n,this.edges=[]}function Ir(n){for(var t,e,r,u,i,o,a,c,l,s,f=n[0][0],h=n[1][0],g=n[0][1],p=n[1][1],v=el,d=v.length;d--;)if(i=v[d],i&&i.prepare())for(a=i.edges,c=a.length,o=0;c>o;)s=a[o].end(),r=s.x,u=s.y,l=a[++o%c].start(),t=l.x,e=l.y,(va(r-t)>Ta||va(u-e)>Ta)&&(a.splice(o,0,new nu(Kr(i.site,s,va(r-f)Ta?{x:f,y:va(t-f)Ta?{x:va(e-p)Ta?{x:h,y:va(t-h)Ta?{x:va(e-g)=-Ra)){var g=c*c+l*l,p=s*s+f*f,v=(f*g-l*p)/h,d=(c*p-s*g)/h,f=d+a,m=al.pop()||new Vr;m.arc=n,m.site=u,m.x=v+o,m.y=f+Math.sqrt(v*v+d*d),m.cy=f,n.circle=m;for(var y=null,M=il._;M;)if(m.yd||d>=a)return;if(h>p){if(i){if(i.y>=l)return}else i={x:d,y:c};e={x:d,y:l}}else{if(i){if(i.yr||r>1)if(h>p){if(i){if(i.y>=l)return}else i={x:(c-u)/r,y:c};e={x:(l-u)/r,y:l}}else{if(i){if(i.yg){if(i){if(i.x>=a)return}else i={x:o,y:r*o+u};e={x:a,y:r*a+u}}else{if(i){if(i.xi||f>o||r>h||u>g)){if(p=n.point){var p,v=t-p[0],d=e-p[1],m=v*v+d*d;if(c>m){var y=Math.sqrt(c=m);r=t-y,u=e-y,i=t+y,o=e+y,a=p}}for(var M=n.nodes,x=.5*(s+h),b=.5*(f+g),_=t>=x,w=e>=b,S=w<<1|_,k=S+4;k>S;++S)if(n=M[3&S])switch(3&S){case 0:l(n,s,f,x,b);break;case 1:l(n,x,f,h,b);break;case 2:l(n,s,b,x,g);break;case 3:l(n,x,b,h,g)}}}(n,r,u,i,o),a}function pu(n,t){n=ta.rgb(n),t=ta.rgb(t);var e=n.r,r=n.g,u=n.b,i=t.r-e,o=t.g-r,a=t.b-u;return function(n){return"#"+xt(Math.round(e+i*n))+xt(Math.round(r+o*n))+xt(Math.round(u+a*n))}}function vu(n,t){var e,r={},u={};for(e in n)e in t?r[e]=yu(n[e],t[e]):u[e]=n[e];for(e in t)e in n||(u[e]=t[e]);return function(n){for(e in r)u[e]=r[e](n);return u}}function du(n,t){return n=+n,t=+t,function(e){return n*(1-e)+t*e}}function mu(n,t){var e,r,u,i=ll.lastIndex=sl.lastIndex=0,o=-1,a=[],c=[];for(n+="",t+="";(e=ll.exec(n))&&(r=sl.exec(t));)(u=r.index)>i&&(u=t.slice(i,u),a[o]?a[o]+=u:a[++o]=u),(e=e[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,c.push({i:o,x:du(e,r)})),i=sl.lastIndex;return ir;++r)a[(e=c[r]).i]=e.x(n);return a.join("")})}function yu(n,t){for(var e,r=ta.interpolators.length;--r>=0&&!(e=ta.interpolators[r](n,t)););return e}function Mu(n,t){var e,r=[],u=[],i=n.length,o=t.length,a=Math.min(n.length,t.length);for(e=0;a>e;++e)r.push(yu(n[e],t[e]));for(;i>e;++e)u[e]=n[e];for(;o>e;++e)u[e]=t[e];return function(n){for(e=0;a>e;++e)u[e]=r[e](n);return u}}function xu(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function bu(n){return function(t){return 1-n(1-t)}}function _u(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function wu(n){return n*n}function Su(n){return n*n*n}function ku(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function Eu(n){return function(t){return Math.pow(t,n)}}function Au(n){return 1-Math.cos(n*ja)}function Nu(n){return Math.pow(2,10*(n-1))}function Cu(n){return 1-Math.sqrt(1-n*n)}function zu(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/Pa*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*Pa/t)}}function qu(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Lu(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Tu(n,t){n=ta.hcl(n),t=ta.hcl(t);var e=n.h,r=n.c,u=n.l,i=t.h-e,o=t.c-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.c:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return st(e+i*n,r+o*n,u+a*n)+""}}function Ru(n,t){n=ta.hsl(n),t=ta.hsl(t);var e=n.h,r=n.s,u=n.l,i=t.h-e,o=t.s-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.s:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return ct(e+i*n,r+o*n,u+a*n)+""}}function Du(n,t){n=ta.lab(n),t=ta.lab(t);var e=n.l,r=n.a,u=n.b,i=t.l-e,o=t.a-r,a=t.b-u;return function(n){return ht(e+i*n,r+o*n,u+a*n)+""}}function Pu(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Uu(n){var t=[n.a,n.b],e=[n.c,n.d],r=Fu(t),u=ju(t,e),i=Fu(Hu(e,t,-u))||0;t[0]*e[1]180?s+=360:s-l>180&&(l+=360),u.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:du(l,s)})):s&&r.push(r.pop()+"rotate("+s+")"),f!=h?u.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:du(f,h)}):h&&r.push(r.pop()+"skewX("+h+")"),g[0]!=p[0]||g[1]!=p[1]?(e=r.push(r.pop()+"scale(",null,",",null,")"),u.push({i:e-4,x:du(g[0],p[0])},{i:e-2,x:du(g[1],p[1])})):(1!=p[0]||1!=p[1])&&r.push(r.pop()+"scale("+p+")"),e=u.length,function(n){for(var t,i=-1;++i=0;)e.push(u[r])}function ni(n,t){for(var e=[n],r=[];null!=(n=e.pop());)if(r.push(n),(i=n.children)&&(u=i.length))for(var u,i,o=-1;++oe;++e)(t=n[e][1])>u&&(r=e,u=t);return r}function fi(n){return n.reduce(hi,0)}function hi(n,t){return n+t[1]}function gi(n,t){return pi(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function pi(n,t){for(var e=-1,r=+n[0],u=(n[1]-r)/t,i=[];++e<=t;)i[e]=u*e+r;return i}function vi(n){return[ta.min(n),ta.max(n)]}function di(n,t){return n.value-t.value}function mi(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function yi(n,t){n._pack_next=t,t._pack_prev=n}function Mi(n,t){var e=t.x-n.x,r=t.y-n.y,u=n.r+t.r;return.999*u*u>e*e+r*r}function xi(n){function t(n){s=Math.min(n.x-n.r,s),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),g=Math.max(n.y+n.r,g)}if((e=n.children)&&(l=e.length)){var e,r,u,i,o,a,c,l,s=1/0,f=-1/0,h=1/0,g=-1/0;if(e.forEach(bi),r=e[0],r.x=-r.r,r.y=0,t(r),l>1&&(u=e[1],u.x=u.r,u.y=0,t(u),l>2))for(i=e[2],Si(r,u,i),t(i),mi(r,i),r._pack_prev=i,mi(i,u),u=r._pack_next,o=3;l>o;o++){Si(r,u,i=e[o]);var p=0,v=1,d=1;for(a=u._pack_next;a!==u;a=a._pack_next,v++)if(Mi(a,i)){p=1;break}if(1==p)for(c=r._pack_prev;c!==a._pack_prev&&!Mi(c,i);c=c._pack_prev,d++);p?(d>v||v==d&&u.ro;o++)i=e[o],i.x-=m,i.y-=y,M=Math.max(M,i.r+Math.sqrt(i.x*i.x+i.y*i.y));n.r=M,e.forEach(_i)}}function bi(n){n._pack_next=n._pack_prev=n}function _i(n){delete n._pack_next,delete n._pack_prev}function wi(n,t,e,r){var u=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,u)for(var i=-1,o=u.length;++i=0;)t=u[i],t.z+=e,t.m+=e,e+=t.s+(r+=t.c)}function zi(n,t,e){return n.a.parent===t.parent?n.a:e}function qi(n){return 1+ta.max(n,function(n){return n.y})}function Li(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Ti(n){var t=n.children;return t&&t.length?Ti(t[0]):n}function Ri(n){var t,e=n.children;return e&&(t=e.length)?Ri(e[t-1]):n}function Di(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Pi(n,t){var e=n.x+t[3],r=n.y+t[0],u=n.dx-t[1]-t[3],i=n.dy-t[0]-t[2];return 0>u&&(e+=u/2,u=0),0>i&&(r+=i/2,i=0),{x:e,y:r,dx:u,dy:i}}function Ui(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function ji(n){return n.rangeExtent?n.rangeExtent():Ui(n.range())}function Fi(n,t,e,r){var u=e(n[0],n[1]),i=r(t[0],t[1]);return function(n){return i(u(n))}}function Hi(n,t){var e,r=0,u=n.length-1,i=n[r],o=n[u];return i>o&&(e=r,r=u,u=e,e=i,i=o,o=e),n[r]=t.floor(i),n[u]=t.ceil(o),n}function Oi(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:bl}function Yi(n,t,e,r){var u=[],i=[],o=0,a=Math.min(n.length,t.length)-1;for(n[a]2?Yi:Fi,c=r?Iu:Yu;return o=u(n,t,c,e),a=u(t,n,c,yu),i}function i(n){return o(n)}var o,a;return i.invert=function(n){return a(n)},i.domain=function(t){return arguments.length?(n=t.map(Number),u()):n},i.range=function(n){return arguments.length?(t=n,u()):t},i.rangeRound=function(n){return i.range(n).interpolate(Pu)},i.clamp=function(n){return arguments.length?(r=n,u()):r},i.interpolate=function(n){return arguments.length?(e=n,u()):e},i.ticks=function(t){return $i(n,t)},i.tickFormat=function(t,e){return Bi(n,t,e)},i.nice=function(t){return Vi(n,t),u()},i.copy=function(){return Ii(n,t,e,r)},u()}function Zi(n,t){return ta.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Vi(n,t){return Hi(n,Oi(Xi(n,t)[2]))}function Xi(n,t){null==t&&(t=10);var e=Ui(n),r=e[1]-e[0],u=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),i=t/r*u;return.15>=i?u*=10:.35>=i?u*=5:.75>=i&&(u*=2),e[0]=Math.ceil(e[0]/u)*u,e[1]=Math.floor(e[1]/u)*u+.5*u,e[2]=u,e}function $i(n,t){return ta.range.apply(ta,Xi(n,t))}function Bi(n,t,e){var r=Xi(n,t);if(e){var u=lc.exec(e);if(u.shift(),"s"===u[8]){var i=ta.formatPrefix(Math.max(va(r[0]),va(r[1])));return u[7]||(u[7]="."+Wi(i.scale(r[2]))),u[8]="f",e=ta.format(u.join("")),function(n){return e(i.scale(n))+i.symbol}}u[7]||(u[7]="."+Ji(u[8],r)),e=u.join("")}else e=",."+Wi(r[2])+"f";return ta.format(e)}function Wi(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function Ji(n,t){var e=Wi(t[2]);return n in _l?Math.abs(e-Wi(Math.max(va(t[0]),va(t[1]))))+ +("e"!==n):e-2*("%"===n)}function Gi(n,t,e,r){function u(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function i(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function o(t){return n(u(t))}return o.invert=function(t){return i(n.invert(t))},o.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(u)),o):r},o.base=function(e){return arguments.length?(t=+e,n.domain(r.map(u)),o):t},o.nice=function(){var t=Hi(r.map(u),e?Math:Sl);return n.domain(t),r=t.map(i),o},o.ticks=function(){var n=Ui(r),o=[],a=n[0],c=n[1],l=Math.floor(u(a)),s=Math.ceil(u(c)),f=t%1?2:t;if(isFinite(s-l)){if(e){for(;s>l;l++)for(var h=1;f>h;h++)o.push(i(l)*h);o.push(i(l))}else for(o.push(i(l));l++0;h--)o.push(i(l)*h);for(l=0;o[l]c;s--);o=o.slice(l,s)}return o},o.tickFormat=function(n,t){if(!arguments.length)return wl;arguments.length<2?t=wl:"function"!=typeof t&&(t=ta.format(t));var r,a=Math.max(.1,n/o.ticks().length),c=e?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(n){return n/i(c(u(n)+r))<=a?t(n):""}},o.copy=function(){return Gi(n.copy(),t,e,r)},Zi(o,n)}function Ki(n,t,e){function r(t){return n(u(t))}var u=Qi(t),i=Qi(1/t);return r.invert=function(t){return i(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(u)),r):e},r.ticks=function(n){return $i(e,n)},r.tickFormat=function(n,t){return Bi(e,n,t)},r.nice=function(n){return r.domain(Vi(e,n))},r.exponent=function(o){return arguments.length?(u=Qi(t=o),i=Qi(1/t),n.domain(e.map(u)),r):t},r.copy=function(){return Ki(n.copy(),t,e)},Zi(r,n)}function Qi(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function no(n,t){function e(e){return i[((u.get(e)||("range"===t.t?u.set(e,n.push(e)):0/0))-1)%i.length]}function r(t,e){return ta.range(n.length).map(function(n){return t+e*n})}var u,i,o;return e.domain=function(r){if(!arguments.length)return n;n=[],u=new a;for(var i,o=-1,c=r.length;++on?[0/0,0/0]:[n>0?a[n-1]:r[0],nt?0/0:t/i+n,[t,t+1/i]},r.copy=function(){return eo(n,t,e)},u()}function ro(n,t){function e(e){return e>=e?t[ta.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return ro(n,t)},e}function uo(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return $i(n,t)},t.tickFormat=function(t,e){return Bi(n,t,e)},t.copy=function(){return uo(n)},t}function io(){return 0}function oo(n){return n.innerRadius}function ao(n){return n.outerRadius}function co(n){return n.startAngle}function lo(n){return n.endAngle}function so(n){return n&&n.padAngle}function fo(n,t,e,r){return(n-e)*t-(t-r)*n>0?0:1}function ho(n,t,e,r,u){var i=n[0]-t[0],o=n[1]-t[1],a=(u?r:-r)/Math.sqrt(i*i+o*o),c=a*o,l=-a*i,s=n[0]+c,f=n[1]+l,h=t[0]+c,g=t[1]+l,p=(s+h)/2,v=(f+g)/2,d=h-s,m=g-f,y=d*d+m*m,M=e-r,x=s*g-h*f,b=(0>m?-1:1)*Math.sqrt(M*M*y-x*x),_=(x*m-d*b)/y,w=(-x*d-m*b)/y,S=(x*m+d*b)/y,k=(-x*d+m*b)/y,E=_-p,A=w-v,N=S-p,C=k-v;return E*E+A*A>N*N+C*C&&(_=S,w=k),[[_-c,w-l],[_*e/M,w*e/M]]}function go(n){function t(t){function o(){l.push("M",i(n(s),a))}for(var c,l=[],s=[],f=-1,h=t.length,g=Et(e),p=Et(r);++f1&&u.push("H",r[0]),u.join("")}function yo(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t1){a=t[1],i=n[c],c++,r+="C"+(u[0]+o[0])+","+(u[1]+o[1])+","+(i[0]-a[0])+","+(i[1]-a[1])+","+i[0]+","+i[1];for(var l=2;l9&&(u=3*t/Math.sqrt(u),o[a]=u*e,o[a+1]=u*r));for(a=-1;++a<=c;)u=(n[Math.min(c,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+o[a]*o[a])),i.push([u||0,o[a]*u||0]);return i}function Ro(n){return n.length<3?po(n):n[0]+wo(n,To(n))}function Do(n){for(var t,e,r,u=-1,i=n.length;++ur?s(!1):(i.active=r,o.event&&o.event.start.call(n,f,t),o.tween.forEach(function(e,r){(r=r.call(n,f,t))&&d.push(r)}),ta.timer(function(){return v.c=l(e||1)?Ce:l,1},0,c),void 0)}function l(t){if(i.active!==r)return s(!1);for(var e=t/p,u=h(e),o=d.length;o>0;)d[--o].call(n,u);return e>=1?s(!0):void 0}function s(u){return o.event&&o.event[u?"end":"interrupt"].call(n,f,t),--i.count?delete i[r]:delete n[e],1}var f=n.__data__,h=o.ease,g=o.delay,p=o.duration,v=oc,d=[];return v.t=g+c,u>=g?a(u-g):(v.c=a,void 0)},0,c)}}function Bo(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate("+(isFinite(r)?r:e(n))+",0)"})}function Wo(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate(0,"+(isFinite(r)?r:e(n))+")"})}function Jo(n){return n.toISOString()}function Go(n,t,e){function r(t){return n(t)}function u(n,e){var r=n[1]-n[0],u=r/e,i=ta.bisect(Bl,u);return i==Bl.length?[t.year,Xi(n.map(function(n){return n/31536e6}),e)[2]]:i?t[u/Bl[i-1]1?{floor:function(t){for(;e(t=n.floor(t));)t=Ko(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=Ko(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Ui(r.domain()),i=null==n?u(e,10):"number"==typeof n?u(e,n):!n.range&&[{range:n},t];return i&&(n=i[0],t=i[1]),n.range(e[0],Ko(+e[1]+1),1>t?1:t)},r.tickFormat=function(){return e},r.copy=function(){return Go(n.copy(),t,e)},Zi(r,n)}function Ko(n){return new Date(n)}function Qo(n){return JSON.parse(n.responseText)}function na(n){var t=ua.createRange();return t.selectNode(ua.body),t.createContextualFragment(n.responseText)}var ta={version:"3.5.0pre"};Date.now||(Date.now=function(){return+new Date});var ea=[].slice,ra=function(n){return ea.call(n)},ua=document,ia=ua.documentElement,oa=window;try{ra(ia.childNodes)[0].nodeType}catch(aa){ra=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}try{ua.createElement("div").style.setProperty("opacity",0,"")}catch(ca){var la=oa.Element.prototype,sa=la.setAttribute,fa=la.setAttributeNS,ha=oa.CSSStyleDeclaration.prototype,ga=ha.setProperty;la.setAttribute=function(n,t){sa.call(this,n,t+"")},la.setAttributeNS=function(n,t,e){fa.call(this,n,t,e+"")},ha.setProperty=function(n,t,e){ga.call(this,n,t+"",e)}}ta.ascending=n,ta.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:0/0},ta.min=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u=r){e=r;break}for(;++ur&&(e=r)}else{for(;++u=r){e=r;break}for(;++ur&&(e=r)}return e},ta.max=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u=r){e=r;break}for(;++ue&&(e=r)}else{for(;++u=r){e=r;break}for(;++ue&&(e=r)}return e},ta.extent=function(n,t){var e,r,u,i=-1,o=n.length;if(1===arguments.length){for(;++i=r){e=u=r;break}for(;++ir&&(e=r),r>u&&(u=r))}else{for(;++i=r){e=u=r;break}for(;++ir&&(e=r),r>u&&(u=r))}return[e,u]},ta.sum=function(n,t){var r,u=0,i=n.length,o=-1;if(1===arguments.length)for(;++oi&&(t=0));for(var r,u,i=e-t;i;)u=0|Math.random()*i--,r=n[i+t],n[i+t]=n[u+t],n[u+t]=r;return n},ta.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},ta.pairs=function(n){for(var t,e=0,r=n.length-1,u=n[0],i=new Array(0>r?0:r);r>e;)i[e]=[t=u,u=n[++e]];return i},ta.zip=function(){if(!(r=arguments.length))return[];for(var n=-1,t=ta.min(arguments,u),e=new Array(t);++n=0;)for(r=n[u],t=r.length;--t>=0;)e[--o]=r[t];return e};var va=Math.abs;ta.range=function(n,t,e){if(arguments.length<3&&(e=1,arguments.length<2&&(t=n,n=0)),1/0===(t-n)/e)throw new Error("infinite range");var r,u=[],o=i(va(e)),a=-1;if(n*=o,t*=o,e*=o,0>e)for(;(r=n+e*++a)>t;)u.push(r/o);else for(;(r=n+e*++a)=i.length)return r?r.call(u,o):e?o.sort(e):o;for(var l,s,f,h,g=-1,p=o.length,v=i[c++],d=new a;++g=i.length)return n;var r=[],u=o[e++];return n.forEach(function(n,u){r.push({key:n,values:t(u,e)})}),u?r.sort(function(n,t){return u(n.key,t.key)}):r}var e,r,u={},i=[],o=[];return u.map=function(t,e){return n(e,t,0)},u.entries=function(e){return t(n(ta.map,e,0),0)},u.key=function(n){return i.push(n),u},u.sortKeys=function(n){return o[i.length-1]=n,u},u.sortValues=function(n){return e=n,u},u.rollup=function(n){return r=n,u},u},ta.set=function(n){var t=new v;if(n)for(var e=0,r=n.length;r>e;++e)t.add(n[e]);return t},o(v,{has:s,add:function(n){return this._[c(n+="")]=!0,n},remove:f,values:h,size:g,empty:p,forEach:function(n){for(var t in this._)n.call(this,l(t))}}),ta.behavior={},ta.rebind=function(n,t){for(var e,r=1,u=arguments.length;++r=0&&(r=n.slice(e+1),n=n.slice(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},ta.event=null,ta.requote=function(n){return n.replace(Ma,"\\$&")};var Ma=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,xa={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},ba=function(n,t){return t.querySelector(n)},_a=function(n,t){return t.querySelectorAll(n)},wa=ia.matches||ia[m(ia,"matchesSelector")],Sa=function(n,t){return wa.call(n,t)};"function"==typeof Sizzle&&(ba=function(n,t){return Sizzle(n,t)[0]||null},_a=Sizzle,Sa=Sizzle.matchesSelector),ta.selection=function(){return Na};var ka=ta.selection.prototype=[];ka.select=function(n){var t,e,r,u,i=[];n=k(n);for(var o=-1,a=this.length;++o=0&&(e=n.slice(0,t),n=n.slice(t+1)),Ea.hasOwnProperty(e)?{space:Ea[e],local:n}:n}},ka.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=ta.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(A(t,n[t]));return this}return this.each(A(n,t))},ka.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=z(n)).length,u=-1;if(t=e.classList){for(;++ur){if("string"!=typeof n){2>r&&(t="");for(e in n)this.each(T(e,n[e],t));return this}if(2>r)return oa.getComputedStyle(this.node(),null).getPropertyValue(n);e=""}return this.each(T(n,t,e))},ka.property=function(n,t){if(arguments.length<2){if("string"==typeof n)return this.node()[n];for(t in n)this.each(R(t,n[t]));return this}return this.each(R(n,t))},ka.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},ka.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},ka.append=function(n){return n=D(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},ka.insert=function(n,t){return n=D(n),t=k(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments)||null)})},ka.remove=function(){return this.each(P)},ka.data=function(n,t){function e(n,e){var r,u,i,o=n.length,f=e.length,h=Math.min(o,f),g=new Array(f),p=new Array(f),v=new Array(o);if(t){var d,m=new a,y=new Array(o);for(r=-1;++rr;++r)p[r]=U(e[r]);for(;o>r;++r)v[r]=n[r]}p.update=g,p.parentNode=g.parentNode=v.parentNode=n.parentNode,c.push(p),l.push(g),s.push(v)}var r,u,i=-1,o=this.length;if(!arguments.length){for(n=new Array(o=(r=this[0]).length);++ii;i++){u.push(t=[]),t.parentNode=(e=this[i]).parentNode;for(var a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return S(u)},ka.order=function(){for(var n=-1,t=this.length;++n=0;)(e=r[u])&&(i&&i!==e.nextSibling&&i.parentNode.insertBefore(e,i),i=e);return this},ka.sort=function(n){n=F.apply(this,arguments);for(var t=-1,e=this.length;++tn;n++)for(var e=this[n],r=0,u=e.length;u>r;r++){var i=e[r];if(i)return i}return null},ka.size=function(){var n=0;return H(this,function(){++n}),n};var Aa=[];ta.selection.enter=O,ta.selection.enter.prototype=Aa,Aa.append=ka.append,Aa.empty=ka.empty,Aa.node=ka.node,Aa.call=ka.call,Aa.size=ka.size,Aa.select=function(n){for(var t,e,r,u,i,o=[],a=-1,c=this.length;++ar){if("string"!=typeof n){2>r&&(t=!1);for(e in n)this.each(Z(e,n[e],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;e=!1}return this.each(Z(n,t,e))};var Ca=ta.map({mouseenter:"mouseover",mouseleave:"mouseout"});Ca.forEach(function(n){"on"+n in ua&&Ca.remove(n)});var za="onselectstart"in ua?null:m(ia.style,"userSelect"),qa=0;ta.mouse=function(n){return B(n,_())};var La=/WebKit/.test(oa.navigator.userAgent)?-1:0;ta.touch=function(n,t,e){if(arguments.length<3&&(e=t,t=_().changedTouches),t)for(var r,u=0,i=t.length;i>u;++u)if((r=t[u]).identifier===e)return B(n,r)},ta.behavior.drag=function(){function n(){this.on("mousedown.drag",u).on("touchstart.drag",i)}function t(n,t,u,i,o){return function(){function a(){var n,e,r=t(h,v);r&&(n=r[0]-M[0],e=r[1]-M[1],p|=n|e,M=r,g({type:"drag",x:r[0]+l[0],y:r[1]+l[1],dx:n,dy:e}))}function c(){t(h,v)&&(m.on(i+d,null).on(o+d,null),y(p&&ta.event.target===f),g({type:"dragend"}))}var l,s=this,f=ta.event.target,h=s.parentNode,g=e.of(s,arguments),p=0,v=n(),d=".drag"+(null==v?"":"-"+v),m=ta.select(u()).on(i+d,a).on(o+d,c),y=$(),M=t(h,v);r?(l=r.apply(s,arguments),l=[l.x-M[0],l.y-M[1]]):l=[0,0],g({type:"dragstart"})}}var e=w(n,"drag","dragstart","dragend"),r=null,u=t(y,ta.mouse,G,"mousemove","mouseup"),i=t(W,ta.touch,J,"touchmove","touchend");return n.origin=function(t){return arguments.length?(r=t,n):r},ta.rebind(n,e,"on")},ta.touches=function(n,t){return arguments.length<2&&(t=_().touches),t?ra(t).map(function(t){var e=B(n,t);return e.identifier=t.identifier,e}):[]};var Ta=1e-6,Ra=Ta*Ta,Da=Math.PI,Pa=2*Da,Ua=Pa-Ta,ja=Da/2,Fa=Da/180,Ha=180/Da,Oa=Math.SQRT2,Ya=2,Ia=4;ta.interpolateZoom=function(n,t){function e(n){var t=n*y;if(m){var e=rt(v),o=i/(Ya*h)*(e*ut(Oa*t+v)-et(v));return[r+o*l,u+o*s,i*e/rt(Oa*t+v)]}return[r+n*l,u+n*s,i*Math.exp(Oa*t)]}var r=n[0],u=n[1],i=n[2],o=t[0],a=t[1],c=t[2],l=o-r,s=a-u,f=l*l+s*s,h=Math.sqrt(f),g=(c*c-i*i+Ia*f)/(2*i*Ya*h),p=(c*c-i*i-Ia*f)/(2*c*Ya*h),v=Math.log(Math.sqrt(g*g+1)-g),d=Math.log(Math.sqrt(p*p+1)-p),m=d-v,y=(m||Math.log(c/i))/Oa;return e.duration=1e3*y,e},ta.behavior.zoom=function(){function n(n){n.on(C,s).on(Xa+".zoom",h).on("dblclick.zoom",g).on(L,f)}function t(n){return[(n[0]-k.x)/k.k,(n[1]-k.y)/k.k]}function e(n){return[n[0]*k.k+k.x,n[1]*k.k+k.y]}function r(n){k.k=Math.max(A[0],Math.min(A[1],n))}function u(n,t){t=e(t),k.x+=n[0]-t[0],k.y+=n[1]-t[1]}function i(t,e,i,o){t.__chart__={x:k.x,y:k.y,k:k.k},r(Math.pow(2,o)),u(v=e,i),ta.select(t).transition().duration(350).call(n.event)}function o(){x&&x.domain(M.range().map(function(n){return(n-k.x)/k.k}).map(M.invert)),S&&S.domain(_.range().map(function(n){return(n-k.y)/k.k}).map(_.invert))}function a(n){N++||n({type:"zoomstart"})}function c(n){o(),n({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function l(n){--N||n({type:"zoomend"}),v=null}function s(){function n(){s=1,u(ta.mouse(r),h),c(o)}function e(){f.on(z,null).on(q,null),g(s&&ta.event.target===i),l(o)}var r=this,i=ta.event.target,o=T.of(r,arguments),s=0,f=ta.select(oa).on(z,n).on(q,e),h=t(ta.mouse(r)),g=$();I(r),a(o)}function f(){function n(){var n=ta.touches(p);return g=k.k,n.forEach(function(n){n.identifier in d&&(d[n.identifier]=t(n))}),n}function e(){var t=ta.event.target;ta.select(t).on(x,o).on(_,h),w.push(t);for(var e=ta.event.changedTouches,r=0,u=e.length;u>r;++r)d[e[r].identifier]=null;var a=n(),c=Date.now();if(1===a.length){if(500>c-y){var l=a[0];i(p,l,d[l.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),b()}y=c}else if(a.length>1){var l=a[0],s=a[1],f=l[0]-s[0],g=l[1]-s[1];m=f*f+g*g}}function o(){var n,t,e,i,o=ta.touches(p);I(p);for(var a=0,l=o.length;l>a;++a,i=null)if(e=o[a],i=d[e.identifier]){if(t)break;n=e,t=i}if(i){var s=(s=e[0]-n[0])*s+(s=e[1]-n[1])*s,f=m&&Math.sqrt(s/m);n=[(n[0]+e[0])/2,(n[1]+e[1])/2],t=[(t[0]+i[0])/2,(t[1]+i[1])/2],r(f*g)}y=null,u(n,t),c(v)}function h(){if(ta.event.touches.length){for(var t=ta.event.changedTouches,e=0,r=t.length;r>e;++e)delete d[t[e].identifier];for(var u in d)return void n()}ta.selectAll(w).on(M,null),S.on(C,s).on(L,f),E(),l(v)}var g,p=this,v=T.of(p,arguments),d={},m=0,M=".zoom-"+ta.event.changedTouches[0].identifier,x="touchmove"+M,_="touchend"+M,w=[],S=ta.select(p),E=$();e(),a(v),S.on(C,null).on(L,e)}function h(){var n=T.of(this,arguments);m?clearTimeout(m):(p=t(v=d||ta.mouse(this)),I(this),a(n)),m=setTimeout(function(){m=null,l(n)},50),b(),r(Math.pow(2,.002*Za())*k.k),u(v,p),c(n)}function g(){var n=ta.mouse(this),e=Math.log(k.k)/Math.LN2;i(this,n,t(n),ta.event.shiftKey?Math.ceil(e)-1:Math.floor(e)+1)}var p,v,d,m,y,M,x,_,S,k={x:0,y:0,k:1},E=[960,500],A=Va,N=0,C="mousedown.zoom",z="mousemove.zoom",q="mouseup.zoom",L="touchstart.zoom",T=w(n,"zoomstart","zoom","zoomend");return n.event=function(n){n.each(function(){var n=T.of(this,arguments),t=k;Dl?ta.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},a(n)}).tween("zoom:zoom",function(){var e=E[0],r=E[1],u=v?v[0]:e/2,i=v?v[1]:r/2,o=ta.interpolateZoom([(u-k.x)/k.k,(i-k.y)/k.k,e/k.k],[(u-t.x)/t.k,(i-t.y)/t.k,e/t.k]);return function(t){var r=o(t),a=e/r[2];this.__chart__=k={x:u-r[0]*a,y:i-r[1]*a,k:a},c(n)}}).each("interrupt.zoom",function(){l(n)}).each("end.zoom",function(){l(n)}):(this.__chart__=k,a(n),c(n),l(n))})},n.translate=function(t){return arguments.length?(k={x:+t[0],y:+t[1],k:k.k},o(),n):[k.x,k.y]},n.scale=function(t){return arguments.length?(k={x:k.x,y:k.y,k:+t},o(),n):k.k},n.scaleExtent=function(t){return arguments.length?(A=null==t?Va:[+t[0],+t[1]],n):A},n.center=function(t){return arguments.length?(d=t&&[+t[0],+t[1]],n):d},n.size=function(t){return arguments.length?(E=t&&[+t[0],+t[1]],n):E},n.x=function(t){return arguments.length?(x=t,M=t.copy(),k={x:0,y:0,k:1},n):x},n.y=function(t){return arguments.length?(S=t,_=t.copy(),k={x:0,y:0,k:1},n):S},ta.rebind(n,T,"on")};var Za,Va=[0,1/0],Xa="onwheel"in ua?(Za=function(){return-ta.event.deltaY*(ta.event.deltaMode?120:1)},"wheel"):"onmousewheel"in ua?(Za=function(){return ta.event.wheelDelta},"mousewheel"):(Za=function(){return-ta.event.detail},"MozMousePixelScroll");ta.color=ot,ot.prototype.toString=function(){return this.rgb()+""},ta.hsl=at;var $a=at.prototype=new ot;$a.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),new at(this.h,this.s,this.l/n)},$a.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new at(this.h,this.s,n*this.l)},$a.rgb=function(){return ct(this.h,this.s,this.l)},ta.hcl=lt;var Ba=lt.prototype=new ot;Ba.brighter=function(n){return new lt(this.h,this.c,Math.min(100,this.l+Wa*(arguments.length?n:1)))},Ba.darker=function(n){return new lt(this.h,this.c,Math.max(0,this.l-Wa*(arguments.length?n:1)))},Ba.rgb=function(){return st(this.h,this.c,this.l).rgb()},ta.lab=ft;var Wa=18,Ja=.95047,Ga=1,Ka=1.08883,Qa=ft.prototype=new ot;Qa.brighter=function(n){return new ft(Math.min(100,this.l+Wa*(arguments.length?n:1)),this.a,this.b)},Qa.darker=function(n){return new ft(Math.max(0,this.l-Wa*(arguments.length?n:1)),this.a,this.b)},Qa.rgb=function(){return ht(this.l,this.a,this.b)},ta.rgb=mt;var nc=mt.prototype=new ot;nc.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,u=30;return t||e||r?(t&&u>t&&(t=u),e&&u>e&&(e=u),r&&u>r&&(r=u),new mt(Math.min(255,t/n),Math.min(255,e/n),Math.min(255,r/n))):new mt(u,u,u)},nc.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new mt(n*this.r,n*this.g,n*this.b)},nc.hsl=function(){return _t(this.r,this.g,this.b)},nc.toString=function(){return"#"+xt(this.r)+xt(this.g)+xt(this.b)};var tc=ta.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});tc.forEach(function(n,t){tc.set(n,yt(t))}),ta.functor=Et,ta.xhr=Nt(At),ta.dsv=function(n,t){function e(n,e,i){arguments.length<3&&(i=e,e=null);var o=Ct(n,t,null==e?r:u(e),i);return o.row=function(n){return arguments.length?o.response(null==(e=n)?r:u(n)):e},o}function r(n){return e.parse(n.responseText)}function u(n){return function(t){return e.parse(t.responseText,n)}}function i(t){return t.map(o).join(n)}function o(n){return a.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var a=new RegExp('["'+n+"\n]"),c=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var u=new Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,e){return t(u(n),e)}:u})},e.parseRows=function(n,t){function e(){if(s>=l)return o;if(u)return u=!1,i;var t=s;if(34===n.charCodeAt(t)){for(var e=t;e++s;){var r=n.charCodeAt(s++),a=1;if(10===r)u=!0;else if(13===r)u=!0,10===n.charCodeAt(s)&&(++s,++a);else if(r!==c)continue;return n.slice(t,s-a)}return n.slice(t)}for(var r,u,i={},o={},a=[],l=n.length,s=0,f=0;(r=e())!==o;){for(var h=[];r!==i&&r!==o;)h.push(r),r=e();t&&null==(h=t(h,f++))||a.push(h)}return a},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new v,u=[];return t.forEach(function(n){for(var t in n)r.has(t)||u.push(r.add(t))}),[u.map(o).join(n)].concat(t.map(function(t){return u.map(function(n){return o(t[n])}).join(n)})).join("\n")},e.formatRows=function(n){return n.map(i).join("\n")},e},ta.csv=ta.dsv(",","text/csv"),ta.tsv=ta.dsv(" ","text/tab-separated-values");var ec,rc,uc,ic,oc,ac=oa[m(oa,"requestAnimationFrame")]||function(n){setTimeout(n,17)};ta.timer=function(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var u=e+t,i={c:n,t:u,f:!1,n:null};rc?rc.n=i:ec=i,rc=i,uc||(ic=clearTimeout(ic),uc=1,ac(Lt))},ta.timer.flush=function(){Tt(),Rt()},ta.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)};var cc=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(Pt);ta.formatPrefix=function(n,t){var e=0;return n&&(0>n&&(n*=-1),t&&(n=ta.round(n,Dt(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),cc[8+e/3]};var lc=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,sc=ta.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=ta.round(n,Dt(n,t))).toFixed(Math.max(0,Math.min(20,Dt(n*(1+1e-15),t))))}}),fc=ta.time={},hc=Date;Ft.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){gc.setUTCDate.apply(this._,arguments)},setDay:function(){gc.setUTCDay.apply(this._,arguments)},setFullYear:function(){gc.setUTCFullYear.apply(this._,arguments)},setHours:function(){gc.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){gc.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){gc.setUTCMinutes.apply(this._,arguments)},setMonth:function(){gc.setUTCMonth.apply(this._,arguments)},setSeconds:function(){gc.setUTCSeconds.apply(this._,arguments)},setTime:function(){gc.setTime.apply(this._,arguments)}};var gc=Date.prototype;fc.year=Ht(function(n){return n=fc.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),fc.years=fc.year.range,fc.years.utc=fc.year.utc.range,fc.day=Ht(function(n){var t=new hc(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),fc.days=fc.day.range,fc.days.utc=fc.day.utc.range,fc.dayOfYear=function(n){var t=fc.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){t=7-t;var e=fc[n]=Ht(function(n){return(n=fc.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=fc.year(n).getDay();return Math.floor((fc.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});fc[n+"s"]=e.range,fc[n+"s"].utc=e.utc.range,fc[n+"OfYear"]=function(n){var e=fc.year(n).getDay();return Math.floor((fc.dayOfYear(n)+(e+t)%7)/7)}}),fc.week=fc.sunday,fc.weeks=fc.sunday.range,fc.weeks.utc=fc.sunday.utc.range,fc.weekOfYear=fc.sundayOfYear;var pc={"-":"",_:" ",0:"0"},vc=/^\s*\d+/,dc=/^%/;ta.locale=function(n){return{numberFormat:Ut(n),timeFormat:Yt(n)}};var mc=ta.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});ta.format=mc.numberFormat,ta.geo={},le.prototype={s:0,t:0,add:function(n){se(n,this.t,yc),se(yc.s,this.s,this),this.s?this.t+=yc.t:this.s=yc.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var yc=new le;ta.geo.stream=function(n,t){n&&Mc.hasOwnProperty(n.type)?Mc[n.type](n,t):fe(n,t)};var Mc={Feature:function(n,t){fe(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,u=e.length;++rn?4*Da+n:n,wc.lineStart=wc.lineEnd=wc.point=y}};ta.geo.bounds=function(){function n(n,t){M.push(x=[s=n,h=n]),f>t&&(f=t),t>g&&(g=t)}function t(t,e){var r=ve([t*Fa,e*Fa]);if(m){var u=me(m,r),i=[u[1],-u[0],0],o=me(i,u);xe(o),o=be(o);var c=t-p,l=c>0?1:-1,v=o[0]*Ha*l,d=va(c)>180;if(d^(v>l*p&&l*t>v)){var y=o[1]*Ha;y>g&&(g=y)}else if(v=(v+360)%360-180,d^(v>l*p&&l*t>v)){var y=-o[1]*Ha;f>y&&(f=y)}else f>e&&(f=e),e>g&&(g=e);d?p>t?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t):h>=s?(s>t&&(s=t),t>h&&(h=t)):t>p?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t)}else n(t,e);m=r,p=t}function e(){b.point=t}function r(){x[0]=s,x[1]=h,b.point=n,m=null}function u(n,e){if(m){var r=n-p;y+=va(r)>180?r+(r>0?360:-360):r}else v=n,d=e;wc.point(n,e),t(n,e)}function i(){wc.lineStart()}function o(){u(v,d),wc.lineEnd(),va(y)>Ta&&(s=-(h=180)),x[0]=s,x[1]=h,m=null}function a(n,t){return(t-=n)<0?t+360:t}function c(n,t){return n[0]-t[0]}function l(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n_c?(s=-(h=180),f=-(g=90)):y>Ta?g=90:-Ta>y&&(f=-90),x[0]=s,x[1]=h}};return function(n){g=h=-(s=f=1/0),M=[],ta.geo.stream(n,b);var t=M.length;if(t){M.sort(c);for(var e,r=1,u=M[0],i=[u];t>r;++r)e=M[r],l(e[0],u)||l(e[1],u)?(a(u[0],e[1])>a(u[0],u[1])&&(u[1]=e[1]),a(e[0],u[1])>a(u[0],u[1])&&(u[0]=e[0])):i.push(u=e);for(var o,e,p=-1/0,t=i.length-1,r=0,u=i[t];t>=r;u=e,++r)e=i[r],(o=a(u[1],e[0]))>p&&(p=o,s=e[0],h=u[1])}return M=x=null,1/0===s||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[s,f],[h,g]]}}(),ta.geo.centroid=function(n){Sc=kc=Ec=Ac=Nc=Cc=zc=qc=Lc=Tc=Rc=0,ta.geo.stream(n,Dc);var t=Lc,e=Tc,r=Rc,u=t*t+e*e+r*r;return Ra>u&&(t=Cc,e=zc,r=qc,Ta>kc&&(t=Ec,e=Ac,r=Nc),u=t*t+e*e+r*r,Ra>u)?[0/0,0/0]:[Math.atan2(e,t)*Ha,tt(r/Math.sqrt(u))*Ha]};var Sc,kc,Ec,Ac,Nc,Cc,zc,qc,Lc,Tc,Rc,Dc={sphere:y,point:we,lineStart:ke,lineEnd:Ee,polygonStart:function(){Dc.lineStart=Ae},polygonEnd:function(){Dc.lineStart=ke}},Pc=Te(Ce,Ue,Fe,[-Da,-Da/2]),Uc=1e9;ta.geo.clipExtent=function(){var n,t,e,r,u,i,o={stream:function(n){return u&&(u.valid=!1),u=i(n),u.valid=!0,u},extent:function(a){return arguments.length?(i=Ie(n=+a[0][0],t=+a[0][1],e=+a[1][0],r=+a[1][1]),u&&(u.valid=!1,u=null),o):[[n,t],[e,r]]}};return o.extent([[0,0],[960,500]])},(ta.geo.conicEqualArea=function(){return Ze(Ve)}).raw=Ve,ta.geo.albers=function(){return ta.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},ta.geo.albersUsa=function(){function n(n){var i=n[0],o=n[1];return t=null,e(i,o),t||(r(i,o),t)||u(i,o),t}var t,e,r,u,i=ta.geo.albers(),o=ta.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=ta.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=i.scale(),e=i.translate(),r=(n[0]-e[0])/t,u=(n[1]-e[1])/t;return(u>=.12&&.234>u&&r>=-.425&&-.214>r?o:u>=.166&&.234>u&&r>=-.214&&-.115>r?a:i).invert(n)},n.stream=function(n){var t=i.stream(n),e=o.stream(n),r=a.stream(n);return{point:function(n,u){t.point(n,u),e.point(n,u),r.point(n,u)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(i.precision(t),o.precision(t),a.precision(t),n):i.precision()},n.scale=function(t){return arguments.length?(i.scale(t),o.scale(.35*t),a.scale(t),n.translate(i.translate())):i.scale()},n.translate=function(t){if(!arguments.length)return i.translate();var l=i.scale(),s=+t[0],f=+t[1];return e=i.translate(t).clipExtent([[s-.455*l,f-.238*l],[s+.455*l,f+.238*l]]).stream(c).point,r=o.translate([s-.307*l,f+.201*l]).clipExtent([[s-.425*l+Ta,f+.12*l+Ta],[s-.214*l-Ta,f+.234*l-Ta]]).stream(c).point,u=a.translate([s-.205*l,f+.212*l]).clipExtent([[s-.214*l+Ta,f+.166*l+Ta],[s-.115*l-Ta,f+.234*l-Ta]]).stream(c).point,n},n.scale(1070)};var jc,Fc,Hc,Oc,Yc,Ic,Zc={point:y,lineStart:y,lineEnd:y,polygonStart:function(){Fc=0,Zc.lineStart=Xe},polygonEnd:function(){Zc.lineStart=Zc.lineEnd=Zc.point=y,jc+=va(Fc/2)}},Vc={point:$e,lineStart:y,lineEnd:y,polygonStart:y,polygonEnd:y},Xc={point:Je,lineStart:Ge,lineEnd:Ke,polygonStart:function(){Xc.lineStart=Qe},polygonEnd:function(){Xc.point=Je,Xc.lineStart=Ge,Xc.lineEnd=Ke}};ta.geo.path=function(){function n(n){return n&&("function"==typeof a&&i.pointRadius(+a.apply(this,arguments)),o&&o.valid||(o=u(i)),ta.geo.stream(n,o)),i.result()}function t(){return o=null,n}var e,r,u,i,o,a=4.5;return n.area=function(n){return jc=0,ta.geo.stream(n,u(Zc)),jc},n.centroid=function(n){return Ec=Ac=Nc=Cc=zc=qc=Lc=Tc=Rc=0,ta.geo.stream(n,u(Xc)),Rc?[Lc/Rc,Tc/Rc]:qc?[Cc/qc,zc/qc]:Nc?[Ec/Nc,Ac/Nc]:[0/0,0/0]},n.bounds=function(n){return Yc=Ic=-(Hc=Oc=1/0),ta.geo.stream(n,u(Vc)),[[Hc,Oc],[Yc,Ic]]},n.projection=function(n){return arguments.length?(u=(e=n)?n.stream||er(n):At,t()):e},n.context=function(n){return arguments.length?(i=null==(r=n)?new Be:new nr(n),"function"!=typeof a&&i.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(i.pointRadius(+t),+t),n):a},n.projection(ta.geo.albersUsa()).context(null)},ta.geo.transform=function(n){return{stream:function(t){var e=new rr(t);for(var r in n)e[r]=n[r];return e}}},rr.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},ta.geo.projection=ir,ta.geo.projectionMutator=or,(ta.geo.equirectangular=function(){return ir(cr)}).raw=cr.invert=cr,ta.geo.rotation=function(n){function t(t){return t=n(t[0]*Fa,t[1]*Fa),t[0]*=Ha,t[1]*=Ha,t}return n=sr(n[0]%360*Fa,n[1]*Fa,n.length>2?n[2]*Fa:0),t.invert=function(t){return t=n.invert(t[0]*Fa,t[1]*Fa),t[0]*=Ha,t[1]*=Ha,t},t},lr.invert=cr,ta.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=sr(-n[0]*Fa,-n[1]*Fa,0).invert,u=[];return e(null,null,1,{point:function(n,e){u.push(n=t(n,e)),n[0]*=Ha,n[1]*=Ha}}),{type:"Polygon",coordinates:[u]}}var t,e,r=[0,0],u=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=pr((t=+r)*Fa,u*Fa),n):t},n.precision=function(r){return arguments.length?(e=pr(t*Fa,(u=+r)*Fa),n):u},n.angle(90)},ta.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Fa,u=n[1]*Fa,i=t[1]*Fa,o=Math.sin(r),a=Math.cos(r),c=Math.sin(u),l=Math.cos(u),s=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((e=f*o)*e+(e=l*s-c*f*a)*e),c*s+l*f*a)},ta.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return ta.range(Math.ceil(i/d)*d,u,d).map(h).concat(ta.range(Math.ceil(l/m)*m,c,m).map(g)).concat(ta.range(Math.ceil(r/p)*p,e,p).filter(function(n){return va(n%d)>Ta}).map(s)).concat(ta.range(Math.ceil(a/v)*v,o,v).filter(function(n){return va(n%m)>Ta}).map(f))}var e,r,u,i,o,a,c,l,s,f,h,g,p=10,v=p,d=90,m=360,y=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(i).concat(g(c).slice(1),h(u).reverse().slice(1),g(l).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(i=+t[0][0],u=+t[1][0],l=+t[0][1],c=+t[1][1],i>u&&(t=i,i=u,u=t),l>c&&(t=l,l=c,c=t),n.precision(y)):[[i,l],[u,c]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],o=+t[1][1],r>e&&(t=r,r=e,e=t),a>o&&(t=a,a=o,o=t),n.precision(y)):[[r,a],[e,o]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(d=+t[0],m=+t[1],n):[d,m]},n.minorStep=function(t){return arguments.length?(p=+t[0],v=+t[1],n):[p,v]},n.precision=function(t){return arguments.length?(y=+t,s=dr(a,o,90),f=mr(r,e,y),h=dr(l,c,90),g=mr(i,u,y),n):y},n.majorExtent([[-180,-90+Ta],[180,90-Ta]]).minorExtent([[-180,-80-Ta],[180,80+Ta]])},ta.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||u.apply(this,arguments)]}}var t,e,r=yr,u=Mr;return n.distance=function(){return ta.geo.distance(t||r.apply(this,arguments),e||u.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(u=t,e="function"==typeof t?null:t,n):u},n.precision=function(){return arguments.length?n:0},n},ta.geo.interpolate=function(n,t){return xr(n[0]*Fa,n[1]*Fa,t[0]*Fa,t[1]*Fa)},ta.geo.length=function(n){return $c=0,ta.geo.stream(n,Bc),$c};var $c,Bc={sphere:y,point:y,lineStart:br,lineEnd:y,polygonStart:y,polygonEnd:y},Wc=_r(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(ta.geo.azimuthalEqualArea=function(){return ir(Wc)}).raw=Wc;var Jc=_r(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},At);(ta.geo.azimuthalEquidistant=function(){return ir(Jc)}).raw=Jc,(ta.geo.conicConformal=function(){return Ze(wr)}).raw=wr,(ta.geo.conicEquidistant=function(){return Ze(Sr)}).raw=Sr;var Gc=_r(function(n){return 1/n},Math.atan);(ta.geo.gnomonic=function(){return ir(Gc)}).raw=Gc,kr.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-ja]},(ta.geo.mercator=function(){return Er(kr)}).raw=kr;var Kc=_r(function(){return 1},Math.asin);(ta.geo.orthographic=function(){return ir(Kc)}).raw=Kc;var Qc=_r(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(ta.geo.stereographic=function(){return ir(Qc)}).raw=Qc,Ar.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-ja]},(ta.geo.transverseMercator=function(){var n=Er(Ar),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},e([0,0,90])}).raw=Ar,ta.geom={},ta.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,u=Et(e),i=Et(r),o=n.length,a=[],c=[];for(t=0;o>t;t++)a.push([+u.call(this,n[t],t),+i.call(this,n[t],t),t]);for(a.sort(qr),t=0;o>t;t++)c.push([a[t][0],-a[t][1]]);var l=zr(a),s=zr(c),f=s[0]===l[0],h=s[s.length-1]===l[l.length-1],g=[];for(t=l.length-1;t>=0;--t)g.push(n[a[l[t]][2]]);for(t=+f;t=r&&l.x<=i&&l.y>=u&&l.y<=o?[[r,o],[i,o],[i,u],[r,u]]:[];s.point=n[a]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(i(n,t)/Ta)*Ta,y:Math.round(o(n,t)/Ta)*Ta,i:t}})}var r=Nr,u=Cr,i=r,o=u,a=cl;return n?t(n):(t.links=function(n){return ou(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return ou(e(n)).cells.forEach(function(e,r){for(var u,i,o=e.site,a=e.edges.sort(Zr),c=-1,l=a.length,s=a[l-1].edge,f=s.l===o?s.r:s.l;++c=l,h=r>=s,g=h<<1|f;n.leaf=!1,n=n.nodes[g]||(n.nodes[g]=fu()),f?u=l:a=l,h?o=s:c=s,i(n,t,e,r,u,o,a,c)}var s,f,h,g,p,v,d,m,y,M=Et(a),x=Et(c);if(null!=t)v=t,d=e,m=r,y=u;else if(m=y=-(v=d=1/0),f=[],h=[],p=n.length,o)for(g=0;p>g;++g)s=n[g],s.xm&&(m=s.x),s.y>y&&(y=s.y),f.push(s.x),h.push(s.y);else for(g=0;p>g;++g){var b=+M(s=n[g],g),_=+x(s,g);v>b&&(v=b),d>_&&(d=_),b>m&&(m=b),_>y&&(y=_),f.push(b),h.push(_)}var w=m-v,S=y-d;w>S?y=d+w:m=v+S;var k=fu();if(k.add=function(n){i(k,n,+M(n,++g),+x(n,g),v,d,m,y)},k.visit=function(n){hu(n,k,v,d,m,y)},k.find=function(n){return gu(k,n[0],n[1],v,d,m,y)},g=-1,null==t){for(;++g=0?n.slice(0,t):n,r=t>=0?n.slice(t+1):"in";return e=hl.get(e)||fl,r=gl.get(r)||At,xu(r(e.apply(null,ea.call(arguments,1))))},ta.interpolateHcl=Tu,ta.interpolateHsl=Ru,ta.interpolateLab=Du,ta.interpolateRound=Pu,ta.transform=function(n){var t=ua.createElementNS(ta.ns.prefix.svg,"g");return(ta.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new Uu(e?e.matrix:pl)})(n)},Uu.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var pl={a:1,b:0,c:0,d:1,e:0,f:0};ta.interpolateTransform=Ou,ta.layout={},ta.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++ea*a/d){if(p>c){var l=t.charge/c;n.px-=i*l,n.py-=o*l}return!0}if(t.point&&c&&p>c){var l=t.pointCharge/c;n.px-=i*l,n.py-=o*l}}return!t.charge}}function t(n){n.px=ta.event.x,n.py=ta.event.y,a.resume()}var e,r,u,i,o,a={},c=ta.dispatch("start","tick","end"),l=[1,1],s=.9,f=vl,h=dl,g=-30,p=ml,v=.1,d=.64,m=[],y=[];return a.tick=function(){if((r*=.99)<.005)return c.end({type:"end",alpha:r=0}),!0;var t,e,a,f,h,p,d,M,x,b=m.length,_=y.length;for(e=0;_>e;++e)a=y[e],f=a.source,h=a.target,M=h.x-f.x,x=h.y-f.y,(p=M*M+x*x)&&(p=r*i[e]*((p=Math.sqrt(p))-u[e])/p,M*=p,x*=p,h.x-=M*(d=f.weight/(h.weight+f.weight)),h.y-=x*d,f.x+=M*(d=1-d),f.y+=x*d);if((d=r*v)&&(M=l[0]/2,x=l[1]/2,e=-1,d))for(;++e0?n:0:n>0&&(c.start({type:"start",alpha:r=n}),ta.timer(a.tick)),a):r},a.start=function(){function n(n,r){if(!e){for(e=new Array(c),a=0;c>a;++a)e[a]=[];for(a=0;l>a;++a){var u=y[a];e[u.source.index].push(u.target),e[u.target.index].push(u.source)}}for(var i,o=e[t],a=-1,l=o.length;++at;++t)(r=m[t]).index=t,r.weight=0;for(t=0;s>t;++t)r=y[t],"number"==typeof r.source&&(r.source=m[r.source]),"number"==typeof r.target&&(r.target=m[r.target]),++r.source.weight,++r.target.weight;for(t=0;c>t;++t)r=m[t],isNaN(r.x)&&(r.x=n("x",p)),isNaN(r.y)&&(r.y=n("y",v)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(u=[],"function"==typeof f)for(t=0;s>t;++t)u[t]=+f.call(this,y[t],t);else for(t=0;s>t;++t)u[t]=f;if(i=[],"function"==typeof h)for(t=0;s>t;++t)i[t]=+h.call(this,y[t],t);else for(t=0;s>t;++t)i[t]=h;if(o=[],"function"==typeof g)for(t=0;c>t;++t)o[t]=+g.call(this,m[t],t);else for(t=0;c>t;++t)o[t]=g;return a.resume()},a.resume=function(){return a.alpha(.1)},a.stop=function(){return a.alpha(0)},a.drag=function(){return e||(e=ta.behavior.drag().origin(At).on("dragstart.force",$u).on("drag.force",t).on("dragend.force",Bu)),arguments.length?(this.on("mouseover.force",Wu).on("mouseout.force",Ju).call(e),void 0):e},ta.rebind(a,c,"on")};var vl=20,dl=1,ml=1/0;ta.layout.hierarchy=function(){function n(u){var i,o=[u],a=[];for(u.depth=0;null!=(i=o.pop());)if(a.push(i),(l=e.call(n,i,i.depth))&&(c=l.length)){for(var c,l,s;--c>=0;)o.push(s=l[c]),s.parent=i,s.depth=i.depth+1;r&&(i.value=0),i.children=l}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return ni(u,function(n){var e,u;t&&(e=n.children)&&e.sort(t),r&&(u=n.parent)&&(u.value+=n.value)}),a}var t=ri,e=ti,r=ei;return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(Qu(t,function(n){n.children&&(n.value=0)}),ni(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},ta.layout.partition=function(){function n(t,e,r,u){var i=t.children;if(t.x=e,t.y=t.depth*u,t.dx=r,t.dy=u,i&&(o=i.length)){var o,a,c,l=-1;for(r=t.value?r/t.value:0;++lf?-1:1),p=(f-c*g)/ta.sum(l),v=ta.range(c),d=[];return null!=e&&v.sort(e===yl?function(n,t){return l[t]-l[n]}:function(n,t){return e(o[n],o[t])}),v.forEach(function(n){d[n]={data:o[n],value:a=l[n],startAngle:s,endAngle:s+=a*p+g,padAngle:h}}),d}var t=Number,e=yl,r=0,u=Pa,i=0;return n.value=function(e){return arguments.length?(t=e,n):t},n.sort=function(t){return arguments.length?(e=t,n):e},n.startAngle=function(t){return arguments.length?(r=t,n):r},n.endAngle=function(t){return arguments.length?(u=t,n):u},n.padAngle=function(t){return arguments.length?(i=t,n):i},n};var yl={};ta.layout.stack=function(){function n(a,c){if(!(h=a.length))return a;var l=a.map(function(e,r){return t.call(n,e,r)}),s=l.map(function(t){return t.map(function(t,e){return[i.call(n,t,e),o.call(n,t,e)]})}),f=e.call(n,s,c);l=ta.permute(l,f),s=ta.permute(s,f);var h,g,p,v,d=r.call(n,s,c),m=l[0].length;for(p=0;m>p;++p)for(u.call(n,l[0][p],v=d[p],s[0][p][1]),g=1;h>g;++g)u.call(n,l[g][p],v+=s[g-1][p][1],s[g][p][1]);return a}var t=At,e=ci,r=li,u=ai,i=ii,o=oi;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e="function"==typeof t?t:Ml.get(t)||ci,n):e},n.offset=function(t){return arguments.length?(r="function"==typeof t?t:xl.get(t)||li,n):r},n.x=function(t){return arguments.length?(i=t,n):i},n.y=function(t){return arguments.length?(o=t,n):o},n.out=function(t){return arguments.length?(u=t,n):u},n};var Ml=ta.map({"inside-out":function(n){var t,e,r=n.length,u=n.map(si),i=n.map(fi),o=ta.range(r).sort(function(n,t){return u[n]-u[t]}),a=0,c=0,l=[],s=[];for(t=0;r>t;++t)e=o[t],c>a?(a+=i[e],l.push(e)):(c+=i[e],s.push(e));return s.reverse().concat(l)},reverse:function(n){return ta.range(n.length).reverse()},"default":ci}),xl=ta.map({silhouette:function(n){var t,e,r,u=n.length,i=n[0].length,o=[],a=0,c=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];r>a&&(a=r),o.push(r)}for(e=0;i>e;++e)c[e]=(a-o[e])/2;return c},wiggle:function(n){var t,e,r,u,i,o,a,c,l,s=n.length,f=n[0],h=f.length,g=[];for(g[0]=c=l=0,e=1;h>e;++e){for(t=0,u=0;s>t;++t)u+=n[t][e][1];for(t=0,i=0,a=f[e][0]-f[e-1][0];s>t;++t){for(r=0,o=(n[t][e][1]-n[t][e-1][1])/(2*a);t>r;++r)o+=(n[r][e][1]-n[r][e-1][1])/a;i+=o*n[t][e][1]}g[e]=c-=u?i/u*a:0,l>c&&(l=c)}for(e=0;h>e;++e)g[e]-=l;return g},expand:function(n){var t,e,r,u=n.length,i=n[0].length,o=1/u,a=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];if(r)for(t=0;u>t;t++)n[t][e][1]/=r;else for(t=0;u>t;t++)n[t][e][1]=o}for(e=0;i>e;++e)a[e]=0;return a},zero:li});ta.layout.histogram=function(){function n(n,i){for(var o,a,c=[],l=n.map(e,this),s=r.call(this,l,i),f=u.call(this,s,l,i),i=-1,h=l.length,g=f.length-1,p=t?1:1/h;++i0)for(i=-1;++i=s[0]&&a<=s[1]&&(o=c[ta.bisect(f,a,1,g)-1],o.y+=p,o.push(n[i]));return c}var t=!0,e=Number,r=vi,u=gi;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=Et(t),n):r},n.bins=function(t){return arguments.length?(u="number"==typeof t?function(n){return pi(n,t)}:Et(t),n):u},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},ta.layout.pack=function(){function n(n,i){var o=e.call(this,n,i),a=o[0],c=u[0],l=u[1],s=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,ni(a,function(n){n.r=+s(n.value)}),ni(a,xi),r){var f=r*(t?1:Math.max(2*a.r/c,2*a.r/l))/2;ni(a,function(n){n.r+=f}),ni(a,xi),ni(a,function(n){n.r-=f})}return wi(a,c/2,l/2,t?1:1/Math.max(2*a.r/c,2*a.r/l)),o}var t,e=ta.layout.hierarchy().sort(di),r=0,u=[1,1];return n.size=function(t){return arguments.length?(u=t,n):u},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},Ku(n,e)},ta.layout.tree=function(){function n(n,u){var s=o.call(this,n,u),f=s[0],h=t(f);if(ni(h,e),h.parent.m=-h.z,Qu(h,r),l)Qu(f,i);else{var g=f,p=f,v=f;Qu(f,function(n){n.xp.x&&(p=n),n.depth>v.depth&&(v=n)});var d=a(g,p)/2-g.x,m=c[0]/(p.x+a(p,g)/2+d),y=c[1]/(v.depth||1);Qu(f,function(n){n.x=(n.x+d)*m,n.y=n.depth*y})}return s}function t(n){for(var t,e={A:null,children:[n]},r=[e];null!=(t=r.pop());)for(var u,i=t.children,o=0,a=i.length;a>o;++o)r.push((i[o]=u={_:i[o],parent:t,children:(u=i[o].children)&&u.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=u);return e.children[0]}function e(n){var t=n.children,e=n.parent.children,r=n.i?e[n.i-1]:null;if(t.length){Ci(n);var i=(t[0].z+t[t.length-1].z)/2;r?(n.z=r.z+a(n._,r._),n.m=n.z-i):n.z=i}else r&&(n.z=r.z+a(n._,r._));n.parent.A=u(n,r,n.parent.A||e[0])}function r(n){n._.x=n.z+n.parent.m,n.m+=n.parent.m}function u(n,t,e){if(t){for(var r,u=n,i=n,o=t,c=u.parent.children[0],l=u.m,s=i.m,f=o.m,h=c.m;o=Ai(o),u=Ei(u),o&&u;)c=Ei(c),i=Ai(i),i.a=n,r=o.z+f-u.z-l+a(o._,u._),r>0&&(Ni(zi(o,n,e),n,r),l+=r,s+=r),f+=o.m,l+=u.m,h+=c.m,s+=i.m;o&&!Ai(i)&&(i.t=o,i.m+=f-s),u&&!Ei(c)&&(c.t=u,c.m+=l-h,e=n)}return e}function i(n){n.x*=c[0],n.y=n.depth*c[1]}var o=ta.layout.hierarchy().sort(null).value(null),a=ki,c=[1,1],l=null;return n.separation=function(t){return arguments.length?(a=t,n):a},n.size=function(t){return arguments.length?(l=null==(c=t)?i:null,n):l?null:c},n.nodeSize=function(t){return arguments.length?(l=null==(c=t)?null:i,n):l?c:null},Ku(n,o)},ta.layout.cluster=function(){function n(n,i){var o,a=t.call(this,n,i),c=a[0],l=0;ni(c,function(n){var t=n.children;t&&t.length?(n.x=Li(t),n.y=qi(t)):(n.x=o?l+=e(n,o):0,n.y=0,o=n)});var s=Ti(c),f=Ri(c),h=s.x-e(s,f)/2,g=f.x+e(f,s)/2;return ni(c,u?function(n){n.x=(n.x-c.x)*r[0],n.y=(c.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(g-h)*r[0],n.y=(1-(c.y?n.y/c.y:1))*r[1]}),a}var t=ta.layout.hierarchy().sort(null).value(null),e=ki,r=[1,1],u=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(u=null==(r=t),n):u?null:r},n.nodeSize=function(t){return arguments.length?(u=null!=(r=t),n):u?r:null},Ku(n,t)},ta.layout.treemap=function(){function n(n,t){for(var e,r,u=-1,i=n.length;++ut?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var i=e.children;if(i&&i.length){var o,a,c,l=f(e),s=[],h=i.slice(),p=1/0,v="slice"===g?l.dx:"dice"===g?l.dy:"slice-dice"===g?1&e.depth?l.dy:l.dx:Math.min(l.dx,l.dy);for(n(h,l.dx*l.dy/e.value),s.area=0;(c=h.length)>0;)s.push(o=h[c-1]),s.area+=o.area,"squarify"!==g||(a=r(s,v))<=p?(h.pop(),p=a):(s.area-=s.pop().area,u(s,v,l,!1),v=Math.min(l.dx,l.dy),s.length=s.area=0,p=1/0);s.length&&(u(s,v,l,!0),s.length=s.area=0),i.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var i,o=f(t),a=r.slice(),c=[];for(n(a,o.dx*o.dy/t.value),c.area=0;i=a.pop();)c.push(i),c.area+=i.area,null!=i.z&&(u(c,i.z?o.dx:o.dy,o,!a.length),c.length=c.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,u=0,i=1/0,o=-1,a=n.length;++oe&&(i=e),e>u&&(u=e));return r*=r,t*=t,r?Math.max(t*u*p/r,r/(t*i*p)):1/0}function u(n,t,e,r){var u,i=-1,o=n.length,a=e.x,l=e.y,s=t?c(n.area/t):0;if(t==e.dx){for((r||s>e.dy)&&(s=e.dy);++ie.dx)&&(s=e.dx);++ie&&(t=1),1>e&&(n=0),function(){var e,r,u;do e=2*Math.random()-1,r=2*Math.random()-1,u=e*e+r*r;while(!u||u>1);return n+t*e*Math.sqrt(-2*Math.log(u)/u) +}},logNormal:function(){var n=ta.random.normal.apply(ta,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=ta.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t}}},ta.scale={};var bl={floor:At,ceil:At};ta.scale.linear=function(){return Ii([0,1],[0,1],yu,!1)};var _l={s:1,g:1,p:1,r:1,e:1};ta.scale.log=function(){return Gi(ta.scale.linear().domain([0,1]),10,!0,[1,10])};var wl=ta.format(".0e"),Sl={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};ta.scale.pow=function(){return Ki(ta.scale.linear(),1,[0,1])},ta.scale.sqrt=function(){return ta.scale.pow().exponent(.5)},ta.scale.ordinal=function(){return no([],{t:"range",a:[[]]})},ta.scale.category10=function(){return ta.scale.ordinal().range(kl)},ta.scale.category20=function(){return ta.scale.ordinal().range(El)},ta.scale.category20b=function(){return ta.scale.ordinal().range(Al)},ta.scale.category20c=function(){return ta.scale.ordinal().range(Nl)};var kl=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(Mt),El=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(Mt),Al=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(Mt),Nl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(Mt);ta.scale.quantile=function(){return to([],[])},ta.scale.quantize=function(){return eo(0,1,[0,1])},ta.scale.threshold=function(){return ro([.5],[0,1])},ta.scale.identity=function(){return uo([0,1])},ta.svg={},ta.svg.arc=function(){function n(){var n=Math.max(0,+e.apply(this,arguments)),l=Math.max(0,+r.apply(this,arguments)),s=o.apply(this,arguments)-ja,f=a.apply(this,arguments)-ja,h=Math.abs(f-s),g=s>f?0:1;if(n>l&&(p=l,l=n,n=p),h>=Ua)return t(l,g)+(n?t(n,1-g):"")+"Z";var p,v,d,m,y,M,x,b,_,w,S,k,E=0,A=0,N=[];if((m=(+c.apply(this,arguments)||0)/2)&&(d=i===Cl?Math.sqrt(n*n+l*l):+i.apply(this,arguments),g||(A*=-1),l&&(A=tt(d/l*Math.sin(m))),n&&(E=tt(d/n*Math.sin(m)))),l){y=l*Math.cos(s+A),M=l*Math.sin(s+A),x=l*Math.cos(f-A),b=l*Math.sin(f-A);var C=Math.abs(f-s-2*A)<=Da?0:1;if(A&&fo(y,M,x,b)===g^C){var z=(s+f)/2;y=l*Math.cos(z),M=l*Math.sin(z),x=b=null}}else y=M=0;if(n){_=n*Math.cos(f-E),w=n*Math.sin(f-E),S=n*Math.cos(s+E),k=n*Math.sin(s+E);var q=Math.abs(s-f+2*E)<=Da?0:1;if(E&&fo(_,w,S,k)===1-g^q){var L=(s+f)/2;_=n*Math.cos(L),w=n*Math.sin(L),S=k=null}}else _=w=0;if((p=Math.min(Math.abs(l-n)/2,+u.apply(this,arguments)))>.001){v=l>n^g?0:1;var T=null==S?[_,w]:null==x?[y,M]:Tr([y,M],[S,k],[x,b],[_,w]),R=y-T[0],D=M-T[1],P=x-T[0],U=b-T[1],j=1/Math.sin(Math.acos((R*P+D*U)/(Math.sqrt(R*R+D*D)*Math.sqrt(P*P+U*U)))/2),F=Math.sqrt(T[0]*T[0]+T[1]*T[1]);if(null!=x){var H=Math.min(p,(l-F)/(j+1)),O=ho(null==S?[_,w]:[S,k],[y,M],l,H,g),Y=ho([x,b],[_,w],l,H,g);p===H?N.push("M",O[0],"A",H,",",H," 0 0,",v," ",O[1],"A",l,",",l," 0 ",1-g^fo(O[1][0],O[1][1],Y[1][0],Y[1][1]),",",g," ",Y[1],"A",H,",",H," 0 0,",v," ",Y[0]):N.push("M",O[0],"A",H,",",H," 0 1,",v," ",Y[0])}else N.push("M",y,",",M);if(null!=S){var I=Math.min(p,(n-F)/(j-1)),Z=ho([y,M],[S,k],n,-I,g),V=ho([_,w],null==x?[y,M]:[x,b],n,-I,g);p===I?N.push("L",V[0],"A",I,",",I," 0 0,",v," ",V[1],"A",n,",",n," 0 ",g^fo(V[1][0],V[1][1],Z[1][0],Z[1][1]),",",1-g," ",Z[1],"A",I,",",I," 0 0,",v," ",Z[0]):N.push("L",V[0],"A",I,",",I," 0 0,",v," ",Z[0])}else N.push("L",_,",",w)}else N.push("M",y,",",M),null!=x&&N.push("A",l,",",l," 0 ",C,",",g," ",x,",",b),N.push("L",_,",",w),null!=S&&N.push("A",n,",",n," 0 ",q,",",1-g," ",S,",",k);return N.push("Z"),N.join("")}function t(n,t){return"M0,"+n+"A"+n+","+n+" 0 1,"+t+" 0,"+-n+"A"+n+","+n+" 0 1,"+t+" 0,"+n}var e=oo,r=ao,u=io,i=Cl,o=co,a=lo,c=so;return n.innerRadius=function(t){return arguments.length?(e=Et(t),n):e},n.outerRadius=function(t){return arguments.length?(r=Et(t),n):r},n.cornerRadius=function(t){return arguments.length?(u=Et(t),n):u},n.padRadius=function(t){return arguments.length?(i=t==Cl?Cl:Et(t),n):i},n.startAngle=function(t){return arguments.length?(o=Et(t),n):o},n.endAngle=function(t){return arguments.length?(a=Et(t),n):a},n.padAngle=function(t){return arguments.length?(c=Et(t),n):c},n.centroid=function(){var n=(+e.apply(this,arguments)+ +r.apply(this,arguments))/2,t=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-ja;return[Math.cos(t)*n,Math.sin(t)*n]},n};var Cl="auto";ta.svg.line=function(){return go(At)};var zl=ta.map({linear:po,"linear-closed":vo,step:mo,"step-before":yo,"step-after":Mo,basis:ko,"basis-open":Eo,"basis-closed":Ao,bundle:No,cardinal:_o,"cardinal-open":xo,"cardinal-closed":bo,monotone:Ro});zl.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var ql=[0,2/3,1/3,0],Ll=[0,1/3,2/3,0],Tl=[0,1/6,2/3,1/6];ta.svg.line.radial=function(){var n=go(Do);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},yo.reverse=Mo,Mo.reverse=yo,ta.svg.area=function(){return Po(At)},ta.svg.area.radial=function(){var n=Po(Do);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},ta.svg.chord=function(){function n(n,a){var c=t(this,i,n,a),l=t(this,o,n,a);return"M"+c.p0+r(c.r,c.p1,c.a1-c.a0)+(e(c,l)?u(c.r,c.p1,c.r,c.p0):u(c.r,c.p1,l.r,l.p0)+r(l.r,l.p1,l.a1-l.a0)+u(l.r,l.p1,c.r,c.p0))+"Z"}function t(n,t,e,r){var u=t.call(n,e,r),i=a.call(n,u,r),o=c.call(n,u,r)-ja,s=l.call(n,u,r)-ja;return{r:i,a0:o,a1:s,p0:[i*Math.cos(o),i*Math.sin(o)],p1:[i*Math.cos(s),i*Math.sin(s)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return"A"+n+","+n+" 0 "+ +(e>Da)+",1 "+t}function u(n,t,e,r){return"Q 0,0 "+r}var i=yr,o=Mr,a=Uo,c=co,l=lo;return n.radius=function(t){return arguments.length?(a=Et(t),n):a},n.source=function(t){return arguments.length?(i=Et(t),n):i},n.target=function(t){return arguments.length?(o=Et(t),n):o},n.startAngle=function(t){return arguments.length?(c=Et(t),n):c},n.endAngle=function(t){return arguments.length?(l=Et(t),n):l},n},ta.svg.diagonal=function(){function n(n,u){var i=t.call(this,n,u),o=e.call(this,n,u),a=(i.y+o.y)/2,c=[i,{x:i.x,y:a},{x:o.x,y:a},o];return c=c.map(r),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var t=yr,e=Mr,r=jo;return n.source=function(e){return arguments.length?(t=Et(e),n):t},n.target=function(t){return arguments.length?(e=Et(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},ta.svg.diagonal.radial=function(){var n=ta.svg.diagonal(),t=jo,e=n.projection;return n.projection=function(n){return arguments.length?e(Fo(t=n)):t},n},ta.svg.symbol=function(){function n(n,r){return(Rl.get(t.call(this,n,r))||Yo)(e.call(this,n,r))}var t=Oo,e=Ho;return n.type=function(e){return arguments.length?(t=Et(e),n):t},n.size=function(t){return arguments.length?(e=Et(t),n):e},n};var Rl=ta.map({circle:Yo,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*jl)),e=t*jl;return"M0,"+-t+"L"+e+",0"+" 0,"+t+" "+-e+",0"+"Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/Ul),e=t*Ul/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/Ul),e=t*Ul/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});ta.svg.symbolTypes=Rl.keys();var Dl,Pl,Ul=Math.sqrt(3),jl=Math.tan(30*Fa),Fl=[],Hl=0;Fl.call=ka.call,Fl.empty=ka.empty,Fl.node=ka.node,Fl.size=ka.size,ta.transition=function(n){return arguments.length?Dl?n.transition():n:Na.transition()},ta.transition.prototype=Fl,Fl.select=function(n){var t,e,r,u=this.id,i=this.namespace,o=[];n=k(n);for(var a=-1,c=this.length;++ai;i++){u.push(t=[]);for(var e=this[i],a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return Io(u,this.namespace,this.id)},Fl.tween=function(n,t){var e=this.id,r=this.namespace;return arguments.length<2?this.node()[r][e].tween.get(n):H(this,null==t?function(t){t[r][e].tween.remove(n)}:function(u){u[r][e].tween.set(n,t)})},Fl.attr=function(n,t){function e(){this.removeAttribute(a)}function r(){this.removeAttributeNS(a.space,a.local)}function u(n){return null==n?e:(n+="",function(){var t,e=this.getAttribute(a);return e!==n&&(t=o(e,n),function(n){this.setAttribute(a,t(n))})})}function i(n){return null==n?r:(n+="",function(){var t,e=this.getAttributeNS(a.space,a.local);return e!==n&&(t=o(e,n),function(n){this.setAttributeNS(a.space,a.local,t(n))})})}if(arguments.length<2){for(t in n)this.attr(t,n[t]);return this}var o="transform"==n?Ou:yu,a=ta.ns.qualify(n);return Zo(this,"attr."+n,t,a.local?i:u)},Fl.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(u));return r&&function(n){this.setAttribute(u,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(u.space,u.local));return r&&function(n){this.setAttributeNS(u.space,u.local,r(n))}}var u=ta.ns.qualify(n);return this.tween("attr."+n,u.local?r:e)},Fl.style=function(n,t,e){function r(){this.style.removeProperty(n)}function u(t){return null==t?r:(t+="",function(){var r,u=oa.getComputedStyle(this,null).getPropertyValue(n);return u!==t&&(r=yu(u,t),function(t){this.style.setProperty(n,r(t),e)})})}var i=arguments.length;if(3>i){if("string"!=typeof n){2>i&&(t="");for(e in n)this.style(e,n[e],t);return this}e=""}return Zo(this,"style."+n,t,u)},Fl.styleTween=function(n,t,e){function r(r,u){var i=t.call(this,r,u,oa.getComputedStyle(this,null).getPropertyValue(n));return i&&function(t){this.style.setProperty(n,i(t),e)}}return arguments.length<3&&(e=""),this.tween("style."+n,r)},Fl.text=function(n){return Zo(this,"text",n,Vo)},Fl.remove=function(){var n=this.namespace;return this.each("end.transition",function(){var t;this[n].count<2&&(t=this.parentNode)&&t.removeChild(this)})},Fl.ease=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].ease:("function"!=typeof n&&(n=ta.ease.apply(ta,arguments)),H(this,function(r){r[e][t].ease=n}))},Fl.delay=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].delay:H(this,"function"==typeof n?function(r,u,i){r[e][t].delay=+n.call(r,r.__data__,u,i)}:(n=+n,function(r){r[e][t].delay=n}))},Fl.duration=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].duration:H(this,"function"==typeof n?function(r,u,i){r[e][t].duration=Math.max(1,n.call(r,r.__data__,u,i))}:(n=Math.max(1,n),function(r){r[e][t].duration=n}))},Fl.each=function(n,t){var e=this.id,r=this.namespace;if(arguments.length<2){var u=Pl,i=Dl;Dl=e,H(this,function(t,u,i){Pl=t[r][e],n.call(t,t.__data__,u,i)}),Pl=u,Dl=i}else H(this,function(u){var i=u[r][e];(i.event||(i.event=ta.dispatch("start","end","interrupt"))).on(n,t)});return this},Fl.transition=function(){for(var n,t,e,r,u=this.id,i=++Hl,o=this.namespace,a=[],c=0,l=this.length;l>c;c++){a.push(n=[]);for(var t=this[c],s=0,f=t.length;f>s;s++)(e=t[s])&&(r=e[o][u],$o(e,s,o,i,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),n.push(e)}return Io(a,o,i)},ta.svg.axis=function(){function n(n){n.each(function(){var n,l=ta.select(this),s=this.__chart__||e,f=this.__chart__=e.copy(),h=null==c?f.ticks?f.ticks.apply(f,a):f.domain():c,g=null==t?f.tickFormat?f.tickFormat.apply(f,a):At:t,p=l.selectAll(".tick").data(h,f),v=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Ta),d=ta.transition(p.exit()).style("opacity",Ta).remove(),m=ta.transition(p.order()).style("opacity",1),y=Math.max(u,0)+o,M=ji(f),x=l.selectAll(".domain").data([0]),b=(x.enter().append("path").attr("class","domain"),ta.transition(x));v.append("line"),v.append("text");var _,w,S,k,E=v.select("line"),A=m.select("line"),N=p.select("text").text(g),C=v.select("text"),z=m.select("text"),q="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(n=Bo,_="x",S="y",w="x2",k="y2",N.attr("dy",0>q?"0em":".71em").style("text-anchor","middle"),b.attr("d","M"+M[0]+","+q*i+"V0H"+M[1]+"V"+q*i)):(n=Wo,_="y",S="x",w="y2",k="x2",N.attr("dy",".32em").style("text-anchor",0>q?"end":"start"),b.attr("d","M"+q*i+","+M[0]+"H0V"+M[1]+"H"+q*i)),E.attr(k,q*u),C.attr(S,q*y),A.attr(w,0).attr(k,q*u),z.attr(_,0).attr(S,q*y),f.rangeBand){var L=f,T=L.rangeBand()/2;s=f=function(n){return L(n)+T}}else s.rangeBand?s=f:d.call(n,f,s);v.call(n,s,f),m.call(n,f,f)})}var t,e=ta.scale.linear(),r=Ol,u=6,i=6,o=3,a=[10],c=null;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in Yl?t+"":Ol,n):r},n.ticks=function(){return arguments.length?(a=arguments,n):a},n.tickValues=function(t){return arguments.length?(c=t,n):c},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t){var e=arguments.length;return e?(u=+t,i=+arguments[e-1],n):u},n.innerTickSize=function(t){return arguments.length?(u=+t,n):u},n.outerTickSize=function(t){return arguments.length?(i=+t,n):i},n.tickPadding=function(t){return arguments.length?(o=+t,n):o},n.tickSubdivide=function(){return arguments.length&&n},n};var Ol="bottom",Yl={top:1,right:1,bottom:1,left:1};ta.svg.brush=function(){function n(i){i.each(function(){var i=ta.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",u).on("touchstart.brush",u),o=i.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),i.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var a=i.selectAll(".resize").data(p,At);a.exit().remove(),a.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return Il[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),a.style("display",n.empty()?"none":null);var s,f=ta.transition(i),h=ta.transition(o);c&&(s=ji(c),h.attr("x",s[0]).attr("width",s[1]-s[0]),e(f)),l&&(s=ji(l),h.attr("y",s[0]).attr("height",s[1]-s[0]),r(f)),t(f)})}function t(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+s[+/e$/.test(n)]+","+f[+/^s/.test(n)]+")"})}function e(n){n.select(".extent").attr("x",s[0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",s[1]-s[0])}function r(n){n.select(".extent").attr("y",f[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function u(){function u(){32==ta.event.keyCode&&(N||(y=null,z[0]-=s[1],z[1]-=f[1],N=2),b())}function p(){32==ta.event.keyCode&&2==N&&(z[0]+=s[1],z[1]+=f[1],N=0,b())}function v(){var n=ta.mouse(x),u=!1;M&&(n[0]+=M[0],n[1]+=M[1]),N||(ta.event.altKey?(y||(y=[(s[0]+s[1])/2,(f[0]+f[1])/2]),z[0]=s[+(n[0]p?(u=r,r=p):u=p),v[0]!=r||v[1]!=u?(e?o=null:i=null,v[0]=r,v[1]=u,!0):void 0}function m(){v(),S.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),ta.select("body").style("cursor",null),q.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),C(),w({type:"brushend"})}var y,M,x=this,_=ta.select(ta.event.target),w=a.of(x,arguments),S=ta.select(x),k=_.datum(),E=!/^(n|s)$/.test(k)&&c,A=!/^(e|w)$/.test(k)&&l,N=_.classed("extent"),C=$(),z=ta.mouse(x),q=ta.select(oa).on("keydown.brush",u).on("keyup.brush",p);if(ta.event.changedTouches?q.on("touchmove.brush",v).on("touchend.brush",m):q.on("mousemove.brush",v).on("mouseup.brush",m),S.interrupt().selectAll("*").interrupt(),N)z[0]=s[0]-z[0],z[1]=f[0]-z[1];else if(k){var L=+/w$/.test(k),T=+/^n/.test(k);M=[s[1-L]-z[0],f[1-T]-z[1]],z[0]=s[L],z[1]=f[T]}else ta.event.altKey&&(y=z.slice());S.style("pointer-events","none").selectAll(".resize").style("display",null),ta.select("body").style("cursor",_.style("cursor")),w({type:"brushstart"}),v()}var i,o,a=w(n,"brushstart","brush","brushend"),c=null,l=null,s=[0,0],f=[0,0],h=!0,g=!0,p=Zl[0];return n.event=function(n){n.each(function(){var n=a.of(this,arguments),t={x:s,y:f,i:i,j:o},e=this.__chart__||t;this.__chart__=t,Dl?ta.select(this).transition().each("start.brush",function(){i=e.i,o=e.j,s=e.x,f=e.y,n({type:"brushstart"})}).tween("brush:brush",function(){var e=Mu(s,t.x),r=Mu(f,t.y);return i=o=null,function(u){s=t.x=e(u),f=t.y=r(u),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){i=t.i,o=t.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},n.x=function(t){return arguments.length?(c=t,p=Zl[!c<<1|!l],n):c},n.y=function(t){return arguments.length?(l=t,p=Zl[!c<<1|!l],n):l},n.clamp=function(t){return arguments.length?(c&&l?(h=!!t[0],g=!!t[1]):c?h=!!t:l&&(g=!!t),n):c&&l?[h,g]:c?h:l?g:null},n.extent=function(t){var e,r,u,a,h;return arguments.length?(c&&(e=t[0],r=t[1],l&&(e=e[0],r=r[0]),i=[e,r],c.invert&&(e=c(e),r=c(r)),e>r&&(h=e,e=r,r=h),(e!=s[0]||r!=s[1])&&(s=[e,r])),l&&(u=t[0],a=t[1],c&&(u=u[1],a=a[1]),o=[u,a],l.invert&&(u=l(u),a=l(a)),u>a&&(h=u,u=a,a=h),(u!=f[0]||a!=f[1])&&(f=[u,a])),n):(c&&(i?(e=i[0],r=i[1]):(e=s[0],r=s[1],c.invert&&(e=c.invert(e),r=c.invert(r)),e>r&&(h=e,e=r,r=h))),l&&(o?(u=o[0],a=o[1]):(u=f[0],a=f[1],l.invert&&(u=l.invert(u),a=l.invert(a)),u>a&&(h=u,u=a,a=h))),c&&l?[[e,u],[r,a]]:c?[e,r]:l&&[u,a])},n.clear=function(){return n.empty()||(s=[0,0],f=[0,0],i=o=null),n},n.empty=function(){return!!c&&s[0]==s[1]||!!l&&f[0]==f[1]},ta.rebind(n,a,"on")};var Il={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Zl=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Vl=fc.format=mc.timeFormat,Xl=Vl.utc,$l=Xl("%Y-%m-%dT%H:%M:%S.%LZ");Vl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Jo:$l,Jo.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},Jo.toString=$l.toString,fc.second=Ht(function(n){return new hc(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),fc.seconds=fc.second.range,fc.seconds.utc=fc.second.utc.range,fc.minute=Ht(function(n){return new hc(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),fc.minutes=fc.minute.range,fc.minutes.utc=fc.minute.utc.range,fc.hour=Ht(function(n){var t=n.getTimezoneOffset()/60;return new hc(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),fc.hours=fc.hour.range,fc.hours.utc=fc.hour.utc.range,fc.month=Ht(function(n){return n=fc.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),fc.months=fc.month.range,fc.months.utc=fc.month.utc.range;var Bl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Wl=[[fc.second,1],[fc.second,5],[fc.second,15],[fc.second,30],[fc.minute,1],[fc.minute,5],[fc.minute,15],[fc.minute,30],[fc.hour,1],[fc.hour,3],[fc.hour,6],[fc.hour,12],[fc.day,1],[fc.day,2],[fc.week,1],[fc.month,1],[fc.month,3],[fc.year,1]],Jl=Vl.multi([[".%L",function(n){return n.getMilliseconds()}],[":%S",function(n){return n.getSeconds()}],["%I:%M",function(n){return n.getMinutes()}],["%I %p",function(n){return n.getHours()}],["%a %d",function(n){return n.getDay()&&1!=n.getDate()}],["%b %d",function(n){return 1!=n.getDate()}],["%B",function(n){return n.getMonth()}],["%Y",Ce]]),Gl={range:function(n,t,e){return ta.range(Math.ceil(n/e)*e,+t,e).map(Ko)},floor:At,ceil:At};Wl.year=fc.year,fc.scale=function(){return Go(ta.scale.linear(),Wl,Jl)};var Kl=Wl.map(function(n){return[n[0].utc,n[1]]}),Ql=Xl.multi([[".%L",function(n){return n.getUTCMilliseconds()}],[":%S",function(n){return n.getUTCSeconds()}],["%I:%M",function(n){return n.getUTCMinutes()}],["%I %p",function(n){return n.getUTCHours()}],["%a %d",function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],["%b %d",function(n){return 1!=n.getUTCDate()}],["%B",function(n){return n.getUTCMonth()}],["%Y",Ce]]);Kl.year=fc.year.utc,fc.scale.utc=function(){return Go(ta.scale.linear(),Kl,Ql)},ta.text=Nt(function(n){return n.responseText}),ta.json=function(n,t){return Ct(n,"application/json",Qo,t)},ta.html=function(n,t){return Ct(n,"text/html",na,t)},ta.xml=Nt(function(n){return n.responseXML}),"function"==typeof define&&define.amd?define(ta):"object"==typeof module&&module.exports&&(module.exports=ta),this.d3=ta}(); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.layout.cloud.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.layout.cloud.js new file mode 100644 index 0000000..44c4f7d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.layout.cloud.js @@ -0,0 +1,433 @@ +// Word cloud layout by Jason Davies, http://www.jasondavies.com/word-cloud/ +// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf +(function() { + function cloud() { + var size = [256, 256], + text = cloudText, + font = cloudFont, + fontSize = cloudFontSize, + fontStyle = cloudFontNormal, + fontWeight = cloudFontNormal, + rotate = cloudRotate, + padding = cloudPadding, + spiral = archimedeanSpiral, + words = [], + timeInterval = Infinity, + event = d3.dispatch("word", "end"), + timer = null, + cloud = {}; + + cloud.start = function() { + var board = zeroArray((size[0] >> 5) * size[1]), + bounds = null, + n = words.length, + i = -1, + tags = [], + data = words.map(function(d, i) { + d.text = text.call(this, d, i); + d.font = font.call(this, d, i); + d.style = fontStyle.call(this, d, i); + d.weight = fontWeight.call(this, d, i); + d.rotate = rotate.call(this, d, i); + d.size = ~~fontSize.call(this, d, i); + d.padding = padding.call(this, d, i); + return d; + }).sort(function(a, b) { return b.size - a.size; }); +// createMask(); +/* var bd = 3000; + while (bd < 4000) { + board[bd] = -1; + bd++ + } + */ + function createMask() + { + d3.select("body").append("canvas").attr("id", "maskCanvas") + maskCanvas = document.getElementById('maskCanvas'), + maskCanvas.width = 85; + maskCanvas.height = 85; + maskContext = maskCanvas.getContext('2d'); + maskImage = new Image(); + maskImage.src = 'mask.png'; + maskImage.onload = function(){ + maskContext.drawImage(maskImage,0,0,85,85 * maskImage.height / maskImage.width); + maskData = maskContext.getImageData(0,0,85,85).data; +/* + var hh = 0; + while (hh < maskData.length) { + if (hh%4 == 0) { + if (maskData[hh] == 0) { + board[~~(hh/4)] = -1; + } + } + hh++; + } + */ + + } + } + if (timer) clearInterval(timer); + timer = setInterval(step, 0); + step(); + + return cloud; + + function step() { + var start = +new Date, + d; + while (+new Date - start < timeInterval && ++i < n && timer) { + d = data[i]; + d.x = (size[0] * (Math.random() + .5)) >> 1; + d.y = (size[1] * (Math.random() + .5)) >> 1; + cloudSprite(d, data, i); + if (d.hasText && place(board, d, bounds)) { + tags.push(d); + event.word(d); + if (bounds) cloudBounds(bounds, d); + else bounds = [{x: d.x + d.x0, y: d.y + d.y0}, {x: d.x + d.x1, y: d.y + d.y1}]; + // Temporary hack + d.x -= size[0] >> 1; + d.y -= size[1] >> 1; + } + } + if (i >= n) { + cloud.stop(); + event.end(tags, bounds); + } + } + } + + cloud.stop = function() { + if (timer) { + clearInterval(timer); + timer = null; + } + return cloud; + }; + + cloud.timeInterval = function(x) { + if (!arguments.length) return timeInterval; + timeInterval = x == null ? Infinity : x; + return cloud; + }; + + function place(board, tag, bounds) { + var perimeter = [{x: 0, y: 0}, {x: size[0], y: size[1]}], + startX = tag.x, + startY = tag.y, + maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]), + s = spiral(size), + dt = Math.random() < .5 ? 1 : -1, + t = -dt, + dxdy, + dx, + dy; + + while (dxdy = s(t += dt)) { + dx = ~~dxdy[0]; + dy = ~~dxdy[1]; + + if (Math.min(dx, dy) > maxDelta) break; + + tag.x = startX + dx; + tag.y = startY + dy; + + if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || + tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue; + // TODO only check for collisions within current bounds. + if (!bounds || !cloudCollide(tag, board, size[0])) { + if (!bounds || collideRects(tag, bounds)) { + var sprite = tag.sprite, + w = tag.width >> 5, + sw = size[0] >> 5, + lx = tag.x - (w << 4), + sx = lx & 0x7f, + msx = 32 - sx, + h = tag.y1 - tag.y0, + x = (tag.y + tag.y0) * sw + (lx >> 5), + last; + for (var j = 0; j < h; j++) { + last = 0; + for (var i = 0; i <= w; i++) { + board[x + i] |= (last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0); + } + x += sw; + } + delete tag.sprite; + return true; + } + } + } + return false; + } + + cloud.words = function(x) { + if (!arguments.length) return words; + words = x; + return cloud; + }; + + cloud.size = function(x) { + if (!arguments.length) return size; + size = [+x[0], +x[1]]; + return cloud; + }; + + cloud.font = function(x) { + if (!arguments.length) return font; + font = d3.functor(x); + return cloud; + }; + + cloud.fontStyle = function(x) { + if (!arguments.length) return fontStyle; + fontStyle = d3.functor(x); + return cloud; + }; + + cloud.fontWeight = function(x) { + if (!arguments.length) return fontWeight; + fontWeight = d3.functor(x); + return cloud; + }; + + cloud.rotate = function(x) { + if (!arguments.length) return rotate; + rotate = d3.functor(x); + return cloud; + }; + + cloud.text = function(x) { + if (!arguments.length) return text; + text = d3.functor(x); + return cloud; + }; + + cloud.spiral = function(x) { + if (!arguments.length) return spiral; + spiral = spirals[x + ""] || x; + return cloud; + }; + + cloud.fontSize = function(x) { + if (!arguments.length) return fontSize; + fontSize = d3.functor(x); + return cloud; + }; + + cloud.padding = function(x) { + if (!arguments.length) return padding; + padding = d3.functor(x); + return cloud; + }; + + return d3.rebind(cloud, event, "on"); + } + + function cloudText(d) { + return d.text; + } + + function cloudFont() { + return "serif"; + } + + function cloudFontNormal() { + return "normal"; + } + + function cloudFontSize(d) { + return Math.sqrt(d.value); + } + + function cloudRotate() { + return (~~(Math.random() * 6) - 3) * 30; + } + + function cloudPadding() { + return 1; + } + + // Fetches a monochrome sprite bitmap for the specified text. + // Load in batches for speed. + function cloudSprite(d, data, di) { + if (d.sprite) return; + c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio); + var x = 0, + y = 0, + maxh = 0, + n = data.length; + --di; + while (++di < n) { + d = data[di]; + c.save(); + c.font = d.style + " " + d.weight + " " + ~~((d.size + 1) / ratio) + "px " + d.font; + var w = c.measureText(d.text + "m").width * ratio, + h = d.size << 1; + if (d.rotate) { + var sr = Math.sin(d.rotate * cloudRadians), + cr = Math.cos(d.rotate * cloudRadians), + wcr = w * cr, + wsr = w * sr, + hcr = h * cr, + hsr = h * sr; + w = (Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f) >> 5 << 5; + h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr)); + } else { + w = (w + 0x1f) >> 5 << 5; + } + if (h > maxh) maxh = h; + if (x + w >= (cw << 5)) { + x = 0; + y += maxh; + maxh = 0; + } + if (y + h >= ch) break; + c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio); + if (d.rotate) c.rotate(d.rotate * cloudRadians); + c.fillText(d.text, 0, 0); + if (d.padding) c.lineWidth = 2 * d.padding, c.strokeText(d.text, 0, 0); + c.restore(); + d.width = w; + d.height = h; + d.xoff = x; + d.yoff = y; + d.x1 = w >> 1; + d.y1 = h >> 1; + d.x0 = -d.x1; + d.y0 = -d.y1; + d.hasText = true; + x += w; + } + var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, + sprite = []; + while (--di >= 0) { + d = data[di]; + if (!d.hasText) continue; + var w = d.width, + w32 = w >> 5, + h = d.y1 - d.y0; + // Zero the buffer + for (var i = 0; i < h * w32; i++) sprite[i] = 0; + x = d.xoff; + if (x == null) return; + y = d.yoff; + var seen = 0, + seenRow = -1; + for (var j = 0; j < h; j++) { + for (var i = 0; i < w; i++) { + var k = w32 * j + (i >> 5), + m = pixels[((y + j) * (cw << 5) + (x + i)) << 2] ? 1 << (31 - (i % 32)) : 0; + sprite[k] |= m; + seen |= m; + } + if (seen) seenRow = j; + else { + d.y0++; + h--; + j--; + y++; + } + } + d.y1 = d.y0 + seenRow; + d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32); + } + } + + // Use mask-based collision detection. + function cloudCollide(tag, board, sw) { + sw >>= 5; + var sprite = tag.sprite, + w = tag.width >> 5, + lx = tag.x - (w << 4), + sx = lx & 0x7f, + msx = 32 - sx, + h = tag.y1 - tag.y0, + x = (tag.y + tag.y0) * sw + (lx >> 5), + last; + for (var j = 0; j < h; j++) { + last = 0; + for (var i = 0; i <= w; i++) { + if (((last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) + & board[x + i]) return true; + } + x += sw; + } + return false; + } + + function cloudBounds(bounds, d) { + var b0 = bounds[0], + b1 = bounds[1]; + if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0; + if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0; + if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1; + if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1; + } + + function collideRects(a, b) { + return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y; + } + + function archimedeanSpiral(size) { + var e = size[0] / size[1]; + return function(t) { + return [e * (t *= .1) * Math.cos(t), t * Math.sin(t)]; + }; + } + + function rectangularSpiral(size) { + var dy = 4, + dx = dy * size[0] / size[1], + x = 0, + y = 0; + return function(t) { + var sign = t < 0 ? -1 : 1; + // See triangular numbers: T_n = n * (n + 1) / 2. + switch ((Math.sqrt(1 + 4 * sign * t) - sign) & 3) { + case 0: x += dx; break; + case 1: y += dy; break; + case 2: x -= dx; break; + default: y -= dy; break; + } + return [x, y]; + }; + } + + // TODO reuse arrays? + function zeroArray(n) { + var a = [], + i = -1; + while (++i < n) a[i] = 0; + return a; + } + + var cloudRadians = Math.PI / 180, + cw = 1 << 11 >> 5, + ch = 1 << 11, + canvas, + ratio = 1; + + if (typeof document !== "undefined") { + canvas = document.createElement("canvas"); + canvas.width = 1; + canvas.height = 1; + ratio = Math.sqrt(canvas.getContext("2d").getImageData(0, 0, 1, 1).data.length >> 2); + canvas.width = (cw << 5) / ratio; + canvas.height = ch / ratio; + } else { + // Attempt to use node-canvas. + canvas = new Canvas(cw << 5, ch); + } + + var c = canvas.getContext("2d"), + spirals = { + archimedean: archimedeanSpiral, + rectangular: rectangularSpiral + }; + c.fillStyle = c.strokeStyle = "red"; + c.textAlign = "center"; + + if (typeof module === "object" && module.exports) module.exports = cloud; + else (d3.layout || (d3.layout = {})).cloud = cloud; +})(); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.layout.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.layout.js new file mode 100644 index 0000000..abc5ebe --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.layout.js @@ -0,0 +1,908 @@ +(function(){d3.layout = {}; +d3.layout.chord = function() { + var chord = {}, + chords, + groups, + matrix, + n, + padding = 0, + sortGroups, + sortSubgroups, + sortChords; + + function relayout() { + var subgroups = {}, + groupSums = [], + groupIndex = d3.range(n), + subgroupIndex = [], + k, + x, + x0, + i, + j; + + chords = []; + groups = []; + + // Compute the sum. + k = 0, i = -1; while (++i < n) { + x = 0, j = -1; while (++j < n) { + x += matrix[i][j]; + } + groupSums.push(x); + subgroupIndex.push(d3.range(n)); + k += x; + } + + // Sort groups… + if (sortGroups) { + groupIndex.sort(function(a, b) { + return sortGroups(groupSums[a], groupSums[b]); + }); + } + + // Sort subgroups… + if (sortSubgroups) { + subgroupIndex.forEach(function(d, i) { + d.sort(function(a, b) { + return sortSubgroups(matrix[i][a], matrix[i][b]); + }); + }); + } + + // Convert the sum to scaling factor for [0, 2pi]. + // TODO Allow start and end angle to be specified. + // TODO Allow padding to be specified as percentage? + k = (2 * Math.PI - padding * n) / k; + + // Compute the start and end angle for each group and subgroup. + x = 0, i = -1; while (++i < n) { + x0 = x, j = -1; while (++j < n) { + var di = groupIndex[i], + dj = subgroupIndex[i][j], + v = matrix[di][dj]; + subgroups[di + "-" + dj] = { + index: di, + subindex: dj, + startAngle: x, + endAngle: x += v * k, + value: v + }; + } + groups.push({ + index: di, + startAngle: x0, + endAngle: x, + value: (x - x0) / k + }); + x += padding; + } + + // Generate chords for each (non-empty) subgroup-subgroup link. + i = -1; while (++i < n) { + j = i - 1; while (++j < n) { + var source = subgroups[i + "-" + j], + target = subgroups[j + "-" + i]; + if (source.value || target.value) { + chords.push({ + source: source, + target: target + }) + } + } + } + + if (sortChords) resort(); + } + + function resort() { + chords.sort(function(a, b) { + a = Math.min(a.source.value, a.target.value); + b = Math.min(b.source.value, b.target.value); + return sortChords(a, b); + }); + } + + chord.matrix = function(x) { + if (!arguments.length) return matrix; + n = (matrix = x) && matrix.length; + chords = groups = null; + return chord; + }; + + chord.padding = function(x) { + if (!arguments.length) return padding; + padding = x; + chords = groups = null; + return chord; + }; + + chord.sortGroups = function(x) { + if (!arguments.length) return sortGroups; + sortGroups = x; + chords = groups = null; + return chord; + }; + + chord.sortSubgroups = function(x) { + if (!arguments.length) return sortSubgroups; + sortSubgroups = x; + chords = null; + return chord; + }; + + chord.sortChords = function(x) { + if (!arguments.length) return sortChords; + sortChords = x; + if (chords) resort(); + return chord; + }; + + chord.chords = function() { + if (!chords) relayout(); + return chords; + }; + + chord.groups = function() { + if (!groups) relayout(); + return groups; + }; + + return chord; +}; +// A rudimentary force layout using Gauss-Seidel. +d3.layout.force = function() { + var force = {}, + event = d3.dispatch("tick"), + size = [1, 1], + alpha = .5, + distance = 30, + interval, + nodes, + links, + distances; + + function tick() { + var n = distances.length, + i, // current index + o, // current link + s, // current source + t, // current target + l, // current distance + x, // x-distance + y; // y-distance + + // gauss-seidel relaxation + for (i = 0; i < n; ++i) { + o = distances[i]; + s = o.source; + t = o.target; + x = t.x - s.x; + y = t.y - s.y; + if (l = Math.sqrt(x * x + y * y)) { + l = alpha / (o.distance * o.distance) * (l - distance * o.distance) / l; + x *= l; + y *= l; + if (!t.fixed) { + t.x -= x; + t.y -= y; + } + if (!s.fixed) { + s.x += x; + s.y += y; + } + } + } + + event.tick.dispatch({type: "tick"}); + + // simulated annealing, basically + return (alpha *= .99) < .005; + } + + force.on = function(type, listener) { + event[type].add(listener); + return force; + }; + + force.nodes = function(x) { + if (!arguments.length) return nodes; + nodes = x; + return force; + }; + + force.links = function(x) { + if (!arguments.length) return links; + links = x; + return force; + }; + + force.size = function(x) { + if (!arguments.length) return size; + size = x; + return force; + }; + + force.distance = function(d) { + if (!arguments.length) return distance; + distance = d; + return force; + }; + + force.start = function() { + var i, + j, + k, + n = nodes.length, + m = links.length, + w = size[0], + h = size[1], + o; + + var paths = []; + for (i = 0; i < n; ++i) { + o = nodes[i]; + o.x = o.x || Math.random() * w; + o.y = o.y || Math.random() * h; + o.fixed = 0; + paths[i] = []; + for (j = 0; j < n; ++j) { + paths[i][j] = Infinity; + } + paths[i][i] = 0; + } + + for (i = 0; i < m; ++i) { + o = links[i]; + paths[o.source][o.target] = 1; + paths[o.target][o.source] = 1; + o.source = nodes[o.source]; + o.target = nodes[o.target]; + } + + // Floyd-Warshall + for (k = 0; k < n; ++k) { + for (i = 0; i < n; ++i) { + for (j = 0; j < n; ++j) { + paths[i][j] = Math.min(paths[i][j], paths[i][k] + paths[k][j]); + } + } + } + + distances = []; + for (i = 0; i < n; ++i) { + for (j = i + 1; j < n; ++j) { + distances.push({ + source: nodes[i], + target: nodes[j], + distance: paths[i][j] * paths[i][j] + }); + } + } + + distances.sort(function(a, b) { + return a.distance - b.distance; + }); + + d3.timer(tick); + return force; + }; + + force.resume = function() { + alpha = .1; + d3.timer(tick); + return force; + }; + + force.stop = function() { + alpha = 0; + return force; + }; + + // use `node.call(force.drag)` to make nodes draggable + force.drag = function() { + var node, element; + + this + .on("mouseover", function(d) { d.fixed = true; }) + .on("mouseout", function(d) { if (d != node) d.fixed = false; }) + .on("mousedown", mousedown); + + d3.select(window) + .on("mousemove", mousemove) + .on("mouseup", mouseup); + + function mousedown(d) { + (node = d).fixed = true; + element = this; + d3.event.preventDefault(); + } + + function mousemove() { + if (!node) return; + var m = d3.svg.mouse(element); + node.x = m[0]; + node.y = m[1]; + force.resume(); // restart annealing + } + + function mouseup() { + if (!node) return; + mousemove(); + node.fixed = false; + node = element = null; + } + + return force; + }; + + return force; +}; +d3.layout.partition = function() { + var hierarchy = d3.layout.hierarchy(), + size = [1, 1]; // width, height + + function position(node, x, dx, dy) { + var children = node.children; + node.x = x; + node.y = node.depth * dy; + node.dx = dx; + node.dy = dy; + if (children) { + var i = -1, + n = children.length, + c, + d; + dx /= node.value; + while (++i < n) { + position(c = children[i], x, d = c.value * dx, dy); + x += d; + } + } + } + + function depth(node) { + var children = node.children, + d = 0; + if (children) { + var i = -1, + n = children.length; + while (++i < n) d = Math.max(d, depth(children[i])); + } + return 1 + d; + } + + function partition(d, i) { + var nodes = hierarchy.call(this, d, i); + position(nodes[0], 0, size[0], size[1] / depth(nodes[0])); + return nodes; + } + + partition.sort = d3.rebind(partition, hierarchy.sort); + partition.children = d3.rebind(partition, hierarchy.children); + partition.value = d3.rebind(partition, hierarchy.value); + + partition.size = function(x) { + if (!arguments.length) return size; + size = x; + return partition; + }; + + return partition; +}; +d3.layout.pie = function() { + var value = Number, + sort = null, + startAngle = 0, + endAngle = 2 * Math.PI; + + function pie(data, i) { + + // Compute the start angle. + var a = +(typeof startAngle == "function" + ? startAngle.apply(this, arguments) + : startAngle); + + // Compute the angular range (end - start). + var k = (typeof endAngle == "function" + ? endAngle.apply(this, arguments) + : endAngle) - startAngle; + + // Optionally sort the data. + var index = d3.range(data.length); + if (sort != null) index.sort(function(i, j) { + return sort(data[i], data[j]); + }); + + // Compute the numeric values for each data element. + var values = data.map(value); + + // Convert k into a scale factor from value to angle, using the sum. + k /= values.reduce(function(p, d) { return p + d; }, 0); + + // Compute the arcs! + var arcs = index.map(function(i) { + return { + value: d = values[i], + startAngle: a, + endAngle: a += d * k + }; + }); + + // Return the arcs in the original data's order. + return data.map(function(d, i) { + return arcs[index[i]]; + }); + } + + /** + * Specifies the value function *x*, which returns a nonnegative numeric value + * for each datum. The default value function is `Number`. The value function + * is passed two arguments: the current datum and the current index. + */ + pie.value = function(x) { + if (!arguments.length) return value; + value = x; + return pie; + }; + + /** + * Specifies a sort comparison operator *x*. The comparator is passed two data + * elements from the data array, a and b; it returns a negative value if a is + * less than b, a positive value if a is greater than b, and zero if a equals + * b. + */ + pie.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return pie; + }; + + /** + * Specifies the overall start angle of the pie chart. Defaults to 0. The + * start angle can be specified either as a constant or as a function; in the + * case of a function, it is evaluated once per array (as opposed to per + * element). + */ + pie.startAngle = function(x) { + if (!arguments.length) return startAngle; + startAngle = x; + return pie; + }; + + /** + * Specifies the overall end angle of the pie chart. Defaults to 2Ï€. The + * end angle can be specified either as a constant or as a function; in the + * case of a function, it is evaluated once per array (as opposed to per + * element). + */ + pie.endAngle = function(x) { + if (!arguments.length) return endAngle; + endAngle = x; + return pie; + }; + + return pie; +}; +// data is two-dimensional array of x,y; we populate y0 +// TODO perhaps make the `x`, `y` and `y0` structure customizable +d3.layout.stack = function() { + var order = "default", + offset = "zero"; + + function stack(data) { + var n = data.length, + m = data[0].length, + i, + j, + y0; + + // compute the order of series + var index = d3_layout_stackOrders[order](data); + + // set y0 on the baseline + d3_layout_stackOffsets[offset](data, index); + + // propagate offset to other series + for (j = 0; j < m; ++j) { + for (i = 1, y0 = data[index[0]][j].y0; i < n; ++i) { + data[index[i]][j].y0 = y0 += data[index[i - 1]][j].y; + } + } + + return data; + } + + stack.order = function(x) { + if (!arguments.length) return order; + order = x; + return stack; + }; + + stack.offset = function(x) { + if (!arguments.length) return offset; + offset = x; + return stack; + }; + + return stack; +} + +var d3_layout_stackOrders = { + + "inside-out": function(data) { + var n = data.length, + i, + j, + max = data.map(d3_layout_stackMaxIndex), + sums = data.map(d3_layout_stackReduceSum), + index = d3.range(n).sort(function(a, b) { return max[a] - max[b]; }), + top = 0, + bottom = 0, + tops = [], + bottoms = []; + for (i = 0; i < n; i++) { + j = index[i]; + if (top < bottom) { + top += sums[j]; + tops.push(j); + } else { + bottom += sums[j]; + bottoms.push(j); + } + } + return bottoms.reverse().concat(tops); + }, + + "reverse": function(data) { + return d3.range(data.length).reverse(); + }, + + "default": function(data) { + return d3.range(data.length); + } + +}; + +var d3_layout_stackOffsets = { + + "silhouette": function(data, index) { + var n = data.length, + m = data[0].length, + sums = [], + max = 0, + i, + j, + o; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j].y; + if (o > max) max = o; + sums.push(o); + } + for (j = 0, i = index[0]; j < m; ++j) { + data[i][j].y0 = (max - sums[j]) / 2; + } + }, + + "wiggle": function(data, index) { + var n = data.length, + x = data[0], + m = x.length, + max = 0, + i, + j, + k, + ii, + ik, + i0 = index[0], + s1, + s2, + s3, + dx, + o, + o0; + data[i0][0].y0 = o = o0 = 0; + for (j = 1; j < m; ++j) { + for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j].y; + for (i = 0, s2 = 0, dx = x[j].x - x[j - 1].x; i < n; ++i) { + for (k = 0, ii = index[i], s3 = (data[ii][j].y - data[ii][j - 1].y) / (2 * dx); k < i; ++k) { + s3 += (data[ik = index[k]][j].y - data[ik][j - 1].y) / dx; + } + s2 += s3 * data[ii][j].y; + } + data[i0][j].y0 = o -= s1 ? s2 / s1 * dx : 0; + if (o < o0) o0 = o; + } + for (j = 0; j < m; ++j) data[i0][j].y0 -= o0; + }, + + "zero": function(data, index) { + var j = 0, + m = data[0].length, + i0 = index[0]; + for (; j < m; ++j) data[i0][j].y0 = 0; + } + +}; + +function d3_layout_stackReduceSum(d) { + return d.reduce(d3_layout_stackSum, 0); +} + +function d3_layout_stackMaxIndex(array) { + var i = 1, + j = 0, + v = array[0].y, + k, + n = array.length; + for (; i < n; ++i) { + if ((k = array[i].y) > v) { + j = i; + v = k; + } + } + return j; +} + +function d3_layout_stackSum(p, d) { + return p + d.y; +} +d3.layout.hierarchy = function() { + var sort = d3_layout_hierarchySort, + children = d3_layout_hierarchyChildren, + value = d3_layout_hierarchyValue; + + // Recursively compute the node depth and value. + // Also converts the data representation into a standard hierarchy structure. + function recurse(data, depth, nodes) { + var datas = children.call(hierarchy, data, depth), + node = {depth: depth, data: data}; + nodes.push(node); + if (datas) { + var i = -1, + n = datas.length, + c = node.children = [], + v = 0, + j = depth + 1; + while (++i < n) { + d = recurse(datas[i], j, nodes); + if (d.value > 0) { // ignore NaN, negative, etc. + c.push(d); + v += d.value; + d.parent = node; + } + } + if (sort) c.sort(sort); + node.value = v; + } else { + node.value = value.call(hierarchy, data, depth); + } + return node; + } + + // Recursively re-evaluates the node value. + function revalue(node, depth) { + var children = node.children, + v = 0; + if (children) { + var i = -1, + n = children.length, + j = depth + 1; + while (++i < n) v += revalue(children[i], j); + } else { + v = value.call(hierarchy, node.data, depth); + } + return node.value = v; + } + + function hierarchy(d) { + var nodes = []; + recurse(d, 0, nodes); + return nodes; + } + + hierarchy.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return hierarchy; + }; + + hierarchy.children = function(x) { + if (!arguments.length) return children; + children = x; + return hierarchy; + }; + + hierarchy.value = function(x) { + if (!arguments.length) return value; + value = x; + return hierarchy; + }; + + // Re-evaluates the `value` property for the specified hierarchy. + hierarchy.revalue = function(root) { + revalue(root, 0); + return root; + }; + + return hierarchy; +} + +function d3_layout_hierarchyChildren(d) { + return d.children; +} + +function d3_layout_hierarchyValue(d) { + return d.value; +} + +function d3_layout_hierarchySort(a, b) { + return b.value - a.value; +} +// Squarified Treemaps by Mark Bruls, Kees Huizing, and Jarke J. van Wijk +d3.layout.treemap = function() { + var hierarchy = d3.layout.hierarchy(), + round = Math.round, + size = [1, 1], // width, height + sticky = false, + stickies; + + // Recursively compute the node area based on value & scale. + function scale(node, k) { + var children = node.children; + node.area = node.value * k; + if (children) { + var i = -1, + n = children.length; + while (++i < n) scale(children[i], k); + } + } + + // Recursively arranges the specified node's children into squarified rows. + function squarify(node) { + if (!node.children) return; + var rect = {x: node.x, y: node.y, dx: node.dx, dy: node.dy}, + row = [], + children = node.children.slice(), // copy-on-write + child, + best = Infinity, // the best row score so far + score, // the current row score + u = Math.min(rect.dx, rect.dy), // initial orientation + n; + row.area = 0; + while ((n = children.length) > 0) { + row.push(child = children[n - 1]); + row.area += child.area; + if ((score = worst(row, u)) <= best) { // continue with this orientation + children.pop(); + best = score; + } else { // abort, and try a different orientation + row.area -= row.pop().area; + position(row, u, rect, false); + u = Math.min(rect.dx, rect.dy); + row.length = row.area = 0; + best = Infinity; + } + } + if (row.length) { + position(row, u, rect, true); + row.length = row.area = 0; + } + node.children.forEach(squarify); + } + + // Recursively resizes the specified node's children into existing rows. + // Preserves the existing layout! + function stickify(node) { + if (!node.children) return; + var rect = {x: node.x, y: node.y, dx: node.dx, dy: node.dy}, + children = node.children.slice(), // copy-on-write + child, + row = []; + row.area = 0; + while (child = children.pop()) { + row.push(child); + row.area += child.area; + if (child.z != null) { + position(row, child.z ? rect.dx : rect.dy, rect, !children.length); + row.length = row.area = 0; + } + } + node.children.forEach(stickify); + } + + // Computes the score for the specified row, as the worst aspect ratio. + function worst(row, u) { + var s = row.area, + r, + rmax = 0, + rmin = Infinity, + i = -1, + n = row.length; + while (++i < n) { + r = row[i].area; + if (r < rmin) rmin = r; + if (r > rmax) rmax = r; + } + s *= s; + u *= u; + return Math.max((u * rmax) / s, s / (u * rmin)); + } + + // Positions the specified row of nodes. Modifies `rect`. + function position(row, u, rect, flush) { + var i = -1, + n = row.length, + x = rect.x, + y = rect.y, + v = u ? round(row.area / u) : 0, + o; + if (u == rect.dx) { // horizontal subdivision + if (flush || v > rect.dy) v = rect.dy; // over+underflow + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dy = v; + x += o.dx = round(o.area / v); + } + o.z = true; + o.dx += rect.x + rect.dx - x; // rounding error + rect.y += v; + rect.dy -= v; + } else { // vertical subdivision + if (flush || v > rect.dx) v = rect.dx; // over+underflow + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dx = v; + y += o.dy = round(o.area / v); + } + o.z = false; + o.dy += rect.y + rect.dy - y; // rounding error + rect.x += v; + rect.dx -= v; + } + } + + function treemap(d) { + var nodes = stickies || hierarchy(d), + root = nodes[0]; + root.x = 0; + root.y = 0; + root.dx = size[0]; + root.dy = size[1]; + if (stickies) hierarchy.revalue(root); + scale(root, size[0] * size[1] / root.value); + (stickies ? stickify : squarify)(root); + if (sticky) stickies = nodes; + return nodes; + } + + treemap.sort = d3.rebind(treemap, hierarchy.sort); + treemap.children = d3.rebind(treemap, hierarchy.children); + treemap.value = d3.rebind(treemap, hierarchy.value); + + treemap.size = function(x) { + if (!arguments.length) return size; + size = x; + return treemap; + }; + + treemap.round = function(x) { + if (!arguments.length) return round != Number; + round = x ? Math.round : Number; + return treemap; + }; + + treemap.sticky = function(x) { + if (!arguments.length) return sticky; + sticky = x; + stickies = null; + return treemap; + }; + + return treemap; +}; +})() \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v2.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v2.js new file mode 100644 index 0000000..78c4dbc --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v2.js @@ -0,0 +1,7037 @@ +(function() { + function d3_class(ctor, properties) { + try { + for (var key in properties) { + Object.defineProperty(ctor.prototype, key, { + value: properties[key], + enumerable: false + }); + } + } catch (e) { + ctor.prototype = properties; + } + } + function d3_arrayCopy(pseudoarray) { + var i = -1, n = pseudoarray.length, array = []; + while (++i < n) array.push(pseudoarray[i]); + return array; + } + function d3_arraySlice(pseudoarray) { + return Array.prototype.slice.call(pseudoarray); + } + function d3_Map() {} + function d3_identity(d) { + return d; + } + function d3_this() { + return this; + } + function d3_true() { + return true; + } + function d3_functor(v) { + return typeof v === "function" ? v : function() { + return v; + }; + } + function d3_rebind(target, source, method) { + return function() { + var value = method.apply(source, arguments); + return arguments.length ? target : value; + }; + } + function d3_number(x) { + return x != null && !isNaN(x); + } + function d3_zipLength(d) { + return d.length; + } + function d3_splitter(d) { + return d == null; + } + function d3_collapse(s) { + return s.trim().replace(/\s+/g, " "); + } + function d3_range_integerScale(x) { + var k = 1; + while (x * k % 1) k *= 10; + return k; + } + function d3_dispatch() {} + function d3_dispatch_event(dispatch) { + function event() { + var z = listeners, i = -1, n = z.length, l; + while (++i < n) if (l = z[i].on) l.apply(this, arguments); + return dispatch; + } + var listeners = [], listenerByName = new d3_Map; + event.on = function(name, listener) { + var l = listenerByName.get(name), i; + if (arguments.length < 2) return l && l.on; + if (l) { + l.on = null; + listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1)); + listenerByName.remove(name); + } + if (listener) listeners.push(listenerByName.set(name, { + on: listener + })); + return dispatch; + }; + return event; + } + function d3_format_precision(x, p) { + return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1); + } + function d3_format_typeDefault(x) { + return x + ""; + } + function d3_format_group(value) { + var i = value.lastIndexOf("."), f = i >= 0 ? value.substring(i) : (i = value.length, ""), t = []; + while (i > 0) t.push(value.substring(i -= 3, i + 3)); + return t.reverse().join(",") + f; + } + function d3_formatPrefix(d, i) { + var k = Math.pow(10, Math.abs(8 - i) * 3); + return { + scale: i > 8 ? function(d) { + return d / k; + } : function(d) { + return d * k; + }, + symbol: d + }; + } + function d3_ease_clamp(f) { + return function(t) { + return t <= 0 ? 0 : t >= 1 ? 1 : f(t); + }; + } + function d3_ease_reverse(f) { + return function(t) { + return 1 - f(1 - t); + }; + } + function d3_ease_reflect(f) { + return function(t) { + return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t)); + }; + } + function d3_ease_identity(t) { + return t; + } + function d3_ease_poly(e) { + return function(t) { + return Math.pow(t, e); + }; + } + function d3_ease_sin(t) { + return 1 - Math.cos(t * Math.PI / 2); + } + function d3_ease_exp(t) { + return Math.pow(2, 10 * (t - 1)); + } + function d3_ease_circle(t) { + return 1 - Math.sqrt(1 - t * t); + } + function d3_ease_elastic(a, p) { + var s; + if (arguments.length < 2) p = .45; + if (arguments.length < 1) { + a = 1; + s = p / 4; + } else s = p / (2 * Math.PI) * Math.asin(1 / a); + return function(t) { + return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p); + }; + } + function d3_ease_back(s) { + if (!s) s = 1.70158; + return function(t) { + return t * t * ((s + 1) * t - s); + }; + } + function d3_ease_bounce(t) { + return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375; + } + function d3_eventCancel() { + d3.event.stopPropagation(); + d3.event.preventDefault(); + } + function d3_eventSource() { + var e = d3.event, s; + while (s = e.sourceEvent) e = s; + return e; + } + function d3_eventDispatch(target) { + var dispatch = new d3_dispatch, i = 0, n = arguments.length; + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); + dispatch.of = function(thiz, argumentz) { + return function(e1) { + try { + var e0 = e1.sourceEvent = d3.event; + e1.target = target; + d3.event = e1; + dispatch[e1.type].apply(thiz, argumentz); + } finally { + d3.event = e0; + } + }; + }; + return dispatch; + } + function d3_transform(m) { + var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0; + if (r0[0] * r1[1] < r1[0] * r0[1]) { + r0[0] *= -1; + r0[1] *= -1; + kx *= -1; + kz *= -1; + } + this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees; + this.translate = [ m.e, m.f ]; + this.scale = [ kx, ky ]; + this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0; + } + function d3_transformDot(a, b) { + return a[0] * b[0] + a[1] * b[1]; + } + function d3_transformNormalize(a) { + var k = Math.sqrt(d3_transformDot(a, a)); + if (k) { + a[0] /= k; + a[1] /= k; + } + return k; + } + function d3_transformCombine(a, b, k) { + a[0] += k * b[0]; + a[1] += k * b[1]; + return a; + } + function d3_interpolateByName(name) { + return name == "transform" ? d3.interpolateTransform : d3.interpolate; + } + function d3_uninterpolateNumber(a, b) { + b = b - (a = +a) ? 1 / (b - a) : 0; + return function(x) { + return (x - a) * b; + }; + } + function d3_uninterpolateClamp(a, b) { + b = b - (a = +a) ? 1 / (b - a) : 0; + return function(x) { + return Math.max(0, Math.min(1, (x - a) * b)); + }; + } + function d3_rgb(r, g, b) { + return new d3_Rgb(r, g, b); + } + function d3_Rgb(r, g, b) { + this.r = r; + this.g = g; + this.b = b; + } + function d3_rgb_hex(v) { + return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16); + } + function d3_rgb_parse(format, rgb, hsl) { + var r = 0, g = 0, b = 0, m1, m2, name; + m1 = /([a-z]+)\((.*)\)/i.exec(format); + if (m1) { + m2 = m1[2].split(","); + switch (m1[1]) { + case "hsl": + { + return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100); + } + case "rgb": + { + return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2])); + } + } + } + if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b); + if (format != null && format.charAt(0) === "#") { + if (format.length === 4) { + r = format.charAt(1); + r += r; + g = format.charAt(2); + g += g; + b = format.charAt(3); + b += b; + } else if (format.length === 7) { + r = format.substring(1, 3); + g = format.substring(3, 5); + b = format.substring(5, 7); + } + r = parseInt(r, 16); + g = parseInt(g, 16); + b = parseInt(b, 16); + } + return rgb(r, g, b); + } + function d3_rgb_hsl(r, g, b) { + var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2; + if (d) { + s = l < .5 ? d / (max + min) : d / (2 - max - min); + if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4; + h *= 60; + } else { + s = h = 0; + } + return d3_hsl(h, s, l); + } + function d3_rgb_lab(r, g, b) { + r = d3_rgb_xyz(r); + g = d3_rgb_xyz(g); + b = d3_rgb_xyz(b); + var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z); + return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z)); + } + function d3_rgb_xyz(r) { + return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4); + } + function d3_rgb_parseNumber(c) { + var f = parseFloat(c); + return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f; + } + function d3_hsl(h, s, l) { + return new d3_Hsl(h, s, l); + } + function d3_Hsl(h, s, l) { + this.h = h; + this.s = s; + this.l = l; + } + function d3_hsl_rgb(h, s, l) { + function v(h) { + if (h > 360) h -= 360; else if (h < 0) h += 360; + if (h < 60) return m1 + (m2 - m1) * h / 60; + if (h < 180) return m2; + if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; + return m1; + } + function vv(h) { + return Math.round(v(h) * 255); + } + var m1, m2; + h = h % 360; + if (h < 0) h += 360; + s = s < 0 ? 0 : s > 1 ? 1 : s; + l = l < 0 ? 0 : l > 1 ? 1 : l; + m2 = l <= .5 ? l * (1 + s) : l + s - l * s; + m1 = 2 * l - m2; + return d3_rgb(vv(h + 120), vv(h), vv(h - 120)); + } + function d3_hcl(h, c, l) { + return new d3_Hcl(h, c, l); + } + function d3_Hcl(h, c, l) { + this.h = h; + this.c = c; + this.l = l; + } + function d3_hcl_lab(h, c, l) { + return d3_lab(l, Math.cos(h *= Math.PI / 180) * c, Math.sin(h) * c); + } + function d3_lab(l, a, b) { + return new d3_Lab(l, a, b); + } + function d3_Lab(l, a, b) { + this.l = l; + this.a = a; + this.b = b; + } + function d3_lab_rgb(l, a, b) { + var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200; + x = d3_lab_xyz(x) * d3_lab_X; + y = d3_lab_xyz(y) * d3_lab_Y; + z = d3_lab_xyz(z) * d3_lab_Z; + return d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z)); + } + function d3_lab_hcl(l, a, b) { + return d3_hcl(Math.atan2(b, a) / Math.PI * 180, Math.sqrt(a * a + b * b), l); + } + function d3_lab_xyz(x) { + return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037; + } + function d3_xyz_lab(x) { + return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29; + } + function d3_xyz_rgb(r) { + return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055)); + } + function d3_selection(groups) { + d3_arraySubclass(groups, d3_selectionPrototype); + return groups; + } + function d3_selection_selector(selector) { + return function() { + return d3_select(selector, this); + }; + } + function d3_selection_selectorAll(selector) { + return function() { + return d3_selectAll(selector, this); + }; + } + function d3_selection_attr(name, value) { + function attrNull() { + this.removeAttribute(name); + } + function attrNullNS() { + this.removeAttributeNS(name.space, name.local); + } + function attrConstant() { + this.setAttribute(name, value); + } + function attrConstantNS() { + this.setAttributeNS(name.space, name.local, value); + } + function attrFunction() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttribute(name); else this.setAttribute(name, x); + } + function attrFunctionNS() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x); + } + name = d3.ns.qualify(name); + return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant; + } + function d3_selection_classedRe(name) { + return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g"); + } + function d3_selection_classed(name, value) { + function classedConstant() { + var i = -1; + while (++i < n) name[i](this, value); + } + function classedFunction() { + var i = -1, x = value.apply(this, arguments); + while (++i < n) name[i](this, x); + } + name = name.trim().split(/\s+/).map(d3_selection_classedName); + var n = name.length; + return typeof value === "function" ? classedFunction : classedConstant; + } + function d3_selection_classedName(name) { + var re = d3_selection_classedRe(name); + return function(node, value) { + if (c = node.classList) return value ? c.add(name) : c.remove(name); + var c = node.className, cb = c.baseVal != null, cv = cb ? c.baseVal : c; + if (value) { + re.lastIndex = 0; + if (!re.test(cv)) { + cv = d3_collapse(cv + " " + name); + if (cb) c.baseVal = cv; else node.className = cv; + } + } else if (cv) { + cv = d3_collapse(cv.replace(re, " ")); + if (cb) c.baseVal = cv; else node.className = cv; + } + }; + } + function d3_selection_style(name, value, priority) { + function styleNull() { + this.style.removeProperty(name); + } + function styleConstant() { + this.style.setProperty(name, value, priority); + } + function styleFunction() { + var x = value.apply(this, arguments); + if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority); + } + return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant; + } + function d3_selection_property(name, value) { + function propertyNull() { + delete this[name]; + } + function propertyConstant() { + this[name] = value; + } + function propertyFunction() { + var x = value.apply(this, arguments); + if (x == null) delete this[name]; else this[name] = x; + } + return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant; + } + function d3_selection_dataNode(data) { + return { + __data__: data + }; + } + function d3_selection_filter(selector) { + return function() { + return d3_selectMatches(this, selector); + }; + } + function d3_selection_sortComparator(comparator) { + if (!arguments.length) comparator = d3.ascending; + return function(a, b) { + return comparator(a && a.__data__, b && b.__data__); + }; + } + function d3_selection_on(type, listener, capture) { + function onRemove() { + var wrapper = this[name]; + if (wrapper) { + this.removeEventListener(type, wrapper, wrapper.$); + delete this[name]; + } + } + function onAdd() { + function wrapper(e) { + var o = d3.event; + d3.event = e; + args[0] = node.__data__; + try { + listener.apply(node, args); + } finally { + d3.event = o; + } + } + var node = this, args = arguments; + onRemove.call(this); + this.addEventListener(type, this[name] = wrapper, wrapper.$ = capture); + wrapper._ = listener; + } + var name = "__on" + type, i = type.indexOf("."); + if (i > 0) type = type.substring(0, i); + return listener ? onAdd : onRemove; + } + function d3_selection_each(groups, callback) { + for (var j = 0, m = groups.length; j < m; j++) { + for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) { + if (node = group[i]) callback(node, i, j); + } + } + return groups; + } + function d3_selection_enter(selection) { + d3_arraySubclass(selection, d3_selection_enterPrototype); + return selection; + } + function d3_transition(groups, id, time) { + d3_arraySubclass(groups, d3_transitionPrototype); + var tweens = new d3_Map, event = d3.dispatch("start", "end"), ease = d3_transitionEase; + groups.id = id; + groups.time = time; + groups.tween = function(name, tween) { + if (arguments.length < 2) return tweens.get(name); + if (tween == null) tweens.remove(name); else tweens.set(name, tween); + return groups; + }; + groups.ease = function(value) { + if (!arguments.length) return ease; + ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments); + return groups; + }; + groups.each = function(type, listener) { + if (arguments.length < 2) return d3_transition_each.call(groups, type); + event.on(type, listener); + return groups; + }; + d3.timer(function(elapsed) { + return d3_selection_each(groups, function(node, i, j) { + function start(elapsed) { + if (lock.active > id) return stop(); + lock.active = id; + tweens.forEach(function(key, value) { + if (value = value.call(node, d, i)) { + tweened.push(value); + } + }); + event.start.call(node, d, i); + if (!tick(elapsed)) d3.timer(tick, 0, time); + return 1; + } + function tick(elapsed) { + if (lock.active !== id) return stop(); + var t = (elapsed - delay) / duration, e = ease(t), n = tweened.length; + while (n > 0) { + tweened[--n].call(node, e); + } + if (t >= 1) { + stop(); + d3_transitionId = id; + event.end.call(node, d, i); + d3_transitionId = 0; + return 1; + } + } + function stop() { + if (!--lock.count) delete node.__transition__; + return 1; + } + var tweened = [], delay = node.delay, duration = node.duration, lock = (node = node.node).__transition__ || (node.__transition__ = { + active: 0, + count: 0 + }), d = node.__data__; + ++lock.count; + delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time); + }); + }, 0, time); + return groups; + } + function d3_transition_each(callback) { + var id = d3_transitionId, ease = d3_transitionEase, delay = d3_transitionDelay, duration = d3_transitionDuration; + d3_transitionId = this.id; + d3_transitionEase = this.ease(); + d3_selection_each(this, function(node, i, j) { + d3_transitionDelay = node.delay; + d3_transitionDuration = node.duration; + callback.call(node = node.node, node.__data__, i, j); + }); + d3_transitionId = id; + d3_transitionEase = ease; + d3_transitionDelay = delay; + d3_transitionDuration = duration; + return this; + } + function d3_tweenNull(d, i, a) { + return a != "" && d3_tweenRemove; + } + function d3_tweenByName(b, name) { + return d3.tween(b, d3_interpolateByName(name)); + } + function d3_timer_step() { + var elapsed, now = Date.now(), t1 = d3_timer_queue; + while (t1) { + elapsed = now - t1.then; + if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed); + t1 = t1.next; + } + var delay = d3_timer_flush() - now; + if (delay > 24) { + if (isFinite(delay)) { + clearTimeout(d3_timer_timeout); + d3_timer_timeout = setTimeout(d3_timer_step, delay); + } + d3_timer_interval = 0; + } else { + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } + } + function d3_timer_flush() { + var t0 = null, t1 = d3_timer_queue, then = Infinity; + while (t1) { + if (t1.flush) { + t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next; + } else { + then = Math.min(then, t1.then + t1.delay); + t1 = (t0 = t1).next; + } + } + return then; + } + function d3_mousePoint(container, e) { + var svg = container.ownerSVGElement || container; + if (svg.createSVGPoint) { + var point = svg.createSVGPoint(); + if (d3_mouse_bug44083 < 0 && (window.scrollX || window.scrollY)) { + svg = d3.select(document.body).append("svg").style("position", "absolute").style("top", 0).style("left", 0); + var ctm = svg[0][0].getScreenCTM(); + d3_mouse_bug44083 = !(ctm.f || ctm.e); + svg.remove(); + } + if (d3_mouse_bug44083) { + point.x = e.pageX; + point.y = e.pageY; + } else { + point.x = e.clientX; + point.y = e.clientY; + } + point = point.matrixTransform(container.getScreenCTM().inverse()); + return [ point.x, point.y ]; + } + var rect = container.getBoundingClientRect(); + return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ]; + } + function d3_noop() {} + function d3_scaleExtent(domain) { + var start = domain[0], stop = domain[domain.length - 1]; + return start < stop ? [ start, stop ] : [ stop, start ]; + } + function d3_scaleRange(scale) { + return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range()); + } + function d3_scale_nice(domain, nice) { + var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx; + if (x1 < x0) { + dx = i0, i0 = i1, i1 = dx; + dx = x0, x0 = x1, x1 = dx; + } + if (nice = nice(x1 - x0)) { + domain[i0] = nice.floor(x0); + domain[i1] = nice.ceil(x1); + } + return domain; + } + function d3_scale_niceDefault() { + return Math; + } + function d3_scale_linear(domain, range, interpolate, clamp) { + function rescale() { + var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber; + output = linear(domain, range, uninterpolate, interpolate); + input = linear(range, domain, uninterpolate, d3.interpolate); + return scale; + } + function scale(x) { + return output(x); + } + var output, input; + scale.invert = function(y) { + return input(y); + }; + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.map(Number); + return rescale(); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + scale.rangeRound = function(x) { + return scale.range(x).interpolate(d3.interpolateRound); + }; + scale.clamp = function(x) { + if (!arguments.length) return clamp; + clamp = x; + return rescale(); + }; + scale.interpolate = function(x) { + if (!arguments.length) return interpolate; + interpolate = x; + return rescale(); + }; + scale.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + scale.tickFormat = function(m) { + return d3_scale_linearTickFormat(domain, m); + }; + scale.nice = function() { + d3_scale_nice(domain, d3_scale_linearNice); + return rescale(); + }; + scale.copy = function() { + return d3_scale_linear(domain, range, interpolate, clamp); + }; + return rescale(); + } + function d3_scale_linearRebind(scale, linear) { + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); + } + function d3_scale_linearNice(dx) { + dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1); + return dx && { + floor: function(x) { + return Math.floor(x / dx) * dx; + }, + ceil: function(x) { + return Math.ceil(x / dx) * dx; + } + }; + } + function d3_scale_linearTickRange(domain, m) { + var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step; + if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2; + extent[0] = Math.ceil(extent[0] / step) * step; + extent[1] = Math.floor(extent[1] / step) * step + step * .5; + extent[2] = step; + return extent; + } + function d3_scale_linearTicks(domain, m) { + return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); + } + function d3_scale_linearTickFormat(domain, m) { + return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f"); + } + function d3_scale_bilinear(domain, range, uninterpolate, interpolate) { + var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]); + return function(x) { + return i(u(x)); + }; + } + function d3_scale_polylinear(domain, range, uninterpolate, interpolate) { + var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1; + if (domain[k] < domain[0]) { + domain = domain.slice().reverse(); + range = range.slice().reverse(); + } + while (++j <= k) { + u.push(uninterpolate(domain[j - 1], domain[j])); + i.push(interpolate(range[j - 1], range[j])); + } + return function(x) { + var j = d3.bisect(domain, x, 1, k) - 1; + return i[j](u[j](x)); + }; + } + function d3_scale_log(linear, log) { + function scale(x) { + return linear(log(x)); + } + var pow = log.pow; + scale.invert = function(x) { + return pow(linear.invert(x)); + }; + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(pow); + log = x[0] < 0 ? d3_scale_logn : d3_scale_logp; + pow = log.pow; + linear.domain(x.map(log)); + return scale; + }; + scale.nice = function() { + linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault)); + return scale; + }; + scale.ticks = function() { + var extent = d3_scaleExtent(linear.domain()), ticks = []; + if (extent.every(isFinite)) { + var i = Math.floor(extent[0]), j = Math.ceil(extent[1]), u = pow(extent[0]), v = pow(extent[1]); + if (log === d3_scale_logn) { + ticks.push(pow(i)); + for (; i++ < j; ) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k); + } else { + for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k); + ticks.push(pow(i)); + } + for (i = 0; ticks[i] < u; i++) {} + for (j = ticks.length; ticks[j - 1] > v; j--) {} + ticks = ticks.slice(i, j); + } + return ticks; + }; + scale.tickFormat = function(n, format) { + if (arguments.length < 2) format = d3_scale_logFormat; + if (arguments.length < 1) return format; + var k = Math.max(.1, n / scale.ticks().length), f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil), e; + return function(d) { + return d / pow(f(log(d) + e)) <= k ? format(d) : ""; + }; + }; + scale.copy = function() { + return d3_scale_log(linear.copy(), log); + }; + return d3_scale_linearRebind(scale, linear); + } + function d3_scale_logp(x) { + return Math.log(x < 0 ? 0 : x) / Math.LN10; + } + function d3_scale_logn(x) { + return -Math.log(x > 0 ? 0 : -x) / Math.LN10; + } + function d3_scale_pow(linear, exponent) { + function scale(x) { + return linear(powp(x)); + } + var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent); + scale.invert = function(x) { + return powb(linear.invert(x)); + }; + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(powb); + linear.domain(x.map(powp)); + return scale; + }; + scale.ticks = function(m) { + return d3_scale_linearTicks(scale.domain(), m); + }; + scale.tickFormat = function(m) { + return d3_scale_linearTickFormat(scale.domain(), m); + }; + scale.nice = function() { + return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice)); + }; + scale.exponent = function(x) { + if (!arguments.length) return exponent; + var domain = scale.domain(); + powp = d3_scale_powPow(exponent = x); + powb = d3_scale_powPow(1 / exponent); + return scale.domain(domain); + }; + scale.copy = function() { + return d3_scale_pow(linear.copy(), exponent); + }; + return d3_scale_linearRebind(scale, linear); + } + function d3_scale_powPow(e) { + return function(x) { + return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e); + }; + } + function d3_scale_ordinal(domain, ranger) { + function scale(x) { + return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length]; + } + function steps(start, step) { + return d3.range(domain.length).map(function(i) { + return start + step * i; + }); + } + var index, range, rangeBand; + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = []; + index = new d3_Map; + var i = -1, n = x.length, xi; + while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi)); + return scale[ranger.t].apply(scale, ranger.a); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + rangeBand = 0; + ranger = { + t: "range", + a: arguments + }; + return scale; + }; + scale.rangePoints = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding); + range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step); + rangeBand = 0; + ranger = { + t: "rangePoints", + a: arguments + }; + return scale; + }; + scale.rangeBands = function(x, padding, outerPadding) { + if (arguments.length < 2) padding = 0; + if (arguments.length < 3) outerPadding = padding; + var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding); + range = steps(start + step * outerPadding, step); + if (reverse) range.reverse(); + rangeBand = step * (1 - padding); + ranger = { + t: "rangeBands", + a: arguments + }; + return scale; + }; + scale.rangeRoundBands = function(x, padding, outerPadding) { + if (arguments.length < 2) padding = 0; + if (arguments.length < 3) outerPadding = padding; + var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)), error = stop - start - (domain.length - padding) * step; + range = steps(start + Math.round(error / 2), step); + if (reverse) range.reverse(); + rangeBand = Math.round(step * (1 - padding)); + ranger = { + t: "rangeRoundBands", + a: arguments + }; + return scale; + }; + scale.rangeBand = function() { + return rangeBand; + }; + scale.rangeExtent = function() { + return d3_scaleExtent(ranger.a[0]); + }; + scale.copy = function() { + return d3_scale_ordinal(domain, ranger); + }; + return scale.domain(domain); + } + function d3_scale_quantile(domain, range) { + function rescale() { + var k = 0, n = domain.length, q = range.length; + thresholds = []; + while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q); + return scale; + } + function scale(x) { + if (isNaN(x = +x)) return NaN; + return range[d3.bisect(thresholds, x)]; + } + var thresholds; + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.filter(function(d) { + return !isNaN(d); + }).sort(d3.ascending); + return rescale(); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + scale.quantiles = function() { + return thresholds; + }; + scale.copy = function() { + return d3_scale_quantile(domain, range); + }; + return rescale(); + } + function d3_scale_quantize(x0, x1, range) { + function scale(x) { + return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; + } + function rescale() { + kx = range.length / (x1 - x0); + i = range.length - 1; + return scale; + } + var kx, i; + scale.domain = function(x) { + if (!arguments.length) return [ x0, x1 ]; + x0 = +x[0]; + x1 = +x[x.length - 1]; + return rescale(); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + scale.copy = function() { + return d3_scale_quantize(x0, x1, range); + }; + return rescale(); + } + function d3_scale_threshold(domain, range) { + function scale(x) { + return range[d3.bisect(domain, x)]; + } + scale.domain = function(_) { + if (!arguments.length) return domain; + domain = _; + return scale; + }; + scale.range = function(_) { + if (!arguments.length) return range; + range = _; + return scale; + }; + scale.copy = function() { + return d3_scale_threshold(domain, range); + }; + return scale; + } + function d3_scale_identity(domain) { + function identity(x) { + return +x; + } + identity.invert = identity; + identity.domain = identity.range = function(x) { + if (!arguments.length) return domain; + domain = x.map(identity); + return identity; + }; + identity.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + identity.tickFormat = function(m) { + return d3_scale_linearTickFormat(domain, m); + }; + identity.copy = function() { + return d3_scale_identity(domain); + }; + return identity; + } + function d3_svg_arcInnerRadius(d) { + return d.innerRadius; + } + function d3_svg_arcOuterRadius(d) { + return d.outerRadius; + } + function d3_svg_arcStartAngle(d) { + return d.startAngle; + } + function d3_svg_arcEndAngle(d) { + return d.endAngle; + } + function d3_svg_line(projection) { + function line(data) { + function segment() { + segments.push("M", interpolate(projection(points), tension)); + } + var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y); + while (++i < n) { + if (defined.call(this, d = data[i], i)) { + points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]); + } else if (points.length) { + segment(); + points = []; + } + } + if (points.length) segment(); + return segments.length ? segments.join("") : null; + } + var x = d3_svg_lineX, y = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7; + line.x = function(_) { + if (!arguments.length) return x; + x = _; + return line; + }; + line.y = function(_) { + if (!arguments.length) return y; + y = _; + return line; + }; + line.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return line; + }; + line.interpolate = function(_) { + if (!arguments.length) return interpolateKey; + if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; + return line; + }; + line.tension = function(_) { + if (!arguments.length) return tension; + tension = _; + return line; + }; + return line; + } + function d3_svg_lineX(d) { + return d[0]; + } + function d3_svg_lineY(d) { + return d[1]; + } + function d3_svg_lineLinear(points) { + return points.join("L"); + } + function d3_svg_lineLinearClosed(points) { + return d3_svg_lineLinear(points) + "Z"; + } + function d3_svg_lineStepBefore(points) { + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; + while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]); + return path.join(""); + } + function d3_svg_lineStepAfter(points) { + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; + while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]); + return path.join(""); + } + function d3_svg_lineCardinalOpen(points, tension) { + return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension)); + } + function d3_svg_lineCardinalClosed(points, tension) { + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension)); + } + function d3_svg_lineCardinal(points, tension, closed) { + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension)); + } + function d3_svg_lineHermite(points, tangents) { + if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) { + return d3_svg_lineLinear(points); + } + var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1; + if (quad) { + path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1]; + p0 = points[1]; + pi = 2; + } + if (tangents.length > 1) { + t = tangents[1]; + p = points[pi]; + pi++; + path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; + for (var i = 2; i < tangents.length; i++, pi++) { + p = points[pi]; + t = tangents[i]; + path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; + } + } + if (quad) { + var lp = points[pi]; + path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1]; + } + return path; + } + function d3_svg_lineCardinalTangents(points, tension) { + var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length; + while (++i < n) { + p0 = p1; + p1 = p2; + p2 = points[i]; + tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]); + } + return tangents; + } + function d3_svg_lineBasis(points) { + if (points.length < 3) return d3_svg_lineLinear(points); + var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0 ]; + d3_svg_lineBasisBezier(path, px, py); + while (++i < n) { + pi = points[i]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + i = -1; + while (++i < 2) { + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); + } + function d3_svg_lineBasisOpen(points) { + if (points.length < 4) return d3_svg_lineLinear(points); + var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ]; + while (++i < 3) { + pi = points[i]; + px.push(pi[0]); + py.push(pi[1]); + } + path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)); + --i; + while (++i < n) { + pi = points[i]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); + } + function d3_svg_lineBasisClosed(points) { + var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = []; + while (++i < 4) { + pi = points[i % n]; + px.push(pi[0]); + py.push(pi[1]); + } + path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ]; + --i; + while (++i < m) { + pi = points[i % n]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); + } + function d3_svg_lineBundle(points, tension) { + var n = points.length - 1; + if (n) { + var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t; + while (++i <= n) { + p = points[i]; + t = i / n; + p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); + p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); + } + } + return d3_svg_lineBasis(points); + } + function d3_svg_lineDot4(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + function d3_svg_lineBasisBezier(path, x, y) { + path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y)); + } + function d3_svg_lineSlope(p0, p1) { + return (p1[1] - p0[1]) / (p1[0] - p0[0]); + } + function d3_svg_lineFiniteDifferences(points) { + var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1); + while (++i < j) { + m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2; + } + m[i] = d; + return m; + } + function d3_svg_lineMonotoneTangents(points) { + var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1; + while (++i < j) { + d = d3_svg_lineSlope(points[i], points[i + 1]); + if (Math.abs(d) < 1e-6) { + m[i] = m[i + 1] = 0; + } else { + a = m[i] / d; + b = m[i + 1] / d; + s = a * a + b * b; + if (s > 9) { + s = d * 3 / Math.sqrt(s); + m[i] = s * a; + m[i + 1] = s * b; + } + } + } + i = -1; + while (++i <= j) { + s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i])); + tangents.push([ s || 0, m[i] * s || 0 ]); + } + return tangents; + } + function d3_svg_lineMonotone(points) { + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points)); + } + function d3_svg_lineRadial(points) { + var point, i = -1, n = points.length, r, a; + while (++i < n) { + point = points[i]; + r = point[0]; + a = point[1] + d3_svg_arcOffset; + point[0] = r * Math.cos(a); + point[1] = r * Math.sin(a); + } + return points; + } + function d3_svg_area(projection) { + function area(data) { + function segment() { + segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z"); + } + var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() { + return x; + } : d3_functor(x1), fy1 = y0 === y1 ? function() { + return y; + } : d3_functor(y1), x, y; + while (++i < n) { + if (defined.call(this, d = data[i], i)) { + points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]); + points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]); + } else if (points0.length) { + segment(); + points0 = []; + points1 = []; + } + } + if (points0.length) segment(); + return segments.length ? segments.join("") : null; + } + var x0 = d3_svg_lineX, x1 = d3_svg_lineX, y0 = 0, y1 = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7; + area.x = function(_) { + if (!arguments.length) return x1; + x0 = x1 = _; + return area; + }; + area.x0 = function(_) { + if (!arguments.length) return x0; + x0 = _; + return area; + }; + area.x1 = function(_) { + if (!arguments.length) return x1; + x1 = _; + return area; + }; + area.y = function(_) { + if (!arguments.length) return y1; + y0 = y1 = _; + return area; + }; + area.y0 = function(_) { + if (!arguments.length) return y0; + y0 = _; + return area; + }; + area.y1 = function(_) { + if (!arguments.length) return y1; + y1 = _; + return area; + }; + area.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return area; + }; + area.interpolate = function(_) { + if (!arguments.length) return interpolateKey; + if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; + interpolateReverse = interpolate.reverse || interpolate; + L = interpolate.closed ? "M" : "L"; + return area; + }; + area.tension = function(_) { + if (!arguments.length) return tension; + tension = _; + return area; + }; + return area; + } + function d3_svg_chordSource(d) { + return d.source; + } + function d3_svg_chordTarget(d) { + return d.target; + } + function d3_svg_chordRadius(d) { + return d.radius; + } + function d3_svg_chordStartAngle(d) { + return d.startAngle; + } + function d3_svg_chordEndAngle(d) { + return d.endAngle; + } + function d3_svg_diagonalProjection(d) { + return [ d.x, d.y ]; + } + function d3_svg_diagonalRadialProjection(projection) { + return function() { + var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset; + return [ r * Math.cos(a), r * Math.sin(a) ]; + }; + } + function d3_svg_symbolSize() { + return 64; + } + function d3_svg_symbolType() { + return "circle"; + } + function d3_svg_symbolCircle(size) { + var r = Math.sqrt(size / Math.PI); + return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z"; + } + function d3_svg_axisX(selection, x) { + selection.attr("transform", function(d) { + return "translate(" + x(d) + ",0)"; + }); + } + function d3_svg_axisY(selection, y) { + selection.attr("transform", function(d) { + return "translate(0," + y(d) + ")"; + }); + } + function d3_svg_axisSubdivide(scale, ticks, m) { + subticks = []; + if (m && ticks.length > 1) { + var extent = d3_scaleExtent(scale.domain()), subticks, i = -1, n = ticks.length, d = (ticks[1] - ticks[0]) / ++m, j, v; + while (++i < n) { + for (j = m; --j > 0; ) { + if ((v = +ticks[i] - j * d) >= extent[0]) { + subticks.push(v); + } + } + } + for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1]; ) { + subticks.push(v); + } + } + return subticks; + } + function d3_behavior_zoomDelta() { + if (!d3_behavior_zoomDiv) { + d3_behavior_zoomDiv = d3.select("body").append("div").style("visibility", "hidden").style("top", 0).style("height", 0).style("width", 0).style("overflow-y", "scroll").append("div").style("height", "2000px").node().parentNode; + } + var e = d3.event, delta; + try { + d3_behavior_zoomDiv.scrollTop = 1e3; + d3_behavior_zoomDiv.dispatchEvent(e); + delta = 1e3 - d3_behavior_zoomDiv.scrollTop; + } catch (error) { + delta = e.wheelDelta || -e.detail * 5; + } + return delta; + } + function d3_layout_bundlePath(link) { + var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ]; + while (start !== lca) { + start = start.parent; + points.push(start); + } + var k = points.length; + while (end !== lca) { + points.splice(k, 0, end); + end = end.parent; + } + return points; + } + function d3_layout_bundleAncestors(node) { + var ancestors = [], parent = node.parent; + while (parent != null) { + ancestors.push(node); + node = parent; + parent = parent.parent; + } + ancestors.push(node); + return ancestors; + } + function d3_layout_bundleLeastCommonAncestor(a, b) { + if (a === b) return a; + var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null; + while (aNode === bNode) { + sharedNode = aNode; + aNode = aNodes.pop(); + bNode = bNodes.pop(); + } + return sharedNode; + } + function d3_layout_forceDragstart(d) { + d.fixed |= 2; + } + function d3_layout_forceDragend(d) { + d.fixed &= 1; + } + function d3_layout_forceMouseover(d) { + d.fixed |= 4; + } + function d3_layout_forceMouseout(d) { + d.fixed &= 3; + } + function d3_layout_forceAccumulate(quad, alpha, charges) { + var cx = 0, cy = 0; + quad.charge = 0; + if (!quad.leaf) { + var nodes = quad.nodes, n = nodes.length, i = -1, c; + while (++i < n) { + c = nodes[i]; + if (c == null) continue; + d3_layout_forceAccumulate(c, alpha, charges); + quad.charge += c.charge; + cx += c.charge * c.cx; + cy += c.charge * c.cy; + } + } + if (quad.point) { + if (!quad.leaf) { + quad.point.x += Math.random() - .5; + quad.point.y += Math.random() - .5; + } + var k = alpha * charges[quad.point.index]; + quad.charge += quad.pointCharge = k; + cx += k * quad.point.x; + cy += k * quad.point.y; + } + quad.cx = cx / quad.charge; + quad.cy = cy / quad.charge; + } + function d3_layout_forceLinkDistance(link) { + return 20; + } + function d3_layout_forceLinkStrength(link) { + return 1; + } + function d3_layout_stackX(d) { + return d.x; + } + function d3_layout_stackY(d) { + return d.y; + } + function d3_layout_stackOut(d, y0, y) { + d.y0 = y0; + d.y = y; + } + function d3_layout_stackOrderDefault(data) { + return d3.range(data.length); + } + function d3_layout_stackOffsetZero(data) { + var j = -1, m = data[0].length, y0 = []; + while (++j < m) y0[j] = 0; + return y0; + } + function d3_layout_stackMaxIndex(array) { + var i = 1, j = 0, v = array[0][1], k, n = array.length; + for (; i < n; ++i) { + if ((k = array[i][1]) > v) { + j = i; + v = k; + } + } + return j; + } + function d3_layout_stackReduceSum(d) { + return d.reduce(d3_layout_stackSum, 0); + } + function d3_layout_stackSum(p, d) { + return p + d[1]; + } + function d3_layout_histogramBinSturges(range, values) { + return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1)); + } + function d3_layout_histogramBinFixed(range, n) { + var x = -1, b = +range[0], m = (range[1] - b) / n, f = []; + while (++x <= n) f[x] = m * x + b; + return f; + } + function d3_layout_histogramRange(values) { + return [ d3.min(values), d3.max(values) ]; + } + function d3_layout_hierarchyRebind(object, hierarchy) { + d3.rebind(object, hierarchy, "sort", "children", "value"); + object.links = d3_layout_hierarchyLinks; + object.nodes = function(d) { + d3_layout_hierarchyInline = true; + return (object.nodes = object)(d); + }; + return object; + } + function d3_layout_hierarchyChildren(d) { + return d.children; + } + function d3_layout_hierarchyValue(d) { + return d.value; + } + function d3_layout_hierarchySort(a, b) { + return b.value - a.value; + } + function d3_layout_hierarchyLinks(nodes) { + return d3.merge(nodes.map(function(parent) { + return (parent.children || []).map(function(child) { + return { + source: parent, + target: child + }; + }); + })); + } + function d3_layout_packSort(a, b) { + return a.value - b.value; + } + function d3_layout_packInsert(a, b) { + var c = a._pack_next; + a._pack_next = b; + b._pack_prev = a; + b._pack_next = c; + c._pack_prev = b; + } + function d3_layout_packSplice(a, b) { + a._pack_next = b; + b._pack_prev = a; + } + function d3_layout_packIntersects(a, b) { + var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r; + return dr * dr - dx * dx - dy * dy > .001; + } + function d3_layout_packSiblings(node) { + function bound(node) { + xMin = Math.min(node.x - node.r, xMin); + xMax = Math.max(node.x + node.r, xMax); + yMin = Math.min(node.y - node.r, yMin); + yMax = Math.max(node.y + node.r, yMax); + } + if (!(nodes = node.children) || !(n = nodes.length)) return; + var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n; + nodes.forEach(d3_layout_packLink); + a = nodes[0]; + a.x = -a.r; + a.y = 0; + bound(a); + if (n > 1) { + b = nodes[1]; + b.x = b.r; + b.y = 0; + bound(b); + if (n > 2) { + c = nodes[2]; + d3_layout_packPlace(a, b, c); + bound(c); + d3_layout_packInsert(a, c); + a._pack_prev = c; + d3_layout_packInsert(c, b); + b = a._pack_next; + for (i = 3; i < n; i++) { + d3_layout_packPlace(a, b, c = nodes[i]); + var isect = 0, s1 = 1, s2 = 1; + for (j = b._pack_next; j !== b; j = j._pack_next, s1++) { + if (d3_layout_packIntersects(j, c)) { + isect = 1; + break; + } + } + if (isect == 1) { + for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) { + if (d3_layout_packIntersects(k, c)) { + break; + } + } + } + if (isect) { + if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b); + i--; + } else { + d3_layout_packInsert(a, c); + b = c; + bound(c); + } + } + } + } + var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0; + for (i = 0; i < n; i++) { + c = nodes[i]; + c.x -= cx; + c.y -= cy; + cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y)); + } + node.r = cr; + nodes.forEach(d3_layout_packUnlink); + } + function d3_layout_packLink(node) { + node._pack_next = node._pack_prev = node; + } + function d3_layout_packUnlink(node) { + delete node._pack_next; + delete node._pack_prev; + } + function d3_layout_packTransform(node, x, y, k) { + var children = node.children; + node.x = x += k * node.x; + node.y = y += k * node.y; + node.r *= k; + if (children) { + var i = -1, n = children.length; + while (++i < n) d3_layout_packTransform(children[i], x, y, k); + } + } + function d3_layout_packPlace(a, b, c) { + var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y; + if (db && (dx || dy)) { + var da = b.r + c.r, dc = dx * dx + dy * dy; + da *= da; + db *= db; + var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc); + c.x = a.x + x * dx + y * dy; + c.y = a.y + x * dy - y * dx; + } else { + c.x = a.x + db; + c.y = a.y; + } + } + function d3_layout_clusterY(children) { + return 1 + d3.max(children, function(child) { + return child.y; + }); + } + function d3_layout_clusterX(children) { + return children.reduce(function(x, child) { + return x + child.x; + }, 0) / children.length; + } + function d3_layout_clusterLeft(node) { + var children = node.children; + return children && children.length ? d3_layout_clusterLeft(children[0]) : node; + } + function d3_layout_clusterRight(node) { + var children = node.children, n; + return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node; + } + function d3_layout_treeSeparation(a, b) { + return a.parent == b.parent ? 1 : 2; + } + function d3_layout_treeLeft(node) { + var children = node.children; + return children && children.length ? children[0] : node._tree.thread; + } + function d3_layout_treeRight(node) { + var children = node.children, n; + return children && (n = children.length) ? children[n - 1] : node._tree.thread; + } + function d3_layout_treeSearch(node, compare) { + var children = node.children; + if (children && (n = children.length)) { + var child, n, i = -1; + while (++i < n) { + if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) { + node = child; + } + } + } + return node; + } + function d3_layout_treeRightmost(a, b) { + return a.x - b.x; + } + function d3_layout_treeLeftmost(a, b) { + return b.x - a.x; + } + function d3_layout_treeDeepest(a, b) { + return a.depth - b.depth; + } + function d3_layout_treeVisitAfter(node, callback) { + function visit(node, previousSibling) { + var children = node.children; + if (children && (n = children.length)) { + var child, previousChild = null, i = -1, n; + while (++i < n) { + child = children[i]; + visit(child, previousChild); + previousChild = child; + } + } + callback(node, previousSibling); + } + visit(node, null); + } + function d3_layout_treeShift(node) { + var shift = 0, change = 0, children = node.children, i = children.length, child; + while (--i >= 0) { + child = children[i]._tree; + child.prelim += shift; + child.mod += shift; + shift += child.shift + (change += child.change); + } + } + function d3_layout_treeMove(ancestor, node, shift) { + ancestor = ancestor._tree; + node = node._tree; + var change = shift / (node.number - ancestor.number); + ancestor.change += change; + node.change -= change; + node.shift += shift; + node.prelim += shift; + node.mod += shift; + } + function d3_layout_treeAncestor(vim, node, ancestor) { + return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor; + } + function d3_layout_treemapPadNull(node) { + return { + x: node.x, + y: node.y, + dx: node.dx, + dy: node.dy + }; + } + function d3_layout_treemapPad(node, padding) { + var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2]; + if (dx < 0) { + x += dx / 2; + dx = 0; + } + if (dy < 0) { + y += dy / 2; + dy = 0; + } + return { + x: x, + y: y, + dx: dx, + dy: dy + }; + } + function d3_dsv(delimiter, mimeType) { + function dsv(url, callback) { + d3.text(url, mimeType, function(text) { + callback(text && dsv.parse(text)); + }); + } + function formatRow(row) { + return row.map(formatValue).join(delimiter); + } + function formatValue(text) { + return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text; + } + var reParse = new RegExp("\r\n|[" + delimiter + "\r\n]", "g"), reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0); + dsv.parse = function(text) { + var header; + return dsv.parseRows(text, function(row, i) { + if (i) { + var o = {}, j = -1, m = header.length; + while (++j < m) o[header[j]] = row[j]; + return o; + } else { + header = row; + return null; + } + }); + }; + dsv.parseRows = function(text, f) { + function token() { + if (reParse.lastIndex >= text.length) return EOF; + if (eol) { + eol = false; + return EOL; + } + var j = reParse.lastIndex; + if (text.charCodeAt(j) === 34) { + var i = j; + while (i++ < text.length) { + if (text.charCodeAt(i) === 34) { + if (text.charCodeAt(i + 1) !== 34) break; + i++; + } + } + reParse.lastIndex = i + 2; + var c = text.charCodeAt(i + 1); + if (c === 13) { + eol = true; + if (text.charCodeAt(i + 2) === 10) reParse.lastIndex++; + } else if (c === 10) { + eol = true; + } + return text.substring(j + 1, i).replace(/""/g, '"'); + } + var m = reParse.exec(text); + if (m) { + eol = m[0].charCodeAt(0) !== delimiterCode; + return text.substring(j, m.index); + } + reParse.lastIndex = text.length; + return text.substring(j); + } + var EOL = {}, EOF = {}, rows = [], n = 0, t, eol; + reParse.lastIndex = 0; + while ((t = token()) !== EOF) { + var a = []; + while (t !== EOL && t !== EOF) { + a.push(t); + t = token(); + } + if (f && !(a = f(a, n++))) continue; + rows.push(a); + } + return rows; + }; + dsv.format = function(rows) { + return rows.map(formatRow).join("\n"); + }; + return dsv; + } + function d3_geo_type(types, defaultValue) { + return function(object) { + return object && types.hasOwnProperty(object.type) ? types[object.type](object) : defaultValue; + }; + } + function d3_path_circle(radius) { + return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + +2 * radius + "z"; + } + function d3_geo_bounds(o, f) { + if (d3_geo_boundsTypes.hasOwnProperty(o.type)) d3_geo_boundsTypes[o.type](o, f); + } + function d3_geo_boundsFeature(o, f) { + d3_geo_bounds(o.geometry, f); + } + function d3_geo_boundsFeatureCollection(o, f) { + for (var a = o.features, i = 0, n = a.length; i < n; i++) { + d3_geo_bounds(a[i].geometry, f); + } + } + function d3_geo_boundsGeometryCollection(o, f) { + for (var a = o.geometries, i = 0, n = a.length; i < n; i++) { + d3_geo_bounds(a[i], f); + } + } + function d3_geo_boundsLineString(o, f) { + for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { + f.apply(null, a[i]); + } + } + function d3_geo_boundsMultiLineString(o, f) { + for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { + for (var b = a[i], j = 0, m = b.length; j < m; j++) { + f.apply(null, b[j]); + } + } + } + function d3_geo_boundsMultiPolygon(o, f) { + for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { + for (var b = a[i][0], j = 0, m = b.length; j < m; j++) { + f.apply(null, b[j]); + } + } + } + function d3_geo_boundsPoint(o, f) { + f.apply(null, o.coordinates); + } + function d3_geo_boundsPolygon(o, f) { + for (var a = o.coordinates[0], i = 0, n = a.length; i < n; i++) { + f.apply(null, a[i]); + } + } + function d3_geo_greatArcSource(d) { + return d.source; + } + function d3_geo_greatArcTarget(d) { + return d.target; + } + function d3_geo_greatArcInterpolator() { + function interpolate(t) { + var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1; + return [ Math.atan2(y, x) / d3_geo_radians, Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_geo_radians ]; + } + var x0, y0, cy0, sy0, kx0, ky0, x1, y1, cy1, sy1, kx1, ky1, d, k; + interpolate.distance = function() { + if (d == null) k = 1 / Math.sin(d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0))))); + return d; + }; + interpolate.source = function(_) { + var cx0 = Math.cos(x0 = _[0] * d3_geo_radians), sx0 = Math.sin(x0); + cy0 = Math.cos(y0 = _[1] * d3_geo_radians); + sy0 = Math.sin(y0); + kx0 = cy0 * cx0; + ky0 = cy0 * sx0; + d = null; + return interpolate; + }; + interpolate.target = function(_) { + var cx1 = Math.cos(x1 = _[0] * d3_geo_radians), sx1 = Math.sin(x1); + cy1 = Math.cos(y1 = _[1] * d3_geo_radians); + sy1 = Math.sin(y1); + kx1 = cy1 * cx1; + ky1 = cy1 * sx1; + d = null; + return interpolate; + }; + return interpolate; + } + function d3_geo_greatArcInterpolate(a, b) { + var i = d3_geo_greatArcInterpolator().source(a).target(b); + i.distance(); + return i; + } + function d3_geom_contourStart(grid) { + var x = 0, y = 0; + while (true) { + if (grid(x, y)) { + return [ x, y ]; + } + if (x === 0) { + x = y + 1; + y = 0; + } else { + x = x - 1; + y = y + 1; + } + } + } + function d3_geom_hullCCW(i1, i2, i3, v) { + var t, a, b, c, d, e, f; + t = v[i1]; + a = t[0]; + b = t[1]; + t = v[i2]; + c = t[0]; + d = t[1]; + t = v[i3]; + e = t[0]; + f = t[1]; + return (f - b) * (c - a) - (d - b) * (e - a) > 0; + } + function d3_geom_polygonInside(p, a, b) { + return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]); + } + function d3_geom_polygonIntersect(c, d, a, b) { + var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0], y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1], x13 = x1 - x3, x21 = x2 - x1, x43 = x4 - x3, y13 = y1 - y3, y21 = y2 - y1, y43 = y4 - y3, ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21); + return [ x1 + ua * x21, y1 + ua * y21 ]; + } + function d3_voronoi_tessellate(vertices, callback) { + var Sites = { + list: vertices.map(function(v, i) { + return { + index: i, + x: v[0], + y: v[1] + }; + }).sort(function(a, b) { + return a.y < b.y ? -1 : a.y > b.y ? 1 : a.x < b.x ? -1 : a.x > b.x ? 1 : 0; + }), + bottomSite: null + }; + var EdgeList = { + list: [], + leftEnd: null, + rightEnd: null, + init: function() { + EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.leftEnd.r = EdgeList.rightEnd; + EdgeList.rightEnd.l = EdgeList.leftEnd; + EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd); + }, + createHalfEdge: function(edge, side) { + return { + edge: edge, + side: side, + vertex: null, + l: null, + r: null + }; + }, + insert: function(lb, he) { + he.l = lb; + he.r = lb.r; + lb.r.l = he; + lb.r = he; + }, + leftBound: function(p) { + var he = EdgeList.leftEnd; + do { + he = he.r; + } while (he != EdgeList.rightEnd && Geom.rightOf(he, p)); + he = he.l; + return he; + }, + del: function(he) { + he.l.r = he.r; + he.r.l = he.l; + he.edge = null; + }, + right: function(he) { + return he.r; + }, + left: function(he) { + return he.l; + }, + leftRegion: function(he) { + return he.edge == null ? Sites.bottomSite : he.edge.region[he.side]; + }, + rightRegion: function(he) { + return he.edge == null ? Sites.bottomSite : he.edge.region[d3_voronoi_opposite[he.side]]; + } + }; + var Geom = { + bisect: function(s1, s2) { + var newEdge = { + region: { + l: s1, + r: s2 + }, + ep: { + l: null, + r: null + } + }; + var dx = s2.x - s1.x, dy = s2.y - s1.y, adx = dx > 0 ? dx : -dx, ady = dy > 0 ? dy : -dy; + newEdge.c = s1.x * dx + s1.y * dy + (dx * dx + dy * dy) * .5; + if (adx > ady) { + newEdge.a = 1; + newEdge.b = dy / dx; + newEdge.c /= dx; + } else { + newEdge.b = 1; + newEdge.a = dx / dy; + newEdge.c /= dy; + } + return newEdge; + }, + intersect: function(el1, el2) { + var e1 = el1.edge, e2 = el2.edge; + if (!e1 || !e2 || e1.region.r == e2.region.r) { + return null; + } + var d = e1.a * e2.b - e1.b * e2.a; + if (Math.abs(d) < 1e-10) { + return null; + } + var xint = (e1.c * e2.b - e2.c * e1.b) / d, yint = (e2.c * e1.a - e1.c * e2.a) / d, e1r = e1.region.r, e2r = e2.region.r, el, e; + if (e1r.y < e2r.y || e1r.y == e2r.y && e1r.x < e2r.x) { + el = el1; + e = e1; + } else { + el = el2; + e = e2; + } + var rightOfSite = xint >= e.region.r.x; + if (rightOfSite && el.side === "l" || !rightOfSite && el.side === "r") { + return null; + } + return { + x: xint, + y: yint + }; + }, + rightOf: function(he, p) { + var e = he.edge, topsite = e.region.r, rightOfSite = p.x > topsite.x; + if (rightOfSite && he.side === "l") { + return 1; + } + if (!rightOfSite && he.side === "r") { + return 0; + } + if (e.a === 1) { + var dyp = p.y - topsite.y, dxp = p.x - topsite.x, fast = 0, above = 0; + if (!rightOfSite && e.b < 0 || rightOfSite && e.b >= 0) { + above = fast = dyp >= e.b * dxp; + } else { + above = p.x + p.y * e.b > e.c; + if (e.b < 0) { + above = !above; + } + if (!above) { + fast = 1; + } + } + if (!fast) { + var dxs = topsite.x - e.region.l.x; + above = e.b * (dxp * dxp - dyp * dyp) < dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b); + if (e.b < 0) { + above = !above; + } + } + } else { + var yl = e.c - e.a * p.x, t1 = p.y - yl, t2 = p.x - topsite.x, t3 = yl - topsite.y; + above = t1 * t1 > t2 * t2 + t3 * t3; + } + return he.side === "l" ? above : !above; + }, + endPoint: function(edge, side, site) { + edge.ep[side] = site; + if (!edge.ep[d3_voronoi_opposite[side]]) return; + callback(edge); + }, + distance: function(s, t) { + var dx = s.x - t.x, dy = s.y - t.y; + return Math.sqrt(dx * dx + dy * dy); + } + }; + var EventQueue = { + list: [], + insert: function(he, site, offset) { + he.vertex = site; + he.ystar = site.y + offset; + for (var i = 0, list = EventQueue.list, l = list.length; i < l; i++) { + var next = list[i]; + if (he.ystar > next.ystar || he.ystar == next.ystar && site.x > next.vertex.x) { + continue; + } else { + break; + } + } + list.splice(i, 0, he); + }, + del: function(he) { + for (var i = 0, ls = EventQueue.list, l = ls.length; i < l && ls[i] != he; ++i) {} + ls.splice(i, 1); + }, + empty: function() { + return EventQueue.list.length === 0; + }, + nextEvent: function(he) { + for (var i = 0, ls = EventQueue.list, l = ls.length; i < l; ++i) { + if (ls[i] == he) return ls[i + 1]; + } + return null; + }, + min: function() { + var elem = EventQueue.list[0]; + return { + x: elem.vertex.x, + y: elem.ystar + }; + }, + extractMin: function() { + return EventQueue.list.shift(); + } + }; + EdgeList.init(); + Sites.bottomSite = Sites.list.shift(); + var newSite = Sites.list.shift(), newIntStar; + var lbnd, rbnd, llbnd, rrbnd, bisector; + var bot, top, temp, p, v; + var e, pm; + while (true) { + if (!EventQueue.empty()) { + newIntStar = EventQueue.min(); + } + if (newSite && (EventQueue.empty() || newSite.y < newIntStar.y || newSite.y == newIntStar.y && newSite.x < newIntStar.x)) { + lbnd = EdgeList.leftBound(newSite); + rbnd = EdgeList.right(lbnd); + bot = EdgeList.rightRegion(lbnd); + e = Geom.bisect(bot, newSite); + bisector = EdgeList.createHalfEdge(e, "l"); + EdgeList.insert(lbnd, bisector); + p = Geom.intersect(lbnd, bisector); + if (p) { + EventQueue.del(lbnd); + EventQueue.insert(lbnd, p, Geom.distance(p, newSite)); + } + lbnd = bisector; + bisector = EdgeList.createHalfEdge(e, "r"); + EdgeList.insert(lbnd, bisector); + p = Geom.intersect(bisector, rbnd); + if (p) { + EventQueue.insert(bisector, p, Geom.distance(p, newSite)); + } + newSite = Sites.list.shift(); + } else if (!EventQueue.empty()) { + lbnd = EventQueue.extractMin(); + llbnd = EdgeList.left(lbnd); + rbnd = EdgeList.right(lbnd); + rrbnd = EdgeList.right(rbnd); + bot = EdgeList.leftRegion(lbnd); + top = EdgeList.rightRegion(rbnd); + v = lbnd.vertex; + Geom.endPoint(lbnd.edge, lbnd.side, v); + Geom.endPoint(rbnd.edge, rbnd.side, v); + EdgeList.del(lbnd); + EventQueue.del(rbnd); + EdgeList.del(rbnd); + pm = "l"; + if (bot.y > top.y) { + temp = bot; + bot = top; + top = temp; + pm = "r"; + } + e = Geom.bisect(bot, top); + bisector = EdgeList.createHalfEdge(e, pm); + EdgeList.insert(llbnd, bisector); + Geom.endPoint(e, d3_voronoi_opposite[pm], v); + p = Geom.intersect(llbnd, bisector); + if (p) { + EventQueue.del(llbnd); + EventQueue.insert(llbnd, p, Geom.distance(p, bot)); + } + p = Geom.intersect(bisector, rrbnd); + if (p) { + EventQueue.insert(bisector, p, Geom.distance(p, bot)); + } + } else { + break; + } + } + for (lbnd = EdgeList.right(EdgeList.leftEnd); lbnd != EdgeList.rightEnd; lbnd = EdgeList.right(lbnd)) { + callback(lbnd.edge); + } + } + function d3_geom_quadtreeNode() { + return { + leaf: true, + nodes: [], + point: null + }; + } + function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { + if (!f(node, x1, y1, x2, y2)) { + var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes; + if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); + if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); + if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); + if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); + } + } + function d3_geom_quadtreePoint(p) { + return { + x: p[0], + y: p[1] + }; + } + function d3_time_utc() { + this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]); + } + function d3_time_formatAbbreviate(name) { + return name.substring(0, 3); + } + function d3_time_parse(date, template, string, j) { + var c, p, i = 0, n = template.length, m = string.length; + while (i < n) { + if (j >= m) return -1; + c = template.charCodeAt(i++); + if (c == 37) { + p = d3_time_parsers[template.charAt(i++)]; + if (!p || (j = p(date, string, j)) < 0) return -1; + } else if (c != string.charCodeAt(j++)) { + return -1; + } + } + return j; + } + function d3_time_formatRe(names) { + return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i"); + } + function d3_time_formatLookup(names) { + var map = new d3_Map, i = -1, n = names.length; + while (++i < n) map.set(names[i].toLowerCase(), i); + return map; + } + function d3_time_parseWeekdayAbbrev(date, string, i) { + d3_time_dayAbbrevRe.lastIndex = 0; + var n = d3_time_dayAbbrevRe.exec(string.substring(i)); + return n ? i += n[0].length : -1; + } + function d3_time_parseWeekday(date, string, i) { + d3_time_dayRe.lastIndex = 0; + var n = d3_time_dayRe.exec(string.substring(i)); + return n ? i += n[0].length : -1; + } + function d3_time_parseMonthAbbrev(date, string, i) { + d3_time_monthAbbrevRe.lastIndex = 0; + var n = d3_time_monthAbbrevRe.exec(string.substring(i)); + return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i += n[0].length) : -1; + } + function d3_time_parseMonth(date, string, i) { + d3_time_monthRe.lastIndex = 0; + var n = d3_time_monthRe.exec(string.substring(i)); + return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1; + } + function d3_time_parseLocaleFull(date, string, i) { + return d3_time_parse(date, d3_time_formats.c.toString(), string, i); + } + function d3_time_parseLocaleDate(date, string, i) { + return d3_time_parse(date, d3_time_formats.x.toString(), string, i); + } + function d3_time_parseLocaleTime(date, string, i) { + return d3_time_parse(date, d3_time_formats.X.toString(), string, i); + } + function d3_time_parseFullYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 4)); + return n ? (date.y = +n[0], i += n[0].length) : -1; + } + function d3_time_parseYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.y = d3_time_expandYear(+n[0]), i += n[0].length) : -1; + } + function d3_time_expandYear(d) { + return d + (d > 68 ? 1900 : 2e3); + } + function d3_time_parseMonthNumber(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.m = n[0] - 1, i += n[0].length) : -1; + } + function d3_time_parseDay(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.d = +n[0], i += n[0].length) : -1; + } + function d3_time_parseHour24(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.H = +n[0], i += n[0].length) : -1; + } + function d3_time_parseMinutes(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.M = +n[0], i += n[0].length) : -1; + } + function d3_time_parseSeconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.S = +n[0], i += n[0].length) : -1; + } + function d3_time_parseMilliseconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 3)); + return n ? (date.L = +n[0], i += n[0].length) : -1; + } + function d3_time_parseAmPm(date, string, i) { + var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase()); + return n == null ? -1 : (date.p = n, i); + } + function d3_time_zone(d) { + var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(Math.abs(z) / 60), zm = Math.abs(z) % 60; + return zs + d3_time_zfill2(zh) + d3_time_zfill2(zm); + } + function d3_time_formatIsoNative(date) { + return date.toISOString(); + } + function d3_time_interval(local, step, number) { + function round(date) { + var d0 = local(date), d1 = offset(d0, 1); + return date - d0 < d1 - date ? d0 : d1; + } + function ceil(date) { + step(date = local(new d3_time(date - 1)), 1); + return date; + } + function offset(date, k) { + step(date = new d3_time(+date), k); + return date; + } + function range(t0, t1, dt) { + var time = ceil(t0), times = []; + if (dt > 1) { + while (time < t1) { + if (!(number(time) % dt)) times.push(new Date(+time)); + step(time, 1); + } + } else { + while (time < t1) times.push(new Date(+time)), step(time, 1); + } + return times; + } + function range_utc(t0, t1, dt) { + try { + d3_time = d3_time_utc; + var utc = new d3_time_utc; + utc._ = t0; + return range(utc, t1, dt); + } finally { + d3_time = Date; + } + } + local.floor = local; + local.round = round; + local.ceil = ceil; + local.offset = offset; + local.range = range; + var utc = local.utc = d3_time_interval_utc(local); + utc.floor = utc; + utc.round = d3_time_interval_utc(round); + utc.ceil = d3_time_interval_utc(ceil); + utc.offset = d3_time_interval_utc(offset); + utc.range = range_utc; + return local; + } + function d3_time_interval_utc(method) { + return function(date, k) { + try { + d3_time = d3_time_utc; + var utc = new d3_time_utc; + utc._ = date; + return method(utc, k)._; + } finally { + d3_time = Date; + } + }; + } + function d3_time_scale(linear, methods, format) { + function scale(x) { + return linear(x); + } + scale.invert = function(x) { + return d3_time_scaleDate(linear.invert(x)); + }; + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(d3_time_scaleDate); + linear.domain(x); + return scale; + }; + scale.nice = function(m) { + return scale.domain(d3_scale_nice(scale.domain(), function() { + return m; + })); + }; + scale.ticks = function(m, k) { + var extent = d3_time_scaleExtent(scale.domain()); + if (typeof m !== "function") { + var span = extent[1] - extent[0], target = span / m, i = d3.bisect(d3_time_scaleSteps, target); + if (i == d3_time_scaleSteps.length) return methods.year(extent, m); + if (!i) return linear.ticks(m).map(d3_time_scaleDate); + if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i; + m = methods[i]; + k = m[1]; + m = m[0].range; + } + return m(extent[0], new Date(+extent[1] + 1), k); + }; + scale.tickFormat = function() { + return format; + }; + scale.copy = function() { + return d3_time_scale(linear.copy(), methods, format); + }; + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); + } + function d3_time_scaleExtent(domain) { + var start = domain[0], stop = domain[domain.length - 1]; + return start < stop ? [ start, stop ] : [ stop, start ]; + } + function d3_time_scaleDate(t) { + return new Date(t); + } + function d3_time_scaleFormat(formats) { + return function(date) { + var i = formats.length - 1, f = formats[i]; + while (!f[1](date)) f = formats[--i]; + return f[0](date); + }; + } + function d3_time_scaleSetYear(y) { + var d = new Date(y, 0, 1); + d.setFullYear(y); + return d; + } + function d3_time_scaleGetYear(d) { + var y = d.getFullYear(), d0 = d3_time_scaleSetYear(y), d1 = d3_time_scaleSetYear(y + 1); + return y + (d - d0) / (d1 - d0); + } + function d3_time_scaleUTCSetYear(y) { + var d = new Date(Date.UTC(y, 0, 1)); + d.setUTCFullYear(y); + return d; + } + function d3_time_scaleUTCGetYear(d) { + var y = d.getUTCFullYear(), d0 = d3_time_scaleUTCSetYear(y), d1 = d3_time_scaleUTCSetYear(y + 1); + return y + (d - d0) / (d1 - d0); + } + if (!Date.now) Date.now = function() { + return +(new Date); + }; + try { + document.createElement("div").style.setProperty("opacity", 0, ""); + } catch (error) { + var d3_style_prototype = CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty; + d3_style_prototype.setProperty = function(name, value, priority) { + d3_style_setProperty.call(this, name, value + "", priority); + }; + } + d3 = { + version: "2.10.2" + }; + var d3_array = d3_arraySlice; + try { + d3_array(document.documentElement.childNodes)[0].nodeType; + } catch (e) { + d3_array = d3_arrayCopy; + } + var d3_arraySubclass = [].__proto__ ? function(array, prototype) { + array.__proto__ = prototype; + } : function(array, prototype) { + for (var property in prototype) array[property] = prototype[property]; + }; + d3.map = function(object) { + var map = new d3_Map; + for (var key in object) map.set(key, object[key]); + return map; + }; + d3_class(d3_Map, { + has: function(key) { + return d3_map_prefix + key in this; + }, + get: function(key) { + return this[d3_map_prefix + key]; + }, + set: function(key, value) { + return this[d3_map_prefix + key] = value; + }, + remove: function(key) { + key = d3_map_prefix + key; + return key in this && delete this[key]; + }, + keys: function() { + var keys = []; + this.forEach(function(key) { + keys.push(key); + }); + return keys; + }, + values: function() { + var values = []; + this.forEach(function(key, value) { + values.push(value); + }); + return values; + }, + entries: function() { + var entries = []; + this.forEach(function(key, value) { + entries.push({ + key: key, + value: value + }); + }); + return entries; + }, + forEach: function(f) { + for (var key in this) { + if (key.charCodeAt(0) === d3_map_prefixCode) { + f.call(this, key.substring(1), this[key]); + } + } + } + }); + var d3_map_prefix = "\0", d3_map_prefixCode = d3_map_prefix.charCodeAt(0); + d3.functor = d3_functor; + d3.rebind = function(target, source) { + var i = 1, n = arguments.length, method; + while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]); + return target; + }; + d3.ascending = function(a, b) { + return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; + }; + d3.descending = function(a, b) { + return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; + }; + d3.mean = function(array, f) { + var n = array.length, a, m = 0, i = -1, j = 0; + if (arguments.length === 1) { + while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j; + } else { + while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j; + } + return j ? m : undefined; + }; + d3.median = function(array, f) { + if (arguments.length > 1) array = array.map(f); + array = array.filter(d3_number); + return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined; + }; + d3.min = function(array, f) { + var i = -1, n = array.length, a, b; + if (arguments.length === 1) { + while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; + while (++i < n) if ((b = array[i]) != null && a > b) a = b; + } else { + while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b; + } + return a; + }; + d3.max = function(array, f) { + var i = -1, n = array.length, a, b; + if (arguments.length === 1) { + while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; + while (++i < n) if ((b = array[i]) != null && b > a) a = b; + } else { + while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; + } + return a; + }; + d3.extent = function(array, f) { + var i = -1, n = array.length, a, b, c; + if (arguments.length === 1) { + while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined; + while (++i < n) if ((b = array[i]) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } else { + while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } + return [ a, c ]; + }; + d3.random = { + normal: function(µ, σ) { + var n = arguments.length; + if (n < 2) σ = 1; + if (n < 1) µ = 0; + return function() { + var x, y, r; + do { + x = Math.random() * 2 - 1; + y = Math.random() * 2 - 1; + r = x * x + y * y; + } while (!r || r > 1); + return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r); + }; + }, + logNormal: function(µ, σ) { + var n = arguments.length; + if (n < 2) σ = 1; + if (n < 1) µ = 0; + var random = d3.random.normal(); + return function() { + return Math.exp(µ + σ * random()); + }; + }, + irwinHall: function(m) { + return function() { + for (var s = 0, j = 0; j < m; j++) s += Math.random(); + return s / m; + }; + } + }; + d3.sum = function(array, f) { + var s = 0, n = array.length, a, i = -1; + if (arguments.length === 1) { + while (++i < n) if (!isNaN(a = +array[i])) s += a; + } else { + while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a; + } + return s; + }; + d3.quantile = function(values, p) { + var H = (values.length - 1) * p + 1, h = Math.floor(H), v = values[h - 1], e = H - h; + return e ? v + e * (values[h] - v) : v; + }; + d3.transpose = function(matrix) { + return d3.zip.apply(d3, matrix); + }; + d3.zip = function() { + if (!(n = arguments.length)) return []; + for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) { + for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) { + zip[j] = arguments[j][i]; + } + } + return zips; + }; + d3.bisector = function(f) { + return { + left: function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (f.call(a, a[mid], mid) < x) lo = mid + 1; else hi = mid; + } + return lo; + }, + right: function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (x < f.call(a, a[mid], mid)) hi = mid; else lo = mid + 1; + } + return lo; + } + }; + }; + var d3_bisector = d3.bisector(function(d) { + return d; + }); + d3.bisectLeft = d3_bisector.left; + d3.bisect = d3.bisectRight = d3_bisector.right; + d3.first = function(array, f) { + var i = 0, n = array.length, a = array[0], b; + if (arguments.length === 1) f = d3.ascending; + while (++i < n) { + if (f.call(array, a, b = array[i]) > 0) { + a = b; + } + } + return a; + }; + d3.last = function(array, f) { + var i = 0, n = array.length, a = array[0], b; + if (arguments.length === 1) f = d3.ascending; + while (++i < n) { + if (f.call(array, a, b = array[i]) <= 0) { + a = b; + } + } + return a; + }; + d3.nest = function() { + function map(array, depth) { + if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array; + var i = -1, n = array.length, key = keys[depth++], keyValue, object, valuesByKey = new d3_Map, values, o = {}; + while (++i < n) { + if (values = valuesByKey.get(keyValue = key(object = array[i]))) { + values.push(object); + } else { + valuesByKey.set(keyValue, [ object ]); + } + } + valuesByKey.forEach(function(keyValue, values) { + o[keyValue] = map(values, depth); + }); + return o; + } + function entries(map, depth) { + if (depth >= keys.length) return map; + var a = [], sortKey = sortKeys[depth++], key; + for (key in map) { + a.push({ + key: key, + values: entries(map[key], depth) + }); + } + if (sortKey) a.sort(function(a, b) { + return sortKey(a.key, b.key); + }); + return a; + } + var nest = {}, keys = [], sortKeys = [], sortValues, rollup; + nest.map = function(array) { + return map(array, 0); + }; + nest.entries = function(array) { + return entries(map(array, 0), 0); + }; + nest.key = function(d) { + keys.push(d); + return nest; + }; + nest.sortKeys = function(order) { + sortKeys[keys.length - 1] = order; + return nest; + }; + nest.sortValues = function(order) { + sortValues = order; + return nest; + }; + nest.rollup = function(f) { + rollup = f; + return nest; + }; + return nest; + }; + d3.keys = function(map) { + var keys = []; + for (var key in map) keys.push(key); + return keys; + }; + d3.values = function(map) { + var values = []; + for (var key in map) values.push(map[key]); + return values; + }; + d3.entries = function(map) { + var entries = []; + for (var key in map) entries.push({ + key: key, + value: map[key] + }); + return entries; + }; + d3.permute = function(array, indexes) { + var permutes = [], i = -1, n = indexes.length; + while (++i < n) permutes[i] = array[indexes[i]]; + return permutes; + }; + d3.merge = function(arrays) { + return Array.prototype.concat.apply([], arrays); + }; + d3.split = function(array, f) { + var arrays = [], values = [], value, i = -1, n = array.length; + if (arguments.length < 2) f = d3_splitter; + while (++i < n) { + if (f.call(values, value = array[i], i)) { + values = []; + } else { + if (!values.length) arrays.push(values); + values.push(value); + } + } + return arrays; + }; + d3.range = function(start, stop, step) { + if (arguments.length < 3) { + step = 1; + if (arguments.length < 2) { + stop = start; + start = 0; + } + } + if ((stop - start) / step === Infinity) throw new Error("infinite range"); + var range = [], k = d3_range_integerScale(Math.abs(step)), i = -1, j; + start *= k, stop *= k, step *= k; + if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k); + return range; + }; + d3.requote = function(s) { + return s.replace(d3_requote_re, "\\$&"); + }; + var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; + d3.round = function(x, n) { + return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x); + }; + d3.xhr = function(url, mime, callback) { + var req = new XMLHttpRequest; + if (arguments.length < 3) callback = mime, mime = null; else if (mime && req.overrideMimeType) req.overrideMimeType(mime); + req.open("GET", url, true); + if (mime) req.setRequestHeader("Accept", mime); + req.onreadystatechange = function() { + if (req.readyState === 4) { + var s = req.status; + callback(!s && req.response || s >= 200 && s < 300 || s === 304 ? req : null); + } + }; + req.send(null); + }; + d3.text = function(url, mime, callback) { + function ready(req) { + callback(req && req.responseText); + } + if (arguments.length < 3) { + callback = mime; + mime = null; + } + d3.xhr(url, mime, ready); + }; + d3.json = function(url, callback) { + d3.text(url, "application/json", function(text) { + callback(text ? JSON.parse(text) : null); + }); + }; + d3.html = function(url, callback) { + d3.text(url, "text/html", function(text) { + if (text != null) { + var range = document.createRange(); + range.selectNode(document.body); + text = range.createContextualFragment(text); + } + callback(text); + }); + }; + d3.xml = function(url, mime, callback) { + function ready(req) { + callback(req && req.responseXML); + } + if (arguments.length < 3) { + callback = mime; + mime = null; + } + d3.xhr(url, mime, ready); + }; + var d3_nsPrefix = { + svg: "http://www.w3.org/2000/svg", + xhtml: "http://www.w3.org/1999/xhtml", + xlink: "http://www.w3.org/1999/xlink", + xml: "http://www.w3.org/XML/1998/namespace", + xmlns: "http://www.w3.org/2000/xmlns/" + }; + d3.ns = { + prefix: d3_nsPrefix, + qualify: function(name) { + var i = name.indexOf(":"), prefix = name; + if (i >= 0) { + prefix = name.substring(0, i); + name = name.substring(i + 1); + } + return d3_nsPrefix.hasOwnProperty(prefix) ? { + space: d3_nsPrefix[prefix], + local: name + } : name; + } + }; + d3.dispatch = function() { + var dispatch = new d3_dispatch, i = -1, n = arguments.length; + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); + return dispatch; + }; + d3_dispatch.prototype.on = function(type, listener) { + var i = type.indexOf("."), name = ""; + if (i > 0) { + name = type.substring(i + 1); + type = type.substring(0, i); + } + return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener); + }; + d3.format = function(specifier) { + var match = d3_format_re.exec(specifier), fill = match[1] || " ", sign = match[3] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, suffix = "", integer = false; + if (precision) precision = +precision.substring(1); + if (zfill) { + fill = "0"; + if (comma) width -= Math.floor((width - 1) / 4); + } + switch (type) { + case "n": + comma = true; + type = "g"; + break; + case "%": + scale = 100; + suffix = "%"; + type = "f"; + break; + case "p": + scale = 100; + suffix = "%"; + type = "r"; + break; + case "d": + integer = true; + precision = 0; + break; + case "s": + scale = -1; + type = "r"; + break; + } + if (type == "r" && !precision) type = "g"; + type = d3_format_types.get(type) || d3_format_typeDefault; + return function(value) { + if (integer && value % 1) return ""; + var negative = value < 0 && (value = -value) ? "-" : sign; + if (scale < 0) { + var prefix = d3.formatPrefix(value, precision); + value = prefix.scale(value); + suffix = prefix.symbol; + } else { + value *= scale; + } + value = type(value, precision); + if (zfill) { + var length = value.length + negative.length; + if (length < width) value = (new Array(width - length + 1)).join(fill) + value; + if (comma) value = d3_format_group(value); + value = negative + value; + } else { + if (comma) value = d3_format_group(value); + value = negative + value; + var length = value.length; + if (length < width) value = (new Array(width - length + 1)).join(fill) + value; + } + return value + suffix; + }; + }; + var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/; + var d3_format_types = d3.map({ + g: function(x, p) { + return x.toPrecision(p); + }, + e: function(x, p) { + return x.toExponential(p); + }, + f: function(x, p) { + return x.toFixed(p); + }, + r: function(x, p) { + return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p))); + } + }); + var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "μ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix); + d3.formatPrefix = function(value, precision) { + var i = 0; + if (value) { + if (value < 0) value *= -1; + if (precision) value = d3.round(value, d3_format_precision(value, precision)); + i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10); + i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3)); + } + return d3_formatPrefixes[8 + i / 3]; + }; + var d3_ease_quad = d3_ease_poly(2), d3_ease_cubic = d3_ease_poly(3), d3_ease_default = function() { + return d3_ease_identity; + }; + var d3_ease = d3.map({ + linear: d3_ease_default, + poly: d3_ease_poly, + quad: function() { + return d3_ease_quad; + }, + cubic: function() { + return d3_ease_cubic; + }, + sin: function() { + return d3_ease_sin; + }, + exp: function() { + return d3_ease_exp; + }, + circle: function() { + return d3_ease_circle; + }, + elastic: d3_ease_elastic, + back: d3_ease_back, + bounce: function() { + return d3_ease_bounce; + } + }); + var d3_ease_mode = d3.map({ + "in": d3_ease_identity, + out: d3_ease_reverse, + "in-out": d3_ease_reflect, + "out-in": function(f) { + return d3_ease_reflect(d3_ease_reverse(f)); + } + }); + d3.ease = function(name) { + var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in"; + t = d3_ease.get(t) || d3_ease_default; + m = d3_ease_mode.get(m) || d3_ease_identity; + return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1)))); + }; + d3.event = null; + d3.transform = function(string) { + var g = document.createElementNS(d3.ns.prefix.svg, "g"); + return (d3.transform = function(string) { + g.setAttribute("transform", string); + var t = g.transform.baseVal.consolidate(); + return new d3_transform(t ? t.matrix : d3_transformIdentity); + })(string); + }; + d3_transform.prototype.toString = function() { + return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")"; + }; + var d3_transformDegrees = 180 / Math.PI, d3_transformIdentity = { + a: 1, + b: 0, + c: 0, + d: 1, + e: 0, + f: 0 + }; + d3.interpolate = function(a, b) { + var i = d3.interpolators.length, f; + while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ; + return f; + }; + d3.interpolateNumber = function(a, b) { + b -= a; + return function(t) { + return a + b * t; + }; + }; + d3.interpolateRound = function(a, b) { + b -= a; + return function(t) { + return Math.round(a + b * t); + }; + }; + d3.interpolateString = function(a, b) { + var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o; + d3_interpolate_number.lastIndex = 0; + for (i = 0; m = d3_interpolate_number.exec(b); ++i) { + if (m.index) s.push(b.substring(s0, s1 = m.index)); + q.push({ + i: s.length, + x: m[0] + }); + s.push(null); + s0 = d3_interpolate_number.lastIndex; + } + if (s0 < b.length) s.push(b.substring(s0)); + for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) { + o = q[i]; + if (o.x == m[0]) { + if (o.i) { + if (s[o.i + 1] == null) { + s[o.i - 1] += o.x; + s.splice(o.i, 1); + for (j = i + 1; j < n; ++j) q[j].i--; + } else { + s[o.i - 1] += o.x + s[o.i + 1]; + s.splice(o.i, 2); + for (j = i + 1; j < n; ++j) q[j].i -= 2; + } + } else { + if (s[o.i + 1] == null) { + s[o.i] = o.x; + } else { + s[o.i] = o.x + s[o.i + 1]; + s.splice(o.i + 1, 1); + for (j = i + 1; j < n; ++j) q[j].i--; + } + } + q.splice(i, 1); + n--; + i--; + } else { + o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x)); + } + } + while (i < n) { + o = q.pop(); + if (s[o.i + 1] == null) { + s[o.i] = o.x; + } else { + s[o.i] = o.x + s[o.i + 1]; + s.splice(o.i + 1, 1); + } + n--; + } + if (s.length === 1) { + return s[0] == null ? q[0].x : function() { + return b; + }; + } + return function(t) { + for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; + }; + d3.interpolateTransform = function(a, b) { + var s = [], q = [], n, A = d3.transform(a), B = d3.transform(b), ta = A.translate, tb = B.translate, ra = A.rotate, rb = B.rotate, wa = A.skew, wb = B.skew, ka = A.scale, kb = B.scale; + if (ta[0] != tb[0] || ta[1] != tb[1]) { + s.push("translate(", null, ",", null, ")"); + q.push({ + i: 1, + x: d3.interpolateNumber(ta[0], tb[0]) + }, { + i: 3, + x: d3.interpolateNumber(ta[1], tb[1]) + }); + } else if (tb[0] || tb[1]) { + s.push("translate(" + tb + ")"); + } else { + s.push(""); + } + if (ra != rb) { + if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360; + q.push({ + i: s.push(s.pop() + "rotate(", null, ")") - 2, + x: d3.interpolateNumber(ra, rb) + }); + } else if (rb) { + s.push(s.pop() + "rotate(" + rb + ")"); + } + if (wa != wb) { + q.push({ + i: s.push(s.pop() + "skewX(", null, ")") - 2, + x: d3.interpolateNumber(wa, wb) + }); + } else if (wb) { + s.push(s.pop() + "skewX(" + wb + ")"); + } + if (ka[0] != kb[0] || ka[1] != kb[1]) { + n = s.push(s.pop() + "scale(", null, ",", null, ")"); + q.push({ + i: n - 4, + x: d3.interpolateNumber(ka[0], kb[0]) + }, { + i: n - 2, + x: d3.interpolateNumber(ka[1], kb[1]) + }); + } else if (kb[0] != 1 || kb[1] != 1) { + s.push(s.pop() + "scale(" + kb + ")"); + } + n = q.length; + return function(t) { + var i = -1, o; + while (++i < n) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; + }; + d3.interpolateRgb = function(a, b) { + a = d3.rgb(a); + b = d3.rgb(b); + var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab; + return function(t) { + return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t)); + }; + }; + d3.interpolateHsl = function(a, b) { + a = d3.hsl(a); + b = d3.hsl(b); + var h0 = a.h, s0 = a.s, l0 = a.l, h1 = b.h - h0, s1 = b.s - s0, l1 = b.l - l0; + if (h1 > 180) h1 -= 360; else if (h1 < -180) h1 += 360; + return function(t) { + return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t) + ""; + }; + }; + d3.interpolateLab = function(a, b) { + a = d3.lab(a); + b = d3.lab(b); + var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab; + return function(t) { + return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + ""; + }; + }; + d3.interpolateHcl = function(a, b) { + a = d3.hcl(a); + b = d3.hcl(b); + var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al; + if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; + return function(t) { + return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + ""; + }; + }; + d3.interpolateArray = function(a, b) { + var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i; + for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i])); + for (; i < na; ++i) c[i] = a[i]; + for (; i < nb; ++i) c[i] = b[i]; + return function(t) { + for (i = 0; i < n0; ++i) c[i] = x[i](t); + return c; + }; + }; + d3.interpolateObject = function(a, b) { + var i = {}, c = {}, k; + for (k in a) { + if (k in b) { + i[k] = d3_interpolateByName(k)(a[k], b[k]); + } else { + c[k] = a[k]; + } + } + for (k in b) { + if (!(k in a)) { + c[k] = b[k]; + } + } + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; + }; + var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g; + d3.interpolators = [ d3.interpolateObject, function(a, b) { + return b instanceof Array && d3.interpolateArray(a, b); + }, function(a, b) { + return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + ""); + }, function(a, b) { + return (typeof b === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b); + }, function(a, b) { + return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b); + } ]; + d3.rgb = function(r, g, b) { + return arguments.length === 1 ? r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : d3_rgb(~~r, ~~g, ~~b); + }; + d3_Rgb.prototype.brighter = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + var r = this.r, g = this.g, b = this.b, i = 30; + if (!r && !g && !b) return d3_rgb(i, i, i); + if (r && r < i) r = i; + if (g && g < i) g = i; + if (b && b < i) b = i; + return d3_rgb(Math.min(255, Math.floor(r / k)), Math.min(255, Math.floor(g / k)), Math.min(255, Math.floor(b / k))); + }; + d3_Rgb.prototype.darker = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + return d3_rgb(Math.floor(k * this.r), Math.floor(k * this.g), Math.floor(k * this.b)); + }; + d3_Rgb.prototype.hsl = function() { + return d3_rgb_hsl(this.r, this.g, this.b); + }; + d3_Rgb.prototype.toString = function() { + return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b); + }; + var d3_rgb_names = d3.map({ + aliceblue: "#f0f8ff", + antiquewhite: "#faebd7", + aqua: "#00ffff", + aquamarine: "#7fffd4", + azure: "#f0ffff", + beige: "#f5f5dc", + bisque: "#ffe4c4", + black: "#000000", + blanchedalmond: "#ffebcd", + blue: "#0000ff", + blueviolet: "#8a2be2", + brown: "#a52a2a", + burlywood: "#deb887", + cadetblue: "#5f9ea0", + chartreuse: "#7fff00", + chocolate: "#d2691e", + coral: "#ff7f50", + cornflowerblue: "#6495ed", + cornsilk: "#fff8dc", + crimson: "#dc143c", + cyan: "#00ffff", + darkblue: "#00008b", + darkcyan: "#008b8b", + darkgoldenrod: "#b8860b", + darkgray: "#a9a9a9", + darkgreen: "#006400", + darkgrey: "#a9a9a9", + darkkhaki: "#bdb76b", + darkmagenta: "#8b008b", + darkolivegreen: "#556b2f", + darkorange: "#ff8c00", + darkorchid: "#9932cc", + darkred: "#8b0000", + darksalmon: "#e9967a", + darkseagreen: "#8fbc8f", + darkslateblue: "#483d8b", + darkslategray: "#2f4f4f", + darkslategrey: "#2f4f4f", + darkturquoise: "#00ced1", + darkviolet: "#9400d3", + deeppink: "#ff1493", + deepskyblue: "#00bfff", + dimgray: "#696969", + dimgrey: "#696969", + dodgerblue: "#1e90ff", + firebrick: "#b22222", + floralwhite: "#fffaf0", + forestgreen: "#228b22", + fuchsia: "#ff00ff", + gainsboro: "#dcdcdc", + ghostwhite: "#f8f8ff", + gold: "#ffd700", + goldenrod: "#daa520", + gray: "#808080", + green: "#008000", + greenyellow: "#adff2f", + grey: "#808080", + honeydew: "#f0fff0", + hotpink: "#ff69b4", + indianred: "#cd5c5c", + indigo: "#4b0082", + ivory: "#fffff0", + khaki: "#f0e68c", + lavender: "#e6e6fa", + lavenderblush: "#fff0f5", + lawngreen: "#7cfc00", + lemonchiffon: "#fffacd", + lightblue: "#add8e6", + lightcoral: "#f08080", + lightcyan: "#e0ffff", + lightgoldenrodyellow: "#fafad2", + lightgray: "#d3d3d3", + lightgreen: "#90ee90", + lightgrey: "#d3d3d3", + lightpink: "#ffb6c1", + lightsalmon: "#ffa07a", + lightseagreen: "#20b2aa", + lightskyblue: "#87cefa", + lightslategray: "#778899", + lightslategrey: "#778899", + lightsteelblue: "#b0c4de", + lightyellow: "#ffffe0", + lime: "#00ff00", + limegreen: "#32cd32", + linen: "#faf0e6", + magenta: "#ff00ff", + maroon: "#800000", + mediumaquamarine: "#66cdaa", + mediumblue: "#0000cd", + mediumorchid: "#ba55d3", + mediumpurple: "#9370db", + mediumseagreen: "#3cb371", + mediumslateblue: "#7b68ee", + mediumspringgreen: "#00fa9a", + mediumturquoise: "#48d1cc", + mediumvioletred: "#c71585", + midnightblue: "#191970", + mintcream: "#f5fffa", + mistyrose: "#ffe4e1", + moccasin: "#ffe4b5", + navajowhite: "#ffdead", + navy: "#000080", + oldlace: "#fdf5e6", + olive: "#808000", + olivedrab: "#6b8e23", + orange: "#ffa500", + orangered: "#ff4500", + orchid: "#da70d6", + palegoldenrod: "#eee8aa", + palegreen: "#98fb98", + paleturquoise: "#afeeee", + palevioletred: "#db7093", + papayawhip: "#ffefd5", + peachpuff: "#ffdab9", + peru: "#cd853f", + pink: "#ffc0cb", + plum: "#dda0dd", + powderblue: "#b0e0e6", + purple: "#800080", + red: "#ff0000", + rosybrown: "#bc8f8f", + royalblue: "#4169e1", + saddlebrown: "#8b4513", + salmon: "#fa8072", + sandybrown: "#f4a460", + seagreen: "#2e8b57", + seashell: "#fff5ee", + sienna: "#a0522d", + silver: "#c0c0c0", + skyblue: "#87ceeb", + slateblue: "#6a5acd", + slategray: "#708090", + slategrey: "#708090", + snow: "#fffafa", + springgreen: "#00ff7f", + steelblue: "#4682b4", + tan: "#d2b48c", + teal: "#008080", + thistle: "#d8bfd8", + tomato: "#ff6347", + turquoise: "#40e0d0", + violet: "#ee82ee", + wheat: "#f5deb3", + white: "#ffffff", + whitesmoke: "#f5f5f5", + yellow: "#ffff00", + yellowgreen: "#9acd32" + }); + d3_rgb_names.forEach(function(key, value) { + d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb)); + }); + d3.hsl = function(h, s, l) { + return arguments.length === 1 ? h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : d3_hsl(+h, +s, +l); + }; + d3_Hsl.prototype.brighter = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + return d3_hsl(this.h, this.s, this.l / k); + }; + d3_Hsl.prototype.darker = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + return d3_hsl(this.h, this.s, k * this.l); + }; + d3_Hsl.prototype.rgb = function() { + return d3_hsl_rgb(this.h, this.s, this.l); + }; + d3_Hsl.prototype.toString = function() { + return this.rgb().toString(); + }; + d3.hcl = function(h, c, l) { + return arguments.length === 1 ? h instanceof d3_Hcl ? d3_hcl(h.h, h.c, h.l) : h instanceof d3_Lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : d3_hcl(+h, +c, +l); + }; + d3_Hcl.prototype.brighter = function(k) { + return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1))); + }; + d3_Hcl.prototype.darker = function(k) { + return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1))); + }; + d3_Hcl.prototype.rgb = function() { + return d3_hcl_lab(this.h, this.c, this.l).rgb(); + }; + d3_Hcl.prototype.toString = function() { + return this.rgb() + ""; + }; + d3.lab = function(l, a, b) { + return arguments.length === 1 ? l instanceof d3_Lab ? d3_lab(l.l, l.a, l.b) : l instanceof d3_Hcl ? d3_hcl_lab(l.l, l.c, l.h) : d3_rgb_lab((l = d3.rgb(l)).r, l.g, l.b) : d3_lab(+l, +a, +b); + }; + var d3_lab_K = 18; + var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883; + d3_Lab.prototype.brighter = function(k) { + return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); + }; + d3_Lab.prototype.darker = function(k) { + return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); + }; + d3_Lab.prototype.rgb = function() { + return d3_lab_rgb(this.l, this.a, this.b); + }; + d3_Lab.prototype.toString = function() { + return this.rgb() + ""; + }; + var d3_select = function(s, n) { + return n.querySelector(s); + }, d3_selectAll = function(s, n) { + return n.querySelectorAll(s); + }, d3_selectRoot = document.documentElement, d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, d3_selectMatches = function(n, s) { + return d3_selectMatcher.call(n, s); + }; + if (typeof Sizzle === "function") { + d3_select = function(s, n) { + return Sizzle(s, n)[0] || null; + }; + d3_selectAll = function(s, n) { + return Sizzle.uniqueSort(Sizzle(s, n)); + }; + d3_selectMatches = Sizzle.matchesSelector; + } + var d3_selectionPrototype = []; + d3.selection = function() { + return d3_selectionRoot; + }; + d3.selection.prototype = d3_selectionPrototype; + d3_selectionPrototype.select = function(selector) { + var subgroups = [], subgroup, subnode, group, node; + if (typeof selector !== "function") selector = d3_selection_selector(selector); + for (var j = -1, m = this.length; ++j < m; ) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + subgroup.push(subnode = selector.call(node, node.__data__, i)); + if (subnode && "__data__" in node) subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + return d3_selection(subgroups); + }; + d3_selectionPrototype.selectAll = function(selector) { + var subgroups = [], subgroup, node; + if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); + for (var j = -1, m = this.length; ++j < m; ) { + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i))); + subgroup.parentNode = node; + } + } + } + return d3_selection(subgroups); + }; + d3_selectionPrototype.attr = function(name, value) { + if (arguments.length < 2) { + if (typeof name === "string") { + var node = this.node(); + name = d3.ns.qualify(name); + return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name); + } + for (value in name) this.each(d3_selection_attr(value, name[value])); + return this; + } + return this.each(d3_selection_attr(name, value)); + }; + d3_selectionPrototype.classed = function(name, value) { + if (arguments.length < 2) { + if (typeof name === "string") { + var node = this.node(), n = (name = name.trim().split(/^|\s+/g)).length, i = -1; + if (value = node.classList) { + while (++i < n) if (!value.contains(name[i])) return false; + } else { + value = node.className; + if (value.baseVal != null) value = value.baseVal; + while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false; + } + return true; + } + for (value in name) this.each(d3_selection_classed(value, name[value])); + return this; + } + return this.each(d3_selection_classed(name, value)); + }; + d3_selectionPrototype.style = function(name, value, priority) { + var n = arguments.length; + if (n < 3) { + if (typeof name !== "string") { + if (n < 2) value = ""; + for (priority in name) this.each(d3_selection_style(priority, name[priority], value)); + return this; + } + if (n < 2) return window.getComputedStyle(this.node(), null).getPropertyValue(name); + priority = ""; + } + return this.each(d3_selection_style(name, value, priority)); + }; + d3_selectionPrototype.property = function(name, value) { + if (arguments.length < 2) { + if (typeof name === "string") return this.node()[name]; + for (value in name) this.each(d3_selection_property(value, name[value])); + return this; + } + return this.each(d3_selection_property(name, value)); + }; + d3_selectionPrototype.text = function(value) { + return arguments.length < 1 ? this.node().textContent : this.each(typeof value === "function" ? function() { + var v = value.apply(this, arguments); + this.textContent = v == null ? "" : v; + } : value == null ? function() { + this.textContent = ""; + } : function() { + this.textContent = value; + }); + }; + d3_selectionPrototype.html = function(value) { + return arguments.length < 1 ? this.node().innerHTML : this.each(typeof value === "function" ? function() { + var v = value.apply(this, arguments); + this.innerHTML = v == null ? "" : v; + } : value == null ? function() { + this.innerHTML = ""; + } : function() { + this.innerHTML = value; + }); + }; + d3_selectionPrototype.append = function(name) { + function append() { + return this.appendChild(document.createElementNS(this.namespaceURI, name)); + } + function appendNS() { + return this.appendChild(document.createElementNS(name.space, name.local)); + } + name = d3.ns.qualify(name); + return this.select(name.local ? appendNS : append); + }; + d3_selectionPrototype.insert = function(name, before) { + function insert() { + return this.insertBefore(document.createElementNS(this.namespaceURI, name), d3_select(before, this)); + } + function insertNS() { + return this.insertBefore(document.createElementNS(name.space, name.local), d3_select(before, this)); + } + name = d3.ns.qualify(name); + return this.select(name.local ? insertNS : insert); + }; + d3_selectionPrototype.remove = function() { + return this.each(function() { + var parent = this.parentNode; + if (parent) parent.removeChild(this); + }); + }; + d3_selectionPrototype.data = function(value, key) { + function bind(group, groupData) { + var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), n1 = Math.max(n, m), updateNodes = [], enterNodes = [], exitNodes = [], node, nodeData; + if (key) { + var nodeByKeyValue = new d3_Map, keyValues = [], keyValue, j = groupData.length; + for (i = -1; ++i < n; ) { + keyValue = key.call(node = group[i], node.__data__, i); + if (nodeByKeyValue.has(keyValue)) { + exitNodes[j++] = node; + } else { + nodeByKeyValue.set(keyValue, node); + } + keyValues.push(keyValue); + } + for (i = -1; ++i < m; ) { + keyValue = key.call(groupData, nodeData = groupData[i], i); + if (nodeByKeyValue.has(keyValue)) { + updateNodes[i] = node = nodeByKeyValue.get(keyValue); + node.__data__ = nodeData; + enterNodes[i] = exitNodes[i] = null; + } else { + enterNodes[i] = d3_selection_dataNode(nodeData); + updateNodes[i] = exitNodes[i] = null; + } + nodeByKeyValue.remove(keyValue); + } + for (i = -1; ++i < n; ) { + if (nodeByKeyValue.has(keyValues[i])) { + exitNodes[i] = group[i]; + } + } + } else { + for (i = -1; ++i < n0; ) { + node = group[i]; + nodeData = groupData[i]; + if (node) { + node.__data__ = nodeData; + updateNodes[i] = node; + enterNodes[i] = exitNodes[i] = null; + } else { + enterNodes[i] = d3_selection_dataNode(nodeData); + updateNodes[i] = exitNodes[i] = null; + } + } + for (; i < m; ++i) { + enterNodes[i] = d3_selection_dataNode(groupData[i]); + updateNodes[i] = exitNodes[i] = null; + } + for (; i < n1; ++i) { + exitNodes[i] = group[i]; + enterNodes[i] = updateNodes[i] = null; + } + } + enterNodes.update = updateNodes; + enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode; + enter.push(enterNodes); + update.push(updateNodes); + exit.push(exitNodes); + } + var i = -1, n = this.length, group, node; + if (!arguments.length) { + value = new Array(n = (group = this[0]).length); + while (++i < n) { + if (node = group[i]) { + value[i] = node.__data__; + } + } + return value; + } + var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]); + if (typeof value === "function") { + while (++i < n) { + bind(group = this[i], value.call(group, group.parentNode.__data__, i)); + } + } else { + while (++i < n) { + bind(group = this[i], value); + } + } + update.enter = function() { + return enter; + }; + update.exit = function() { + return exit; + }; + return update; + }; + d3_selectionPrototype.datum = d3_selectionPrototype.map = function(value) { + return arguments.length < 1 ? this.property("__data__") : this.property("__data__", value); + }; + d3_selectionPrototype.filter = function(filter) { + var subgroups = [], subgroup, group, node; + if (typeof filter !== "function") filter = d3_selection_filter(filter); + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = 0, n = group.length; i < n; i++) { + if ((node = group[i]) && filter.call(node, node.__data__, i)) { + subgroup.push(node); + } + } + } + return d3_selection(subgroups); + }; + d3_selectionPrototype.order = function() { + for (var j = -1, m = this.length; ++j < m; ) { + for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) { + if (node = group[i]) { + if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next); + next = node; + } + } + } + return this; + }; + d3_selectionPrototype.sort = function(comparator) { + comparator = d3_selection_sortComparator.apply(this, arguments); + for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator); + return this.order(); + }; + d3_selectionPrototype.on = function(type, listener, capture) { + var n = arguments.length; + if (n < 3) { + if (typeof type !== "string") { + if (n < 2) listener = false; + for (capture in type) this.each(d3_selection_on(capture, type[capture], listener)); + return this; + } + if (n < 2) return (n = this.node()["__on" + type]) && n._; + capture = false; + } + return this.each(d3_selection_on(type, listener, capture)); + }; + d3_selectionPrototype.each = function(callback) { + return d3_selection_each(this, function(node, i, j) { + callback.call(node, node.__data__, i, j); + }); + }; + d3_selectionPrototype.call = function(callback) { + callback.apply(this, (arguments[0] = this, arguments)); + return this; + }; + d3_selectionPrototype.empty = function() { + return !this.node(); + }; + d3_selectionPrototype.node = function(callback) { + for (var j = 0, m = this.length; j < m; j++) { + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + var node = group[i]; + if (node) return node; + } + } + return null; + }; + d3_selectionPrototype.transition = function() { + var subgroups = [], subgroup, node; + for (var j = -1, m = this.length; ++j < m; ) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + subgroup.push((node = group[i]) ? { + node: node, + delay: d3_transitionDelay, + duration: d3_transitionDuration + } : null); + } + } + return d3_transition(subgroups, d3_transitionId || ++d3_transitionNextId, Date.now()); + }; + var d3_selectionRoot = d3_selection([ [ document ] ]); + d3_selectionRoot[0].parentNode = d3_selectRoot; + d3.select = function(selector) { + return typeof selector === "string" ? d3_selectionRoot.select(selector) : d3_selection([ [ selector ] ]); + }; + d3.selectAll = function(selector) { + return typeof selector === "string" ? d3_selectionRoot.selectAll(selector) : d3_selection([ d3_array(selector) ]); + }; + var d3_selection_enterPrototype = []; + d3.selection.enter = d3_selection_enter; + d3.selection.enter.prototype = d3_selection_enterPrototype; + d3_selection_enterPrototype.append = d3_selectionPrototype.append; + d3_selection_enterPrototype.insert = d3_selectionPrototype.insert; + d3_selection_enterPrototype.empty = d3_selectionPrototype.empty; + d3_selection_enterPrototype.node = d3_selectionPrototype.node; + d3_selection_enterPrototype.select = function(selector) { + var subgroups = [], subgroup, subnode, upgroup, group, node; + for (var j = -1, m = this.length; ++j < m; ) { + upgroup = (group = this[j]).update; + subgroups.push(subgroup = []); + subgroup.parentNode = group.parentNode; + for (var i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i)); + subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + return d3_selection(subgroups); + }; + var d3_transitionPrototype = [], d3_transitionNextId = 0, d3_transitionId = 0, d3_transitionDefaultDelay = 0, d3_transitionDefaultDuration = 250, d3_transitionDefaultEase = d3.ease("cubic-in-out"), d3_transitionDelay = d3_transitionDefaultDelay, d3_transitionDuration = d3_transitionDefaultDuration, d3_transitionEase = d3_transitionDefaultEase; + d3_transitionPrototype.call = d3_selectionPrototype.call; + d3.transition = function(selection) { + return arguments.length ? d3_transitionId ? selection.transition() : selection : d3_selectionRoot.transition(); + }; + d3.transition.prototype = d3_transitionPrototype; + d3_transitionPrototype.select = function(selector) { + var subgroups = [], subgroup, subnode, node; + if (typeof selector !== "function") selector = d3_selection_selector(selector); + for (var j = -1, m = this.length; ++j < m; ) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) { + if ("__data__" in node.node) subnode.__data__ = node.node.__data__; + subgroup.push({ + node: subnode, + delay: node.delay, + duration: node.duration + }); + } else { + subgroup.push(null); + } + } + } + return d3_transition(subgroups, this.id, this.time).ease(this.ease()); + }; + d3_transitionPrototype.selectAll = function(selector) { + var subgroups = [], subgroup, subnodes, node; + if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); + for (var j = -1, m = this.length; ++j < m; ) { + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + subnodes = selector.call(node.node, node.node.__data__, i); + subgroups.push(subgroup = []); + for (var k = -1, o = subnodes.length; ++k < o; ) { + subgroup.push({ + node: subnodes[k], + delay: node.delay, + duration: node.duration + }); + } + } + } + } + return d3_transition(subgroups, this.id, this.time).ease(this.ease()); + }; + d3_transitionPrototype.filter = function(filter) { + var subgroups = [], subgroup, group, node; + if (typeof filter !== "function") filter = d3_selection_filter(filter); + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + if ((node = group[i]) && filter.call(node.node, node.node.__data__, i)) { + subgroup.push(node); + } + } + } + return d3_transition(subgroups, this.id, this.time).ease(this.ease()); + }; + d3_transitionPrototype.attr = function(name, value) { + if (arguments.length < 2) { + for (value in name) this.attrTween(value, d3_tweenByName(name[value], value)); + return this; + } + return this.attrTween(name, d3_tweenByName(value, name)); + }; + d3_transitionPrototype.attrTween = function(nameNS, tween) { + function attrTween(d, i) { + var f = tween.call(this, d, i, this.getAttribute(name)); + return f === d3_tweenRemove ? (this.removeAttribute(name), null) : f && function(t) { + this.setAttribute(name, f(t)); + }; + } + function attrTweenNS(d, i) { + var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local)); + return f === d3_tweenRemove ? (this.removeAttributeNS(name.space, name.local), null) : f && function(t) { + this.setAttributeNS(name.space, name.local, f(t)); + }; + } + var name = d3.ns.qualify(nameNS); + return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween); + }; + d3_transitionPrototype.style = function(name, value, priority) { + var n = arguments.length; + if (n < 3) { + if (typeof name !== "string") { + if (n < 2) value = ""; + for (priority in name) this.styleTween(priority, d3_tweenByName(name[priority], priority), value); + return this; + } + priority = ""; + } + return this.styleTween(name, d3_tweenByName(value, name), priority); + }; + d3_transitionPrototype.styleTween = function(name, tween, priority) { + if (arguments.length < 3) priority = ""; + return this.tween("style." + name, function(d, i) { + var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name)); + return f === d3_tweenRemove ? (this.style.removeProperty(name), null) : f && function(t) { + this.style.setProperty(name, f(t), priority); + }; + }); + }; + d3_transitionPrototype.text = function(value) { + return this.tween("text", function(d, i) { + this.textContent = typeof value === "function" ? value.call(this, d, i) : value; + }); + }; + d3_transitionPrototype.remove = function() { + return this.each("end.transition", function() { + var p; + if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this); + }); + }; + d3_transitionPrototype.delay = function(value) { + return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { + node.delay = value.call(node = node.node, node.__data__, i, j) | 0; + } : (value = value | 0, function(node) { + node.delay = value; + })); + }; + d3_transitionPrototype.duration = function(value) { + return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { + node.duration = Math.max(1, value.call(node = node.node, node.__data__, i, j) | 0); + } : (value = Math.max(1, value | 0), function(node) { + node.duration = value; + })); + }; + d3_transitionPrototype.transition = function() { + return this.select(d3_this); + }; + d3.tween = function(b, interpolate) { + function tweenFunction(d, i, a) { + var v = b.call(this, d, i); + return v == null ? a != "" && d3_tweenRemove : a != v && interpolate(a, v); + } + function tweenString(d, i, a) { + return a != b && interpolate(a, b); + } + return typeof b === "function" ? tweenFunction : b == null ? d3_tweenNull : (b += "", tweenString); + }; + var d3_tweenRemove = {}; + var d3_timer_queue = null, d3_timer_interval, d3_timer_timeout; + d3.timer = function(callback, delay, then) { + var found = false, t0, t1 = d3_timer_queue; + if (arguments.length < 3) { + if (arguments.length < 2) delay = 0; else if (!isFinite(delay)) return; + then = Date.now(); + } + while (t1) { + if (t1.callback === callback) { + t1.then = then; + t1.delay = delay; + found = true; + break; + } + t0 = t1; + t1 = t1.next; + } + if (!found) d3_timer_queue = { + callback: callback, + then: then, + delay: delay, + next: d3_timer_queue + }; + if (!d3_timer_interval) { + d3_timer_timeout = clearTimeout(d3_timer_timeout); + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } + }; + d3.timer.flush = function() { + var elapsed, now = Date.now(), t1 = d3_timer_queue; + while (t1) { + elapsed = now - t1.then; + if (!t1.delay) t1.flush = t1.callback(elapsed); + t1 = t1.next; + } + d3_timer_flush(); + }; + var d3_timer_frame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) { + setTimeout(callback, 17); + }; + d3.mouse = function(container) { + return d3_mousePoint(container, d3_eventSource()); + }; + var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0; + d3.touches = function(container, touches) { + if (arguments.length < 2) touches = d3_eventSource().touches; + return touches ? d3_array(touches).map(function(touch) { + var point = d3_mousePoint(container, touch); + point.identifier = touch.identifier; + return point; + }) : []; + }; + d3.scale = {}; + d3.scale.linear = function() { + return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3.interpolate, false); + }; + d3.scale.log = function() { + return d3_scale_log(d3.scale.linear(), d3_scale_logp); + }; + var d3_scale_logFormat = d3.format(".0e"); + d3_scale_logp.pow = function(x) { + return Math.pow(10, x); + }; + d3_scale_logn.pow = function(x) { + return -Math.pow(10, -x); + }; + d3.scale.pow = function() { + return d3_scale_pow(d3.scale.linear(), 1); + }; + d3.scale.sqrt = function() { + return d3.scale.pow().exponent(.5); + }; + d3.scale.ordinal = function() { + return d3_scale_ordinal([], { + t: "range", + a: [ [] ] + }); + }; + d3.scale.category10 = function() { + return d3.scale.ordinal().range(d3_category10); + }; + d3.scale.category20 = function() { + return d3.scale.ordinal().range(d3_category20); + }; + d3.scale.category20b = function() { + return d3.scale.ordinal().range(d3_category20b); + }; + d3.scale.category20c = function() { + return d3.scale.ordinal().range(d3_category20c); + }; + d3.scale.category50 = function() { + return d3.scale.ordinal().range(d3_category50); + }; + var d3_category10 = [ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" ]; + var d3_category20 = [ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ]; + var d3_category20b = [ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" ]; + var d3_category20c = [ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9" ]; + var d3_category50 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#8c864b", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf","#DC143C","#800080","#0000FF","#008000","#D2691E","#FF0000","#000000","#DB7093","#FF00FF","#7B68EE","#1f77b6", "#9edae5", "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#aec7e8", "#e7ba52", "#ffbb78", "#e7cb94", "#98df8a", "#843c39", "#ff9896", "#ad494a", "#c5b0d5", "#d6616b", "#c49c94", "#e7969c", "#f7b6d2", "#fd8d3c", "#c7c7c7", "#7b4173", "#dbdb8d", "#a55194", ]; + d3.scale.quantile = function() { + return d3_scale_quantile([], []); + }; + d3.scale.quantize = function() { + return d3_scale_quantize(0, 1, [ 0, 1 ]); + }; + d3.scale.threshold = function() { + return d3_scale_threshold([ .5 ], [ 0, 1 ]); + }; + d3.scale.identity = function() { + return d3_scale_identity([ 0, 1 ]); + }; + d3.svg = {}; + d3.svg.arc = function() { + function arc() { + var r0 = innerRadius.apply(this, arguments), r1 = outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0), df = da < Math.PI ? "0" : "1", c0 = Math.cos(a0), s0 = Math.sin(a0), c1 = Math.cos(a1), s1 = Math.sin(a1); + return da >= d3_svg_arcMax ? r0 ? "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "M0," + r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + -r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + "Z" : "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "Z" : r0 ? "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L" + r0 * c1 + "," + r0 * s1 + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + "Z" : "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L0,0" + "Z"; + } + var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; + arc.innerRadius = function(v) { + if (!arguments.length) return innerRadius; + innerRadius = d3_functor(v); + return arc; + }; + arc.outerRadius = function(v) { + if (!arguments.length) return outerRadius; + outerRadius = d3_functor(v); + return arc; + }; + arc.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3_functor(v); + return arc; + }; + arc.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3_functor(v); + return arc; + }; + arc.centroid = function() { + var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset; + return [ Math.cos(a) * r, Math.sin(a) * r ]; + }; + return arc; + }; + var d3_svg_arcOffset = -Math.PI / 2, d3_svg_arcMax = 2 * Math.PI - 1e-6; + d3.svg.line = function() { + return d3_svg_line(d3_identity); + }; + var d3_svg_lineInterpolators = d3.map({ + linear: d3_svg_lineLinear, + "linear-closed": d3_svg_lineLinearClosed, + "step-before": d3_svg_lineStepBefore, + "step-after": d3_svg_lineStepAfter, + basis: d3_svg_lineBasis, + "basis-open": d3_svg_lineBasisOpen, + "basis-closed": d3_svg_lineBasisClosed, + bundle: d3_svg_lineBundle, + cardinal: d3_svg_lineCardinal, + "cardinal-open": d3_svg_lineCardinalOpen, + "cardinal-closed": d3_svg_lineCardinalClosed, + monotone: d3_svg_lineMonotone + }); + d3_svg_lineInterpolators.forEach(function(key, value) { + value.key = key; + value.closed = /-closed$/.test(key); + }); + var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ]; + d3.svg.line.radial = function() { + var line = d3_svg_line(d3_svg_lineRadial); + line.radius = line.x, delete line.x; + line.angle = line.y, delete line.y; + return line; + }; + d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter; + d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore; + d3.svg.area = function() { + return d3_svg_area(d3_identity); + }; + d3.svg.area.radial = function() { + var area = d3_svg_area(d3_svg_lineRadial); + area.radius = area.x, delete area.x; + area.innerRadius = area.x0, delete area.x0; + area.outerRadius = area.x1, delete area.x1; + area.angle = area.y, delete area.y; + area.startAngle = area.y0, delete area.y0; + area.endAngle = area.y1, delete area.y1; + return area; + }; + d3.svg.chord = function() { + function chord(d, i) { + var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i); + return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z"; + } + function subgroup(self, f, d, i) { + var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset; + return { + r: r, + a0: a0, + a1: a1, + p0: [ r * Math.cos(a0), r * Math.sin(a0) ], + p1: [ r * Math.cos(a1), r * Math.sin(a1) ] + }; + } + function equals(a, b) { + return a.a0 == b.a0 && a.a1 == b.a1; + } + function arc(r, p, a) { + return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p; + } + function curve(r0, p0, r1, p1) { + return "Q 0,0 " + p1; + } + var source = d3_svg_chordSource, target = d3_svg_chordTarget, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; + chord.radius = function(v) { + if (!arguments.length) return radius; + radius = d3_functor(v); + return chord; + }; + chord.source = function(v) { + if (!arguments.length) return source; + source = d3_functor(v); + return chord; + }; + chord.target = function(v) { + if (!arguments.length) return target; + target = d3_functor(v); + return chord; + }; + chord.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3_functor(v); + return chord; + }; + chord.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3_functor(v); + return chord; + }; + return chord; + }; + d3.svg.diagonal = function() { + function diagonal(d, i) { + var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, { + x: p0.x, + y: m + }, { + x: p3.x, + y: m + }, p3 ]; + p = p.map(projection); + return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3]; + } + var source = d3_svg_chordSource, target = d3_svg_chordTarget, projection = d3_svg_diagonalProjection; + diagonal.source = function(x) { + if (!arguments.length) return source; + source = d3_functor(x); + return diagonal; + }; + diagonal.target = function(x) { + if (!arguments.length) return target; + target = d3_functor(x); + return diagonal; + }; + diagonal.projection = function(x) { + if (!arguments.length) return projection; + projection = x; + return diagonal; + }; + return diagonal; + }; + d3.svg.diagonal.radial = function() { + var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection; + diagonal.projection = function(x) { + return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection; + }; + return diagonal; + }; + d3.svg.mouse = d3.mouse; + d3.svg.touches = d3.touches; + d3.svg.symbol = function() { + function symbol(d, i) { + return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i)); + } + var type = d3_svg_symbolType, size = d3_svg_symbolSize; + symbol.type = function(x) { + if (!arguments.length) return type; + type = d3_functor(x); + return symbol; + }; + symbol.size = function(x) { + if (!arguments.length) return size; + size = d3_functor(x); + return symbol; + }; + return symbol; + }; + var d3_svg_symbols = d3.map({ + circle: d3_svg_symbolCircle, + cross: function(size) { + var r = Math.sqrt(size / 5) / 2; + return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z"; + }, + diamond: function(size) { + var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30; + return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z"; + }, + square: function(size) { + var r = Math.sqrt(size) / 2; + return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z"; + }, + "triangle-down": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z"; + }, + "triangle-up": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z"; + } + }); + d3.svg.symbolTypes = d3_svg_symbols.keys(); + var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180); + d3.svg.axis = function() { + function axis(g) { + g.each(function() { + var g = d3.select(this); + var ticks = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain() : tickValues, tickFormat = tickFormat_ == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String : tickFormat_; + var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), subtick = g.selectAll(".minor").data(subticks, String), subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6), subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(), subtickUpdate = d3.transition(subtick).style("opacity", 1); + var tick = g.selectAll("g").data(ticks, String), tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform; + var range = d3_scaleRange(scale), path = g.selectAll(".domain").data([ 0 ]), pathEnter = path.enter().append("path").attr("class", "domain"), pathUpdate = d3.transition(path); + var scale1 = scale.copy(), scale0 = this.__chart__ || scale1; + this.__chart__ = scale1; + tickEnter.append("line").attr("class", "tick"); + tickEnter.append("text"); + var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text"); + switch (orient) { + case "bottom": + { + tickTransform = d3_svg_axisX; + subtickEnter.attr("y2", tickMinorSize); + subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize); + lineEnter.attr("y2", tickMajorSize); + textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding); + lineUpdate.attr("x2", 0).attr("y2", tickMajorSize); + textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding); + text.attr("dy", ".71em").attr("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize); + break; + } + case "top": + { + tickTransform = d3_svg_axisX; + subtickEnter.attr("y2", -tickMinorSize); + subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize); + lineEnter.attr("y2", -tickMajorSize); + textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)); + lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize); + textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)); + text.attr("dy", "0em").attr("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize); + break; + } + case "left": + { + tickTransform = d3_svg_axisY; + subtickEnter.attr("x2", -tickMinorSize); + subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0); + lineEnter.attr("x2", -tickMajorSize); + textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)); + lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0); + textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0); + text.attr("dy", ".32em").attr("text-anchor", "end"); + pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize); + break; + } + case "right": + { + tickTransform = d3_svg_axisY; + subtickEnter.attr("x2", tickMinorSize); + subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0); + lineEnter.attr("x2", tickMajorSize); + textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding); + lineUpdate.attr("x2", tickMajorSize).attr("y2", 0); + textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0); + text.attr("dy", ".32em").attr("text-anchor", "start"); + pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize); + break; + } + } + if (scale.ticks) { + tickEnter.call(tickTransform, scale0); + tickUpdate.call(tickTransform, scale1); + tickExit.call(tickTransform, scale1); + subtickEnter.call(tickTransform, scale0); + subtickUpdate.call(tickTransform, scale1); + subtickExit.call(tickTransform, scale1); + } else { + var dx = scale1.rangeBand() / 2, x = function(d) { + return scale1(d) + dx; + }; + tickEnter.call(tickTransform, x); + tickUpdate.call(tickTransform, x); + } + }); + } + var scale = d3.scale.linear(), orient = "bottom", tickMajorSize = 6, tickMinorSize = 6, tickEndSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_, tickSubdivide = 0; + axis.scale = function(x) { + if (!arguments.length) return scale; + scale = x; + return axis; + }; + axis.orient = function(x) { + if (!arguments.length) return orient; + orient = x; + return axis; + }; + axis.ticks = function() { + if (!arguments.length) return tickArguments_; + tickArguments_ = arguments; + return axis; + }; + axis.tickValues = function(x) { + if (!arguments.length) return tickValues; + tickValues = x; + return axis; + }; + axis.tickFormat = function(x) { + if (!arguments.length) return tickFormat_; + tickFormat_ = x; + return axis; + }; + axis.tickSize = function(x, y, z) { + if (!arguments.length) return tickMajorSize; + var n = arguments.length - 1; + tickMajorSize = +x; + tickMinorSize = n > 1 ? +y : tickMajorSize; + tickEndSize = n > 0 ? +arguments[n] : tickMajorSize; + return axis; + }; + axis.tickPadding = function(x) { + if (!arguments.length) return tickPadding; + tickPadding = +x; + return axis; + }; + axis.tickSubdivide = function(x) { + if (!arguments.length) return tickSubdivide; + tickSubdivide = +x; + return axis; + }; + return axis; + }; + d3.svg.brush = function() { + function brush(g) { + g.each(function() { + var g = d3.select(this), bg = g.selectAll(".background").data([ 0 ]), fg = g.selectAll(".extent").data([ 0 ]), tz = g.selectAll(".resize").data(resizes, String), e; + g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart); + bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair"); + fg.enter().append("rect").attr("class", "extent").style("cursor", "move"); + tz.enter().append("g").attr("class", function(d) { + return "resize " + d; + }).style("cursor", function(d) { + return d3_svg_brushCursor[d]; + }).append("rect").attr("x", function(d) { + return /[ew]$/.test(d) ? -3 : null; + }).attr("y", function(d) { + return /^[ns]/.test(d) ? -3 : null; + }).attr("width", 6).attr("height", 6).style("visibility", "hidden"); + tz.style("display", brush.empty() ? "none" : null); + tz.exit().remove(); + if (x) { + e = d3_scaleRange(x); + bg.attr("x", e[0]).attr("width", e[1] - e[0]); + redrawX(g); + } + if (y) { + e = d3_scaleRange(y); + bg.attr("y", e[0]).attr("height", e[1] - e[0]); + redrawY(g); + } + redraw(g); + }); + } + function redraw(g) { + g.selectAll(".resize").attr("transform", function(d) { + return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")"; + }); + } + function redrawX(g) { + g.select(".extent").attr("x", extent[0][0]); + g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]); + } + function redrawY(g) { + g.select(".extent").attr("y", extent[0][1]); + g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]); + } + function brushstart() { + function mouse() { + var touches = d3.event.changedTouches; + return touches ? d3.touches(target, touches)[0] : d3.mouse(target); + } + function keydown() { + if (d3.event.keyCode == 32) { + if (!dragging) { + center = null; + origin[0] -= extent[1][0]; + origin[1] -= extent[1][1]; + dragging = 2; + } + d3_eventCancel(); + } + } + function keyup() { + if (d3.event.keyCode == 32 && dragging == 2) { + origin[0] += extent[1][0]; + origin[1] += extent[1][1]; + dragging = 0; + d3_eventCancel(); + } + } + function brushmove() { + var point = mouse(), moved = false; + if (offset) { + point[0] += offset[0]; + point[1] += offset[1]; + } + if (!dragging) { + if (d3.event.altKey) { + if (!center) center = [ (extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2 ]; + origin[0] = extent[+(point[0] < center[0])][0]; + origin[1] = extent[+(point[1] < center[1])][1]; + } else center = null; + } + if (resizingX && move1(point, x, 0)) { + redrawX(g); + moved = true; + } + if (resizingY && move1(point, y, 1)) { + redrawY(g); + moved = true; + } + if (moved) { + redraw(g); + event_({ + type: "brush", + mode: dragging ? "move" : "resize" + }); + } + } + function move1(point, scale, i) { + var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], size = extent[1][i] - extent[0][i], min, max; + if (dragging) { + r0 -= position; + r1 -= size + position; + } + min = Math.max(r0, Math.min(r1, point[i])); + if (dragging) { + max = (min += position) + size; + } else { + if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min)); + if (position < min) { + max = min; + min = position; + } else { + max = position; + } + } + if (extent[0][i] !== min || extent[1][i] !== max) { + extentDomain = null; + extent[0][i] = min; + extent[1][i] = max; + return true; + } + } + function brushend() { + brushmove(); + g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null); + d3.select("body").style("cursor", null); + w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null); + event_({ + type: "brushend" + }); + d3_eventCancel(); + } + var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), center, origin = mouse(), offset; + var w = d3.select(window).on("mousemove.brush", brushmove).on("mouseup.brush", brushend).on("touchmove.brush", brushmove).on("touchend.brush", brushend).on("keydown.brush", keydown).on("keyup.brush", keyup); + if (dragging) { + origin[0] = extent[0][0] - origin[0]; + origin[1] = extent[0][1] - origin[1]; + } else if (resizing) { + var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing); + offset = [ extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1] ]; + origin[0] = extent[ex][0]; + origin[1] = extent[ey][1]; + } else if (d3.event.altKey) center = origin.slice(); + g.style("pointer-events", "none").selectAll(".resize").style("display", null); + d3.select("body").style("cursor", eventTarget.style("cursor")); + event_({ + type: "brushstart" + }); + brushmove(); + d3_eventCancel(); + } + var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], extentDomain; + brush.x = function(z) { + if (!arguments.length) return x; + x = z; + resizes = d3_svg_brushResizes[!x << 1 | !y]; + return brush; + }; + brush.y = function(z) { + if (!arguments.length) return y; + y = z; + resizes = d3_svg_brushResizes[!x << 1 | !y]; + return brush; + }; + brush.extent = function(z) { + var x0, x1, y0, y1, t; + if (!arguments.length) { + z = extentDomain || extent; + if (x) { + x0 = z[0][0], x1 = z[1][0]; + if (!extentDomain) { + x0 = extent[0][0], x1 = extent[1][0]; + if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + } + } + if (y) { + y0 = z[0][1], y1 = z[1][1]; + if (!extentDomain) { + y0 = extent[0][1], y1 = extent[1][1]; + if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + } + } + return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ]; + } + extentDomain = [ [ 0, 0 ], [ 0, 0 ] ]; + if (x) { + x0 = z[0], x1 = z[1]; + if (y) x0 = x0[0], x1 = x1[0]; + extentDomain[0][0] = x0, extentDomain[1][0] = x1; + if (x.invert) x0 = x(x0), x1 = x(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + extent[0][0] = x0 | 0, extent[1][0] = x1 | 0; + } + if (y) { + y0 = z[0], y1 = z[1]; + if (x) y0 = y0[1], y1 = y1[1]; + extentDomain[0][1] = y0, extentDomain[1][1] = y1; + if (y.invert) y0 = y(y0), y1 = y(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + extent[0][1] = y0 | 0, extent[1][1] = y1 | 0; + } + return brush; + }; + brush.clear = function() { + extentDomain = null; + extent[0][0] = extent[0][1] = extent[1][0] = extent[1][1] = 0; + return brush; + }; + brush.empty = function() { + return x && extent[0][0] === extent[1][0] || y && extent[0][1] === extent[1][1]; + }; + return d3.rebind(brush, event, "on"); + }; + var d3_svg_brushCursor = { + n: "ns-resize", + e: "ew-resize", + s: "ns-resize", + w: "ew-resize", + nw: "nwse-resize", + ne: "nesw-resize", + se: "nwse-resize", + sw: "nesw-resize" + }; + var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ]; + d3.behavior = {}; + d3.behavior.drag = function() { + function drag() { + this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown); + } + function mousedown() { + function point() { + var p = target.parentNode; + return touchId ? d3.touches(p).filter(function(p) { + return p.identifier === touchId; + })[0] : d3.mouse(p); + } + function dragmove() { + if (!target.parentNode) return dragend(); + var p = point(), dx = p[0] - origin_[0], dy = p[1] - origin_[1]; + moved |= dx | dy; + origin_ = p; + d3_eventCancel(); + event_({ + type: "drag", + x: p[0] + offset[0], + y: p[1] + offset[1], + dx: dx, + dy: dy + }); + } + function dragend() { + event_({ + type: "dragend" + }); + if (moved) { + d3_eventCancel(); + if (d3.event.target === eventTarget) w.on("click.drag", click, true); + } + w.on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", null).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", null); + } + function click() { + d3_eventCancel(); + w.on("click.drag", null); + } + var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, touchId = d3.event.touches && d3.event.changedTouches[0].identifier, offset, origin_ = point(), moved = 0; + var w = d3.select(window).on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", dragmove).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", dragend, true); + if (origin) { + offset = origin.apply(target, arguments); + offset = [ offset.x - origin_[0], offset.y - origin_[1] ]; + } else { + offset = [ 0, 0 ]; + } + if (!touchId) d3_eventCancel(); + event_({ + type: "dragstart" + }); + } + var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null; + drag.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + return drag; + }; + return d3.rebind(drag, event, "on"); + }; + d3.behavior.zoom = function() { + function zoom() { + this.on("mousedown.zoom", mousedown).on("mousewheel.zoom", mousewheel).on("mousemove.zoom", mousemove).on("DOMMouseScroll.zoom", mousewheel).on("dblclick.zoom", dblclick).on("touchstart.zoom", touchstart).on("touchmove.zoom", touchmove).on("touchend.zoom", touchstart); + } + function location(p) { + return [ (p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale ]; + } + function point(l) { + return [ l[0] * scale + translate[0], l[1] * scale + translate[1] ]; + } + function scaleTo(s) { + scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s)); + } + function translateTo(p, l) { + l = point(l); + translate[0] += p[0] - l[0]; + translate[1] += p[1] - l[1]; + } + function dispatch(event) { + if (x1) x1.domain(x0.range().map(function(x) { + return (x - translate[0]) / scale; + }).map(x0.invert)); + if (y1) y1.domain(y0.range().map(function(y) { + return (y - translate[1]) / scale; + }).map(y0.invert)); + d3.event.preventDefault(); + event({ + type: "zoom", + scale: scale, + translate: translate + }); + } + function mousedown() { + function mousemove() { + moved = 1; + translateTo(d3.mouse(target), l); + dispatch(event_); + } + function mouseup() { + if (moved) d3_eventCancel(); + w.on("mousemove.zoom", null).on("mouseup.zoom", null); + if (moved && d3.event.target === eventTarget) w.on("click.zoom", click, true); + } + function click() { + d3_eventCancel(); + w.on("click.zoom", null); + } + var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, moved = 0, w = d3.select(window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup), l = location(d3.mouse(target)); + window.focus(); + d3_eventCancel(); + } + function mousewheel() { + if (!translate0) translate0 = location(d3.mouse(this)); + scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale); + translateTo(d3.mouse(this), translate0); + dispatch(event.of(this, arguments)); + } + function mousemove() { + translate0 = null; + } + function dblclick() { + var p = d3.mouse(this), l = location(p); + scaleTo(d3.event.shiftKey ? scale / 2 : scale * 2); + translateTo(p, l); + dispatch(event.of(this, arguments)); + } + function touchstart() { + var touches = d3.touches(this), now = Date.now(); + scale0 = scale; + translate0 = {}; + touches.forEach(function(t) { + translate0[t.identifier] = location(t); + }); + d3_eventCancel(); + if (touches.length === 1) { + if (now - touchtime < 500) { + var p = touches[0], l = location(touches[0]); + scaleTo(scale * 2); + translateTo(p, l); + dispatch(event.of(this, arguments)); + } + touchtime = now; + } + } + function touchmove() { + var touches = d3.touches(this), p0 = touches[0], l0 = translate0[p0.identifier]; + if (p1 = touches[1]) { + var p1, l1 = translate0[p1.identifier]; + p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ]; + l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ]; + scaleTo(d3.event.scale * scale0); + } + translateTo(p0, l0); + touchtime = null; + dispatch(event.of(this, arguments)); + } + var translate = [ 0, 0 ], translate0, scale = 1, scale0, scaleExtent = d3_behavior_zoomInfinity, event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime; + zoom.translate = function(x) { + if (!arguments.length) return translate; + translate = x.map(Number); + return zoom; + }; + zoom.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return zoom; + }; + zoom.scaleExtent = function(x) { + if (!arguments.length) return scaleExtent; + scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number); + return zoom; + }; + zoom.x = function(z) { + if (!arguments.length) return x1; + x1 = z; + x0 = z.copy(); + return zoom; + }; + zoom.y = function(z) { + if (!arguments.length) return y1; + y1 = z; + y0 = z.copy(); + return zoom; + }; + return d3.rebind(zoom, event, "on"); + }; + var d3_behavior_zoomDiv, d3_behavior_zoomInfinity = [ 0, Infinity ]; + d3.layout = {}; + d3.layout.bundle = function() { + return function(links) { + var paths = [], i = -1, n = links.length; + while (++i < n) paths.push(d3_layout_bundlePath(links[i])); + return paths; + }; + }; + d3.layout.chord = function() { + function relayout() { + var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j; + chords = []; + groups = []; + k = 0, i = -1; + while (++i < n) { + x = 0, j = -1; + while (++j < n) { + x += matrix[i][j]; + } + groupSums.push(x); + subgroupIndex.push(d3.range(n)); + k += x; + } + if (sortGroups) { + groupIndex.sort(function(a, b) { + return sortGroups(groupSums[a], groupSums[b]); + }); + } + if (sortSubgroups) { + subgroupIndex.forEach(function(d, i) { + d.sort(function(a, b) { + return sortSubgroups(matrix[i][a], matrix[i][b]); + }); + }); + } + k = (2 * Math.PI - padding * n) / k; + x = 0, i = -1; + while (++i < n) { + x0 = x, j = -1; + while (++j < n) { + var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k; + subgroups[di + "-" + dj] = { + index: di, + subindex: dj, + startAngle: a0, + endAngle: a1, + value: v + }; + } + groups[di] = { + index: di, + startAngle: x0, + endAngle: x, + value: (x - x0) / k + }; + x += padding; + } + i = -1; + while (++i < n) { + j = i - 1; + while (++j < n) { + var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i]; + if (source.value || target.value) { + chords.push(source.value < target.value ? { + source: target, + target: source + } : { + source: source, + target: target + }); + } + } + } + if (sortChords) resort(); + } + function resort() { + chords.sort(function(a, b) { + return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2); + }); + } + var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords; + chord.matrix = function(x) { + if (!arguments.length) return matrix; + n = (matrix = x) && matrix.length; + chords = groups = null; + return chord; + }; + chord.padding = function(x) { + if (!arguments.length) return padding; + padding = x; + chords = groups = null; + return chord; + }; + chord.sortGroups = function(x) { + if (!arguments.length) return sortGroups; + sortGroups = x; + chords = groups = null; + return chord; + }; + chord.sortSubgroups = function(x) { + if (!arguments.length) return sortSubgroups; + sortSubgroups = x; + chords = null; + return chord; + }; + chord.sortChords = function(x) { + if (!arguments.length) return sortChords; + sortChords = x; + if (chords) resort(); + return chord; + }; + chord.chords = function() { + if (!chords) relayout(); + return chords; + }; + chord.groups = function() { + if (!groups) relayout(); + return groups; + }; + return chord; + }; + d3.layout.force = function() { + function repulse(node) { + return function(quad, x1, y1, x2, y2) { + if (quad.point !== node) { + var dx = quad.cx - node.x, dy = quad.cy - node.y, dn = 1 / Math.sqrt(dx * dx + dy * dy); + if ((x2 - x1) * dn < theta) { + var k = quad.charge * dn * dn; + node.px -= dx * k; + node.py -= dy * k; + return true; + } + if (quad.point && isFinite(dn)) { + var k = quad.pointCharge * dn * dn; + node.px -= dx * k; + node.py -= dy * k; + } + } + return !quad.charge; + }; + } + function dragmove(d) { + d.px = d3.event.x; + d.py = d3.event.y; + force.resume(); + } + var force = {}, event = d3.dispatch("start", "tick", "end"), size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, gravity = .1, theta = .8, interval, nodes = [], links = [], distances, strengths, charges; + force.tick = function() { + if ((alpha *= .99) < .005) { + event.end({ + type: "end", + alpha: alpha = 0 + }); + return true; + } + var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y; + for (i = 0; i < m; ++i) { + o = links[i]; + s = o.source; + t = o.target; + x = t.x - s.x; + y = t.y - s.y; + if (l = x * x + y * y) { + l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l; + x *= l; + y *= l; + t.x -= x * (k = s.weight / (t.weight + s.weight)); + t.y -= y * k; + s.x += x * (k = 1 - k); + s.y += y * k; + } + } + if (k = alpha * gravity) { + x = size[0] / 2; + y = size[1] / 2; + i = -1; + if (k) while (++i < n) { + o = nodes[i]; + o.x += (x - o.x) * k; + o.y += (y - o.y) * k; + } + } + if (charge) { + d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges); + i = -1; + while (++i < n) { + if (!(o = nodes[i]).fixed) { + q.visit(repulse(o)); + } + } + } + i = -1; + while (++i < n) { + o = nodes[i]; + if (o.fixed) { + o.x = o.px; + o.y = o.py; + } else { + o.x -= (o.px - (o.px = o.x)) * friction; + o.y -= (o.py - (o.py = o.y)) * friction; + } + } + event.tick({ + type: "tick", + alpha: alpha + }); + }; + force.nodes = function(x) { + if (!arguments.length) return nodes; + nodes = x; + return force; + }; + force.links = function(x) { + if (!arguments.length) return links; + links = x; + return force; + }; + force.size = function(x) { + if (!arguments.length) return size; + size = x; + return force; + }; + force.linkDistance = function(x) { + if (!arguments.length) return linkDistance; + linkDistance = d3_functor(x); + return force; + }; + force.distance = force.linkDistance; + force.linkStrength = function(x) { + if (!arguments.length) return linkStrength; + linkStrength = d3_functor(x); + return force; + }; + force.friction = function(x) { + if (!arguments.length) return friction; + friction = x; + return force; + }; + force.charge = function(x) { + if (!arguments.length) return charge; + charge = typeof x === "function" ? x : +x; + return force; + }; + force.gravity = function(x) { + if (!arguments.length) return gravity; + gravity = x; + return force; + }; + force.theta = function(x) { + if (!arguments.length) return theta; + theta = x; + return force; + }; + force.alpha = function(x) { + if (!arguments.length) return alpha; + if (alpha) { + if (x > 0) alpha = x; else alpha = 0; + } else if (x > 0) { + event.start({ + type: "start", + alpha: alpha = x + }); + d3.timer(force.tick); + } + return force; + }; + force.start = function() { + function position(dimension, size) { + var neighbors = neighbor(i), j = -1, m = neighbors.length, x; + while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x; + return Math.random() * size; + } + function neighbor() { + if (!neighbors) { + neighbors = []; + for (j = 0; j < n; ++j) { + neighbors[j] = []; + } + for (j = 0; j < m; ++j) { + var o = links[j]; + neighbors[o.source.index].push(o.target); + neighbors[o.target.index].push(o.source); + } + } + return neighbors[i]; + } + var i, j, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o; + for (i = 0; i < n; ++i) { + (o = nodes[i]).index = i; + o.weight = 0; + } + distances = []; + strengths = []; + for (i = 0; i < m; ++i) { + o = links[i]; + if (typeof o.source == "number") o.source = nodes[o.source]; + if (typeof o.target == "number") o.target = nodes[o.target]; + distances[i] = linkDistance.call(this, o, i); + strengths[i] = linkStrength.call(this, o, i); + ++o.source.weight; + ++o.target.weight; + } + for (i = 0; i < n; ++i) { + o = nodes[i]; + if (isNaN(o.x)) o.x = position("x", w); + if (isNaN(o.y)) o.y = position("y", h); + if (isNaN(o.px)) o.px = o.x; + if (isNaN(o.py)) o.py = o.y; + } + charges = []; + if (typeof charge === "function") { + for (i = 0; i < n; ++i) { + charges[i] = +charge.call(this, nodes[i], i); + } + } else { + for (i = 0; i < n; ++i) { + charges[i] = charge; + } + } + return force.resume(); + }; + force.resume = function() { + return force.alpha(.1); + }; + force.stop = function() { + return force.alpha(0); + }; + force.drag = function() { + if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart", d3_layout_forceDragstart).on("drag", dragmove).on("dragend", d3_layout_forceDragend); + this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag); + }; + return d3.rebind(force, event, "on"); + }; + d3.layout.partition = function() { + function position(node, x, dx, dy) { + var children = node.children; + node.x = x; + node.y = node.depth * dy; + node.dx = dx; + node.dy = dy; + if (children && (n = children.length)) { + var i = -1, n, c, d; + dx = node.value ? dx / node.value : 0; + while (++i < n) { + position(c = children[i], x, d = c.value * dx, dy); + x += d; + } + } + } + function depth(node) { + var children = node.children, d = 0; + if (children && (n = children.length)) { + var i = -1, n; + while (++i < n) d = Math.max(d, depth(children[i])); + } + return 1 + d; + } + function partition(d, i) { + var nodes = hierarchy.call(this, d, i); + position(nodes[0], 0, size[0], size[1] / depth(nodes[0])); + return nodes; + } + var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ]; + partition.size = function(x) { + if (!arguments.length) return size; + size = x; + return partition; + }; + return d3_layout_hierarchyRebind(partition, hierarchy); + }; + d3.layout.pie = function() { + function pie(data, i) { + var values = data.map(function(d, i) { + return +value.call(pie, d, i); + }); + var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle); + var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - startAngle) / d3.sum(values); + var index = d3.range(data.length); + if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) { + return values[j] - values[i]; + } : function(i, j) { + return sort(data[i], data[j]); + }); + var arcs = []; + index.forEach(function(i) { + var d; + arcs[i] = { + data: data[i], + value: d = values[i], + startAngle: a, + endAngle: a += d * k + }; + }); + return arcs; + } + var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = 2 * Math.PI; + pie.value = function(x) { + if (!arguments.length) return value; + value = x; + return pie; + }; + pie.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return pie; + }; + pie.startAngle = function(x) { + if (!arguments.length) return startAngle; + startAngle = x; + return pie; + }; + pie.endAngle = function(x) { + if (!arguments.length) return endAngle; + endAngle = x; + return pie; + }; + return pie; + }; + var d3_layout_pieSortByValue = {}; + d3.layout.stack = function() { + function stack(data, index) { + var series = data.map(function(d, i) { + return values.call(stack, d, i); + }); + var points = series.map(function(d, i) { + return d.map(function(v, i) { + return [ x.call(stack, v, i), y.call(stack, v, i) ]; + }); + }); + var orders = order.call(stack, points, index); + series = d3.permute(series, orders); + points = d3.permute(points, orders); + var offsets = offset.call(stack, points, index); + var n = series.length, m = series[0].length, i, j, o; + for (j = 0; j < m; ++j) { + out.call(stack, series[0][j], o = offsets[j], points[0][j][1]); + for (i = 1; i < n; ++i) { + out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]); + } + } + return data; + } + var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY; + stack.values = function(x) { + if (!arguments.length) return values; + values = x; + return stack; + }; + stack.order = function(x) { + if (!arguments.length) return order; + order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault; + return stack; + }; + stack.offset = function(x) { + if (!arguments.length) return offset; + offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero; + return stack; + }; + stack.x = function(z) { + if (!arguments.length) return x; + x = z; + return stack; + }; + stack.y = function(z) { + if (!arguments.length) return y; + y = z; + return stack; + }; + stack.out = function(z) { + if (!arguments.length) return out; + out = z; + return stack; + }; + return stack; + }; + var d3_layout_stackOrders = d3.map({ + "inside-out": function(data) { + var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) { + return max[a] - max[b]; + }), top = 0, bottom = 0, tops = [], bottoms = []; + for (i = 0; i < n; ++i) { + j = index[i]; + if (top < bottom) { + top += sums[j]; + tops.push(j); + } else { + bottom += sums[j]; + bottoms.push(j); + } + } + return bottoms.reverse().concat(tops); + }, + reverse: function(data) { + return d3.range(data.length).reverse(); + }, + "default": d3_layout_stackOrderDefault + }); + var d3_layout_stackOffsets = d3.map({ + silhouette: function(data) { + var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o > max) max = o; + sums.push(o); + } + for (j = 0; j < m; ++j) { + y0[j] = (max - sums[j]) / 2; + } + return y0; + }, + wiggle: function(data) { + var n = data.length, x = data[0], m = x.length, max = 0, i, j, k, s1, s2, s3, dx, o, o0, y0 = []; + y0[0] = o = o0 = 0; + for (j = 1; j < m; ++j) { + for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1]; + for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) { + for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) { + s3 += (data[k][j][1] - data[k][j - 1][1]) / dx; + } + s2 += s3 * data[i][j][1]; + } + y0[j] = o -= s1 ? s2 / s1 * dx : 0; + if (o < o0) o0 = o; + } + for (j = 0; j < m; ++j) y0[j] -= o0; + return y0; + }, + expand: function(data) { + var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k; + } + for (j = 0; j < m; ++j) y0[j] = 0; + return y0; + }, + zero: d3_layout_stackOffsetZero + }); + d3.layout.histogram = function() { + function histogram(data, i) { + var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x; + while (++i < m) { + bin = bins[i] = []; + bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]); + bin.y = 0; + } + if (m > 0) { + i = -1; + while (++i < n) { + x = values[i]; + if (x >= range[0] && x <= range[1]) { + bin = bins[d3.bisect(thresholds, x, 1, m) - 1]; + bin.y += k; + bin.push(data[i]); + } + } + } + return bins; + } + var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges; + histogram.value = function(x) { + if (!arguments.length) return valuer; + valuer = x; + return histogram; + }; + histogram.range = function(x) { + if (!arguments.length) return ranger; + ranger = d3_functor(x); + return histogram; + }; + histogram.bins = function(x) { + if (!arguments.length) return binner; + binner = typeof x === "number" ? function(range) { + return d3_layout_histogramBinFixed(range, x); + } : d3_functor(x); + return histogram; + }; + histogram.frequency = function(x) { + if (!arguments.length) return frequency; + frequency = !!x; + return histogram; + }; + return histogram; + }; + d3.layout.hierarchy = function() { + function recurse(data, depth, nodes) { + var childs = children.call(hierarchy, data, depth), node = d3_layout_hierarchyInline ? data : { + data: data + }; + node.depth = depth; + nodes.push(node); + if (childs && (n = childs.length)) { + var i = -1, n, c = node.children = [], v = 0, j = depth + 1, d; + while (++i < n) { + d = recurse(childs[i], j, nodes); + d.parent = node; + c.push(d); + v += d.value; + } + if (sort) c.sort(sort); + if (value) node.value = v; + } else if (value) { + node.value = +value.call(hierarchy, data, depth) || 0; + } + return node; + } + function revalue(node, depth) { + var children = node.children, v = 0; + if (children && (n = children.length)) { + var i = -1, n, j = depth + 1; + while (++i < n) v += revalue(children[i], j); + } else if (value) { + v = +value.call(hierarchy, d3_layout_hierarchyInline ? node : node.data, depth) || 0; + } + if (value) node.value = v; + return v; + } + function hierarchy(d) { + var nodes = []; + recurse(d, 0, nodes); + return nodes; + } + var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue; + hierarchy.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return hierarchy; + }; + hierarchy.children = function(x) { + if (!arguments.length) return children; + children = x; + return hierarchy; + }; + hierarchy.value = function(x) { + if (!arguments.length) return value; + value = x; + return hierarchy; + }; + hierarchy.revalue = function(root) { + revalue(root, 0); + return root; + }; + return hierarchy; + }; + var d3_layout_hierarchyInline = false; + d3.layout.pack = function() { + function pack(d, i) { + var nodes = hierarchy.call(this, d, i), root = nodes[0]; + root.x = 0; + root.y = 0; + d3_layout_treeVisitAfter(root, function(d) { + d.r = Math.sqrt(d.value); + }); + d3_layout_treeVisitAfter(root, d3_layout_packSiblings); + var w = size[0], h = size[1], k = Math.max(2 * root.r / w, 2 * root.r / h); + if (padding > 0) { + var dr = padding * k / 2; + d3_layout_treeVisitAfter(root, function(d) { + d.r += dr; + }); + d3_layout_treeVisitAfter(root, d3_layout_packSiblings); + d3_layout_treeVisitAfter(root, function(d) { + d.r -= dr; + }); + k = Math.max(2 * root.r / w, 2 * root.r / h); + } + d3_layout_packTransform(root, w / 2, h / 2, 1 / k); + return nodes; + } + var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ]; + pack.size = function(x) { + if (!arguments.length) return size; + size = x; + return pack; + }; + pack.padding = function(_) { + if (!arguments.length) return padding; + padding = +_; + return pack; + }; + return d3_layout_hierarchyRebind(pack, hierarchy); + }; + d3.layout.cluster = function() { + function cluster(d, i) { + var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0, kx, ky; + d3_layout_treeVisitAfter(root, function(node) { + var children = node.children; + if (children && children.length) { + node.x = d3_layout_clusterX(children); + node.y = d3_layout_clusterY(children); + } else { + node.x = previousNode ? x += separation(node, previousNode) : 0; + node.y = 0; + previousNode = node; + } + }); + var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2; + d3_layout_treeVisitAfter(root, function(node) { + node.x = (node.x - x0) / (x1 - x0) * size[0]; + node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1]; + }); + return nodes; + } + var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ]; + cluster.separation = function(x) { + if (!arguments.length) return separation; + separation = x; + return cluster; + }; + cluster.size = function(x) { + if (!arguments.length) return size; + size = x; + return cluster; + }; + return d3_layout_hierarchyRebind(cluster, hierarchy); + }; + d3.layout.tree = function() { + function tree(d, i) { + function firstWalk(node, previousSibling) { + var children = node.children, layout = node._tree; + if (children && (n = children.length)) { + var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1; + while (++i < n) { + child = children[i]; + firstWalk(child, previousChild); + ancestor = apportion(child, previousChild, ancestor); + previousChild = child; + } + d3_layout_treeShift(node); + var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim); + if (previousSibling) { + layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); + layout.mod = layout.prelim - midpoint; + } else { + layout.prelim = midpoint; + } + } else { + if (previousSibling) { + layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); + } + } + } + function secondWalk(node, x) { + node.x = node._tree.prelim + x; + var children = node.children; + if (children && (n = children.length)) { + var i = -1, n; + x += node._tree.mod; + while (++i < n) { + secondWalk(children[i], x); + } + } + } + function apportion(node, previousSibling, ancestor) { + if (previousSibling) { + var vip = node, vop = node, vim = previousSibling, vom = node.parent.children[0], sip = vip._tree.mod, sop = vop._tree.mod, sim = vim._tree.mod, som = vom._tree.mod, shift; + while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) { + vom = d3_layout_treeLeft(vom); + vop = d3_layout_treeRight(vop); + vop._tree.ancestor = node; + shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip); + if (shift > 0) { + d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift); + sip += shift; + sop += shift; + } + sim += vim._tree.mod; + sip += vip._tree.mod; + som += vom._tree.mod; + sop += vop._tree.mod; + } + if (vim && !d3_layout_treeRight(vop)) { + vop._tree.thread = vim; + vop._tree.mod += sim - sop; + } + if (vip && !d3_layout_treeLeft(vom)) { + vom._tree.thread = vip; + vom._tree.mod += sip - som; + ancestor = node; + } + } + return ancestor; + } + var nodes = hierarchy.call(this, d, i), root = nodes[0]; + d3_layout_treeVisitAfter(root, function(node, previousSibling) { + node._tree = { + ancestor: node, + prelim: 0, + mod: 0, + change: 0, + shift: 0, + number: previousSibling ? previousSibling._tree.number + 1 : 0 + }; + }); + firstWalk(root); + secondWalk(root, -root._tree.prelim); + var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), right = d3_layout_treeSearch(root, d3_layout_treeRightmost), deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2, y1 = deep.depth || 1; + d3_layout_treeVisitAfter(root, function(node) { + node.x = (node.x - x0) / (x1 - x0) * size[0]; + node.y = node.depth / y1 * size[1]; + delete node._tree; + }); + return nodes; + } + var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ]; + tree.separation = function(x) { + if (!arguments.length) return separation; + separation = x; + return tree; + }; + tree.size = function(x) { + if (!arguments.length) return size; + size = x; + return tree; + }; + return d3_layout_hierarchyRebind(tree, hierarchy); + }; + d3.layout.treemap = function() { + function scale(children, k) { + var i = -1, n = children.length, child, area; + while (++i < n) { + area = (child = children[i]).value * (k < 0 ? 0 : k); + child.area = isNaN(area) || area <= 0 ? 0 : area; + } + } + function squarify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = Math.min(rect.dx, rect.dy), n; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while ((n = remaining.length) > 0) { + row.push(child = remaining[n - 1]); + row.area += child.area; + if ((score = worst(row, u)) <= best) { + remaining.pop(); + best = score; + } else { + row.area -= row.pop().area; + position(row, u, rect, false); + u = Math.min(rect.dx, rect.dy); + row.length = row.area = 0; + best = Infinity; + } + } + if (row.length) { + position(row, u, rect, true); + row.length = row.area = 0; + } + children.forEach(squarify); + } + } + function stickify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), remaining = children.slice(), child, row = []; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while (child = remaining.pop()) { + row.push(child); + row.area += child.area; + if (child.z != null) { + position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length); + row.length = row.area = 0; + } + } + children.forEach(stickify); + } + } + function worst(row, u) { + var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length; + while (++i < n) { + if (!(r = row[i].area)) continue; + if (r < rmin) rmin = r; + if (r > rmax) rmax = r; + } + s *= s; + u *= u; + return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity; + } + function position(row, u, rect, flush) { + var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o; + if (u == rect.dx) { + if (flush || v > rect.dy) v = rect.dy; + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dy = v; + x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0); + } + o.z = true; + o.dx += rect.x + rect.dx - x; + rect.y += v; + rect.dy -= v; + } else { + if (flush || v > rect.dx) v = rect.dx; + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dx = v; + y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0); + } + o.z = false; + o.dy += rect.y + rect.dy - y; + rect.x += v; + rect.dx -= v; + } + } + function treemap(d) { + var nodes = stickies || hierarchy(d), root = nodes[0]; + root.x = 0; + root.y = 0; + root.dx = size[0]; + root.dy = size[1]; + if (stickies) hierarchy.revalue(root); + scale([ root ], root.dx * root.dy / root.value); + (stickies ? stickify : squarify)(root); + if (sticky) stickies = nodes; + return nodes; + } + var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, ratio = .5 * (1 + Math.sqrt(5)); + treemap.size = function(x) { + if (!arguments.length) return size; + size = x; + return treemap; + }; + treemap.padding = function(x) { + function padFunction(node) { + var p = x.call(treemap, node, node.depth); + return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p); + } + function padConstant(node) { + return d3_layout_treemapPad(node, x); + } + if (!arguments.length) return padding; + var type; + pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], padConstant) : padConstant; + return treemap; + }; + treemap.round = function(x) { + if (!arguments.length) return round != Number; + round = x ? Math.round : Number; + return treemap; + }; + treemap.sticky = function(x) { + if (!arguments.length) return sticky; + sticky = x; + stickies = null; + return treemap; + }; + treemap.ratio = function(x) { + if (!arguments.length) return ratio; + ratio = x; + return treemap; + }; + return d3_layout_hierarchyRebind(treemap, hierarchy); + }; + d3.csv = d3_dsv(",", "text/csv"); + d3.tsv = d3_dsv(" ", "text/tab-separated-values"); + d3.geo = {}; + var d3_geo_radians = Math.PI / 180; + d3.geo.azimuthal = function() { + function azimuthal(coordinates) { + var x1 = coordinates[0] * d3_geo_radians - x0, y1 = coordinates[1] * d3_geo_radians, cx1 = Math.cos(x1), sx1 = Math.sin(x1), cy1 = Math.cos(y1), sy1 = Math.sin(y1), cc = mode !== "orthographic" ? sy0 * sy1 + cy0 * cy1 * cx1 : null, c, k = mode === "stereographic" ? 1 / (1 + cc) : mode === "gnomonic" ? 1 / cc : mode === "equidistant" ? (c = Math.acos(cc), c ? c / Math.sin(c) : 0) : mode === "equalarea" ? Math.sqrt(2 / (1 + cc)) : 1, x = k * cy1 * sx1, y = k * (sy0 * cy1 * cx1 - cy0 * sy1); + return [ scale * x + translate[0], scale * y + translate[1] ]; + } + var mode = "orthographic", origin, scale = 200, translate = [ 480, 250 ], x0, y0, cy0, sy0; + azimuthal.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale, p = Math.sqrt(x * x + y * y), c = mode === "stereographic" ? 2 * Math.atan(p) : mode === "gnomonic" ? Math.atan(p) : mode === "equidistant" ? p : mode === "equalarea" ? 2 * Math.asin(.5 * p) : Math.asin(p), sc = Math.sin(c), cc = Math.cos(c); + return [ (x0 + Math.atan2(x * sc, p * cy0 * cc + y * sy0 * sc)) / d3_geo_radians, Math.asin(cc * sy0 - (p ? y * sc * cy0 / p : 0)) / d3_geo_radians ]; + }; + azimuthal.mode = function(x) { + if (!arguments.length) return mode; + mode = x + ""; + return azimuthal; + }; + azimuthal.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + x0 = origin[0] * d3_geo_radians; + y0 = origin[1] * d3_geo_radians; + cy0 = Math.cos(y0); + sy0 = Math.sin(y0); + return azimuthal; + }; + azimuthal.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return azimuthal; + }; + azimuthal.translate = function(x) { + if (!arguments.length) return translate; + translate = [ +x[0], +x[1] ]; + return azimuthal; + }; + return azimuthal.origin([ 0, 0 ]); + }; + d3.geo.albers = function() { + function albers(coordinates) { + var t = n * (d3_geo_radians * coordinates[0] - lng0), p = Math.sqrt(C - 2 * n * Math.sin(d3_geo_radians * coordinates[1])) / n; + return [ scale * p * Math.sin(t) + translate[0], scale * (p * Math.cos(t) - p0) + translate[1] ]; + } + function reload() { + var phi1 = d3_geo_radians * parallels[0], phi2 = d3_geo_radians * parallels[1], lat0 = d3_geo_radians * origin[1], s = Math.sin(phi1), c = Math.cos(phi1); + lng0 = d3_geo_radians * origin[0]; + n = .5 * (s + Math.sin(phi2)); + C = c * c + 2 * n * s; + p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n; + return albers; + } + var origin = [ -98, 38 ], parallels = [ 29.5, 45.5 ], scale = 1e3, translate = [ 480, 250 ], lng0, n, C, p0; + albers.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale, p0y = p0 + y, t = Math.atan2(x, p0y), p = Math.sqrt(x * x + p0y * p0y); + return [ (lng0 + t / n) / d3_geo_radians, Math.asin((C - p * p * n * n) / (2 * n)) / d3_geo_radians ]; + }; + albers.origin = function(x) { + if (!arguments.length) return origin; + origin = [ +x[0], +x[1] ]; + return reload(); + }; + albers.parallels = function(x) { + if (!arguments.length) return parallels; + parallels = [ +x[0], +x[1] ]; + return reload(); + }; + albers.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return albers; + }; + albers.translate = function(x) { + if (!arguments.length) return translate; + translate = [ +x[0], +x[1] ]; + return albers; + }; + return reload(); + }; + d3.geo.albersUsa = function() { + function albersUsa(coordinates) { + var lon = coordinates[0], lat = coordinates[1]; + return (lat > 50 ? alaska : lon < -140 ? hawaii : lat < 21 ? puertoRico : lower48)(coordinates); + } + var lower48 = d3.geo.albers(); + var alaska = d3.geo.albers().origin([ -160, 60 ]).parallels([ 55, 65 ]); + var hawaii = d3.geo.albers().origin([ -160, 20 ]).parallels([ 8, 18 ]); + var puertoRico = d3.geo.albers().origin([ -60, 10 ]).parallels([ 8, 18 ]); + albersUsa.scale = function(x) { + if (!arguments.length) return lower48.scale(); + lower48.scale(x); + alaska.scale(x * .6); + hawaii.scale(x); + puertoRico.scale(x * 1.5); + return albersUsa.translate(lower48.translate()); + }; + albersUsa.translate = function(x) { + if (!arguments.length) return lower48.translate(); + var dz = lower48.scale() / 1e3, dx = x[0], dy = x[1]; + lower48.translate(x); + alaska.translate([ dx - 400 * dz, dy + 170 * dz ]); + hawaii.translate([ dx - 190 * dz, dy + 200 * dz ]); + puertoRico.translate([ dx + 580 * dz, dy + 430 * dz ]); + return albersUsa; + }; + return albersUsa.scale(lower48.scale()); + }; + d3.geo.bonne = function() { + function bonne(coordinates) { + var x = coordinates[0] * d3_geo_radians - x0, y = coordinates[1] * d3_geo_radians - y0; + if (y1) { + var p = c1 + y1 - y, E = x * Math.cos(y) / p; + x = p * Math.sin(E); + y = p * Math.cos(E) - c1; + } else { + x *= Math.cos(y); + y *= -1; + } + return [ scale * x + translate[0], scale * y + translate[1] ]; + } + var scale = 200, translate = [ 480, 250 ], x0, y0, y1, c1; + bonne.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale; + if (y1) { + var c = c1 + y, p = Math.sqrt(x * x + c * c); + y = c1 + y1 - p; + x = x0 + p * Math.atan2(x, c) / Math.cos(y); + } else { + y *= -1; + x /= Math.cos(y); + } + return [ x / d3_geo_radians, y / d3_geo_radians ]; + }; + bonne.parallel = function(x) { + if (!arguments.length) return y1 / d3_geo_radians; + c1 = 1 / Math.tan(y1 = x * d3_geo_radians); + return bonne; + }; + bonne.origin = function(x) { + if (!arguments.length) return [ x0 / d3_geo_radians, y0 / d3_geo_radians ]; + x0 = x[0] * d3_geo_radians; + y0 = x[1] * d3_geo_radians; + return bonne; + }; + bonne.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return bonne; + }; + bonne.translate = function(x) { + if (!arguments.length) return translate; + translate = [ +x[0], +x[1] ]; + return bonne; + }; + return bonne.origin([ 0, 0 ]).parallel(45); + }; + d3.geo.equirectangular = function() { + function equirectangular(coordinates) { + var x = coordinates[0] / 360, y = -coordinates[1] / 360; + return [ scale * x + translate[0], scale * y + translate[1] ]; + } + var scale = 500, translate = [ 480, 250 ]; + equirectangular.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale; + return [ 360 * x, -360 * y ]; + }; + equirectangular.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return equirectangular; + }; + equirectangular.translate = function(x) { + if (!arguments.length) return translate; + translate = [ +x[0], +x[1] ]; + return equirectangular; + }; + return equirectangular; + }; + d3.geo.mercator = function() { + function mercator(coordinates) { + var x = coordinates[0] / 360, y = -(Math.log(Math.tan(Math.PI / 4 + coordinates[1] * d3_geo_radians / 2)) / d3_geo_radians) / 360; + return [ scale * x + translate[0], scale * Math.max(-.5, Math.min(.5, y)) + translate[1] ]; + } + var scale = 500, translate = [ 480, 250 ]; + mercator.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale; + return [ 360 * x, 2 * Math.atan(Math.exp(-360 * y * d3_geo_radians)) / d3_geo_radians - 90 ]; + }; + mercator.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return mercator; + }; + mercator.translate = function(x) { + if (!arguments.length) return translate; + translate = [ +x[0], +x[1] ]; + return mercator; + }; + return mercator; + }; + d3.geo.path = function() { + function path(d, i) { + if (typeof pointRadius === "function") pointCircle = d3_path_circle(pointRadius.apply(this, arguments)); + pathType(d); + var result = buffer.length ? buffer.join("") : null; + buffer = []; + return result; + } + function project(coordinates) { + return projection(coordinates).join(","); + } + function polygonArea(coordinates) { + var sum = area(coordinates[0]), i = 0, n = coordinates.length; + while (++i < n) sum -= area(coordinates[i]); + return sum; + } + function polygonCentroid(coordinates) { + var polygon = d3.geom.polygon(coordinates[0].map(projection)), area = polygon.area(), centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1), x = centroid[0], y = centroid[1], z = area, i = 0, n = coordinates.length; + while (++i < n) { + polygon = d3.geom.polygon(coordinates[i].map(projection)); + area = polygon.area(); + centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1); + x -= centroid[0]; + y -= centroid[1]; + z -= area; + } + return [ x, y, 6 * z ]; + } + function area(coordinates) { + return Math.abs(d3.geom.polygon(coordinates.map(projection)).area()); + } + var pointRadius = 4.5, pointCircle = d3_path_circle(pointRadius), projection = d3.geo.albersUsa(), buffer = []; + var pathType = d3_geo_type({ + FeatureCollection: function(o) { + var features = o.features, i = -1, n = features.length; + while (++i < n) buffer.push(pathType(features[i].geometry)); + }, + Feature: function(o) { + pathType(o.geometry); + }, + Point: function(o) { + buffer.push("M", project(o.coordinates), pointCircle); + }, + MultiPoint: function(o) { + var coordinates = o.coordinates, i = -1, n = coordinates.length; + while (++i < n) buffer.push("M", project(coordinates[i]), pointCircle); + }, + LineString: function(o) { + var coordinates = o.coordinates, i = -1, n = coordinates.length; + buffer.push("M"); + while (++i < n) buffer.push(project(coordinates[i]), "L"); + buffer.pop(); + }, + MultiLineString: function(o) { + var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m; + while (++i < n) { + subcoordinates = coordinates[i]; + j = -1; + m = subcoordinates.length; + buffer.push("M"); + while (++j < m) buffer.push(project(subcoordinates[j]), "L"); + buffer.pop(); + } + }, + Polygon: function(o) { + var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m; + while (++i < n) { + subcoordinates = coordinates[i]; + j = -1; + if ((m = subcoordinates.length - 1) > 0) { + buffer.push("M"); + while (++j < m) buffer.push(project(subcoordinates[j]), "L"); + buffer[buffer.length - 1] = "Z"; + } + } + }, + MultiPolygon: function(o) { + var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m, subsubcoordinates, k, p; + while (++i < n) { + subcoordinates = coordinates[i]; + j = -1; + m = subcoordinates.length; + while (++j < m) { + subsubcoordinates = subcoordinates[j]; + k = -1; + if ((p = subsubcoordinates.length - 1) > 0) { + buffer.push("M"); + while (++k < p) buffer.push(project(subsubcoordinates[k]), "L"); + buffer[buffer.length - 1] = "Z"; + } + } + } + }, + GeometryCollection: function(o) { + var geometries = o.geometries, i = -1, n = geometries.length; + while (++i < n) buffer.push(pathType(geometries[i])); + } + }); + var areaType = path.area = d3_geo_type({ + FeatureCollection: function(o) { + var area = 0, features = o.features, i = -1, n = features.length; + while (++i < n) area += areaType(features[i]); + return area; + }, + Feature: function(o) { + return areaType(o.geometry); + }, + Polygon: function(o) { + return polygonArea(o.coordinates); + }, + MultiPolygon: function(o) { + var sum = 0, coordinates = o.coordinates, i = -1, n = coordinates.length; + while (++i < n) sum += polygonArea(coordinates[i]); + return sum; + }, + GeometryCollection: function(o) { + var sum = 0, geometries = o.geometries, i = -1, n = geometries.length; + while (++i < n) sum += areaType(geometries[i]); + return sum; + } + }, 0); + var centroidType = path.centroid = d3_geo_type({ + Feature: function(o) { + return centroidType(o.geometry); + }, + Polygon: function(o) { + var centroid = polygonCentroid(o.coordinates); + return [ centroid[0] / centroid[2], centroid[1] / centroid[2] ]; + }, + MultiPolygon: function(o) { + var area = 0, coordinates = o.coordinates, centroid, x = 0, y = 0, z = 0, i = -1, n = coordinates.length; + while (++i < n) { + centroid = polygonCentroid(coordinates[i]); + x += centroid[0]; + y += centroid[1]; + z += centroid[2]; + } + return [ x / z, y / z ]; + } + }); + path.projection = function(x) { + projection = x; + return path; + }; + path.pointRadius = function(x) { + if (typeof x === "function") pointRadius = x; else { + pointRadius = +x; + pointCircle = d3_path_circle(pointRadius); + } + return path; + }; + return path; + }; + d3.geo.bounds = function(feature) { + var left = Infinity, bottom = Infinity, right = -Infinity, top = -Infinity; + d3_geo_bounds(feature, function(x, y) { + if (x < left) left = x; + if (x > right) right = x; + if (y < bottom) bottom = y; + if (y > top) top = y; + }); + return [ [ left, bottom ], [ right, top ] ]; + }; + var d3_geo_boundsTypes = { + Feature: d3_geo_boundsFeature, + FeatureCollection: d3_geo_boundsFeatureCollection, + GeometryCollection: d3_geo_boundsGeometryCollection, + LineString: d3_geo_boundsLineString, + MultiLineString: d3_geo_boundsMultiLineString, + MultiPoint: d3_geo_boundsLineString, + MultiPolygon: d3_geo_boundsMultiPolygon, + Point: d3_geo_boundsPoint, + Polygon: d3_geo_boundsPolygon + }; + d3.geo.circle = function() { + function circle() {} + function visible(point) { + return arc.distance(point) < radians; + } + function clip(coordinates) { + var i = -1, n = coordinates.length, clipped = [], p0, p1, p2, d0, d1; + while (++i < n) { + d1 = arc.distance(p2 = coordinates[i]); + if (d1 < radians) { + if (p1) clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1))); + clipped.push(p2); + p0 = p1 = null; + } else { + p1 = p2; + if (!p0 && clipped.length) { + clipped.push(d3_geo_greatArcInterpolate(clipped[clipped.length - 1], p1)((radians - d0) / (d1 - d0))); + p0 = p1; + } + } + d0 = d1; + } + p0 = coordinates[0]; + p1 = clipped[0]; + if (p1 && p2[0] === p0[0] && p2[1] === p0[1] && !(p2[0] === p1[0] && p2[1] === p1[1])) { + clipped.push(p1); + } + return resample(clipped); + } + function resample(coordinates) { + var i = 0, n = coordinates.length, j, m, resampled = n ? [ coordinates[0] ] : coordinates, resamples, origin = arc.source(); + while (++i < n) { + resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates; + for (j = 0, m = resamples.length; ++j < m; ) resampled.push(resamples[j]); + } + arc.source(origin); + return resampled; + } + var origin = [ 0, 0 ], degrees = 90 - .01, radians = degrees * d3_geo_radians, arc = d3.geo.greatArc().source(origin).target(d3_identity); + circle.clip = function(d) { + if (typeof origin === "function") arc.source(origin.apply(this, arguments)); + return clipType(d) || null; + }; + var clipType = d3_geo_type({ + FeatureCollection: function(o) { + var features = o.features.map(clipType).filter(d3_identity); + return features && (o = Object.create(o), o.features = features, o); + }, + Feature: function(o) { + var geometry = clipType(o.geometry); + return geometry && (o = Object.create(o), o.geometry = geometry, o); + }, + Point: function(o) { + return visible(o.coordinates) && o; + }, + MultiPoint: function(o) { + var coordinates = o.coordinates.filter(visible); + return coordinates.length && { + type: o.type, + coordinates: coordinates + }; + }, + LineString: function(o) { + var coordinates = clip(o.coordinates); + return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + MultiLineString: function(o) { + var coordinates = o.coordinates.map(clip).filter(function(d) { + return d.length; + }); + return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + Polygon: function(o) { + var coordinates = o.coordinates.map(clip); + return coordinates[0].length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + MultiPolygon: function(o) { + var coordinates = o.coordinates.map(function(d) { + return d.map(clip); + }).filter(function(d) { + return d[0].length; + }); + return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + GeometryCollection: function(o) { + var geometries = o.geometries.map(clipType).filter(d3_identity); + return geometries.length && (o = Object.create(o), o.geometries = geometries, o); + } + }); + circle.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + if (typeof origin !== "function") arc.source(origin); + return circle; + }; + circle.angle = function(x) { + if (!arguments.length) return degrees; + radians = (degrees = +x) * d3_geo_radians; + return circle; + }; + return d3.rebind(circle, arc, "precision"); + }; + d3.geo.greatArc = function() { + function greatArc() { + var d = greatArc.distance.apply(this, arguments), t = 0, dt = precision / d, coordinates = [ p0 ]; + while ((t += dt) < 1) coordinates.push(interpolate(t)); + coordinates.push(p1); + return { + type: "LineString", + coordinates: coordinates + }; + } + var source = d3_geo_greatArcSource, p0, target = d3_geo_greatArcTarget, p1, precision = 6 * d3_geo_radians, interpolate = d3_geo_greatArcInterpolator(); + greatArc.distance = function() { + if (typeof source === "function") interpolate.source(p0 = source.apply(this, arguments)); + if (typeof target === "function") interpolate.target(p1 = target.apply(this, arguments)); + return interpolate.distance(); + }; + greatArc.source = function(_) { + if (!arguments.length) return source; + source = _; + if (typeof source !== "function") interpolate.source(p0 = source); + return greatArc; + }; + greatArc.target = function(_) { + if (!arguments.length) return target; + target = _; + if (typeof target !== "function") interpolate.target(p1 = target); + return greatArc; + }; + greatArc.precision = function(_) { + if (!arguments.length) return precision / d3_geo_radians; + precision = _ * d3_geo_radians; + return greatArc; + }; + return greatArc; + }; + d3.geo.greatCircle = d3.geo.circle; + d3.geom = {}; + d3.geom.contour = function(grid, start) { + var s = start || d3_geom_contourStart(grid), c = [], x = s[0], y = s[1], dx = 0, dy = 0, pdx = NaN, pdy = NaN, i = 0; + do { + i = 0; + if (grid(x - 1, y - 1)) i += 1; + if (grid(x, y - 1)) i += 2; + if (grid(x - 1, y)) i += 4; + if (grid(x, y)) i += 8; + if (i === 6) { + dx = pdy === -1 ? -1 : 1; + dy = 0; + } else if (i === 9) { + dx = 0; + dy = pdx === 1 ? -1 : 1; + } else { + dx = d3_geom_contourDx[i]; + dy = d3_geom_contourDy[i]; + } + if (dx != pdx && dy != pdy) { + c.push([ x, y ]); + pdx = dx; + pdy = dy; + } + x += dx; + y += dy; + } while (s[0] != x || s[1] != y); + return c; + }; + var d3_geom_contourDx = [ 1, 0, 1, 1, -1, 0, -1, 1, 0, 0, 0, 0, -1, 0, -1, NaN ], d3_geom_contourDy = [ 0, -1, 0, 0, 0, -1, 0, 0, 1, -1, 1, 1, 0, -1, 0, NaN ]; + d3.geom.hull = function(vertices) { + if (vertices.length < 3) return []; + var len = vertices.length, plen = len - 1, points = [], stack = [], i, j, h = 0, x1, y1, x2, y2, u, v, a, sp; + for (i = 1; i < len; ++i) { + if (vertices[i][1] < vertices[h][1]) { + h = i; + } else if (vertices[i][1] == vertices[h][1]) { + h = vertices[i][0] < vertices[h][0] ? i : h; + } + } + for (i = 0; i < len; ++i) { + if (i === h) continue; + y1 = vertices[i][1] - vertices[h][1]; + x1 = vertices[i][0] - vertices[h][0]; + points.push({ + angle: Math.atan2(y1, x1), + index: i + }); + } + points.sort(function(a, b) { + return a.angle - b.angle; + }); + a = points[0].angle; + v = points[0].index; + u = 0; + for (i = 1; i < plen; ++i) { + j = points[i].index; + if (a == points[i].angle) { + x1 = vertices[v][0] - vertices[h][0]; + y1 = vertices[v][1] - vertices[h][1]; + x2 = vertices[j][0] - vertices[h][0]; + y2 = vertices[j][1] - vertices[h][1]; + if (x1 * x1 + y1 * y1 >= x2 * x2 + y2 * y2) { + points[i].index = -1; + } else { + points[u].index = -1; + a = points[i].angle; + u = i; + v = j; + } + } else { + a = points[i].angle; + u = i; + v = j; + } + } + stack.push(h); + for (i = 0, j = 0; i < 2; ++j) { + if (points[j].index !== -1) { + stack.push(points[j].index); + i++; + } + } + sp = stack.length; + for (; j < plen; ++j) { + if (points[j].index === -1) continue; + while (!d3_geom_hullCCW(stack[sp - 2], stack[sp - 1], points[j].index, vertices)) { + --sp; + } + stack[sp++] = points[j].index; + } + var poly = []; + for (i = 0; i < sp; ++i) { + poly.push(vertices[stack[i]]); + } + return poly; + }; + d3.geom.polygon = function(coordinates) { + coordinates.area = function() { + var i = 0, n = coordinates.length, a = coordinates[n - 1][0] * coordinates[0][1], b = coordinates[n - 1][1] * coordinates[0][0]; + while (++i < n) { + a += coordinates[i - 1][0] * coordinates[i][1]; + b += coordinates[i - 1][1] * coordinates[i][0]; + } + return (b - a) * .5; + }; + coordinates.centroid = function(k) { + var i = -1, n = coordinates.length, x = 0, y = 0, a, b = coordinates[n - 1], c; + if (!arguments.length) k = -1 / (6 * coordinates.area()); + while (++i < n) { + a = b; + b = coordinates[i]; + c = a[0] * b[1] - b[0] * a[1]; + x += (a[0] + b[0]) * c; + y += (a[1] + b[1]) * c; + } + return [ x * k, y * k ]; + }; + coordinates.clip = function(subject) { + var input, i = -1, n = coordinates.length, j, m, a = coordinates[n - 1], b, c, d; + while (++i < n) { + input = subject.slice(); + subject.length = 0; + b = coordinates[i]; + c = input[(m = input.length) - 1]; + j = -1; + while (++j < m) { + d = input[j]; + if (d3_geom_polygonInside(d, a, b)) { + if (!d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + subject.push(d); + } else if (d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + c = d; + } + a = b; + } + return subject; + }; + return coordinates; + }; + d3.geom.voronoi = function(vertices) { + var polygons = vertices.map(function() { + return []; + }); + d3_voronoi_tessellate(vertices, function(e) { + var s1, s2, x1, x2, y1, y2; + if (e.a === 1 && e.b >= 0) { + s1 = e.ep.r; + s2 = e.ep.l; + } else { + s1 = e.ep.l; + s2 = e.ep.r; + } + if (e.a === 1) { + y1 = s1 ? s1.y : -1e6; + x1 = e.c - e.b * y1; + y2 = s2 ? s2.y : 1e6; + x2 = e.c - e.b * y2; + } else { + x1 = s1 ? s1.x : -1e6; + y1 = e.c - e.a * x1; + x2 = s2 ? s2.x : 1e6; + y2 = e.c - e.a * x2; + } + var v1 = [ x1, y1 ], v2 = [ x2, y2 ]; + polygons[e.region.l.index].push(v1, v2); + polygons[e.region.r.index].push(v1, v2); + }); + return polygons.map(function(polygon, i) { + var cx = vertices[i][0], cy = vertices[i][1]; + polygon.forEach(function(v) { + v.angle = Math.atan2(v[0] - cx, v[1] - cy); + }); + return polygon.sort(function(a, b) { + return a.angle - b.angle; + }).filter(function(d, i) { + return !i || d.angle - polygon[i - 1].angle > 1e-10; + }); + }); + }; + var d3_voronoi_opposite = { + l: "r", + r: "l" + }; + d3.geom.delaunay = function(vertices) { + var edges = vertices.map(function() { + return []; + }), triangles = []; + d3_voronoi_tessellate(vertices, function(e) { + edges[e.region.l.index].push(vertices[e.region.r.index]); + }); + edges.forEach(function(edge, i) { + var v = vertices[i], cx = v[0], cy = v[1]; + edge.forEach(function(v) { + v.angle = Math.atan2(v[0] - cx, v[1] - cy); + }); + edge.sort(function(a, b) { + return a.angle - b.angle; + }); + for (var j = 0, m = edge.length - 1; j < m; j++) { + triangles.push([ v, edge[j], edge[j + 1] ]); + } + }); + return triangles; + }; + d3.geom.quadtree = function(points, x1, y1, x2, y2) { + function insert(n, p, x1, y1, x2, y2) { + if (isNaN(p.x) || isNaN(p.y)) return; + if (n.leaf) { + var v = n.point; + if (v) { + if (Math.abs(v.x - p.x) + Math.abs(v.y - p.y) < .01) { + insertChild(n, p, x1, y1, x2, y2); + } else { + n.point = null; + insertChild(n, v, x1, y1, x2, y2); + insertChild(n, p, x1, y1, x2, y2); + } + } else { + n.point = p; + } + } else { + insertChild(n, p, x1, y1, x2, y2); + } + } + function insertChild(n, p, x1, y1, x2, y2) { + var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = p.x >= sx, bottom = p.y >= sy, i = (bottom << 1) + right; + n.leaf = false; + n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); + if (right) x1 = sx; else x2 = sx; + if (bottom) y1 = sy; else y2 = sy; + insert(n, p, x1, y1, x2, y2); + } + var p, i = -1, n = points.length; + if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint); + if (arguments.length < 5) { + if (arguments.length === 3) { + y2 = x2 = y1; + y1 = x1; + } else { + x1 = y1 = Infinity; + x2 = y2 = -Infinity; + while (++i < n) { + p = points[i]; + if (p.x < x1) x1 = p.x; + if (p.y < y1) y1 = p.y; + if (p.x > x2) x2 = p.x; + if (p.y > y2) y2 = p.y; + } + var dx = x2 - x1, dy = y2 - y1; + if (dx > dy) y2 = y1 + dx; else x2 = x1 + dy; + } + } + var root = d3_geom_quadtreeNode(); + root.add = function(p) { + insert(root, p, x1, y1, x2, y2); + }; + root.visit = function(f) { + d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2); + }; + points.forEach(root.add); + return root; + }; + d3.time = {}; + var d3_time = Date, d3_time_daySymbols = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ]; + d3_time_utc.prototype = { + getDate: function() { + return this._.getUTCDate(); + }, + getDay: function() { + return this._.getUTCDay(); + }, + getFullYear: function() { + return this._.getUTCFullYear(); + }, + getHours: function() { + return this._.getUTCHours(); + }, + getMilliseconds: function() { + return this._.getUTCMilliseconds(); + }, + getMinutes: function() { + return this._.getUTCMinutes(); + }, + getMonth: function() { + return this._.getUTCMonth(); + }, + getSeconds: function() { + return this._.getUTCSeconds(); + }, + getTime: function() { + return this._.getTime(); + }, + getTimezoneOffset: function() { + return 0; + }, + valueOf: function() { + return this._.valueOf(); + }, + setDate: function() { + d3_time_prototype.setUTCDate.apply(this._, arguments); + }, + setDay: function() { + d3_time_prototype.setUTCDay.apply(this._, arguments); + }, + setFullYear: function() { + d3_time_prototype.setUTCFullYear.apply(this._, arguments); + }, + setHours: function() { + d3_time_prototype.setUTCHours.apply(this._, arguments); + }, + setMilliseconds: function() { + d3_time_prototype.setUTCMilliseconds.apply(this._, arguments); + }, + setMinutes: function() { + d3_time_prototype.setUTCMinutes.apply(this._, arguments); + }, + setMonth: function() { + d3_time_prototype.setUTCMonth.apply(this._, arguments); + }, + setSeconds: function() { + d3_time_prototype.setUTCSeconds.apply(this._, arguments); + }, + setTime: function() { + d3_time_prototype.setTime.apply(this._, arguments); + } + }; + var d3_time_prototype = Date.prototype; + var d3_time_formatDateTime = "%a %b %e %H:%M:%S %Y", d3_time_formatDate = "%m/%d/%y", d3_time_formatTime = "%H:%M:%S"; + var d3_time_days = d3_time_daySymbols, d3_time_dayAbbreviations = d3_time_days.map(d3_time_formatAbbreviate), d3_time_months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], d3_time_monthAbbreviations = d3_time_months.map(d3_time_formatAbbreviate); + d3.time.format = function(template) { + function format(date) { + var string = [], i = -1, j = 0, c, f; + while (++i < n) { + if (template.charCodeAt(i) == 37) { + string.push(template.substring(j, i), (f = d3_time_formats[c = template.charAt(++i)]) ? f(date) : c); + j = i + 1; + } + } + string.push(template.substring(j, i)); + return string.join(""); + } + var n = template.length; + format.parse = function(string) { + var d = { + y: 1900, + m: 0, + d: 1, + H: 0, + M: 0, + S: 0, + L: 0 + }, i = d3_time_parse(d, template, string, 0); + if (i != string.length) return null; + if ("p" in d) d.H = d.H % 12 + d.p * 12; + var date = new d3_time; + date.setFullYear(d.y, d.m, d.d); + date.setHours(d.H, d.M, d.S, d.L); + return date; + }; + format.toString = function() { + return template; + }; + return format; + }; + var d3_time_zfill2 = d3.format("02d"), d3_time_zfill3 = d3.format("03d"), d3_time_zfill4 = d3.format("04d"), d3_time_sfill2 = d3.format("2d"); + var d3_time_dayRe = d3_time_formatRe(d3_time_days), d3_time_dayAbbrevRe = d3_time_formatRe(d3_time_dayAbbreviations), d3_time_monthRe = d3_time_formatRe(d3_time_months), d3_time_monthLookup = d3_time_formatLookup(d3_time_months), d3_time_monthAbbrevRe = d3_time_formatRe(d3_time_monthAbbreviations), d3_time_monthAbbrevLookup = d3_time_formatLookup(d3_time_monthAbbreviations); + var d3_time_formats = { + a: function(d) { + return d3_time_dayAbbreviations[d.getDay()]; + }, + A: function(d) { + return d3_time_days[d.getDay()]; + }, + b: function(d) { + return d3_time_monthAbbreviations[d.getMonth()]; + }, + B: function(d) { + return d3_time_months[d.getMonth()]; + }, + c: d3.time.format(d3_time_formatDateTime), + d: function(d) { + return d3_time_zfill2(d.getDate()); + }, + e: function(d) { + return d3_time_sfill2(d.getDate()); + }, + H: function(d) { + return d3_time_zfill2(d.getHours()); + }, + I: function(d) { + return d3_time_zfill2(d.getHours() % 12 || 12); + }, + j: function(d) { + return d3_time_zfill3(1 + d3.time.dayOfYear(d)); + }, + L: function(d) { + return d3_time_zfill3(d.getMilliseconds()); + }, + m: function(d) { + return d3_time_zfill2(d.getMonth() + 1); + }, + M: function(d) { + return d3_time_zfill2(d.getMinutes()); + }, + p: function(d) { + return d.getHours() >= 12 ? "PM" : "AM"; + }, + S: function(d) { + return d3_time_zfill2(d.getSeconds()); + }, + U: function(d) { + return d3_time_zfill2(d3.time.sundayOfYear(d)); + }, + w: function(d) { + return d.getDay(); + }, + W: function(d) { + return d3_time_zfill2(d3.time.mondayOfYear(d)); + }, + x: d3.time.format(d3_time_formatDate), + X: d3.time.format(d3_time_formatTime), + y: function(d) { + return d3_time_zfill2(d.getFullYear() % 100); + }, + Y: function(d) { + return d3_time_zfill4(d.getFullYear() % 1e4); + }, + Z: d3_time_zone, + "%": function(d) { + return "%"; + } + }; + var d3_time_parsers = { + a: d3_time_parseWeekdayAbbrev, + A: d3_time_parseWeekday, + b: d3_time_parseMonthAbbrev, + B: d3_time_parseMonth, + c: d3_time_parseLocaleFull, + d: d3_time_parseDay, + e: d3_time_parseDay, + H: d3_time_parseHour24, + I: d3_time_parseHour24, + L: d3_time_parseMilliseconds, + m: d3_time_parseMonthNumber, + M: d3_time_parseMinutes, + p: d3_time_parseAmPm, + S: d3_time_parseSeconds, + x: d3_time_parseLocaleDate, + X: d3_time_parseLocaleTime, + y: d3_time_parseYear, + Y: d3_time_parseFullYear + }; + var d3_time_numberRe = /^\s*\d+/; + var d3_time_amPmLookup = d3.map({ + am: 0, + pm: 1 + }); + d3.time.format.utc = function(template) { + function format(date) { + try { + d3_time = d3_time_utc; + var utc = new d3_time; + utc._ = date; + return local(utc); + } finally { + d3_time = Date; + } + } + var local = d3.time.format(template); + format.parse = function(string) { + try { + d3_time = d3_time_utc; + var date = local.parse(string); + return date && date._; + } finally { + d3_time = Date; + } + }; + format.toString = local.toString; + return format; + }; + var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ"); + d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso; + d3_time_formatIsoNative.parse = function(string) { + var date = new Date(string); + return isNaN(date) ? null : date; + }; + d3_time_formatIsoNative.toString = d3_time_formatIso.toString; + d3.time.second = d3_time_interval(function(date) { + return new d3_time(Math.floor(date / 1e3) * 1e3); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 1e3); + }, function(date) { + return date.getSeconds(); + }); + d3.time.seconds = d3.time.second.range; + d3.time.seconds.utc = d3.time.second.utc.range; + d3.time.minute = d3_time_interval(function(date) { + return new d3_time(Math.floor(date / 6e4) * 6e4); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 6e4); + }, function(date) { + return date.getMinutes(); + }); + d3.time.minutes = d3.time.minute.range; + d3.time.minutes.utc = d3.time.minute.utc.range; + d3.time.hour = d3_time_interval(function(date) { + var timezone = date.getTimezoneOffset() / 60; + return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 36e5); + }, function(date) { + return date.getHours(); + }); + d3.time.hours = d3.time.hour.range; + d3.time.hours.utc = d3.time.hour.utc.range; + d3.time.day = d3_time_interval(function(date) { + var day = new d3_time(1970, 0); + day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate()); + return day; + }, function(date, offset) { + date.setDate(date.getDate() + offset); + }, function(date) { + return date.getDate() - 1; + }); + d3.time.days = d3.time.day.range; + d3.time.days.utc = d3.time.day.utc.range; + d3.time.dayOfYear = function(date) { + var year = d3.time.year(date); + return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5); + }; + d3_time_daySymbols.forEach(function(day, i) { + day = day.toLowerCase(); + i = 7 - i; + var interval = d3.time[day] = d3_time_interval(function(date) { + (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7); + return date; + }, function(date, offset) { + date.setDate(date.getDate() + Math.floor(offset) * 7); + }, function(date) { + var day = d3.time.year(date).getDay(); + return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i); + }); + d3.time[day + "s"] = interval.range; + d3.time[day + "s"].utc = interval.utc.range; + d3.time[day + "OfYear"] = function(date) { + var day = d3.time.year(date).getDay(); + return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7); + }; + }); + d3.time.week = d3.time.sunday; + d3.time.weeks = d3.time.sunday.range; + d3.time.weeks.utc = d3.time.sunday.utc.range; + d3.time.weekOfYear = d3.time.sundayOfYear; + d3.time.month = d3_time_interval(function(date) { + date = d3.time.day(date); + date.setDate(1); + return date; + }, function(date, offset) { + date.setMonth(date.getMonth() + offset); + }, function(date) { + return date.getMonth(); + }); + d3.time.months = d3.time.month.range; + d3.time.months.utc = d3.time.month.utc.range; + d3.time.year = d3_time_interval(function(date) { + date = d3.time.day(date); + date.setMonth(0, 1); + return date; + }, function(date, offset) { + date.setFullYear(date.getFullYear() + offset); + }, function(date) { + return date.getFullYear(); + }); + d3.time.years = d3.time.year.range; + d3.time.years.utc = d3.time.year.utc.range; + var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ]; + var d3_time_scaleLocalMethods = [ [ d3.time.second, 1 ], [ d3.time.second, 5 ], [ d3.time.second, 15 ], [ d3.time.second, 30 ], [ d3.time.minute, 1 ], [ d3.time.minute, 5 ], [ d3.time.minute, 15 ], [ d3.time.minute, 30 ], [ d3.time.hour, 1 ], [ d3.time.hour, 3 ], [ d3.time.hour, 6 ], [ d3.time.hour, 12 ], [ d3.time.day, 1 ], [ d3.time.day, 2 ], [ d3.time.week, 1 ], [ d3.time.month, 1 ], [ d3.time.month, 3 ], [ d3.time.year, 1 ] ]; + var d3_time_scaleLocalFormats = [ [ d3.time.format("%Y"), function(d) { + return true; + } ], [ d3.time.format("%B"), function(d) { + return d.getMonth(); + } ], [ d3.time.format("%b %d"), function(d) { + return d.getDate() != 1; + } ], [ d3.time.format("%a %d"), function(d) { + return d.getDay() && d.getDate() != 1; + } ], [ d3.time.format("%I %p"), function(d) { + return d.getHours(); + } ], [ d3.time.format("%I:%M"), function(d) { + return d.getMinutes(); + } ], [ d3.time.format(":%S"), function(d) { + return d.getSeconds(); + } ], [ d3.time.format(".%L"), function(d) { + return d.getMilliseconds(); + } ] ]; + var d3_time_scaleLinear = d3.scale.linear(), d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats); + d3_time_scaleLocalMethods.year = function(extent, m) { + return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear); + }; + d3.time.scale = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat); + }; + var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) { + return [ m[0].utc, m[1] ]; + }); + var d3_time_scaleUTCFormats = [ [ d3.time.format.utc("%Y"), function(d) { + return true; + } ], [ d3.time.format.utc("%B"), function(d) { + return d.getUTCMonth(); + } ], [ d3.time.format.utc("%b %d"), function(d) { + return d.getUTCDate() != 1; + } ], [ d3.time.format.utc("%a %d"), function(d) { + return d.getUTCDay() && d.getUTCDate() != 1; + } ], [ d3.time.format.utc("%I %p"), function(d) { + return d.getUTCHours(); + } ], [ d3.time.format.utc("%I:%M"), function(d) { + return d.getUTCMinutes(); + } ], [ d3.time.format.utc(":%S"), function(d) { + return d.getUTCSeconds(); + } ], [ d3.time.format.utc(".%L"), function(d) { + return d.getUTCMilliseconds(); + } ] ]; + var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats); + d3_time_scaleUTCMethods.year = function(extent, m) { + return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear); + }; + d3.time.scale.utc = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat); + }; +})(); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v2.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v2.min.js new file mode 100644 index 0000000..cc47f1e --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v2.min.js @@ -0,0 +1,4 @@ +(function(){function e(e,t){try{for(var n in t)Object.defineProperty(e.prototype,n,{value:t[n],enumerable:!1})}catch(r){e.prototype=t}}function t(e){var t=-1,n=e.length,r=[];while(++t=0?e.substring(t):(t=e.length,""),r=[];while(t>0)r.push(e.substring(t-=3,t+3));return r.reverse().join(",")+n}function b(e,t){var n=Math.pow(10,Math.abs(8-t)*3);return{scale:t>8?function(e){return e/n}:function(e){return e*n},symbol:e}}function w(e){return function(t){return t<=0?0:t>=1?1:e(t)}}function E(e){return function(t){return 1-e(1-t)}}function S(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function x(e){return e}function T(e){return function(t){return Math.pow(t,e)}}function N(e){return 1-Math.cos(e*Math.PI/2)}function C(e){return Math.pow(2,10*(e-1))}function k(e){return 1-Math.sqrt(1-e*e)}function L(e,t){var n;return arguments.length<2&&(t=.45),arguments.length<1?(e=1,n=t/4):n=t/(2*Math.PI)*Math.asin(1/e),function(r){return 1+e*Math.pow(2,10*-r)*Math.sin((r-n)*2*Math.PI/t)}}function A(e){return e||(e=1.70158),function(t){return t*t*((e+1)*t-e)}}function O(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function M(){d3.event.stopPropagation(),d3.event.preventDefault()}function _(){var e=d3.event,t;while(t=e.sourceEvent)e=t;return e}function D(e){var t=new d,n=0,r=arguments.length;while(++n360?e-=360:e<0&&(e+=360),e<60?s+(o-s)*e/60:e<180?o:e<240?s+(o-s)*(240-e)/60:s}function i(e){return Math.round(r(e)*255)}var s,o;return e%=360,e<0&&(e+=360),t=t<0?0:t>1?1:t,n=n<0?0:n>1?1:n,o=n<=.5?n*(1+t):n+t-n*t,s=2*n-o,R(i(e+120),i(e),i(e-120))}function Y(e,t,n){return new Z(e,t,n)}function Z(e,t,n){this.h=e,this.c=t,this.l=n}function et(e,t,n){return tt(n,Math.cos(e*=Math.PI/180)*t,Math.sin(e)*t)}function tt(e,t,n){return new nt(e,t,n)}function nt(e,t,n){this.l=e,this.a=t,this.b=n}function rt(e,t,n){var r=(e+16)/116,i=r+t/500,s=r-n/200;return i=st(i)*ds,r=st(r)*vs,s=st(s)*ms,R(ut(3.2404542*i-1.5371385*r-.4985314*s),ut(-0.969266*i+1.8760108*r+.041556*s),ut(.0556434*i-.2040259*r+1.0572252*s))}function it(e,t,n){return Y(Math.atan2(n,t)/Math.PI*180,Math.sqrt(t*t+n*n),e)}function st(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function ot(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function ut(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function at(e){return Ki(e,Ss),e}function ft(e){return function(){return gs(e,this)}}function lt(e){return function(){return ys(e,this)}}function ct(e,t){function n(){this.removeAttribute(e)}function r(){this.removeAttributeNS(e.space,e.local)}function i(){this.setAttribute(e,t)}function s(){this.setAttributeNS(e.space,e.local,t)}function o(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}function u(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}return e=d3.ns.qualify(e),t==null?e.local?r:n:typeof t=="function"?e.local?u:o:e.local?s:i}function ht(e){return new RegExp("(?:^|\\s+)"+d3.requote(e)+"(?:\\s+|$)","g")}function pt(e,t){function n(){var n=-1;while(++n0&&(e=e.substring(0,o)),t?i:r}function Et(e,t){for(var n=0,r=e.length;nt?c():(v.active=t,i.forEach(function(t,n){(n=n.call(e,m,u))&&h.push(n)}),s.start.call(e,m,u),l(r)||d3.timer(l,0,n),1)}function l(n){if(v.active!==t)return c();var r=(n-p)/d,i=o(r),a=h.length;while(a>0)h[--a].call(e,i);if(r>=1)return c(),ks=t,s.end.call(e,m,u),ks=0,1}function c(){return--v.count||delete e.__transition__,1}var h=[],p=e.delay,d=e.duration,v=(e=e.node).__transition__||(e.__transition__={active:0,count:0}),m=e.__data__;++v.count,p<=r?f(r):d3.timer(f,p,n)})},0,n),e}function Tt(e){var t=ks,n=Ds,r=Ms,i=_s;return ks=this.id,Ds=this.ease(),Et(this,function(t,n,r){Ms=t.delay,_s=t.duration,e.call(t=t.node,t.__data__,n,r)}),ks=t,Ds=n,Ms=r,_s=i,this}function Nt(e,t,n){return n!=""&&Ps}function Ct(e,t){return d3.tween(e,F(t))}function kt(){var e,t=Date.now(),n=Hs;while(n)e=t-n.then,e>=n.delay&&(n.flush=n.callback(e)),n=n.next;var r=Lt()-t;r>24?(isFinite(r)&&(clearTimeout(js),js=setTimeout(kt,r)),Bs=0):(Bs=1,Fs(kt))}function Lt(){var e=null,t=Hs,n=Infinity;while(t)t.flush?t=e?e.next=t.next:Hs=t.next:(n=Math.min(n,t.then+t.delay),t=(e=t).next);return n}function At(e,t){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();if(Is<0&&(window.scrollX||window.scrollY)){n=d3.select(document.body).append("svg").style("position","absolute").style("top",0).style("left",0);var i=n[0][0].getScreenCTM();Is=!i.f&&!i.e,n.remove()}return Is?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}function Ot(){}function Mt(e){var t=e[0],n=e[e.length-1];return t2?Ut:Rt,a=r?q:I;return o=i(e,t,a,n),u=i(t,e,a,d3.interpolate),s}function s(e){return o(e)}var o,u;return s.invert=function(e){return u(e)},s.domain=function(t){return arguments.length?(e=t.map(Number),i()):e},s.range=function(e){return arguments.length?(t=e,i()):t},s.rangeRound=function(e){return s.range(e).interpolate(d3.interpolateRound)},s.clamp=function(e){return arguments.length?(r=e,i()):r},s.interpolate=function(e){return arguments.length?(n=e,i()):n},s.ticks=function(t){return It(e,t)},s.tickFormat=function(t){return qt(e,t)},s.nice=function(){return Dt(e,jt),i()},s.copy=function(){return Ht(e,t,n,r)},i()}function Bt(e,t){return d3.rebind(e,t,"range","rangeRound","interpolate","clamp")}function jt(e){return e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1),e&&{floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}}}function Ft(e,t){var n=Mt(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),s=t/r*i;return s<=.15?i*=10:s<=.35?i*=5:s<=.75&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+i*.5,n[2]=i,n}function It(e,t){return d3.range.apply(d3,Ft(e,t))}function qt(e,t){return d3.format(",."+Math.max(0,-Math.floor(Math.log(Ft(e,t)[2])/Math.LN10+.01))+"f")}function Rt(e,t,n,r){var i=n(e[0],e[1]),s=r(t[0],t[1]);return function(e){return s(i(e))}}function Ut(e,t,n,r){var i=[],s=[],o=0,u=Math.min(e.length,t.length)-1;e[u]0;f--)i.push(r(s)*f)}else{for(;sa;o--);i=i.slice(s,o)}return i},n.tickFormat=function(e,i){arguments.length<2&&(i=qs);if(arguments.length<1)return i;var s=Math.max(.1,e/n.ticks().length),o=t===Xt?(u=-1e-12,Math.floor):(u=1e-12,Math.ceil),u;return function(e){return e/r(o(t(e)+u))<=s?i(e):""}},n.copy=function(){return zt(e.copy(),t)},Bt(n,e)}function Wt(e){return Math.log(e<0?0:e)/Math.LN10}function Xt(e){return-Math.log(e>0?0:-e)/Math.LN10}function Vt(e,t){function n(t){return e(r(t))}var r=$t(t),i=$t(1/t);return n.invert=function(t){return i(e.invert(t))},n.domain=function(t){return arguments.length?(e.domain(t.map(r)),n):e.domain().map(i)},n.ticks=function(e){return It(n.domain(),e)},n.tickFormat=function(e){return qt(n.domain(),e)},n.nice=function(){return n.domain(Dt(n.domain(),jt))},n.exponent=function(e){if(!arguments.length)return t;var s=n.domain();return r=$t(t=e),i=$t(1/t),n.domain(s)},n.copy=function(){return Vt(e.copy(),t)},Bt(n,e)}function $t(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Jt(e,t){function n(t){return o[((s.get(t)||s.set(t,e.push(t)))-1)%o.length]}function i(t,n){return d3.range(e.length).map(function(e){return t+n*e})}var s,o,u;return n.domain=function(i){if(!arguments.length)return e;e=[],s=new r;var o=-1,u=i.length,a;while(++o1){u=t[1],s=e[a],a++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1];for(var f=2;f9&&(s=n*3/Math.sqrt(s),o[u]=s*r,o[u+1]=s*i));u=-1;while(++u<=a)s=(e[Math.min(a,u+1)][0]-e[Math.max(0,u-1)][0])/(6*(1+o[u]*o[u])),t.push([s||0,o[u]*s||0]);return t}function Nn(e){return e.length<3?un(e):e[0]+dn(e,Tn(e))}function Cn(e){var t,n=-1,r=e.length,i,s;while(++n1){var r=Mt(e.domain()),i,s=-1,o=t.length,u=(t[1]-t[0])/++n,a,f;while(++s0;)(f=+t[s]-a*u)>=r[0]&&i.push(f);for(--s,a=0;++ar&&(n=t,r=i);return n}function ir(e){return e.reduce(sr,0)}function sr(e,t){return e+t[1]}function or(e,t){return ur(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function ur(e,t){var n=-1,r=+e[0],i=(e[1]-r)/t,s=[];while(++n<=t)s[n]=i*n+r;return s}function ar(e){return[d3.min(e),d3.max(e)]}function fr(e,t){return d3.rebind(e,t,"sort","children","value"),e.links=pr,e.nodes=function(t){return uo=!0,(e.nodes=e)(t)},e}function lr(e){return e.children}function cr(e){return e.value}function hr(e,t){return t.value-e.value}function pr(e){return d3.merge(e.map(function(e){return(e.children||[]).map(function(t){return{source:e,target:t}})}))}function dr(e,t){return e.value-t.value}function vr(e,t){var n=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=n,n._pack_prev=t}function mr(e,t){e._pack_next=t,t._pack_prev=e}function gr(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return i*i-n*n-r*r>.001}function yr(e){function t(e){r=Math.min(e.x-e.r,r),i=Math.max(e.x+e.r,i),s=Math.min(e.y-e.r,s),o=Math.max(e.y+e.r,o)}if(!(n=e.children)||!(p=n.length))return;var n,r=Infinity,i=-Infinity,s=Infinity,o=-Infinity,u,a,f,l,c,h,p;n.forEach(br),u=n[0],u.x=-u.r,u.y=0,t(u);if(p>1){a=n[1],a.x=a.r,a.y=0,t(a);if(p>2){f=n[2],Sr(u,a,f),t(f),vr(u,f),u._pack_prev=f,vr(f,a),a=u._pack_next;for(l=3;l0&&(e=r)}return e}function Mr(e,t){return e.x-t.x}function _r(e,t){return t.x-e.x}function Dr(e,t){return e.depth-t.depth}function Pr(e,t){function n(e,r){var i=e.children;if(i&&(a=i.length)){var s,o=null,u=-1,a;while(++u=0)s=r[i]._tree,s.prelim+=t,s.mod+=t,t+=s.shift+(n+=s.change)}function Br(e,t,n){e=e._tree,t=t._tree;var r=n/(t.number-e.number);e.change+=r,t.change-=r,t.shift+=n,t.prelim+=n,t.mod+=n}function jr(e,t,n){return e._tree.ancestor.parent==t.parent?e._tree.ancestor:n}function Fr(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function Ir(e,t){var n=e.x+t[3],r=e.y+t[0],i=e.dx-t[1]-t[3],s=e.dy-t[0]-t[2];return i<0&&(n+=i/2,i=0),s<0&&(r+=s/2,s=0),{x:n,y:r,dx:i,dy:s}}function qr(e,t){function n(e,r){d3.text(e,t,function(e){r(e&&n.parse(e))})}function r(t){return t.map(i).join(e)}function i(e){return o.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}var s=new RegExp("\r\n|["+e+"\r\n]","g"),o=new RegExp('["'+e+"\n]"),u=e.charCodeAt(0);return n.parse=function(e){var t;return n.parseRows(e,function(e,n){if(n){var r={},i=-1,s=t.length;while(++i=e.length)return i;if(l)return l=!1,r;var t=s.lastIndex;if(e.charCodeAt(t)===34){var n=t;while(n++0}function ii(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function si(e,t,n,r){var i=e[0],s=t[0],o=n[0],u=r[0],a=e[1],f=t[1],l=n[1],c=r[1],h=i-o,p=s-i,d=u-o,v=a-l,m=f-a,g=c-l,y=(d*v-g*h)/(g*p-d*m);return[i+y*p,a+y*m]}function oi(e,t){var n={list:e.map(function(e,t){return{index:t,x:e[0],y:e[1]}}).sort(function(e,t){return e.yt.y?1:e.xt.x?1:0}),bottomSite:null},r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,"l"),r.rightEnd=r.createHalfEdge(null,"l"),r.leftEnd.r=r.rightEnd,r.rightEnd.l=r.leftEnd,r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(e,t){return{edge:e,side:t,vertex:null,l:null,r:null}},insert:function(e,t){t.l=e,t.r=e.r,e.r.l=t,e.r=t},leftBound:function(e){var t=r.leftEnd;do t=t.r;while(t!=r.rightEnd&&i.rightOf(t,e));return t=t.l,t},del:function(e){e.l.r=e.r,e.r.l=e.l,e.edge=null},right:function(e){return e.r},left:function(e){return e.l},leftRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[e.side]},rightRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[ho[e.side]]}},i={bisect:function(e,t){var n={region:{l:e,r:t},ep:{l:null,r:null}},r=t.x-e.x,i=t.y-e.y,s=r>0?r:-r,o=i>0?i:-i;return n.c=e.x*r+e.y*i+(r*r+i*i)*.5,s>o?(n.a=1,n.b=i/r,n.c/=r):(n.b=1,n.a=r/i,n.c/=i),n},intersect:function(e,t){var n=e.edge,r=t.edge;if(!n||!r||n.region.r==r.region.r)return null;var i=n.a*r.b-n.b*r.a;if(Math.abs(i)<1e-10)return null;var s=(n.c*r.b-r.c*n.b)/i,o=(r.c*n.a-n.c*r.a)/i,u=n.region.r,a=r.region.r,f,l;u.y=l.region.r.x;return c&&f.side==="l"||!c&&f.side==="r"?null:{x:s,y:o}},rightOf:function(e,t){var n=e.edge,r=n.region.r,i=t.x>r.x;if(i&&e.side==="l")return 1;if(!i&&e.side==="r")return 0;if(n.a===1){var s=t.y-r.y,o=t.x-r.x,u=0,a=0;!i&&n.b<0||i&&n.b>=0?a=u=s>=n.b*o:(a=t.x+t.y*n.b>n.c,n.b<0&&(a=!a),a||(u=1));if(!u){var f=r.x-n.region.l.x;a=n.b*(o*o-s*s)h*h+p*p}return e.side==="l"?a:!a},endPoint:function(e,n,r){e.ep[n]=r;if(!e.ep[ho[n]])return;t(e)},distance:function(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}},s={list:[],insert:function(e,t,n){e.vertex=t,e.ystar=t.y+n;for(var r=0,i=s.list,o=i.length;ru.ystar||e.ystar==u.ystar&&t.x>u.vertex.x)continue;break}i.splice(r,0,e)},del:function(e){for(var t=0,n=s.list,r=n.length;td.y&&(v=p,p=d,d=v,b="r"),y=i.bisect(p,d),h=r.createHalfEdge(y,b),r.insert(l,h),i.endPoint(y,ho[b],g),m=i.intersect(l,h),m&&(s.del(l),s.insert(l,m,i.distance(m,p))),m=i.intersect(h,c),m&&s.insert(h,m,i.distance(m,p))}}for(a=r.right(r.leftEnd);a!=r.rightEnd;a=r.right(a))t(a.edge)}function ui(){return{leaf:!0,nodes:[],point:null}}function ai(e,t,n,r,i,s){if(!e(t,n,r,i,s)){var o=(n+i)*.5,u=(r+s)*.5,a=t.nodes;a[0]&&ai(e,a[0],n,r,o,u),a[1]&&ai(e,a[1],o,r,i,u),a[2]&&ai(e,a[2],n,u,o,s),a[3]&&ai(e,a[3],o,u,i,s)}}function fi(e){return{x:e[0],y:e[1]}}function li(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function ci(e){return e.substring(0,3)}function hi(e,t,n,r){var i,s,o=0,u=t.length,a=n.length;while(o=a)return-1;i=t.charCodeAt(o++);if(i==37){s=Ho[t.charAt(o++)];if(!s||(r=s(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function pi(e){return new RegExp("^(?:"+e.map(d3.requote).join("|")+")","i")}function di(e){var t=new r,n=-1,i=e.length;while(++n68?1900:2e3)}function Ni(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.m=r[0]-1,n+=r[0].length):-1}function Ci(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.d=+r[0],n+=r[0].length):-1}function ki(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.H=+r[0],n+=r[0].length):-1}function Li(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.M=+r[0],n+=r[0].length):-1}function Ai(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.S=+r[0],n+=r[0].length):-1}function Oi(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+3));return r?(e.L=+r[0],n+=r[0].length):-1}function Mi(e,t,n){var r=jo.get(t.substring(n,n+=2).toLowerCase());return r==null?-1:(e.p=r,n)}function _i(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=~~(Math.abs(t)/60),i=Math.abs(t)%60;return n+To(r)+To(i)}function Di(e){return e.toISOString()}function Pi(e,t,n){function r(t){var n=e(t),r=s(n,1);return t-n1)while(ot?1:e>=t?0:NaN},d3.descending=function(e,t){return te?1:t>=e?0:NaN},d3.mean=function(e,t){var n=e.length,r,i=0,s=-1,o=0;if(arguments.length===1)while(++s1&&(e=e.map(t)),e=e.filter(f),e.length?d3.quantile(e.sort(d3.ascending),.5):undefined},d3.min=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++ns&&(i=s)}else{while(++ns&&(i=s)}return i},d3.max=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++ni&&(i=s)}else{while(++ni&&(i=s)}return i},d3.extent=function(e,t){var n=-1,r=e.length,i,s,o;if(arguments.length===1){while(++ns&&(i=s),os&&(i=s),o1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(e,t){var n=arguments.length;n<2&&(t=1),n<1&&(e=0);var r=d3.random.normal();return function(){return Math.exp(e+t*r())}},irwinHall:function(e){return function(){for(var t=0,n=0;n>>1;e.call(t,t[s],s)>>1;n0&&(i=s);return i},d3.last=function(e,t){var n=0,r=e.length,i=e[0],s;arguments.length===1&&(t=d3.ascending);while(++n=i.length)return u?u.call(n,t):o?t.sort(o):t;var a=-1,f=t.length,l=i[s++],c,h,p=new r,d,v={};while(++a=i.length)return e;var r=[],o=s[n++],u;for(u in e)r.push({key:u,values:t(e[u],n)});return o&&r.sort(function(e,t){return o(e.key,t.key)}),r}var n={},i=[],s=[],o,u;return n.map=function(t){return e(t,0)},n.entries=function(n){return t(e(n,0),0)},n.key=function(e){return i.push(e),n},n.sortKeys=function(e){return s[i.length-1]=e,n},n.sortValues=function(e){return o=e,n},n.rollup=function(e){return u=e,n},n},d3.keys=function(e){var t=[];for(var n in e)t.push(n);return t},d3.values=function(e){var t=[];for(var n in e)t.push(e[n]);return t},d3.entries=function(e){var t=[];for(var n in e)t.push({key:n,value:e[n]});return t},d3.permute=function(e,t){var n=[],r=-1,i=t.length;while(++rt)r.push(o/i);else while((o=e+n*++s)=200&&e<300||e===304?r:null)}},r.send(null)},d3.text=function(e,t,n){function r(e){n(e&&e.responseText)}arguments.length<3&&(n=t,t=null),d3.xhr(e,t,r)},d3.json=function(e,t){d3.text(e,"application/json",function(e){t(e?JSON.parse(e):null)})},d3.html=function(e,t){d3.text(e,"text/html",function(e){if(e!=null){var n=document.createRange();n.selectNode(document.body),e=n.createContextualFragment(e)}t(e)})},d3.xml=function(e,t,n){function r(e){n(e&&e.responseXML)}arguments.length<3&&(n=t,t=null),d3.xhr(e,t,r)};var es={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};d3.ns={prefix:es,qualify:function(e){var t=e.indexOf(":"),n=e;return t>=0&&(n=e.substring(0,t),e=e.substring(t+1)),es.hasOwnProperty(n)?{space:es[n],local:e}:e}},d3.dispatch=function(){var e=new d,t=-1,n=arguments.length;while(++t0&&(r=e.substring(n+1),e=e.substring(0,n)),arguments.length<2?this[e].on(r):this[e].on(r,t)},d3.format=function(e){var t=ts.exec(e),n=t[1]||" ",r=t[3]||"",i=t[5],s=+t[6],o=t[7],u=t[8],a=t[9],f=1,l="",c=!1;u&&(u=+u.substring(1)),i&&(n="0",o&&(s-=Math.floor((s-1)/4)));switch(a){case"n":o=!0,a="g";break;case"%":f=100,l="%",a="f";break;case"p":f=100,l="%",a="r";break;case"d":c=!0,u=0;break;case"s":f=-1,a="r"}return a=="r"&&!u&&(a="g"),a=ns.get(a)||g,function(e){if(c&&e%1)return"";var t=e<0&&(e=-e)?"-":r;if(f<0){var h=d3.formatPrefix(e,u);e=h.scale(e),l=h.symbol}else e*=f;e=a(e,u);if(i){var p=e.length+t.length;p=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,ns=d3.map({g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(e,t){return d3.round(e,t=m(e,t)).toFixed(Math.max(0,Math.min(20,t)))}}),rs=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(b);d3.formatPrefix=function(e,t){var n=0;return e&&(e<0&&(e*=-1),t&&(e=d3.round(e,m(e,t))),n=1+Math.floor(1e-12+Math.log(e)/Math.LN10),n=Math.max(-24,Math.min(24,Math.floor((n<=0?n+1:n-1)/3)*3))),rs[8+n/3]};var is=T(2),ss=T(3),os=function(){return x},us=d3.map({linear:os,poly:T,quad:function(){return is},cubic:function(){return ss},sin:function(){return N},exp:function(){return C},circle:function(){return k},elastic:L,back:A,bounce:function(){return O}}),as=d3.map({"in":x,out:E,"in-out":S,"out-in":function(e){return S(E(e))}});d3.ease=function(e){var t=e.indexOf("-"),n=t>=0?e.substring(0,t):e,r=t>=0?e.substring(t+1):"in";return n=us.get(n)||os,r=as.get(r)||x,w(r(n.apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.transform=function(e){var t=document.createElementNS(d3.ns.prefix.svg,"g");return(d3.transform=function(e){t.setAttribute("transform",e);var n=t.transform.baseVal.consolidate();return new P(n?n.matrix:ls)})(e)},P.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var fs=180/Math.PI,ls={a:1,b:0,c:0,d:1,e:0,f:0};d3.interpolate=function(e,t){var n=d3.interpolators.length,r;while(--n>=0&&!(r=d3.interpolators[n](e,t)));return r},d3.interpolateNumber=function(e,t){return t-=e,function(n){return e+t*n}},d3.interpolateRound=function(e,t){return t-=e,function(n){return Math.round(e+t*n)}},d3.interpolateString=function(e,t){var n,r,i,s=0,o=0,u=[],a=[],f,l;cs.lastIndex=0;for(r=0;n=cs.exec(t);++r)n.index&&u.push(t.substring(s,o=n.index)),a.push({i:u.length,x:n[0]}),u.push(null),s=cs.lastIndex;s180?l+=360:l-f>180&&(f+=360),r.push({i:n.push(n.pop()+"rotate(",null,")")-2,x:d3.interpolateNumber(f,l)})):l&&n.push(n.pop()+"rotate("+l+")"),c!=h?r.push({i:n.push(n.pop()+"skewX(",null,")")-2,x:d3.interpolateNumber(c,h)}):h&&n.push(n.pop()+"skewX("+h+")"),p[0]!=d[0]||p[1]!=d[1]?(i=n.push(n.pop()+"scale(",null,",",null,")"),r.push({i:i-4,x:d3.interpolateNumber(p[0],d[0])},{i:i-2,x:d3.interpolateNumber(p[1],d[1])})):(d[0]!=1||d[1]!=1)&&n.push(n.pop()+"scale("+d+")"),i=r.length,function(e){var t=-1,s;while(++t180?s-=360:s<-180&&(s+=360),function(e){return G(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateLab=function(e,t){e=d3.lab(e),t=d3.lab(t);var n=e.l,r=e.a,i=e.b,s=t.l-n,o=t.a-r,u=t.b-i;return function(e){return rt(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateHcl=function(e,t){e=d3.hcl(e),t=d3.hcl(t);var n=e.h,r=e.c,i=e.l,s=t.h-n,o=t.c-r,u=t.l-i;return s>180?s-=360:s<-180&&(s+=360),function(e){return et(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateArray=function(e,t){var n=[],r=[],i=e.length,s=t.length,o=Math.min(e.length,t.length),u;for(u=0;u=0;)if(s=n[r])i&&i!==s.nextSibling&&i.parentNode.insertBefore(s,i),i=s;return this},Ss.sort=function(e){e=bt.apply(this,arguments);for(var t=-1,n=this.length;++t=Vs?e?"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"Z":e?"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L"+e*h+","+e*p+"A"+e+","+e+" 0 "+f+",0 "+e*l+","+e*c+"Z":"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L0,0"+"Z"}var t=Zt,n=en,r=tn,i=nn;return e.innerRadius=function(n){return arguments.length?(t=u(n),e):t},e.outerRadius=function(t){return arguments.length?(n=u(t),e):n},e.startAngle=function(t){return arguments.length?(r=u(t),e):r},e.endAngle=function(t){return arguments.length?(i=u(t),e):i},e.centroid=function(){var e=(t.apply(this,arguments)+n.apply(this,arguments))/2,s=(r.apply(this,arguments)+i.apply(this,arguments))/2+Xs;return[Math.cos(s)*e,Math.sin(s)*e]},e};var Xs=-Math.PI/2,Vs=2*Math.PI-1e-6;d3.svg.line=function(){return rn(i)};var $s=d3.map({linear:un,"linear-closed":an,"step-before":fn,"step-after":ln,basis:mn,"basis-open":gn,"basis-closed":yn,bundle:bn,cardinal:pn,"cardinal-open":cn,"cardinal-closed":hn,monotone:Nn});$s.forEach(function(e,t){t.key=e,t.closed=/-closed$/.test(e)});var Js=[0,2/3,1/3,0],Ks=[0,1/3,2/3,0],Qs=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var e=rn(Cn);return e.radius=e.x,delete e.x,e.angle=e.y,delete e.y,e},fn.reverse=ln,ln.reverse=fn,d3.svg.area=function(){return kn(i)},d3.svg.area.radial=function(){var e=kn(Cn);return e.radius=e.x,delete e.x,e.innerRadius=e.x0,delete e.x0,e.outerRadius=e.x1,delete e.x1,e.angle=e.y,delete e.y,e.startAngle=e.y0,delete e.y0,e.endAngle=e.y1,delete e.y1,e},d3.svg.chord=function(){function e(e,u){var a=t(this,s,e,u),f=t(this,o,e,u);return"M"+a.p0+r(a.r,a.p1,a.a1-a.a0)+(n(a,f)?i(a.r,a.p1,a.r,a.p0):i(a.r,a.p1,f.r,f.p0)+r(f.r,f.p1,f.a1-f.a0)+i(f.r,f.p1,a.r,a.p0))+"Z"}function t(e,t,n,r){var i=t.call(e,n,r),s=a.call(e,i,r),o=f.call(e,i,r)+Xs,u=l.call(e,i,r)+Xs;return{r:s,a0:o,a1:u,p0:[s*Math.cos(o),s*Math.sin(o)],p1:[s*Math.cos(u),s*Math.sin(u)]}}function n(e,t){return e.a0==t.a0&&e.a1==t.a1}function r(e,t,n){return"A"+e+","+e+" 0 "+ +(n>Math.PI)+",1 "+t}function i(e,t,n,r){return"Q 0,0 "+r}var s=Ln,o=An,a=On,f=tn,l=nn;return e.radius=function(t){return arguments.length?(a=u(t),e):a},e.source=function(t){return arguments.length?(s=u(t),e):s},e.target=function(t){return arguments.length?(o=u(t),e):o},e.startAngle=function(t){return arguments.length?(f=u(t),e):f},e.endAngle=function(t){return arguments.length?(l=u(t),e):l},e},d3.svg.diagonal=function(){function e(e,i){var s=t.call(this,e,i),o=n.call(this,e,i),u=(s.y+o.y)/2,a=[s,{x:s.x,y:u},{x:o.x,y:u},o];return a=a.map(r),"M"+a[0]+"C"+a[1]+" "+a[2]+" "+a[3]}var t=Ln,n=An,r=Dn;return e.source=function(n){return arguments.length?(t=u(n),e):t},e.target=function(t){return arguments.length?(n=u(t),e):n},e.projection=function(t){return arguments.length?(r=t,e):r},e},d3.svg.diagonal.radial=function(){var e=d3.svg.diagonal(),t=Dn,n=e.projection;return e.projection=function(e){return arguments.length?n(Pn(t=e)):t},e},d3.svg.mouse=d3.mouse,d3.svg.touches=d3.touches,d3.svg.symbol=function(){function e(e,r){return(Gs.get(t.call(this,e,r))||jn)(n.call(this,e,r))}var t=Bn,n=Hn;return e.type=function(n){return arguments.length?(t=u(n),e):t},e.size=function(t){return arguments.length?(n=u(t),e):n},e};var Gs=d3.map({circle:jn,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+ -3*t+","+ -t+"H"+ -t+"V"+ -3*t+"H"+t+"V"+ -t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+ -t+"V"+t+"H"+ -3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*Zs)),n=t*Zs;return"M0,"+ -t+"L"+n+",0"+" 0,"+t+" "+ -n+",0"+"Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+ -t+","+ -t+"L"+t+","+ -t+" "+t+","+t+" "+ -t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/Ys),n=t*Ys/2;return"M0,"+n+"L"+t+","+ -n+" "+ -t+","+ -n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/Ys),n=t*Ys/2;return"M0,"+ -n+"L"+t+","+n+" "+ -t+","+n+"Z"}});d3.svg.symbolTypes=Gs.keys();var Ys=Math.sqrt(3),Zs=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function e(e){e.each(function(){var e=d3.select(this),c=a==null?t.ticks?t.ticks.apply(t,u):t.domain():a,h=f==null?t.tickFormat?t.tickFormat.apply(t,u):String:f,p=qn(t,c,l),d=e.selectAll(".minor").data(p,String),v=d.enter().insert("line","g").attr("class","tick minor").style("opacity",1e-6),m=d3.transition(d.exit()).style("opacity",1e-6).remove(),g=d3.transition(d).style("opacity",1),y=e.selectAll("g").data(c,String),b=y.enter().insert("g","path").style("opacity",1e-6),w=d3.transition(y.exit()).style("opacity",1e-6).remove(),E=d3.transition(y).style("opacity",1),S,x=_t(t),T=e.selectAll(".domain").data([0]),N=T.enter().append("path").attr("class","domain"),C=d3.transition(T),k=t.copy(),L=this.__chart__||k;this.__chart__=k,b.append("line").attr("class","tick"),b.append("text");var A=b.select("line"),O=E.select("line"),M=y.select("text").text(h),_=b.select("text"),D=E.select("text");switch(n){case"bottom":S=Fn,v.attr("y2",i),g.attr("x2",0).attr("y2",i),A.attr("y2",r),_.attr("y",Math.max(r,0)+o),O.attr("x2",0).attr("y2",r),D.attr("x",0).attr("y",Math.max(r,0)+o),M.attr("dy",".71em").attr("text-anchor","middle"),C.attr("d","M"+x[0]+","+s+"V0H"+x[1]+"V"+s);break;case"top":S=Fn,v.attr("y2",-i),g.attr("x2",0).attr("y2",-i),A.attr("y2",-r),_.attr("y",-(Math.max(r,0)+o)),O.attr("x2",0).attr("y2",-r),D.attr("x",0).attr("y",-(Math.max(r,0)+o)),M.attr("dy","0em").attr("text-anchor","middle"),C.attr("d","M"+x[0]+","+ -s+"V0H"+x[1]+"V"+ -s);break;case"left":S=In,v.attr("x2",-i),g.attr("x2",-i).attr("y2",0),A.attr("x2",-r),_.attr("x",-(Math.max(r,0)+o)),O.attr("x2",-r).attr("y2",0),D.attr("x",-(Math.max(r,0)+o)).attr("y",0),M.attr("dy",".32em").attr("text-anchor","end"),C.attr("d","M"+ -s+","+x[0]+"H0V"+x[1]+"H"+ -s);break;case"right":S=In,v.attr("x2",i),g.attr("x2",i).attr("y2",0),A.attr("x2",r),_.attr("x",Math.max(r,0)+o),O.attr("x2",r).attr("y2",0),D.attr("x",Math.max(r,0)+o).attr("y",0),M.attr("dy",".32em").attr("text-anchor","start"),C.attr("d","M"+s+","+x[0]+"H0V"+x[1]+"H"+s)}if(t.ticks)b.call(S,L),E.call(S,k),w.call(S,k),v.call(S,L),g.call(S,k),m.call(S,k);else{var P=k.rangeBand()/2,H=function(e){return k(e)+P};b.call(S,H),E.call(S,H)}})}var t=d3.scale.linear(),n="bottom",r=6,i=6,s=6,o=3,u=[10],a=null,f,l=0;return e.scale=function(n){return arguments.length?(t=n,e):t},e.orient=function(t){return arguments.length?(n=t,e):n},e.ticks=function(){return arguments.length?(u=arguments,e):u},e.tickValues=function(t){return arguments.length?(a=t,e):a},e.tickFormat=function(t){return arguments.length?(f=t,e):f},e.tickSize=function(t,n,o){if(!arguments.length)return r;var u=arguments.length-1;return r=+t,i=u>1?+n:r,s=u>0?+arguments[u]:r,e},e.tickPadding=function(t){return arguments.length?(o=+t,e):o},e.tickSubdivide=function(t){return arguments.length?(l=+t,e):l},e},d3.svg.brush=function(){function e(s){s.each(function(){var s=d3.select(this),f=s.selectAll(".background").data([0]),l=s.selectAll(".extent").data([0]),c=s.selectAll(".resize").data(a,String),h;s.style("pointer-events","all").on("mousedown.brush",i).on("touchstart.brush",i),f.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),l.enter().append("rect").attr("class","extent").style("cursor","move"),c.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return eo[e]}).append("rect").attr("x",function(e){return/[ew]$/.test(e)?-3:null}).attr("y",function(e){return/^[ns]/.test(e)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),c.style("display",e.empty()?"none":null),c.exit().remove(),o&&(h=_t(o),f.attr("x",h[0]).attr("width",h[1]-h[0]),n(s)),u&&(h=_t(u),f.attr("y",h[0]).attr("height",h[1]-h[0]),r(s)),t(s)})}function t(e){e.selectAll(".resize").attr("transform",function(e){return"translate("+f[+/e$/.test(e)][0]+","+f[+/^s/.test(e)][1]+")"})}function n(e){e.select(".extent").attr("x",f[0][0]),e.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1][0]-f[0][0])}function r(e){e.select(".extent").attr("y",f[0][1]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1][1]-f[0][1])}function i(){function i(){var e=d3.event.changedTouches;return e?d3.touches(v,e)[0]:d3.mouse(v)}function a(){d3.event.keyCode==32&&(S||(x=null,T[0]-=f[1][0],T[1]-=f[1][1],S=2),M())}function c(){d3.event.keyCode==32&&S==2&&(T[0]+=f[1][0],T[1]+=f[1][1],S=0,M())}function h(){var e=i(),s=!1;N&&(e[0]+=N[0],e[1]+=N[1]),S||(d3.event.altKey?(x||(x=[(f[0][0]+f[1][0])/2,(f[0][1]+f[1][1])/2]),T[0]=f[+(e[0]0?a=e:a=0:e>0&&(r.start({type:"start",alpha:a=e}),d3.timer(n.tick)),n):a},n.start=function(){function e(e,n){var i=t(r),s=-1,o=i.length,u;while(++si&&(i=u),r.push(u)}for(o=0;o0){s=-1;while(++s=a[0]&&d<=a[1]&&(l=o[d3.bisect(f,d,1,h)-1],l.y+=p,l.push(e[s]))}return o}var t=!0,n=Number,r=ar,i=or;return e.value=function(t){return arguments.length?(n=t,e):n},e.range=function(t){return arguments.length?(r=u(t),e):r},e.bins=function(t){return arguments.length?(i=typeof t=="number"?function(e){return ur(e,t)}:u(t),e):i},e.frequency=function(n){return arguments.length?(t=!!n,e):t},e},d3.layout.hierarchy=function(){function e(t,o,u){var a=i.call(n,t,o),f=uo?t:{data:t};f.depth=o,u.push(f);if(a&&(c=a.length)){var l=-1,c,h=f.children=[],p=0,d=o+1,v;while(++l0){var l=n*f/2;Pr(o,function(e){e.r+=l}),Pr(o,yr),Pr(o,function(e){e.r-=l}),f=Math.max(2*o.r/u,2*o.r/a)}return Er(o,u/2,a/2,1/f),s}var t=d3.layout.hierarchy().sort(dr),n=0,r=[1,1];return e.size=function(t){return arguments.length?(r=t,e):r},e.padding=function(t){return arguments.length?(n=+t,e):n},fr(e,t)},d3.layout.cluster=function(){function e(e,i){var s=t.call(this,e,i),o=s[0],u,a=0,f,l;Pr(o,function(e){var t=e.children;t&&t.length?(e.x=Tr(t),e.y=xr(t)):(e.x=u?a+=n(e,u):0,e.y=0,u=e)});var c=Nr(o),h=Cr(o),p=c.x-n(c,h)/2,d=h.x+n(h,c)/2;return Pr(o,function(e){e.x=(e.x-p)/(d-p)*r[0],e.y=(1-(o.y?e.y/o.y:1))*r[1]}),s}var t=d3.layout.hierarchy().sort(null).value(null),n=kr,r=[1,1];return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(r=t,e):r},fr(e,t)},d3.layout.tree=function(){function e(e,i){function s(e,t){var r=e.children,i=e._tree;if(r&&(o=r.length)){var o,a=r[0],f,l=a,c,h=-1;while(++h0&&(Br(jr(o,e,r),e,h),a+=h,f+=h),l+=o._tree.mod,a+=i._tree.mod,c+=u._tree.mod,f+=s._tree.mod;o&&!Ar(s)&&(s._tree.thread=o,s._tree.mod+=l-f),i&&!Lr(u)&&(u._tree.thread=i,u._tree.mod+=a-c,r=e)}return r}var a=t.call(this,e,i),f=a[0];Pr(f,function(e,t){e._tree={ancestor:e,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}}),s(f),o(f,-f._tree.prelim);var l=Or(f,_r),c=Or(f,Mr),h=Or(f,Dr),p=l.x-n(l,c)/2,d=c.x+n(c,l)/2,v=h.depth||1;return Pr(f,function(e){e.x=(e.x-p)/(d-p)*r[0],e.y=e.depth/v*r[1],delete e._tree}),a}var t=d3.layout.hierarchy().sort(null).value(null),n=kr,r=[1,1];return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(r=t,e):r},fr(e,t)},d3.layout.treemap=function(){function e(e,t){var n=-1,r=e.length,i,s;while(++n0)u.push(f=a[d-1]),u.area+=f.area,(h=r(u,p))<=c?(a.pop(),c=h):(u.area-=u.pop().area,i(u,p,o,!1),p=Math.min(o.dx,o.dy),u.length=u.area=0,c=Infinity);u.length&&(i(u,p,o,!0),u.length=u.area=0),s.forEach(t)}}function n(t){var r=t.children;if(r&&r.length){var s=l(t),o=r.slice(),u,a=[];e(o,s.dx*s.dy/t.value),a.area=0;while(u=o.pop())a.push(u),a.area+=u.area,u.z!=null&&(i(a,u.z?s.dx:s.dy,s,!o.length),a.length=a.area=0);r.forEach(n)}}function r(e,t){var n=e.area,r,i=0,s=Infinity,o=-1,u=e.length;while(++oi&&(i=r)}return n*=n,t*=t,n?Math.max(t*i*p/n,n/(t*s*p)):Infinity}function i(e,t,n,r){var i=-1,s=e.length,o=n.x,a=n.y,f=t?u(e.area/t):0,l;if(t==n.dx){if(r||f>n.dy)f=n.dy;while(++in.dx)f=n.dx;while(++i50?n:s<-140?r:o<21?i:t)(e)}var t=d3.geo.albers(),n=d3.geo.albers().origin([-160,60]).parallels([55,65]),r=d3.geo.albers().origin([-160,20]).parallels([8,18]),i=d3.geo.albers().origin([-60,10]).parallels([8,18]);return e.scale=function(s){return arguments.length?(t.scale(s),n.scale(s*.6),r.scale(s),i.scale(s*1.5),e.translate(t.translate())):t.scale()},e.translate=function(s){if(!arguments.length)return t.translate();var o=t.scale()/1e3,u=s[0],a=s[1];return t.translate(s),n.translate([u-400*o,a+170*o]),r.translate([u-190*o,a+200*o]),i.translate([u+580*o,a+430*o]),e},e.scale(t.scale())},d3.geo.bonne=function(){function e(e){var u=e[0]*ao-r,a=e[1]*ao-i;if(s){var f=o+s-a,l=u*Math.cos(a)/f;u=f*Math.sin(l),a=f*Math.cos(l)-o}else u*=Math.cos(a),a*=-1;return[t*u+n[0],t*a+n[1]]}var t=200,n=[480,250],r,i,s,o;return e.invert=function(e){var i=(e[0]-n[0])/t,u=(e[1]-n[1])/t;if(s){var a=o+u,f=Math.sqrt(i*i+a*a);u=o+s-f,i=r+f*Math.atan2(i,a)/Math.cos(u)}else u*=-1,i/=Math.cos(u);return[i/ao,u/ao]},e.parallel=function(t){return arguments.length?(o=1/Math.tan +(s=t*ao),e):s/ao},e.origin=function(t){return arguments.length?(r=t[0]*ao,i=t[1]*ao,e):[r/ao,i/ao]},e.scale=function(n){return arguments.length?(t=+n,e):t},e.translate=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e.origin([0,0]).parallel(45)},d3.geo.equirectangular=function(){function e(e){var r=e[0]/360,i=-e[1]/360;return[t*r+n[0],t*i+n[1]]}var t=500,n=[480,250];return e.invert=function(e){var r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return[360*r,-360*i]},e.scale=function(n){return arguments.length?(t=+n,e):t},e.translate=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e},d3.geo.mercator=function(){function e(e){var r=e[0]/360,i=-(Math.log(Math.tan(Math.PI/4+e[1]*ao/2))/ao)/360;return[t*r+n[0],t*Math.max(-0.5,Math.min(.5,i))+n[1]]}var t=500,n=[480,250];return e.invert=function(e){var r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return[360*r,2*Math.atan(Math.exp(-360*i*ao))/ao-90]},e.scale=function(n){return arguments.length?(t=+n,e):t},e.translate=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e},d3.geo.path=function(){function e(e,t){typeof s=="function"&&(o=Ur(s.apply(this,arguments))),f(e);var n=a.length?a.join(""):null;return a=[],n}function t(e){return u(e).join(",")}function n(e){var t=i(e[0]),n=0,r=e.length;while(++n0){a.push("M");while(++o0){a.push("M");while(++lr&&(r=e),si&&(i=s)}),[[t,n],[r,i]]};var fo={Feature:Wr,FeatureCollection:Xr,GeometryCollection:Vr,LineString:$r,MultiLineString:Jr,MultiPoint:$r,MultiPolygon:Kr,Point:Qr,Polygon:Gr};d3.geo.circle=function(){function e(){}function t(e){return a.distance(e)=l*l+c*c?r[s].index=-1:(r[h].index=-1,d=r[s].angle,h=s,p=o)):(d=r[s].angle,h=s,p=o);i.push(u);for(s=0,o=0;s<2;++o)r[o].index!==-1&&(i.push(r[o].index),s++);v=i.length;for(;o=0?(n=e.ep.r,r=e.ep.l):(n=e.ep.l,r=e.ep.r),e.a===1?(o=n?n.y:-1e6,i=e.c-e.b*o,u=r?r.y:1e6,s=e.c-e.b*u):(i=n?n.x:-1e6,o=e.c-e.a*i,s=r?r.x:1e6,u=e.c-e.a*s);var a=[i,o],f=[s,u];t[e.region.l.index].push(a,f),t[e.region.r.index].push(a,f)}),t.map(function(t,n){var r=e[n][0],i=e[n][1];return t.forEach(function(e){e.angle=Math.atan2(e[0]-r,e[1]-i)}),t.sort(function(e,t){return e.angle-t.angle}).filter(function(e,n){return!n||e.angle-t[n-1].angle>1e-10})})};var ho={l:"r",r:"l"};d3.geom.delaunay=function(e){var t=e.map(function(){return[]}),n=[];return oi(e,function(n){t[n.region.l.index].push(e[n.region.r.index])}),t.forEach(function(t,r){var i=e[r],s=i[0],o=i[1];t.forEach(function(e){e.angle=Math.atan2(e[0]-s,e[1]-o)}),t.sort(function(e,t){return e.angle-t.angle});for(var u=0,a=t.length-1;u=u,l=t.y>=a,c=(l<<1)+f;e.leaf=!1,e=e.nodes[c]||(e.nodes[c]=ui()),f?n=u:i=u,l?r=a:o=a,s(e,t,n,r,i,o)}var u,a=-1,f=e.length;f&&isNaN(e[0].x)&&(e=e.map(fi));if(arguments.length<5)if(arguments.length===3)i=r=n,n=t;else{t=n=Infinity,r=i=-Infinity;while(++ar&&(r=u.x),u.y>i&&(i=u.y);var l=r-t,c=i-n;l>c?i=n+l:r=t+c}var h=ui();return h.add=function(e){s(h,e,t,n,r,i)},h.visit=function(e){ai(e,h,t,n,r,i)},e.forEach(h.add),h},d3.time={};var po=Date,vo=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];li.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){mo.setUTCDate.apply(this._,arguments)},setDay:function(){mo.setUTCDay.apply(this._,arguments)},setFullYear:function(){mo.setUTCFullYear.apply(this._,arguments)},setHours:function(){mo.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){mo.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){mo.setUTCMinutes.apply(this._,arguments)},setMonth:function(){mo.setUTCMonth.apply(this._,arguments)},setSeconds:function(){mo.setUTCSeconds.apply(this._,arguments)},setTime:function(){mo.setTime.apply(this._,arguments)}};var mo=Date.prototype,go="%a %b %e %H:%M:%S %Y",yo="%m/%d/%y",bo="%H:%M:%S",wo=vo,Eo=wo.map(ci),So=["January","February","March","April","May","June","July","August","September","October","November","December"],xo=So.map(ci);d3.time.format=function(e){function t(t){var r=[],i=-1,s=0,o,u;while(++i=12?"PM":"AM"},S:function(e){return To(e.getSeconds())},U:function(e){return To(d3.time.sundayOfYear(e))},w:function(e){return e.getDay()},W:function(e){return To(d3.time.mondayOfYear(e))},x:d3.time.format(yo),X:d3.time.format(bo),y:function(e){return To(e.getFullYear()%100)},Y:function(e){return Co(e.getFullYear()%1e4)},Z:_i,"%":function(e){return"%"}},Ho={a:vi,A:mi,b:gi,B:yi,c:bi,d:Ci,e:Ci,H:ki,I:ki,L:Oi,m:Ni,M:Li,p:Mi,S:Ai,x:wi,X:Ei,y:xi,Y:Si},Bo=/^\s*\d+/,jo=d3.map({am:0,pm:1});d3.time.format.utc=function(e){function t(e){try{po=li;var t=new po;return t._=e,n(t)}finally{po=Date}}var n=d3.time.format(e);return t.parse=function(e){try{po=li;var t=n.parse(e);return t&&t._}finally{po=Date}},t.toString=n.toString,t};var Fo=d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");d3.time.format.iso=Date.prototype.toISOString?Di:Fo,Di.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Di.toString=Fo.toString,d3.time.second=Pi(function(e){return new po(Math.floor(e/1e3)*1e3)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*1e3)},function(e){return e.getSeconds()}),d3.time.seconds=d3.time.second.range,d3.time.seconds.utc=d3.time.second.utc.range,d3.time.minute=Pi(function(e){return new po(Math.floor(e/6e4)*6e4)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*6e4)},function(e){return e.getMinutes()}),d3.time.minutes=d3.time.minute.range,d3.time.minutes.utc=d3.time.minute.utc.range,d3.time.hour=Pi(function(e){var t=e.getTimezoneOffset()/60;return new po((Math.floor(e/36e5-t)+t)*36e5)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*36e5)},function(e){return e.getHours()}),d3.time.hours=d3.time.hour.range,d3.time.hours.utc=d3.time.hour.utc.range,d3.time.day=Pi(function(e){var t=new po(1970,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t},function(e,t){e.setDate(e.getDate()+t)},function(e){return e.getDate()-1}),d3.time.days=d3.time.day.range,d3.time.days.utc=d3.time.day.utc.range,d3.time.dayOfYear=function(e){var t=d3.time.year(e);return Math.floor((e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5)},vo.forEach(function(e,t){e=e.toLowerCase(),t=7-t;var n=d3.time[e]=Pi(function(e){return(e=d3.time.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e},function(e,t){e.setDate(e.getDate()+Math.floor(t)*7)},function(e){var n=d3.time.year(e).getDay();return Math.floor((d3.time.dayOfYear(e)+(n+t)%7)/7)-(n!==t)});d3.time[e+"s"]=n.range,d3.time[e+"s"].utc=n.utc.range,d3.time[e+"OfYear"]=function(e){var n=d3.time.year(e).getDay();return Math.floor((d3.time.dayOfYear(e)+(n+t)%7)/7)}}),d3.time.week=d3.time.sunday,d3.time.weeks=d3.time.sunday.range,d3.time.weeks.utc=d3.time.sunday.utc.range,d3.time.weekOfYear=d3.time.sundayOfYear,d3.time.month=Pi(function(e){return e=d3.time.day(e),e.setDate(1),e},function(e,t){e.setMonth(e.getMonth()+t)},function(e){return e.getMonth()}),d3.time.months=d3.time.month.range,d3.time.months.utc=d3.time.month.utc.range,d3.time.year=Pi(function(e){return e=d3.time.day(e),e.setMonth(0,1),e},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e){return e.getFullYear()}),d3.time.years=d3.time.year.range,d3.time.years.utc=d3.time.year.utc.range;var Io=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],qo=[[d3.time.second,1],[d3.time.second,5],[d3.time.second,15],[d3.time.second,30],[d3.time.minute,1],[d3.time.minute,5],[d3.time.minute,15],[d3.time.minute,30],[d3.time.hour,1],[d3.time.hour,3],[d3.time.hour,6],[d3.time.hour,12],[d3.time.day,1],[d3.time.day,2],[d3.time.week,1],[d3.time.month,1],[d3.time.month,3],[d3.time.year,1]],Ro=[[d3.time.format("%Y"),function(e){return!0}],[d3.time.format("%B"),function(e){return e.getMonth()}],[d3.time.format("%b %d"),function(e){return e.getDate()!=1}],[d3.time.format("%a %d"),function(e){return e.getDay()&&e.getDate()!=1}],[d3.time.format("%I %p"),function(e){return e.getHours()}],[d3.time.format("%I:%M"),function(e){return e.getMinutes()}],[d3.time.format(":%S"),function(e){return e.getSeconds()}],[d3.time.format(".%L"),function(e){return e.getMilliseconds()}]],Uo=d3.scale.linear(),zo=Ii(Ro);qo.year=function(e,t){return Uo.domain(e.map(Ri)).ticks(t).map(qi)},d3.time.scale=function(){return Bi(d3.scale.linear(),qo,zo)};var Wo=qo.map(function(e){return[e[0].utc,e[1]]}),Xo=[[d3.time.format.utc("%Y"),function(e){return!0}],[d3.time.format.utc("%B"),function(e){return e.getUTCMonth()}],[d3.time.format.utc("%b %d"),function(e){return e.getUTCDate()!=1}],[d3.time.format.utc("%a %d"),function(e){return e.getUTCDay()&&e.getUTCDate()!=1}],[d3.time.format.utc("%I %p"),function(e){return e.getUTCHours()}],[d3.time.format.utc("%I:%M"),function(e){return e.getUTCMinutes()}],[d3.time.format.utc(":%S"),function(e){return e.getUTCSeconds()}],[d3.time.format.utc(".%L"),function(e){return e.getUTCMilliseconds()}]],Vo=Ii(Xo);Wo.year=function(e,t){return Uo.domain(e.map(zi)).ticks(t).map(Ui)},d3.time.scale.utc=function(){return Bi(d3.scale.linear(),Wo,Vo)}})(); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v3.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v3.min.js new file mode 100644 index 0000000..7975878 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/d3.v3.min.js @@ -0,0 +1 @@ +d3=function(){function o(e){return e!=null&&!isNaN(e)}function a(e){return e.length}function f(e){var t=1;while(e*t%1)t*=10;return t}function l(e,t){try{for(var n in t){Object.defineProperty(e.prototype,n,{value:t[n],enumerable:false})}}catch(r){e.prototype=t}}function c(){}function d(){}function v(e,t,n){return function(){var r=n.apply(t,arguments);return r===t?e:r}}function m(){}function g(e){function r(){var n=t,r=-1,i=n.length,s;while(++r0)t=t.substring(0,s);var u=Z.get(t);if(u)t=u,o=tt;return s?n?f:a:n?G:l}function et(t,n){return function(r){var i=e.event;e.event=r;n[0]=this.__data__;try{t.apply(this,n)}finally{e.event=i}}}function tt(e,t){var n=et(e,t);return function(e){var t=this,r=e.relatedTarget;if(!r||r!==t&&!(r.compareDocumentPosition(t)&8)){n.call(t,e)}}}function nt(e,t){for(var n=0,r=e.length;n360)e-=360;else if(e<0)e+=360;if(e<60)return r+(i-r)*e/60;if(e<180)return i;if(e<240)return r+(i-r)*(240-e)/60;return r}function o(e){return Math.round(s(e)*255)}var r,i;e=e%360;if(e<0)e+=360;t=t<0?0:t>1?1:t;n=n<0?0:n>1?1:n;i=n<=.5?n*(1+t):n+t-n*t;r=2*n-i;return qt(o(e+120),o(e),o(e-120))}function yt(e){return e>0?1:e<0?-1:0}function bt(e){return Math.acos(Math.max(-1,Math.min(1,e)))}function wt(e){return e>1?dt/2:e<-1?-dt/2:Math.asin(e)}function Et(e){return(Math.exp(e)-Math.exp(-e))/2}function St(e){return(Math.exp(e)+Math.exp(-e))/2}function xt(e){return(e=Math.sin(e/2))*e}function Tt(e,t,n){return new Nt(e,t,n)}function Nt(e,t,n){this.h=e;this.c=t;this.l=n}function kt(e,t,n){return Lt(n,Math.cos(e*=mt)*t,Math.sin(e)*t)}function Lt(e,t,n){return new At(e,t,n)}function At(e,t,n){this.l=e;this.a=t;this.b=n}function Ht(e,t,n){var r=(e+16)/116,i=r+t/500,s=r-n/200;i=jt(i)*Mt;r=jt(r)*_t;s=jt(s)*Dt;return qt(It(3.2404542*i-1.5371385*r-.4985314*s),It(-.969266*i+1.8760108*r+.041556*s),It(.0556434*i-.2040259*r+1.0572252*s))}function Bt(e,t,n){return Tt(Math.atan2(n,t)*gt,Math.sqrt(t*t+n*n),e)}function jt(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function Ft(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function It(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function qt(e,t,n){return new Rt(e,t,n)}function Rt(e,t,n){this.r=e;this.g=t;this.b=n}function zt(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function Wt(e,t,n){var r=0,i=0,s=0,o,u,a;o=/([a-z]+)\((.*)\)/i.exec(e);if(o){u=o[2].split(",");switch(o[1]){case"hsl":{return n(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100)};case"rgb":{return t(Jt(u[0]),Jt(u[1]),Jt(u[2]))}}}if(a=Kt.get(e))return t(a.r,a.g,a.b);if(e!=null&&e.charAt(0)==="#"){if(e.length===4){r=e.charAt(1);r+=r;i=e.charAt(2);i+=i;s=e.charAt(3);s+=s}else if(e.length===7){r=e.substring(1,3);i=e.substring(3,5);s=e.substring(5,7)}r=parseInt(r,16);i=parseInt(i,16);s=parseInt(s,16)}return t(r,i,s)}function Xt(e,t,n){var r=Math.min(e/=255,t/=255,n/=255),i=Math.max(e,t,n),s=i-r,o,u,a=(i+r)/2;if(s){u=a<.5?s/(i+r):s/(2-i-r);if(e==i)o=(t-n)/s+(t=o)return r;if(l)return l=false,n;var t=u;if(e.charCodeAt(t)===34){var s=t;while(s++=n.delay)n.flush=n.callback(e);n=n.next}var r=un()-t;if(r>24){if(isFinite(r)){clearTimeout(sn);sn=setTimeout(on,r)}rn=0}else{rn=1;an(on)}}function un(){var e=null,t=nn,n=Infinity;while(t){if(t.flush){delete tn[t.callback.id];t=e?e.next=t.next:nn=t.next}else{n=Math.min(n,t.then+t.delay);t=(e=t).next}}return n}function pn(e,t){var n=Math.pow(10,Math.abs(8-t)*3);return{scale:t>8?function(e){return e/n}:function(e){return e*n},symbol:e}}function mn(e,t){return t-(e?Math.ceil(Math.log(e)/Math.LN10):1)}function gn(e){return e+""}function wn(e,t){if(e&&Sn.hasOwnProperty(e.type)){Sn[e.type](e,t)}}function xn(e,t,n){var r=-1,i=e.length-n,s;t.lineStart();while(++ri)i=e;if(ts)s=t}function a(){o.point=o.lineEnd=G}var n,r,i,s;var o={point:u,lineStart:G,lineEnd:G,polygonStart:function(){o.lineEnd=a},polygonEnd:function(){o.point=u}};return function(u){s=i=-(n=r=Infinity);e.geo.stream(u,t(o));return[[n,r],[i,s]]}}function jn(e,t){if(Mn)return;++_n;e*=mt;var n=Math.cos(t*=mt);Dn+=(n*Math.cos(e)-Dn)/_n;Pn+=(n*Math.sin(e)-Pn)/_n;Hn+=(Math.sin(t)-Hn)/_n}function Fn(){var e,t;Mn=1;In();Mn=2;var n=Bn.point;Bn.point=function(r,i){n(e=r,t=i)};Bn.lineEnd=function(){Bn.point(e,t);qn();Bn.lineEnd=qn}}function In(){function r(r,i){r*=mt;var s=Math.cos(i*=mt),o=s*Math.cos(r),u=s*Math.sin(r),a=Math.sin(i),f=Math.atan2(Math.sqrt((f=t*a-n*u)*f+(f=n*o-e*a)*f+(f=e*u-t*o)*f),e*o+t*u+n*a);_n+=f;Dn+=f*(e+(e=o));Pn+=f*(t+(t=u));Hn+=f*(n+(n=a))}var e,t,n;if(Mn>1)return;if(Mn<1){Mn=1;_n=Dn=Pn=Hn=0}Bn.point=function(i,s){i*=mt;var o=Math.cos(s*=mt);e=o*Math.cos(i);t=o*Math.sin(i);n=Math.sin(s);Bn.point=r}}function qn(){Bn.point=jn}function Rn(e){var t=e[0],n=e[1],r=Math.cos(n);return[r*Math.cos(t),r*Math.sin(t),Math.sin(n)]}function Un(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function zn(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Wn(e,t){e[0]+=t[0];e[1]+=t[1];e[2]+=t[2]}function Xn(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Vn(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t;e[1]/=t;e[2]/=t}function $n(){return true}function Jn(e){return[Math.atan2(e[1],e[0]),Math.asin(Math.max(-1,Math.min(1,e[2])))]}function Kn(e,t){return Math.abs(e[0]-t[0])=0;)i.point((p=h[u])[0],p[1])}else{r(c.point,c.prev.point,-1,i)}c=c.prev}c=c.other;h=c.points}while(!c.visited);i.lineEnd()}}function Gn(e){if(!(t=e.length))return;var t,n=0,r=e[0],i;while(++n1&&e&2)t.push(t.pop().concat(t.shift()));c.push(t.filter(Zn))}var s=n(i);var o={point:u,lineStart:f,lineEnd:l,polygonStart:function(){o.point=y;o.lineStart=b;o.lineEnd=w;d=false;p=h=0;c=[];i.polygonStart()},polygonEnd:function(){o.point=u;o.lineStart=f;o.lineEnd=l;c=e.merge(c);if(c.length){Qn(c,nr,null,r,i)}else if(h<-vt||d&&p<-vt){i.lineStart();r(null,null,1,i);i.lineEnd()}i.polygonEnd();c=null},sphere:function(){i.polygonStart();i.lineStart();r(null,null,1,i);i.lineEnd();i.polygonEnd()}};var c,h,p,d;var v=er(),m=n(v),g;return o}}function Zn(e){return e.length>1}function er(){var e=[],t;return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:G,buffer:function(){var n=e;e=[];t=null;return n},rejoin:function(){if(e.length>1)e.push(e.pop().concat(e.shift()))}}}function tr(e,t){if(!(n=e.length))return 0;var n,r=0,i=0,s=e[0],o=s[0],u=s[1],a=Math.cos(u),f=Math.atan2(t*Math.sin(o)*a,Math.sin(u)),l=1-t*Math.cos(o)*a,c=f,h,p;while(++r2)i+=4*(h-f)}else if(Math.abs(l-2)0?dt:-dt,a=Math.abs(s-t);if(Math.abs(a-dt)0?dt/2:-dt/2);e.point(r,n);e.lineEnd();e.lineStart();e.point(u,n);e.point(s,n);i=0}else if(r!==u&&a>=dt){if(Math.abs(t-r)vt?Math.atan((Math.sin(t)*(s=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(t))*Math.sin(e))/(i*s*o)):(t+r)/2}function or(e,t,n,r){var i;if(e==null){i=n*dt/2;r.point(-dt,i);r.point(0,i);r.point(dt,i);r.point(dt,0);r.point(dt,-i);r.point(0,-i);r.point(-dt,-i);r.point(-dt,0);r.point(-dt,i)}else if(Math.abs(e[0]-t[0])>vt){var s=(e[0]t}function o(e){var t,i,o,f,l;return{lineStart:function(){f=o=false;l=1},point:function(c,h){var p=[c,h],d,v=s(c,h),m=n?v?0:a(c,h):v?a(c+(c<0?dt:-dt),h):0;if(!t&&(f=o=v))e.lineStart();if(v!==o){d=u(t,p);if(Kn(t,d)||Kn(p,d)){p[0]+=vt;p[1]+=vt;v=s(p[0],p[1])}}if(v!==o){l=0;if(v){e.lineStart();d=u(p,t);e.point(d[0],d[1])}else{d=u(t,p);e.point(d[0],d[1]);e.lineEnd()}t=d}else if(r&&t&&n^v){var g;if(!(m&i)&&(g=u(p,t,true))){l=0;if(n){e.lineStart();e.point(g[0][0],g[0][1]);e.point(g[1][0],g[1][1]);e.lineEnd()}else{e.point(g[1][0],g[1][1]);e.lineEnd();e.lineStart();e.point(g[0][0],g[0][1])}}}if(v&&(!t||!Kn(t,p))){e.point(p[0],p[1])}t=p,o=v,i=m},lineEnd:function(){if(o)e.lineEnd();t=null},clean:function(){return l|(f&&o)<<1}}}function u(e,n,r){var i=Rn(e),s=Rn(n);var o=[1,0,0],u=zn(i,s),a=Un(u,u),f=u[0],l=a-f*f;if(!l)return!r&&e;var c=t*a/l,h=-t*f/l,p=zn(o,u),d=Xn(o,c),v=Xn(u,h);Wn(d,v);var m=p,g=Un(d,m),y=Un(m,m),b=g*g-y*(Un(d,d)-1);if(b<0)return;var w=Math.sqrt(b),E=Xn(m,(-g-w)/y);Wn(E,d);E=Jn(E);if(!r)return E;var S=e[0],x=n[0],T=e[1],N=n[1],C;if(x0^E[1]<(Math.abs(E[0]-S)dt^(S<=E[0]&&E[0]<=x)){var O=Xn(m,(-g+w)/y);Wn(O,d);return[E,Jn(O)]}}function a(t,r){var i=n?e:dt-e,s=0;if(t<-i)s|=1;else if(t>i)s|=2;if(r<-i)s|=4;else if(r>i)s|=8;return s}var t=Math.cos(e),n=t>0,r=Math.abs(t)>vt,i=Er(e,6*mt);return Yn(s,o,i)}function fr(t,n,r,i){function s(e,i){return Math.abs(e[0]-t)0?0:3:Math.abs(e[0]-r)0?2:1:Math.abs(e[1]-n)0?1:0:i>0?3:2}function o(e,t){return u(e.point,t.point)}function u(e,t){var n=s(e,1),r=s(t,1);return n!==r?n-r:n===0?t[1]-e[1]:n===1?e[0]-t[0]:n===2?e[1]-t[1]:t[0]-e[0]}function a(e,s){var o=s[0]-e[0],u=s[1]-e[1],a=[0,1];if(Math.abs(o)0){e[0]+=a[0]*o;e[1]+=a[0]*u}return true}return false}return function(f){function m(e){var o=s(e,-1),u=g([o===0||o===3?t:r,o>1?i:n]);return u}function g(e){var t=0,n=p.length,r=e[1];for(var i=0;ir&&y(a,b,e)>0)++t}else{if(b[1]<=r&&y(a,b,e)<0)--t}a=b}}return t!==0}function y(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(t[1]-e[1])}function w(e,o,a,f){var l=0,c=0;if(e==null||(l=s(e,a))!==(c=s(o,a))||u(e,o)<0^a>0){do{f.point(l===0||l===3?t:r,l>1?i:n)}while((l=(l+a+4)%4)!==c)}else{f.point(o[0],o[1])}}function E(e,s){return t<=e&&e<=r&&n<=s&&s<=i}function S(e,t){if(E(e,t))f.point(e,t)}function O(){v.point=_;if(p)p.push(d=[]);A=true;L=false;C=k=NaN}function M(){if(h){_(x,T);if(N&&L)c.rejoin();h.push(c.buffer())}v.point=S;if(L)f.lineEnd()}function _(e,t){e=Math.max(-ar,Math.min(ar,e));t=Math.max(-ar,Math.min(ar,t));var n=E(e,t);if(p)d.push([e,t]);if(A){x=e,T=t,N=n;A=false;if(n){f.lineStart();f.point(e,t)}}else{if(n&&L)f.point(e,t);else{var r=[C,k],i=[e,t];if(a(r,i)){if(!L){f.lineStart();f.point(r[0],r[1])}f.point(i[0],i[1]);if(!n)f.lineEnd()}else{f.lineStart();f.point(e,t)}}}C=e,k=t,L=n}var l=f,c=er(),h,p,d;var v={point:S,lineStart:O,lineEnd:M,polygonStart:function(){f=c;h=[];p=[]},polygonEnd:function(){f=l;if((h=e.merge(h)).length){f.polygonStart();Qn(h,o,m,w,f);f.polygonEnd()}else if(g([t,n])){f.polygonStart(),f.lineStart();w(null,null,1,f);f.lineEnd(),f.polygonEnd()}h=p=d=null}};var x,T,N,C,k,L,A;return v}}function lr(e,t,n){if(Math.abs(t)0){if(r>n[1])return false;if(r>n[0])n[0]=r}else{if(r4*t&&v--){var w=o+h,E=u+p,S=a+d,x=Math.sqrt(w*w+E*E+S*S),T=Math.asin(S/=x),N=Math.abs(Math.abs(S)-1)t||Math.abs((g*A+y*O)/b-.5)>.3){i(n,r,s,o,u,a,k,L,N,w/=x,E/=x,S,v,m);m.point(k,L);i(k,L,N,w,E,S,f,l,c,h,p,d,v,m)}}}var t=.5,n=16;r.precision=function(e){if(!arguments.length)return Math.sqrt(t);n=(t=e*e)>0&&16;return r};return r}function pr(e){return dr(function(){return e})()}function dr(t){function w(e){e=i(e[0]*mt,e[1]*mt);return[e[0]*o+d,v-e[1]*o]}function E(e){e=i.invert((e[0]-d)/o,(v-e[1])/o);return e&&[e[0]*gt,e[1]*gt]}function S(){i=cr(r=gr(c,h,p),n);var e=n(f,l);d=u-e[0]*o;v=a+e[1]*o;return w}var n,r,i,s=hr(function(e,t){e=n(e,t);return[e[0]*o+d,v-e[1]*o]}),o=150,u=480,a=250,f=0,l=0,c=0,h=0,p=0,d,v,m=rr,g=Gt,y=null,b=null;w.stream=function(e){return vr(r,m(s(g(e))))};w.clipAngle=function(e){if(!arguments.length)return y;m=e==null?(y=e,rr):ur((y=+e)*mt);return w};w.clipExtent=function(e){if(!arguments.length)return b;b=e;g=e==null?Gt:fr(e[0][0],e[0][1],e[1][0],e[1][1]);return w};w.scale=function(e){if(!arguments.length)return o;o=+e;return S()};w.translate=function(e){if(!arguments.length)return[u,a];u=+e[0];a=+e[1];return S()};w.center=function(e){if(!arguments.length)return[f*gt,l*gt];f=e[0]%360*mt;l=e[1]%360*mt;return S()};w.rotate=function(e){if(!arguments.length)return[c*gt,h*gt,p*gt];c=e[0]%360*mt;h=e[1]%360*mt;p=e.length>2?e[2]%360*mt:0;return S()};e.rebind(w,s,"precision");return function(){n=t.apply(this,arguments);w.invert=n.invert&&E;return S()}}function vr(e,t){return{point:function(n,r){r=e(n*mt,r*mt),n=r[0];t.point(n>dt?n-2*dt:n<-dt?n+2*dt:n,r[1])},sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function mr(e,t){return[e,t]}function gr(e,t,n){return e?t||n?cr(br(e),wr(t,n)):br(e):t||n?wr(t,n):mr}function yr(e){return function(t,n){return t+=e,[t>dt?t-2*dt:t<-dt?t+2*dt:t,n]}}function br(e){var t=yr(e);t.invert=yr(-e);return t}function wr(e,t){function o(e,t){var o=Math.cos(t),u=Math.cos(e)*o,a=Math.sin(e)*o,f=Math.sin(t),l=f*n+u*r;return[Math.atan2(a*i-l*s,u*n-f*r),Math.asin(Math.max(-1,Math.min(1,l*i+a*s)))]}var n=Math.cos(e),r=Math.sin(e),i=Math.cos(t),s=Math.sin(t);o.invert=function(e,t){var o=Math.cos(t),u=Math.cos(e)*o,a=Math.sin(e)*o,f=Math.sin(t),l=f*i-a*s;return[Math.atan2(a*i+f*s,u*n+l*r),Math.asin(Math.max(-1,Math.min(1,l*n-u*r)))]};return o}function Er(e,t){var n=Math.cos(e),r=Math.sin(e);return function(i,s,o,u){if(i!=null){i=Sr(n,i);s=Sr(n,s);if(o>0?is)i+=o*2*dt}else{i=e+o*2*dt;s=e}var a;for(var f=o*t,l=i;o>0?l>s:l1){u=t[1];s=e[a];a++;r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1];for(var f=2;f9){s=n*3/Math.sqrt(s);o[u]=s*r;o[u+1]=s*i}}}u=-1;while(++u<=a){s=(e[Math.min(a,u+1)][0]-e[Math.max(0,u-1)][0])/(6*(1+o[u]*o[u]));t.push([s||0,o[u]*s||0])}return t}function Ai(e){return e.length<3?ai(e):e[0]+vi(e,Li(e))}function Oi(e,t,n,r){var i,s,o,u,a,f,l;i=r[e];s=i[0];o=i[1];i=r[t];u=i[0];a=i[1];i=r[n];f=i[0];l=i[1];return(l-o)*(u-s)-(a-o)*(f-s)>0}function Mi(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function _i(e,t,n,r){var i=e[0],s=n[0],o=t[0]-i,u=r[0]-s,a=e[1],f=n[1],l=t[1]-a,c=r[1]-f,h=(u*(a-f)-c*(i-s))/(c*o-u*l);return[i+h*o,a+h*l]}function Pi(e,t){var n={list:e.map(function(e,t){return{index:t,x:e[0],y:e[1]}}).sort(function(e,t){return e.yt.y?1:e.xt.x?1:0}),bottomSite:null};var r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,"l");r.rightEnd=r.createHalfEdge(null,"l");r.leftEnd.r=r.rightEnd;r.rightEnd.l=r.leftEnd;r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(e,t){return{edge:e,side:t,vertex:null,l:null,r:null}},insert:function(e,t){t.l=e;t.r=e.r;e.r.l=t;e.r=t},leftBound:function(e){var t=r.leftEnd;do{t=t.r}while(t!=r.rightEnd&&i.rightOf(t,e));t=t.l;return t},del:function(e){e.l.r=e.r;e.r.l=e.l;e.edge=null},right:function(e){return e.r},left:function(e){return e.l},leftRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[e.side]},rightRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[Di[e.side]]}};var i={bisect:function(e,t){var n={region:{l:e,r:t},ep:{l:null,r:null}};var r=t.x-e.x,i=t.y-e.y,s=r>0?r:-r,o=i>0?i:-i;n.c=e.x*r+e.y*i+(r*r+i*i)*.5;if(s>o){n.a=1;n.b=i/r;n.c/=r}else{n.b=1;n.a=r/i;n.c/=i}return n},intersect:function(e,t){var n=e.edge,r=t.edge;if(!n||!r||n.region.r==r.region.r){return null}var i=n.a*r.b-n.b*r.a;if(Math.abs(i)<1e-10){return null}var s=(n.c*r.b-r.c*n.b)/i,o=(r.c*n.a-n.c*r.a)/i,u=n.region.r,a=r.region.r,f,l;if(u.y=l.region.r.x;if(c&&f.side==="l"||!c&&f.side==="r"){return null}return{x:s,y:o}},rightOf:function(e,t){var n=e.edge,r=n.region.r,i=t.x>r.x;if(i&&e.side==="l"){return 1}if(!i&&e.side==="r"){return 0}if(n.a===1){var s=t.y-r.y,o=t.x-r.x,u=0,a=0;if(!i&&n.b<0||i&&n.b>=0){a=u=s>=n.b*o}else{a=t.x+t.y*n.b>n.c;if(n.b<0){a=!a}if(!a){u=1}}if(!u){var f=r.x-n.region.l.x;a=n.b*(o*o-s*s)h*h+p*p}return e.side==="l"?a:!a},endPoint:function(e,n,r){e.ep[n]=r;if(!e.ep[Di[n]])return;t(e)},distance:function(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}};var s={list:[],insert:function(e,t,n){e.vertex=t;e.ystar=t.y+n;for(var r=0,i=s.list,o=i.length;ru.ystar||e.ystar==u.ystar&&t.x>u.vertex.x){continue}else{break}}i.splice(r,0,e)},del:function(e){for(var t=0,n=s.list,r=n.length;td.y){v=p;p=d;d=v;b="r"}y=i.bisect(p,d);h=r.createHalfEdge(y,b);r.insert(l,h);i.endPoint(y,Di[b],g);m=i.intersect(l,h);if(m){s.del(l);s.insert(l,m,i.distance(m,p))}m=i.intersect(h,c);if(m){s.insert(h,m,i.distance(m,p))}}else{break}}for(a=r.right(r.leftEnd);a!=r.rightEnd;a=r.right(a)){t(a.edge)}}function Hi(e){return e.x}function Bi(e){return e.y}function ji(){return{leaf:true,nodes:[],point:null,x:null,y:null}}function Fi(e,t,n,r,i,s){if(!e(t,n,r,i,s)){var o=(n+i)*.5,u=(r+s)*.5,a=t.nodes;if(a[0])Fi(e,a[0],n,r,o,u);if(a[1])Fi(e,a[1],o,r,i,u);if(a[2])Fi(e,a[2],n,u,o,s);if(a[3])Fi(e,a[3],o,u,i,s)}}function Ii(t,n){t=e.rgb(t);n=e.rgb(n);var r=t.r,i=t.g,s=t.b,o=n.r-r,u=n.g-i,a=n.b-s;return function(e){return"#"+zt(Math.round(r+o*e))+zt(Math.round(i+u*e))+zt(Math.round(s+a*e))}}function qi(e){var t=[e.a,e.b],n=[e.c,e.d],r=Ui(t),i=Ri(t,n),s=Ui(zi(n,t,-i))||0;if(t[0]*n[1]180)c+=360;else if(c-l>180)l+=360;i.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:Xi(l,c)})}else if(c){r.push(r.pop()+"rotate("+c+")")}if(h!=p){i.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:Xi(h,p)})}else if(p){r.push(r.pop()+"skewX("+p+")")}if(d[0]!=v[0]||d[1]!=v[1]){s=r.push(r.pop()+"scale(",null,",",null,")");i.push({i:s-4,x:Xi(d[0],v[0])},{i:s-2,x:Xi(d[1],v[1])})}else if(v[0]!=1||v[1]!=1){r.push(r.pop()+"scale("+v+")")}s=i.length;return function(e){var t=-1,n;while(++t=0&&!(i=e.interpolators[r](t,n)));return i}function Gi(e){return e=="transform"?Vi:Qi}function Yi(e,t){var n=[],r=[],i=e.length,s=t.length,o=Math.min(e.length,t.length),u;for(u=0;u=1?1:e(t)}}function rs(e){return function(t){return 1-e(1-t)}}function is(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function ss(e){return e*e}function os(e){return e*e*e}function us(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function as(e){return function(t){return Math.pow(t,e)}}function fs(e){return 1-Math.cos(e*dt/2)}function ls(e){return Math.pow(2,10*(e-1))}function cs(e){return 1-Math.sqrt(1-e*e)}function hs(e,t){var n;if(arguments.length<2)t=.45;if(arguments.length)n=t/(2*dt)*Math.asin(1/e);else e=1,n=t/4;return function(r){return 1+e*Math.pow(2,10*-r)*Math.sin((r-n)*2*dt/t)}}function ps(e){if(!e)e=1.70158;return function(t){return t*t*((e+1)*t-e)}}function ds(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function vs(t,n){t=e.hcl(t);n=e.hcl(n);var r=t.h,i=t.c,s=t.l,o=n.h-r,u=n.c-i,a=n.l-s;if(o>180)o-=360;else if(o<-180)o+=360;return function(e){return kt(r+o*e,i+u*e,s+a*e)+""}}function ms(t,n){t=e.hsl(t);n=e.hsl(n);var r=t.h,i=t.s,s=t.l,o=n.h-r,u=n.s-i,a=n.l-s;if(o>180)o-=360;else if(o<-180)o+=360;return function(e){return pt(r+o*e,i+u*e,s+a*e)+""}}function gs(t,n){t=e.lab(t);n=e.lab(n);var r=t.l,i=t.a,s=t.b,o=n.l-r,u=n.a-i,a=n.b-s;return function(e){return Ht(r+o*e,i+u*e,s+a*e)+""}}function ys(e,t){t-=e;return function(n){return Math.round(e+t*n)}}function bs(e,t){t=t-(e=+e)?1/(t-e):0;return function(n){return(n-e)*t}}function ws(e,t){t=t-(e=+e)?1/(t-e):0;return function(n){return Math.max(0,Math.min(1,(n-e)*t))}}function Es(e){var t=e.source,n=e.target,r=xs(t,n),i=[t];while(t!==r){t=t.parent;i.push(t)}var s=i.length;while(n!==r){i.splice(s,0,n);n=n.parent}return i}function Ss(e){var t=[],n=e.parent;while(n!=null){t.push(e);e=n;n=n.parent}t.push(e);return t}function xs(e,t){if(e===t)return e;var n=Ss(e),r=Ss(t),i=n.pop(),s=r.pop(),o=null;while(i===s){o=i;i=n.pop();s=r.pop()}return o}function Ts(e){e.fixed|=2}function Ns(e){e.fixed&=~6}function Cs(e){e.fixed|=4;e.px=e.x,e.py=e.y}function ks(e){e.fixed&=~4}function Ls(e,t,n){var r=0,i=0;e.charge=0;if(!e.leaf){var s=e.nodes,o=s.length,u=-1,a;while(++ur){n=t;r=i}}return n}function Xs(e){return e.reduce(Vs,0)}function Vs(e,t){return e+t[1]}function $s(e,t){return Js(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function Js(e,t){var n=-1,r=+e[0],i=(e[1]-r)/t,s=[];while(++n<=t)s[n]=i*n+r;return s}function Ks(t){return[e.min(t),e.max(t)]}function Qs(e,t){return e.parent==t.parent?1:2}function Gs(e){var t=e.children;return t&&t.length?t[0]:e._tree.thread}function Ys(e){var t=e.children,n;return t&&(n=t.length)?t[n-1]:e._tree.thread}function Zs(e,t){var n=e.children;if(n&&(i=n.length)){var r,i,s=-1;while(++s0){e=r}}}return e}function eo(e,t){return e.x-t.x}function to(e,t){return t.x-e.x}function no(e,t){return e.depth-t.depth}function ro(e,t){function n(e,r){var i=e.children;if(i&&(a=i.length)){var s,o=null,u=-1,a;while(++u=0){s=r[i]._tree;s.prelim+=t;s.mod+=t;t+=s.shift+(n+=s.change)}}function so(e,t,n){e=e._tree;t=t._tree;var r=n/(t.number-e.number);e.change+=r;t.change-=r;t.shift+=n;t.prelim+=n;t.mod+=n}function oo(e,t,n){return e._tree.ancestor.parent==t.parent?e._tree.ancestor:n}function uo(e,t){return e.value-t.value}function ao(e,t){var n=e._pack_next;e._pack_next=t;t._pack_prev=e;t._pack_next=n;n._pack_prev=t}function fo(e,t){e._pack_next=t;t._pack_prev=e}function lo(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return i*i-n*n-r*r>.001}function co(e){function p(e){n=Math.min(e.x-e.r,n);r=Math.max(e.x+e.r,r);i=Math.min(e.y-e.r,i);s=Math.max(e.y+e.r,s)}if(!(t=e.children)||!(h=t.length))return;var t,n=Infinity,r=-Infinity,i=Infinity,s=-Infinity,o,u,a,f,l,c,h;t.forEach(ho);o=t[0];o.x=-o.r;o.y=0;p(o);if(h>1){u=t[1];u.x=u.r;u.y=0;p(u);if(h>2){a=t[2];mo(o,u,a);p(a);ao(o,a);o._pack_prev=a;ao(a,u);u=o._pack_next;for(f=3;f2?ko:No,a=r?ws:bs;i=o(e,t,a,n);s=o(t,e,a,Qi);return u}function u(e){return i(e)}var i,s;u.invert=function(e){return s(e)};u.domain=function(t){if(!arguments.length)return e;e=t.map(Number);return o()};u.range=function(e){if(!arguments.length)return t;t=e;return o()};u.rangeRound=function(e){return u.range(e).interpolate(ys)};u.clamp=function(e){if(!arguments.length)return r;r=e;return o()};u.interpolate=function(e){if(!arguments.length)return n;n=e;return o()};u.ticks=function(t){return _o(e,t)};u.tickFormat=function(t,n){return Do(e,t,n)};u.nice=function(){Co(e,Oo);return o()};u.copy=function(){return Lo(e,t,n,r)};return o()}function Ao(t,n){return e.rebind(t,n,"range","rangeRound","interpolate","clamp")}function Oo(e){e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1);return e&&{floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}}}function Mo(e,t){var n=xo(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),s=t/r*i;if(s<=.15)i*=10;else if(s<=.35)i*=5;else if(s<=.75)i*=2;n[0]=Math.ceil(n[0]/i)*i;n[1]=Math.floor(n[1]/i)*i+i*.5;n[2]=i;return n}function _o(t,n){return e.range.apply(e,Mo(t,n))}function Do(t,n,r){var i=-Math.floor(Math.log(Mo(t,n)[2])/Math.LN10+.01);return e.format(r?r.replace(dn,function(e,t,n,r,s,o,u,a,f,l){return[t,n,r,s,o,u,a,f||"."+(i-(l==="%")*2),l].join("")}):",."+i+"f")}function Po(e,t,n,r){function i(t){return e(n(t))}i.invert=function(t){return r(e.invert(t))};i.domain=function(t){if(!arguments.length)return e.domain().map(r);if(t[0]<0)n=Fo,r=Io;else n=Bo,r=jo;e.domain(t.map(n));return i};i.base=function(e){if(!arguments.length)return t;t=+e;return i};i.nice=function(){e.domain(Co(e.domain(),qo(t)));return i};i.ticks=function(){var i=xo(e.domain()),s=[];if(i.every(isFinite)){var o=Math.log(t),u=Math.floor(i[0]/o),a=Math.ceil(i[1]/o),f=r(i[0]),l=r(i[1]),c=t%1?2:t;if(n===Fo){s.push(-Math.pow(t,-u));for(;u++0;h--)s.push(-Math.pow(t,-u)*h)}else{for(;ul;a--){}s=s.slice(u,a)}return s};i.tickFormat=function(e,s){if(arguments.length<2)s=Ho;if(!arguments.length)return s;var o=Math.log(t),u=Math.max(.1,e/i.ticks().length),a=n===Fo?(f=-1e-12,Math.floor):(f=1e-12,Math.ceil),f;return function(e){return e/r(o*a(n(e)/o+f))<=u?s(e):""}};i.copy=function(){return Po(e.copy(),t,n,r)};return Ao(i,e)}function Bo(e){return Math.log(e<0?0:e)}function jo(e){return Math.exp(e)}function Fo(e){return-Math.log(e>0?0:-e)}function Io(e){return-Math.exp(-e)}function qo(e){e=Math.log(e);var t={floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}};return function(){return t}}function Ro(e,t){function i(t){return e(n(t))}var n=Uo(t),r=Uo(1/t);i.invert=function(t){return r(e.invert(t))};i.domain=function(t){if(!arguments.length)return e.domain().map(r);e.domain(t.map(n));return i};i.ticks=function(e){return _o(i.domain(),e)};i.tickFormat=function(e,t){return Do(i.domain(),e,t)};i.nice=function(){return i.domain(Co(i.domain(),Oo))};i.exponent=function(e){if(!arguments.length)return t;var s=i.domain();n=Uo(t=e);r=Uo(1/t);return i.domain(s)};i.copy=function(){return Ro(e.copy(),t)};return Ao(i,e)}function Uo(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function zo(t,n){function o(e){return i[((r.get(e)||r.set(e,t.push(e)))-1)%i.length]}function u(n,r){return e.range(t.length).map(function(e){return n+r*e})}var r,i,s;o.domain=function(e){if(!arguments.length)return t;t=[];r=new c;var i=-1,s=e.length,u;while(++ir)return m();s.active=r;l.start.call(t,a,n);o.tween.forEach(function(e,r){if(r=r.call(t,a,n)){p.push(r)}});if(!v(i))e.timer(v,0,u);return 1}function v(e){if(s.active!==r)return m();var i=(e-c)/h,o=f(i),u=p.length;while(u>0){p[--u].call(t,o)}if(i>=1){m();l.end.call(t,a,n);return 1}}function m(){if(--s.count)delete s[r];else delete t.__transition__;return 1}var a=t.__data__,f=o.ease,l=o.event,c=o.delay,h=o.duration,p=[];return c<=i?d(i):e.timer(d,c,u),1},0,u);return o}}function Cu(e,t){e.attr("transform",function(e){return"translate("+t(e)+",0)"})}function ku(e,t){e.attr("transform",function(e){return"translate(0,"+t(e)+")"})}function Lu(e,t,n){i=[];if(n&&t.length>1){var r=xo(e.domain()),i,s=-1,o=t.length,u=(t[1]-t[0])/++n,a,f;while(++s0;){if((f=+t[s]-a*u)>=r[0]){i.push(f)}}}for(--s,a=0;++a1?Date.UTC.apply(this,arguments):arguments[0])}function Uu(e,t,n){function r(t){var n=e(t),r=s(n,1);return t-n1){while(o=a)return-1;i=t.charCodeAt(o++);if(i===37){s=na[t.charAt(o++)];if(!s||(r=s(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++)){return-1}}return r}function Xu(t){return new RegExp("^(?:"+t.map(e.requote).join("|")+")","i")}function Vu(e){var t=new c,n=-1,r=e.length;while(++n68?1900:2e3)}function pa(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.m=r[0]-1,n+=r[0].length):-1}function da(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.d=+r[0],n+=r[0].length):-1}function va(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.H=+r[0],n+=r[0].length):-1}function ma(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.M=+r[0],n+=r[0].length):-1}function ga(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.S=+r[0],n+=r[0].length):-1}function ya(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+3));return r?(e.L=+r[0],n+=r[0].length):-1}function wa(e,t,n){var r=Ea.get(t.substring(n,n+=2).toLowerCase());return r==null?-1:(e.p=r,n)}function Sa(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=~~(Math.abs(t)/60),i=Math.abs(t)%60;return n+$u(r,"0",2)+$u(i,"0",2)}function Ta(e){return e.toISOString()}function Na(t,n,r){function i(e){return t(e)}i.invert=function(e){return ka(t.invert(e))};i.domain=function(e){if(!arguments.length)return t.domain().map(ka);t.domain(e);return i};i.nice=function(e){return i.domain(Co(i.domain(),function(){return e}))};i.ticks=function(r,s){var o=Ca(i.domain());if(typeof r!=="function"){var u=o[1]-o[0],a=u/r,f=e.bisect(Ma,a);if(f==Ma.length)return n.year(o,r);if(!f)return t.ticks(r).map(ka);if(Math.log(a/Ma[f-1])t?1:e>=t?0:NaN};e.descending=function(e,t){return te?1:t>=e?0:NaN};e.min=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++ns)i=s}else{while(++ns)i=s}return i};e.max=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++ni)i=s}else{while(++ni)i=s}return i};e.extent=function(e,t){var n=-1,r=e.length,i,s,o;if(arguments.length===1){while(++ns)i=s;if(os)i=s;if(o1)t=t.map(n);t=t.filter(o);return t.length?e.quantile(t.sort(e.ascending),.5):undefined};e.bisector=function(e){return{left:function(t,n,r,i){if(arguments.length<3)r=0;if(arguments.length<4)i=t.length;while(r>>1;if(e.call(t,t[s],s)>>1;if(nt)r.push(o/i);else while((o=e+n*++s)=n.length)return s?s.call(t,r):i?r.sort(i):r;var a=-1,f=r.length,l=n[u++],h,p,d,v=new c,m;while(++a=n.length)return e;var i=[],s=r[t++];e.forEach(function(e,n){i.push({key:e,values:u(n,t)})});return s?i.sort(function(e,t){return s(e.key,t.key)}):i}var t={},n=[],r=[],i,s;t.map=function(e,t){return o(t,e,0)};t.entries=function(t){return u(o(e.map,t,0),0)};t.key=function(e){n.push(e);return t};t.sortKeys=function(e){r[n.length-1]=e;return t};t.sortValues=function(e){i=e;return t};t.rollup=function(e){s=e;return t};return t};e.set=function(e){var t=new d;if(e)for(var n=0;n=0){r=e.substring(n+1);e=e.substring(0,n)}if(e)return arguments.length<2?this[e].on(r):this[e].on(r,t);if(arguments.length===2){if(t==null)for(e in this){if(this.hasOwnProperty(e))this[e].on(r,null)}return this}};e.event=null;e.mouse=function(e){return T(e,w())};var x=/WebKit/.test(n.navigator.userAgent)?-1:0;var N=k;try{N(t.documentElement.childNodes)[0].nodeType}catch(L){N=C}var A=[].__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]};e.touches=function(e,t){if(arguments.length<2)t=w().touches;return t?N(t).map(function(t){var n=T(e,t);n.identifier=t.identifier;return n}):[]};e.behavior.drag=function(){function i(){this.on("mousedown.drag",s).on("touchstart.drag",s)}function s(){function h(){var t=i.parentNode;return u!=null?e.touches(t).filter(function(e){return e.identifier===u})[0]:e.mouse(t)}function p(){if(!i.parentNode)return d();var e=h(),t=e[0]-f[0],n=e[1]-f[1];l|=t|n;f=e;y();s({type:"drag",x:e[0]+a[0],y:e[1]+a[1],dx:t,dy:n})}function d(){s({type:"dragend"});if(l){y();if(e.event.target===o)E(c,"click")}c.on(u!=null?"touchmove.drag-"+u:"mousemove.drag",null).on(u!=null?"touchend.drag-"+u:"mouseup.drag",null)}var i=this,s=t.of(i,arguments),o=e.event.target,u=e.event.touches?e.event.changedTouches[0].identifier:null,a,f=h(),l=0;var c=e.select(n).on(u!=null?"touchmove.drag-"+u:"mousemove.drag",p).on(u!=null?"touchend.drag-"+u:"mouseup.drag",d,true);if(r){a=r.apply(i,arguments);a=[a.x-f[0],a.y-f[1]]}else{a=[0,0]}if(u==null)y();s({type:"dragstart"})}var t=S(i,"drag","dragstart","dragend"),r=null;i.origin=function(e){if(!arguments.length)return r;r=e;return i};return e.rebind(i,t,"on")};var M=function(e,t){return t.querySelector(e)},_=function(e,t){return t.querySelectorAll(e)},D=t.documentElement,P=D.matchesSelector||D.webkitMatchesSelector||D.mozMatchesSelector||D.msMatchesSelector||D.oMatchesSelector,H=function(e,t){return P.call(e,t)};if(typeof Sizzle==="function"){M=function(e,t){return Sizzle(e,t)[0]||null};_=function(e,t){return Sizzle.uniqueSort(Sizzle(e,t))};H=Sizzle.matchesSelector}var B=[];e.selection=function(){return st};e.selection.prototype=B;B.select=function(e){var t=[],n,r,i,s;if(typeof e!=="function")e=j(e);for(var o=-1,u=this.length;++o=0){n=e.substring(0,t);e=e.substring(t+1)}return I.hasOwnProperty(n)?{space:I[n],local:e}:e}};B.attr=function(t,n){if(arguments.length<2){if(typeof t==="string"){var r=this.node();t=e.ns.qualify(t);return t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(n in t)this.each(q(n,t[n]));return this}return this.each(q(t,n))};e.requote=function(e){return e.replace(U,"\\$&")};var U=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;B.classed=function(e,t){if(arguments.length<2){if(typeof e==="string"){var n=this.node(),r=(e=e.trim().split(/^|\s+/g)).length,i=-1;if(t=n.classList){while(++i=0;){if(s=n[r]){if(i&&i!==s.nextSibling)i.parentNode.insertBefore(s,i);i=s}}}return this};B.sort=function(e){e=Q.apply(this,arguments);for(var t=-1,n=this.length;++t=200&&e<300||e===304?o.load.call(s,a.call(s,f)):o.error.call(s,f)}var s={},o=e.dispatch("progress","load","error"),u={},a=Gt,f=new(n.XDomainRequest&&/^(http(s)?:)?\/\//.test(t)?XDomainRequest:XMLHttpRequest);"onload"in f?f.onload=f.onerror=l:f.onreadystatechange=function(){f.readyState>3&&l()};f.onprogress=function(t){var n=e.event;e.event=t;try{o.progress.call(s,f)}finally{e.event=n}};s.header=function(e,t){e=(e+"").toLowerCase();if(arguments.length<2)return u[e];if(t==null)delete u[e];else u[e]=t+"";return s};s.mimeType=function(e){if(!arguments.length)return r;r=e==null?null:e+"";return s};s.response=function(e){a=e;return s};["get","post"].forEach(function(e){s[e]=function(){return s.send.apply(s,[e].concat(N(arguments)))}});s.send=function(e,n,i){if(arguments.length===2&&typeof n==="function")i=n,n=null;f.open(e,t,true);if(r!=null&&!("accept"in u))u["accept"]=r+",*/*";if(f.setRequestHeader)for(var o in u)f.setRequestHeader(o,u[o]);if(r!=null&&f.overrideMimeType)f.overrideMimeType(r);if(i!=null)s.on("error",i).on("load",function(e){i(null,e)});f.send(n==null?null:n);return s};s.abort=function(){f.abort();return s};e.rebind(s,o,"on");if(arguments.length===2&&typeof r==="function")i=r,r=null;return i==null?s:s.get(Yt(i))};e.csv=Zt(",","text/csv");e.tsv=Zt(" ","text/tab-separated-values");var en=0,tn={},nn=null,rn,sn;e.timer=function(e,t,n){if(arguments.length<3){if(arguments.length<2)t=0;else if(!isFinite(t))return;n=Date.now()}var r=tn[e.id];if(r&&r.callback===e){r.then=n;r.delay=t}else tn[e.id=++en]=nn={callback:e,then:n,delay:t,next:nn};if(!rn){sn=clearTimeout(sn);rn=1;an(on)}};e.timer.flush=function(){var e,t=Date.now(),n=nn;while(n){e=t-n.then;if(!n.delay)n.flush=n.callback(e);n=n.next}un()};var an=n.requestAnimationFrame||n.webkitRequestAnimationFrame||n.mozRequestAnimationFrame||n.oRequestAnimationFrame||n.msRequestAnimationFrame||function(e){setTimeout(e,17)};var fn=".",ln=",",cn=[3,3];var hn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(pn);e.formatPrefix=function(t,n){var r=0;if(t){if(t<0)t*=-1;if(n)t=e.round(t,mn(t,n));r=1+Math.floor(1e-12+Math.log(t)/Math.LN10);r=Math.max(-24,Math.min(24,Math.floor((r<=0?r+1:r-1)/3)*3))}return hn[8+r/3]};e.round=function(e,t){return t?Math.round(e*(t=Math.pow(10,t)))/t:Math.round(e)};e.format=function(t){var n=dn.exec(t),r=n[1]||" ",i=n[2]||">",s=n[3]||"",o=n[4]||"",u=n[5],a=+n[6],f=n[7],l=n[8],c=n[9],h=1,p="",d=false;if(l)l=+l.substring(1);if(u||r==="0"&&i==="="){u=r="0";i="=";if(f)a-=Math.floor((a-1)/4)}switch(c){case"n":f=true;c="g";break;case"%":h=100;p="%";c="f";break;case"p":h=100;p="%";c="r";break;case"b":case"o":case"x":case"X":if(o)o="0"+c.toLowerCase();case"c":case"d":d=true;l=0;break;case"s":h=-1;c="r";break}if(o==="#")o="";if(c=="r"&&!l)c="g";if(l!=null){if(c=="g")l=Math.max(1,Math.min(21,l));else if(c=="e"||c=="f")l=Math.max(0,Math.min(20,l))}c=vn.get(c)||gn;var v=u&&f;return function(t){if(d&&t%1)return"";var n=t<0||t===0&&1/t<0?(t=-t,"-"):s;if(h<0){var m=e.formatPrefix(t,l);t=m.scale(t);p=m.symbol}else{t*=h}t=c(t,l);if(!u&&f)t=yn(t);var g=o.length+t.length+(v?0:n.length),y=g"?y+n+t:i==="^"?y.substring(0,g>>=1)+n+t+y.substring(g):n+(v?t:y+t))+p}};var dn=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i;var vn=e.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(t,n){return(t=e.round(t,mn(t,n))).toFixed(Math.max(0,Math.min(20,mn(t*(1+1e-15),n))))}});var yn=Gt;if(cn){var bn=cn.length;yn=function(e){var t=e.lastIndexOf("."),n=t>=0?"."+e.substring(t+1):(t=e.length,""),r=[],i=0,s=cn[0];while(t>0&&s>0){r.push(e.substring(t-=s,t+s));s=cn[i=(i+1)%bn]}return r.reverse().join(ln||"")+n}}e.geo={};e.geo.stream=function(e,t){if(e&&En.hasOwnProperty(e.type)){En[e.type](e,t)}else{wn(e,t)}};var En={Feature:function(e,t){wn(e.geometry,t)},FeatureCollection:function(e,t){var n=e.features,r=-1,i=n.length;while(++rvt){return[Math.atan2(Pn,Dn)*gt,Math.asin(Math.max(-1,Math.min(1,Hn/n)))*gt]}};var Mn,_n,Dn,Pn,Hn;var Bn={sphere:function(){if(Mn<2){Mn=2;_n=Dn=Pn=Hn=0}},point:jn,lineStart:In,lineEnd:qn,polygonStart:function(){if(Mn<2){Mn=2;_n=Dn=Pn=Hn=0}Bn.lineStart=Fn},polygonEnd:function(){Bn.lineStart=In}};var rr=Yn($n,ir,or);var ar=1e9;e.geo.projection=pr;e.geo.projectionMutator=dr;(e.geo.equirectangular=function(){return pr(mr)}).raw=mr.invert=mr;e.geo.rotation=function(e){function t(t){t=e(t[0]*mt,t[1]*mt);return t[0]*=gt,t[1]*=gt,t}e=gr(e[0]%360*mt,e[1]*mt,e.length>2?e[2]*mt:0);t.invert=function(t){t=e.invert(t[0]*mt,t[1]*mt);return t[0]*=gt,t[1]*=gt,t};return t};e.geo.circle=function(){function i(){var t=typeof e==="function"?e.apply(this,arguments):e,n=gr(-t[0]*mt,-t[1]*mt,0).invert,i=[];r(null,null,1,{point:function(e,t){i.push(e=n(e,t));e[0]*=gt,e[1]*=gt}});return{type:"Polygon",coordinates:[i]}}var e=[0,0],t,n=6,r;i.origin=function(t){if(!arguments.length)return e;e=t;return i};i.angle=function(e){if(!arguments.length)return t;r=Er((t=+e)*mt,n*mt);return i};i.precision=function(e){if(!arguments.length)return n;r=Er(t*mt,(n=+e)*mt);return i};return i.angle(90)};e.geo.distance=function(e,t){var n=(t[0]-e[0])*mt,r=e[1]*mt,i=t[1]*mt,s=Math.sin(n),o=Math.cos(n),u=Math.sin(r),a=Math.cos(r),f=Math.sin(i),l=Math.cos(i),c;return Math.atan2(Math.sqrt((c=l*s)*c+(c=a*f-u*l*o)*c),u*f+a*l*o)};e.geo.graticule=function(){function y(){return{type:"MultiLineString",coordinates:b()}}function b(){return e.range(Math.ceil(i/c)*c,r,c).map(v).concat(e.range(Math.ceil(a/h)*h,u,h).map(m)).concat(e.range(Math.ceil(n/f)*f,t,f).filter(function(e){return Math.abs(e%c)>vt}).map(p)).concat(e.range(Math.ceil(o/l)*l,s,l).filter(function(e){return Math.abs(e%h)>vt}).map(d))}var t,n,r,i,s,o,u,a,f=10,l=f,c=90,h=360,p,d,v,m,g=2.5;y.lines=function(){return b().map(function(e){return{type:"LineString",coordinates:e}})};y.outline=function(){return{type:"Polygon",coordinates:[v(i).concat(m(u).slice(1),v(r).reverse().slice(1),m(a).reverse().slice(1))]}};y.extent=function(e){if(!arguments.length)return y.minorExtent();return y.majorExtent(e).minorExtent(e)};y.majorExtent=function(e){if(!arguments.length)return[[i,a],[r,u]];i=+e[0][0],r=+e[1][0];a=+e[0][1],u=+e[1][1];if(i>r)e=i,i=r,r=e;if(a>u)e=a,a=u,u=e;return y.precision(g)};y.minorExtent=function(e){if(!arguments.length)return[[n,o],[t,s]];n=+e[0][0],t=+e[1][0];o=+e[0][1],s=+e[1][1];if(n>t)e=n,n=t,t=e;if(o>s)e=o,o=s,s=e;return y.precision(g)};y.step=function(e){if(!arguments.length)return y.minorStep();return y.majorStep(e).minorStep(e)};y.majorStep=function(e){if(!arguments.length)return[c,h];c=+e[0],h=+e[1];return y};y.minorStep=function(e){if(!arguments.length)return[f,l];f=+e[0],l=+e[1];return y};y.precision=function(e){if(!arguments.length)return g;g=+e;p=xr(o,s,90);d=Tr(n,t,g);v=xr(a,u,90);m=Tr(i,r,g);return y};return y.majorExtent([[-180,-90+vt],[180,90-vt]]).minorExtent([[-180,-80-vt],[180,80+vt]])};e.geo.greatArc=function(){function s(){return{type:"LineString",coordinates:[n||t.apply(this,arguments),i||r.apply(this,arguments)]}}var t=Nr,n,r=Cr,i;s.distance=function(){return e.geo.distance(n||t.apply(this,arguments),i||r.apply(this,arguments))};s.source=function(e){if(!arguments.length)return t;t=e,n=typeof e==="function"?null:e;return s};s.target=function(e){if(!arguments.length)return r;r=e,i=typeof e==="function"?null:e;return s};s.precision=function(){return arguments.length?s:0};return s};e.geo.interpolate=function(e,t){return kr(e[0]*mt,e[1]*mt,t[0]*mt,t[1]*mt)};e.geo.length=function(t){Lr=0;e.geo.stream(t,Ar);return Lr};var Lr;var Ar={sphere:G,point:G,lineStart:Or,lineEnd:G,polygonStart:G,polygonEnd:G};(e.geo.conicEqualArea=function(){return Mr(_r)}).raw=_r;e.geo.albersUsa=function(){function a(e){return f(e)(e)}function f(e){var s=e[0],o=e[1];return o>50?n:s<-140?r:o<21?i:t}var t=e.geo.conicEqualArea().rotate([98,0]).center([0,38]).parallels([29.5,45.5]);var n=e.geo.conicEqualArea().rotate([160,0]).center([0,60]).parallels([55,65]);var r=e.geo.conicEqualArea().rotate([160,0]).center([0,20]).parallels([8,18]);var i=e.geo.conicEqualArea().rotate([60,0]).center([0,10]).parallels([8,18]);var s,o,u;a.invert=function(e){return s(e)||o(e)||u(e)||t.invert(e)};a.scale=function(e){if(!arguments.length)return t.scale();t.scale(e);n.scale(e*.6);r.scale(e);i.scale(e*1.5);return a.translate(t.translate())};a.translate=function(e){if(!arguments.length)return t.translate();var f=t.scale(),l=e[0],c=e[1];t.translate(e);n.translate([l-.4*f,c+.17*f]);r.translate([l-.19*f,c+.2*f]);i.translate([l+.58*f,c+.43*f]);s=Dr(n,[[-180,50],[-130,72]]);o=Dr(r,[[-164,18],[-154,24]]);u=Dr(i,[[-67.5,17.5],[-65,19]]);return a};return a.scale(1e3)};var Pr,Hr,Br={point:G,lineStart:G,lineEnd:G,polygonStart:function(){Hr=0;Br.lineStart=jr},polygonEnd:function(){Br.lineStart=Br.lineEnd=Br.point=G;Pr+=Math.abs(Hr/2)}};var Ir={point:qr,lineStart:Rr,lineEnd:Ur,polygonStart:function(){Ir.lineStart=zr},polygonEnd:function(){Ir.point=qr;Ir.lineStart=Rr;Ir.lineEnd=Ur}};e.geo.path=function(){function o(n){if(n)e.geo.stream(n,i(s.pointRadius(typeof t==="function"?+t.apply(this,arguments):t)));return s.result()}var t=4.5,n,r,i,s;o.area=function(t){Pr=0;e.geo.stream(t,i(Br));return Pr};o.centroid=function(t){Mn=Dn=Pn=Hn=0;e.geo.stream(t,i(Ir));return Hn?[Dn/Hn,Pn/Hn]:undefined};o.bounds=function(e){return On(i)(e)};o.projection=function(e){if(!arguments.length)return n;i=(n=e)?e.stream||Vr(e):Gt;return o};o.context=function(e){if(!arguments.length)return r;s=(r=e)==null?new Fr:new Wr(e);return o};o.pointRadius=function(e){if(!arguments.length)return t;t=typeof e==="function"?e:+e;return o};return o.projection(e.geo.albersUsa()).context(null)};e.geo.albers=function(){return e.geo.conicEqualArea().parallels([29.5,45.5]).rotate([98,0]).center([0,38]).scale(1e3)};var Jr=$r(function(e){return Math.sqrt(2/(1+e))},function(e){return 2*Math.asin(e/2)});(e.geo.azimuthalEqualArea=function(){return pr(Jr)}).raw=Jr;var Kr=$r(function(e){var t=Math.acos(e);return t&&t/Math.sin(t)},Gt);(e.geo.azimuthalEquidistant=function(){return pr(Kr)}).raw=Kr;(e.geo.conicConformal=function(){return Mr(Qr)}).raw=Qr;(e.geo.conicEquidistant=function(){return Mr(Gr)}).raw=Gr;var Yr=$r(function(e){return 1/e},Math.atan);(e.geo.gnomonic=function(){return pr(Yr)}).raw=Yr;Zr.invert=function(e,t){return[e,2*Math.atan(Math.exp(t))-dt/2]};(e.geo.mercator=function(){return ei(Zr)}).raw=Zr;var ti=$r(function(){return 1},Math.asin);(e.geo.orthographic=function(){return pr(ti)}).raw=ti;var ni=$r(function(e){return 1/(1+e)},function(e){return 2*Math.atan(e)});(e.geo.stereographic=function(){return pr(ni)}).raw=ni;ri.invert=function(e,t){return[Math.atan2(Et(e),Math.cos(t)),wt(Math.sin(t)/St(e))]};(e.geo.transverseMercator=function(){return ei(ri)}).raw=ri;e.geom={};e.svg={};e.svg.line=function(){return ii(Gt)};var ui=e.map({linear:ai,"linear-closed":fi,"step-before":li,"step-after":ci,basis:gi,"basis-open":yi,"basis-closed":bi,bundle:wi,cardinal:di,"cardinal-open":hi,"cardinal-closed":pi,monotone:Ai});ui.forEach(function(e,t){t.key=e;t.closed=/-closed$/.test(e)});var Si=[0,2/3,1/3,0],xi=[0,1/3,2/3,0],Ti=[0,1/6,2/3,1/6];e.geom.hull=function(e){function r(e){if(e.length<3)return[];var r=Qt(t),i=Qt(n),s=e.length,o,u=s-1,a=[],f=[],l,c,h,p=0,d,v,m,g,y,b,w,E;if(r===si&&n===oi)o=e;else for(c=0,o=[];c=m*m+g*g){a[c].index=-1}else{a[y].index=-1;w=a[c].angle;y=c;b=h}}else{w=a[c].angle;y=c;b=h}}f.push(p);for(c=0,h=0;c<2;++h){if(a[h].index!==-1){f.push(a[h].index);c++}}E=f.length;for(;h=0){t=e.ep.r;n=e.ep.l}else{t=e.ep.l;n=e.ep.r}if(e.a===1){s=t?t.y:-h;r=e.c-e.b*s;u=n?n.y:h;i=e.c-e.b*u}else{r=t?t.x:-h;s=e.c-e.a*r;i=n?n.x:h;u=e.c-e.a*i}var a=[r,s],f=[i,u];o[e.region.l.index].push(a,f);o[e.region.r.index].push(a,f)});o=o.map(function(t,r){var i=n[r][0],s=n[r][1],o=t.map(function(e){return Math.atan2(e[0]-i,e[1]-s)}),u=e.range(t.length).sort(function(e,t){return o[e]-o[t]});return u.filter(function(e,t){return!t||o[e]-o[u[t-1]]>vt}).map(function(e){return t[e]})});o.forEach(function(e,t){var r=e.length;if(!r)return e.push([-h,-h],[-h,h],[h,h],[h,-h]);if(r>2)return;var i=n[t],s=e[0],o=e[1],u=i[0],a=i[1],f=s[0],l=s[1],c=o[0],p=o[1],d=Math.abs(c-f),v=p-l;if(Math.abs(v)0)m*=-1;e.push([-h,m],[h,m])}}});if(s)for(l=0;l=a,c=r>=f,h=(c<<1)+l;e.leaf=false;e=e.nodes[h]||(e.nodes[h]=ji());if(l)i=a;else o=a;if(c)s=f;else u=f;x(e,t,n,r,i,s,o,u)}var a,f=Qt(s),l=Qt(o),c,h,p,d,v,m,g,y;if(t!=null){v=t,m=n,g=r,y=i}else{g=y=-(v=m=Infinity);c=[],h=[];d=e.length;if(u)for(p=0;pg)g=a.x;if(a.y>y)y=a.y;c.push(a.x);h.push(a.y)}else for(p=0;pg)g=b;if(w>y)y=w;c.push(b);h.push(w)}}var E=g-v,S=y-m;if(E>S)y=m+E;else g=v+S;var N=ji();N.add=function(e){x(N,e,+f(e,++p),+l(e,p),v,m,g,y)};N.visit=function(e){Fi(e,N,v,m,g,y)};p=-1;if(t==null){while(++p=0?e.substring(0,t):e,r=t>=0?e.substring(t+1):"in";n=es.get(n)||Zi;r=ts.get(r)||Gt;return ns(r(n.apply(null,Array.prototype.slice.call(arguments,1))))};e.interpolateHcl=vs;e.interpolateHsl=ms;e.interpolateLab=gs;e.interpolateRound=ys;e.layout={};e.layout.bundle=function(){return function(e){var t=[],n=-1,r=e.length;while(++n0)s=r;else s=0}else if(r>0){n.start({type:"start",alpha:s=r});e.timer(t.tick)}return t};t.start=function(){function y(t,n){var r=b(e),i=-1,s=r.length,o;while(++ii)i=u;r.push(u)}for(o=0;o0){o=-1;while(++o=f[0]&&v<=f[1]){c=u[e.bisect(l,v,1,p)-1];c.y+=d;c.push(s[o])}}}return u}var t=true,n=Number,r=Ks,i=$s;s.value=function(e){if(!arguments.length)return n;n=e;return s};s.range=function(e){if(!arguments.length)return r;r=Qt(e);return s};s.bins=function(e){if(!arguments.length)return i;i=typeof e==="number"?function(t){return Js(t,e)}:Qt(e);return s};s.frequency=function(e){if(!arguments.length)return t;t=!!e;return s};return s};e.layout.tree=function(){function i(e,i){function u(e,t){var r=e.children,i=e._tree;if(r&&(s=r.length)){var s,o=r[0],a,l=o,c,h=-1;while(++h0){so(oo(o,e,r),e,h);a+=h;f+=h}l+=o._tree.mod;a+=i._tree.mod;c+=u._tree.mod;f+=s._tree.mod}if(o&&!Ys(s)){s._tree.thread=o;s._tree.mod+=l-f}if(i&&!Gs(u)){u._tree.thread=i;u._tree.mod+=a-c;r=e}}return r}var s=t.call(this,e,i),o=s[0];ro(o,function(e,t){e._tree={ancestor:e,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}});u(o);a(o,-o._tree.prelim);var l=Zs(o,to),c=Zs(o,eo),h=Zs(o,no),p=l.x-n(l,c)/2,d=c.x+n(c,l)/2,v=h.depth||1;ro(o,function(e){e.x=(e.x-p)/(d-p)*r[0];e.y=e.depth/v*r[1];delete e._tree});return s}var t=e.layout.hierarchy().sort(null).value(null),n=Qs,r=[1,1];i.separation=function(e){if(!arguments.length)return n;n=e;return i};i.size=function(e){if(!arguments.length)return r;r=e;return i};return Ms(i,t)};e.layout.pack=function(){function i(e,i){var s=t.call(this,e,i),o=s[0];o.x=0;o.y=0;ro(o,function(e){e.r=Math.sqrt(e.value)});ro(o,co);var u=r[0],a=r[1],f=Math.max(2*o.r/u,2*o.r/a);if(n>0){var l=n*f/2;ro(o,function(e){e.r+=l});ro(o,co);ro(o,function(e){e.r-=l});f=Math.max(2*o.r/u,2*o.r/a)}vo(o,u/2,a/2,1/f);return s}var t=e.layout.hierarchy().sort(uo),n=0,r=[1,1];i.size=function(e){if(!arguments.length)return r;r=e;return i};i.padding=function(e){if(!arguments.length)return n;n=+e;return i};return Ms(i,t)};e.layout.cluster=function(){function i(e,i){var s=t.call(this,e,i),o=s[0],u,a=0;ro(o,function(e){var t=e.children;if(t&&t.length){e.x=yo(t);e.y=go(t)}else{e.x=u?a+=n(e,u):0;e.y=0;u=e}});var f=bo(o),l=wo(o),c=f.x-n(f,l)/2,h=l.x+n(l,f)/2;ro(o,function(e){e.x=(e.x-c)/(h-c)*r[0];e.y=(1-(o.y?e.y/o.y:1))*r[1]});return s}var t=e.layout.hierarchy().sort(null).value(null),n=Qs,r=[1,1];i.separation=function(e){if(!arguments.length)return n;n=e;return i};i.size=function(e){if(!arguments.length)return r;r=e;return i};return Ms(i,t)};e.layout.treemap=function(){function l(e,t){var n=-1,r=e.length,i,s;while(++n0){r.push(o=i[v-1]);r.area+=o.area;if(a!=="squarify"||(f=p(r,h))<=u){i.pop();u=f}else{r.area-=r.pop().area;d(r,h,n,false);h=Math.min(n.dx,n.dy);r.length=r.area=0;u=Infinity}}if(r.length){d(r,h,n,true);r.length=r.area=0}t.forEach(c)}}function h(e){var t=e.children;if(t&&t.length){var n=s(e),r=t.slice(),i,o=[];l(r,n.dx*n.dy/e.value);o.area=0;while(i=r.pop()){o.push(i);o.area+=i.area;if(i.z!=null){d(o,i.z?n.dx:n.dy,n,!r.length);o.length=o.area=0}}t.forEach(h)}}function p(e,t){var n=e.area,r,i=0,s=Infinity,o=-1,u=e.length;while(++oi)i=r}n*=n;t*=t;return n?Math.max(t*i*f/n,n/(t*s*f)):Infinity}function d(e,t,r,i){var s=-1,o=e.length,u=r.x,a=r.y,f=t?n(e.area/t):0,l;if(t==r.dx){if(i||f>r.dy)f=r.dy;while(++sr.dx)f=r.dx;while(++s1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=e.random.normal.apply(e,arguments);return function(){return Math.exp(t())}},irwinHall:function(e){return function(){for(var t=0,n=0;n=eu?i?"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"M0,"+i+"A"+i+","+i+" 0 1,0 0,"+ -i+"A"+i+","+i+" 0 1,0 0,"+i+"Z":"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"Z":i?"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L"+i*h+","+i*p+"A"+i+","+i+" 0 "+f+",0 "+i*l+","+i*c+"Z":"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L0,0"+"Z"}var e=tu,t=nu,n=ru,r=iu;i.innerRadius=function(t){if(!arguments.length)return e;e=Qt(t);return i};i.outerRadius=function(e){if(!arguments.length)return t;t=Qt(e);return i};i.startAngle=function(e){if(!arguments.length)return n;n=Qt(e);return i};i.endAngle=function(e){if(!arguments.length)return r;r=Qt(e);return i};i.centroid=function(){var i=(e.apply(this,arguments)+t.apply(this,arguments))/2,s=(n.apply(this,arguments)+r.apply(this,arguments))/2+Zo;return[Math.cos(s)*i,Math.sin(s)*i]};return i};var Zo=-dt/2,eu=2*dt-1e-6;e.svg.line.radial=function(){var e=ii(su);e.radius=e.x,delete e.x;e.angle=e.y,delete e.y;return e};li.reverse=ci;ci.reverse=li;e.svg.area=function(){return ou(Gt)};e.svg.area.radial=function(){var e=ou(su);e.radius=e.x,delete e.x;e.innerRadius=e.x0,delete e.x0;e.outerRadius=e.x1,delete e.x1;e.angle=e.y,delete e.y;e.startAngle=e.y0,delete e.y0;e.endAngle=e.y1,delete e.y1;return e};e.svg.chord=function(){function s(n,r){var i=o(this,e,n,r),s=o(this,t,n,r);return"M"+i.p0+a(i.r,i.p1,i.a1-i.a0)+(u(i,s)?f(i.r,i.p1,i.r,i.p0):f(i.r,i.p1,s.r,s.p0)+a(s.r,s.p1,s.a1-s.a0)+f(s.r,s.p1,i.r,i.p0))+"Z"}function o(e,t,s,o){var u=t.call(e,s,o),a=n.call(e,u,o),f=r.call(e,u,o)+Zo,l=i.call(e,u,o)+Zo;return{r:a,a0:f,a1:l,p0:[a*Math.cos(f),a*Math.sin(f)],p1:[a*Math.cos(l),a*Math.sin(l)]}}function u(e,t){return e.a0==t.a0&&e.a1==t.a1}function a(e,t,n){return"A"+e+","+e+" 0 "+ +(n>dt)+",1 "+t}function f(e,t,n,r){return"Q 0,0 "+r}var e=Nr,t=Cr,n=uu,r=ru,i=iu;s.radius=function(e){if(!arguments.length)return n;n=Qt(e);return s};s.source=function(t){if(!arguments.length)return e;e=Qt(t);return s};s.target=function(e){if(!arguments.length)return t;t=Qt(e);return s};s.startAngle=function(e){if(!arguments.length)return r;r=Qt(e);return s};s.endAngle=function(e){if(!arguments.length)return i;i=Qt(e);return s};return s};e.svg.diagonal=function(){function r(r,i){var s=e.call(this,r,i),o=t.call(this,r,i),u=(s.y+o.y)/2,a=[s,{x:s.x,y:u},{x:o.x,y:u},o];a=a.map(n);return"M"+a[0]+"C"+a[1]+" "+a[2]+" "+a[3]}var e=Nr,t=Cr,n=au;r.source=function(t){if(!arguments.length)return e;e=Qt(t);return r};r.target=function(e){if(!arguments.length)return t;t=Qt(e);return r};r.projection=function(e){if(!arguments.length)return n;n=e;return r};return r};e.svg.diagonal.radial=function(){var t=e.svg.diagonal(),n=au,r=t.projection;t.projection=function(e){return arguments.length?r(fu(n=e)):n};return t};e.svg.symbol=function(){function n(n,r){return(pu.get(e.call(this,n,r))||hu)(t.call(this,n,r))}var e=cu,t=lu;n.type=function(t){if(!arguments.length)return e;e=Qt(t);return n};n.size=function(e){if(!arguments.length)return t;t=Qt(e);return n};return n};var pu=e.map({circle:hu,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+ -3*t+","+ -t+"H"+ -t+"V"+ -3*t+"H"+t+"V"+ -t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+ -t+"V"+t+"H"+ -3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*vu)),n=t*vu;return"M0,"+ -t+"L"+n+",0"+" 0,"+t+" "+ -n+",0"+"Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+ -t+","+ -t+"L"+t+","+ -t+" "+t+","+t+" "+ -t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/du),n=t*du/2;return"M0,"+n+"L"+t+","+ -n+" "+ -t+","+ -n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/du),n=t*du/2;return"M0,"+ -n+"L"+t+","+n+" "+ -t+","+n+"Z"}});e.svg.symbolTypes=pu.keys();var du=Math.sqrt(3),vu=Math.tan(30*mt);var gu=[],yu=0,bu,wu={ease:us,delay:0,duration:250};gu.call=B.call;gu.empty=B.empty;gu.node=B.node;e.transition=function(e){return arguments.length?bu?e.transition():e:st.transition()};e.transition.prototype=gu;gu.select=function(e){var t=this.id,n=[],r,i,s;if(typeof e!=="function")e=j(e);for(var o=-1,u=this.length;++o1?+t:r;s=n>0?+arguments[n]:r;return c};c.tickPadding=function(e){if(!arguments.length)return o;o=+e;return c};c.tickSubdivide=function(e){if(!arguments.length)return l;l=+e;return c};return c};var Tu="bottom",Nu={top:1,right:1,bottom:1,left:1};e.svg.brush=function(){function a(t){t.each(function(){var t=e.select(this),n=t.selectAll(".background").data([0]),o=t.selectAll(".extent").data([0]),u=t.selectAll(".resize").data(s,String),p;t.style("pointer-events","all").on("mousedown.brush",h).on("touchstart.brush",h);n.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair");o.enter().append("rect").attr("class","extent").style("cursor","move");u.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return Au[e]}).append("rect").attr("x",function(e){return/[ew]$/.test(e)?-3:null}).attr("y",function(e){return/^[ns]/.test(e)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden");u.style("display",a.empty()?"none":null);u.exit().remove();if(r){p=To(r);n.attr("x",p[0]).attr("width",p[1]-p[0]);l(t)}if(i){p=To(i);n.attr("y",p[0]).attr("height",p[1]-p[0]);c(t)}f(t)})}function f(e){e.selectAll(".resize").attr("transform",function(e){return"translate("+o[+/e$/.test(e)][0]+","+o[+/^s/.test(e)][1]+")"})}function l(e){e.select(".extent").attr("x",o[0][0]);e.selectAll(".extent,.n>rect,.s>rect").attr("width",o[1][0]-o[0][0])}function c(e){e.select(".extent").attr("y",o[0][1]);e.selectAll(".extent,.e>rect,.w>rect").attr("height",o[1][1]-o[0][1])}function h(){function C(){var t=e.event.changedTouches;return t?e.touches(s,t)[0]:e.mouse(s)}function k(){if(e.event.keyCode==32){if(!b){w=null;E[0]-=o[1][0];E[1]-=o[1][1];b=2}y()}}function L(){if(e.event.keyCode==32&&b==2){E[0]+=o[1][0];E[1]+=o[1][1];b=0;y()}}function A(){var t=C(),n=false;if(S){t[0]+=S[0];t[1]+=S[1]}if(!b){if(e.event.altKey){if(!w)w=[(o[0][0]+o[1][0])/2,(o[0][1]+o[1][1])/2];E[0]=o[+(t[0]=12?"PM":"AM"},S:function(e,t){return $u(e.getSeconds(),t,2)},U:function(t,n){return $u(e.time.sundayOfYear(t),n,2)},w:function(e){return e.getDay()},W:function(t,n){return $u(e.time.mondayOfYear(t),n,2)},x:e.time.format(Bu),X:e.time.format(ju),y:function(e,t){return $u(e.getFullYear()%100,t,2)},Y:function(e,t){return $u(e.getFullYear()%1e4,t,4)},Z:Sa,"%":function(){return"%"}};var na={a:ra,A:ia,b:sa,B:oa,c:ua,d:da,e:da,H:va,I:va,L:ya,m:pa,M:ma,p:wa,S:ga,x:aa,X:fa,y:ca,Y:la};var ba=/^\s*\d+/;var Ea=e.map({am:0,pm:1});e.time.format.utc=function(t){function r(e){try{Mu=Du;var t=new Mu;t._=e;return n(t)}finally{Mu=Date}}var n=e.time.format(t);r.parse=function(e){try{Mu=Du;var t=n.parse(e);return t&&t._}finally{Mu=Date}};r.toString=n.toString;return r};var xa=e.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");e.time.format.iso=Date.prototype.toISOString&&+(new Date("2000-01-01T00:00:00.000Z"))?Ta:xa;Ta.parse=function(e){var t=new Date(e);return isNaN(t)?null:t};Ta.toString=xa.toString;e.time.second=Uu(function(e){return new Mu(Math.floor(e/1e3)*1e3)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*1e3)},function(e){return e.getSeconds()});e.time.seconds=e.time.second.range;e.time.seconds.utc=e.time.second.utc.range;e.time.minute=Uu(function(e){return new Mu(Math.floor(e/6e4)*6e4)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*6e4)},function(e){return e.getMinutes()});e.time.minutes=e.time.minute.range;e.time.minutes.utc=e.time.minute.utc.range;e.time.hour=Uu(function(e){var t=e.getTimezoneOffset()/60;return new Mu((Math.floor(e/36e5-t)+t)*36e5)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*36e5)},function(e){return e.getHours()});e.time.hours=e.time.hour.range;e.time.hours.utc=e.time.hour.utc.range;e.time.month=Uu(function(t){t=e.time.day(t);t.setDate(1);return t},function(e,t){e.setMonth(e.getMonth()+t)},function(e){return e.getMonth()});e.time.months=e.time.month.range;e.time.months.utc=e.time.month.utc.range;var Ma=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6];var _a=[[e.time.second,1],[e.time.second,5],[e.time.second,15],[e.time.second,30],[e.time.minute,1],[e.time.minute,5],[e.time.minute,15],[e.time.minute,30],[e.time.hour,1],[e.time.hour,3],[e.time.hour,6],[e.time.hour,12],[e.time.day,1],[e.time.day,2],[e.time.week,1],[e.time.month,1],[e.time.month,3],[e.time.year,1]];var Da=[[e.time.format("%Y"),$n],[e.time.format("%B"),function(e){return e.getMonth()}],[e.time.format("%b %d"),function(e){return e.getDate()!=1}],[e.time.format("%a %d"),function(e){return e.getDay()&&e.getDate()!=1}],[e.time.format("%I %p"),function(e){return e.getHours()}],[e.time.format("%I:%M"),function(e){return e.getMinutes()}],[e.time.format(":%S"),function(e){return e.getSeconds()}],[e.time.format(".%L"),function(e){return e.getMilliseconds()}]];var Pa=e.scale.linear(),Ha=La(Da);_a.year=function(e,t){return Pa.domain(e.map(Oa)).ticks(t).map(Aa)};e.time.scale=function(){return Na(e.scale.linear(),_a,Ha)};var Ba=_a.map(function(e){return[e[0].utc,e[1]]});var ja=[[e.time.format.utc("%Y"),$n],[e.time.format.utc("%B"),function(e){return e.getUTCMonth()}],[e.time.format.utc("%b %d"),function(e){return e.getUTCDate()!=1}],[e.time.format.utc("%a %d"),function(e){return e.getUTCDay()&&e.getUTCDate()!=1}],[e.time.format.utc("%I %p"),function(e){return e.getUTCHours()}],[e.time.format.utc("%I:%M"),function(e){return e.getUTCMinutes()}],[e.time.format.utc(":%S"),function(e){return e.getUTCSeconds()}],[e.time.format.utc(".%L"),function(e){return e.getUTCMilliseconds()}]];var Fa=La(ja);Ba.year=function(e,t){return Pa.domain(e.map(qa)).ticks(t).map(Ia)};e.time.scale.utc=function(){return Na(e.scale.linear(),Ba,Fa)};e.text=function(){return e.xhr.apply(e,arguments).response(Ra)};e.json=function(t,n){return e.xhr(t,"application/json",n).response(Ua)};e.html=function(t,n){return e.xhr(t,"text/html",n).response(za)};e.xml=function(){return e.xhr.apply(e,arguments).response(Wa)};return e}() \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/fisheye.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/fisheye.js new file mode 100644 index 0000000..e1addd7 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/fisheye.js @@ -0,0 +1,86 @@ +(function() { + d3.fisheye = { + scale: function(scaleType) { + return d3_fisheye_scale(scaleType(), 3, 0); + }, + circular: function() { + var radius = 200, + distortion = 2, + k0, + k1, + focus = [0, 0]; + + function fisheye(d) { + var dx = d.x - focus[0], + dy = d.y - focus[1], + dd = Math.sqrt(dx * dx + dy * dy); + if (!dd || dd >= radius) return {x: d.x, y: d.y, z: 1}; + var k = k0 * (1 - Math.exp(-dd * k1)) / dd * .75 + .25; + return {x: focus[0] + dx * k, y: focus[1] + dy * k, z: Math.min(k, 10)}; + } + + function rescale() { + k0 = Math.exp(distortion); + k0 = k0 / (k0 - 1) * radius; + k1 = distortion / radius; + return fisheye; + } + + fisheye.radius = function(_) { + if (!arguments.length) return radius; + radius = +_; + return rescale(); + }; + + fisheye.distortion = function(_) { + if (!arguments.length) return distortion; + distortion = +_; + return rescale(); + }; + + fisheye.focus = function(_) { + if (!arguments.length) return focus; + focus = _; + return fisheye; + }; + + return rescale(); + } + }; + + function d3_fisheye_scale(scale, d, a) { + + function fisheye(_) { + var x = scale(_), + left = x < a, + v, + range = d3.extent(scale.range()), + min = range[0], + max = range[1], + m = left ? a - min : max - a; + if (m == 0) m = max - min; + return (left ? -1 : 1) * m * (d + 1) / (d + (m / Math.abs(x - a))) + a; + } + + fisheye.distortion = function(_) { + if (!arguments.length) return d; + d = +_; + return fisheye; + }; + + fisheye.focus = function(_) { + if (!arguments.length) return a; + a = +_; + return fisheye; + }; + + fisheye.copy = function() { + return d3_fisheye_scale(scale.copy(), d, a); + }; + + fisheye.nice = scale.nice; + fisheye.ticks = scale.ticks; + fisheye.tickFormat = scale.tickFormat; + return d3.rebind(fisheye, scale, "domain", "range"); + } +})(); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/hive.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/hive.js new file mode 100644 index 0000000..06e53ae --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/hive.js @@ -0,0 +1,80 @@ +d3.hive = {}; + +d3.hive.link = function() { + var source = function(d) { return d.source; }, + target = function(d) { return d.target; }, + angle = function(d) { return d.angle; }, + startRadius = function(d) { return d.radius; }, + endRadius = startRadius, + arcOffset = -Math.PI / 2; + + function link(d, i) { + var s = node(source, this, d, i), + t = node(target, this, d, i), + x; + if (t.a < s.a) x = t, t = s, s = x; + if (t.a - s.a > Math.PI) s.a += 2 * Math.PI; + var a1 = s.a + (t.a - s.a) / 3, + a2 = t.a - (t.a - s.a) / 3; + return s.r0 - s.r1 || t.r0 - t.r1 + ? "M" + Math.cos(s.a) * s.r0 + "," + Math.sin(s.a) * s.r0 + + "L" + Math.cos(s.a) * s.r1 + "," + Math.sin(s.a) * s.r1 + + "C" + Math.cos(a1) * s.r1 + "," + Math.sin(a1) * s.r1 + + " " + Math.cos(a2) * t.r1 + "," + Math.sin(a2) * t.r1 + + " " + Math.cos(t.a) * t.r1 + "," + Math.sin(t.a) * t.r1 + + "L" + Math.cos(t.a) * t.r0 + "," + Math.sin(t.a) * t.r0 + + "C" + Math.cos(a2) * t.r0 + "," + Math.sin(a2) * t.r0 + + " " + Math.cos(a1) * s.r0 + "," + Math.sin(a1) * s.r0 + + " " + Math.cos(s.a) * s.r0 + "," + Math.sin(s.a) * s.r0 + : "M" + Math.cos(s.a) * s.r0 + "," + Math.sin(s.a) * s.r0 + + "C" + Math.cos(a1) * s.r1 + "," + Math.sin(a1) * s.r1 + + " " + Math.cos(a2) * t.r1 + "," + Math.sin(a2) * t.r1 + + " " + Math.cos(t.a) * t.r1 + "," + Math.sin(t.a) * t.r1; + } + + function node(method, thiz, d, i) { + var node = method.call(thiz, d, i), + a = +(typeof angle === "function" ? angle.call(thiz, node, i) : angle) + arcOffset, + r0 = +(typeof startRadius === "function" ? startRadius.call(thiz, node, i) : startRadius), + r1 = (startRadius === endRadius ? r0 : +(typeof endRadius === "function" ? endRadius.call(thiz, node, i) : endRadius)); + return {r0: r0, r1: r1, a: a}; + } + + link.source = function(_) { + if (!arguments.length) return source; + source = _; + return link; + }; + + link.target = function(_) { + if (!arguments.length) return target; + target = _; + return link; + }; + + link.angle = function(_) { + if (!arguments.length) return angle; + angle = _; + return link; + }; + + link.radius = function(_) { + if (!arguments.length) return startRadius; + startRadius = endRadius = _; + return link; + }; + + link.startRadius = function(_) { + if (!arguments.length) return startRadius; + startRadius = _; + return link; + }; + + link.endRadius = function(_) { + if (!arguments.length) return endRadius; + endRadius = _; + return link; + }; + + return link; +}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/horizon.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/horizon.js new file mode 100644 index 0000000..d84c656 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/horizon.js @@ -0,0 +1,192 @@ +(function() { + d3.horizon = function() { + var bands = 1, // between 1 and 5, typically + mode = "offset", // or mirror + interpolate = "linear", // or basis, monotone, step-before, etc. + x = d3_horizonX, + y = d3_horizonY, + w = 960, + h = 40, + duration = 0; + + var color = d3.scale.linear() + .domain([-1, 0, 1]) + .range(["#d62728", "#fff", "#1f77b4"]); + + // For each small multiple… + function horizon(g) { + g.each(function(d, i) { + var g = d3.select(this), + n = 2 * bands + 1, + xMin = Infinity, + xMax = -Infinity, + yMax = -Infinity, + x0, // old x-scale + y0, // old y-scale + id; // unique id for paths + + // Compute x- and y-values along with extents. + var data = d.map(function(d, i) { + var xv = x.call(this, d, i), + yv = y.call(this, d, i); + if (xv < xMin) xMin = xv; + if (xv > xMax) xMax = xv; + if (-yv > yMax) yMax = -yv; + if (yv > yMax) yMax = yv; + return [xv, yv]; + }); + + // Compute the new x- and y-scales, and transform. + var x1 = d3.scale.linear().domain([xMin, xMax]).range([0, w]), + y1 = d3.scale.linear().domain([0, yMax]).range([0, h * bands]), + t1 = d3_horizonTransform(bands, h, mode); + + // Retrieve the old scales, if this is an update. + if (this.__chart__) { + x0 = this.__chart__.x; + y0 = this.__chart__.y; + t0 = this.__chart__.t; + id = this.__chart__.id; + } else { + x0 = x1.copy(); + y0 = y1.copy(); + t0 = t1; + id = ++d3_horizonId; + } + + // We'll use a defs to store the area path and the clip path. + var defs = g.selectAll("defs") + .data([null]); + + // The clip path is a simple rect. + defs.enter().append("defs").append("clipPath") + .attr("id", "d3_horizon_clip" + id) + .append("rect") + .attr("width", w) + .attr("height", h); + + defs.select("rect").transition() + .duration(duration) + .attr("width", w) + .attr("height", h); + + // We'll use a container to clip all horizon layers at once. + g.selectAll("g") + .data([null]) + .enter().append("g") + .attr("clip-path", "url(#d3_horizon_clip" + id + ")"); + + // Instantiate each copy of the path with different transforms. + var path = g.select("g").selectAll("path") + .data(d3.range(-1, -bands - 1, -1).concat(d3.range(1, bands + 1)), Number); + + var d0 = d3_horizonArea + .interpolate(interpolate) + .x(function(d) { return x0(d[0]); }) + .y0(h * bands) + .y1(function(d) { return h * bands - y0(d[1]); }) + (data); + + var d1 = d3_horizonArea + .x(function(d) { return x1(d[0]); }) + .y1(function(d) { return h * bands - y1(d[1]); }) + (data); + + path.enter().append("path") + .style("fill", color) + .attr("transform", t0) + .attr("d", d0); + + path.transition() + .duration(duration) + .style("fill", color) + .attr("transform", t1) + .attr("d", d1); + + path.exit().transition() + .duration(duration) + .attr("transform", t1) + .attr("d", d1) + .remove(); + + // Stash the new scales. + this.__chart__ = {x: x1, y: y1, t: t1, id: id}; + }); + d3.timer.flush(); + } + + horizon.duration = function(x) { + if (!arguments.length) return duration; + duration = +x; + return horizon; + }; + + horizon.bands = function(x) { + if (!arguments.length) return bands; + bands = +x; + color.domain([-bands, 0, bands]); + return horizon; + }; + + horizon.mode = function(x) { + if (!arguments.length) return mode; + mode = x + ""; + return horizon; + }; + + horizon.colors = function(x) { + if (!arguments.length) return color.range(); + color.range(x); + return horizon; + }; + + horizon.interpolate = function(x) { + if (!arguments.length) return interpolate; + interpolate = x + ""; + return horizon; + }; + + horizon.x = function(z) { + if (!arguments.length) return x; + x = z; + return horizon; + }; + + horizon.y = function(z) { + if (!arguments.length) return y; + y = z; + return horizon; + }; + + horizon.width = function(x) { + if (!arguments.length) return w; + w = +x; + return horizon; + }; + + horizon.height = function(x) { + if (!arguments.length) return h; + h = +x; + return horizon; + }; + + return horizon; + }; + + var d3_horizonArea = d3.svg.area(), + d3_horizonId = 0; + + function d3_horizonX(d) { + return d[0]; + } + + function d3_horizonY(d) { + return d[1]; + } + + function d3_horizonTransform(bands, h, mode) { + return mode == "offset" + ? function(d) { return "translate(0," + (d + (d < 0) - bands) * h + ")"; } + : function(d) { return (d < 0 ? "scale(1,-1)" : "") + "translate(0," + (d - bands) * h + ")"; }; + } +})(); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/interactiveLayer.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/interactiveLayer.js new file mode 100644 index 0000000..4dfb68d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/interactiveLayer.js @@ -0,0 +1,251 @@ +/* Utility class to handle creation of an interactive layer. +This places a rectangle on top of the chart. When you mouse move over it, it sends a dispatch +containing the X-coordinate. It can also render a vertical line where the mouse is located. + +dispatch.elementMousemove is the important event to latch onto. It is fired whenever the mouse moves over +the rectangle. The dispatch is given one object which contains the mouseX/Y location. +It also has 'pointXValue', which is the conversion of mouseX to the x-axis scale. +*/ +nv.interactiveGuideline = function() { + "use strict"; + var tooltip = nv.models.tooltip(); + //Public settings + var width = null + , height = null + //Please pass in the bounding chart's top and left margins + //This is important for calculating the correct mouseX/Y positions. + , margin = {left: 0, top: 0} + , xScale = d3.scale.linear() + , yScale = d3.scale.linear() + , dispatch = d3.dispatch('elementMousemove', 'elementMouseout','elementDblclick') + , showGuideLine = true + , svgContainer = null + //Must pass in the bounding chart's container. + //The mousemove event is attached to this container. + ; + + //Private variables + var isMSIE = navigator.userAgent.indexOf("MSIE") !== -1 //Check user-agent for Microsoft Internet Explorer. + ; + + + function layer(selection) { + selection.each(function(data) { + var container = d3.select(this); + + var availableWidth = (width || 960), availableHeight = (height || 400); + + var wrap = container.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([data]); + var wrapEnter = wrap.enter() + .append("g").attr("class", " nv-wrap nv-interactiveLineLayer"); + + + wrapEnter.append("g").attr("class","nv-interactiveGuideLine"); + + if (!svgContainer) { + return; + } + + function mouseHandler() { + var d3mouse = d3.mouse(this); + var mouseX = d3mouse[0]; + var mouseY = d3mouse[1]; + var subtractMargin = true; + var mouseOutAnyReason = false; + if (isMSIE) { + /* + D3.js (or maybe SVG.getScreenCTM) has a nasty bug in Internet Explorer 10. + d3.mouse() returns incorrect X,Y mouse coordinates when mouse moving + over a rect in IE 10. + However, d3.event.offsetX/Y also returns the mouse coordinates + relative to the triggering . So we use offsetX/Y on IE. + */ + mouseX = d3.event.offsetX; + mouseY = d3.event.offsetY; + + /* + On IE, if you attach a mouse event listener to the container, + it will actually trigger it for all the child elements (like , , etc). + When this happens on IE, the offsetX/Y is set to where ever the child element + is located. + As a result, we do NOT need to subtract margins to figure out the mouse X/Y + position under this scenario. Removing the line below *will* cause + the interactive layer to not work right on IE. + */ + if(d3.event.target.tagName !== "svg") + subtractMargin = false; + + if (d3.event.target.className.baseVal.match("nv-legend")) + mouseOutAnyReason = true; + + } + + if(subtractMargin) { + mouseX -= margin.left; + mouseY -= margin.top; + } + + /* If mouseX/Y is outside of the chart's bounds, + trigger a mouseOut event. + */ + if (mouseX < 0 || mouseY < 0 + || mouseX > availableWidth || mouseY > availableHeight + || (d3.event.relatedTarget && d3.event.relatedTarget.ownerSVGElement === undefined) + || mouseOutAnyReason + ) + { + if (isMSIE) { + if (d3.event.relatedTarget + && d3.event.relatedTarget.ownerSVGElement === undefined + && d3.event.relatedTarget.className.match(tooltip.nvPointerEventsClass)) { + return; + } + } + dispatch.elementMouseout({ + mouseX: mouseX, + mouseY: mouseY + }); + layer.renderGuideLine(null); //hide the guideline + return; + } + + var pointXValue = xScale.invert(mouseX); + dispatch.elementMousemove({ + mouseX: mouseX, + mouseY: mouseY, + pointXValue: pointXValue + }); + + //If user double clicks the layer, fire a elementDblclick dispatch. + if (d3.event.type === "dblclick") { + dispatch.elementDblclick({ + mouseX: mouseX, + mouseY: mouseY, + pointXValue: pointXValue + }); + } + } + + svgContainer + .on("mousemove",mouseHandler, true) + .on("mouseout" ,mouseHandler,true) + .on("dblclick" ,mouseHandler) + ; + + //Draws a vertical guideline at the given X postion. + layer.renderGuideLine = function(x) { + if (!showGuideLine) return; + var line = wrap.select(".nv-interactiveGuideLine") + .selectAll("line") + .data((x != null) ? [nv.utils.NaNtoZero(x)] : [], String); + + line.enter() + .append("line") + .attr("class", "nv-guideline") + .attr("x1", function(d) { return d;}) + .attr("x2", function(d) { return d;}) + .attr("y1", availableHeight) + .attr("y2",0) + ; + line.exit().remove(); + + } + }); + } + + layer.dispatch = dispatch; + layer.tooltip = tooltip; + + layer.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return layer; + }; + + layer.width = function(_) { + if (!arguments.length) return width; + width = _; + return layer; + }; + + layer.height = function(_) { + if (!arguments.length) return height; + height = _; + return layer; + }; + + layer.xScale = function(_) { + if (!arguments.length) return xScale; + xScale = _; + return layer; + }; + + layer.showGuideLine = function(_) { + if (!arguments.length) return showGuideLine; + showGuideLine = _; + return layer; + }; + + layer.svgContainer = function(_) { + if (!arguments.length) return svgContainer; + svgContainer = _; + return layer; + }; + + + return layer; +}; + +/* Utility class that uses d3.bisect to find the index in a given array, where a search value can be inserted. +This is different from normal bisectLeft; this function finds the nearest index to insert the search value. + +For instance, lets say your array is [1,2,3,5,10,30], and you search for 28. +Normal d3.bisectLeft will return 4, because 28 is inserted after the number 10. But interactiveBisect will return 5 +because 28 is closer to 30 than 10. + +Unit tests can be found in: interactiveBisectTest.html + +Has the following known issues: + * Will not work if the data points move backwards (ie, 10,9,8,7, etc) or if the data points are in random order. + * Won't work if there are duplicate x coordinate values. +*/ +nv.interactiveBisect = function (values, searchVal, xAccessor) { + "use strict"; + if (! values instanceof Array) return null; + if (typeof xAccessor !== 'function') xAccessor = function(d,i) { return d.x;} + + var bisect = d3.bisector(xAccessor).left; + var index = d3.max([0, bisect(values,searchVal) - 1]); + var currentValue = xAccessor(values[index], index); + if (typeof currentValue === 'undefined') currentValue = index; + + if (currentValue === searchVal) return index; //found exact match + + var nextIndex = d3.min([index+1, values.length - 1]); + var nextValue = xAccessor(values[nextIndex], nextIndex); + if (typeof nextValue === 'undefined') nextValue = nextIndex; + + if (Math.abs(nextValue - searchVal) >= Math.abs(currentValue - searchVal)) + return index; + else + return nextIndex +}; + +/* +Returns the index in the array "values" that is closest to searchVal. +Only returns an index if searchVal is within some "threshold". +Otherwise, returns null. +*/ +nv.nearestValueIndex = function (values, searchVal, threshold) { + "use strict"; + var yDistMax = Infinity, indexToHighlight = null; + values.forEach(function(d,i) { + var delta = Math.abs(searchVal - d); + if ( delta <= yDistMax && delta < threshold) { + yDistMax = delta; + indexToHighlight = i; + } + }); + return indexToHighlight; +}; \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/intro.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/intro.js new file mode 100644 index 0000000..af50383 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/intro.js @@ -0,0 +1 @@ +(function(){ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis-min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis-min.js new file mode 100644 index 0000000..1101dde --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis-min.js @@ -0,0 +1 @@ +nv.models.axis=function(){function o(d){return d.each(function(d){var o=d3.select(this),p=o.selectAll("g.nv-wrap.nv-axis").data([d]),q=p.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");q.append("g");var s=p.select("g");null!==m?a.ticks(m):("top"==a.orient()||"bottom"==a.orient())&&a.ticks(Math.abs(e.range()[1]-e.range()[0])/100),d3.transition(s).call(a),n=n||a.scale();var t=a.tickFormat();null==t&&(t=n.tickFormat());var u=s.selectAll("text.nv-axislabel").data([f||null]);switch(u.exit().remove(),a.orient()){case"top":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",0);var v=2==e.range().length?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);if(u.attr("x",v/2),g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a){return"translate("+e(a)+",0)"}).select("text").attr("dy","0em").attr("y",-a.tickPadding()).attr("text-anchor","middle").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate("+e.range()[b]+",0)"})}break;case"bottom":var x=36,y=30,z=s.selectAll("g").select("text");if(i%360){z.each(function(){var c=this.getBBox().width;c>y&&(y=c)});var A=Math.abs(Math.sin(i*Math.PI/180)),x=(A?A*y:y)+30;z.attr("transform",function(){return"rotate("+i+" 0,0)"}).attr("text-anchor",i%360>0?"start":"end")}u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",x);var v=2==e.range().length?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);if(u.attr("x",v/2),g){var w=p.selectAll("g.nv-axisMaxMin").data([e.domain()[0],e.domain()[e.domain().length-1]]);w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",a.tickPadding()).attr("transform",function(){return"rotate("+i+" 0,0)"}).attr("text-anchor",i?i%360>0?"start":"end":"middle").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"})}k&&z.attr("transform",function(a,b){return"translate(0,"+(0==b%2?"0":"12")+")"});break;case"right":if(u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"begin").attr("transform",j?"rotate(90)":"").attr("y",j?-Math.max(b.right,c)+30:-10),u.attr("x",j?e.range()[0]/2:a.tickPadding()),g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a){return"translate(0,"+e(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",a.tickPadding()).attr("text-anchor","start").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}break;case"left":if(u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"begin").attr("transform",j?"rotate(-90)":"").attr("y",j?-Math.max(b.left,c)+0:-10),u.attr("x",j?-e.range()[0]/2:-a.tickPadding()),g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a){return"translate(0,"+e(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-a.tickPadding()).attr("text-anchor","start").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}}if(u.text(function(a){return a}),!g||"left"!==a.orient()&&"right"!==a.orient()||(s.selectAll("g").each(function(a){d3.select(this).select("text").attr("opacity",1),(e(a)e.range()[0]-10)&&((a>1e-10||-1e-10>a)&&d3.select(this).attr("opacity",0),d3.select(this).select("text").attr("opacity",0))}),e.domain()[0]==e.domain()[1]&&0==e.domain()[0]&&p.selectAll("g.nv-axisMaxMin").style("opacity",function(a,b){return b?0:1})),g&&("top"===a.orient()||"bottom"===a.orient())){var B=[];p.selectAll("g.nv-axisMaxMin").each(function(a,b){try{b?B.push(e(a)-this.getBBox().width-4):B.push(e(a)+this.getBBox().width+4)}catch(c){b?B.push(e(a)-4):B.push(e(a)+4)}}),s.selectAll("g").each(function(a){(e(a)B[1])&&(a>1e-10||-1e-10>a?d3.select(this).remove():d3.select(this).select("text").remove())})}h&&s.selectAll("line.tick").filter(function(a){return!parseFloat(Math.round(1e5*a)/1e6)}).classed("zero",!0),n=e.copy()}),o}var a=d3.svg.axis(),b={top:0,right:0,bottom:0,left:0},c=75,d=60,e=d3.scale.linear(),f=null,g=!1,h=!0,i=0,j=!0,k=!1,l=!1,m=null;a.scale(e).orient("bottom").tickFormat(function(a){return a});var n;return o.axis=a,d3.rebind(o,a,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o.margin=function(a){return arguments.length?(b.top=a.top!==void 0?a.top:b.top,b.right=a.right!==void 0?a.right:b.right,b.bottom=a.bottom!==void 0?a.bottom:b.bottom,b.left=a.left!==void 0?a.left:b.left,o):b},o.width=function(a){return arguments.length?(c=a,o):c},o.ticks=function(a){return arguments.length?(m=a,o):m},o.height=function(a){return arguments.length?(d=a,o):d},o.axisLabel=function(a){return arguments.length?(f=a,o):f},o.showMaxMin=function(a){return arguments.length?(g=a,o):g},o.highlightZero=function(a){return arguments.length?(h=a,o):h},o.scale=function(b){return arguments.length?(e=b,a.scale(e),l="function"==typeof e.rangeBands,d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o):e},o.rotateYLabel=function(a){return arguments.length?(j=a,o):j},o.rotateLabels=function(a){return arguments.length?(i=a,o):i},o.staggerLabels=function(a){return arguments.length?(k=a,o):k},o}; \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis.js new file mode 100644 index 0000000..9895c3f --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis.js @@ -0,0 +1,470 @@ +nv.models.axis = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var axis = d3.svg.axis() + ; + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 75 //only used for tickLabel currently + , height = 60 //only used for tickLabel currently + , scale = d3.scale.linear() + , axisLabelText = null + , showMaxMin = true //TODO: showMaxMin should be disabled on all ordinal scaled axes + , highlightZero = true + , rotateLabels = 0 + , rotateYLabel = true + , staggerLabels = false + , isOrdinal = false + , ticks = null + , logScale = false + , axisLabelDistance = 12 //The larger this number is, the closer the axis label is to the axis. + ; + + axis + .scale(scale) + .orient('bottom') + .tickFormat(function(d) { return d }) + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var scale0; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-axis').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-axis'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + //------------------------------------------------------------ + + + if (ticks !== null) + axis.ticks(ticks); + else if (axis.orient() == 'top' || axis.orient() == 'bottom') + axis.ticks(Math.abs(scale.range()[1] - scale.range()[0]) / 100); + + + //TODO: consider calculating width/height based on whether or not label is added, for reference in charts using this component + + + g.transition().call(axis); + + scale0 = scale0 || axis.scale(); + + var fmt = axis.tickFormat(); + if (fmt == null) { + fmt = scale0.tickFormat(); + } + + var axisLabel = g.selectAll('text.nv-axislabel') + .data([axisLabelText || null]); + axisLabel.exit().remove(); + switch (axis.orient()) { + case 'top': + axisLabel.enter().append('text').attr('class', 'nv-axislabel'); + var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0])); + axisLabel + .attr('text-anchor', 'middle') + .attr('y', 0) + .attr('x', w/2); + if (showMaxMin) { + var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin') + .data(scale.domain()); + axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text'); + axisMaxMin.exit().remove(); + axisMaxMin + .attr('transform', function(d,i) { + return 'translate(' + scale(d) + ',0)' + }) + .select('text') + .attr('dy', '0em') + .attr('y', -axis.tickPadding()) + .attr('text-anchor', 'middle') + .text(function(d,i) { + //var v = fmt(d); + var v = d; + if(logScale) { + v = Math.pow(10,v); + v = fmt(v); + //fmt = d3.format(',.2f'); + //v = fmt(v); + } else + v = fmt(v); + return ('' + v).match('NaN') ? '' : v; + }); + axisMaxMin.transition() + .attr('transform', function(d,i) { + return 'translate(' + scale.range()[i] + ',0)' + }); + } + break; + case 'bottom': + var xLabelMargin = 36; + var maxTextWidth = 30; + var xTicks = g.selectAll('g').select("text"); + if (rotateLabels%360) { + //Calculate the longest xTick width + xTicks.each(function(d,i){ + var width = this.getBBox().width; + if(width > maxTextWidth) maxTextWidth = width; + }); + //Convert to radians before calculating sin. Add 30 to margin for healthy padding. + var sin = Math.abs(Math.sin(rotateLabels*Math.PI/180)); + var xLabelMargin = (sin ? sin*maxTextWidth : maxTextWidth)+30; + //Rotate all xTicks + xTicks + .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' }) + .style('text-anchor', rotateLabels%360 > 0 ? 'start' : 'end'); + } + axisLabel.enter().append('text').attr('class', 'nv-axislabel'); + var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0])); + axisLabel + .attr('text-anchor', 'middle') + .attr('y', xLabelMargin) + .attr('x', w/2); + if (showMaxMin) { + //if (showMaxMin && !isOrdinal) { + var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin') + //.data(scale.domain()) + .data([scale.domain()[0], scale.domain()[scale.domain().length - 1]]); + axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text'); + axisMaxMin.exit().remove(); + axisMaxMin + .attr('transform', function(d,i) { + return 'translate(' + (scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0)) + ',0)' + }) + .select('text') + .attr('dy', '.71em') + .attr('y', axis.tickPadding()) + .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' }) + .style('text-anchor', rotateLabels ? (rotateLabels%360 > 0 ? 'start' : 'end') : 'middle') + .text(function(d,i) { + //var v = fmt(d); + var v = d; + if(logScale) { + v = Math.pow(10,v); + v = fmt(v); + //fmt = d3.format(',.2f'); + //v = fmt(v); + } else + v = fmt(v); + return ('' + v).match('NaN') ? '' : v; + }); + axisMaxMin.transition() + .attr('transform', function(d,i) { + //return 'translate(' + scale.range()[i] + ',0)' + //return 'translate(' + scale(d) + ',0)' + return 'translate(' + (scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0)) + ',0)' + }); + } + if (staggerLabels) + xTicks + .attr('transform', function(d,i) { return 'translate(0,' + (i % 2 == 0 ? '0' : '12') + ')' }); + + break; + case 'right': + axisLabel.enter().append('text').attr('class', 'nv-axislabel'); + axisLabel + .style('text-anchor', rotateYLabel ? 'middle' : 'begin') + .attr('transform', rotateYLabel ? 'rotate(90)' : '') + .attr('y', rotateYLabel ? (-Math.max(margin.right,width) + 12) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart + .attr('x', rotateYLabel ? (scale.range()[0] / 2) : axis.tickPadding()); + if (showMaxMin) { + var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin') + .data(scale.domain()); + axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text') + .style('opacity', 0); + axisMaxMin.exit().remove(); + axisMaxMin + .attr('transform', function(d,i) { + return 'translate(0,' + scale(d) + ')' + }) + .select('text') + .attr('dy', '.32em') + .attr('y', 0) + .attr('x', axis.tickPadding()) + .style('text-anchor', 'start') + .text(function(d,i) { + //var v = fmt(d); + var v = d; + if(logScale) { + v = Math.pow(10,v); + v = fmt(v); + //fmt = d3.format(',.2f'); + //v = fmt(v); + } else + v = fmt(v); + return ('' + v).match('NaN') ? '' : v; + }); + axisMaxMin.transition() + .attr('transform', function(d,i) { + return 'translate(0,' + scale.range()[i] + ')' + }) + .select('text') + .style('opacity', 1); + } + break; + case 'left': + /* + //For dynamically placing the label. Can be used with dynamically-sized chart axis margins + var yTicks = g.selectAll('g').select("text"); + yTicks.each(function(d,i){ + var labelPadding = this.getBBox().width + axis.tickPadding() + 16; + if(labelPadding > width) width = labelPadding; + }); + */ + axisLabel.enter().append('text').attr('class', 'nv-axislabel'); + axisLabel + .style('text-anchor', rotateYLabel ? 'middle' : 'end') + .attr('transform', rotateYLabel ? 'rotate(-90)' : '') + .attr('y', rotateYLabel ? (-Math.max(margin.left,width) + axisLabelDistance) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart + .attr('x', rotateYLabel ? (-scale.range()[0] / 2) : -axis.tickPadding()); + if (showMaxMin) { + var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin') + .data(scale.domain()); + axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text') + .style('opacity', 0); + axisMaxMin.exit().remove(); + axisMaxMin + .attr('transform', function(d,i) { + return 'translate(0,' + scale0(d) + ')' + }) + .select('text') + .attr('dy', '.32em') + .attr('y', 0) + .attr('x', -axis.tickPadding()) + .attr('text-anchor', 'end') + .text(function(d,i) { + //var v = fmt(d); + var v = d; + if(logScale) { + v = Math.pow(10,v); + v = fmt(v); + //fmt = d3.format(',.2f'); + //v = fmt(v); + } else + v = fmt(v); + return ('' + v).match('NaN') ? '' : v; + }); + axisMaxMin.transition() + .attr('transform', function(d,i) { + return 'translate(0,' + scale.range()[i] + ')' + }) + .select('text') + .style('opacity', 1); + } + break; + } + axisLabel + .text(function(d) { return d }); + + + if (showMaxMin && (axis.orient() === 'left' || axis.orient() === 'right')) { + //check if max and min overlap other values, if so, hide the values that overlap + g.selectAll('g') // the g's wrapping each tick + .each(function(d,i) { + d3.select(this).select('text').attr('opacity', 1); + var v; + if(logScale) { + v = Math.pow(10,d); + v = fmt(v); + //fmt = d3.format(',.2f'); + //v = fmt(v); + } else { + v = fmt(d); + } + + //d3.select(this).select('text').text(fmt(Math.pow(10,d))); + d3.select(this).select('text').text(v); + if (scale(d) < scale.range()[1] + 10 || scale(d) > scale.range()[0] - 10) { // 10 is assuming text height is 16... if d is 0, leave it! + if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL + d3.select(this).attr('opacity', 0); + + d3.select(this).select('text').attr('opacity', 0); // Don't remove the ZERO line!! + } + }); + + //if Max and Min = 0 only show min, Issue #281 + if (scale.domain()[0] == scale.domain()[1] && scale.domain()[0] == 0) + wrap.selectAll('g.nv-axisMaxMin') + .style('opacity', function(d,i) { return !i ? 1 : 0 }); + + } + + if (showMaxMin && (axis.orient() === 'top' || axis.orient() === 'bottom')) { + var maxMinRange = []; + wrap.selectAll('g.nv-axisMaxMin') + .each(function(d,i) { + try { + if (i) // i== 1, max position + maxMinRange.push(scale(d) - this.getBBox().width - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case) + else // i==0, min position + maxMinRange.push(scale(d) + this.getBBox().width + 4) + }catch (err) { + if (i) // i== 1, max position + maxMinRange.push(scale(d) - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case) + else // i==0, min position + maxMinRange.push(scale(d) + 4) + } + }); + g.selectAll('g') // the g's wrapping each tick + .each(function(d,i) { + var v; + if(logScale) { + v = Math.pow(10,d); + //v = fmt(v); + //fmt = d3.format(',.2f'); + v = fmt(v); + } else { + v = fmt(d); + } + //alert(v); + + //d3.select(this).select('text').text(fmt(Math.pow(10,d))); + d3.select(this).select('text').text(v); + + if (scale(d) < maxMinRange[0] || scale(d) > maxMinRange[1]) { + if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL + d3.select(this).remove(); + else + d3.select(this).select('text').remove(); // Don't remove the ZERO line!! + } + }); + } + + + //highlight zero line ... Maybe should not be an option and should just be in CSS? + if (highlightZero) + g.selectAll('.tick') + .filter(function(d) { return !parseFloat(Math.round(d.__data__*100000)/1000000) && (d.__data__ !== undefined) }) //this is because sometimes the 0 tick is a very small fraction, TODO: think of cleaner technique + .classed('zero', true); + + //store old scales for use in transitions on update + scale0 = scale.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.axis = axis; + + d3.rebind(chart, axis, 'orient', 'tickValues', 'tickSubdivide', 'tickSize', 'tickPadding', 'tickFormat'); + d3.rebind(chart, scale, 'domain', 'range', 'rangeBand', 'rangeBands'); //these are also accessible by chart.scale(), but added common ones directly for ease of use + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if(!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + } + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.ticks = function(_) { + if (!arguments.length) return ticks; + ticks = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.axisLabel = function(_) { + if (!arguments.length) return axisLabelText; + axisLabelText = _; + return chart; + } + + chart.showMaxMin = function(_) { + if (!arguments.length) return showMaxMin; + showMaxMin = _; + return chart; + } + + chart.logScale = function(_) { + if (!arguments.length) return logScale; + logScale = _; + return chart; + } + + chart.highlightZero = function(_) { + if (!arguments.length) return highlightZero; + highlightZero = _; + return chart; + } + + chart.scale = function(_) { + if (!arguments.length) return scale; + scale = _; + axis.scale(scale); + isOrdinal = typeof scale.rangeBands === 'function'; + d3.rebind(chart, scale, 'domain', 'range', 'rangeBand', 'rangeBands'); + return chart; + } + + chart.rotateYLabel = function(_) { + if(!arguments.length) return rotateYLabel; + rotateYLabel = _; + return chart; + } + + chart.rotateLabels = function(_) { + if(!arguments.length) return rotateLabels; + rotateLabels = _; + return chart; + } + + chart.staggerLabels = function(_) { + if (!arguments.length) return staggerLabels; + staggerLabels = _; + return chart; + }; + + chart.axisLabelDistance = function(_) { + if (!arguments.length) return axisLabelDistance; + axisLabelDistance = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis.min.js new file mode 100644 index 0000000..6c8ad6a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/axis.min.js @@ -0,0 +1 @@ +nv.models.axis=function(){"use strict";function m(r){r.each(function(r){var m=d3.select(this);var g=m.selectAll("g.nv-wrap.nv-axis").data([r]);var y=g.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");var b=y.append("g");var w=g.select("g");if(h!==null)e.ticks(h);else if(e.orient()=="top"||e.orient()=="bottom")e.ticks(Math.abs(i.range()[1]-i.range()[0])/100);w.transition().call(e);v=v||e.scale();var E=e.tickFormat();if(E==null){E=v.tickFormat()}var S=w.selectAll("text.nv-axislabel").data([s||null]);S.exit().remove();switch(e.orient()){case"top":S.enter().append("text").attr("class","nv-axislabel");var x=i.range().length==2?i.range()[1]:i.range()[i.range().length-1]+(i.range()[1]-i.range()[0]);S.attr("text-anchor","middle").attr("y",0).attr("x",x/2);if(o){var T=g.selectAll("g.nv-axisMaxMin").data(i.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+i(e)+",0)"}).select("text").attr("dy","0em").attr("y",-e.tickPadding()).attr("text-anchor","middle").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+i.range()[t]+",0)"})}break;case"bottom":var N=36;var C=30;var k=w.selectAll("g").select("text");if(a%360){k.each(function(e,t){var n=this.getBBox().width;if(n>C)C=n});var L=Math.abs(Math.sin(a*Math.PI/180));var N=(L?L*C:C)+30;k.attr("transform",function(e,t,n){return"rotate("+a+" 0,0)"}).style("text-anchor",a%360>0?"start":"end")}S.enter().append("text").attr("class","nv-axislabel");var x=i.range().length==2?i.range()[1]:i.range()[i.range().length-1]+(i.range()[1]-i.range()[0]);S.attr("text-anchor","middle").attr("y",N).attr("x",x/2);if(o){var T=g.selectAll("g.nv-axisMaxMin").data([i.domain()[0],i.domain()[i.domain().length-1]]);T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+(i(e)+(c?i.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",e.tickPadding()).attr("transform",function(e,t,n){return"rotate("+a+" 0,0)"}).style("text-anchor",a?a%360>0?"start":"end":"middle").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+(i(e)+(c?i.rangeBand()/2:0))+",0)"})}if(l)k.attr("transform",function(e,t){return"translate(0,"+(t%2==0?"0":"12")+")"});break;case"right":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",f?"middle":"begin").attr("transform",f?"rotate(90)":"").attr("y",f?-Math.max(t.right,n)+12:-10).attr("x",f?i.range()[0]/2:e.tickPadding());if(o){var T=g.selectAll("g.nv-axisMaxMin").data(i.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+i(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",e.tickPadding()).style("text-anchor","start").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+i.range()[t]+")"}).select("text").style("opacity",1)}break;case"left":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",f?"middle":"end").attr("transform",f?"rotate(-90)":"").attr("y",f?-Math.max(t.left,n)+d:-10).attr("x",f?-i.range()[0]/2:-e.tickPadding());if(o){var T=g.selectAll("g.nv-axisMaxMin").data(i.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+v(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-e.tickPadding()).attr("text-anchor","end").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+i.range()[t]+")"}).select("text").style("opacity",1)}break}S.text(function(e){return e});if(o&&(e.orient()==="left"||e.orient()==="right")){w.selectAll("g").each(function(e,t){d3.select(this).select("text").attr("opacity",1);var n;if(p){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(i(e)i.range()[0]-10){if(e>1e-10||e<-1e-10)d3.select(this).attr("opacity",0);d3.select(this).select("text").attr("opacity",0)}});if(i.domain()[0]==i.domain()[1]&&i.domain()[0]==0)g.selectAll("g.nv-axisMaxMin").style("opacity",function(e,t){return!t?1:0})}if(o&&(e.orient()==="top"||e.orient()==="bottom")){var A=[];g.selectAll("g.nv-axisMaxMin").each(function(e,t){try{if(t)A.push(i(e)-this.getBBox().width-4);else A.push(i(e)+this.getBBox().width+4)}catch(n){if(t)A.push(i(e)-4);else A.push(i(e)+4)}});w.selectAll("g").each(function(e,t){var n;if(p){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(i(e)A[1]){if(e>1e-10||e<-1e-10)d3.select(this).remove();else d3.select(this).select("text").remove()}})}if(u)w.selectAll(".tick").filter(function(e){return!parseFloat(Math.round(e.__data__*1e5)/1e6)&&e.__data__!==undefined}).classed("zero",true);v=i.copy()});return m}var e=d3.svg.axis();var t={top:0,right:0,bottom:0,left:0},n=75,r=60,i=d3.scale.linear(),s=null,o=true,u=true,a=0,f=true,l=false,c=false,h=null,p=false,d=12;e.scale(i).orient("bottom").tickFormat(function(e){return e});var v;m.axis=e;d3.rebind(m,e,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat");d3.rebind(m,i,"domain","range","rangeBand","rangeBands");m.options=nv.utils.optionsFunc.bind(m);m.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return m};m.width=function(e){if(!arguments.length)return n;n=e;return m};m.ticks=function(e){if(!arguments.length)return h;h=e;return m};m.height=function(e){if(!arguments.length)return r;r=e;return m};m.axisLabel=function(e){if(!arguments.length)return s;s=e;return m};m.showMaxMin=function(e){if(!arguments.length)return o;o=e;return m};m.logScale=function(e){if(!arguments.length)return p;p=e;return m};m.highlightZero=function(e){if(!arguments.length)return u;u=e;return m};m.scale=function(t){if(!arguments.length)return i;i=t;e.scale(i);c=typeof i.rangeBands==="function";d3.rebind(m,i,"domain","range","rangeBand","rangeBands");return m};m.rotateYLabel=function(e){if(!arguments.length)return f;f=e;return m};m.rotateLabels=function(e){if(!arguments.length)return a;a=e;return m};m.staggerLabels=function(e){if(!arguments.length)return l;l=e;return m};m.axisLabelDistance=function(e){if(!arguments.length)return d;d=e;return m};return m} \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/backup/bullet.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/backup/bullet.js new file mode 100644 index 0000000..86ebeb0 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/backup/bullet.js @@ -0,0 +1,250 @@ + +// Chart design based on the recommendations of Stephen Few. Implementation +// based on the work of Clint Ivy, Jamie Love, and Jason Davies. +// http://projects.instantcognition.com/protovis/bulletchart/ + +nv.models.bullet = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , orient = 'left' // TODO top & bottom + , reverse = false + , ranges = function(d) { return d.ranges } + , markers = function(d) { return d.markers } + , measures = function(d) { return d.measures } + , forceX = [0] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.) + , width = 380 + , height = 30 + , tickFormat = null + , dispatch = d3.dispatch('elementMouseover', 'elementMouseout') + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(d, i) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this), + mainGroup = nv.log(this.parentNode.parentNode).getAttribute('transform'), + heightFromTop = nv.log(parseInt(mainGroup.replace(/.*,(\d+)\)/,"$1"))); //TODO: There should be a smarter way to get this value + + var rangez = ranges.call(this, d, i).slice().sort(d3.descending), + markerz = markers.call(this, d, i).slice().sort(d3.descending), + measurez = measures.call(this, d, i).slice().sort(d3.descending); + + + //------------------------------------------------------------ + // Setup Scales + + // Compute the new x-scale. + var MaxX = Math.max(rangez[0] ? rangez[0]:0 , markerz[0] ? markerz[0] : 0 , measurez[0] ? measurez[0] : 0) + var x1 = d3.scale.linear() + .domain([0, MaxX]).nice() // TODO: need to allow forceX and forceY, and xDomain, yDomain + .range(reverse ? [availableWidth, 0] : [0, availableWidth]); + + // Retrieve the old x-scale, if this is an update. + var x0 = this.__chart__ || d3.scale.linear() + .domain([0, Infinity]) + .range(x1.range()); + + // Stash the new scale. + this.__chart__ = x1; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-bullet').data([d]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bullet'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0) + w1 = function(d) { return Math.abs(x1(d) - x1(0)) }; + + + // Update the range rects. + var range = g.selectAll('rect.nv-range') + .data(rangez); + + range.enter().append('rect') + .attr('class', function(d, i) { return 'nv-range nv-s' + i; }) + .attr('width', w0) + .attr('height', availableHeight) + .attr('x', reverse ? x0 : 0) + .on('mouseover', function(d,i) { + dispatch.elementMouseover({ + value: d, + label: (i <= 0) ? 'Maximum' : (i > 1) ? 'Minimum' : 'Mean', //TODO: make these labels a variable + pos: [x1(d), heightFromTop] + }) + }) + .on('mouseout', function(d,i) { + dispatch.elementMouseout({ + value: d, + label: (i <= 0) ? 'Minimum' : (i >=1) ? 'Maximum' : 'Mean' //TODO: make these labels a variable + }) + }) + + d3.transition(range) + .attr('x', reverse ? x1 : 0) + .attr('width', w1) + .attr('height', availableHeight); + + + // Update the measure rects. + var measure = g.selectAll('rect.nv-measure') + .data(measurez); + + measure.enter().append('rect') + .attr('class', function(d, i) { return 'nv-measure nv-s' + i; }) + .attr('width', w0) + .attr('height', availableHeight / 3) + .attr('x', reverse ? x0 : 0) + .attr('y', availableHeight / 3) + .on('mouseover', function(d) { + dispatch.elementMouseover({ + value: d, + label: 'Current', //TODO: make these labels a variable + pos: [x1(d), heightFromTop] + }) + }) + .on('mouseout', function(d) { + dispatch.elementMouseout({ + value: d, + label: 'Current' //TODO: make these labels a variable + }) + }) + + d3.transition(measure) + .attr('width', w1) + .attr('height', availableHeight / 3) + .attr('x', reverse ? x1 : 0) + .attr('y', availableHeight / 3); + + + + // Update the marker lines. + var marker = g.selectAll('path.nv-markerTriangle') + .data(markerz); + + var h3 = availableHeight / 6; + marker.enter().append('path') + .attr('class', 'nv-markerTriangle') + .attr('transform', function(d) { return 'translate(' + x0(d) + ',' + (availableHeight / 2) + ')' }) + .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z') + .on('mouseover', function(d,i) { + dispatch.elementMouseover({ + value: d, + label: 'Previous', + pos: [x1(d), heightFromTop] + }) + }) + .on('mouseout', function(d,i) { + dispatch.elementMouseout({ + value: d, + label: 'Previous' + }) + }); + + d3.transition(marker) + .attr('transform', function(d) { return 'translate(' + x1(d) + ',' + (availableHeight / 2) + ')' }); + + marker.exit().remove(); + + }); + + d3.timer.flush(); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + // left, right, top, bottom + chart.orient = function(_) { + if (!arguments.length) return orient; + orient = _; + reverse = orient == 'right' || orient == 'bottom'; + return chart; + }; + + // ranges (bad, satisfactory, good) + chart.ranges = function(_) { + if (!arguments.length) return ranges; + ranges = _; + return chart; + }; + + // markers (previous, goal) + chart.markers = function(_) { + if (!arguments.length) return markers; + markers = _; + return chart; + }; + + // measures (actual, forecast) + chart.measures = function(_) { + if (!arguments.length) return measures; + measures = _; + return chart; + }; + + chart.forceX = function(_) { + if (!arguments.length) return forceX; + forceX = _; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.tickFormat = function(_) { + if (!arguments.length) return tickFormat; + tickFormat = _; + return chart; + }; + + //============================================================ + + + return chart; +}; + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/backup/bulletChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/backup/bulletChart.js new file mode 100644 index 0000000..a2a0f07 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/backup/bulletChart.js @@ -0,0 +1,349 @@ + +// Chart design based on the recommendations of Stephen Few. Implementation +// based on the work of Clint Ivy, Jamie Love, and Jason Davies. +// http://projects.instantcognition.com/protovis/bulletchart/ +nv.models.bulletChart = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var bullet = nv.models.bullet() + ; + + var orient = 'left' // TODO top & bottom + , reverse = false + , margin = {top: 5, right: 40, bottom: 20, left: 120} + , ranges = function(d) { return d.ranges } + , markers = function(d) { return d.markers } + , measures = function(d) { return d.measures } + , width = null + , height = 55 + , tickFormat = null + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + e.label + '

      ' + + '

      ' + e.value + '

      ' + } + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, parentElement) { + var offsetElement = parentElement.parentNode.parentNode, + left = e.pos[0] + offsetElement.offsetLeft + margin.left, + top = e.pos[1] + offsetElement.offsetTop + margin.top; + + var content = '

      ' + e.label + '

      ' + + '

      ' + e.value + '

      '; + + nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement.parentNode); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(d, i) { + var container = d3.select(this); + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + that = this; + + + chart.update = function() { chart(selection) }; + chart.container = this; + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + /* + // Disabled until I figure out a better way to check for no data with the bullet chart + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + */ + + //------------------------------------------------------------ + + + + var rangez = ranges.call(this, d, i).slice().sort(d3.descending), + markerz = markers.call(this, d, i).slice().sort(d3.descending), + measurez = measures.call(this, d, i).slice().sort(d3.descending); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-bulletChart').data([d]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bulletChart'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-bulletWrap'); + gEnter.append('g').attr('class', 'nv-titles'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + ( margin.top + i*height )+ ')'); + + //------------------------------------------------------------ + + + // Compute the new x-scale. + var MaxX = Math.max(rangez[0] ? rangez[0]:0 , markerz[0] ? markerz[0] : 0 , measurez[0] ? measurez[0] : 0) + var x1 = d3.scale.linear() + .domain([0, MaxX]).nice() // TODO: need to allow forceX and forceY, and xDomain, yDomain + .range(reverse ? [availableWidth, 0] : [0, availableWidth]); + + // Retrieve the old x-scale, if this is an update. + var x0 = this.__chart__ || d3.scale.linear() + .domain([0, Infinity]) + .range(x1.range()); + + // Stash the new scale. + this.__chart__ = x1; + + /* + // Derive width-scales from the x-scales. + var w0 = bulletWidth(x0), + w1 = bulletWidth(x1); + + function bulletWidth(x) { + var x0 = x(0); + return function(d) { + return Math.abs(x(d) - x(0)); + }; + } + + function bulletTranslate(x) { + return function(d) { + return 'translate(' + x(d) + ',0)'; + }; + } + */ + + var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0) + w1 = function(d) { return Math.abs(x1(d) - x1(0)) }; + + + var title = gEnter.select('.nv-titles').append("g") + .attr("text-anchor", "end") + .attr("transform", "translate(-6," + (height - margin.top - margin.bottom) / 2 + ")"); + title.append("text") + .attr("class", "nv-title") + .text(function(d) { return d.title; }); + + title.append("text") + .attr("class", "nv-subtitle") + .attr("dy", "1em") + .text(function(d) { return d.subtitle; }); + + + + bullet + .width(availableWidth) + .height(availableHeight) + + var bulletWrap = g.select('.nv-bulletWrap'); + + d3.transition(bulletWrap).call(bullet); + + + + // Compute the tick format. + var format = tickFormat || x1.tickFormat(8); + + // Update the tick groups. + var tick = g.selectAll('g.nv-tick') + .data(x1.ticks(8), function(d) { + return this.textContent || format(d); + }); + + // Initialize the ticks with the old scale, x0. + var tickEnter = tick.enter().append('g') + .attr('class', 'nv-tick') + .attr('transform', function(d) { return 'translate(' + x0(d) + ',0)' }) + .style('opacity', 1e-6); + + tickEnter.append('line') + .attr('y1', availableHeight) + .attr('y2', availableHeight * 7 / 6); + + tickEnter.append('text') + .attr('text-anchor', 'middle') + .attr('dy', '1em') + .attr('y', availableHeight * 7 / 6) + .text(format); + + // Transition the entering ticks to the new scale, x1. + d3.transition(tickEnter) + .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' }) + .style('opacity', 1); + + // Transition the updating ticks to the new scale, x1. + var tickUpdate = d3.transition(tick) + .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' }) + .style('opacity', 1); + + tickUpdate.select('line') + .attr('y1', availableHeight) + .attr('y2', availableHeight * 7 / 6); + + tickUpdate.select('text') + .attr('y', availableHeight * 7 / 6); + + // Transition the exiting ticks to the new scale, x1. + d3.transition(tick.exit()) + .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' }) + .style('opacity', 1e-6) + .remove(); + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + //============================================================ + + }); + + d3.timer.flush(); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + bullet.dispatch.on('elementMouseover.tooltip', function(e) { + dispatch.tooltipShow(e); + }); + + bullet.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + chart.bullet = bullet; + + // left, right, top, bottom + chart.orient = function(x) { + if (!arguments.length) return orient; + orient = x; + reverse = orient == 'right' || orient == 'bottom'; + return chart; + }; + + // ranges (bad, satisfactory, good) + chart.ranges = function(x) { + if (!arguments.length) return ranges; + ranges = x; + return chart; + }; + + // markers (previous, goal) + chart.markers = function(x) { + if (!arguments.length) return markers; + markers = x; + return chart; + }; + + // measures (actual, forecast) + chart.measures = function(x) { + if (!arguments.length) return measures; + measures = x; + return chart; + }; + + chart.width = function(x) { + if (!arguments.length) return width; + width = x; + return chart; + }; + + chart.height = function(x) { + if (!arguments.length) return height; + height = x; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.tickFormat = function(x) { + if (!arguments.length) return tickFormat; + tickFormat = x; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +}; + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/boilerplate.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/boilerplate.js new file mode 100644 index 0000000..3d2360a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/boilerplate.js @@ -0,0 +1,104 @@ + +nv.models.chartName = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + + var margin = {top: 30, right: 10, bottom: 10, left: 10} + , width = 960 + , height = 500 + , color = nv.utils.getColor(d3.scale.category20c().range()) + , dispatch = d3.dispatch('stateChange', 'changeState') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup Scales + + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-chartName').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-chartName'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + gEnter.append('g').attr('class', 'nv-mainWrap'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + + chart.dispatch = dispatch; + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_) + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/bullet.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/bullet.js new file mode 100644 index 0000000..9b9bf4d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/bullet.js @@ -0,0 +1,385 @@ + +// Chart design based on the recommendations of Stephen Few. Implementation +// based on the work of Clint Ivy, Jamie Love, and Jason Davies. +// http://projects.instantcognition.com/protovis/bulletchart/ + +nv.models.bullet = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , orient = 'left' // TODO top & bottom + , reverse = false + , ranges = function(d) { return d.ranges } + , markers = function(d) { return d.markers } + , measures = function(d) { return d.measures } + , rangeLabels = function(d) { return d.rangeLabels ? d.rangeLabels : [] } + , markerLabels = function(d) { return d.markerLabels ? d.markerLabels : [] } + , measureLabels = function(d) { return d.measureLabels ? d.measureLabels : [] } + , forceX = [0] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.) + , width = 380 + , height = 30 + , tickFormat = null + , color = nv.utils.getColor(['#1f77b4']) + , dispatch = d3.dispatch('elementMouseover', 'elementMouseout') + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(d, i) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + var rangez = ranges.call(this, d, i).slice().sort(d3.descending), + markerz = markers.call(this, d, i).slice().sort(d3.descending), + measurez = measures.call(this, d, i).slice().sort(d3.descending), + rangeLabelz = rangeLabels.call(this, d, i).slice(), + markerLabelz = markerLabels.call(this, d, i).slice(), + measureLabelz = measureLabels.call(this, d, i).slice(); + + + //------------------------------------------------------------ + // Setup Scales + + // Compute the new x-scale. + var x1 = d3.scale.linear() + .domain( d3.extent(d3.merge([forceX, rangez])) ) + .range(reverse ? [availableWidth, 0] : [0, availableWidth]); + + // Retrieve the old x-scale, if this is an update. + var x0 = this.__chart__ || d3.scale.linear() + .domain([0, Infinity]) + .range(x1.range()); + + // Stash the new scale. + this.__chart__ = x1; + + + var rangeMin = d3.min(rangez), //rangez[2] + rangeMax = d3.max(rangez), //rangez[0] + rangeAvg = rangez[1]; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-bullet').data([d]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bullet'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('rect').attr('class', 'nv-range nv-rangeMax'); + gEnter.append('rect').attr('class', 'nv-range nv-rangeAvg'); + gEnter.append('rect').attr('class', 'nv-range nv-rangeMin'); + gEnter.append('rect').attr('class', 'nv-measure'); + gEnter.append('path').attr('class', 'nv-markerTriangle'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0) + w1 = function(d) { return Math.abs(x1(d) - x1(0)) }; + var xp0 = function(d) { return d < 0 ? x0(d) : x0(0) }, + xp1 = function(d) { return d < 0 ? x1(d) : x1(0) }; + + + g.select('rect.nv-rangeMax') + .attr('height', availableHeight) + .attr('width', w1(rangeMax > 0 ? rangeMax : rangeMin)) + .attr('x', xp1(rangeMax > 0 ? rangeMax : rangeMin)) + .datum(rangeMax > 0 ? rangeMax : rangeMin) + /* + .attr('x', rangeMin < 0 ? + rangeMax > 0 ? + x1(rangeMin) + : x1(rangeMax) + : x1(0)) + */ + + g.select('rect.nv-rangeAvg') + .attr('height', availableHeight) + .attr('width', w1(rangeAvg)) + .attr('x', xp1(rangeAvg)) + .datum(rangeAvg) + /* + .attr('width', rangeMax <= 0 ? + x1(rangeMax) - x1(rangeAvg) + : x1(rangeAvg) - x1(rangeMin)) + .attr('x', rangeMax <= 0 ? + x1(rangeAvg) + : x1(rangeMin)) + */ + + g.select('rect.nv-rangeMin') + .attr('height', availableHeight) + .attr('width', w1(rangeMax)) + .attr('x', xp1(rangeMax)) + .attr('width', w1(rangeMax > 0 ? rangeMin : rangeMax)) + .attr('x', xp1(rangeMax > 0 ? rangeMin : rangeMax)) + .datum(rangeMax > 0 ? rangeMin : rangeMax) + /* + .attr('width', rangeMax <= 0 ? + x1(rangeAvg) - x1(rangeMin) + : x1(rangeMax) - x1(rangeAvg)) + .attr('x', rangeMax <= 0 ? + x1(rangeMin) + : x1(rangeAvg)) + */ + + g.select('rect.nv-measure') + .style('fill', color) + .attr('height', availableHeight / 3) + .attr('y', availableHeight / 3) + .attr('width', measurez < 0 ? + x1(0) - x1(measurez[0]) + : x1(measurez[0]) - x1(0)) + .attr('x', xp1(measurez)) + .on('mouseover', function() { + dispatch.elementMouseover({ + value: measurez[0], + label: measureLabelz[0] || 'Current', + pos: [x1(measurez[0]), availableHeight/2] + }) + }) + .on('mouseout', function() { + dispatch.elementMouseout({ + value: measurez[0], + label: measureLabelz[0] || 'Current' + }) + }) + + var h3 = availableHeight / 6; + if (markerz[0]) { + g.selectAll('path.nv-markerTriangle') + .attr('transform', function(d) { return 'translate(' + x1(markerz[0]) + ',' + (availableHeight / 2) + ')' }) + .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z') + .on('mouseover', function() { + dispatch.elementMouseover({ + value: markerz[0], + label: markerLabelz[0] || 'Previous', + pos: [x1(markerz[0]), availableHeight/2] + }) + }) + .on('mouseout', function() { + dispatch.elementMouseout({ + value: markerz[0], + label: markerLabelz[0] || 'Previous' + }) + }); + } else { + g.selectAll('path.nv-markerTriangle').remove(); + } + + + wrap.selectAll('.nv-range') + .on('mouseover', function(d,i) { + var label = rangeLabelz[i] || (!i ? "Maximum" : i == 1 ? "Mean" : "Minimum"); + + dispatch.elementMouseover({ + value: d, + label: label, + pos: [x1(d), availableHeight/2] + }) + }) + .on('mouseout', function(d,i) { + var label = rangeLabelz[i] || (!i ? "Maximum" : i == 1 ? "Mean" : "Minimum"); + + dispatch.elementMouseout({ + value: d, + label: label + }) + }) + +/* // THIS IS THE PREVIOUS BULLET IMPLEMENTATION, WILL REMOVE SHORTLY + // Update the range rects. + var range = g.selectAll('rect.nv-range') + .data(rangez); + + range.enter().append('rect') + .attr('class', function(d, i) { return 'nv-range nv-s' + i; }) + .attr('width', w0) + .attr('height', availableHeight) + .attr('x', reverse ? x0 : 0) + .on('mouseover', function(d,i) { + dispatch.elementMouseover({ + value: d, + label: (i <= 0) ? 'Maximum' : (i > 1) ? 'Minimum' : 'Mean', //TODO: make these labels a variable + pos: [x1(d), availableHeight/2] + }) + }) + .on('mouseout', function(d,i) { + dispatch.elementMouseout({ + value: d, + label: (i <= 0) ? 'Minimum' : (i >=1) ? 'Maximum' : 'Mean' //TODO: make these labels a variable + }) + }) + + d3.transition(range) + .attr('x', reverse ? x1 : 0) + .attr('width', w1) + .attr('height', availableHeight); + + + // Update the measure rects. + var measure = g.selectAll('rect.nv-measure') + .data(measurez); + + measure.enter().append('rect') + .attr('class', function(d, i) { return 'nv-measure nv-s' + i; }) + .style('fill', function(d,i) { return color(d,i ) }) + .attr('width', w0) + .attr('height', availableHeight / 3) + .attr('x', reverse ? x0 : 0) + .attr('y', availableHeight / 3) + .on('mouseover', function(d) { + dispatch.elementMouseover({ + value: d, + label: 'Current', //TODO: make these labels a variable + pos: [x1(d), availableHeight/2] + }) + }) + .on('mouseout', function(d) { + dispatch.elementMouseout({ + value: d, + label: 'Current' //TODO: make these labels a variable + }) + }) + + d3.transition(measure) + .attr('width', w1) + .attr('height', availableHeight / 3) + .attr('x', reverse ? x1 : 0) + .attr('y', availableHeight / 3); + + + + // Update the marker lines. + var marker = g.selectAll('path.nv-markerTriangle') + .data(markerz); + + var h3 = availableHeight / 6; + marker.enter().append('path') + .attr('class', 'nv-markerTriangle') + .attr('transform', function(d) { return 'translate(' + x0(d) + ',' + (availableHeight / 2) + ')' }) + .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z') + .on('mouseover', function(d,i) { + dispatch.elementMouseover({ + value: d, + label: 'Previous', + pos: [x1(d), availableHeight/2] + }) + }) + .on('mouseout', function(d,i) { + dispatch.elementMouseout({ + value: d, + label: 'Previous' + }) + }); + + d3.transition(marker) + .attr('transform', function(d) { return 'translate(' + (x1(d) - x1(0)) + ',' + (availableHeight / 2) + ')' }); + + marker.exit().remove(); +*/ + + }); + + // d3.timer.flush(); // Not needed? + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.options = nv.utils.optionsFunc.bind(chart); + + // left, right, top, bottom + chart.orient = function(_) { + if (!arguments.length) return orient; + orient = _; + reverse = orient == 'right' || orient == 'bottom'; + return chart; + }; + + // ranges (bad, satisfactory, good) + chart.ranges = function(_) { + if (!arguments.length) return ranges; + ranges = _; + return chart; + }; + + // markers (previous, goal) + chart.markers = function(_) { + if (!arguments.length) return markers; + markers = _; + return chart; + }; + + // measures (actual, forecast) + chart.measures = function(_) { + if (!arguments.length) return measures; + measures = _; + return chart; + }; + + chart.forceX = function(_) { + if (!arguments.length) return forceX; + forceX = _; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.tickFormat = function(_) { + if (!arguments.length) return tickFormat; + tickFormat = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + //============================================================ + + + return chart; +}; + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/bulletChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/bulletChart.js new file mode 100644 index 0000000..fa5bd59 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/bulletChart.js @@ -0,0 +1,343 @@ + +// Chart design based on the recommendations of Stephen Few. Implementation +// based on the work of Clint Ivy, Jamie Love, and Jason Davies. +// http://projects.instantcognition.com/protovis/bulletchart/ +nv.models.bulletChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var bullet = nv.models.bullet() + ; + + var orient = 'left' // TODO top & bottom + , reverse = false + , margin = {top: 5, right: 40, bottom: 20, left: 120} + , ranges = function(d) { return d.ranges } + , markers = function(d) { return d.markers } + , measures = function(d) { return d.measures } + , width = null + , height = 55 + , tickFormat = null + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + x + '

      ' + + '

      ' + y + '

      ' + } + , noData = 'No Data Available.' + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ) + margin.left, + top = e.pos[1] + ( offsetElement.offsetTop || 0) + margin.top, + content = tooltip(e.key, e.label, e.value, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(d, i) { + var container = d3.select(this); + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + that = this; + + + chart.update = function() { chart(selection) }; + chart.container = this; + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!d || !ranges.call(this, d, i)) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', 18 + margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + + var rangez = ranges.call(this, d, i).slice().sort(d3.descending), + markerz = markers.call(this, d, i).slice().sort(d3.descending), + measurez = measures.call(this, d, i).slice().sort(d3.descending); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-bulletChart').data([d]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bulletChart'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-bulletWrap'); + gEnter.append('g').attr('class', 'nv-titles'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + // Compute the new x-scale. + var x1 = d3.scale.linear() + .domain([0, Math.max(rangez[0], markerz[0], measurez[0])]) // TODO: need to allow forceX and forceY, and xDomain, yDomain + .range(reverse ? [availableWidth, 0] : [0, availableWidth]); + + // Retrieve the old x-scale, if this is an update. + var x0 = this.__chart__ || d3.scale.linear() + .domain([0, Infinity]) + .range(x1.range()); + + // Stash the new scale. + this.__chart__ = x1; + + /* + // Derive width-scales from the x-scales. + var w0 = bulletWidth(x0), + w1 = bulletWidth(x1); + + function bulletWidth(x) { + var x0 = x(0); + return function(d) { + return Math.abs(x(d) - x(0)); + }; + } + + function bulletTranslate(x) { + return function(d) { + return 'translate(' + x(d) + ',0)'; + }; + } + */ + + var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0) + w1 = function(d) { return Math.abs(x1(d) - x1(0)) }; + + + var title = gEnter.select('.nv-titles').append('g') + .attr('text-anchor', 'end') + .attr('transform', 'translate(-6,' + (height - margin.top - margin.bottom) / 2 + ')'); + title.append('text') + .attr('class', 'nv-title') + .text(function(d) { return d.title; }); + + title.append('text') + .attr('class', 'nv-subtitle') + .attr('dy', '1em') + .text(function(d) { return d.subtitle; }); + + + + bullet + .width(availableWidth) + .height(availableHeight) + + var bulletWrap = g.select('.nv-bulletWrap'); + + d3.transition(bulletWrap).call(bullet); + + + + // Compute the tick format. + var format = tickFormat || x1.tickFormat( availableWidth / 100 ); + + // Update the tick groups. + var tick = g.selectAll('g.nv-tick') + .data(x1.ticks( availableWidth / 50 ), function(d) { + return this.textContent || format(d); + }); + + // Initialize the ticks with the old scale, x0. + var tickEnter = tick.enter().append('g') + .attr('class', 'nv-tick') + .attr('transform', function(d) { return 'translate(' + x0(d) + ',0)' }) + .style('opacity', 1e-6); + + tickEnter.append('line') + .attr('y1', availableHeight) + .attr('y2', availableHeight * 7 / 6); + + tickEnter.append('text') + .attr('text-anchor', 'middle') + .attr('dy', '1em') + .attr('y', availableHeight * 7 / 6) + .text(format); + + + // Transition the updating ticks to the new scale, x1. + var tickUpdate = d3.transition(tick) + .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' }) + .style('opacity', 1); + + tickUpdate.select('line') + .attr('y1', availableHeight) + .attr('y2', availableHeight * 7 / 6); + + tickUpdate.select('text') + .attr('y', availableHeight * 7 / 6); + + // Transition the exiting ticks to the new scale, x1. + d3.transition(tick.exit()) + .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' }) + .style('opacity', 1e-6) + .remove(); + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + dispatch.on('tooltipShow', function(e) { + e.key = d.title; + if (tooltips) showTooltip(e, that.parentNode); + }); + + //============================================================ + + }); + + d3.timer.flush(); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + bullet.dispatch.on('elementMouseover.tooltip', function(e) { + dispatch.tooltipShow(e); + }); + + bullet.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + chart.bullet = bullet; + + d3.rebind(chart, bullet, 'color'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + // left, right, top, bottom + chart.orient = function(x) { + if (!arguments.length) return orient; + orient = x; + reverse = orient == 'right' || orient == 'bottom'; + return chart; + }; + + // ranges (bad, satisfactory, good) + chart.ranges = function(x) { + if (!arguments.length) return ranges; + ranges = x; + return chart; + }; + + // markers (previous, goal) + chart.markers = function(x) { + if (!arguments.length) return markers; + markers = x; + return chart; + }; + + // measures (actual, forecast) + chart.measures = function(x) { + if (!arguments.length) return measures; + measures = x; + return chart; + }; + + chart.width = function(x) { + if (!arguments.length) return width; + width = x; + return chart; + }; + + chart.height = function(x) { + if (!arguments.length) return height; + height = x; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.tickFormat = function(x) { + if (!arguments.length) return tickFormat; + tickFormat = x; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +}; + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/cumulativeLineChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/cumulativeLineChart.js new file mode 100644 index 0000000..00f193c --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/cumulativeLineChart.js @@ -0,0 +1,782 @@ + +nv.models.cumulativeLineChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var lines = nv.models.line() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + , controls = nv.models.legend() + , interactiveLayer = nv.interactiveGuideline() + ; + + var margin = {top: 30, right: 30, bottom: 50, left: 60} + , color = nv.utils.defaultColor() + , width = null + , height = null + , showLegend = true + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , tooltips = true + , showControls = true + , useInteractiveGuideline = false + , rescaleY = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' at ' + x + '

      ' + } + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , id = lines.id() + , state = { index: 0, rescaleY: rescaleY } + , defaultState = null + , noData = 'No Data Available.' + , average = function(d) { return d.average } + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , transitionDuration = 250 + ; + + xAxis + .orient('bottom') + .tickPadding(7) + ; + yAxis + .orient((rightAlignYAxis) ? 'right' : 'left') + ; + + //============================================================ + controls.updateState(false); + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var dx = d3.scale.linear() + , index = {i: 0, x: 0} + ; + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, null, null, offsetElement); + }; + +/* + //Moved to see if we can get better behavior to fix issue #315 + var indexDrag = d3.behavior.drag() + .on('dragstart', dragStart) + .on('drag', dragMove) + .on('dragend', dragEnd); + + function dragStart(d,i) { + d3.select(chart.container) + .style('cursor', 'ew-resize'); + } + + function dragMove(d,i) { + d.x += d3.event.dx; + d.i = Math.round(dx.invert(d.x)); + + d3.select(this).attr('transform', 'translate(' + dx(d.i) + ',0)'); + chart.update(); + } + + function dragEnd(d,i) { + d3.select(chart.container) + .style('cursor', 'auto'); + chart.update(); + } +*/ + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this).classed('nv-chart-' + id, true), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + + chart.update = function() { container.transition().duration(transitionDuration).call(chart) }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + var indexDrag = d3.behavior.drag() + .on('dragstart', dragStart) + .on('drag', dragMove) + .on('dragend', dragEnd); + + + function dragStart(d,i) { + d3.select(chart.container) + .style('cursor', 'ew-resize'); + } + + function dragMove(d,i) { + index.x = d3.event.x; + index.i = Math.round(dx.invert(index.x)); + updateZero(); + } + + function dragEnd(d,i) { + d3.select(chart.container) + .style('cursor', 'auto'); + + // update state and send stateChange with new index + state.index = index.i; + dispatch.stateChange(state); + } + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = lines.xScale(); + y = lines.yScale(); + + + if (!rescaleY) { + var seriesDomains = data + .filter(function(series) { return !series.disabled }) + .map(function(series,i) { + var initialDomain = d3.extent(series.values, lines.y()); + + //account for series being disabled when losing 95% or more + if (initialDomain[0] < -.95) initialDomain[0] = -.95; + + return [ + (initialDomain[0] - initialDomain[1]) / (1 + initialDomain[1]), + (initialDomain[1] - initialDomain[0]) / (1 + initialDomain[0]) + ]; + }); + + var completeDomain = [ + d3.min(seriesDomains, function(d) { return d[0] }), + d3.max(seriesDomains, function(d) { return d[1] }) + ] + + lines.yDomain(completeDomain); + } else { + lines.yDomain(null); + } + + + dx .domain([0, data[0].values.length - 1]) //Assumes all series have same length + .range([0, availableWidth]) + .clamp(true); + + //------------------------------------------------------------ + + + var data = indexify(index.i, data); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + var interactivePointerEvents = (useInteractiveGuideline) ? "none" : "all"; + var wrap = container.selectAll('g.nv-wrap.nv-cumulativeLine').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-cumulativeLine').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-interactive'); + gEnter.append('g').attr('class', 'nv-x nv-axis').style("pointer-events","none"); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-background'); + gEnter.append('g').attr('class', 'nv-linesWrap').style("pointer-events",interactivePointerEvents); + gEnter.append('g').attr('class', 'nv-avgLinesWrap').style("pointer-events","none"); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')') + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + var controlsData = [ + { key: 'Re-scale y-axis', disabled: !rescaleY } + ]; + + controls.width(140).color(['#444', '#444', '#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + // Show error if series goes below 100% + var tempDisabled = data.filter(function(d) { return d.tempDisabled }); + + wrap.select('.tempDisabled').remove(); //clean-up and prevent duplicates + if (tempDisabled.length) { + wrap.append('text').attr('class', 'tempDisabled') + .attr('x', availableWidth / 2) + .attr('y', '-.71em') + .style('text-anchor', 'end') + .text(tempDisabled.map(function(d) { return d.key }).join(', ') + ' values cannot be calculated for this time period.'); + } + + //------------------------------------------------------------ + // Main Chart Component(s) + + //------------------------------------------------------------ + //Set up interactive layer + if (useInteractiveGuideline) { + interactiveLayer + .width(availableWidth) + .height(availableHeight) + .margin({left:margin.left,top:margin.top}) + .svgContainer(container) + .xScale(x); + wrap.select(".nv-interactive").call(interactiveLayer); + } + + gEnter.select('.nv-background') + .append('rect'); + + g.select('.nv-background rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + lines + //.x(function(d) { return d.x }) + .y(function(d) { return d.display.y }) + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && !data[i].tempDisabled; })); + + + + var linesWrap = g.select('.nv-linesWrap') + .datum(data.filter(function(d) { return !d.disabled && !d.tempDisabled })); + + //d3.transition(linesWrap).call(lines); + linesWrap.call(lines); + + /*Handle average lines [AN-612] ----------------------------*/ + + //Store a series index number in the data array. + data.forEach(function(d,i) { + d.seriesIndex = i; + }); + + var avgLineData = data.filter(function(d) { + return !d.disabled && !!average(d); + }); + + var avgLines = g.select(".nv-avgLinesWrap").selectAll("line") + .data(avgLineData, function(d) { return d.key; }); + + var getAvgLineY = function(d) { + //If average lines go off the svg element, clamp them to the svg bounds. + var yVal = y(average(d)); + if (yVal < 0) return 0; + if (yVal > availableHeight) return availableHeight; + return yVal; + }; + + avgLines.enter() + .append('line') + .style('stroke-width',2) + .style('stroke-dasharray','10,10') + .style('stroke',function (d,i) { + return lines.color()(d,d.seriesIndex); + }) + .attr('x1',0) + .attr('x2',availableWidth) + .attr('y1', getAvgLineY) + .attr('y2', getAvgLineY); + + avgLines + .style('stroke-opacity',function(d){ + //If average lines go offscreen, make them transparent + var yVal = y(average(d)); + if (yVal < 0 || yVal > availableHeight) return 0; + return 1; + }) + .attr('x1',0) + .attr('x2',availableWidth) + .attr('y1', getAvgLineY) + .attr('y2', getAvgLineY); + + avgLines.exit().remove(); + + //Create index line ----------------------------------------- + + var indexLine = linesWrap.selectAll('.nv-indexLine') + .data([index]); + indexLine.enter().append('rect').attr('class', 'nv-indexLine') + .attr('width', 3) + .attr('x', -2) + .attr('fill', 'red') + .attr('fill-opacity', .5) + .style("pointer-events","all") + .call(indexDrag) + + indexLine + .attr('transform', function(d) { return 'translate(' + dx(d.i) + ',0)' }) + .attr('height', availableHeight) + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + if (showXAxis) { + xAxis + .scale(x) + //Suggest how many ticks based on the chart width and D3 should listen (70 is the optimal number for MM/DD/YY dates) + .ticks( Math.min(data[0].values.length,availableWidth/70) ) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')'); + d3.transition(g.select('.nv-x.nv-axis')) + .call(xAxis); + } + + + if (showYAxis) { + yAxis + .scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + d3.transition(g.select('.nv-y.nv-axis')) + .call(yAxis); + } + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + + function updateZero() { + indexLine + .data([index]); + + //When dragging the index line, turn off line transitions. + // Then turn them back on when done dragging. + var oldDuration = chart.transitionDuration(); + chart.transitionDuration(0); + chart.update(); + chart.transitionDuration(oldDuration); + } + + g.select('.nv-background rect') + .on('click', function() { + index.x = d3.mouse(this)[0]; + index.i = Math.round(dx.invert(index.x)); + + // update state and send stateChange with new index + state.index = index.i; + dispatch.stateChange(state); + + updateZero(); + }); + + lines.dispatch.on('elementClick', function(e) { + index.i = e.pointIndex; + index.x = dx(index.i); + + // update state and send stateChange with new index + state.index = index.i; + dispatch.stateChange(state); + + updateZero(); + }); + + controls.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + rescaleY = !d.disabled; + + state.rescaleY = rescaleY; + dispatch.stateChange(state); + chart.update(); + }); + + + legend.dispatch.on('stateChange', function(newState) { + state.disabled = newState.disabled; + dispatch.stateChange(state); + chart.update(); + }); + + interactiveLayer.dispatch.on('elementMousemove', function(e) { + lines.clearHighlights(); + var singlePoint, pointIndex, pointXLocation, allData = []; + + + data + .filter(function(series, i) { + series.seriesIndex = i; + return !series.disabled; + }) + .forEach(function(series,i) { + pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x()); + lines.highlightPoint(i, pointIndex, true); + var point = series.values[pointIndex]; + if (typeof point === 'undefined') return; + if (typeof singlePoint === 'undefined') singlePoint = point; + if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex)); + allData.push({ + key: series.key, + value: chart.y()(point, pointIndex), + color: color(series,series.seriesIndex) + }); + }); + + //Highlight the tooltip entry based on which point the mouse is closest to. + if (allData.length > 2) { + var yValue = chart.yScale().invert(e.mouseY); + var domainExtent = Math.abs(chart.yScale().domain()[0] - chart.yScale().domain()[1]); + var threshold = 0.03 * domainExtent; + var indexToHighlight = nv.nearestValueIndex(allData.map(function(d){return d.value}),yValue,threshold); + if (indexToHighlight !== null) + allData[indexToHighlight].highlight = true; + } + + var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex), pointIndex); + interactiveLayer.tooltip + .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top}) + .chartContainer(that.parentNode) + .enabled(tooltips) + .valueFormatter(function(d,i) { + return yAxis.tickFormat()(d); + }) + .data( + { + value: xValue, + series: allData + } + )(); + + interactiveLayer.renderGuideLine(pointXLocation); + + }); + + interactiveLayer.dispatch.on("elementMouseout",function(e) { + dispatch.tooltipHide(); + lines.clearHighlights(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + + if (typeof e.index !== 'undefined') { + index.i = e.index; + index.x = dx(index.i); + + state.index = e.index; + + indexLine + .data([index]); + } + + + if (typeof e.rescaleY !== 'undefined') { + rescaleY = e.rescaleY; + } + + chart.update(); + }); + + //============================================================ + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.lines = lines; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + chart.interactiveLayer = interactiveLayer; + + d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'xScale','yScale', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi','useVoronoi', 'id'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.rescaleY = function(_) { + if (!arguments.length) return rescaleY; + rescaleY = _; + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.useInteractiveGuideline = function(_) { + if(!arguments.length) return useInteractiveGuideline; + useInteractiveGuideline = _; + if (_ === true) { + chart.interactive(false); + chart.useVoronoi(false); + } + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.average = function(_) { + if(!arguments.length) return average; + average = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + //============================================================ + + + //============================================================ + // Functions + //------------------------------------------------------------ + + /* Normalize the data according to an index point. */ + function indexify(idx, data) { + return data.map(function(line, i) { + if (!line.values) { + return line; + } + var v = lines.y()(line.values[idx], idx); + + //TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue + if (v < -.95) { + //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically correct till it hits 100) + line.tempDisabled = true; + return line; + } + + line.tempDisabled = false; + + line.values = line.values.map(function(point, pointIndex) { + point.display = {'y': (lines.y()(point, pointIndex) - v) / (1 + v) }; + return point; + }) + + return line; + }) + } + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/discreteBar.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/discreteBar.js new file mode 100644 index 0000000..a20f582 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/discreteBar.js @@ -0,0 +1,349 @@ +//TODO: consider deprecating by adding necessary features to multiBar model +nv.models.discreteBar = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , x = d3.scale.ordinal() + , y = d3.scale.linear() + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove + , color = nv.utils.defaultColor() + , showValues = false + , valueFormat = d3.format(',.2f') + , xDomain + , yDomain + , xRange + , yRange + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + , rectClass = 'discreteBar' + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + + //add series index to each data point for reference + data.forEach(function(series, i) { + series.values.forEach(function(point) { + point.series = i; + }); + }); + + + //------------------------------------------------------------ + // Setup Scales + + // remap and flatten the data for use in calculating the scales' domains + var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate + data.map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i), y0: d.y0 } + }) + }); + + x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x })) + .rangeBands(xRange || [0, availableWidth], .1); + + y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y }).concat(forceY))); + + + // If showValues, pad the Y axis range to account for label height + if (showValues) y.range(yRange || [availableHeight - (y.domain()[0] < 0 ? 12 : 0), y.domain()[1] > 0 ? 12 : 0]); + else y.range(yRange || [availableHeight, 0]); + + //store old scales if they exist + x0 = x0 || x; + y0 = y0 || y.copy().range([y(0),y(0)]); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-discretebar').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discretebar'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-groups'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + //TODO: by definition, the discrete bar should not have multiple groups, will modify/remove later + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d) { return d.key }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + groups.exit() + .transition() + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6) + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }); + groups + .transition() + .style('stroke-opacity', 1) + .style('fill-opacity', .75); + + + var bars = groups.selectAll('g.nv-bar') + .data(function(d) { return d.values }); + + bars.exit().remove(); + + + var barsEnter = bars.enter().append('g') + .attr('transform', function(d,i,j) { + return 'translate(' + (x(getX(d,i)) + x.rangeBand() * .05 ) + ', ' + y(0) + ')' + }) + .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('mouseout', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + value: getY(d,i), + point: d, + series: data[d.series], + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('click', function(d,i) { + dispatch.elementClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + dispatch.elementDblClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }); + + barsEnter.append('rect') + .attr('height', 0) + .attr('width', x.rangeBand() * .9 / data.length ) + + if (showValues) { + barsEnter.append('text') + .attr('text-anchor', 'middle') + ; + + bars.select('text') + .text(function(d,i) { return valueFormat(getY(d,i)) }) + .transition() + .attr('x', x.rangeBand() * .9 / 2) + .attr('y', function(d,i) { return getY(d,i) < 0 ? y(getY(d,i)) - y(0) + 12 : -4 }) + + ; + } else { + bars.selectAll('text').remove(); + } + + bars + .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive' }) + .style('fill', function(d,i) { return d.color || color(d,i) }) + .style('stroke', function(d,i) { return d.color || color(d,i) }) + .select('rect') + .attr('class', rectClass) + .transition() + .attr('width', x.rangeBand() * .9 / data.length); + bars.transition() + //.delay(function(d,i) { return i * 1200 / data[0].values.length }) + .attr('transform', function(d,i) { + var left = x(getX(d,i)) + x.rangeBand() * .05, + top = getY(d,i) < 0 ? + y(0) : + y(0) - y(getY(d,i)) < 1 ? + y(0) - 1 : //make 1 px positive bars show up above y=0 + y(getY(d,i)); + + return 'translate(' + left + ', ' + top + ')' + }) + .select('rect') + .attr('height', function(d,i) { + return Math.max(Math.abs(y(getY(d,i)) - y((yDomain && yDomain[0]) || 0)) || 1) + }); + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.xRange = function(_) { + if (!arguments.length) return xRange; + xRange = _; + return chart; + }; + + chart.yRange = function(_) { + if (!arguments.length) return yRange; + yRange = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.showValues = function(_) { + if (!arguments.length) return showValues; + showValues = _; + return chart; + }; + + chart.valueFormat= function(_) { + if (!arguments.length) return valueFormat; + valueFormat = _; + return chart; + }; + + chart.rectClass= function(_) { + if (!arguments.length) return rectClass; + rectClass = _; + return chart; + }; + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/discreteBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/discreteBarChart.js new file mode 100644 index 0000000..48a4816 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/discreteBarChart.js @@ -0,0 +1,333 @@ + +nv.models.discreteBarChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var discretebar = nv.models.discreteBar() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + ; + + var margin = {top: 15, right: 10, bottom: 50, left: 60} + , width = null + , height = null + , color = nv.utils.getColor() + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , staggerLabels = false + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + x + '

      ' + + '

      ' + y + '

      ' + } + , x + , y + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'beforeUpdate') + , transitionDuration = 250 + ; + + xAxis + .orient('bottom') + .highlightZero(false) + .showMaxMin(false) + .tickFormat(function(d) { return d }) + ; + yAxis + .orient((rightAlignYAxis) ? 'right' : 'left') + .tickFormat(d3.format(',.1f')) + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(discretebar.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(discretebar.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + + chart.update = function() { + dispatch.beforeUpdate(); + container.transition().duration(transitionDuration).call(chart); + }; + chart.container = this; + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = discretebar.xScale(); + y = discretebar.yScale().clamp(true); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-discreteBarWithAxes').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discreteBarWithAxes').append('g'); + var defsEnter = gEnter.append('defs'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-barsWrap'); + + g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Main Chart Component(s) + + discretebar + .width(availableWidth) + .height(availableHeight); + + + var barsWrap = g.select('.nv-barsWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + barsWrap.transition().call(discretebar); + + //------------------------------------------------------------ + + + + defsEnter.append('clipPath') + .attr('id', 'nv-x-label-clip-' + discretebar.id()) + .append('rect'); + + g.select('#nv-x-label-clip-' + discretebar.id() + ' rect') + .attr('width', x.rangeBand() * (staggerLabels ? 2 : 1)) + .attr('height', 16) + .attr('x', -x.rangeBand() / (staggerLabels ? 1 : 2 )); + + + //------------------------------------------------------------ + // Setup Axes + + if (showXAxis) { + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + (y.range()[0] + ((discretebar.showValues() && y.domain()[0] < 0) ? 16 : 0)) + ')'); + //d3.transition(g.select('.nv-x.nv-axis')) + g.select('.nv-x.nv-axis').transition() + .call(xAxis); + + + var xTicks = g.select('.nv-x.nv-axis').selectAll('g'); + + if (staggerLabels) { + xTicks + .selectAll('text') + .attr('transform', function(d,i,j) { return 'translate(0,' + (j % 2 == 0 ? '5' : '17') + ')' }) + } + } + + if (showYAxis) { + yAxis + .scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-y.nv-axis').transition() + .call(yAxis); + } + + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + //============================================================ + + + }); + + return chart; + } + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + discretebar.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + discretebar.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.discretebar = discretebar; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, discretebar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'id', 'showValues', 'valueFormat'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + discretebar.color(color); + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + chart.staggerLabels = function(_) { + if (!arguments.length) return staggerLabels; + staggerLabels = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/distribution.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/distribution.js new file mode 100644 index 0000000..62a7465 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/distribution.js @@ -0,0 +1,148 @@ + +nv.models.distribution = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 400 //technically width or height depending on x or y.... + , size = 8 + , axis = 'x' // 'x' or 'y'... horizontal or vertical + , getData = function(d) { return d[axis] } // defaults d.x or d.y + , color = nv.utils.defaultColor() + , scale = d3.scale.linear() + , domain + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var scale0; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableLength = width - (axis === 'x' ? margin.left + margin.right : margin.top + margin.bottom), + naxis = axis == 'x' ? 'y' : 'x', + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup Scales + + scale0 = scale0 || scale; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-distribution').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-distribution'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')') + + //------------------------------------------------------------ + + + var distWrap = g.selectAll('g.nv-dist') + .data(function(d) { return d }, function(d) { return d.key }); + + distWrap.enter().append('g'); + distWrap + .attr('class', function(d,i) { return 'nv-dist nv-series-' + i }) + .style('stroke', function(d,i) { return color(d, i) }); + + var dist = distWrap.selectAll('line.nv-dist' + axis) + .data(function(d) { return d.values }) + dist.enter().append('line') + .attr(axis + '1', function(d,i) { return scale0(getData(d,i)) }) + .attr(axis + '2', function(d,i) { return scale0(getData(d,i)) }) + distWrap.exit().selectAll('line.nv-dist' + axis) + .transition() + .attr(axis + '1', function(d,i) { return scale(getData(d,i)) }) + .attr(axis + '2', function(d,i) { return scale(getData(d,i)) }) + .style('stroke-opacity', 0) + .remove(); + dist + .attr('class', function(d,i) { return 'nv-dist' + axis + ' nv-dist' + axis + '-' + i }) + .attr(naxis + '1', 0) + .attr(naxis + '2', size); + dist + .transition() + .attr(axis + '1', function(d,i) { return scale(getData(d,i)) }) + .attr(axis + '2', function(d,i) { return scale(getData(d,i)) }) + + + scale0 = scale.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.axis = function(_) { + if (!arguments.length) return axis; + axis = _; + return chart; + }; + + chart.size = function(_) { + if (!arguments.length) return size; + size = _; + return chart; + }; + + chart.getData = function(_) { + if (!arguments.length) return getData; + getData = d3.functor(_); + return chart; + }; + + chart.scale = function(_) { + if (!arguments.length) return scale; + scale = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/historicalBar.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/historicalBar.js new file mode 100644 index 0000000..2a6c644 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/historicalBar.js @@ -0,0 +1,331 @@ +//TODO: consider deprecating and using multibar with single series for this +nv.models.historicalBar = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , x = d3.scale.linear() + , y = d3.scale.linear() + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , forceX = [] + , forceY = [0] + , padData = false + , clipEdge = true + , color = nv.utils.defaultColor() + , xDomain + , yDomain + , xRange + , yRange + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + , interactive = true + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup Scales + + x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) )) + + if (padData) + x.range(xRange || [availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]); + else + x.range(xRange || [0, availableWidth]); + + y .domain(yDomain || d3.extent(data[0].values.map(getY).concat(forceY) )) + .range(yRange || [availableHeight, 0]); + + // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point + + if (x.domain()[0] === x.domain()[1]) + x.domain()[0] ? + x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) + : x.domain([-1,1]); + + if (y.domain()[0] === y.domain()[1]) + y.domain()[0] ? + y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01]) + : y.domain([-1,1]); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-historicalBar-' + id).data([data[0].values]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-historicalBar-' + id); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-bars'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + container + .on('click', function(d,i) { + dispatch.chartClick({ + data: d, + index: i, + pos: d3.event, + id: id + }); + }); + + + defsEnter.append('clipPath') + .attr('id', 'nv-chart-clip-path-' + id) + .append('rect'); + + wrap.select('#nv-chart-clip-path-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : ''); + + + + var bars = wrap.select('.nv-bars').selectAll('.nv-bar') + .data(function(d) { return d }, function(d,i) {return getX(d,i)}); + + bars.exit().remove(); + + + var barsEnter = bars.enter().append('rect') + //.attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i }) + .attr('x', 0 ) + .attr('y', function(d,i) { return nv.utils.NaNtoZero(y(Math.max(0, getY(d,i)))) }) + .attr('height', function(d,i) { return nv.utils.NaNtoZero(Math.abs(y(getY(d,i)) - y(0))) }) + .attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; }) + .on('mouseover', function(d,i) { + if (!interactive) return; + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + point: d, + series: data[0], + pos: [x(getX(d,i)), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: 0, + e: d3.event + }); + + }) + .on('mouseout', function(d,i) { + if (!interactive) return; + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + point: d, + series: data[0], + pointIndex: i, + seriesIndex: 0, + e: d3.event + }); + }) + .on('click', function(d,i) { + if (!interactive) return; + dispatch.elementClick({ + //label: d[label], + value: getY(d,i), + data: d, + index: i, + pos: [x(getX(d,i)), y(getY(d,i))], + e: d3.event, + id: id + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + if (!interactive) return; + dispatch.elementDblClick({ + //label: d[label], + value: getY(d,i), + data: d, + index: i, + pos: [x(getX(d,i)), y(getY(d,i))], + e: d3.event, + id: id + }); + d3.event.stopPropagation(); + }); + + bars + .attr('fill', function(d,i) { return color(d, i); }) + .attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i }) + .transition() + .attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; }) + //TODO: better width calculations that don't assume always uniform data spacing;w + .attr('width', (availableWidth / data[0].values.length) * .9 ); + + + bars.transition() + .attr('y', function(d,i) { + var rval = getY(d,i) < 0 ? + y(0) : + y(0) - y(getY(d,i)) < 1 ? + y(0) - 1 : + y(getY(d,i)); + return nv.utils.NaNtoZero(rval); + }) + .attr('height', function(d,i) { return nv.utils.NaNtoZero(Math.max(Math.abs(y(getY(d,i)) - y(0)),1)) }); + + }); + + return chart; + } + + //Create methods to allow outside functions to highlight a specific bar. + chart.highlightPoint = function(pointIndex, isHoverOver) { + d3.select(".nv-historicalBar-" + id) + .select(".nv-bars .nv-bar-0-" + pointIndex) + .classed("hover", isHoverOver) + ; + }; + + chart.clearHighlights = function() { + d3.select(".nv-historicalBar-" + id) + .select(".nv-bars .nv-bar.hover") + .classed("hover", false) + ; + }; + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.xRange = function(_) { + if (!arguments.length) return xRange; + xRange = _; + return chart; + }; + + chart.yRange = function(_) { + if (!arguments.length) return yRange; + yRange = _; + return chart; + }; + + chart.forceX = function(_) { + if (!arguments.length) return forceX; + forceX = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.padData = function(_) { + if (!arguments.length) return padData; + padData = _; + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.interactive = function(_) { + if(!arguments.length) return interactive; + interactive = false; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/historicalBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/historicalBarChart.js new file mode 100644 index 0000000..a5b4a09 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/historicalBarChart.js @@ -0,0 +1,419 @@ + +nv.models.historicalBarChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var bars = nv.models.historicalBar() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + ; + + + var margin = {top: 30, right: 90, bottom: 50, left: 90} + , color = nv.utils.defaultColor() + , width = null + , height = null + , showLegend = false + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' at ' + x + '

      ' + } + , x + , y + , state = {} + , defaultState = null + , noData = 'No Data Available.' + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , transitionDuration = 250 + ; + + xAxis + .orient('bottom') + .tickPadding(7) + ; + yAxis + .orient( (rightAlignYAxis) ? 'right' : 'left') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + + // New addition to calculate position if SVG is scaled with viewBox, may move TODO: consider implementing everywhere else + if (offsetElement) { + var svg = d3.select(offsetElement).select('svg'); + var viewBox = (svg.node()) ? svg.attr('viewBox') : null; + if (viewBox) { + viewBox = viewBox.split(' '); + var ratio = parseInt(svg.style('width')) / viewBox[2]; + e.pos[0] = e.pos[0] * ratio; + e.pos[1] = e.pos[1] * ratio; + } + } + + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(bars.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(bars.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, null, null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + + chart.update = function() { container.transition().duration(transitionDuration).call(chart) }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display noData message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = bars.xScale(); + y = bars.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-historicalBarChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-historicalBarChart').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-barsWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + wrap.select('.nv-legendWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')') + } + + //------------------------------------------------------------ + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + + //------------------------------------------------------------ + // Main Chart Component(s) + + bars + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + + + var barsWrap = g.select('.nv-barsWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + barsWrap.transition().call(bars); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + if (showXAxis) { + xAxis + .scale(x) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')'); + g.select('.nv-x.nv-axis') + .transition() + .call(xAxis); + } + + if (showYAxis) { + yAxis + .scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-y.nv-axis') + .transition() + .call(yAxis); + } + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + if (!data.filter(function(d) { return !d.disabled }).length) { + data.map(function(d) { + d.disabled = false; + wrap.selectAll('.nv-series').classed('disabled', false); + return d; + }); + } + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + + selection.transition().call(chart); + }); + + legend.dispatch.on('legendDblclick', function(d) { + //Double clicking should always enable current series, and disabled all others. + data.forEach(function(d) { + d.disabled = true; + }); + d.disabled = false; + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + selection.call(chart); + }); + + //============================================================ + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + bars.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + bars.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.bars = bars; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, bars, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale', + 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate','highlightPoint','clearHighlights', 'interactive'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/indentedTree.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/indentedTree.js new file mode 100644 index 0000000..18c2700 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/indentedTree.js @@ -0,0 +1,337 @@ +nv.models.indentedTree = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} //TODO: implement, maybe as margin on the containing div + , width = 960 + , height = 500 + , color = nv.utils.defaultColor() + , id = Math.floor(Math.random() * 10000) + , header = true + , filterZero = false + , noData = "No Data Available." + , childIndent = 20 + , columns = [{key:'key', label: 'Name', type:'text'}] //TODO: consider functions like chart.addColumn, chart.removeColumn, instead of a block like this + , tableClass = null + , iconOpen = 'images/grey-plus.png' //TODO: consider removing this and replacing with a '+' or '-' unless user defines images + , iconClose = 'images/grey-minus.png' + , dispatch = d3.dispatch('elementClick', 'elementDblclick', 'elementMouseover', 'elementMouseout') + , getUrl = function(d) { return d.url } + ; + + //============================================================ + + var idx = 0; + + function chart(selection) { + selection.each(function(data) { + var depth = 1, + container = d3.select(this); + + var tree = d3.layout.tree() + .children(function(d) { return d.values }) + .size([height, childIndent]); //Not sure if this is needed now that the result is HTML + + chart.update = function() { container.transition().duration(600).call(chart) }; + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + if (!data[0]) data[0] = {key: noData}; + + //------------------------------------------------------------ + + + var nodes = tree.nodes(data[0]); + + // nodes.map(function(d) { + // d.id = i++; + // }) + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = d3.select(this).selectAll('div').data([[nodes]]); + var wrapEnter = wrap.enter().append('div').attr('class', 'nvd3 nv-wrap nv-indentedtree'); + var tableEnter = wrapEnter.append('table'); + var table = wrap.select('table').attr('width', '100%').attr('class', tableClass); + + //------------------------------------------------------------ + + + if (header) { + var thead = tableEnter.append('thead'); + + var theadRow1 = thead.append('tr'); + + columns.forEach(function(column) { + theadRow1 + .append('th') + .attr('width', column.width ? column.width : '10%') + .style('text-align', column.type == 'numeric' ? 'right' : 'left') + .append('span') + .text(column.label); + }); + } + + + var tbody = table.selectAll('tbody') + .data(function(d) { return d }); + tbody.enter().append('tbody'); + + + + //compute max generations + depth = d3.max(nodes, function(node) { return node.depth }); + tree.size([height, depth * childIndent]); //TODO: see if this is necessary at all + + + // Update the nodes… + var node = tbody.selectAll('tr') + // .data(function(d) { return d; }, function(d) { return d.id || (d.id == ++i)}); + .data(function(d) { return d.filter(function(d) { return (filterZero && !d.children) ? filterZero(d) : true; } )}, function(d,i) { return d.id || (d.id || ++idx)}); + //.style('display', 'table-row'); //TODO: see if this does anything + + node.exit().remove(); + + node.select('img.nv-treeicon') + .attr('src', icon) + .classed('folded', folded); + + var nodeEnter = node.enter().append('tr'); + + + columns.forEach(function(column, index) { + + var nodeName = nodeEnter.append('td') + .style('padding-left', function(d) { return (index ? 0 : d.depth * childIndent + 12 + (icon(d) ? 0 : 16)) + 'px' }, 'important') //TODO: check why I did the ternary here + .style('text-align', column.type == 'numeric' ? 'right' : 'left'); + + + if (index == 0) { + nodeName.append('img') + .classed('nv-treeicon', true) + .classed('nv-folded', folded) + .attr('src', icon) + .style('width', '14px') + .style('height', '14px') + .style('padding', '0 1px') + .style('display', function(d) { return icon(d) ? 'inline-block' : 'none'; }) + .on('click', click); + } + + + nodeName.each(function(d) { + if (!index && getUrl(d)) + d3.select(this) + .append('a') + .attr('href',getUrl) + .attr('class', d3.functor(column.classes)) + .append('span') + else + d3.select(this) + .append('span') + + d3.select(this).select('span') + .attr('class', d3.functor(column.classes) ) + .text(function(d) { return column.format ? column.format(d) : + (d[column.key] || '-') }); + }); + + if (column.showCount) { + nodeName.append('span') + .attr('class', 'nv-childrenCount'); + + node.selectAll('span.nv-childrenCount').text(function(d) { + return ((d.values && d.values.length) || (d._values && d._values.length)) ? //If this is a parent + '(' + ((d.values && (d.values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length)) //If children are in values check its children and filter + || (d._values && d._values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length) //Otherwise, do the same, but with the other name, _values... + || 0) + ')' //This is the catch-all in case there are no children after a filter + : '' //If this is not a parent, just give an empty string + }); + } + + // if (column.click) + // nodeName.select('span').on('click', column.click); + + }); + + node + .order() + .on('click', function(d) { + dispatch.elementClick({ + row: this, //TODO: decide whether or not this should be consistent with scatter/line events or should be an html link (a href) + data: d, + pos: [d.x, d.y] + }); + }) + .on('dblclick', function(d) { + dispatch.elementDblclick({ + row: this, + data: d, + pos: [d.x, d.y] + }); + }) + .on('mouseover', function(d) { + dispatch.elementMouseover({ + row: this, + data: d, + pos: [d.x, d.y] + }); + }) + .on('mouseout', function(d) { + dispatch.elementMouseout({ + row: this, + data: d, + pos: [d.x, d.y] + }); + }); + + + + + // Toggle children on click. + function click(d, _, unshift) { + d3.event.stopPropagation(); + + if(d3.event.shiftKey && !unshift) { + //If you shift-click, it'll toggle fold all the children, instead of itself + d3.event.shiftKey = false; + d.values && d.values.forEach(function(node){ + if (node.values || node._values) { + click(node, 0, true); + } + }); + return true; + } + if(!hasChildren(d)) { + //download file + //window.location.href = d.url; + return true; + } + if (d.values) { + d._values = d.values; + d.values = null; + } else { + d.values = d._values; + d._values = null; + } + chart.update(); + } + + + function icon(d) { + return (d._values && d._values.length) ? iconOpen : (d.values && d.values.length) ? iconClose : ''; + } + + function folded(d) { + return (d._values && d._values.length); + } + + function hasChildren(d) { + var values = d.values || d._values; + + return (values && values.length); + } + + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + scatter.color(color); + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.header = function(_) { + if (!arguments.length) return header; + header = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.filterZero = function(_) { + if (!arguments.length) return filterZero; + filterZero = _; + return chart; + }; + + chart.columns = function(_) { + if (!arguments.length) return columns; + columns = _; + return chart; + }; + + chart.tableClass = function(_) { + if (!arguments.length) return tableClass; + tableClass = _; + return chart; + }; + + chart.iconOpen = function(_){ + if (!arguments.length) return iconOpen; + iconOpen = _; + return chart; + } + + chart.iconClose = function(_){ + if (!arguments.length) return iconClose; + iconClose = _; + return chart; + } + + chart.getUrl = function(_){ + if (!arguments.length) return getUrl; + getUrl = _; + return chart; + } + + //============================================================ + + + return chart; +}; \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/legend.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/legend.js new file mode 100644 index 0000000..21f9f9a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/legend.js @@ -0,0 +1,270 @@ +nv.models.legend = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 5, right: 0, bottom: 5, left: 0} + , width = 400 + , height = 20 + , getKey = function(d) { return d.key } + , color = nv.utils.defaultColor() + , align = true + , rightAlign = true + , updateState = true //If true, legend will update data.disabled and trigger a 'stateChange' dispatch. + , radioButtonMode = false //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at a time) + , dispatch = d3.dispatch('legendClick', 'legendDblclick', 'legendMouseover', 'legendMouseout', 'stateChange') + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-legend').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-legend').append('g'); + var g = wrap.select('g'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + var series = g.selectAll('.nv-series') + .data(function(d) { return d }); + var seriesEnter = series.enter().append('g').attr('class', 'nv-series') + .on('mouseover', function(d,i) { + dispatch.legendMouseover(d,i); //TODO: Make consistent with other event objects + }) + .on('mouseout', function(d,i) { + dispatch.legendMouseout(d,i); + }) + .on('click', function(d,i) { + dispatch.legendClick(d,i); + if (updateState) { + if (radioButtonMode) { + //Radio button mode: set every series to disabled, + // and enable the clicked series. + data.forEach(function(series) { series.disabled = true}); + d.disabled = false; + } + else { + d.disabled = !d.disabled; + if (data.every(function(series) { return series.disabled})) { + //the default behavior of NVD3 legends is, if every single series + // is disabled, turn all series' back on. + data.forEach(function(series) { series.disabled = false}); + } + } + dispatch.stateChange({ + disabled: data.map(function(d) { return !!d.disabled }) + }); + } + }) + .on('dblclick', function(d,i) { + dispatch.legendDblclick(d,i); + if (updateState) { + //the default behavior of NVD3 legends, when double clicking one, + // is to set all other series' to false, and make the double clicked series enabled. + data.forEach(function(series) { + series.disabled = true; + }); + d.disabled = false; + dispatch.stateChange({ + disabled: data.map(function(d) { return !!d.disabled }) + }); + } + }); + seriesEnter.append('circle') + .style('stroke-width', 2) + .attr('class','nv-legend-symbol') + .attr('r', 5); + seriesEnter.append('text') + .attr('text-anchor', 'start') + .attr('class','nv-legend-text') + .attr('dy', '.32em') + .attr('dx', '8'); + series.classed('disabled', function(d) { return d.disabled }); + series.exit().remove(); + series.select('circle') + .style('fill', function(d,i) { return d.color || color(d,i)}) + .style('stroke', function(d,i) { return d.color || color(d, i) }); + series.select('text').text(getKey); + + + //TODO: implement fixed-width and max-width options (max-width is especially useful with the align option) + + // NEW ALIGNING CODE, TODO: clean up + if (align) { + + var seriesWidths = []; + series.each(function(d,i) { + var legendText = d3.select(this).select('text'); + var nodeTextLength; + try { + nodeTextLength = legendText.node().getComputedTextLength(); + } + catch(e) { + nodeTextLength = nv.utils.calcApproxTextWidth(legendText); + } + + seriesWidths.push(nodeTextLength + 28); // 28 is ~ the width of the circle plus some padding + }); + + var seriesPerRow = 0; + var legendWidth = 0; + var columnWidths = []; + + while ( legendWidth < availableWidth && seriesPerRow < seriesWidths.length) { + columnWidths[seriesPerRow] = seriesWidths[seriesPerRow]; + legendWidth += seriesWidths[seriesPerRow++]; + } + if (seriesPerRow === 0) seriesPerRow = 1; //minimum of one series per row + + + while ( legendWidth > availableWidth && seriesPerRow > 1 ) { + columnWidths = []; + seriesPerRow--; + + for (var k = 0; k < seriesWidths.length; k++) { + if (seriesWidths[k] > (columnWidths[k % seriesPerRow] || 0) ) + columnWidths[k % seriesPerRow] = seriesWidths[k]; + } + + legendWidth = columnWidths.reduce(function(prev, cur, index, array) { + return prev + cur; + }); + } + + var xPositions = []; + for (var i = 0, curX = 0; i < seriesPerRow; i++) { + xPositions[i] = curX; + curX += columnWidths[i]; + } + + series + .attr('transform', function(d, i) { + return 'translate(' + xPositions[i % seriesPerRow] + ',' + (5 + Math.floor(i / seriesPerRow) * 20) + ')'; + }); + + //position legend as far right as possible within the total width + if (rightAlign) { + g.attr('transform', 'translate(' + (width - margin.right - legendWidth) + ',' + margin.top + ')'); + } + else { + g.attr('transform', 'translate(0' + ',' + margin.top + ')'); + } + + height = margin.top + margin.bottom + (Math.ceil(seriesWidths.length / seriesPerRow) * 20); + + } else { + + var ypos = 5, + newxpos = 5, + maxwidth = 0, + xpos; + series + .attr('transform', function(d, i) { + var length = d3.select(this).select('text').node().getComputedTextLength() + 28; + xpos = newxpos; + + if (width < margin.left + margin.right + xpos + length) { + newxpos = xpos = 5; + ypos += 20; + } + + newxpos += length; + if (newxpos > maxwidth) maxwidth = newxpos; + + return 'translate(' + xpos + ',' + ypos + ')'; + }); + + //position legend as far right as possible within the total width + g.attr('transform', 'translate(' + (width - margin.right - maxwidth) + ',' + margin.top + ')'); + + height = margin.top + margin.bottom + ypos + 15; + + } + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.key = function(_) { + if (!arguments.length) return getKey; + getKey = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.align = function(_) { + if (!arguments.length) return align; + align = _; + return chart; + }; + + chart.rightAlign = function(_) { + if (!arguments.length) return rightAlign; + rightAlign = _; + return chart; + }; + + chart.updateState = function(_) { + if (!arguments.length) return updateState; + updateState = _; + return chart; + }; + + chart.radioButtonMode = function(_) { + if (!arguments.length) return radioButtonMode; + radioButtonMode = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/line.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/line.js new file mode 100644 index 0000000..855cc54 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/line.js @@ -0,0 +1,284 @@ + +nv.models.line = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var scatter = nv.models.scatter() + ; + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , color = nv.utils.defaultColor() // a function that returns a color + , getX = function(d) { return d.x } // accessor to get the x value from a data point + , getY = function(d) { return d.y } // accessor to get the y value from a data point + , defined = function(d,i) { return !isNaN(getY(d,i)) && getY(d,i) !== null } // allows a line to be not continuous when it is not defined + , isArea = function(d) { return d.area } // decides if a line is an area or just a line + , clipEdge = false // if true, masks lines within x and y scale + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , interpolate = "linear" // controls the line interpolation + ; + + scatter + .size(16) // default size + .sizeDomain([16,256]) //set to speed up calculation, needs to be unset if there is a custom size accessor + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0 //used to store previous scales + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + //------------------------------------------------------------ + // Setup Scales + + x = scatter.xScale(); + y = scatter.yScale(); + + x0 = x0 || x; + y0 = y0 || y; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-line').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-line'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + gEnter.append('g').attr('class', 'nv-groups'); + gEnter.append('g').attr('class', 'nv-scatterWrap'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + + scatter + .width(availableWidth) + .height(availableHeight) + + var scatterWrap = wrap.select('.nv-scatterWrap'); + //.datum(data); // Data automatically trickles down from the wrap + + scatterWrap.transition().call(scatter); + + + + defsEnter.append('clipPath') + .attr('id', 'nv-edge-clip-' + scatter.id()) + .append('rect'); + + wrap.select('#nv-edge-clip-' + scatter.id() + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : ''); + scatterWrap + .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : ''); + + + + + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d) { return d.key }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + groups.exit() + .transition() + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6) + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }) + .style('fill', function(d,i){ return color(d, i) }) + .style('stroke', function(d,i){ return color(d, i)}); + groups + .transition() + .style('stroke-opacity', 1) + .style('fill-opacity', .5); + + + + var areaPaths = groups.selectAll('path.nv-area') + .data(function(d) { return isArea(d) ? [d] : [] }); // this is done differently than lines because I need to check if series is an area + areaPaths.enter().append('path') + .attr('class', 'nv-area') + .attr('d', function(d) { + return d3.svg.area() + .interpolate(interpolate) + .defined(defined) + .x(function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) }) + .y0(function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) }) + .y1(function(d,i) { return y0( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) }) + //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this + .apply(this, [d.values]) + }); + groups.exit().selectAll('path.nv-area') + .remove(); + + areaPaths + .transition() + .attr('d', function(d) { + return d3.svg.area() + .interpolate(interpolate) + .defined(defined) + .x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) }) + .y0(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) }) + .y1(function(d,i) { return y( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) }) + //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this + .apply(this, [d.values]) + }); + + + + var linePaths = groups.selectAll('path.nv-line') + .data(function(d) { return [d.values] }); + linePaths.enter().append('path') + .attr('class', 'nv-line') + .attr('d', + d3.svg.line() + .interpolate(interpolate) + .defined(defined) + .x(function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) }) + .y(function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) }) + ); + groups.exit().selectAll('path.nv-line') + .transition() + .attr('d', + d3.svg.line() + .interpolate(interpolate) + .defined(defined) + .x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) }) + .y(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) }) + ); + linePaths + .transition() + .attr('d', + d3.svg.line() + .interpolate(interpolate) + .defined(defined) + .x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) }) + .y(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) }) + ); + + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = scatter.dispatch; + chart.scatter = scatter; + + d3.rebind(chart, scatter, 'id', 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', + 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'useVoronoi', 'clipRadius', 'padData','highlightPoint','clearHighlights'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + scatter.x(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + scatter.y(_); + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + scatter.color(color); + return chart; + }; + + chart.interpolate = function(_) { + if (!arguments.length) return interpolate; + interpolate = _; + return chart; + }; + + chart.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return chart; + }; + + chart.isArea = function(_) { + if (!arguments.length) return isArea; + isArea = d3.functor(_); + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineChart.js new file mode 100644 index 0000000..a4ffcf6 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineChart.js @@ -0,0 +1,465 @@ + +nv.models.lineChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var lines = nv.models.line() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + , interactiveLayer = nv.interactiveGuideline() + ; + + var margin = {top: 30, right: 20, bottom: 50, left: 60} + , color = nv.utils.defaultColor() + , width = null + , height = null + , showLegend = true + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , useInteractiveGuideline = false + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' at ' + x + '

      ' + } + , x + , y + , state = {} + , defaultState = null + , noData = 'No Data Available.' + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , transitionDuration = 250 + ; + + xAxis + .orient('bottom') + .tickPadding(7) + ; + yAxis + .orient((rightAlignYAxis) ? 'right' : 'left') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, null, null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + + chart.update = function() { container.transition().duration(transitionDuration).call(chart) }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display noData message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = lines.xScale(); + y = lines.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-lineChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g'); + var g = wrap.select('g'); + + gEnter.append("rect").style("opacity",0); + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-linesWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-interactive'); + + g.select("rect").attr("width",availableWidth).attr("height",availableHeight); + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + wrap.select('.nv-legendWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')') + } + + //------------------------------------------------------------ + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + //------------------------------------------------------------ + // Main Chart Component(s) + + + //------------------------------------------------------------ + //Set up interactive layer + if (useInteractiveGuideline) { + interactiveLayer + .width(availableWidth) + .height(availableHeight) + .margin({left:margin.left, top:margin.top}) + .svgContainer(container) + .xScale(x); + wrap.select(".nv-interactive").call(interactiveLayer); + } + + + lines + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + + + var linesWrap = g.select('.nv-linesWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + linesWrap.transition().call(lines); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + if (showXAxis) { + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')'); + g.select('.nv-x.nv-axis') + .transition() + .call(xAxis); + } + + if (showYAxis) { + yAxis + .scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-y.nv-axis') + .transition() + .call(yAxis); + } + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('stateChange', function(newState) { + state = newState; + dispatch.stateChange(state); + chart.update(); + }); + + interactiveLayer.dispatch.on('elementMousemove', function(e) { + lines.clearHighlights(); + var singlePoint, pointIndex, pointXLocation, allData = []; + data + .filter(function(series, i) { + series.seriesIndex = i; + return !series.disabled; + }) + .forEach(function(series,i) { + pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x()); + lines.highlightPoint(i, pointIndex, true); + var point = series.values[pointIndex]; + if (typeof point === 'undefined') return; + if (typeof singlePoint === 'undefined') singlePoint = point; + if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex)); + allData.push({ + key: series.key, + value: chart.y()(point, pointIndex), + color: color(series,series.seriesIndex) + }); + }); + //Highlight the tooltip entry based on which point the mouse is closest to. + if (allData.length > 2) { + var yValue = chart.yScale().invert(e.mouseY); + var domainExtent = Math.abs(chart.yScale().domain()[0] - chart.yScale().domain()[1]); + var threshold = 0.03 * domainExtent; + var indexToHighlight = nv.nearestValueIndex(allData.map(function(d){return d.value}),yValue,threshold); + if (indexToHighlight !== null) + allData[indexToHighlight].highlight = true; + } + + var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex)); + interactiveLayer.tooltip + .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top}) + .chartContainer(that.parentNode) + .enabled(tooltips) + .valueFormatter(function(d,i) { + return yAxis.tickFormat()(d); + }) + .data( + { + value: xValue, + series: allData + } + )(); + + interactiveLayer.renderGuideLine(pointXLocation); + + }); + + interactiveLayer.dispatch.on("elementMouseout",function(e) { + dispatch.tooltipHide(); + lines.clearHighlights(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + chart.update(); + }); + + //============================================================ + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.lines = lines; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + chart.interactiveLayer = interactiveLayer; + + d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'xRange', 'yRange' + , 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'useVoronoi','id', 'interpolate'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + chart.useInteractiveGuideline = function(_) { + if(!arguments.length) return useInteractiveGuideline; + useInteractiveGuideline = _; + if (_ === true) { + chart.interactive(false); + chart.useVoronoi(false); + } + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/linePlusBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/linePlusBarChart.js new file mode 100644 index 0000000..77fcbab --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/linePlusBarChart.js @@ -0,0 +1,433 @@ + +nv.models.linePlusBarChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var lines = nv.models.line() + , bars = nv.models.historicalBar() + , xAxis = nv.models.axis() + , y1Axis = nv.models.axis() + , y2Axis = nv.models.axis() + , legend = nv.models.legend() + ; + + var margin = {top: 30, right: 60, bottom: 50, left: 60} + , width = null + , height = null + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , color = nv.utils.defaultColor() + , showLegend = true + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' at ' + x + '

      '; + } + , x + , y1 + , y2 + , state = {} + , defaultState = null + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + ; + + bars + .padData(true) + ; + lines + .clipEdge(false) + .padData(true) + ; + xAxis + .orient('bottom') + .tickPadding(7) + .highlightZero(false) + ; + y1Axis + .orient('left') + ; + y2Axis + .orient('right') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)), + y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + } + ; + + //------------------------------------------------------------ + + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().call(chart); }; + // chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + var dataBars = data.filter(function(d) { return !d.disabled && d.bar }); + var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240 + + //x = xAxis.scale(); + x = dataLines.filter(function(d) { return !d.disabled; }).length && dataLines.filter(function(d) { return !d.disabled; })[0].values.length ? lines.xScale() : bars.xScale(); + //x = dataLines.filter(function(d) { return !d.disabled; }).length ? lines.xScale() : bars.xScale(); //old code before change above + y1 = bars.yScale(); + y2 = lines.yScale(); + + //------------------------------------------------------------ + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = d3.select(this).selectAll('g.nv-wrap.nv-linePlusBar').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-linePlusBar').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y1 nv-axis'); + gEnter.append('g').attr('class', 'nv-y2 nv-axis'); + gEnter.append('g').attr('class', 'nv-barsWrap'); + gEnter.append('g').attr('class', 'nv-linesWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width( availableWidth / 2 ); + + g.select('.nv-legendWrap') + .datum(data.map(function(series) { + series.originalKey = series.originalKey === undefined ? series.key : series.originalKey; + series.key = series.originalKey + (series.bar ? ' (left axis)' : ' (right axis)'); + return series; + })) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Main Chart Component(s) + + + lines + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && !data[i].bar })) + + bars + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && data[i].bar })) + + + + var barsWrap = g.select('.nv-barsWrap') + .datum(dataBars.length ? dataBars : [{values:[]}]) + + var linesWrap = g.select('.nv-linesWrap') + .datum(dataLines[0] && !dataLines[0].disabled ? dataLines : [{values:[]}] ); + //.datum(!dataLines[0].disabled ? dataLines : [{values:dataLines[0].values.map(function(d) { return [d[0], null] }) }] ); + + d3.transition(barsWrap).call(bars); + d3.transition(linesWrap).call(lines); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y1.range()[0] + ')'); + d3.transition(g.select('.nv-x.nv-axis')) + .call(xAxis); + + + y1Axis + .scale(y1) + .ticks( availableHeight / 36 ) + .tickSize(-availableWidth, 0); + + d3.transition(g.select('.nv-y1.nv-axis')) + .style('opacity', dataBars.length ? 1 : 0) + .call(y1Axis); + + + y2Axis + .scale(y2) + .ticks( availableHeight / 36 ) + .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none + + g.select('.nv-y2.nv-axis') + .style('opacity', dataLines.length ? 1 : 0) + .attr('transform', 'translate(' + availableWidth + ',0)'); + //.attr('transform', 'translate(' + x.range()[1] + ',0)'); + + d3.transition(g.select('.nv-y2.nv-axis')) + .call(y2Axis); + + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('stateChange', function(newState) { + state = newState; + dispatch.stateChange(state); + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + chart.update(); + }); + + //============================================================ + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + bars.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + bars.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.legend = legend; + chart.lines = lines; + chart.bars = bars; + chart.xAxis = xAxis; + chart.y1Axis = y1Axis; + chart.y2Axis = y2Axis; + + d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate'); + //TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc. + //d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + lines.x(_); + bars.x(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + lines.y(_); + bars.y(_); + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/linePlusBarWithFocusChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/linePlusBarWithFocusChart.js new file mode 100644 index 0000000..2ef3113 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/linePlusBarWithFocusChart.js @@ -0,0 +1,658 @@ + +nv.models.linePlusBarWithFocusChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var lines = nv.models.line() + , lines2 = nv.models.line() + , bars = nv.models.historicalBar() + , bars2 = nv.models.historicalBar() + , xAxis = nv.models.axis() + , x2Axis = nv.models.axis() + , y1Axis = nv.models.axis() + , y2Axis = nv.models.axis() + , y3Axis = nv.models.axis() + , y4Axis = nv.models.axis() + , legend = nv.models.legend() + , brush = d3.svg.brush() + ; + + var margin = {top: 30, right: 30, bottom: 30, left: 60} + , margin2 = {top: 0, right: 30, bottom: 20, left: 60} + , width = null + , height = null + , height2 = 100 + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , color = nv.utils.defaultColor() + , showLegend = true + , extent + , brushExtent = null + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' at ' + x + '

      '; + } + , x + , x2 + , y1 + , y2 + , y3 + , y4 + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush') + , transitionDuration = 0 + ; + + lines + .clipEdge(true) + ; + lines2 + .interactive(false) + ; + xAxis + .orient('bottom') + .tickPadding(5) + ; + y1Axis + .orient('left') + ; + y2Axis + .orient('right') + ; + x2Axis + .orient('bottom') + .tickPadding(5) + ; + y3Axis + .orient('left') + ; + y4Axis + .orient('right') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + if (extent) { + e.pointIndex += Math.ceil(extent[0]); + } + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)), + y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + //------------------------------------------------------------ + + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight1 = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom - height2, + availableHeight2 = height2 - margin2.top - margin2.bottom; + + chart.update = function() { container.transition().duration(transitionDuration).call(chart); }; + chart.container = this; + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight1 / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + var dataBars = data.filter(function(d) { return !d.disabled && d.bar }); + var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240 + + x = bars.xScale(); + x2 = x2Axis.scale(); + y1 = bars.yScale(); + y2 = lines.yScale(); + y3 = bars2.yScale(); + y4 = lines2.yScale(); + + var series1 = data + .filter(function(d) { return !d.disabled && d.bar }) + .map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i) } + }) + }); + + var series2 = data + .filter(function(d) { return !d.disabled && !d.bar }) + .map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i) } + }) + }); + + x .range([0, availableWidth]); + + x2 .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } )) + .range([0, availableWidth]); + + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-linePlusBar').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-linePlusBar').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-legendWrap'); + + var focusEnter = gEnter.append('g').attr('class', 'nv-focus'); + focusEnter.append('g').attr('class', 'nv-x nv-axis'); + focusEnter.append('g').attr('class', 'nv-y1 nv-axis'); + focusEnter.append('g').attr('class', 'nv-y2 nv-axis'); + focusEnter.append('g').attr('class', 'nv-barsWrap'); + focusEnter.append('g').attr('class', 'nv-linesWrap'); + + var contextEnter = gEnter.append('g').attr('class', 'nv-context'); + contextEnter.append('g').attr('class', 'nv-x nv-axis'); + contextEnter.append('g').attr('class', 'nv-y1 nv-axis'); + contextEnter.append('g').attr('class', 'nv-y2 nv-axis'); + contextEnter.append('g').attr('class', 'nv-barsWrap'); + contextEnter.append('g').attr('class', 'nv-linesWrap'); + contextEnter.append('g').attr('class', 'nv-brushBackground'); + contextEnter.append('g').attr('class', 'nv-x nv-brush'); + + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width( availableWidth / 2 ); + + g.select('.nv-legendWrap') + .datum(data.map(function(series) { + series.originalKey = series.originalKey === undefined ? series.key : series.originalKey; + series.key = series.originalKey + (series.bar ? ' (left axis)' : ' (right axis)'); + return series; + })) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight1 = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom - height2; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Context Components + + bars2 + .width(availableWidth) + .height(availableHeight2) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && data[i].bar })); + + lines2 + .width(availableWidth) + .height(availableHeight2) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && !data[i].bar })); + + var bars2Wrap = g.select('.nv-context .nv-barsWrap') + .datum(dataBars.length ? dataBars : [{values:[]}]); + + var lines2Wrap = g.select('.nv-context .nv-linesWrap') + .datum(!dataLines[0].disabled ? dataLines : [{values:[]}]); + + g.select('.nv-context') + .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')') + + bars2Wrap.transition().call(bars2); + lines2Wrap.transition().call(lines2); + + //------------------------------------------------------------ + + + + //------------------------------------------------------------ + // Setup Brush + + brush + .x(x2) + .on('brush', onBrush); + + if (brushExtent) brush.extent(brushExtent); + + var brushBG = g.select('.nv-brushBackground').selectAll('g') + .data([brushExtent || brush.extent()]) + + var brushBGenter = brushBG.enter() + .append('g'); + + brushBGenter.append('rect') + .attr('class', 'left') + .attr('x', 0) + .attr('y', 0) + .attr('height', availableHeight2); + + brushBGenter.append('rect') + .attr('class', 'right') + .attr('x', 0) + .attr('y', 0) + .attr('height', availableHeight2); + + var gBrush = g.select('.nv-x.nv-brush') + .call(brush); + gBrush.selectAll('rect') + //.attr('y', -5) + .attr('height', availableHeight2); + gBrush.selectAll('.resize').append('path').attr('d', resizePath); + + //------------------------------------------------------------ + + //------------------------------------------------------------ + // Setup Secondary (Context) Axes + + x2Axis + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight2, 0); + + g.select('.nv-context .nv-x.nv-axis') + .attr('transform', 'translate(0,' + y3.range()[0] + ')'); + g.select('.nv-context .nv-x.nv-axis').transition() + .call(x2Axis); + + + y3Axis + .scale(y3) + .ticks( availableHeight2 / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-context .nv-y1.nv-axis') + .style('opacity', dataBars.length ? 1 : 0) + .attr('transform', 'translate(0,' + x2.range()[0] + ')'); + + g.select('.nv-context .nv-y1.nv-axis').transition() + .call(y3Axis); + + + y4Axis + .scale(y4) + .ticks( availableHeight2 / 36 ) + .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none + + g.select('.nv-context .nv-y2.nv-axis') + .style('opacity', dataLines.length ? 1 : 0) + .attr('transform', 'translate(' + x2.range()[1] + ',0)'); + + g.select('.nv-context .nv-y2.nv-axis').transition() + .call(y4Axis); + + //------------------------------------------------------------ + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('stateChange', function(newState) { + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + //============================================================ + + + //============================================================ + // Functions + //------------------------------------------------------------ + + // Taken from crossfilter (http://square.github.com/crossfilter/) + function resizePath(d) { + var e = +(d == 'e'), + x = e ? 1 : -1, + y = availableHeight2 / 3; + return 'M' + (.5 * x) + ',' + y + + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6) + + 'V' + (2 * y - 6) + + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y) + + 'Z' + + 'M' + (2.5 * x) + ',' + (y + 8) + + 'V' + (2 * y - 8) + + 'M' + (4.5 * x) + ',' + (y + 8) + + 'V' + (2 * y - 8); + } + + + function updateBrushBG() { + if (!brush.empty()) brush.extent(brushExtent); + brushBG + .data([brush.empty() ? x2.domain() : brushExtent]) + .each(function(d,i) { + var leftWidth = x2(d[0]) - x2.range()[0], + rightWidth = x2.range()[1] - x2(d[1]); + d3.select(this).select('.left') + .attr('width', leftWidth < 0 ? 0 : leftWidth); + + d3.select(this).select('.right') + .attr('x', x2(d[1])) + .attr('width', rightWidth < 0 ? 0 : rightWidth); + }); + } + + + function onBrush() { + brushExtent = brush.empty() ? null : brush.extent(); + extent = brush.empty() ? x2.domain() : brush.extent(); + + + dispatch.brush({extent: extent, brush: brush}); + + updateBrushBG(); + + + //------------------------------------------------------------ + // Prepare Main (Focus) Bars and Lines + + bars + .width(availableWidth) + .height(availableHeight1) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && data[i].bar })); + + + lines + .width(availableWidth) + .height(availableHeight1) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && !data[i].bar })); + + var focusBarsWrap = g.select('.nv-focus .nv-barsWrap') + .datum(!dataBars.length ? [{values:[]}] : + dataBars + .map(function(d,i) { + return { + key: d.key, + values: d.values.filter(function(d,i) { + return bars.x()(d,i) >= extent[0] && bars.x()(d,i) <= extent[1]; + }) + } + }) + ); + + var focusLinesWrap = g.select('.nv-focus .nv-linesWrap') + .datum(dataLines[0].disabled ? [{values:[]}] : + dataLines + .map(function(d,i) { + return { + key: d.key, + values: d.values.filter(function(d,i) { + return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1]; + }) + } + }) + ); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Update Main (Focus) X Axis + + if (dataBars.length) { + x = bars.xScale(); + } else { + x = lines.xScale(); + } + + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight1, 0); + + xAxis.domain([Math.ceil(extent[0]), Math.floor(extent[1])]); + + g.select('.nv-x.nv-axis').transition().duration(transitionDuration) + .call(xAxis); + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Update Main (Focus) Bars and Lines + + focusBarsWrap.transition().duration(transitionDuration).call(bars); + focusLinesWrap.transition().duration(transitionDuration).call(lines); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup and Update Main (Focus) Y Axes + + g.select('.nv-focus .nv-x.nv-axis') + .attr('transform', 'translate(0,' + y1.range()[0] + ')'); + + + y1Axis + .scale(y1) + .ticks( availableHeight1 / 36 ) + .tickSize(-availableWidth, 0); + + g.select('.nv-focus .nv-y1.nv-axis') + .style('opacity', dataBars.length ? 1 : 0); + + + y2Axis + .scale(y2) + .ticks( availableHeight1 / 36 ) + .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none + + g.select('.nv-focus .nv-y2.nv-axis') + .style('opacity', dataLines.length ? 1 : 0) + .attr('transform', 'translate(' + x.range()[1] + ',0)'); + + g.select('.nv-focus .nv-y1.nv-axis').transition().duration(transitionDuration) + .call(y1Axis); + g.select('.nv-focus .nv-y2.nv-axis').transition().duration(transitionDuration) + .call(y2Axis); + } + + //============================================================ + + onBrush(); + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + bars.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + bars.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.legend = legend; + chart.lines = lines; + chart.lines2 = lines2; + chart.bars = bars; + chart.bars2 = bars2; + chart.xAxis = xAxis; + chart.x2Axis = x2Axis; + chart.y1Axis = y1Axis; + chart.y2Axis = y2Axis; + chart.y3Axis = y3Axis; + chart.y4Axis = y4Axis; + + d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate'); + //TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc. + //d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + lines.x(_); + bars.x(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + lines.y(_); + bars.y(_); + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.brushExtent = function(_) { + if (!arguments.length) return brushExtent; + brushExtent = _; + return chart; + }; + + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFisheye.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFisheye.js new file mode 100644 index 0000000..2b41167 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFisheye.js @@ -0,0 +1,200 @@ + +nv.models.line = function() { + "use strict"; + //Default Settings + var margin = {top: 0, right: 0, bottom: 0, left: 0}, + width = 960, + height = 500, + color = nv.utils.defaultColor(), // function that returns colors + id = Math.floor(Math.random() * 10000), //Create semi-unique ID incase user doesn't select one + getX = function(d) { return d.x }, // accessor to get the x value from a data point + getY = function(d) { return d.y }, // accessor to get the y value from a data point + clipEdge = false, // if true, masks lines within x and y scale + interpolate = "linear"; // controls the line interpolation + + + var scatter = nv.models.scatter() + .id(id) + .size(16) // default size + .sizeDomain([16,256]), //set to speed up calculation, needs to be unset if there is a custom size accessor + //x = scatter.xScale(), + //y = scatter.yScale(), + x, y, + x0, y0, timeoutID; + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom; + + //get the scales inscase scatter scale was set manually + x = x || scatter.xScale(); + y = y || scatter.yScale(); + + //store old scales if they exist + x0 = x0 || x; + y0 = y0 || y; + + + var wrap = d3.select(this).selectAll('g.nv-wrap.nv-line').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-line'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + wrapEnter.append('g').attr('class', 'nv-scatterWrap'); + var scatterWrap = wrap.select('.nv-scatterWrap').datum(data); + + gEnter.append('g').attr('class', 'nv-groups'); + + + scatter + .width(availableWidth) + .height(availableHeight) + + d3.transition(scatterWrap).call(scatter); + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + defsEnter.append('clipPath') + .attr('id', 'nv-edge-clip-' + id) + .append('rect'); + + wrap.select('#nv-edge-clip-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); + scatterWrap + .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); + + + + + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d) { return d.key }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + d3.transition(groups.exit()) + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6) + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }) + .style('fill', function(d,i){ return color(d, i) }) + .style('stroke', function(d,i){ return color(d, i) }) + d3.transition(groups) + .style('stroke-opacity', 1) + .style('fill-opacity', .5) + + + var paths = groups.selectAll('path') + .data(function(d, i) { return [d.values] }); + paths.enter().append('path') + .attr('class', 'nv-line') + .attr('d', d3.svg.line() + .interpolate(interpolate) + .x(function(d,i) { return x0(getX(d,i)) }) + .y(function(d,i) { return y0(getY(d,i)) }) + ); + d3.transition(groups.exit().selectAll('path')) + .attr('d', d3.svg.line() + .interpolate(interpolate) + .x(function(d,i) { return x(getX(d,i)) }) + .y(function(d,i) { return y(getY(d,i)) }) + ) + .remove(); // redundant? line is already being removed + d3.transition(paths) + .attr('d', d3.svg.line() + .interpolate(interpolate) + .x(function(d,i) { return x(getX(d,i)) }) + .y(function(d,i) { return y(getY(d,i)) }) + ); + + + //store old scales for use in transitions on update, to animate from old to new positions + x0 = x.copy(); + y0 = y.copy(); + + }); + + return chart; + } + + + chart.dispatch = scatter.dispatch; + + d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin = _; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + scatter.x(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + scatter.y(_); + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + scatter.color(color); + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.interpolate = function(_) { + if (!arguments.length) return interpolate; + interpolate = _; + return chart; + }; + + chart.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return chart; + }; + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFisheyeChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFisheyeChart.js new file mode 100644 index 0000000..ad89419 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFisheyeChart.js @@ -0,0 +1,297 @@ + +nv.models.lineChart = function() { + "use strict"; + var margin = {top: 30, right: 20, bottom: 50, left: 60}, + color = nv.utils.defaultColor(), + width = null, + height = null, + showLegend = true, + showControls = true, + fisheye = 0, + pauseFisheye = false, + tooltips = true, + tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' at ' + x + '

      ' + }, + noData = "No Data Available." + ; + + + var x = d3.fisheye.scale(d3.scale.linear).distortion(0); + + var lines = nv.models.line().xScale(x), + //x = lines.xScale(), + y = lines.yScale(), + xAxis = nv.models.axis().scale(x).orient('bottom').tickPadding(5), + yAxis = nv.models.axis().scale(y).orient('left'), + legend = nv.models.legend().height(30), + controls = nv.models.legend().height(30).updateState(false), + dispatch = d3.dispatch('tooltipShow', 'tooltipHide'); + + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, null, null, offsetElement); + }; + + + var controlsData = [ + { key: 'Magnify', disabled: true } + ]; + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().call(chart) }; + chart.container = this; // I need a reference to the container in order to have outside code check if the chart is visible or not + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + container.append('text') + .attr('class', 'nvd3 nv-noData') + .attr('x', availableWidth / 2) + .attr('y', availableHeight / 2) + .attr('dy', '-.7em') + .style('text-anchor', 'middle') + .text(noData); + return chart; + } else { + container.select('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + + var wrap = container.selectAll('g.nv-wrap.nv-lineChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g'); + + + gEnter.append('rect') + .attr('class', 'nvd3 nv-background') + .attr('width', availableWidth) + .attr('height', availableHeight); + + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-linesWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + + var g = wrap.select('g'); + + + + + if (showLegend) { + legend.width(availableWidth); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')') + } + + if (showControls) { + controls.width(180).color(['#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + + + lines + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + + + + g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + var linesWrap = g.select('.nv-linesWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + d3.transition(linesWrap).call(lines); + + + + xAxis + //.scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')'); + d3.transition(g.select('.nv-x.nv-axis')) + .call(xAxis); + + + yAxis + //.scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + d3.transition(g.select('.nv-y.nv-axis')) + .call(yAxis); + + + + g.select('.nv-background').on('mousemove', updateFisheye); + g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye; }); + //g.select('.point-paths').on('mousemove', updateFisheye); + + + function updateFisheye() { + if (pauseFisheye) { + //g.select('.background') .style('pointer-events', 'none'); + g.select('.nv-point-paths').style('pointer-events', 'all'); + return false; + } + + g.select('.nv-background') .style('pointer-events', 'all'); + g.select('.nv-point-paths').style('pointer-events', 'none' ); + + var mouse = d3.mouse(this); + linesWrap.call(lines); + g.select('.nv-x.nv-axis').call(xAxis); + x.distortion(fisheye).focus(mouse[0]); + } + + + controls.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + fisheye = d.disabled ? 0 : 5; + g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all'); + g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' ); + + //scatter.interactive(d.disabled); + //tooltips = d.disabled; + + if (d.disabled) { + x.distortion(fisheye).focus(0); + + linesWrap.call(lines); + g.select('.nv-x.nv-axis').call(xAxis); + } else { + pauseFisheye = false; + } + + chart.update(); + }); + + + legend.dispatch.on('stateChange', function(newState) { + chart.update(); + }); + + lines.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + if (tooltips) dispatch.on('tooltipShow', function(e) { showTooltip(e, that.parentNode) } ); // TODO: maybe merge with above? + + lines.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + if (tooltips) dispatch.on('tooltipHide', nv.tooltip.cleanup); + + }); + + return chart; + } + + + chart.dispatch = dispatch; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, lines, 'defined', 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin = _; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFocusChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFocusChart.js new file mode 100644 index 0000000..0afd28b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/lineWithFocusChart.js @@ -0,0 +1,574 @@ +nv.models.lineWithFocusChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var lines = nv.models.line() + , lines2 = nv.models.line() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , x2Axis = nv.models.axis() + , y2Axis = nv.models.axis() + , legend = nv.models.legend() + , brush = d3.svg.brush() + ; + + var margin = {top: 30, right: 30, bottom: 30, left: 60} + , margin2 = {top: 0, right: 30, bottom: 20, left: 60} + , color = nv.utils.defaultColor() + , width = null + , height = null + , height2 = 100 + , x + , y + , x2 + , y2 + , showLegend = true + , brushExtent = null + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' at ' + x + '

      ' + } + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush') + , transitionDuration = 250 + ; + + lines + .clipEdge(true) + ; + lines2 + .interactive(false) + ; + xAxis + .orient('bottom') + .tickPadding(5) + ; + yAxis + .orient('left') + ; + x2Axis + .orient('bottom') + .tickPadding(5) + ; + y2Axis + .orient('left') + ; + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, null, null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight1 = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom - height2, + availableHeight2 = height2 - margin2.top - margin2.bottom; + + chart.update = function() { container.transition().duration(transitionDuration).call(chart) }; + chart.container = this; + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight1 / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = lines.xScale(); + y = lines.yScale(); + x2 = lines2.xScale(); + y2 = lines2.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-lineWithFocusChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineWithFocusChart').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-legendWrap'); + + var focusEnter = gEnter.append('g').attr('class', 'nv-focus'); + focusEnter.append('g').attr('class', 'nv-x nv-axis'); + focusEnter.append('g').attr('class', 'nv-y nv-axis'); + focusEnter.append('g').attr('class', 'nv-linesWrap'); + + var contextEnter = gEnter.append('g').attr('class', 'nv-context'); + contextEnter.append('g').attr('class', 'nv-x nv-axis'); + contextEnter.append('g').attr('class', 'nv-y nv-axis'); + contextEnter.append('g').attr('class', 'nv-linesWrap'); + contextEnter.append('g').attr('class', 'nv-brushBackground'); + contextEnter.append('g').attr('class', 'nv-x nv-brush'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight1 = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom - height2; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')') + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Main Chart Component(s) + + lines + .width(availableWidth) + .height(availableHeight1) + .color( + data + .map(function(d,i) { + return d.color || color(d, i); + }) + .filter(function(d,i) { + return !data[i].disabled; + }) + ); + + lines2 + .defined(lines.defined()) + .width(availableWidth) + .height(availableHeight2) + .color( + data + .map(function(d,i) { + return d.color || color(d, i); + }) + .filter(function(d,i) { + return !data[i].disabled; + }) + ); + + g.select('.nv-context') + .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')') + + var contextLinesWrap = g.select('.nv-context .nv-linesWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + d3.transition(contextLinesWrap).call(lines2); + + //------------------------------------------------------------ + + + /* + var focusLinesWrap = g.select('.nv-focus .nv-linesWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + d3.transition(focusLinesWrap).call(lines); + */ + + + //------------------------------------------------------------ + // Setup Main (Focus) Axes + + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight1, 0); + + yAxis + .scale(y) + .ticks( availableHeight1 / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-focus .nv-x.nv-axis') + .attr('transform', 'translate(0,' + availableHeight1 + ')'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Brush + + brush + .x(x2) + .on('brush', function() { + //When brushing, turn off transitions because chart needs to change immediately. + var oldTransition = chart.transitionDuration(); + chart.transitionDuration(0); + onBrush(); + chart.transitionDuration(oldTransition); + }); + + if (brushExtent) brush.extent(brushExtent); + + var brushBG = g.select('.nv-brushBackground').selectAll('g') + .data([brushExtent || brush.extent()]) + + var brushBGenter = brushBG.enter() + .append('g'); + + brushBGenter.append('rect') + .attr('class', 'left') + .attr('x', 0) + .attr('y', 0) + .attr('height', availableHeight2); + + brushBGenter.append('rect') + .attr('class', 'right') + .attr('x', 0) + .attr('y', 0) + .attr('height', availableHeight2); + + var gBrush = g.select('.nv-x.nv-brush') + .call(brush); + gBrush.selectAll('rect') + //.attr('y', -5) + .attr('height', availableHeight2); + gBrush.selectAll('.resize').append('path').attr('d', resizePath); + + onBrush(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Secondary (Context) Axes + + x2Axis + .scale(x2) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight2, 0); + + g.select('.nv-context .nv-x.nv-axis') + .attr('transform', 'translate(0,' + y2.range()[0] + ')'); + d3.transition(g.select('.nv-context .nv-x.nv-axis')) + .call(x2Axis); + + + y2Axis + .scale(y2) + .ticks( availableHeight2 / 36 ) + .tickSize( -availableWidth, 0); + + d3.transition(g.select('.nv-context .nv-y.nv-axis')) + .call(y2Axis); + + g.select('.nv-context .nv-x.nv-axis') + .attr('transform', 'translate(0,' + y2.range()[0] + ')'); + + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('stateChange', function(newState) { + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + //============================================================ + + + //============================================================ + // Functions + //------------------------------------------------------------ + + // Taken from crossfilter (http://square.github.com/crossfilter/) + function resizePath(d) { + var e = +(d == 'e'), + x = e ? 1 : -1, + y = availableHeight2 / 3; + return 'M' + (.5 * x) + ',' + y + + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6) + + 'V' + (2 * y - 6) + + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y) + + 'Z' + + 'M' + (2.5 * x) + ',' + (y + 8) + + 'V' + (2 * y - 8) + + 'M' + (4.5 * x) + ',' + (y + 8) + + 'V' + (2 * y - 8); + } + + + function updateBrushBG() { + if (!brush.empty()) brush.extent(brushExtent); + brushBG + .data([brush.empty() ? x2.domain() : brushExtent]) + .each(function(d,i) { + var leftWidth = x2(d[0]) - x.range()[0], + rightWidth = x.range()[1] - x2(d[1]); + d3.select(this).select('.left') + .attr('width', leftWidth < 0 ? 0 : leftWidth); + + d3.select(this).select('.right') + .attr('x', x2(d[1])) + .attr('width', rightWidth < 0 ? 0 : rightWidth); + }); + } + + + function onBrush() { + brushExtent = brush.empty() ? null : brush.extent(); + var extent = brush.empty() ? x2.domain() : brush.extent(); + + //The brush extent cannot be less than one. If it is, don't update the line chart. + if (Math.abs(extent[0] - extent[1]) <= 1) { + return; + } + + dispatch.brush({extent: extent, brush: brush}); + + + updateBrushBG(); + + // Update Main (Focus) + var focusLinesWrap = g.select('.nv-focus .nv-linesWrap') + .datum( + data + .filter(function(d) { return !d.disabled }) + .map(function(d,i) { + return { + key: d.key, + values: d.values.filter(function(d,i) { + return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1]; + }) + } + }) + ); + focusLinesWrap.transition().duration(transitionDuration).call(lines); + + + // Update Main (Focus) Axes + g.select('.nv-focus .nv-x.nv-axis').transition().duration(transitionDuration) + .call(xAxis); + g.select('.nv-focus .nv-y.nv-axis').transition().duration(transitionDuration) + .call(yAxis); + } + + //============================================================ + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.legend = legend; + chart.lines = lines; + chart.lines2 = lines2; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + chart.x2Axis = x2Axis; + chart.y2Axis = y2Axis; + + d3.rebind(chart, lines, 'defined', 'isArea', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return lines.x; + lines.x(_); + lines2.x(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return lines.y; + lines.y(_); + lines2.y(_); + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.margin2 = function(_) { + if (!arguments.length) return margin2; + margin2 = _; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.height2 = function(_) { + if (!arguments.length) return height2; + height2 = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color =nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.interpolate = function(_) { + if (!arguments.length) return lines.interpolate(); + lines.interpolate(_); + lines2.interpolate(_); + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + // Chart has multiple similar Axes, to prevent code duplication, probably need to link all axis functions manually like below + chart.xTickFormat = function(_) { + if (!arguments.length) return xAxis.tickFormat(); + xAxis.tickFormat(_); + x2Axis.tickFormat(_); + return chart; + }; + + chart.yTickFormat = function(_) { + if (!arguments.length) return yAxis.tickFormat(); + yAxis.tickFormat(_); + y2Axis.tickFormat(_); + return chart; + }; + + chart.brushExtent = function(_) { + if (!arguments.length) return brushExtent; + brushExtent = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBar.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBar.js new file mode 100644 index 0000000..1085919 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBar.js @@ -0,0 +1,461 @@ + +nv.models.multiBar = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , x = d3.scale.ordinal() + , y = d3.scale.linear() + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove + , clipEdge = true + , stacked = false + , stackOffset = 'zero' // options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function + , color = nv.utils.defaultColor() + , hideable = false + , barColor = null // adding the ability to set the color for each rather than the whole group + , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled + , delay = 1200 + , xDomain + , yDomain + , xRange + , yRange + , groupSpacing = 0.1 + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0 //used to store previous scales + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + if(hideable && data.length) hideable = [{ + values: data[0].values.map(function(d) { + return { + x: d.x, + y: 0, + series: d.series, + size: 0.01 + };} + )}]; + + if (stacked) + data = d3.layout.stack() + .offset(stackOffset) + .values(function(d){ return d.values }) + .y(getY) + (!data.length && hideable ? hideable : data); + + + //add series index to each data point for reference + data.forEach(function(series, i) { + series.values.forEach(function(point) { + point.series = i; + }); + }); + + + //------------------------------------------------------------ + // HACK for negative value stacking + if (stacked) + data[0].values.map(function(d,i) { + var posBase = 0, negBase = 0; + data.map(function(d) { + var f = d.values[i] + f.size = Math.abs(f.y); + if (f.y<0) { + f.y1 = negBase; + negBase = negBase - f.size; + } else + { + f.y1 = f.size + posBase; + posBase = posBase + f.size; + } + }); + }); + + //------------------------------------------------------------ + // Setup Scales + + // remap and flatten the data for use in calculating the scales' domains + var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate + data.map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1 } + }) + }); + + x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x })) + .rangeBands(xRange || [0, availableWidth], groupSpacing); + + //y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y1 : 0) }).concat(forceY))) + y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 : d.y1 + d.y ) : d.y }).concat(forceY))) + .range(yRange || [availableHeight, 0]); + + // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point + if (x.domain()[0] === x.domain()[1]) + x.domain()[0] ? + x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) + : x.domain([-1,1]); + + if (y.domain()[0] === y.domain()[1]) + y.domain()[0] ? + y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01]) + : y.domain([-1,1]); + + + x0 = x0 || x; + y0 = y0 || y; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-multibar').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibar'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + gEnter.append('g').attr('class', 'nv-groups'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + defsEnter.append('clipPath') + .attr('id', 'nv-edge-clip-' + id) + .append('rect'); + wrap.select('#nv-edge-clip-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); + + + + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d,i) { return i }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + groups.exit() + .transition() + .selectAll('rect.nv-bar') + .delay(function(d,i) { + return i * delay/ data[0].values.length; + }) + .attr('y', function(d) { return stacked ? y0(d.y0) : y0(0) }) + .attr('height', 0) + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }) + .style('fill', function(d,i){ return color(d, i) }) + .style('stroke', function(d,i){ return color(d, i) }); + groups + .transition() + .style('stroke-opacity', 1) + .style('fill-opacity', .75); + + + var bars = groups.selectAll('rect.nv-bar') + .data(function(d) { return (hideable && !data.length) ? hideable.values : d.values }); + + bars.exit().remove(); + + + var barsEnter = bars.enter().append('rect') + .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'}) + .attr('x', function(d,i,j) { + return stacked ? 0 : (j * x.rangeBand() / data.length ) + }) + .attr('y', function(d) { return y0(stacked ? d.y0 : 0) }) + .attr('height', 0) + .attr('width', x.rangeBand() / (stacked ? 1 : data.length) ) + .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; }) + ; + bars + .style('fill', function(d,i,j){ return color(d, j, i); }) + .style('stroke', function(d,i,j){ return color(d, j, i); }) + .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('mouseout', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + value: getY(d,i), + point: d, + series: data[d.series], + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('click', function(d,i) { + dispatch.elementClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + dispatch.elementDblClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }); + bars + .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'}) + .transition() + .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; }) + + if (barColor) { + if (!disabled) disabled = data.map(function() { return true }); + bars + .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); }) + .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); }); + } + + + if (stacked) + bars.transition() + .delay(function(d,i) { + + return i * delay / data[0].values.length; + }) + .attr('y', function(d,i) { + + return y((stacked ? d.y1 : 0)); + }) + .attr('height', function(d,i) { + return Math.max(Math.abs(y(d.y + (stacked ? d.y0 : 0)) - y((stacked ? d.y0 : 0))),1); + }) + .attr('x', function(d,i) { + return stacked ? 0 : (d.series * x.rangeBand() / data.length ) + }) + .attr('width', x.rangeBand() / (stacked ? 1 : data.length) ); + else + bars.transition() + .delay(function(d,i) { + return i * delay/ data[0].values.length; + }) + .attr('x', function(d,i) { + return d.series * x.rangeBand() / data.length + }) + .attr('width', x.rangeBand() / data.length) + .attr('y', function(d,i) { + return getY(d,i) < 0 ? + y(0) : + y(0) - y(getY(d,i)) < 1 ? + y(0) - 1 : + y(getY(d,i)) || 0; + }) + .attr('height', function(d,i) { + return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) || 0; + }); + + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.xRange = function(_) { + if (!arguments.length) return xRange; + xRange = _; + return chart; + }; + + chart.yRange = function(_) { + if (!arguments.length) return yRange; + yRange = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.stacked = function(_) { + if (!arguments.length) return stacked; + stacked = _; + return chart; + }; + + chart.stackOffset = function(_) { + if (!arguments.length) return stackOffset; + stackOffset = _; + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.barColor = function(_) { + if (!arguments.length) return barColor; + barColor = nv.utils.getColor(_); + return chart; + }; + + chart.disabled = function(_) { + if (!arguments.length) return disabled; + disabled = _; + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.hideable = function(_) { + if (!arguments.length) return hideable; + hideable = _; + return chart; + }; + + chart.delay = function(_) { + if (!arguments.length) return delay; + delay = _; + return chart; + }; + + chart.groupSpacing = function(_) { + if (!arguments.length) return groupSpacing; + groupSpacing = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarChart.js new file mode 100644 index 0000000..0323063 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarChart.js @@ -0,0 +1,524 @@ + +nv.models.multiBarChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var multibar = nv.models.multiBar() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + , controls = nv.models.legend() + ; + + var margin = {top: 30, right: 20, bottom: 50, left: 60} + , width = null + , height = null + , color = nv.utils.defaultColor() + , showControls = true + , showLegend = true + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , reduceXTicks = true // if false a tick will show for every data point + , staggerLabels = false + , rotateLabels = 0 + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' on ' + x + '

      ' + } + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , state = { stacked: false } + , defaultState = null + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , controlWidth = function() { return showControls ? 180 : 0 } + , transitionDuration = 250 + ; + + multibar + .stacked(false) + ; + xAxis + .orient('bottom') + .tickPadding(7) + .highlightZero(true) + .showMaxMin(false) + .tickFormat(function(d) { return d }) + ; + yAxis + .orient((rightAlignYAxis) ? 'right' : 'left') + .tickFormat(d3.format(',.1f')) + ; + + controls.updateState(false); + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().duration(transitionDuration).call(chart) }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + //------------------------------------------------------------ + // Display noData message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = multibar.xScale(); + y = multibar.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-multiBarWithLegend').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarWithLegend').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-barsWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth - controlWidth()); + + if (multibar.barColor()) + data.forEach(function(series,i) { + series.color = d3.rgb('#ccc').darker(i * 1.5).toString(); + }) + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + var controlsData = [ + { key: 'Grouped', disabled: multibar.stacked() }, + { key: 'Stacked', disabled: !multibar.stacked() } + ]; + + controls.width(controlWidth()).color(['#444', '#444', '#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + //------------------------------------------------------------ + // Main Chart Component(s) + + multibar + .disabled(data.map(function(series) { return series.disabled })) + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })) + + + var barsWrap = g.select('.nv-barsWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + barsWrap.transition().call(multibar); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + if (showXAxis) { + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')'); + g.select('.nv-x.nv-axis').transition() + .call(xAxis); + + var xTicks = g.select('.nv-x.nv-axis > g').selectAll('g'); + + xTicks + .selectAll('line, text') + .style('opacity', 1) + + if (staggerLabels) { + var getTranslate = function(x,y) { + return "translate(" + x + "," + y + ")"; + }; + + var staggerUp = 5, staggerDown = 17; //pixels to stagger by + // Issue #140 + xTicks + .selectAll("text") + .attr('transform', function(d,i,j) { + return getTranslate(0, (j % 2 == 0 ? staggerUp : staggerDown)); + }); + + var totalInBetweenTicks = d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length; + g.selectAll(".nv-x.nv-axis .nv-axisMaxMin text") + .attr("transform", function(d,i) { + return getTranslate(0, (i === 0 || totalInBetweenTicks % 2 !== 0) ? staggerDown : staggerUp); + }); + } + + if (reduceXTicks) + xTicks + .filter(function(d,i) { + return i % Math.ceil(data[0].values.length / (availableWidth / 100)) !== 0; + }) + .selectAll('text, line') + .style('opacity', 0); + + if(rotateLabels) + xTicks + .selectAll('.tick text') + .attr('transform', 'rotate(' + rotateLabels + ' 0,0)') + .style('text-anchor', rotateLabels > 0 ? 'start' : 'end'); + + g.select('.nv-x.nv-axis').selectAll('g.nv-axisMaxMin text') + .style('opacity', 1); + } + + + if (showYAxis) { + yAxis + .scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-y.nv-axis').transition() + .call(yAxis); + } + + + //------------------------------------------------------------ + + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('stateChange', function(newState) { + state = newState; + dispatch.stateChange(state); + chart.update(); + }); + + controls.dispatch.on('legendClick', function(d,i) { + if (!d.disabled) return; + controlsData = controlsData.map(function(s) { + s.disabled = true; + return s; + }); + d.disabled = false; + + switch (d.key) { + case 'Grouped': + multibar.stacked(false); + break; + case 'Stacked': + multibar.stacked(true); + break; + } + + state.stacked = multibar.stacked(); + dispatch.stateChange(state); + + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode) + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + if (typeof e.stacked !== 'undefined') { + multibar.stacked(e.stacked); + state.stacked = e.stacked; + } + + chart.update(); + }); + + //============================================================ + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + multibar.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + multibar.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.multibar = multibar; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'clipEdge', + 'id', 'stacked', 'stackOffset', 'delay', 'barColor','groupSpacing'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + chart.reduceXTicks= function(_) { + if (!arguments.length) return reduceXTicks; + reduceXTicks = _; + return chart; + }; + + chart.rotateLabels = function(_) { + if (!arguments.length) return rotateLabels; + rotateLabels = _; + return chart; + } + + chart.staggerLabels = function(_) { + if (!arguments.length) return staggerLabels; + staggerLabels = _; + return chart; + }; + + chart.tooltip = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarHorizontal.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarHorizontal.js new file mode 100644 index 0000000..d16d460 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarHorizontal.js @@ -0,0 +1,424 @@ + +nv.models.multiBarHorizontal = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , x = d3.scale.ordinal() + , y = d3.scale.linear() + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove + , color = nv.utils.defaultColor() + , barColor = null // adding the ability to set the color for each rather than the whole group + , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled + , stacked = false + , showValues = false + , valuePadding = 60 + , valueFormat = d3.format(',.2f') + , delay = 1200 + , xDomain + , yDomain + , xRange + , yRange + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0 //used to store previous scales + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + + if (stacked) + data = d3.layout.stack() + .offset('zero') + .values(function(d){ return d.values }) + .y(getY) + (data); + + + //add series index to each data point for reference + data.forEach(function(series, i) { + series.values.forEach(function(point) { + point.series = i; + }); + }); + + + + //------------------------------------------------------------ + // HACK for negative value stacking + if (stacked) + data[0].values.map(function(d,i) { + var posBase = 0, negBase = 0; + data.map(function(d) { + var f = d.values[i] + f.size = Math.abs(f.y); + if (f.y<0) { + f.y1 = negBase - f.size; + negBase = negBase - f.size; + } else + { + f.y1 = posBase; + posBase = posBase + f.size; + } + }); + }); + + + + //------------------------------------------------------------ + // Setup Scales + + // remap and flatten the data for use in calculating the scales' domains + var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate + data.map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1 } + }) + }); + + x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x })) + .rangeBands(xRange || [0, availableHeight], .1); + + //y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y0 : 0) }).concat(forceY))) + y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 + d.y : d.y1 ) : d.y }).concat(forceY))) + + if (showValues && !stacked) + y.range(yRange || [(y.domain()[0] < 0 ? valuePadding : 0), availableWidth - (y.domain()[1] > 0 ? valuePadding : 0) ]); + else + y.range(yRange || [0, availableWidth]); + + x0 = x0 || x; + y0 = y0 || d3.scale.linear().domain(y.domain()).range([y(0),y(0)]); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = d3.select(this).selectAll('g.nv-wrap.nv-multibarHorizontal').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibarHorizontal'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-groups'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d,i) { return i }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + groups.exit().transition() + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6) + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }) + .style('fill', function(d,i){ return color(d, i) }) + .style('stroke', function(d,i){ return color(d, i) }); + groups.transition() + .style('stroke-opacity', 1) + .style('fill-opacity', .75); + + + var bars = groups.selectAll('g.nv-bar') + .data(function(d) { return d.values }); + + bars.exit().remove(); + + + var barsEnter = bars.enter().append('g') + .attr('transform', function(d,i,j) { + return 'translate(' + y0(stacked ? d.y0 : 0) + ',' + (stacked ? 0 : (j * x.rangeBand() / data.length ) + x(getX(d,i))) + ')' + }); + + barsEnter.append('rect') + .attr('width', 0) + .attr('height', x.rangeBand() / (stacked ? 1 : data.length) ) + + bars + .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [ y(getY(d,i) + (stacked ? d.y0 : 0)), x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length) ], + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('mouseout', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + value: getY(d,i), + point: d, + series: data[d.series], + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('click', function(d,i) { + dispatch.elementClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + dispatch.elementDblClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }); + + + barsEnter.append('text'); + + if (showValues && !stacked) { + bars.select('text') + .attr('text-anchor', function(d,i) { return getY(d,i) < 0 ? 'end' : 'start' }) + .attr('y', x.rangeBand() / (data.length * 2)) + .attr('dy', '.32em') + .text(function(d,i) { return valueFormat(getY(d,i)) }) + bars.transition() + .select('text') + .attr('x', function(d,i) { return getY(d,i) < 0 ? -4 : y(getY(d,i)) - y(0) + 4 }) + } else { + bars.selectAll('text').text(''); + } + + bars + .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'}) + + if (barColor) { + if (!disabled) disabled = data.map(function() { return true }); + bars + .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); }) + .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); }); + } + + if (stacked) + bars.transition() + .attr('transform', function(d,i) { + return 'translate(' + y(d.y1) + ',' + x(getX(d,i)) + ')' + }) + .select('rect') + .attr('width', function(d,i) { + return Math.abs(y(getY(d,i) + d.y0) - y(d.y0)) + }) + .attr('height', x.rangeBand() ); + else + bars.transition() + .attr('transform', function(d,i) { + //TODO: stacked must be all positive or all negative, not both? + return 'translate(' + + (getY(d,i) < 0 ? y(getY(d,i)) : y(0)) + + ',' + + (d.series * x.rangeBand() / data.length + + + x(getX(d,i)) ) + + ')' + }) + .select('rect') + .attr('height', x.rangeBand() / data.length ) + .attr('width', function(d,i) { + return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) + }); + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.xRange = function(_) { + if (!arguments.length) return xRange; + xRange = _; + return chart; + }; + + chart.yRange = function(_) { + if (!arguments.length) return yRange; + yRange = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.stacked = function(_) { + if (!arguments.length) return stacked; + stacked = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.barColor = function(_) { + if (!arguments.length) return barColor; + barColor = nv.utils.getColor(_); + return chart; + }; + + chart.disabled = function(_) { + if (!arguments.length) return disabled; + disabled = _; + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.delay = function(_) { + if (!arguments.length) return delay; + delay = _; + return chart; + }; + + chart.showValues = function(_) { + if (!arguments.length) return showValues; + showValues = _; + return chart; + }; + + chart.valueFormat= function(_) { + if (!arguments.length) return valueFormat; + valueFormat = _; + return chart; + }; + + chart.valuePadding = function(_) { + if (!arguments.length) return valuePadding; + valuePadding = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarHorizontalChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarHorizontalChart.js new file mode 100644 index 0000000..02aa6fa --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarHorizontalChart.js @@ -0,0 +1,434 @@ + +nv.models.multiBarHorizontalChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var multibar = nv.models.multiBarHorizontal() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend().height(30) + , controls = nv.models.legend().height(30) + ; + + var margin = {top: 30, right: 20, bottom: 50, left: 60} + , width = null + , height = null + , color = nv.utils.defaultColor() + , showControls = true + , showLegend = true + , stacked = false + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + key + ' - ' + x + '

      ' + + '

      ' + y + '

      ' + } + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , state = { stacked: stacked } + , defaultState = null + , noData = 'No Data Available.' + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , controlWidth = function() { return showControls ? 180 : 0 } + , transitionDuration = 250 + ; + + multibar + .stacked(stacked) + ; + xAxis + .orient('left') + .tickPadding(5) + .highlightZero(false) + .showMaxMin(false) + .tickFormat(function(d) { return d }) + ; + yAxis + .orient('bottom') + .tickFormat(d3.format(',.1f')) + ; + + controls.updateState(false); + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().duration(transitionDuration).call(chart) }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = multibar.xScale(); + y = multibar.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-multiBarHorizontalChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarHorizontalChart').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-barsWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth - controlWidth()); + + if (multibar.barColor()) + data.forEach(function(series,i) { + series.color = d3.rgb('#ccc').darker(i * 1.5).toString(); + }) + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + var controlsData = [ + { key: 'Grouped', disabled: multibar.stacked() }, + { key: 'Stacked', disabled: !multibar.stacked() } + ]; + + controls.width(controlWidth()).color(['#444', '#444', '#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Main Chart Component(s) + + multibar + .disabled(data.map(function(series) { return series.disabled })) + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })) + + + var barsWrap = g.select('.nv-barsWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + barsWrap.transition().call(multibar); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + xAxis + .scale(x) + .ticks( availableHeight / 24 ) + .tickSize(-availableWidth, 0); + + g.select('.nv-x.nv-axis').transition() + .call(xAxis); + + var xTicks = g.select('.nv-x.nv-axis').selectAll('g'); + + xTicks + .selectAll('line, text') + .style('opacity', 1) + + + yAxis + .scale(y) + .ticks( availableWidth / 100 ) + .tickSize( -availableHeight, 0); + + g.select('.nv-y.nv-axis') + .attr('transform', 'translate(0,' + availableHeight + ')'); + g.select('.nv-y.nv-axis').transition() + .call(yAxis); + + //------------------------------------------------------------ + + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('stateChange', function(newState) { + state = newState; + dispatch.stateChange(state); + chart.update(); + }); + + controls.dispatch.on('legendClick', function(d,i) { + if (!d.disabled) return; + controlsData = controlsData.map(function(s) { + s.disabled = true; + return s; + }); + d.disabled = false; + + switch (d.key) { + case 'Grouped': + multibar.stacked(false); + break; + case 'Stacked': + multibar.stacked(true); + break; + } + + state.stacked = multibar.stacked(); + dispatch.stateChange(state); + + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + if (typeof e.stacked !== 'undefined') { + multibar.stacked(e.stacked); + state.stacked = e.stacked; + } + + selection.call(chart); + }); + //============================================================ + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + multibar.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + multibar.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.multibar = multibar; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'clipEdge', 'id', 'delay', 'showValues', 'valueFormat', 'stacked', 'barColor'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltip = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarTimeSeries.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarTimeSeries.js new file mode 100644 index 0000000..abc062c --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiBarTimeSeries.js @@ -0,0 +1,384 @@ +nv.models.multiBarTimeSeries = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , x = d3.time.scale() + , y = d3.scale.linear() + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove + , clipEdge = true + , stacked = false + , color = nv.utils.defaultColor() + , delay = 1200 + , xDomain + , yDomain + , xRange + , yRange + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0 //used to store previous scales + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + if (stacked) + data = d3.layout.stack() + .offset('zero') + .values(function(d){ return d.values }) + .y(getY) + (data); + + + //add series index to each data point for reference + data.forEach(function(series, i) { + series.values.forEach(function(point) { + point.series = i; + }); + }); + + //------------------------------------------------------------ + // Setup Scales + + // remap and flatten the data for use in calculating the scales' domains + var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate + data.map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i), y0: d.y0 } + }) + }); + + x .domain(xDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.x }))) + .range(xRange || [0, availableWidth]); + + y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y0 : 0) }).concat(forceY))) + .range(yRange || [availableHeight, 0]); + + + // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point + if (x.domain()[0] === x.domain()[1]) + x.domain()[0] ? + x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) + : x.domain([-1,1]); + + if (y.domain()[0] === y.domain()[1]) + y.domain()[0] ? + y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01]) + : y.domain([-1,1]); + + + x0 = x0 || x; + y0 = y0 || y; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-multibar').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibar'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + gEnter.append('g').attr('class', 'nv-groups'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + defsEnter.append('clipPath') + .attr('id', 'nv-edge-clip-' + id) + .append('rect'); + wrap.select('#nv-edge-clip-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); + + + + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d) { return d.key }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + d3.transition(groups.exit()) + //.style('stroke-opacity', 1e-6) + //.style('fill-opacity', 1e-6) + .selectAll('rect.nv-bar') + .delay(function(d,i) { return i * delay/ data[0].values.length }) + .attr('y', function(d) { return stacked ? y0(d.y0) : y0(0) }) + .attr('height', 0) + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }) + .style('fill', function(d,i){ return color(d, i) }) + .style('stroke', function(d,i){ return color(d, i) }); + d3.transition(groups) + .style('stroke-opacity', 1) + .style('fill-opacity', .75); + + + var bars = groups.selectAll('rect.nv-bar') + .data(function(d) { return d.values }); + + bars.exit().remove(); + + var maxElements = 0; + for(var ei=0; ei' + key + '' + + '

      ' + y + ' on ' + x + '

      ' + } + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide') + ; + + multibar + .stacked(false) + ; + xAxis + .orient('bottom') + .tickPadding(7) + .highlightZero(false) + .showMaxMin(false) + ; + yAxis + .orient('left') + .tickFormat(d3.format(',.1f')) + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { selection.transition().call(chart) }; + chart.container = this; + + + //------------------------------------------------------------ + // Display noData message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = multibar.xScale(); + y = multibar.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-multiBarWithLegend').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarWithLegend').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-barsWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth / 2); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + var controlsData = [ + { key: 'Grouped', disabled: multibar.stacked() }, + { key: 'Stacked', disabled: !multibar.stacked() } + ]; + + controls.width(180).color(['#444', '#444', '#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Main Chart Component(s) + + multibar + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })) + + + var barsWrap = g.select('.nv-barsWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + d3.transition(barsWrap).call(multibar); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + xAxis + .scale(x) + .ticks(availableWidth / 100) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')'); + d3.transition(g.select('.nv-x.nv-axis')) + .call(xAxis); + + var xTicks = g.select('.nv-x.nv-axis > g').selectAll('g'); + + xTicks + .selectAll('line, text') + .style('opacity', 1) + + if (reduceXTicks) + xTicks + .filter(function(d,i) { + return i % Math.ceil(data[0].values.length / (availableWidth / 100)) !== 0; + }) + .selectAll('text, line') + .style('opacity', 0); + + if(rotateLabels) + xTicks + .selectAll('text') + .attr('transform', function(d,i,j) { return 'rotate('+rotateLabels+' 0,0)' }) + .attr('text-transform', rotateLabels > 0 ? 'start' : 'end'); + + yAxis + .scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + d3.transition(g.select('.nv-y.nv-axis')) + .call(yAxis); + + //------------------------------------------------------------ + + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + if (!data.filter(function(d) { return !d.disabled }).length) { + data.map(function(d) { + d.disabled = false; + wrap.selectAll('.nv-series').classed('disabled', false); + return d; + }); + } + + selection.transition().call(chart); + }); + + controls.dispatch.on('legendClick', function(d,i) { + if (!d.disabled) return; + controlsData = controlsData.map(function(s) { + s.disabled = true; + return s; + }); + d.disabled = false; + + switch (d.key) { + case 'Grouped': + multibar.stacked(false); + break; + case 'Stacked': + multibar.stacked(true); + break; + } + + selection.transition().call(chart); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode) + }); + + //============================================================ + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + multibar.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + multibar.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.multibar = multibar; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'clipEdge', 'id', 'stacked', 'delay'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.reduceXTicks= function(_) { + if (!arguments.length) return reduceXTicks; + reduceXTicks = _; + return chart; + }; + + chart.rotateLabels = function(_) { + if (!arguments.length) return rotateLabels; + rotateLabels = _; + return chart; + } + + chart.tooltip = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiChart.js new file mode 100644 index 0000000..e3e2c5e --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/multiChart.js @@ -0,0 +1,452 @@ +nv.models.multiChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 30, right: 20, bottom: 50, left: 60}, + color = d3.scale.category20().range(), + width = null, + height = null, + showLegend = true, + tooltips = true, + tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' at ' + x + '

      ' + }, + x, + y, + yDomain1, + yDomain2 + ; //can be accessed via chart.lines.[x/y]Scale() + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x = d3.scale.linear(), + yScale1 = d3.scale.linear(), + yScale2 = d3.scale.linear(), + + lines1 = nv.models.line().yScale(yScale1), + lines2 = nv.models.line().yScale(yScale2), + + bars1 = nv.models.multiBar().stacked(false).yScale(yScale1), + bars2 = nv.models.multiBar().stacked(false).yScale(yScale2), + + stack1 = nv.models.stackedArea().yScale(yScale1), + stack2 = nv.models.stackedArea().yScale(yScale2), + + xAxis = nv.models.axis().scale(x).orient('bottom').tickPadding(5), + yAxis1 = nv.models.axis().scale(yScale1).orient('left'), + yAxis2 = nv.models.axis().scale(yScale2).orient('right'), + + legend = nv.models.legend().height(30), + dispatch = d3.dispatch('tooltipShow', 'tooltipHide'); + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines1.x()(e.point, e.pointIndex)), + y = ((e.series.yAxis == 2) ? yAxis2 : yAxis1).tickFormat()(lines1.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, undefined, undefined, offsetElement.offsetParent); + }; + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + chart.update = function() { container.transition().call(chart); }; + chart.container = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + var dataLines1 = data.filter(function(d) {return !d.disabled && d.type == 'line' && d.yAxis == 1}) + var dataLines2 = data.filter(function(d) {return !d.disabled && d.type == 'line' && d.yAxis == 2}) + var dataBars1 = data.filter(function(d) {return !d.disabled && d.type == 'bar' && d.yAxis == 1}) + var dataBars2 = data.filter(function(d) {return !d.disabled && d.type == 'bar' && d.yAxis == 2}) + var dataStack1 = data.filter(function(d) {return !d.disabled && d.type == 'area' && d.yAxis == 1}) + var dataStack2 = data.filter(function(d) {return !d.disabled && d.type == 'area' && d.yAxis == 2}) + + var series1 = data.filter(function(d) {return !d.disabled && d.yAxis == 1}) + .map(function(d) { + return d.values.map(function(d,i) { + return { x: d.x, y: d.y } + }) + }) + + var series2 = data.filter(function(d) {return !d.disabled && d.yAxis == 2}) + .map(function(d) { + return d.values.map(function(d,i) { + return { x: d.x, y: d.y } + }) + }) + + x .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } )) + .range([0, availableWidth]); + + var wrap = container.selectAll('g.wrap.multiChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'wrap nvd3 multiChart').append('g'); + + gEnter.append('g').attr('class', 'x axis'); + gEnter.append('g').attr('class', 'y1 axis'); + gEnter.append('g').attr('class', 'y2 axis'); + gEnter.append('g').attr('class', 'lines1Wrap'); + gEnter.append('g').attr('class', 'lines2Wrap'); + gEnter.append('g').attr('class', 'bars1Wrap'); + gEnter.append('g').attr('class', 'bars2Wrap'); + gEnter.append('g').attr('class', 'stack1Wrap'); + gEnter.append('g').attr('class', 'stack2Wrap'); + gEnter.append('g').attr('class', 'legendWrap'); + + var g = wrap.select('g'); + + if (showLegend) { + legend.width( availableWidth / 2 ); + + g.select('.legendWrap') + .datum(data.map(function(series) { + series.originalKey = series.originalKey === undefined ? series.key : series.originalKey; + series.key = series.originalKey + (series.yAxis == 1 ? '' : ' (right axis)'); + return series; + })) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.legendWrap') + .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')'); + } + + + lines1 + .width(availableWidth) + .height(availableHeight) + .interpolate("monotone") + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'line'})); + + lines2 + .width(availableWidth) + .height(availableHeight) + .interpolate("monotone") + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'line'})); + + bars1 + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'bar'})); + + bars2 + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'bar'})); + + stack1 + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'area'})); + + stack2 + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'area'})); + + g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + var lines1Wrap = g.select('.lines1Wrap') + .datum(dataLines1) + var bars1Wrap = g.select('.bars1Wrap') + .datum(dataBars1) + var stack1Wrap = g.select('.stack1Wrap') + .datum(dataStack1) + + var lines2Wrap = g.select('.lines2Wrap') + .datum(dataLines2) + var bars2Wrap = g.select('.bars2Wrap') + .datum(dataBars2) + var stack2Wrap = g.select('.stack2Wrap') + .datum(dataStack2) + + var extraValue1 = dataStack1.length ? dataStack1.map(function(a){return a.values}).reduce(function(a,b){ + return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}}) + }).concat([{x:0, y:0}]) : [] + var extraValue2 = dataStack2.length ? dataStack2.map(function(a){return a.values}).reduce(function(a,b){ + return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}}) + }).concat([{x:0, y:0}]) : [] + + yScale1 .domain(yDomain1 || d3.extent(d3.merge(series1).concat(extraValue1), function(d) { return d.y } )) + .range([0, availableHeight]) + + yScale2 .domain(yDomain2 || d3.extent(d3.merge(series2).concat(extraValue2), function(d) { return d.y } )) + .range([0, availableHeight]) + + lines1.yDomain(yScale1.domain()) + bars1.yDomain(yScale1.domain()) + stack1.yDomain(yScale1.domain()) + + lines2.yDomain(yScale2.domain()) + bars2.yDomain(yScale2.domain()) + stack2.yDomain(yScale2.domain()) + + if(dataStack1.length){d3.transition(stack1Wrap).call(stack1);} + if(dataStack2.length){d3.transition(stack2Wrap).call(stack2);} + + if(dataBars1.length){d3.transition(bars1Wrap).call(bars1);} + if(dataBars2.length){d3.transition(bars2Wrap).call(bars2);} + + if(dataLines1.length){d3.transition(lines1Wrap).call(lines1);} + if(dataLines2.length){d3.transition(lines2Wrap).call(lines2);} + + + + xAxis + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight, 0); + + g.select('.x.axis') + .attr('transform', 'translate(0,' + availableHeight + ')'); + d3.transition(g.select('.x.axis')) + .call(xAxis); + + yAxis1 + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + + d3.transition(g.select('.y1.axis')) + .call(yAxis1); + + yAxis2 + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + d3.transition(g.select('.y2.axis')) + .call(yAxis2); + + g.select('.y2.axis') + .style('opacity', series2.length ? 1 : 0) + .attr('transform', 'translate(' + x.range()[1] + ',0)'); + + legend.dispatch.on('stateChange', function(newState) { + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines1.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines1.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + lines2.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines2.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + bars1.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + bars1.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + bars2.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + bars2.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + stack1.dispatch.on('tooltipShow', function(e) { + //disable tooltips when value ~= 0 + //// TODO: consider removing points from voronoi that have 0 value instead of this hack + if (!Math.round(stack1.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range + setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0); + return false; + } + + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top], + dispatch.tooltipShow(e); + }); + + stack1.dispatch.on('tooltipHide', function(e) { + dispatch.tooltipHide(e); + }); + + stack2.dispatch.on('tooltipShow', function(e) { + //disable tooltips when value ~= 0 + //// TODO: consider removing points from voronoi that have 0 value instead of this hack + if (!Math.round(stack2.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range + setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0); + return false; + } + + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top], + dispatch.tooltipShow(e); + }); + + stack2.dispatch.on('tooltipHide', function(e) { + dispatch.tooltipHide(e); + }); + + lines1.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines1.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + lines2.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines2.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + + + //============================================================ + // Global getters and setters + //------------------------------------------------------------ + + chart.dispatch = dispatch; + chart.lines1 = lines1; + chart.lines2 = lines2; + chart.bars1 = bars1; + chart.bars2 = bars2; + chart.stack1 = stack1; + chart.stack2 = stack2; + chart.xAxis = xAxis; + chart.yAxis1 = yAxis1; + chart.yAxis2 = yAxis2; + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + lines1.x(_); + bars1.x(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + lines1.y(_); + bars1.y(_); + return chart; + }; + + chart.yDomain1 = function(_) { + if (!arguments.length) return yDomain1; + yDomain1 = _; + return chart; + }; + + chart.yDomain2 = function(_) { + if (!arguments.length) return yDomain2; + yDomain2 = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin = _; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = _; + legend.color(_); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + return chart; +} + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/ohlcBar.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/ohlcBar.js new file mode 100644 index 0000000..46f2b60 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/ohlcBar.js @@ -0,0 +1,380 @@ + +nv.models.ohlcBar = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , x = d3.scale.linear() + , y = d3.scale.linear() + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , getOpen = function(d) { return d.open } + , getClose = function(d) { return d.close } + , getHigh = function(d) { return d.high } + , getLow = function(d) { return d.low } + , forceX = [] + , forceY = [] + , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart + , clipEdge = true + , color = nv.utils.defaultColor() + , xDomain + , yDomain + , xRange + , yRange + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + //TODO: store old scales for transitions + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup Scales + + x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) )); + + if (padData) + x.range(xRange || [availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]); + else + x.range(xRange || [0, availableWidth]); + + y .domain(yDomain || [ + d3.min(data[0].values.map(getLow).concat(forceY)), + d3.max(data[0].values.map(getHigh).concat(forceY)) + ]) + .range(yRange || [availableHeight, 0]); + + // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point + if (x.domain()[0] === x.domain()[1]) + x.domain()[0] ? + x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) + : x.domain([-1,1]); + + if (y.domain()[0] === y.domain()[1]) + y.domain()[0] ? + y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01]) + : y.domain([-1,1]); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = d3.select(this).selectAll('g.nv-wrap.nv-ohlcBar').data([data[0].values]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-ohlcBar'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-ticks'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + container + .on('click', function(d,i) { + dispatch.chartClick({ + data: d, + index: i, + pos: d3.event, + id: id + }); + }); + + + defsEnter.append('clipPath') + .attr('id', 'nv-chart-clip-path-' + id) + .append('rect'); + + wrap.select('#nv-chart-clip-path-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : ''); + + + + var ticks = wrap.select('.nv-ticks').selectAll('.nv-tick') + .data(function(d) { return d }); + + ticks.exit().remove(); + + + var ticksEnter = ticks.enter().append('path') + .attr('class', function(d,i,j) { return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i }) + .attr('d', function(d,i) { + var w = (availableWidth / data[0].values.length) * .9; + return 'm0,0l0,' + + (y(getOpen(d,i)) + - y(getHigh(d,i))) + + 'l' + + (-w/2) + + ',0l' + + (w/2) + + ',0l0,' + + (y(getLow(d,i)) - y(getOpen(d,i))) + + 'l0,' + + (y(getClose(d,i)) + - y(getLow(d,i))) + + 'l' + + (w/2) + + ',0l' + + (-w/2) + + ',0z'; + }) + .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; }) + //.attr('fill', function(d,i) { return color[0]; }) + //.attr('stroke', function(d,i) { return color[0]; }) + //.attr('x', 0 ) + //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) }) + //.attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) }) + .on('mouseover', function(d,i) { + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + point: d, + series: data[0], + pos: [x(getX(d,i)), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: 0, + e: d3.event + }); + + }) + .on('mouseout', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + point: d, + series: data[0], + pointIndex: i, + seriesIndex: 0, + e: d3.event + }); + }) + .on('click', function(d,i) { + dispatch.elementClick({ + //label: d[label], + value: getY(d,i), + data: d, + index: i, + pos: [x(getX(d,i)), y(getY(d,i))], + e: d3.event, + id: id + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + dispatch.elementDblClick({ + //label: d[label], + value: getY(d,i), + data: d, + index: i, + pos: [x(getX(d,i)), y(getY(d,i))], + e: d3.event, + id: id + }); + d3.event.stopPropagation(); + }); + + ticks + .attr('class', function(d,i,j) { return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i }) + d3.transition(ticks) + .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; }) + .attr('d', function(d,i) { + var w = (availableWidth / data[0].values.length) * .9; + return 'm0,0l0,' + + (y(getOpen(d,i)) + - y(getHigh(d,i))) + + 'l' + + (-w/2) + + ',0l' + + (w/2) + + ',0l0,' + + (y(getLow(d,i)) + - y(getOpen(d,i))) + + 'l0,' + + (y(getClose(d,i)) + - y(getLow(d,i))) + + 'l' + + (w/2) + + ',0l' + + (-w/2) + + ',0z'; + }) + //.attr('width', (availableWidth / data[0].values.length) * .9 ) + + + //d3.transition(ticks) + //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) }) + //.attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) }); + //.order(); // not sure if this makes any sense for this model + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + return chart; + }; + + chart.open = function(_) { + if (!arguments.length) return getOpen; + getOpen = _; + return chart; + }; + + chart.close = function(_) { + if (!arguments.length) return getClose; + getClose = _; + return chart; + }; + + chart.high = function(_) { + if (!arguments.length) return getHigh; + getHigh = _; + return chart; + }; + + chart.low = function(_) { + if (!arguments.length) return getLow; + getLow = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.xRange = function(_) { + if (!arguments.length) return xRange; + xRange = _; + return chart; + }; + + chart.yRange = function(_) { + if (!arguments.length) return yRange; + yRange = _; + return chart; + }; + + chart.forceX = function(_) { + if (!arguments.length) return forceX; + forceX = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.padData = function(_) { + if (!arguments.length) return padData; + padData = _; + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/parallelCoordinates.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/parallelCoordinates.js new file mode 100644 index 0000000..107154f --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/parallelCoordinates.js @@ -0,0 +1,239 @@ + +//Code adapted from Jason Davies' "Parallel Coordinates" +// http://bl.ocks.org/jasondavies/1341281 + +nv.models.parallelCoordinates = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + + var margin = {top: 30, right: 10, bottom: 10, left: 10} + , width = 960 + , height = 500 + , x = d3.scale.ordinal() + , y = {} + , dimensions = [] + , color = nv.utils.getColor(d3.scale.category20c().range()) + , axisLabel = function(d) { return d; } + , filters = [] + , active = [] + , dispatch = d3.dispatch('brush') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + active = data; //set all active before first brush call + + chart.update = function() { }; //This is a placeholder until this chart is made resizeable + + //------------------------------------------------------------ + // Setup Scales + + x + .rangePoints([0, availableWidth], 1) + .domain(dimensions); + + // Extract the list of dimensions and create a scale for each. + dimensions.forEach(function(d) { + y[d] = d3.scale.linear() + .domain(d3.extent(data, function(p) { return +p[d]; })) + .range([availableHeight, 0]); + + y[d].brush = d3.svg.brush().y(y[d]).on('brush', brush); + + return d != 'name'; + }) + + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-parallelCoordinates').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-parallelCoordinates'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + gEnter.append('g').attr('class', 'nv-parallelCoordinatesWrap'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + var line = d3.svg.line(), + axis = d3.svg.axis().orient('left'), + background, + foreground; + + + // Add grey background lines for context. + background = gEnter.append('g') + .attr('class', 'background') + .selectAll('path') + .data(data) + .enter().append('path') + .attr('d', path) + ; + + // Add blue foreground lines for focus. + foreground = gEnter.append('g') + .attr('class', 'foreground') + .selectAll('path') + .data(data) + .enter().append('path') + .attr('d', path) + ; + + // Add a group element for each dimension. + var dimension = g.selectAll('.dimension') + .data(dimensions) + .enter().append('g') + .attr('class', 'dimension') + .attr('transform', function(d) { return 'translate(' + x(d) + ',0)'; }); + + // Add an axis and title. + dimension.append('g') + .attr('class', 'axis') + .each(function(d) { d3.select(this).call(axis.scale(y[d])); }) + .append('text') + .attr('text-anchor', 'middle') + .attr('y', -9) + .text(String); + + // Add and store a brush for each axis. + dimension.append('g') + .attr('class', 'brush') + .each(function(d) { d3.select(this).call(y[d].brush); }) + .selectAll('rect') + .attr('x', -8) + .attr('width', 16); + + + // Returns the path for a given data point. + function path(d) { + return line(dimensions.map(function(p) { return [x(p), y[p](d[p])]; })); + } + + // Handles a brush event, toggling the display of foreground lines. + function brush() { + var actives = dimensions.filter(function(p) { return !y[p].brush.empty(); }), + extents = actives.map(function(p) { return y[p].brush.extent(); }); + + filters = []; //erase current filters + actives.forEach(function(d,i) { + filters[i] = { + dimension: d, + extent: extents[i] + } + }); + + active = []; //erase current active list + foreground.style('display', function(d) { + var isActive = actives.every(function(p, i) { + return extents[i][0] <= d[p] && d[p] <= extents[i][1]; + }); + if (isActive) active.push(d); + return isActive ? null : 'none'; + }); + + dispatch.brush({ + filters: filters, + active: active + }); + + } + + + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + + chart.dispatch = dispatch; + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_) + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.dimensions = function(_) { + if (!arguments.length) return dimensions; + dimensions = _; + return chart; + }; + + chart.filters = function() { + return filters; + }; + + chart.active = function() { + return active; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/pie.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/pie.js new file mode 100644 index 0000000..2099c8f --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/pie.js @@ -0,0 +1,400 @@ +nv.models.pie = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 500 + , height = 500 + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , getDescription = function(d) { return d.description } + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , color = nv.utils.defaultColor() + , valueFormat = d3.format(',.2f') + , showLabels = true + , pieLabelsOutside = true + , donutLabelsOutside = false + , labelType = "key" + , labelThreshold = .02 //if slice percentage is under this, don't show label + , donut = false + , labelSunbeamLayout = false + , startAngle = false + , endAngle = false + , donutRatio = 0.5 + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + radius = Math.min(availableWidth, availableHeight) / 2, + arcRadius = radius-(radius / 5), + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + //var wrap = container.selectAll('.nv-wrap.nv-pie').data([data]); + var wrap = container.selectAll('.nv-wrap.nv-pie').data(data); + var wrapEnter = wrap.enter().append('g').attr('class','nvd3 nv-wrap nv-pie nv-chart-' + id); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-pie'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + g.select('.nv-pie').attr('transform', 'translate(' + availableWidth / 2 + ',' + availableHeight / 2 + ')'); + + //------------------------------------------------------------ + + + container + .on('click', function(d,i) { + dispatch.chartClick({ + data: d, + index: i, + pos: d3.event, + id: id + }); + }); + + + var arc = d3.svg.arc() + .outerRadius(arcRadius); + + if (startAngle) arc.startAngle(startAngle) + if (endAngle) arc.endAngle(endAngle); + if (donut) arc.innerRadius(radius * donutRatio); + + // Setup the Pie chart and choose the data element + var pie = d3.layout.pie() + .sort(null) + .value(function(d) { return d.disabled ? 0 : getY(d) }); + + var slices = wrap.select('.nv-pie').selectAll('.nv-slice') + .data(pie); + + slices.exit().remove(); + + var ae = slices.enter().append('g') + .attr('class', 'nv-slice') + .on('mouseover', function(d,i){ + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + label: getX(d.data), + value: getY(d.data), + point: d.data, + pointIndex: i, + pos: [d3.event.pageX, d3.event.pageY], + id: id + }); + }) + .on('mouseout', function(d,i){ + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + label: getX(d.data), + value: getY(d.data), + point: d.data, + index: i, + id: id + }); + }) + .on('click', function(d,i) { + dispatch.elementClick({ + label: getX(d.data), + value: getY(d.data), + point: d.data, + index: i, + pos: d3.event, + id: id + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + dispatch.elementDblClick({ + label: getX(d.data), + value: getY(d.data), + point: d.data, + index: i, + pos: d3.event, + id: id + }); + d3.event.stopPropagation(); + }); + + slices + .attr('fill', function(d,i) { return color(d, i); }) + .attr('stroke', function(d,i) { return color(d, i); }); + + var paths = ae.append('path') + .each(function(d) { this._current = d; }); + //.attr('d', arc); + + d3.transition(slices.select('path')) + .attr('d', arc); + //.attrTween('d', arcTween); + + if (showLabels) { + // This does the normal label + var labelsArc = d3.svg.arc().innerRadius(0); + + if (pieLabelsOutside){ labelsArc = arc; } + + if (donutLabelsOutside) { labelsArc = d3.svg.arc().outerRadius(arc.outerRadius()); } + + ae.append("g").classed("nv-label", true) + .each(function(d, i) { + var group = d3.select(this); + + group + .attr('transform', function(d) { + if (labelSunbeamLayout) { + d.outerRadius = arcRadius + 10; // Set Outer Coordinate + d.innerRadius = arcRadius + 15; // Set Inner Coordinate + var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI); + if ((d.startAngle+d.endAngle)/2 < Math.PI) { + rotateAngle -= 90; + } else { + rotateAngle += 90; + } + return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')'; + } else { + d.outerRadius = radius + 10; // Set Outer Coordinate + d.innerRadius = radius + 15; // Set Inner Coordinate + return 'translate(' + labelsArc.centroid(d) + ')' + } + }); + + group.append('rect') + .style('stroke', '#fff') + .style('fill', '#fff') + .attr("rx", 3) + .attr("ry", 3); + + group.append('text') + .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned + .style('fill', '#000') + + + }); + + slices.select(".nv-label").transition() + .attr('transform', function(d) { + if (labelSunbeamLayout) { + d.outerRadius = arcRadius + 10; // Set Outer Coordinate + d.innerRadius = arcRadius + 15; // Set Inner Coordinate + var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI); + if ((d.startAngle+d.endAngle)/2 < Math.PI) { + rotateAngle -= 90; + } else { + rotateAngle += 90; + } + return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')'; + } else { + d.outerRadius = radius + 10; // Set Outer Coordinate + d.innerRadius = radius + 15; // Set Inner Coordinate + return 'translate(' + labelsArc.centroid(d) + ')' + } + }); + + slices.each(function(d, i) { + var slice = d3.select(this); + + slice + .select(".nv-label text") + .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned + .text(function(d, i) { + var percent = (d.endAngle - d.startAngle) / (2 * Math.PI); + return Math.round(percent*1001/10)+"%"; + /*var labelTypes = { + "key" : getX(d.data), + "value": getY(d.data), + "percent": d3.format('%')(percent) + }; + return (d.value && percent > labelThreshold) ? labelTypes[labelType] : ''; + */ + }); + + var textBox = slice.select('text').node().getBBox(); + slice.select(".nv-label rect") + .attr("width", textBox.width + 10) + .attr("height", textBox.height + 10) + .attr("transform", function() { + return "translate(" + [textBox.x - 5, textBox.y - 5] + ")"; + }); + }); + } + + + // Computes the angle of an arc, converting from radians to degrees. + function angle(d) { + var a = (d.startAngle + d.endAngle) * 90 / Math.PI - 90; + return a > 90 ? a - 180 : a; + } + + function arcTween(a) { + a.endAngle = isNaN(a.endAngle) ? 0 : a.endAngle; + a.startAngle = isNaN(a.startAngle) ? 0 : a.startAngle; + if (!donut) a.innerRadius = 0; + var i = d3.interpolate(this._current, a); + this._current = i(0); + return function(t) { + return arc(i(t)); + }; + } + + function tweenPie(b) { + b.innerRadius = 0; + var i = d3.interpolate({startAngle: 0, endAngle: 0}, b); + return function(t) { + return arc(i(t)); + }; + } + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.values = function(_) { + nv.log("pie.values() is no longer supported."); + return chart; + }; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = d3.functor(_); + return chart; + }; + + chart.description = function(_) { + if (!arguments.length) return getDescription; + getDescription = _; + return chart; + }; + + chart.showLabels = function(_) { + if (!arguments.length) return showLabels; + showLabels = _; + return chart; + }; + + chart.labelSunbeamLayout = function(_) { + if (!arguments.length) return labelSunbeamLayout; + labelSunbeamLayout = _; + return chart; + }; + + chart.donutLabelsOutside = function(_) { + if (!arguments.length) return donutLabelsOutside; + donutLabelsOutside = _; + return chart; + }; + + chart.pieLabelsOutside = function(_) { + if (!arguments.length) return pieLabelsOutside; + pieLabelsOutside = _; + return chart; + }; + + chart.labelType = function(_) { + if (!arguments.length) return labelType; + labelType = _; + labelType = labelType || "key"; + return chart; + }; + + chart.donut = function(_) { + if (!arguments.length) return donut; + donut = _; + return chart; + }; + + chart.donutRatio = function(_) { + if (!arguments.length) return donutRatio; + donutRatio = _; + return chart; + }; + + chart.startAngle = function(_) { + if (!arguments.length) return startAngle; + startAngle = _; + return chart; + }; + + chart.endAngle = function(_) { + if (!arguments.length) return endAngle; + endAngle = _; + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.valueFormat = function(_) { + if (!arguments.length) return valueFormat; + valueFormat = _; + return chart; + }; + + chart.labelThreshold = function(_) { + if (!arguments.length) return labelThreshold; + labelThreshold = _; + return chart; + }; + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/pieChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/pieChart.js new file mode 100644 index 0000000..b4303fd --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/pieChart.js @@ -0,0 +1,292 @@ +nv.models.pieChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var pie = nv.models.pie() + , legend = nv.models.legend() + ; + + var margin = {top: 30, right: 20, bottom: 20, left: 20} + , width = null + , height = null + , showLegend = true + , color = nv.utils.defaultColor() + , tooltips = false + , tooltip = function(key, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + '

      ' + } + , state = {} + , defaultState = null + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var tooltipLabel = pie.description()(e.point) || pie.x()(e.point) + var left = e.pos[0] + ( (offsetElement && offsetElement.offsetLeft) || 0 ), + top = e.pos[1] + ( (offsetElement && offsetElement.offsetTop) || 0), + y = pie.valueFormat()(pie.y()(e.point)), + content = tooltip(tooltipLabel, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().call(chart); }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-pieChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-pieChart').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-pieWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend + .width( availableWidth ) + .key(pie.x()); + + wrap.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + wrap.select('.nv-legendWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Main Chart Component(s) + + pie + .width(availableWidth) + .height(availableHeight); + + + var pieWrap = g.select('.nv-pieWrap') + .datum([data]); + + d3.transition(pieWrap).call(pie); + + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + /*legend.dispatch.on('stateChange', function(newState) { + state = newState; + dispatch.stateChange(state); + chart.update(); + });*/ + + pie.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + chart.update(); + }); + + //============================================================ + + + }); + + return chart; + } + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + pie.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.legend = legend; + chart.dispatch = dispatch; + chart.pie = pie; + + d3.rebind(chart, pie, 'valueFormat', 'values', 'x', 'y', 'description', 'id', 'showLabels', 'donutLabelsOutside', 'pieLabelsOutside', 'labelType', 'donut', 'donutRatio', 'labelThreshold'); + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + pie.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatter.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatter.js new file mode 100644 index 0000000..16cbee6 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatter.js @@ -0,0 +1,674 @@ + +nv.models.scatter = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , color = nv.utils.defaultColor() // chooses color + , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't select one + , x = d3.scale.linear() + , y = d3.scale.linear() + , z = d3.scale.linear() //linear because d3.svg.shape.size is treated as area + , getX = function(d) { return d.x } // accessor to get the x value + , getY = function(d) { return d.y } // accessor to get the y value + , getSize = function(d) { return d.size || 1} // accessor to get the point size + , getShape = function(d) { return d.shape || 'circle' } // accessor to get point shape + , onlyCircles = true // Set to false to use shapes + , forceX = [] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.) + , forceY = [] // List of numbers to Force into the Y scale + , forceSize = [] // List of numbers to Force into the Size scale + , interactive = true // If true, plots a voronoi overlay for advanced point intersection + , pointKey = null + , pointActive = function(d) { return !d.notActive } // any points that return false will be filtered out + , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart + , padDataOuter = .1 //outerPadding to imitate ordinal scale outer padding + , clipEdge = false // if true, masks points within x and y scale + , clipVoronoi = true // if true, masks each point with a circle... can turn off to slightly increase performance + , clipRadius = function() { return 25 } // function to get the radius for voronoi point clips + , xDomain = null // Override x domain (skips the calculation from data) + , yDomain = null // Override y domain + , xRange = null // Override x range + , yRange = null // Override y range + , sizeDomain = null // Override point size domain + , sizeRange = null + , singlePoint = false + , dispatch = d3.dispatch('elementClick', 'elementMouseover', 'elementMouseout') + , useVoronoi = true + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0, z0 // used to store previous scales + , timeoutID + , needsUpdate = false // Flag for when the points are visually updating, but the interactive layer is behind, to disable tooltips + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + //add series index to each data point for reference + data.forEach(function(series, i) { + series.values.forEach(function(point) { + point.series = i; + }); + }); + + //------------------------------------------------------------ + // Setup Scales + + // remap and flatten the data for use in calculating the scales' domains + var seriesData = (xDomain && yDomain && sizeDomain) ? [] : // if we know xDomain and yDomain and sizeDomain, no need to calculate.... if Size is constant remember to set sizeDomain to speed up performance + d3.merge( + data.map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i), size: getSize(d,i) } + }) + }) + ); + + x .domain(xDomain || d3.extent(seriesData.map(function(d) { return d.x; }).concat(forceX))) + + if (padData && data[0]) + x.range(xRange || [(availableWidth * padDataOuter + availableWidth) / (2 *data[0].values.length), availableWidth - availableWidth * (1 + padDataOuter) / (2 * data[0].values.length) ]); + //x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]); + else + x.range(xRange || [0, availableWidth]); + + y .domain(yDomain || d3.extent(seriesData.map(function(d) { return d.y }).concat(forceY))) + .range(yRange || [availableHeight, 0]); + + z .domain(sizeDomain || d3.extent(seriesData.map(function(d) { return d.size }).concat(forceSize))) + .range(sizeRange || [16, 256]); + + // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point + if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true; + if (x.domain()[0] === x.domain()[1]) + x.domain()[0] ? + x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) + : x.domain([-1,1]); + + if (y.domain()[0] === y.domain()[1]) + y.domain()[0] ? + y.domain([y.domain()[0] - y.domain()[0] * 0.01, y.domain()[1] + y.domain()[1] * 0.01]) + : y.domain([-1,1]); + + if ( isNaN(x.domain()[0])) { + x.domain([-1,1]); + } + + if ( isNaN(y.domain()[0])) { + y.domain([-1,1]); + } + + + x0 = x0 || x; + y0 = y0 || y; + z0 = z0 || z; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-scatter').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatter nv-chart-' + id + (singlePoint ? ' nv-single-point' : '')); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-groups'); + gEnter.append('g').attr('class', 'nv-point-paths'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + defsEnter.append('clipPath') + .attr('id', 'nv-edge-clip-' + id) + .append('rect'); + + wrap.select('#nv-edge-clip-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); + + + function updateInteractiveLayer() { + + if (!interactive) return false; + + var eventElements; + + var vertices = d3.merge(data.map(function(group, groupIndex) { + return group.values + .map(function(point, pointIndex) { + // *Adding noise to make duplicates very unlikely + // *Injecting series and point index for reference + /* *Adding a 'jitter' to the points, because there's an issue in d3.geom.voronoi. + */ + var pX = getX(point,pointIndex); + var pY = getY(point,pointIndex); + + return [x(pX)+ Math.random() * 1e-7, + y(pY)+ Math.random() * 1e-7, + groupIndex, + pointIndex, point]; //temp hack to add noise untill I think of a better way so there are no duplicates + }) + .filter(function(pointArray, pointIndex) { + return pointActive(pointArray[4], pointIndex); // Issue #237.. move filter to after map, so pointIndex is correct! + }) + }) + ); + + + + //inject series and point index for reference into voronoi + if (useVoronoi === true) { + + if (clipVoronoi) { + var pointClipsEnter = wrap.select('defs').selectAll('.nv-point-clips') + .data([id]) + .enter(); + + pointClipsEnter.append('clipPath') + .attr('class', 'nv-point-clips') + .attr('id', 'nv-points-clip-' + id); + + var pointClips = wrap.select('#nv-points-clip-' + id).selectAll('circle') + .data(vertices); + pointClips.enter().append('circle') + .attr('r', clipRadius); + pointClips.exit().remove(); + pointClips + .attr('cx', function(d) { return d[0] }) + .attr('cy', function(d) { return d[1] }); + + wrap.select('.nv-point-paths') + .attr('clip-path', 'url(#nv-points-clip-' + id + ')'); + } + + + if(vertices.length) { + // Issue #283 - Adding 2 dummy points to the voronoi b/c voronoi requires min 3 points to work + vertices.push([x.range()[0] - 20, y.range()[0] - 20, null, null]); + vertices.push([x.range()[1] + 20, y.range()[1] + 20, null, null]); + vertices.push([x.range()[0] - 20, y.range()[0] + 20, null, null]); + vertices.push([x.range()[1] + 20, y.range()[1] - 20, null, null]); + } + + var bounds = d3.geom.polygon([ + [-10,-10], + [-10,height + 10], + [width + 10,height + 10], + [width + 10,-10] + ]); + + var voronoi = d3.geom.voronoi(vertices).map(function(d, i) { + return { + 'data': bounds.clip(d), + 'series': vertices[i][2], + 'point': vertices[i][3] + } + }); + + + var pointPaths = wrap.select('.nv-point-paths').selectAll('path') + .data(voronoi); + pointPaths.enter().append('path') + .attr('class', function(d,i) { return 'nv-path-'+i; }); + pointPaths.exit().remove(); + pointPaths + .attr('d', function(d) { + if (d.data.length === 0) + return 'M 0 0' + else + return 'M' + d.data.join('L') + 'Z'; + }); + + var mouseEventCallback = function(d,mDispatch) { + if (needsUpdate) return 0; + var series = data[d.series]; + if (typeof series === 'undefined') return; + + var point = series.values[d.point]; + + mDispatch({ + point: point, + series: series, + pos: [x(getX(point, d.point)) + margin.left, y(getY(point, d.point)) + margin.top], + seriesIndex: d.series, + pointIndex: d.point + }); + }; + + pointPaths + .on('click', function(d) { + mouseEventCallback(d, dispatch.elementClick); + }) + .on('mouseover', function(d) { + mouseEventCallback(d, dispatch.elementMouseover); + }) + .on('mouseout', function(d, i) { + mouseEventCallback(d, dispatch.elementMouseout); + }); + + + } else { + /* + // bring data in form needed for click handlers + var dataWithPoints = vertices.map(function(d, i) { + return { + 'data': d, + 'series': vertices[i][2], + 'point': vertices[i][3] + } + }); + */ + + // add event handlers to points instead voronoi paths + wrap.select('.nv-groups').selectAll('.nv-group') + .selectAll('.nv-point') + //.data(dataWithPoints) + //.style('pointer-events', 'auto') // recativate events, disabled by css + .on('click', function(d,i) { + //nv.log('test', d, i); + if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point + var series = data[d.series], + point = series.values[i]; + + dispatch.elementClick({ + point: point, + series: series, + pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top], + seriesIndex: d.series, + pointIndex: i + }); + }) + .on('mouseover', function(d,i) { + if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point + var series = data[d.series], + point = series.values[i]; + + dispatch.elementMouseover({ + point: point, + series: series, + pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top], + seriesIndex: d.series, + pointIndex: i + }); + }) + .on('mouseout', function(d,i) { + if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point + var series = data[d.series], + point = series.values[i]; + + dispatch.elementMouseout({ + point: point, + series: series, + seriesIndex: d.series, + pointIndex: i + }); + }); + } + + needsUpdate = false; + } + + needsUpdate = true; + + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d) { return d.key }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + groups.exit() + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }); + groups + .transition() + .style('fill', function(d,i) { return color(d, i) }) + .style('stroke', function(d,i) { return color(d, i) }) + .style('stroke-opacity', 1) + .style('fill-opacity', .5); + + + if (onlyCircles) { + + var points = groups.selectAll('circle.nv-point') + .data(function(d) { return d.values }, pointKey); + points.enter().append('circle') + .style('fill', function (d,i) { return d.color }) + .style('stroke', function (d,i) { return d.color }) + .attr('cx', function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) }) + .attr('cy', function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) }) + .attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) }); + points.exit().remove(); + groups.exit().selectAll('path.nv-point').transition() + .attr('cx', function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) }) + .attr('cy', function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) }) + .remove(); + points.each(function(d,i) { + d3.select(this) + .classed('nv-point', true) + .classed('nv-point-' + i, true) + .classed('hover',false) + ; + }); + points.transition() + .attr('cx', function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) }) + .attr('cy', function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) }) + .attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) }); + + } else { + + var points = groups.selectAll('path.nv-point') + .data(function(d) { return d.values }); + points.enter().append('path') + .style('fill', function (d,i) { return d.color }) + .style('stroke', function (d,i) { return d.color }) + .attr('transform', function(d,i) { + return 'translate(' + x0(getX(d,i)) + ',' + y0(getY(d,i)) + ')' + }) + .attr('d', + d3.svg.symbol() + .type(getShape) + .size(function(d,i) { return z(getSize(d,i)) }) + ); + points.exit().remove(); + groups.exit().selectAll('path.nv-point') + .transition() + .attr('transform', function(d,i) { + return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')' + }) + .remove(); + points.each(function(d,i) { + d3.select(this) + .classed('nv-point', true) + .classed('nv-point-' + i, true) + .classed('hover',false) + ; + }); + points.transition() + .attr('transform', function(d,i) { + //nv.log(d,i,getX(d,i), x(getX(d,i))); + return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')' + }) + .attr('d', + d3.svg.symbol() + .type(getShape) + .size(function(d,i) { return z(getSize(d,i)) }) + ); + } + + + // Delay updating the invisible interactive layer for smoother animation + clearTimeout(timeoutID); // stop repeat calls to updateInteractiveLayer + timeoutID = setTimeout(updateInteractiveLayer, 300); + //updateInteractiveLayer(); + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + z0 = z.copy(); + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + chart.clearHighlights = function() { + //Remove the 'hover' class from all highlighted points. + d3.selectAll(".nv-chart-" + id + " .nv-point.hover").classed("hover",false); + }; + + chart.highlightPoint = function(seriesIndex,pointIndex,isHoverOver) { + d3.select(".nv-chart-" + id + " .nv-series-" + seriesIndex + " .nv-point-" + pointIndex) + .classed("hover",isHoverOver); + }; + + + dispatch.on('elementMouseover.point', function(d) { + if (interactive) chart.highlightPoint(d.seriesIndex,d.pointIndex,true); + }); + + dispatch.on('elementMouseout.point', function(d) { + if (interactive) chart.highlightPoint(d.seriesIndex,d.pointIndex,false); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = d3.functor(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = d3.functor(_); + return chart; + }; + + chart.size = function(_) { + if (!arguments.length) return getSize; + getSize = d3.functor(_); + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.zScale = function(_) { + if (!arguments.length) return z; + z = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.sizeDomain = function(_) { + if (!arguments.length) return sizeDomain; + sizeDomain = _; + return chart; + }; + + chart.xRange = function(_) { + if (!arguments.length) return xRange; + xRange = _; + return chart; + }; + + chart.yRange = function(_) { + if (!arguments.length) return yRange; + yRange = _; + return chart; + }; + + chart.sizeRange = function(_) { + if (!arguments.length) return sizeRange; + sizeRange = _; + return chart; + }; + + chart.forceX = function(_) { + if (!arguments.length) return forceX; + forceX = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.forceSize = function(_) { + if (!arguments.length) return forceSize; + forceSize = _; + return chart; + }; + + chart.interactive = function(_) { + if (!arguments.length) return interactive; + interactive = _; + return chart; + }; + + chart.pointKey = function(_) { + if (!arguments.length) return pointKey; + pointKey = _; + return chart; + }; + + chart.pointActive = function(_) { + if (!arguments.length) return pointActive; + pointActive = _; + return chart; + }; + + chart.padData = function(_) { + if (!arguments.length) return padData; + padData = _; + return chart; + }; + + chart.padDataOuter = function(_) { + if (!arguments.length) return padDataOuter; + padDataOuter = _; + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.clipVoronoi= function(_) { + if (!arguments.length) return clipVoronoi; + clipVoronoi = _; + return chart; + }; + + chart.useVoronoi= function(_) { + if (!arguments.length) return useVoronoi; + useVoronoi = _; + if (useVoronoi === false) { + clipVoronoi = false; + } + return chart; + }; + + chart.clipRadius = function(_) { + if (!arguments.length) return clipRadius; + clipRadius = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.shape = function(_) { + if (!arguments.length) return getShape; + getShape = _; + return chart; + }; + + chart.onlyCircles = function(_) { + if (!arguments.length) return onlyCircles; + onlyCircles = _; + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.singlePoint = function(_) { + if (!arguments.length) return singlePoint; + singlePoint = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatterChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatterChart.js new file mode 100644 index 0000000..65b6e38 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatterChart.js @@ -0,0 +1,628 @@ +nv.models.scatterChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var scatter = nv.models.scatter() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + , controls = nv.models.legend() + , distX = nv.models.distribution() + , distY = nv.models.distribution() + ; + + var margin = {top: 30, right: 20, bottom: 50, left: 75} + , width = null + , height = null + , color = nv.utils.defaultColor() + , x = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.xScale() + , y = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.yScale() + , xPadding = 0 + , yPadding = 0 + , showDistX = false + , showDistY = false + , showLegend = true + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , showControls = !!d3.fisheye + , fisheye = 0 + , pauseFisheye = false + , tooltips = true + , tooltipX = function(key, x, y) { return '' + x + '' } + , tooltipY = function(key, x, y) { return '' + y + '' } + , tooltip = null + , state = {} + , defaultState = null + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , noData = "No Data Available." + , transitionDuration = 250 + ; + + scatter + .xScale(x) + .yScale(y) + ; + xAxis + .orient('bottom') + .tickPadding(10) + ; + yAxis + .orient((rightAlignYAxis) ? 'right' : 'left') + .tickPadding(10) + ; + distX + .axis('x') + ; + distY + .axis('y') + ; + + controls.updateState(false); + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0; + + var showTooltip = function(e, offsetElement) { + //TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?) + + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + leftX = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + topX = y.range()[0] + margin.top + ( offsetElement.offsetTop || 0), + leftY = x.range()[0] + margin.left + ( offsetElement.offsetLeft || 0 ), + topY = e.pos[1] + ( offsetElement.offsetTop || 0), + xVal = xAxis.tickFormat()(scatter.x()(e.point, e.pointIndex)), + yVal = yAxis.tickFormat()(scatter.y()(e.point, e.pointIndex)); + + if( tooltipX != null ) + nv.tooltip.show([leftX, topX], tooltipX(e.series.key, xVal, yVal, e, chart), 'n', 1, offsetElement, 'x-nvtooltip'); + if( tooltipY != null ) + nv.tooltip.show([leftY, topY], tooltipY(e.series.key, xVal, yVal, e, chart), 'e', 1, offsetElement, 'y-nvtooltip'); + if( tooltip != null ) + nv.tooltip.show([left, top], tooltip(e.series.key, xVal, yVal, e, chart), e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + var controlsData = [ + { key: 'Magnify', disabled: true } + ]; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().duration(transitionDuration).call(chart); }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display noData message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x0 = x0 || x; + y0 = y0 || y; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id()); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + // background for pointer events + gEnter.append('rect').attr('class', 'nvd3 nv-background'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-scatterWrap'); + gEnter.append('g').attr('class', 'nv-distWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + var legendWidth = (showControls) ? availableWidth / 2 : availableWidth; + legend.width(legendWidth); + + wrap.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + wrap.select('.nv-legendWrap') + .attr('transform', 'translate(' + (availableWidth - legendWidth) + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + controls.width(180).color(['#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + //------------------------------------------------------------ + // Main Chart Component(s) + + scatter + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + + if (xPadding !== 0) + scatter.xDomain(null); + + if (yPadding !== 0) + scatter.yDomain(null); + + wrap.select('.nv-scatterWrap') + .datum(data.filter(function(d) { return !d.disabled })) + .call(scatter); + + //Adjust for x and y padding + if (xPadding !== 0) { + var xRange = x.domain()[1] - x.domain()[0]; + scatter.xDomain([x.domain()[0] - (xPadding * xRange), x.domain()[1] + (xPadding * xRange)]); + } + + if (yPadding !== 0) { + var yRange = y.domain()[1] - y.domain()[0]; + scatter.yDomain([y.domain()[0] - (yPadding * yRange), y.domain()[1] + (yPadding * yRange)]); + } + + //Only need to update the scatter again if x/yPadding changed the domain. + if (yPadding !== 0 || xPadding !== 0) { + wrap.select('.nv-scatterWrap') + .datum(data.filter(function(d) { return !d.disabled })) + .call(scatter); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + if (showXAxis) { + xAxis + .scale(x) + .ticks( xAxis.ticks() && xAxis.ticks().length ? xAxis.ticks() : availableWidth / 100 ) + .tickSize( -availableHeight , 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')') + .call(xAxis); + + } + + if (showYAxis) { + yAxis + .scale(y) + .ticks( yAxis.ticks() && yAxis.ticks().length ? yAxis.ticks() : availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-y.nv-axis') + .call(yAxis); + } + + + if (showDistX) { + distX + .getData(scatter.x()) + .scale(x) + .width(availableWidth) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + gEnter.select('.nv-distWrap').append('g') + .attr('class', 'nv-distributionX'); + g.select('.nv-distributionX') + .attr('transform', 'translate(0,' + y.range()[0] + ')') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distX); + } + + if (showDistY) { + distY + .getData(scatter.y()) + .scale(y) + .width(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + gEnter.select('.nv-distWrap').append('g') + .attr('class', 'nv-distributionY'); + g.select('.nv-distributionY') + .attr('transform', + 'translate(' + (rightAlignYAxis ? availableWidth : -distY.size() ) + ',0)') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distY); + } + + //------------------------------------------------------------ + + + + + if (d3.fisheye) { + g.select('.nv-background') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g.select('.nv-background').on('mousemove', updateFisheye); + g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye;}); + scatter.dispatch.on('elementClick.freezeFisheye', function() { + pauseFisheye = !pauseFisheye; + }); + } + + + function updateFisheye() { + if (pauseFisheye) { + g.select('.nv-point-paths').style('pointer-events', 'all'); + return false; + } + + g.select('.nv-point-paths').style('pointer-events', 'none' ); + + var mouse = d3.mouse(this); + x.distortion(fisheye).focus(mouse[0]); + y.distortion(fisheye).focus(mouse[1]); + + g.select('.nv-scatterWrap') + .call(scatter); + + if (showXAxis) + g.select('.nv-x.nv-axis').call(xAxis); + + if (showYAxis) + g.select('.nv-y.nv-axis').call(yAxis); + + g.select('.nv-distributionX') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distX); + g.select('.nv-distributionY') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distY); + } + + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + controls.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + fisheye = d.disabled ? 0 : 2.5; + g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all'); + g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' ); + + if (d.disabled) { + x.distortion(fisheye).focus(0); + y.distortion(fisheye).focus(0); + + g.select('.nv-scatterWrap').call(scatter); + g.select('.nv-x.nv-axis').call(xAxis); + g.select('.nv-y.nv-axis').call(yAxis); + } else { + pauseFisheye = false; + } + + chart.update(); + }); + + legend.dispatch.on('stateChange', function(newState) { + state.disabled = newState.disabled; + dispatch.stateChange(state); + chart.update(); + }); + + scatter.dispatch.on('elementMouseover.tooltip', function(e) { + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex) + .attr('y1', function(d,i) { return e.pos[1] - availableHeight;}); + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex) + .attr('x2', e.pos[0] + distX.size()); + + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + chart.update(); + }); + + //============================================================ + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + scatter.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex) + .attr('y1', 0); + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex) + .attr('x2', distY.size()); + }); + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.scatter = scatter; + chart.legend = legend; + chart.controls = controls; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + chart.distX = distX; + chart.distY = distY; + + d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi'); + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + distX.color(color); + distY.color(color); + return chart; + }; + + chart.showDistX = function(_) { + if (!arguments.length) return showDistX; + showDistX = _; + return chart; + }; + + chart.showDistY = function(_) { + if (!arguments.length) return showDistY; + showDistY = _; + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + + chart.fisheye = function(_) { + if (!arguments.length) return fisheye; + fisheye = _; + return chart; + }; + + chart.xPadding = function(_) { + if (!arguments.length) return xPadding; + xPadding = _; + return chart; + }; + + chart.yPadding = function(_) { + if (!arguments.length) return yPadding; + yPadding = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.tooltipXContent = function(_) { + if (!arguments.length) return tooltipX; + tooltipX = _; + return chart; + }; + + chart.tooltipYContent = function(_) { + if (!arguments.length) return tooltipY; + tooltipY = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatterPlusLineChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatterPlusLineChart.js new file mode 100644 index 0000000..23c8785 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/scatterPlusLineChart.js @@ -0,0 +1,620 @@ + +nv.models.scatterPlusLineChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var scatter = nv.models.scatter() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + , controls = nv.models.legend() + , distX = nv.models.distribution() + , distY = nv.models.distribution() + ; + + var margin = {top: 30, right: 20, bottom: 50, left: 75} + , width = null + , height = null + , color = nv.utils.defaultColor() + , x = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.xScale() + , y = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.yScale() + , showDistX = false + , showDistY = false + , showLegend = true + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , showControls = !!d3.fisheye + , fisheye = 0 + , pauseFisheye = false + , tooltips = true + , tooltipX = function(key, x, y) { return '' + x + '' } + , tooltipY = function(key, x, y) { return '' + y + '' } + , tooltip = function(key, x, y, date) { return '

      ' + key + '

      ' + + '

      ' + date + '

      ' } + , state = {} + , defaultState = null + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , noData = "No Data Available." + , transitionDuration = 250 + ; + + scatter + .xScale(x) + .yScale(y) + ; + xAxis + .orient('bottom') + .tickPadding(10) + ; + yAxis + .orient((rightAlignYAxis) ? 'right' : 'left') + .tickPadding(10) + ; + distX + .axis('x') + ; + distY + .axis('y') + ; + + controls.updateState(false); + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0; + + var showTooltip = function(e, offsetElement) { + //TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?) + + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + leftX = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + topX = y.range()[0] + margin.top + ( offsetElement.offsetTop || 0), + leftY = x.range()[0] + margin.left + ( offsetElement.offsetLeft || 0 ), + topY = e.pos[1] + ( offsetElement.offsetTop || 0), + xVal = xAxis.tickFormat()(scatter.x()(e.point, e.pointIndex)), + yVal = yAxis.tickFormat()(scatter.y()(e.point, e.pointIndex)); + + if( tooltipX != null ) + nv.tooltip.show([leftX, topX], tooltipX(e.series.key, xVal, yVal, e, chart), 'n', 1, offsetElement, 'x-nvtooltip'); + if( tooltipY != null ) + nv.tooltip.show([leftY, topY], tooltipY(e.series.key, xVal, yVal, e, chart), 'e', 1, offsetElement, 'y-nvtooltip'); + if( tooltip != null ) + nv.tooltip.show([left, top], tooltip(e.series.key, xVal, yVal, e.point.tooltip, e, chart), e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + var controlsData = [ + { key: 'Magnify', disabled: true } + ]; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().duration(transitionDuration).call(chart); }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display noData message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = scatter.xScale(); + y = scatter.yScale(); + + x0 = x0 || x; + y0 = y0 || y; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id()); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + // background for pointer events + gEnter.append('rect').attr('class', 'nvd3 nv-background').style("pointer-events","none"); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-scatterWrap'); + gEnter.append('g').attr('class', 'nv-regressionLinesWrap'); + gEnter.append('g').attr('class', 'nv-distWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width( availableWidth / 2 ); + + wrap.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + wrap.select('.nv-legendWrap') + .attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + controls.width(180).color(['#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Main Chart Component(s) + + scatter + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })) + + wrap.select('.nv-scatterWrap') + .datum(data.filter(function(d) { return !d.disabled })) + .call(scatter); + + wrap.select('.nv-regressionLinesWrap') + .attr('clip-path', 'url(#nv-edge-clip-' + scatter.id() + ')'); + + var regWrap = wrap.select('.nv-regressionLinesWrap').selectAll('.nv-regLines') + .data(function(d) {return d }); + + regWrap.enter().append('g').attr('class', 'nv-regLines'); + + var regLine = regWrap.selectAll('.nv-regLine').data(function(d){return [d]}); + var regLineEnter = regLine.enter() + .append('line').attr('class', 'nv-regLine') + .style('stroke-opacity', 0); + + regLine + .transition() + .attr('x1', x.range()[0]) + .attr('x2', x.range()[1]) + .attr('y1', function(d,i) {return y(x.domain()[0] * d.slope + d.intercept) }) + .attr('y2', function(d,i) { return y(x.domain()[1] * d.slope + d.intercept) }) + .style('stroke', function(d,i,j) { return color(d,j) }) + .style('stroke-opacity', function(d,i) { + return (d.disabled || typeof d.slope === 'undefined' || typeof d.intercept === 'undefined') ? 0 : 1 + }); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + if (showXAxis) { + xAxis + .scale(x) + .ticks( xAxis.ticks() ? xAxis.ticks() : availableWidth / 100 ) + .tickSize( -availableHeight , 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')') + .call(xAxis); + } + + if (showYAxis) { + yAxis + .scale(y) + .ticks( yAxis.ticks() ? yAxis.ticks() : availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-y.nv-axis') + .call(yAxis); + } + + + if (showDistX) { + distX + .getData(scatter.x()) + .scale(x) + .width(availableWidth) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + gEnter.select('.nv-distWrap').append('g') + .attr('class', 'nv-distributionX'); + g.select('.nv-distributionX') + .attr('transform', 'translate(0,' + y.range()[0] + ')') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distX); + } + + if (showDistY) { + distY + .getData(scatter.y()) + .scale(y) + .width(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + gEnter.select('.nv-distWrap').append('g') + .attr('class', 'nv-distributionY'); + g.select('.nv-distributionY') + .attr('transform', 'translate(' + (rightAlignYAxis ? availableWidth : -distY.size() ) + ',0)') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distY); + } + + //------------------------------------------------------------ + + + + + if (d3.fisheye) { + g.select('.nv-background') + .attr('width', availableWidth) + .attr('height', availableHeight) + ; + + g.select('.nv-background').on('mousemove', updateFisheye); + g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye;}); + scatter.dispatch.on('elementClick.freezeFisheye', function() { + pauseFisheye = !pauseFisheye; + }); + } + + + function updateFisheye() { + if (pauseFisheye) { + g.select('.nv-point-paths').style('pointer-events', 'all'); + return false; + } + + g.select('.nv-point-paths').style('pointer-events', 'none' ); + + var mouse = d3.mouse(this); + x.distortion(fisheye).focus(mouse[0]); + y.distortion(fisheye).focus(mouse[1]); + + g.select('.nv-scatterWrap') + .datum(data.filter(function(d) { return !d.disabled })) + .call(scatter); + + if (showXAxis) + g.select('.nv-x.nv-axis').call(xAxis); + + if (showYAxis) + g.select('.nv-y.nv-axis').call(yAxis); + + g.select('.nv-distributionX') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distX); + g.select('.nv-distributionY') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distY); + } + + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + controls.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + fisheye = d.disabled ? 0 : 2.5; + g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all'); + g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' ); + + if (d.disabled) { + x.distortion(fisheye).focus(0); + y.distortion(fisheye).focus(0); + + g.select('.nv-scatterWrap').call(scatter); + g.select('.nv-x.nv-axis').call(xAxis); + g.select('.nv-y.nv-axis').call(yAxis); + } else { + pauseFisheye = false; + } + + chart.update(); + }); + + legend.dispatch.on('stateChange', function(newState) { + state = newState; + dispatch.stateChange(state); + chart.update(); + }); + + + scatter.dispatch.on('elementMouseover.tooltip', function(e) { + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex) + .attr('y1', e.pos[1] - availableHeight); + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex) + .attr('x2', e.pos[0] + distX.size()); + + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + chart.update(); + }); + + //============================================================ + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + scatter.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex) + .attr('y1', 0); + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex) + .attr('x2', distY.size()); + }); + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.scatter = scatter; + chart.legend = legend; + chart.controls = controls; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + chart.distX = distX; + chart.distY = distY; + + d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + distX.color(color); + distY.color(color); + return chart; + }; + + chart.showDistX = function(_) { + if (!arguments.length) return showDistX; + showDistX = _; + return chart; + }; + + chart.showDistY = function(_) { + if (!arguments.length) return showDistY; + showDistY = _; + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + chart.fisheye = function(_) { + if (!arguments.length) return fisheye; + fisheye = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.tooltipXContent = function(_) { + if (!arguments.length) return tooltipX; + tooltipX = _; + return chart; + }; + + chart.tooltipYContent = function(_) { + if (!arguments.length) return tooltipY; + tooltipY = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/sparkline.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/sparkline.js new file mode 100644 index 0000000..e4c2e87 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/sparkline.js @@ -0,0 +1,194 @@ + +nv.models.sparkline = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 2, right: 0, bottom: 2, left: 0} + , width = 400 + , height = 32 + , animate = true + , x = d3.scale.linear() + , y = d3.scale.linear() + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , color = nv.utils.getColor(['#000']) + , xDomain + , yDomain + , xRange + , yRange + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup Scales + + x .domain(xDomain || d3.extent(data, getX )) + .range(xRange || [0, availableWidth]); + + y .domain(yDomain || d3.extent(data, getY )) + .range(yRange || [availableHeight, 0]); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-sparkline').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparkline'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')') + + //------------------------------------------------------------ + + + var paths = wrap.selectAll('path') + .data(function(d) { return [d] }); + paths.enter().append('path'); + paths.exit().remove(); + paths + .style('stroke', function(d,i) { return d.color || color(d, i) }) + .attr('d', d3.svg.line() + .x(function(d,i) { return x(getX(d,i)) }) + .y(function(d,i) { return y(getY(d,i)) }) + ); + + + // TODO: Add CURRENT data point (Need Min, Mac, Current / Most recent) + var points = wrap.selectAll('circle.nv-point') + .data(function(data) { + var yValues = data.map(function(d, i) { return getY(d,i); }); + function pointIndex(index) { + if (index != -1) { + var result = data[index]; + result.pointIndex = index; + return result; + } else { + return null; + } + } + var maxPoint = pointIndex(yValues.lastIndexOf(y.domain()[1])), + minPoint = pointIndex(yValues.indexOf(y.domain()[0])), + currentPoint = pointIndex(yValues.length - 1); + return [minPoint, maxPoint, currentPoint].filter(function (d) {return d != null;}); + }); + points.enter().append('circle'); + points.exit().remove(); + points + .attr('cx', function(d,i) { return x(getX(d,d.pointIndex)) }) + .attr('cy', function(d,i) { return y(getY(d,d.pointIndex)) }) + .attr('r', 2) + .attr('class', function(d,i) { + return getX(d, d.pointIndex) == x.domain()[1] ? 'nv-point nv-currentValue' : + getY(d, d.pointIndex) == y.domain()[0] ? 'nv-point nv-minValue' : 'nv-point nv-maxValue' + }); + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = d3.functor(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = d3.functor(_); + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.xRange = function(_) { + if (!arguments.length) return xRange; + xRange = _; + return chart; + }; + + chart.yRange = function(_) { + if (!arguments.length) return yRange; + yRange = _; + return chart; + }; + + chart.animate = function(_) { + if (!arguments.length) return animate; + animate = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/sparklinePlus.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/sparklinePlus.js new file mode 100644 index 0000000..1535f8a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/sparklinePlus.js @@ -0,0 +1,295 @@ + +nv.models.sparklinePlus = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var sparkline = nv.models.sparkline(); + + var margin = {top: 15, right: 100, bottom: 10, left: 50} + , width = null + , height = null + , x + , y + , index = [] + , paused = false + , xTickFormat = d3.format(',r') + , yTickFormat = d3.format(',.2f') + , showValue = true + , alignValue = true + , rightAlignValue = false + , noData = "No Data Available." + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this); + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + + + chart.update = function() { chart(selection) }; + chart.container = this; + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + var currentValue = sparkline.y()(data[data.length-1], data.length-1); + + //------------------------------------------------------------ + + + + //------------------------------------------------------------ + // Setup Scales + + x = sparkline.xScale(); + y = sparkline.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-sparklineplus').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparklineplus'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-sparklineWrap'); + gEnter.append('g').attr('class', 'nv-valueWrap'); + gEnter.append('g').attr('class', 'nv-hoverArea'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Main Chart Component(s) + + var sparklineWrap = g.select('.nv-sparklineWrap'); + + sparkline + .width(availableWidth) + .height(availableHeight); + + sparklineWrap + .call(sparkline); + + //------------------------------------------------------------ + + + var valueWrap = g.select('.nv-valueWrap'); + + var value = valueWrap.selectAll('.nv-currentValue') + .data([currentValue]); + + value.enter().append('text').attr('class', 'nv-currentValue') + .attr('dx', rightAlignValue ? -8 : 8) + .attr('dy', '.9em') + .style('text-anchor', rightAlignValue ? 'end' : 'start'); + + value + .attr('x', availableWidth + (rightAlignValue ? margin.right : 0)) + .attr('y', alignValue ? function(d) { return y(d) } : 0) + .style('fill', sparkline.color()(data[data.length-1], data.length-1)) + .text(yTickFormat(currentValue)); + + + + gEnter.select('.nv-hoverArea').append('rect') + .on('mousemove', sparklineHover) + .on('click', function() { paused = !paused }) + .on('mouseout', function() { index = []; updateValueLine(); }); + //.on('mouseout', function() { index = null; updateValueLine(); }); + + g.select('.nv-hoverArea rect') + .attr('transform', function(d) { return 'translate(' + -margin.left + ',' + -margin.top + ')' }) + .attr('width', availableWidth + margin.left + margin.right) + .attr('height', availableHeight + margin.top); + + + + function updateValueLine() { //index is currently global (within the chart), may or may not keep it that way + if (paused) return; + + var hoverValue = g.selectAll('.nv-hoverValue').data(index) + + var hoverEnter = hoverValue.enter() + .append('g').attr('class', 'nv-hoverValue') + .style('stroke-opacity', 0) + .style('fill-opacity', 0); + + hoverValue.exit() + .transition().duration(250) + .style('stroke-opacity', 0) + .style('fill-opacity', 0) + .remove(); + + hoverValue + .attr('transform', function(d) { return 'translate(' + x(sparkline.x()(data[d],d)) + ',0)' }) + .transition().duration(250) + .style('stroke-opacity', 1) + .style('fill-opacity', 1); + + if (!index.length) return; + + hoverEnter.append('line') + .attr('x1', 0) + .attr('y1', -margin.top) + .attr('x2', 0) + .attr('y2', availableHeight); + + + hoverEnter.append('text').attr('class', 'nv-xValue') + .attr('x', -6) + .attr('y', -margin.top) + .attr('text-anchor', 'end') + .attr('dy', '.9em') + + + g.select('.nv-hoverValue .nv-xValue') + .text(xTickFormat(sparkline.x()(data[index[0]], index[0]))); + + hoverEnter.append('text').attr('class', 'nv-yValue') + .attr('x', 6) + .attr('y', -margin.top) + .attr('text-anchor', 'start') + .attr('dy', '.9em') + + g.select('.nv-hoverValue .nv-yValue') + .text(yTickFormat(sparkline.y()(data[index[0]], index[0]))); + + } + + + function sparklineHover() { + if (paused) return; + + var pos = d3.mouse(this)[0] - margin.left; + + function getClosestIndex(data, x) { + var distance = Math.abs(sparkline.x()(data[0], 0) - x); + var closestIndex = 0; + for (var i = 0; i < data.length; i++){ + if (Math.abs(sparkline.x()(data[i], i) - x) < distance) { + distance = Math.abs(sparkline.x()(data[i], i) - x); + closestIndex = i; + } + } + return closestIndex; + } + + index = [getClosestIndex(data, Math.round(x.invert(pos)))]; + + updateValueLine(); + } + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.sparkline = sparkline; + + d3.rebind(chart, sparkline, 'x', 'y', 'xScale', 'yScale', 'color'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xTickFormat = function(_) { + if (!arguments.length) return xTickFormat; + xTickFormat = _; + return chart; + }; + + chart.yTickFormat = function(_) { + if (!arguments.length) return yTickFormat; + yTickFormat = _; + return chart; + }; + + chart.showValue = function(_) { + if (!arguments.length) return showValue; + showValue = _; + return chart; + }; + + chart.alignValue = function(_) { + if (!arguments.length) return alignValue; + alignValue = _; + return chart; + }; + + chart.rightAlignValue = function(_) { + if (!arguments.length) return rightAlignValue; + rightAlignValue = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/stackedArea.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/stackedArea.js new file mode 100644 index 0000000..eefeb8f --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/stackedArea.js @@ -0,0 +1,368 @@ + +nv.models.stackedArea = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , color = nv.utils.defaultColor() // a function that computes the color + , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't selet one + , getX = function(d) { return d.x } // accessor to get the x value from a data point + , getY = function(d) { return d.y } // accessor to get the y value from a data point + , style = 'stack' + , offset = 'zero' + , order = 'default' + , interpolate = 'linear' // controls the line interpolation + , clipEdge = false // if true, masks lines within x and y scale + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , scatter = nv.models.scatter() + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'areaClick', 'areaMouseover', 'areaMouseout') + ; + + scatter + .size(2.2) // default size + .sizeDomain([2.2,2.2]) // all the same size by default + ; + + /************************************ + * offset: + * 'wiggle' (stream) + * 'zero' (stacked) + * 'expand' (normalize to 100%) + * 'silhouette' (simple centered) + * + * order: + * 'inside-out' (stream) + * 'default' (input order) + ************************************/ + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + //------------------------------------------------------------ + // Setup Scales + + x = scatter.xScale(); + y = scatter.yScale(); + + //------------------------------------------------------------ + + var dataRaw = data; + // Injecting point index into each point because d3.layout.stack().out does not give index + data.forEach(function(aseries, i) { + aseries.seriesIndex = i; + aseries.values = aseries.values.map(function(d, j) { + d.index = j; + d.seriesIndex = i; + return d; + }); + }); + + var dataFiltered = data.filter(function(series) { + return !series.disabled; + }); + + data = d3.layout.stack() + .order(order) + .offset(offset) + .values(function(d) { return d.values }) //TODO: make values customizeable in EVERY model in this fashion + .x(getX) + .y(getY) + .out(function(d, y0, y) { + var yHeight = (getY(d) === 0) ? 0 : y; + d.display = { + y: yHeight, + y0: y0 + }; + }) + (dataFiltered); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-stackedarea').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedarea'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-areaWrap'); + gEnter.append('g').attr('class', 'nv-scatterWrap'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + scatter + .width(availableWidth) + .height(availableHeight) + .x(getX) + .y(function(d) { return d.display.y + d.display.y0 }) + .forceY([0]) + .color(data.map(function(d,i) { + return d.color || color(d, d.seriesIndex); + })); + + + var scatterWrap = g.select('.nv-scatterWrap') + .datum(data); + + scatterWrap.call(scatter); + + defsEnter.append('clipPath') + .attr('id', 'nv-edge-clip-' + id) + .append('rect'); + + wrap.select('#nv-edge-clip-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); + + var area = d3.svg.area() + .x(function(d,i) { return x(getX(d,i)) }) + .y0(function(d) { + return y(d.display.y0) + }) + .y1(function(d) { + return y(d.display.y + d.display.y0) + }) + .interpolate(interpolate); + + var zeroArea = d3.svg.area() + .x(function(d,i) { return x(getX(d,i)) }) + .y0(function(d) { return y(d.display.y0) }) + .y1(function(d) { return y(d.display.y0) }); + + + var path = g.select('.nv-areaWrap').selectAll('path.nv-area') + .data(function(d) { return d }); + + path.enter().append('path').attr('class', function(d,i) { return 'nv-area nv-area-' + i }) + .attr('d', function(d,i){ + return zeroArea(d.values, d.seriesIndex); + }) + .on('mouseover', function(d,i) { + d3.select(this).classed('hover', true); + dispatch.areaMouseover({ + point: d, + series: d.key, + pos: [d3.event.pageX, d3.event.pageY], + seriesIndex: i + }); + }) + .on('mouseout', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.areaMouseout({ + point: d, + series: d.key, + pos: [d3.event.pageX, d3.event.pageY], + seriesIndex: i + }); + }) + .on('click', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.areaClick({ + point: d, + series: d.key, + pos: [d3.event.pageX, d3.event.pageY], + seriesIndex: i + }); + }) + path.exit().transition() + .attr('d', function(d,i) { return zeroArea(d.values,i) }) + .remove(); + path + .style('fill', function(d,i){ + return d.color || color(d, d.seriesIndex) + }) + .style('stroke', function(d,i){ return d.color || color(d, d.seriesIndex) }); + path.transition() + .attr('d', function(d,i) { + return area(d.values,i) + }); + + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + scatter.dispatch.on('elementMouseover.area', function(e) { + g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', true); + }); + scatter.dispatch.on('elementMouseout.area', function(e) { + g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', false); + }); + + //============================================================ + //Special offset functions + chart.d3_stackedOffset_stackPercent = function(stackData) { + var n = stackData.length, //How many series + m = stackData[0].length, //how many points per series + k = 1 / n, + i, + j, + o, + y0 = []; + + for (j = 0; j < m; ++j) { //Looping through all points + for (i = 0, o = 0; i < dataRaw.length; i++) //looping through series' + o += getY(dataRaw[i].values[j]) //total value of all points at a certian point in time. + + if (o) for (i = 0; i < n; i++) + stackData[i][j][1] /= o; + else + for (i = 0; i < n; i++) + stackData[i][j][1] = k; + } + for (j = 0; j < m; ++j) y0[j] = 0; + return y0; + }; + + }); + + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + scatter.dispatch.on('elementClick.area', function(e) { + dispatch.areaClick(e); + }) + scatter.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top], + dispatch.tooltipShow(e); + }); + scatter.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + //============================================================ + + //============================================================ + // Global getters and setters + //------------------------------------------------------------ + + chart.dispatch = dispatch; + chart.scatter = scatter; + + d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', + 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'useVoronoi','clipRadius','highlightPoint','clearHighlights'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = d3.functor(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = d3.functor(_); + return chart; + } + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.offset = function(_) { + if (!arguments.length) return offset; + offset = _; + return chart; + }; + + chart.order = function(_) { + if (!arguments.length) return order; + order = _; + return chart; + }; + + //shortcut for offset + order + chart.style = function(_) { + if (!arguments.length) return style; + style = _; + + switch (style) { + case 'stack': + chart.offset('zero'); + chart.order('default'); + break; + case 'stream': + chart.offset('wiggle'); + chart.order('inside-out'); + break; + case 'stream-center': + chart.offset('silhouette'); + chart.order('inside-out'); + break; + case 'expand': + chart.offset('expand'); + chart.order('default'); + break; + case 'stack_percent': + chart.offset(chart.d3_stackedOffset_stackPercent); + chart.order('default'); + break; + } + + return chart; + }; + + chart.interpolate = function(_) { + if (!arguments.length) return interpolate; + interpolate = _; + return chart; + }; + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/stackedAreaChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/stackedAreaChart.js new file mode 100644 index 0000000..a036b8b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/models/stackedAreaChart.js @@ -0,0 +1,629 @@ + +nv.models.stackedAreaChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var stacked = nv.models.stackedArea() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + , controls = nv.models.legend() + , interactiveLayer = nv.interactiveGuideline() + ; + + var margin = {top: 30, right: 25, bottom: 50, left: 60} + , width = null + , height = null + , color = nv.utils.defaultColor() // a function that takes in d, i and returns color + , showControls = true + , showLegend = true + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , useInteractiveGuideline = false + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' on ' + x + '

      ' + } + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , yAxisTickFormat = d3.format(',.2f') + , state = { style: stacked.style() } + , defaultState = null + , noData = 'No Data Available.' + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , controlWidth = 250 + , cData = ['Stacked','Stream','Expanded'] + , controlLabels = {} + , transitionDuration = 250 + ; + + xAxis + .orient('bottom') + .tickPadding(7) + ; + yAxis + .orient((rightAlignYAxis) ? 'right' : 'left') + ; + + controls.updateState(false); + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(stacked.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(stacked.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().duration(transitionDuration).call(chart); }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = stacked.xScale(); + y = stacked.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-stackedAreaChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedAreaChart').append('g'); + var g = wrap.select('g'); + + gEnter.append("rect").style("opacity",0); + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-stackedWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + gEnter.append('g').attr('class', 'nv-interactive'); + + g.select("rect").attr("width",availableWidth).attr("height",availableHeight); + //------------------------------------------------------------ + // Legend + + if (showLegend) { + var legendWidth = (showControls) ? availableWidth - controlWidth : availableWidth; + legend + .width(legendWidth); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(' + (availableWidth-legendWidth) + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + var controlsData = [ + { + key: controlLabels.stacked || 'Stacked', + metaKey: 'Stacked', + disabled: stacked.style() != 'stack', + style: 'stack' + }, + { + key: controlLabels.stream || 'Stream', + metaKey: 'Stream', + disabled: stacked.style() != 'stream', + style: 'stream' + }, + { + key: controlLabels.expanded || 'Expanded', + metaKey: 'Expanded', + disabled: stacked.style() != 'expand', + style: 'expand' + }, + { + key: controlLabels.stack_percent || 'Stack %', + metaKey: 'Stack_Percent', + disabled: stacked.style() != 'stack_percent', + style: 'stack_percent' + } + ]; + + controlWidth = (cData.length/3) * 260; + + controlsData = controlsData.filter(function(d) { + return cData.indexOf(d.metaKey) !== -1; + }) + + controls + .width( controlWidth ) + .color(['#444', '#444', '#444']); + + g.select('.nv-controlsWrap') + .datum(controlsData) + .call(controls); + + + if ( margin.top != Math.max(controls.height(), legend.height()) ) { + margin.top = Math.max(controls.height(), legend.height()); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + + g.select('.nv-controlsWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + //------------------------------------------------------------ + // Main Chart Component(s) + + //------------------------------------------------------------ + //Set up interactive layer + if (useInteractiveGuideline) { + interactiveLayer + .width(availableWidth) + .height(availableHeight) + .margin({left: margin.left, top: margin.top}) + .svgContainer(container) + .xScale(x); + wrap.select(".nv-interactive").call(interactiveLayer); + } + + stacked + .width(availableWidth) + .height(availableHeight) + + var stackedWrap = g.select('.nv-stackedWrap') + .datum(data); + + stackedWrap.transition().call(stacked); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + if (showXAxis) { + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize( -availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + availableHeight + ')'); + + g.select('.nv-x.nv-axis') + .transition().duration(0) + .call(xAxis); + } + + if (showYAxis) { + yAxis + .scale(y) + .ticks(stacked.offset() == 'wiggle' ? 0 : availableHeight / 36) + .tickSize(-availableWidth, 0) + .setTickFormat( (stacked.style() == 'expand' || stacked.style() == 'stack_percent') + ? d3.format('%') : yAxisTickFormat); + + g.select('.nv-y.nv-axis') + .transition().duration(0) + .call(yAxis); + } + + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + stacked.dispatch.on('areaClick.toggle', function(e) { + if (data.filter(function(d) { return !d.disabled }).length === 1) + data.forEach(function(d) { + d.disabled = false; + }); + else + data.forEach(function(d,i) { + d.disabled = (i != e.seriesIndex); + }); + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + + chart.update(); + }); + + legend.dispatch.on('stateChange', function(newState) { + state.disabled = newState.disabled; + dispatch.stateChange(state); + chart.update(); + }); + + controls.dispatch.on('legendClick', function(d,i) { + if (!d.disabled) return; + + controlsData = controlsData.map(function(s) { + s.disabled = true; + return s; + }); + d.disabled = false; + + stacked.style(d.style); + + + state.style = stacked.style(); + dispatch.stateChange(state); + + chart.update(); + }); + + + interactiveLayer.dispatch.on('elementMousemove', function(e) { + stacked.clearHighlights(); + var singlePoint, pointIndex, pointXLocation, allData = []; + data + .filter(function(series, i) { + series.seriesIndex = i; + return !series.disabled; + }) + .forEach(function(series,i) { + pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x()); + stacked.highlightPoint(i, pointIndex, true); + var point = series.values[pointIndex]; + if (typeof point === 'undefined') return; + if (typeof singlePoint === 'undefined') singlePoint = point; + if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex)); + + //If we are in 'expand' mode, use the stacked percent value instead of raw value. + var tooltipValue = (stacked.style() == 'expand') ? point.display.y : chart.y()(point,pointIndex); + allData.push({ + key: series.key, + value: tooltipValue, + color: color(series,series.seriesIndex), + stackedValue: point.display + }); + }); + + allData.reverse(); + + //Highlight the tooltip entry based on which stack the mouse is closest to. + if (allData.length > 2) { + var yValue = chart.yScale().invert(e.mouseY); + var yDistMax = Infinity, indexToHighlight = null; + allData.forEach(function(series,i) { + if ( yValue >= series.stackedValue.y0 && yValue <= (series.stackedValue.y0 + series.stackedValue.y)) + { + indexToHighlight = i; + return; + } + }); + if (indexToHighlight != null) + allData[indexToHighlight].highlight = true; + } + + var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex)); + + //If we are in 'expand' mode, force the format to be a percentage. + var valueFormatter = (stacked.style() == 'expand') ? + function(d,i) {return d3.format(".1%")(d);} : + function(d,i) {return yAxis.tickFormat()(d); }; + interactiveLayer.tooltip + .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top}) + .chartContainer(that.parentNode) + .enabled(tooltips) + .valueFormatter(valueFormatter) + .data( + { + value: xValue, + series: allData + } + )(); + + interactiveLayer.renderGuideLine(pointXLocation); + + }); + + interactiveLayer.dispatch.on("elementMouseout",function(e) { + dispatch.tooltipHide(); + stacked.clearHighlights(); + }); + + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + if (typeof e.style !== 'undefined') { + stacked.style(e.style); + } + + chart.update(); + }); + + }); + + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + stacked.dispatch.on('tooltipShow', function(e) { + //disable tooltips when value ~= 0 + //// TODO: consider removing points from voronoi that have 0 value instead of this hack + /* + if (!Math.round(stacked.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range + setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0); + return false; + } + */ + + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top], + dispatch.tooltipShow(e); + }); + + stacked.dispatch.on('tooltipHide', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.stacked = stacked; + chart.legend = legend; + chart.controls = controls; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + chart.interactiveLayer = interactiveLayer; + + d3.rebind(chart, stacked, 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'interactive', 'useVoronoi', 'offset', 'order', 'style', 'clipEdge', 'forceX', 'forceY', 'forceSize', 'interpolate'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + stacked.color(color); + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + chart.useInteractiveGuideline = function(_) { + if(!arguments.length) return useInteractiveGuideline; + useInteractiveGuideline = _; + if (_ === true) { + chart.interactive(false); + chart.useVoronoi(false); + } + return chart; + }; + + chart.tooltip = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + chart.controlsData = function(_) { + if (!arguments.length) return cData; + cData = _; + return chart; + }; + + chart.controlLabels = function(_) { + if (!arguments.length) return controlLabels; + if (typeof _ !== 'object') return controlLabels; + controlLabels = _; + return chart; + }; + + yAxis.setTickFormat = yAxis.tickFormat; + + yAxis.tickFormat = function(_) { + if (!arguments.length) return yAxisTickFormat; + yAxisTickFormat = _; + return yAxis; + }; + + + //============================================================ + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/nv.d3.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/nv.d3.js new file mode 100644 index 0000000..7858666 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/nv.d3.js @@ -0,0 +1,13097 @@ +(function(){ + +var nv = window.nv || {}; + +nv.version = '0.0.1a'; +nv.dev = true //set false when in production + +window.nv = nv; + +nv.tooltip = {}; // For the tooltip system +nv.utils = {}; // Utility subsystem +nv.models = {}; //stores all the possible models/components +nv.charts = {}; //stores all the ready to use charts +nv.graphs = []; //stores all the graphs currently on the page +nv.logs = {}; //stores some statistics and potential error messages + +nv.dispatch = d3.dispatch('render_start', 'render_end'); + +// ************************************************************************* +// Development render timers - disabled if dev = false + +if (nv.dev) { + nv.dispatch.on('render_start', function(e) { + nv.logs.startTime = +new Date(); + }); + + nv.dispatch.on('render_end', function(e) { + nv.logs.endTime = +new Date(); + nv.logs.totalTime = nv.logs.endTime - nv.logs.startTime; + nv.log('total', nv.logs.totalTime); // used for development, to keep track of graph generation times + }); +} + +// ******************************************** +// Public Core NV functions + +// Logs all arguments, and returns the last so you can test things in place +nv.log = function() { + if (nv.dev && console.log && console.log.apply) + console.log.apply(console, arguments) + else if (nv.dev && console.log && Function.prototype.bind) { + var log = Function.prototype.bind.call(console.log, console); + log.apply(console, arguments); + } + return arguments[arguments.length - 1]; +}; + + +nv.render = function render(step) { + step = step || 1; // number of graphs to generate in each timeout loop + + nv.render.active = true; + nv.dispatch.render_start(); + + setTimeout(function() { + var chart, graph; + + for (var i = 0; i < step && (graph = nv.render.queue[i]); i++) { + chart = graph.generate(); + if (typeof graph.callback == typeof(Function)) graph.callback(chart); + nv.graphs.push(chart); + } + + nv.render.queue.splice(0, i); + + if (nv.render.queue.length) setTimeout(arguments.callee, 0); + else { nv.render.active = false; nv.dispatch.render_end(); } + }, 0); +}; + +nv.render.active = false; +nv.render.queue = []; + +nv.addGraph = function(obj) { + if (typeof arguments[0] === typeof(Function)) + obj = {generate: arguments[0], callback: arguments[1]}; + + nv.render.queue.push(obj); + + if (!nv.render.active) nv.render(); +}; + +nv.identity = function(d) { return d; }; + +nv.strip = function(s) { return s.replace(/(\s|&)/g,''); }; + +function daysInMonth(month,year) { + return (new Date(year, month+1, 0)).getDate(); +} + +function d3_time_range(floor, step, number) { + return function(t0, t1, dt) { + var time = floor(t0), times = []; + if (time < t0) step(time); + if (dt > 1) { + while (time < t1) { + var date = new Date(+time); + if ((number(date) % dt === 0)) times.push(date); + step(time); + } + } else { + while (time < t1) { times.push(new Date(+time)); step(time); } + } + return times; + }; +} + +d3.time.monthEnd = function(date) { + return new Date(date.getFullYear(), date.getMonth(), 0); +}; + +d3.time.monthEnds = d3_time_range(d3.time.monthEnd, function(date) { + date.setUTCDate(date.getUTCDate() + 1); + date.setDate(daysInMonth(date.getMonth() + 1, date.getFullYear())); + }, function(date) { + return date.getMonth(); + } +); + + +/***** + * A no-frills tooltip implementation. + *****/ + + +(function() { + + var nvtooltip = window.nv.tooltip = {}; + + nvtooltip.show = function(pos, content, gravity, dist, parentContainer, classes) { + + var container = document.createElement('div'); + container.className = 'nvtooltip ' + (classes ? classes : 'xy-tooltip'); + + gravity = gravity || 's'; + dist = dist || 20; + + var body = parentContainer; + if ( !parentContainer || parentContainer.tagName.match(/g|svg/i)) { + //If the parent element is an SVG element, place tooltip in the element. + body = document.getElementsByTagName('body')[0]; + } + + container.innerHTML = content; + container.style.left = 0; + container.style.top = 0; + container.style.opacity = 0; + + body.appendChild(container); + + var height = parseInt(container.offsetHeight), + width = parseInt(container.offsetWidth), + windowWidth = nv.utils.windowSize().width, + windowHeight = nv.utils.windowSize().height, + scrollTop = window.scrollY, + scrollLeft = window.scrollX, + left, top; + + windowHeight = window.innerWidth >= document.body.scrollWidth ? windowHeight : windowHeight - 16; + windowWidth = window.innerHeight >= document.body.scrollHeight ? windowWidth : windowWidth - 16; + + var tooltipTop = function ( Elem ) { + var offsetTop = top; + do { + if( !isNaN( Elem.offsetTop ) ) { + offsetTop += (Elem.offsetTop); + } + } while( Elem = Elem.offsetParent ); + return offsetTop; + } + + var tooltipLeft = function ( Elem ) { + var offsetLeft = left; + do { + if( !isNaN( Elem.offsetLeft ) ) { + offsetLeft += (Elem.offsetLeft); + } + } while( Elem = Elem.offsetParent ); + return offsetLeft; + } + + switch (gravity) { + case 'e': + left = pos[0] - width - dist; + top = pos[1] - (height / 2); + var tLeft = tooltipLeft(container); + var tTop = tooltipTop(container); + if (tLeft < scrollLeft) left = pos[0] + dist > scrollLeft ? pos[0] + dist : scrollLeft - tLeft + left; + if (tTop < scrollTop) top = scrollTop - tTop + top; + if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height; + break; + case 'w': + left = pos[0] + dist; + top = pos[1] - (height / 2); + if (tLeft + width > windowWidth) left = pos[0] - width - dist; + if (tTop < scrollTop) top = scrollTop + 5; + if (tTop + height > scrollTop + windowHeight) top = scrollTop - height - 5; + break; + case 'n': + left = pos[0] - (width / 2) - 5; + top = pos[1] + dist; + var tLeft = tooltipLeft(container); + var tTop = tooltipTop(container); + if (tLeft < scrollLeft) left = scrollLeft + 5; + if (tLeft + width > windowWidth) left = left - width/2 + 5; + if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height; + break; + case 's': + left = pos[0] - (width / 2); + top = pos[1] - height - dist; + var tLeft = tooltipLeft(container); + var tTop = tooltipTop(container); + if (tLeft < scrollLeft) left = scrollLeft + 5; + if (tLeft + width > windowWidth) left = left - width/2 + 5; + if (scrollTop > tTop) top = scrollTop; + break; + } + + + container.style.left = left+'px'; + container.style.top = top+'px'; + container.style.opacity = 1; + container.style.position = 'absolute'; //fix scroll bar issue + container.style.pointerEvents = 'none'; //fix scroll bar issue + + return container; + }; + + nvtooltip.cleanup = function() { + + // Find the tooltips, mark them for removal by this class (so others cleanups won't find it) + var tooltips = document.getElementsByClassName('nvtooltip'); + var purging = []; + while(tooltips.length) { + purging.push(tooltips[0]); + tooltips[0].style.transitionDelay = '0 !important'; + tooltips[0].style.opacity = 0; + tooltips[0].className = 'nvtooltip-pending-removal'; + } + + + setTimeout(function() { + + while (purging.length) { + var removeMe = purging.pop(); + removeMe.parentNode.removeChild(removeMe); + } + }, 500); + }; + + +})(); + +nv.utils.windowSize = function() { + // Sane defaults + var size = {width: 640, height: 480}; + + // Earlier IE uses Doc.body + if (document.body && document.body.offsetWidth) { + size.width = document.body.offsetWidth; + size.height = document.body.offsetHeight; + } + + // IE can use depending on mode it is in + if (document.compatMode=='CSS1Compat' && + document.documentElement && + document.documentElement.offsetWidth ) { + size.width = document.documentElement.offsetWidth; + size.height = document.documentElement.offsetHeight; + } + + // Most recent browsers use + if (window.innerWidth && window.innerHeight) { + size.width = window.innerWidth; + size.height = window.innerHeight; + } + return (size); +}; + + + +// Easy way to bind multiple functions to window.onresize +// TODO: give a way to remove a function after its bound, other than removing all of them +nv.utils.windowResize = function(fun){ + var oldresize = window.onresize; + + window.onresize = function(e) { + if (typeof oldresize == 'function') oldresize(e); + fun(e); + } +} + +// Backwards compatible way to implement more d3-like coloring of graphs. +// If passed an array, wrap it in a function which implements the old default +// behavior +nv.utils.getColor = function(color) { + if (!arguments.length) return nv.utils.defaultColor(); //if you pass in nothing, get default colors back + + if( Object.prototype.toString.call( color ) === '[object Array]' ) + return function(d, i) { return d.color || color[i % color.length]; }; + else + return color; + //can't really help it if someone passes rubbish as color +} + +// Default color chooser uses the index of an object as before. +nv.utils.defaultColor = function() { + var colors = d3.scale.category20().range(); + return function(d, i) { return d.color || colors[i % colors.length] }; +} + + +// Returns a color function that takes the result of 'getKey' for each series and +// looks for a corresponding color from the dictionary, +nv.utils.customTheme = function(dictionary, getKey, defaultColors) { + getKey = getKey || function(series) { return series.key }; // use default series.key if getKey is undefined + defaultColors = defaultColors || d3.scale.category20().range(); //default color function + + var defIndex = defaultColors.length; //current default color (going in reverse) + + return function(series, index) { + var key = getKey(series); + + if (!defIndex) defIndex = defaultColors.length; //used all the default colors, start over + + if (typeof dictionary[key] !== "undefined") + return (typeof dictionary[key] === "function") ? dictionary[key]() : dictionary[key]; + else + return defaultColors[--defIndex]; // no match in dictionary, use default color + } +} + + + +// From the PJAX example on d3js.org, while this is not really directly needed +// it's a very cool method for doing pjax, I may expand upon it a little bit, +// open to suggestions on anything that may be useful +nv.utils.pjax = function(links, content) { + d3.selectAll(links).on("click", function() { + history.pushState(this.href, this.textContent, this.href); + load(this.href); + d3.event.preventDefault(); + }); + + function load(href) { + d3.html(href, function(fragment) { + var target = d3.select(content).node(); + target.parentNode.replaceChild(d3.select(fragment).select(content).node(), target); + nv.utils.pjax(links, content); + }); + } + + d3.select(window).on("popstate", function() { + if (d3.event.state) load(d3.event.state); + }); +} + +/* For situations where we want to approximate the width in pixels for an SVG:text element. +Most common instance is when the element is in a display:none; container. +Forumla is : text.length * font-size * constant_factor +*/ +nv.utils.calcApproxTextWidth = function (svgTextElem) { + if (svgTextElem instanceof d3.selection) { + var fontSize = parseInt(svgTextElem.style("font-size").replace("px","")); + var textLength = svgTextElem.text().length; + + return textLength * fontSize * 0.5; + } + return 0; +}; +nv.models.axis = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var axis = d3.svg.axis() + ; + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 75 //only used for tickLabel currently + , height = 60 //only used for tickLabel currently + , scale = d3.scale.linear() + , axisLabelText = null + , showMaxMin = true //TODO: showMaxMin should be disabled on all ordinal scaled axes + , highlightZero = true + , rotateLabels = 0 + , rotateYLabel = true + , staggerLabels = false + , isOrdinal = false + , ticks = null + , logScale=false + ; + + axis + .scale(scale) + .orient('bottom') + .tickFormat(function(d) { return d }) + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var scale0; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-axis').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-axis'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + //------------------------------------------------------------ + + + if (ticks !== null) + axis.ticks(ticks); + else if (axis.orient() == 'top' || axis.orient() == 'bottom') + axis.ticks(Math.abs(scale.range()[1] - scale.range()[0]) / 100); + + + //TODO: consider calculating width/height based on whether or not label is added, for reference in charts using this component + + + d3.transition(g) + .call(axis); + + scale0 = scale0 || axis.scale(); + + var fmt = axis.tickFormat(); + if (fmt == null) { + fmt = scale0.tickFormat(); + } + + var axisLabel = g.selectAll('text.nv-axislabel') + .data([axisLabelText || null]); + axisLabel.exit().remove(); + switch (axis.orient()) { + case 'top': + axisLabel.enter().append('text').attr('class', 'nv-axislabel'); + var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0])); + axisLabel + .attr('text-anchor', 'middle') + .attr('y', 0) + .attr('x', w/2); + if (showMaxMin) { + var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin') + .data(scale.domain()); + axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text'); + axisMaxMin.exit().remove(); + axisMaxMin + .attr('transform', function(d,i) { + return 'translate(' + scale(d) + ',0)' + }) + .select('text') + .attr('dy', '0em') + .attr('y', -axis.tickPadding()) + .attr('text-anchor', 'middle') + .text(function(d,i) { + var v = fmt(d); + return ('' + v).match('NaN') ? '' : v; + }); + d3.transition(axisMaxMin) + .attr('transform', function(d,i) { + return 'translate(' + scale.range()[i] + ',0)' + }); + } + break; + case 'bottom': + var xLabelMargin = 36; + var maxTextWidth = 30; + var xTicks = g.selectAll('g').select("text"); + if (rotateLabels%360) { + //Calculate the longest xTick width + xTicks.each(function(d,i){ + var width = this.getBBox().width; + if(width > maxTextWidth) maxTextWidth = width; + }); + //Convert to radians before calculating sin. Add 30 to margin for healthy padding. + var sin = Math.abs(Math.sin(rotateLabels*Math.PI/180)); + var xLabelMargin = (sin ? sin*maxTextWidth : maxTextWidth)+30; + //Rotate all xTicks + xTicks + .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' }) + .attr('text-anchor', rotateLabels%360 > 0 ? 'start' : 'end'); + } + axisLabel.enter().append('text').attr('class', 'nv-axislabel'); + var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0])); + axisLabel + .attr('text-anchor', 'middle') + .attr('y', xLabelMargin) + .attr('x', w/2); + if (showMaxMin) { + //if (showMaxMin && !isOrdinal) { + var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin') + //.data(scale.domain()) + .data([scale.domain()[0], scale.domain()[scale.domain().length - 1]]); + axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text'); + axisMaxMin.exit().remove(); + axisMaxMin + .attr('transform', function(d,i) { + return 'translate(' + (scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0)) + ',0)' + }) + .select('text') + .attr('dy', '.71em') + .attr('y', axis.tickPadding()) + .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' }) + .attr('text-anchor', rotateLabels ? (rotateLabels%360 > 0 ? 'start' : 'end') : 'middle') + .text(function(d,i) { + var v = fmt(d); + return ('' + v).match('NaN') ? '' : v; + }); + d3.transition(axisMaxMin) + .attr('transform', function(d,i) { + //return 'translate(' + scale.range()[i] + ',0)' + //return 'translate(' + scale(d) + ',0)' + return 'translate(' + (scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0)) + ',0)' + }); + } + if (staggerLabels) + xTicks + .attr('transform', function(d,i) { return 'translate(0,' + (i % 2 == 0 ? '0' : '12') + ')' }); + + break; + case 'right': + axisLabel.enter().append('text').attr('class', 'nv-axislabel'); + axisLabel + .attr('text-anchor', rotateYLabel ? 'middle' : 'begin') + .attr('transform', rotateYLabel ? 'rotate(90)' : '') + .attr('y', rotateYLabel ? (-Math.max(margin.right,width) + 12) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart + .attr('x', rotateYLabel ? (scale.range()[0] / 2) : axis.tickPadding()); + if (showMaxMin) { + var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin') + .data(scale.domain()); + axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text') + .style('opacity', 0); + axisMaxMin.exit().remove(); + axisMaxMin + .attr('transform', function(d,i) { + return 'translate(0,' + scale(d) + ')' + }) + .select('text') + .attr('dy', '.32em') + .attr('y', 0) + .attr('x', axis.tickPadding()) + .attr('text-anchor', 'start') + .text(function(d,i) { + var v = fmt(d); + return ('' + v).match('NaN') ? '' : v; + }); + d3.transition(axisMaxMin) + .attr('transform', function(d,i) { + return 'translate(0,' + scale.range()[i] + ')' + }) + .select('text') + .style('opacity', 1); + } + break; + case 'left': + /* + //For dynamically placing the label. Can be used with dynamically-sized chart axis margins + var yTicks = g.selectAll('g').select("text"); + yTicks.each(function(d,i){ + var labelPadding = this.getBBox().width + axis.tickPadding() + 16; + if(labelPadding > width) width = labelPadding; + }); + */ + axisLabel.enter().append('text').attr('class', 'nv-axislabel'); + axisLabel + .attr('text-anchor', rotateYLabel ? 'middle' : 'end') + .attr('transform', rotateYLabel ? 'rotate(-90)' : '') + .attr('y', rotateYLabel ? (-Math.max(margin.left,width) + 12) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart + .attr('x', rotateYLabel ? (-scale.range()[0] / 2) : -axis.tickPadding()); + if (showMaxMin) { + var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin') + .data(scale.domain()); + axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text') + .style('opacity', 0); + axisMaxMin.exit().remove(); + axisMaxMin + .attr('transform', function(d,i) { + return 'translate(0,' + scale0(d) + ')' + }) + .select('text') + .attr('dy', '.32em') + .attr('y', 0) + .attr('x', -axis.tickPadding()) + .attr('text-anchor', 'end') + .text(function(d,i) { + var v = fmt(d); + return ('' + v).match('NaN') ? '' : v; + }); + d3.transition(axisMaxMin) + .attr('transform', function(d,i) { + return 'translate(0,' + scale.range()[i] + ')' + }) + .select('text') + .style('opacity', 1); + } + break; + } + axisLabel + .text(function(d) { return d }); + + + if (showMaxMin && (axis.orient() === 'left' || axis.orient() === 'right')) { + //check if max and min overlap other values, if so, hide the values that overlap + g.selectAll('g') // the g's wrapping each tick + .each(function(d,i) { + d3.select(this).select('text').attr('opacity', 1); + if (scale(d) < scale.range()[1] + 10 || scale(d) > scale.range()[0] - 10) { // 10 is assuming text height is 16... if d is 0, leave it! + if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL + d3.select(this).attr('opacity', 0); + + d3.select(this).select('text').attr('opacity', 0); // Don't remove the ZERO line!! + } + }); + + //if Max and Min = 0 only show min, Issue #281 + if (scale.domain()[0] == scale.domain()[1] && scale.domain()[0] == 0) + wrap.selectAll('g.nv-axisMaxMin') + .style('opacity', function(d,i) { return !i ? 1 : 0 }); + + } + + if (showMaxMin && (axis.orient() === 'top' || axis.orient() === 'bottom')) { + var maxMinRange = []; + wrap.selectAll('g.nv-axisMaxMin') + .each(function(d,i) { + try { + if (i) // i== 1, max position + maxMinRange.push(scale(d) - this.getBBox().width - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case) + else // i==0, min position + maxMinRange.push(scale(d) + this.getBBox().width + 4) + }catch (err) { + if (i) // i== 1, max position + maxMinRange.push(scale(d) - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case) + else // i==0, min position + maxMinRange.push(scale(d) + 4) + } + }); + g.selectAll('g') // the g's wrapping each tick + .each(function(d,i) { + if (scale(d) < maxMinRange[0] || scale(d) > maxMinRange[1]) { + if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL + d3.select(this).remove(); + else + d3.select(this).select('text').remove(); // Don't remove the ZERO line!! + } + }); + } + + + //highlight zero line ... Maybe should not be an option and should just be in CSS? + if (highlightZero) + g.selectAll('.tick') + .filter(function(d) { return !parseFloat(Math.round(d.__data__*100000)/1000000) && (d.__data__ !== undefined) }) //this is because sometimes the 0 tick is a very small fraction, TODO: think of cleaner technique + .classed('zero', true); + + //store old scales for use in transitions on update + scale0 = scale.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.axis = axis; + + d3.rebind(chart, axis, 'orient', 'tickValues', 'tickSubdivide', 'tickSize', 'tickPadding', 'tickFormat'); + d3.rebind(chart, scale, 'domain', 'range', 'rangeBand', 'rangeBands'); //these are also accessible by chart.scale(), but added common ones directly for ease of use + + chart.margin = function(_) { + if(!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + } + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.ticks = function(_) { + if (!arguments.length) return ticks; + ticks = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.axisLabel = function(_) { + if (!arguments.length) return axisLabelText; + axisLabelText = _; + return chart; + } + + chart.showMaxMin = function(_) { + if (!arguments.length) return showMaxMin; + showMaxMin = _; + return chart; + } + + chart.highlightZero = function(_) { + if (!arguments.length) return highlightZero; + highlightZero = _; + return chart; + } + + chart.scale = function(_) { + if (!arguments.length) return scale; + scale = _; + axis.scale(scale); + isOrdinal = typeof scale.rangeBands === 'function'; + d3.rebind(chart, scale, 'domain', 'range', 'rangeBand', 'rangeBands'); + return chart; + } + + chart.rotateYLabel = function(_) { + if(!arguments.length) return rotateYLabel; + rotateYLabel = _; + return chart; + } + + chart.rotateLabels = function(_) { + if(!arguments.length) return rotateLabels; + rotateLabels = _; + return chart; + } + + chart.staggerLabels = function(_) { + if (!arguments.length) return staggerLabels; + staggerLabels = _; + return chart; + }; + + + //============================================================ + + + return chart; +} + +// Chart design based on the recommendations of Stephen Few. Implementation +// based on the work of Clint Ivy, Jamie Love, and Jason Davies. +// http://projects.instantcognition.com/protovis/bulletchart/ + +nv.models.bullet = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , orient = 'left' // TODO top & bottom + , reverse = false + , ranges = function(d) { return d.ranges } + , markers = function(d) { return d.markers } + , measures = function(d) { return d.measures } + , forceX = [0] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.) + , width = 380 + , height = 30 + , tickFormat = null + , color = nv.utils.getColor(['#1f77b4']) + , dispatch = d3.dispatch('elementMouseover', 'elementMouseout') + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(d, i) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + var rangez = ranges.call(this, d, i).slice().sort(d3.descending), + markerz = markers.call(this, d, i).slice().sort(d3.descending), + measurez = measures.call(this, d, i).slice().sort(d3.descending); + + + //------------------------------------------------------------ + // Setup Scales + + // Compute the new x-scale. + var x1 = d3.scale.linear() + .domain( d3.extent(d3.merge([forceX, rangez])) ) + .range(reverse ? [availableWidth, 0] : [0, availableWidth]); + + // Retrieve the old x-scale, if this is an update. + var x0 = this.__chart__ || d3.scale.linear() + .domain([0, Infinity]) + .range(x1.range()); + + // Stash the new scale. + this.__chart__ = x1; + + + var rangeMin = d3.min(rangez), //rangez[2] + rangeMax = d3.max(rangez), //rangez[0] + rangeAvg = rangez[1]; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-bullet').data([d]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bullet'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('rect').attr('class', 'nv-range nv-rangeMax'); + gEnter.append('rect').attr('class', 'nv-range nv-rangeAvg'); + gEnter.append('rect').attr('class', 'nv-range nv-rangeMin'); + gEnter.append('rect').attr('class', 'nv-measure'); + gEnter.append('path').attr('class', 'nv-markerTriangle'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0) + w1 = function(d) { return Math.abs(x1(d) - x1(0)) }; + var xp0 = function(d) { return d < 0 ? x0(d) : x0(0) }, + xp1 = function(d) { return d < 0 ? x1(d) : x1(0) }; + + + g.select('rect.nv-rangeMax') + .attr('height', availableHeight) + .attr('width', w1(rangeMax > 0 ? rangeMax : rangeMin)) + .attr('x', xp1(rangeMax > 0 ? rangeMax : rangeMin)) + .datum(rangeMax > 0 ? rangeMax : rangeMin) + /* + .attr('x', rangeMin < 0 ? + rangeMax > 0 ? + x1(rangeMin) + : x1(rangeMax) + : x1(0)) + */ + + g.select('rect.nv-rangeAvg') + .attr('height', availableHeight) + .attr('width', w1(rangeAvg)) + .attr('x', xp1(rangeAvg)) + .datum(rangeAvg) + /* + .attr('width', rangeMax <= 0 ? + x1(rangeMax) - x1(rangeAvg) + : x1(rangeAvg) - x1(rangeMin)) + .attr('x', rangeMax <= 0 ? + x1(rangeAvg) + : x1(rangeMin)) + */ + + g.select('rect.nv-rangeMin') + .attr('height', availableHeight) + .attr('width', w1(rangeMax)) + .attr('x', xp1(rangeMax)) + .attr('width', w1(rangeMax > 0 ? rangeMin : rangeMax)) + .attr('x', xp1(rangeMax > 0 ? rangeMin : rangeMax)) + .datum(rangeMax > 0 ? rangeMin : rangeMax) + /* + .attr('width', rangeMax <= 0 ? + x1(rangeAvg) - x1(rangeMin) + : x1(rangeMax) - x1(rangeAvg)) + .attr('x', rangeMax <= 0 ? + x1(rangeMin) + : x1(rangeAvg)) + */ + + g.select('rect.nv-measure') + .style('fill', color) + .attr('height', availableHeight / 3) + .attr('y', availableHeight / 3) + .attr('width', measurez < 0 ? + x1(0) - x1(measurez[0]) + : x1(measurez[0]) - x1(0)) + .attr('x', xp1(measurez)) + .on('mouseover', function() { + dispatch.elementMouseover({ + value: measurez[0], + label: 'Current', + pos: [x1(measurez[0]), availableHeight/2] + }) + }) + .on('mouseout', function() { + dispatch.elementMouseout({ + value: measurez[0], + label: 'Current' + }) + }) + + var h3 = availableHeight / 6; + if (markerz[0]) { + g.selectAll('path.nv-markerTriangle') + .attr('transform', function(d) { return 'translate(' + x1(markerz[0]) + ',' + (availableHeight / 2) + ')' }) + .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z') + .on('mouseover', function() { + dispatch.elementMouseover({ + value: markerz[0], + label: 'Previous', + pos: [x1(markerz[0]), availableHeight/2] + }) + }) + .on('mouseout', function() { + dispatch.elementMouseout({ + value: markerz[0], + label: 'Previous' + }) + }); + } else { + g.selectAll('path.nv-markerTriangle').remove(); + } + + + wrap.selectAll('.nv-range') + .on('mouseover', function(d,i) { + var label = !i ? "Maximum" : i == 1 ? "Mean" : "Minimum"; + + dispatch.elementMouseover({ + value: d, + label: label, + pos: [x1(d), availableHeight/2] + }) + }) + .on('mouseout', function(d,i) { + var label = !i ? "Maximum" : i == 1 ? "Mean" : "Minimum"; + + dispatch.elementMouseout({ + value: d, + label: label + }) + }) + +/* // THIS IS THE PREVIOUS BULLET IMPLEMENTATION, WILL REMOVE SHORTLY + // Update the range rects. + var range = g.selectAll('rect.nv-range') + .data(rangez); + + range.enter().append('rect') + .attr('class', function(d, i) { return 'nv-range nv-s' + i; }) + .attr('width', w0) + .attr('height', availableHeight) + .attr('x', reverse ? x0 : 0) + .on('mouseover', function(d,i) { + dispatch.elementMouseover({ + value: d, + label: (i <= 0) ? 'Maximum' : (i > 1) ? 'Minimum' : 'Mean', //TODO: make these labels a variable + pos: [x1(d), availableHeight/2] + }) + }) + .on('mouseout', function(d,i) { + dispatch.elementMouseout({ + value: d, + label: (i <= 0) ? 'Minimum' : (i >=1) ? 'Maximum' : 'Mean' //TODO: make these labels a variable + }) + }) + + d3.transition(range) + .attr('x', reverse ? x1 : 0) + .attr('width', w1) + .attr('height', availableHeight); + + + // Update the measure rects. + var measure = g.selectAll('rect.nv-measure') + .data(measurez); + + measure.enter().append('rect') + .attr('class', function(d, i) { return 'nv-measure nv-s' + i; }) + .style('fill', function(d,i) { return color(d,i ) }) + .attr('width', w0) + .attr('height', availableHeight / 3) + .attr('x', reverse ? x0 : 0) + .attr('y', availableHeight / 3) + .on('mouseover', function(d) { + dispatch.elementMouseover({ + value: d, + label: 'Current', //TODO: make these labels a variable + pos: [x1(d), availableHeight/2] + }) + }) + .on('mouseout', function(d) { + dispatch.elementMouseout({ + value: d, + label: 'Current' //TODO: make these labels a variable + }) + }) + + d3.transition(measure) + .attr('width', w1) + .attr('height', availableHeight / 3) + .attr('x', reverse ? x1 : 0) + .attr('y', availableHeight / 3); + + + + // Update the marker lines. + var marker = g.selectAll('path.nv-markerTriangle') + .data(markerz); + + var h3 = availableHeight / 6; + marker.enter().append('path') + .attr('class', 'nv-markerTriangle') + .attr('transform', function(d) { return 'translate(' + x0(d) + ',' + (availableHeight / 2) + ')' }) + .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z') + .on('mouseover', function(d,i) { + dispatch.elementMouseover({ + value: d, + label: 'Previous', + pos: [x1(d), availableHeight/2] + }) + }) + .on('mouseout', function(d,i) { + dispatch.elementMouseout({ + value: d, + label: 'Previous' + }) + }); + + d3.transition(marker) + .attr('transform', function(d) { return 'translate(' + (x1(d) - x1(0)) + ',' + (availableHeight / 2) + ')' }); + + marker.exit().remove(); +*/ + + }); + + // d3.timer.flush(); // Not needed? + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + // left, right, top, bottom + chart.orient = function(_) { + if (!arguments.length) return orient; + orient = _; + reverse = orient == 'right' || orient == 'bottom'; + return chart; + }; + + // ranges (bad, satisfactory, good) + chart.ranges = function(_) { + if (!arguments.length) return ranges; + ranges = _; + return chart; + }; + + // markers (previous, goal) + chart.markers = function(_) { + if (!arguments.length) return markers; + markers = _; + return chart; + }; + + // measures (actual, forecast) + chart.measures = function(_) { + if (!arguments.length) return measures; + measures = _; + return chart; + }; + + chart.forceX = function(_) { + if (!arguments.length) return forceX; + forceX = _; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.tickFormat = function(_) { + if (!arguments.length) return tickFormat; + tickFormat = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + //============================================================ + + + return chart; +}; + + + +// Chart design based on the recommendations of Stephen Few. Implementation +// based on the work of Clint Ivy, Jamie Love, and Jason Davies. +// http://projects.instantcognition.com/protovis/bulletchart/ +nv.models.bulletChart = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var bullet = nv.models.bullet() + ; + + var orient = 'left' // TODO top & bottom + , reverse = false + , margin = {top: 5, right: 40, bottom: 20, left: 120} + , ranges = function(d) { return d.ranges } + , markers = function(d) { return d.markers } + , measures = function(d) { return d.measures } + , width = null + , height = 55 + , tickFormat = null + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + x + '

      ' + + '

      ' + y + '

      ' + } + , noData = 'No Data Available.' + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ) + margin.left, + top = e.pos[1] + ( offsetElement.offsetTop || 0) + margin.top, + content = tooltip(e.key, e.label, e.value, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(d, i) { + var container = d3.select(this); + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + that = this; + + + chart.update = function() { chart(selection) }; + chart.container = this; + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!d || !ranges.call(this, d, i)) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', 18 + margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + + var rangez = ranges.call(this, d, i).slice().sort(d3.descending), + markerz = markers.call(this, d, i).slice().sort(d3.descending), + measurez = measures.call(this, d, i).slice().sort(d3.descending); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-bulletChart').data([d]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bulletChart'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-bulletWrap'); + gEnter.append('g').attr('class', 'nv-titles'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + // Compute the new x-scale. + var x1 = d3.scale.linear() + .domain([0, Math.max(rangez[0], markerz[0], measurez[0])]) // TODO: need to allow forceX and forceY, and xDomain, yDomain + .range(reverse ? [availableWidth, 0] : [0, availableWidth]); + + // Retrieve the old x-scale, if this is an update. + var x0 = this.__chart__ || d3.scale.linear() + .domain([0, Infinity]) + .range(x1.range()); + + // Stash the new scale. + this.__chart__ = x1; + + /* + // Derive width-scales from the x-scales. + var w0 = bulletWidth(x0), + w1 = bulletWidth(x1); + + function bulletWidth(x) { + var x0 = x(0); + return function(d) { + return Math.abs(x(d) - x(0)); + }; + } + + function bulletTranslate(x) { + return function(d) { + return 'translate(' + x(d) + ',0)'; + }; + } + */ + + var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0) + w1 = function(d) { return Math.abs(x1(d) - x1(0)) }; + + + var title = gEnter.select('.nv-titles').append('g') + .attr('text-anchor', 'end') + .attr('transform', 'translate(-6,' + (height - margin.top - margin.bottom) / 2 + ')'); + title.append('text') + .attr('class', 'nv-title') + .text(function(d) { return d.title; }); + + title.append('text') + .attr('class', 'nv-subtitle') + .attr('dy', '1em') + .text(function(d) { return d.subtitle; }); + + + + bullet + .width(availableWidth) + .height(availableHeight) + + var bulletWrap = g.select('.nv-bulletWrap'); + + d3.transition(bulletWrap).call(bullet); + + + + // Compute the tick format. + var format = tickFormat || x1.tickFormat( availableWidth / 100 ); + + // Update the tick groups. + var tick = g.selectAll('g.nv-tick') + .data(x1.ticks( availableWidth / 50 ), function(d) { + return this.textContent || format(d); + }); + + // Initialize the ticks with the old scale, x0. + var tickEnter = tick.enter().append('g') + .attr('class', 'nv-tick') + .attr('transform', function(d) { return 'translate(' + x0(d) + ',0)' }) + .style('opacity', 1e-6); + + tickEnter.append('line') + .attr('y1', availableHeight) + .attr('y2', availableHeight * 7 / 6); + + tickEnter.append('text') + .attr('text-anchor', 'middle') + .attr('dy', '1em') + .attr('y', availableHeight * 7 / 6) + .text(format); + + + // Transition the updating ticks to the new scale, x1. + var tickUpdate = d3.transition(tick) + .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' }) + .style('opacity', 1); + + tickUpdate.select('line') + .attr('y1', availableHeight) + .attr('y2', availableHeight * 7 / 6); + + tickUpdate.select('text') + .attr('y', availableHeight * 7 / 6); + + // Transition the exiting ticks to the new scale, x1. + d3.transition(tick.exit()) + .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' }) + .style('opacity', 1e-6) + .remove(); + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + dispatch.on('tooltipShow', function(e) { + e.key = d.title; + if (tooltips) showTooltip(e, that.parentNode); + }); + + //============================================================ + + }); + + d3.timer.flush(); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + bullet.dispatch.on('elementMouseover.tooltip', function(e) { + dispatch.tooltipShow(e); + }); + + bullet.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + chart.bullet = bullet; + + d3.rebind(chart, bullet, 'color'); + + // left, right, top, bottom + chart.orient = function(x) { + if (!arguments.length) return orient; + orient = x; + reverse = orient == 'right' || orient == 'bottom'; + return chart; + }; + + // ranges (bad, satisfactory, good) + chart.ranges = function(x) { + if (!arguments.length) return ranges; + ranges = x; + return chart; + }; + + // markers (previous, goal) + chart.markers = function(x) { + if (!arguments.length) return markers; + markers = x; + return chart; + }; + + // measures (actual, forecast) + chart.measures = function(x) { + if (!arguments.length) return measures; + measures = x; + return chart; + }; + + chart.width = function(x) { + if (!arguments.length) return width; + width = x; + return chart; + }; + + chart.height = function(x) { + if (!arguments.length) return height; + height = x; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.tickFormat = function(x) { + if (!arguments.length) return tickFormat; + tickFormat = x; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +}; + + + +nv.models.cumulativeLineChart = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var lines = nv.models.line() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + , controls = nv.models.legend() + ; + + var margin = {top: 30, right: 30, bottom: 50, left: 60} + , color = nv.utils.defaultColor() + , width = null + , height = null + , showLegend = true + , tooltips = true + , showControls = true + , rescaleY = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' at ' + x + '

      ' + } + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , id = lines.id() + , state = { index: 0, rescaleY: rescaleY } + , defaultState = null + , noData = 'No Data Available.' + , average = function(d) { return d.average } + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + ; + + xAxis + .orient('bottom') + .tickPadding(7) + ; + yAxis + .orient('left') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var dx = d3.scale.linear() + , index = {i: 0, x: 0} + ; + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, null, null, offsetElement); + }; + +/* + //Moved to see if we can get better behavior to fix issue #315 + var indexDrag = d3.behavior.drag() + .on('dragstart', dragStart) + .on('drag', dragMove) + .on('dragend', dragEnd); + + function dragStart(d,i) { + d3.select(chart.container) + .style('cursor', 'ew-resize'); + } + + function dragMove(d,i) { + d.x += d3.event.dx; + d.i = Math.round(dx.invert(d.x)); + + d3.select(this).attr('transform', 'translate(' + dx(d.i) + ',0)'); + chart.update(); + } + + function dragEnd(d,i) { + d3.select(chart.container) + .style('cursor', 'auto'); + chart.update(); + } +*/ + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this).classed('nv-chart-' + id, true), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + + chart.update = function() { container.transition().call(chart) }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + var indexDrag = d3.behavior.drag() + .on('dragstart', dragStart) + .on('drag', dragMove) + .on('dragend', dragEnd); + + + function dragStart(d,i) { + d3.select(chart.container) + .style('cursor', 'ew-resize'); + } + + function dragMove(d,i) { + index.x = d3.event.x; + index.i = Math.round(dx.invert(index.x)); + updateZero(); + } + + function dragEnd(d,i) { + d3.select(chart.container) + .style('cursor', 'auto'); + + // update state and send stateChange with new index + state.index = index.i; + dispatch.stateChange(state); + } + + + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = lines.xScale(); + y = lines.yScale(); + + + if (!rescaleY) { + var seriesDomains = data + .filter(function(series) { return !series.disabled }) + .map(function(series,i) { + var initialDomain = d3.extent(series.values, lines.y()); + + //account for series being disabled when losing 95% or more + if (initialDomain[0] < -.95) initialDomain[0] = -.95; + + return [ + (initialDomain[0] - initialDomain[1]) / (1 + initialDomain[1]), + (initialDomain[1] - initialDomain[0]) / (1 + initialDomain[0]) + ]; + }); + + var completeDomain = [ + d3.min(seriesDomains, function(d) { return d[0] }), + d3.max(seriesDomains, function(d) { return d[1] }) + ] + + lines.yDomain(completeDomain); + } else { + lines.yDomain(null); + } + + + dx .domain([0, data[0].values.length - 1]) //Assumes all series have same length + .range([0, availableWidth]) + .clamp(true); + + //------------------------------------------------------------ + + + var data = indexify(index.i, data); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-cumulativeLine').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-cumulativeLine').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-background'); + gEnter.append('g').attr('class', 'nv-linesWrap'); + gEnter.append('g').attr('class', 'nv-avgLinesWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')') + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + var controlsData = [ + { key: 'Re-scale y-axis', disabled: !rescaleY } + ]; + + controls.width(140).color(['#444', '#444', '#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + // Show error if series goes below 100% + var tempDisabled = data.filter(function(d) { return d.tempDisabled }); + + wrap.select('.tempDisabled').remove(); //clean-up and prevent duplicates + if (tempDisabled.length) { + wrap.append('text').attr('class', 'tempDisabled') + .attr('x', availableWidth / 2) + .attr('y', '-.71em') + .style('text-anchor', 'end') + .text(tempDisabled.map(function(d) { return d.key }).join(', ') + ' values cannot be calculated for this time period.'); + } + + //------------------------------------------------------------ + // Main Chart Component(s) + + gEnter.select('.nv-background') + .append('rect'); + + g.select('.nv-background rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + lines + //.x(function(d) { return d.x }) + .y(function(d) { return d.display.y }) + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && !data[i].tempDisabled; })); + + + + var linesWrap = g.select('.nv-linesWrap') + .datum(data.filter(function(d) { return !d.disabled && !d.tempDisabled })); + + //d3.transition(linesWrap).call(lines); + linesWrap.call(lines); + + /*Handle average lines [AN-612] ----------------------------*/ + + //Store a series index number in the data array. + data.forEach(function(d,i) { + d.seriesIndex = i; + }); + + var avgLineData = data.filter(function(d) { + return !d.disabled && !!average(d); + }); + + var avgLines = g.select(".nv-avgLinesWrap").selectAll("line") + .data(avgLineData, function(d) { return d.key; }); + + avgLines.enter() + .append('line') + .style('stroke-width',2) + .style('stroke-dasharray','10,10') + .style('stroke',function (d,i) { + return lines.color()(d,d.seriesIndex); + }) + .attr('x1',0) + .attr('x2',availableWidth) + .attr('y1', function(d) { return y(average(d)); }) + .attr('y2', function(d) { return y(average(d)); }); + + avgLines + .attr('x1',0) + .attr('x2',availableWidth) + .attr('y1', function(d) { return y(average(d)); }) + .attr('y2', function(d) { return y(average(d)); }); + + avgLines.exit().remove(); + + //Create index line ----------------------------------------- + + var indexLine = linesWrap.selectAll('.nv-indexLine') + .data([index]); + indexLine.enter().append('rect').attr('class', 'nv-indexLine') + .attr('width', 3) + .attr('x', -2) + .attr('fill', 'red') + .attr('fill-opacity', .5) + .call(indexDrag) + + indexLine + .attr('transform', function(d) { return 'translate(' + dx(d.i) + ',0)' }) + .attr('height', availableHeight) + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + xAxis + .scale(x) + //Suggest how many ticks based on the chart width and D3 should listen (70 is the optimal number for MM/DD/YY dates) + .ticks( Math.min(data[0].values.length,availableWidth/70) ) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')'); + d3.transition(g.select('.nv-x.nv-axis')) + .call(xAxis); + + + yAxis + .scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + d3.transition(g.select('.nv-y.nv-axis')) + .call(yAxis); + + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + + function updateZero() { + indexLine + .data([index]); + + container.call(chart); + } + + g.select('.nv-background rect') + .on('click', function() { + index.x = d3.mouse(this)[0]; + index.i = Math.round(dx.invert(index.x)); + + // update state and send stateChange with new index + state.index = index.i; + dispatch.stateChange(state); + + updateZero(); + }); + + lines.dispatch.on('elementClick', function(e) { + index.i = e.pointIndex; + index.x = dx(index.i); + + // update state and send stateChange with new index + state.index = index.i; + dispatch.stateChange(state); + + updateZero(); + }); + + controls.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + rescaleY = !d.disabled; + + state.rescaleY = rescaleY; + dispatch.stateChange(state); + + //selection.transition().call(chart); + chart.update(); + }); + + + legend.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + if (!data.filter(function(d) { return !d.disabled }).length) { + data.map(function(d) { + d.disabled = false; + wrap.selectAll('.nv-series').classed('disabled', false); + return d; + }); + } + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + + //selection.transition().call(chart); + chart.update(); + }); + + legend.dispatch.on('legendDblclick', function(d) { + //Double clicking should always enable current series, and disabled all others. + data.forEach(function(d) { + d.disabled = true; + }); + d.disabled = false; + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + chart.update(); + }); + + +/* + // + legend.dispatch.on('legendMouseover', function(d, i) { + d.hover = true; + selection.transition().call(chart) + }); + + legend.dispatch.on('legendMouseout', function(d, i) { + d.hover = false; + selection.transition().call(chart) + }); +*/ + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + + if (typeof e.index !== 'undefined') { + index.i = e.index; + index.x = dx(index.i); + + state.index = e.index; + + indexLine + .data([index]); + } + + + if (typeof e.rescaleY !== 'undefined') { + rescaleY = e.rescaleY; + } + + chart.update(); + }); + + //============================================================ + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.lines = lines; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id'); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.rescaleY = function(_) { + if (!arguments.length) return rescaleY; + rescaleY = _ + return rescaleY; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.average = function(_) { + if(!arguments.length) return average; + average = _; + return chart; + }; + + //============================================================ + + + //============================================================ + // Functions + //------------------------------------------------------------ + + /* Normalize the data according to an index point. */ + function indexify(idx, data) { + return data.map(function(line, i) { + if (!line.values) { + return line; + } + var v = lines.y()(line.values[idx], idx); + + //TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue + if (v < -.95) { + //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically correct till it hits 100) + line.tempDisabled = true; + return line; + } + + line.tempDisabled = false; + + line.values = line.values.map(function(point, pointIndex) { + point.display = {'y': (lines.y()(point, pointIndex) - v) / (1 + v) }; + return point; + }) + + return line; + }) + } + + //============================================================ + + + return chart; +} +//TODO: consider deprecating by adding necessary features to multiBar model +nv.models.discreteBar = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , x = d3.scale.ordinal() + , y = d3.scale.linear() + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove + , color = nv.utils.defaultColor() + , showValues = false + , valueFormat = d3.format(',.2f') + , xDomain + , yDomain + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + , rectClass = 'discreteBar' + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + + //add series index to each data point for reference + data = data.map(function(series, i) { + series.values = series.values.map(function(point) { + point.series = i; + return point; + }); + return series; + }); + + + //------------------------------------------------------------ + // Setup Scales + + // remap and flatten the data for use in calculating the scales' domains + var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate + data.map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i), y0: d.y0 } + }) + }); + + x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x })) + .rangeBands([0, availableWidth], .1); + + y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y }).concat(forceY))); + + + // If showValues, pad the Y axis range to account for label height + if (showValues) y.range([availableHeight - (y.domain()[0] < 0 ? 12 : 0), y.domain()[1] > 0 ? 12 : 0]); + else y.range([availableHeight, 0]); + + //store old scales if they exist + x0 = x0 || x; + y0 = y0 || y.copy().range([y(0),y(0)]); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-discretebar').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discretebar'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-groups'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + //TODO: by definition, the discrete bar should not have multiple groups, will modify/remove later + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d) { return d.key }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + d3.transition(groups.exit()) + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6) + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }); + d3.transition(groups) + .style('stroke-opacity', 1) + .style('fill-opacity', .75); + + + var bars = groups.selectAll('g.nv-bar') + .data(function(d) { return d.values }); + + bars.exit().remove(); + + + var barsEnter = bars.enter().append('g') + .attr('transform', function(d,i,j) { + return 'translate(' + (x(getX(d,i)) + x.rangeBand() * .05 ) + ', ' + y(0) + ')' + }) + .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('mouseout', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + value: getY(d,i), + point: d, + series: data[d.series], + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('click', function(d,i) { + dispatch.elementClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + dispatch.elementDblClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }); + + barsEnter.append('rect') + .attr('height', 0) + .attr('width', x.rangeBand() * .9 / data.length ) + + if (showValues) { + barsEnter.append('text') + .attr('text-anchor', 'middle') + bars.select('text') + .attr('x', x.rangeBand() * .9 / 2) + .attr('y', function(d,i) { return getY(d,i) < 0 ? y(getY(d,i)) - y(0) + 12 : -4 }) + .text(function(d,i) { return valueFormat(getY(d,i)) }); + } else { + bars.selectAll('text').remove(); + } + + bars + .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive' }) + .style('fill', function(d,i) { return d.color || color(d,i) }) + .style('stroke', function(d,i) { return d.color || color(d,i) }) + .select('rect') + .attr('class', rectClass) + .attr('width', x.rangeBand() * .9 / data.length); + d3.transition(bars) + //.delay(function(d,i) { return i * 1200 / data[0].values.length }) + .attr('transform', function(d,i) { + var left = x(getX(d,i)) + x.rangeBand() * .05, + top = getY(d,i) < 0 ? + y(0) : + y(0) - y(getY(d,i)) < 1 ? + y(0) - 1 : //make 1 px positive bars show up above y=0 + y(getY(d,i)); + + return 'translate(' + left + ', ' + top + ')' + }) + .select('rect') + .attr('height', function(d,i) { + return Math.max(Math.abs(y(getY(d,i)) - y(0)) || 1) + }); + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.showValues = function(_) { + if (!arguments.length) return showValues; + showValues = _; + return chart; + }; + + chart.valueFormat= function(_) { + if (!arguments.length) return valueFormat; + valueFormat = _; + return chart; + }; + + chart.rectClass= function(_) { + if (!arguments.length) return rectClass; + rectClass = _; + return chart; + } + //============================================================ + + + return chart; +} + +nv.models.discreteBarChart = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var discretebar = nv.models.discreteBar() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + ; + + var margin = {top: 15, right: 10, bottom: 50, left: 60} + , width = null + , height = null + , color = nv.utils.getColor() + , staggerLabels = false + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + x + '

      ' + + '

      ' + y + '

      ' + } + , x + , y + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'beforeUpdate') + ; + + xAxis + .orient('bottom') + .highlightZero(false) + .showMaxMin(false) + .tickFormat(function(d) { return d }) + ; + yAxis + .orient('left') + .tickFormat(d3.format(',.1f')) + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(discretebar.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(discretebar.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + + chart.update = function() { dispatch.beforeUpdate(); container.transition().call(chart); }; + chart.container = this; + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = discretebar.xScale(); + y = discretebar.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-discreteBarWithAxes').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discreteBarWithAxes').append('g'); + var defsEnter = gEnter.append('defs'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-barsWrap'); + + g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Main Chart Component(s) + + discretebar + .width(availableWidth) + .height(availableHeight); + + + var barsWrap = g.select('.nv-barsWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + d3.transition(barsWrap).call(discretebar); + + //------------------------------------------------------------ + + + + defsEnter.append('clipPath') + .attr('id', 'nv-x-label-clip-' + discretebar.id()) + .append('rect'); + + g.select('#nv-x-label-clip-' + discretebar.id() + ' rect') + .attr('width', x.rangeBand() * (staggerLabels ? 2 : 1)) + .attr('height', 16) + .attr('x', -x.rangeBand() / (staggerLabels ? 1 : 2 )); + + + //------------------------------------------------------------ + // Setup Axes + + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + (y.range()[0] + ((discretebar.showValues() && y.domain()[0] < 0) ? 16 : 0)) + ')'); + //d3.transition(g.select('.nv-x.nv-axis')) + g.select('.nv-x.nv-axis').transition().duration(0) + .call(xAxis); + + + var xTicks = g.select('.nv-x.nv-axis').selectAll('g'); + + if (staggerLabels) { + xTicks + .selectAll('text') + .attr('transform', function(d,i,j) { return 'translate(0,' + (j % 2 == 0 ? '5' : '17') + ')' }) + } + + yAxis + .scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + d3.transition(g.select('.nv-y.nv-axis')) + .call(yAxis); + + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + //============================================================ + + + }); + + return chart; + } + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + discretebar.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + discretebar.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.discretebar = discretebar; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, discretebar, 'x', 'y', 'xDomain', 'yDomain', 'forceX', 'forceY', 'id', 'showValues', 'valueFormat'); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + discretebar.color(color); + return chart; + }; + + chart.staggerLabels = function(_) { + if (!arguments.length) return staggerLabels; + staggerLabels = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} + +nv.models.distribution = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 400 //technically width or height depending on x or y.... + , size = 8 + , axis = 'x' // 'x' or 'y'... horizontal or vertical + , getData = function(d) { return d[axis] } // defaults d.x or d.y + , color = nv.utils.defaultColor() + , scale = d3.scale.linear() + , domain + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var scale0; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableLength = width - (axis === 'x' ? margin.left + margin.right : margin.top + margin.bottom), + naxis = axis == 'x' ? 'y' : 'x', + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup Scales + + scale0 = scale0 || scale; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-distribution').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-distribution'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')') + + //------------------------------------------------------------ + + + var distWrap = g.selectAll('g.nv-dist') + .data(function(d) { return d }, function(d) { return d.key }); + + distWrap.enter().append('g'); + distWrap + .attr('class', function(d,i) { return 'nv-dist nv-series-' + i }) + .style('stroke', function(d,i) { return color(d, i) }); + + var dist = distWrap.selectAll('line.nv-dist' + axis) + .data(function(d) { return d.values }) + dist.enter().append('line') + .attr(axis + '1', function(d,i) { return scale0(getData(d,i)) }) + .attr(axis + '2', function(d,i) { return scale0(getData(d,i)) }) + d3.transition(distWrap.exit().selectAll('line.nv-dist' + axis)) + .attr(axis + '1', function(d,i) { return scale(getData(d,i)) }) + .attr(axis + '2', function(d,i) { return scale(getData(d,i)) }) + .style('stroke-opacity', 0) + .remove(); + dist + .attr('class', function(d,i) { return 'nv-dist' + axis + ' nv-dist' + axis + '-' + i }) + .attr(naxis + '1', 0) + .attr(naxis + '2', size); + d3.transition(dist) + .attr(axis + '1', function(d,i) { return scale(getData(d,i)) }) + .attr(axis + '2', function(d,i) { return scale(getData(d,i)) }) + + + scale0 = scale.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.axis = function(_) { + if (!arguments.length) return axis; + axis = _; + return chart; + }; + + chart.size = function(_) { + if (!arguments.length) return size; + size = _; + return chart; + }; + + chart.getData = function(_) { + if (!arguments.length) return getData; + getData = d3.functor(_); + return chart; + }; + + chart.scale = function(_) { + if (!arguments.length) return scale; + scale = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + //============================================================ + + + return chart; +} +//TODO: consider deprecating and using multibar with single series for this +nv.models.historicalBar = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , x = d3.scale.linear() + , y = d3.scale.linear() + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , forceX = [] + , forceY = [0] + , padData = false + , clipEdge = true + , color = nv.utils.defaultColor() + , xDomain + , yDomain + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup Scales + + x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) )) + + if (padData) + x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]); + else + x.range([0, availableWidth]); + + y .domain(yDomain || d3.extent(data[0].values.map(getY).concat(forceY) )) + .range([availableHeight, 0]); + + // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point + if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true; + if (x.domain()[0] === x.domain()[1]) + x.domain()[0] ? + x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) + : x.domain([-1,1]); + + if (y.domain()[0] === y.domain()[1]) + y.domain()[0] ? + y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01]) + : y.domain([-1,1]); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-bar').data([data[0].values]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bar'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-bars'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + container + .on('click', function(d,i) { + dispatch.chartClick({ + data: d, + index: i, + pos: d3.event, + id: id + }); + }); + + + defsEnter.append('clipPath') + .attr('id', 'nv-chart-clip-path-' + id) + .append('rect'); + + wrap.select('#nv-chart-clip-path-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : ''); + + + + var bars = wrap.select('.nv-bars').selectAll('.nv-bar') + .data(function(d) { return d }); + + bars.exit().remove(); + + + var barsEnter = bars.enter().append('rect') + //.attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i }) + .attr('x', 0 ) + .attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) }) + .attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) }) + .on('mouseover', function(d,i) { + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + point: d, + series: data[0], + pos: [x(getX(d,i)), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: 0, + e: d3.event + }); + + }) + .on('mouseout', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + point: d, + series: data[0], + pointIndex: i, + seriesIndex: 0, + e: d3.event + }); + }) + .on('click', function(d,i) { + dispatch.elementClick({ + //label: d[label], + value: getY(d,i), + data: d, + index: i, + pos: [x(getX(d,i)), y(getY(d,i))], + e: d3.event, + id: id + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + dispatch.elementDblClick({ + //label: d[label], + value: getY(d,i), + data: d, + index: i, + pos: [x(getX(d,i)), y(getY(d,i))], + e: d3.event, + id: id + }); + d3.event.stopPropagation(); + }); + + bars + .attr('fill', function(d,i) { return color(d, i); }) + .attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i }) + .attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; }) //TODO: better width calculations that don't assume always uniform data spacing;w + .attr('width', (availableWidth / data[0].values.length) * .9 ) + + + d3.transition(bars) + //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) }) + .attr('y', function(d,i) { + return getY(d,i) < 0 ? + y(0) : + y(0) - y(getY(d,i)) < 1 ? + y(0) - 1 : + y(getY(d,i)) + }) + .attr('height', function(d,i) { return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) }); + //.order(); // not sure if this makes any sense for this model + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.forceX = function(_) { + if (!arguments.length) return forceX; + forceX = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.padData = function(_) { + if (!arguments.length) return padData; + padData = _; + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + //============================================================ + + + return chart; +} + +nv.models.historicalBarChart = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var bars = nv.models.historicalBar() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + ; + + var margin = {top: 30, right: 90, bottom: 50, left: 90} + , color = nv.utils.defaultColor() + , width = null + , height = null + , showLegend = false + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' at ' + x + '

      ' + } + , x + , y + , state = {} + , defaultState = null + , noData = 'No Data Available.' + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + ; + + xAxis + .orient('bottom') + .tickPadding(7) + ; + yAxis + .orient( (rightAlignYAxis) ? 'right' : 'left') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + + // New addition to calculate position if SVG is scaled with viewBox, may move TODO: consider implementing everywhere else + if (offsetElement) { + var svg = d3.select(offsetElement).select('svg'); + var viewBox = (svg.node()) ? svg.attr('viewBox') : null; + if (viewBox) { + viewBox = viewBox.split(' '); + var ratio = parseInt(svg.style('width')) / viewBox[2]; + e.pos[0] = e.pos[0] * ratio; + e.pos[1] = e.pos[1] * ratio; + } + } + + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(bars.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(bars.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, null, null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + + chart.update = function() { chart(selection) }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display noData message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = bars.xScale(); + y = bars.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-lineChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-barsWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + wrap.select('.nv-legendWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')') + } + + //------------------------------------------------------------ + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + //------------------------------------------------------------ + // Main Chart Component(s) + + bars + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + + + var barsWrap = g.select('.nv-barsWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + d3.transition(barsWrap).call(bars); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + if (showXAxis) { + xAxis + .scale(x) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')'); + g.select('.nv-x.nv-axis') + .transition() + .call(xAxis); + } + + if (showYAxis) { + yAxis + .scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-y.nv-axis') + .transition().duration(0) + .call(yAxis); + } + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + if (!data.filter(function(d) { return !d.disabled }).length) { + data.map(function(d) { + d.disabled = false; + wrap.selectAll('.nv-series').classed('disabled', false); + return d; + }); + } + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + + selection.transition().call(chart); + }); + + legend.dispatch.on('legendDblclick', function(d) { + //Double clicking should always enable current series, and disabled all others. + data.forEach(function(d) { + d.disabled = true; + }); + d.disabled = false; + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + chart.update(); + }); + + +/* + legend.dispatch.on('legendMouseover', function(d, i) { + d.hover = true; + selection.transition().call(chart) + }); + + legend.dispatch.on('legendMouseout', function(d, i) { + d.hover = false; + selection.transition().call(chart) + }); +*/ + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + selection.call(chart); + }); + + //============================================================ + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + bars.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + bars.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.bars = bars; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, bars, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate'); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} +nv.models.indentedTree = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} //TODO: implement, maybe as margin on the containing div + , width = 960 + , height = 500 + , color = nv.utils.defaultColor() + , id = Math.floor(Math.random() * 10000) + , header = true + , filterZero = false + , noData = "No Data Available." + , childIndent = 20 + , columns = [{key:'key', label: 'Name', type:'text'}] //TODO: consider functions like chart.addColumn, chart.removeColumn, instead of a block like this + , tableClass = null + , iconOpen = 'images/grey-plus.png' //TODO: consider removing this and replacing with a '+' or '-' unless user defines images + , iconClose = 'images/grey-minus.png' + , dispatch = d3.dispatch('elementClick', 'elementDblclick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + var idx = 0; + + function chart(selection) { + selection.each(function(data) { + var depth = 1, + container = d3.select(this); + + var tree = d3.layout.tree() + .children(function(d) { return d.values }) + .size([height, childIndent]); //Not sure if this is needed now that the result is HTML + + chart.update = function() { container.transition().duration(600).call(chart) }; + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + if (!data[0]) data[0] = {key: noData}; + + //------------------------------------------------------------ + + + var nodes = tree.nodes(data[0]); + + // nodes.map(function(d) { + // d.id = i++; + // }) + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = d3.select(this).selectAll('div').data([[nodes]]); + var wrapEnter = wrap.enter().append('div').attr('class', 'nvd3 nv-wrap nv-indentedtree'); + var tableEnter = wrapEnter.append('table'); + var table = wrap.select('table').attr('width', '100%').attr('class', tableClass); + + //------------------------------------------------------------ + + + if (header) { + var thead = tableEnter.append('thead'); + + var theadRow1 = thead.append('tr'); + + columns.forEach(function(column) { + theadRow1 + .append('th') + .attr('width', column.width ? column.width : '10%') + .style('text-align', column.type == 'numeric' ? 'right' : 'left') + .append('span') + .text(column.label); + }); + } + + + var tbody = table.selectAll('tbody') + .data(function(d) { return d }); + tbody.enter().append('tbody'); + + + + //compute max generations + depth = d3.max(nodes, function(node) { return node.depth }); + tree.size([height, depth * childIndent]); //TODO: see if this is necessary at all + + + // Update the nodes… + var node = tbody.selectAll('tr') + // .data(function(d) { return d; }, function(d) { return d.id || (d.id == ++i)}); + .data(function(d) { return d.filter(function(d) { return (filterZero && !d.children) ? filterZero(d) : true; } )}, function(d,i) { return d.id || (d.id || ++idx)}); + //.style('display', 'table-row'); //TODO: see if this does anything + + node.exit().remove(); + + node.select('img.nv-treeicon') + .attr('src', icon) + .classed('folded', folded); + + var nodeEnter = node.enter().append('tr'); + + + columns.forEach(function(column, index) { + + var nodeName = nodeEnter.append('td') + .style('padding-left', function(d) { return (index ? 0 : d.depth * childIndent + 12 + (icon(d) ? 0 : 16)) + 'px' }, 'important') //TODO: check why I did the ternary here + .style('text-align', column.type == 'numeric' ? 'right' : 'left'); + + + if (index == 0) { + nodeName.append('img') + .classed('nv-treeicon', true) + .classed('nv-folded', folded) + .attr('src', icon) + .style('width', '14px') + .style('height', '14px') + .style('padding', '0 1px') + .style('display', function(d) { return icon(d) ? 'inline-block' : 'none'; }) + .on('click', click); + } + + + nodeName.append('span') + .attr('class', d3.functor(column.classes) ) + .text(function(d) { return column.format ? column.format(d) : + (d[column.key] || '-') }); + + if (column.showCount) { + nodeName.append('span') + .attr('class', 'nv-childrenCount'); + + node.selectAll('span.nv-childrenCount').text(function(d) { + return ((d.values && d.values.length) || (d._values && d._values.length)) ? //If this is a parent + '(' + ((d.values && (d.values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length)) //If children are in values check its children and filter + || (d._values && d._values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length) //Otherwise, do the same, but with the other name, _values... + || 0) + ')' //This is the catch-all in case there are no children after a filter + : '' //If this is not a parent, just give an empty string + }); + } + + if (column.click) + nodeName.select('span').on('click', column.click); + + }); + + node + .order() + .on('click', function(d) { + dispatch.elementClick({ + row: this, //TODO: decide whether or not this should be consistent with scatter/line events or should be an html link (a href) + data: d, + pos: [d.x, d.y] + }); + }) + .on('dblclick', function(d) { + dispatch.elementDblclick({ + row: this, + data: d, + pos: [d.x, d.y] + }); + }) + .on('mouseover', function(d) { + dispatch.elementMouseover({ + row: this, + data: d, + pos: [d.x, d.y] + }); + }) + .on('mouseout', function(d) { + dispatch.elementMouseout({ + row: this, + data: d, + pos: [d.x, d.y] + }); + }); + + + + + // Toggle children on click. + function click(d, _, unshift) { + d3.event.stopPropagation(); + + if(d3.event.shiftKey && !unshift) { + //If you shift-click, it'll toggle fold all the children, instead of itself + d3.event.shiftKey = false; + d.values && d.values.forEach(function(node){ + if (node.values || node._values) { + click(node, 0, true); + } + }); + return true; + } + if(!hasChildren(d)) { + //download file + //window.location.href = d.url; + return true; + } + if (d.values) { + d._values = d.values; + d.values = null; + } else { + d.values = d._values; + d._values = null; + } + chart.update(); + } + + + function icon(d) { + return (d._values && d._values.length) ? iconOpen : (d.values && d.values.length) ? iconClose : ''; + } + + function folded(d) { + return (d._values && d._values.length); + } + + function hasChildren(d) { + var values = d.values || d._values; + + return (values && values.length); + } + + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + scatter.color(color); + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.header = function(_) { + if (!arguments.length) return header; + header = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.filterZero = function(_) { + if (!arguments.length) return filterZero; + filterZero = _; + return chart; + }; + + chart.columns = function(_) { + if (!arguments.length) return columns; + columns = _; + return chart; + }; + + chart.tableClass = function(_) { + if (!arguments.length) return tableClass; + tableClass = _; + return chart; + }; + + chart.iconOpen = function(_){ + if (!arguments.length) return iconOpen; + iconOpen = _; + return chart; + } + + chart.iconClose = function(_){ + if (!arguments.length) return iconClose; + iconClose = _; + return chart; + } + + //============================================================ + + + return chart; +};nv.models.legend = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 5, right: 0, bottom: 5, left: 0} + , width = 400 + , height = 20 + , getKey = function(d) { return d.key } + , color = nv.utils.defaultColor() + , align = true + , dispatch = d3.dispatch('legendClick', 'legendDblclick', 'legendMouseover', 'legendMouseout') + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-legend').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-legend').append('g'); + var g = wrap.select('g'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + var series = g.selectAll('.nv-series') + .data(function(d) { return d }); + var seriesEnter = series.enter().append('g').attr('class', 'nv-series') + .on('mouseover', function(d,i) { + dispatch.legendMouseover(d,i); //TODO: Make consistent with other event objects + }) + .on('mouseout', function(d,i) { + dispatch.legendMouseout(d,i); + }) + .on('click', function(d,i) { + dispatch.legendClick(d,i); + }) + .on('dblclick', function(d,i) { + dispatch.legendDblclick(d,i); + }); + seriesEnter.append('circle') + .style('stroke-width', 2) + .attr('r', 5); + seriesEnter.append('text') + .attr('text-anchor', 'start') + .attr('dy', '.32em') + .attr('dx', '8'); + series.classed('disabled', function(d) { return d.disabled }); + series.exit().remove(); + series.select('circle') + .style('fill', function(d,i) { return d.color || color(d,i)}) + .style('stroke', function(d,i) { return d.color || color(d, i) }); + series.select('text').text(getKey); + + + //TODO: implement fixed-width and max-width options (max-width is especially useful with the align option) + + // NEW ALIGNING CODE, TODO: clean up + if (align) { + + var seriesWidths = []; + series.each(function(d,i) { + var legendText = d3.select(this).select('text'); + var svgComputedTextLength = legendText.node().getComputedTextLength() + || nv.utils.calcApproxTextWidth(legendText); + seriesWidths.push(svgComputedTextLength + 28); // 28 is ~ the width of the circle plus some padding + }); + + //nv.log('Series Widths: ', JSON.stringify(seriesWidths)); + + var seriesPerRow = 0; + var legendWidth = 0; + var columnWidths = []; + + while ( legendWidth < availableWidth && seriesPerRow < seriesWidths.length) { + columnWidths[seriesPerRow] = seriesWidths[seriesPerRow]; + legendWidth += seriesWidths[seriesPerRow++]; + } + + + while ( legendWidth > availableWidth && seriesPerRow > 1 ) { + columnWidths = []; + seriesPerRow--; + + for (k = 0; k < seriesWidths.length; k++) { + if (seriesWidths[k] > (columnWidths[k % seriesPerRow] || 0) ) + columnWidths[k % seriesPerRow] = seriesWidths[k]; + } + + legendWidth = columnWidths.reduce(function(prev, cur, index, array) { + return prev + cur; + }); + } + //console.log(columnWidths, legendWidth, seriesPerRow); + + var xPositions = []; + for (var i = 0, curX = 0; i < seriesPerRow; i++) { + xPositions[i] = curX; + curX += columnWidths[i]; + } + + series + .attr('transform', function(d, i) { + return 'translate(' + xPositions[i % seriesPerRow] + ',' + (5 + Math.floor(i / seriesPerRow) * 20) + ')'; + }); + + //position legend as far right as possible within the total width + g.attr('transform', 'translate(' + (width - margin.right - legendWidth) + ',' + margin.top + ')'); + + height = margin.top + margin.bottom + (Math.ceil(seriesWidths.length / seriesPerRow) * 20); + + } else { + + var ypos = 5, + newxpos = 5, + maxwidth = 0, + xpos; + series + .attr('transform', function(d, i) { + var length = d3.select(this).select('text').node().getComputedTextLength() + 28; + xpos = newxpos; + + if (width < margin.left + margin.right + xpos + length) { + newxpos = xpos = 5; + ypos += 20; + } + + newxpos += length; + if (newxpos > maxwidth) maxwidth = newxpos; + + return 'translate(' + xpos + ',' + ypos + ')'; + }); + + //position legend as far right as possible within the total width + g.attr('transform', 'translate(' + (width - margin.right - maxwidth) + ',' + margin.top + ')'); + + height = margin.top + margin.bottom + ypos + 15; + + } + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.key = function(_) { + if (!arguments.length) return getKey; + getKey = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.align = function(_) { + if (!arguments.length) return align; + align = _; + return chart; + }; + + //============================================================ + + + return chart; +} + +nv.models.line = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var scatter = nv.models.scatter() + ; + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , color = nv.utils.defaultColor() // a function that returns a color + , getX = function(d) { return d.x } // accessor to get the x value from a data point + , getY = function(d) { return d.y } // accessor to get the y value from a data point + , defined = function(d,i) { return !isNaN(getY(d,i)) && getY(d,i) !== null } // allows a line to be not continuous when it is not defined + , isArea = function(d) { return d.area } // decides if a line is an area or just a line + , clipEdge = false // if true, masks lines within x and y scale + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , interpolate = "linear" // controls the line interpolation + ; + + scatter + .size(16) // default size + .sizeDomain([16,256]) //set to speed up calculation, needs to be unset if there is a custom size accessor + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0 //used to store previous scales + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + //------------------------------------------------------------ + // Setup Scales + + x = scatter.xScale(); + y = scatter.yScale(); + + x0 = x0 || x; + y0 = y0 || y; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-line').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-line'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + gEnter.append('g').attr('class', 'nv-groups'); + gEnter.append('g').attr('class', 'nv-scatterWrap'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + + scatter + .width(availableWidth) + .height(availableHeight) + + var scatterWrap = wrap.select('.nv-scatterWrap'); + //.datum(data); // Data automatically trickles down from the wrap + + d3.transition(scatterWrap).call(scatter); + + + + defsEnter.append('clipPath') + .attr('id', 'nv-edge-clip-' + scatter.id()) + .append('rect'); + + wrap.select('#nv-edge-clip-' + scatter.id() + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : ''); + scatterWrap + .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : ''); + + + + + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d) { return d.key }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + d3.transition(groups.exit()) + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6) + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }) + .style('fill', function(d,i){ return color(d, i) }) + .style('stroke', function(d,i){ return color(d, i)}); + d3.transition(groups) + .style('stroke-opacity', 1) + .style('fill-opacity', .5); + + + + var areaPaths = groups.selectAll('path.nv-area') + .data(function(d) { return isArea(d) ? [d] : [] }); // this is done differently than lines because I need to check if series is an area + areaPaths.enter().append('path') + .attr('class', 'nv-area') + .attr('d', function(d) { + return d3.svg.area() + .interpolate(interpolate) + .defined(defined) + .x(function(d,i) { return x0(getX(d,i)) }) + .y0(function(d,i) { return y0(getY(d,i)) }) + .y1(function(d,i) { return y0( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) }) + //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this + .apply(this, [d.values]) + }); + d3.transition(groups.exit().selectAll('path.nv-area')) + .attr('d', function(d) { + return d3.svg.area() + .interpolate(interpolate) + .defined(defined) + .x(function(d,i) { return x(getX(d,i)) }) + .y0(function(d,i) { return y(getY(d,i)) }) + .y1(function(d,i) { return y( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) }) + //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this + .apply(this, [d.values]) + }); + d3.transition(areaPaths) + .attr('d', function(d) { + return d3.svg.area() + .interpolate(interpolate) + .defined(defined) + .x(function(d,i) { return x(getX(d,i)) }) + .y0(function(d,i) { return y(getY(d,i)) }) + .y1(function(d,i) { return y( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) }) + //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this + .apply(this, [d.values]) + }); + + + + var linePaths = groups.selectAll('path.nv-line') + .data(function(d) { return [d.values] }); + linePaths.enter().append('path') + .attr('class', 'nv-line') + .attr('d', + d3.svg.line() + .interpolate(interpolate) + .defined(defined) + .x(function(d,i) { return x0(getX(d,i)) }) + .y(function(d,i) { return y0(getY(d,i)) }) + ); + d3.transition(groups.exit().selectAll('path.nv-line')) + .attr('d', + d3.svg.line() + .interpolate(interpolate) + .defined(defined) + .x(function(d,i) { return x(getX(d,i)) }) + .y(function(d,i) { return y(getY(d,i)) }) + ); + d3.transition(linePaths) + .attr('d', + d3.svg.line() + .interpolate(interpolate) + .defined(defined) + .x(function(d,i) { return x(getX(d,i)) }) + .y(function(d,i) { return y(getY(d,i)) }) + ); + + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = scatter.dispatch; + chart.scatter = scatter; + + d3.rebind(chart, scatter, 'id', 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'padData'); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + scatter.x(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + scatter.y(_); + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + scatter.color(color); + return chart; + }; + + chart.interpolate = function(_) { + if (!arguments.length) return interpolate; + interpolate = _; + return chart; + }; + + chart.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return chart; + }; + + chart.isArea = function(_) { + if (!arguments.length) return isArea; + isArea = d3.functor(_); + return chart; + }; + + //============================================================ + + + return chart; +} + +nv.models.lineChart = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var lines = nv.models.line() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + ; + +//set margin.right to 23 to fit dates on the x-axis within the chart + var margin = {top: 30, right: 20, bottom: 50, left: 60} + , color = nv.utils.defaultColor() + , width = null + , height = null + , showLegend = true + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' at ' + x + '

      ' + } + , x + , y + , state = {} + , defaultState = null + , noData = 'No Data Available.' + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + ; + + xAxis + .orient('bottom') + .tickPadding(7) + ; + yAxis + .orient((rightAlignYAxis) ? 'right' : 'left') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + + // New addition to calculate position if SVG is scaled with viewBox, may move TODO: consider implementing everywhere else + if (offsetElement) { + var svg = d3.select(offsetElement).select('svg'); + var viewBox = (svg.node()) ? svg.attr('viewBox') : null; + if (viewBox) { + viewBox = viewBox.split(' '); + var ratio = parseInt(svg.style('width')) / viewBox[2]; + e.pos[0] = e.pos[0] * ratio; + e.pos[1] = e.pos[1] * ratio; + } + } + + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, null, null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + + chart.update = function() { container.transition().call(chart) }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display noData message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = lines.xScale(); + y = lines.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-lineChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-linesWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + wrap.select('.nv-legendWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')') + } + + //------------------------------------------------------------ + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + //------------------------------------------------------------ + // Main Chart Component(s) + + lines + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + + + var linesWrap = g.select('.nv-linesWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + d3.transition(linesWrap).call(lines); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + if (showXAxis) { + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')'); + d3.transition(g.select('.nv-x.nv-axis')) + .call(xAxis); + } + + if (showYAxis) { + yAxis + .scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + d3.transition(g.select('.nv-y.nv-axis')) + .call(yAxis); + } + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + if (!data.filter(function(d) { return !d.disabled }).length) { + data.map(function(d) { + d.disabled = false; + wrap.selectAll('.nv-series').classed('disabled', false); + return d; + }); + } + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + + // container.transition().call(chart); + chart.update(); + }); + + legend.dispatch.on('legendDblclick', function(d) { + //Double clicking should always enable current series, and disabled all others. + data.forEach(function(d) { + d.disabled = true; + }); + d.disabled = false; + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + chart.update(); + }); + + +/* + legend.dispatch.on('legendMouseover', function(d, i) { + d.hover = true; + selection.transition().call(chart) + }); + + legend.dispatch.on('legendMouseout', function(d, i) { + d.hover = false; + selection.transition().call(chart) + }); +*/ + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + chart.update(); + }); + + //============================================================ + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.lines = lines; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate'); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} + +nv.models.linePlusBarChart = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var lines = nv.models.line() + , bars = nv.models.historicalBar() + , xAxis = nv.models.axis() + , y1Axis = nv.models.axis() + , y2Axis = nv.models.axis() + , legend = nv.models.legend() + ; + + var margin = {top: 30, right: 60, bottom: 50, left: 60} + , width = null + , height = null + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , color = nv.utils.defaultColor() + , showLegend = true + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' at ' + x + '

      '; + } + , x + , y1 + , y2 + , state = {} + , defaultState = null + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + ; + + bars + .padData(true) + ; + lines + .clipEdge(false) + .padData(true) + ; + xAxis + .orient('bottom') + .tickPadding(7) + .highlightZero(false) + ; + y1Axis + .orient('left') + ; + y2Axis + .orient('right') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)), + y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + } + ; + + //------------------------------------------------------------ + + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().call(chart); }; + // chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + var dataBars = data.filter(function(d) { return !d.disabled && d.bar }); + var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240 + + //x = xAxis.scale(); + x = dataLines.filter(function(d) { return !d.disabled; }).length && dataLines.filter(function(d) { return !d.disabled; })[0].values.length ? lines.xScale() : bars.xScale(); + //x = dataLines.filter(function(d) { return !d.disabled; }).length ? lines.xScale() : bars.xScale(); //old code before change above + y1 = bars.yScale(); + y2 = lines.yScale(); + + //------------------------------------------------------------ + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = d3.select(this).selectAll('g.nv-wrap.nv-linePlusBar').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-linePlusBar').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y1 nv-axis'); + gEnter.append('g').attr('class', 'nv-y2 nv-axis'); + gEnter.append('g').attr('class', 'nv-barsWrap'); + gEnter.append('g').attr('class', 'nv-linesWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width( availableWidth / 2 ); + + g.select('.nv-legendWrap') + .datum(data.map(function(series) { + series.originalKey = series.originalKey === undefined ? series.key : series.originalKey; + series.key = series.originalKey + (series.bar ? ' (left axis)' : ' (right axis)'); + return series; + })) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Main Chart Component(s) + + + lines + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && !data[i].bar })) + + bars + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && data[i].bar })) + + + + var barsWrap = g.select('.nv-barsWrap') + .datum(dataBars.length ? dataBars : [{values:[]}]) + + var linesWrap = g.select('.nv-linesWrap') + .datum(dataLines[0] && !dataLines[0].disabled ? dataLines : [{values:[]}] ); + //.datum(!dataLines[0].disabled ? dataLines : [{values:dataLines[0].values.map(function(d) { return [d[0], null] }) }] ); + + d3.transition(barsWrap).call(bars); + d3.transition(linesWrap).call(lines); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y1.range()[0] + ')'); + d3.transition(g.select('.nv-x.nv-axis')) + .call(xAxis); + + + y1Axis + .scale(y1) + .ticks( availableHeight / 36 ) + .tickSize(-availableWidth, 0); + + d3.transition(g.select('.nv-y1.nv-axis')) + .style('opacity', dataBars.length ? 1 : 0) + .call(y1Axis); + + + y2Axis + .scale(y2) + .ticks( availableHeight / 36 ) + .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none + + g.select('.nv-y2.nv-axis') + .style('opacity', dataLines.length ? 1 : 0) + .attr('transform', 'translate(' + availableWidth + ',0)'); + //.attr('transform', 'translate(' + x.range()[1] + ',0)'); + + d3.transition(g.select('.nv-y2.nv-axis')) + .call(y2Axis); + + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + if (!data.filter(function(d) { return !d.disabled }).length) { + data.map(function(d) { + d.disabled = false; + wrap.selectAll('.nv-series').classed('disabled', false); + return d; + }); + } + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + + chart.update(); + }); + + legend.dispatch.on('legendDblclick', function(d) { + //Double clicking should always enable current series, and disabled all others. + data.forEach(function(d) { + d.disabled = true; + }); + d.disabled = false; + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + chart.update(); + }); + + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + chart.update(); + }); + + //============================================================ + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + bars.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + bars.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.legend = legend; + chart.lines = lines; + chart.bars = bars; + chart.xAxis = xAxis; + chart.y1Axis = y1Axis; + chart.y2Axis = y2Axis; + + d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate'); + //TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc. + //d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id'); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + lines.x(_); + bars.x(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + lines.y(_); + bars.y(_); + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} + +nv.models.lineWithFocusChart = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var lines = nv.models.line() + , lines2 = nv.models.line() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , x2Axis = nv.models.axis() + , y2Axis = nv.models.axis() + , legend = nv.models.legend() + , brush = d3.svg.brush() + ; + + var margin = {top: 30, right: 30, bottom: 30, left: 60} + , margin2 = {top: 0, right: 30, bottom: 20, left: 60} + , color = nv.utils.defaultColor() + , width = null + , height = null + , height2 = 100 + , x + , y + , x2 + , y2 + , showLegend = true + , brushExtent = null + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' at ' + x + '

      ' + } + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush') + ; + + lines + .clipEdge(true) + ; + lines2 + .interactive(false) + ; + xAxis + .orient('bottom') + .tickPadding(5) + ; + yAxis + .orient('left') + ; + x2Axis + .orient('bottom') + .tickPadding(5) + ; + y2Axis + .orient('left') + ; + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, null, null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight1 = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom - height2, + availableHeight2 = height2 - margin2.top - margin2.bottom; + + chart.update = function() { container.transition().call(chart) }; + chart.container = this; + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight1 / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = lines.xScale(); + y = lines.yScale(); + x2 = lines2.xScale(); + y2 = lines2.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-lineWithFocusChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineWithFocusChart').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-legendWrap'); + + var focusEnter = gEnter.append('g').attr('class', 'nv-focus'); + focusEnter.append('g').attr('class', 'nv-x nv-axis'); + focusEnter.append('g').attr('class', 'nv-y nv-axis'); + focusEnter.append('g').attr('class', 'nv-linesWrap'); + + var contextEnter = gEnter.append('g').attr('class', 'nv-context'); + contextEnter.append('g').attr('class', 'nv-x nv-axis'); + contextEnter.append('g').attr('class', 'nv-y nv-axis'); + contextEnter.append('g').attr('class', 'nv-linesWrap'); + contextEnter.append('g').attr('class', 'nv-brushBackground'); + contextEnter.append('g').attr('class', 'nv-x nv-brush'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight1 = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom - height2; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')') + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Main Chart Component(s) + + lines + .width(availableWidth) + .height(availableHeight1) + .color( + data + .map(function(d,i) { + return d.color || color(d, i); + }) + .filter(function(d,i) { + return !data[i].disabled; + }) + ); + + lines2 + .defined(lines.defined()) + .width(availableWidth) + .height(availableHeight2) + .color( + data + .map(function(d,i) { + return d.color || color(d, i); + }) + .filter(function(d,i) { + return !data[i].disabled; + }) + ); + + g.select('.nv-context') + .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')') + + var contextLinesWrap = g.select('.nv-context .nv-linesWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + d3.transition(contextLinesWrap).call(lines2); + + //------------------------------------------------------------ + + + /* + var focusLinesWrap = g.select('.nv-focus .nv-linesWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + d3.transition(focusLinesWrap).call(lines); + */ + + + //------------------------------------------------------------ + // Setup Main (Focus) Axes + + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight1, 0); + + yAxis + .scale(y) + .ticks( availableHeight1 / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-focus .nv-x.nv-axis') + .attr('transform', 'translate(0,' + availableHeight1 + ')'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Brush + + brush + .x(x2) + .on('brush', onBrush); + + if (brushExtent) brush.extent(brushExtent); + + var brushBG = g.select('.nv-brushBackground').selectAll('g') + .data([brushExtent || brush.extent()]) + + var brushBGenter = brushBG.enter() + .append('g'); + + brushBGenter.append('rect') + .attr('class', 'left') + .attr('x', 0) + .attr('y', 0) + .attr('height', availableHeight2); + + brushBGenter.append('rect') + .attr('class', 'right') + .attr('x', 0) + .attr('y', 0) + .attr('height', availableHeight2); + + gBrush = g.select('.nv-x.nv-brush') + .call(brush); + gBrush.selectAll('rect') + //.attr('y', -5) + .attr('height', availableHeight2); + gBrush.selectAll('.resize').append('path').attr('d', resizePath); + + onBrush(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Secondary (Context) Axes + + x2Axis + .scale(x2) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight2, 0); + + g.select('.nv-context .nv-x.nv-axis') + .attr('transform', 'translate(0,' + y2.range()[0] + ')'); + d3.transition(g.select('.nv-context .nv-x.nv-axis')) + .call(x2Axis); + + + y2Axis + .scale(y2) + .ticks( availableHeight2 / 36 ) + .tickSize( -availableWidth, 0); + + d3.transition(g.select('.nv-context .nv-y.nv-axis')) + .call(y2Axis); + + g.select('.nv-context .nv-x.nv-axis') + .attr('transform', 'translate(0,' + y2.range()[0] + ')'); + + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + if (!data.filter(function(d) { return !d.disabled }).length) { + data.map(function(d) { + d.disabled = false; + wrap.selectAll('.nv-series').classed('disabled', false); + return d; + }); + } + + container.transition().call(chart); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + //============================================================ + + + //============================================================ + // Functions + //------------------------------------------------------------ + + // Taken from crossfilter (http://square.github.com/crossfilter/) + function resizePath(d) { + var e = +(d == 'e'), + x = e ? 1 : -1, + y = availableHeight2 / 3; + return 'M' + (.5 * x) + ',' + y + + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6) + + 'V' + (2 * y - 6) + + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y) + + 'Z' + + 'M' + (2.5 * x) + ',' + (y + 8) + + 'V' + (2 * y - 8) + + 'M' + (4.5 * x) + ',' + (y + 8) + + 'V' + (2 * y - 8); + } + + + function updateBrushBG() { + if (!brush.empty()) brush.extent(brushExtent); + brushBG + .data([brush.empty() ? x2.domain() : brushExtent]) + .each(function(d,i) { + var leftWidth = x2(d[0]) - x.range()[0], + rightWidth = x.range()[1] - x2(d[1]); + d3.select(this).select('.left') + .attr('width', leftWidth < 0 ? 0 : leftWidth); + + d3.select(this).select('.right') + .attr('x', x2(d[1])) + .attr('width', rightWidth < 0 ? 0 : rightWidth); + }); + } + + + function onBrush() { + brushExtent = brush.empty() ? null : brush.extent(); + extent = brush.empty() ? x2.domain() : brush.extent(); + + + dispatch.brush({extent: extent, brush: brush}); + + + updateBrushBG(); + + // Update Main (Focus) + var focusLinesWrap = g.select('.nv-focus .nv-linesWrap') + .datum( + data + .filter(function(d) { return !d.disabled }) + .map(function(d,i) { + return { + key: d.key, + values: d.values.filter(function(d,i) { + return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1]; + }) + } + }) + ); + d3.transition(focusLinesWrap).call(lines); + + + // Update Main (Focus) Axes + d3.transition(g.select('.nv-focus .nv-x.nv-axis')) + .call(xAxis); + d3.transition(g.select('.nv-focus .nv-y.nv-axis')) + .call(yAxis); + } + + //============================================================ + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.legend = legend; + chart.lines = lines; + chart.lines2 = lines2; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + chart.x2Axis = x2Axis; + chart.y2Axis = y2Axis; + + d3.rebind(chart, lines, 'defined', 'isArea', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id'); + + chart.x = function(_) { + if (!arguments.length) return lines.x; + lines.x(_); + lines2.x(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return lines.y; + lines.y(_); + lines2.y(_); + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.margin2 = function(_) { + if (!arguments.length) return margin2; + margin2 = _; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.height2 = function(_) { + if (!arguments.length) return height2; + height2 = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color =nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.interpolate = function(_) { + if (!arguments.length) return lines.interpolate(); + lines.interpolate(_); + lines2.interpolate(_); + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + // Chart has multiple similar Axes, to prevent code duplication, probably need to link all axis functions manually like below + chart.xTickFormat = function(_) { + if (!arguments.length) return xAxis.tickFormat(); + xAxis.tickFormat(_); + x2Axis.tickFormat(_); + return chart; + }; + + chart.yTickFormat = function(_) { + if (!arguments.length) return yAxis.tickFormat(); + yAxis.tickFormat(_); + y2Axis.tickFormat(_); + return chart; + }; + + //============================================================ + + + return chart; +} + +nv.models.linePlusBarWithFocusChart = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var lines = nv.models.line() + , lines2 = nv.models.line() + , bars = nv.models.historicalBar() + , bars2 = nv.models.historicalBar() + , xAxis = nv.models.axis() + , x2Axis = nv.models.axis() + , y1Axis = nv.models.axis() + , y2Axis = nv.models.axis() + , y3Axis = nv.models.axis() + , y4Axis = nv.models.axis() + , legend = nv.models.legend() + , brush = d3.svg.brush() + ; + + var margin = {top: 30, right: 30, bottom: 30, left: 60} + , margin2 = {top: 0, right: 30, bottom: 20, left: 60} + , width = null + , height = null + , height2 = 100 + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , color = nv.utils.defaultColor() + , showLegend = true + , extent + , brushExtent = null + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' at ' + x + '

      '; + } + , x + , x2 + , y1 + , y2 + , y3 + , y4 + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush') + ; + + lines + .clipEdge(true) + ; + lines2 + .interactive(false) + ; + xAxis + .orient('bottom') + .tickPadding(5) + ; + y1Axis + .orient('left') + ; + y2Axis + .orient('right') + ; + x2Axis + .orient('bottom') + .tickPadding(5) + ; + y3Axis + .orient('left') + ; + y4Axis + .orient('right') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + if (extent) { + e.pointIndex += Math.ceil(extent[0]); + } + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)), + y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + //------------------------------------------------------------ + + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight1 = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom - height2, + availableHeight2 = height2 - margin2.top - margin2.bottom; + + chart.update = function() { container.transition().call(chart); }; + chart.container = this; + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight1 / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + var dataBars = data.filter(function(d) { return !d.disabled && d.bar }); + var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240 + + x = bars.xScale(); + x2 = x2Axis.scale(); + y1 = bars.yScale(); + y2 = lines.yScale(); + y3 = bars2.yScale(); + y4 = lines2.yScale(); + + var series1 = data + .filter(function(d) { return !d.disabled && d.bar }) + .map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i) } + }) + }); + + var series2 = data + .filter(function(d) { return !d.disabled && !d.bar }) + .map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i) } + }) + }); + + x .range([0, availableWidth]); + + x2 .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } )) + .range([0, availableWidth]); + + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-linePlusBar').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-linePlusBar').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-legendWrap'); + + var focusEnter = gEnter.append('g').attr('class', 'nv-focus'); + focusEnter.append('g').attr('class', 'nv-x nv-axis'); + focusEnter.append('g').attr('class', 'nv-y1 nv-axis'); + focusEnter.append('g').attr('class', 'nv-y2 nv-axis'); + focusEnter.append('g').attr('class', 'nv-barsWrap'); + focusEnter.append('g').attr('class', 'nv-linesWrap'); + + var contextEnter = gEnter.append('g').attr('class', 'nv-context'); + contextEnter.append('g').attr('class', 'nv-x nv-axis'); + contextEnter.append('g').attr('class', 'nv-y1 nv-axis'); + contextEnter.append('g').attr('class', 'nv-y2 nv-axis'); + contextEnter.append('g').attr('class', 'nv-barsWrap'); + contextEnter.append('g').attr('class', 'nv-linesWrap'); + contextEnter.append('g').attr('class', 'nv-brushBackground'); + contextEnter.append('g').attr('class', 'nv-x nv-brush'); + + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width( availableWidth / 2 ); + + g.select('.nv-legendWrap') + .datum(data.map(function(series) { + series.originalKey = series.originalKey === undefined ? series.key : series.originalKey; + series.key = series.originalKey + (series.bar ? ' (left axis)' : ' (right axis)'); + return series; + })) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight1 = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom - height2; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Context Components + + bars2 + .width(availableWidth) + .height(availableHeight2) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && data[i].bar })); + + lines2 + .width(availableWidth) + .height(availableHeight2) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && !data[i].bar })); + + var bars2Wrap = g.select('.nv-context .nv-barsWrap') + .datum(dataBars.length ? dataBars : [{values:[]}]); + + var lines2Wrap = g.select('.nv-context .nv-linesWrap') + .datum(!dataLines[0].disabled ? dataLines : [{values:[]}]); + + g.select('.nv-context') + .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')') + + d3.transition(bars2Wrap).call(bars2); + d3.transition(lines2Wrap).call(lines2); + + //------------------------------------------------------------ + + + + //------------------------------------------------------------ + // Setup Brush + + brush + .x(x2) + .on('brush', onBrush); + + if (brushExtent) brush.extent(brushExtent); + + var brushBG = g.select('.nv-brushBackground').selectAll('g') + .data([brushExtent || brush.extent()]) + + var brushBGenter = brushBG.enter() + .append('g'); + + brushBGenter.append('rect') + .attr('class', 'left') + .attr('x', 0) + .attr('y', 0) + .attr('height', availableHeight2); + + brushBGenter.append('rect') + .attr('class', 'right') + .attr('x', 0) + .attr('y', 0) + .attr('height', availableHeight2); + + var gBrush = g.select('.nv-x.nv-brush') + .call(brush); + gBrush.selectAll('rect') + //.attr('y', -5) + .attr('height', availableHeight2); + gBrush.selectAll('.resize').append('path').attr('d', resizePath); + + //------------------------------------------------------------ + + //------------------------------------------------------------ + // Setup Secondary (Context) Axes + + x2Axis + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight2, 0); + + g.select('.nv-context .nv-x.nv-axis') + .attr('transform', 'translate(0,' + y3.range()[0] + ')'); + d3.transition(g.select('.nv-context .nv-x.nv-axis')) + .call(x2Axis); + + + y3Axis + .scale(y3) + .ticks( availableHeight2 / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-context .nv-y1.nv-axis') + .style('opacity', dataBars.length ? 1 : 0) + .attr('transform', 'translate(0,' + x2.range()[0] + ')'); + + d3.transition(g.select('.nv-context .nv-y1.nv-axis')) + .call(y3Axis); + + + y4Axis + .scale(y4) + .ticks( availableHeight2 / 36 ) + .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none + + g.select('.nv-context .nv-y2.nv-axis') + .style('opacity', dataLines.length ? 1 : 0) + .attr('transform', 'translate(' + x2.range()[1] + ',0)'); + + d3.transition(g.select('.nv-context .nv-y2.nv-axis')) + .call(y4Axis); + + //------------------------------------------------------------ + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + if (!data.filter(function(d) { return !d.disabled }).length) { + data.map(function(d) { + d.disabled = false; + wrap.selectAll('.nv-series').classed('disabled', false); + return d; + }); + } + + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + //============================================================ + + + //============================================================ + // Functions + //------------------------------------------------------------ + + // Taken from crossfilter (http://square.github.com/crossfilter/) + function resizePath(d) { + var e = +(d == 'e'), + x = e ? 1 : -1, + y = availableHeight2 / 3; + return 'M' + (.5 * x) + ',' + y + + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6) + + 'V' + (2 * y - 6) + + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y) + + 'Z' + + 'M' + (2.5 * x) + ',' + (y + 8) + + 'V' + (2 * y - 8) + + 'M' + (4.5 * x) + ',' + (y + 8) + + 'V' + (2 * y - 8); + } + + + function updateBrushBG() { + if (!brush.empty()) brush.extent(brushExtent); + brushBG + .data([brush.empty() ? x2.domain() : brushExtent]) + .each(function(d,i) { + var leftWidth = x2(d[0]) - x2.range()[0], + rightWidth = x2.range()[1] - x2(d[1]); + d3.select(this).select('.left') + .attr('width', leftWidth < 0 ? 0 : leftWidth); + + d3.select(this).select('.right') + .attr('x', x2(d[1])) + .attr('width', rightWidth < 0 ? 0 : rightWidth); + }); + } + + + function onBrush() { + brushExtent = brush.empty() ? null : brush.extent(); + extent = brush.empty() ? x2.domain() : brush.extent(); + + + dispatch.brush({extent: extent, brush: brush}); + + updateBrushBG(); + + + //------------------------------------------------------------ + // Prepare Main (Focus) Bars and Lines + + bars + .width(availableWidth) + .height(availableHeight1) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && data[i].bar })); + + + lines + .width(availableWidth) + .height(availableHeight1) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && !data[i].bar })); + + var focusBarsWrap = g.select('.nv-focus .nv-barsWrap') + .datum(!dataBars.length ? [{values:[]}] : + dataBars + .map(function(d,i) { + return { + key: d.key, + values: d.values.filter(function(d,i) { + return bars.x()(d,i) >= extent[0] && bars.x()(d,i) <= extent[1]; + }) + } + }) + ); + + var focusLinesWrap = g.select('.nv-focus .nv-linesWrap') + .datum(dataLines[0].disabled ? [{values:[]}] : + dataLines + .map(function(d,i) { + return { + key: d.key, + values: d.values.filter(function(d,i) { + return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1]; + }) + } + }) + ); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Update Main (Focus) X Axis + + if (dataBars.length) { + x = bars.xScale(); + } else { + x = lines.xScale(); + } + + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight1, 0); + + xAxis.domain([Math.ceil(extent[0]), Math.floor(extent[1])]); + + d3.transition(g.select('.nv-x.nv-axis')) + .call(xAxis); + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Update Main (Focus) Bars and Lines + + d3.transition(focusBarsWrap).call(bars); + d3.transition(focusLinesWrap).call(lines); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup and Update Main (Focus) Y Axes + + g.select('.nv-focus .nv-x.nv-axis') + .attr('transform', 'translate(0,' + y1.range()[0] + ')'); + + + y1Axis + .scale(y1) + .ticks( availableHeight1 / 36 ) + .tickSize(-availableWidth, 0); + + g.select('.nv-focus .nv-y1.nv-axis') + .style('opacity', dataBars.length ? 1 : 0); + + + y2Axis + .scale(y2) + .ticks( availableHeight1 / 36 ) + .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none + + g.select('.nv-focus .nv-y2.nv-axis') + .style('opacity', dataLines.length ? 1 : 0) + .attr('transform', 'translate(' + x.range()[1] + ',0)'); + + d3.transition(g.select('.nv-focus .nv-y1.nv-axis')) + .call(y1Axis); + d3.transition(g.select('.nv-focus .nv-y2.nv-axis')) + .call(y2Axis); + } + + //============================================================ + + onBrush(); + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + bars.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + bars.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.legend = legend; + chart.lines = lines; + chart.lines2 = lines2; + chart.bars = bars; + chart.bars2 = bars2; + chart.xAxis = xAxis; + chart.x2Axis = x2Axis; + chart.y1Axis = y1Axis; + chart.y2Axis = y2Axis; + chart.y3Axis = y3Axis; + chart.y4Axis = y4Axis; + + d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate'); + //TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc. + //d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id'); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + lines.x(_); + bars.x(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + lines.y(_); + bars.y(_); + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.brushExtent = function(_) { + if (!arguments.length) return brushExtent; + brushExtent = _; + return chart; + }; + + + //============================================================ + + + return chart; +} + +nv.models.multiBar = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , x = d3.scale.ordinal() + , y = d3.scale.linear() + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove + , clipEdge = true + , stacked = false + , color = nv.utils.defaultColor() + , hideable = false + , barColor = null // adding the ability to set the color for each rather than the whole group + , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled + , delay = 1200 + , drawTime = 500 + , xDomain + , yDomain + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0 //used to store previous scales + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + if(hideable && data.length) hideable = [{ + values: data[0].values.map(function(d) { + return { + x: d.x, + y: 0, + series: d.series, + size: 0.01 + };} + )}]; + + if (stacked) + data = d3.layout.stack() + .offset('zero') + .values(function(d){ return d.values }) + .y(getY) + (!data.length && hideable ? hideable : data); + + + //add series index to each data point for reference + data = data.map(function(series, i) { + series.values = series.values.map(function(point) { + point.series = i; + return point; + }); + return series; + }); + + + //------------------------------------------------------------ + // HACK for negative value stacking + if (stacked) + data[0].values.map(function(d,i) { + var posBase = 0, negBase = 0; + data.map(function(d) { + var f = d.values[i] + f.size = Math.abs(f.y); + if (f.y<0) { + f.y1 = negBase; + negBase = negBase - f.size; + } else + { + f.y1 = f.size + posBase; + posBase = posBase + f.size; + } + }); + }); + + //------------------------------------------------------------ + // Setup Scales + + // remap and flatten the data for use in calculating the scales' domains + var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate + data.map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1 } + }) + }); + + x .domain(d3.merge(seriesData).map(function(d) { return d.x })) + .rangeBands([0, availableWidth], .1); + + //y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y1 : 0) }).concat(forceY))) + y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 : d.y1 + d.y ) : d.y }).concat(forceY))) + .range([availableHeight, 0]); + + // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point + if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true; + if (x.domain()[0] === x.domain()[1]) + x.domain()[0] ? + x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) + : x.domain([-1,1]); + + if (y.domain()[0] === y.domain()[1]) + y.domain()[0] ? + y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01]) + : y.domain([-1,1]); + + + x0 = x0 || x; + y0 = y0 || y; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-multibar').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibar'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + gEnter.append('g').attr('class', 'nv-groups'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + defsEnter.append('clipPath') + .attr('id', 'nv-edge-clip-' + id) + .append('rect'); + wrap.select('#nv-edge-clip-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); + + + + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d) { return d.key }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + + + groups.exit() + .selectAll('rect.nv-bar') + .transition() + .delay(function(d,i) { return i * delay/ data[0].values.length }) + .attr('y', function(d) { return stacked ? y0(d.y0) : y0(0) }) + .attr('height', 0) + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }) + .style('fill', function(d,i){ return color(d, i) }) + .style('stroke', function(d,i){ return color(d, i) }); + d3.transition(groups) + .style('stroke-opacity', 1) + .style('fill-opacity', .75); + + + var bars = groups.selectAll('rect.nv-bar') + .data(function(d) { return (hideable && !data.length) ? hideable.values : d.values }); + + bars.exit().remove(); + + + var barsEnter = bars.enter().append('rect') + .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'}) + .attr('x', function(d,i,j) { + return stacked ? 0 : (j * x.rangeBand() / data.length ) + }) + .attr('y', function(d) { return y0(stacked ? d.y0 : 0) }) + .attr('height', 0) + .attr('width', x.rangeBand() / (stacked ? 1 : data.length) ); + bars + .style('fill', function(d,i,j){ return color(d, j, i); }) + .style('stroke', function(d,i,j){ return color(d, j, i); }) + .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('mouseout', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + value: getY(d,i), + point: d, + series: data[d.series], + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('click', function(d,i) { + dispatch.elementClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + dispatch.elementDblClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }); + bars + .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'}) + .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; }) + + if (barColor) { + if (!disabled) disabled = data.map(function() { return true }); + bars + //.style('fill', barColor) + //.style('stroke', barColor) + //.style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker(j).toString(); }) + //.style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker(j).toString(); }) + .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); }) + .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); }); + } + + + if (stacked) + bars.transition() + + .delay(function(d,i) { return i * delay / data[0].values.length }) + .attr('y', function(d,i) { + + return y((stacked ? d.y1 : 0)); + }) + .attr('height', function(d,i) { + if(d.y == null) return 0; + return Math.max(Math.abs(y(d.y + (stacked ? d.y0 : 0)) - y((stacked ? d.y0 : 0))),1); + }) + .each('end', function() { + d3.select(this).transition().duration(drawTime) + .attr('x', function(d,i) { + return stacked ? 0 : (d.series * x.rangeBand() / data.length ) + }) + .attr('width', x.rangeBand() / (stacked ? 1 : data.length) ); + }) + else + d3.transition(bars).duration(drawTime) + .delay(function(d,i) { return i * delay/ data[0].values.length }) + .attr('x', function(d,i) { + return d.series * x.rangeBand() / data.length + }) + .attr('width', x.rangeBand() / data.length) + .each('end', function() { + d3.select(this).transition().duration(drawTime) + .attr('y', function(d,i) { + return getY(d,i) < 0 ? + y(0) : + y(0) - y(getY(d,i)) < 1 ? + y(0) - 1 : + y(getY(d,i)) || 0; + }) + .attr('height', function(d,i) { + if(d.y == null) return 0; + return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) || 0; + }); + }) + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.stacked = function(_) { + if (!arguments.length) return stacked; + stacked = _; + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.barColor = function(_) { + if (!arguments.length) return barColor; + barColor = nv.utils.getColor(_); + return chart; + }; + + chart.disabled = function(_) { + if (!arguments.length) return disabled; + disabled = _; + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.hideable = function(_) { + if (!arguments.length) return hideable; + hideable = _; + return chart; + }; + + chart.delay = function(_) { + if (!arguments.length) return delay; + delay = _; + return chart; + }; + + chart.drawTime = function(_) { + if (!arguments.length) return drawTime; + drawTime = _; + return chart; + }; + + //============================================================ + + + return chart; +} + +nv.models.multiBarChart = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var multibar = nv.models.multiBar() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + , controls = nv.models.legend() + ; + + var margin = {top: 30, right: 20, bottom: 50, left: 60} + , width = null + , height = null + , color = nv.utils.defaultColor() + , showControls = true + , showLegend = true + , logScale = false + , reduceXTicks = true // if false a tick will show for every data point + , staggerLabels = false + , rotateLabels = 0 + , tooltips = true + , tooltip = function(key, x, y, e, graph, logScale) { + //alert(y+ " " + logScale); + if(logScale) { + var fmt = d3.format(',.2f'); + return '

      ' + key + '

      ' + + '

      ' + fmt(Math.pow(10,y)) + ' on ' + x + '

      ' + } else { + return '

      ' + key + '

      ' + + '

      ' + y + ' on ' + x + '

      ' + } + + } + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , state = { stacked: false } + , defaultState = null + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , controlWidth = function() { return showControls ? 180 : 0 } + ; + multibar + .stacked(false) + ; + xAxis + .orient('bottom') + .tickPadding(7) + .highlightZero(true) + .showMaxMin(false) + .tickFormat(function(d) { return d }) + ; + yAxis + .orient('left') + .tickFormat(d3.format(',.1f')) + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart, logScale); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().call(chart) }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + //------------------------------------------------------------ + // Display noData message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = multibar.xScale(); + y = multibar.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-multiBarWithLegend').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarWithLegend').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-barsWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth - controlWidth()); + + if (multibar.barColor()) + data.forEach(function(series,i) { + series.color = d3.rgb('#ccc').darker(i * 1.5).toString(); + }) + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + var controlsData = [ + { key: 'Grouped', disabled: multibar.stacked() }, + { key: 'Stacked', disabled: !multibar.stacked() } + ]; + + controls.width(controlWidth()).color(['#444', '#444', '#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Main Chart Component(s) + + multibar + .disabled(data.map(function(series) { return series.disabled })) + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })) + + + var barsWrap = g.select('.nv-barsWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + d3.transition(barsWrap).call(multibar); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')'); + d3.transition(g.select('.nv-x.nv-axis')) + .call(xAxis); + + var xTicks = g.select('.nv-x.nv-axis > g').selectAll('g'); + + xTicks + .selectAll('line, text') + .style('opacity', 1) + + if (staggerLabels) { + var getTranslate = function(x,y) { + return "translate(" + x + "," + y + ")"; + }; + + var staggerUp = 5, staggerDown = 17; //pixels to stagger by + // Issue #140 + xTicks + .selectAll("text") + .attr('transform', function(d,i,j) { + return getTranslate(0, (j % 2 == 0 ? staggerUp : staggerDown)); + }); + + var totalInBetweenTicks = d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length; + g.selectAll(".nv-x.nv-axis .nv-axisMaxMin text") + .attr("transform", function(d,i) { + return getTranslate(0, (i === 0 || totalInBetweenTicks % 2 !== 0) ? staggerDown : staggerUp); + }); + } + + + if (reduceXTicks) + xTicks + .filter(function(d,i) { + return i % Math.ceil(data[0].values.length / (availableWidth / 100)) !== 0; + }) + .selectAll('text, line') + .style('opacity', 0); + + if(rotateLabels) + xTicks + .selectAll('text') + .attr('transform', 'rotate(' + rotateLabels + ' 0,0)') + .attr('text-anchor', rotateLabels > 0 ? 'start' : 'end'); + + g.select('.nv-x.nv-axis').selectAll('g.nv-axisMaxMin text') + .style('opacity', 1); + + yAxis + .scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + d3.transition(g.select('.nv-y.nv-axis')) + .call(yAxis); + + //------------------------------------------------------------ + + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + if (!data.filter(function(d) { return !d.disabled }).length) { + data.map(function(d) { + d.disabled = false; + wrap.selectAll('.nv-series').classed('disabled', false); + return d; + }); + } + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + + chart.update(); + }); + + legend.dispatch.on('legendDblclick', function(d) { + //Double clicking should always enable current series, and disabled all others. + data.forEach(function(d) { + d.disabled = true; + }); + d.disabled = false; + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + chart.update(); + }); + + + controls.dispatch.on('legendClick', function(d,i) { + if (!d.disabled) return; + controlsData = controlsData.map(function(s) { + s.disabled = true; + return s; + }); + d.disabled = false; + + switch (d.key) { + case 'Grouped': + multibar.stacked(false); + break; + case 'Stacked': + multibar.stacked(true); + break; + } + + state.stacked = multibar.stacked(); + dispatch.stateChange(state); + + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode) + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + if (typeof e.stacked !== 'undefined') { + multibar.stacked(e.stacked); + state.stacked = e.stacked; + } + + chart.update(); + }); + + //============================================================ + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + multibar.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + multibar.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.multibar = multibar; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'forceX', 'forceY', 'clipEdge', 'id', 'stacked', 'delay', 'barColor'); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.logScale = function(_) { + if (!arguments.length) return logScale; + logScale = _; + return chart; + }; + + chart.reduceXTicks= function(_) { + if (!arguments.length) return reduceXTicks; + reduceXTicks = _; + return chart; + }; + + chart.rotateLabels = function(_) { + if (!arguments.length) return rotateLabels; + rotateLabels = _; + return chart; + } + + chart.staggerLabels = function(_) { + if (!arguments.length) return staggerLabels; + staggerLabels = _; + return chart; + }; + + chart.tooltip = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} + +nv.models.multiBarHorizontal = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , x = d3.scale.ordinal() + , y = d3.scale.linear() + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove + , color = nv.utils.defaultColor() + , barColor = null // adding the ability to set the color for each rather than the whole group + , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled + , stacked = false + , showValues = false + , valuePadding = 60 + , valueFormat = d3.format(',.2f') + , delay = 1200 + , xDomain + , yDomain + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0 //used to store previous scales + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + + if (stacked) + data = d3.layout.stack() + .offset('zero') + .values(function(d){ return d.values }) + .y(getY) + (data); + + + //add series index to each data point for reference + data = data.map(function(series, i) { + series.values = series.values.map(function(point) { + point.series = i; + return point; + }); + return series; + }); + + + + //------------------------------------------------------------ + // HACK for negative value stacking + if (stacked) + data[0].values.map(function(d,i) { + var posBase = 0, negBase = 0; + data.map(function(d) { + var f = d.values[i] + f.size = Math.abs(f.y); + if (f.y<0) { + f.y1 = negBase - f.size; + negBase = negBase - f.size; + } else + { + f.y1 = posBase; + posBase = posBase + f.size; + } + }); + }); + + + + //------------------------------------------------------------ + // Setup Scales + + // remap and flatten the data for use in calculating the scales' domains + var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate + data.map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1 } + }) + }); + + x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x })) + .rangeBands([0, availableHeight], .1); + + //y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y0 : 0) }).concat(forceY))) + y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 + d.y : d.y1 ) : d.y }).concat(forceY))) + + if (showValues && !stacked) + y.range([(y.domain()[0] < 0 ? valuePadding : 0), availableWidth - (y.domain()[1] > 0 ? valuePadding : 0) ]); + else + y.range([0, availableWidth]); + + x0 = x0 || x; + y0 = y0 || d3.scale.linear().domain(y.domain()).range([y(0),y(0)]); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = d3.select(this).selectAll('g.nv-wrap.nv-multibarHorizontal').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibarHorizontal'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-groups'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d) { return d.key }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + d3.transition(groups.exit()) + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6) + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }) + .style('fill', function(d,i){ return color(d, i) }) + .style('stroke', function(d,i){ return color(d, i) }); + d3.transition(groups) + .style('stroke-opacity', 1) + .style('fill-opacity', .75); + + + var bars = groups.selectAll('g.nv-bar') + .data(function(d) { return d.values }); + + bars.exit().remove(); + + + var barsEnter = bars.enter().append('g') + .attr('transform', function(d,i,j) { + return 'translate(' + y0(stacked ? d.y0 : 0) + ',' + (stacked ? 0 : (j * x.rangeBand() / data.length ) + x(getX(d,i))) + ')' + }); + + barsEnter.append('rect') + .attr('width', 0) + .attr('height', x.rangeBand() / (stacked ? 1 : data.length) ) + + bars + .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [ y(getY(d,i) + (stacked ? d.y0 : 0)), x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length) ], + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('mouseout', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + value: getY(d,i), + point: d, + series: data[d.series], + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('click', function(d,i) { + dispatch.elementClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + dispatch.elementDblClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }); + + + barsEnter.append('text'); + + if (showValues && !stacked) { + bars.select('text') + .attr('text-anchor', function(d,i) { return getY(d,i) < 0 ? 'end' : 'start' }) + .attr('y', x.rangeBand() / (data.length * 2)) + .attr('dy', '.32em') + .text(function(d,i) { return valueFormat(getY(d,i)) }) + d3.transition(bars) + //.delay(function(d,i) { return i * delay / data[0].values.length }) + .select('text') + .attr('x', function(d,i) { return getY(d,i) < 0 ? -4 : y(getY(d,i)) - y(0) + 4 }) + } else { + //bars.selectAll('text').remove(); + bars.selectAll('text').text(''); + } + + bars + .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'}) + + if (barColor) { + if (!disabled) disabled = data.map(function() { return true }); + bars + //.style('fill', barColor) + //.style('stroke', barColor) + //.style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker(j).toString(); }) + //.style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker(j).toString(); }) + .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); }) + .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); }); + } + + if (stacked) + d3.transition(bars) + //.delay(function(d,i) { return i * delay / data[0].values.length }) + .attr('transform', function(d,i) { + //return 'translate(' + y(d.y0) + ',0)' + //return 'translate(' + y(d.y0) + ',' + x(getX(d,i)) + ')' + return 'translate(' + y(d.y1) + ',' + x(getX(d,i)) + ')' + }) + .select('rect') + .attr('width', function(d,i) { + return Math.abs(y(getY(d,i) + d.y0) - y(d.y0)) + }) + .attr('height', x.rangeBand() ); + else + d3.transition(bars) + //.delay(function(d,i) { return i * delay / data[0].values.length }) + .attr('transform', function(d,i) { + //TODO: stacked must be all positive or all negative, not both? + return 'translate(' + + (getY(d,i) < 0 ? y(getY(d,i)) : y(0)) + + ',' + + (d.series * x.rangeBand() / data.length + + + x(getX(d,i)) ) + + ')' + }) + .select('rect') + .attr('height', x.rangeBand() / data.length ) + .attr('width', function(d,i) { + return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) + }); + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.stacked = function(_) { + if (!arguments.length) return stacked; + stacked = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.barColor = function(_) { + if (!arguments.length) return barColor; + barColor = nv.utils.getColor(_); + return chart; + }; + + chart.disabled = function(_) { + if (!arguments.length) return disabled; + disabled = _; + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.delay = function(_) { + if (!arguments.length) return delay; + delay = _; + return chart; + }; + + chart.showValues = function(_) { + if (!arguments.length) return showValues; + showValues = _; + return chart; + }; + + chart.valueFormat= function(_) { + if (!arguments.length) return valueFormat; + valueFormat = _; + return chart; + }; + + chart.valuePadding = function(_) { + if (!arguments.length) return valuePadding; + valuePadding = _; + return chart; + }; + + //============================================================ + + + return chart; +} + +nv.models.multiBarHorizontalChart = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var multibar = nv.models.multiBarHorizontal() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend().height(30) + , controls = nv.models.legend().height(30) + ; + + var margin = {top: 30, right: 20, bottom: 50, left: 60} + , width = null + , height = null + , color = nv.utils.defaultColor() + , showControls = true + , showLegend = true + , logScale = false + , stacked = false + , tooltips = true + , tooltip = function(key, x, y, e, graph, logScale) { + //alert(y+ " " + logScale + " " + Math.pow(10,y) + " " + Math.pow(10,y).toFixed(0)); + if(logScale) { + //var fmt = d3.format(',.2f'); + return '

      ' + key + ' - ' + x + '

      ' + + '

      ' + yAxis.tickFormat()(Math.pow(10,y)) + '

      ' + } else { + return '

      ' + key + ' - ' + x + '

      ' + + '

      ' + y + '

      ' + } + + } + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , state = { stacked: stacked } + , defaultState = null + , noData = 'No Data Available.' + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , controlWidth = function() { return showControls ? 180 : 0 } + ; + + multibar + .stacked(stacked) + ; + xAxis + .orient('left') + .tickPadding(5) + .highlightZero(false) + .showMaxMin(false) + .tickFormat(function(d) { return d }) + ; + yAxis + .orient('bottom') + .tickFormat(d3.format(',.1f')) + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + //var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + //alert(offsetElement.offsetLeft + " " + e.pos[0]); + var leftPos = 0; + if(e.pos[0] >=200) leftPos = 200; + else leftPos = e.pos[0]; + if(logScale) + y = multibar.y()(e.point, e.pointIndex); + else + y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)) + var left = leftPos + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart, logScale); + //alert("from tooltip " + multibar.y()(e.point, e.pointIndex)); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().call(chart) }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = multibar.xScale(); + y = multibar.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-multiBarHorizontalChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarHorizontalChart').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-barsWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth - controlWidth()); + + if (multibar.barColor()) + data.forEach(function(series,i) { + series.color = d3.rgb('#ccc').darker(i * 1.5).toString(); + }) + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + var controlsData = [ + { key: 'Grouped', disabled: multibar.stacked() }, + { key: 'Stacked', disabled: !multibar.stacked() } + ]; + + controls.width(controlWidth()).color(['#444', '#444', '#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Main Chart Component(s) + + multibar + .disabled(data.map(function(series) { return series.disabled })) + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })) + + + var barsWrap = g.select('.nv-barsWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + d3.transition(barsWrap).call(multibar); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + xAxis + .scale(x) + .ticks( availableHeight / 24 ) + .tickSize(-availableWidth, 0); + + d3.transition(g.select('.nv-x.nv-axis')) + .call(xAxis); + + var xTicks = g.select('.nv-x.nv-axis').selectAll('g'); + + xTicks + .selectAll('line, text') + .style('opacity', 1) + + + yAxis + .scale(y) + .ticks( availableWidth / 100 ) + .tickSize( -availableHeight, 0); + + g.select('.nv-y.nv-axis') + .attr('transform', 'translate(0,' + availableHeight + ')'); + d3.transition(g.select('.nv-y.nv-axis')) + .call(yAxis); + + //------------------------------------------------------------ + + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + if (!data.filter(function(d) { return !d.disabled }).length) { + data.map(function(d) { + d.disabled = false; + wrap.selectAll('.nv-series').classed('disabled', false); + return d; + }); + } + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + + chart.update(); + }); + + legend.dispatch.on('legendDblclick', function(d) { + //Double clicking should always enable current series, and disabled all others. + data.forEach(function(d) { + d.disabled = true; + }); + d.disabled = false; + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + chart.update(); + }); + + controls.dispatch.on('legendClick', function(d,i) { + if (!d.disabled) return; + controlsData = controlsData.map(function(s) { + s.disabled = true; + return s; + }); + d.disabled = false; + + switch (d.key) { + case 'Grouped': + multibar.stacked(false); + break; + case 'Stacked': + multibar.stacked(true); + break; + } + + state.stacked = multibar.stacked(); + dispatch.stateChange(state); + + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + if (typeof e.stacked !== 'undefined') { + multibar.stacked(e.stacked); + state.stacked = e.stacked; + } + + selection.call(chart); + }); + //============================================================ + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + multibar.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + multibar.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.multibar = multibar; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'forceX', 'forceY', 'clipEdge', 'id', 'delay', 'showValues', 'valueFormat', 'stacked', 'barColor'); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.logScale = function(_) { + if (!arguments.length) return logScale; + logScale = _; + return chart; + }; + + chart.tooltip = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} +nv.models.multiChart = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 30, right: 20, bottom: 50, left: 60}, + color = d3.scale.category20().range(), + width = null, + height = null, + showLegend = true, + tooltips = true, + tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' at ' + x + '

      ' + }, + x, y; //can be accessed via chart.lines.[x/y]Scale() + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x = d3.scale.linear(), + yScale1 = d3.scale.linear(), + yScale2 = d3.scale.linear(), + + lines1 = nv.models.line().yScale(yScale1), + lines2 = nv.models.line().yScale(yScale2), + + bars1 = nv.models.multiBar().stacked(false).yScale(yScale1), + bars2 = nv.models.multiBar().stacked(false).yScale(yScale2), + + stack1 = nv.models.stackedArea().yScale(yScale1), + stack2 = nv.models.stackedArea().yScale(yScale2), + + xAxis = nv.models.axis().scale(x).orient('bottom').tickPadding(5), + yAxis1 = nv.models.axis().scale(yScale1).orient('left'), + yAxis2 = nv.models.axis().scale(yScale2).orient('right'), + + legend = nv.models.legend().height(30), + dispatch = d3.dispatch('tooltipShow', 'tooltipHide'); + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines1.x()(e.point, e.pointIndex)), + y = ((e.series.yAxis == 2) ? yAxis2 : yAxis1).tickFormat()(lines1.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, undefined, undefined, offsetElement.offsetParent); + }; + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + chart.update = function() { container.transition().call(chart); }; + chart.container = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + var dataLines1 = data.filter(function(d) {return !d.disabled && d.type == 'line' && d.yAxis == 1}) + var dataLines2 = data.filter(function(d) {return !d.disabled && d.type == 'line' && d.yAxis == 2}) + var dataBars1 = data.filter(function(d) {return !d.disabled && d.type == 'bar' && d.yAxis == 1}) + var dataBars2 = data.filter(function(d) {return !d.disabled && d.type == 'bar' && d.yAxis == 2}) + var dataStack1 = data.filter(function(d) {return !d.disabled && d.type == 'area' && d.yAxis == 1}) + var dataStack2 = data.filter(function(d) {return !d.disabled && d.type == 'area' && d.yAxis == 2}) + + var series1 = data.filter(function(d) {return !d.disabled && d.yAxis == 1}) + .map(function(d) { + return d.values.map(function(d,i) { + return { x: d.x, y: d.y } + }) + }) + + var series2 = data.filter(function(d) {return !d.disabled && d.yAxis == 2}) + .map(function(d) { + return d.values.map(function(d,i) { + return { x: d.x, y: d.y } + }) + }) + + x .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } )) + .range([0, availableWidth]); + + var wrap = container.selectAll('g.wrap.multiChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'wrap nvd3 multiChart').append('g'); + + gEnter.append('g').attr('class', 'x axis'); + gEnter.append('g').attr('class', 'y1 axis'); + gEnter.append('g').attr('class', 'y2 axis'); + gEnter.append('g').attr('class', 'lines1Wrap'); + gEnter.append('g').attr('class', 'lines2Wrap'); + gEnter.append('g').attr('class', 'bars1Wrap'); + gEnter.append('g').attr('class', 'bars2Wrap'); + gEnter.append('g').attr('class', 'stack1Wrap'); + gEnter.append('g').attr('class', 'stack2Wrap'); + gEnter.append('g').attr('class', 'legendWrap'); + + var g = wrap.select('g'); + + if (showLegend) { + legend.width( availableWidth / 2 ); + + g.select('.legendWrap') + .datum(data.map(function(series) { + series.originalKey = series.originalKey === undefined ? series.key : series.originalKey; + series.key = series.originalKey + (series.yAxis == 1 ? '' : ' (right axis)'); + return series; + })) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.legendWrap') + .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')'); + } + + + lines1 + .width(availableWidth) + .height(availableHeight) + .interpolate("monotone") + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'line'})); + + lines2 + .width(availableWidth) + .height(availableHeight) + .interpolate("monotone") + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'line'})); + + bars1 + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'bar'})); + + bars2 + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'bar'})); + + stack1 + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'area'})); + + stack2 + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'area'})); + + g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + var lines1Wrap = g.select('.lines1Wrap') + .datum(dataLines1) + var bars1Wrap = g.select('.bars1Wrap') + .datum(dataBars1) + var stack1Wrap = g.select('.stack1Wrap') + .datum(dataStack1) + + var lines2Wrap = g.select('.lines2Wrap') + .datum(dataLines2) + var bars2Wrap = g.select('.bars2Wrap') + .datum(dataBars2) + var stack2Wrap = g.select('.stack2Wrap') + .datum(dataStack2) + + var extraValue1 = dataStack1.length ? dataStack1.map(function(a){return a.values}).reduce(function(a,b){ + return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}}) + }).concat([{x:0, y:0}]) : [] + var extraValue2 = dataStack2.length ? dataStack2.map(function(a){return a.values}).reduce(function(a,b){ + return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}}) + }).concat([{x:0, y:0}]) : [] + + yScale1 .domain(d3.extent(d3.merge(series1).concat(extraValue1), function(d) { return d.y } )) + .range([0, availableHeight]) + + yScale2 .domain(d3.extent(d3.merge(series2).concat(extraValue2), function(d) { return d.y } )) + .range([0, availableHeight]) + + lines1.yDomain(yScale1.domain()) + bars1.yDomain(yScale1.domain()) + stack1.yDomain(yScale1.domain()) + + lines2.yDomain(yScale2.domain()) + bars2.yDomain(yScale2.domain()) + stack2.yDomain(yScale2.domain()) + + if(dataStack1.length){d3.transition(stack1Wrap).call(stack1);} + if(dataStack2.length){d3.transition(stack2Wrap).call(stack2);} + + if(dataBars1.length){d3.transition(bars1Wrap).call(bars1);} + if(dataBars2.length){d3.transition(bars2Wrap).call(bars2);} + + if(dataLines1.length){d3.transition(lines1Wrap).call(lines1);} + if(dataLines2.length){d3.transition(lines2Wrap).call(lines2);} + + + + xAxis + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight, 0); + + g.select('.x.axis') + .attr('transform', 'translate(0,' + availableHeight + ')'); + d3.transition(g.select('.x.axis')) + .call(xAxis); + + yAxis1 + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + + d3.transition(g.select('.y1.axis')) + .call(yAxis1); + + yAxis2 + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + d3.transition(g.select('.y2.axis')) + .call(yAxis2); + + g.select('.y2.axis') + .style('opacity', series2.length ? 1 : 0) + .attr('transform', 'translate(' + x.range()[1] + ',0)'); + + legend.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + if (series2.length <= 0) { + if (!data.filter(function(d) { return !d.disabled }).length) { + data.map(function(d) { + d.disabled = false; + wrap.selectAll('.series').classed('disabled', false); + return d; + }); + } + chart.update(); + } + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines1.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines1.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + lines2.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines2.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + bars1.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + bars1.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + bars2.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + bars2.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + stack1.dispatch.on('tooltipShow', function(e) { + //disable tooltips when value ~= 0 + //// TODO: consider removing points from voronoi that have 0 value instead of this hack + if (!Math.round(stack1.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range + setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0); + return false; + } + + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top], + dispatch.tooltipShow(e); + }); + + stack1.dispatch.on('tooltipHide', function(e) { + dispatch.tooltipHide(e); + }); + + stack2.dispatch.on('tooltipShow', function(e) { + //disable tooltips when value ~= 0 + //// TODO: consider removing points from voronoi that have 0 value instead of this hack + if (!Math.round(stack2.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range + setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0); + return false; + } + + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top], + dispatch.tooltipShow(e); + }); + + stack2.dispatch.on('tooltipHide', function(e) { + dispatch.tooltipHide(e); + }); + + lines1.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines1.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + lines2.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines2.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + + + //============================================================ + // Global getters and setters + //------------------------------------------------------------ + + chart.dispatch = dispatch; + chart.lines1 = lines1; + chart.lines2 = lines2; + chart.bars1 = bars1; + chart.bars2 = bars2; + chart.stack1 = stack1; + chart.stack2 = stack2; + chart.xAxis = xAxis; + chart.yAxis1 = yAxis1; + chart.yAxis2 = yAxis2; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + lines1.x(_); + bars1.x(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + lines1.y(_); + bars1.y(_); + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin = _; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = _; + legend.color(_); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + return chart; +} + + +nv.models.ohlcBar = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , x = d3.scale.linear() + , y = d3.scale.linear() + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , getOpen = function(d) { return d.open } + , getClose = function(d) { return d.close } + , getHigh = function(d) { return d.high } + , getLow = function(d) { return d.low } + , forceX = [] + , forceY = [] + , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart + , clipEdge = true + , color = nv.utils.defaultColor() + , xDomain + , yDomain + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + //TODO: store old scales for transitions + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup Scales + + x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) )); + + if (padData) + x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]); + else + x.range([0, availableWidth]); + + y .domain(yDomain || [ + d3.min(data[0].values.map(getLow).concat(forceY)), + d3.max(data[0].values.map(getHigh).concat(forceY)) + ]) + .range([availableHeight, 0]); + + // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point + if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true; + if (x.domain()[0] === x.domain()[1]) + x.domain()[0] ? + x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) + : x.domain([-1,1]); + + if (y.domain()[0] === y.domain()[1]) + y.domain()[0] ? + y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01]) + : y.domain([-1,1]); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = d3.select(this).selectAll('g.nv-wrap.nv-ohlcBar').data([data[0].values]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-ohlcBar'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-ticks'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + container + .on('click', function(d,i) { + dispatch.chartClick({ + data: d, + index: i, + pos: d3.event, + id: id + }); + }); + + + defsEnter.append('clipPath') + .attr('id', 'nv-chart-clip-path-' + id) + .append('rect'); + + wrap.select('#nv-chart-clip-path-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : ''); + + + + var ticks = wrap.select('.nv-ticks').selectAll('.nv-tick') + .data(function(d) { return d }); + + ticks.exit().remove(); + + + var ticksEnter = ticks.enter().append('path') + .attr('class', function(d,i,j) { return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i }) + .attr('d', function(d,i) { + var w = (availableWidth / data[0].values.length) * .9; + return 'm0,0l0,' + + (y(getOpen(d,i)) + - y(getHigh(d,i))) + + 'l' + + (-w/2) + + ',0l' + + (w/2) + + ',0l0,' + + (y(getLow(d,i)) - y(getOpen(d,i))) + + 'l0,' + + (y(getClose(d,i)) + - y(getLow(d,i))) + + 'l' + + (w/2) + + ',0l' + + (-w/2) + + ',0z'; + }) + .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; }) + //.attr('fill', function(d,i) { return color[0]; }) + //.attr('stroke', function(d,i) { return color[0]; }) + //.attr('x', 0 ) + //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) }) + //.attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) }) + .on('mouseover', function(d,i) { + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + point: d, + series: data[0], + pos: [x(getX(d,i)), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: 0, + e: d3.event + }); + + }) + .on('mouseout', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + point: d, + series: data[0], + pointIndex: i, + seriesIndex: 0, + e: d3.event + }); + }) + .on('click', function(d,i) { + dispatch.elementClick({ + //label: d[label], + value: getY(d,i), + data: d, + index: i, + pos: [x(getX(d,i)), y(getY(d,i))], + e: d3.event, + id: id + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + dispatch.elementDblClick({ + //label: d[label], + value: getY(d,i), + data: d, + index: i, + pos: [x(getX(d,i)), y(getY(d,i))], + e: d3.event, + id: id + }); + d3.event.stopPropagation(); + }); + + ticks + .attr('class', function(d,i,j) { return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i }) + d3.transition(ticks) + .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; }) + .attr('d', function(d,i) { + var w = (availableWidth / data[0].values.length) * .9; + return 'm0,0l0,' + + (y(getOpen(d,i)) + - y(getHigh(d,i))) + + 'l' + + (-w/2) + + ',0l' + + (w/2) + + ',0l0,' + + (y(getLow(d,i)) + - y(getOpen(d,i))) + + 'l0,' + + (y(getClose(d,i)) + - y(getLow(d,i))) + + 'l' + + (w/2) + + ',0l' + + (-w/2) + + ',0z'; + }) + //.attr('width', (availableWidth / data[0].values.length) * .9 ) + + + //d3.transition(ticks) + //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) }) + //.attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) }); + //.order(); // not sure if this makes any sense for this model + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + return chart; + }; + + chart.open = function(_) { + if (!arguments.length) return getOpen; + getOpen = _; + return chart; + }; + + chart.close = function(_) { + if (!arguments.length) return getClose; + getClose = _; + return chart; + }; + + chart.high = function(_) { + if (!arguments.length) return getHigh; + getHigh = _; + return chart; + }; + + chart.low = function(_) { + if (!arguments.length) return getLow; + getLow = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.forceX = function(_) { + if (!arguments.length) return forceX; + forceX = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.padData = function(_) { + if (!arguments.length) return padData; + padData = _; + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + //============================================================ + + + return chart; +} +nv.models.pie = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 500 + , height = 500 + , getValues = function(d) { return d.values } + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , getDescription = function(d) { return d.description } + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , color = nv.utils.defaultColor() + , valueFormat = d3.format(',.2f') + , showLabels = true + , pieLabelsOutside = true + , donutLabelsOutside = false + , labelThreshold = .02 //if slice percentage is under this, don't show label + , donut = false + , labelSunbeamLayout = false + , startAngle = false + , endAngle = false + , donutRatio = 0.5 + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + radius = Math.min(availableWidth, availableHeight) / 2, + arcRadius = radius-(radius / 5), + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + //var wrap = container.selectAll('.nv-wrap.nv-pie').data([data]); + var wrap = container.selectAll('.nv-wrap.nv-pie').data([getValues(data[0])]); + var wrapEnter = wrap.enter().append('g').attr('class','nvd3 nv-wrap nv-pie nv-chart-' + id); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-pie'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + g.select('.nv-pie').attr('transform', 'translate(' + availableWidth / 2 + ',' + availableHeight / 2 + ')'); + + //------------------------------------------------------------ + + + container + .on('click', function(d,i) { + dispatch.chartClick({ + data: d, + index: i, + pos: d3.event, + id: id + }); + }); + + + var arc = d3.svg.arc() + .outerRadius(arcRadius); + + if (startAngle) arc.startAngle(startAngle) + if (endAngle) arc.endAngle(endAngle); + if (donut) arc.innerRadius(radius * donutRatio); + + // Setup the Pie chart and choose the data element + var pie = d3.layout.pie() + .sort(null) + .value(function(d) { return d.disabled ? 0 : getY(d) }); + + var slices = wrap.select('.nv-pie').selectAll('.nv-slice') + .data(pie); + + slices.exit().remove(); + + var ae = slices.enter().append('g') + .attr('class', 'nv-slice') + .on('mouseover', function(d,i){ + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + label: getX(d.data), + value: getY(d.data), + point: d.data, + pointIndex: i, + pos: [d3.event.pageX, d3.event.pageY], + id: id + }); + }) + .on('mouseout', function(d,i){ + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + label: getX(d.data), + value: getY(d.data), + point: d.data, + index: i, + id: id + }); + }) + .on('click', function(d,i) { + dispatch.elementClick({ + label: getX(d.data), + value: getY(d.data), + point: d.data, + index: i, + pos: d3.event, + id: id + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + dispatch.elementDblClick({ + label: getX(d.data), + value: getY(d.data), + point: d.data, + index: i, + pos: d3.event, + id: id + }); + d3.event.stopPropagation(); + }); + + slices + .attr('fill', function(d,i) { return color(d, i); }) + .attr('stroke', function(d,i) { return color(d, i); }); + + var paths = ae.append('path') + .each(function(d) { this._current = d; }); + //.attr('d', arc); + + d3.transition(slices.select('path')) + .attr('d', arc) + .attrTween('d', arcTween); + + if (showLabels) { + // This does the normal label + var labelsArc = d3.svg.arc().innerRadius(0); + + if (pieLabelsOutside){ labelsArc = arc; } + + if (donutLabelsOutside) { labelsArc = d3.svg.arc().outerRadius(arc.outerRadius()); } + + ae.append("g").classed("nv-label", true) + .each(function(d, i) { + var group = d3.select(this); + + group + .attr('transform', function(d) { + if (labelSunbeamLayout) { + d.outerRadius = arcRadius + 10; // Set Outer Coordinate + d.innerRadius = arcRadius + 15; // Set Inner Coordinate + var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI); + if ((d.startAngle+d.endAngle)/2 < Math.PI) { + rotateAngle -= 90; + } else { + rotateAngle += 90; + } + return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')'; + } else { + d.outerRadius = radius + 10; // Set Outer Coordinate + d.innerRadius = radius + 15; // Set Inner Coordinate + return 'translate(' + labelsArc.centroid(d) + ')' + } + }); + + group.append('rect') + .style('stroke', '#fff') + .style('fill', '#fff') + .attr("rx", 3) + .attr("ry", 3); + + group.append('text') + .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned + .style('fill', '#000') + + + }); + + slices.select(".nv-label").transition() + .attr('transform', function(d) { + if (labelSunbeamLayout) { + d.outerRadius = arcRadius + 10; // Set Outer Coordinate + d.innerRadius = arcRadius + 15; // Set Inner Coordinate + var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI); + if ((d.startAngle+d.endAngle)/2 < Math.PI) { + rotateAngle -= 90; + } else { + rotateAngle += 90; + } + return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')'; + } else { + d.outerRadius = radius + 10; // Set Outer Coordinate + d.innerRadius = radius + 15; // Set Inner Coordinate + return 'translate(' + labelsArc.centroid(d) + ')' + } + }); + + slices.each(function(d, i) { + var slice = d3.select(this); + + slice + .select(".nv-label text") + .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned + .text(function(d, i) { + var percent = (d.endAngle - d.startAngle) / (2 * Math.PI); + return (d.value && percent > labelThreshold) ? getX(d.data) : ''; + }); + + var textBox = slice.select('text').node().getBBox(); + slice.select(".nv-label rect") + .attr("width", textBox.width + 10) + .attr("height", textBox.height + 10) + .attr("transform", function() { + return "translate(" + [textBox.x - 5, textBox.y - 5] + ")"; + }); + }); + } + + + // Computes the angle of an arc, converting from radians to degrees. + function angle(d) { + var a = (d.startAngle + d.endAngle) * 90 / Math.PI - 90; + return a > 90 ? a - 180 : a; + } + + function arcTween(a) { + a.endAngle = isNaN(a.endAngle) ? 0 : a.endAngle; + a.startAngle = isNaN(a.startAngle) ? 0 : a.startAngle; + if (!donut) a.innerRadius = 0; + var i = d3.interpolate(this._current, a); + this._current = i(0); + return function(t) { + return arc(i(t)); + }; + } + + function tweenPie(b) { + b.innerRadius = 0; + var i = d3.interpolate({startAngle: 0, endAngle: 0}, b); + return function(t) { + return arc(i(t)); + }; + } + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.values = function(_) { + if (!arguments.length) return getValues; + getValues = _; + return chart; + }; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = d3.functor(_); + return chart; + }; + + chart.description = function(_) { + if (!arguments.length) return getDescription; + getDescription = _; + return chart; + }; + + chart.showLabels = function(_) { + if (!arguments.length) return showLabels; + showLabels = _; + return chart; + }; + + chart.labelSunbeamLayout = function(_) { + if (!arguments.length) return labelSunbeamLayout; + labelSunbeamLayout = _; + return chart; + }; + + chart.donutLabelsOutside = function(_) { + if (!arguments.length) return donutLabelsOutside; + donutLabelsOutside = _; + return chart; + }; + + chart.pieLabelsOutside = function(_) { + if (!arguments.length) return pieLabelsOutside; + pieLabelsOutside = _; + return chart; + }; + + chart.donut = function(_) { + if (!arguments.length) return donut; + donut = _; + return chart; + }; + + chart.donutRatio = function(_) { + if (!arguments.length) return donutRatio; + donutRatio = _; + return chart; + }; + + chart.startAngle = function(_) { + if (!arguments.length) return startAngle; + startAngle = _; + return chart; + }; + + chart.endAngle = function(_) { + if (!arguments.length) return endAngle; + endAngle = _; + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.valueFormat = function(_) { + if (!arguments.length) return valueFormat; + valueFormat = _; + return chart; + }; + + chart.labelThreshold = function(_) { + if (!arguments.length) return labelThreshold; + labelThreshold = _; + return chart; + }; + //============================================================ + + + return chart; +} +nv.models.pieChart = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var pie = nv.models.pie() + , legend = nv.models.legend() + ; + + var margin = {top: 30, right: 20, bottom: 20, left: 20} + , width = null + , height = null + , showLegend = true + , color = nv.utils.defaultColor() + , tooltips = true + , tooltip = function(key, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + '

      ' + } + , state = {} + , defaultState = null + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var tooltipLabel = pie.description()(e.point) || pie.x()(e.point) + var left = e.pos[0] + ( (offsetElement && offsetElement.offsetLeft) || 0 ), + top = e.pos[1] + ( (offsetElement && offsetElement.offsetTop) || 0), + y = pie.valueFormat()(pie.y()(e.point)), + content = tooltip(tooltipLabel, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().call(chart); }; + chart.container = this; + + //set state.disabled + state.disabled = data[0].map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data[0] || !data[0].length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-pieChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-pieChart').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-pieWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend + .width( availableWidth ) + .key(pie.x()); + + wrap.select('.nv-legendWrap') + .datum(pie.values()(data[0])) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + wrap.select('.nv-legendWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Main Chart Component(s) + + pie + .width(availableWidth) + .height(availableHeight); + + + var pieWrap = g.select('.nv-pieWrap') + .datum(data); + + d3.transition(pieWrap).call(pie); + + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('legendClick', function(d,i, that) { + d.disabled = !d.disabled; + + if (!pie.values()(data[0]).filter(function(d) { return !d.disabled }).length) { + pie.values()(data[0]).map(function(d) { + d.disabled = false; + wrap.selectAll('.nv-series').classed('disabled', false); + return d; + }); + } + + state.disabled = data[0].map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + + chart.update(); + }); + + pie.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data[0].forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + chart.update(); + }); + + //============================================================ + + + }); + + return chart; + } + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + pie.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.legend = legend; + chart.dispatch = dispatch; + chart.pie = pie; + + d3.rebind(chart, pie, 'valueFormat', 'values', 'x', 'y', 'description', 'id', 'showLabels', 'donutLabelsOutside', 'pieLabelsOutside', 'donut', 'donutRatio', 'labelThreshold'); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + pie.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} + +nv.models.scatter = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , color = nv.utils.defaultColor() // chooses color + , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't select one + , x = d3.scale.linear() + , y = d3.scale.linear() + , z = d3.scale.linear() //linear because d3.svg.shape.size is treated as area + , getX = function(d) { return d.x } // accessor to get the x value + , getY = function(d) { return d.y } // accessor to get the y value + , getSize = function(d) { return d.size || 1} // accessor to get the point size + , getShape = function(d) { return d.shape || 'circle' } // accessor to get point shape + , onlyCircles = true // Set to false to use shapes + , forceX = [] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.) + , forceY = [] // List of numbers to Force into the Y scale + , forceSize = [] // List of numbers to Force into the Size scale + , interactive = true // If true, plots a voronoi overlay for advanced point intersection + , pointKey = null + , pointActive = function(d) { return !d.notActive } // any points that return false will be filtered out + , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart + , padDataOuter = .1 //outerPadding to imitate ordinal scale outer padding + , clipEdge = false // if true, masks points within x and y scale + , clipVoronoi = true // if true, masks each point with a circle... can turn off to slightly increase performance + , clipRadius = function() { return 25 } // function to get the radius for voronoi point clips + , xDomain = null // Override x domain (skips the calculation from data) + , yDomain = null // Override y domain + , sizeDomain = null // Override point size domain + , sizeRange = null + , singlePoint = false + , dispatch = d3.dispatch('elementClick', 'elementMouseover', 'elementMouseout') + , useVoronoi = true + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0, z0 // used to store previous scales + , timeoutID + , needsUpdate = false // Flag for when the points are visually updating, but the interactive layer is behind, to disable tooltips + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + //add series index to each data point for reference + data = data.map(function(series, i) { + series.values = series.values.map(function(point) { + point.series = i; + return point; + }); + return series; + }); + + //------------------------------------------------------------ + // Setup Scales + + // remap and flatten the data for use in calculating the scales' domains + var seriesData = (xDomain && yDomain && sizeDomain) ? [] : // if we know xDomain and yDomain and sizeDomain, no need to calculate.... if Size is constant remember to set sizeDomain to speed up performance + d3.merge( + data.map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i), size: getSize(d,i) } + }) + }) + ); + + x .domain(xDomain || d3.extent(seriesData.map(function(d) { return d.x; }).concat(forceX))) + + if (padData && data[0]) + x.range([(availableWidth * padDataOuter + availableWidth) / (2 *data[0].values.length), availableWidth - availableWidth * (1 + padDataOuter) / (2 * data[0].values.length) ]); + //x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]); + else + x.range([0, availableWidth]); + + y .domain(yDomain || d3.extent(seriesData.map(function(d) { return d.y }).concat(forceY))) + .range([availableHeight, 0]); + + z .domain(sizeDomain || d3.extent(seriesData.map(function(d) { return d.size }).concat(forceSize))) + .range(sizeRange || [16, 256]); + + // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point + if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true; + if (x.domain()[0] === x.domain()[1]) + x.domain()[0] ? + x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) + : x.domain([-1,1]); + + if (y.domain()[0] === y.domain()[1]) + y.domain()[0] ? + y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01]) + : y.domain([-1,1]); + + if ( isNaN(x.domain()[0])) { + x.domain([-1,1]); + } + + if ( isNaN(y.domain()[0])) { + y.domain([-1,1]); + } + + + x0 = x0 || x; + y0 = y0 || y; + z0 = z0 || z; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-scatter').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatter nv-chart-' + id + (singlePoint ? ' nv-single-point' : '')); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-groups'); + gEnter.append('g').attr('class', 'nv-point-paths'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + defsEnter.append('clipPath') + .attr('id', 'nv-edge-clip-' + id) + .append('rect'); + + wrap.select('#nv-edge-clip-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); + + + function updateInteractiveLayer() { + + if (!interactive) return false; + + var eventElements; + + var vertices = d3.merge(data.map(function(group, groupIndex) { + return group.values + .map(function(point, pointIndex) { + // *Adding noise to make duplicates very unlikely + // *Injecting series and point index for reference + /* *Adding a 'jitter' to the points, because there's an issue in d3.geom.voronoi. + */ + var pX = getX(point,pointIndex) + Math.random() * 1e-7; + var pY = getY(point,pointIndex) + Math.random() * 1e-7; + + return [x(pX), + y(pY), + groupIndex, + pointIndex, point]; //temp hack to add noise untill I think of a better way so there are no duplicates + }) + .filter(function(pointArray, pointIndex) { + return pointActive(pointArray[4], pointIndex); // Issue #237.. move filter to after map, so pointIndex is correct! + }) + }) + ); + + + + //inject series and point index for reference into voronoi + if (useVoronoi === true) { + + if (clipVoronoi) { + var pointClipsEnter = wrap.select('defs').selectAll('.nv-point-clips') + .data([id]) + .enter(); + + pointClipsEnter.append('clipPath') + .attr('class', 'nv-point-clips') + .attr('id', 'nv-points-clip-' + id); + + var pointClips = wrap.select('#nv-points-clip-' + id).selectAll('circle') + .data(vertices); + pointClips.enter().append('circle') + .attr('r', clipRadius); + pointClips.exit().remove(); + pointClips + .attr('cx', function(d) { return d[0] }) + .attr('cy', function(d) { return d[1] }); + + wrap.select('.nv-point-paths') + .attr('clip-path', 'url(#nv-points-clip-' + id + ')'); + } + + + if(vertices.length) { + // Issue #283 - Adding 2 dummy points to the voronoi b/c voronoi requires min 3 points to work + vertices.push([x.range()[0] - 20, y.range()[0] - 20, null, null]); + vertices.push([x.range()[1] + 20, y.range()[1] + 20, null, null]); + vertices.push([x.range()[0] - 20, y.range()[0] + 20, null, null]); + vertices.push([x.range()[1] + 20, y.range()[1] - 20, null, null]); + } + + var bounds = d3.geom.polygon([ + [-10,-10], + [-10,height + 10], + [width + 10,height + 10], + [width + 10,-10] + ]); + + var voronoi = d3.geom.voronoi(vertices).map(function(d, i) { + return { + 'data': bounds.clip(d), + 'series': vertices[i][2], + 'point': vertices[i][3] + } + }); + + + var pointPaths = wrap.select('.nv-point-paths').selectAll('path') + .data(voronoi); + pointPaths.enter().append('path') + .attr('class', function(d,i) { return 'nv-path-'+i; }); + pointPaths.exit().remove(); + pointPaths + .attr('d', function(d) { + if (d.data.length === 0) + return 'M 0 0' + else + return 'M' + d.data.join('L') + 'Z'; + }); + + pointPaths + .on('click', function(d) { + if (needsUpdate) return 0; + var series = data[d.series], + point = series.values[d.point]; + + dispatch.elementClick({ + point: point, + series: series, + pos: [x(getX(point, d.point)) + margin.left, y(getY(point, d.point)) + margin.top], + seriesIndex: d.series, + pointIndex: d.point + }); + }) + .on('mouseover', function(d) { + if (needsUpdate) return 0; + var series = data[d.series], + point = series.values[d.point]; + + dispatch.elementMouseover({ + point: point, + series: series, + pos: [x(getX(point, d.point)) + margin.left, y(getY(point, d.point)) + margin.top], + seriesIndex: d.series, + pointIndex: d.point + }); + }) + .on('mouseout', function(d, i) { + if (needsUpdate) return 0; + var series = data[d.series], + point = series.values[d.point]; + + dispatch.elementMouseout({ + point: point, + series: series, + seriesIndex: d.series, + pointIndex: d.point + }); + }); + + + } else { + /* + // bring data in form needed for click handlers + var dataWithPoints = vertices.map(function(d, i) { + return { + 'data': d, + 'series': vertices[i][2], + 'point': vertices[i][3] + } + }); + */ + + // add event handlers to points instead voronoi paths + wrap.select('.nv-groups').selectAll('.nv-group') + .selectAll('.nv-point') + //.data(dataWithPoints) + //.style('pointer-events', 'auto') // recativate events, disabled by css + .on('click', function(d,i) { + //nv.log('test', d, i); + if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point + var series = data[d.series], + point = series.values[i]; + + dispatch.elementClick({ + point: point, + series: series, + pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top], + seriesIndex: d.series, + pointIndex: i + }); + }) + .on('mouseover', function(d,i) { + if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point + var series = data[d.series], + point = series.values[i]; + + dispatch.elementMouseover({ + point: point, + series: series, + pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top], + seriesIndex: d.series, + pointIndex: i + }); + }) + .on('mouseout', function(d,i) { + if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point + var series = data[d.series], + point = series.values[i]; + + dispatch.elementMouseout({ + point: point, + series: series, + seriesIndex: d.series, + pointIndex: i + }); + }); + } + + needsUpdate = false; + } + + needsUpdate = true; + + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d) { return d.key }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + d3.transition(groups.exit()) + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6) + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }); + d3.transition(groups) + .style('fill', function(d,i) { return color(d, i) }) + .style('stroke', function(d,i) { return color(d, i) }) + .style('stroke-opacity', 1) + .style('fill-opacity', .5); + + + if (onlyCircles) { + + var points = groups.selectAll('circle.nv-point') + .data(function(d) { return d.values }, pointKey); + points.enter().append('circle') + .attr('cx', function(d,i) { return x0(getX(d,i)) }) + .attr('cy', function(d,i) { return y0(getY(d,i)) }) + .attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) }); + points.exit().remove(); + groups.exit().selectAll('path.nv-point').transition() + .attr('cx', function(d,i) { return x(getX(d,i)) }) + .attr('cy', function(d,i) { return y(getY(d,i)) }) + .remove(); + points.each(function(d,i) { + d3.select(this) + .classed('nv-point', true) + .classed('nv-point-' + i, true); + }); + points.transition() + .attr('cx', function(d,i) { return x(getX(d,i)) }) + .attr('cy', function(d,i) { return y(getY(d,i)) }) + .attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) }); + + } else { + + var points = groups.selectAll('path.nv-point') + .data(function(d) { return d.values }); + points.enter().append('path') + .attr('transform', function(d,i) { + return 'translate(' + x0(getX(d,i)) + ',' + y0(getY(d,i)) + ')' + }) + .attr('d', + d3.svg.symbol() + .type(getShape) + .size(function(d,i) { return z(getSize(d,i)) }) + ); + points.exit().remove(); + d3.transition(groups.exit().selectAll('path.nv-point')) + .attr('transform', function(d,i) { + return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')' + }) + .remove(); + points.each(function(d,i) { + d3.select(this) + .classed('nv-point', true) + .classed('nv-point-' + i, true); + }); + points.transition() + .attr('transform', function(d,i) { + //nv.log(d,i,getX(d,i), x(getX(d,i))); + return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')' + }) + .attr('d', + d3.svg.symbol() + .type(getShape) + .size(function(d,i) { return z(getSize(d,i)) }) + ); + } + + + // Delay updating the invisible interactive layer for smoother animation + clearTimeout(timeoutID); // stop repeat calls to updateInteractiveLayer + timeoutID = setTimeout(updateInteractiveLayer, 300); + //updateInteractiveLayer(); + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + z0 = z.copy(); + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + dispatch.on('elementMouseover.point', function(d) { + if (interactive) + d3.select('.nv-chart-' + id + ' .nv-series-' + d.seriesIndex + ' .nv-point-' + d.pointIndex) + .classed('hover', true); + }); + + dispatch.on('elementMouseout.point', function(d) { + if (interactive) + d3.select('.nv-chart-' + id + ' .nv-series-' + d.seriesIndex + ' .nv-point-' + d.pointIndex) + .classed('hover', false); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = d3.functor(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = d3.functor(_); + return chart; + }; + + chart.size = function(_) { + if (!arguments.length) return getSize; + getSize = d3.functor(_); + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.zScale = function(_) { + if (!arguments.length) return z; + z = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.sizeDomain = function(_) { + if (!arguments.length) return sizeDomain; + sizeDomain = _; + return chart; + }; + + chart.sizeRange = function(_) { + if (!arguments.length) return sizeRange; + sizeRange = _; + return chart; + }; + + chart.forceX = function(_) { + if (!arguments.length) return forceX; + forceX = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.forceSize = function(_) { + if (!arguments.length) return forceSize; + forceSize = _; + return chart; + }; + + chart.interactive = function(_) { + if (!arguments.length) return interactive; + interactive = _; + return chart; + }; + + chart.pointKey = function(_) { + if (!arguments.length) return pointKey; + pointKey = _; + return chart; + }; + + chart.pointActive = function(_) { + if (!arguments.length) return pointActive; + pointActive = _; + return chart; + }; + + chart.padData = function(_) { + if (!arguments.length) return padData; + padData = _; + return chart; + }; + + chart.padDataOuter = function(_) { + if (!arguments.length) return padDataOuter; + padDataOuter = _; + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.clipVoronoi= function(_) { + if (!arguments.length) return clipVoronoi; + clipVoronoi = _; + return chart; + }; + + chart.useVoronoi= function(_) { + if (!arguments.length) return useVoronoi; + useVoronoi = _; + if (useVoronoi === false) { + clipVoronoi = false; + } + return chart; + }; + + chart.clipRadius = function(_) { + if (!arguments.length) return clipRadius; + clipRadius = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.shape = function(_) { + if (!arguments.length) return getShape; + getShape = _; + return chart; + }; + + chart.onlyCircles = function(_) { + if (!arguments.length) return onlyCircles; + onlyCircles = _; + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.singlePoint = function(_) { + if (!arguments.length) return singlePoint; + singlePoint = _; + return chart; + }; + + //============================================================ + + + return chart; +} + +nv.models.scatterChart = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var scatter = nv.models.scatter() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + , controls = nv.models.legend() + , distX = nv.models.distribution() + , distY = nv.models.distribution() + ; + + var margin = {top: 30, right: 20, bottom: 50, left: 75} + , width = null + , height = null + , color = nv.utils.defaultColor() + , x = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.xScale() + , y = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.yScale() + , xPadding = 0 + , yPadding = 0 + , showDistX = false + , showDistY = false + , showLegend = true + , showControls = !!d3.fisheye + , fisheye = 0 + , pauseFisheye = false + , tooltips = true + , tooltipX = function(key, x, y) { return '' + x + '' } + , tooltipY = function(key, x, y) { return '' + y + '' } + //, tooltip = function(key, x, y) { return '

      ' + key + '

      ' } + , tooltip = null + , state = {} + , defaultState = null + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , noData = "No Data Available." + ; + + scatter + .xScale(x) + .yScale(y) + ; + xAxis + .orient('bottom') + .tickPadding(10) + ; + yAxis + .orient('left') + .tickPadding(10) + ; + distX + .axis('x') + ; + distY + .axis('y') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0; + + var showTooltip = function(e, offsetElement) { + //TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?) + + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + leftX = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + topX = y.range()[0] + margin.top + ( offsetElement.offsetTop || 0), + leftY = x.range()[0] + margin.left + ( offsetElement.offsetLeft || 0 ), + topY = e.pos[1] + ( offsetElement.offsetTop || 0), + xVal = xAxis.tickFormat()(scatter.x()(e.point, e.pointIndex)), + yVal = yAxis.tickFormat()(scatter.y()(e.point, e.pointIndex)); + + if( tooltipX != null ) + nv.tooltip.show([leftX, topX], tooltipX(e.series.key, xVal, yVal, e, chart), 'n', 1, offsetElement, 'x-nvtooltip'); + if( tooltipY != null ) + nv.tooltip.show([leftY, topY], tooltipY(e.series.key, xVal, yVal, e, chart), 'e', 1, offsetElement, 'y-nvtooltip'); + if( tooltip != null ) + nv.tooltip.show([left, top], tooltip(e.series.key, xVal, yVal, e, chart), e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + var controlsData = [ + { key: 'Magnify', disabled: true } + ]; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().call(chart); }; + // chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display noData message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x0 = x0 || x; + y0 = y0 || y; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id()); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + // background for pointer events + gEnter.append('rect').attr('class', 'nvd3 nv-background'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-scatterWrap'); + gEnter.append('g').attr('class', 'nv-distWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width( availableWidth / 2 ); + + wrap.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + wrap.select('.nv-legendWrap') + .attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + controls.width(180).color(['#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Main Chart Component(s) + + scatter + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })) + .xDomain(null) + .yDomain(null) + + wrap.select('.nv-scatterWrap') + .datum(data.filter(function(d) { return !d.disabled })) + .call(scatter); + + + //Adjust for x and y padding + if (xPadding) { + var xRange = x.domain()[1] - x.domain()[0]; + scatter.xDomain([x.domain()[0] - (xPadding * xRange), x.domain()[1] + (xPadding * xRange)]); + } + + if (yPadding) { + var yRange = y.domain()[1] - y.domain()[0]; + scatter.yDomain([y.domain()[0] - (yPadding * yRange), y.domain()[1] + (yPadding * yRange)]); + } + + wrap.select('.nv-scatterWrap') + .datum(data.filter(function(d) { return !d.disabled })) + .call(scatter); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + xAxis + .scale(x) + .ticks( xAxis.ticks() && xAxis.ticks().length ? xAxis.ticks() : availableWidth / 100 ) + .tickSize( -availableHeight , 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')') + .call(xAxis); + + + yAxis + .scale(y) + .ticks( yAxis.ticks() && yAxis.ticks().length ? yAxis.ticks() : availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-y.nv-axis') + .call(yAxis); + + + if (showDistX) { + distX + .getData(scatter.x()) + .scale(x) + .width(availableWidth) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + gEnter.select('.nv-distWrap').append('g') + .attr('class', 'nv-distributionX'); + g.select('.nv-distributionX') + .attr('transform', 'translate(0,' + y.range()[0] + ')') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distX); + } + + if (showDistY) { + distY + .getData(scatter.y()) + .scale(y) + .width(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + gEnter.select('.nv-distWrap').append('g') + .attr('class', 'nv-distributionY'); + g.select('.nv-distributionY') + .attr('transform', 'translate(-' + distY.size() + ',0)') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distY); + } + + //------------------------------------------------------------ + + + + + if (d3.fisheye) { + g.select('.nv-background') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g.select('.nv-background').on('mousemove', updateFisheye); + g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye;}); + scatter.dispatch.on('elementClick.freezeFisheye', function() { + pauseFisheye = !pauseFisheye; + }); + } + + + function updateFisheye() { + if (pauseFisheye) { + g.select('.nv-point-paths').style('pointer-events', 'all'); + return false; + } + + g.select('.nv-point-paths').style('pointer-events', 'none' ); + + var mouse = d3.mouse(this); + x.distortion(fisheye).focus(mouse[0]); + y.distortion(fisheye).focus(mouse[1]); + + g.select('.nv-scatterWrap') + .call(scatter); + + g.select('.nv-x.nv-axis').call(xAxis); + g.select('.nv-y.nv-axis').call(yAxis); + g.select('.nv-distributionX') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distX); + g.select('.nv-distributionY') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distY); + } + + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + controls.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + fisheye = d.disabled ? 0 : 2.5; + g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all'); + g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' ); + + if (d.disabled) { + x.distortion(fisheye).focus(0); + y.distortion(fisheye).focus(0); + + g.select('.nv-scatterWrap').call(scatter); + g.select('.nv-x.nv-axis').call(xAxis); + g.select('.nv-y.nv-axis').call(yAxis); + } else { + pauseFisheye = false; + } + + chart.update(); + }); + + legend.dispatch.on('legendClick', function(d,i, that) { + d.disabled = !d.disabled; + + if (!data.filter(function(d) { return !d.disabled }).length) { + data.map(function(d) { + d.disabled = false; + wrap.selectAll('.nv-series').classed('disabled', false); + return d; + }); + } + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + + chart.update(); + }); + + legend.dispatch.on('legendDblclick', function(d) { + //Double clicking should always enable current series, and disabled all others. + data.forEach(function(d) { + d.disabled = true; + }); + d.disabled = false; + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + chart.update(); + }); + + + /* + legend.dispatch.on('legendMouseover', function(d, i) { + d.hover = true; + chart(selection); + }); + + legend.dispatch.on('legendMouseout', function(d, i) { + d.hover = false; + chart(selection); + }); + */ + + scatter.dispatch.on('elementMouseover.tooltip', function(e) { + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex) + .attr('y1', function(d,i) { return e.pos[1] - availableHeight;}); + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex) + .attr('x2', e.pos[0] + distX.size()); + + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + chart.update(); + }); + + //============================================================ + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + scatter.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex) + .attr('y1', 0); + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex) + .attr('x2', distY.size()); + }); + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.scatter = scatter; + chart.legend = legend; + chart.controls = controls; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + chart.distX = distX; + chart.distY = distY; + + d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi'); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + distX.color(color); + distY.color(color); + return chart; + }; + + chart.showDistX = function(_) { + if (!arguments.length) return showDistX; + showDistX = _; + return chart; + }; + + chart.showDistY = function(_) { + if (!arguments.length) return showDistY; + showDistY = _; + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.fisheye = function(_) { + if (!arguments.length) return fisheye; + fisheye = _; + return chart; + }; + + chart.xPadding = function(_) { + if (!arguments.length) return xPadding; + xPadding = _; + return chart; + }; + + chart.yPadding = function(_) { + if (!arguments.length) return yPadding; + yPadding = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.tooltipXContent = function(_) { + if (!arguments.length) return tooltipX; + tooltipX = _; + return chart; + }; + + chart.tooltipYContent = function(_) { + if (!arguments.length) return tooltipY; + tooltipY = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} + +nv.models.scatterPlusLineChart = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var scatter = nv.models.scatter() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + , controls = nv.models.legend() + , distX = nv.models.distribution() + , distY = nv.models.distribution() + ; + + var margin = {top: 30, right: 20, bottom: 50, left: 75} + , width = null + , height = null + , color = nv.utils.defaultColor() + , x = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.xScale() + , y = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.yScale() + , showDistX = false + , showDistY = false + , showLegend = true + , showControls = !!d3.fisheye + , fisheye = 0 + , pauseFisheye = false + , tooltips = true + , tooltipX = function(key, x, y) { return '' + x + '' } + , tooltipY = function(key, x, y) { return '' + y + '' } + , tooltip = function(key, x, y, date) { return '

      ' + key + '

      ' + + '

      ' + date + '

      ' } + //, tooltip = null + , state = {} + , defaultState = null + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , noData = "No Data Available." + ; + + scatter + .xScale(x) + .yScale(y) + ; + xAxis + .orient('bottom') + .tickPadding(10) + ; + yAxis + .orient('left') + .tickPadding(10) + ; + distX + .axis('x') + ; + distY + .axis('y') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0; + + var showTooltip = function(e, offsetElement) { + //TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?) + + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + leftX = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + topX = y.range()[0] + margin.top + ( offsetElement.offsetTop || 0), + leftY = x.range()[0] + margin.left + ( offsetElement.offsetLeft || 0 ), + topY = e.pos[1] + ( offsetElement.offsetTop || 0), + xVal = xAxis.tickFormat()(scatter.x()(e.point, e.pointIndex)), + yVal = yAxis.tickFormat()(scatter.y()(e.point, e.pointIndex)); + + if( tooltipX != null ) + nv.tooltip.show([leftX, topX], tooltipX(e.series.key, xVal, yVal, e, chart), 'n', 1, offsetElement, 'x-nvtooltip'); + if( tooltipY != null ) + nv.tooltip.show([leftY, topY], tooltipY(e.series.key, xVal, yVal, e, chart), 'e', 1, offsetElement, 'y-nvtooltip'); + if( tooltip != null ) + nv.tooltip.show([left, top], tooltip(e.series.key, xVal, yVal, e.point.tooltip, e, chart), e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + var controlsData = [ + { key: 'Magnify', disabled: true } + ]; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().call(chart); }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display noData message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = scatter.xScale(); + y = scatter.yScale(); + + x0 = x0 || x; + y0 = y0 || y; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id()); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + // background for pointer events + gEnter.append('rect').attr('class', 'nvd3 nv-background') + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-scatterWrap'); + gEnter.append('g').attr('class', 'nv-regressionLinesWrap'); + gEnter.append('g').attr('class', 'nv-distWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width( availableWidth / 2 ); + + wrap.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + wrap.select('.nv-legendWrap') + .attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + controls.width(180).color(['#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Main Chart Component(s) + + scatter + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })) + + wrap.select('.nv-scatterWrap') + .datum(data.filter(function(d) { return !d.disabled })) + .call(scatter); + + + wrap.select('.nv-regressionLinesWrap') + .attr('clip-path', 'url(#nv-edge-clip-' + scatter.id() + ')'); + + var regWrap = wrap.select('.nv-regressionLinesWrap').selectAll('.nv-regLines') + .data(function(d) { return d }); + + var reglines = regWrap.enter() + .append('g').attr('class', 'nv-regLines') + .append('line').attr('class', 'nv-regLine') + .style('stroke-opacity', 0); + + //d3.transition(regWrap.selectAll('.nv-regLines line')) + regWrap.selectAll('.nv-regLines line') + .attr('x1', x.range()[0]) + .attr('x2', x.range()[1]) + .attr('y1', function(d,i) { return y(x.domain()[0] * d.slope + d.intercept) }) + .attr('y2', function(d,i) { return y(x.domain()[1] * d.slope + d.intercept) }) + .style('stroke', function(d,i,j) { return color(d,j) }) + .style('stroke-opacity', function(d,i) { + return (d.disabled || typeof d.slope === 'undefined' || typeof d.intercept === 'undefined') ? 0 : 1 + }); + + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + xAxis + .scale(x) + .ticks( xAxis.ticks() ? xAxis.ticks() : availableWidth / 100 ) + .tickSize( -availableHeight , 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')') + .call(xAxis); + + + yAxis + .scale(y) + .ticks( yAxis.ticks() ? yAxis.ticks() : availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-y.nv-axis') + .call(yAxis); + + + if (showDistX) { + distX + .getData(scatter.x()) + .scale(x) + .width(availableWidth) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + gEnter.select('.nv-distWrap').append('g') + .attr('class', 'nv-distributionX'); + g.select('.nv-distributionX') + .attr('transform', 'translate(0,' + y.range()[0] + ')') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distX); + } + + if (showDistY) { + distY + .getData(scatter.y()) + .scale(y) + .width(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + gEnter.select('.nv-distWrap').append('g') + .attr('class', 'nv-distributionY'); + g.select('.nv-distributionY') + .attr('transform', 'translate(-' + distY.size() + ',0)') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distY); + } + + //------------------------------------------------------------ + + + + + if (d3.fisheye) { + g.select('.nv-background') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g.select('.nv-background').on('mousemove', updateFisheye); + g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye;}); + scatter.dispatch.on('elementClick.freezeFisheye', function() { + pauseFisheye = !pauseFisheye; + }); + } + + + function updateFisheye() { + if (pauseFisheye) { + g.select('.nv-point-paths').style('pointer-events', 'all'); + return false; + } + + g.select('.nv-point-paths').style('pointer-events', 'none' ); + + var mouse = d3.mouse(this); + x.distortion(fisheye).focus(mouse[0]); + y.distortion(fisheye).focus(mouse[1]); + + g.select('.nv-scatterWrap') + .datum(data.filter(function(d) { return !d.disabled })) + .call(scatter); + g.select('.nv-x.nv-axis').call(xAxis); + g.select('.nv-y.nv-axis').call(yAxis); + g.select('.nv-distributionX') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distX); + g.select('.nv-distributionY') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distY); + } + + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + controls.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + fisheye = d.disabled ? 0 : 2.5; + g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all'); + g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' ); + + if (d.disabled) { + x.distortion(fisheye).focus(0); + y.distortion(fisheye).focus(0); + + g.select('.nv-scatterWrap').call(scatter); + g.select('.nv-x.nv-axis').call(xAxis); + g.select('.nv-y.nv-axis').call(yAxis); + } else { + pauseFisheye = false; + } + + chart.update(); + }); + + legend.dispatch.on('legendClick', function(d,i, that) { + d.disabled = !d.disabled; + + if (!data.filter(function(d) { return !d.disabled }).length) { + data.map(function(d) { + d.disabled = false; + wrap.selectAll('.nv-series').classed('disabled', false); + return d; + }); + } + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + + chart.update(); + }); + + legend.dispatch.on('legendDblclick', function(d) { + //Double clicking should always enable current series, and disabled all others. + data.forEach(function(d) { + d.disabled = true; + }); + d.disabled = false; + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + chart.update(); + }); + + + /* + legend.dispatch.on('legendMouseover', function(d, i) { + d.hover = true; + chart(selection); + }); + + legend.dispatch.on('legendMouseout', function(d, i) { + d.hover = false; + chart(selection); + }); + */ + + scatter.dispatch.on('elementMouseover.tooltip', function(e) { + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex) + .attr('y1', e.pos[1] - availableHeight); + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex) + .attr('x2', e.pos[0] + distX.size()); + + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + chart.update(); + }); + + //============================================================ + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + scatter.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex) + .attr('y1', 0); + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex) + .attr('x2', distY.size()); + }); + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.scatter = scatter; + chart.legend = legend; + chart.controls = controls; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + chart.distX = distX; + chart.distY = distY; + + d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi'); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + distX.color(color); + distY.color(color); + return chart; + }; + + chart.showDistX = function(_) { + if (!arguments.length) return showDistX; + showDistX = _; + return chart; + }; + + chart.showDistY = function(_) { + if (!arguments.length) return showDistY; + showDistY = _; + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.fisheye = function(_) { + if (!arguments.length) return fisheye; + fisheye = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.tooltipXContent = function(_) { + if (!arguments.length) return tooltipX; + tooltipX = _; + return chart; + }; + + chart.tooltipYContent = function(_) { + if (!arguments.length) return tooltipY; + tooltipY = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} + +nv.models.sparkline = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 2, right: 0, bottom: 2, left: 0} + , width = 400 + , height = 32 + , animate = true + , x = d3.scale.linear() + , y = d3.scale.linear() + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , color = nv.utils.getColor(['#000']) + , xDomain + , yDomain + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup Scales + + x .domain(xDomain || d3.extent(data, getX )) + .range([0, availableWidth]); + + y .domain(yDomain || d3.extent(data, getY )) + .range([availableHeight, 0]); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-sparkline').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparkline'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')') + + //------------------------------------------------------------ + + + var paths = wrap.selectAll('path') + .data(function(d) { return [d] }); + paths.enter().append('path'); + paths.exit().remove(); + paths + .style('stroke', function(d,i) { return d.color || color(d, i) }) + .attr('d', d3.svg.line() + .x(function(d,i) { return x(getX(d,i)) }) + .y(function(d,i) { return y(getY(d,i)) }) + ); + + + // TODO: Add CURRENT data point (Need Min, Mac, Current / Most recent) + var points = wrap.selectAll('circle.nv-point') + .data(function(data) { + var yValues = data.map(function(d, i) { return getY(d,i); }); + function pointIndex(index) { + if (index != -1) { + var result = data[index]; + result.pointIndex = index; + return result; + } else { + return null; + } + } + var maxPoint = pointIndex(yValues.lastIndexOf(y.domain()[1])), + minPoint = pointIndex(yValues.indexOf(y.domain()[0])), + currentPoint = pointIndex(yValues.length - 1); + return [minPoint, maxPoint, currentPoint].filter(function (d) {return d != null;}); + }); + points.enter().append('circle'); + points.exit().remove(); + points + .attr('cx', function(d,i) { return x(getX(d,d.pointIndex)) }) + .attr('cy', function(d,i) { return y(getY(d,d.pointIndex)) }) + .attr('r', 2) + .attr('class', function(d,i) { + return getX(d, d.pointIndex) == x.domain()[1] ? 'nv-point nv-currentValue' : + getY(d, d.pointIndex) == y.domain()[0] ? 'nv-point nv-minValue' : 'nv-point nv-maxValue' + }); + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = d3.functor(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = d3.functor(_); + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.animate = function(_) { + if (!arguments.length) return animate; + animate = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + //============================================================ + + + return chart; +} + +nv.models.sparklinePlus = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var sparkline = nv.models.sparkline(); + + var margin = {top: 15, right: 100, bottom: 10, left: 50} + , width = null + , height = null + , x + , y + , index = [] + , paused = false + , xTickFormat = d3.format(',r') + , yTickFormat = d3.format(',.2f') + , showValue = true + , alignValue = true + , rightAlignValue = false + , noData = "No Data Available." + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this); + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + + + chart.update = function() { chart(selection) }; + chart.container = this; + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + var currentValue = sparkline.y()(data[data.length-1], data.length-1); + + //------------------------------------------------------------ + + + + //------------------------------------------------------------ + // Setup Scales + + x = sparkline.xScale(); + y = sparkline.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-sparklineplus').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparklineplus'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-sparklineWrap'); + gEnter.append('g').attr('class', 'nv-valueWrap'); + gEnter.append('g').attr('class', 'nv-hoverArea'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Main Chart Component(s) + + var sparklineWrap = g.select('.nv-sparklineWrap'); + + sparkline + .width(availableWidth) + .height(availableHeight); + + sparklineWrap + .call(sparkline); + + //------------------------------------------------------------ + + + var valueWrap = g.select('.nv-valueWrap'); + + var value = valueWrap.selectAll('.nv-currentValue') + .data([currentValue]); + + value.enter().append('text').attr('class', 'nv-currentValue') + .attr('dx', rightAlignValue ? -8 : 8) + .attr('dy', '.9em') + .style('text-anchor', rightAlignValue ? 'end' : 'start'); + + value + .attr('x', availableWidth + (rightAlignValue ? margin.right : 0)) + .attr('y', alignValue ? function(d) { return y(d) } : 0) + .style('fill', sparkline.color()(data[data.length-1], data.length-1)) + .text(yTickFormat(currentValue)); + + + + gEnter.select('.nv-hoverArea').append('rect') + .on('mousemove', sparklineHover) + .on('click', function() { paused = !paused }) + .on('mouseout', function() { index = []; updateValueLine(); }); + //.on('mouseout', function() { index = null; updateValueLine(); }); + + g.select('.nv-hoverArea rect') + .attr('transform', function(d) { return 'translate(' + -margin.left + ',' + -margin.top + ')' }) + .attr('width', availableWidth + margin.left + margin.right) + .attr('height', availableHeight + margin.top); + + + + function updateValueLine() { //index is currently global (within the chart), may or may not keep it that way + if (paused) return; + + var hoverValue = g.selectAll('.nv-hoverValue').data(index) + + var hoverEnter = hoverValue.enter() + .append('g').attr('class', 'nv-hoverValue') + .style('stroke-opacity', 0) + .style('fill-opacity', 0); + + hoverValue.exit() + .transition().duration(250) + .style('stroke-opacity', 0) + .style('fill-opacity', 0) + .remove(); + + hoverValue + .attr('transform', function(d) { return 'translate(' + x(sparkline.x()(data[d],d)) + ',0)' }) + .transition().duration(250) + .style('stroke-opacity', 1) + .style('fill-opacity', 1); + + if (!index.length) return; + + hoverEnter.append('line') + .attr('x1', 0) + .attr('y1', -margin.top) + .attr('x2', 0) + .attr('y2', availableHeight); + + + hoverEnter.append('text').attr('class', 'nv-xValue') + .attr('x', -6) + .attr('y', -margin.top) + .attr('text-anchor', 'end') + .attr('dy', '.9em') + + + g.select('.nv-hoverValue .nv-xValue') + .text(xTickFormat(sparkline.x()(data[index[0]], index[0]))); + + hoverEnter.append('text').attr('class', 'nv-yValue') + .attr('x', 6) + .attr('y', -margin.top) + .attr('text-anchor', 'start') + .attr('dy', '.9em') + + g.select('.nv-hoverValue .nv-yValue') + .text(yTickFormat(sparkline.y()(data[index[0]], index[0]))); + + } + + + function sparklineHover() { + if (paused) return; + + var pos = d3.mouse(this)[0] - margin.left; + + function getClosestIndex(data, x) { + var distance = Math.abs(sparkline.x()(data[0], 0) - x); + var closestIndex = 0; + for (var i = 0; i < data.length; i++){ + if (Math.abs(sparkline.x()(data[i], i) - x) < distance) { + distance = Math.abs(sparkline.x()(data[i], i) - x); + closestIndex = i; + } + } + return closestIndex; + } + + index = [getClosestIndex(data, Math.round(x.invert(pos)))]; + + updateValueLine(); + } + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.sparkline = sparkline; + + d3.rebind(chart, sparkline, 'x', 'y', 'xScale', 'yScale', 'color'); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xTickFormat = function(_) { + if (!arguments.length) return xTickFormat; + xTickFormat = _; + return chart; + }; + + chart.yTickFormat = function(_) { + if (!arguments.length) return yTickFormat; + yTickFormat = _; + return chart; + }; + + chart.showValue = function(_) { + if (!arguments.length) return showValue; + showValue = _; + return chart; + }; + + chart.alignValue = function(_) { + if (!arguments.length) return alignValue; + alignValue = _; + return chart; + }; + + chart.rightAlignValue = function(_) { + if (!arguments.length) return rightAlignValue; + rightAlignValue = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} + +nv.models.stackedArea = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , color = nv.utils.defaultColor() // a function that computes the color + , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't selet one + , getX = function(d) { return d.x } // accessor to get the x value from a data point + , getY = function(d) { return d.y } // accessor to get the y value from a data point + , style = 'stack' + , offset = 'zero' + , order = 'default' + , interpolate = 'linear' // controls the line interpolation + , clipEdge = false // if true, masks lines within x and y scale + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , yAxisTooltipFormat = d3.format(',.3f') + , scatter = nv.models.scatter() + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'areaClick', 'areaMouseover', 'areaMouseout') + ; + + scatter + .size(2.2) // default size + .sizeDomain([2.2,2.2]) // all the same size by default + ; + + /************************************ + * offset: + * 'wiggle' (stream) + * 'zero' (stacked) + * 'expand' (normalize to 100%) + * 'silhouette' (simple centered) + * + * order: + * 'inside-out' (stream) + * 'default' (input order) + ************************************/ + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + //------------------------------------------------------------ + // Setup Scales + + x = scatter.xScale(); + y = scatter.yScale(); + + //------------------------------------------------------------ + + + // Injecting point index into each point because d3.layout.stack().out does not give index + // ***Also storing getY(d,i) as stackedY so that it can be set to 0 if series is disabled + data = data.map(function(aseries, i) { + aseries.values = aseries.values.map(function(d, j) { + d.index = j; + d.stackedY = aseries.disabled ? 0 : getY(d,j); + return d; + }) + return aseries; + }); + + + data = d3.layout.stack() + .order(order) + .offset(offset) + .values(function(d) { return d.values }) //TODO: make values customizeable in EVERY model in this fashion + .x(getX) + .y(function(d) { return d.stackedY }) + .out(function(d, y0, y) { + d.display = { + y: y, + y0: y0 + }; + }) + (data); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-stackedarea').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedarea'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-areaWrap'); + gEnter.append('g').attr('class', 'nv-scatterWrap'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + scatter + .width(availableWidth) + .height(availableHeight) + .x(getX) + .y(function(d) { return d.display.y + d.display.y0 }) + .forceY([0]) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + + + var scatterWrap = g.select('.nv-scatterWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + //d3.transition(scatterWrap).call(scatter); + scatterWrap.call(scatter); + + + + + + defsEnter.append('clipPath') + .attr('id', 'nv-edge-clip-' + id) + .append('rect'); + + wrap.select('#nv-edge-clip-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); + + + + + var area = d3.svg.area() + .x(function(d,i) { return x(getX(d,i)) }) + .y0(function(d) { return y(d.display.y0) }) + .y1(function(d) { return y(d.display.y + d.display.y0) }) + .interpolate(interpolate); + + var zeroArea = d3.svg.area() + .x(function(d,i) { return x(getX(d,i)) }) + .y0(function(d) { return y(d.display.y0) }) + .y1(function(d) { return y(d.display.y0) }); + + + var path = g.select('.nv-areaWrap').selectAll('path.nv-area') + .data(function(d) { return d }); + //.data(function(d) { return d }, function(d) { return d.key }); + path.enter().append('path').attr('class', function(d,i) { return 'nv-area nv-area-' + i }) + .on('mouseover', function(d,i) { + d3.select(this).classed('hover', true); + dispatch.areaMouseover({ + point: d, + series: d.key, + pos: [d3.event.pageX, d3.event.pageY], + seriesIndex: i + }); + }) + .on('mouseout', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.areaMouseout({ + point: d, + series: d.key, + pos: [d3.event.pageX, d3.event.pageY], + seriesIndex: i + }); + }) + .on('click', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.areaClick({ + point: d, + series: d.key, + pos: [d3.event.pageX, d3.event.pageY], + seriesIndex: i + }); + }) + //d3.transition(path.exit()) + path.exit() + .attr('d', function(d,i) { return zeroArea(d.values,i) }) + .remove(); + path + .style('fill', function(d,i){ return d.color || color(d, i) }) + .style('stroke', function(d,i){ return d.color || color(d, i) }); + //d3.transition(path) + path + .attr('d', function(d,i) { return area(d.values,i) }) + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + scatter.dispatch.on('elementMouseover.area', function(e) { + g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', true); + }); + scatter.dispatch.on('elementMouseout.area', function(e) { + g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', false); + }); + + //============================================================ + + }); + + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + scatter.dispatch.on('elementClick.area', function(e) { + dispatch.areaClick(e); + }) + scatter.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top], + dispatch.tooltipShow(e); + }); + scatter.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + //============================================================ + + + //============================================================ + // Global getters and setters + //------------------------------------------------------------ + + chart.dispatch = dispatch; + chart.scatter = scatter; + + d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius'); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = d3.functor(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = d3.functor(_); + return chart; + } + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.offset = function(_) { + if (!arguments.length) return offset; + offset = _; + return chart; + }; + + chart.order = function(_) { + if (!arguments.length) return order; + order = _; + return chart; + }; + + //shortcut for offset + order + chart.style = function(_) { + if (!arguments.length) return style; + style = _; + + switch (style) { + case 'stack': + chart.offset('zero'); + chart.order('default'); + break; + case 'stream': + chart.offset('wiggle'); + chart.order('inside-out'); + break; + case 'stream-center': + chart.offset('silhouette'); + chart.order('inside-out'); + break; + case 'expand': + chart.offset('expand'); + chart.order('default'); + break; + } + + return chart; + }; + + chart.interpolate = function(_) { + if (!arguments.length) return interpolate; + interpolate = _; + return interpolate; + + }; + + //============================================================ + + + return chart; +} + +nv.models.stackedAreaChart = function() { + + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var stacked = nv.models.stackedArea() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + , controls = nv.models.legend() + ; + + var margin = {top: 30, right: 25, bottom: 50, left: 60} + , width = null + , height = null + , color = nv.utils.defaultColor() // a function that takes in d, i and returns color + , showControls = true + , showLegend = true + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

      ' + key + '

      ' + + '

      ' + y + ' on ' + x + '

      ' + } + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , yAxisTickFormat = d3.format(',.2f') + , yAxisTooltipFormat = d3.format(',.3f') + , state = { style: stacked.style() } + , defaultState = null + , noData = 'No Data Available.' + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , controlWidth = 250 + ; + + xAxis + .orient('bottom') + .tickPadding(7) + ; + yAxis + .orient('left') + ; + stacked.scatter + .pointActive(function(d) { + //console.log(stacked.y()(d), !!Math.round(stacked.y()(d) * 100)); + return !!Math.round(stacked.y()(d) * 100); + }) + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(stacked.x()(e.point, e.pointIndex)), + //y = yAxis.tickFormat()(stacked.y()(e.point, e.pointIndex)), + y = yAxisTooltipFormat(stacked.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().call(chart); }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = stacked.xScale(); + y = stacked.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-stackedAreaChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedAreaChart').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-stackedWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend + .width( availableWidth - controlWidth ); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(' + controlWidth + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + var controlsData = [ + { key: 'Stacked', disabled: stacked.offset() != 'zero' }, + { key: 'Stream', disabled: stacked.offset() != 'wiggle' }, + { key: 'Expanded', disabled: stacked.offset() != 'expand' } + ]; + + controls + .width( controlWidth ) + .color(['#444', '#444', '#444']); + + g.select('.nv-controlsWrap') + .datum(controlsData) + .call(controls); + + + if ( margin.top != Math.max(controls.height(), legend.height()) ) { + margin.top = Math.max(controls.height(), legend.height()); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + + g.select('.nv-controlsWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Main Chart Component(s) + + stacked + .width(availableWidth) + .height(availableHeight) + + var stackedWrap = g.select('.nv-stackedWrap') + .datum(data); + //d3.transition(stackedWrap).call(stacked); + stackedWrap.call(stacked); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize( -availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + availableHeight + ')'); + //d3.transition(g.select('.nv-x.nv-axis')) + g.select('.nv-x.nv-axis') + .transition().duration(0) + .call(xAxis); + + yAxis + .scale(y) + .ticks(stacked.offset() == 'wiggle' ? 0 : availableHeight / 36) + .tickSize(-availableWidth, 0) + .setTickFormat(stacked.offset() == 'expand' ? d3.format('%') : yAxisTickFormat); + + //d3.transition(g.select('.nv-y.nv-axis')) + g.select('.nv-y.nv-axis') + .transition().duration(0) + .call(yAxis); + + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + stacked.dispatch.on('areaClick.toggle', function(e) { + if (data.filter(function(d) { return !d.disabled }).length === 1) + data = data.map(function(d) { + d.disabled = false; + return d + }); + else + data = data.map(function(d,i) { + d.disabled = (i != e.seriesIndex); + return d + }); + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + + //selection.transition().call(chart); + chart.update(); + }); + + legend.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + if (!data.filter(function(d) { return !d.disabled }).length) { + data.map(function(d) { + d.disabled = false; + return d; + }); + } + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + + //selection.transition().call(chart); + chart.update(); + }); + + legend.dispatch.on('legendDblclick', function(d) { + //Double clicking should always enable current series, and disabled all others. + data.forEach(function(d) { + d.disabled = true; + }); + d.disabled = false; + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + chart.update(); + }); + + controls.dispatch.on('legendClick', function(d,i) { + if (!d.disabled) return; + + controlsData = controlsData.map(function(s) { + s.disabled = true; + return s; + }); + d.disabled = false; + + switch (d.key) { + case 'Stacked': + stacked.style('stack'); + break; + case 'Stream': + stacked.style('stream'); + break; + case 'Expanded': + stacked.style('expand'); + break; + } + + state.style = stacked.style(); + dispatch.stateChange(state); + + //selection.transition().call(chart); + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + if (typeof e.style !== 'undefined') { + stacked.style(e.style); + } + + chart.update(); + }); + + }); + + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + stacked.dispatch.on('tooltipShow', function(e) { + //disable tooltips when value ~= 0 + //// TODO: consider removing points from voronoi that have 0 value instead of this hack + /* + if (!Math.round(stacked.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range + setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0); + return false; + } + */ + + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top], + dispatch.tooltipShow(e); + }); + + stacked.dispatch.on('tooltipHide', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.stacked = stacked; + chart.legend = legend; + chart.controls = controls; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, stacked, 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'sizeDomain', 'interactive', 'offset', 'order', 'style', 'clipEdge', 'forceX', 'forceY', 'forceSize', 'interpolate'); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return getWidth; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return getHeight; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + stacked.color(color); + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltip = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.yAxisTooltipFormat = function(_) { + if (!arguments.length) return yAxisTooltipFormat; + yAxisTooltipFormat = _; + return chart; + }; + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + yAxis.setTickFormat = yAxis.tickFormat; + + yAxis.tickFormat = function(_) { + if (!arguments.length) return yAxisTickFormat; + yAxisTickFormat = _; + return yAxis; + }; + + //============================================================ + + return chart; +} +})(); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/nv.d3.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/nv.d3.min.js new file mode 100644 index 0000000..892379c --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/nv.d3.min.js @@ -0,0 +1 @@ +(function(){function t(e,t){return(new Date(t,e+1,0)).getDate()}function n(e,t,n){return function(r,i,s){var o=e(r),u=[];if(o1){while(op||r>d||d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined||a){if(l){if(d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined&&d3.event.relatedTarget.className.match(t.nvPointerEventsClass)){return}}u.elementMouseout({mouseX:n,mouseY:r});c.renderGuideLine(null);return}var f=s.invert(n);u.elementMousemove({mouseX:n,mouseY:r,pointXValue:f});if(d3.event.type==="dblclick"){u.elementDblclick({mouseX:n,mouseY:r,pointXValue:f})}}var h=d3.select(this);var p=n||960,d=r||400;var v=h.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([o]);var m=v.enter().append("g").attr("class"," nv-wrap nv-interactiveLineLayer");m.append("g").attr("class","nv-interactiveGuideLine");if(!f){return}f.on("mousemove",g,true).on("mouseout",g,true).on("dblclick",g);c.renderGuideLine=function(t){if(!a)return;var n=v.select(".nv-interactiveGuideLine").selectAll("line").data(t!=null?[e.utils.NaNtoZero(t)]:[],String);n.enter().append("line").attr("class","nv-guideline").attr("x1",function(e){return e}).attr("x2",function(e){return e}).attr("y1",d).attr("y2",0);n.exit().remove()}})}var t=e.models.tooltip();var n=null,r=null,i={left:0,top:0},s=d3.scale.linear(),o=d3.scale.linear(),u=d3.dispatch("elementMousemove","elementMouseout","elementDblclick"),a=true,f=null;var l=navigator.userAgent.indexOf("MSIE")!==-1;c.dispatch=u;c.tooltip=t;c.margin=function(e){if(!arguments.length)return i;i.top=typeof e.top!="undefined"?e.top:i.top;i.left=typeof e.left!="undefined"?e.left:i.left;return c};c.width=function(e){if(!arguments.length)return n;n=e;return c};c.height=function(e){if(!arguments.length)return r;r=e;return c};c.xScale=function(e){if(!arguments.length)return s;s=e;return c};c.showGuideLine=function(e){if(!arguments.length)return a;a=e;return c};c.svgContainer=function(e){if(!arguments.length)return f;f=e;return c};return c};e.interactiveBisect=function(e,t,n){"use strict";if(!e instanceof Array)return null;if(typeof n!=="function")n=function(e,t){return e.x};var r=d3.bisector(n).left;var i=d3.max([0,r(e,t)-1]);var s=n(e[i],i);if(typeof s==="undefined")s=i;if(s===t)return i;var o=d3.min([i+1,e.length-1]);var u=n(e[o],o);if(typeof u==="undefined")u=o;if(Math.abs(u-t)>=Math.abs(s-t))return i;else return o};e.nearestValueIndex=function(e,t,n){"use strict";var r=Infinity,i=null;e.forEach(function(e,s){var o=Math.abs(t-e);if(o<=r&&oT.height?0:x}v.top=Math.abs(x-S.top);v.left=Math.abs(E.left-S.left)}t+=a.offsetLeft+v.left-2*a.scrollLeft;u+=a.offsetTop+v.top-2*a.scrollTop}if(s&&s>0){u=Math.floor(u/s)*s}e.tooltip.calcTooltipPosition([t,u],r,i,h);return w}var t=null,n=null,r="w",i=50,s=25,o=null,u=null,a=null,f=null,l={left:null,top:null},c=true,h="nvtooltip-"+Math.floor(Math.random()*1e5);var p="nv-pointer-events-none";var d=function(e,t){return e};var v=function(e){return e};var m=function(e){if(t!=null)return t;if(e==null)return"";var n=d3.select(document.createElement("table"));var r=n.selectAll("thead").data([e]).enter().append("thead");r.append("tr").append("td").attr("colspan",3).append("strong").classed("x-value",true).html(v(e.value));var i=n.selectAll("tbody").data([e]).enter().append("tbody");var s=i.selectAll("tr").data(function(e){return e.series}).enter().append("tr").classed("highlight",function(e){return e.highlight});s.append("td").classed("legend-color-guide",true).append("div").style("background-color",function(e){return e.color});s.append("td").classed("key",true).html(function(e){return e.key});s.append("td").classed("value",true).html(function(e,t){return d(e.value,t)});s.selectAll("td").each(function(e){if(e.highlight){var t=d3.scale.linear().domain([0,1]).range(["#fff",e.color]);var n=.6;d3.select(this).style("border-bottom-color",t(n)).style("border-top-color",t(n))}});var o=n.node().outerHTML;if(e.footer!==undefined)o+="";return o};var g=function(e){if(e&&e.series&&e.series.length>0)return true;return false};w.nvPointerEventsClass=p;w.content=function(e){if(!arguments.length)return t;t=e;return w};w.tooltipElem=function(){return f};w.contentGenerator=function(e){if(!arguments.length)return m;if(typeof e==="function"){m=e}return w};w.data=function(e){if(!arguments.length)return n;n=e;return w};w.gravity=function(e){if(!arguments.length)return r;r=e;return w};w.distance=function(e){if(!arguments.length)return i;i=e;return w};w.snapDistance=function(e){if(!arguments.length)return s;s=e;return w};w.classes=function(e){if(!arguments.length)return u;u=e;return w};w.chartContainer=function(e){if(!arguments.length)return a;a=e;return w};w.position=function(e){if(!arguments.length)return l;l.left=typeof e.left!=="undefined"?e.left:l.left;l.top=typeof e.top!=="undefined"?e.top:l.top;return w};w.fixedTop=function(e){if(!arguments.length)return o;o=e;return w};w.enabled=function(e){if(!arguments.length)return c;c=e;return w};w.valueFormatter=function(e){if(!arguments.length)return d;if(typeof e==="function"){d=e}return w};w.headerFormatter=function(e){if(!arguments.length)return v;if(typeof e==="function"){v=e}return w};w.id=function(){return h};return w};e.tooltip.show=function(t,n,r,i,s,o){var u=document.createElement("div");u.className="nvtooltip "+(o?o:"xy-tooltip");var a=s;if(!s||s.tagName.match(/g|svg/i)){a=document.getElementsByTagName("body")[0]}u.style.left=0;u.style.top=0;u.style.opacity=0;u.innerHTML=n;a.appendChild(u);if(s){t[0]=t[0]-s.scrollLeft;t[1]=t[1]-s.scrollTop}e.tooltip.calcTooltipPosition(t,r,i,u)};e.tooltip.findFirstNonSVGParent=function(e){while(e.tagName.match(/^g|svg$/i)!==null){e=e.parentNode}return e};e.tooltip.findTotalOffsetTop=function(e,t){var n=t;do{if(!isNaN(e.offsetTop)){n+=e.offsetTop}}while(e=e.offsetParent);return n};e.tooltip.findTotalOffsetLeft=function(e,t){var n=t;do{if(!isNaN(e.offsetLeft)){n+=e.offsetLeft}}while(e=e.offsetParent);return n};e.tooltip.calcTooltipPosition=function(t,n,r,i){var s=parseInt(i.offsetHeight),o=parseInt(i.offsetWidth),u=e.utils.windowSize().width,a=e.utils.windowSize().height,f=window.pageYOffset,l=window.pageXOffset,c,h;a=window.innerWidth>=document.body.scrollWidth?a:a-16;u=window.innerHeight>=document.body.scrollHeight?u:u-16;n=n||"s";r=r||20;var p=function(t){return e.tooltip.findTotalOffsetTop(t,h)};var d=function(t){return e.tooltip.findTotalOffsetLeft(t,c)};switch(n){case"e":c=t[0]-o-r;h=t[1]-s/2;var v=d(i);var m=p(i);if(vl?t[0]+r:l-v+c;if(mf+a)h=f+a-m+h-s;break;case"w":c=t[0]+r;h=t[1]-s/2;var v=d(i);var m=p(i);if(v+o>u)c=t[0]-o-r;if(mf+a)h=f+a-m+h-s;break;case"n":c=t[0]-o/2-5;h=t[1]+r;var v=d(i);var m=p(i);if(vu)c=c-o/2+5;if(m+s>f+a)h=f+a-m+h-s;break;case"s":c=t[0]-o/2;h=t[1]-s-r;var v=d(i);var m=p(i);if(vu)c=c-o/2+5;if(f>m)h=f;break;case"none":c=t[0];h=t[1]-r;var v=d(i);var m=p(i);break}i.style.left=c+"px";i.style.top=h+"px";i.style.opacity=1;i.style.position="absolute";return i};e.tooltip.cleanup=function(){var e=document.getElementsByClassName("nvtooltip");var t=[];while(e.length){t.push(e[0]);e[0].style.transitionDelay="0 !important";e[0].style.opacity=0;e[0].className="nvtooltip-pending-removal"}setTimeout(function(){while(t.length){var e=t.pop();e.parentNode.removeChild(e)}},500)}})();e.utils.windowSize=function(){var e={width:640,height:480};if(document.body&&document.body.offsetWidth){e.width=document.body.offsetWidth;e.height=document.body.offsetHeight}if(document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth){e.width=document.documentElement.offsetWidth;e.height=document.documentElement.offsetHeight}if(window.innerWidth&&window.innerHeight){e.width=window.innerWidth;e.height=window.innerHeight}return e};e.utils.windowResize=function(e){if(e===undefined)return;var t=window.onresize;window.onresize=function(n){if(typeof t=="function")t(n);e(n)}};e.utils.getColor=function(t){if(!arguments.length)return e.utils.defaultColor();if(Object.prototype.toString.call(t)==="[object Array]")return function(e,n){return e.color||t[n%t.length]};else return t};e.utils.defaultColor=function(){var e=d3.scale.category20().range();return function(t,n){return t.color||e[n%e.length]}};e.utils.customTheme=function(e,t,n){t=t||function(e){return e.key};n=n||d3.scale.category20().range();var r=n.length;return function(i,s){var o=t(i);if(!r)r=n.length;if(typeof e[o]!=="undefined")return typeof e[o]==="function"?e[o]():e[o];else return n[--r]}};e.utils.pjax=function(t,n){function r(r){d3.html(r,function(r){var i=d3.select(n).node();i.parentNode.replaceChild(d3.select(r).select(n).node(),i);e.utils.pjax(t,n)})}d3.selectAll(t).on("click",function(){history.pushState(this.href,this.textContent,this.href);r(this.href);d3.event.preventDefault()});d3.select(window).on("popstate",function(){if(d3.event.state)r(d3.event.state)})};e.utils.calcApproxTextWidth=function(e){if(e instanceof d3.selection){var t=parseInt(e.style("font-size").replace("px",""));var n=e.text().length;return n*t*.5}return 0};e.utils.NaNtoZero=function(e){if(typeof e!=="number"||isNaN(e)||e===null||e===Infinity)return 0;return e};e.utils.optionsFunc=function(e){if(e){d3.map(e).forEach(function(e,t){if(typeof this[e]==="function"){this[e](t)}}.bind(this))}return this};e.models.axis=function(){"use strict";function g(e){e.each(function(e){var i=d3.select(this);var g=i.selectAll("g.nv-wrap.nv-axis").data([e]);var y=g.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");var b=y.append("g");var w=g.select("g");if(p!==null)t.ticks(p);else if(t.orient()=="top"||t.orient()=="bottom")t.ticks(Math.abs(s.range()[1]-s.range()[0])/100);w.transition().call(t);m=m||t.scale();var E=t.tickFormat();if(E==null){E=m.tickFormat()}var S=w.selectAll("text.nv-axislabel").data([o||null]);S.exit().remove();switch(t.orient()){case"top":S.enter().append("text").attr("class","nv-axislabel");var x=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);S.attr("text-anchor","middle").attr("y",0).attr("x",x/2);if(u){var T=g.selectAll("g.nv-axisMaxMin").data(s.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+s(e)+",0)"}).select("text").attr("dy","0em").attr("y",-t.tickPadding()).attr("text-anchor","middle").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+s.range()[t]+",0)"})}break;case"bottom":var N=36;var C=30;var k=w.selectAll("g").select("text");if(f%360){k.each(function(e,t){var n=this.getBBox().width;if(n>C)C=n});var L=Math.abs(Math.sin(f*Math.PI/180));var N=(L?L*C:C)+30;k.attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f%360>0?"start":"end")}S.enter().append("text").attr("class","nv-axislabel");var x=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);S.attr("text-anchor","middle").attr("y",N).attr("x",x/2);if(u){var T=g.selectAll("g.nv-axisMaxMin").data([s.domain()[0],s.domain()[s.domain().length-1]]);T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",t.tickPadding()).attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f?f%360>0?"start":"end":"middle").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"})}if(c)k.attr("transform",function(e,t){return"translate(0,"+(t%2==0?"0":"12")+")"});break;case"right":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",l?"middle":"begin").attr("transform",l?"rotate(90)":"").attr("y",l?-Math.max(n.right,r)+12:-10).attr("x",l?s.range()[0]/2:t.tickPadding());if(u){var T=g.selectAll("g.nv-axisMaxMin").data(s.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+s(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",t.tickPadding()).style("text-anchor","start").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}break;case"left":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",l?"middle":"end").attr("transform",l?"rotate(-90)":"").attr("y",l?-Math.max(n.left,r)+v:-10).attr("x",l?-s.range()[0]/2:-t.tickPadding());if(u){var T=g.selectAll("g.nv-axisMaxMin").data(s.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+m(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-t.tickPadding()).attr("text-anchor","end").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}break}S.text(function(e){return e});if(u&&(t.orient()==="left"||t.orient()==="right")){w.selectAll("g").each(function(e,t){d3.select(this).select("text").attr("opacity",1);var n;if(d){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(s(e)s.range()[0]-10){if(e>1e-10||e<-1e-10)d3.select(this).attr("opacity",0);d3.select(this).select("text").attr("opacity",0)}});if(s.domain()[0]==s.domain()[1]&&s.domain()[0]==0)g.selectAll("g.nv-axisMaxMin").style("opacity",function(e,t){return!t?1:0})}if(u&&(t.orient()==="top"||t.orient()==="bottom")){var A=[];g.selectAll("g.nv-axisMaxMin").each(function(e,t){try{if(t)A.push(s(e)-this.getBBox().width-4);else A.push(s(e)+this.getBBox().width+4)}catch(n){if(t)A.push(s(e)-4);else A.push(s(e)+4)}});w.selectAll("g").each(function(e,t){var n;if(d){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(s(e)A[1]){if(e>1e-10||e<-1e-10)d3.select(this).remove();else d3.select(this).select("text").remove()}})}if(a)w.selectAll(".tick").filter(function(e){return!parseFloat(Math.round(e.__data__*1e5)/1e6)&&e.__data__!==undefined}).classed("zero",true);m=s.copy()});return g}var t=d3.svg.axis();var n={top:0,right:0,bottom:0,left:0},r=75,i=60,s=d3.scale.linear(),o=null,u=true,a=true,f=0,l=true,c=false,h=false,p=null,d=false,v=12;t.scale(s).orient("bottom").tickFormat(function(e){return e});var m;g.axis=t;d3.rebind(g,t,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat");d3.rebind(g,s,"domain","range","rangeBand","rangeBands");g.options=e.utils.optionsFunc.bind(g);g.margin=function(e){if(!arguments.length)return n;n.top=typeof e.top!="undefined"?e.top:n.top;n.right=typeof e.right!="undefined"?e.right:n.right;n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom;n.left=typeof e.left!="undefined"?e.left:n.left;return g};g.width=function(e){if(!arguments.length)return r;r=e;return g};g.ticks=function(e){if(!arguments.length)return p;p=e;return g};g.height=function(e){if(!arguments.length)return i;i=e;return g};g.axisLabel=function(e){if(!arguments.length)return o;o=e;return g};g.showMaxMin=function(e){if(!arguments.length)return u;u=e;return g};g.logScale=function(e){if(!arguments.length)return d;d=e;return g};g.highlightZero=function(e){if(!arguments.length)return a;a=e;return g};g.scale=function(e){if(!arguments.length)return s;s=e;t.scale(s);h=typeof s.rangeBands==="function";d3.rebind(g,s,"domain","range","rangeBand","rangeBands");return g};g.rotateYLabel=function(e){if(!arguments.length)return l;l=e;return g};g.rotateLabels=function(e){if(!arguments.length)return f;f=e;return g};g.staggerLabels=function(e){if(!arguments.length)return c;c=e;return g};g.axisLabelDistance=function(e){if(!arguments.length)return v;v=e;return g};return g};e.models.bullet=function(){"use strict";function m(e){e.each(function(e,n){var p=c-t.left-t.right,m=h-t.top-t.bottom,g=d3.select(this);var y=i.call(this,e,n).slice().sort(d3.descending),b=s.call(this,e,n).slice().sort(d3.descending),w=o.call(this,e,n).slice().sort(d3.descending),E=u.call(this,e,n).slice(),S=a.call(this,e,n).slice(),x=f.call(this,e,n).slice();var T=d3.scale.linear().domain(d3.extent(d3.merge([l,y]))).range(r?[p,0]:[0,p]);var N=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(T.range());this.__chart__=T;var C=d3.min(y),k=d3.max(y),L=y[1];var A=g.selectAll("g.nv-wrap.nv-bullet").data([e]);var O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet");var M=O.append("g");var _=A.select("g");M.append("rect").attr("class","nv-range nv-rangeMax");M.append("rect").attr("class","nv-range nv-rangeAvg");M.append("rect").attr("class","nv-range nv-rangeMin");M.append("rect").attr("class","nv-measure");M.append("path").attr("class","nv-markerTriangle");A.attr("transform","translate("+t.left+","+t.top+")");var D=function(e){return Math.abs(N(e)-N(0))},P=function(e){return Math.abs(T(e)-T(0))};var H=function(e){return e<0?N(e):N(0)},B=function(e){return e<0?T(e):T(0)};_.select("rect.nv-rangeMax").attr("height",m).attr("width",P(k>0?k:C)).attr("x",B(k>0?k:C)).datum(k>0?k:C);_.select("rect.nv-rangeAvg").attr("height",m).attr("width",P(L)).attr("x",B(L)).datum(L);_.select("rect.nv-rangeMin").attr("height",m).attr("width",P(k)).attr("x",B(k)).attr("width",P(k>0?C:k)).attr("x",B(k>0?C:k)).datum(k>0?C:k);_.select("rect.nv-measure").style("fill",d).attr("height",m/3).attr("y",m/3).attr("width",w<0?T(0)-T(w[0]):T(w[0])-T(0)).attr("x",B(w)).on("mouseover",function(){v.elementMouseover({value:w[0],label:x[0]||"Current",pos:[T(w[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:w[0],label:x[0]||"Current"})});var j=m/6;if(b[0]){_.selectAll("path.nv-markerTriangle").attr("transform",function(e){return"translate("+T(b[0])+","+m/2+")"}).attr("d","M0,"+j+"L"+j+","+ -j+" "+ -j+","+ -j+"Z").on("mouseover",function(){v.elementMouseover({value:b[0],label:S[0]||"Previous",pos:[T(b[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:b[0],label:S[0]||"Previous"})})}else{_.selectAll("path.nv-markerTriangle").remove()}A.selectAll(".nv-range").on("mouseover",function(e,t){var n=E[t]||(!t?"Maximum":t==1?"Mean":"Minimum");v.elementMouseover({value:e,label:n,pos:[T(e),m/2]})}).on("mouseout",function(e,t){var n=E[t]||(!t?"Maximum":t==1?"Mean":"Minimum");v.elementMouseout({value:e,label:n})})});return m}var t={top:0,right:0,bottom:0,left:0},n="left",r=false,i=function(e){return e.ranges},s=function(e){return e.markers},o=function(e){return e.measures},u=function(e){return e.rangeLabels?e.rangeLabels:[]},a=function(e){return e.markerLabels?e.markerLabels:[]},f=function(e){return e.measureLabels?e.measureLabels:[]},l=[0],c=380,h=30,p=null,d=e.utils.getColor(["#1f77b4"]),v=d3.dispatch("elementMouseover","elementMouseout");m.dispatch=v;m.options=e.utils.optionsFunc.bind(m);m.orient=function(e){if(!arguments.length)return n;n=e;r=n=="right"||n=="bottom";return m};m.ranges=function(e){if(!arguments.length)return i;i=e;return m};m.markers=function(e){if(!arguments.length)return s;s=e;return m};m.measures=function(e){if(!arguments.length)return o;o=e;return m};m.forceX=function(e){if(!arguments.length)return l;l=e;return m};m.width=function(e){if(!arguments.length)return c;c=e;return m};m.height=function(e){if(!arguments.length)return h;h=e;return m};m.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return m};m.tickFormat=function(e){if(!arguments.length)return p;p=e;return m};m.color=function(t){if(!arguments.length)return d;d=e.utils.getColor(t);return m};return m};e.models.bulletChart=function(){"use strict";function m(e){e.each(function(n,h){var g=d3.select(this);var y=(a||parseInt(g.style("width"))||960)-i.left-i.right,b=f-i.top-i.bottom,w=this;m.update=function(){m(e)};m.container=this;if(!n||!s.call(this,n,h)){var E=g.selectAll(".nv-noData").data([p]);E.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");E.attr("x",i.left+y/2).attr("y",18+i.top+b/2).text(function(e){return e});return m}else{g.selectAll(".nv-noData").remove()}var S=s.call(this,n,h).slice().sort(d3.descending),x=o.call(this,n,h).slice().sort(d3.descending),T=u.call(this,n,h).slice().sort(d3.descending);var N=g.selectAll("g.nv-wrap.nv-bulletChart").data([n]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart");var k=C.append("g");var L=N.select("g");k.append("g").attr("class","nv-bulletWrap");k.append("g").attr("class","nv-titles");N.attr("transform","translate("+i.left+","+i.top+")");var A=d3.scale.linear().domain([0,Math.max(S[0],x[0],T[0])]).range(r?[y,0]:[0,y]);var O=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(A.range());this.__chart__=A;var M=function(e){return Math.abs(O(e)-O(0))},_=function(e){return Math.abs(A(e)-A(0))};var D=k.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(f-i.top-i.bottom)/2+")");D.append("text").attr("class","nv-title").text(function(e){return e.title});D.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(e){return e.subtitle});t.width(y).height(b);var P=L.select(".nv-bulletWrap");d3.transition(P).call(t);var H=l||A.tickFormat(y/100);var B=L.selectAll("g.nv-tick").data(A.ticks(y/50),function(e){return this.textContent||H(e)});var j=B.enter().append("g").attr("class","nv-tick").attr("transform",function(e){return"translate("+O(e)+",0)"}).style("opacity",1e-6);j.append("line").attr("y1",b).attr("y2",b*7/6);j.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",b*7/6).text(H);var F=d3.transition(B).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1);F.select("line").attr("y1",b).attr("y2",b*7/6);F.select("text").attr("y",b*7/6);d3.transition(B.exit()).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1e-6).remove();d.on("tooltipShow",function(e){e.key=n.title;if(c)v(e,w.parentNode)})});d3.timer.flush();return m}var t=e.models.bullet();var n="left",r=false,i={top:5,right:40,bottom:20,left:120},s=function(e){return e.ranges},o=function(e){return e.markers},u=function(e){return e.measures},a=null,f=55,l=null,c=true,h=function(e,t,n,r,i){return"

      "+t+"

      "+"

      "+n+"

      "},p="No Data Available.",d=d3.dispatch("tooltipShow","tooltipHide");var v=function(t,n){var r=t.pos[0]+(n.offsetLeft||0)+i.left,s=t.pos[1]+(n.offsetTop||0)+i.top,o=h(t.key,t.label,t.value,t,m);e.tooltip.show([r,s],o,t.value<0?"e":"w",null,n)};t.dispatch.on("elementMouseover.tooltip",function(e){d.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){d.tooltipHide(e)});d.on("tooltipHide",function(){if(c)e.tooltip.cleanup()});m.dispatch=d;m.bullet=t;d3.rebind(m,t,"color");m.options=e.utils.optionsFunc.bind(m);m.orient=function(e){if(!arguments.length)return n;n=e;r=n=="right"||n=="bottom";return m};m.ranges=function(e){if(!arguments.length)return s;s=e;return m};m.markers=function(e){if(!arguments.length)return o;o=e;return m};m.measures=function(e){if(!arguments.length)return u;u=e;return m};m.width=function(e){if(!arguments.length)return a;a=e;return m};m.height=function(e){if(!arguments.length)return f;f=e;return m};m.margin=function(e){if(!arguments.length)return i;i.top=typeof e.top!="undefined"?e.top:i.top;i.right=typeof e.right!="undefined"?e.right:i.right;i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom;i.left=typeof e.left!="undefined"?e.left:i.left;return m};m.tickFormat=function(e){if(!arguments.length)return l;l=e;return m};m.tooltips=function(e){if(!arguments.length)return c;c=e;return m};m.tooltipContent=function(e){if(!arguments.length)return h;h=e;return m};m.noData=function(e){if(!arguments.length)return p;p=e;return m};return m};e.models.cumulativeLineChart=function(){"use strict";function _(b){b.each(function(b){function q(e,t){d3.select(_.container).style("cursor","ew-resize")}function R(e,t){O.x=d3.event.x;O.i=Math.round(A.invert(O.x));rt()}function U(e,t){d3.select(_.container).style("cursor","auto");x.index=O.i;k.stateChange(x)}function rt(){nt.data([O]);var e=_.transitionDuration();_.transitionDuration(0);_.update();_.transitionDuration(e)}var P=d3.select(this).classed("nv-chart-"+S,true),H=this;var B=(f||parseInt(P.style("width"))||960)-u.left-u.right,j=(l||parseInt(P.style("height"))||400)-u.top-u.bottom;_.update=function(){P.transition().duration(L).call(_)};_.container=this;x.disabled=b.map(function(e){return!!e.disabled});if(!T){var F;T={};for(F in x){if(x[F]instanceof Array)T[F]=x[F].slice(0);else T[F]=x[F]}}var I=d3.behavior.drag().on("dragstart",q).on("drag",R).on("dragend",U);if(!b||!b.length||!b.filter(function(e){return e.values.length}).length){var z=P.selectAll(".nv-noData").data([N]);z.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");z.attr("x",u.left+B/2).attr("y",u.top+j/2).text(function(e){return e});return _}else{P.selectAll(".nv-noData").remove()}w=t.xScale();E=t.yScale();if(!y){var W=b.filter(function(e){return!e.disabled}).map(function(e,n){var r=d3.extent(e.values,t.y());if(r[0]<-.95)r[0]=-.95;return[(r[0]-r[1])/(1+r[1]),(r[1]-r[0])/(1+r[0])]});var X=[d3.min(W,function(e){return e[0]}),d3.max(W,function(e){return e[1]})];t.yDomain(X)}else{t.yDomain(null)}A.domain([0,b[0].values.length-1]).range([0,B]).clamp(true);var b=D(O.i,b);var V=g?"none":"all";var $=P.selectAll("g.nv-wrap.nv-cumulativeLine").data([b]);var J=$.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g");var K=$.select("g");J.append("g").attr("class","nv-interactive");J.append("g").attr("class","nv-x nv-axis").style("pointer-events","none");J.append("g").attr("class","nv-y nv-axis");J.append("g").attr("class","nv-background");J.append("g").attr("class","nv-linesWrap").style("pointer-events",V);J.append("g").attr("class","nv-avgLinesWrap").style("pointer-events","none");J.append("g").attr("class","nv-legendWrap");J.append("g").attr("class","nv-controlsWrap");if(c){i.width(B);K.select(".nv-legendWrap").datum(b).call(i);if(u.top!=i.height()){u.top=i.height();j=(l||parseInt(P.style("height"))||400)-u.top-u.bottom}K.select(".nv-legendWrap").attr("transform","translate(0,"+ -u.top+")")}if(m){var Q=[{key:"Re-scale y-axis",disabled:!y}];s.width(140).color(["#444","#444","#444"]);K.select(".nv-controlsWrap").datum(Q).attr("transform","translate(0,"+ -u.top+")").call(s)}$.attr("transform","translate("+u.left+","+u.top+")");if(d){K.select(".nv-y.nv-axis").attr("transform","translate("+B+",0)")}var G=b.filter(function(e){return e.tempDisabled});$.select(".tempDisabled").remove();if(G.length){$.append("text").attr("class","tempDisabled").attr("x",B/2).attr("y","-.71em").style("text-anchor","end").text(G.map(function(e){return e.key}).join(", ")+" values cannot be calculated for this time period.")}if(g){o.width(B).height(j).margin({left:u.left,top:u.top}).svgContainer(P).xScale(w);$.select(".nv-interactive").call(o)}J.select(".nv-background").append("rect");K.select(".nv-background rect").attr("width",B).attr("height",j);t.y(function(e){return e.display.y}).width(B).height(j).color(b.map(function(e,t){return e.color||a(e,t)}).filter(function(e,t){return!b[t].disabled&&!b[t].tempDisabled}));var Y=K.select(".nv-linesWrap").datum(b.filter(function(e){return!e.disabled&&!e.tempDisabled}));Y.call(t);b.forEach(function(e,t){e.seriesIndex=t});var Z=b.filter(function(e){return!e.disabled&&!!C(e)});var et=K.select(".nv-avgLinesWrap").selectAll("line").data(Z,function(e){return e.key});var tt=function(e){var t=E(C(e));if(t<0)return 0;if(t>j)return j;return t};et.enter().append("line").style("stroke-width",2).style("stroke-dasharray","10,10").style("stroke",function(e,n){return t.color()(e,e.seriesIndex)}).attr("x1",0).attr("x2",B).attr("y1",tt).attr("y2",tt);et.style("stroke-opacity",function(e){var t=E(C(e));if(t<0||t>j)return 0;return 1}).attr("x1",0).attr("x2",B).attr("y1",tt).attr("y2",tt);et.exit().remove();var nt=Y.selectAll(".nv-indexLine").data([O]);nt.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).style("pointer-events","all").call(I);nt.attr("transform",function(e){return"translate("+A(e.i)+",0)"}).attr("height",j);if(h){n.scale(w).ticks(Math.min(b[0].values.length,B/70)).tickSize(-j,0);K.select(".nv-x.nv-axis").attr("transform","translate(0,"+E.range()[0]+")");d3.transition(K.select(".nv-x.nv-axis")).call(n)}if(p){r.scale(E).ticks(j/36).tickSize(-B,0);d3.transition(K.select(".nv-y.nv-axis")).call(r)}K.select(".nv-background rect").on("click",function(){O.x=d3.mouse(this)[0];O.i=Math.round(A.invert(O.x));x.index=O.i;k.stateChange(x);rt()});t.dispatch.on("elementClick",function(e){O.i=e.pointIndex;O.x=A(O.i);x.index=O.i;k.stateChange(x);rt()});s.dispatch.on("legendClick",function(e,t){e.disabled=!e.disabled;y=!e.disabled;x.rescaleY=y;k.stateChange(x);_.update()});i.dispatch.on("stateChange",function(e){x.disabled=e.disabled;k.stateChange(x);_.update()});o.dispatch.on("elementMousemove",function(i){t.clearHighlights();var s,f,l,c=[];b.filter(function(e,t){e.seriesIndex=t;return!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,_.x());t.highlightPoint(r,f,true);var o=n.values[f];if(typeof o==="undefined")return;if(typeof s==="undefined")s=o;if(typeof l==="undefined")l=_.xScale()(_.x()(o,f));c.push({key:n.key,value:_.y()(o,f),color:a(n,n.seriesIndex)})});if(c.length>2){var h=_.yScale().invert(i.mouseY);var p=Math.abs(_.yScale().domain()[0]-_.yScale().domain()[1]);var d=.03*p;var m=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);if(m!==null)c[m].highlight=true}var g=n.tickFormat()(_.x()(s,f),f);o.tooltip.position({left:l+u.left,top:i.mouseY+u.top}).chartContainer(H.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:g,series:c})();o.renderGuideLine(l)});o.dispatch.on("elementMouseout",function(e){k.tooltipHide();t.clearHighlights()});k.on("tooltipShow",function(e){if(v)M(e,H.parentNode)});k.on("changeState",function(e){if(typeof e.disabled!=="undefined"){b.forEach(function(t,n){t.disabled=e.disabled[n]});x.disabled=e.disabled}if(typeof e.index!=="undefined"){O.i=e.index;O.x=A(O.i);x.index=e.index;nt.data([O])}if(typeof e.rescaleY!=="undefined"){y=e.rescaleY}_.update()})});return _}function D(e,n){return n.map(function(n,r){if(!n.values){return n}var i=t.y()(n.values[e],e);if(i<-.95){n.tempDisabled=true;return n}n.tempDisabled=false;n.values=n.values.map(function(e,n){e.display={y:(t.y()(e,n)-i)/(1+i)};return e});return n})}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline();var u={top:30,right:30,bottom:50,left:60},a=e.utils.defaultColor(),f=null,l=null,c=true,h=true,p=true,d=false,v=true,m=true,g=false,y=true,b=function(e,t,n,r,i){return"

      "+e+"

      "+"

      "+n+" at "+t+"

      "},w,E,S=t.id(),x={index:0,rescaleY:y},T=null,N="No Data Available.",C=function(e){return e.average},k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=250;n.orient("bottom").tickPadding(7);r.orient(d?"right":"left");s.updateState(false);var A=d3.scale.linear(),O={i:0,x:0};var M=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=b(i.series.key,a,f,i,_);e.tooltip.show([o,u],l,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top];k.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){k.tooltipHide(e)});k.on("tooltipHide",function(){if(v)e.tooltip.cleanup()});_.dispatch=k;_.lines=t;_.legend=i;_.xAxis=n;_.yAxis=r;_.interactiveLayer=o;d3.rebind(_,t,"defined","isArea","x","y","xScale","yScale","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id");_.options=e.utils.optionsFunc.bind(_);_.margin=function(e){if(!arguments.length)return u;u.top=typeof e.top!="undefined"?e.top:u.top;u.right=typeof e.right!="undefined"?e.right:u.right;u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom;u.left=typeof e.left!="undefined"?e.left:u.left;return _};_.width=function(e){if(!arguments.length)return f;f=e;return _};_.height=function(e){if(!arguments.length)return l;l=e;return _};_.color=function(t){if(!arguments.length)return a;a=e.utils.getColor(t);i.color(a);return _};_.rescaleY=function(e){if(!arguments.length)return y;y=e;return _};_.showControls=function(e){if(!arguments.length)return m;m=e;return _};_.useInteractiveGuideline=function(e){if(!arguments.length)return g;g=e;if(e===true){_.interactive(false);_.useVoronoi(false)}return _};_.showLegend=function(e){if(!arguments.length)return c;c=e;return _};_.showXAxis=function(e){if(!arguments.length)return h;h=e;return _};_.showYAxis=function(e){if(!arguments.length)return p;p=e;return _};_.rightAlignYAxis=function(e){if(!arguments.length)return d;d=e;r.orient(e?"right":"left");return _};_.tooltips=function(e){if(!arguments.length)return v;v=e;return _};_.tooltipContent=function(e){if(!arguments.length)return b;b=e;return _};_.state=function(e){if(!arguments.length)return x;x=e;return _};_.defaultState=function(e){if(!arguments.length)return T;T=e;return _};_.noData=function(e){if(!arguments.length)return N;N=e;return _};_.average=function(e){if(!arguments.length)return C;C=e;return _};_.transitionDuration=function(e){if(!arguments.length)return L;L=e;return _};return _};e.models.discreteBar=function(){"use strict";function E(e){e.each(function(e){var i=n-t.left-t.right,E=r-t.top-t.bottom,S=d3.select(this);e=e.map(function(e,t){e.values=e.values.map(function(e){e.series=t;return e});return e});var T=p&&d?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0}})});s.domain(p||d3.merge(T).map(function(e){return e.x})).rangeBands(v||[0,i],.1);o.domain(d||d3.extent(d3.merge(T).map(function(e){return e.y}).concat(f)));if(c)o.range(m||[E-(o.domain()[0]<0?12:0),o.domain()[1]>0?12:0]);else o.range(m||[E,0]);b=b||s;w=w||o.copy().range([o(0),o(0)]);var N=S.selectAll("g.nv-wrap.nv-discretebar").data([e]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar");var k=C.append("g");var L=N.select("g");k.append("g").attr("class","nv-groups");N.attr("transform","translate("+t.left+","+t.top+")");var A=N.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});A.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);A.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();A.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover});A.transition().style("stroke-opacity",1).style("fill-opacity",.75);var O=A.selectAll("g.nv-bar").data(function(e){return e.values});O.exit().remove();var M=O.enter().append("g").attr("transform",function(e,t,n){return"translate("+(s(u(e,t))+s.rangeBand()*.05)+", "+o(0)+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",true);g.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);g.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){g.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(t,n){g.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()});M.append("rect").attr("height",0).attr("width",s.rangeBand()*.9/e.length);if(c){M.append("text").attr("text-anchor","middle");O.select("text").text(function(e,t){return h(a(e,t))}).transition().attr("x",s.rangeBand()*.9/2).attr("y",function(e,t){return a(e,t)<0?o(a(e,t))-o(0)+12:-4})}else{O.selectAll("text").remove()}O.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(e,t){return e.color||l(e,t)}).style("stroke",function(e,t){return e.color||l(e,t)}).select("rect").attr("class",y).transition().attr("width",s.rangeBand()*.9/e.length);O.transition().attr("transform",function(e,t){var n=s(u(e,t))+s.rangeBand()*.05,r=a(e,t)<0?o(0):o(0)-o(a(e,t))<1?o(0)-1:o(a(e,t));return"translate("+n+", "+r+")"}).select("rect").attr("height",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(d&&d[0]||0))||1)});b=s.copy();w=o.copy()});return E}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=false,h=d3.format(",.2f"),p,d,v,m,g=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),y="discreteBar";var b,w;E.dispatch=g;E.options=e.utils.optionsFunc.bind(E);E.x=function(e){if(!arguments.length)return u;u=e;return E};E.y=function(e){if(!arguments.length)return a;a=e;return E};E.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return E};E.width=function(e){if(!arguments.length)return n;n=e;return E};E.height=function(e){if(!arguments.length)return r;r=e;return E};E.xScale=function(e){if(!arguments.length)return s;s=e;return E};E.yScale=function(e){if(!arguments.length)return o;o=e;return E};E.xDomain=function(e){if(!arguments.length)return p;p=e;return E};E.yDomain=function(e){if(!arguments.length)return d;d=e;return E};E.xRange=function(e){if(!arguments.length)return v;v=e;return E};E.yRange=function(e){if(!arguments.length)return m;m=e;return E};E.forceY=function(e){if(!arguments.length)return f;f=e;return E};E.color=function(t){if(!arguments.length)return l;l=e.utils.getColor(t);return E};E.id=function(e){if(!arguments.length)return i;i=e;return E};E.showValues=function(e){if(!arguments.length)return c;c=e;return E};E.valueFormat=function(e){if(!arguments.length)return h;h=e;return E};E.rectClass=function(e){if(!arguments.length)return y;y=e;return E};return E};e.models.discreteBarChart=function(){"use strict";function w(e){e.each(function(e){var u=d3.select(this),p=this;var E=(s||parseInt(u.style("width"))||960)-i.left-i.right,S=(o||parseInt(u.style("height"))||400)-i.top-i.bottom;w.update=function(){g.beforeUpdate();u.transition().duration(y).call(w)};w.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var T=u.selectAll(".nv-noData").data([m]);T.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");T.attr("x",i.left+E/2).attr("y",i.top+S/2).text(function(e){return e});return w}else{u.selectAll(".nv-noData").remove()}d=t.xScale();v=t.yScale().clamp(true);var N=u.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([e]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g");var k=C.append("defs");var L=N.select("g");C.append("g").attr("class","nv-x nv-axis");C.append("g").attr("class","nv-y nv-axis");C.append("g").attr("class","nv-barsWrap");L.attr("transform","translate("+i.left+","+i.top+")");if(l){L.select(".nv-y.nv-axis").attr("transform","translate("+E+",0)")}t.width(E).height(S);var A=L.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));A.transition().call(t);k.append("clipPath").attr("id","nv-x-label-clip-"+t.id()).append("rect");L.select("#nv-x-label-clip-"+t.id()+" rect").attr("width",d.rangeBand()*(c?2:1)).attr("height",16).attr("x",-d.rangeBand()/(c?1:2));if(a){n.scale(d).ticks(E/100).tickSize(-S,0);L.select(".nv-x.nv-axis").attr("transform","translate(0,"+(v.range()[0]+(t.showValues()&&v.domain()[0]<0?16:0))+")");L.select(".nv-x.nv-axis").transition().call(n);var O=L.select(".nv-x.nv-axis").selectAll("g");if(c){O.selectAll("text").attr("transform",function(e,t,n){return"translate(0,"+(n%2==0?"5":"17")+")"})}}if(f){r.scale(v).ticks(S/36).tickSize(-E,0);L.select(".nv-y.nv-axis").transition().call(r)}g.on("tooltipShow",function(e){if(h)b(e,p.parentNode)})});return w}var t=e.models.discreteBar(),n=e.models.axis(),r=e.models.axis();var i={top:15,right:10,bottom:50,left:60},s=null,o=null,u=e.utils.getColor(),a=true,f=true,l=false,c=false,h=true,p=function(e,t,n,r,i){return"

      "+t+"

      "+"

      "+n+"

      "},d,v,m="No Data Available.",g=d3.dispatch("tooltipShow","tooltipHide","beforeUpdate"),y=250;n.orient("bottom").highlightZero(false).showMaxMin(false).tickFormat(function(e){return e});r.orient(l?"right":"left").tickFormat(d3.format(",.1f"));var b=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=p(i.series.key,a,f,i,w);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+i.left,e.pos[1]+i.top];g.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){g.tooltipHide(e)});g.on("tooltipHide",function(){if(h)e.tooltip.cleanup()});w.dispatch=g;w.discretebar=t;w.xAxis=n;w.yAxis=r;d3.rebind(w,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","id","showValues","valueFormat");w.options=e.utils.optionsFunc.bind(w);w.margin=function(e){if(!arguments.length)return i;i.top=typeof e.top!="undefined"?e.top:i.top;i.right=typeof e.right!="undefined"?e.right:i.right;i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom;i.left=typeof e.left!="undefined"?e.left:i.left;return w};w.width=function(e){if(!arguments.length)return s;s=e;return w};w.height=function(e){if(!arguments.length)return o;o=e;return w};w.color=function(n){if(!arguments.length)return u;u=e.utils.getColor(n);t.color(u);return w};w.showXAxis=function(e){if(!arguments.length)return a;a=e;return w};w.showYAxis=function(e){if(!arguments.length)return f;f=e;return w};w.rightAlignYAxis=function(e){if(!arguments.length)return l;l=e;r.orient(e?"right":"left");return w};w.staggerLabels=function(e){if(!arguments.length)return c;c=e;return w};w.tooltips=function(e){if(!arguments.length)return h;h=e;return w};w.tooltipContent=function(e){if(!arguments.length)return p;p=e;return w};w.noData=function(e){if(!arguments.length)return m;m=e;return w};w.transitionDuration=function(e){if(!arguments.length)return y;y=e;return w};return w};e.models.distribution=function(){"use strict";function l(e){e.each(function(e){var a=n-(i==="x"?t.left+t.right:t.top+t.bottom),l=i=="x"?"y":"x",c=d3.select(this);f=f||u;var h=c.selectAll("g.nv-distribution").data([e]);var p=h.enter().append("g").attr("class","nvd3 nv-distribution");var d=p.append("g");var v=h.select("g");h.attr("transform","translate("+t.left+","+t.top+")");var m=v.selectAll("g.nv-dist").data(function(e){return e},function(e){return e.key});m.enter().append("g");m.attr("class",function(e,t){return"nv-dist nv-series-"+t}).style("stroke",function(e,t){return o(e,t)});var g=m.selectAll("line.nv-dist"+i).data(function(e){return e.values});g.enter().append("line").attr(i+"1",function(e,t){return f(s(e,t))}).attr(i+"2",function(e,t){return f(s(e,t))});m.exit().selectAll("line.nv-dist"+i).transition().attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))}).style("stroke-opacity",0).remove();g.attr("class",function(e,t){return"nv-dist"+i+" nv-dist"+i+"-"+t}).attr(l+"1",0).attr(l+"2",r);g.transition().attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))});f=u.copy()});return l}var t={top:0,right:0,bottom:0,left:0},n=400,r=8,i="x",s=function(e){return e[i]},o=e.utils.defaultColor(),u=d3.scale.linear(),a;var f;l.options=e.utils.optionsFunc.bind(l);l.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return l};l.width=function(e){if(!arguments.length)return n;n=e;return l};l.axis=function(e){if(!arguments.length)return i;i=e;return l};l.size=function(e){if(!arguments.length)return r;r=e;return l};l.getData=function(e){if(!arguments.length)return s;s=d3.functor(e);return l};l.scale=function(e){if(!arguments.length)return u;u=e;return l};l.color=function(t){if(!arguments.length)return o;o=e.utils.getColor(t);return l};return l};e.models.historicalBar=function(){"use strict";function w(E){E.each(function(w){var E=n-t.left-t.right,S=r-t.top-t.bottom,T=d3.select(this);s.domain(d||d3.extent(w[0].values.map(u).concat(f)));if(c)s.range(m||[E*.5/w[0].values.length,E*(w[0].values.length-.5)/w[0].values.length]);else s.range(m||[0,E]);o.domain(v||d3.extent(w[0].values.map(a).concat(l))).range(g||[S,0]);if(s.domain()[0]===s.domain()[1])s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1]);if(o.domain()[0]===o.domain()[1])o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]);var N=T.selectAll("g.nv-wrap.nv-historicalBar-"+i).data([w[0].values]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBar-"+i);var k=C.append("defs");var L=C.append("g");var A=N.select("g");L.append("g").attr("class","nv-bars");N.attr("transform","translate("+t.left+","+t.top+")");T.on("click",function(e,t){y.chartClick({data:e,index:t,pos:d3.event,id:i})});k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect");N.select("#nv-chart-clip-path-"+i+" rect").attr("width",E).attr("height",S);A.attr("clip-path",h?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-bars").selectAll(".nv-bar").data(function(e){return e},function(e,t){return u(e,t)});O.exit().remove();var M=O.enter().append("rect").attr("x",0).attr("y",function(t,n){return e.utils.NaNtoZero(o(Math.max(0,a(t,n))))}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.abs(o(a(t,n))-o(0)))}).attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).on("mouseover",function(e,t){if(!b)return;d3.select(this).classed("hover",true);y.elementMouseover({point:e,series:w[0],pos:[s(u(e,t)),o(a(e,t))],pointIndex:t,seriesIndex:0,e:d3.event})}).on("mouseout",function(e,t){if(!b)return;d3.select(this).classed("hover",false);y.elementMouseout({point:e,series:w[0],pointIndex:t,seriesIndex:0,e:d3.event})}).on("click",function(e,t){if(!b)return;y.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()}).on("dblclick",function(e,t){if(!b)return;y.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()});O.attr("fill",function(e,t){return p(e,t)}).attr("class",function(e,t,n){return(a(e,t)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+n+"-"+t}).transition().attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).attr("width",E/w[0].values.length*.9);O.transition().attr("y",function(t,n){var r=a(t,n)<0?o(0):o(0)-o(a(t,n))<1?o(0)-1:o(a(t,n));return e.utils.NaNtoZero(r)}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.max(Math.abs(o(a(t,n))-o(0)),1))})});return w}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[],l=[0],c=false,h=true,p=e.utils.defaultColor(),d,v,m,g,y=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),b=true;w.highlightPoint=function(e,t){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar-0-"+e).classed("hover",t)};w.clearHighlights=function(){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar.hover").classed("hover",false)};w.dispatch=y;w.options=e.utils.optionsFunc.bind(w);w.x=function(e){if(!arguments.length)return u;u=e;return w};w.y=function(e){if(!arguments.length)return a;a=e;return w};w.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return w};w.width=function(e){if(!arguments.length)return n;n=e;return w};w.height=function(e){if(!arguments.length)return r;r=e;return w};w.xScale=function(e){if(!arguments.length)return s;s=e;return w};w.yScale=function(e){if(!arguments.length)return o;o=e;return w};w.xDomain=function(e){if(!arguments.length)return d;d=e;return w};w.yDomain=function(e){if(!arguments.length)return v;v=e;return w};w.xRange=function(e){if(!arguments.length)return m;m=e;return w};w.yRange=function(e){if(!arguments.length)return g;g=e;return w};w.forceX=function(e){if(!arguments.length)return f;f=e;return w};w.forceY=function(e){if(!arguments.length)return l;l=e;return w};w.padData=function(e){if(!arguments.length)return c;c=e;return w};w.clipEdge=function(e){if(!arguments.length)return h;h=e;return w};w.color=function(t){if(!arguments.length)return p;p=e.utils.getColor(t);return w};w.id=function(e){if(!arguments.length)return i;i=e;return w};w.interactive=function(e){if(!arguments.length)return b;b=false;return w};return w};e.models.historicalBarChart=function(){"use strict";function x(e){e.each(function(d){var T=d3.select(this),N=this;var C=(u||parseInt(T.style("width"))||960)-s.left-s.right,k=(a||parseInt(T.style("height"))||400)-s.top-s.bottom;x.update=function(){T.transition().duration(E).call(x)};x.container=this;g.disabled=d.map(function(e){return!!e.disabled});if(!y){var L;y={};for(L in g){if(g[L]instanceof Array)y[L]=g[L].slice(0);else y[L]=g[L]}}if(!d||!d.length||!d.filter(function(e){return e.values.length}).length){var A=T.selectAll(".nv-noData").data([b]);A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");A.attr("x",s.left+C/2).attr("y",s.top+k/2).text(function(e){return e});return x}else{T.selectAll(".nv-noData").remove()}v=t.xScale();m=t.yScale();var O=T.selectAll("g.nv-wrap.nv-historicalBarChart").data([d]);var M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBarChart").append("g");var _=O.select("g");M.append("g").attr("class","nv-x nv-axis");M.append("g").attr("class","nv-y nv-axis");M.append("g").attr("class","nv-barsWrap");M.append("g").attr("class","nv-legendWrap");if(f){i.width(C);_.select(".nv-legendWrap").datum(d).call(i);if(s.top!=i.height()){s.top=i.height();k=(a||parseInt(T.style("height"))||400)-s.top-s.bottom}O.select(".nv-legendWrap").attr("transform","translate(0,"+ -s.top+")")}O.attr("transform","translate("+s.left+","+s.top+")");if(h){_.select(".nv-y.nv-axis").attr("transform","translate("+C+",0)")}t.width(C).height(k).color(d.map(function(e,t){return e.color||o(e,t)}).filter(function(e,t){return!d[t].disabled}));var D=_.select(".nv-barsWrap").datum(d.filter(function(e){return!e.disabled}));D.transition().call(t);if(l){n.scale(v).tickSize(-k,0);_.select(".nv-x.nv-axis").attr("transform","translate(0,"+m.range()[0]+")");_.select(".nv-x.nv-axis").transition().call(n)}if(c){r.scale(m).ticks(k/36).tickSize(-C,0);_.select(".nv-y.nv-axis").transition().call(r)}i.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled;if(!d.filter(function(e){return!e.disabled}).length){d.map(function(e){e.disabled=false;O.selectAll(".nv-series").classed("disabled",false);return e})}g.disabled=d.map(function(e){return!!e.disabled});w.stateChange(g);e.transition().call(x)});i.dispatch.on("legendDblclick",function(e){d.forEach(function(e){e.disabled=true});e.disabled=false;g.disabled=d.map(function(e){return!!e.disabled});w.stateChange(g);x.update()});w.on("tooltipShow",function(e){if(p)S(e,N.parentNode)});w.on("changeState",function(t){if(typeof t.disabled!=="undefined"){d.forEach(function(e,n){e.disabled=t.disabled[n]});g.disabled=t.disabled}e.call(x)})});return x}var t=e.models.historicalBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend();var s={top:30,right:90,bottom:50,left:90},o=e.utils.defaultColor(),u=null,a=null,f=false,l=true,c=true,h=false,p=true,d=function(e,t,n,r,i){return"

      "+e+"

      "+"

      "+n+" at "+t+"

      "},v,m,g={},y=null,b="No Data Available.",w=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),E=250;n.orient("bottom").tickPadding(7);r.orient(h?"right":"left");var S=function(i,s){if(s){var o=d3.select(s).select("svg");var u=o.node()?o.attr("viewBox"):null;if(u){u=u.split(" ");var a=parseInt(o.style("width"))/u[2];i.pos[0]=i.pos[0]*a;i.pos[1]=i.pos[1]*a}}var f=i.pos[0]+(s.offsetLeft||0),l=i.pos[1]+(s.offsetTop||0),c=n.tickFormat()(t.x()(i.point,i.pointIndex)),h=r.tickFormat()(t.y()(i.point,i.pointIndex)),p=d(i.series.key,c,h,i,x);e.tooltip.show([f,l],p,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+s.left,e.pos[1]+s.top];w.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){w.tooltipHide(e)});w.on("tooltipHide",function(){if(p)e.tooltip.cleanup()});x.dispatch=w;x.bars=t;x.legend=i;x.xAxis=n;x.yAxis=r;d3.rebind(x,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate","highlightPoint","clearHighlights","interactive");x.options=e.utils.optionsFunc.bind(x);x.margin=function(e){if(!arguments.length)return s;s.top=typeof e.top!="undefined"?e.top:s.top;s.right=typeof e.right!="undefined"?e.right:s.right;s.bottom=typeof e.bottom!="undefined"?e.bottom:s.bottom;s.left=typeof e.left!="undefined"?e.left:s.left;return x};x.width=function(e){if(!arguments.length)return u;u=e;return x};x.height=function(e){if(!arguments.length)return a;a=e;return x};x.color=function(t){if(!arguments.length)return o;o=e.utils.getColor(t);i.color(o);return x};x.showLegend=function(e){if(!arguments.length)return f;f=e;return x};x.showXAxis=function(e){if(!arguments.length)return l;l=e;return x};x.showYAxis=function(e){if(!arguments.length)return c;c=e;return x};x.rightAlignYAxis=function(e){if(!arguments.length)return h;h=e;r.orient(e?"right":"left");return x};x.tooltips=function(e){if(!arguments.length)return p;p=e;return x};x.tooltipContent=function(e){if(!arguments.length)return d;d=e;return x};x.state=function(e){if(!arguments.length)return g;g=e;return x};x.defaultState=function(e){if(!arguments.length)return y;y=e;return x};x.noData=function(e){if(!arguments.length)return b;b=e;return x};x.transitionDuration=function(e){if(!arguments.length)return E;E=e;return x};return x};e.models.indentedTree=function(){"use strict";function g(e){e.each(function(e){function k(e,t,n){d3.event.stopPropagation();if(d3.event.shiftKey&&!n){d3.event.shiftKey=false;e.values&&e.values.forEach(function(e){if(e.values||e._values){k(e,0,true)}});return true}if(!O(e)){return true}if(e.values){e._values=e.values;e.values=null}else{e.values=e._values;e._values=null}g.update()}function L(e){return e._values&&e._values.length?h:e.values&&e.values.length?p:""}function A(e){return e._values&&e._values.length}function O(e){var t=e.values||e._values;return t&&t.length}var t=1,n=d3.select(this);var i=d3.layout.tree().children(function(e){return e.values}).size([r,f]);g.update=function(){n.transition().duration(600).call(g)};if(!e[0])e[0]={key:a};var s=i.nodes(e[0]);var y=d3.select(this).selectAll("div").data([[s]]);var b=y.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree");var w=b.append("table");var E=y.select("table").attr("width","100%").attr("class",c);if(o){var S=w.append("thead");var x=S.append("tr");l.forEach(function(e){x.append("th").attr("width",e.width?e.width:"10%").style("text-align",e.type=="numeric"?"right":"left").append("span").text(e.label)})}var T=E.selectAll("tbody").data(function(e){return e});T.enter().append("tbody");t=d3.max(s,function(e){return e.depth});i.size([r,t*f]);var N=T.selectAll("tr").data(function(e){return e.filter(function(e){return u&&!e.children?u(e):true})},function(e,t){return e.id||e.id||++m});N.exit().remove();N.select("img.nv-treeicon").attr("src",L).classed("folded",A);var C=N.enter().append("tr");l.forEach(function(e,t){var n=C.append("td").style("padding-left",function(e){return(t?0:e.depth*f+12+(L(e)?0:16))+"px"},"important").style("text-align",e.type=="numeric"?"right":"left");if(t==0){n.append("img").classed("nv-treeicon",true).classed("nv-folded",A).attr("src",L).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(e){return L(e)?"inline-block":"none"}).on("click",k)}n.each(function(n){if(!t&&v(n))d3.select(this).append("a").attr("href",v).attr("class",d3.functor(e.classes)).append("span");else d3.select(this).append("span");d3.select(this).select("span").attr("class",d3.functor(e.classes)).text(function(t){return e.format?e.format(t):t[e.key]||"-"})});if(e.showCount){n.append("span").attr("class","nv-childrenCount");N.selectAll("span.nv-childrenCount").text(function(e){return e.values&&e.values.length||e._values&&e._values.length?"("+(e.values&&e.values.filter(function(e){return u?u(e):true}).length||e._values&&e._values.filter(function(e){return u?u(e):true}).length||0)+")":""})}});N.order().on("click",function(e){d.elementClick({row:this,data:e,pos:[e.x,e.y]})}).on("dblclick",function(e){d.elementDblclick({row:this,data:e,pos:[e.x,e.y]})}).on("mouseover",function(e){d.elementMouseover({row:this,data:e,pos:[e.x,e.y]})}).on("mouseout",function(e){d.elementMouseout({row:this,data:e,pos:[e.x,e.y]})})});return g}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e4),o=true,u=false,a="No Data Available.",f=20,l=[{key:"key",label:"Name",type:"text"}],c=null,h="images/grey-plus.png",p="images/grey-minus.png",d=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout"),v=function(e){return e.url};var m=0;g.options=e.utils.optionsFunc.bind(g);g.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return g};g.width=function(e){if(!arguments.length)return n;n=e;return g};g.height=function(e){if(!arguments.length)return r;r=e;return g};g.color=function(t){if(!arguments.length)return i;i=e.utils.getColor(t);scatter.color(i);return g};g.id=function(e){if(!arguments.length)return s;s=e;return g};g.header=function(e){if(!arguments.length)return o;o=e;return g};g.noData=function(e){if(!arguments.length)return a;a=e;return g};g.filterZero=function(e){if(!arguments.length)return u;u=e;return g};g.columns=function(e){if(!arguments.length)return l;l=e;return g};g.tableClass=function(e){if(!arguments.length)return c;c=e;return g};g.iconOpen=function(e){if(!arguments.length)return h;h=e;return g};g.iconClose=function(e){if(!arguments.length)return p;p=e;return g};g.getUrl=function(e){if(!arguments.length)return v;v=e;return g};return g};e.models.legend=function(){"use strict";function h(p){p.each(function(h){var p=n-t.left-t.right,d=d3.select(this);var v=d.selectAll("g.nv-legend").data([h]);var m=v.enter().append("g").attr("class","nvd3 nv-legend").append("g");var g=v.select("g");v.attr("transform","translate("+t.left+","+t.top+")");var y=g.selectAll(".nv-series").data(function(e){return e});var b=y.enter().append("g").attr("class","nv-series").on("mouseover",function(e,t){l.legendMouseover(e,t)}).on("mouseout",function(e,t){l.legendMouseout(e,t)}).on("click",function(e,t){if(!c){l.legendClick(e,t);if(a){if(f){h.forEach(function(e){e.disabled=true});e.disabled=false}else{e.disabled=!e.disabled;if(h.every(function(e){return e.disabled})){h.forEach(function(e){e.disabled=false})}}l.stateChange({disabled:h.map(function(e){return!!e.disabled})})}}}).on("dblclick",function(e,t){if(!c){l.legendDblclick(e,t);if(a){h.forEach(function(e){e.disabled=true});e.disabled=false;l.stateChange({disabled:h.map(function(e){return!!e.disabled})})}}});b.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5);b.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8");y.classed("disabled",function(e){return e.disabled});y.exit().remove();y.select("circle").style("fill",function(e,t){return e.color||s(e,t)}).style("stroke",function(e,t){return e.color||s(e,t)});y.select("text").text(i);if(o){var w=[];y.each(function(t,n){var r=d3.select(this).select("text");var i=r.node().getComputedTextLength()||e.utils.calcApproxTextWidth(r);w.push(i+28)});var E=0;var S=0;var x=[];while(Sp&&E>1){x=[];E--;for(var T=0;T(x[T%E]||0))x[T%E]=w[T]}S=x.reduce(function(e,t,n,r){return e+t})}var N=[];for(var C=0,k=0;CO)O=A;return"translate("+M+","+L+")"});g.attr("transform","translate("+(n-t.right-O)+","+t.top+")");r=t.top+t.bottom+L+15}});return h}var t={top:5,right:0,bottom:5,left:0},n=400,r=20,i=function(e){return e.key},s=e.utils.defaultColor(),o=true,u=true,a=true,f=false,l=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange"),c=false;h.dispatch=l;h.options=e.utils.optionsFunc.bind(h);h.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return h};h.width=function(e){if(!arguments.length)return n;n=e;return h};h.height=function(e){if(!arguments.length)return r;r=e;return h};h.key=function(e){if(!arguments.length)return i;i=e;return h};h.color=function(t){if(!arguments.length)return s;s=e.utils.getColor(t);return h};h.align=function(e){if(!arguments.length)return o;o=e;return h};h.rightAlign=function(e){if(!arguments.length)return u;u=e;return h};h.dualaxis=function(e){if(!arguments.length)return c;c=e;return h};h.updateState=function(e){if(!arguments.length)return a;a=e;return h};h.radioButtonMode=function(e){if(!arguments.length)return f;f=e;return h};return h};e.models.line=function(){"use strict";function m(g){g.each(function(m){var g=r-n.left-n.right,b=i-n.top-n.bottom,w=d3.select(this);c=t.xScale();h=t.yScale();d=d||c;v=v||h;var E=w.selectAll("g.nv-wrap.nv-line").data([m]);var S=E.enter().append("g").attr("class","nvd3 nv-wrap nv-line");var T=S.append("defs");var N=S.append("g");var C=E.select("g");N.append("g").attr("class","nv-groups");N.append("g").attr("class","nv-scatterWrap");E.attr("transform","translate("+n.left+","+n.top+")");t.width(g).height(b);var k=E.select(".nv-scatterWrap");k.transition().call(t);T.append("clipPath").attr("id","nv-edge-clip-"+t.id()).append("rect");E.select("#nv-edge-clip-"+t.id()+" rect").attr("width",g).attr("height",b);C.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":"");k.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":"");var L=E.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});L.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);L.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();L.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return s(e,t)}).style("stroke",function(e,t){return s(e,t)});L.transition().style("stroke-opacity",1).style("fill-opacity",.5);var A=L.selectAll("path.nv-area").data(function(e){return f(e)?[e]:[]});A.enter().append("path").attr("class","nv-area").attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))}).y1(function(e,t){return v(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])});L.exit().selectAll("path.nv-area").remove();A.transition().attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}).y1(function(e,t){return h(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])});var O=L.selectAll("path.nv-line").data(function(e){return[e.values]});O.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))}));L.exit().selectAll("path.nv-line").transition().attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}));O.transition().attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}));d=c.copy();v=h.copy()});return m}var t=e.models.scatter();var n={top:0,right:0,bottom:0,left:0},r=960,i=500,s=e.utils.defaultColor(),o=function(e){return e.x},u=function(e){return e.y},a=function(e,t){return!isNaN(u(e,t))&&u(e,t)!==null},f=function(e){return e.area},l=false,c,h,p="linear";t.size(16).sizeDomain([16,256]);var d,v;m.dispatch=t.dispatch;m.scatter=t;d3.rebind(m,t,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","padData","highlightPoint","clearHighlights");m.options=e.utils.optionsFunc.bind(m);m.margin=function(e){if(!arguments.length)return n;n.top=typeof e.top!="undefined"?e.top:n.top;n.right=typeof e.right!="undefined"?e.right:n.right;n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom;n.left=typeof e.left!="undefined"?e.left:n.left;return m};m.width=function(e){if(!arguments.length)return r;r=e;return m};m.height=function(e){if(!arguments.length)return i;i=e;return m};m.x=function(e){if(!arguments.length)return o;o=e;t.x(e);return m};m.y=function(e){if(!arguments.length)return u;u=e;t.y(e);return m};m.clipEdge=function(e){if(!arguments.length)return l;l=e;return m};m.color=function(n){if(!arguments.length)return s;s=e.utils.getColor(n);t.color(s);return m};m.interpolate=function(e){if(!arguments.length)return p;p=e;return m};m.defined=function(e){if(!arguments.length)return a;a=e;return m};m.isArea=function(e){if(!arguments.length)return f;f=d3.functor(e);return m};return m};e.models.lineChart=function(){"use strict";function N(m){m.each(function(m){var C=d3.select(this),k=this;var L=(a||parseInt(C.style("width"))||960)-o.left-o.right,A=(f||parseInt(C.style("height"))||400)-o.top-o.bottom;N.update=function(){C.transition().duration(x).call(N)};N.container=this;b.disabled=m.map(function(e){return!!e.disabled});if(!w){var O;w={};for(O in b){if(b[O]instanceof Array)w[O]=b[O].slice(0);else w[O]=b[O]}}if(!m||!m.length||!m.filter(function(e){return e.values.length}).length){var M=C.selectAll(".nv-noData").data([E]);M.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");M.attr("x",o.left+L/2).attr("y",o.top+A/2).text(function(e){return e});return N}else{C.selectAll(".nv-noData").remove()}g=t.xScale();y=t.yScale();var _=C.selectAll("g.nv-wrap.nv-lineChart").data([m]);var D=_.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g");var P=_.select("g");D.append("rect").style("opacity",0);D.append("g").attr("class","nv-x nv-axis");D.append("g").attr("class","nv-y nv-axis");D.append("g").attr("class","nv-linesWrap");D.append("g").attr("class","nv-legendWrap");D.append("g").attr("class","nv-interactive");P.select("rect").attr("width",L).attr("height",A);if(l){i.width(L);P.select(".nv-legendWrap").datum(m).call(i);if(o.top!=i.height()){o.top=i.height();A=(f||parseInt(C.style("height"))||400)-o.top-o.bottom}_.select(".nv-legendWrap").attr("transform","translate(0,"+ -o.top+")")}_.attr("transform","translate("+o.left+","+o.top+")");if(p){P.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)")}if(d){s.width(L).height(A).margin({left:o.left,top:o.top}).svgContainer(C).xScale(g);_.select(".nv-interactive").call(s)}t.width(L).height(A).color(m.map(function(e,t){return e.color||u(e,t)}).filter(function(e,t){return!m[t].disabled}));var H=P.select(".nv-linesWrap").datum(m.filter(function(e){return!e.disabled}));H.transition().call(t);if(c){n.scale(g).ticks(L/100).tickSize(-A,0);P.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");P.select(".nv-x.nv-axis").transition().call(n)}if(h){r.scale(y).ticks(A/36).tickSize(-L,0);P.select(".nv-y.nv-axis").transition().call(r)}i.dispatch.on("stateChange",function(e){b=e;S.stateChange(b);N.update()});s.dispatch.on("elementMousemove",function(i){t.clearHighlights();var a,f,l,c=[];m.filter(function(e,t){e.seriesIndex=t;return!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,N.x());t.highlightPoint(r,f,true);var s=n.values[f];if(typeof s==="undefined")return;if(typeof a==="undefined")a=s;if(typeof l==="undefined")l=N.xScale()(N.x()(s,f));c.push({key:n.key,value:N.y()(s,f),color:u(n,n.seriesIndex)})});if(c.length>2){var h=N.yScale().invert(i.mouseY);var p=Math.abs(N.yScale().domain()[0]-N.yScale().domain()[1]);var d=.03*p;var g=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);if(g!==null)c[g].highlight=true}var y=n.tickFormat()(N.x()(a,f));s.tooltip.position({left:l+o.left,top:i.mouseY+o.top}).chartContainer(k.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:y,series:c})();s.renderGuideLine(l)});s.dispatch.on("elementMouseout",function(e){S.tooltipHide();t.clearHighlights()});S.on("tooltipShow",function(e){if(v)T(e,k.parentNode)});S.on("changeState",function(e){if(typeof e.disabled!=="undefined"){m.forEach(function(t,n){t.disabled=e.disabled[n]});b.disabled=e.disabled}N.update()})});return N}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.interactiveGuideline();var o={top:30,right:20,bottom:50,left:60},u=e.utils.defaultColor(),a=null,f=null,l=true,c=true,h=true,p=false,d=false,v=true,m=function(e,t,n,r,i){return"

      "+e+"

      "+"

      "+n+" at "+t+"

      "},g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=250;n.orient("bottom").tickPadding(7);r.orient(p?"right":"left");var T=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=m(i.series.key,a,f,i,N);e.tooltip.show([o,u],l,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top];S.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});S.on("tooltipHide",function(){if(v)e.tooltip.cleanup()});N.dispatch=S;N.lines=t;N.legend=i;N.xAxis=n;N.yAxis=r;N.interactiveLayer=s;d3.rebind(N,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id","interpolate");N.options=e.utils.optionsFunc.bind(N);N.margin=function(e){if(!arguments.length)return o;o.top=typeof e.top!="undefined"?e.top:o.top;o.right=typeof e.right!="undefined"?e.right:o.right;o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom;o.left=typeof e.left!="undefined"?e.left:o.left;return N};N.width=function(e){if(!arguments.length)return a;a=e;return N};N.height=function(e){if(!arguments.length)return f;f=e;return N};N.color=function(t){if(!arguments.length)return u;u=e.utils.getColor(t);i.color(u);return N};N.showLegend=function(e){if(!arguments.length)return l;l=e;return N};N.showXAxis=function(e){if(!arguments.length)return c;c=e;return N};N.showYAxis=function(e){if(!arguments.length)return h;h=e;return N};N.rightAlignYAxis=function(e){if(!arguments.length)return p;p=e;r.orient(e?"right":"left");return N};N.useInteractiveGuideline=function(e){if(!arguments.length)return d;d=e;if(e===true){N.interactive(false);N.useVoronoi(false)}return N};N.tooltips=function(e){if(!arguments.length)return v;v=e;return N};N.tooltipContent=function(e){if(!arguments.length)return m;m=e;return N};N.state=function(e){if(!arguments.length)return b;b=e;return N};N.defaultState=function(e){if(!arguments.length)return w;w=e;return N};N.noData=function(e){if(!arguments.length)return E;E=e;return N};N.transitionDuration=function(e){if(!arguments.length)return x;x=e;return N};return N};e.models.linePlusBarChart=function(){"use strict";function T(e){e.each(function(e){var l=d3.select(this),c=this;var v=(a||parseInt(l.style("width"))||960)-u.left-u.right,N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom;T.update=function(){l.transition().call(T)};b.disabled=e.map(function(e){return!!e.disabled});if(!w){var C;w={};for(C in b){if(b[C]instanceof Array)w[C]=b[C].slice(0);else w[C]=b[C]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var k=l.selectAll(".nv-noData").data([E]);k.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");k.attr("x",u.left+v/2).attr("y",u.top+N/2).text(function(e){return e});return T}else{l.selectAll(".nv-noData").remove()}var L=e.filter(function(e){return!e.disabled&&e.bar});var A=e.filter(function(e){return!e.bar});m=A.filter(function(e){return!e.disabled}).length&&A.filter(function(e){return!e.disabled})[0].values.length?t.xScale():n.xScale();g=n.yScale();y=t.yScale();var O=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([e]);var M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g");var _=O.select("g");M.append("g").attr("class","nv-x nv-axis");M.append("g").attr("class","nv-y1 nv-axis");M.append("g").attr("class","nv-y2 nv-axis");M.append("g").attr("class","nv-barsWrap");M.append("g").attr("class","nv-linesWrap");M.append("g").attr("class","nv-legendWrap");if(p){o.width(v/2);_.select(".nv-legendWrap").datum(e.map(function(e){e.originalKey=e.originalKey===undefined?e.key:e.originalKey;e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)");return e})).call(o);if(u.top!=o.height()){u.top=o.height();N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom}_.select(".nv-legendWrap").attr("transform","translate("+v/2+","+ -u.top+")")}O.attr("transform","translate("+u.left+","+u.top+")");t.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));n.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));var D=_.select(".nv-barsWrap").datum(L.length?L:[{values:[]}]);var P=_.select(".nv-linesWrap").datum(A[0]&&!A[0].disabled?A:[{values:[]}]);d3.transition(D).call(n);d3.transition(P).call(t);r.scale(m).ticks(v/100).tickSize(-N,0);_.select(".nv-x.nv-axis").attr("transform","translate(0,"+g.range()[0]+")");d3.transition(_.select(".nv-x.nv-axis")).call(r);i.scale(g).ticks(N/36).tickSize(-v,0);d3.transition(_.select(".nv-y1.nv-axis")).style("opacity",L.length?1:0).call(i);s.scale(y).ticks(N/36).tickSize(L.length?0:-v,0);_.select(".nv-y2.nv-axis").style("opacity",A.length?1:0).attr("transform","translate("+v+",0)");d3.transition(_.select(".nv-y2.nv-axis")).call(s);o.dispatch.on("stateChange",function(e){b=e;S.stateChange(b);T.update()});S.on("tooltipShow",function(e){if(d)x(e,c.parentNode)});S.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});b.disabled=t.disabled}T.update()})});return T}var t=e.models.line(),n=e.models.historicalBar(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.legend();var u={top:30,right:60,bottom:50,left:60},a=null,f=null,l=function(e){return e.x},c=function(e){return e.y},h=e.utils.defaultColor(),p=true,d=true,v=function(e,t,n,r,i){return"

      "+e+"

      "+"

      "+n+" at "+t+"

      "},m,g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");n.padData(true);t.clipEdge(false).padData(true);r.orient("bottom").tickPadding(7).highlightZero(false);i.orient("left");s.orient("right");var x=function(n,o){var u=n.pos[0]+(o.offsetLeft||0),a=n.pos[1]+(o.offsetTop||0),f=r.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?i:s).tickFormat()(t.y()(n.point,n.pointIndex)),c=v(n.series.key,f,l,n,T);e.tooltip.show([u,a],c,n.value<0?"n":"s",null,o)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top];S.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});n.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top];S.tooltipShow(e)});n.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});S.on("tooltipHide",function(){if(d)e.tooltip.cleanup()});T.dispatch=S;T.legend=o;T.lines=t;T.bars=n;T.xAxis=r;T.y1Axis=i;T.y2Axis=s;d3.rebind(T,t,"defined","size","clipVoronoi","interpolate");T.options=e.utils.optionsFunc.bind(T);T.x=function(e){if(!arguments.length)return l;l=e;t.x(e);n.x(e);return T};T.y=function(e){if(!arguments.length)return c;c=e;t.y(e);n.y(e);return T};T.margin=function(e){if(!arguments.length)return u;u.top=typeof e.top!="undefined"?e.top:u.top;u.right=typeof e.right!="undefined"?e.right:u.right;u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom;u.left=typeof e.left!="undefined"?e.left:u.left;return T};T.width=function(e){if(!arguments.length)return a;a=e;return T};T.height=function(e){if(!arguments.length)return f;f=e;return T};T.color=function(t){if(!arguments.length)return h;h=e.utils.getColor(t);o.color(h);return T};T.showLegend=function(e){if(!arguments.length)return p;p=e;return T};T.tooltips=function(e){if(!arguments.length)return d;d=e;return T};T.tooltipContent=function(e){if(!arguments.length)return v;v=e;return T};T.state=function(e){if(!arguments.length)return b;b=e;return T};T.defaultState=function(e){if(!arguments.length)return w;w=e;return T};T.noData=function(e){if(!arguments.length)return E;E=e;return T};return T};e.models.lineWithFocusChart=function(){"use strict";function k(e){e.each(function(e){function U(e){var t=+(e=="e"),n=t?1:-1,r=M/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function z(){if(!a.empty())a.extent(w);I.data([a.empty()?g.domain():w]).each(function(e,t){var n=g(e[0])-v.range()[0],r=v.range()[1]-g(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n);d3.select(this).select(".right").attr("x",g(e[1])).attr("width",r<0?0:r)})}function W(){w=a.empty()?null:a.extent();var n=a.empty()?g.domain():a.extent();if(Math.abs(n[0]-n[1])<=1){return}T.brush({extent:n,brush:a});z();var s=H.select(".nv-focus .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}).map(function(e,r){return{key:e.key,values:e.values.filter(function(e,r){return t.x()(e,r)>=n[0]&&t.x()(e,r)<=n[1]})}}));s.transition().duration(N).call(t);H.select(".nv-focus .nv-x.nv-axis").transition().duration(N).call(r);H.select(".nv-focus .nv-y.nv-axis").transition().duration(N).call(i)}var S=d3.select(this),L=this;var A=(h||parseInt(S.style("width"))||960)-f.left-f.right,O=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d,M=d-l.top-l.bottom;k.update=function(){S.transition().duration(N).call(k)};k.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var _=S.selectAll(".nv-noData").data([x]);_.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");_.attr("x",f.left+A/2).attr("y",f.top+O/2).text(function(e){return e});return k}else{S.selectAll(".nv-noData").remove()}v=t.xScale();m=t.yScale();g=n.xScale();y=n.yScale();var D=S.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([e]);var P=D.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g");var H=D.select("g");P.append("g").attr("class","nv-legendWrap");var B=P.append("g").attr("class","nv-focus");B.append("g").attr("class","nv-x nv-axis");B.append("g").attr("class","nv-y nv-axis");B.append("g").attr("class","nv-linesWrap");var j=P.append("g").attr("class","nv-context");j.append("g").attr("class","nv-x nv-axis");j.append("g").attr("class","nv-y nv-axis");j.append("g").attr("class","nv-linesWrap");j.append("g").attr("class","nv-brushBackground");j.append("g").attr("class","nv-x nv-brush");if(b){u.width(A);H.select(".nv-legendWrap").datum(e).call(u);if(f.top!=u.height()){f.top=u.height();O=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d}H.select(".nv-legendWrap").attr("transform","translate(0,"+ -f.top+")")}D.attr("transform","translate("+f.left+","+f.top+")");t.width(A).height(O).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));n.defined(t.defined()).width(A).height(M).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));H.select(".nv-context").attr("transform","translate(0,"+(O+f.bottom+l.top)+")");var F=H.select(".nv-context .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}));d3.transition(F).call(n);r.scale(v).ticks(A/100).tickSize(-O,0);i.scale(m).ticks(O/36).tickSize(-A,0);H.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+O+")");a.x(g).on("brush",function(){var e=k.transitionDuration();k.transitionDuration(0);W();k.transitionDuration(e)});if(w)a.extent(w);var I=H.select(".nv-brushBackground").selectAll("g").data([w||a.extent()]);var q=I.enter().append("g");q.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",M);q.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",M);var R=H.select(".nv-x.nv-brush").call(a);R.selectAll("rect").attr("height",M);R.selectAll(".resize").append("path").attr("d",U);W();s.scale(g).ticks(A/100).tickSize(-M,0);H.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");d3.transition(H.select(".nv-context .nv-x.nv-axis")).call(s);o.scale(y).ticks(M/36).tickSize(-A,0);d3.transition(H.select(".nv-context .nv-y.nv-axis")).call(o);H.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");u.dispatch.on("stateChange",function(e){k.update()});T.on("tooltipShow",function(e){if(E)C(e,L.parentNode)})});return k}var t=e.models.line(),n=e.models.line(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.axis(),u=e.models.legend(),a=d3.svg.brush();var f={top:30,right:30,bottom:30,left:60},l={top:0,right:30,bottom:20,left:60},c=e.utils.defaultColor(),h=null,p=null,d=100,v,m,g,y,b=true,w=null,E=true,S=function(e,t,n,r,i){return"

      "+e+"

      "+"

      "+n+" at "+t+"

      "},x="No Data Available.",T=d3.dispatch("tooltipShow","tooltipHide","brush"),N=250;t.clipEdge(true);n.interactive(false);r.orient("bottom").tickPadding(5);i.orient("left");s.orient("bottom").tickPadding(5);o.orient("left");var C=function(n,s){var o=n.pos[0]+(s.offsetLeft||0),u=n.pos[1]+(s.offsetTop||0),a=r.tickFormat()(t.x()(n.point,n.pointIndex)),f=i.tickFormat()(t.y()(n.point,n.pointIndex)),l=S(n.series.key,a,f,n,k);e.tooltip.show([o,u],l,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+f.left,e.pos[1]+f.top];T.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)});T.on("tooltipHide",function(){if(E)e.tooltip.cleanup()});k.dispatch=T;k.legend=u;k.lines=t;k.lines2=n;k.xAxis=r;k.yAxis=i;k.x2Axis=s;k.y2Axis=o;d3.rebind(k,t,"defined","isArea","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id");k.options=e.utils.optionsFunc.bind(k);k.x=function(e){if(!arguments.length)return t.x;t.x(e);n.x(e);return k};k.y=function(e){if(!arguments.length)return t.y;t.y(e);n.y(e);return k};k.margin=function(e){if(!arguments.length)return f;f.top=typeof e.top!="undefined"?e.top:f.top;f.right=typeof e.right!="undefined"?e.right:f.right;f.bottom=typeof e.bottom!="undefined"?e.bottom:f.bottom;f.left=typeof e.left!="undefined"?e.left:f.left;return k};k.margin2=function(e){if(!arguments.length)return l;l=e;return k};k.width=function(e){if(!arguments.length)return h;h=e;return k};k.height=function(e){if(!arguments.length)return p;p=e;return k};k.height2=function(e){if(!arguments.length)return d;d=e;return k};k.color=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);u.color(c);return k};k.showLegend=function(e){if(!arguments.length)return b;b=e;return k};k.tooltips=function(e){if(!arguments.length)return E;E=e;return k};k.tooltipContent=function(e){if(!arguments.length)return S;S=e;return k};k.interpolate=function(e){if(!arguments.length)return t.interpolate();t.interpolate(e);n.interpolate(e);return k};k.noData=function(e){if(!arguments.length)return x;x=e;return k};k.xTickFormat=function(e){if(!arguments.length)return r.tickFormat();r.tickFormat(e);s.tickFormat(e);return k};k.yTickFormat=function(e){if(!arguments.length)return i.tickFormat();i.tickFormat(e);o.tickFormat(e);return k};k.brushExtent=function(e){if(!arguments.length)return w;w=e;return k};k.transitionDuration=function(e){if(!arguments.length)return N;N=e;return k};return k};e.models.linePlusBarWithFocusChart=function(){"use strict";function B(e){e.each(function(e){function nt(e){var t=+(e=="e"),n=t?1:-1,r=q/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function rt(){if(!h.empty())h.extent(x);Z.data([h.empty()?k.domain():x]).each(function(e,t){var n=k(e[0])-k.range()[0],r=k.range()[1]-k(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n);d3.select(this).select(".right").attr("x",k(e[1])).attr("width",r<0?0:r)})}function it(){x=h.empty()?null:h.extent();S=h.empty()?k.domain():h.extent();D.brush({extent:S,brush:h});rt();r.width(F).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));t.width(F).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var n=J.select(".nv-focus .nv-barsWrap").datum(!U.length?[{values:[]}]:U.map(function(e,t){return{key:e.key,values:e.values.filter(function(e,t){return r.x()(e,t)>=S[0]&&r.x()(e,t)<=S[1]})}}));var i=J.select(".nv-focus .nv-linesWrap").datum(z[0].disabled?[{values:[]}]:z.map(function(e,n){return{key:e.key,values:e.values.filter(function(e,n){return t.x()(e,n)>=S[0]&&t.x()(e,n)<=S[1]})}}));if(U.length){C=r.xScale()}else{C=t.xScale()}s.scale(C).ticks(F/100).tickSize(-I,0);s.domain([Math.ceil(S[0]),Math.floor(S[1])]);J.select(".nv-x.nv-axis").transition().duration(P).call(s);n.transition().duration(P).call(r);i.transition().duration(P).call(t);J.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+L.range()[0]+")");u.scale(L).ticks(I/36).tickSize(-F,0);J.select(".nv-focus .nv-y1.nv-axis").style("opacity",U.length?1:0);a.scale(A).ticks(I/36).tickSize(U.length?0:-F,0);J.select(".nv-focus .nv-y2.nv-axis").style("opacity",z.length?1:0).attr("transform","translate("+C.range()[1]+",0)");J.select(".nv-focus .nv-y1.nv-axis").transition().duration(P).call(u);J.select(".nv-focus .nv-y2.nv-axis").transition().duration(P).call(a)}var N=d3.select(this),j=this;var F=(v||parseInt(N.style("width"))||960)-p.left-p.right,I=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g,q=g-d.top-d.bottom;B.update=function(){N.transition().duration(P).call(B)};B.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var R=N.selectAll(".nv-noData").data([_]);R.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");R.attr("x",p.left+F/2).attr("y",p.top+I/2).text(function(e){return e});return B}else{N.selectAll(".nv-noData").remove()}var U=e.filter(function(e){return!e.disabled&&e.bar});var z=e.filter(function(e){return!e.bar});C=r.xScale();k=o.scale();L=r.yScale();A=t.yScale();O=i.yScale();M=n.yScale();var W=e.filter(function(e){return!e.disabled&&e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})});var X=e.filter(function(e){return!e.disabled&&!e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})});C.range([0,F]);k.domain(d3.extent(d3.merge(W.concat(X)),function(e){return e.x})).range([0,F]);var V=N.selectAll("g.nv-wrap.nv-linePlusBar").data([e]);var $=V.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g");var J=V.select("g");$.append("g").attr("class","nv-legendWrap");var K=$.append("g").attr("class","nv-focus");K.append("g").attr("class","nv-x nv-axis");K.append("g").attr("class","nv-y1 nv-axis");K.append("g").attr("class","nv-y2 nv-axis");K.append("g").attr("class","nv-barsWrap");K.append("g").attr("class","nv-linesWrap");var Q=$.append("g").attr("class","nv-context");Q.append("g").attr("class","nv-x nv-axis");Q.append("g").attr("class","nv-y1 nv-axis");Q.append("g").attr("class","nv-y2 nv-axis");Q.append("g").attr("class","nv-barsWrap");Q.append("g").attr("class","nv-linesWrap");Q.append("g").attr("class","nv-brushBackground");Q.append("g").attr("class","nv-x nv-brush");if(E){c.width(F/2);J.select(".nv-legendWrap").datum(e.map(function(e){e.originalKey=e.originalKey===undefined?e.key:e.originalKey;e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)");return e})).call(c);if(p.top!=c.height()){p.top=c.height();I=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g}J.select(".nv-legendWrap").attr("transform","translate("+F/2+","+ -p.top+")")}V.attr("transform","translate("+p.left+","+p.top+")");i.width(F).height(q).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));n.width(F).height(q).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var G=J.select(".nv-context .nv-barsWrap").datum(U.length?U:[{values:[]}]);var Y=J.select(".nv-context .nv-linesWrap").datum(!z[0].disabled?z:[{values:[]}]);J.select(".nv-context").attr("transform","translate(0,"+(I+p.bottom+d.top)+")");G.transition().call(i);Y.transition().call(n);h.x(k).on("brush",it);if(x)h.extent(x);var Z=J.select(".nv-brushBackground").selectAll("g").data([x||h.extent()]);var et=Z.enter().append("g");et.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",q);et.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",q);var tt=J.select(".nv-x.nv-brush").call(h);tt.selectAll("rect").attr("height",q);tt.selectAll(".resize").append("path").attr("d",nt);o.ticks(F/100).tickSize(-q,0);J.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+O.range()[0]+")");J.select(".nv-context .nv-x.nv-axis").transition().call(o);f.scale(O).ticks(q/36).tickSize(-F,0);J.select(".nv-context .nv-y1.nv-axis").style("opacity",U.length?1:0).attr("transform","translate(0,"+k.range()[0]+")");J.select(".nv-context .nv-y1.nv-axis").transition().call(f);l.scale(M).ticks(q/36).tickSize(U.length?0:-F,0);J.select(".nv-context .nv-y2.nv-axis").style("opacity",z.length?1:0).attr("transform","translate("+k.range()[1]+",0)");J.select(".nv-context .nv-y2.nv-axis").transition().call(l);c.dispatch.on("stateChange",function(e){B.update()});D.on("tooltipShow",function(e){if(T)H(e,j.parentNode)});it()});return B}var t=e.models.line(),n=e.models.line(),r=e.models.historicalBar(),i=e.models.historicalBar(),s=e.models.axis(),o=e.models.axis(),u=e.models.axis(),a=e.models.axis(),f=e.models.axis(),l=e.models.axis(),c=e.models.legend(),h=d3.svg.brush();var p={top:30,right:30,bottom:30,left:60},d={top:0,right:30,bottom:20,left:60},v=null,m=null,g=100,y=function(e){return e.x},b=function(e){return e.y},w=e.utils.defaultColor(),E=true,S,x=null,T=true,N=function(e,t,n,r,i){return"

      "+e+"

      "+"

      "+n+" at "+t+"

      "},C,k,L,A,O,M,_="No Data Available.",D=d3.dispatch("tooltipShow","tooltipHide","brush"),P=0;t.clipEdge(true);n.interactive(false);s.orient("bottom").tickPadding(5);u.orient("left");a.orient("right");o.orient("bottom").tickPadding(5);f.orient("left");l.orient("right");var H=function(n,r){if(S){n.pointIndex+=Math.ceil(S[0])}var i=n.pos[0]+(r.offsetLeft||0),o=n.pos[1]+(r.offsetTop||0),f=s.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?u:a).tickFormat()(t.y()(n.point,n.pointIndex)),c=N(n.series.key,f,l,n,B);e.tooltip.show([i,o],c,n.value<0?"n":"s",null,r)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top];D.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)});r.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top];D.tooltipShow(e)});r.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)});D.on("tooltipHide",function(){if(T)e.tooltip.cleanup()});B.dispatch=D;B.legend=c;B.lines=t;B.lines2=n;B.bars=r;B.bars2=i;B.xAxis=s;B.x2Axis=o;B.y1Axis=u;B.y2Axis=a;B.y3Axis=f;B.y4Axis=l;d3.rebind(B,t,"defined","size","clipVoronoi","interpolate");B.options=e.utils.optionsFunc.bind(B);B.x=function(e){if(!arguments.length)return y;y=e;t.x(e);r.x(e);return B};B.y=function(e){if(!arguments.length)return b;b=e;t.y(e);r.y(e);return B};B.margin=function(e){if(!arguments.length)return p;p.top=typeof e.top!="undefined"?e.top:p.top;p.right=typeof e.right!="undefined"?e.right:p.right;p.bottom=typeof e.bottom!="undefined"?e.bottom:p.bottom;p.left=typeof e.left!="undefined"?e.left:p.left;return B};B.width=function(e){if(!arguments.length)return v;v=e;return B};B.height=function(e){if(!arguments.length)return m;m=e;return B};B.color=function(t){if(!arguments.length)return w;w=e.utils.getColor(t);c.color(w);return B};B.showLegend=function(e){if(!arguments.length)return E;E=e;return B};B.tooltips=function(e){if(!arguments.length)return T;T=e;return B};B.tooltipContent=function(e){if(!arguments.length)return N;N=e;return B};B.noData=function(e){if(!arguments.length)return _;_=e;return B};B.brushExtent=function(e){if(!arguments.length)return x;x=e;return B};return B};e.models.multiBar=function(){"use strict";function C(e){e.each(function(e){var C=n-t.left-t.right,k=r-t.top-t.bottom,L=d3.select(this);if(d&&e.length)d=[{values:e[0].values.map(function(e){return{x:e.x,y:0,series:e.series,size:.01}})}];if(c)e=d3.layout.stack().offset(h).values(function(e){return e.values}).y(a)(!e.length&&d?d:e);e=e.map(function(e,t){e.values=e.values.map(function(e){e.series=t;return e});return e});if(c)e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y);if(t.y<0){t.y1=i;i=i-t.size}else{t.y1=t.size+r;r=r+t.size}})});var A=y&&b?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});i.domain(y||d3.merge(A).map(function(e){return e.x})).rangeBands(w||[0,C],S);s.domain(b||d3.extent(d3.merge(A).map(function(e){return c?e.y>0?e.y1:e.y1+e.y:e.y}).concat(f))).range(E||[k,0]);if(i.domain()[0]===i.domain()[1])i.domain()[0]?i.domain([i.domain()[0]-i.domain()[0]*.01,i.domain()[1]+i.domain()[1]*.01]):i.domain([-1,1]);if(s.domain()[0]===s.domain()[1])s.domain()[0]?s.domain([s.domain()[0]+s.domain()[0]*.01,s.domain()[1]-s.domain()[1]*.01]):s.domain([-1,1]);T=T||i;N=N||s;var O=L.selectAll("g.nv-wrap.nv-multibar").data([e]);var M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar");var _=M.append("defs");var D=M.append("g");var P=O.select("g");D.append("g").attr("class","nv-groups");O.attr("transform","translate("+t.left+","+t.top+")");_.append("clipPath").attr("id","nv-edge-clip-"+o).append("rect");O.select("#nv-edge-clip-"+o+" rect").attr("width",C).attr("height",k);P.attr("clip-path",l?"url(#nv-edge-clip-"+o+")":"");var H=O.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});H.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);H.exit().transition().selectAll("rect.nv-bar").delay(function(t,n){return n*g/e[0].values.length}).attr("y",function(e){return c?N(e.y0):N(0)}).attr("height",0).remove();H.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return p(e,t)}).style("stroke",function(e,t){return p(e,t)});H.transition().style("stroke-opacity",1).style("fill-opacity",.75);var B=H.selectAll("rect.nv-bar").data(function(t){return d&&!e.length?d.values:t.values});B.exit().remove();var j=B.enter().append("rect").attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(t,n,r){return c?0:r*i.rangeBand()/e.length}).attr("y",function(e){return N(c?e.y0:0)}).attr("height",0).attr("width",i.rangeBand()/(c?1:e.length)).attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"});B.style("fill",function(e,t,n){return p(e,n,t)}).style("stroke",function(e,t,n){return p(e,n,t)}).on("mouseover",function(t,n){d3.select(this).classed("hover",true);x.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);x.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){x.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(t,n){x.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()});B.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).transition().attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"});if(v){if(!m)m=e.map(function(){return true});B.style("fill",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()})}if(c)B.transition().delay(function(t,n){return n*g/e[0].values.length}).attr("y",function(e,t){return s(c?e.y1:0)}).attr("height",function(e,t){if(e.y==null)return 0;return Math.max(Math.abs(s(e.y+(c?e.y0:0))-s(c?e.y0:0)),1)}).attr("x",function(t,n){return c?0:t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/(c?1:e.length));else B.transition().delay(function(t,n){return n*g/e[0].values.length}).attr("x",function(t,n){return t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/e.length).attr("y",function(e,t){return a(e,t)<0?s(0):s(0)-s(a(e,t))<1?s(0)-1:s(a(e,t))||0}).attr("height",function(e,t){if(e.y==null)return 0;return Math.max(Math.abs(s(a(e,t))-s(0)),1)||0});T=i.copy();N=s.copy()});return C}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=d3.scale.ordinal(),s=d3.scale.linear(),o=Math.floor(Math.random()*1e4),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=true,c=false,h="zero",p=e.utils.defaultColor(),d=false,v=null,m,g=1200,y,b,w,E,S=.1,x=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");var T,N;C.dispatch=x;C.options=e.utils.optionsFunc.bind(C);C.x=function(e){if(!arguments.length)return u;u=e;return C};C.y=function(e){if(!arguments.length)return a;a=e;return C};C.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return C};C.width=function(e){if(!arguments.length)return n;n=e;return C};C.height=function(e){if(!arguments.length)return r;r=e;return C};C.xScale=function(e){if(!arguments.length)return i;i=e;return C};C.yScale=function(e){if(!arguments.length)return s;s=e;return C};C.xDomain=function(e){if(!arguments.length)return y;y=e;return C};C.yDomain=function(e){if(!arguments.length)return b;b=e;return C};C.xRange=function(e){if(!arguments.length)return w;w=e;return C};C.yRange=function(e){if(!arguments.length)return E;E=e;return C};C.forceY=function(e){if(!arguments.length)return f;f=e;return C};C.stacked=function(e){if(!arguments.length)return c;c=e;return C};C.stackOffset=function(e){if(!arguments.length)return h;h=e;return C};C.clipEdge=function(e){if(!arguments.length)return l;l=e;return C};C.color=function(t){if(!arguments.length)return p;p=e.utils.getColor(t);return C};C.barColor=function(t){if(!arguments.length)return v;v=e.utils.getColor(t);return C};C.disabled=function(e){if(!arguments.length)return m;m=e;return C};C.id=function(e){if(!arguments.length)return o;o=e;return C};C.hideable=function(e){if(!arguments.length)return d;d=e;return C};C.delay=function(e){if(!arguments.length)return g;g=e;return C};C.groupSpacing=function(e){if(!arguments.length)return S;S=e;return C};return C};e.models.multiBarChart=function(){"use strict";function M(e){e.each(function(e){var h=d3.select(this),E=this;var _=(u||parseInt(h.style("width"))||960)-o.left-o.right,D=(a||parseInt(h.style("height"))||400)-o.top-o.bottom;M.update=function(){h.transition().duration(A).call(M)};M.container=this;if(w=="right")_=_-250;T.disabled=e.map(function(e){return!!e.disabled});if(!N){var P;N={};for(P in T){if(T[P]instanceof Array)N[P]=T[P].slice(0);else N[P]=T[P]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var H=h.selectAll(".nv-noData").data([C]);H.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");H.attr("x",o.left+_/2).attr("y",o.top+D/2).text(function(e){return e});return M}else{h.selectAll(".nv-noData").remove()}S=t.xScale();x=t.yScale();var B=h.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([e]);var j=B.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g");var F=B.select("g");j.append("g").attr("class","nv-x nv-axis");j.append("g").attr("class","nv-y nv-axis");j.append("g").attr("class","nv-barsWrap");j.append("g").attr("class","nv-legendWrap");j.append("g").attr("class","nv-controlsWrap");if(c){i.width(_-L());if(t.barColor())e.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()});F.select(".nv-legendWrap").datum(e).call(i);if(o.top!=i.height()){o.top=i.height();D=(a||parseInt(h.style("height"))||400)-o.top-o.bottom}if(w=="right"){F.select(".nv-legendWrap").attr("transform","translate("+_+","+(-o.top+20+30)+")")}else{F.select(".nv-legendWrap").attr("transform","translate("+L()+","+ -o.top+")")}}if(l){var I=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(L()).color(["#444","#444","#444"]);F.select(".nv-controlsWrap").datum(I).call(s);if(w=="right"){F.select(".nv-controlsWrap").attr("transform","translate("+_+","+(-o.top+20)+")")}else{F.select(".nv-controlsWrap").attr("transform","translate("+0+","+ -o.top+")")}}B.attr("transform","translate("+o.left+","+o.top+")");if(v){F.select(".nv-y.nv-axis").attr("transform","translate("+_+",0)")}t.disabled(e.map(function(e){return e.disabled})).width(_).height(D).color(e.map(function(e,t){return e.color||f(e,t)}).filter(function(t,n){return!e[n].disabled}));var q=F.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));q.transition().call(t);if(p){n.scale(S).ticks(_/100).tickSize(-D,0);F.select(".nv-x.nv-axis").attr("transform","translate(0,"+x.range()[0]+")");F.select(".nv-x.nv-axis").transition().call(n);var R=F.select(".nv-x.nv-axis > g").selectAll("g");R.selectAll("line, text").style("opacity",1);if(g){var U=function(e,t){return"translate("+e+","+t+")"};var z=5,W=17;R.selectAll("text").attr("transform",function(e,t,n){return U(0,n%2==0?z:W)});var X=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;F.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(e,t){return U(0,t===0||X%2!==0?W:z)})}if(m)R.filter(function(t,n){return n%Math.ceil(e[0].values.length/(_/100))!==0}).selectAll("text, line").style("opacity",0);if(y)R.selectAll(".tick text").attr("transform","rotate("+y+" 0,0)").style("text-anchor",y>0?"start":"end");F.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}if(d){r.scale(x).ticks(D/36).tickSize(-_,0);F.select(".nv-y.nv-axis").transition().call(r)}i.dispatch.on("stateChange",function(e){T=e;k.stateChange(T);M.update()});s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;I=I.map(function(e){e.disabled=true;return e});e.disabled=false;switch(e.key){case"Grouped":t.stacked(false);break;case"Stacked":t.stacked(true);break}T.stacked=t.stacked();k.stateChange(T);M.update()});k.on("tooltipShow",function(e){if(b)O(e,E.parentNode)});k.on("changeState",function(n){if(typeof n.disabled!=="undefined"){e.forEach(function(e,t){e.disabled=n.disabled[t]});T.disabled=n.disabled}if(typeof n.stacked!=="undefined"){t.stacked(n.stacked);T.stacked=n.stacked}M.update()})});return M}var t=e.models.multiBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend();var o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=true,c=true,h=false,p=true,d=true,v=false,m=true,g=false,y=0,b=true,w="top",E=function(e,t,n,r,i,s){if(s){var o=d3.format(",.2f");return"

      "+e+"

      "+"

      "+o(Math.pow(10,n))+" on "+t+"

      "}else{return"

      "+e+"

      "+"

      "+n+" on "+t+"

      "}},S,x,T={stacked:false},N=null,C="No Data Available.",k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=function(){return l?180:0},A=250;t.stacked(false);n.orient("bottom").tickPadding(7).highlightZero(true).showMaxMin(false).tickFormat(function(e){return e});r.orient(v?"right":"left").tickFormat(d3.format(",.1f"));s.updateState(false);var O=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=E(i.series.key,a,f,i,M,h);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top];k.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){k.tooltipHide(e)});k.on("tooltipHide",function(){if(b)e.tooltip.cleanup()});M.dispatch=k;M.multibar=t;M.legend=i;M.xAxis=n;M.yAxis=r;d3.rebind(M,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","stacked","stackOffset","delay","barColor","groupSpacing");M.options=e.utils.optionsFunc.bind(M);M.margin=function(e){if(!arguments.length)return o;o.top=typeof e.top!="undefined"?e.top:o.top;o.right=typeof e.right!="undefined"?e.right:o.right;o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom;o.left=typeof e.left!="undefined"?e.left:o.left;return M};M.width=function(e){if(!arguments.length)return u;u=e;return M};M.height=function(e){if(!arguments.length)return a;a=e;return M};M.color=function(t){if(!arguments.length)return f;f=e.utils.getColor(t);i.color(f);return M};M.showControls=function(e){if(!arguments.length)return l;l=e;return M};M.showLegend=function(e){if(!arguments.length)return c;c=e;return M};M.logScale=function(e){if(!arguments.length)return h;h=e;return M};M.showXAxis=function(e){if(!arguments.length)return p;p=e;return M};M.showYAxis=function(e){if(!arguments.length)return d;d=e;return M};M.rightAlignYAxis=function(e){if(!arguments.length)return v;v=e;r.orient(e?"right":"left");return M};M.reduceXTicks=function(e){if(!arguments.length)return m;m=e;return M};M.rotateLabels=function(e){if(!arguments.length)return y;y=e;return M};M.staggerLabels=function(e){if(!arguments.length)return g;g=e;return M};M.tooltip=function(e){if(!arguments.length)return E;E=e;return M};M.tooltips=function(e){if(!arguments.length)return b;b=e;return M};M.legendPos=function(e){if(!arguments.length)return w;w=e;return M};M.tooltipContent=function(e){if(!arguments.length)return E;E=e;return M};M.state=function(e){if(!arguments.length)return T;T=e;return M};M.defaultState=function(e){if(!arguments.length)return N;N=e;return M};M.noData=function(e){if(!arguments.length)return C;C=e;return M};M.transitionDuration=function(e){if(!arguments.length)return A;A=e;return M};return M};e.models.multiBarHorizontal=function(){"use strict";function N(e){e.each(function(e){var i=n-t.left-t.right,g=r-t.top-t.bottom,N=d3.select(this);if(p)e=d3.layout.stack().offset("zero").values(function(e){return e.values}).y(a)(e);e=e.map(function(e,t){e.values=e.values.map(function(e){e.series=t;return e});return e});if(p)e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y);if(t.y<0){t.y1=i-t.size;i=i-t.size}else{t.y1=r;r=r+t.size}})});var C=y&&b?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});s.domain(y||d3.merge(C).map(function(e){return e.x})).rangeBands(w||[0,g],.1);o.domain(b||d3.extent(d3.merge(C).map(function(e){return p?e.y>0?e.y1+e.y:e.y1:e.y}).concat(f)));if(d&&!p)o.range(E||[o.domain()[0]<0?v:0,i-(o.domain()[1]>0?v:0)]);else o.range(E||[0,i]);x=x||s;T=T||d3.scale.linear().domain(o.domain()).range([o(0),o(0)]);var k=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([e]);var L=k.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal");var A=L.append("defs");var O=L.append("g");var M=k.select("g");O.append("g").attr("class","nv-groups");k.attr("transform","translate("+t.left+","+t.top+")");var _=k.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});_.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);_.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();_.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return l(e,t)}).style("stroke",function(e,t){return l(e,t)});_.transition().style("stroke-opacity",1).style("fill-opacity",.75);var D=_.selectAll("g.nv-bar").data(function(e){return e.values});D.exit().remove();var P=D.enter().append("g").attr("transform",function(t,n,r){return"translate("+T(p?t.y0:0)+","+(p?0:r*s.rangeBand()/e.length+s(u(t,n)))+")"});P.append("rect").attr("width",0).attr("height",s.rangeBand()/(p?1:e.length));D.on("mouseover",function(t,n){d3.select(this).classed("hover",true);S.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[o(a(t,n)+(p?t.y0:0)),s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);S.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){S.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(t,n){S.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()});P.append("text");if(d&&!p){D.select("text").attr("text-anchor",function(e,t){return a(e,t)<0?"end":"start"}).attr("y",s.rangeBand()/(e.length*2)).attr("dy",".32em").text(function(e,t){return m(a(e,t))});D.transition().select("text").attr("x",function(e,t){return a(e,t)<0?-4:o(a(e,t))-o(0)+4})}else{D.selectAll("text").text("")}D.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"});if(c){if(!h)h=e.map(function(){return true});D.style("fill",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()})}if(p)D.transition().attr("transform",function(e,t){return"translate("+o(e.y1)+","+s(u(e,t))+")"}).select("rect").attr("width",function(e,t){return Math.abs(o(a(e,t)+e.y0)-o(e.y0))}).attr("height",s.rangeBand());else D.transition().attr("transform",function(t,n){return"translate("+(a(t,n)<0?o(a(t,n)):o(0))+","+(t.series*s.rangeBand()/e.length+s(u(t,n)))+")"}).select("rect").attr("height",s.rangeBand()/e.length).attr("width",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(0)),1)});x=s.copy();T=o.copy()});return N}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=null,h,p=false,d=false,v=60,m=d3.format(",.2f"),g=1200,y,b,w,E,S=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");var x,T;N.dispatch=S;N.options=e.utils.optionsFunc.bind(N);N.x=function(e){if(!arguments.length)return u;u=e;return N};N.y=function(e){if(!arguments.length)return a;a=e;return N};N.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return N};N.width=function(e){if(!arguments.length)return n;n=e;return N};N.height=function(e){if(!arguments.length)return r;r=e;return N};N.xScale=function(e){if(!arguments.length)return s;s=e;return N};N.yScale=function(e){if(!arguments.length)return o;o=e;return N};N.xDomain=function(e){if(!arguments.length)return y;y=e;return N};N.yDomain=function(e){if(!arguments.length)return b;b=e;return N};N.xRange=function(e){if(!arguments.length)return w;w=e;return N};N.yRange=function(e){if(!arguments.length)return E;E=e;return N};N.forceY=function(e){if(!arguments.length)return f;f=e;return N};N.stacked=function(e){if(!arguments.length)return p;p=e;return N};N.color=function(t){if(!arguments.length)return l;l=e.utils.getColor(t);return N};N.barColor=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);return N};N.disabled=function(e){if(!arguments.length)return h;h=e;return N};N.id=function(e){if(!arguments.length)return i;i=e;return N};N.delay=function(e){if(!arguments.length)return g;g=e;return N};N.showValues=function(e){if(!arguments.length)return d;d=e;return N};N.valueFormat=function(e){if(!arguments.length)return m;m=e;return N};N.valuePadding=function(e){if(!arguments.length)return v;v=e;return N};return N};e.models.multiBarHorizontalChart=function(){"use strict";function C(e){e.each(function(h){var p=d3.select(this),m=this;var k=(u||parseInt(p.style("width"))||960)-o.left-o.right,L=(a||parseInt(p.style("height"))||400)-o.top-o.bottom;C.update=function(){p.transition().duration(T).call(C)};C.container=this;if(v=="right")k=k-250;b.disabled=h.map(function(e){return!!e.disabled});if(!w){var A;w={};for(A in b){if(b[A]instanceof Array)w[A]=b[A].slice(0);else w[A]=b[A]}}if(!h||!h.length||!h.filter(function(e){return e.values.length}).length){var O=p.selectAll(".nv-noData").data([E]);O.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");O.attr("x",o.left+k/2).attr("y",o.top+L/2).text(function(e){return e});return C}else{p.selectAll(".nv-noData").remove()}g=t.xScale();y=t.yScale();var M=p.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([h]);var _=M.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g");var D=M.select("g");_.append("g").attr("class","nv-x nv-axis");_.append("g").attr("class","nv-y nv-axis");_.append("g").attr("class","nv-barsWrap");_.append("g").attr("class","nv-legendWrap");_.append("g").attr("class","nv-controlsWrap");if(c){i.width(k-x());if(t.barColor())h.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()});D.select(".nv-legendWrap").datum(h).call(i);if(o.top!=i.height()){o.top=i.height();L=(a||parseInt(p.style("height"))||400)-o.top-o.bottom}if(v=="right"){D.select(".nv-legendWrap").attr("transform","translate("+x()+","+20+")")}else{D.select(".nv-legendWrap").attr("transform","translate("+x()+","+ -o.top+")")}}if(l){var P=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(x()).color(["#444","#444","#444"]);D.select(".nv-controlsWrap").datum(P).attr("transform","translate(0,"+ -o.top+")").call(s)}M.attr("transform","translate("+o.left+","+o.top+")");t.disabled(h.map(function(e){return e.disabled})).width(k).height(L).color(h.map(function(e,t){return e.color||f(e,t)}).filter(function(e,t){return!h[t].disabled}));var H=D.select(".nv-barsWrap").datum(h.filter(function(e){return!e.disabled}));H.transition().call(t);n.scale(g).ticks(L/24).tickSize(-k,0);D.select(".nv-x.nv-axis").transition().call(n);var B=D.select(".nv-x.nv-axis").selectAll("g");B.selectAll("line, text").style("opacity",1);r.scale(y).ticks(k/100).tickSize(-L,0);D.select(".nv-y.nv-axis").attr("transform","translate(0,"+L+")");D.select(".nv-y.nv-axis").transition().call(r);i.dispatch.on("stateChange",function(e){b=e;S.stateChange(b);C.update()});s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;P=P.map(function(e){e.disabled=true;return e});e.disabled=false;switch(e.key){case"Grouped":t.stacked(false);break;case"Stacked":t.stacked(true);break}b.stacked=t.stacked();S.stateChange(b);C.update()});S.on("tooltipShow",function(e){if(d)N(e,m.parentNode)});S.on("changeState",function(n){if(typeof n.disabled!=="undefined"){h.forEach(function(e,t){e.disabled=n.disabled[t]});b.disabled=n.disabled}if(typeof n.stacked!=="undefined"){t.stacked(n.stacked);b.stacked=n.stacked}e.call(C)})});return C}var t=e.models.multiBarHorizontal(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend().height(30),s=e.models.legend().height(30);var o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=true,c=true,h=false,p=false,d=true,v="top",m=function(e,t,n,i,s,o){if(o){return"

      "+e+" - "+t+"

      "+"

      "+r.tickFormat()(Math.pow(10,n))+"

      "}else{return"

      "+e+" - "+t+"

      "+"

      "+n+"

      "}},g,y,b={stacked:p},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=function(){return l?180:0},T=250;t.stacked(p);n.orient("left").tickPadding(5).highlightZero(false).showMaxMin(false).tickFormat(function(e){return e});r.orient("bottom").tickFormat(d3.format(",.1f"));s.updateState(false);var N=function(i,s){var o=0;if(i.pos[0]>=200)o=200;else o=i.pos[0];if(h)l=t.y()(i.point,i.pointIndex);else l=r.tickFormat()(t.y()(i.point,i.pointIndex));var u=o+(s.offsetLeft||0),a=i.pos[1]+(s.offsetTop||0),f=n.tickFormat()(t.x()(i.point,i.pointIndex)),l=r.tickFormat()(t.y()(i.point,i.pointIndex)),c=m(i.series.key,f,l,i,C,h);e.tooltip.show([u,a],c,i.value<0?"e":"w",null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top];S.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});S.on("tooltipHide",function(){if(d)e.tooltip.cleanup()});C.dispatch=S;C.multibar=t;C.legend=i;C.xAxis=n;C.yAxis=r;d3.rebind(C,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","delay","showValues","valueFormat","stacked","barColor");C.options=e.utils.optionsFunc.bind(C);C.margin=function(e){if(!arguments.length)return o;o.top=typeof e.top!="undefined"?e.top:o.top;o.right=typeof e.right!="undefined"?e.right:o.right;o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom;o.left=typeof e.left!="undefined"?e.left:o.left;return C};C.width=function(e){if(!arguments.length)return u;u=e;return C};C.height=function(e){if(!arguments.length)return a;a=e;return C};C.color=function(t){if(!arguments.length)return f;f=e.utils.getColor(t);i.color(f);return C};C.showControls=function(e){if(!arguments.length)return l;l=e;return C};C.showLegend=function(e){if(!arguments.length)return c;c=e;return C};C.logScale=function(e){if(!arguments.length)return h;h=e;return C};C.tooltip=function(e){if(!arguments.length)return m;m=e;return C};C.tooltips=function(e){if(!arguments.length)return d;d=e;return C};C.legendPos=function(e){if(!arguments.length)return v;v=e;return C};C.tooltipContent=function(e){if(!arguments.length)return m;m=e;return C};C.state=function(e){if(!arguments.length)return b;b=e;return C};C.defaultState=function(e){if(!arguments.length)return w;w=e;return C};C.noData=function(e){if(!arguments.length)return E;E=e;return C};C.transitionDuration=function(e){if(!arguments.length)return T;T=e;return C};return C};e.models.multiChart=function(){"use strict";function L(e){e.each(function(e){var f=d3.select(this),c=this;L.update=function(){f.transition().call(L)};L.container=this;var h=(r||parseInt(f.style("width"))||960)-t.left-t.right,p=(i||parseInt(f.style("height"))||400)-t.top-t.bottom;if(a=="right")h=h-250;var A=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==1});var O=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==2});var M=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==1});var _=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==2});var D=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==1});var P=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==2});var H=e.filter(function(e){return!e.disabled&&e.yAxis==1}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})});var B=e.filter(function(e){return!e.disabled&&e.yAxis==2}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})});l.domain(d3.extent(d3.merge(H.concat(B)),function(e){return e.x})).range([0,h]);var j=f.selectAll("g.wrap.multiChart").data([e]);var F=j.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");F.append("g").attr("class","x axis");F.append("g").attr("class","y1 axis");F.append("g").attr("class","y2 axis");F.append("g").attr("class","lines1Wrap");F.append("g").attr("class","lines2Wrap");F.append("g").attr("class","bars1Wrap");F.append("g").attr("class","bars2Wrap");F.append("g").attr("class","stack1Wrap");F.append("g").attr("class","stack2Wrap");F.append("g").attr("class","legendWrap");var I=j.select("g");if(s){N.width(h/2);I.select(".legendWrap").datum(e.map(function(e){e.originalKey=e.originalKey===undefined?e.key:e.originalKey;e.key=e.originalKey+(e.yAxis==1?"":" (right axis)");return e})).call(N);if(t.top!=N.height()){t.top=N.height();p=(i||parseInt(f.style("height"))||400)-t.top-t.bottom}if(a=="right"){I.select(".legendWrap").attr("transform","translate("+h+","+20+")")}else{I.select(".legendWrap").attr("transform","translate("+h/2+","+ -t.top+")")}}m.width(h).height(p).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="line"}));g.width(h).height(p).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="line"}));y.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="bar"}));b.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="bar"}));w.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="area"}));E.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="area"}));if(a=="right"){I.attr("transform","translate("+t.left+","+"20"+")")}else{I.attr("transform","translate("+t.left+","+t.top+")")}var q=I.select(".lines1Wrap").datum(A);var R=I.select(".bars1Wrap").datum(M);var U=I.select(".stack1Wrap").datum(D);var z=I.select(".lines2Wrap").datum(O);var W=I.select(".bars2Wrap").datum(_);var X=I.select(".stack2Wrap").datum(P);var V=D.length?D.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[];var $=P.length?P.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[];d.domain(d3.extent(d3.extent(d3.merge(H).concat(V),function(e){return e.y}).concat(m.forceY()))).range([0,p]);v.domain(d3.extent(d3.extent(d3.merge(B).concat($),function(e){return e.y}).concat(g.forceY()))).range([0,p]);m.yDomain(d.domain());y.yDomain(d.domain());w.yDomain(d.domain());g.yDomain(v.domain());b.yDomain(v.domain());E.yDomain(v.domain());if(D.length){d3.transition(U).call(w)}if(P.length){d3.transition(X).call(E)}if(M.length){d3.transition(R).call(y)}if(_.length){d3.transition(W).call(b)}if(A.length){d3.transition(q).call(m)}if(O.length){d3.transition(z).call(g)}S.ticks(h/100).tickSize(-p,0);I.select(".x.axis").attr("transform","translate(0,"+p+")");d3.transition(I.select(".x.axis")).call(S);x.ticks(p/36).tickSize(-h,0);d3.transition(I.select(".y1.axis")).call(x);T.ticks(p/36).tickSize(-h,0);d3.transition(I.select(".y2.axis")).call(T);I.select(".y2.axis").style("opacity",B.length?1:0).attr("transform","translate("+l.range()[1]+",0)");N.dispatch.on("stateChange",function(e){L.update()});if(u){N.dualaxis(true)}else{N.dualaxis(false)}C.on("tooltipShow",function(e){if(o)k(e,c.parentNode)})});return L}var t={top:30,right:20,bottom:50,left:60},n=d3.scale.category20().range(),r=null,i=null,s=true,o=true,u=false,a="top",f=function(e,t,n,r,i){return"

      "+e+"

      "+"

      "+n+" at "+t+"

      "},l,c,h,p;var l=d3.scale.linear(),d=d3.scale.linear(),v=d3.scale.linear(),m=e.models.line().yScale(d),g=e.models.line().yScale(v),y=e.models.multiBar().stacked(false).yScale(d),b=e.models.multiBar().stacked(false).yScale(v),w=e.models.stackedArea().yScale(d),E=e.models.stackedArea().yScale(v),S=e.models.axis().scale(l).orient("bottom").tickPadding(5),x=e.models.axis().scale(d).orient("left"),T=e.models.axis().scale(v).orient("right"),N=e.models.legend().height(30),C=d3.dispatch("tooltipShow","tooltipHide");var k=function(t,n){var r=t.pos[0]+(n.offsetLeft||0),i=t.pos[1]+(n.offsetTop||0),s=S.tickFormat()(m.x()(t.point,t.pointIndex)),o=(t.series.yAxis==2?T:x).tickFormat()(m.y()(t.point,t.pointIndex)),u=f(t.series.key,s,o,t,L);e.tooltip.show([r,i],u,undefined,undefined,n.offsetParent)};m.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});m.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});g.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});g.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});y.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});y.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});b.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});b.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});w.dispatch.on("tooltipShow",function(e){if(!Math.round(w.y()(e.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",false)},0);return false}e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],C.tooltipShow(e)});w.dispatch.on("tooltipHide",function(e){C.tooltipHide(e)});E.dispatch.on("tooltipShow",function(e){if(!Math.round(E.y()(e.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",false)},0);return false}e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],C.tooltipShow(e)});E.dispatch.on("tooltipHide",function(e){C.tooltipHide(e)});m.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});m.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});g.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});g.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});C.on("tooltipHide",function(){if(o)e.tooltip.cleanup()});L.dispatch=C;L.lines1=m;L.lines2=g;L.bars1=y;L.bars2=b;L.stack1=w;L.stack2=E;L.xAxis=S;L.yAxis1=x;L.yAxis2=T;L.options=e.utils.optionsFunc.bind(L);L.x=function(e){if(!arguments.length)return getX;getX=e;m.x(e);y.x(e);return L};L.y=function(e){if(!arguments.length)return getY;getY=e;m.y(e);y.y(e);return L};L.yDomain1=function(e){if(!arguments.length)return h;h=e;return L};L.yDomain2=function(e){if(!arguments.length)return p;p=e;return L};L.margin=function(e){if(!arguments.length)return t;t=e;return L};L.width=function(e){if(!arguments.length)return r;r=e;return L};L.height=function(e){if(!arguments.length)return i;i=e;return L};L.color=function(e){if(!arguments.length)return n;n=e;N.color(e);return L};L.showLegend=function(e){if(!arguments.length)return s;s=e;return L};L.tooltips=function(e){if(!arguments.length)return o;o=e;return L};L.dualaxis=function(e){if(!arguments.length)return u;u=e;return L};L.legendPos=function(e){if(!arguments.length)return a;a=e;return L};L.tooltipContent=function(e){if(!arguments.length)return f;f=e;return L};return L};e.models.ohlcBar=function(){"use strict";function x(e){e.each(function(e){var g=n-t.left-t.right,x=r-t.top-t.bottom,T=d3.select(this);s.domain(y||d3.extent(e[0].values.map(u).concat(p)));if(v)s.range(w||[g*.5/e[0].values.length,g*(e[0].values.length-.5)/e[0].values.length]);else s.range(w||[0,g]);o.domain(b||[d3.min(e[0].values.map(h).concat(d)),d3.max(e[0].values.map(c).concat(d))]).range(E||[x,0]);if(s.domain()[0]===s.domain()[1])s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1]);if(o.domain()[0]===o.domain()[1])o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]);var N=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([e[0].values]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar");var k=C.append("defs");var L=C.append("g");var A=N.select("g");L.append("g").attr("class","nv-ticks");N.attr("transform","translate("+t.left+","+t.top+")");T.on("click",function(e,t){S.chartClick({data:e,index:t,pos:d3.event,id:i})});k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect");N.select("#nv-chart-clip-path-"+i+" rect").attr("width",g).attr("height",x);A.attr("clip-path",m?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-ticks").selectAll(".nv-tick").data(function(e){return e});O.exit().remove();var M=O.enter().append("path").attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"}).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",true);S.elementMouseover({point:t,series:e[0],pos:[s(u(t,n)),o(a(t,n))],pointIndex:n,seriesIndex:0,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);S.elementMouseout({point:t,series:e[0],pointIndex:n,seriesIndex:0,e:d3.event})}).on("click",function(e,t){S.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()}).on("dblclick",function(e,t){S.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()});O.attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t});d3.transition(O).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"})});return x}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=function(e){return e.open},l=function(e){return e.close},c=function(e){return e.high},h=function(e){return e.low},p=[],d=[],v=false,m=true,g=e.utils.defaultColor(),y,b,w,E,S=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");x.dispatch=S;x.options=e.utils.optionsFunc.bind(x);x.x=function(e){if(!arguments.length)return u;u=e;return x};x.y=function(e){if(!arguments.length)return a;a=e;return x};x.open=function(e){if(!arguments.length)return f;f=e;return x};x.close=function(e){if(!arguments.length)return l;l=e;return x};x.high=function(e){if(!arguments.length)return c;c=e;return x};x.low=function(e){if(!arguments.length)return h;h=e;return x};x.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return x};x.width=function(e){if(!arguments.length)return n;n=e;return x};x.height=function(e){if(!arguments.length)return r;r=e;return x};x.xScale=function(e){if(!arguments.length)return s;s=e;return x};x.yScale=function(e){if(!arguments.length)return o;o=e;return x};x.xDomain=function(e){if(!arguments.length)return y;y=e;return x};x.yDomain=function(e){if(!arguments.length)return b;b=e;return x};x.xRange=function(e){if(!arguments.length)return w;w=e;return x};x.yRange=function(e){if(!arguments.length)return E;E=e;return x};x.forceX=function(e){if(!arguments.length)return p;p=e;return x};x.forceY=function(e){if(!arguments.length)return d;d=e;return x};x.padData=function(e){if(!arguments.length)return v;v=e;return x};x.clipEdge=function(e){if(!arguments.length)return m;m=e;return x};x.color=function(t){if(!arguments.length)return g;g=e.utils.getColor(t);return x};x.id=function(e){if(!arguments.length)return i;i=e;return x};return x};e.models.pie=function(){"use strict";function E(e){e.each(function(e){function P(e){var t=(e.startAngle+e.endAngle)*90/Math.PI-90;return t>90?t-180:t}function H(e){e.endAngle=isNaN(e.endAngle)?0:e.endAngle;e.startAngle=isNaN(e.startAngle)?0:e.startAngle;if(!v)e.innerRadius=0;var t=d3.interpolate(this._current,e);this._current=t(0);return function(e){return L(t(e))}}function B(e){e.innerRadius=0;var t=d3.interpolate({startAngle:0,endAngle:0},e);return function(e){return L(t(e))}}var o=n-t.left-t.right,f=r-t.top-t.bottom,E=Math.min(o,f)/2,S=E-E/5,x=d3.select(this);var T=x.selectAll(".nv-wrap.nv-pie").data(e);var N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+u);var C=N.append("g");var k=T.select("g");C.append("g").attr("class","nv-pie");T.attr("transform","translate("+t.left+","+t.top+")");k.select(".nv-pie").attr("transform","translate("+o/2+","+f/2+")");x.on("click",function(e,t){w.chartClick({data:e,index:t,pos:d3.event,id:u})});var L=d3.svg.arc().outerRadius(S);if(g)L.startAngle(g);if(y)L.endAngle(y);if(v)L.innerRadius(E*b);var A=d3.layout.pie().sort(null).value(function(e){return e.disabled?0:s(e)});var O=T.select(".nv-pie").selectAll(".nv-slice").data(A);O.exit().remove();var M=O.enter().append("g").attr("class","nv-slice").on("mouseover",function(e,t){d3.select(this).classed("hover",true);w.elementMouseover({label:i(e.data),value:s(e.data),point:e.data,pointIndex:t,pos:[d3.event.pageX,d3.event.pageY],id:u})}).on("mouseout",function(e,t){d3.select(this).classed("hover",false);w.elementMouseout({label:i(e.data),value:s(e.data),point:e.data,index:t,id:u})}).on("click",function(e,t){w.elementClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u});d3.event.stopPropagation()}).on("dblclick",function(e,t){w.elementDblClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u});d3.event.stopPropagation()});O.attr("fill",function(e,t){return a(e,t)}).attr("stroke",function(e,t){return a(e,t)});var _=M.append("path").each(function(e){this._current=e});d3.transition(O.select("path")).attr("d",L).attrTween("d",H);if(l){var D=d3.svg.arc().innerRadius(0);if(c){D=L}if(h){D=d3.svg.arc().outerRadius(L.outerRadius())}M.append("g").classed("nv-label",true).each(function(e,t){var n=d3.select(this);n.attr("transform",function(e){if(m){e.outerRadius=S+10;e.innerRadius=S+15;var t=(e.startAngle+e.endAngle)/2*(180/Math.PI);if((e.startAngle+e.endAngle)/2d?r[p]:""});var r=n.select("text").node().getBBox();n.select(".nv-label rect").attr("width",r.width+10).attr("height",r.height+10).attr("transform",function(){return"translate("+[r.x-5,r.y-5]+")"})})}});return E}var t={top:0,right:0,bottom:0,left:0},n=500,r=500,i=function(e){return e.x},s=function(e){return e.y},o=function(e){return e.description},u=Math.floor(Math.random()*1e4),a=e.utils.defaultColor(),f=d3.format(",.2f"),l=true,c=true,h=false,p="key",d=.02,v=false,m=false,g=false,y=false,b=.5,w=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");E.dispatch=w;E.options=e.utils.optionsFunc.bind(E);E.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return E};E.width=function(e){if(!arguments.length)return n;n=e;return E};E.height=function(e){if(!arguments.length)return r;r=e;return E};E.values=function(t){e.log("pie.values() is no longer supported.");return E};E.x=function(e){if(!arguments.length)return i;i=e;return E};E.y=function(e){if(!arguments.length)return s;s=d3.functor(e);return E};E.description=function(e){if(!arguments.length)return o;o=e;return E};E.showLabels=function(e){if(!arguments.length)return l;l=e;return E};E.labelSunbeamLayout=function(e){if(!arguments.length)return m;m=e;return E};E.donutLabelsOutside=function(e){if(!arguments.length)return h;h=e;return E};E.pieLabelsOutside=function(e){if(!arguments.length)return c;c=e;return E};E.labelType=function(e){if(!arguments.length)return p;p=e;p=p||"key";return E};E.donut=function(e){if(!arguments.length)return v;v=e;return E};E.donutRatio=function(e){if(!arguments.length)return b;b=e;return E};E.startAngle=function(e){if(!arguments.length)return g;g=e;return E};E.endAngle=function(e){if(!arguments.length)return y;y=e;return E};E.id=function(e){if(!arguments.length)return u;u=e;return E};E.color=function(t){if(!arguments.length)return a;a=e.utils.getColor(t);return E};E.valueFormat=function(e){if(!arguments.length)return f;f=e;return E};E.labelThreshold=function(e){if(!arguments.length)return d;d=e;return E};return E};e.models.pieChart=function(){"use strict";function v(e){e.each(function(e){var u=d3.select(this),a=this;var f=(i||parseInt(u.style("width"))||960)-r.left-r.right,d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom;v.update=function(){u.transition().call(v)};v.container=this;l.disabled=e.map(function(e){return!!e.disabled});if(!c){var m;c={};for(m in l){if(l[m]instanceof Array)c[m]=l[m].slice(0);else c[m]=l[m]}}if(!e||!e.length){var g=u.selectAll(".nv-noData").data([h]);g.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");g.attr("x",r.left+f/2).attr("y",r.top+d/2).text(function(e){return e});return v}else{u.selectAll(".nv-noData").remove()}var y=u.selectAll("g.nv-wrap.nv-pieChart").data([e]);var b=y.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g");var w=y.select("g");b.append("g").attr("class","nv-pieWrap");b.append("g").attr("class","nv-legendWrap");if(o){n.width(f).key(t.x());y.select(".nv-legendWrap").datum(e).call(n);if(r.top!=n.height()){r.top=n.height();d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom}y.select(".nv-legendWrap").attr("transform","translate(0,"+ -r.top+")")}y.attr("transform","translate("+r.left+","+r.top+")");t.width(f).height(d);var E=w.select(".nv-pieWrap").datum([e]);d3.transition(E).call(t);n.dispatch.on("stateChange",function(e){l=e;p.stateChange(l);v.update()});t.dispatch.on("elementMouseout.tooltip",function(e){p.tooltipHide(e)});p.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});l.disabled=t.disabled}v.update()})});return v}var t=e.models.pie(),n=e.models.legend();var r={top:30,right:20,bottom:20,left:20},i=null,s=null,o=true,u=e.utils.defaultColor(),a=true,f=function(e,t,n,r){return"

      "+e+"

      "+"

      "+t+"

      "},l={},c=null,h="No Data Available.",p=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");var d=function(n,r){var i=t.description()(n.point)||t.x()(n.point);var s=n.pos[0]+(r&&r.offsetLeft||0),o=n.pos[1]+(r&&r.offsetTop||0),u=t.valueFormat()(t.y()(n.point)),a=f(i,u,n,v);e.tooltip.show([s,o],a,n.value<0?"n":"s",null,r)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+r.left,e.pos[1]+r.top];p.tooltipShow(e)});p.on("tooltipShow",function(e){if(a)d(e)});p.on("tooltipHide",function(){if(a)e.tooltip.cleanup()});v.legend=n;v.dispatch=p;v.pie=t;d3.rebind(v,t,"valueFormat","values","x","y","description","id","showLabels","donutLabelsOutside","pieLabelsOutside","labelType","donut","donutRatio","labelThreshold");v.options=e.utils.optionsFunc.bind(v);v.margin=function(e){if(!arguments.length)return r;r.top=typeof e.top!="undefined"?e.top:r.top;r.right=typeof e.right!="undefined"?e.right:r.right;r.bottom=typeof e.bottom!="undefined"?e.bottom:r.bottom;r.left=typeof e.left!="undefined"?e.left:r.left;return v};v.width=function(e){if(!arguments.length)return i;i=e;return v};v.height=function(e){if(!arguments.length)return s;s=e;return v};v.color=function(r){if(!arguments.length)return u;u=e.utils.getColor(r);n.color(u);t.color(u);return v};v.showLegend=function(e){if(!arguments.length)return o;o=e;return v};v.tooltips=function(e){if(!arguments.length)return a;a=e;return v};v.tooltipContent=function(e){if(!arguments.length)return f;f=e;return v};v.state=function(e){if(!arguments.length)return l;l=e;return v};v.defaultState=function(e){if(!arguments.length)return c;c=e;return v};v.noData=function(e){if(!arguments.length)return h;h=e;return v};return v};e.models.scatter=function(){"use strict";function I(q){q.each(function(I){function Q(){if(!g)return false;var e;var i=d3.merge(I.map(function(e,t){return e.values.map(function(e,n){var r=f(e,n);var i=l(e,n);return[o(r)+Math.random()*1e-7,u(i)+Math.random()*1e-7,t,n,e]}).filter(function(e,t){return b(e[4],t)})}));if(D===true){if(x){var a=X.select("defs").selectAll(".nv-point-clips").data([s]).enter();a.append("clipPath").attr("class","nv-point-clips").attr("id","nv-points-clip-"+s);var c=X.select("#nv-points-clip-"+s).selectAll("circle").data(i);c.enter().append("circle").attr("r",T);c.exit().remove();c.attr("cx",function(e){return e[0]}).attr("cy",function(e){return e[1]});X.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+s+")")}if(i.length){i.push([o.range()[0]-20,u.range()[0]-20,null,null]);i.push([o.range()[1]+20,u.range()[1]+20,null,null]);i.push([o.range()[0]-20,u.range()[0]+20,null,null]);i.push([o.range()[1]+20,u.range()[1]-20,null,null])}var h=d3.geom.polygon([[-10,-10],[-10,r+10],[n+10,r+10],[n+10,-10]]);var p=d3.geom.voronoi(i).map(function(e,t){return{data:h.clip(e),series:i[t][2],point:i[t][3]}});var d=X.select(".nv-point-paths").selectAll("path").data(p);d.enter().append("path").attr("class",function(e,t){return"nv-path-"+t});d.exit().remove();d.attr("d",function(e){if(e.data.length===0)return"M 0 0";else return"M"+e.data.join("L")+"Z"});var v=function(e,n){if(F)return 0;var r=I[e.series];if(typeof r==="undefined")return;var i=r.values[e.point];n({point:i,series:r,pos:[o(f(i,e.point))+t.left,u(l(i,e.point))+t.top],seriesIndex:e.series,pointIndex:e.point})};d.on("click",function(e){v(e,_.elementClick)}).on("mouseover",function(e){v(e,_.elementMouseover)}).on("mouseout",function(e,t){v(e,_.elementMouseout)})}else{X.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementClick({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseover",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementMouseover({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseout",function(e,t){if(F||!I[e.series])return 0;var n=I[e.series],r=n.values[t];_.elementMouseout({point:r,series:n,seriesIndex:e.series,pointIndex:t})})}F=false}var q=n-t.left-t.right,R=r-t.top-t.bottom,U=d3.select(this);I.forEach(function(e,t){e.values.forEach(function(e){e.series=t})});var W=N&&C&&A?[]:d3.merge(I.map(function(e){return e.values.map(function(e,t){return{x:f(e,t),y:l(e,t),size:c(e,t)}})}));o.domain(N||d3.extent(W.map(function(e){return e.x}).concat(d)));if(w&&I[0])o.range(k||[(q*E+q)/(2*I[0].values.length),q-q*(1+E)/(2*I[0].values.length)]);else o.range(k||[0,q]);u.domain(C||d3.extent(W.map(function(e){return e.y}).concat(v))).range(L||[R,0]);a.domain(A||d3.extent(W.map(function(e){return e.size}).concat(m))).range(O||[16,256]);if(o.domain()[0]===o.domain()[1]||u.domain()[0]===u.domain()[1])M=true;if(o.domain()[0]===o.domain()[1])o.domain()[0]?o.domain([o.domain()[0]-o.domain()[0]*.01,o.domain()[1]+o.domain()[1]*.01]):o.domain([-1,1]);if(u.domain()[0]===u.domain()[1])u.domain()[0]?u.domain([u.domain()[0]-u.domain()[0]*.01,u.domain()[1]+u.domain()[1]*.01]):u.domain([-1,1]);if(isNaN(o.domain()[0])){o.domain([-1,1])}if(isNaN(u.domain()[0])){u.domain([-1,1])}P=P||o;H=H||u;B=B||a;var X=U.selectAll("g.nv-wrap.nv-scatter").data([I]);var V=X.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+s+(M?" nv-single-point":""));var $=V.append("defs");var J=V.append("g");var K=X.select("g");J.append("g").attr("class","nv-groups");J.append("g").attr("class","nv-point-paths");X.attr("transform","translate("+t.left+","+t.top+")");$.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect");X.select("#nv-edge-clip-"+s+" rect").attr("width",q).attr("height",R);K.attr("clip-path",S?"url(#nv-edge-clip-"+s+")":"");F=true;var G=X.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});G.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);G.exit().remove();G.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover});G.transition().style("fill",function(e,t){return i(e,t)}).style("stroke",function(e,t){return i(e,t)}).style("stroke-opacity",1).style("fill-opacity",.5);if(p){var Y=G.selectAll("circle.nv-point").data(function(e){return e.values},y);Y.enter().append("circle").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("cx",function(t,n){return e.utils.NaNtoZero(P(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(H(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)});Y.exit().remove();G.exit().selectAll("path.nv-point").transition().attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).remove();Y.each(function(e,t){d3.select(this).classed("nv-point",true).classed("nv-point-"+t,true).classed("hover",false)});Y.transition().attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)})}else{var Y=G.selectAll("path.nv-point").data(function(e){return e.values});Y.enter().append("path").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("transform",function(e,t){return"translate("+P(f(e,t))+","+H(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))}));Y.exit().remove();G.exit().selectAll("path.nv-point").transition().attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).remove();Y.each(function(e,t){d3.select(this).classed("nv-point",true).classed("nv-point-"+t,true).classed("hover",false)});Y.transition().attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))}))}clearTimeout(j);j=setTimeout(Q,300);P=o.copy();H=u.copy();B=a.copy()});return I}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=d3.scale.linear(),u=d3.scale.linear(),a=d3.scale.linear(),f=function(e){return e.x},l=function(e){return e.y},c=function(e){return e.size||1},h=function(e){return e.shape||"circle"},p=true,d=[],v=[],m=[],g=true,y=null,b=function(e){return!e.notActive},w=false,E=.1,S=false,x=true,T=function(){return 25},N=null,C=null,k=null,L=null,A=null,O=null,M=false,_=d3.dispatch("elementClick","elementMouseover","elementMouseout"),D=true;var P,H,B,j,F=false;I.clearHighlights=function(){d3.selectAll(".nv-chart-"+s+" .nv-point.hover").classed("hover",false)};I.highlightPoint=function(e,t,n){d3.select(".nv-chart-"+s+" .nv-series-"+e+" .nv-point-"+t).classed("hover",n)};_.on("elementMouseover.point",function(e){if(g)I.highlightPoint(e.seriesIndex,e.pointIndex,true)});_.on("elementMouseout.point",function(e){if(g)I.highlightPoint(e.seriesIndex,e.pointIndex,false)});I.dispatch=_;I.options=e.utils.optionsFunc.bind(I);I.x=function(e){if(!arguments.length)return f;f=d3.functor(e);return I};I.y=function(e){if(!arguments.length)return l;l=d3.functor(e);return I};I.size=function(e){if(!arguments.length)return c;c=d3.functor(e);return I};I.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return I};I.width=function(e){if(!arguments.length)return n;n=e;return I};I.height=function(e){if(!arguments.length)return r;r=e;return I};I.xScale=function(e){if(!arguments.length)return o;o=e;return I};I.yScale=function(e){if(!arguments.length)return u;u=e;return I};I.zScale=function(e){if(!arguments.length)return a;a=e;return I};I.xDomain=function(e){if(!arguments.length)return N;N=e;return I};I.yDomain=function(e){if(!arguments.length)return C;C=e;return I};I.sizeDomain=function(e){if(!arguments.length)return A;A=e;return I};I.xRange=function(e){if(!arguments.length)return k;k=e;return I};I.yRange=function(e){if(!arguments.length)return L;L=e;return I};I.sizeRange=function(e){if(!arguments.length)return O;O=e;return I};I.forceX=function(e){if(!arguments.length)return d;d=e;return I};I.forceY=function(e){if(!arguments.length)return v;v=e;return I};I.forceSize=function(e){if(!arguments.length)return m;m=e;return I};I.interactive=function(e){if(!arguments.length)return g;g=e;return I};I.pointKey=function(e){if(!arguments.length)return y;y=e;return I};I.pointActive=function(e){if(!arguments.length)return b;b=e;return I};I.padData=function(e){if(!arguments.length)return w;w=e;return I};I.padDataOuter=function(e){if(!arguments.length)return E;E=e;return I};I.clipEdge=function(e){if(!arguments.length)return S;S=e;return I};I.clipVoronoi=function(e){if(!arguments.length)return x;x=e;return I};I.useVoronoi=function(e){if(!arguments.length)return D;D=e;if(D===false){x=false}return I};I.clipRadius=function(e){if(!arguments.length)return T;T=e;return I};I.color=function(t){if(!arguments.length)return i;i=e.utils.getColor(t);return I};I.shape=function(e){if(!arguments.length)return h;h=e;return I};I.onlyCircles=function(e){if(!arguments.length)return p;p=e;return I};I.id=function(e){if(!arguments.length)return s;s=e;return I};I.singlePoint=function(e){if(!arguments.length)return M;M=e;return I};return I};e.models.scatterChart=function(){"use strict";function F(e){e.each(function(e){function K(){if(T){X.select(".nv-point-paths").style("pointer-events","all");return false}X.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(x).focus(i[0]);p.distortion(x).focus(i[1]);X.select(".nv-scatterWrap").call(t);if(b)X.select(".nv-x.nv-axis").call(n);if(w)X.select(".nv-y.nv-axis").call(r);X.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o);X.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var C=d3.select(this),k=this;var L=(f||parseInt(C.style("width"))||960)-a.left-a.right,I=(l||parseInt(C.style("height"))||400)-a.top-a.bottom;F.update=function(){C.transition().duration(D).call(F)};F.container=this;A.disabled=e.map(function(e){return!!e.disabled});if(!O){var q;O={};for(q in A){if(A[q]instanceof Array)O[q]=A[q].slice(0);else O[q]=A[q]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var R=C.selectAll(".nv-noData").data([_]);R.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");R.attr("x",a.left+L/2).attr("y",a.top+I/2).text(function(e){return e});return F}else{C.selectAll(".nv-noData").remove()}P=P||h;H=H||p;var U=C.selectAll("g.nv-wrap.nv-scatterChart").data([e]);var z=U.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id());var W=z.append("g");var X=U.select("g");W.append("rect").attr("class","nvd3 nv-background");W.append("g").attr("class","nv-x nv-axis");W.append("g").attr("class","nv-y nv-axis");W.append("g").attr("class","nv-scatterWrap");W.append("g").attr("class","nv-distWrap");W.append("g").attr("class","nv-legendWrap");W.append("g").attr("class","nv-controlsWrap");if(y){var V=S?L/2:L;i.width(V);U.select(".nv-legendWrap").datum(e).call(i);if(a.top!=i.height()){a.top=i.height();I=(l||parseInt(C.style("height"))||400)-a.top-a.bottom}U.select(".nv-legendWrap").attr("transform","translate("+(L-V)+","+ -a.top+")")}if(S){s.width(180).color(["#444"]);X.select(".nv-controlsWrap").datum(j).attr("transform","translate(0,"+ -a.top+")").call(s)}U.attr("transform","translate("+a.left+","+a.top+")");if(E){X.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)")}t.width(L).height(I).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));if(d!==0)t.xDomain(null);if(v!==0)t.yDomain(null);U.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);if(d!==0){var $=h.domain()[1]-h.domain()[0];t.xDomain([h.domain()[0]-d*$,h.domain()[1]+d*$])}if(v!==0){var J=p.domain()[1]-p.domain()[0];t.yDomain([p.domain()[0]-v*J,p.domain()[1]+v*J])}if(v!==0||d!==0){U.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t)}if(b){n.scale(h).ticks(n.ticks()&&n.ticks().length?n.ticks():L/100).tickSize(-I,0);X.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)}if(w){r.scale(p).ticks(r.ticks()&&r.ticks().length?r.ticks():I/36).tickSize(-L,0);X.select(".nv-y.nv-axis").call(r)}if(m){o.getData(t.x()).scale(h).width(L).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));W.select(".nv-distWrap").append("g").attr("class","nv-distributionX");X.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)}if(g){u.getData(t.y()).scale(p).width(I).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));W.select(".nv-distWrap").append("g").attr("class","nv-distributionY");X.select(".nv-distributionY").attr("transform","translate("+(E?L:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)}if(d3.fisheye){X.select(".nv-background").attr("width",L).attr("height",I);X.select(".nv-background").on("mousemove",K);X.select(".nv-background").on("click",function(){T=!T});t.dispatch.on("elementClick.freezeFisheye",function(){T=!T})}s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled;x=e.disabled?0:2.5;X.select(".nv-background").style("pointer-events",e.disabled?"none":"all");X.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none");if(e.disabled){h.distortion(x).focus(0);p.distortion(x).focus(0);X.select(".nv-scatterWrap").call(t);X.select(".nv-x.nv-axis").call(n);X.select(".nv-y.nv-axis").call(r)}else{T=false}F.update()});i.dispatch.on("stateChange",function(e){A.disabled=e.disabled;M.stateChange(A);F.update()});t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",function(t,n){return e.pos[1]-I});d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size());e.pos=[e.pos[0]+a.left,e.pos[1]+a.top];M.tooltipShow(e)});M.on("tooltipShow",function(e){if(N)B(e,k.parentNode)});M.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});A.disabled=t.disabled}F.update()});P=h.copy();H=p.copy()});return F}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution();var a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=0,v=0,m=false,g=false,y=true,b=true,w=true,E=false,S=!!d3.fisheye,x=0,T=false,N=true,C=function(e,t,n){return""+t+""},k=function(e,t,n){return""+n+""},L=null,A={},O=null,M=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),_="No Data Available.",D=250;t.xScale(h).yScale(p);n.orient("bottom").tickPadding(10);r.orient(E?"right":"left").tickPadding(10);o.axis("x");u.axis("y");s.updateState(false);var P,H;var B=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));if(C!=null)e.tooltip.show([f,l],C(i.series.key,v,m,i,F),"n",1,s,"x-nvtooltip");if(k!=null)e.tooltip.show([c,d],k(i.series.key,v,m,i,F),"e",1,s,"y-nvtooltip");if(L!=null)e.tooltip.show([o,u],L(i.series.key,v,m,i,F),i.value<0?"n":"s",null,s)};var j=[{key:"Magnify",disabled:true}];t.dispatch.on("elementMouseout.tooltip",function(e){M.tooltipHide(e);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())});M.on("tooltipHide",function(){if(N)e.tooltip.cleanup()});F.dispatch=M;F.scatter=t;F.legend=i;F.controls=s;F.xAxis=n;F.yAxis=r;F.distX=o;F.distY=u;d3.rebind(F,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi");F.options=e.utils.optionsFunc.bind(F);F.margin=function(e){if(!arguments.length)return a;a.top=typeof e.top!="undefined"?e.top:a.top;a.right=typeof e.right!="undefined"?e.right:a.right;a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom;a.left=typeof e.left!="undefined"?e.left:a.left;return F};F.width=function(e){if(!arguments.length)return f;f=e;return F};F.height=function(e){if(!arguments.length)return l;l=e;return F};F.color=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);i.color(c);o.color(c);u.color(c);return F};F.showDistX=function(e){if(!arguments.length)return m;m=e;return F};F.showDistY=function(e){if(!arguments.length)return g;g=e;return F};F.showControls=function(e){if(!arguments.length)return S;S=e;return F};F.showLegend=function(e){if(!arguments.length)return y;y=e;return F};F.showXAxis=function(e){if(!arguments.length)return b;b=e;return F};F.showYAxis=function(e){if(!arguments.length)return w;w=e;return F};F.rightAlignYAxis=function(e){if(!arguments.length)return E;E=e;r.orient(e?"right":"left");return F};F.fisheye=function(e){if(!arguments.length)return x;x=e;return F};F.xPadding=function(e){if(!arguments.length)return d;d=e;return F};F.yPadding=function(e){if(!arguments.length)return v;v=e;return F};F.tooltips=function(e){if(!arguments.length)return N;N=e;return F};F.tooltipContent=function(e){if(!arguments.length)return L;L=e;return F};F.tooltipXContent=function(e){if(!arguments.length)return C;C=e;return F};F.tooltipYContent=function(e){if(!arguments.length)return k;k=e;return F};F.state=function(e){if(!arguments.length)return A;A=e;return F};F.defaultState=function(e){if(!arguments.length)return O;O=e;return F};F.noData=function(e){if(!arguments.length)return _;_=e;return F};F.transitionDuration=function(e){if(!arguments.length)return D;D=e;return F};return F};e.models.scatterPlusLineChart=function(){"use strict";function B(e){e.each(function(e){function $(){if(S){z.select(".nv-point-paths").style("pointer-events","all");return false}z.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(E).focus(i[0]);p.distortion(E).focus(i[1]);z.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);if(g)z.select(".nv-x.nv-axis").call(n);if(y)z.select(".nv-y.nv-axis").call(r);z.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o);z.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var T=d3.select(this),N=this;var C=(f||parseInt(T.style("width"))||960)-a.left-a.right,j=(l||parseInt(T.style("height"))||400)-a.top-a.bottom;B.update=function(){T.transition().duration(M).call(B)};B.container=this;k.disabled=e.map(function(e){return!!e.disabled});if(!L){var F;L={};for(F in k){if(k[F]instanceof Array)L[F]=k[F].slice(0);else L[F]=k[F]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var I=T.selectAll(".nv-noData").data([O]);I.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");I.attr("x",a.left+C/2).attr("y",a.top+j/2).text(function(e){return e});return B}else{T.selectAll(".nv-noData").remove()}h=t.xScale();p=t.yScale();_=_||h;D=D||p;var q=T.selectAll("g.nv-wrap.nv-scatterChart").data([e]);var R=q.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id());var U=R.append("g");var z=q.select("g");U.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none");U.append("g").attr("class","nv-x nv-axis");U.append("g").attr("class","nv-y nv-axis");U.append("g").attr("class","nv-scatterWrap");U.append("g").attr("class","nv-regressionLinesWrap");U.append("g").attr("class","nv-distWrap");U.append("g").attr("class","nv-legendWrap");U.append("g").attr("class","nv-controlsWrap");q.attr("transform","translate("+a.left+","+a.top+")");if(b){z.select(".nv-y.nv-axis").attr("transform","translate("+C+",0)")}if(m){i.width(C/2);q.select(".nv-legendWrap").datum(e).call(i);if(a.top!=i.height()){a.top=i.height();j=(l||parseInt(T.style("height"))||400)-a.top-a.bottom}q.select(".nv-legendWrap").attr("transform","translate("+C/2+","+ -a.top+")")}if(w){s.width(180).color(["#444"]);z.select(".nv-controlsWrap").datum(H).attr("transform","translate(0,"+ -a.top+")").call(s)}t.width(C).height(j).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));q.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);q.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+t.id()+")");var W=q.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(e){return e});W.enter().append("g").attr("class","nv-regLines");var X=W.selectAll(".nv-regLine").data(function(e){return[e]});var V=X.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0);X.transition().attr("x1",h.range()[0]).attr("x2",h.range()[1]).attr("y1",function(e,t){return p(h.domain()[0]*e.slope+e.intercept)}).attr("y2",function(e,t){return p(h.domain()[1]*e.slope+e.intercept)}).style("stroke",function(e,t,n){return c(e,n)}).style("stroke-opacity",function(e,t){return e.disabled||typeof e.slope==="undefined"||typeof e.intercept==="undefined"?0:1});if(g){n.scale(h).ticks(n.ticks()?n.ticks():C/100).tickSize(-j,0);z.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)}if(y){r.scale(p).ticks(r.ticks()?r.ticks():j/36).tickSize(-C,0);z.select(".nv-y.nv-axis").call(r)}if(d){o.getData(t.x()).scale(h).width(C).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));U.select(".nv-distWrap").append("g").attr("class","nv-distributionX");z.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)}if(v){u.getData(t.y()).scale(p).width(j).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));U.select(".nv-distWrap").append("g").attr("class","nv-distributionY");z.select(".nv-distributionY").attr("transform","translate("+(b?C:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)}if(d3.fisheye){z.select(".nv-background").attr("width",C).attr("height",j);z.select(".nv-background").on("mousemove",$);z.select(".nv-background").on("click",function(){S=!S});t.dispatch.on("elementClick.freezeFisheye",function(){S=!S})}s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled;E=e.disabled?0:2.5;z.select(".nv-background").style("pointer-events",e.disabled?"none":"all");z.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none");if(e.disabled){h.distortion(E).focus(0);p.distortion(E).focus(0);z.select(".nv-scatterWrap").call(t);z.select(".nv-x.nv-axis").call(n);z.select(".nv-y.nv-axis").call(r)}else{S=false}B.update()});i.dispatch.on("stateChange",function(e){k=e;A.stateChange(k);B.update()});t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",e.pos[1]-j);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size());e.pos=[e.pos[0]+a.left,e.pos[1]+a.top];A.tooltipShow(e)});A.on("tooltipShow",function(e){if(x)P(e,N.parentNode)});A.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});k.disabled=t.disabled}B.update()});_=h.copy();D=p.copy()});return B}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution();var a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=false,v=false,m=true,g=true,y=true,b=false,w=!!d3.fisheye,E=0,S=false,x=true,T=function(e,t,n){return""+t+""},N=function(e,t,n){return""+n+""},C=function(e,t,n,r){return"

      "+e+"

      "+"

      "+r+"

      "},k={},L=null,A=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),O="No Data Available.",M=250;t.xScale(h).yScale(p);n.orient("bottom").tickPadding(10);r.orient(b?"right":"left").tickPadding(10);o.axis("x");u.axis("y");s.updateState(false);var _,D;var P=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));if(T!=null)e.tooltip.show([f,l],T(i.series.key,v,m,i,B),"n",1,s,"x-nvtooltip");if(N!=null)e.tooltip.show([c,d],N(i.series.key,v,m,i,B),"e",1,s,"y-nvtooltip");if(C!=null)e.tooltip.show([o,u],C(i.series.key,v,m,i.point.tooltip,i,B),i.value<0?"n":"s",null,s)};var H=[{key:"Magnify",disabled:true}];t.dispatch.on("elementMouseout.tooltip",function(e){A.tooltipHide(e);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())});A.on("tooltipHide",function(){if(x)e.tooltip.cleanup()});B.dispatch=A;B.scatter=t;B.legend=i;B.controls=s;B.xAxis=n;B.yAxis=r;B.distX=o;B.distY=u;d3.rebind(B,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi");B.options=e.utils.optionsFunc.bind(B);B.margin=function(e){if(!arguments.length)return a;a.top=typeof e.top!="undefined"?e.top:a.top;a.right=typeof e.right!="undefined"?e.right:a.right;a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom;a.left=typeof e.left!="undefined"?e.left:a.left;return B};B.width=function(e){if(!arguments.length)return f;f=e;return B};B.height=function(e){if(!arguments.length)return l;l=e;return B};B.color=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);i.color(c);o.color(c);u.color(c);return B};B.showDistX=function(e){if(!arguments.length)return d;d=e;return B};B.showDistY=function(e){if(!arguments.length)return v;v=e;return B};B.showControls=function(e){if(!arguments.length)return w;w=e;return B};B.showLegend=function(e){if(!arguments.length)return m;m=e;return B};B.showXAxis=function(e){if(!arguments.length)return g;g=e;return B};B.showYAxis=function(e){if(!arguments.length)return y;y=e;return B};B.rightAlignYAxis=function(e){if(!arguments.length)return b;b=e;r.orient(e?"right":"left");return B};B.fisheye=function(e){if(!arguments.length)return E;E=e;return B};B.tooltips=function(e){if(!arguments.length)return x;x=e;return B};B.tooltipContent=function(e){if(!arguments.length)return C;C=e;return B};B.tooltipXContent=function(e){if(!arguments.length)return T;T=e;return B};B.tooltipYContent=function(e){if(!arguments.length)return N;N=e;return B};B.state=function(e){if(!arguments.length)return k;k=e;return B};B.defaultState=function(e){if(!arguments.length)return L;L=e;return B};B.noData=function(e){if(!arguments.length)return O;O=e;return B};B.transitionDuration=function(e){if(!arguments.length)return M;M=e;return B};return B};e.models.sparkline=function(){"use strict";function d(e){e.each(function(e){var i=n-t.left-t.right,d=r-t.top-t.bottom,v=d3.select(this);s.domain(l||d3.extent(e,u)).range(h||[0,i]);o.domain(c||d3.extent(e,a)).range(p||[d,0]);var m=v.selectAll("g.nv-wrap.nv-sparkline").data([e]);var g=m.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline");var b=g.append("g");var w=m.select("g");m.attr("transform","translate("+t.left+","+t.top+")");var E=m.selectAll("path").data(function(e){return[e]});E.enter().append("path");E.exit().remove();E.style("stroke",function(e,t){return e.color||f(e,t)}).attr("d",d3.svg.line().x(function(e,t){return s(u(e,t))}).y(function(e,t){return o(a(e,t))}));var S=m.selectAll("circle.nv-point").data(function(e){function n(t){if(t!=-1){var n=e[t];n.pointIndex=t;return n}else{return null}}var t=e.map(function(e,t){return a(e,t)});var r=n(t.lastIndexOf(o.domain()[1])),i=n(t.indexOf(o.domain()[0])),s=n(t.length-1);return[i,r,s].filter(function(e){return e!=null})});S.enter().append("circle");S.exit().remove();S.attr("cx",function(e,t){return s(u(e,e.pointIndex))}).attr("cy",function(e,t){return o(a(e,e.pointIndex))}).attr("r",2).attr("class",function(e,t){return u(e,e.pointIndex)==s.domain()[1]?"nv-point nv-currentValue":a(e,e.pointIndex)==o.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})});return d}var t={top:2,right:0,bottom:2,left:0},n=400,r=32,i=true,s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=e.utils.getColor(["#000"]),l,c,h,p;d.options=e.utils.optionsFunc.bind(d);d.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return d};d.width=function(e){if(!arguments.length)return n;n=e;return d};d.height=function(e){if(!arguments.length)return r;r=e;return d};d.x=function(e){if(!arguments.length)return u;u=d3.functor(e);return d};d.y=function(e){if(!arguments.length)return a;a=d3.functor(e);return d};d.xScale=function(e){if(!arguments.length)return s;s=e;return d};d.yScale=function(e){if(!arguments.length)return o;o=e;return d};d.xDomain=function(e){if(!arguments.length)return l;l=e;return d};d.yDomain=function(e){if(!arguments.length)return c;c=e;return d};d.xRange=function(e){if(!arguments.length)return h;h=e;return d};d.yRange=function(e){if(!arguments.length)return p;p=e;return d};d.animate=function(e){if(!arguments.length)return i;i=e;return d};d.color=function(t){if(!arguments.length)return f;f=e.utils.getColor(t);return d};return d};e.models.sparklinePlus=function(){"use strict";function v(e){e.each(function(c){function O(){if(a)return;var e=C.selectAll(".nv-hoverValue").data(u);var r=e.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);e.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove();e.attr("transform",function(e){return"translate("+s(t.x()(c[e],e))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1);if(!u.length)return;r.append("line").attr("x1",0).attr("y1",-n.top).attr("x2",0).attr("y2",b);r.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-n.top).attr("text-anchor","end").attr("dy",".9em");C.select(".nv-hoverValue .nv-xValue").text(f(t.x()(c[u[0]],u[0])));r.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-n.top).attr("text-anchor","start").attr("dy",".9em");C.select(".nv-hoverValue .nv-yValue").text(l(t.y()(c[u[0]],u[0])))}function M(){function r(e,n){var r=Math.abs(t.x()(e[0],0)-n);var i=0;for(var s=0;s2){var h=D.yScale().invert(i.mouseY);var p=Infinity,d=null;c.forEach(function(e,t){if(h>=e.stackedValue.y0&&h<=e.stackedValue.y0+e.stackedValue.y){d=t;return}});if(d!=null)c[d].highlight=true}var v=n.tickFormat()(D.x()(s,a));var m=t.style()=="expand"?function(e,t){return d3.format(".1%")(e)}:function(e,t){return r.tickFormat()(e)};o.tooltip.position({left:f+u.left,top:i.mouseY+u.top}).chartContainer(P.parentNode).enabled(g).valueFormatter(m).data({value:v,series:c})();o.renderGuideLine(f)});o.dispatch.on("elementMouseout",function(e){k.tooltipHide();t.clearHighlights()});k.on("tooltipShow",function(e){if(g)_(e,P.parentNode)});k.on("changeState",function(e){if(typeof e.disabled!=="undefined"){b.forEach(function(t,n){t.disabled=e.disabled[n]});T.disabled=e.disabled}if(typeof e.style!=="undefined"){t.style(e.style)}D.update()})});return D}var t=e.models.stackedArea(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline();var u={top:30,right:25,bottom:50,left:60},a=null,f=null,l=e.utils.defaultColor(),c=true,h=true,p=true,d=true,v=false,m=false,g=true,y="top",b=function(e,t,n,r,i){return"

      "+e+"

      "+"

      "+n+" on "+t+"

      "},w,E,S=d3.format(",.2f"),x=d3.format(",.3f"),T={style:t.style()},N=null,C="No Data Available.",k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=250,A=["Stacked","Stream","Expanded"],O={},M=250;n.orient("bottom").tickPadding(7);r.orient(v?"right":"left");s.updateState(false);var _=function(r,i){var s=r.pos[0]+(i.offsetLeft||0),o=r.pos[1]+(i.offsetTop||0),u=n.tickFormat()(t.x()(r.point,r.pointIndex)),a=x(t.y()(r.point,r.pointIndex)),f=b(r.series.key,u,a,r,D);e.tooltip.show([s,o],f,r.value<0?"n":"s",null,i)};t.dispatch.on("tooltipShow",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],k.tooltipShow(e)});t.dispatch.on("tooltipHide",function(e){k.tooltipHide(e)});k.on("tooltipHide",function(){if(g)e.tooltip.cleanup()});D.dispatch=k;D.stacked=t;D.legend=i;D.controls=s;D.xAxis=n;D.yAxis=r;D.interactiveLayer=o;d3.rebind(D,t,"x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","sizeDomain","interactive","useVoronoi","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate");D.options=e.utils.optionsFunc.bind(D);D.margin=function(e){if(!arguments.length)return u;u.top=typeof e.top!="undefined"?e.top:u.top;u.right=typeof e.right!="undefined"?e.right:u.right;u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom;u.left=typeof e.left!="undefined"?e.left:u.left;return D};D.width=function(e){if(!arguments.length)return a;a=e;return D};D.height=function(e){if(!arguments.length)return f;f=e;return D};D.color=function(n){if(!arguments.length)return l;l=e.utils.getColor(n);i.color(l);t.color(l);return D};D.showControls=function(e){if(!arguments.length)return c;c=e;return D};D.showLegend=function(e){if(!arguments.length)return h;h=e;return D};D.showXAxis=function(e){if(!arguments.length)return p;p=e;return D};D.showYAxis=function(e){if(!arguments.length)return d;d=e;return D};D.rightAlignYAxis=function(e){if(!arguments.length)return v;v=e;r.orient(e?"right":"left");return D};D.useInteractiveGuideline=function(e){if(!arguments.length)return m;m=e;if(e===true){D.interactive(false);D.useVoronoi(false)}return D};D.tooltip=function(e){if(!arguments.length)return b;b=e;return D};D.tooltips=function(e){if(!arguments.length)return g;g=e;return D};D.legendPos=function(e){if(!arguments.length)return y;y=e;return D};D.tooltipContent=function(e){if(!arguments.length)return b;b=e;return D};D.yAxisTooltipFormat=function(e){if(!arguments.length)return x;x=e;return D};D.state=function(e){if(!arguments.length)return T;T=e;return D};D.defaultState=function(e){if(!arguments.length)return N;N=e;return D};D.noData=function(e){if(!arguments.length)return C;C=e;return D};D.transitionDuration=function(e){if(!arguments.length)return M;M=e;return D};D.controlsData=function(e){if(!arguments.length)return A;A=e;return D};D.controlLabels=function(e){if(!arguments.length)return O;if(typeof e!=="object")return O;O=e;return D};r.setTickFormat=r.tickFormat;r.tickFormat=function(e){if(!arguments.length)return S;S=e;return r};return D}})() \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/outro.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/outro.js new file mode 100644 index 0000000..158693a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/outro.js @@ -0,0 +1 @@ +})(); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/sankey.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/sankey.js new file mode 100644 index 0000000..c3bc59f --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/sankey.js @@ -0,0 +1,292 @@ +d3.sankey = function() { + var sankey = {}, + nodeWidth = 24, + nodePadding = 8, + size = [1, 1], + nodes = [], + links = []; + + sankey.nodeWidth = function(_) { + if (!arguments.length) return nodeWidth; + nodeWidth = +_; + return sankey; + }; + + sankey.nodePadding = function(_) { + if (!arguments.length) return nodePadding; + nodePadding = +_; + return sankey; + }; + + sankey.nodes = function(_) { + if (!arguments.length) return nodes; + nodes = _; + return sankey; + }; + + sankey.links = function(_) { + if (!arguments.length) return links; + links = _; + return sankey; + }; + + sankey.size = function(_) { + if (!arguments.length) return size; + size = _; + return sankey; + }; + + sankey.layout = function(iterations) { + computeNodeLinks(); + computeNodeValues(); + computeNodeBreadths(); + computeNodeDepths(iterations); + computeLinkDepths(); + return sankey; + }; + + sankey.relayout = function() { + computeLinkDepths(); + return sankey; + }; + + sankey.link = function() { + var curvature = .5; + + function link(d) { + var x0 = d.source.x + d.source.dx, + x1 = d.target.x, + xi = d3.interpolateNumber(x0, x1), + x2 = xi(curvature), + x3 = xi(1 - curvature), + y0 = d.source.y + d.sy + d.dy / 2, + y1 = d.target.y + d.ty + d.dy / 2; + return "M" + x0 + "," + y0 + + "C" + x2 + "," + y0 + + " " + x3 + "," + y1 + + " " + x1 + "," + y1; + } + + link.curvature = function(_) { + if (!arguments.length) return curvature; + curvature = +_; + return link; + }; + + return link; + }; + + // Populate the sourceLinks and targetLinks for each node. + // Also, if the source and target are not objects, assume they are indices. + function computeNodeLinks() { + nodes.forEach(function(node) { + node.sourceLinks = []; + node.targetLinks = []; + }); + links.forEach(function(link) { + var source = link.source, + target = link.target; + if (typeof source === "number") source = link.source = nodes[link.source]; + if (typeof target === "number") target = link.target = nodes[link.target]; + source.sourceLinks.push(link); + target.targetLinks.push(link); + }); + } + + // Compute the value (size) of each node by summing the associated links. + function computeNodeValues() { + nodes.forEach(function(node) { + node.value = Math.max( + d3.sum(node.sourceLinks, value), + d3.sum(node.targetLinks, value) + ); + }); + } + + // Iteratively assign the breadth (x-position) for each node. + // Nodes are assigned the maximum breadth of incoming neighbors plus one; + // nodes with no incoming links are assigned breadth zero, while + // nodes with no outgoing links are assigned the maximum breadth. + function computeNodeBreadths() { + var remainingNodes = nodes, + nextNodes, + x = 0; + + while (remainingNodes.length) { + nextNodes = []; + remainingNodes.forEach(function(node) { + node.x = x; + node.dx = nodeWidth; + node.sourceLinks.forEach(function(link) { + nextNodes.push(link.target); + }); + }); + remainingNodes = nextNodes; + ++x; + } + + // + moveSinksRight(x); + scaleNodeBreadths((size[0] - nodeWidth) / (x - 1)); + } + + function moveSourcesRight() { + nodes.forEach(function(node) { + if (!node.targetLinks.length) { + node.x = d3.min(node.sourceLinks, function(d) { return d.target.x; }) - 1; + } + }); + } + + function moveSinksRight(x) { + nodes.forEach(function(node) { + if (!node.sourceLinks.length) { + node.x = x - 1; + } + }); + } + + function scaleNodeBreadths(kx) { + nodes.forEach(function(node) { + node.x *= kx; + }); + } + + function computeNodeDepths(iterations) { + var nodesByBreadth = d3.nest() + .key(function(d) { return d.x; }) + .sortKeys(d3.ascending) + .entries(nodes) + .map(function(d) { return d.values; }); + + // + initializeNodeDepth(); + resolveCollisions(); + for (var alpha = 1; iterations > 0; --iterations) { + relaxRightToLeft(alpha *= .99); + resolveCollisions(); + relaxLeftToRight(alpha); + resolveCollisions(); + } + + function initializeNodeDepth() { + var ky = d3.min(nodesByBreadth, function(nodes) { + return (size[1] - (nodes.length - 1) * nodePadding) / d3.sum(nodes, value); + }); + + nodesByBreadth.forEach(function(nodes) { + nodes.forEach(function(node, i) { + node.y = i; + node.dy = node.value * ky; + }); + }); + + links.forEach(function(link) { + link.dy = link.value * ky; + }); + } + + function relaxLeftToRight(alpha) { + nodesByBreadth.forEach(function(nodes, breadth) { + nodes.forEach(function(node) { + if (node.targetLinks.length) { + var y = d3.sum(node.targetLinks, weightedSource) / d3.sum(node.targetLinks, value); + node.y += (y - center(node)) * alpha; + } + }); + }); + + function weightedSource(link) { + return center(link.source) * link.value; + } + } + + function relaxRightToLeft(alpha) { + nodesByBreadth.slice().reverse().forEach(function(nodes) { + nodes.forEach(function(node) { + if (node.sourceLinks.length) { + var y = d3.sum(node.sourceLinks, weightedTarget) / d3.sum(node.sourceLinks, value); + node.y += (y - center(node)) * alpha; + } + }); + }); + + function weightedTarget(link) { + return center(link.target) * link.value; + } + } + + function resolveCollisions() { + nodesByBreadth.forEach(function(nodes) { + var node, + dy, + y0 = 0, + n = nodes.length, + i; + + // Push any overlapping nodes down. + nodes.sort(ascendingDepth); + for (i = 0; i < n; ++i) { + node = nodes[i]; + dy = y0 - node.y; + if (dy > 0) node.y += dy; + y0 = node.y + node.dy + nodePadding; + } + + // If the bottommost node goes outside the bounds, push it back up. + dy = y0 - nodePadding - size[1]; + if (dy > 0) { + y0 = node.y -= dy; + + // Push any overlapping nodes back up. + for (i = n - 2; i >= 0; --i) { + node = nodes[i]; + dy = node.y + node.dy + nodePadding - y0; + if (dy > 0) node.y -= dy; + y0 = node.y; + } + } + }); + } + + function ascendingDepth(a, b) { + return a.y - b.y; + } + } + + function computeLinkDepths() { + nodes.forEach(function(node) { + node.sourceLinks.sort(ascendingTargetDepth); + node.targetLinks.sort(ascendingSourceDepth); + }); + nodes.forEach(function(node) { + var sy = 0, ty = 0; + node.sourceLinks.forEach(function(link) { + link.sy = sy; + sy += link.dy; + }); + node.targetLinks.forEach(function(link) { + link.ty = ty; + ty += link.dy; + }); + }); + + function ascendingSourceDepth(a, b) { + return a.source.y - b.source.y; + } + + function ascendingTargetDepth(a, b) { + return a.target.y - b.target.y; + } + } + + function center(node) { + return node.y + node.dy / 2; + } + + function value(link) { + return link.value; + } + + return sankey; +}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/tooltip.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/tooltip.js new file mode 100644 index 0000000..46e5a81 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/tooltip.js @@ -0,0 +1,490 @@ +/* Tooltip rendering model for nvd3 charts. +window.nv.models.tooltip is the updated,new way to render tooltips. + +window.nv.tooltip.show is the old tooltip code. +window.nv.tooltip.* also has various helper methods. +*/ +(function() { + "use strict"; + window.nv.tooltip = {}; + + /* Model which can be instantiated to handle tooltip rendering. + Example usage: + var tip = nv.models.tooltip().gravity('w').distance(23) + .data(myDataObject); + + tip(); //just invoke the returned function to render tooltip. + */ + window.nv.models.tooltip = function() { + var content = null //HTML contents of the tooltip. If null, the content is generated via the data variable. + , data = null /* Tooltip data. If data is given in the proper format, a consistent tooltip is generated. + Format of data: + { + key: "Date", + value: "August 2009", + series: [ + { + key: "Series 1", + value: "Value 1", + color: "#000" + }, + { + key: "Series 2", + value: "Value 2", + color: "#00f" + } + ] + + } + + */ + , gravity = 'w' //Can be 'n','s','e','w'. Determines how tooltip is positioned. + , distance = 50 //Distance to offset tooltip from the mouse location. + , snapDistance = 25 //Tolerance allowed before tooltip is moved from its current position (creates 'snapping' effect) + , fixedTop = null //If not null, this fixes the top position of the tooltip. + , classes = null //Attaches additional CSS classes to the tooltip DIV that is created. + , chartContainer = null //Parent DIV, of the SVG Container that holds the chart. + , tooltipElem = null //actual DOM element representing the tooltip. + , position = {left: null, top: null} //Relative position of the tooltip inside chartContainer. + , enabled = true //True -> tooltips are rendered. False -> don't render tooltips. + //Generates a unique id when you create a new tooltip() object + , id = "nvtooltip-" + Math.floor(Math.random() * 100000) + ; + + //CSS class to specify whether element should not have mouse events. + var nvPointerEventsClass = "nv-pointer-events-none"; + + //Format function for the tooltip values column + var valueFormatter = function(d,i) { + return d; + }; + + //Format function for the tooltip header value. + var headerFormatter = function(d) { + return d; + }; + + //By default, the tooltip model renders a beautiful table inside a DIV. + //You can override this function if a custom tooltip is desired. + var contentGenerator = function(d) { + if (content != null) return content; + + if (d == null) return ''; + + var table = d3.select(document.createElement("table")); + var theadEnter = table.selectAll("thead") + .data([d]) + .enter().append("thead"); + theadEnter.append("tr") + .append("td") + .attr("colspan",3) + .append("strong") + .classed("x-value",true) + .html(headerFormatter(d.value)); + + var tbodyEnter = table.selectAll("tbody") + .data([d]) + .enter().append("tbody"); + var trowEnter = tbodyEnter.selectAll("tr") + .data(function(p) { return p.series}) + .enter() + .append("tr") + .classed("highlight", function(p) { return p.highlight}) + ; + + trowEnter.append("td") + .classed("legend-color-guide",true) + .append("div") + .style("background-color", function(p) { return p.color}); + trowEnter.append("td") + .classed("key",true) + .html(function(p) {return p.key}); + trowEnter.append("td") + .classed("value",true) + .html(function(p,i) { return valueFormatter(p.value,i) }); + + + trowEnter.selectAll("td").each(function(p) { + if (p.highlight) { + var opacityScale = d3.scale.linear().domain([0,1]).range(["#fff",p.color]); + var opacity = 0.6; + d3.select(this) + .style("border-bottom-color", opacityScale(opacity)) + .style("border-top-color", opacityScale(opacity)) + ; + } + }); + + var html = table.node().outerHTML; + if (d.footer !== undefined) + html += ""; + return html; + + }; + + var dataSeriesExists = function(d) { + if (d && d.series && d.series.length > 0) return true; + + return false; + }; + + //In situations where the chart is in a 'viewBox', re-position the tooltip based on how far chart is zoomed. + function convertViewBoxRatio() { + if (chartContainer) { + var svg = d3.select(chartContainer); + if (svg.node().tagName !== "svg") { + svg = svg.select("svg"); + } + var viewBox = (svg.node()) ? svg.attr('viewBox') : null; + if (viewBox) { + viewBox = viewBox.split(' '); + var ratio = parseInt(svg.style('width')) / viewBox[2]; + + position.left = position.left * ratio; + position.top = position.top * ratio; + } + } + } + + //Creates new tooltip container, or uses existing one on DOM. + function getTooltipContainer(newContent) { + var body; + if (chartContainer) + body = d3.select(chartContainer); + else + body = d3.select("body"); + + var container = body.select(".nvtooltip"); + if (container.node() === null) { + //Create new tooltip div if it doesn't exist on DOM. + container = body.append("div") + .attr("class", "nvtooltip " + (classes? classes: "xy-tooltip")) + .attr("id",id) + ; + } + + + container.node().innerHTML = newContent; + container.style("top",0).style("left",0).style("opacity",0); + container.selectAll("div, table, td, tr").classed(nvPointerEventsClass,true) + container.classed(nvPointerEventsClass,true); + return container.node(); + } + + + + //Draw the tooltip onto the DOM. + function nvtooltip() { + if (!enabled) return; + if (!dataSeriesExists(data)) return; + + convertViewBoxRatio(); + + var left = position.left; + var top = (fixedTop != null) ? fixedTop : position.top; + var container = getTooltipContainer(contentGenerator(data)); + tooltipElem = container; + if (chartContainer) { + var svgComp = chartContainer.getElementsByTagName("svg")[0]; + var boundRect = (svgComp) ? svgComp.getBoundingClientRect() : chartContainer.getBoundingClientRect(); + var svgOffset = {left:0,top:0}; + if (svgComp) { + var svgBound = svgComp.getBoundingClientRect(); + var chartBound = chartContainer.getBoundingClientRect(); + var svgBoundTop = svgBound.top; + + //Defensive code. Sometimes, svgBoundTop can be a really negative + // number, like -134254. That's a bug. + // If such a number is found, use zero instead. FireFox bug only + if (svgBoundTop < 0) { + var containerBound = chartContainer.getBoundingClientRect(); + svgBoundTop = (Math.abs(svgBoundTop) > containerBound.height) ? 0 : svgBoundTop; + } + svgOffset.top = Math.abs(svgBoundTop - chartBound.top); + svgOffset.left = Math.abs(svgBound.left - chartBound.left); + } + //If the parent container is an overflow
      with scrollbars, subtract the scroll offsets. + //You need to also add any offset between the element and its containing
      + //Finally, add any offset of the containing
      on the whole page. + left += chartContainer.offsetLeft + svgOffset.left - 2*chartContainer.scrollLeft; + top += chartContainer.offsetTop + svgOffset.top - 2*chartContainer.scrollTop; + } + + if (snapDistance && snapDistance > 0) { + top = Math.floor(top/snapDistance) * snapDistance; + } + + nv.tooltip.calcTooltipPosition([left,top], gravity, distance, container); + return nvtooltip; + }; + + nvtooltip.nvPointerEventsClass = nvPointerEventsClass; + + nvtooltip.content = function(_) { + if (!arguments.length) return content; + content = _; + return nvtooltip; + }; + + //Returns tooltipElem...not able to set it. + nvtooltip.tooltipElem = function() { + return tooltipElem; + }; + + nvtooltip.contentGenerator = function(_) { + if (!arguments.length) return contentGenerator; + if (typeof _ === 'function') { + contentGenerator = _; + } + return nvtooltip; + }; + + nvtooltip.data = function(_) { + if (!arguments.length) return data; + data = _; + return nvtooltip; + }; + + nvtooltip.gravity = function(_) { + if (!arguments.length) return gravity; + gravity = _; + return nvtooltip; + }; + + nvtooltip.distance = function(_) { + if (!arguments.length) return distance; + distance = _; + return nvtooltip; + }; + + nvtooltip.snapDistance = function(_) { + if (!arguments.length) return snapDistance; + snapDistance = _; + return nvtooltip; + }; + + nvtooltip.classes = function(_) { + if (!arguments.length) return classes; + classes = _; + return nvtooltip; + }; + + nvtooltip.chartContainer = function(_) { + if (!arguments.length) return chartContainer; + chartContainer = _; + return nvtooltip; + }; + + nvtooltip.position = function(_) { + if (!arguments.length) return position; + position.left = (typeof _.left !== 'undefined') ? _.left : position.left; + position.top = (typeof _.top !== 'undefined') ? _.top : position.top; + return nvtooltip; + }; + + nvtooltip.fixedTop = function(_) { + if (!arguments.length) return fixedTop; + fixedTop = _; + return nvtooltip; + }; + + nvtooltip.enabled = function(_) { + if (!arguments.length) return enabled; + enabled = _; + return nvtooltip; + }; + + nvtooltip.valueFormatter = function(_) { + if (!arguments.length) return valueFormatter; + if (typeof _ === 'function') { + valueFormatter = _; + } + return nvtooltip; + }; + + nvtooltip.headerFormatter = function(_) { + if (!arguments.length) return headerFormatter; + if (typeof _ === 'function') { + headerFormatter = _; + } + return nvtooltip; + }; + + //id() is a read-only function. You can't use it to set the id. + nvtooltip.id = function() { + return id; + }; + + + return nvtooltip; + }; + + + //Original tooltip.show function. Kept for backward compatibility. + // pos = [left,top] + nv.tooltip.show = function(pos, content, gravity, dist, parentContainer, classes) { + + //Create new tooltip div if it doesn't exist on DOM. + var container = document.createElement('div'); + container.className = 'nvtooltip ' + (classes ? classes : 'xy-tooltip'); + + var body = parentContainer; + if ( !parentContainer || parentContainer.tagName.match(/g|svg/i)) { + //If the parent element is an SVG element, place tooltip in the element. + body = document.getElementsByTagName('body')[0]; + } + + container.style.left = 0; + container.style.top = 0; + container.style.opacity = 0; + container.innerHTML = content; + body.appendChild(container); + + //If the parent container is an overflow
      with scrollbars, subtract the scroll offsets. + if (parentContainer) { + pos[0] = pos[0] - parentContainer.scrollLeft; + pos[1] = pos[1] - parentContainer.scrollTop; + } + nv.tooltip.calcTooltipPosition(pos, gravity, dist, container); + }; + + //Looks up the ancestry of a DOM element, and returns the first NON-svg node. + nv.tooltip.findFirstNonSVGParent = function(Elem) { + while(Elem.tagName.match(/^g|svg$/i) !== null) { + Elem = Elem.parentNode; + } + return Elem; + }; + + //Finds the total offsetTop of a given DOM element. + //Looks up the entire ancestry of an element, up to the first relatively positioned element. + nv.tooltip.findTotalOffsetTop = function ( Elem, initialTop ) { + var offsetTop = initialTop; + + do { + if( !isNaN( Elem.offsetTop ) ) { + offsetTop += (Elem.offsetTop); + } + } while( Elem = Elem.offsetParent ); + return offsetTop; + }; + + //Finds the total offsetLeft of a given DOM element. + //Looks up the entire ancestry of an element, up to the first relatively positioned element. + nv.tooltip.findTotalOffsetLeft = function ( Elem, initialLeft) { + var offsetLeft = initialLeft; + + do { + if( !isNaN( Elem.offsetLeft ) ) { + offsetLeft += (Elem.offsetLeft); + } + } while( Elem = Elem.offsetParent ); + return offsetLeft; + }; + + //Global utility function to render a tooltip on the DOM. + //pos = [left,top] coordinates of where to place the tooltip, relative to the SVG chart container. + //gravity = how to orient the tooltip + //dist = how far away from the mouse to place tooltip + //container = tooltip DIV + nv.tooltip.calcTooltipPosition = function(pos, gravity, dist, container) { + + var height = parseInt(container.offsetHeight), + width = parseInt(container.offsetWidth), + windowWidth = nv.utils.windowSize().width, + windowHeight = nv.utils.windowSize().height, + scrollTop = window.pageYOffset, + scrollLeft = window.pageXOffset, + left, top; + + windowHeight = window.innerWidth >= document.body.scrollWidth ? windowHeight : windowHeight - 16; + windowWidth = window.innerHeight >= document.body.scrollHeight ? windowWidth : windowWidth - 16; + + gravity = gravity || 's'; + dist = dist || 20; + + var tooltipTop = function ( Elem ) { + return nv.tooltip.findTotalOffsetTop(Elem, top); + }; + + var tooltipLeft = function ( Elem ) { + return nv.tooltip.findTotalOffsetLeft(Elem,left); + }; + + switch (gravity) { + case 'e': + left = pos[0] - width - dist; + top = pos[1] - (height / 2); + var tLeft = tooltipLeft(container); + var tTop = tooltipTop(container); + if (tLeft < scrollLeft) left = pos[0] + dist > scrollLeft ? pos[0] + dist : scrollLeft - tLeft + left; + if (tTop < scrollTop) top = scrollTop - tTop + top; + if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height; + break; + case 'w': + left = pos[0] + dist; + top = pos[1] - (height / 2); + var tLeft = tooltipLeft(container); + var tTop = tooltipTop(container); + if (tLeft + width > windowWidth) left = pos[0] - width - dist; + if (tTop < scrollTop) top = scrollTop + 5; + if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height; + break; + case 'n': + left = pos[0] - (width / 2) - 5; + top = pos[1] + dist; + var tLeft = tooltipLeft(container); + var tTop = tooltipTop(container); + if (tLeft < scrollLeft) left = scrollLeft + 5; + if (tLeft + width > windowWidth) left = left - width/2 + 5; + if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height; + break; + case 's': + left = pos[0] - (width / 2); + top = pos[1] - height - dist; + var tLeft = tooltipLeft(container); + var tTop = tooltipTop(container); + if (tLeft < scrollLeft) left = scrollLeft + 5; + if (tLeft + width > windowWidth) left = left - width/2 + 5; + if (scrollTop > tTop) top = scrollTop; + break; + case 'none': + left = pos[0]; + top = pos[1] - dist; + var tLeft = tooltipLeft(container); + var tTop = tooltipTop(container); + break; + } + + + container.style.left = left+'px'; + container.style.top = top+'px'; + container.style.opacity = 1; + container.style.position = 'absolute'; + + return container; + }; + + //Global utility function to remove tooltips from the DOM. + nv.tooltip.cleanup = function() { + + // Find the tooltips, mark them for removal by this class (so others cleanups won't find it) + var tooltips = document.getElementsByClassName('nvtooltip'); + var purging = []; + while(tooltips.length) { + purging.push(tooltips[0]); + tooltips[0].style.transitionDelay = '0 !important'; + tooltips[0].style.opacity = 0; + tooltips[0].className = 'nvtooltip-pending-removal'; + } + + setTimeout(function() { + + while (purging.length) { + var removeMe = purging.pop(); + removeMe.parentNode.removeChild(removeMe); + } + }, 500); + }; + +})(); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/utils.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/utils.js new file mode 100644 index 0000000..7b99e1d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/d3/js/utils.js @@ -0,0 +1,152 @@ + +nv.utils.windowSize = function() { + // Sane defaults + var size = {width: 640, height: 480}; + + // Earlier IE uses Doc.body + if (document.body && document.body.offsetWidth) { + size.width = document.body.offsetWidth; + size.height = document.body.offsetHeight; + } + + // IE can use depending on mode it is in + if (document.compatMode=='CSS1Compat' && + document.documentElement && + document.documentElement.offsetWidth ) { + size.width = document.documentElement.offsetWidth; + size.height = document.documentElement.offsetHeight; + } + + // Most recent browsers use + if (window.innerWidth && window.innerHeight) { + size.width = window.innerWidth; + size.height = window.innerHeight; + } + return (size); +}; + + + +// Easy way to bind multiple functions to window.onresize +// TODO: give a way to remove a function after its bound, other than removing all of them +nv.utils.windowResize = function(fun){ + if (fun === undefined) return; + var oldresize = window.onresize; + + window.onresize = function(e) { + if (typeof oldresize == 'function') oldresize(e); + fun(e); + } +} + +// Backwards compatible way to implement more d3-like coloring of graphs. +// If passed an array, wrap it in a function which implements the old default +// behavior +nv.utils.getColor = function(color) { + if (!arguments.length) return nv.utils.defaultColor(); //if you pass in nothing, get default colors back + + if( Object.prototype.toString.call( color ) === '[object Array]' ) + return function(d, i) { return d.color || color[i % color.length]; }; + else + return color; + //can't really help it if someone passes rubbish as color +} + +// Default color chooser uses the index of an object as before. +nv.utils.defaultColor = function() { + var colors = d3.scale.category20().range(); + return function(d, i) { return d.color || colors[i % colors.length] }; +} + + +// Returns a color function that takes the result of 'getKey' for each series and +// looks for a corresponding color from the dictionary, +nv.utils.customTheme = function(dictionary, getKey, defaultColors) { + getKey = getKey || function(series) { return series.key }; // use default series.key if getKey is undefined + defaultColors = defaultColors || d3.scale.category20().range(); //default color function + + var defIndex = defaultColors.length; //current default color (going in reverse) + + return function(series, index) { + var key = getKey(series); + + if (!defIndex) defIndex = defaultColors.length; //used all the default colors, start over + + if (typeof dictionary[key] !== "undefined") + return (typeof dictionary[key] === "function") ? dictionary[key]() : dictionary[key]; + else + return defaultColors[--defIndex]; // no match in dictionary, use default color + } +} + + + +// From the PJAX example on d3js.org, while this is not really directly needed +// it's a very cool method for doing pjax, I may expand upon it a little bit, +// open to suggestions on anything that may be useful +nv.utils.pjax = function(links, content) { + d3.selectAll(links).on("click", function() { + history.pushState(this.href, this.textContent, this.href); + load(this.href); + d3.event.preventDefault(); + }); + + function load(href) { + d3.html(href, function(fragment) { + var target = d3.select(content).node(); + target.parentNode.replaceChild(d3.select(fragment).select(content).node(), target); + nv.utils.pjax(links, content); + }); + } + + d3.select(window).on("popstate", function() { + if (d3.event.state) load(d3.event.state); + }); +} + +/* For situations where we want to approximate the width in pixels for an SVG:text element. +Most common instance is when the element is in a display:none; container. +Forumla is : text.length * font-size * constant_factor +*/ +nv.utils.calcApproxTextWidth = function (svgTextElem) { + if (svgTextElem instanceof d3.selection) { + var fontSize = parseInt(svgTextElem.style("font-size").replace("px","")); + var textLength = svgTextElem.text().length; + + return textLength * fontSize * 0.5; + } + return 0; +}; + +/* Numbers that are undefined, null or NaN, convert them to zeros. +*/ +nv.utils.NaNtoZero = function(n) { + if (typeof n !== 'number' + || isNaN(n) + || n === null + || n === Infinity) return 0; + + return n; +}; + +/* +Snippet of code you can insert into each nv.models.* to give you the ability to +do things like: +chart.options({ + showXAxis: true, + tooltips: true +}); + +To enable in the chart: +chart.options = nv.utils.optionsFunc.bind(chart); +*/ +nv.utils.optionsFunc = function(args) { + if (args) { + d3.map(args).forEach((function(key,value) { + if (typeof this[key] === "function") { + this[key](value); + } + }).bind(this)); + } + return this; +}; \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/Rlogo.jpg b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/Rlogo.jpg new file mode 100644 index 0000000..656a6b1 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/Rlogo.jpg differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/Thumbs.db b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/Thumbs.db new file mode 100644 index 0000000..f504b22 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/Thumbs.db differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/action_icon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/action_icon.png new file mode 100644 index 0000000..f2d1bc0 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/action_icon.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/action_list_spacer.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/action_list_spacer.gif new file mode 100644 index 0000000..0afdd23 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/action_list_spacer.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/active.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/active.png new file mode 100644 index 0000000..4524177 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/active.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/add.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/add.png new file mode 100644 index 0000000..46d944b Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/add.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/add_tool_button.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/add_tool_button.png new file mode 100644 index 0000000..1e7890d Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/add_tool_button.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/addicon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/addicon.png new file mode 100644 index 0000000..6cb5042 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/addicon.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/application_window_bg.jpg b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/application_window_bg.jpg new file mode 100644 index 0000000..c559e59 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/application_window_bg.jpg differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/arrow-next.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/arrow-next.png new file mode 100644 index 0000000..1a4f72c Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/arrow-next.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/arrow-prev.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/arrow-prev.png new file mode 100644 index 0000000..8211eba Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/arrow-prev.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/att_angular_gridster/grips.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/att_angular_gridster/grips.png new file mode 100644 index 0000000..29b92cc Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/att_angular_gridster/grips.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/backButton.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/backButton.png new file mode 100644 index 0000000..e27ea8c Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/backButton.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/blank.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/blank.gif new file mode 100644 index 0000000..75b945d Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/blank.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/blueButton.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/blueButton.png new file mode 100644 index 0000000..0cfbee1 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/blueButton.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/bubble.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/bubble.png new file mode 100644 index 0000000..dd5abd3 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/bubble.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/cache.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/cache.png new file mode 100644 index 0000000..67fb355 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/cache.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/calendar.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/calendar.gif new file mode 100644 index 0000000..a90aef0 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/calendar.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/chevron.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/chevron.png new file mode 100644 index 0000000..7f7ae15 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/chevron.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/close_container.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/close_container.gif new file mode 100644 index 0000000..e2f67d7 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/close_container.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/collapsed-icon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/collapsed-icon.png new file mode 100644 index 0000000..000cbec Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/collapsed-icon.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/column-bg.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/column-bg.png new file mode 100644 index 0000000..1005ea7 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/column-bg.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/copyicon-highlighted.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/copyicon-highlighted.png new file mode 100644 index 0000000..312c439 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/copyicon-highlighted.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/copyicon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/copyicon.png new file mode 100644 index 0000000..6c1c3c1 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/copyicon.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/csv_icon.jpg b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/csv_icon.jpg new file mode 100644 index 0000000..b4d795b Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/csv_icon.jpg differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/csv_icon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/csv_icon.png new file mode 100644 index 0000000..bfae8fc Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/csv_icon.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers-add.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers-add.png new file mode 100644 index 0000000..127cdac Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers-add.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers-search.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers-search.png new file mode 100644 index 0000000..fb08f84 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers-search.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers.png new file mode 100644 index 0000000..f9bb5ef Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/customers.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/decrypted.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/decrypted.png new file mode 100644 index 0000000..236cbeb Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/decrypted.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon-highlighted.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon-highlighted.gif new file mode 100644 index 0000000..b62241b Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon-highlighted.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon-highlighted.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon-highlighted.png new file mode 100644 index 0000000..aee193d Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon-highlighted.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon.gif new file mode 100644 index 0000000..4b07af8 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/deleteicon.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/ecomp.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/ecomp.png new file mode 100644 index 0000000..b355f10 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/ecomp.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/ecomp_trans.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/ecomp_trans.png new file mode 100644 index 0000000..4e8381c Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/ecomp_trans.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/editicon.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/editicon.gif new file mode 100644 index 0000000..48538c1 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/editicon.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/error_type.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/error_type.gif new file mode 100644 index 0000000..bd51e81 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/error_type.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/example-frame.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/example-frame.png new file mode 100644 index 0000000..31f2fe1 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/example-frame.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/excelicon_multi.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/excelicon_multi.gif new file mode 100644 index 0000000..1a4fbaa Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/excelicon_multi.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/executeicon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/executeicon.png new file mode 100644 index 0000000..295c429 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/executeicon.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/expanded-icon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/expanded-icon.png new file mode 100644 index 0000000..490e068 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/expanded-icon.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file-add.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file-add.png new file mode 100644 index 0000000..076bd89 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file-add.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file_import.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file_import.png new file mode 100644 index 0000000..2374ba3 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file_import.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file_save-all.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file_save-all.png new file mode 100644 index 0000000..3c300ec Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/file_save-all.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/filter_icon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/filter_icon.png new file mode 100644 index 0000000..c36ad2c Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/filter_icon.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_add.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_add.png new file mode 100644 index 0000000..83761c2 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_add.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_closed.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_closed.png new file mode 100644 index 0000000..1b365fd Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_closed.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_delete.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_delete.png new file mode 100644 index 0000000..bb56a9e Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_delete.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_edit.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_edit.png new file mode 100644 index 0000000..fe774a6 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_edit.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_open.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_open.png new file mode 100644 index 0000000..f1ed9ab Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_open.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_user.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_user.png new file mode 100644 index 0000000..2cd2841 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/folder_user.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/funnel.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/funnel.png new file mode 100644 index 0000000..35f1d25 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/funnel.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/fusion.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/fusion.gif new file mode 100644 index 0000000..368319e Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/fusion.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/grayButton.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/grayButton.png new file mode 100644 index 0000000..83f2c45 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/grayButton.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/gray_add_tool_button.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/gray_add_tool_button.png new file mode 100644 index 0000000..962b0a8 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/gray_add_tool_button.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/headerChatIcon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/headerChatIcon.png new file mode 100644 index 0000000..9b0840a Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/headerChatIcon.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/icon_remove_all.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/icon_remove_all.gif new file mode 100644 index 0000000..0912b4a Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/icon_remove_all.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/inactive.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/inactive.png new file mode 100644 index 0000000..e9920bf Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/inactive.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/info_type.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/info_type.gif new file mode 100644 index 0000000..8dd66f3 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/info_type.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/leftButton.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/leftButton.png new file mode 100644 index 0000000..edf02c6 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/leftButton.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/loading.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/loading.gif new file mode 100644 index 0000000..cccb0fc Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/loading.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/loading_bar.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/loading_bar.gif new file mode 100644 index 0000000..eed8a50 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/loading_bar.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/login_button.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/login_button.gif new file mode 100644 index 0000000..990b522 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/login_button.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/m1.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/m1.gif new file mode 100644 index 0000000..f7161fd Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/m1.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/mail.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/mail.png new file mode 100644 index 0000000..bcf7d25 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/mail.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/map.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/map.png new file mode 100644 index 0000000..9ecb79a Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/map.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/minus.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/minus.gif new file mode 100644 index 0000000..0c62d1a Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/minus.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/modify_icon.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/modify_icon.gif new file mode 100644 index 0000000..994fe65 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/modify_icon.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/no_favorites_star.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/no_favorites_star.png new file mode 100644 index 0000000..4db0540 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/no_favorites_star.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note-add.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note-add.png new file mode 100644 index 0000000..96bbaf4 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note-add.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note-search.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note-search.png new file mode 100644 index 0000000..dbdab17 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note-search.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note.png new file mode 100644 index 0000000..f082b0e Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/note.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/notes.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/notes.png new file mode 100644 index 0000000..f54a9e8 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/notes.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/offline.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/offline.png new file mode 100644 index 0000000..4519ff3 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/offline.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/offlineMsg.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/offlineMsg.gif new file mode 100644 index 0000000..dbbe02f Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/offlineMsg.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/online.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/online.png new file mode 100644 index 0000000..7a74a9c Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/online.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/page.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/page.gif new file mode 100644 index 0000000..10b36fa Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/page.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/pagination.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/pagination.png new file mode 100644 index 0000000..4dc4610 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/pagination.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/panel-e-w-toggle.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/panel-e-w-toggle.png new file mode 100644 index 0000000..b3863ee Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/panel-e-w-toggle.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/panel-n-s-toggle.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/panel-n-s-toggle.png new file mode 100644 index 0000000..b5d9c3c Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/panel-n-s-toggle.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/pix.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/pix.gif new file mode 100644 index 0000000..c7bee69 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/pix.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/plus.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/plus.gif new file mode 100644 index 0000000..4a51f04 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/plus.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/printer.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/printer.gif new file mode 100644 index 0000000..37f2d98 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/printer.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/profile.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/profile.png new file mode 100644 index 0000000..a3998fc Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/profile.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-add.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-add.png new file mode 100644 index 0000000..c75b666 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-add.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-favorite.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-favorite.png new file mode 100644 index 0000000..e75cacc Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-favorite.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-my.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-my.png new file mode 100644 index 0000000..1b9e092 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-my.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-public.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-public.png new file mode 100644 index 0000000..9ee052e Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report-public.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report.png new file mode 100644 index 0000000..b0cd69f Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/report.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/reports.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/reports.png new file mode 100644 index 0000000..40dca71 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/reports.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-first-active.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-first-active.png new file mode 100644 index 0000000..0e54592 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-first-active.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-first-disabled.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-first-disabled.png new file mode 100644 index 0000000..f5610ff Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-first-disabled.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-last-active.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-last-active.png new file mode 100644 index 0000000..5ee5da4 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-last-active.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-last-disabled.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-last-disabled.png new file mode 100644 index 0000000..8647a55 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-last-disabled.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-next-active.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-next-active.png new file mode 100644 index 0000000..3c07936 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-next-active.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-next-disabled.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-next-disabled.png new file mode 100644 index 0000000..12f6d6b Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-next-disabled.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-prev-active.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-prev-active.png new file mode 100644 index 0000000..2c7246a Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-prev-active.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-prev-disabled.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-prev-disabled.png new file mode 100644 index 0000000..46c82bd Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/results-prev-disabled.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/resultset_last.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/resultset_last.png new file mode 100644 index 0000000..b8c4f09 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/resultset_last.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/resultset_previous.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/resultset_previous.png new file mode 100644 index 0000000..73b8332 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/resultset_previous.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/return_to_top.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/return_to_top.gif new file mode 100644 index 0000000..f02defb Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/return_to_top.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/rightButton.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/rightButton.png new file mode 100644 index 0000000..9d868f9 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/rightButton.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/search.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/search.png new file mode 100644 index 0000000..7ff964f Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/search.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/search_profile.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/search_profile.png new file mode 100644 index 0000000..2885214 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/search_profile.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/sort_asc.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/sort_asc.gif new file mode 100644 index 0000000..427928f Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/sort_asc.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/sort_desc.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/sort_desc.gif new file mode 100644 index 0000000..5aa81a1 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/sort_desc.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/spacer.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/spacer.gif new file mode 100644 index 0000000..fc25609 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/spacer.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/success_type.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/success_type.gif new file mode 100644 index 0000000..2f72242 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/success_type.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/swoosh.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/swoosh.gif new file mode 100644 index 0000000..4b79177 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/swoosh.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab-hm.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab-hm.png new file mode 100644 index 0000000..1e75d8d Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab-hm.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab-v-hm.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab-v-hm.png new file mode 100644 index 0000000..df8c6cb Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab-v-hm.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab.png new file mode 100644 index 0000000..00eb6fc Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tab.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-add.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-add.png new file mode 100644 index 0000000..0c13857 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-add.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-delete.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-delete.png new file mode 100644 index 0000000..917d7d2 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-delete.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-edit.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-edit.png new file mode 100644 index 0000000..40dbc0b Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table-edit.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table.png new file mode 100644 index 0000000..ff025e7 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/table.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tabs-bg.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tabs-bg.png new file mode 100644 index 0000000..f711bc0 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/tabs-bg.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolButton.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolButton.gif new file mode 100644 index 0000000..6d3923e Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolButton.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolButton.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolButton.png new file mode 100644 index 0000000..afe4d7a Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolButton.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolbar.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolbar.png new file mode 100644 index 0000000..3dde94c Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/toolbar.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/users.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/users.png new file mode 100644 index 0000000..13fec65 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/users.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/warning_type.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/warning_type.gif new file mode 100644 index 0000000..fd7b9a0 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/warning_type.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/webphone.ico b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/webphone.ico new file mode 100644 index 0000000..d58e62a Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/webphone.ico differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/whiteButton.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/whiteButton.png new file mode 100644 index 0000000..ce8c9cb Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/images/whiteButton.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/att_angular_gridster/angular-gridster.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/att_angular_gridster/angular-gridster.js new file mode 100644 index 0000000..985fa43 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/att_angular_gridster/angular-gridster.js @@ -0,0 +1,2244 @@ +/*global define:true*/ +(function(root, factory) { + + 'use strict'; + + if (typeof define === 'function' && define.amd) { + // AMD + define(['angular'], factory); + } else if (typeof exports === 'object') { + // CommonJS + module.exports = factory(require('angular')); + } else { + // Browser, nothing "exported". Only registered as a module with angular. + factory(root.angular); + } +}(this, function(angular) { + + 'use strict'; + + var ie8 = false; + + var getInternetExplorerVersion = function () + // Returns the version of Internet Explorer >4 or + // undefined(indicating the use of another browser). + { + var isIE10 = (eval("/*@cc_on!@*/false") && document.documentMode === 10); + if (isIE10) { + return 10; + } + var v = 3, + div = document.createElement('div'), + all = div.getElementsByTagName('i'); + do { + div.innerHTML = ''; + } while (all[0]); + return v > 4 ? v : undefined; + }; + + var browserVersion = getInternetExplorerVersion(); + + if (browserVersion && browserVersion < 9) { + ie8 = true; + } + + // This returned angular module 'gridster' is what is exported. + return angular.module('attGridsterLib', []) + + .constant('gridsterConfig', { + columns: 6, // number of columns in the grid + pushing: true, // whether to push other items out of the way + floating: true, // whether to automatically float items up so they stack + swapping: true, // whether or not to have items switch places instead of push down if they are the same size + width: 'auto', // width of the grid. "auto" will expand the grid to its parent container + colWidth: 'auto', // width of grid columns. "auto" will divide the width of the grid evenly among the columns + rowHeight: 'match', // height of grid rows. 'match' will make it the same as the column width, a numeric value will be interpreted as pixels, '/2' is half the column width, '*5' is five times the column width, etc. + margins: [10, 10], // margins in between grid items + outerMargin: false, + isMobile: false, // toggle mobile view + mobileBreakPoint: 100, // width threshold to toggle mobile mode + mobileModeEnabled: true, // whether or not to toggle mobile mode when screen width is less than mobileBreakPoint + minColumns: 1, // minimum amount of columns the grid can scale down to + minRows: 1, // minimum amount of rows to show if the grid is empty + maxRows: 100, // maximum amount of rows in the grid + defaultSizeX: 1, // default width of an item in columns + defaultSizeY: 1, // default height of an item in rows + minSizeX: 1, // minimum column width of an item + maxSizeX: null, // maximum column width of an item + minSizeY: 1, // minumum row height of an item + maxSizeY: null, // maximum row height of an item + saveGridItemCalculatedHeightInMobile: false, // grid item height in mobile display. true- to use the calculated height by sizeY given + resizable: { // options to pass to resizable handler + enabled: false, + handles: ['s', 'e', 'n', 'w', 'se', 'ne', 'sw', 'nw'] + }, + draggable: { // options to pass to draggable handler + enabled: true, + scrollSensitivity: 20, // Distance in pixels from the edge of the viewport after which the viewport should scroll, relative to pointer + scrollSpeed: 15 // Speed at which the window should scroll once the mouse pointer gets within scrollSensitivity distance + } + }) + + .controller('GridsterCtrl', ['gridsterConfig', '$timeout', + function(gridsterConfig, $timeout) { + + var gridster = this; + + /** + * Create options from gridsterConfig constant + */ + angular.extend(this, gridsterConfig); + + this.resizable = angular.extend({}, gridsterConfig.resizable || {}); + this.draggable = angular.extend({}, gridsterConfig.draggable || {}); + + var flag = false; + this.layoutChanged = function() { + if (flag) { + return; + } + flag = true; + $timeout(function() { + flag = false; + if (gridster.loaded) { + gridster.floatItemsUp(); + } + gridster.updateHeight(gridster.movingItem ? gridster.movingItem.sizeY : 0); + }, 30); + }; + + /** + * A positional array of the items in the grid + */ + this.grid = []; + + /** + * Clean up after yourself + */ + this.destroy = function() { + // empty the grid to cut back on the possibility + // of circular references + if (this.grid) { + this.grid = []; + } + this.$element = null; + }; + + /** + * Overrides default options + * + * @param {Object} options The options to override + */ + this.setOptions = function(options) { + if (!options) { + return; + } + + options = angular.extend({}, options); + + // all this to avoid using jQuery... + if (options.draggable) { + angular.extend(this.draggable, options.draggable); + delete(options.draggable); + } + if (options.resizable) { + angular.extend(this.resizable, options.resizable); + delete(options.resizable); + } + + angular.extend(this, options); + + if (!this.margins || this.margins.length !== 2) { + this.margins = [0, 0]; + } else { + for (var x = 0, l = this.margins.length; x < l; ++x) { + this.margins[x] = parseInt(this.margins[x], 10); + if (isNaN(this.margins[x])) { + this.margins[x] = 0; + } + } + } + }; + + /** + * Check if item can occupy a specified position in the grid + * + * @param {Object} item The item in question + * @param {Number} row The row index + * @param {Number} column The column index + * @returns {Boolean} True if if item fits + */ + this.canItemOccupy = function(item, row, column) { + return row > -1 && column > -1 && item.sizeX + column <= this.columns && item.sizeY + row <= this.maxRows; + }; + + /** + * Set the item in the first suitable position + * + * @param {Object} item The item to insert + */ + this.autoSetItemPosition = function(item) { + // walk through each row and column looking for a place it will fit + for (var rowIndex = 0; rowIndex < this.maxRows; ++rowIndex) { + for (var colIndex = 0; colIndex < this.columns; ++colIndex) { + // only insert if position is not already taken and it can fit + var items = this.getItems(rowIndex, colIndex, item.sizeX, item.sizeY, item); + if (items.length === 0 && this.canItemOccupy(item, rowIndex, colIndex)) { + this.putItem(item, rowIndex, colIndex); + return; + } + } + } + throw new Error('Unable to place item!'); + }; + + /** + * Gets items at a specific coordinate + * + * @param {Number} row + * @param {Number} column + * @param {Number} sizeX + * @param {Number} sizeY + * @param {Array} excludeItems An array of items to exclude from selection + * @returns {Array} Items that match the criteria + */ + this.getItems = function(row, column, sizeX, sizeY, excludeItems) { + var items = []; + if (!sizeX || !sizeY) { + sizeX = sizeY = 1; + } + if (excludeItems && !(excludeItems instanceof Array)) { + excludeItems = [excludeItems]; + } + for (var h = 0; h < sizeY; ++h) { + for (var w = 0; w < sizeX; ++w) { + var item = this.getItem(row + h, column + w, excludeItems); + if (item && (!excludeItems || excludeItems.indexOf(item) === -1) && items.indexOf(item) === -1) { + items.push(item); + } + } + } + return items; + }; + + /** + * @param {Array} items + * @returns {Object} An item that represents the bounding box of the items + */ + this.getBoundingBox = function(items) { + + if (items.length === 0) { + return null; + } + if (items.length === 1) { + return { + row: items[0].row, + col: items[0].col, + sizeY: items[0].sizeY, + sizeX: items[0].sizeX + }; + } + + var maxRow = 0; + var maxCol = 0; + var minRow = 9999; + var minCol = 9999; + + for (var i = 0, l = items.length; i < l; ++i) { + var item = items[i]; + minRow = Math.min(item.row, minRow); + minCol = Math.min(item.col, minCol); + maxRow = Math.max(item.row + item.sizeY, maxRow); + maxCol = Math.max(item.col + item.sizeX, maxCol); + } + + return { + row: minRow, + col: minCol, + sizeY: maxRow - minRow, + sizeX: maxCol - minCol + }; + }; + + + /** + * Removes an item from the grid + * + * @param {Object} item + */ + this.removeItem = function(item) { + for (var rowIndex = 0, l = this.grid.length; rowIndex < l; ++rowIndex) { + var columns = this.grid[rowIndex]; + if (!columns) { + continue; + } + var index = columns.indexOf(item); + if (index !== -1) { + columns[index] = null; + break; + } + } + this.layoutChanged(); + }; + + /** + * Returns the item at a specified coordinate + * + * @param {Number} row + * @param {Number} column + * @param {Array} excludeItems Items to exclude from selection + * @returns {Object} The matched item or null + */ + this.getItem = function(row, column, excludeItems) { + if (excludeItems && !(excludeItems instanceof Array)) { + excludeItems = [excludeItems]; + } + var sizeY = 1; + while (row > -1) { + var sizeX = 1, + col = column; + while (col > -1) { + var items = this.grid[row]; + if (items) { + var item = items[col]; + if (item && (!excludeItems || excludeItems.indexOf(item) === -1) && item.sizeX >= sizeX && item.sizeY >= sizeY) { + return item; + } + } + ++sizeX; + --col; + } + --row; + ++sizeY; + } + return null; + }; + + /** + * Insert an array of items into the grid + * + * @param {Array} items An array of items to insert + */ + this.putItems = function(items) { + for (var i = 0, l = items.length; i < l; ++i) { + this.putItem(items[i]); + } + }; + + /** + * Insert a single item into the grid + * + * @param {Object} item The item to insert + * @param {Number} row (Optional) Specifies the items row index + * @param {Number} column (Optional) Specifies the items column index + * @param {Array} ignoreItems + */ + this.putItem = function(item, row, column, ignoreItems) { + // auto place item if no row specified + if (typeof row === 'undefined' || row === null) { + row = item.row; + column = item.col; + if (typeof row === 'undefined' || row === null) { + this.autoSetItemPosition(item); + return; + } + } + + // keep item within allowed bounds + if (!this.canItemOccupy(item, row, column)) { + column = Math.min(this.columns - item.sizeX, Math.max(0, column)); + row = Math.min(this.maxRows - item.sizeY, Math.max(0, row)); + } + + // check if item is already in grid + if (item.oldRow !== null && typeof item.oldRow !== 'undefined') { + var samePosition = item.oldRow === row && item.oldColumn === column; + var inGrid = this.grid[row] && this.grid[row][column] === item; + if (samePosition && inGrid) { + item.row = row; + item.col = column; + return; + } else { + // remove from old position + var oldRow = this.grid[item.oldRow]; + if (oldRow && oldRow[item.oldColumn] === item) { + delete oldRow[item.oldColumn]; + } + } + } + + item.oldRow = item.row = row; + item.oldColumn = item.col = column; + + this.moveOverlappingItems(item, ignoreItems); + + if (!this.grid[row]) { + this.grid[row] = []; + } + this.grid[row][column] = item; + + if (this.movingItem === item) { + this.floatItemUp(item); + } + this.layoutChanged(); + }; + + /** + * Trade row and column if item1 with item2 + * + * @param {Object} item1 + * @param {Object} item2 + */ + this.swapItems = function(item1, item2) { + this.grid[item1.row][item1.col] = item2; + this.grid[item2.row][item2.col] = item1; + + var item1Row = item1.row; + var item1Col = item1.col; + item1.row = item2.row; + item1.col = item2.col; + item2.row = item1Row; + item2.col = item1Col; + }; + + /** + * Prevents items from being overlapped + * + * @param {Object} item The item that should remain + * @param {Array} ignoreItems + */ + this.moveOverlappingItems = function(item, ignoreItems) { + // don't move item, so ignore it + if (!ignoreItems) { + ignoreItems = [item]; + } else if (ignoreItems.indexOf(item) === -1) { + ignoreItems = ignoreItems.slice(0); + ignoreItems.push(item); + } + + // get the items in the space occupied by the item's coordinates + var overlappingItems = this.getItems( + item.row, + item.col, + item.sizeX, + item.sizeY, + ignoreItems + ); + this.moveItemsDown(overlappingItems, item.row + item.sizeY, ignoreItems); + }; + + /** + * Moves an array of items to a specified row + * + * @param {Array} items The items to move + * @param {Number} newRow The target row + * @param {Array} ignoreItems + */ + this.moveItemsDown = function(items, newRow, ignoreItems) { + if (!items || items.length === 0) { + return; + } + items.sort(function(a, b) { + return a.row - b.row; + }); + + ignoreItems = ignoreItems ? ignoreItems.slice(0) : []; + var topRows = {}, + item, i, l; + + // calculate the top rows in each column + for (i = 0, l = items.length; i < l; ++i) { + item = items[i]; + var topRow = topRows[item.col]; + if (typeof topRow === 'undefined' || item.row < topRow) { + topRows[item.col] = item.row; + } + } + + // move each item down from the top row in its column to the row + for (i = 0, l = items.length; i < l; ++i) { + item = items[i]; + var rowsToMove = newRow - topRows[item.col]; + this.moveItemDown(item, item.row + rowsToMove, ignoreItems); + ignoreItems.push(item); + } + }; + + /** + * Moves an item down to a specified row + * + * @param {Object} item The item to move + * @param {Number} newRow The target row + * @param {Array} ignoreItems + */ + this.moveItemDown = function(item, newRow, ignoreItems) { + if (item.row >= newRow) { + return; + } + while (item.row < newRow) { + ++item.row; + this.moveOverlappingItems(item, ignoreItems); + } + this.putItem(item, item.row, item.col, ignoreItems); + }; + + /** + * Moves all items up as much as possible + */ + this.floatItemsUp = function() { + if (this.floating === false) { + return; + } + for (var rowIndex = 0, l = this.grid.length; rowIndex < l; ++rowIndex) { + var columns = this.grid[rowIndex]; + if (!columns) { + continue; + } + for (var colIndex = 0, len = columns.length; colIndex < len; ++colIndex) { + var item = columns[colIndex]; + if (item) { + this.floatItemUp(item); + } + } + } + }; + + /** + * Float an item up to the most suitable row + * + * @param {Object} item The item to move + */ + this.floatItemUp = function(item) { + if (this.floating === false) { + return; + } + var colIndex = item.col, + sizeY = item.sizeY, + sizeX = item.sizeX, + bestRow = null, + bestColumn = null, + rowIndex = item.row - 1; + + while (rowIndex > -1) { + var items = this.getItems(rowIndex, colIndex, sizeX, sizeY, item); + if (items.length !== 0) { + break; + } + bestRow = rowIndex; + bestColumn = colIndex; + --rowIndex; + } + if (bestRow !== null) { + this.putItem(item, bestRow, bestColumn); + } + }; + + /** + * Update gridsters height + * + * @param {Number} plus (Optional) Additional height to add + */ + this.updateHeight = function(plus) { + var maxHeight = this.minRows; + plus = plus || 0; + for (var rowIndex = this.grid.length; rowIndex >= 0; --rowIndex) { + var columns = this.grid[rowIndex]; + if (!columns) { + continue; + } + for (var colIndex = 0, len = columns.length; colIndex < len; ++colIndex) { + if (columns[colIndex]) { + maxHeight = Math.max(maxHeight, rowIndex + plus + columns[colIndex].sizeY); + } + } + } + this.gridHeight = this.maxRows - maxHeight > 0 ? Math.min(this.maxRows, maxHeight) : Math.max(this.maxRows, maxHeight); + }; + + /** + * Returns the number of rows that will fit in given amount of pixels + * + * @param {Number} pixels + * @param {Boolean} ceilOrFloor (Optional) Determines rounding method + */ + this.pixelsToRows = function(pixels, ceilOrFloor) { + if (ceilOrFloor === true) { + return Math.ceil(pixels / this.curRowHeight); + } else if (ceilOrFloor === false) { + return Math.floor(pixels / this.curRowHeight); + } + + return Math.round(pixels / this.curRowHeight); + }; + + /** + * Returns the number of columns that will fit in a given amount of pixels + * + * @param {Number} pixels + * @param {Boolean} ceilOrFloor (Optional) Determines rounding method + * @returns {Number} The number of columns + */ + this.pixelsToColumns = function(pixels, ceilOrFloor) { + if (ceilOrFloor === true) { + return Math.ceil(pixels / this.curColWidth); + } else if (ceilOrFloor === false) { + return Math.floor(pixels / this.curColWidth); + } + + return Math.round(pixels / this.curColWidth); + }; + } + ]) + + .directive('gridsterPreview', function() { + return { + replace: true, + scope: true, + require: '^gridster', + template: '
      ', + link: function(scope, $el, attrs, gridster) { + + /** + * @returns {Object} style object for preview element + */ + scope.previewStyle = function() { + + if (!gridster.movingItem) { + return { + display: 'none' + }; + } + + return { + display: 'block', + height: (gridster.movingItem.sizeY * gridster.curRowHeight - gridster.margins[0]) + 'px', + width: (gridster.movingItem.sizeX * gridster.curColWidth - gridster.margins[1]) + 'px', + top: (gridster.movingItem.row * gridster.curRowHeight + (gridster.outerMargin ? gridster.margins[0] : 0)) + 'px', + left: (gridster.movingItem.col * gridster.curColWidth + (gridster.outerMargin ? gridster.margins[1] : 0)) + 'px' + }; + }; + } + }; + }) + + /** + * The gridster directive + * + * @param {Function} $timeout + * @param {Object} $window + * @param {Object} $rootScope + * @param {Function} gridsterDebounce + */ + .directive('gridster', ['$timeout', '$window', '$rootScope', 'gridsterDebounce', + function($timeout, $window, $rootScope, gridsterDebounce) { + return { + scope: true, + restrict: 'EAC', + controller: 'GridsterCtrl', + controllerAs: 'gridster', + compile: function($tplElem) { + + $tplElem.prepend('
      '); + + return function(scope, $elem, attrs, gridster) { + gridster.loaded = false; + + gridster.$element = $elem; + + scope.gridster = gridster; + + $elem.addClass('gridster'); + + var isVisible = function(ele) { + return ele.style.visibility !== 'hidden' && ele.style.display !== 'none'; + }; + + function refresh(config) { + gridster.setOptions(config); + + if (!isVisible($elem[0])) { + return; + } + + // resolve "auto" & "match" values + if (gridster.width === 'auto') { + gridster.curWidth = $elem[0].offsetWidth || parseInt($elem.css('width'), 10); + } else { + gridster.curWidth = gridster.width; + } + + if (gridster.colWidth === 'auto') { + gridster.curColWidth = (gridster.curWidth + (gridster.outerMargin ? -gridster.margins[1] : gridster.margins[1])) / gridster.columns; + } else { + gridster.curColWidth = gridster.colWidth; + } + + gridster.curRowHeight = gridster.rowHeight; + if (typeof gridster.rowHeight === 'string') { + if (gridster.rowHeight === 'match') { + gridster.curRowHeight = Math.round(gridster.curColWidth); + } else if (gridster.rowHeight.indexOf('*') !== -1) { + gridster.curRowHeight = Math.round(gridster.curColWidth * gridster.rowHeight.replace('*', '').replace(' ', '')); + } else if (gridster.rowHeight.indexOf('/') !== -1) { + gridster.curRowHeight = Math.round(gridster.curColWidth / gridster.rowHeight.replace('/', '').replace(' ', '')); + } + } + + gridster.isMobile = gridster.mobileModeEnabled && gridster.curWidth <= gridster.mobileBreakPoint; + + // loop through all items and reset their CSS + for (var rowIndex = 0, l = gridster.grid.length; rowIndex < l; ++rowIndex) { + var columns = gridster.grid[rowIndex]; + if (!columns) { + continue; + } + + for (var colIndex = 0, len = columns.length; colIndex < len; ++colIndex) { + if (columns[colIndex]) { + var item = columns[colIndex]; + item.setElementPosition(); + item.setElementSizeY(); + item.setElementSizeX(); + } + } + } + + updateHeight(); + } + + var optionsKey = attrs.gridster; + if (optionsKey) { + scope.$parent.$watch(optionsKey, function(newConfig) { + refresh(newConfig); + }, true); + } else { + refresh({}); + } + + scope.$watch(function() { + return gridster.loaded; + }, function() { + if (gridster.loaded) { + $elem.addClass('gridster-loaded'); + } else { + $elem.removeClass('gridster-loaded'); + } + }); + + scope.$watch(function() { + return gridster.isMobile; + }, function() { + if (gridster.isMobile) { + $elem.addClass('gridster-mobile').removeClass('gridster-desktop'); + } else { + $elem.removeClass('gridster-mobile').addClass('gridster-desktop'); + } + $rootScope.$broadcast('gridster-mobile-changed', gridster); + }); + + scope.$watch(function() { + return gridster.draggable; + }, function() { + $rootScope.$broadcast('gridster-draggable-changed', gridster); + }, true); + + scope.$watch(function() { + return gridster.resizable; + }, function() { + $rootScope.$broadcast('gridster-resizable-changed', gridster); + }, true); + + function updateHeight() { + if(gridster.gridHeight){ //need to put this check, otherwise fail in IE8 + $elem.css('height', (gridster.gridHeight * gridster.curRowHeight) + (gridster.outerMargin ? gridster.margins[0] : -gridster.margins[0]) + 'px'); + } + } + + scope.$watch(function() { + return gridster.gridHeight; + }, updateHeight); + + scope.$watch(function() { + return gridster.movingItem; + }, function() { + gridster.updateHeight(gridster.movingItem ? gridster.movingItem.sizeY : 0); + }); + + var prevWidth = $elem[0].offsetWidth || parseInt($elem.css('width'), 10); + + var resize = function() { + var width = $elem[0].offsetWidth || parseInt($elem.css('width'), 10); + + if (!width || width === prevWidth || gridster.movingItem) { + return; + } + prevWidth = width; + + if (gridster.loaded) { + $elem.removeClass('gridster-loaded'); + } + + refresh(); + + if (gridster.loaded) { + $elem.addClass('gridster-loaded'); + } + + $rootScope.$broadcast('gridster-resized', [width, $elem[0].offsetHeight], gridster); + }; + + // track element width changes any way we can + var onResize = gridsterDebounce(function onResize() { + resize(); + $timeout(function() { + scope.$apply(); + }); + }, 100); + + scope.$watch(function() { + return isVisible($elem[0]); + }, onResize); + + // see https://github.com/sdecima/javascript-detect-element-resize + if (typeof window.addResizeListener === 'function') { + window.addResizeListener($elem[0], onResize); + } else { + scope.$watch(function() { + return $elem[0].offsetWidth || parseInt($elem.css('width'), 10); + }, resize); + } + var $win = angular.element($window); + $win.on('resize', onResize); + + // be sure to cleanup + scope.$on('$destroy', function() { + gridster.destroy(); + $win.off('resize', onResize); + if (typeof window.removeResizeListener === 'function') { + window.removeResizeListener($elem[0], onResize); + } + }); + + // allow a little time to place items before floating up + $timeout(function() { + scope.$watch('gridster.floating', function() { + gridster.floatItemsUp(); + }); + gridster.loaded = true; + }, 100); + }; + } + }; + } + ]) + + .controller('GridsterItemCtrl', function() { + this.$element = null; + this.gridster = null; + this.row = null; + this.col = null; + this.sizeX = null; + this.sizeY = null; + this.minSizeX = 0; + this.minSizeY = 0; + this.maxSizeX = null; + this.maxSizeY = null; + + this.init = function($element, gridster) { + this.$element = $element; + this.gridster = gridster; + this.sizeX = gridster.defaultSizeX; + this.sizeY = gridster.defaultSizeY; + }; + + this.destroy = function() { + // set these to null to avoid the possibility of circular references + this.gridster = null; + this.$element = null; + }; + + /** + * Returns the items most important attributes + */ + this.toJSON = function() { + return { + row: this.row, + col: this.col, + sizeY: this.sizeY, + sizeX: this.sizeX + }; + }; + + this.isMoving = function() { + return this.gridster.movingItem === this; + }; + + /** + * Set the items position + * + * @param {Number} row + * @param {Number} column + */ + this.setPosition = function(row, column) { + this.gridster.putItem(this, row, column); + + if (!this.isMoving()) { + this.setElementPosition(); + } + }; + + /** + * Sets a specified size property + * + * @param {String} key Can be either "x" or "y" + * @param {Number} value The size amount + * @param {Boolean} preventMove + */ + this.setSize = function(key, value, preventMove) { + key = key.toUpperCase(); + var camelCase = 'size' + key, + titleCase = 'Size' + key; + if (value === '') { + return; + } + value = parseInt(value, 10); + if (isNaN(value) || value === 0) { + value = this.gridster['default' + titleCase]; + } + var max = key === 'X' ? this.gridster.columns : this.gridster.maxRows; + if (this['max' + titleCase]) { + max = Math.min(this['max' + titleCase], max); + } + if (this.gridster['max' + titleCase]) { + max = Math.min(this.gridster['max' + titleCase], max); + } + if (key === 'X' && this.cols) { + max -= this.cols; + } else if (key === 'Y' && this.rows) { + max -= this.rows; + } + + var min = 0; + if (this['min' + titleCase]) { + min = Math.max(this['min' + titleCase], min); + } + if (this.gridster['min' + titleCase]) { + min = Math.max(this.gridster['min' + titleCase], min); + } + + value = Math.max(Math.min(value, max), min); + + var changed = (this[camelCase] !== value || (this['old' + titleCase] && this['old' + titleCase] !== value)); + this['old' + titleCase] = this[camelCase] = value; + + if (!this.isMoving()) { + this['setElement' + titleCase](); + } + if (!preventMove && changed) { + this.gridster.moveOverlappingItems(this); + this.gridster.layoutChanged(); + } + + return changed; + }; + + /** + * Sets the items sizeY property + * + * @param {Number} rows + * @param {Boolean} preventMove + */ + this.setSizeY = function(rows, preventMove) { + return this.setSize('Y', rows, preventMove); + }; + + /** + * Sets the items sizeX property + * + * @param {Number} columns + * @param {Boolean} preventMove + */ + this.setSizeX = function(columns, preventMove) { + return this.setSize('X', columns, preventMove); + }; + + /** + * Sets an elements position on the page + */ + this.setElementPosition = function() { + if (this.gridster.isMobile) { + this.$element.css({ + marginLeft: this.gridster.margins[0] + 'px', + marginRight: this.gridster.margins[0] + 'px', + marginTop: this.gridster.margins[1] + 'px', + marginBottom: this.gridster.margins[1] + 'px', + top: '', + left: '' + }); + } else { + this.$element.css({ + margin: 0, + top: (this.row * this.gridster.curRowHeight + (this.gridster.outerMargin ? this.gridster.margins[0] : 0)) + 'px', + left: (this.col * this.gridster.curColWidth + (this.gridster.outerMargin ? this.gridster.margins[1] : 0)) + 'px' + }); + } + }; + + /** + * Sets an elements height + */ + this.setElementSizeY = function() { + if (this.gridster.isMobile && !this.gridster.saveGridItemCalculatedHeightInMobile) { + this.$element.css('height', ''); + } else { + var computedHeight = (this.sizeY * this.gridster.curRowHeight - this.gridster.margins[0]) + 'px'; + //this.$element.css('height', computedHeight); + this.$element.attr('style', this.$element.attr('style') + '; ' + 'height: '+computedHeight+' !important;'); + } + }; + + /** + * Sets an elements width + */ + this.setElementSizeX = function() { + if (this.gridster.isMobile) { + this.$element.css('width', ''); + } else { + this.$element.css('width', (this.sizeX * this.gridster.curColWidth - this.gridster.margins[1]) + 'px'); + } + }; + + /** + * Gets an element's width + */ + this.getElementSizeX = function() { + return (this.sizeX * this.gridster.curColWidth - this.gridster.margins[1]); + }; + + /** + * Gets an element's height + */ + this.getElementSizeY = function() { + return (this.sizeY * this.gridster.curRowHeight - this.gridster.margins[0]); + }; + + }) + + .factory('GridsterTouch', [function() { + return function GridsterTouch(target, startEvent, moveEvent, endEvent) { + var lastXYById = {}; + + // Opera doesn't have Object.keys so we use this wrapper + var numberOfKeys = function(theObject) { + if (Object.keys) { + return Object.keys(theObject).length; + } + + var n = 0, + key; + for (key in theObject) { + ++n; + } + + return n; + }; + + // this calculates the delta needed to convert pageX/Y to offsetX/Y because offsetX/Y don't exist in the TouchEvent object or in Firefox's MouseEvent object + var computeDocumentToElementDelta = function(theElement) { + var elementLeft = 0; + var elementTop = 0; + var oldIEUserAgent = navigator.userAgent.match(/\bMSIE\b/); + + for (var offsetElement = theElement; offsetElement != null; offsetElement = offsetElement.offsetParent) { + // the following is a major hack for versions of IE less than 8 to avoid an apparent problem on the IEBlog with double-counting the offsets + // this may not be a general solution to IE7's problem with offsetLeft/offsetParent + if (oldIEUserAgent && + (!document.documentMode || document.documentMode < 8) && + offsetElement.currentStyle.position === 'relative' && offsetElement.offsetParent && offsetElement.offsetParent.currentStyle.position === 'relative' && offsetElement.offsetLeft === offsetElement.offsetParent.offsetLeft) { + // add only the top + elementTop += offsetElement.offsetTop; + } else { + elementLeft += offsetElement.offsetLeft; + elementTop += offsetElement.offsetTop; + } + } + + return { + x: elementLeft, + y: elementTop + }; + }; + + // cache the delta from the document to our event target (reinitialized each mousedown/MSPointerDown/touchstart) + var documentToTargetDelta = computeDocumentToElementDelta(target); + + // common event handler for the mouse/pointer/touch models and their down/start, move, up/end, and cancel events + var doEvent = function(theEvtObj) { + + if (theEvtObj.type === 'mousemove' && numberOfKeys(lastXYById) === 0) { + return; + } + + var prevent = true; + + var pointerList = theEvtObj.changedTouches ? theEvtObj.changedTouches : [theEvtObj]; + + for (var i = 0; i < pointerList.length; ++i) { + var pointerObj = pointerList[i]; + var pointerId = (typeof pointerObj.identifier !== 'undefined') ? pointerObj.identifier : (typeof pointerObj.pointerId !== 'undefined') ? pointerObj.pointerId : 1; + + // use the pageX/Y coordinates to compute target-relative coordinates when we have them (in ie < 9, we need to do a little work to put them there) + if (typeof pointerObj.pageX === 'undefined') { + + // initialize assuming our source element is our target + if(!ie8){ + pointerObj.pageX = pointerObj.offsetX + documentToTargetDelta.x; + pointerObj.pageY = pointerObj.offsetY + documentToTargetDelta.y; + } + else{ + pointerObj.pageX = pointerObj.clientX; + pointerObj.pageY = pointerObj.clientY; + } + + if (pointerObj.srcElement.offsetParent === target && document.documentMode && document.documentMode === 8 && pointerObj.type === 'mousedown') { + // source element is a child piece of VML, we're in IE8, and we've not called setCapture yet - add the origin of the source element + pointerObj.pageX += pointerObj.srcElement.offsetLeft; + pointerObj.pageY += pointerObj.srcElement.offsetTop; + } else if (pointerObj.srcElement !== target && !document.documentMode || document.documentMode < 8) { + // source element isn't the target (most likely it's a child piece of VML) and we're in a version of IE before IE8 - + // the offsetX/Y values are unpredictable so use the clientX/Y values and adjust by the scroll offsets of its parents + // to get the document-relative coordinates (the same as pageX/Y) + var sx = -2, + sy = -2; // adjust for old IE's 2-pixel border + for (var scrollElement = pointerObj.srcElement; scrollElement !== null; scrollElement = scrollElement.parentNode) { + sx += scrollElement.scrollLeft ? scrollElement.scrollLeft : 0; + sy += scrollElement.scrollTop ? scrollElement.scrollTop : 0; + } + + pointerObj.pageX = pointerObj.clientX + sx; + pointerObj.pageY = pointerObj.clientY + sy; + } + } + + + var pageX = pointerObj.pageX; + var pageY = pointerObj.pageY; + + if (theEvtObj.type.match(/(start|down)$/i)) { + // clause for processing MSPointerDown, touchstart, and mousedown + + // refresh the document-to-target delta on start in case the target has moved relative to document + documentToTargetDelta = computeDocumentToElementDelta(target); + + // protect against failing to get an up or end on this pointerId + if (lastXYById[pointerId]) { + if (endEvent) { + endEvent({ + target: theEvtObj.target, + which: theEvtObj.which, + pointerId: pointerId, + pageX: pageX, + pageY: pageY + }); + } + + delete lastXYById[pointerId]; + } + + if (startEvent) { + if (prevent) { + prevent = startEvent({ + target: theEvtObj.target, + which: theEvtObj.which, + pointerId: pointerId, + pageX: pageX, + pageY: pageY + }); + } + } + + // init last page positions for this pointer + lastXYById[pointerId] = { + x: pageX, + y: pageY + }; + + // IE pointer model + if (target.msSetPointerCapture) { + target.msSetPointerCapture(pointerId); + } else if (theEvtObj.type === 'mousedown' && numberOfKeys(lastXYById) === 1) { + if (useSetReleaseCapture) { + target.setCapture(true); + } else { + document.addEventListener('mousemove', doEvent, false); + document.addEventListener('mouseup', doEvent, false); + } + } + } else if (theEvtObj.type.match(/move$/i)) { + // clause handles mousemove, MSPointerMove, and touchmove + + if (lastXYById[pointerId] && !(lastXYById[pointerId].x === pageX && lastXYById[pointerId].y === pageY)) { + // only extend if the pointer is down and it's not the same as the last point + + if (moveEvent && prevent) { + prevent = moveEvent({ + target: theEvtObj.target, + which: theEvtObj.which, + pointerId: pointerId, + pageX: pageX, + pageY: pageY + }); + } + + // update last page positions for this pointer + lastXYById[pointerId].x = pageX; + lastXYById[pointerId].y = pageY; + } + } else if (lastXYById[pointerId] && theEvtObj.type.match(/(up|end|cancel)$/i)) { + // clause handles up/end/cancel + + if (endEvent && prevent) { + prevent = endEvent({ + target: theEvtObj.target, + which: theEvtObj.which, + pointerId: pointerId, + pageX: pageX, + pageY: pageY + }); + } + + // delete last page positions for this pointer + delete lastXYById[pointerId]; + + // in the Microsoft pointer model, release the capture for this pointer + // in the mouse model, release the capture or remove document-level event handlers if there are no down points + // nothing is required for the iOS touch model because capture is implied on touchstart + if (target.msReleasePointerCapture) { + target.msReleasePointerCapture(pointerId); + } else if (theEvtObj.type === 'mouseup' && numberOfKeys(lastXYById) === 0) { + if (useSetReleaseCapture) { + target.releaseCapture(); + } else { + document.removeEventListener('mousemove', doEvent, false); + document.removeEventListener('mouseup', doEvent, false); + } + } + } + } + + if (prevent) { + if (theEvtObj.preventDefault) { + theEvtObj.preventDefault(); + } + + if (theEvtObj.preventManipulation) { + theEvtObj.preventManipulation(); + } + + if (theEvtObj.preventMouseEvent) { + theEvtObj.preventMouseEvent(); + } + } + }; + + var useSetReleaseCapture = false; + // saving the settings for contentZooming and touchaction before activation + var contentZooming, msTouchAction; + + this.enable = function() { + + if (window.navigator.msPointerEnabled) { + // Microsoft pointer model + target.addEventListener('MSPointerDown', doEvent, false); + target.addEventListener('MSPointerMove', doEvent, false); + target.addEventListener('MSPointerUp', doEvent, false); + target.addEventListener('MSPointerCancel', doEvent, false); + + // css way to prevent panning in our target area + if (typeof target.style.msContentZooming !== 'undefined') { + contentZooming = target.style.msContentZooming; + target.style.msContentZooming = 'none'; + } + + // new in Windows Consumer Preview: css way to prevent all built-in touch actions on our target + // without this, you cannot touch draw on the element because IE will intercept the touch events + if (typeof target.style.msTouchAction !== 'undefined') { + msTouchAction = target.style.msTouchAction; + target.style.msTouchAction = 'none'; + } + } else if (target.addEventListener) { + // iOS touch model + target.addEventListener('touchstart', doEvent, false); + target.addEventListener('touchmove', doEvent, false); + target.addEventListener('touchend', doEvent, false); + target.addEventListener('touchcancel', doEvent, false); + + // mouse model + target.addEventListener('mousedown', doEvent, false); + + // mouse model with capture + // rejecting gecko because, unlike ie, firefox does not send events to target when the mouse is outside target + if (target.setCapture && !window.navigator.userAgent.match(/\bGecko\b/)) { + useSetReleaseCapture = true; + + target.addEventListener('mousemove', doEvent, false); + target.addEventListener('mouseup', doEvent, false); + } + } else if (target.attachEvent && target.setCapture) { + // legacy IE mode - mouse with capture + useSetReleaseCapture = true; + target.attachEvent('onmousedown', function() { + doEvent(window.event); + window.event.returnValue = false; + return false; + }); + target.attachEvent('onmousemove', function() { + doEvent(window.event); + window.event.returnValue = false; + return false; + }); + target.attachEvent('onmouseup', function() { + doEvent(window.event); + window.event.returnValue = false; + return false; + }); + } + }; + + this.disable = function() { + if (window.navigator.msPointerEnabled) { + // Microsoft pointer model + target.removeEventListener('MSPointerDown', doEvent, false); + target.removeEventListener('MSPointerMove', doEvent, false); + target.removeEventListener('MSPointerUp', doEvent, false); + target.removeEventListener('MSPointerCancel', doEvent, false); + + // reset zooming to saved value + if (contentZooming) { + target.style.msContentZooming = contentZooming; + } + + // reset touch action setting + if (msTouchAction) { + target.style.msTouchAction = msTouchAction; + } + } else if (target.removeEventListener) { + // iOS touch model + target.removeEventListener('touchstart', doEvent, false); + target.removeEventListener('touchmove', doEvent, false); + target.removeEventListener('touchend', doEvent, false); + target.removeEventListener('touchcancel', doEvent, false); + + // mouse model + target.removeEventListener('mousedown', doEvent, false); + + // mouse model with capture + // rejecting gecko because, unlike ie, firefox does not send events to target when the mouse is outside target + if (target.setCapture && !window.navigator.userAgent.match(/\bGecko\b/)) { + useSetReleaseCapture = true; + + target.removeEventListener('mousemove', doEvent, false); + target.removeEventListener('mouseup', doEvent, false); + } + } else if (target.detachEvent && target.setCapture) { + // legacy IE mode - mouse with capture + useSetReleaseCapture = true; + target.detachEvent('onmousedown'); + target.detachEvent('onmousemove'); + target.detachEvent('onmouseup'); + } + }; + + return this; + }; + }]) + + .factory('GridsterDraggable', ['$document', '$timeout', '$window', 'GridsterTouch', + function($document, $timeout, $window, GridsterTouch) { + function GridsterDraggable($el, scope, gridster, item, itemOptions) { + + var elmX, elmY, elmW, elmH, + + mouseX = 0, + mouseY = 0, + lastMouseX = 0, + lastMouseY = 0, + mOffX = 0, + mOffY = 0, + + minTop = 0, + maxTop = 9999, + minLeft = 0, + realdocument = $document[0]; + + var originalCol, originalRow; + var inputTags = ['select', 'input', 'textarea', 'button']; + + var gridsterItemDragElement = $el[0].querySelector('[gridster-item-drag]'); + //console.log(gridsterItemDragElement); + var isDraggableAreaDefined = gridsterItemDragElement?true:false; + //console.log(isDraggableAreaDefined); + + function mouseDown(e) { + + if(ie8){ + e.target = window.event.srcElement; + e.which = window.event.button; + } + + if(isDraggableAreaDefined && (!gridsterItemDragElement.contains(e.target))){ + return false; + } + + if (inputTags.indexOf(e.target.nodeName.toLowerCase()) !== -1) { + return false; + } + + var $target = angular.element(e.target); + + // exit, if a resize handle was hit + if ($target.hasClass('gridster-item-resizable-handler')) { + return false; + } + + // exit, if the target has it's own click event + if ($target.attr('onclick') || $target.attr('ng-click')) { + return false; + } + + // only works if you have jQuery + if ($target.closest && $target.closest('.gridster-no-drag').length) { + return false; + } + + switch (e.which) { + case 1: + // left mouse button + break; + case 2: + case 3: + // right or middle mouse button + return; + } + + lastMouseX = e.pageX; + lastMouseY = e.pageY; + + elmX = parseInt($el.css('left'), 10); + elmY = parseInt($el.css('top'), 10); + elmW = $el[0].offsetWidth; + elmH = $el[0].offsetHeight; + + originalCol = item.col; + originalRow = item.row; + + dragStart(e); + + return true; + } + + function mouseMove(e) { + if (!$el.hasClass('gridster-item-moving') || $el.hasClass('gridster-item-resizing')) { + return false; + } + + var maxLeft = gridster.curWidth - 1; + + // Get the current mouse position. + mouseX = e.pageX; + mouseY = e.pageY; + + // Get the deltas + var diffX = mouseX - lastMouseX + mOffX; + var diffY = mouseY - lastMouseY + mOffY; + mOffX = mOffY = 0; + + // Update last processed mouse positions. + lastMouseX = mouseX; + lastMouseY = mouseY; + + var dX = diffX, + dY = diffY; + if (elmX + dX < minLeft) { + diffX = minLeft - elmX; + mOffX = dX - diffX; + } else if (elmX + elmW + dX > maxLeft) { + diffX = maxLeft - elmX - elmW; + mOffX = dX - diffX; + } + + if (elmY + dY < minTop) { + diffY = minTop - elmY; + mOffY = dY - diffY; + } else if (elmY + elmH + dY > maxTop) { + diffY = maxTop - elmY - elmH; + mOffY = dY - diffY; + } + elmX += diffX; + elmY += diffY; + + // set new position + $el.css({ + 'top': elmY + 'px', + 'left': elmX + 'px' + }); + + drag(e); + + return true; + } + + function mouseUp(e) { + if (!$el.hasClass('gridster-item-moving') || $el.hasClass('gridster-item-resizing')) { + return false; + } + + mOffX = mOffY = 0; + + dragStop(e); + + return true; + } + + function dragStart(event) { + $el.addClass('gridster-item-moving'); + gridster.movingItem = item; + + gridster.updateHeight(item.sizeY); + scope.$apply(function() { + if (gridster.draggable && gridster.draggable.start) { + gridster.draggable.start(event, $el, itemOptions); + } + }); + } + + function drag(event) { + var oldRow = item.row, + oldCol = item.col, + hasCallback = gridster.draggable && gridster.draggable.drag, + scrollSensitivity = gridster.draggable.scrollSensitivity, + scrollSpeed = gridster.draggable.scrollSpeed; + + var row = gridster.pixelsToRows(elmY); + var col = gridster.pixelsToColumns(elmX); + + var itemsInTheWay = gridster.getItems(row, col, item.sizeX, item.sizeY, item); + var hasItemsInTheWay = itemsInTheWay.length !== 0; + + if (gridster.swapping === true && hasItemsInTheWay) { + var boundingBoxItem = gridster.getBoundingBox(itemsInTheWay), + sameSize = boundingBoxItem.sizeX === item.sizeX && boundingBoxItem.sizeY === item.sizeY, + sameRow = boundingBoxItem.row === oldRow, + sameCol = boundingBoxItem.col === oldCol, + samePosition = boundingBoxItem.row === row && boundingBoxItem.col === col, + inline = sameRow || sameCol; + + if (sameSize && itemsInTheWay.length === 1) { + if (samePosition) { + gridster.swapItems(item, itemsInTheWay[0]); + } else if (inline) { + return; + } + } else if (boundingBoxItem.sizeX <= item.sizeX && boundingBoxItem.sizeY <= item.sizeY && inline) { + var emptyRow = item.row <= row ? item.row : row + item.sizeY, + emptyCol = item.col <= col ? item.col : col + item.sizeX, + rowOffset = emptyRow - boundingBoxItem.row, + colOffset = emptyCol - boundingBoxItem.col; + + for (var i = 0, l = itemsInTheWay.length; i < l; ++i) { + var itemInTheWay = itemsInTheWay[i]; + + var itemsInFreeSpace = gridster.getItems( + itemInTheWay.row + rowOffset, + itemInTheWay.col + colOffset, + itemInTheWay.sizeX, + itemInTheWay.sizeY, + item + ); + + if (itemsInFreeSpace.length === 0) { + gridster.putItem(itemInTheWay, itemInTheWay.row + rowOffset, itemInTheWay.col + colOffset); + } + } + } + } + + if (gridster.pushing !== false || !hasItemsInTheWay) { + item.row = row; + item.col = col; + } + + if(($window.navigator.appName === 'Microsoft Internet Explorer' && !ie8) || $window.navigator.userAgent.indexOf("Firefox")!==-1){ + if (event.pageY - realdocument.documentElement.scrollTop < scrollSensitivity) { + realdocument.documentElement.scrollTop = realdocument.documentElement.scrollTop - scrollSpeed; + } else if ($window.innerHeight - (event.pageY - realdocument.documentElement.scrollTop) < scrollSensitivity) { + realdocument.documentElement.scrollTop = realdocument.documentElement.scrollTop + scrollSpeed; + } + } + else{ + if (event.pageY - realdocument.body.scrollTop < scrollSensitivity) { + realdocument.body.scrollTop = realdocument.body.scrollTop - scrollSpeed; + } else if ($window.innerHeight - (event.pageY - realdocument.body.scrollTop) < scrollSensitivity) { + realdocument.body.scrollTop = realdocument.body.scrollTop + scrollSpeed; + } + } + + + + if (event.pageX - realdocument.body.scrollLeft < scrollSensitivity) { + realdocument.body.scrollLeft = realdocument.body.scrollLeft - scrollSpeed; + } else if ($window.innerWidth - (event.pageX - realdocument.body.scrollLeft) < scrollSensitivity) { + realdocument.body.scrollLeft = realdocument.body.scrollLeft + scrollSpeed; + } + + if (hasCallback || oldRow !== item.row || oldCol !== item.col) { + scope.$apply(function() { + if (hasCallback) { + gridster.draggable.drag(event, $el, itemOptions); + } + }); + } + } + + function dragStop(event) { + $el.removeClass('gridster-item-moving'); + var row = gridster.pixelsToRows(elmY); + var col = gridster.pixelsToColumns(elmX); + if (gridster.pushing !== false || gridster.getItems(row, col, item.sizeX, item.sizeY, item).length === 0) { + item.row = row; + item.col = col; + } + gridster.movingItem = null; + item.setPosition(item.row, item.col); + + scope.$apply(function() { + if (gridster.draggable && gridster.draggable.stop) { + gridster.draggable.stop(event, $el, itemOptions); + } + }); + } + + var enabled = null; + var $dragHandles = null; + var unifiedInputs = []; + + this.enable = function() { + if (enabled === true) { + return; + } + + // disable and timeout required for some template rendering + $timeout(function() { + // disable any existing draghandles + for (var u = 0, ul = unifiedInputs.length; u < ul; ++u) { + unifiedInputs[u].disable(); + } + unifiedInputs = []; + + if (gridster.draggable && gridster.draggable.handle) { + $dragHandles = angular.element($el[0].querySelectorAll(gridster.draggable.handle)); + if ($dragHandles.length === 0) { + // fall back to element if handle not found... + $dragHandles = $el; + } + } else { + $dragHandles = $el; + } + + for (var h = 0, hl = $dragHandles.length; h < hl; ++h) { + unifiedInputs[h] = new GridsterTouch($dragHandles[h], mouseDown, mouseMove, mouseUp); + unifiedInputs[h].enable(); + } + + enabled = true; + }); + }; + + this.disable = function() { + if (enabled === false) { + return; + } + + // timeout to avoid race contition with the enable timeout + $timeout(function() { + + for (var u = 0, ul = unifiedInputs.length; u < ul; ++u) { + unifiedInputs[u].disable(); + } + + unifiedInputs = []; + enabled = false; + }); + }; + + this.toggle = function(enabled) { + if (enabled) { + this.enable(); + } else { + this.disable(); + } + }; + + this.destroy = function() { + this.disable(); + }; + } + + return GridsterDraggable; + } + ]) + + .factory('GridsterResizable', ['GridsterTouch', function(GridsterTouch) { + function GridsterResizable($el, scope, gridster, item, itemOptions) { + + function ResizeHandle(handleClass) { + + var hClass = handleClass; + + var elmX, elmY, elmW, elmH, + + mouseX = 0, + mouseY = 0, + lastMouseX = 0, + lastMouseY = 0, + mOffX = 0, + mOffY = 0, + + minTop = 0, + maxTop = 9999, + minLeft = 0; + + var getMinHeight = function() { + return (item.minSizeY ? item.minSizeY : 1) * gridster.curRowHeight - gridster.margins[0]; + }; + var getMinWidth = function() { + return (item.minSizeX ? item.minSizeX : 1) * gridster.curColWidth - gridster.margins[1]; + }; + + var originalWidth, originalHeight; + var savedDraggable; + + function mouseDown(e) { + switch (e.which) { + case 1: + // left mouse button + break; + case 2: + case 3: + // right or middle mouse button + return; + } + + // save the draggable setting to restore after resize + savedDraggable = gridster.draggable.enabled; + if (savedDraggable) { + gridster.draggable.enabled = false; + scope.$broadcast('gridster-draggable-changed', gridster); + } + + // Get the current mouse position. + lastMouseX = e.pageX; + lastMouseY = e.pageY; + + // Record current widget dimensions + elmX = parseInt($el.css('left'), 10); + elmY = parseInt($el.css('top'), 10); + elmW = $el[0].offsetWidth; + elmH = $el[0].offsetHeight; + + originalWidth = item.sizeX; + originalHeight = item.sizeY; + + resizeStart(e); + + return true; + } + + function resizeStart(e) { + $el.addClass('gridster-item-moving'); + $el.addClass('gridster-item-resizing'); + + gridster.movingItem = item; + + item.setElementSizeX(); + item.setElementSizeY(); + item.setElementPosition(); + gridster.updateHeight(1); + + scope.$apply(function() { + // callback + if (gridster.resizable && gridster.resizable.start) { + gridster.resizable.start(e, $el, itemOptions); // options is the item model + } + }); + } + + function mouseMove(e) { + var maxLeft = gridster.curWidth - 1; + + // Get the current mouse position. + mouseX = e.pageX; + mouseY = e.pageY; + + // Get the deltas + var diffX = mouseX - lastMouseX + mOffX; + var diffY = mouseY - lastMouseY + mOffY; + mOffX = mOffY = 0; + + // Update last processed mouse positions. + lastMouseX = mouseX; + lastMouseY = mouseY; + + var dY = diffY, + dX = diffX; + + if (hClass.indexOf('n') >= 0) { + if (elmH - dY < getMinHeight()) { + diffY = elmH - getMinHeight(); + mOffY = dY - diffY; + } else if (elmY + dY < minTop) { + diffY = minTop - elmY; + mOffY = dY - diffY; + } + elmY += diffY; + elmH -= diffY; + } + if (hClass.indexOf('s') >= 0) { + if (elmH + dY < getMinHeight()) { + diffY = getMinHeight() - elmH; + mOffY = dY - diffY; + } else if (elmY + elmH + dY > maxTop) { + diffY = maxTop - elmY - elmH; + mOffY = dY - diffY; + } + elmH += diffY; + } + if (hClass.indexOf('w') >= 0) { + if (elmW - dX < getMinWidth()) { + diffX = elmW - getMinWidth(); + mOffX = dX - diffX; + } else if (elmX + dX < minLeft) { + diffX = minLeft - elmX; + mOffX = dX - diffX; + } + elmX += diffX; + elmW -= diffX; + } + if (hClass.indexOf('e') >= 0) { + if (elmW + dX < getMinWidth()) { + diffX = getMinWidth() - elmW; + mOffX = dX - diffX; + } else if (elmX + elmW + dX > maxLeft) { + diffX = maxLeft - elmX - elmW; + mOffX = dX - diffX; + } + elmW += diffX; + } + + // set new position + $el.css({ + 'top': elmY + 'px', + 'left': elmX + 'px', + 'width': elmW + 'px', + 'height': elmH + 'px' + }); + + resize(e); + + return true; + } + + function mouseUp(e) { + // restore draggable setting to its original state + if (gridster.draggable.enabled !== savedDraggable) { + gridster.draggable.enabled = savedDraggable; + scope.$broadcast('gridster-draggable-changed', gridster); + } + + mOffX = mOffY = 0; + + resizeStop(e); + + return true; + } + + function resize(e) { + var oldRow = item.row, + oldCol = item.col, + oldSizeX = item.sizeX, + oldSizeY = item.sizeY, + hasCallback = gridster.resizable && gridster.resizable.resize; + + var col = item.col; + // only change column if grabbing left edge + if (['w', 'nw', 'sw'].indexOf(handleClass) !== -1) { + col = gridster.pixelsToColumns(elmX, false); + } + + var row = item.row; + // only change row if grabbing top edge + if (['n', 'ne', 'nw'].indexOf(handleClass) !== -1) { + row = gridster.pixelsToRows(elmY, false); + } + + var sizeX = item.sizeX; + // only change row if grabbing left or right edge + if (['n', 's'].indexOf(handleClass) === -1) { + sizeX = gridster.pixelsToColumns(elmW, true); + } + + var sizeY = item.sizeY; + // only change row if grabbing top or bottom edge + if (['e', 'w'].indexOf(handleClass) === -1) { + sizeY = gridster.pixelsToRows(elmH, true); + } + + if (gridster.pushing !== false || gridster.getItems(row, col, sizeX, sizeY, item).length === 0) { + item.row = row; + item.col = col; + item.sizeX = sizeX; + item.sizeY = sizeY; + } + var isChanged = item.row !== oldRow || item.col !== oldCol || item.sizeX !== oldSizeX || item.sizeY !== oldSizeY; + + if (hasCallback || isChanged) { + scope.$apply(function() { + if (hasCallback) { + gridster.resizable.resize(e, $el, itemOptions); // options is the item model + } + }); + } + } + + function resizeStop(e) { + $el.removeClass('gridster-item-moving'); + $el.removeClass('gridster-item-resizing'); + + gridster.movingItem = null; + + item.setPosition(item.row, item.col); + item.setSizeY(item.sizeY); + item.setSizeX(item.sizeX); + + scope.$apply(function() { + if (gridster.resizable && gridster.resizable.stop) { + gridster.resizable.stop(e, $el, itemOptions); // options is the item model + } + }); + } + + var $dragHandle = null; + var unifiedInput; + + this.enable = function() { + if (!$dragHandle) { + $dragHandle = angular.element('
      '); + $el.append($dragHandle); + } + + unifiedInput = new GridsterTouch($dragHandle[0], mouseDown, mouseMove, mouseUp); + unifiedInput.enable(); + }; + + this.disable = function() { + if ($dragHandle) { + $dragHandle.remove(); + $dragHandle = null; + } + + unifiedInput.disable(); + unifiedInput = undefined; + }; + + this.destroy = function() { + this.disable(); + }; + } + + var handles = []; + var handlesOpts = gridster.resizable.handles; + if (typeof handlesOpts === 'string') { + handlesOpts = gridster.resizable.handles.split(','); + } + var enabled = false; + + for (var c = 0, l = handlesOpts.length; c < l; c++) { + handles.push(new ResizeHandle(handlesOpts[c])); + } + + this.enable = function() { + if (enabled) { + return; + } + for (var c = 0, l = handles.length; c < l; c++) { + handles[c].enable(); + } + enabled = true; + }; + + this.disable = function() { + if (!enabled) { + return; + } + for (var c = 0, l = handles.length; c < l; c++) { + handles[c].disable(); + } + enabled = false; + }; + + this.toggle = function(enabled) { + if (enabled) { + this.enable(); + } else { + this.disable(); + } + }; + + this.destroy = function() { + for (var c = 0, l = handles.length; c < l; c++) { + handles[c].destroy(); + } + }; + } + return GridsterResizable; + }]) + + .factory('gridsterDebounce', function() { + return function gridsterDebounce(func, wait, immediate) { + var timeout; + return function() { + var context = this, + args = arguments; + var later = function() { + timeout = null; + if (!immediate) { + func.apply(context, args); + } + }; + var callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) { + func.apply(context, args); + } + }; + }; + }) + + /** + * GridsterItem directive + * @param $parse + * @param GridsterDraggable + * @param GridsterResizable + * @param gridsterDebounce + */ + .directive('gridsterItem', ['$parse', 'GridsterDraggable', 'GridsterResizable', 'gridsterDebounce', + function($parse, GridsterDraggable, GridsterResizable, gridsterDebounce) { + return { + scope: true, + restrict: 'EA', + controller: 'GridsterItemCtrl', + controllerAs: 'gridsterItem', + require: ['^gridster', 'gridsterItem'], + link: function(scope, $el, attrs, controllers) { + var optionsKey = attrs.gridsterItem, + options; + + var gridster = controllers[0], + item = controllers[1]; + + scope.gridster = gridster; + + + // bind the item's position properties + // options can be an object specified by gridster-item="object" + // or the options can be the element html attributes object + if (optionsKey) { + var $optionsGetter = $parse(optionsKey); + options = $optionsGetter(scope) || {}; + if (!options && $optionsGetter.assign) { + options = { + row: item.row, + col: item.col, + sizeX: item.sizeX, + sizeY: item.sizeY, + minSizeX: 0, + minSizeY: 0, + maxSizeX: null, + maxSizeY: null + }; + $optionsGetter.assign(scope, options); + } + } else { + options = attrs; + } + + item.init($el, gridster); + + $el.addClass('gridster-item'); + + var aspects = ['minSizeX', 'maxSizeX', 'minSizeY', 'maxSizeY', 'sizeX', 'sizeY', 'row', 'col'], + $getters = {}; + + var expressions = []; + var aspectFn = function(aspect) { + var expression; + if (typeof options[aspect] === 'string') { + // watch the expression in the scope + expression = options[aspect]; + } else if (typeof options[aspect.toLowerCase()] === 'string') { + // watch the expression in the scope + expression = options[aspect.toLowerCase()]; + } else if (optionsKey) { + // watch the expression on the options object in the scope + expression = optionsKey + '.' + aspect; + } else { + return; + } + expressions.push('"' + aspect + '":' + expression); + $getters[aspect] = $parse(expression); + + // initial set + var val = $getters[aspect](scope); + if (typeof val === 'number') { + item[aspect] = val; + } + }; + + for (var i = 0, l = aspects.length; i < l; ++i) { + aspectFn(aspects[i]); + } + + var watchExpressions = '{' + expressions.join(',') + '}'; + + // when the value changes externally, update the internal item object + scope.$watchCollection(watchExpressions, function(newVals, oldVals) { + for (var aspect in newVals) { + var newVal = newVals[aspect]; + var oldVal = oldVals[aspect]; + if (oldVal === newVal) { + continue; + } + newVal = parseInt(newVal, 10); + if (!isNaN(newVal)) { + item[aspect] = newVal; + } + } + }); + + function positionChanged() { + // call setPosition so the element and gridster controller are updated + item.setPosition(item.row, item.col); + + // when internal item position changes, update externally bound values + if ($getters.row && $getters.row.assign) { + $getters.row.assign(scope, item.row); + } + if ($getters.col && $getters.col.assign) { + $getters.col.assign(scope, item.col); + } + } + scope.$watch(function() { + return item.row + ',' + item.col; + }, positionChanged); + + function sizeChanged() { + var changedX = item.setSizeX(item.sizeX, true); + if (changedX && $getters.sizeX && $getters.sizeX.assign) { + $getters.sizeX.assign(scope, item.sizeX); + } + var changedY = item.setSizeY(item.sizeY, true); + if (changedY && $getters.sizeY && $getters.sizeY.assign) { + $getters.sizeY.assign(scope, item.sizeY); + } + + if (changedX || changedY) { + item.gridster.moveOverlappingItems(item); + gridster.layoutChanged(); + scope.$broadcast('gridster-item-resized', item); + } + } + + scope.$watch(function() { + return item.sizeY + ',' + item.sizeX + ',' + item.minSizeX + ',' + item.maxSizeX + ',' + item.minSizeY + ',' + item.maxSizeY; + }, sizeChanged); + + var draggable = new GridsterDraggable($el, scope, gridster, item, options); + var resizable = new GridsterResizable($el, scope, gridster, item, options); + + var updateResizable = function() { + resizable.toggle(!gridster.isMobile && gridster.resizable && gridster.resizable.enabled); + }; + updateResizable(); + + var updateDraggable = function() { + draggable.toggle(!gridster.isMobile && gridster.draggable && gridster.draggable.enabled); + }; + updateDraggable(); + + scope.$on('gridster-draggable-changed', updateDraggable); + scope.$on('gridster-resizable-changed', updateResizable); + scope.$on('gridster-resized', updateResizable); + scope.$on('gridster-mobile-changed', function() { + updateResizable(); + updateDraggable(); + }); + + function whichTransitionEvent() { + var el = document.createElement('div'); + var transitions = { + 'transition': 'transitionend', + 'OTransition': 'oTransitionEnd', + 'MozTransition': 'transitionend', + 'WebkitTransition': 'webkitTransitionEnd' + }; + for (var t in transitions) { + if (el.style[t] !== undefined) { + return transitions[t]; + } + } + } + + var debouncedTransitionEndPublisher = gridsterDebounce(function() { + scope.$apply(function() { + scope.$broadcast('gridster-item-transition-end', item); + }); + }, 50); + + if(whichTransitionEvent()){ //check for IE8, as it evaluates to null + $el.on(whichTransitionEvent(), debouncedTransitionEndPublisher); + } + + scope.$broadcast('gridster-item-initialized', item); + + return scope.$on('$destroy', function() { + try { + resizable.destroy(); + draggable.destroy(); + } catch (e) {} + + try { + gridster.removeItem(item); + } catch (e) {} + + try { + item.destroy(); + } catch (e) {} + }); + } + }; + } + ]) + + .directive('gridsterNoDrag', function() { + return { + restrict: 'A', + link: function(scope, $element) { + $element.addClass('gridster-no-drag'); + } + }; + }) + + ; + +})); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/att_angular_gridster/ui-gridster-tpls.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/att_angular_gridster/ui-gridster-tpls.js new file mode 100644 index 0000000..3ca3db7 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/att_angular_gridster/ui-gridster-tpls.js @@ -0,0 +1,168 @@ +/** +* FileName ui-gridster +* Version 0.0.1 +* Build number ad58c6f4f8f8fd7f04ac457f95d76f09 +* Date 08/17/2015 +*/ + + +(function(angular, window){ +angular.module("att.gridster", ["att.gridster.tpls", "att.gridster.utilities","att.gridster.gridster"]); +angular.module("att.gridster.tpls", ["template/gridster/gridster.html","template/gridster/gridsterItem.html","template/gridster/gridsterItemBody.html","template/gridster/gridsterItemFooter.html","template/gridster/gridsterItemHeader.html"]); +angular.module('att.gridster.utilities', []) + .factory('$extendObj', [function() { + var _extendDeep = function(dst) { + angular.forEach(arguments, function(obj) { + if (obj !== dst) { + angular.forEach(obj, function(value, key) { + if (dst[key] && dst[key].constructor && dst[key].constructor === Object) { + _extendDeep(dst[key], value); + } else { + dst[key] = value; + } + }); + } + }); + return dst; + }; + return { + extendDeep: _extendDeep + }; + }]); + +angular.module('att.gridster.gridster', ['attGridsterLib', 'att.gridster.utilities']) + .config(['$compileProvider', function($compileProvider) { + $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|javascript):/); + }]) + .constant('attGridsterConfig', + { + columns: 3, + margins: [10, 10], + outerMargin: true, + pushing: true, + floating: true, + swapping: true, + draggable: { + enabled: true + } + }) + .directive('attGridster', ['attGridsterConfig', '$extendObj', function(attGridsterConfig, $extendObj) { + return { + restrict: 'EA', + scope: { + attGridsterOptions: '=?' + }, + templateUrl: 'template/gridster/gridster.html', + replace: false, + transclude: true, + controller: [function() {}], + link: function(scope) { + if (angular.isDefined(scope.attGridsterOptions)) { + attGridsterConfig = $extendObj.extendDeep(attGridsterConfig, scope.attGridsterOptions); + } + scope.attGridsterConfig = attGridsterConfig; + } + }; + }]) + .directive('attGridsterItem', ['$timeout', function($timeout) { + return { + restrict: 'EA', + require: ['^attGridster'], + scope: { + attGridsterItem: '=' + }, + templateUrl: 'template/gridster/gridsterItem.html', + replace: false, + transclude: true, + controller: [function() {}] + }; + }]) + .directive('attGridsterItemHeader', [function() { + return { + restrict: 'EA', + require: ['^attGridsterItem'], + scope: { + headerText: '@', + subHeaderText: '@?' + }, + templateUrl: 'template/gridster/gridsterItemHeader.html', + replace: true, + transclude: true, + link: function(scope, element) { + if (angular.isDefined(scope.subHeaderText) && scope.subHeaderText) { + angular.element(element[0].querySelector('span.gridster-item-sub-header-content')).attr("tabindex", "0"); + angular.element(element[0].querySelector('span.gridster-item-sub-header-content')).attr("aria-label", scope.subHeaderText); + } + } + }; + }]) + .directive('attGridsterItemBody', [function() { + return { + restrict: 'EA', + require: ['^attGridsterItem'], + scope: {}, + templateUrl: 'template/gridster/gridsterItemBody.html', + replace: true, + transclude: true + }; + }]) + .directive('attGridsterItemFooter', ['$location', function($location) { + return { + restrict: 'EA', + require: ['^attGridsterItem'], + scope: { + attGridsterItemFooterLink: '@?' + }, + templateUrl: 'template/gridster/gridsterItemFooter.html', + replace: true, + transclude: true, + controller: ['$scope', function($scope) { + $scope.clickOnFooterLink = function(evt) { + evt.preventDefault(); + evt.stopPropagation(); + if ($scope.attGridsterItemFooterLink) { + $location.url($scope.attGridsterItemFooterLink); + } + }; + }], + link: function(scope, element) { + if (angular.isDefined(scope.attGridsterItemFooterLink) && scope.attGridsterItemFooterLink) { + element.attr("role", "link"); + } + } + }; + }]); +angular.module("template/gridster/gridster.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/gridster/gridster.html", + "
      "); +}]); + +angular.module("template/gridster/gridsterItem.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/gridster/gridsterItem.html", + "
      "); +}]); + +angular.module("template/gridster/gridsterItemBody.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/gridster/gridsterItemBody.html", + "
      "); +}]); + +angular.module("template/gridster/gridsterItemFooter.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/gridster/gridsterItemFooter.html", + "
      \n" + + " \n" + + "
      "); +}]); + +angular.module("template/gridster/gridsterItemHeader.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/gridster/gridsterItemHeader.html", + "
      \n" + + " \"||\"\n" + + " {{headerText}}\n" + + " {{subHeaderText}}\n" + + "
      \n" + + "
      "); +}]); + +return {} +})(angular, window); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/jquery.resize.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/jquery.resize.js new file mode 100644 index 0000000..1ebd6c9 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/jquery.resize.js @@ -0,0 +1,139 @@ +/*! + * jquery.resize.js 0.0.1 - https://github.com/yckart/jquery.resize.js + * Resize-event for DOM-Nodes + * + * @see http://workingdraft.de/113/ + * @see http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/ + * + * Copyright (c) 2013 Yannick Albert (http://yckart.com) + * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php). + * 2013/04/01 + */ + +(function(factory) { + if(typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else if(typeof exports === 'object') { + // Node/CommonJS style for Browserify + module.exports = factory; + } else { + // Browser globals + factory(jQuery); + } +}(function($) { + + function addFlowListener(element, type, fn) { + var flow = type == 'over'; + element.addEventListener('OverflowEvent' in window ? 'overflowchanged' : type + 'flow', function(e) { + if(e.type == (type + 'flow') || ((e.orient == 0 && e.horizontalOverflow == flow) || (e.orient == 1 && e.verticalOverflow == flow) || (e.orient == 2 && e.horizontalOverflow == flow && e.verticalOverflow == flow))) { + e.flow = type; + return fn.call(this, e); + } + }, false); + }; + + function fireEvent(element, type, data, options) { + var options = options || {}, + event = document.createEvent('Event'); + event.initEvent(type, 'bubbles' in options ? options.bubbles : true, 'cancelable' in options ? options.cancelable : true); + for(var z in data) event[z] = data[z]; + element.dispatchEvent(event); + }; + + $.event.special.resize = { + setup: function() { + var element = this; + var resize = 'onresize' in element; + if(!resize && !element._resizeSensor) { + var sensor = element._resizeSensor = document.createElement('div'); + sensor.className = 'resize-sensor'; + sensor.innerHTML = '
      '; + + var x = 0, + y = 0, + first = sensor.firstElementChild.firstChild, + last = sensor.lastElementChild.firstChild, + matchFlow = function(event) { + var change = false, + width = element.offsetWidth; + if(x != width) { + first.style.width = width - 1 + 'px'; + last.style.width = width + 1 + 'px'; + change = true; + x = width; + } + var height = element.offsetHeight; + if(y != height) { + first.style.height = height - 1 + 'px'; + last.style.height = height + 1 + 'px'; + change = true; + y = height; + } + if(change && event.currentTarget != element) fireEvent(element, 'resize'); + }; + + if(getComputedStyle(element).position == 'static') { + element.style.position = 'relative'; + element._resizeSensor._resetPosition = true; + } + addFlowListener(sensor, 'over', matchFlow); + addFlowListener(sensor, 'under', matchFlow); + addFlowListener(sensor.firstElementChild, 'over', matchFlow); + addFlowListener(sensor.lastElementChild, 'under', matchFlow); + element.appendChild(sensor); + matchFlow({}); + } + var events = element._flowEvents || (element._flowEvents = []); + if(events.indexOf(handler) == -1) events.push(handler); + if(!resize) element.addEventListener('resize', handler, false); + element.onresize = function(e) { + events.forEach(function(fn) { + fn.call(element, e); + }); + }; + }, + + teardown: function() { + var element = this; + var index = element._flowEvents.indexOf(handler); + if(index > -1) element._flowEvents.splice(index, 1); + if(!element._flowEvents.length) { + var sensor = element._resizeSensor; + if(sensor) { + element.removeChild(sensor); + if(sensor._resetPosition) element.style.position = 'static'; + delete element._resizeSensor; + } + if('onresize' in element) element.onresize = null; + delete element._flowEvents; + } + element.removeEventListener('resize', handler); + } + }; + + $.fn.extend({ + resize: function(fn) { + return fn ? this.bind("resize", fn) : this.trigger("resize"); + }, + + unresize: function(fn) { + return this.unbind("resize", fn); + } + }); + + + function handler(event) { + var orgEvent = event || window.event, + args = [].slice.call(arguments, 1); + + event = $.event.fix(orgEvent); + event.type = "resize"; + + // Add event to the front of the arguments + args.unshift(event); + + return($.event.dispatch || $.event.handle).apply(this, args); + } + +})); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/debug.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/debug.js new file mode 100644 index 0000000..eff36a2 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/debug.js @@ -0,0 +1,329 @@ +/** + * debugData + * + * Pass me a data structure {} and I'll output all the key/value pairs - recursively + * + * @example var HTML = debugData( oElem.style, "Element.style", { keys: "top,left,width,height", recurse: true, sort: true, display: true, returnHTML: true }); + * + * @param Object o_Data A JSON-style data structure + * @param String s_Title Title for dialog (optional) + * @param Hash options Pass additional options in a hash + */ +function debugData (o_Data, s_Title, options) { + options = options || {}; + var + str=(s_Title||s_Title==='' ? s_Title : 'DATA') + , dType=$.type(o_Data) + // maintain backward compatibility with OLD 'recurseData' param + , recurse=($.type(options)==='boolean' ? options : options.recurse !==false) + , keys=(options.keys?','+options.keys+',':false) + , display=options.display !==false + , html=options.returnHTML !==false + , sort=!!options.sort + , prefix=options.indent ? ' ' : '' + , D=[], i=0 // Array to hold data, i=counter + , hasSubKeys = false + , k, t, skip, x, type // loop vars + ; + if (dType!=='object' && dType!=='array') { + if (options.display) alert( (s_Title || 'debugData') +': '+ o_Data ); + return o_Data; + } + if (dType==='object' && $.isPlainObject(o_Data)) + dType='hash'; + + if (o_Data.jquery) { + str=s_Title+'jQuery Collection ('+ o_Data.length +')\n context="'+ o_Data.context +'"'; + } + else if (o_Data.nodeName) { + str=s_Title+o_Data.tagName; + var id = o_Data.id, cls=o_Data.className, src=o_Data.src, hrf=o_Data.href; + if (id) str+='\n id="'+ id+'"'; + if (cls) str+='\n class="'+ cls+'"'; + if (src) str+='\n src="'+ src+'"'; + if (hrf) str+='\n href="'+ hrf+'"'; + } + else { + parse(o_Data,prefix,dType); // recursive parsing + if (sort && !hasSubKeys) D.sort(); // sort by keyName - but NOT if has subKeys! + if (str) str += '\n***'+ '****************************'.substr(0,str.length) +'\n'; + str += D.join('\n'); // add line-breaks + } + + if (display) alert(str); // display data + if (html) str=str.replace(/\n/g, '
      ').replace(/ /g, '  '); // format as HTML + return str; + + function parse ( data, prefix, parentType ) { + var first = true; + try { + $.each( data, function (key, val) { + skip = (keys && keys.indexOf(','+key+',') === -1); + type = $.type(val); + if (type==='object' && $.isPlainObject(val)) + type = 'hash'; + k = prefix + (first ? ' ' : ', '); + first = false; + + if (parentType!=='array') // no key-names for array items + k += key+': '; // NOT an array + + if (type==="date" || type==="regexp") { + val = val.toString(); + type = "string"; + } + if (type==="string") { // STRING + if (!skip) D[i++] = k +'"'+ val +'"'; + } + // NULL, UNDEFINED, NUMBER or BOOLEAN + else if (/^(null|undefined|number|boolean)/.test(type)) { + if (!skip) D[i++] = k + val; + } + else if (type==="function") { // FUNCTION + if (!skip) D[i++] = k +'function()'; + } + else if (type==="array") { // ARRAY + if (!skip) { + D[i++] = k +'['; + parse( val, prefix+' ',type); // RECURSE + D[i++] = prefix +' ]'; + } + } + else if (val.jquery) { // JQUERY OBJECT + if (!skip) D[i++] = k +'jQuery ('+ val.length +') context="'+ val.context +'"'; + } + else if (val.nodeName) { // DOM ELEMENT + var id = val.id, cls=val.className, src=val.src, hrf=val.href; + if (skip) D[i++] = k +' '+ + id ? 'id="'+ id+'"' : + src ? 'src="'+ src+'"' : + hrf ? 'href="'+ hrf+'"' : + cls ? 'class="'+cls+'"' : + ''; + } + else if (type==="hash") { // JSON + if (!recurse || $.isEmptyObject(val)) { // show an empty hash + if (!skip) D[i++] = k +'{ }'; + } + else { // recurse into JSON hash - indent output + D[i++] = k +'{'; + parse( val, prefix+' ',type); // RECURSE + D[i++] = prefix +' }'; + } + } + else { // OBJECT + if (!skip) D[i++] = k +'OBJECT'; // NOT a hash + } + }); + } catch (e) {} + } +}; + +function debugStackTrace (s_Title, options) { + var + callstack = [] + , isCallstackPopulated = false + ; + try { + i.dont.exist += 0; // doesn't exist- that's the point + } catch(e) { + if (e.stack) { // Firefox + var lines = e.stack.split('\n'); + for (var i=0, len=lines.length; i
      ') + .html( content.replace(/\n/g, '
      ').replace(/ /g, '  ') ) // format as HTML + .css( options.css ) + ; +}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery-latest.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery-latest.js new file mode 100644 index 0000000..1c998ba --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery-latest.js @@ -0,0 +1,9555 @@ +/*! + * jQuery JavaScript Library v1.9.0 + * http://jquery.com/ + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * + * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2013-1-14 + */ +(function( window, undefined ) { +"use strict"; +var + // A central reference to the root jQuery(document) + rootjQuery, + + // The deferred used on DOM ready + readyList, + + // Use the correct document accordingly with window argument (sandbox) + document = window.document, + location = window.location, + + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$, + + // [[Class]] -> type pairs + class2type = {}, + + // List of deleted data cache ids, so we can reuse them + core_deletedIds = [], + + core_version = "1.9.0", + + // Save a reference to some core methods + core_concat = core_deletedIds.concat, + core_push = core_deletedIds.push, + core_slice = core_deletedIds.slice, + core_indexOf = core_deletedIds.indexOf, + core_toString = class2type.toString, + core_hasOwn = class2type.hasOwnProperty, + core_trim = core_version.trim, + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context, rootjQuery ); + }, + + // Used for matching numbers + core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, + + // Used for splitting on whitespace + core_rnotwhite = /\S+/g, + + // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/, + + // Match a standalone tag + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, + + // JSON RegExp + rvalidchars = /^[\],:{}\s]*$/, + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, + rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, + rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([\da-z])/gi, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }, + + // The ready event handler and self cleanup method + DOMContentLoaded = function() { + if ( document.addEventListener ) { + document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + jQuery.ready(); + } else if ( document.readyState === "complete" ) { + // we're here because readyState === "complete" in oldIE + // which is good enough for us to call the dom ready! + document.detachEvent( "onreadystatechange", DOMContentLoaded ); + jQuery.ready(); + } + }; + +jQuery.fn = jQuery.prototype = { + // The current version of jQuery being used + jquery: core_version, + + constructor: jQuery, + init: function( selector, context, rootjQuery ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + + // scripts is true for back-compat + jQuery.merge( this, jQuery.parseHTML( + match[1], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }, + + // Start with an empty selector + selector: "", + + // The default length of a jQuery object is 0 + length: 0, + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + toArray: function() { + return core_slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + ret.context = this.context; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + ready: function( fn ) { + // Add the callback + jQuery.ready.promise().done( fn ); + + return this; + }, + + slice: function() { + return this.pushStack( core_slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: core_push, + sort: [].sort, + splice: [].splice +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + noConflict: function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger("ready").off("ready"); + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + isWindow: function( obj ) { + return obj != null && obj == obj.window; + }, + + isNumeric: function( obj ) { + return !isNaN( parseFloat(obj) ) && isFinite( obj ); + }, + + type: function( obj ) { + if ( obj == null ) { + return String( obj ); + } + return typeof obj === "object" || typeof obj === "function" ? + class2type[ core_toString.call(obj) ] || "object" : + typeof obj; + }, + + isPlainObject: function( obj ) { + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !core_hasOwn.call(obj, "constructor") && + !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + + var key; + for ( key in obj ) {} + + return key === undefined || core_hasOwn.call( obj, key ); + }, + + isEmptyObject: function( obj ) { + var name; + for ( name in obj ) { + return false; + } + return true; + }, + + error: function( msg ) { + throw new Error( msg ); + }, + + // data: string of html + // context (optional): If specified, the fragment will be created in this context, defaults to document + // keepScripts (optional): If true, will include scripts passed in the html string + parseHTML: function( data, context, keepScripts ) { + if ( !data || typeof data !== "string" ) { + return null; + } + if ( typeof context === "boolean" ) { + keepScripts = context; + context = false; + } + context = context || document; + + var parsed = rsingleTag.exec( data ), + scripts = !keepScripts && []; + + // Single tag + if ( parsed ) { + return [ context.createElement( parsed[1] ) ]; + } + + parsed = jQuery.buildFragment( [ data ], context, scripts ); + if ( scripts ) { + jQuery( scripts ).remove(); + } + return jQuery.merge( [], parsed.childNodes ); + }, + + parseJSON: function( data ) { + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + return window.JSON.parse( data ); + } + + if ( data === null ) { + return data; + } + + if ( typeof data === "string" ) { + + // Make sure leading/trailing whitespace is removed (IE can't handle it) + data = jQuery.trim( data ); + + if ( data ) { + // Make sure the incoming data is actual JSON + // Logic borrowed from http://json.org/json2.js + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) + .replace( rvalidtokens, "]" ) + .replace( rvalidbraces, "")) ) { + + return ( new Function( "return " + data ) )(); + } + } + } + + jQuery.error( "Invalid JSON: " + data ); + }, + + // Cross-browser xml parsing + parseXML: function( data ) { + var xml, tmp; + if ( !data || typeof data !== "string" ) { + return null; + } + try { + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + } catch( e ) { + xml = undefined; + } + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; + }, + + noop: function() {}, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && jQuery.trim( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + // args is for internal usage only + each: function( obj, callback, args ) { + var value, + i = 0, + length = obj.length, + isArray = isArraylike( obj ); + + if ( args ) { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } + } + + return obj; + }, + + // Use native String.trim function wherever possible + trim: core_trim && !core_trim.call("\uFEFF\xA0") ? + function( text ) { + return text == null ? + "" : + core_trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArraylike( Object(arr) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + core_push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + var len; + + if ( arr ) { + if ( core_indexOf ) { + return core_indexOf.call( arr, elem, i ); + } + + len = arr.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in arr && arr[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var l = second.length, + i = first.length, + j = 0; + + if ( typeof l === "number" ) { + for ( ; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, inv ) { + var retVal, + ret = [], + i = 0, + length = elems.length; + inv = !!inv; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { + ret.push( elems[ i ] ); + } + } + + return ret; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, + i = 0, + length = elems.length, + isArray = isArraylike( elems ), + ret = []; + + // Go through the array, translating each of the items to their + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + } + + // Flatten any nested arrays + return core_concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = core_slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + // Multifunctional method to get and set values of a collection + // The value/s can optionally be executed if it's a function + access: function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + length = elems.length, + bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === "object" ) { + chainable = true; + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !jQuery.isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < length; i++ ) { + fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); + } + } + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + length ? fn( elems[0], key ) : emptyGet; + }, + + now: function() { + return ( new Date() ).getTime(); + } +}); + +jQuery.ready.promise = function( obj ) { + if ( !readyList ) { + + readyList = jQuery.Deferred(); + + // Catch cases where $(document).ready() is called after the browser event has already occurred. + // we once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + setTimeout( jQuery.ready ); + + // Standards-based browsers support DOMContentLoaded + } else if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", jQuery.ready, false ); + + // If IE event model is used + } else { + // Ensure firing before onload, maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", DOMContentLoaded ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", jQuery.ready ); + + // If IE and not a frame + // continually check to see if the document is ready + var top = false; + + try { + top = window.frameElement == null && document.documentElement; + } catch(e) {} + + if ( top && top.doScroll ) { + (function doScrollCheck() { + if ( !jQuery.isReady ) { + + try { + // Use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + top.doScroll("left"); + } catch(e) { + return setTimeout( doScrollCheck, 50 ); + } + + // and execute any waiting functions + jQuery.ready(); + } + })(); + } + } + } + return readyList.promise( obj ); +}; + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +function isArraylike( obj ) { + var length = obj.length, + type = jQuery.type( obj ); + + if ( jQuery.isWindow( obj ) ) { + return false; + } + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === "array" || type !== "function" && + ( length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj ); +} + +// All jQuery objects should point back to these +rootjQuery = jQuery(document); +// String to Object options format cache +var optionsCache = {}; + +// Convert String-formatted options into Object-formatted ones and store in cache +function createOptions( options ) { + var object = optionsCache[ options ] = {}; + jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { + object[ flag ] = true; + }); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + ( optionsCache[ options ] || createOptions( options ) ) : + jQuery.extend( {}, options ); + + var // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list was already fired + fired, + // Flag to know if list is currently firing + firing, + // First callback to fire (used internally by add and fireWith) + firingStart, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = !options.once && [], + // Fire callbacks + fire = function( data ) { + memory = options.memory && data; + fired = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + firing = true; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { + memory = false; // To prevent further calls using add + break; + } + } + firing = false; + if ( list ) { + if ( stack ) { + if ( stack.length ) { + fire( stack.shift() ); + } + } else if ( memory ) { + list = []; + } else { + self.disable(); + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + // First, we save the current length + var start = list.length; + (function add( args ) { + jQuery.each( args, function( _, arg ) { + var type = jQuery.type( arg ); + if ( type === "function" ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && type !== "string" ) { + // Inspect recursively + add( arg ); + } + }); + })( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away + } else if ( memory ) { + firingStart = start; + fire( memory ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + jQuery.each( arguments, function( _, arg ) { + var index; + while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + // Handle firing indexes + if ( firing ) { + if ( index <= firingLength ) { + firingLength--; + } + if ( index <= firingIndex ) { + firingIndex--; + } + } + } + }); + } + return this; + }, + // Control if a given callback is in the list + has: function( fn ) { + return jQuery.inArray( fn, list ) > -1; + }, + // Remove all callbacks from the list + empty: function() { + list = []; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + if ( list && ( !fired || stack ) ) { + if ( firing ) { + stack.push( args ); + } else { + fire( args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; +jQuery.extend({ + + Deferred: function( func ) { + var tuples = [ + // action, add listener, listener list, final state + [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], + [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], + [ "notify", "progress", jQuery.Callbacks("memory") ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + return jQuery.Deferred(function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + var action = tuple[ 0 ], + fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; + // deferred[ done | fail | progress ] for forwarding actions to newDefer + deferred[ tuple[1] ](function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); + } + }); + }); + fns = null; + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Keep pipe for back-compat + promise.pipe = promise.then; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 3 ]; + + // promise[ done | fail | progress ] = list.add + promise[ tuple[1] ] = list.add; + + // Handle state + if ( stateString ) { + list.add(function() { + // state = [ resolved | rejected ] + state = stateString; + + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + } + + // deferred[ resolve | reject | notify ] + deferred[ tuple[0] ] = function() { + deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); + return this; + }; + deferred[ tuple[0] + "With" ] = list.fireWith; + }); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0, + resolveValues = core_slice.call( arguments ), + length = resolveValues.length, + + // the count of uncompleted subordinates + remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, + + // the master Deferred. If resolveValues consist of only a single Deferred, just use that. + deferred = remaining === 1 ? subordinate : jQuery.Deferred(), + + // Update function for both resolve and progress values + updateFunc = function( i, contexts, values ) { + return function( value ) { + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; + if( values === progressValues ) { + deferred.notifyWith( contexts, values ); + } else if ( !( --remaining ) ) { + deferred.resolveWith( contexts, values ); + } + }; + }, + + progressValues, progressContexts, resolveContexts; + + // add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { + resolveValues[ i ].promise() + .done( updateFunc( i, resolveContexts, resolveValues ) ) + .fail( deferred.reject ) + .progress( updateFunc( i, progressContexts, progressValues ) ); + } else { + --remaining; + } + } + } + + // if we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); + } + + return deferred.promise(); + } +}); +jQuery.support = (function() { + + var support, all, a, select, opt, input, fragment, eventName, isSupported, i, + div = document.createElement("div"); + + // Setup + div.setAttribute( "className", "t" ); + div.innerHTML = "
      a"; + + // Support tests won't run in some limited or non-browser environments + all = div.getElementsByTagName("*"); + a = div.getElementsByTagName("a")[ 0 ]; + if ( !all || !a || !all.length ) { + return {}; + } + + // First batch of tests + select = document.createElement("select"); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName("input")[ 0 ]; + + a.style.cssText = "top:1px;float:left;opacity:.5"; + support = { + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + getSetAttribute: div.className !== "t", + + // IE strips leading whitespace when .innerHTML is used + leadingWhitespace: div.firstChild.nodeType === 3, + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + tbody: !div.getElementsByTagName("tbody").length, + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + htmlSerialize: !!div.getElementsByTagName("link").length, + + // Get the style information from getAttribute + // (IE uses .cssText instead) + style: /top/.test( a.getAttribute("style") ), + + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + hrefNormalized: a.getAttribute("href") === "/a", + + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + opacity: /^0.5/.test( a.style.opacity ), + + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + cssFloat: !!a.style.cssFloat, + + // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) + checkOn: !!input.value, + + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + optSelected: opt.selected, + + // Tests for enctype support on a form (#6743) + enctype: !!document.createElement("form").enctype, + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", + + // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode + boxModel: document.compatMode === "CSS1Compat", + + // Will be defined later + deleteExpando: true, + noCloneEvent: true, + inlineBlockNeedsLayout: false, + shrinkWrapBlocks: false, + reliableMarginRight: true, + boxSizingReliable: true, + pixelPosition: false + }; + + // Make sure checked status is properly cloned + input.checked = true; + support.noCloneChecked = input.cloneNode( true ).checked; + + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as disabled) + select.disabled = true; + support.optDisabled = !opt.disabled; + + // Support: IE<9 + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + + // Check if we can trust getAttribute("value") + input = document.createElement("input"); + input.setAttribute( "value", "" ); + support.input = input.getAttribute( "value" ) === ""; + + // Check if an input maintains its value after becoming a radio + input.value = "t"; + input.setAttribute( "type", "radio" ); + support.radioValue = input.value === "t"; + + // #11217 - WebKit loses check when the name is after the checked attribute + input.setAttribute( "checked", "t" ); + input.setAttribute( "name", "t" ); + + fragment = document.createDocumentFragment(); + fragment.appendChild( input ); + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; + + // WebKit doesn't clone checked state correctly in fragments + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE<9 + // Opera does not clone events (and typeof div.attachEvent === undefined). + // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() + if ( div.attachEvent ) { + div.attachEvent( "onclick", function() { + support.noCloneEvent = false; + }); + + div.cloneNode( true ).click(); + } + + // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event) + // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php + for ( i in { submit: true, change: true, focusin: true }) { + div.setAttribute( eventName = "on" + i, "t" ); + + support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false; + } + + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; + + // Run tests that need a body at doc ready + jQuery(function() { + var container, marginDiv, tds, + divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", + body = document.getElementsByTagName("body")[0]; + + if ( !body ) { + // Return for frameset docs that don't have a body + return; + } + + container = document.createElement("div"); + container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; + + body.appendChild( container ).appendChild( div ); + + // Support: IE8 + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + div.innerHTML = "
      t
      "; + tds = div.getElementsByTagName("td"); + tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; + isSupported = ( tds[ 0 ].offsetHeight === 0 ); + + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; + + // Support: IE8 + // Check if empty table cells still have offsetWidth/Height + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); + + // Check box-sizing and margin behavior + div.innerHTML = ""; + div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; + support.boxSizing = ( div.offsetWidth === 4 ); + support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); + + // Use window.getComputedStyle because jsdom on node.js will break without it. + if ( window.getComputedStyle ) { + support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; + support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; + + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. (#3333) + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + marginDiv = div.appendChild( document.createElement("div") ); + marginDiv.style.cssText = div.style.cssText = divReset; + marginDiv.style.marginRight = marginDiv.style.width = "0"; + div.style.width = "1px"; + + support.reliableMarginRight = + !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); + } + + if ( typeof div.style.zoom !== "undefined" ) { + // Support: IE<8 + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + div.innerHTML = ""; + div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; + support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); + + // Support: IE6 + // Check if elements with layout shrink-wrap their children + div.style.display = "block"; + div.innerHTML = "
      "; + div.firstChild.style.width = "5px"; + support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); + + // Prevent IE 6 from affecting layout for positioned elements #11048 + // Prevent IE from shrinking the body in IE 7 mode #12869 + body.style.zoom = 1; + } + + body.removeChild( container ); + + // Null elements to avoid leaks in IE + container = div = tds = marginDiv = null; + }); + + // Null elements to avoid leaks in IE + all = select = fragment = opt = a = input = null; + + return support; +})(); + +var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, + rmultiDash = /([A-Z])/g; + +function internalData( elem, name, data, pvt /* Internal Use Only */ ){ + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, ret, + internalKey = jQuery.expando, + getByName = typeof name === "string", + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++; + } else { + id = internalKey; + } + } + + if ( !cache[ id ] ) { + cache[ id ] = {}; + + // Avoids exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + if ( !isNode ) { + cache[ id ].toJSON = jQuery.noop; + } + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } + + thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } + + thisCache = thisCache.data; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( getByName ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; +} + +function internalRemoveData( elem, name, pvt /* For internal use only */ ){ + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, i, l, + + isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + id = isNode ? elem[ jQuery.expando ] : jQuery.expando; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + + thisCache = pvt ? cache[ id ] : cache[ id ].data; + + if ( thisCache ) { + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split(" "); + } + } + } else { + // If "name" is an array of keys... + // When data is initially created, via ("key", "val") signature, + // keys will be converted to camelCase. + // Since there is no way to tell _how_ a key was added, remove + // both plain key and camelCase key. #12786 + // This will only penalize the array argument path. + name = name.concat( jQuery.map( name, jQuery.camelCase ) ); + } + + for ( i = 0, l = name.length; i < l; i++ ) { + delete thisCache[ name[i] ]; + } + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject( cache[ id ] ) ) { + return; + } + } + + // Destroy the cache + if ( isNode ) { + jQuery.cleanData( [ elem ], true ); + + // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) + } else if ( jQuery.support.deleteExpando || cache != cache.window ) { + delete cache[ id ]; + + // When all else fails, null + } else { + cache[ id ] = null; + } +} + +jQuery.extend({ + cache: {}, + + // Unique for each copy of jQuery on the page + // Non-digits removed to match rinlinejQuery + expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), + + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "embed": true, + // Ban all objects except for Flash (which handle expandos) + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", + "applet": true + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data ) { + return internalData( elem, name, data, false ); + }, + + removeData: function( elem, name ) { + return internalRemoveData( elem, name, false ); + }, + + // For internal use only. + _data: function( elem, name, data ) { + return internalData( elem, name, data, true ); + }, + + _removeData: function( elem, name ) { + return internalRemoveData( elem, name, true ); + }, + + // A method for determining if a DOM node can handle the data expando + acceptData: function( elem ) { + var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; + + // nodes accept data unless otherwise specified; rejection can be conditional + return !noData || noData !== true && elem.getAttribute("classid") === noData; + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var attrs, name, + elem = this[0], + i = 0, + data = null; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = jQuery.data( elem ); + + if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { + attrs = elem.attributes; + for ( ; i < attrs.length; i++ ) { + name = attrs[i].name; + + if ( !name.indexOf( "data-" ) ) { + name = jQuery.camelCase( name.substring(5) ); + + dataAttr( elem, name, data[ name ] ); + } + } + jQuery._data( elem, "parsedAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + return jQuery.access( this, function( value ) { + + if ( value === undefined ) { + // Try to fetch any internally stored data first + return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null; + } + + this.each(function() { + jQuery.data( this, key, value ); + }); + }, null, value, arguments.length > 1, null, true ); + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + +// checks a cache object for emptiness +function isEmptyDataObject( obj ) { + var name; + for ( name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } + + return true; +} +jQuery.extend({ + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || jQuery.isArray(data) ) { + queue = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + hooks.cur = fn; + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // not intended for public consumption - generates a queueHooks object, or returns the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return jQuery._data( elem, key ) || jQuery._data( elem, key, { + empty: jQuery.Callbacks("once memory").add(function() { + jQuery._removeData( elem, type + "queue" ); + jQuery._removeData( elem, key ); + }) + }); + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } + + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); + + // ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = setTimeout( next, time ); + hooks.stop = function() { + clearTimeout( timeout ); + }; + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while( i-- ) { + tmp = jQuery._data( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +}); +var nodeHook, boolHook, + rclass = /[\t\r\n]/g, + rreturn = /\r/g, + rfocusable = /^(?:input|select|textarea|button|object)$/i, + rclickable = /^(?:a|area)$/i, + rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i, + ruseDefault = /^(?:checked|selected)$/i, + getSetAttribute = jQuery.support.getSetAttribute, + getSetInput = jQuery.support.input; + +jQuery.fn.extend({ + attr: function( name, value ) { + return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each(function() { + jQuery.removeAttr( this, name ); + }); + }, + + prop: function( name, value ) { + return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} + }); + }, + + addClass: function( value ) { + var classes, elem, cur, clazz, j, + i = 0, + len = this.length, + proceed = typeof value === "string" && value; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call( this, j, this.className ) ); + }); + } + + if ( proceed ) { + // The disjunction here is for better compressibility (see removeClass) + classes = ( value || "" ).match( core_rnotwhite ) || []; + + for ( ; i < len; i++ ) { + elem = this[ i ]; + cur = elem.nodeType === 1 && ( elem.className ? + ( " " + elem.className + " " ).replace( rclass, " " ) : + " " + ); + + if ( cur ) { + j = 0; + while ( (clazz = classes[j++]) ) { + if ( cur.indexOf( " " + clazz + " " ) < 0 ) { + cur += clazz + " "; + } + } + elem.className = jQuery.trim( cur ); + + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classes, elem, cur, clazz, j, + i = 0, + len = this.length, + proceed = arguments.length === 0 || typeof value === "string" && value; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call( this, j, this.className ) ); + }); + } + if ( proceed ) { + classes = ( value || "" ).match( core_rnotwhite ) || []; + + for ( ; i < len; i++ ) { + elem = this[ i ]; + // This expression is here for better compressibility (see addClass) + cur = elem.nodeType === 1 && ( elem.className ? + ( " " + elem.className + " " ).replace( rclass, " " ) : + "" + ); + + if ( cur ) { + j = 0; + while ( (clazz = classes[j++]) ) { + // Remove *all* instances + while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { + cur = cur.replace( " " + clazz + " ", " " ); + } + } + elem.className = value ? jQuery.trim( cur ) : ""; + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value, + isBool = typeof stateVal === "boolean"; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + }); + } + + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, + i = 0, + self = jQuery( this ), + state = stateVal, + classNames = value.match( core_rnotwhite ) || []; + + while ( (className = classNames[ i++ ]) ) { + // check each className given, space separated list + state = isBool ? state : !self.hasClass( className ); + self[ state ? "addClass" : "removeClass" ]( className ); + } + + // Toggle whole class name + } else if ( type === "undefined" || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery._data( this, "__className__", this.className ); + } + + // If the element has a class name or if we're passed "false", + // then remove the whole classname (if there was one, the above saved it). + // Otherwise bring back whatever was previously saved (if anything), + // falling back to the empty string if nothing was stored. + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; + } + }); + }, + + hasClass: function( selector ) { + var className = " " + selector + " ", + i = 0, + l = this.length; + for ( ; i < l; i++ ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { + return true; + } + } + + return false; + }, + + val: function( value ) { + var hooks, ret, isFunction, + elem = this[0]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; + } + + ret = elem.value; + + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each(function( i ) { + var val, + self = jQuery(this); + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, self.val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { + val += ""; + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map(val, function ( value ) { + return value == null ? "" : value + ""; + }); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + }); + } +}); + +jQuery.extend({ + valHooks: { + option: { + get: function( elem ) { + // attributes.value is undefined in Blackberry 4.7 but + // uses .value. See #6932 + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; + } + }, + select: { + get: function( elem ) { + var value, option, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one" || index < 0, + values = one ? null : [], + max = one ? index + 1 : options.length, + i = index < 0 ? + max : + one ? index : 0; + + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; + + // oldIE doesn't update selected after form reset (#2551) + if ( ( option.selected || i === index ) && + // Don't return options that are disabled or in a disabled optgroup + ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && + ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + }, + + set: function( elem, value ) { + var values = jQuery.makeArray( value ); + + jQuery(elem).find("option").each(function() { + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; + }); + + if ( !values.length ) { + elem.selectedIndex = -1; + } + return values; + } + } + }, + + attr: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + // All attributes are lowercase + // Grab necessary hook if one is defined + if ( notxml ) { + name = name.toLowerCase(); + hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); + } + + if ( value !== undefined ) { + + if ( value === null ) { + jQuery.removeAttr( elem, name ); + + } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + elem.setAttribute( name, value + "" ); + return value; + } + + } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + + // In IE9+, Flash objects don't have .getAttribute (#12945) + // Support: IE9+ + if ( typeof elem.getAttribute !== "undefined" ) { + ret = elem.getAttribute( name ); + } + + // Non-existent attributes return null, we normalize to undefined + return ret == null ? + undefined : + ret; + } + }, + + removeAttr: function( elem, value ) { + var name, propName, + i = 0, + attrNames = value && value.match( core_rnotwhite ); + + if ( attrNames && elem.nodeType === 1 ) { + while ( (name = attrNames[i++]) ) { + propName = jQuery.propFix[ name ] || name; + + // Boolean attributes get special treatment (#10870) + if ( rboolean.test( name ) ) { + // Set corresponding property to false for boolean attributes + // Also clear defaultChecked/defaultSelected (if appropriate) for IE<8 + if ( !getSetAttribute && ruseDefault.test( name ) ) { + elem[ jQuery.camelCase( "default-" + name ) ] = + elem[ propName ] = false; + } else { + elem[ propName ] = false; + } + + // See #9699 for explanation of this approach (setting first, then removal) + } else { + jQuery.attr( elem, name, "" ); + } + + elem.removeAttribute( getSetAttribute ? name : propName ); + } + } + }, + + attrHooks: { + type: { + set: function( elem, value ) { + if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to default in case type is set after value during creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + } + }, + + propFix: { + tabindex: "tabIndex", + readonly: "readOnly", + "for": "htmlFor", + "class": "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable" + }, + + prop: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + return ( elem[ name ] = value ); + } + + } else { + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + return elem[ name ]; + } + } + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + var attributeNode = elem.getAttributeNode("tabindex"); + + return attributeNode && attributeNode.specified ? + parseInt( attributeNode.value, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + undefined; + } + } + } +}); + +// Hook for boolean attributes +boolHook = { + get: function( elem, name ) { + var + // Use .prop to determine if this attribute is understood as boolean + prop = jQuery.prop( elem, name ), + + // Fetch it accordingly + attr = typeof prop === "boolean" && elem.getAttribute( name ), + detail = typeof prop === "boolean" ? + + getSetInput && getSetAttribute ? + attr != null : + // oldIE fabricates an empty string for missing boolean attributes + // and conflates checked/selected into attroperties + ruseDefault.test( name ) ? + elem[ jQuery.camelCase( "default-" + name ) ] : + !!attr : + + // fetch an attribute node for properties not recognized as boolean + elem.getAttributeNode( name ); + + return detail && detail.value !== false ? + name.toLowerCase() : + undefined; + }, + set: function( elem, value, name ) { + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { + // IE<8 needs the *property* name + elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); + + // Use defaultChecked and defaultSelected for oldIE + } else { + elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; + } + + return name; + } +}; + +// fix oldIE value attroperty +if ( !getSetInput || !getSetAttribute ) { + jQuery.attrHooks.value = { + get: function( elem, name ) { + var ret = elem.getAttributeNode( name ); + return jQuery.nodeName( elem, "input" ) ? + + // Ignore the value *property* by using defaultValue + elem.defaultValue : + + ret && ret.specified ? ret.value : undefined; + }, + set: function( elem, value, name ) { + if ( jQuery.nodeName( elem, "input" ) ) { + // Does not return so that setAttribute is also used + elem.defaultValue = value; + } else { + // Use nodeHook if defined (#1954); otherwise setAttribute is fine + return nodeHook && nodeHook.set( elem, value, name ); + } + } + }; +} + +// IE6/7 do not support getting/setting some attributes with get/setAttribute +if ( !getSetAttribute ) { + + // Use this for any attribute in IE6/7 + // This fixes almost every IE6/7 issue + nodeHook = jQuery.valHooks.button = { + get: function( elem, name ) { + var ret = elem.getAttributeNode( name ); + return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ? + ret.value : + undefined; + }, + set: function( elem, value, name ) { + // Set the existing or create a new attribute node + var ret = elem.getAttributeNode( name ); + if ( !ret ) { + elem.setAttributeNode( + (ret = elem.ownerDocument.createAttribute( name )) + ); + } + + ret.value = value += ""; + + // Break association with cloned elements by also using setAttribute (#9646) + return name === "value" || value === elem.getAttribute( name ) ? + value : + undefined; + } + }; + + // Set contenteditable to false on removals(#10429) + // Setting to empty string throws an error as an invalid value + jQuery.attrHooks.contenteditable = { + get: nodeHook.get, + set: function( elem, value, name ) { + nodeHook.set( elem, value === "" ? false : value, name ); + } + }; + + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } + } + }); + }); +} + + +// Some attributes require a special call on IE +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !jQuery.support.hrefNormalized ) { + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + get: function( elem ) { + var ret = elem.getAttribute( name, 2 ); + return ret == null ? undefined : ret; + } + }); + }); + + // href/src property should get the full normalized URL (#10299/#12915) + jQuery.each([ "href", "src" ], function( i, name ) { + jQuery.propHooks[ name ] = { + get: function( elem ) { + return elem.getAttribute( name, 4 ); + } + }; + }); +} + +if ( !jQuery.support.style ) { + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Note: IE uppercases css property names, but if we were to .toLowerCase() + // .cssText, that would destroy case senstitivity in URL's, like in "background" + return elem.style.cssText || undefined; + }, + set: function( elem, value ) { + return ( elem.style.cssText = value + "" ); + } + }; +} + +// Safari mis-reports the default selected property of an option +// Accessing the parent's selectedIndex property fixes it +if ( !jQuery.support.optSelected ) { + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { + get: function( elem ) { + var parent = elem.parentNode; + + if ( parent ) { + parent.selectedIndex; + + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + return null; + } + }); +} + +// IE6/7 call enctype encoding +if ( !jQuery.support.enctype ) { + jQuery.propFix.enctype = "encoding"; +} + +// Radios and checkboxes getter/setter +if ( !jQuery.support.checkOn ) { + jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + get: function( elem ) { + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + } + }; + }); +} +jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + } + } + }); +}); +var rformElems = /^(?:input|select|textarea)$/i, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + + var handleObjIn, eventHandle, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + // Don't attach events to noData or text/comment nodes (but allow plain objects) + elemData = elem.nodeType !== 3 && elem.nodeType !== 8 && jQuery._data( elem ); + + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !(events = elemData.events) ) { + events = elemData.events = {}; + } + if ( !(eventHandle = elemData.handle) ) { + eventHandle = elemData.handle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + // jQuery(...).bind("mouseover mouseout", fn); + types = ( types || "" ).match( core_rnotwhite ) || [""]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !(handlers = events[ type ]) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var j, origCount, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = jQuery.hasData( elem ) && jQuery._data( elem ); + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( core_rnotwhite ) || [""]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + delete elemData.handle; + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery._removeData( elem, "events" ); + } + }, + + trigger: function( event, data, elem, onlyHandlers ) { + + var i, cur, tmp, bubbleType, ontype, handle, special, + eventPath = [ elem || document ], + type = event.type || event, + namespaces = event.namespace ? event.namespace.split(".") : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf(".") >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf(":") < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + event.isTrigger = true; + event.namespace = namespaces.join("."); + event.namespace_re = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === (elem.ownerDocument || document) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { + event.preventDefault(); + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + try { + elem[ type ](); + } catch ( e ) { + // IE<9 dies on focus/blur to hidden element (#1486,#12518) + // only reproducible on winXP IE8 native, not IE9 in IE8 mode + } + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event ); + + var i, j, ret, matched, handleObj, + handlerQueue = [], + args = core_slice.call( arguments ), + handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( (event.result = ret) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var i, matches, sel, handleObj, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + // Black-hole SVG instance trees (#13180) + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { + + for ( ; cur != this; cur = cur.parentNode || this ) { + + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.disabled !== true || event.type !== "click" ) { + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matches[ sel ] === undefined ) { + matches[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) >= 0 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matches[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, handlers: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( delegateCount < handlers.length ) { + handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); + } + + return handlerQueue; + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, + originalEvent = event, + fixHook = jQuery.event.fixHooks[ event.type ] || {}, + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = new jQuery.Event( originalEvent ); + + i = copy.length; + while ( i-- ) { + prop = copy[ i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Support: IE<9 + // Fix target property (#1925) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Support: Chrome 23+, Safari? + // Target should not be a text node (#504, #13143) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // Support: IE<9 + // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) + event.metaKey = !!event.metaKey; + + return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var eventDoc, doc, body, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + special: { + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + click: { + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { + this.click(); + return false; + } + } + }, + focus: { + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== document.activeElement && this.focus ) { + try { + this.focus(); + return false; + } catch ( e ) { + // Support: IE<9 + // If we error on focus to hidden element (#1486, #12518), + // let .trigger() run the handlers + } + } + }, + delegateType: "focusin" + }, + blur: { + trigger: function() { + if ( this === document.activeElement && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: "focusout" + }, + + beforeunload: { + postDispatch: function( event ) { + + // Even when returnValue equals to undefined Firefox will still show alert + if ( event.result !== undefined ) { + event.originalEvent.returnValue = event.result; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + var name = "on" + type; + + if ( elem.detachEvent ) { + + // #8545, #7054, preventing memory leaks for custom events in IE6-8 + // detachEvent needed property on element, by name of that event, to properly expose it to GC + if ( typeof elem[ name ] === "undefined" ) { + elem[ name ] = null; + } + + elem.detachEvent( name, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + if ( !e ) { + return; + } + + // If preventDefault exists, run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // Support: IE + // Otherwise set the returnValue property of the original event to false + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + if ( !e ) { + return; + } + // If stopPropagation exists, run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + + // Support: IE + // Set the cancelBubble property of the original event to true + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + } +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// IE submit delegation +if ( !jQuery.support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !jQuery._data( form, "submitBubbles" ) ) { + jQuery.event.add( form, "submit._submit", function( event ) { + event._submit_bubble = true; + }); + jQuery._data( form, "submitBubbles", true ); + } + }); + // return undefined since we don't need an event listener + }, + + postDispatch: function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( event._submit_bubble ) { + delete event._submit_bubble; + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + } + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !jQuery.support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + } + // Allow triggered, simulated change events (#11500) + jQuery.event.simulate( "change", this, event, true ); + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + jQuery._data( elem, "changeBubbles", true ); + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return !rformElems.test( this.nodeName ); + } + }; +} + +// Create "bubbling" focus and blur events +if ( !jQuery.support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler while someone wants focusin/focusout + var attaches = 0, + handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + if ( attaches++ === 0 ) { + document.addEventListener( orig, handler, true ); + } + }, + teardown: function() { + if ( --attaches === 0 ) { + document.removeEventListener( orig, handler, true ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, + + delegate: function( selector, types, data, fn ) { + return this.on( types, selector, data, fn ); + }, + undelegate: function( selector, types, fn ) { + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + var elem = this[0]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + }, + + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } +}); + +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; + + if ( rkeyEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; + } + + if ( rmouseEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; + } +}); +/*! + * Sizzle CSS Selector Engine + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license + * http://sizzlejs.com/ + */ +(function( window, undefined ) { + +var i, + cachedruns, + Expr, + getText, + isXML, + compile, + hasDuplicate, + outermostContext, + + // Local document vars + setDocument, + document, + docElem, + documentIsXML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + sortOrder, + + // Instance-specific data + expando = "sizzle" + -(new Date()), + preferredDoc = window.document, + support = {}, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + + // General-purpose constants + strundefined = typeof undefined, + MAX_NEGATIVE = 1 << 31, + + // Array methods + arr = [], + pop = arr.pop, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf if we can't use a native one + indexOf = arr.indexOf || function( elem ) { + var i = 0, + len = this.length; + for ( ; i < len; i++ ) { + if ( this[i] === elem ) { + return i; + } + } + return -1; + }, + + + // Regular expressions + + // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + // http://www.w3.org/TR/css3-syntax/#characters + characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", + + // Loosely modeled on CSS identifier characters + // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors + // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = characterEncoding.replace( "w", "w#" ), + + // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors + operators = "([*^$|!~]?=)", + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", + + // Prefer arguments quoted, + // then not containing pseudos/brackets, + // then attribute selectors/non-parenthetical expressions, + // then anything else + // These preferences are here to reduce the number of selectors + // needing tokenize in the PSEUDO preFilter + pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + characterEncoding + ")" ), + "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), + "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), + "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rsibling = /[\x20\t\r\n\f]*[+~]/, + + rnative = /\{\s*\[native code\]\s*\}/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rescape = /'|\\/g, + rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, + + // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g, + funescape = function( _, escaped ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + return high !== high ? + escaped : + // BMP codepoint + high < 0 ? + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }; + +// Use a stripped-down slice if we can't use a native one +try { + slice.call( docElem.childNodes, 0 )[0].nodeType; +} catch ( e ) { + slice = function( i ) { + var elem, + results = []; + for ( ; (elem = this[i]); i++ ) { + results.push( elem ); + } + return results; + }; +} + +/** + * For feature detection + * @param {Function} fn The function to test for native support + */ +function isNative( fn ) { + return rnative.test( fn + "" ); +} + +/** + * Create key-value caches of limited size + * @returns {Function(string, Object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var cache, + keys = []; + + return (cache = function( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key += " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key ] = value); + }); +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created div and expects a boolean result + */ +function assert( fn ) { + var div = document.createElement("div"); + + try { + return fn( div ); + } catch (e) { + return false; + } finally { + // release memory in IE + div = null; + } +} + +function Sizzle( selector, context, results, seed ) { + var match, elem, m, nodeType, + // QSA vars + i, groups, old, nid, newContext, newSelector; + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + + context = context || document; + results = results || []; + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { + return []; + } + + if ( !documentIsXML && !seed ) { + + // Shortcuts + if ( (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + contains( context, elem ) && elem.id === m ) { + results.push( elem ); + return results; + } + } + + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); + return results; + + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) { + push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); + return results; + } + } + + // QSA path + if ( support.qsa && !rbuggyQSA.test(selector) ) { + old = true; + nid = expando; + newContext = context; + newSelector = nodeType === 9 && selector; + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + groups = tokenize( selector ); + + if ( (old = context.getAttribute("id")) ) { + nid = old.replace( rescape, "\\$&" ); + } else { + context.setAttribute( "id", nid ); + } + nid = "[id='" + nid + "'] "; + + i = groups.length; + while ( i-- ) { + groups[i] = nid + toSelector( groups[i] ); + } + newContext = rsibling.test( selector ) && context.parentNode || context; + newSelector = groups.join(","); + } + + if ( newSelector ) { + try { + push.apply( results, slice.call( newContext.querySelectorAll( + newSelector + ), 0 ) ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute("id"); + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Detect xml + * @param {Element|Object} elem An element or a document + */ +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var doc = node ? node.ownerDocument || node : preferredDoc; + + // If no document and documentElement is available, return + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Set our document + document = doc; + docElem = doc.documentElement; + + // Support tests + documentIsXML = isXML( doc ); + + // Check if getElementsByTagName("*") returns only elements + support.tagNameNoComments = assert(function( div ) { + div.appendChild( doc.createComment("") ); + return !div.getElementsByTagName("*").length; + }); + + // Check if attributes should be retrieved by attribute nodes + support.attributes = assert(function( div ) { + div.innerHTML = ""; + var type = typeof div.lastChild.getAttribute("multiple"); + // IE8 returns a string for some attributes even when not present + return type !== "boolean" && type !== "string"; + }); + + // Check if getElementsByClassName can be trusted + support.getByClassName = assert(function( div ) { + // Opera can't find a second classname (in 9.6) + div.innerHTML = ""; + if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { + return false; + } + + // Safari 3.2 caches class attributes and doesn't catch changes + div.lastChild.className = "e"; + return div.getElementsByClassName("e").length === 2; + }); + + // Check if getElementById returns elements by name + // Check if getElementsByName privileges form controls or returns elements by ID + support.getByName = assert(function( div ) { + // Inject content + div.id = expando + 0; + div.innerHTML = "
      "; + docElem.insertBefore( div, docElem.firstChild ); + + // Test + var pass = doc.getElementsByName && + // buggy browsers will return fewer than the correct 2 + doc.getElementsByName( expando ).length === 2 + + // buggy browsers will return more than the correct 0 + doc.getElementsByName( expando + 0 ).length; + support.getIdNotName = !doc.getElementById( expando ); + + // Cleanup + docElem.removeChild( div ); + + return pass; + }); + + // IE6/7 return modified attributes + Expr.attrHandle = assert(function( div ) { + div.innerHTML = ""; + return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && + div.firstChild.getAttribute("href") === "#"; + }) ? + {} : + { + "href": function( elem ) { + return elem.getAttribute( "href", 2 ); + }, + "type": function( elem ) { + return elem.getAttribute("type"); + } + }; + + // ID find and filter + if ( support.getIdNotName ) { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== strundefined && !documentIsXML ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute("id") === attrId; + }; + }; + } else { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== strundefined && !documentIsXML ) { + var m = context.getElementById( id ); + + return m ? + m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? + [m] : + undefined : + []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); + return node && node.value === attrId; + }; + }; + } + + // Tag + Expr.find["TAG"] = support.tagNameNoComments ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== strundefined ) { + return context.getElementsByTagName( tag ); + } + } : + function( tag, context ) { + var elem, + tmp = [], + i = 0, + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + for ( ; (elem = results[i]); i++ ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Name + Expr.find["NAME"] = support.getByName && function( tag, context ) { + if ( typeof context.getElementsByName !== strundefined ) { + return context.getElementsByName( name ); + } + }; + + // Class + Expr.find["CLASS"] = support.getByClassName && function( className, context ) { + if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) { + return context.getElementsByClassName( className ); + } + }; + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21), + // no need to also add to buggyMatches since matches checks buggyQSA + // A support test would require too much code (would include document ready) + rbuggyQSA = [ ":focus" ]; + + if ( (support.qsa = isNative(doc.querySelectorAll)) ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explictly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + div.innerHTML = ""; + + // IE8 - Some boolean attributes are not treated correctly + if ( !div.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + }); + + assert(function( div ) { + + // Opera 10-12/IE8 - ^= $= *= and empty values + // Should not select anything + div.innerHTML = ""; + if ( div.querySelectorAll("[i^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":enabled").length ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + div.querySelectorAll("*,:x"); + rbuggyQSA.push(",.*:"); + }); + } + + if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector || + docElem.mozMatchesSelector || + docElem.webkitMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector) )) ) { + + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( div, "div" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( div, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + }); + } + + rbuggyQSA = new RegExp( rbuggyQSA.join("|") ); + rbuggyMatches = new RegExp( rbuggyMatches.join("|") ); + + // Element contains another + // Purposefully does not implement inclusive descendent + // As in, an element does not contain itself + contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + // Document order sorting + sortOrder = docElem.compareDocumentPosition ? + function( a, b ) { + var compare; + + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) { + if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) { + if ( a === doc || contains( preferredDoc, a ) ) { + return -1; + } + if ( b === doc || contains( preferredDoc, b ) ) { + return 1; + } + return 0; + } + return compare & 4 ? -1 : 1; + } + + return a.compareDocumentPosition ? -1 : 1; + } : + function( a, b ) { + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // The nodes are identical, we can exit early + if ( a === b ) { + hasDuplicate = true; + return 0; + + // Fallback to using sourceIndex (in IE) if it's available on both nodes + } else if ( a.sourceIndex && b.sourceIndex ) { + return ( ~b.sourceIndex || MAX_NEGATIVE ) - ( contains( preferredDoc, a ) && ~a.sourceIndex || MAX_NEGATIVE ); + + // Parentless nodes are either documents or disconnected + } else if ( !aup || !bup ) { + return a === doc ? -1 : + b === doc ? 1 : + aup ? -1 : + bup ? 1 : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + // Always assume the presence of duplicates if sort doesn't + // pass them to our comparison function (as in Google Chrome). + hasDuplicate = false; + [0, 0].sort( sortOrder ); + support.detectDuplicates = hasDuplicate; + + return document; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + // rbuggyQSA always contains :focus, so no need for an existence check + if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) { + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch(e) {} + } + + return Sizzle( expr, document, null, [elem] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + var val; + + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + if ( !documentIsXML ) { + name = name.toLowerCase(); + } + if ( (val = Expr.attrHandle[ name ]) ) { + return val( elem ); + } + if ( documentIsXML || support.attributes ) { + return elem.getAttribute( name ); + } + return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ? + name : + val && val.specified ? val.value : null; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +// Document sorting and removing duplicates +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + i = 1, + j = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + results.sort( sortOrder ); + + if ( hasDuplicate ) { + for ( ; (elem = results[i]); i++ ) { + if ( elem === results[ i - 1 ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + return results; +}; + +function siblingCheck( a, b ) { + var cur = a && b && a.nextSibling; + + for ( ; cur; cur = cur.nextSibling ) { + if ( cur === b ) { + return -1; + } + } + + return a ? 1 : -1; +} + +// Returns a function to use in pseudos for input types +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +// Returns a function to use in pseudos for buttons +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +// Returns a function to use in pseudos for positionals +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + for ( ; (node = elem[i]); i++ ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (see #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1].slice( 0, 3 ) === "nth" ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[5] && match[2]; + + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[4] ) { + match[2] = match[4]; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeName ) { + if ( nodeName === "*" ) { + return function() { return true; }; + } + + nodeName = nodeName.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.substr( result.length - check.length ) === check : + operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache, outerCache, node, diff, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + // Seek `elem` from a previously-cached index + outerCache = parent[ expando ] || (parent[ expando ] = {}); + cache = outerCache[ type ] || []; + nodeIndex = cache[0] === dirruns && cache[1]; + diff = cache[0] === dirruns && cache[2]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + (diff = nodeIndex = 0) || start.pop()) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + outerCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + // Use previously-cached element index if available + } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { + diff = cache[1]; + + // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) + } else { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || + (diff = nodeIndex = 0) || start.pop()) ) { + + if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { + // Cache the index of each encountered element + if ( useCache ) { + (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf.call( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + // lang value must be a valid identifider + if ( !ridentifier.test(lang || "") ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsXML ? + elem.getAttribute("xml:lang") || elem.getAttribute("lang") : + elem.lang) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), + // not comment, processing instructions, or others + // Thanks to Diego Perini for the nodeName shortcut + // Greater than "@" means alpha characters (specifically not starting with "#" or "?") + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) + // use getAttribute instead to test this case + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); + }, + + // Position-in-collection + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +function tokenize( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( tokens = [] ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push( { + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, " " ) + } ); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + matched = match.shift(); + tokens.push( { + value: matched, + type: type, + matches: match + } ); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +} + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + checkNonElements = base && combinator.dir === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var data, cache, outerCache, + dirkey = dirruns + " " + doneName; + + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { + if ( (data = cache[1]) === true || data === cachedruns ) { + return data === true; + } + } else { + cache = outerCache[ dir ] = [ dirkey ]; + cache[1] = matcher( elem, context, xml ) || cachedruns; + if ( cache[1] === true ) { + return true; + } + } + } + } + } + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf.call( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + // A counter to specify which element is currently being matched + var matcherCachedRuns = 0, + bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, expandContext ) { + var elem, j, matcher, + setMatched = [], + matchedCount = 0, + i = "0", + unmatched = seed && [], + outermost = expandContext != null, + contextBackup = outermostContext, + // We must always have either seed elements or context + elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), + // Nested matchers should use non-integer dirruns + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); + + if ( outermost ) { + outermostContext = context !== document && context; + cachedruns = matcherCachedRuns; + } + + // Add elements passing elementMatchers directly to results + for ( ; (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + for ( j = 0; (matcher = elementMatchers[j]); j++ ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + cachedruns = ++matcherCachedRuns; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // Apply set filters to unmatched elements + // `i` starts as a string, so matchedCount would equal "00" if there are no elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + for ( j = 0; (matcher = setMatchers[j]); j++ ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !group ) { + group = tokenize( selector ); + } + i = group.length; + while ( i-- ) { + cached = matcherFromTokens( group[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + } + return cached; +}; + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function select( selector, context, results, seed ) { + var i, tokens, token, type, find, + match = tokenize( selector ); + + if ( !seed ) { + // Try to minimize operations if there is only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + context.nodeType === 9 && !documentIsXML && + Expr.relative[ tokens[1].type ] ) { + + context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0]; + if ( !context ) { + return results; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + for ( i = matchExpr["needsContext"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && context.parentNode || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, slice.call( seed, 0 ) ); + return results; + } + + break; + } + } + } + } + } + + // Compile and execute a filtering function + // Provide `match` to avoid retokenization if we modified the selector above + compile( selector, match )( + seed, + context, + documentIsXML, + results, + rsibling.test( selector ) + ); + return results; +} + +// Deprecated +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Easy API for creating new setFilters +function setFilters() {} +Expr.filters = setFilters.prototype = Expr.pseudos; +Expr.setFilters = new setFilters(); + +// Initialize with the default document +setDocument(); + +// Override sizzle attribute retrieval +Sizzle.attr = jQuery.attr; +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.pseudos; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + +})( window ); +var runtil = /Until$/, + rparentsprev = /^(?:parents|prev(?:Until|All))/, + isSimple = /^.[^:#\[\.,]*$/, + rneedsContext = jQuery.expr.match.needsContext, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend({ + find: function( selector ) { + var i, ret, self; + + if ( typeof selector !== "string" ) { + self = this; + return this.pushStack( jQuery( selector ).filter(function() { + for ( i = 0; i < self.length; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }) ); + } + + ret = []; + for ( i = 0; i < this.length; i++ ) { + jQuery.find( selector, this[ i ], ret ); + } + + // Needed because $( selector, context ) becomes $( context ).find( selector ) + ret = this.pushStack( jQuery.unique( ret ) ); + ret.selector = ( this.selector ? this.selector + " " : "" ) + selector; + return ret; + }, + + has: function( target ) { + var i, + targets = jQuery( target, this ), + len = targets.length; + + return this.filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + not: function( selector ) { + return this.pushStack( winnow(this, selector, false) ); + }, + + filter: function( selector ) { + return this.pushStack( winnow(this, selector, true) ); + }, + + is: function( selector ) { + return !!selector && ( + typeof selector === "string" ? + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + rneedsContext.test( selector ) ? + jQuery( selector, this.context ).index( this[0] ) >= 0 : + jQuery.filter( selector, this ).length > 0 : + this.filter( selector ).length > 0 ); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + ret = [], + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( ; i < l; i++ ) { + cur = this[i]; + + while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { + ret.push( cur ); + break; + } + cur = cur.parentNode; + } + } + + return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + var set = typeof selector === "string" ? + jQuery( selector, context ) : + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), + all = jQuery.merge( this.get(), set ); + + return this.pushStack( jQuery.unique(all) ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter(selector) + ); + } +}); + +jQuery.fn.andSelf = jQuery.fn.addBack; + +function sibling( cur, dir ) { + do { + cur = cur[ dir ]; + } while ( cur && cur.nodeType !== 1 ); + + return cur; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( !runtil.test( name ) ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; + + if ( this.length > 1 && rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + + return this.pushStack( ret ); + }; +}); + +jQuery.extend({ + filter: function( expr, elems, not ) { + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 ? + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : + jQuery.find.matches(expr, elems); + }, + + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, keep ) { + + // Can't pass null or undefined to indexOf in Firefox 4 + // Set to 0 to skip string check + qualifier = qualifier || 0; + + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep(elements, function( elem, i ) { + var retVal = !!qualifier.call( elem, i, elem ); + return retVal === keep; + }); + + } else if ( qualifier.nodeType ) { + return jQuery.grep(elements, function( elem ) { + return ( elem === qualifier ) === keep; + }); + + } else if ( typeof qualifier === "string" ) { + var filtered = jQuery.grep(elements, function( elem ) { + return elem.nodeType === 1; + }); + + if ( isSimple.test( qualifier ) ) { + return jQuery.filter(qualifier, filtered, !keep); + } else { + qualifier = jQuery.filter( qualifier, filtered ); + } + } + + return jQuery.grep(elements, function( elem ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; + }); +} +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, + rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + rtagName = /<([\w:]+)/, + rtbody = /\s*$/g, + + // We have to close these tags to support XHTML (#13200) + wrapMap = { + option: [ 1, "" ], + legend: [ 1, "
      ", "
      " ], + area: [ 1, "", "" ], + param: [ 1, "", "" ], + thead: [ 1, "", "
      " ], + tr: [ 2, "", "
      " ], + col: [ 2, "", "
      " ], + td: [ 3, "", "
      " ], + + // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, + // unless wrapped in a div with non-breaking characters in front of it. + _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
      ", "
      " ] + }, + safeFragment = createSafeFragment( document ), + fragmentDiv = safeFragment.appendChild( document.createElement("div") ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +jQuery.fn.extend({ + text: function( value ) { + return jQuery.access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); + }, null, value, arguments.length ); + }, + + wrapAll: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapAll( html.call(this, i) ); + }); + } + + if ( this[0] ) { + // The elements to wrap the target around + var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); + + if ( this[0].parentNode ) { + wrap.insertBefore( this[0] ); + } + + wrap.map(function() { + var elem = this; + + while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { + elem = elem.firstChild; + } + + return elem; + }).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapInner( html.call(this, i) ); + }); + } + + return this.each(function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + }); + }, + + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); + + return this.each(function(i) { + jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); + }); + }, + + unwrap: function() { + return this.parent().each(function() { + if ( !jQuery.nodeName( this, "body" ) ) { + jQuery( this ).replaceWith( this.childNodes ); + } + }).end(); + }, + + append: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.insertBefore( elem, this.firstChild ); + } + }); + }, + + before: function() { + return this.domManip( arguments, false, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + }); + }, + + after: function() { + return this.domManip( arguments, false, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + }); + }, + + // keepData is for internal use only--do not document + remove: function( selector, keepData ) { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) { + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem ) ); + } + + if ( elem.parentNode ) { + if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { + setGlobalEval( getAll( elem, "script" ) ); + } + elem.parentNode.removeChild( elem ); + } + } + } + + return this; + }, + + empty: function() { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + } + + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + + // If this is a select, ensure that it displays empty (#12336) + // Support: IE<9 + if ( elem.options && jQuery.nodeName( elem, "select" ) ) { + elem.options.length = 0; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function () { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, + + html: function( value ) { + return jQuery.access( this, function( value ) { + var elem = this[0] || {}, + i = 0, + l = this.length; + + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, "" ) : + undefined; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && + ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && + !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, "<$1>" ); + + try { + for (; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + elem = this[i] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch(e) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function( value ) { + var isFunc = jQuery.isFunction( value ); + + // Make sure that the elements are removed from the DOM before they are inserted + // this can help fix replacing a parent with child elements + if ( !isFunc && typeof value !== "string" ) { + value = jQuery( value ).not( this ).detach(); + } + + return this.domManip( [ value ], true, function( elem ) { + var next = this.nextSibling, + parent = this.parentNode; + + if ( parent && this.nodeType === 1 || this.nodeType === 11 ) { + + jQuery( this ).remove(); + + if ( next ) { + next.parentNode.insertBefore( elem, next ); + } else { + parent.appendChild( elem ); + } + } + }); + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, table, callback ) { + + // Flatten any nested arrays + args = core_concat.apply( [], args ); + + var fragment, first, scripts, hasScripts, node, doc, + i = 0, + l = this.length, + set = this, + iNoClone = l - 1, + value = args[0], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { + return this.each(function( index ) { + var self = set.eq( index ); + if ( isFunction ) { + args[0] = value.call( this, index, table ? self.html() : undefined ); + } + self.domManip( args, table, callback ); + }); + } + + if ( l ) { + fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + if ( first ) { + table = table && jQuery.nodeName( first, "tr" ); + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( + table && jQuery.nodeName( this[i], "table" ) ? + findOrAppend( this[i], "tbody" ) : + this[i], + node, + i + ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { + + if ( node.src ) { + // Hope ajax is available... + jQuery.ajax({ + url: node.src, + type: "GET", + dataType: "script", + async: false, + global: false, + "throws": true + }); + } else { + jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); + } + } + } + } + + // Fix #11809: Avoid leaking memory + fragment = first = null; + } + } + + return this; + } +}); + +function findOrAppend( elem, tag ) { + return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + var attr = elem.getAttributeNode("type"); + elem.type = ( attr && attr.specified ) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + if ( match ) { + elem.type = match[1]; + } else { + elem.removeAttribute("type"); + } + return elem; +} + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var elem, + i = 0; + for ( ; (elem = elems[i]) != null; i++ ) { + jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); + } +} + +function cloneCopyEvent( src, dest ) { + + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; + + if ( events ) { + delete curData.handle; + curData.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } +} + +function fixCloneNodeIssues( src, dest ) { + var nodeName, data, e; + + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + nodeName = dest.nodeName.toLowerCase(); + + // IE6-8 copies events bound via attachEvent when using cloneNode. + if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { + data = jQuery._data( dest ); + + for ( e in data.events ) { + jQuery.removeEvent( dest, e, data.handle ); + } + + // Event data gets referenced instead of copied if the expando gets copied too + dest.removeAttribute( jQuery.expando ); + } + + // IE blanks contents when cloning scripts, and tries to evaluate newly-set text + if ( nodeName === "script" && dest.text !== src.text ) { + disableScript( dest ).text = src.text; + restoreScript( dest ); + + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + } else if ( nodeName === "object" ) { + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; + } + + // This path appears unavoidable for IE9. When cloning an object + // element in IE9, the outerHTML strategy above is not sufficient. + // If the src has innerHTML and the destination does not, + // copy the src.innerHTML into the dest.innerHTML. #10324 + if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { + dest.innerHTML = src.innerHTML; + } + + } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set + + dest.defaultChecked = dest.checked = src.checked; + + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; + } + + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === "option" ) { + dest.defaultSelected = dest.selected = src.defaultSelected; + + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + i = 0, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone(true); + jQuery( insert[i] )[ original ]( elems ); + + // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() + core_push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +}); + +function getAll( context, tag ) { + var elems, elem, + i = 0, + found = typeof context.getElementsByTagName !== "undefined" ? context.getElementsByTagName( tag || "*" ) : + typeof context.querySelectorAll !== "undefined" ? context.querySelectorAll( tag || "*" ) : + undefined; + + if ( !found ) { + for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { + if ( !tag || jQuery.nodeName( elem, tag ) ) { + found.push( elem ); + } else { + jQuery.merge( found, getAll( elem, tag ) ); + } + } + } + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], found ) : + found; +} + +// Used in buildFragment, fixes the defaultChecked property +function fixDefaultChecked( elem ) { + if ( manipulation_rcheckableType.test( elem.type ) ) { + elem.defaultChecked = elem.checked; + } +} + +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var destElements, srcElements, node, i, clone, + inPage = jQuery.contains( elem.ownerDocument, elem ); + + if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { + clone = elem.cloneNode( true ); + + // IE<=8 does not properly clone detached, unknown element nodes + } else { + fragmentDiv.innerHTML = elem.outerHTML; + fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + } + + if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { + + // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + // Fix all IE cloning issues + for ( i = 0; (node = srcElements[i]) != null; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + fixCloneNodeIssues( node, destElements[i] ); + } + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0; (node = srcElements[i]) != null; i++ ) { + cloneCopyEvent( node, destElements[i] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + destElements = srcElements = node = null; + + // Return the cloned set + return clone; + }, + + buildFragment: function( elems, context, scripts, selection ) { + var contains, elem, tag, tmp, wrap, tbody, j, + l = elems.length, + + // Ensure a safe fragment + safe = createSafeFragment( context ), + + nodes = [], + i = 0; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || safe.appendChild( context.createElement("div") ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + + tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; + + // Descend through wrappers to the right content + j = wrap[0]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Manually add leading whitespace removed by IE + if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); + } + + // Remove IE's autoinserted from table fragments + if ( !jQuery.support.tbody ) { + + // String was a , *may* have spurious + elem = tag === "table" && !rtbody.test( elem ) ? + tmp.firstChild : + + // String was a bare or + wrap[1] === "
      " && !rtbody.test( elem ) ? + tmp : + 0; + + j = elem && elem.childNodes.length; + while ( j-- ) { + if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { + elem.removeChild( tbody ); + } + } + } + + jQuery.merge( nodes, tmp.childNodes ); + + // Fix #12392 for WebKit and IE > 9 + tmp.textContent = ""; + + // Fix #12392 for oldIE + while ( tmp.firstChild ) { + tmp.removeChild( tmp.firstChild ); + } + + // Remember the top-level container for proper cleanup + tmp = safe.lastChild; + } + } + } + + // Fix #11356: Clear elements from fragment + if ( tmp ) { + safe.removeChild( tmp ); + } + + // Reset defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + if ( !jQuery.support.appendChecked ) { + jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); + } + + i = 0; + while ( (elem = nodes[ i++ ]) ) { + + // #4087 - If origin and destination elements are the same, and this is + // that element, do not do anything + if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( safe.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( (elem = tmp[ j++ ]) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + tmp = null; + + return safe; + }, + + cleanData: function( elems, /* internal */ acceptData ) { + var data, id, elem, type, + i = 0, + internalKey = jQuery.expando, + cache = jQuery.cache, + deleteExpando = jQuery.support.deleteExpando, + special = jQuery.event.special; + + for ( ; (elem = elems[i]) != null; i++ ) { + + if ( acceptData || jQuery.acceptData( elem ) ) { + + id = elem[ internalKey ]; + data = id && cache[ id ]; + + if ( data ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Remove cache only if it was not already removed by jQuery.event.remove + if ( cache[ id ] ) { + + delete cache[ id ]; + + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( deleteExpando ) { + delete elem[ internalKey ]; + + } else if ( typeof elem.removeAttribute !== "undefined" ) { + elem.removeAttribute( internalKey ); + + } else { + elem[ internalKey ] = null; + } + + core_deletedIds.push( id ); + } + } + } + } + } +}); +var curCSS, getStyles, iframe, + ralpha = /alpha\([^)]*\)/i, + ropacity = /opacity\s*=\s*([^)]*)/, + rposition = /^(top|right|bottom|left)$/, + // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" + // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + rmargin = /^margin/, + rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), + rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), + rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), + elemdisplay = { BODY: "block" }, + + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: 0, + fontWeight: 400 + }, + + cssExpand = [ "Top", "Right", "Bottom", "Left" ], + cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; + +// return a css property mapped to a potentially vendor prefixed property +function vendorPropName( style, name ) { + + // shortcut for names that are not vendor prefixed + if ( name in style ) { + return name; + } + + // check for vendor prefixed names + var capName = name.charAt(0).toUpperCase() + name.slice(1), + origName = name, + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in style ) { + return name; + } + } + + return origName; +} + +function isHidden( elem, el ) { + // isHidden might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); +} + +function showHide( elements, show ) { + var elem, + values = [], + index = 0, + length = elements.length; + + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + values[ index ] = jQuery._data( elem, "olddisplay" ); + if ( show ) { + // Reset the inline display of this element to learn if it is + // being hidden by cascaded rules or not + if ( !values[ index ] && elem.style.display === "none" ) { + elem.style.display = ""; + } + + // Set elements which have been overridden with display: none + // in a stylesheet to whatever the default browser style is + // for such an element + if ( elem.style.display === "" && isHidden( elem ) ) { + values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); + } + } else if ( !values[ index ] && !isHidden( elem ) ) { + jQuery._data( elem, "olddisplay", jQuery.css( elem, "display" ) ); + } + } + + // Set the display of most of the elements in a second loop + // to avoid the constant reflow + for ( index = 0; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + if ( !show || elem.style.display === "none" || elem.style.display === "" ) { + elem.style.display = show ? values[ index ] || "" : "none"; + } + } + + return elements; +} + +jQuery.fn.extend({ + css: function( name, value ) { + return jQuery.access( this, function( elem, name, value ) { + var styles, len, + map = {}, + i = 0; + + if ( jQuery.isArray( name ) ) { + styles = getStyles( elem ); + len = name.length; + + for ( ; i < len; i++ ) { + map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); + } + + return map; + } + + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + }, + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state ) { + var bool = typeof state === "boolean"; + + return this.each(function() { + if ( bool ? state : isHidden( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + }); + } +}); + +jQuery.extend({ + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + } + } + } + }, + + // Exclude the following css properties to add px + cssNumber: { + "columnCount": true, + "fillOpacity": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + // normalize float css property + "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" + }, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, hooks, + origName = jQuery.camelCase( name ), + style = elem.style; + + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // convert relative number strings (+= or -=) to relative numbers. #7345 + if ( type === "string" && (ret = rrelNum.exec( value )) ) { + value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); + // Fixes bug #9237 + type = "number"; + } + + // Make sure that NaN and null values aren't set. See: #7116 + if ( value == null || type === "number" && isNaN( value ) ) { + return; + } + + // If a number was passed in, add 'px' to the (except for certain CSS properties) + if ( type === "number" && !jQuery.cssNumber[ origName ] ) { + value += "px"; + } + + // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, + // but it would mean to define eight (for every problematic property) identical functions + if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { + style[ name ] = "inherit"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { + + // Wrapped to prevent IE from throwing errors when 'invalid' values are provided + // Fixes bug #5509 + try { + style[ name ] = value; + } catch(e) {} + } + + } else { + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, extra, styles ) { + var val, num, hooks, + origName = jQuery.camelCase( name ); + + // Make sure that we're working with the right name + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name, styles ); + } + + //convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Return, converting to number if forced or a qualifier was provided and val looks numeric + if ( extra ) { + num = parseFloat( val ); + return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; + } + return val; + }, + + // A method for quickly swapping in/out CSS properties to get correct calculations + swap: function( elem, options, callback, args ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.apply( elem, args || [] ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; + } +}); + +// NOTE: we've included the "window" in window.getComputedStyle +// because jsdom on node.js will break without it. +if ( window.getComputedStyle ) { + getStyles = function( elem ) { + return window.getComputedStyle( elem, null ); + }; + + curCSS = function( elem, name, _computed ) { + var width, minWidth, maxWidth, + computed = _computed || getStyles( elem ), + + // getPropertyValue is only needed for .css('filter') in IE9, see #12537 + ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, + style = elem.style; + + if ( computed ) { + + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right + // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels + // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values + if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { + + // Remember the original values + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + // Put in the new values to get a computed value out + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + // Revert the changed values + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret; + }; +} else if ( document.documentElement.currentStyle ) { + getStyles = function( elem ) { + return elem.currentStyle; + }; + + curCSS = function( elem, name, _computed ) { + var left, rs, rsLeft, + computed = _computed || getStyles( elem ), + ret = computed ? computed[ name ] : undefined, + style = elem.style; + + // Avoid setting ret to empty string here + // so we don't default to auto + if ( ret == null && style && style[ name ] ) { + ret = style[ name ]; + } + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + // but not position css attributes, as those are proportional to the parent element instead + // and we can't measure the parent instead because it might trigger a "stacking dolls" problem + if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { + + // Remember the original values + left = style.left; + rs = elem.runtimeStyle; + rsLeft = rs && rs.left; + + // Put in the new values to get a computed value out + if ( rsLeft ) { + rs.left = elem.currentStyle.left; + } + style.left = name === "fontSize" ? "1em" : ret; + ret = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + if ( rsLeft ) { + rs.left = rsLeft; + } + } + + return ret === "" ? "auto" : ret; + }; +} + +function setPositiveNumber( elem, value, subtract ) { + var matches = rnumsplit.exec( value ); + return matches ? + // Guard against undefined "subtract", e.g., when used as in cssHooks + Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : + value; +} + +function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { + var i = extra === ( isBorderBox ? "border" : "content" ) ? + // If we already have the right measurement, avoid augmentation + 4 : + // Otherwise initialize for horizontal or vertical properties + name === "width" ? 1 : 0, + + val = 0; + + for ( ; i < 4; i += 2 ) { + // both box models exclude margin, so add it if we want it + if ( extra === "margin" ) { + val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); + } + + if ( isBorderBox ) { + // border-box includes padding, so remove it if we want content + if ( extra === "content" ) { + val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + } + + // at this point, extra isn't border nor margin, so remove border + if ( extra !== "margin" ) { + val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } else { + // at this point, extra isn't content, so add padding + val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + + // at this point, extra isn't content nor padding, so add border + if ( extra !== "padding" ) { + val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } + } + + return val; +} + +function getWidthOrHeight( elem, name, extra ) { + + // Start with offset property, which is equivalent to the border-box value + var valueIsBorderBox = true, + val = name === "width" ? elem.offsetWidth : elem.offsetHeight, + styles = getStyles( elem ), + isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + + // some non-html elements return undefined for offsetWidth, so check for null/undefined + // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 + // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 + if ( val <= 0 || val == null ) { + // Fall back to computed then uncomputed css if necessary + val = curCSS( elem, name, styles ); + if ( val < 0 || val == null ) { + val = elem.style[ name ]; + } + + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test(val) ) { + return val; + } + + // we need the check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable elem.style + valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); + + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + } + + // use the active box-sizing model to add/subtract irrelevant styles + return ( val + + augmentWidthOrHeight( + elem, + name, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox, + styles + ) + ) + "px"; +} + +// Try to determine the default display value of an element +function css_defaultDisplay( nodeName ) { + var doc = document, + display = elemdisplay[ nodeName ]; + + if ( !display ) { + display = actualDisplay( nodeName, doc ); + + // If the simple way fails, read from inside an iframe + if ( display === "none" || !display ) { + // Use the already-created iframe if possible + iframe = ( iframe || + jQuery("' : ''); + inst._keyEvent = false; + return html; + }, + + /* Generate the month and year header. */ + _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, + secondary, monthNames, monthNamesShort) { + var changeMonth = this._get(inst, 'changeMonth'); + var changeYear = this._get(inst, 'changeYear'); + var showMonthAfterYear = this._get(inst, 'showMonthAfterYear'); + var html = '
      '; + var monthHtml = ''; + // month selection + if (secondary || !changeMonth) + monthHtml += '' + monthNames[drawMonth] + ''; + else { + var inMinYear = (minDate && minDate.getFullYear() == drawYear); + var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); + monthHtml += ''; + } + if (!showMonthAfterYear) + html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : ''); + // year selection + if ( !inst.yearshtml ) { + inst.yearshtml = ''; + if (secondary || !changeYear) + html += '' + drawYear + ''; + else { + // determine range of years to display + var years = this._get(inst, 'yearRange').split(':'); + var thisYear = new Date().getFullYear(); + var determineYear = function(value) { + var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) : + (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) : + parseInt(value, 10))); + return (isNaN(year) ? thisYear : year); + }; + var year = determineYear(years[0]); + var endYear = Math.max(year, determineYear(years[1] || '')); + year = (minDate ? Math.max(year, minDate.getFullYear()) : year); + endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); + inst.yearshtml += ''; + + html += inst.yearshtml; + inst.yearshtml = null; + } + } + html += this._get(inst, 'yearSuffix'); + if (showMonthAfterYear) + html += (secondary || !(changeMonth && changeYear) ? ' ' : '') + monthHtml; + html += '
      '; // Close datepicker_header + return html; + }, + + /* Adjust one of the date sub-fields. */ + _adjustInstDate: function(inst, offset, period) { + var year = inst.drawYear + (period == 'Y' ? offset : 0); + var month = inst.drawMonth + (period == 'M' ? offset : 0); + var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + + (period == 'D' ? offset : 0); + var date = this._restrictMinMax(inst, + this._daylightSavingAdjust(new Date(year, month, day))); + inst.selectedDay = date.getDate(); + inst.drawMonth = inst.selectedMonth = date.getMonth(); + inst.drawYear = inst.selectedYear = date.getFullYear(); + if (period == 'M' || period == 'Y') + this._notifyChange(inst); + }, + + /* Ensure a date is within any min/max bounds. */ + _restrictMinMax: function(inst, date) { + var minDate = this._getMinMaxDate(inst, 'min'); + var maxDate = this._getMinMaxDate(inst, 'max'); + var newDate = (minDate && date < minDate ? minDate : date); + newDate = (maxDate && newDate > maxDate ? maxDate : newDate); + return newDate; + }, + + /* Notify change of month/year. */ + _notifyChange: function(inst) { + var onChange = this._get(inst, 'onChangeMonthYear'); + if (onChange) + onChange.apply((inst.input ? inst.input[0] : null), + [inst.selectedYear, inst.selectedMonth + 1, inst]); + }, + + /* Determine the number of months to show. */ + _getNumberOfMonths: function(inst) { + var numMonths = this._get(inst, 'numberOfMonths'); + return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths)); + }, + + /* Determine the current maximum date - ensure no time components are set. */ + _getMinMaxDate: function(inst, minMax) { + return this._determineDate(inst, this._get(inst, minMax + 'Date'), null); + }, + + /* Find the number of days in a given month. */ + _getDaysInMonth: function(year, month) { + return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); + }, + + /* Find the day of the week of the first of a month. */ + _getFirstDayOfMonth: function(year, month) { + return new Date(year, month, 1).getDay(); + }, + + /* Determines if we should allow a "next/prev" month display change. */ + _canAdjustMonth: function(inst, offset, curYear, curMonth) { + var numMonths = this._getNumberOfMonths(inst); + var date = this._daylightSavingAdjust(new Date(curYear, + curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); + if (offset < 0) + date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); + return this._isInRange(inst, date); + }, + + /* Is the given date in the accepted range? */ + _isInRange: function(inst, date) { + var minDate = this._getMinMaxDate(inst, 'min'); + var maxDate = this._getMinMaxDate(inst, 'max'); + return ((!minDate || date.getTime() >= minDate.getTime()) && + (!maxDate || date.getTime() <= maxDate.getTime())); + }, + + /* Provide the configuration settings for formatting/parsing. */ + _getFormatConfig: function(inst) { + var shortYearCutoff = this._get(inst, 'shortYearCutoff'); + shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : + new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); + return {shortYearCutoff: shortYearCutoff, + dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'), + monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')}; + }, + + /* Format the given date for display. */ + _formatDate: function(inst, day, month, year) { + if (!day) { + inst.currentDay = inst.selectedDay; + inst.currentMonth = inst.selectedMonth; + inst.currentYear = inst.selectedYear; + } + var date = (day ? (typeof day == 'object' ? day : + this._daylightSavingAdjust(new Date(year, month, day))) : + this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); + return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst)); + } +}); + +/* + * Bind hover events for datepicker elements. + * Done via delegate so the binding only occurs once in the lifetime of the parent div. + * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. + */ +function bindHover(dpDiv) { + var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a'; + return dpDiv.delegate(selector, 'mouseout', function() { + $(this).removeClass('ui-state-hover'); + if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover'); + if (this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover'); + }) + .delegate(selector, 'mouseover', function(){ + if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) { + $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); + $(this).addClass('ui-state-hover'); + if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover'); + if (this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover'); + } + }); +} + +/* jQuery extend now ignores nulls! */ +function extendRemove(target, props) { + $.extend(target, props); + for (var name in props) + if (props[name] == null || props[name] == undefined) + target[name] = props[name]; + return target; +}; + +/* Invoke the datepicker functionality. + @param options string - a command, optionally followed by additional parameters or + Object - settings for attaching new datepicker functionality + @return jQuery object */ +$.fn.datepicker = function(options){ + + /* Verify an empty collection wasn't passed - Fixes #6976 */ + if ( !this.length ) { + return this; + } + + /* Initialise the date picker. */ + if (!$.datepicker.initialized) { + $(document).mousedown($.datepicker._checkExternalClick). + find(document.body).append($.datepicker.dpDiv); + $.datepicker.initialized = true; + } + + var otherArgs = Array.prototype.slice.call(arguments, 1); + if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget')) + return $.datepicker['_' + options + 'Datepicker']. + apply($.datepicker, [this[0]].concat(otherArgs)); + if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string') + return $.datepicker['_' + options + 'Datepicker']. + apply($.datepicker, [this[0]].concat(otherArgs)); + return this.each(function() { + typeof options == 'string' ? + $.datepicker['_' + options + 'Datepicker']. + apply($.datepicker, [this].concat(otherArgs)) : + $.datepicker._attachDatepicker(this, options); + }); +}; + +$.datepicker = new Datepicker(); // singleton instance +$.datepicker.initialized = false; +$.datepicker.uuid = new Date().getTime(); +$.datepicker.version = "1.9.2"; + +// Workaround for #4055 +// Add another global to avoid noConflict issues with inline event handlers +window['DP_jQuery_' + dpuuid] = $; + +})(jQuery); +(function( $, undefined ) { + +var uiDialogClasses = "ui-dialog ui-widget ui-widget-content ui-corner-all ", + sizeRelatedOptions = { + buttons: true, + height: true, + maxHeight: true, + maxWidth: true, + minHeight: true, + minWidth: true, + width: true + }, + resizableRelatedOptions = { + maxHeight: true, + maxWidth: true, + minHeight: true, + minWidth: true + }; + +$.widget("ui.dialog", { + version: "1.9.2", + options: { + autoOpen: true, + buttons: {}, + closeOnEscape: true, + closeText: "close", + dialogClass: "", + draggable: true, + hide: null, + height: "auto", + maxHeight: false, + maxWidth: false, + minHeight: 150, + minWidth: 150, + modal: false, + position: { + my: "center", + at: "center", + of: window, + collision: "fit", + // ensure that the titlebar is never outside the document + using: function( pos ) { + var topOffset = $( this ).css( pos ).offset().top; + if ( topOffset < 0 ) { + $( this ).css( "top", pos.top - topOffset ); + } + } + }, + resizable: true, + show: null, + stack: true, + title: "", + width: 300, + zIndex: 1000 + }, + + _create: function() { + this.originalTitle = this.element.attr( "title" ); + // #5742 - .attr() might return a DOMElement + if ( typeof this.originalTitle !== "string" ) { + this.originalTitle = ""; + } + this.oldPosition = { + parent: this.element.parent(), + index: this.element.parent().children().index( this.element ) + }; + this.options.title = this.options.title || this.originalTitle; + var that = this, + options = this.options, + + title = options.title || " ", + uiDialog, + uiDialogTitlebar, + uiDialogTitlebarClose, + uiDialogTitle, + uiDialogButtonPane; + + uiDialog = ( this.uiDialog = $( "
      " ) ) + .addClass( uiDialogClasses + options.dialogClass ) + .css({ + display: "none", + outline: 0, // TODO: move to stylesheet + zIndex: options.zIndex + }) + // setting tabIndex makes the div focusable + .attr( "tabIndex", -1) + .keydown(function( event ) { + if ( options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && + event.keyCode === $.ui.keyCode.ESCAPE ) { + that.close( event ); + event.preventDefault(); + } + }) + .mousedown(function( event ) { + that.moveToTop( false, event ); + }) + .appendTo( "body" ); + + this.element + .show() + .removeAttr( "title" ) + .addClass( "ui-dialog-content ui-widget-content" ) + .appendTo( uiDialog ); + + uiDialogTitlebar = ( this.uiDialogTitlebar = $( "
      " ) ) + .addClass( "ui-dialog-titlebar ui-widget-header " + + "ui-corner-all ui-helper-clearfix" ) + .bind( "mousedown", function() { + // Dialog isn't getting focus when dragging (#8063) + uiDialog.focus(); + }) + .prependTo( uiDialog ); + + uiDialogTitlebarClose = $( "" ) + .addClass( "ui-dialog-titlebar-close ui-corner-all" ) + .attr( "role", "button" ) + .click(function( event ) { + event.preventDefault(); + that.close( event ); + }) + .appendTo( uiDialogTitlebar ); + + ( this.uiDialogTitlebarCloseText = $( "" ) ) + .addClass( "ui-icon ui-icon-closethick" ) + .text( options.closeText ) + .appendTo( uiDialogTitlebarClose ); + + uiDialogTitle = $( "" ) + .uniqueId() + .addClass( "ui-dialog-title" ) + .html( title ) + .prependTo( uiDialogTitlebar ); + + uiDialogButtonPane = ( this.uiDialogButtonPane = $( "
      " ) ) + .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" ); + + ( this.uiButtonSet = $( "
      " ) ) + .addClass( "ui-dialog-buttonset" ) + .appendTo( uiDialogButtonPane ); + + uiDialog.attr({ + role: "dialog", + "aria-labelledby": uiDialogTitle.attr( "id" ) + }); + + uiDialogTitlebar.find( "*" ).add( uiDialogTitlebar ).disableSelection(); + this._hoverable( uiDialogTitlebarClose ); + this._focusable( uiDialogTitlebarClose ); + + if ( options.draggable && $.fn.draggable ) { + this._makeDraggable(); + } + if ( options.resizable && $.fn.resizable ) { + this._makeResizable(); + } + + this._createButtons( options.buttons ); + this._isOpen = false; + + if ( $.fn.bgiframe ) { + uiDialog.bgiframe(); + } + + // prevent tabbing out of modal dialogs + this._on( uiDialog, { keydown: function( event ) { + if ( !options.modal || event.keyCode !== $.ui.keyCode.TAB ) { + return; + } + + var tabbables = $( ":tabbable", uiDialog ), + first = tabbables.filter( ":first" ), + last = tabbables.filter( ":last" ); + + if ( event.target === last[0] && !event.shiftKey ) { + first.focus( 1 ); + return false; + } else if ( event.target === first[0] && event.shiftKey ) { + last.focus( 1 ); + return false; + } + }}); + }, + + _init: function() { + if ( this.options.autoOpen ) { + this.open(); + } + }, + + _destroy: function() { + var next, + oldPosition = this.oldPosition; + + if ( this.overlay ) { + this.overlay.destroy(); + } + this.uiDialog.hide(); + this.element + .removeClass( "ui-dialog-content ui-widget-content" ) + .hide() + .appendTo( "body" ); + this.uiDialog.remove(); + + if ( this.originalTitle ) { + this.element.attr( "title", this.originalTitle ); + } + + next = oldPosition.parent.children().eq( oldPosition.index ); + // Don't try to place the dialog next to itself (#8613) + if ( next.length && next[ 0 ] !== this.element[ 0 ] ) { + next.before( this.element ); + } else { + oldPosition.parent.append( this.element ); + } + }, + + widget: function() { + return this.uiDialog; + }, + + close: function( event ) { + var that = this, + maxZ, thisZ; + + if ( !this._isOpen ) { + return; + } + + if ( false === this._trigger( "beforeClose", event ) ) { + return; + } + + this._isOpen = false; + + if ( this.overlay ) { + this.overlay.destroy(); + } + + if ( this.options.hide ) { + this._hide( this.uiDialog, this.options.hide, function() { + that._trigger( "close", event ); + }); + } else { + this.uiDialog.hide(); + this._trigger( "close", event ); + } + + $.ui.dialog.overlay.resize(); + + // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) + if ( this.options.modal ) { + maxZ = 0; + $( ".ui-dialog" ).each(function() { + if ( this !== that.uiDialog[0] ) { + thisZ = $( this ).css( "z-index" ); + if ( !isNaN( thisZ ) ) { + maxZ = Math.max( maxZ, thisZ ); + } + } + }); + $.ui.dialog.maxZ = maxZ; + } + + return this; + }, + + isOpen: function() { + return this._isOpen; + }, + + // the force parameter allows us to move modal dialogs to their correct + // position on open + moveToTop: function( force, event ) { + var options = this.options, + saveScroll; + + if ( ( options.modal && !force ) || + ( !options.stack && !options.modal ) ) { + return this._trigger( "focus", event ); + } + + if ( options.zIndex > $.ui.dialog.maxZ ) { + $.ui.dialog.maxZ = options.zIndex; + } + if ( this.overlay ) { + $.ui.dialog.maxZ += 1; + $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ; + this.overlay.$el.css( "z-index", $.ui.dialog.overlay.maxZ ); + } + + // Save and then restore scroll + // Opera 9.5+ resets when parent z-index is changed. + // http://bugs.jqueryui.com/ticket/3193 + saveScroll = { + scrollTop: this.element.scrollTop(), + scrollLeft: this.element.scrollLeft() + }; + $.ui.dialog.maxZ += 1; + this.uiDialog.css( "z-index", $.ui.dialog.maxZ ); + this.element.attr( saveScroll ); + this._trigger( "focus", event ); + + return this; + }, + + open: function() { + if ( this._isOpen ) { + return; + } + + var hasFocus, + options = this.options, + uiDialog = this.uiDialog; + + this._size(); + this._position( options.position ); + uiDialog.show( options.show ); + this.overlay = options.modal ? new $.ui.dialog.overlay( this ) : null; + this.moveToTop( true ); + + // set focus to the first tabbable element in the content area or the first button + // if there are no tabbable elements, set focus on the dialog itself + hasFocus = this.element.find( ":tabbable" ); + if ( !hasFocus.length ) { + hasFocus = this.uiDialogButtonPane.find( ":tabbable" ); + if ( !hasFocus.length ) { + hasFocus = uiDialog; + } + } + hasFocus.eq( 0 ).focus(); + + this._isOpen = true; + this._trigger( "open" ); + + return this; + }, + + _createButtons: function( buttons ) { + var that = this, + hasButtons = false; + + // if we already have a button pane, remove it + this.uiDialogButtonPane.remove(); + this.uiButtonSet.empty(); + + if ( typeof buttons === "object" && buttons !== null ) { + $.each( buttons, function() { + return !(hasButtons = true); + }); + } + if ( hasButtons ) { + $.each( buttons, function( name, props ) { + var button, click; + props = $.isFunction( props ) ? + { click: props, text: name } : + props; + // Default to a non-submitting button + props = $.extend( { type: "button" }, props ); + // Change the context for the click callback to be the main element + click = props.click; + props.click = function() { + click.apply( that.element[0], arguments ); + }; + button = $( "", props ) + .appendTo( that.uiButtonSet ); + if ( $.fn.button ) { + button.button(); + } + }); + this.uiDialog.addClass( "ui-dialog-buttons" ); + this.uiDialogButtonPane.appendTo( this.uiDialog ); + } else { + this.uiDialog.removeClass( "ui-dialog-buttons" ); + } + }, + + _makeDraggable: function() { + var that = this, + options = this.options; + + function filteredUi( ui ) { + return { + position: ui.position, + offset: ui.offset + }; + } + + this.uiDialog.draggable({ + cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", + handle: ".ui-dialog-titlebar", + containment: "document", + start: function( event, ui ) { + $( this ) + .addClass( "ui-dialog-dragging" ); + that._trigger( "dragStart", event, filteredUi( ui ) ); + }, + drag: function( event, ui ) { + that._trigger( "drag", event, filteredUi( ui ) ); + }, + stop: function( event, ui ) { + options.position = [ + ui.position.left - that.document.scrollLeft(), + ui.position.top - that.document.scrollTop() + ]; + $( this ) + .removeClass( "ui-dialog-dragging" ); + that._trigger( "dragStop", event, filteredUi( ui ) ); + $.ui.dialog.overlay.resize(); + } + }); + }, + + _makeResizable: function( handles ) { + handles = (handles === undefined ? this.options.resizable : handles); + var that = this, + options = this.options, + // .ui-resizable has position: relative defined in the stylesheet + // but dialogs have to use absolute or fixed positioning + position = this.uiDialog.css( "position" ), + resizeHandles = typeof handles === 'string' ? + handles : + "n,e,s,w,se,sw,ne,nw"; + + function filteredUi( ui ) { + return { + originalPosition: ui.originalPosition, + originalSize: ui.originalSize, + position: ui.position, + size: ui.size + }; + } + + this.uiDialog.resizable({ + cancel: ".ui-dialog-content", + containment: "document", + alsoResize: this.element, + maxWidth: options.maxWidth, + maxHeight: options.maxHeight, + minWidth: options.minWidth, + minHeight: this._minHeight(), + handles: resizeHandles, + start: function( event, ui ) { + $( this ).addClass( "ui-dialog-resizing" ); + that._trigger( "resizeStart", event, filteredUi( ui ) ); + }, + resize: function( event, ui ) { + that._trigger( "resize", event, filteredUi( ui ) ); + }, + stop: function( event, ui ) { + $( this ).removeClass( "ui-dialog-resizing" ); + options.height = $( this ).height(); + options.width = $( this ).width(); + that._trigger( "resizeStop", event, filteredUi( ui ) ); + $.ui.dialog.overlay.resize(); + } + }) + .css( "position", position ) + .find( ".ui-resizable-se" ) + .addClass( "ui-icon ui-icon-grip-diagonal-se" ); + }, + + _minHeight: function() { + var options = this.options; + + if ( options.height === "auto" ) { + return options.minHeight; + } else { + return Math.min( options.minHeight, options.height ); + } + }, + + _position: function( position ) { + var myAt = [], + offset = [ 0, 0 ], + isVisible; + + if ( position ) { + // deep extending converts arrays to objects in jQuery <= 1.3.2 :-( + // if (typeof position == 'string' || $.isArray(position)) { + // myAt = $.isArray(position) ? position : position.split(' '); + + if ( typeof position === "string" || (typeof position === "object" && "0" in position ) ) { + myAt = position.split ? position.split( " " ) : [ position[ 0 ], position[ 1 ] ]; + if ( myAt.length === 1 ) { + myAt[ 1 ] = myAt[ 0 ]; + } + + $.each( [ "left", "top" ], function( i, offsetPosition ) { + if ( +myAt[ i ] === myAt[ i ] ) { + offset[ i ] = myAt[ i ]; + myAt[ i ] = offsetPosition; + } + }); + + position = { + my: myAt[0] + (offset[0] < 0 ? offset[0] : "+" + offset[0]) + " " + + myAt[1] + (offset[1] < 0 ? offset[1] : "+" + offset[1]), + at: myAt.join( " " ) + }; + } + + position = $.extend( {}, $.ui.dialog.prototype.options.position, position ); + } else { + position = $.ui.dialog.prototype.options.position; + } + + // need to show the dialog to get the actual offset in the position plugin + isVisible = this.uiDialog.is( ":visible" ); + if ( !isVisible ) { + this.uiDialog.show(); + } + this.uiDialog.position( position ); + if ( !isVisible ) { + this.uiDialog.hide(); + } + }, + + _setOptions: function( options ) { + var that = this, + resizableOptions = {}, + resize = false; + + $.each( options, function( key, value ) { + that._setOption( key, value ); + + if ( key in sizeRelatedOptions ) { + resize = true; + } + if ( key in resizableRelatedOptions ) { + resizableOptions[ key ] = value; + } + }); + + if ( resize ) { + this._size(); + } + if ( this.uiDialog.is( ":data(resizable)" ) ) { + this.uiDialog.resizable( "option", resizableOptions ); + } + }, + + _setOption: function( key, value ) { + var isDraggable, isResizable, + uiDialog = this.uiDialog; + + switch ( key ) { + case "buttons": + this._createButtons( value ); + break; + case "closeText": + // ensure that we always pass a string + this.uiDialogTitlebarCloseText.text( "" + value ); + break; + case "dialogClass": + uiDialog + .removeClass( this.options.dialogClass ) + .addClass( uiDialogClasses + value ); + break; + case "disabled": + if ( value ) { + uiDialog.addClass( "ui-dialog-disabled" ); + } else { + uiDialog.removeClass( "ui-dialog-disabled" ); + } + break; + case "draggable": + isDraggable = uiDialog.is( ":data(draggable)" ); + if ( isDraggable && !value ) { + uiDialog.draggable( "destroy" ); + } + + if ( !isDraggable && value ) { + this._makeDraggable(); + } + break; + case "position": + this._position( value ); + break; + case "resizable": + // currently resizable, becoming non-resizable + isResizable = uiDialog.is( ":data(resizable)" ); + if ( isResizable && !value ) { + uiDialog.resizable( "destroy" ); + } + + // currently resizable, changing handles + if ( isResizable && typeof value === "string" ) { + uiDialog.resizable( "option", "handles", value ); + } + + // currently non-resizable, becoming resizable + if ( !isResizable && value !== false ) { + this._makeResizable( value ); + } + break; + case "title": + // convert whatever was passed in o a string, for html() to not throw up + $( ".ui-dialog-title", this.uiDialogTitlebar ) + .html( "" + ( value || " " ) ); + break; + } + + this._super( key, value ); + }, + + _size: function() { + /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content + * divs will both have width and height set, so we need to reset them + */ + var nonContentHeight, minContentHeight, autoHeight, + options = this.options, + isVisible = this.uiDialog.is( ":visible" ); + + // reset content sizing + this.element.show().css({ + width: "auto", + minHeight: 0, + height: 0 + }); + + if ( options.minWidth > options.width ) { + options.width = options.minWidth; + } + + // reset wrapper sizing + // determine the height of all the non-content elements + nonContentHeight = this.uiDialog.css({ + height: "auto", + width: options.width + }) + .outerHeight(); + minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); + + if ( options.height === "auto" ) { + // only needed for IE6 support + if ( $.support.minHeight ) { + this.element.css({ + minHeight: minContentHeight, + height: "auto" + }); + } else { + this.uiDialog.show(); + autoHeight = this.element.css( "height", "auto" ).height(); + if ( !isVisible ) { + this.uiDialog.hide(); + } + this.element.height( Math.max( autoHeight, minContentHeight ) ); + } + } else { + this.element.height( Math.max( options.height - nonContentHeight, 0 ) ); + } + + if (this.uiDialog.is( ":data(resizable)" ) ) { + this.uiDialog.resizable( "option", "minHeight", this._minHeight() ); + } + } +}); + +$.extend($.ui.dialog, { + uuid: 0, + maxZ: 0, + + getTitleId: function($el) { + var id = $el.attr( "id" ); + if ( !id ) { + this.uuid += 1; + id = this.uuid; + } + return "ui-dialog-title-" + id; + }, + + overlay: function( dialog ) { + this.$el = $.ui.dialog.overlay.create( dialog ); + } +}); + +$.extend( $.ui.dialog.overlay, { + instances: [], + // reuse old instances due to IE memory leak with alpha transparency (see #5185) + oldInstances: [], + maxZ: 0, + events: $.map( + "focus,mousedown,mouseup,keydown,keypress,click".split( "," ), + function( event ) { + return event + ".dialog-overlay"; + } + ).join( " " ), + create: function( dialog ) { + if ( this.instances.length === 0 ) { + // prevent use of anchors and inputs + // we use a setTimeout in case the overlay is created from an + // event that we're going to be cancelling (see #2804) + setTimeout(function() { + // handle $(el).dialog().dialog('close') (see #4065) + if ( $.ui.dialog.overlay.instances.length ) { + $( document ).bind( $.ui.dialog.overlay.events, function( event ) { + // stop events if the z-index of the target is < the z-index of the overlay + // we cannot return true when we don't want to cancel the event (#3523) + if ( $( event.target ).zIndex() < $.ui.dialog.overlay.maxZ ) { + return false; + } + }); + } + }, 1 ); + + // handle window resize + $( window ).bind( "resize.dialog-overlay", $.ui.dialog.overlay.resize ); + } + + var $el = ( this.oldInstances.pop() || $( "
      " ).addClass( "ui-widget-overlay" ) ); + + // allow closing by pressing the escape key + $( document ).bind( "keydown.dialog-overlay", function( event ) { + var instances = $.ui.dialog.overlay.instances; + // only react to the event if we're the top overlay + if ( instances.length !== 0 && instances[ instances.length - 1 ] === $el && + dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && + event.keyCode === $.ui.keyCode.ESCAPE ) { + + dialog.close( event ); + event.preventDefault(); + } + }); + + $el.appendTo( document.body ).css({ + width: this.width(), + height: this.height() + }); + + if ( $.fn.bgiframe ) { + $el.bgiframe(); + } + + this.instances.push( $el ); + return $el; + }, + + destroy: function( $el ) { + var indexOf = $.inArray( $el, this.instances ), + maxZ = 0; + + if ( indexOf !== -1 ) { + this.oldInstances.push( this.instances.splice( indexOf, 1 )[ 0 ] ); + } + + if ( this.instances.length === 0 ) { + $( [ document, window ] ).unbind( ".dialog-overlay" ); + } + + $el.height( 0 ).width( 0 ).remove(); + + // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) + $.each( this.instances, function() { + maxZ = Math.max( maxZ, this.css( "z-index" ) ); + }); + this.maxZ = maxZ; + }, + + height: function() { + var scrollHeight, + offsetHeight; + // handle IE + if ( $.ui.ie ) { + scrollHeight = Math.max( + document.documentElement.scrollHeight, + document.body.scrollHeight + ); + offsetHeight = Math.max( + document.documentElement.offsetHeight, + document.body.offsetHeight + ); + + if ( scrollHeight < offsetHeight ) { + return $( window ).height() + "px"; + } else { + return scrollHeight + "px"; + } + // handle "good" browsers + } else { + return $( document ).height() + "px"; + } + }, + + width: function() { + var scrollWidth, + offsetWidth; + // handle IE + if ( $.ui.ie ) { + scrollWidth = Math.max( + document.documentElement.scrollWidth, + document.body.scrollWidth + ); + offsetWidth = Math.max( + document.documentElement.offsetWidth, + document.body.offsetWidth + ); + + if ( scrollWidth < offsetWidth ) { + return $( window ).width() + "px"; + } else { + return scrollWidth + "px"; + } + // handle "good" browsers + } else { + return $( document ).width() + "px"; + } + }, + + resize: function() { + /* If the dialog is draggable and the user drags it past the + * right edge of the window, the document becomes wider so we + * need to stretch the overlay. If the user then drags the + * dialog back to the left, the document will become narrower, + * so we need to shrink the overlay to the appropriate size. + * This is handled by shrinking the overlay before setting it + * to the full document size. + */ + var $overlays = $( [] ); + $.each( $.ui.dialog.overlay.instances, function() { + $overlays = $overlays.add( this ); + }); + + $overlays.css({ + width: 0, + height: 0 + }).css({ + width: $.ui.dialog.overlay.width(), + height: $.ui.dialog.overlay.height() + }); + } +}); + +$.extend( $.ui.dialog.overlay.prototype, { + destroy: function() { + $.ui.dialog.overlay.destroy( this.$el ); + } +}); + +}( jQuery ) ); +(function( $, undefined ) { + +$.widget("ui.draggable", $.ui.mouse, { + version: "1.9.2", + widgetEventPrefix: "drag", + options: { + addClasses: true, + appendTo: "parent", + axis: false, + connectToSortable: false, + containment: false, + cursor: "auto", + cursorAt: false, + grid: false, + handle: false, + helper: "original", + iframeFix: false, + opacity: false, + refreshPositions: false, + revert: false, + revertDuration: 500, + scope: "default", + scroll: true, + scrollSensitivity: 20, + scrollSpeed: 20, + snap: false, + snapMode: "both", + snapTolerance: 20, + stack: false, + zIndex: false + }, + _create: function() { + + if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position"))) + this.element[0].style.position = 'relative'; + + (this.options.addClasses && this.element.addClass("ui-draggable")); + (this.options.disabled && this.element.addClass("ui-draggable-disabled")); + + this._mouseInit(); + + }, + + _destroy: function() { + this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" ); + this._mouseDestroy(); + }, + + _mouseCapture: function(event) { + + var o = this.options; + + // among others, prevent a drag on a resizable-handle + if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle')) + return false; + + //Quit if we're not on a valid handle + this.handle = this._getHandle(event); + if (!this.handle) + return false; + + $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { + $('
      ') + .css({ + width: this.offsetWidth+"px", height: this.offsetHeight+"px", + position: "absolute", opacity: "0.001", zIndex: 1000 + }) + .css($(this).offset()) + .appendTo("body"); + }); + + return true; + + }, + + _mouseStart: function(event) { + + var o = this.options; + + //Create and append the visible helper + this.helper = this._createHelper(event); + + this.helper.addClass("ui-draggable-dragging"); + + //Cache the helper size + this._cacheHelperProportions(); + + //If ddmanager is used for droppables, set the global draggable + if($.ui.ddmanager) + $.ui.ddmanager.current = this; + + /* + * - Position generation - + * This block generates everything position related - it's the core of draggables. + */ + + //Cache the margins of the original element + this._cacheMargins(); + + //Store the helper's css position + this.cssPosition = this.helper.css("position"); + this.scrollParent = this.helper.scrollParent(); + + //The element's absolute position on the page minus margins + this.offset = this.positionAbs = this.element.offset(); + this.offset = { + top: this.offset.top - this.margins.top, + left: this.offset.left - this.margins.left + }; + + $.extend(this.offset, { + click: { //Where the click happened, relative to the element + left: event.pageX - this.offset.left, + top: event.pageY - this.offset.top + }, + parent: this._getParentOffset(), + relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper + }); + + //Generate the original position + this.originalPosition = this.position = this._generatePosition(event); + this.originalPageX = event.pageX; + this.originalPageY = event.pageY; + + //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied + (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); + + //Set a containment if given in the options + if(o.containment) + this._setContainment(); + + //Trigger event + callbacks + if(this._trigger("start", event) === false) { + this._clear(); + return false; + } + + //Recache the helper size + this._cacheHelperProportions(); + + //Prepare the droppable offsets + if ($.ui.ddmanager && !o.dropBehaviour) + $.ui.ddmanager.prepareOffsets(this, event); + + + this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position + + //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003) + if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event); + + return true; + }, + + _mouseDrag: function(event, noPropagation) { + + //Compute the helpers position + this.position = this._generatePosition(event); + this.positionAbs = this._convertPositionTo("absolute"); + + //Call plugins and callbacks and use the resulting position if something is returned + if (!noPropagation) { + var ui = this._uiHash(); + if(this._trigger('drag', event, ui) === false) { + this._mouseUp({}); + return false; + } + this.position = ui.position; + } + + if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; + if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; + if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); + + return false; + }, + + _mouseStop: function(event) { + + //If we are using droppables, inform the manager about the drop + var dropped = false; + if ($.ui.ddmanager && !this.options.dropBehaviour) + dropped = $.ui.ddmanager.drop(this, event); + + //if a drop comes from outside (a sortable) + if(this.dropped) { + dropped = this.dropped; + this.dropped = false; + } + + //if the original element is no longer in the DOM don't bother to continue (see #8269) + var element = this.element[0], elementInDom = false; + while ( element && (element = element.parentNode) ) { + if (element == document ) { + elementInDom = true; + } + } + if ( !elementInDom && this.options.helper === "original" ) + return false; + + if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { + var that = this; + $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { + if(that._trigger("stop", event) !== false) { + that._clear(); + } + }); + } else { + if(this._trigger("stop", event) !== false) { + this._clear(); + } + } + + return false; + }, + + _mouseUp: function(event) { + //Remove frame helpers + $("div.ui-draggable-iframeFix").each(function() { + this.parentNode.removeChild(this); + }); + + //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) + if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event); + + return $.ui.mouse.prototype._mouseUp.call(this, event); + }, + + cancel: function() { + + if(this.helper.is(".ui-draggable-dragging")) { + this._mouseUp({}); + } else { + this._clear(); + } + + return this; + + }, + + _getHandle: function(event) { + + var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false; + $(this.options.handle, this.element) + .find("*") + .andSelf() + .each(function() { + if(this == event.target) handle = true; + }); + + return handle; + + }, + + _createHelper: function(event) { + + var o = this.options; + var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element); + + if(!helper.parents('body').length) + helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo)); + + if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) + helper.css("position", "absolute"); + + return helper; + + }, + + _adjustOffsetFromHelper: function(obj) { + if (typeof obj == 'string') { + obj = obj.split(' '); + } + if ($.isArray(obj)) { + obj = {left: +obj[0], top: +obj[1] || 0}; + } + if ('left' in obj) { + this.offset.click.left = obj.left + this.margins.left; + } + if ('right' in obj) { + this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; + } + if ('top' in obj) { + this.offset.click.top = obj.top + this.margins.top; + } + if ('bottom' in obj) { + this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; + } + }, + + _getParentOffset: function() { + + //Get the offsetParent and cache its position + this.offsetParent = this.helper.offsetParent(); + var po = this.offsetParent.offset(); + + // This is a special case where we need to modify a offset calculated on start, since the following happened: + // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent + // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that + // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag + if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) { + po.left += this.scrollParent.scrollLeft(); + po.top += this.scrollParent.scrollTop(); + } + + if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information + || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix + po = { top: 0, left: 0 }; + + return { + top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), + left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) + }; + + }, + + _getRelativeOffset: function() { + + if(this.cssPosition == "relative") { + var p = this.element.position(); + return { + top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), + left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() + }; + } else { + return { top: 0, left: 0 }; + } + + }, + + _cacheMargins: function() { + this.margins = { + left: (parseInt(this.element.css("marginLeft"),10) || 0), + top: (parseInt(this.element.css("marginTop"),10) || 0), + right: (parseInt(this.element.css("marginRight"),10) || 0), + bottom: (parseInt(this.element.css("marginBottom"),10) || 0) + }; + }, + + _cacheHelperProportions: function() { + this.helperProportions = { + width: this.helper.outerWidth(), + height: this.helper.outerHeight() + }; + }, + + _setContainment: function() { + + var o = this.options; + if(o.containment == 'parent') o.containment = this.helper[0].parentNode; + if(o.containment == 'document' || o.containment == 'window') this.containment = [ + o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, + o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, + (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, + (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top + ]; + + if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) { + var c = $(o.containment); + var ce = c[0]; if(!ce) return; + var co = c.offset(); + var over = ($(ce).css("overflow") != 'hidden'); + + this.containment = [ + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0), + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0), + (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right, + (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom + ]; + this.relative_container = c; + + } else if(o.containment.constructor == Array) { + this.containment = o.containment; + } + + }, + + _convertPositionTo: function(d, pos) { + + if(!pos) pos = this.position; + var mod = d == "absolute" ? 1 : -1; + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + + return { + top: ( + pos.top // The absolute mouse position + + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent + + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) + - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) + ), + left: ( + pos.left // The absolute mouse position + + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent + + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) + - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) + ) + }; + + }, + + _generatePosition: function(event) { + + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + var pageX = event.pageX; + var pageY = event.pageY; + + /* + * - Position constraining - + * Constrain the position to a mix of grid, containment. + */ + + if(this.originalPosition) { //If we are not dragging yet, we won't check for options + var containment; + if(this.containment) { + if (this.relative_container){ + var co = this.relative_container.offset(); + containment = [ this.containment[0] + co.left, + this.containment[1] + co.top, + this.containment[2] + co.left, + this.containment[3] + co.top ]; + } + else { + containment = this.containment; + } + + if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left; + if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top; + if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left; + if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top; + } + + if(o.grid) { + //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950) + var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; + pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; + + var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX; + pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; + } + + } + + return { + top: ( + pageY // The absolute mouse position + - this.offset.click.top // Click offset (relative to the element) + - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent + - this.offset.parent.top // The offsetParent's offset without borders (offset + border) + + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) + ), + left: ( + pageX // The absolute mouse position + - this.offset.click.left // Click offset (relative to the element) + - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent + - this.offset.parent.left // The offsetParent's offset without borders (offset + border) + + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) + ) + }; + + }, + + _clear: function() { + this.helper.removeClass("ui-draggable-dragging"); + if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove(); + //if($.ui.ddmanager) $.ui.ddmanager.current = null; + this.helper = null; + this.cancelHelperRemoval = false; + }, + + // From now on bulk stuff - mainly helpers + + _trigger: function(type, event, ui) { + ui = ui || this._uiHash(); + $.ui.plugin.call(this, type, [event, ui]); + if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins + return $.Widget.prototype._trigger.call(this, type, event, ui); + }, + + plugins: {}, + + _uiHash: function(event) { + return { + helper: this.helper, + position: this.position, + originalPosition: this.originalPosition, + offset: this.positionAbs + }; + } + +}); + +$.ui.plugin.add("draggable", "connectToSortable", { + start: function(event, ui) { + + var inst = $(this).data("draggable"), o = inst.options, + uiSortable = $.extend({}, ui, { item: inst.element }); + inst.sortables = []; + $(o.connectToSortable).each(function() { + var sortable = $.data(this, 'sortable'); + if (sortable && !sortable.options.disabled) { + inst.sortables.push({ + instance: sortable, + shouldRevert: sortable.options.revert + }); + sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page). + sortable._trigger("activate", event, uiSortable); + } + }); + + }, + stop: function(event, ui) { + + //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper + var inst = $(this).data("draggable"), + uiSortable = $.extend({}, ui, { item: inst.element }); + + $.each(inst.sortables, function() { + if(this.instance.isOver) { + + this.instance.isOver = 0; + + inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance + this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) + + //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid' + if(this.shouldRevert) this.instance.options.revert = true; + + //Trigger the stop of the sortable + this.instance._mouseStop(event); + + this.instance.options.helper = this.instance.options._helper; + + //If the helper has been the original item, restore properties in the sortable + if(inst.options.helper == 'original') + this.instance.currentItem.css({ top: 'auto', left: 'auto' }); + + } else { + this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance + this.instance._trigger("deactivate", event, uiSortable); + } + + }); + + }, + drag: function(event, ui) { + + var inst = $(this).data("draggable"), that = this; + + var checkPos = function(o) { + var dyClick = this.offset.click.top, dxClick = this.offset.click.left; + var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left; + var itemHeight = o.height, itemWidth = o.width; + var itemTop = o.top, itemLeft = o.left; + + return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth); + }; + + $.each(inst.sortables, function(i) { + + var innermostIntersecting = false; + var thisSortable = this; + //Copy over some variables to allow calling the sortable's native _intersectsWith + this.instance.positionAbs = inst.positionAbs; + this.instance.helperProportions = inst.helperProportions; + this.instance.offset.click = inst.offset.click; + + if(this.instance._intersectsWith(this.instance.containerCache)) { + innermostIntersecting = true; + $.each(inst.sortables, function () { + this.instance.positionAbs = inst.positionAbs; + this.instance.helperProportions = inst.helperProportions; + this.instance.offset.click = inst.offset.click; + if (this != thisSortable + && this.instance._intersectsWith(this.instance.containerCache) + && $.ui.contains(thisSortable.instance.element[0], this.instance.element[0])) + innermostIntersecting = false; + return innermostIntersecting; + }); + } + + + if(innermostIntersecting) { + //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once + if(!this.instance.isOver) { + + this.instance.isOver = 1; + //Now we fake the start of dragging for the sortable instance, + //by cloning the list group item, appending it to the sortable and using it as inst.currentItem + //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one) + this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true); + this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it + this.instance.options.helper = function() { return ui.helper[0]; }; + + event.target = this.instance.currentItem[0]; + this.instance._mouseCapture(event, true); + this.instance._mouseStart(event, true, true); + + //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes + this.instance.offset.click.top = inst.offset.click.top; + this.instance.offset.click.left = inst.offset.click.left; + this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left; + this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top; + + inst._trigger("toSortable", event); + inst.dropped = this.instance.element; //draggable revert needs that + //hack so receive/update callbacks work (mostly) + inst.currentItem = inst.element; + this.instance.fromOutside = inst; + + } + + //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable + if(this.instance.currentItem) this.instance._mouseDrag(event); + + } else { + + //If it doesn't intersect with the sortable, and it intersected before, + //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval + if(this.instance.isOver) { + + this.instance.isOver = 0; + this.instance.cancelHelperRemoval = true; + + //Prevent reverting on this forced stop + this.instance.options.revert = false; + + // The out event needs to be triggered independently + this.instance._trigger('out', event, this.instance._uiHash(this.instance)); + + this.instance._mouseStop(event, true); + this.instance.options.helper = this.instance.options._helper; + + //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size + this.instance.currentItem.remove(); + if(this.instance.placeholder) this.instance.placeholder.remove(); + + inst._trigger("fromSortable", event); + inst.dropped = false; //draggable revert needs that + } + + }; + + }); + + } +}); + +$.ui.plugin.add("draggable", "cursor", { + start: function(event, ui) { + var t = $('body'), o = $(this).data('draggable').options; + if (t.css("cursor")) o._cursor = t.css("cursor"); + t.css("cursor", o.cursor); + }, + stop: function(event, ui) { + var o = $(this).data('draggable').options; + if (o._cursor) $('body').css("cursor", o._cursor); + } +}); + +$.ui.plugin.add("draggable", "opacity", { + start: function(event, ui) { + var t = $(ui.helper), o = $(this).data('draggable').options; + if(t.css("opacity")) o._opacity = t.css("opacity"); + t.css('opacity', o.opacity); + }, + stop: function(event, ui) { + var o = $(this).data('draggable').options; + if(o._opacity) $(ui.helper).css('opacity', o._opacity); + } +}); + +$.ui.plugin.add("draggable", "scroll", { + start: function(event, ui) { + var i = $(this).data("draggable"); + if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset(); + }, + drag: function(event, ui) { + + var i = $(this).data("draggable"), o = i.options, scrolled = false; + + if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') { + + if(!o.axis || o.axis != 'x') { + if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) + i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed; + else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) + i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed; + } + + if(!o.axis || o.axis != 'y') { + if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) + i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed; + else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) + i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed; + } + + } else { + + if(!o.axis || o.axis != 'x') { + if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) + scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); + else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) + scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); + } + + if(!o.axis || o.axis != 'y') { + if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) + scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); + else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) + scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); + } + + } + + if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) + $.ui.ddmanager.prepareOffsets(i, event); + + } +}); + +$.ui.plugin.add("draggable", "snap", { + start: function(event, ui) { + + var i = $(this).data("draggable"), o = i.options; + i.snapElements = []; + + $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() { + var $t = $(this); var $o = $t.offset(); + if(this != i.element[0]) i.snapElements.push({ + item: this, + width: $t.outerWidth(), height: $t.outerHeight(), + top: $o.top, left: $o.left + }); + }); + + }, + drag: function(event, ui) { + + var inst = $(this).data("draggable"), o = inst.options; + var d = o.snapTolerance; + + var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, + y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; + + for (var i = inst.snapElements.length - 1; i >= 0; i--){ + + var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width, + t = inst.snapElements[i].top, b = t + inst.snapElements[i].height; + + //Yes, I know, this is insane ;) + if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) { + if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); + inst.snapElements[i].snapping = false; + continue; + } + + if(o.snapMode != 'inner') { + var ts = Math.abs(t - y2) <= d; + var bs = Math.abs(b - y1) <= d; + var ls = Math.abs(l - x2) <= d; + var rs = Math.abs(r - x1) <= d; + if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top; + if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top; + if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left; + if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left; + } + + var first = (ts || bs || ls || rs); + + if(o.snapMode != 'outer') { + var ts = Math.abs(t - y1) <= d; + var bs = Math.abs(b - y2) <= d; + var ls = Math.abs(l - x1) <= d; + var rs = Math.abs(r - x2) <= d; + if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top; + if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top; + if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left; + if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left; + } + + if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) + (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); + inst.snapElements[i].snapping = (ts || bs || ls || rs || first); + + }; + + } +}); + +$.ui.plugin.add("draggable", "stack", { + start: function(event, ui) { + + var o = $(this).data("draggable").options; + + var group = $.makeArray($(o.stack)).sort(function(a,b) { + return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0); + }); + if (!group.length) { return; } + + var min = parseInt(group[0].style.zIndex) || 0; + $(group).each(function(i) { + this.style.zIndex = min + i; + }); + + this[0].style.zIndex = min + group.length; + + } +}); + +$.ui.plugin.add("draggable", "zIndex", { + start: function(event, ui) { + var t = $(ui.helper), o = $(this).data("draggable").options; + if(t.css("zIndex")) o._zIndex = t.css("zIndex"); + t.css('zIndex', o.zIndex); + }, + stop: function(event, ui) { + var o = $(this).data("draggable").options; + if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex); + } +}); + +})(jQuery); +(function( $, undefined ) { + +$.widget("ui.droppable", { + version: "1.9.2", + widgetEventPrefix: "drop", + options: { + accept: '*', + activeClass: false, + addClasses: true, + greedy: false, + hoverClass: false, + scope: 'default', + tolerance: 'intersect' + }, + _create: function() { + + var o = this.options, accept = o.accept; + this.isover = 0; this.isout = 1; + + this.accept = $.isFunction(accept) ? accept : function(d) { + return d.is(accept); + }; + + //Store the droppable's proportions + this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight }; + + // Add the reference and positions to the manager + $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || []; + $.ui.ddmanager.droppables[o.scope].push(this); + + (o.addClasses && this.element.addClass("ui-droppable")); + + }, + + _destroy: function() { + var drop = $.ui.ddmanager.droppables[this.options.scope]; + for ( var i = 0; i < drop.length; i++ ) + if ( drop[i] == this ) + drop.splice(i, 1); + + this.element.removeClass("ui-droppable ui-droppable-disabled"); + }, + + _setOption: function(key, value) { + + if(key == 'accept') { + this.accept = $.isFunction(value) ? value : function(d) { + return d.is(value); + }; + } + $.Widget.prototype._setOption.apply(this, arguments); + }, + + _activate: function(event) { + var draggable = $.ui.ddmanager.current; + if(this.options.activeClass) this.element.addClass(this.options.activeClass); + (draggable && this._trigger('activate', event, this.ui(draggable))); + }, + + _deactivate: function(event) { + var draggable = $.ui.ddmanager.current; + if(this.options.activeClass) this.element.removeClass(this.options.activeClass); + (draggable && this._trigger('deactivate', event, this.ui(draggable))); + }, + + _over: function(event) { + + var draggable = $.ui.ddmanager.current; + if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element + + if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { + if(this.options.hoverClass) this.element.addClass(this.options.hoverClass); + this._trigger('over', event, this.ui(draggable)); + } + + }, + + _out: function(event) { + + var draggable = $.ui.ddmanager.current; + if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element + + if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { + if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); + this._trigger('out', event, this.ui(draggable)); + } + + }, + + _drop: function(event,custom) { + + var draggable = custom || $.ui.ddmanager.current; + if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element + + var childrenIntersection = false; + this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() { + var inst = $.data(this, 'droppable'); + if( + inst.options.greedy + && !inst.options.disabled + && inst.options.scope == draggable.options.scope + && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) + && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance) + ) { childrenIntersection = true; return false; } + }); + if(childrenIntersection) return false; + + if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { + if(this.options.activeClass) this.element.removeClass(this.options.activeClass); + if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); + this._trigger('drop', event, this.ui(draggable)); + return this.element; + } + + return false; + + }, + + ui: function(c) { + return { + draggable: (c.currentItem || c.element), + helper: c.helper, + position: c.position, + offset: c.positionAbs + }; + } + +}); + +$.ui.intersect = function(draggable, droppable, toleranceMode) { + + if (!droppable.offset) return false; + + var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width, + y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height; + var l = droppable.offset.left, r = l + droppable.proportions.width, + t = droppable.offset.top, b = t + droppable.proportions.height; + + switch (toleranceMode) { + case 'fit': + return (l <= x1 && x2 <= r + && t <= y1 && y2 <= b); + break; + case 'intersect': + return (l < x1 + (draggable.helperProportions.width / 2) // Right Half + && x2 - (draggable.helperProportions.width / 2) < r // Left Half + && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half + && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half + break; + case 'pointer': + var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left), + draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top), + isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width); + return isOver; + break; + case 'touch': + return ( + (y1 >= t && y1 <= b) || // Top edge touching + (y2 >= t && y2 <= b) || // Bottom edge touching + (y1 < t && y2 > b) // Surrounded vertically + ) && ( + (x1 >= l && x1 <= r) || // Left edge touching + (x2 >= l && x2 <= r) || // Right edge touching + (x1 < l && x2 > r) // Surrounded horizontally + ); + break; + default: + return false; + break; + } + +}; + +/* + This manager tracks offsets of draggables and droppables +*/ +$.ui.ddmanager = { + current: null, + droppables: { 'default': [] }, + prepareOffsets: function(t, event) { + + var m = $.ui.ddmanager.droppables[t.options.scope] || []; + var type = event ? event.type : null; // workaround for #2317 + var list = (t.currentItem || t.element).find(":data(droppable)").andSelf(); + + droppablesLoop: for (var i = 0; i < m.length; i++) { + + if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted + for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item + m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue + + if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables + + m[i].offset = m[i].element.offset(); + m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }; + + } + + }, + drop: function(draggable, event) { + + var dropped = false; + $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { + + if(!this.options) return; + if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) + dropped = this._drop.call(this, event) || dropped; + + if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { + this.isout = 1; this.isover = 0; + this._deactivate.call(this, event); + } + + }); + return dropped; + + }, + dragStart: function( draggable, event ) { + //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003) + draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() { + if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); + }); + }, + drag: function(draggable, event) { + + //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. + if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event); + + //Run through all droppables and check their positions based on specific tolerance options + $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { + + if(this.options.disabled || this.greedyChild || !this.visible) return; + var intersects = $.ui.intersect(draggable, this, this.options.tolerance); + + var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null); + if(!c) return; + + var parentInstance; + if (this.options.greedy) { + // find droppable parents with same scope + var scope = this.options.scope; + var parent = this.element.parents(':data(droppable)').filter(function () { + return $.data(this, 'droppable').options.scope === scope; + }); + + if (parent.length) { + parentInstance = $.data(parent[0], 'droppable'); + parentInstance.greedyChild = (c == 'isover' ? 1 : 0); + } + } + + // we just moved into a greedy child + if (parentInstance && c == 'isover') { + parentInstance['isover'] = 0; + parentInstance['isout'] = 1; + parentInstance._out.call(parentInstance, event); + } + + this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0; + this[c == "isover" ? "_over" : "_out"].call(this, event); + + // we just moved out of a greedy child + if (parentInstance && c == 'isout') { + parentInstance['isout'] = 0; + parentInstance['isover'] = 1; + parentInstance._over.call(parentInstance, event); + } + }); + + }, + dragStop: function( draggable, event ) { + draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" ); + //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003) + if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); + } +}; + +})(jQuery); +;(jQuery.effects || (function($, undefined) { + +var backCompat = $.uiBackCompat !== false, + // prefix used for storing data on .data() + dataSpace = "ui-effects-"; + +$.effects = { + effect: {} +}; + +/*! + * jQuery Color Animations v2.0.0 + * http://jquery.com/ + * + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + * + * Date: Mon Aug 13 13:41:02 2012 -0500 + */ +(function( jQuery, undefined ) { + + var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor".split(" "), + + // plusequals test for += 100 -= 100 + rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, + // a set of RE's that can match strings and generate color tuples. + stringParsers = [{ + re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, + parse: function( execResult ) { + return [ + execResult[ 1 ], + execResult[ 2 ], + execResult[ 3 ], + execResult[ 4 ] + ]; + } + }, { + re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, + parse: function( execResult ) { + return [ + execResult[ 1 ] * 2.55, + execResult[ 2 ] * 2.55, + execResult[ 3 ] * 2.55, + execResult[ 4 ] + ]; + } + }, { + // this regex ignores A-F because it's compared against an already lowercased string + re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, + parse: function( execResult ) { + return [ + parseInt( execResult[ 1 ], 16 ), + parseInt( execResult[ 2 ], 16 ), + parseInt( execResult[ 3 ], 16 ) + ]; + } + }, { + // this regex ignores A-F because it's compared against an already lowercased string + re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, + parse: function( execResult ) { + return [ + parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), + parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), + parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ) + ]; + } + }, { + re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, + space: "hsla", + parse: function( execResult ) { + return [ + execResult[ 1 ], + execResult[ 2 ] / 100, + execResult[ 3 ] / 100, + execResult[ 4 ] + ]; + } + }], + + // jQuery.Color( ) + color = jQuery.Color = function( color, green, blue, alpha ) { + return new jQuery.Color.fn.parse( color, green, blue, alpha ); + }, + spaces = { + rgba: { + props: { + red: { + idx: 0, + type: "byte" + }, + green: { + idx: 1, + type: "byte" + }, + blue: { + idx: 2, + type: "byte" + } + } + }, + + hsla: { + props: { + hue: { + idx: 0, + type: "degrees" + }, + saturation: { + idx: 1, + type: "percent" + }, + lightness: { + idx: 2, + type: "percent" + } + } + } + }, + propTypes = { + "byte": { + floor: true, + max: 255 + }, + "percent": { + max: 1 + }, + "degrees": { + mod: 360, + floor: true + } + }, + support = color.support = {}, + + // element for support tests + supportElem = jQuery( "

      " )[ 0 ], + + // colors = jQuery.Color.names + colors, + + // local aliases of functions called often + each = jQuery.each; + +// determine rgba support immediately +supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; +support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; + +// define cache name and alpha properties +// for rgba and hsla spaces +each( spaces, function( spaceName, space ) { + space.cache = "_" + spaceName; + space.props.alpha = { + idx: 3, + type: "percent", + def: 1 + }; +}); + +function clamp( value, prop, allowEmpty ) { + var type = propTypes[ prop.type ] || {}; + + if ( value == null ) { + return (allowEmpty || !prop.def) ? null : prop.def; + } + + // ~~ is an short way of doing floor for positive numbers + value = type.floor ? ~~value : parseFloat( value ); + + // IE will pass in empty strings as value for alpha, + // which will hit this case + if ( isNaN( value ) ) { + return prop.def; + } + + if ( type.mod ) { + // we add mod before modding to make sure that negatives values + // get converted properly: -10 -> 350 + return (value + type.mod) % type.mod; + } + + // for now all property types without mod have min and max + return 0 > value ? 0 : type.max < value ? type.max : value; +} + +function stringParse( string ) { + var inst = color(), + rgba = inst._rgba = []; + + string = string.toLowerCase(); + + each( stringParsers, function( i, parser ) { + var parsed, + match = parser.re.exec( string ), + values = match && parser.parse( match ), + spaceName = parser.space || "rgba"; + + if ( values ) { + parsed = inst[ spaceName ]( values ); + + // if this was an rgba parse the assignment might happen twice + // oh well.... + inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; + rgba = inst._rgba = parsed._rgba; + + // exit each( stringParsers ) here because we matched + return false; + } + }); + + // Found a stringParser that handled it + if ( rgba.length ) { + + // if this came from a parsed string, force "transparent" when alpha is 0 + // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) + if ( rgba.join() === "0,0,0,0" ) { + jQuery.extend( rgba, colors.transparent ); + } + return inst; + } + + // named colors + return colors[ string ]; +} + +color.fn = jQuery.extend( color.prototype, { + parse: function( red, green, blue, alpha ) { + if ( red === undefined ) { + this._rgba = [ null, null, null, null ]; + return this; + } + if ( red.jquery || red.nodeType ) { + red = jQuery( red ).css( green ); + green = undefined; + } + + var inst = this, + type = jQuery.type( red ), + rgba = this._rgba = []; + + // more than 1 argument specified - assume ( red, green, blue, alpha ) + if ( green !== undefined ) { + red = [ red, green, blue, alpha ]; + type = "array"; + } + + if ( type === "string" ) { + return this.parse( stringParse( red ) || colors._default ); + } + + if ( type === "array" ) { + each( spaces.rgba.props, function( key, prop ) { + rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); + }); + return this; + } + + if ( type === "object" ) { + if ( red instanceof color ) { + each( spaces, function( spaceName, space ) { + if ( red[ space.cache ] ) { + inst[ space.cache ] = red[ space.cache ].slice(); + } + }); + } else { + each( spaces, function( spaceName, space ) { + var cache = space.cache; + each( space.props, function( key, prop ) { + + // if the cache doesn't exist, and we know how to convert + if ( !inst[ cache ] && space.to ) { + + // if the value was null, we don't need to copy it + // if the key was alpha, we don't need to copy it either + if ( key === "alpha" || red[ key ] == null ) { + return; + } + inst[ cache ] = space.to( inst._rgba ); + } + + // this is the only case where we allow nulls for ALL properties. + // call clamp with alwaysAllowEmpty + inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); + }); + + // everything defined but alpha? + if ( inst[ cache ] && $.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { + // use the default of 1 + inst[ cache ][ 3 ] = 1; + if ( space.from ) { + inst._rgba = space.from( inst[ cache ] ); + } + } + }); + } + return this; + } + }, + is: function( compare ) { + var is = color( compare ), + same = true, + inst = this; + + each( spaces, function( _, space ) { + var localCache, + isCache = is[ space.cache ]; + if (isCache) { + localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; + each( space.props, function( _, prop ) { + if ( isCache[ prop.idx ] != null ) { + same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); + return same; + } + }); + } + return same; + }); + return same; + }, + _space: function() { + var used = [], + inst = this; + each( spaces, function( spaceName, space ) { + if ( inst[ space.cache ] ) { + used.push( spaceName ); + } + }); + return used.pop(); + }, + transition: function( other, distance ) { + var end = color( other ), + spaceName = end._space(), + space = spaces[ spaceName ], + startColor = this.alpha() === 0 ? color( "transparent" ) : this, + start = startColor[ space.cache ] || space.to( startColor._rgba ), + result = start.slice(); + + end = end[ space.cache ]; + each( space.props, function( key, prop ) { + var index = prop.idx, + startValue = start[ index ], + endValue = end[ index ], + type = propTypes[ prop.type ] || {}; + + // if null, don't override start value + if ( endValue === null ) { + return; + } + // if null - use end + if ( startValue === null ) { + result[ index ] = endValue; + } else { + if ( type.mod ) { + if ( endValue - startValue > type.mod / 2 ) { + startValue += type.mod; + } else if ( startValue - endValue > type.mod / 2 ) { + startValue -= type.mod; + } + } + result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); + } + }); + return this[ spaceName ]( result ); + }, + blend: function( opaque ) { + // if we are already opaque - return ourself + if ( this._rgba[ 3 ] === 1 ) { + return this; + } + + var rgb = this._rgba.slice(), + a = rgb.pop(), + blend = color( opaque )._rgba; + + return color( jQuery.map( rgb, function( v, i ) { + return ( 1 - a ) * blend[ i ] + a * v; + })); + }, + toRgbaString: function() { + var prefix = "rgba(", + rgba = jQuery.map( this._rgba, function( v, i ) { + return v == null ? ( i > 2 ? 1 : 0 ) : v; + }); + + if ( rgba[ 3 ] === 1 ) { + rgba.pop(); + prefix = "rgb("; + } + + return prefix + rgba.join() + ")"; + }, + toHslaString: function() { + var prefix = "hsla(", + hsla = jQuery.map( this.hsla(), function( v, i ) { + if ( v == null ) { + v = i > 2 ? 1 : 0; + } + + // catch 1 and 2 + if ( i && i < 3 ) { + v = Math.round( v * 100 ) + "%"; + } + return v; + }); + + if ( hsla[ 3 ] === 1 ) { + hsla.pop(); + prefix = "hsl("; + } + return prefix + hsla.join() + ")"; + }, + toHexString: function( includeAlpha ) { + var rgba = this._rgba.slice(), + alpha = rgba.pop(); + + if ( includeAlpha ) { + rgba.push( ~~( alpha * 255 ) ); + } + + return "#" + jQuery.map( rgba, function( v ) { + + // default to 0 when nulls exist + v = ( v || 0 ).toString( 16 ); + return v.length === 1 ? "0" + v : v; + }).join(""); + }, + toString: function() { + return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); + } +}); +color.fn.parse.prototype = color.fn; + +// hsla conversions adapted from: +// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 + +function hue2rgb( p, q, h ) { + h = ( h + 1 ) % 1; + if ( h * 6 < 1 ) { + return p + (q - p) * h * 6; + } + if ( h * 2 < 1) { + return q; + } + if ( h * 3 < 2 ) { + return p + (q - p) * ((2/3) - h) * 6; + } + return p; +} + +spaces.hsla.to = function ( rgba ) { + if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { + return [ null, null, null, rgba[ 3 ] ]; + } + var r = rgba[ 0 ] / 255, + g = rgba[ 1 ] / 255, + b = rgba[ 2 ] / 255, + a = rgba[ 3 ], + max = Math.max( r, g, b ), + min = Math.min( r, g, b ), + diff = max - min, + add = max + min, + l = add * 0.5, + h, s; + + if ( min === max ) { + h = 0; + } else if ( r === max ) { + h = ( 60 * ( g - b ) / diff ) + 360; + } else if ( g === max ) { + h = ( 60 * ( b - r ) / diff ) + 120; + } else { + h = ( 60 * ( r - g ) / diff ) + 240; + } + + if ( l === 0 || l === 1 ) { + s = l; + } else if ( l <= 0.5 ) { + s = diff / add; + } else { + s = diff / ( 2 - add ); + } + return [ Math.round(h) % 360, s, l, a == null ? 1 : a ]; +}; + +spaces.hsla.from = function ( hsla ) { + if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { + return [ null, null, null, hsla[ 3 ] ]; + } + var h = hsla[ 0 ] / 360, + s = hsla[ 1 ], + l = hsla[ 2 ], + a = hsla[ 3 ], + q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, + p = 2 * l - q; + + return [ + Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), + Math.round( hue2rgb( p, q, h ) * 255 ), + Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), + a + ]; +}; + + +each( spaces, function( spaceName, space ) { + var props = space.props, + cache = space.cache, + to = space.to, + from = space.from; + + // makes rgba() and hsla() + color.fn[ spaceName ] = function( value ) { + + // generate a cache for this space if it doesn't exist + if ( to && !this[ cache ] ) { + this[ cache ] = to( this._rgba ); + } + if ( value === undefined ) { + return this[ cache ].slice(); + } + + var ret, + type = jQuery.type( value ), + arr = ( type === "array" || type === "object" ) ? value : arguments, + local = this[ cache ].slice(); + + each( props, function( key, prop ) { + var val = arr[ type === "object" ? key : prop.idx ]; + if ( val == null ) { + val = local[ prop.idx ]; + } + local[ prop.idx ] = clamp( val, prop ); + }); + + if ( from ) { + ret = color( from( local ) ); + ret[ cache ] = local; + return ret; + } else { + return color( local ); + } + }; + + // makes red() green() blue() alpha() hue() saturation() lightness() + each( props, function( key, prop ) { + // alpha is included in more than one space + if ( color.fn[ key ] ) { + return; + } + color.fn[ key ] = function( value ) { + var vtype = jQuery.type( value ), + fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ), + local = this[ fn ](), + cur = local[ prop.idx ], + match; + + if ( vtype === "undefined" ) { + return cur; + } + + if ( vtype === "function" ) { + value = value.call( this, cur ); + vtype = jQuery.type( value ); + } + if ( value == null && prop.empty ) { + return this; + } + if ( vtype === "string" ) { + match = rplusequals.exec( value ); + if ( match ) { + value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); + } + } + local[ prop.idx ] = value; + return this[ fn ]( local ); + }; + }); +}); + +// add .fx.step functions +each( stepHooks, function( i, hook ) { + jQuery.cssHooks[ hook ] = { + set: function( elem, value ) { + var parsed, curElem, + backgroundColor = ""; + + if ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) { + value = color( parsed || value ); + if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { + curElem = hook === "backgroundColor" ? elem.parentNode : elem; + while ( + (backgroundColor === "" || backgroundColor === "transparent") && + curElem && curElem.style + ) { + try { + backgroundColor = jQuery.css( curElem, "backgroundColor" ); + curElem = curElem.parentNode; + } catch ( e ) { + } + } + + value = value.blend( backgroundColor && backgroundColor !== "transparent" ? + backgroundColor : + "_default" ); + } + + value = value.toRgbaString(); + } + try { + elem.style[ hook ] = value; + } catch( error ) { + // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' + } + } + }; + jQuery.fx.step[ hook ] = function( fx ) { + if ( !fx.colorInit ) { + fx.start = color( fx.elem, hook ); + fx.end = color( fx.end ); + fx.colorInit = true; + } + jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); + }; +}); + +jQuery.cssHooks.borderColor = { + expand: function( value ) { + var expanded = {}; + + each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) { + expanded[ "border" + part + "Color" ] = value; + }); + return expanded; + } +}; + +// Basic color names only. +// Usage of any of the other color names requires adding yourself or including +// jquery.color.svg-names.js. +colors = jQuery.Color.names = { + // 4.1. Basic color keywords + aqua: "#00ffff", + black: "#000000", + blue: "#0000ff", + fuchsia: "#ff00ff", + gray: "#808080", + green: "#008000", + lime: "#00ff00", + maroon: "#800000", + navy: "#000080", + olive: "#808000", + purple: "#800080", + red: "#ff0000", + silver: "#c0c0c0", + teal: "#008080", + white: "#ffffff", + yellow: "#ffff00", + + // 4.2.3. "transparent" color keyword + transparent: [ null, null, null, 0 ], + + _default: "#ffffff" +}; + +})( jQuery ); + + + +/******************************************************************************/ +/****************************** CLASS ANIMATIONS ******************************/ +/******************************************************************************/ +(function() { + +var classAnimationActions = [ "add", "remove", "toggle" ], + shorthandStyles = { + border: 1, + borderBottom: 1, + borderColor: 1, + borderLeft: 1, + borderRight: 1, + borderTop: 1, + borderWidth: 1, + margin: 1, + padding: 1 + }; + +$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) { + $.fx.step[ prop ] = function( fx ) { + if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) { + jQuery.style( fx.elem, prop, fx.end ); + fx.setAttr = true; + } + }; +}); + +function getElementStyles() { + var style = this.ownerDocument.defaultView ? + this.ownerDocument.defaultView.getComputedStyle( this, null ) : + this.currentStyle, + newStyle = {}, + key, + len; + + // webkit enumerates style porperties + if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { + len = style.length; + while ( len-- ) { + key = style[ len ]; + if ( typeof style[ key ] === "string" ) { + newStyle[ $.camelCase( key ) ] = style[ key ]; + } + } + } else { + for ( key in style ) { + if ( typeof style[ key ] === "string" ) { + newStyle[ key ] = style[ key ]; + } + } + } + + return newStyle; +} + + +function styleDifference( oldStyle, newStyle ) { + var diff = {}, + name, value; + + for ( name in newStyle ) { + value = newStyle[ name ]; + if ( oldStyle[ name ] !== value ) { + if ( !shorthandStyles[ name ] ) { + if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { + diff[ name ] = value; + } + } + } + } + + return diff; +} + +$.effects.animateClass = function( value, duration, easing, callback ) { + var o = $.speed( duration, easing, callback ); + + return this.queue( function() { + var animated = $( this ), + baseClass = animated.attr( "class" ) || "", + applyClassChange, + allAnimations = o.children ? animated.find( "*" ).andSelf() : animated; + + // map the animated objects to store the original styles. + allAnimations = allAnimations.map(function() { + var el = $( this ); + return { + el: el, + start: getElementStyles.call( this ) + }; + }); + + // apply class change + applyClassChange = function() { + $.each( classAnimationActions, function(i, action) { + if ( value[ action ] ) { + animated[ action + "Class" ]( value[ action ] ); + } + }); + }; + applyClassChange(); + + // map all animated objects again - calculate new styles and diff + allAnimations = allAnimations.map(function() { + this.end = getElementStyles.call( this.el[ 0 ] ); + this.diff = styleDifference( this.start, this.end ); + return this; + }); + + // apply original class + animated.attr( "class", baseClass ); + + // map all animated objects again - this time collecting a promise + allAnimations = allAnimations.map(function() { + var styleInfo = this, + dfd = $.Deferred(), + opts = jQuery.extend({}, o, { + queue: false, + complete: function() { + dfd.resolve( styleInfo ); + } + }); + + this.el.animate( this.diff, opts ); + return dfd.promise(); + }); + + // once all animations have completed: + $.when.apply( $, allAnimations.get() ).done(function() { + + // set the final class + applyClassChange(); + + // for each animated element, + // clear all css properties that were animated + $.each( arguments, function() { + var el = this.el; + $.each( this.diff, function(key) { + el.css( key, '' ); + }); + }); + + // this is guarnteed to be there if you use jQuery.speed() + // it also handles dequeuing the next anim... + o.complete.call( animated[ 0 ] ); + }); + }); +}; + +$.fn.extend({ + _addClass: $.fn.addClass, + addClass: function( classNames, speed, easing, callback ) { + return speed ? + $.effects.animateClass.call( this, + { add: classNames }, speed, easing, callback ) : + this._addClass( classNames ); + }, + + _removeClass: $.fn.removeClass, + removeClass: function( classNames, speed, easing, callback ) { + return speed ? + $.effects.animateClass.call( this, + { remove: classNames }, speed, easing, callback ) : + this._removeClass( classNames ); + }, + + _toggleClass: $.fn.toggleClass, + toggleClass: function( classNames, force, speed, easing, callback ) { + if ( typeof force === "boolean" || force === undefined ) { + if ( !speed ) { + // without speed parameter + return this._toggleClass( classNames, force ); + } else { + return $.effects.animateClass.call( this, + (force ? { add: classNames } : { remove: classNames }), + speed, easing, callback ); + } + } else { + // without force parameter + return $.effects.animateClass.call( this, + { toggle: classNames }, force, speed, easing ); + } + }, + + switchClass: function( remove, add, speed, easing, callback) { + return $.effects.animateClass.call( this, { + add: add, + remove: remove + }, speed, easing, callback ); + } +}); + +})(); + +/******************************************************************************/ +/*********************************** EFFECTS **********************************/ +/******************************************************************************/ + +(function() { + +$.extend( $.effects, { + version: "1.9.2", + + // Saves a set of properties in a data storage + save: function( element, set ) { + for( var i=0; i < set.length; i++ ) { + if ( set[ i ] !== null ) { + element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); + } + } + }, + + // Restores a set of previously saved properties from a data storage + restore: function( element, set ) { + var val, i; + for( i=0; i < set.length; i++ ) { + if ( set[ i ] !== null ) { + val = element.data( dataSpace + set[ i ] ); + // support: jQuery 1.6.2 + // http://bugs.jquery.com/ticket/9917 + // jQuery 1.6.2 incorrectly returns undefined for any falsy value. + // We can't differentiate between "" and 0 here, so we just assume + // empty string since it's likely to be a more common value... + if ( val === undefined ) { + val = ""; + } + element.css( set[ i ], val ); + } + } + }, + + setMode: function( el, mode ) { + if (mode === "toggle") { + mode = el.is( ":hidden" ) ? "show" : "hide"; + } + return mode; + }, + + // Translates a [top,left] array into a baseline value + // this should be a little more flexible in the future to handle a string & hash + getBaseline: function( origin, original ) { + var y, x; + switch ( origin[ 0 ] ) { + case "top": y = 0; break; + case "middle": y = 0.5; break; + case "bottom": y = 1; break; + default: y = origin[ 0 ] / original.height; + } + switch ( origin[ 1 ] ) { + case "left": x = 0; break; + case "center": x = 0.5; break; + case "right": x = 1; break; + default: x = origin[ 1 ] / original.width; + } + return { + x: x, + y: y + }; + }, + + // Wraps the element around a wrapper that copies position properties + createWrapper: function( element ) { + + // if the element is already wrapped, return it + if ( element.parent().is( ".ui-effects-wrapper" )) { + return element.parent(); + } + + // wrap the element + var props = { + width: element.outerWidth(true), + height: element.outerHeight(true), + "float": element.css( "float" ) + }, + wrapper = $( "

      " ) + .addClass( "ui-effects-wrapper" ) + .css({ + fontSize: "100%", + background: "transparent", + border: "none", + margin: 0, + padding: 0 + }), + // Store the size in case width/height are defined in % - Fixes #5245 + size = { + width: element.width(), + height: element.height() + }, + active = document.activeElement; + + // support: Firefox + // Firefox incorrectly exposes anonymous content + // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 + try { + active.id; + } catch( e ) { + active = document.body; + } + + element.wrap( wrapper ); + + // Fixes #7595 - Elements lose focus when wrapped. + if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { + $( active ).focus(); + } + + wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element + + // transfer positioning properties to the wrapper + if ( element.css( "position" ) === "static" ) { + wrapper.css({ position: "relative" }); + element.css({ position: "relative" }); + } else { + $.extend( props, { + position: element.css( "position" ), + zIndex: element.css( "z-index" ) + }); + $.each([ "top", "left", "bottom", "right" ], function(i, pos) { + props[ pos ] = element.css( pos ); + if ( isNaN( parseInt( props[ pos ], 10 ) ) ) { + props[ pos ] = "auto"; + } + }); + element.css({ + position: "relative", + top: 0, + left: 0, + right: "auto", + bottom: "auto" + }); + } + element.css(size); + + return wrapper.css( props ).show(); + }, + + removeWrapper: function( element ) { + var active = document.activeElement; + + if ( element.parent().is( ".ui-effects-wrapper" ) ) { + element.parent().replaceWith( element ); + + // Fixes #7595 - Elements lose focus when wrapped. + if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { + $( active ).focus(); + } + } + + + return element; + }, + + setTransition: function( element, list, factor, value ) { + value = value || {}; + $.each( list, function( i, x ) { + var unit = element.cssUnit( x ); + if ( unit[ 0 ] > 0 ) { + value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; + } + }); + return value; + } +}); + +// return an effect options object for the given parameters: +function _normalizeArguments( effect, options, speed, callback ) { + + // allow passing all options as the first parameter + if ( $.isPlainObject( effect ) ) { + options = effect; + effect = effect.effect; + } + + // convert to an object + effect = { effect: effect }; + + // catch (effect, null, ...) + if ( options == null ) { + options = {}; + } + + // catch (effect, callback) + if ( $.isFunction( options ) ) { + callback = options; + speed = null; + options = {}; + } + + // catch (effect, speed, ?) + if ( typeof options === "number" || $.fx.speeds[ options ] ) { + callback = speed; + speed = options; + options = {}; + } + + // catch (effect, options, callback) + if ( $.isFunction( speed ) ) { + callback = speed; + speed = null; + } + + // add options to effect + if ( options ) { + $.extend( effect, options ); + } + + speed = speed || options.duration; + effect.duration = $.fx.off ? 0 : + typeof speed === "number" ? speed : + speed in $.fx.speeds ? $.fx.speeds[ speed ] : + $.fx.speeds._default; + + effect.complete = callback || options.complete; + + return effect; +} + +function standardSpeed( speed ) { + // valid standard speeds + if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) { + return true; + } + + // invalid strings - treat as "normal" speed + if ( typeof speed === "string" && !$.effects.effect[ speed ] ) { + // TODO: remove in 2.0 (#7115) + if ( backCompat && $.effects[ speed ] ) { + return false; + } + return true; + } + + return false; +} + +$.fn.extend({ + effect: function( /* effect, options, speed, callback */ ) { + var args = _normalizeArguments.apply( this, arguments ), + mode = args.mode, + queue = args.queue, + effectMethod = $.effects.effect[ args.effect ], + + // DEPRECATED: remove in 2.0 (#7115) + oldEffectMethod = !effectMethod && backCompat && $.effects[ args.effect ]; + + if ( $.fx.off || !( effectMethod || oldEffectMethod ) ) { + // delegate to the original method (e.g., .show()) if possible + if ( mode ) { + return this[ mode ]( args.duration, args.complete ); + } else { + return this.each( function() { + if ( args.complete ) { + args.complete.call( this ); + } + }); + } + } + + function run( next ) { + var elem = $( this ), + complete = args.complete, + mode = args.mode; + + function done() { + if ( $.isFunction( complete ) ) { + complete.call( elem[0] ); + } + if ( $.isFunction( next ) ) { + next(); + } + } + + // if the element is hiddden and mode is hide, + // or element is visible and mode is show + if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { + done(); + } else { + effectMethod.call( elem[0], args, done ); + } + } + + // TODO: remove this check in 2.0, effectMethod will always be true + if ( effectMethod ) { + return queue === false ? this.each( run ) : this.queue( queue || "fx", run ); + } else { + // DEPRECATED: remove in 2.0 (#7115) + return oldEffectMethod.call(this, { + options: args, + duration: args.duration, + callback: args.complete, + mode: args.mode + }); + } + }, + + _show: $.fn.show, + show: function( speed ) { + if ( standardSpeed( speed ) ) { + return this._show.apply( this, arguments ); + } else { + var args = _normalizeArguments.apply( this, arguments ); + args.mode = "show"; + return this.effect.call( this, args ); + } + }, + + _hide: $.fn.hide, + hide: function( speed ) { + if ( standardSpeed( speed ) ) { + return this._hide.apply( this, arguments ); + } else { + var args = _normalizeArguments.apply( this, arguments ); + args.mode = "hide"; + return this.effect.call( this, args ); + } + }, + + // jQuery core overloads toggle and creates _toggle + __toggle: $.fn.toggle, + toggle: function( speed ) { + if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) { + return this.__toggle.apply( this, arguments ); + } else { + var args = _normalizeArguments.apply( this, arguments ); + args.mode = "toggle"; + return this.effect.call( this, args ); + } + }, + + // helper functions + cssUnit: function(key) { + var style = this.css( key ), + val = []; + + $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { + if ( style.indexOf( unit ) > 0 ) { + val = [ parseFloat( style ), unit ]; + } + }); + return val; + } +}); + +})(); + +/******************************************************************************/ +/*********************************** EASING ***********************************/ +/******************************************************************************/ + +(function() { + +// based on easing equations from Robert Penner (http://www.robertpenner.com/easing) + +var baseEasings = {}; + +$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { + baseEasings[ name ] = function( p ) { + return Math.pow( p, i + 2 ); + }; +}); + +$.extend( baseEasings, { + Sine: function ( p ) { + return 1 - Math.cos( p * Math.PI / 2 ); + }, + Circ: function ( p ) { + return 1 - Math.sqrt( 1 - p * p ); + }, + Elastic: function( p ) { + return p === 0 || p === 1 ? p : + -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 ); + }, + Back: function( p ) { + return p * p * ( 3 * p - 2 ); + }, + Bounce: function ( p ) { + var pow2, + bounce = 4; + + while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} + return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); + } +}); + +$.each( baseEasings, function( name, easeIn ) { + $.easing[ "easeIn" + name ] = easeIn; + $.easing[ "easeOut" + name ] = function( p ) { + return 1 - easeIn( 1 - p ); + }; + $.easing[ "easeInOut" + name ] = function( p ) { + return p < 0.5 ? + easeIn( p * 2 ) / 2 : + 1 - easeIn( p * -2 + 2 ) / 2; + }; +}); + +})(); + +})(jQuery)); +(function( $, undefined ) { + +var rvertical = /up|down|vertical/, + rpositivemotion = /up|left|vertical|horizontal/; + +$.effects.effect.blind = function( o, done ) { + // Create element + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "height", "width" ], + mode = $.effects.setMode( el, o.mode || "hide" ), + direction = o.direction || "up", + vertical = rvertical.test( direction ), + ref = vertical ? "height" : "width", + ref2 = vertical ? "top" : "left", + motion = rpositivemotion.test( direction ), + animation = {}, + show = mode === "show", + wrapper, distance, margin; + + // if already wrapped, the wrapper's properties are my property. #6245 + if ( el.parent().is( ".ui-effects-wrapper" ) ) { + $.effects.save( el.parent(), props ); + } else { + $.effects.save( el, props ); + } + el.show(); + wrapper = $.effects.createWrapper( el ).css({ + overflow: "hidden" + }); + + distance = wrapper[ ref ](); + margin = parseFloat( wrapper.css( ref2 ) ) || 0; + + animation[ ref ] = show ? distance : 0; + if ( !motion ) { + el + .css( vertical ? "bottom" : "right", 0 ) + .css( vertical ? "top" : "left", "auto" ) + .css({ position: "absolute" }); + + animation[ ref2 ] = show ? margin : distance + margin; + } + + // start at 0 if we are showing + if ( show ) { + wrapper.css( ref, 0 ); + if ( ! motion ) { + wrapper.css( ref2, margin + distance ); + } + } + + // Animate + wrapper.animate( animation, { + duration: o.duration, + easing: o.easing, + queue: false, + complete: function() { + if ( mode === "hide" ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + } + }); + +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.bounce = function( o, done ) { + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "height", "width" ], + + // defaults: + mode = $.effects.setMode( el, o.mode || "effect" ), + hide = mode === "hide", + show = mode === "show", + direction = o.direction || "up", + distance = o.distance, + times = o.times || 5, + + // number of internal animations + anims = times * 2 + ( show || hide ? 1 : 0 ), + speed = o.duration / anims, + easing = o.easing, + + // utility: + ref = ( direction === "up" || direction === "down" ) ? "top" : "left", + motion = ( direction === "up" || direction === "left" ), + i, + upAnim, + downAnim, + + // we will need to re-assemble the queue to stack our animations in place + queue = el.queue(), + queuelen = queue.length; + + // Avoid touching opacity to prevent clearType and PNG issues in IE + if ( show || hide ) { + props.push( "opacity" ); + } + + $.effects.save( el, props ); + el.show(); + $.effects.createWrapper( el ); // Create Wrapper + + // default distance for the BIGGEST bounce is the outer Distance / 3 + if ( !distance ) { + distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3; + } + + if ( show ) { + downAnim = { opacity: 1 }; + downAnim[ ref ] = 0; + + // if we are showing, force opacity 0 and set the initial position + // then do the "first" animation + el.css( "opacity", 0 ) + .css( ref, motion ? -distance * 2 : distance * 2 ) + .animate( downAnim, speed, easing ); + } + + // start at the smallest distance if we are hiding + if ( hide ) { + distance = distance / Math.pow( 2, times - 1 ); + } + + downAnim = {}; + downAnim[ ref ] = 0; + // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here + for ( i = 0; i < times; i++ ) { + upAnim = {}; + upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; + + el.animate( upAnim, speed, easing ) + .animate( downAnim, speed, easing ); + + distance = hide ? distance * 2 : distance / 2; + } + + // Last Bounce when Hiding + if ( hide ) { + upAnim = { opacity: 0 }; + upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; + + el.animate( upAnim, speed, easing ); + } + + el.queue(function() { + if ( hide ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + }); + + // inject all the animations we just queued to be first in line (after "inprogress") + if ( queuelen > 1) { + queue.splice.apply( queue, + [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); + } + el.dequeue(); + +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.clip = function( o, done ) { + // Create element + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "height", "width" ], + mode = $.effects.setMode( el, o.mode || "hide" ), + show = mode === "show", + direction = o.direction || "vertical", + vert = direction === "vertical", + size = vert ? "height" : "width", + position = vert ? "top" : "left", + animation = {}, + wrapper, animate, distance; + + // Save & Show + $.effects.save( el, props ); + el.show(); + + // Create Wrapper + wrapper = $.effects.createWrapper( el ).css({ + overflow: "hidden" + }); + animate = ( el[0].tagName === "IMG" ) ? wrapper : el; + distance = animate[ size ](); + + // Shift + if ( show ) { + animate.css( size, 0 ); + animate.css( position, distance / 2 ); + } + + // Create Animation Object: + animation[ size ] = show ? distance : 0; + animation[ position ] = show ? 0 : distance / 2; + + // Animate + animate.animate( animation, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + if ( !show ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + } + }); + +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.drop = function( o, done ) { + + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ], + mode = $.effects.setMode( el, o.mode || "hide" ), + show = mode === "show", + direction = o.direction || "left", + ref = ( direction === "up" || direction === "down" ) ? "top" : "left", + motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg", + animation = { + opacity: show ? 1 : 0 + }, + distance; + + // Adjust + $.effects.save( el, props ); + el.show(); + $.effects.createWrapper( el ); + + distance = o.distance || el[ ref === "top" ? "outerHeight": "outerWidth" ]( true ) / 2; + + if ( show ) { + el + .css( "opacity", 0 ) + .css( ref, motion === "pos" ? -distance : distance ); + } + + // Animation + animation[ ref ] = ( show ? + ( motion === "pos" ? "+=" : "-=" ) : + ( motion === "pos" ? "-=" : "+=" ) ) + + distance; + + // Animate + el.animate( animation, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + if ( mode === "hide" ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + } + }); +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.explode = function( o, done ) { + + var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3, + cells = rows, + el = $( this ), + mode = $.effects.setMode( el, o.mode || "hide" ), + show = mode === "show", + + // show and then visibility:hidden the element before calculating offset + offset = el.show().css( "visibility", "hidden" ).offset(), + + // width and height of a piece + width = Math.ceil( el.outerWidth() / cells ), + height = Math.ceil( el.outerHeight() / rows ), + pieces = [], + + // loop + i, j, left, top, mx, my; + + // children animate complete: + function childComplete() { + pieces.push( this ); + if ( pieces.length === rows * cells ) { + animComplete(); + } + } + + // clone the element for each row and cell. + for( i = 0; i < rows ; i++ ) { // ===> + top = offset.top + i * height; + my = i - ( rows - 1 ) / 2 ; + + for( j = 0; j < cells ; j++ ) { // ||| + left = offset.left + j * width; + mx = j - ( cells - 1 ) / 2 ; + + // Create a clone of the now hidden main element that will be absolute positioned + // within a wrapper div off the -left and -top equal to size of our pieces + el + .clone() + .appendTo( "body" ) + .wrap( "
      " ) + .css({ + position: "absolute", + visibility: "visible", + left: -j * width, + top: -i * height + }) + + // select the wrapper - make it overflow: hidden and absolute positioned based on + // where the original was located +left and +top equal to the size of pieces + .parent() + .addClass( "ui-effects-explode" ) + .css({ + position: "absolute", + overflow: "hidden", + width: width, + height: height, + left: left + ( show ? mx * width : 0 ), + top: top + ( show ? my * height : 0 ), + opacity: show ? 0 : 1 + }).animate({ + left: left + ( show ? 0 : mx * width ), + top: top + ( show ? 0 : my * height ), + opacity: show ? 1 : 0 + }, o.duration || 500, o.easing, childComplete ); + } + } + + function animComplete() { + el.css({ + visibility: "visible" + }); + $( pieces ).remove(); + if ( !show ) { + el.hide(); + } + done(); + } +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.fade = function( o, done ) { + var el = $( this ), + mode = $.effects.setMode( el, o.mode || "toggle" ); + + el.animate({ + opacity: mode + }, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: done + }); +}; + +})( jQuery ); +(function( $, undefined ) { + +$.effects.effect.fold = function( o, done ) { + + // Create element + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "height", "width" ], + mode = $.effects.setMode( el, o.mode || "hide" ), + show = mode === "show", + hide = mode === "hide", + size = o.size || 15, + percent = /([0-9]+)%/.exec( size ), + horizFirst = !!o.horizFirst, + widthFirst = show !== horizFirst, + ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ], + duration = o.duration / 2, + wrapper, distance, + animation1 = {}, + animation2 = {}; + + $.effects.save( el, props ); + el.show(); + + // Create Wrapper + wrapper = $.effects.createWrapper( el ).css({ + overflow: "hidden" + }); + distance = widthFirst ? + [ wrapper.width(), wrapper.height() ] : + [ wrapper.height(), wrapper.width() ]; + + if ( percent ) { + size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ]; + } + if ( show ) { + wrapper.css( horizFirst ? { + height: 0, + width: size + } : { + height: size, + width: 0 + }); + } + + // Animation + animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size; + animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0; + + // Animate + wrapper + .animate( animation1, duration, o.easing ) + .animate( animation2, duration, o.easing, function() { + if ( hide ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + }); + +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.highlight = function( o, done ) { + var elem = $( this ), + props = [ "backgroundImage", "backgroundColor", "opacity" ], + mode = $.effects.setMode( elem, o.mode || "show" ), + animation = { + backgroundColor: elem.css( "backgroundColor" ) + }; + + if (mode === "hide") { + animation.opacity = 0; + } + + $.effects.save( elem, props ); + + elem + .show() + .css({ + backgroundImage: "none", + backgroundColor: o.color || "#ffff99" + }) + .animate( animation, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + if ( mode === "hide" ) { + elem.hide(); + } + $.effects.restore( elem, props ); + done(); + } + }); +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.pulsate = function( o, done ) { + var elem = $( this ), + mode = $.effects.setMode( elem, o.mode || "show" ), + show = mode === "show", + hide = mode === "hide", + showhide = ( show || mode === "hide" ), + + // showing or hiding leaves of the "last" animation + anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ), + duration = o.duration / anims, + animateTo = 0, + queue = elem.queue(), + queuelen = queue.length, + i; + + if ( show || !elem.is(":visible")) { + elem.css( "opacity", 0 ).show(); + animateTo = 1; + } + + // anims - 1 opacity "toggles" + for ( i = 1; i < anims; i++ ) { + elem.animate({ + opacity: animateTo + }, duration, o.easing ); + animateTo = 1 - animateTo; + } + + elem.animate({ + opacity: animateTo + }, duration, o.easing); + + elem.queue(function() { + if ( hide ) { + elem.hide(); + } + done(); + }); + + // We just queued up "anims" animations, we need to put them next in the queue + if ( queuelen > 1 ) { + queue.splice.apply( queue, + [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); + } + elem.dequeue(); +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.puff = function( o, done ) { + var elem = $( this ), + mode = $.effects.setMode( elem, o.mode || "hide" ), + hide = mode === "hide", + percent = parseInt( o.percent, 10 ) || 150, + factor = percent / 100, + original = { + height: elem.height(), + width: elem.width(), + outerHeight: elem.outerHeight(), + outerWidth: elem.outerWidth() + }; + + $.extend( o, { + effect: "scale", + queue: false, + fade: true, + mode: mode, + complete: done, + percent: hide ? percent : 100, + from: hide ? + original : + { + height: original.height * factor, + width: original.width * factor, + outerHeight: original.outerHeight * factor, + outerWidth: original.outerWidth * factor + } + }); + + elem.effect( o ); +}; + +$.effects.effect.scale = function( o, done ) { + + // Create element + var el = $( this ), + options = $.extend( true, {}, o ), + mode = $.effects.setMode( el, o.mode || "effect" ), + percent = parseInt( o.percent, 10 ) || + ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ), + direction = o.direction || "both", + origin = o.origin, + original = { + height: el.height(), + width: el.width(), + outerHeight: el.outerHeight(), + outerWidth: el.outerWidth() + }, + factor = { + y: direction !== "horizontal" ? (percent / 100) : 1, + x: direction !== "vertical" ? (percent / 100) : 1 + }; + + // We are going to pass this effect to the size effect: + options.effect = "size"; + options.queue = false; + options.complete = done; + + // Set default origin and restore for show/hide + if ( mode !== "effect" ) { + options.origin = origin || ["middle","center"]; + options.restore = true; + } + + options.from = o.from || ( mode === "show" ? { + height: 0, + width: 0, + outerHeight: 0, + outerWidth: 0 + } : original ); + options.to = { + height: original.height * factor.y, + width: original.width * factor.x, + outerHeight: original.outerHeight * factor.y, + outerWidth: original.outerWidth * factor.x + }; + + // Fade option to support puff + if ( options.fade ) { + if ( mode === "show" ) { + options.from.opacity = 0; + options.to.opacity = 1; + } + if ( mode === "hide" ) { + options.from.opacity = 1; + options.to.opacity = 0; + } + } + + // Animate + el.effect( options ); + +}; + +$.effects.effect.size = function( o, done ) { + + // Create element + var original, baseline, factor, + el = $( this ), + props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ], + + // Always restore + props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ], + + // Copy for children + props2 = [ "width", "height", "overflow" ], + cProps = [ "fontSize" ], + vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ], + hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ], + + // Set options + mode = $.effects.setMode( el, o.mode || "effect" ), + restore = o.restore || mode !== "effect", + scale = o.scale || "both", + origin = o.origin || [ "middle", "center" ], + position = el.css( "position" ), + props = restore ? props0 : props1, + zero = { + height: 0, + width: 0, + outerHeight: 0, + outerWidth: 0 + }; + + if ( mode === "show" ) { + el.show(); + } + original = { + height: el.height(), + width: el.width(), + outerHeight: el.outerHeight(), + outerWidth: el.outerWidth() + }; + + if ( o.mode === "toggle" && mode === "show" ) { + el.from = o.to || zero; + el.to = o.from || original; + } else { + el.from = o.from || ( mode === "show" ? zero : original ); + el.to = o.to || ( mode === "hide" ? zero : original ); + } + + // Set scaling factor + factor = { + from: { + y: el.from.height / original.height, + x: el.from.width / original.width + }, + to: { + y: el.to.height / original.height, + x: el.to.width / original.width + } + }; + + // Scale the css box + if ( scale === "box" || scale === "both" ) { + + // Vertical props scaling + if ( factor.from.y !== factor.to.y ) { + props = props.concat( vProps ); + el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from ); + el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to ); + } + + // Horizontal props scaling + if ( factor.from.x !== factor.to.x ) { + props = props.concat( hProps ); + el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from ); + el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to ); + } + } + + // Scale the content + if ( scale === "content" || scale === "both" ) { + + // Vertical props scaling + if ( factor.from.y !== factor.to.y ) { + props = props.concat( cProps ).concat( props2 ); + el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from ); + el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to ); + } + } + + $.effects.save( el, props ); + el.show(); + $.effects.createWrapper( el ); + el.css( "overflow", "hidden" ).css( el.from ); + + // Adjust + if (origin) { // Calculate baseline shifts + baseline = $.effects.getBaseline( origin, original ); + el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y; + el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x; + el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y; + el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x; + } + el.css( el.from ); // set top & left + + // Animate + if ( scale === "content" || scale === "both" ) { // Scale the children + + // Add margins/font-size + vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps); + hProps = hProps.concat([ "marginLeft", "marginRight" ]); + props2 = props0.concat(vProps).concat(hProps); + + el.find( "*[width]" ).each( function(){ + var child = $( this ), + c_original = { + height: child.height(), + width: child.width(), + outerHeight: child.outerHeight(), + outerWidth: child.outerWidth() + }; + if (restore) { + $.effects.save(child, props2); + } + + child.from = { + height: c_original.height * factor.from.y, + width: c_original.width * factor.from.x, + outerHeight: c_original.outerHeight * factor.from.y, + outerWidth: c_original.outerWidth * factor.from.x + }; + child.to = { + height: c_original.height * factor.to.y, + width: c_original.width * factor.to.x, + outerHeight: c_original.height * factor.to.y, + outerWidth: c_original.width * factor.to.x + }; + + // Vertical props scaling + if ( factor.from.y !== factor.to.y ) { + child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from ); + child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to ); + } + + // Horizontal props scaling + if ( factor.from.x !== factor.to.x ) { + child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from ); + child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to ); + } + + // Animate children + child.css( child.from ); + child.animate( child.to, o.duration, o.easing, function() { + + // Restore children + if ( restore ) { + $.effects.restore( child, props2 ); + } + }); + }); + } + + // Animate + el.animate( el.to, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + if ( el.to.opacity === 0 ) { + el.css( "opacity", el.from.opacity ); + } + if( mode === "hide" ) { + el.hide(); + } + $.effects.restore( el, props ); + if ( !restore ) { + + // we need to calculate our new positioning based on the scaling + if ( position === "static" ) { + el.css({ + position: "relative", + top: el.to.top, + left: el.to.left + }); + } else { + $.each([ "top", "left" ], function( idx, pos ) { + el.css( pos, function( _, str ) { + var val = parseInt( str, 10 ), + toRef = idx ? el.to.left : el.to.top; + + // if original was "auto", recalculate the new value from wrapper + if ( str === "auto" ) { + return toRef + "px"; + } + + return val + toRef + "px"; + }); + }); + } + } + + $.effects.removeWrapper( el ); + done(); + } + }); + +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.shake = function( o, done ) { + + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "height", "width" ], + mode = $.effects.setMode( el, o.mode || "effect" ), + direction = o.direction || "left", + distance = o.distance || 20, + times = o.times || 3, + anims = times * 2 + 1, + speed = Math.round(o.duration/anims), + ref = (direction === "up" || direction === "down") ? "top" : "left", + positiveMotion = (direction === "up" || direction === "left"), + animation = {}, + animation1 = {}, + animation2 = {}, + i, + + // we will need to re-assemble the queue to stack our animations in place + queue = el.queue(), + queuelen = queue.length; + + $.effects.save( el, props ); + el.show(); + $.effects.createWrapper( el ); + + // Animation + animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance; + animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2; + animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2; + + // Animate + el.animate( animation, speed, o.easing ); + + // Shakes + for ( i = 1; i < times; i++ ) { + el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing ); + } + el + .animate( animation1, speed, o.easing ) + .animate( animation, speed / 2, o.easing ) + .queue(function() { + if ( mode === "hide" ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + }); + + // inject all the animations we just queued to be first in line (after "inprogress") + if ( queuelen > 1) { + queue.splice.apply( queue, + [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); + } + el.dequeue(); + +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.slide = function( o, done ) { + + // Create element + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "width", "height" ], + mode = $.effects.setMode( el, o.mode || "show" ), + show = mode === "show", + direction = o.direction || "left", + ref = (direction === "up" || direction === "down") ? "top" : "left", + positiveMotion = (direction === "up" || direction === "left"), + distance, + animation = {}; + + // Adjust + $.effects.save( el, props ); + el.show(); + distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ); + + $.effects.createWrapper( el ).css({ + overflow: "hidden" + }); + + if ( show ) { + el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance ); + } + + // Animation + animation[ ref ] = ( show ? + ( positiveMotion ? "+=" : "-=") : + ( positiveMotion ? "-=" : "+=")) + + distance; + + // Animate + el.animate( animation, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + if ( mode === "hide" ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + } + }); +}; + +})(jQuery); +(function( $, undefined ) { + +$.effects.effect.transfer = function( o, done ) { + var elem = $( this ), + target = $( o.to ), + targetFixed = target.css( "position" ) === "fixed", + body = $("body"), + fixTop = targetFixed ? body.scrollTop() : 0, + fixLeft = targetFixed ? body.scrollLeft() : 0, + endPosition = target.offset(), + animation = { + top: endPosition.top - fixTop , + left: endPosition.left - fixLeft , + height: target.innerHeight(), + width: target.innerWidth() + }, + startPosition = elem.offset(), + transfer = $( '
      ' ) + .appendTo( document.body ) + .addClass( o.className ) + .css({ + top: startPosition.top - fixTop , + left: startPosition.left - fixLeft , + height: elem.innerHeight(), + width: elem.innerWidth(), + position: targetFixed ? "fixed" : "absolute" + }) + .animate( animation, o.duration, o.easing, function() { + transfer.remove(); + done(); + }); +}; + +})(jQuery); +(function( $, undefined ) { + +var mouseHandled = false; + +$.widget( "ui.menu", { + version: "1.9.2", + defaultElement: "
        ", + delay: 300, + options: { + icons: { + submenu: "ui-icon-carat-1-e" + }, + menus: "ul", + position: { + my: "left top", + at: "right top" + }, + role: "menu", + + // callbacks + blur: null, + focus: null, + select: null + }, + + _create: function() { + this.activeMenu = this.element; + this.element + .uniqueId() + .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) + .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length ) + .attr({ + role: this.options.role, + tabIndex: 0 + }) + // need to catch all clicks on disabled menu + // not possible through _on + .bind( "click" + this.eventNamespace, $.proxy(function( event ) { + if ( this.options.disabled ) { + event.preventDefault(); + } + }, this )); + + if ( this.options.disabled ) { + this.element + .addClass( "ui-state-disabled" ) + .attr( "aria-disabled", "true" ); + } + + this._on({ + // Prevent focus from sticking to links inside menu after clicking + // them (focus should always stay on UL during navigation). + "mousedown .ui-menu-item > a": function( event ) { + event.preventDefault(); + }, + "click .ui-state-disabled > a": function( event ) { + event.preventDefault(); + }, + "click .ui-menu-item:has(a)": function( event ) { + var target = $( event.target ).closest( ".ui-menu-item" ); + if ( !mouseHandled && target.not( ".ui-state-disabled" ).length ) { + mouseHandled = true; + + this.select( event ); + // Open submenu on click + if ( target.has( ".ui-menu" ).length ) { + this.expand( event ); + } else if ( !this.element.is( ":focus" ) ) { + // Redirect focus to the menu + this.element.trigger( "focus", [ true ] ); + + // If the active item is on the top level, let it stay active. + // Otherwise, blur the active item since it is no longer visible. + if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) { + clearTimeout( this.timer ); + } + } + } + }, + "mouseenter .ui-menu-item": function( event ) { + var target = $( event.currentTarget ); + // Remove ui-state-active class from siblings of the newly focused menu item + // to avoid a jump caused by adjacent elements both having a class with a border + target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" ); + this.focus( event, target ); + }, + mouseleave: "collapseAll", + "mouseleave .ui-menu": "collapseAll", + focus: function( event, keepActiveItem ) { + // If there's already an active item, keep it active + // If not, activate the first item + var item = this.active || this.element.children( ".ui-menu-item" ).eq( 0 ); + + if ( !keepActiveItem ) { + this.focus( event, item ); + } + }, + blur: function( event ) { + this._delay(function() { + if ( !$.contains( this.element[0], this.document[0].activeElement ) ) { + this.collapseAll( event ); + } + }); + }, + keydown: "_keydown" + }); + + this.refresh(); + + // Clicks outside of a menu collapse any open menus + this._on( this.document, { + click: function( event ) { + if ( !$( event.target ).closest( ".ui-menu" ).length ) { + this.collapseAll( event ); + } + + // Reset the mouseHandled flag + mouseHandled = false; + } + }); + }, + + _destroy: function() { + // Destroy (sub)menus + this.element + .removeAttr( "aria-activedescendant" ) + .find( ".ui-menu" ).andSelf() + .removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" ) + .removeAttr( "role" ) + .removeAttr( "tabIndex" ) + .removeAttr( "aria-labelledby" ) + .removeAttr( "aria-expanded" ) + .removeAttr( "aria-hidden" ) + .removeAttr( "aria-disabled" ) + .removeUniqueId() + .show(); + + // Destroy menu items + this.element.find( ".ui-menu-item" ) + .removeClass( "ui-menu-item" ) + .removeAttr( "role" ) + .removeAttr( "aria-disabled" ) + .children( "a" ) + .removeUniqueId() + .removeClass( "ui-corner-all ui-state-hover" ) + .removeAttr( "tabIndex" ) + .removeAttr( "role" ) + .removeAttr( "aria-haspopup" ) + .children().each( function() { + var elem = $( this ); + if ( elem.data( "ui-menu-submenu-carat" ) ) { + elem.remove(); + } + }); + + // Destroy menu dividers + this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" ); + }, + + _keydown: function( event ) { + var match, prev, character, skip, regex, + preventDefault = true; + + function escape( value ) { + return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ); + } + + switch ( event.keyCode ) { + case $.ui.keyCode.PAGE_UP: + this.previousPage( event ); + break; + case $.ui.keyCode.PAGE_DOWN: + this.nextPage( event ); + break; + case $.ui.keyCode.HOME: + this._move( "first", "first", event ); + break; + case $.ui.keyCode.END: + this._move( "last", "last", event ); + break; + case $.ui.keyCode.UP: + this.previous( event ); + break; + case $.ui.keyCode.DOWN: + this.next( event ); + break; + case $.ui.keyCode.LEFT: + this.collapse( event ); + break; + case $.ui.keyCode.RIGHT: + if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { + this.expand( event ); + } + break; + case $.ui.keyCode.ENTER: + case $.ui.keyCode.SPACE: + this._activate( event ); + break; + case $.ui.keyCode.ESCAPE: + this.collapse( event ); + break; + default: + preventDefault = false; + prev = this.previousFilter || ""; + character = String.fromCharCode( event.keyCode ); + skip = false; + + clearTimeout( this.filterTimer ); + + if ( character === prev ) { + skip = true; + } else { + character = prev + character; + } + + regex = new RegExp( "^" + escape( character ), "i" ); + match = this.activeMenu.children( ".ui-menu-item" ).filter(function() { + return regex.test( $( this ).children( "a" ).text() ); + }); + match = skip && match.index( this.active.next() ) !== -1 ? + this.active.nextAll( ".ui-menu-item" ) : + match; + + // If no matches on the current filter, reset to the last character pressed + // to move down the menu to the first item that starts with that character + if ( !match.length ) { + character = String.fromCharCode( event.keyCode ); + regex = new RegExp( "^" + escape( character ), "i" ); + match = this.activeMenu.children( ".ui-menu-item" ).filter(function() { + return regex.test( $( this ).children( "a" ).text() ); + }); + } + + if ( match.length ) { + this.focus( event, match ); + if ( match.length > 1 ) { + this.previousFilter = character; + this.filterTimer = this._delay(function() { + delete this.previousFilter; + }, 1000 ); + } else { + delete this.previousFilter; + } + } else { + delete this.previousFilter; + } + } + + if ( preventDefault ) { + event.preventDefault(); + } + }, + + _activate: function( event ) { + if ( !this.active.is( ".ui-state-disabled" ) ) { + if ( this.active.children( "a[aria-haspopup='true']" ).length ) { + this.expand( event ); + } else { + this.select( event ); + } + } + }, + + refresh: function() { + var menus, + icon = this.options.icons.submenu, + submenus = this.element.find( this.options.menus ); + + // Initialize nested menus + submenus.filter( ":not(.ui-menu)" ) + .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) + .hide() + .attr({ + role: this.options.role, + "aria-hidden": "true", + "aria-expanded": "false" + }) + .each(function() { + var menu = $( this ), + item = menu.prev( "a" ), + submenuCarat = $( "" ) + .addClass( "ui-menu-icon ui-icon " + icon ) + .data( "ui-menu-submenu-carat", true ); + + item + .attr( "aria-haspopup", "true" ) + .prepend( submenuCarat ); + menu.attr( "aria-labelledby", item.attr( "id" ) ); + }); + + menus = submenus.add( this.element ); + + // Don't refresh list items that are already adapted + menus.children( ":not(.ui-menu-item):has(a)" ) + .addClass( "ui-menu-item" ) + .attr( "role", "presentation" ) + .children( "a" ) + .uniqueId() + .addClass( "ui-corner-all" ) + .attr({ + tabIndex: -1, + role: this._itemRole() + }); + + // Initialize unlinked menu-items containing spaces and/or dashes only as dividers + menus.children( ":not(.ui-menu-item)" ).each(function() { + var item = $( this ); + // hyphen, em dash, en dash + if ( !/[^\-—–\s]/.test( item.text() ) ) { + item.addClass( "ui-widget-content ui-menu-divider" ); + } + }); + + // Add aria-disabled attribute to any disabled menu item + menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" ); + + // If the active item has been removed, blur the menu + if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { + this.blur(); + } + }, + + _itemRole: function() { + return { + menu: "menuitem", + listbox: "option" + }[ this.options.role ]; + }, + + focus: function( event, item ) { + var nested, focused; + this.blur( event, event && event.type === "focus" ); + + this._scrollIntoView( item ); + + this.active = item.first(); + focused = this.active.children( "a" ).addClass( "ui-state-focus" ); + // Only update aria-activedescendant if there's a role + // otherwise we assume focus is managed elsewhere + if ( this.options.role ) { + this.element.attr( "aria-activedescendant", focused.attr( "id" ) ); + } + + // Highlight active parent menu item, if any + this.active + .parent() + .closest( ".ui-menu-item" ) + .children( "a:first" ) + .addClass( "ui-state-active" ); + + if ( event && event.type === "keydown" ) { + this._close(); + } else { + this.timer = this._delay(function() { + this._close(); + }, this.delay ); + } + + nested = item.children( ".ui-menu" ); + if ( nested.length && ( /^mouse/.test( event.type ) ) ) { + this._startOpening(nested); + } + this.activeMenu = item.parent(); + + this._trigger( "focus", event, { item: item } ); + }, + + _scrollIntoView: function( item ) { + var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; + if ( this._hasScroll() ) { + borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0; + paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0; + offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; + scroll = this.activeMenu.scrollTop(); + elementHeight = this.activeMenu.height(); + itemHeight = item.height(); + + if ( offset < 0 ) { + this.activeMenu.scrollTop( scroll + offset ); + } else if ( offset + itemHeight > elementHeight ) { + this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight ); + } + } + }, + + blur: function( event, fromFocus ) { + if ( !fromFocus ) { + clearTimeout( this.timer ); + } + + if ( !this.active ) { + return; + } + + this.active.children( "a" ).removeClass( "ui-state-focus" ); + this.active = null; + + this._trigger( "blur", event, { item: this.active } ); + }, + + _startOpening: function( submenu ) { + clearTimeout( this.timer ); + + // Don't open if already open fixes a Firefox bug that caused a .5 pixel + // shift in the submenu position when mousing over the carat icon + if ( submenu.attr( "aria-hidden" ) !== "true" ) { + return; + } + + this.timer = this._delay(function() { + this._close(); + this._open( submenu ); + }, this.delay ); + }, + + _open: function( submenu ) { + var position = $.extend({ + of: this.active + }, this.options.position ); + + clearTimeout( this.timer ); + this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) ) + .hide() + .attr( "aria-hidden", "true" ); + + submenu + .show() + .removeAttr( "aria-hidden" ) + .attr( "aria-expanded", "true" ) + .position( position ); + }, + + collapseAll: function( event, all ) { + clearTimeout( this.timer ); + this.timer = this._delay(function() { + // If we were passed an event, look for the submenu that contains the event + var currentMenu = all ? this.element : + $( event && event.target ).closest( this.element.find( ".ui-menu" ) ); + + // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway + if ( !currentMenu.length ) { + currentMenu = this.element; + } + + this._close( currentMenu ); + + this.blur( event ); + this.activeMenu = currentMenu; + }, this.delay ); + }, + + // With no arguments, closes the currently active menu - if nothing is active + // it closes all menus. If passed an argument, it will search for menus BELOW + _close: function( startMenu ) { + if ( !startMenu ) { + startMenu = this.active ? this.active.parent() : this.element; + } + + startMenu + .find( ".ui-menu" ) + .hide() + .attr( "aria-hidden", "true" ) + .attr( "aria-expanded", "false" ) + .end() + .find( "a.ui-state-active" ) + .removeClass( "ui-state-active" ); + }, + + collapse: function( event ) { + var newItem = this.active && + this.active.parent().closest( ".ui-menu-item", this.element ); + if ( newItem && newItem.length ) { + this._close(); + this.focus( event, newItem ); + } + }, + + expand: function( event ) { + var newItem = this.active && + this.active + .children( ".ui-menu " ) + .children( ".ui-menu-item" ) + .first(); + + if ( newItem && newItem.length ) { + this._open( newItem.parent() ); + + // Delay so Firefox will not hide activedescendant change in expanding submenu from AT + this._delay(function() { + this.focus( event, newItem ); + }); + } + }, + + next: function( event ) { + this._move( "next", "first", event ); + }, + + previous: function( event ) { + this._move( "prev", "last", event ); + }, + + isFirstItem: function() { + return this.active && !this.active.prevAll( ".ui-menu-item" ).length; + }, + + isLastItem: function() { + return this.active && !this.active.nextAll( ".ui-menu-item" ).length; + }, + + _move: function( direction, filter, event ) { + var next; + if ( this.active ) { + if ( direction === "first" || direction === "last" ) { + next = this.active + [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" ) + .eq( -1 ); + } else { + next = this.active + [ direction + "All" ]( ".ui-menu-item" ) + .eq( 0 ); + } + } + if ( !next || !next.length || !this.active ) { + next = this.activeMenu.children( ".ui-menu-item" )[ filter ](); + } + + this.focus( event, next ); + }, + + nextPage: function( event ) { + var item, base, height; + + if ( !this.active ) { + this.next( event ); + return; + } + if ( this.isLastItem() ) { + return; + } + if ( this._hasScroll() ) { + base = this.active.offset().top; + height = this.element.height(); + this.active.nextAll( ".ui-menu-item" ).each(function() { + item = $( this ); + return item.offset().top - base - height < 0; + }); + + this.focus( event, item ); + } else { + this.focus( event, this.activeMenu.children( ".ui-menu-item" ) + [ !this.active ? "first" : "last" ]() ); + } + }, + + previousPage: function( event ) { + var item, base, height; + if ( !this.active ) { + this.next( event ); + return; + } + if ( this.isFirstItem() ) { + return; + } + if ( this._hasScroll() ) { + base = this.active.offset().top; + height = this.element.height(); + this.active.prevAll( ".ui-menu-item" ).each(function() { + item = $( this ); + return item.offset().top - base + height > 0; + }); + + this.focus( event, item ); + } else { + this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() ); + } + }, + + _hasScroll: function() { + return this.element.outerHeight() < this.element.prop( "scrollHeight" ); + }, + + select: function( event ) { + // TODO: It should never be possible to not have an active item at this + // point, but the tests don't trigger mouseenter before click. + this.active = this.active || $( event.target ).closest( ".ui-menu-item" ); + var ui = { item: this.active }; + if ( !this.active.has( ".ui-menu" ).length ) { + this.collapseAll( event, true ); + } + this._trigger( "select", event, ui ); + } +}); + +}( jQuery )); +(function( $, undefined ) { + +$.widget( "ui.progressbar", { + version: "1.9.2", + options: { + value: 0, + max: 100 + }, + + min: 0, + + _create: function() { + this.element + .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) + .attr({ + role: "progressbar", + "aria-valuemin": this.min, + "aria-valuemax": this.options.max, + "aria-valuenow": this._value() + }); + + this.valueDiv = $( "
        " ) + .appendTo( this.element ); + + this.oldValue = this._value(); + this._refreshValue(); + }, + + _destroy: function() { + this.element + .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) + .removeAttr( "role" ) + .removeAttr( "aria-valuemin" ) + .removeAttr( "aria-valuemax" ) + .removeAttr( "aria-valuenow" ); + + this.valueDiv.remove(); + }, + + value: function( newValue ) { + if ( newValue === undefined ) { + return this._value(); + } + + this._setOption( "value", newValue ); + return this; + }, + + _setOption: function( key, value ) { + if ( key === "value" ) { + this.options.value = value; + this._refreshValue(); + if ( this._value() === this.options.max ) { + this._trigger( "complete" ); + } + } + + this._super( key, value ); + }, + + _value: function() { + var val = this.options.value; + // normalize invalid value + if ( typeof val !== "number" ) { + val = 0; + } + return Math.min( this.options.max, Math.max( this.min, val ) ); + }, + + _percentage: function() { + return 100 * this._value() / this.options.max; + }, + + _refreshValue: function() { + var value = this.value(), + percentage = this._percentage(); + + if ( this.oldValue !== value ) { + this.oldValue = value; + this._trigger( "change" ); + } + + this.valueDiv + .toggle( value > this.min ) + .toggleClass( "ui-corner-right", value === this.options.max ) + .width( percentage.toFixed(0) + "%" ); + this.element.attr( "aria-valuenow", value ); + } +}); + +})( jQuery ); +(function( $, undefined ) { + +$.widget("ui.resizable", $.ui.mouse, { + version: "1.9.2", + widgetEventPrefix: "resize", + options: { + alsoResize: false, + animate: false, + animateDuration: "slow", + animateEasing: "swing", + aspectRatio: false, + autoHide: false, + containment: false, + ghost: false, + grid: false, + handles: "e,s,se", + helper: false, + maxHeight: null, + maxWidth: null, + minHeight: 10, + minWidth: 10, + zIndex: 1000 + }, + _create: function() { + + var that = this, o = this.options; + this.element.addClass("ui-resizable"); + + $.extend(this, { + _aspectRatio: !!(o.aspectRatio), + aspectRatio: o.aspectRatio, + originalElement: this.element, + _proportionallyResizeElements: [], + _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null + }); + + //Wrap the element if it cannot hold child nodes + if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) { + + //Create a wrapper element and set the wrapper to the new current internal element + this.element.wrap( + $('
        ').css({ + position: this.element.css('position'), + width: this.element.outerWidth(), + height: this.element.outerHeight(), + top: this.element.css('top'), + left: this.element.css('left') + }) + ); + + //Overwrite the original this.element + this.element = this.element.parent().data( + "resizable", this.element.data('resizable') + ); + + this.elementIsWrapper = true; + + //Move margins to the wrapper + this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") }); + this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0}); + + //Prevent Safari textarea resize + this.originalResizeStyle = this.originalElement.css('resize'); + this.originalElement.css('resize', 'none'); + + //Push the actual element to our proportionallyResize internal array + this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' })); + + // avoid IE jump (hard set the margin) + this.originalElement.css({ margin: this.originalElement.css('margin') }); + + // fix handlers offset + this._proportionallyResize(); + + } + + this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' }); + if(this.handles.constructor == String) { + + if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw'; + var n = this.handles.split(","); this.handles = {}; + + for(var i = 0; i < n.length; i++) { + + var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle; + var axis = $('
        '); + + // Apply zIndex to all handles - see #7960 + axis.css({ zIndex: o.zIndex }); + + //TODO : What's going on here? + if ('se' == handle) { + axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se'); + }; + + //Insert into internal handles object and append to element + this.handles[handle] = '.ui-resizable-'+handle; + this.element.append(axis); + } + + } + + this._renderAxis = function(target) { + + target = target || this.element; + + for(var i in this.handles) { + + if(this.handles[i].constructor == String) + this.handles[i] = $(this.handles[i], this.element).show(); + + //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls) + if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) { + + var axis = $(this.handles[i], this.element), padWrapper = 0; + + //Checking the correct pad and border + padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth(); + + //The padding type i have to apply... + var padPos = [ 'padding', + /ne|nw|n/.test(i) ? 'Top' : + /se|sw|s/.test(i) ? 'Bottom' : + /^e$/.test(i) ? 'Right' : 'Left' ].join(""); + + target.css(padPos, padWrapper); + + this._proportionallyResize(); + + } + + //TODO: What's that good for? There's not anything to be executed left + if(!$(this.handles[i]).length) + continue; + + } + }; + + //TODO: make renderAxis a prototype function + this._renderAxis(this.element); + + this._handles = $('.ui-resizable-handle', this.element) + .disableSelection(); + + //Matching axis name + this._handles.mouseover(function() { + if (!that.resizing) { + if (this.className) + var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); + //Axis, default = se + that.axis = axis && axis[1] ? axis[1] : 'se'; + } + }); + + //If we want to auto hide the elements + if (o.autoHide) { + this._handles.hide(); + $(this.element) + .addClass("ui-resizable-autohide") + .mouseenter(function() { + if (o.disabled) return; + $(this).removeClass("ui-resizable-autohide"); + that._handles.show(); + }) + .mouseleave(function(){ + if (o.disabled) return; + if (!that.resizing) { + $(this).addClass("ui-resizable-autohide"); + that._handles.hide(); + } + }); + } + + //Initialize the mouse interaction + this._mouseInit(); + + }, + + _destroy: function() { + + this._mouseDestroy(); + + var _destroy = function(exp) { + $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing") + .removeData("resizable").removeData("ui-resizable").unbind(".resizable").find('.ui-resizable-handle').remove(); + }; + + //TODO: Unwrap at same DOM position + if (this.elementIsWrapper) { + _destroy(this.element); + var wrapper = this.element; + this.originalElement.css({ + position: wrapper.css('position'), + width: wrapper.outerWidth(), + height: wrapper.outerHeight(), + top: wrapper.css('top'), + left: wrapper.css('left') + }).insertAfter( wrapper ); + wrapper.remove(); + } + + this.originalElement.css('resize', this.originalResizeStyle); + _destroy(this.originalElement); + + return this; + }, + + _mouseCapture: function(event) { + var handle = false; + for (var i in this.handles) { + if ($(this.handles[i])[0] == event.target) { + handle = true; + } + } + + return !this.options.disabled && handle; + }, + + _mouseStart: function(event) { + + var o = this.options, iniPos = this.element.position(), el = this.element; + + this.resizing = true; + this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() }; + + // bugfix for http://dev.jquery.com/ticket/1749 + if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) { + el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left }); + } + + this._renderProxy(); + + var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top')); + + if (o.containment) { + curleft += $(o.containment).scrollLeft() || 0; + curtop += $(o.containment).scrollTop() || 0; + } + + //Store needed variables + this.offset = this.helper.offset(); + this.position = { left: curleft, top: curtop }; + this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; + this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; + this.originalPosition = { left: curleft, top: curtop }; + this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() }; + this.originalMousePosition = { left: event.pageX, top: event.pageY }; + + //Aspect Ratio + this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1); + + var cursor = $('.ui-resizable-' + this.axis).css('cursor'); + $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor); + + el.addClass("ui-resizable-resizing"); + this._propagate("start", event); + return true; + }, + + _mouseDrag: function(event) { + + //Increase performance, avoid regex + var el = this.helper, o = this.options, props = {}, + that = this, smp = this.originalMousePosition, a = this.axis; + + var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0; + var trigger = this._change[a]; + if (!trigger) return false; + + // Calculate the attrs that will be change + var data = trigger.apply(this, [event, dx, dy]); + + // Put this in the mouseDrag handler since the user can start pressing shift while resizing + this._updateVirtualBoundaries(event.shiftKey); + if (this._aspectRatio || event.shiftKey) + data = this._updateRatio(data, event); + + data = this._respectSize(data, event); + + // plugins callbacks need to be called first + this._propagate("resize", event); + + el.css({ + top: this.position.top + "px", left: this.position.left + "px", + width: this.size.width + "px", height: this.size.height + "px" + }); + + if (!this._helper && this._proportionallyResizeElements.length) + this._proportionallyResize(); + + this._updateCache(data); + + // calling the user callback at the end + this._trigger('resize', event, this.ui()); + + return false; + }, + + _mouseStop: function(event) { + + this.resizing = false; + var o = this.options, that = this; + + if(this._helper) { + var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), + soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height, + soffsetw = ista ? 0 : that.sizeDiff.width; + + var s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) }, + left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null, + top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null; + + if (!o.animate) + this.element.css($.extend(s, { top: top, left: left })); + + that.helper.height(that.size.height); + that.helper.width(that.size.width); + + if (this._helper && !o.animate) this._proportionallyResize(); + } + + $('body').css('cursor', 'auto'); + + this.element.removeClass("ui-resizable-resizing"); + + this._propagate("stop", event); + + if (this._helper) this.helper.remove(); + return false; + + }, + + _updateVirtualBoundaries: function(forceAspectRatio) { + var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b; + + b = { + minWidth: isNumber(o.minWidth) ? o.minWidth : 0, + maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity, + minHeight: isNumber(o.minHeight) ? o.minHeight : 0, + maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity + }; + + if(this._aspectRatio || forceAspectRatio) { + // We want to create an enclosing box whose aspect ration is the requested one + // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension + pMinWidth = b.minHeight * this.aspectRatio; + pMinHeight = b.minWidth / this.aspectRatio; + pMaxWidth = b.maxHeight * this.aspectRatio; + pMaxHeight = b.maxWidth / this.aspectRatio; + + if(pMinWidth > b.minWidth) b.minWidth = pMinWidth; + if(pMinHeight > b.minHeight) b.minHeight = pMinHeight; + if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth; + if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight; + } + this._vBoundaries = b; + }, + + _updateCache: function(data) { + var o = this.options; + this.offset = this.helper.offset(); + if (isNumber(data.left)) this.position.left = data.left; + if (isNumber(data.top)) this.position.top = data.top; + if (isNumber(data.height)) this.size.height = data.height; + if (isNumber(data.width)) this.size.width = data.width; + }, + + _updateRatio: function(data, event) { + + var o = this.options, cpos = this.position, csize = this.size, a = this.axis; + + if (isNumber(data.height)) data.width = (data.height * this.aspectRatio); + else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio); + + if (a == 'sw') { + data.left = cpos.left + (csize.width - data.width); + data.top = null; + } + if (a == 'nw') { + data.top = cpos.top + (csize.height - data.height); + data.left = cpos.left + (csize.width - data.width); + } + + return data; + }, + + _respectSize: function(data, event) { + + var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis, + ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), + isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height); + + if (isminw) data.width = o.minWidth; + if (isminh) data.height = o.minHeight; + if (ismaxw) data.width = o.maxWidth; + if (ismaxh) data.height = o.maxHeight; + + var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height; + var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); + + if (isminw && cw) data.left = dw - o.minWidth; + if (ismaxw && cw) data.left = dw - o.maxWidth; + if (isminh && ch) data.top = dh - o.minHeight; + if (ismaxh && ch) data.top = dh - o.maxHeight; + + // fixing jump error on top/left - bug #2330 + var isNotwh = !data.width && !data.height; + if (isNotwh && !data.left && data.top) data.top = null; + else if (isNotwh && !data.top && data.left) data.left = null; + + return data; + }, + + _proportionallyResize: function() { + + var o = this.options; + if (!this._proportionallyResizeElements.length) return; + var element = this.helper || this.element; + + for (var i=0; i < this._proportionallyResizeElements.length; i++) { + + var prel = this._proportionallyResizeElements[i]; + + if (!this.borderDif) { + var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')], + p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')]; + + this.borderDif = $.map(b, function(v, i) { + var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0; + return border + padding; + }); + } + + prel.css({ + height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0, + width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0 + }); + + }; + + }, + + _renderProxy: function() { + + var el = this.element, o = this.options; + this.elementOffset = el.offset(); + + if(this._helper) { + + this.helper = this.helper || $('
        '); + + // fix ie6 offset TODO: This seems broken + var ie6offset = ($.ui.ie6 ? 1 : 0), + pxyoffset = ( $.ui.ie6 ? 2 : -1 ); + + this.helper.addClass(this._helper).css({ + width: this.element.outerWidth() + pxyoffset, + height: this.element.outerHeight() + pxyoffset, + position: 'absolute', + left: this.elementOffset.left - ie6offset +'px', + top: this.elementOffset.top - ie6offset +'px', + zIndex: ++o.zIndex //TODO: Don't modify option + }); + + this.helper + .appendTo("body") + .disableSelection(); + + } else { + this.helper = this.element; + } + + }, + + _change: { + e: function(event, dx, dy) { + return { width: this.originalSize.width + dx }; + }, + w: function(event, dx, dy) { + var o = this.options, cs = this.originalSize, sp = this.originalPosition; + return { left: sp.left + dx, width: cs.width - dx }; + }, + n: function(event, dx, dy) { + var o = this.options, cs = this.originalSize, sp = this.originalPosition; + return { top: sp.top + dy, height: cs.height - dy }; + }, + s: function(event, dx, dy) { + return { height: this.originalSize.height + dy }; + }, + se: function(event, dx, dy) { + return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); + }, + sw: function(event, dx, dy) { + return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); + }, + ne: function(event, dx, dy) { + return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); + }, + nw: function(event, dx, dy) { + return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); + } + }, + + _propagate: function(n, event) { + $.ui.plugin.call(this, n, [event, this.ui()]); + (n != "resize" && this._trigger(n, event, this.ui())); + }, + + plugins: {}, + + ui: function() { + return { + originalElement: this.originalElement, + element: this.element, + helper: this.helper, + position: this.position, + size: this.size, + originalSize: this.originalSize, + originalPosition: this.originalPosition + }; + } + +}); + +/* + * Resizable Extensions + */ + +$.ui.plugin.add("resizable", "alsoResize", { + + start: function (event, ui) { + var that = $(this).data("resizable"), o = that.options; + + var _store = function (exp) { + $(exp).each(function() { + var el = $(this); + el.data("resizable-alsoresize", { + width: parseInt(el.width(), 10), height: parseInt(el.height(), 10), + left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10) + }); + }); + }; + + if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) { + if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } + else { $.each(o.alsoResize, function (exp) { _store(exp); }); } + }else{ + _store(o.alsoResize); + } + }, + + resize: function (event, ui) { + var that = $(this).data("resizable"), o = that.options, os = that.originalSize, op = that.originalPosition; + + var delta = { + height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0, + top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0 + }, + + _alsoResize = function (exp, c) { + $(exp).each(function() { + var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, + css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left']; + + $.each(css, function (i, prop) { + var sum = (start[prop]||0) + (delta[prop]||0); + if (sum && sum >= 0) + style[prop] = sum || null; + }); + + el.css(style); + }); + }; + + if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { + $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); }); + }else{ + _alsoResize(o.alsoResize); + } + }, + + stop: function (event, ui) { + $(this).removeData("resizable-alsoresize"); + } +}); + +$.ui.plugin.add("resizable", "animate", { + + stop: function(event, ui) { + var that = $(this).data("resizable"), o = that.options; + + var pr = that._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), + soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height, + soffsetw = ista ? 0 : that.sizeDiff.width; + + var style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) }, + left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null, + top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null; + + that.element.animate( + $.extend(style, top && left ? { top: top, left: left } : {}), { + duration: o.animateDuration, + easing: o.animateEasing, + step: function() { + + var data = { + width: parseInt(that.element.css('width'), 10), + height: parseInt(that.element.css('height'), 10), + top: parseInt(that.element.css('top'), 10), + left: parseInt(that.element.css('left'), 10) + }; + + if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height }); + + // propagating resize, and updating values for each animation step + that._updateCache(data); + that._propagate("resize", event); + + } + } + ); + } + +}); + +$.ui.plugin.add("resizable", "containment", { + + start: function(event, ui) { + var that = $(this).data("resizable"), o = that.options, el = that.element; + var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc; + if (!ce) return; + + that.containerElement = $(ce); + + if (/document/.test(oc) || oc == document) { + that.containerOffset = { left: 0, top: 0 }; + that.containerPosition = { left: 0, top: 0 }; + + that.parentData = { + element: $(document), left: 0, top: 0, + width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight + }; + } + + // i'm a node, so compute top, left, right, bottom + else { + var element = $(ce), p = []; + $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); }); + + that.containerOffset = element.offset(); + that.containerPosition = element.position(); + that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) }; + + var co = that.containerOffset, ch = that.containerSize.height, cw = that.containerSize.width, + width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch); + + that.parentData = { + element: ce, left: co.left, top: co.top, width: width, height: height + }; + } + }, + + resize: function(event, ui) { + var that = $(this).data("resizable"), o = that.options, + ps = that.containerSize, co = that.containerOffset, cs = that.size, cp = that.position, + pRatio = that._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = that.containerElement; + + if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co; + + if (cp.left < (that._helper ? co.left : 0)) { + that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left)); + if (pRatio) that.size.height = that.size.width / that.aspectRatio; + that.position.left = o.helper ? co.left : 0; + } + + if (cp.top < (that._helper ? co.top : 0)) { + that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top); + if (pRatio) that.size.width = that.size.height * that.aspectRatio; + that.position.top = that._helper ? co.top : 0; + } + + that.offset.left = that.parentData.left+that.position.left; + that.offset.top = that.parentData.top+that.position.top; + + var woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width ), + hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height ); + + var isParent = that.containerElement.get(0) == that.element.parent().get(0), + isOffsetRelative = /relative|absolute/.test(that.containerElement.css('position')); + + if(isParent && isOffsetRelative) woset -= that.parentData.left; + + if (woset + that.size.width >= that.parentData.width) { + that.size.width = that.parentData.width - woset; + if (pRatio) that.size.height = that.size.width / that.aspectRatio; + } + + if (hoset + that.size.height >= that.parentData.height) { + that.size.height = that.parentData.height - hoset; + if (pRatio) that.size.width = that.size.height * that.aspectRatio; + } + }, + + stop: function(event, ui){ + var that = $(this).data("resizable"), o = that.options, cp = that.position, + co = that.containerOffset, cop = that.containerPosition, ce = that.containerElement; + + var helper = $(that.helper), ho = helper.offset(), w = helper.outerWidth() - that.sizeDiff.width, h = helper.outerHeight() - that.sizeDiff.height; + + if (that._helper && !o.animate && (/relative/).test(ce.css('position'))) + $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); + + if (that._helper && !o.animate && (/static/).test(ce.css('position'))) + $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); + + } +}); + +$.ui.plugin.add("resizable", "ghost", { + + start: function(event, ui) { + + var that = $(this).data("resizable"), o = that.options, cs = that.size; + + that.ghost = that.originalElement.clone(); + that.ghost + .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }) + .addClass('ui-resizable-ghost') + .addClass(typeof o.ghost == 'string' ? o.ghost : ''); + + that.ghost.appendTo(that.helper); + + }, + + resize: function(event, ui){ + var that = $(this).data("resizable"), o = that.options; + if (that.ghost) that.ghost.css({ position: 'relative', height: that.size.height, width: that.size.width }); + }, + + stop: function(event, ui){ + var that = $(this).data("resizable"), o = that.options; + if (that.ghost && that.helper) that.helper.get(0).removeChild(that.ghost.get(0)); + } + +}); + +$.ui.plugin.add("resizable", "grid", { + + resize: function(event, ui) { + var that = $(this).data("resizable"), o = that.options, cs = that.size, os = that.originalSize, op = that.originalPosition, a = that.axis, ratio = o._aspectRatio || event.shiftKey; + o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid; + var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1); + + if (/^(se|s|e)$/.test(a)) { + that.size.width = os.width + ox; + that.size.height = os.height + oy; + } + else if (/^(ne)$/.test(a)) { + that.size.width = os.width + ox; + that.size.height = os.height + oy; + that.position.top = op.top - oy; + } + else if (/^(sw)$/.test(a)) { + that.size.width = os.width + ox; + that.size.height = os.height + oy; + that.position.left = op.left - ox; + } + else { + that.size.width = os.width + ox; + that.size.height = os.height + oy; + that.position.top = op.top - oy; + that.position.left = op.left - ox; + } + } + +}); + +var num = function(v) { + return parseInt(v, 10) || 0; +}; + +var isNumber = function(value) { + return !isNaN(parseInt(value, 10)); +}; + +})(jQuery); +(function( $, undefined ) { + +$.widget("ui.selectable", $.ui.mouse, { + version: "1.9.2", + options: { + appendTo: 'body', + autoRefresh: true, + distance: 0, + filter: '*', + tolerance: 'touch' + }, + _create: function() { + var that = this; + + this.element.addClass("ui-selectable"); + + this.dragged = false; + + // cache selectee children based on filter + var selectees; + this.refresh = function() { + selectees = $(that.options.filter, that.element[0]); + selectees.addClass("ui-selectee"); + selectees.each(function() { + var $this = $(this); + var pos = $this.offset(); + $.data(this, "selectable-item", { + element: this, + $element: $this, + left: pos.left, + top: pos.top, + right: pos.left + $this.outerWidth(), + bottom: pos.top + $this.outerHeight(), + startselected: false, + selected: $this.hasClass('ui-selected'), + selecting: $this.hasClass('ui-selecting'), + unselecting: $this.hasClass('ui-unselecting') + }); + }); + }; + this.refresh(); + + this.selectees = selectees.addClass("ui-selectee"); + + this._mouseInit(); + + this.helper = $("
        "); + }, + + _destroy: function() { + this.selectees + .removeClass("ui-selectee") + .removeData("selectable-item"); + this.element + .removeClass("ui-selectable ui-selectable-disabled"); + this._mouseDestroy(); + }, + + _mouseStart: function(event) { + var that = this; + + this.opos = [event.pageX, event.pageY]; + + if (this.options.disabled) + return; + + var options = this.options; + + this.selectees = $(options.filter, this.element[0]); + + this._trigger("start", event); + + $(options.appendTo).append(this.helper); + // position helper (lasso) + this.helper.css({ + "left": event.clientX, + "top": event.clientY, + "width": 0, + "height": 0 + }); + + if (options.autoRefresh) { + this.refresh(); + } + + this.selectees.filter('.ui-selected').each(function() { + var selectee = $.data(this, "selectable-item"); + selectee.startselected = true; + if (!event.metaKey && !event.ctrlKey) { + selectee.$element.removeClass('ui-selected'); + selectee.selected = false; + selectee.$element.addClass('ui-unselecting'); + selectee.unselecting = true; + // selectable UNSELECTING callback + that._trigger("unselecting", event, { + unselecting: selectee.element + }); + } + }); + + $(event.target).parents().andSelf().each(function() { + var selectee = $.data(this, "selectable-item"); + if (selectee) { + var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected'); + selectee.$element + .removeClass(doSelect ? "ui-unselecting" : "ui-selected") + .addClass(doSelect ? "ui-selecting" : "ui-unselecting"); + selectee.unselecting = !doSelect; + selectee.selecting = doSelect; + selectee.selected = doSelect; + // selectable (UN)SELECTING callback + if (doSelect) { + that._trigger("selecting", event, { + selecting: selectee.element + }); + } else { + that._trigger("unselecting", event, { + unselecting: selectee.element + }); + } + return false; + } + }); + + }, + + _mouseDrag: function(event) { + var that = this; + this.dragged = true; + + if (this.options.disabled) + return; + + var options = this.options; + + var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY; + if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; } + if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; } + this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1}); + + this.selectees.each(function() { + var selectee = $.data(this, "selectable-item"); + //prevent helper from being selected if appendTo: selectable + if (!selectee || selectee.element == that.element[0]) + return; + var hit = false; + if (options.tolerance == 'touch') { + hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) ); + } else if (options.tolerance == 'fit') { + hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2); + } + + if (hit) { + // SELECT + if (selectee.selected) { + selectee.$element.removeClass('ui-selected'); + selectee.selected = false; + } + if (selectee.unselecting) { + selectee.$element.removeClass('ui-unselecting'); + selectee.unselecting = false; + } + if (!selectee.selecting) { + selectee.$element.addClass('ui-selecting'); + selectee.selecting = true; + // selectable SELECTING callback + that._trigger("selecting", event, { + selecting: selectee.element + }); + } + } else { + // UNSELECT + if (selectee.selecting) { + if ((event.metaKey || event.ctrlKey) && selectee.startselected) { + selectee.$element.removeClass('ui-selecting'); + selectee.selecting = false; + selectee.$element.addClass('ui-selected'); + selectee.selected = true; + } else { + selectee.$element.removeClass('ui-selecting'); + selectee.selecting = false; + if (selectee.startselected) { + selectee.$element.addClass('ui-unselecting'); + selectee.unselecting = true; + } + // selectable UNSELECTING callback + that._trigger("unselecting", event, { + unselecting: selectee.element + }); + } + } + if (selectee.selected) { + if (!event.metaKey && !event.ctrlKey && !selectee.startselected) { + selectee.$element.removeClass('ui-selected'); + selectee.selected = false; + + selectee.$element.addClass('ui-unselecting'); + selectee.unselecting = true; + // selectable UNSELECTING callback + that._trigger("unselecting", event, { + unselecting: selectee.element + }); + } + } + } + }); + + return false; + }, + + _mouseStop: function(event) { + var that = this; + + this.dragged = false; + + var options = this.options; + + $('.ui-unselecting', this.element[0]).each(function() { + var selectee = $.data(this, "selectable-item"); + selectee.$element.removeClass('ui-unselecting'); + selectee.unselecting = false; + selectee.startselected = false; + that._trigger("unselected", event, { + unselected: selectee.element + }); + }); + $('.ui-selecting', this.element[0]).each(function() { + var selectee = $.data(this, "selectable-item"); + selectee.$element.removeClass('ui-selecting').addClass('ui-selected'); + selectee.selecting = false; + selectee.selected = true; + selectee.startselected = true; + that._trigger("selected", event, { + selected: selectee.element + }); + }); + this._trigger("stop", event); + + this.helper.remove(); + + return false; + } + +}); + +})(jQuery); +(function( $, undefined ) { + +// number of pages in a slider +// (how many times can you page up/down to go through the whole range) +var numPages = 5; + +$.widget( "ui.slider", $.ui.mouse, { + version: "1.9.2", + widgetEventPrefix: "slide", + + options: { + animate: false, + distance: 0, + max: 100, + min: 0, + orientation: "horizontal", + range: false, + step: 1, + value: 0, + values: null + }, + + _create: function() { + var i, handleCount, + o = this.options, + existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ), + handle = "", + handles = []; + + this._keySliding = false; + this._mouseSliding = false; + this._animateOff = true; + this._handleIndex = null; + this._detectOrientation(); + this._mouseInit(); + + this.element + .addClass( "ui-slider" + + " ui-slider-" + this.orientation + + " ui-widget" + + " ui-widget-content" + + " ui-corner-all" + + ( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) ); + + this.range = $([]); + + if ( o.range ) { + if ( o.range === true ) { + if ( !o.values ) { + o.values = [ this._valueMin(), this._valueMin() ]; + } + if ( o.values.length && o.values.length !== 2 ) { + o.values = [ o.values[0], o.values[0] ]; + } + } + + this.range = $( "
        " ) + .appendTo( this.element ) + .addClass( "ui-slider-range" + + // note: this isn't the most fittingly semantic framework class for this element, + // but worked best visually with a variety of themes + " ui-widget-header" + + ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) ); + } + + handleCount = ( o.values && o.values.length ) || 1; + + for ( i = existingHandles.length; i < handleCount; i++ ) { + handles.push( handle ); + } + + this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) ); + + this.handle = this.handles.eq( 0 ); + + this.handles.add( this.range ).filter( "a" ) + .click(function( event ) { + event.preventDefault(); + }) + .mouseenter(function() { + if ( !o.disabled ) { + $( this ).addClass( "ui-state-hover" ); + } + }) + .mouseleave(function() { + $( this ).removeClass( "ui-state-hover" ); + }) + .focus(function() { + if ( !o.disabled ) { + $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" ); + $( this ).addClass( "ui-state-focus" ); + } else { + $( this ).blur(); + } + }) + .blur(function() { + $( this ).removeClass( "ui-state-focus" ); + }); + + this.handles.each(function( i ) { + $( this ).data( "ui-slider-handle-index", i ); + }); + + this._on( this.handles, { + keydown: function( event ) { + var allowed, curVal, newVal, step, + index = $( event.target ).data( "ui-slider-handle-index" ); + + switch ( event.keyCode ) { + case $.ui.keyCode.HOME: + case $.ui.keyCode.END: + case $.ui.keyCode.PAGE_UP: + case $.ui.keyCode.PAGE_DOWN: + case $.ui.keyCode.UP: + case $.ui.keyCode.RIGHT: + case $.ui.keyCode.DOWN: + case $.ui.keyCode.LEFT: + event.preventDefault(); + if ( !this._keySliding ) { + this._keySliding = true; + $( event.target ).addClass( "ui-state-active" ); + allowed = this._start( event, index ); + if ( allowed === false ) { + return; + } + } + break; + } + + step = this.options.step; + if ( this.options.values && this.options.values.length ) { + curVal = newVal = this.values( index ); + } else { + curVal = newVal = this.value(); + } + + switch ( event.keyCode ) { + case $.ui.keyCode.HOME: + newVal = this._valueMin(); + break; + case $.ui.keyCode.END: + newVal = this._valueMax(); + break; + case $.ui.keyCode.PAGE_UP: + newVal = this._trimAlignValue( curVal + ( (this._valueMax() - this._valueMin()) / numPages ) ); + break; + case $.ui.keyCode.PAGE_DOWN: + newVal = this._trimAlignValue( curVal - ( (this._valueMax() - this._valueMin()) / numPages ) ); + break; + case $.ui.keyCode.UP: + case $.ui.keyCode.RIGHT: + if ( curVal === this._valueMax() ) { + return; + } + newVal = this._trimAlignValue( curVal + step ); + break; + case $.ui.keyCode.DOWN: + case $.ui.keyCode.LEFT: + if ( curVal === this._valueMin() ) { + return; + } + newVal = this._trimAlignValue( curVal - step ); + break; + } + + this._slide( event, index, newVal ); + }, + keyup: function( event ) { + var index = $( event.target ).data( "ui-slider-handle-index" ); + + if ( this._keySliding ) { + this._keySliding = false; + this._stop( event, index ); + this._change( event, index ); + $( event.target ).removeClass( "ui-state-active" ); + } + } + }); + + this._refreshValue(); + + this._animateOff = false; + }, + + _destroy: function() { + this.handles.remove(); + this.range.remove(); + + this.element + .removeClass( "ui-slider" + + " ui-slider-horizontal" + + " ui-slider-vertical" + + " ui-slider-disabled" + + " ui-widget" + + " ui-widget-content" + + " ui-corner-all" ); + + this._mouseDestroy(); + }, + + _mouseCapture: function( event ) { + var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle, + that = this, + o = this.options; + + if ( o.disabled ) { + return false; + } + + this.elementSize = { + width: this.element.outerWidth(), + height: this.element.outerHeight() + }; + this.elementOffset = this.element.offset(); + + position = { x: event.pageX, y: event.pageY }; + normValue = this._normValueFromMouse( position ); + distance = this._valueMax() - this._valueMin() + 1; + this.handles.each(function( i ) { + var thisDistance = Math.abs( normValue - that.values(i) ); + if ( distance > thisDistance ) { + distance = thisDistance; + closestHandle = $( this ); + index = i; + } + }); + + // workaround for bug #3736 (if both handles of a range are at 0, + // the first is always used as the one with least distance, + // and moving it is obviously prevented by preventing negative ranges) + if( o.range === true && this.values(1) === o.min ) { + index += 1; + closestHandle = $( this.handles[index] ); + } + + allowed = this._start( event, index ); + if ( allowed === false ) { + return false; + } + this._mouseSliding = true; + + this._handleIndex = index; + + closestHandle + .addClass( "ui-state-active" ) + .focus(); + + offset = closestHandle.offset(); + mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" ); + this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { + left: event.pageX - offset.left - ( closestHandle.width() / 2 ), + top: event.pageY - offset.top - + ( closestHandle.height() / 2 ) - + ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) - + ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) + + ( parseInt( closestHandle.css("marginTop"), 10 ) || 0) + }; + + if ( !this.handles.hasClass( "ui-state-hover" ) ) { + this._slide( event, index, normValue ); + } + this._animateOff = true; + return true; + }, + + _mouseStart: function() { + return true; + }, + + _mouseDrag: function( event ) { + var position = { x: event.pageX, y: event.pageY }, + normValue = this._normValueFromMouse( position ); + + this._slide( event, this._handleIndex, normValue ); + + return false; + }, + + _mouseStop: function( event ) { + this.handles.removeClass( "ui-state-active" ); + this._mouseSliding = false; + + this._stop( event, this._handleIndex ); + this._change( event, this._handleIndex ); + + this._handleIndex = null; + this._clickOffset = null; + this._animateOff = false; + + return false; + }, + + _detectOrientation: function() { + this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; + }, + + _normValueFromMouse: function( position ) { + var pixelTotal, + pixelMouse, + percentMouse, + valueTotal, + valueMouse; + + if ( this.orientation === "horizontal" ) { + pixelTotal = this.elementSize.width; + pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 ); + } else { + pixelTotal = this.elementSize.height; + pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 ); + } + + percentMouse = ( pixelMouse / pixelTotal ); + if ( percentMouse > 1 ) { + percentMouse = 1; + } + if ( percentMouse < 0 ) { + percentMouse = 0; + } + if ( this.orientation === "vertical" ) { + percentMouse = 1 - percentMouse; + } + + valueTotal = this._valueMax() - this._valueMin(); + valueMouse = this._valueMin() + percentMouse * valueTotal; + + return this._trimAlignValue( valueMouse ); + }, + + _start: function( event, index ) { + var uiHash = { + handle: this.handles[ index ], + value: this.value() + }; + if ( this.options.values && this.options.values.length ) { + uiHash.value = this.values( index ); + uiHash.values = this.values(); + } + return this._trigger( "start", event, uiHash ); + }, + + _slide: function( event, index, newVal ) { + var otherVal, + newValues, + allowed; + + if ( this.options.values && this.options.values.length ) { + otherVal = this.values( index ? 0 : 1 ); + + if ( ( this.options.values.length === 2 && this.options.range === true ) && + ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) ) + ) { + newVal = otherVal; + } + + if ( newVal !== this.values( index ) ) { + newValues = this.values(); + newValues[ index ] = newVal; + // A slide can be canceled by returning false from the slide callback + allowed = this._trigger( "slide", event, { + handle: this.handles[ index ], + value: newVal, + values: newValues + } ); + otherVal = this.values( index ? 0 : 1 ); + if ( allowed !== false ) { + this.values( index, newVal, true ); + } + } + } else { + if ( newVal !== this.value() ) { + // A slide can be canceled by returning false from the slide callback + allowed = this._trigger( "slide", event, { + handle: this.handles[ index ], + value: newVal + } ); + if ( allowed !== false ) { + this.value( newVal ); + } + } + } + }, + + _stop: function( event, index ) { + var uiHash = { + handle: this.handles[ index ], + value: this.value() + }; + if ( this.options.values && this.options.values.length ) { + uiHash.value = this.values( index ); + uiHash.values = this.values(); + } + + this._trigger( "stop", event, uiHash ); + }, + + _change: function( event, index ) { + if ( !this._keySliding && !this._mouseSliding ) { + var uiHash = { + handle: this.handles[ index ], + value: this.value() + }; + if ( this.options.values && this.options.values.length ) { + uiHash.value = this.values( index ); + uiHash.values = this.values(); + } + + this._trigger( "change", event, uiHash ); + } + }, + + value: function( newValue ) { + if ( arguments.length ) { + this.options.value = this._trimAlignValue( newValue ); + this._refreshValue(); + this._change( null, 0 ); + return; + } + + return this._value(); + }, + + values: function( index, newValue ) { + var vals, + newValues, + i; + + if ( arguments.length > 1 ) { + this.options.values[ index ] = this._trimAlignValue( newValue ); + this._refreshValue(); + this._change( null, index ); + return; + } + + if ( arguments.length ) { + if ( $.isArray( arguments[ 0 ] ) ) { + vals = this.options.values; + newValues = arguments[ 0 ]; + for ( i = 0; i < vals.length; i += 1 ) { + vals[ i ] = this._trimAlignValue( newValues[ i ] ); + this._change( null, i ); + } + this._refreshValue(); + } else { + if ( this.options.values && this.options.values.length ) { + return this._values( index ); + } else { + return this.value(); + } + } + } else { + return this._values(); + } + }, + + _setOption: function( key, value ) { + var i, + valsLength = 0; + + if ( $.isArray( this.options.values ) ) { + valsLength = this.options.values.length; + } + + $.Widget.prototype._setOption.apply( this, arguments ); + + switch ( key ) { + case "disabled": + if ( value ) { + this.handles.filter( ".ui-state-focus" ).blur(); + this.handles.removeClass( "ui-state-hover" ); + this.handles.prop( "disabled", true ); + this.element.addClass( "ui-disabled" ); + } else { + this.handles.prop( "disabled", false ); + this.element.removeClass( "ui-disabled" ); + } + break; + case "orientation": + this._detectOrientation(); + this.element + .removeClass( "ui-slider-horizontal ui-slider-vertical" ) + .addClass( "ui-slider-" + this.orientation ); + this._refreshValue(); + break; + case "value": + this._animateOff = true; + this._refreshValue(); + this._change( null, 0 ); + this._animateOff = false; + break; + case "values": + this._animateOff = true; + this._refreshValue(); + for ( i = 0; i < valsLength; i += 1 ) { + this._change( null, i ); + } + this._animateOff = false; + break; + case "min": + case "max": + this._animateOff = true; + this._refreshValue(); + this._animateOff = false; + break; + } + }, + + //internal value getter + // _value() returns value trimmed by min and max, aligned by step + _value: function() { + var val = this.options.value; + val = this._trimAlignValue( val ); + + return val; + }, + + //internal values getter + // _values() returns array of values trimmed by min and max, aligned by step + // _values( index ) returns single value trimmed by min and max, aligned by step + _values: function( index ) { + var val, + vals, + i; + + if ( arguments.length ) { + val = this.options.values[ index ]; + val = this._trimAlignValue( val ); + + return val; + } else { + // .slice() creates a copy of the array + // this copy gets trimmed by min and max and then returned + vals = this.options.values.slice(); + for ( i = 0; i < vals.length; i+= 1) { + vals[ i ] = this._trimAlignValue( vals[ i ] ); + } + + return vals; + } + }, + + // returns the step-aligned value that val is closest to, between (inclusive) min and max + _trimAlignValue: function( val ) { + if ( val <= this._valueMin() ) { + return this._valueMin(); + } + if ( val >= this._valueMax() ) { + return this._valueMax(); + } + var step = ( this.options.step > 0 ) ? this.options.step : 1, + valModStep = (val - this._valueMin()) % step, + alignValue = val - valModStep; + + if ( Math.abs(valModStep) * 2 >= step ) { + alignValue += ( valModStep > 0 ) ? step : ( -step ); + } + + // Since JavaScript has problems with large floats, round + // the final value to 5 digits after the decimal point (see #4124) + return parseFloat( alignValue.toFixed(5) ); + }, + + _valueMin: function() { + return this.options.min; + }, + + _valueMax: function() { + return this.options.max; + }, + + _refreshValue: function() { + var lastValPercent, valPercent, value, valueMin, valueMax, + oRange = this.options.range, + o = this.options, + that = this, + animate = ( !this._animateOff ) ? o.animate : false, + _set = {}; + + if ( this.options.values && this.options.values.length ) { + this.handles.each(function( i ) { + valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100; + _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; + $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); + if ( that.options.range === true ) { + if ( that.orientation === "horizontal" ) { + if ( i === 0 ) { + that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate ); + } + if ( i === 1 ) { + that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); + } + } else { + if ( i === 0 ) { + that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate ); + } + if ( i === 1 ) { + that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); + } + } + } + lastValPercent = valPercent; + }); + } else { + value = this.value(); + valueMin = this._valueMin(); + valueMax = this._valueMax(); + valPercent = ( valueMax !== valueMin ) ? + ( value - valueMin ) / ( valueMax - valueMin ) * 100 : + 0; + _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; + this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); + + if ( oRange === "min" && this.orientation === "horizontal" ) { + this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate ); + } + if ( oRange === "max" && this.orientation === "horizontal" ) { + this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); + } + if ( oRange === "min" && this.orientation === "vertical" ) { + this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate ); + } + if ( oRange === "max" && this.orientation === "vertical" ) { + this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); + } + } + } + +}); + +}(jQuery)); +(function( $, undefined ) { + +$.widget("ui.sortable", $.ui.mouse, { + version: "1.9.2", + widgetEventPrefix: "sort", + ready: false, + options: { + appendTo: "parent", + axis: false, + connectWith: false, + containment: false, + cursor: 'auto', + cursorAt: false, + dropOnEmpty: true, + forcePlaceholderSize: false, + forceHelperSize: false, + grid: false, + handle: false, + helper: "original", + items: '> *', + opacity: false, + placeholder: false, + revert: false, + scroll: true, + scrollSensitivity: 20, + scrollSpeed: 20, + scope: "default", + tolerance: "intersect", + zIndex: 1000 + }, + _create: function() { + + var o = this.options; + this.containerCache = {}; + this.element.addClass("ui-sortable"); + + //Get the items + this.refresh(); + + //Let's determine if the items are being displayed horizontally + this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false; + + //Let's determine the parent's offset + this.offset = this.element.offset(); + + //Initialize mouse events for interaction + this._mouseInit(); + + //We're ready to go + this.ready = true + + }, + + _destroy: function() { + this.element + .removeClass("ui-sortable ui-sortable-disabled"); + this._mouseDestroy(); + + for ( var i = this.items.length - 1; i >= 0; i-- ) + this.items[i].item.removeData(this.widgetName + "-item"); + + return this; + }, + + _setOption: function(key, value){ + if ( key === "disabled" ) { + this.options[ key ] = value; + + this.widget().toggleClass( "ui-sortable-disabled", !!value ); + } else { + // Don't call widget base _setOption for disable as it adds ui-state-disabled class + $.Widget.prototype._setOption.apply(this, arguments); + } + }, + + _mouseCapture: function(event, overrideHandle) { + var that = this; + + if (this.reverting) { + return false; + } + + if(this.options.disabled || this.options.type == 'static') return false; + + //We have to refresh the items data once first + this._refreshItems(event); + + //Find out if the clicked node (or one of its parents) is a actual item in this.items + var currentItem = null, nodes = $(event.target).parents().each(function() { + if($.data(this, that.widgetName + '-item') == that) { + currentItem = $(this); + return false; + } + }); + if($.data(event.target, that.widgetName + '-item') == that) currentItem = $(event.target); + + if(!currentItem) return false; + if(this.options.handle && !overrideHandle) { + var validHandle = false; + + $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; }); + if(!validHandle) return false; + } + + this.currentItem = currentItem; + this._removeCurrentsFromItems(); + return true; + + }, + + _mouseStart: function(event, overrideHandle, noActivation) { + + var o = this.options; + this.currentContainer = this; + + //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture + this.refreshPositions(); + + //Create and append the visible helper + this.helper = this._createHelper(event); + + //Cache the helper size + this._cacheHelperProportions(); + + /* + * - Position generation - + * This block generates everything position related - it's the core of draggables. + */ + + //Cache the margins of the original element + this._cacheMargins(); + + //Get the next scrolling parent + this.scrollParent = this.helper.scrollParent(); + + //The element's absolute position on the page minus margins + this.offset = this.currentItem.offset(); + this.offset = { + top: this.offset.top - this.margins.top, + left: this.offset.left - this.margins.left + }; + + $.extend(this.offset, { + click: { //Where the click happened, relative to the element + left: event.pageX - this.offset.left, + top: event.pageY - this.offset.top + }, + parent: this._getParentOffset(), + relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper + }); + + // Only after we got the offset, we can change the helper's position to absolute + // TODO: Still need to figure out a way to make relative sorting possible + this.helper.css("position", "absolute"); + this.cssPosition = this.helper.css("position"); + + //Generate the original position + this.originalPosition = this._generatePosition(event); + this.originalPageX = event.pageX; + this.originalPageY = event.pageY; + + //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied + (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); + + //Cache the former DOM position + this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; + + //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way + if(this.helper[0] != this.currentItem[0]) { + this.currentItem.hide(); + } + + //Create the placeholder + this._createPlaceholder(); + + //Set a containment if given in the options + if(o.containment) + this._setContainment(); + + if(o.cursor) { // cursor option + if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor"); + $('body').css("cursor", o.cursor); + } + + if(o.opacity) { // opacity option + if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity"); + this.helper.css("opacity", o.opacity); + } + + if(o.zIndex) { // zIndex option + if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex"); + this.helper.css("zIndex", o.zIndex); + } + + //Prepare scrolling + if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') + this.overflowOffset = this.scrollParent.offset(); + + //Call callbacks + this._trigger("start", event, this._uiHash()); + + //Recache the helper size + if(!this._preserveHelperProportions) + this._cacheHelperProportions(); + + + //Post 'activate' events to possible containers + if(!noActivation) { + for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, this._uiHash(this)); } + } + + //Prepare possible droppables + if($.ui.ddmanager) + $.ui.ddmanager.current = this; + + if ($.ui.ddmanager && !o.dropBehaviour) + $.ui.ddmanager.prepareOffsets(this, event); + + this.dragging = true; + + this.helper.addClass("ui-sortable-helper"); + this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position + return true; + + }, + + _mouseDrag: function(event) { + + //Compute the helpers position + this.position = this._generatePosition(event); + this.positionAbs = this._convertPositionTo("absolute"); + + if (!this.lastPositionAbs) { + this.lastPositionAbs = this.positionAbs; + } + + //Do scrolling + if(this.options.scroll) { + var o = this.options, scrolled = false; + if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') { + + if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) + this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; + else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) + this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; + + if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) + this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed; + else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) + this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; + + } else { + + if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) + scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); + else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) + scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); + + if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) + scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); + else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) + scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); + + } + + if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) + $.ui.ddmanager.prepareOffsets(this, event); + } + + //Regenerate the absolute position used for position checks + this.positionAbs = this._convertPositionTo("absolute"); + + //Set the helper position + if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; + if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; + + //Rearrange + for (var i = this.items.length - 1; i >= 0; i--) { + + //Cache variables and intersection, continue if no intersection + var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item); + if (!intersection) continue; + + // Only put the placeholder inside the current Container, skip all + // items form other containers. This works because when moving + // an item from one container to another the + // currentContainer is switched before the placeholder is moved. + // + // Without this moving items in "sub-sortables" can cause the placeholder to jitter + // beetween the outer and inner container. + if (item.instance !== this.currentContainer) continue; + + if (itemElement != this.currentItem[0] //cannot intersect with itself + && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before + && !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked + && (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true) + //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container + ) { + + this.direction = intersection == 1 ? "down" : "up"; + + if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) { + this._rearrange(event, item); + } else { + break; + } + + this._trigger("change", event, this._uiHash()); + break; + } + } + + //Post events to containers + this._contactContainers(event); + + //Interconnect with droppables + if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); + + //Call callbacks + this._trigger('sort', event, this._uiHash()); + + this.lastPositionAbs = this.positionAbs; + return false; + + }, + + _mouseStop: function(event, noPropagation) { + + if(!event) return; + + //If we are using droppables, inform the manager about the drop + if ($.ui.ddmanager && !this.options.dropBehaviour) + $.ui.ddmanager.drop(this, event); + + if(this.options.revert) { + var that = this; + var cur = this.placeholder.offset(); + + this.reverting = true; + + $(this.helper).animate({ + left: cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), + top: cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) + }, parseInt(this.options.revert, 10) || 500, function() { + that._clear(event); + }); + } else { + this._clear(event, noPropagation); + } + + return false; + + }, + + cancel: function() { + + if(this.dragging) { + + this._mouseUp({ target: null }); + + if(this.options.helper == "original") + this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); + else + this.currentItem.show(); + + //Post deactivating events to containers + for (var i = this.containers.length - 1; i >= 0; i--){ + this.containers[i]._trigger("deactivate", null, this._uiHash(this)); + if(this.containers[i].containerCache.over) { + this.containers[i]._trigger("out", null, this._uiHash(this)); + this.containers[i].containerCache.over = 0; + } + } + + } + + if (this.placeholder) { + //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! + if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]); + if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove(); + + $.extend(this, { + helper: null, + dragging: false, + reverting: false, + _noFinalSort: null + }); + + if(this.domPosition.prev) { + $(this.domPosition.prev).after(this.currentItem); + } else { + $(this.domPosition.parent).prepend(this.currentItem); + } + } + + return this; + + }, + + serialize: function(o) { + + var items = this._getItemsAsjQuery(o && o.connected); + var str = []; o = o || {}; + + $(items).each(function() { + var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/)); + if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2])); + }); + + if(!str.length && o.key) { + str.push(o.key + '='); + } + + return str.join('&'); + + }, + + toArray: function(o) { + + var items = this._getItemsAsjQuery(o && o.connected); + var ret = []; o = o || {}; + + items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); }); + return ret; + + }, + + /* Be careful with the following core functions */ + _intersectsWith: function(item) { + + var x1 = this.positionAbs.left, + x2 = x1 + this.helperProportions.width, + y1 = this.positionAbs.top, + y2 = y1 + this.helperProportions.height; + + var l = item.left, + r = l + item.width, + t = item.top, + b = t + item.height; + + var dyClick = this.offset.click.top, + dxClick = this.offset.click.left; + + var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r; + + if( this.options.tolerance == "pointer" + || this.options.forcePointerForContainers + || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height']) + ) { + return isOverElement; + } else { + + return (l < x1 + (this.helperProportions.width / 2) // Right Half + && x2 - (this.helperProportions.width / 2) < r // Left Half + && t < y1 + (this.helperProportions.height / 2) // Bottom Half + && y2 - (this.helperProportions.height / 2) < b ); // Top Half + + } + }, + + _intersectsWithPointer: function(item) { + + var isOverElementHeight = (this.options.axis === 'x') || $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), + isOverElementWidth = (this.options.axis === 'y') || $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), + isOverElement = isOverElementHeight && isOverElementWidth, + verticalDirection = this._getDragVerticalDirection(), + horizontalDirection = this._getDragHorizontalDirection(); + + if (!isOverElement) + return false; + + return this.floating ? + ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 ) + : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) ); + + }, + + _intersectsWithSides: function(item) { + + var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height), + isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width), + verticalDirection = this._getDragVerticalDirection(), + horizontalDirection = this._getDragHorizontalDirection(); + + if (this.floating && horizontalDirection) { + return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf)); + } else { + return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf)); + } + + }, + + _getDragVerticalDirection: function() { + var delta = this.positionAbs.top - this.lastPositionAbs.top; + return delta != 0 && (delta > 0 ? "down" : "up"); + }, + + _getDragHorizontalDirection: function() { + var delta = this.positionAbs.left - this.lastPositionAbs.left; + return delta != 0 && (delta > 0 ? "right" : "left"); + }, + + refresh: function(event) { + this._refreshItems(event); + this.refreshPositions(); + return this; + }, + + _connectWith: function() { + var options = this.options; + return options.connectWith.constructor == String + ? [options.connectWith] + : options.connectWith; + }, + + _getItemsAsjQuery: function(connected) { + + var items = []; + var queries = []; + var connectWith = this._connectWith(); + + if(connectWith && connected) { + for (var i = connectWith.length - 1; i >= 0; i--){ + var cur = $(connectWith[i]); + for (var j = cur.length - 1; j >= 0; j--){ + var inst = $.data(cur[j], this.widgetName); + if(inst && inst != this && !inst.options.disabled) { + queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]); + } + }; + }; + } + + queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]); + + for (var i = queries.length - 1; i >= 0; i--){ + queries[i][0].each(function() { + items.push(this); + }); + }; + + return $(items); + + }, + + _removeCurrentsFromItems: function() { + + var list = this.currentItem.find(":data(" + this.widgetName + "-item)"); + + this.items = $.grep(this.items, function (item) { + for (var j=0; j < list.length; j++) { + if(list[j] == item.item[0]) + return false; + }; + return true; + }); + + }, + + _refreshItems: function(event) { + + this.items = []; + this.containers = [this]; + var items = this.items; + var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]]; + var connectWith = this._connectWith(); + + if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down + for (var i = connectWith.length - 1; i >= 0; i--){ + var cur = $(connectWith[i]); + for (var j = cur.length - 1; j >= 0; j--){ + var inst = $.data(cur[j], this.widgetName); + if(inst && inst != this && !inst.options.disabled) { + queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]); + this.containers.push(inst); + } + }; + }; + } + + for (var i = queries.length - 1; i >= 0; i--) { + var targetData = queries[i][1]; + var _queries = queries[i][0]; + + for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) { + var item = $(_queries[j]); + + item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager) + + items.push({ + item: item, + instance: targetData, + width: 0, height: 0, + left: 0, top: 0 + }); + }; + }; + + }, + + refreshPositions: function(fast) { + + //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change + if(this.offsetParent && this.helper) { + this.offset.parent = this._getParentOffset(); + } + + for (var i = this.items.length - 1; i >= 0; i--){ + var item = this.items[i]; + + //We ignore calculating positions of all connected containers when we're not over them + if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0]) + continue; + + var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; + + if (!fast) { + item.width = t.outerWidth(); + item.height = t.outerHeight(); + } + + var p = t.offset(); + item.left = p.left; + item.top = p.top; + }; + + if(this.options.custom && this.options.custom.refreshContainers) { + this.options.custom.refreshContainers.call(this); + } else { + for (var i = this.containers.length - 1; i >= 0; i--){ + var p = this.containers[i].element.offset(); + this.containers[i].containerCache.left = p.left; + this.containers[i].containerCache.top = p.top; + this.containers[i].containerCache.width = this.containers[i].element.outerWidth(); + this.containers[i].containerCache.height = this.containers[i].element.outerHeight(); + }; + } + + return this; + }, + + _createPlaceholder: function(that) { + that = that || this; + var o = that.options; + + if(!o.placeholder || o.placeholder.constructor == String) { + var className = o.placeholder; + o.placeholder = { + element: function() { + + var el = $(document.createElement(that.currentItem[0].nodeName)) + .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder") + .removeClass("ui-sortable-helper")[0]; + + if(!className) + el.style.visibility = "hidden"; + + return el; + }, + update: function(container, p) { + + // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that + // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified + if(className && !o.forcePlaceholderSize) return; + + //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item + if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css('paddingTop')||0, 10) - parseInt(that.currentItem.css('paddingBottom')||0, 10)); }; + if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css('paddingLeft')||0, 10) - parseInt(that.currentItem.css('paddingRight')||0, 10)); }; + } + }; + } + + //Create the placeholder + that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem)); + + //Append it after the actual current item + that.currentItem.after(that.placeholder); + + //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) + o.placeholder.update(that, that.placeholder); + + }, + + _contactContainers: function(event) { + + // get innermost container that intersects with item + var innermostContainer = null, innermostIndex = null; + + + for (var i = this.containers.length - 1; i >= 0; i--){ + + // never consider a container that's located within the item itself + if($.contains(this.currentItem[0], this.containers[i].element[0])) + continue; + + if(this._intersectsWith(this.containers[i].containerCache)) { + + // if we've already found a container and it's more "inner" than this, then continue + if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) + continue; + + innermostContainer = this.containers[i]; + innermostIndex = i; + + } else { + // container doesn't intersect. trigger "out" event if necessary + if(this.containers[i].containerCache.over) { + this.containers[i]._trigger("out", event, this._uiHash(this)); + this.containers[i].containerCache.over = 0; + } + } + + } + + // if no intersecting containers found, return + if(!innermostContainer) return; + + // move the item into the container if it's not there already + if(this.containers.length === 1) { + this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); + this.containers[innermostIndex].containerCache.over = 1; + } else { + + //When entering a new container, we will find the item with the least distance and append our item near it + var dist = 10000; var itemWithLeastDistance = null; + var posProperty = this.containers[innermostIndex].floating ? 'left' : 'top'; + var sizeProperty = this.containers[innermostIndex].floating ? 'width' : 'height'; + var base = this.positionAbs[posProperty] + this.offset.click[posProperty]; + for (var j = this.items.length - 1; j >= 0; j--) { + if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue; + if(this.items[j].item[0] == this.currentItem[0]) continue; + var cur = this.items[j].item.offset()[posProperty]; + var nearBottom = false; + if(Math.abs(cur - base) > Math.abs(cur + this.items[j][sizeProperty] - base)){ + nearBottom = true; + cur += this.items[j][sizeProperty]; + } + + if(Math.abs(cur - base) < dist) { + dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j]; + this.direction = nearBottom ? "up": "down"; + } + } + + if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled + return; + + this.currentContainer = this.containers[innermostIndex]; + itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true); + this._trigger("change", event, this._uiHash()); + this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); + + //Update the placeholder + this.options.placeholder.update(this.currentContainer, this.placeholder); + + this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); + this.containers[innermostIndex].containerCache.over = 1; + } + + + }, + + _createHelper: function(event) { + + var o = this.options; + var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem); + + if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already + $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); + + if(helper[0] == this.currentItem[0]) + this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") }; + + if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width()); + if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height()); + + return helper; + + }, + + _adjustOffsetFromHelper: function(obj) { + if (typeof obj == 'string') { + obj = obj.split(' '); + } + if ($.isArray(obj)) { + obj = {left: +obj[0], top: +obj[1] || 0}; + } + if ('left' in obj) { + this.offset.click.left = obj.left + this.margins.left; + } + if ('right' in obj) { + this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; + } + if ('top' in obj) { + this.offset.click.top = obj.top + this.margins.top; + } + if ('bottom' in obj) { + this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; + } + }, + + _getParentOffset: function() { + + + //Get the offsetParent and cache its position + this.offsetParent = this.helper.offsetParent(); + var po = this.offsetParent.offset(); + + // This is a special case where we need to modify a offset calculated on start, since the following happened: + // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent + // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that + // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag + if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) { + po.left += this.scrollParent.scrollLeft(); + po.top += this.scrollParent.scrollTop(); + } + + if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information + || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix + po = { top: 0, left: 0 }; + + return { + top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), + left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) + }; + + }, + + _getRelativeOffset: function() { + + if(this.cssPosition == "relative") { + var p = this.currentItem.position(); + return { + top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), + left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() + }; + } else { + return { top: 0, left: 0 }; + } + + }, + + _cacheMargins: function() { + this.margins = { + left: (parseInt(this.currentItem.css("marginLeft"),10) || 0), + top: (parseInt(this.currentItem.css("marginTop"),10) || 0) + }; + }, + + _cacheHelperProportions: function() { + this.helperProportions = { + width: this.helper.outerWidth(), + height: this.helper.outerHeight() + }; + }, + + _setContainment: function() { + + var o = this.options; + if(o.containment == 'parent') o.containment = this.helper[0].parentNode; + if(o.containment == 'document' || o.containment == 'window') this.containment = [ + 0 - this.offset.relative.left - this.offset.parent.left, + 0 - this.offset.relative.top - this.offset.parent.top, + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top + ]; + + if(!(/^(document|window|parent)$/).test(o.containment)) { + var ce = $(o.containment)[0]; + var co = $(o.containment).offset(); + var over = ($(ce).css("overflow") != 'hidden'); + + this.containment = [ + co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, + co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, + co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left, + co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top + ]; + } + + }, + + _convertPositionTo: function(d, pos) { + + if(!pos) pos = this.position; + var mod = d == "absolute" ? 1 : -1; + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + + return { + top: ( + pos.top // The absolute mouse position + + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent + + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) + - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) + ), + left: ( + pos.left // The absolute mouse position + + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent + + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) + - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) + ) + }; + + }, + + _generatePosition: function(event) { + + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + + // This is another very weird special case that only happens for relative elements: + // 1. If the css position is relative + // 2. and the scroll parent is the document or similar to the offset parent + // we have to refresh the relative offset during the scroll so there are no jumps + if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { + this.offset.relative = this._getRelativeOffset(); + } + + var pageX = event.pageX; + var pageY = event.pageY; + + /* + * - Position constraining - + * Constrain the position to a mix of grid, containment. + */ + + if(this.originalPosition) { //If we are not dragging yet, we won't check for options + + if(this.containment) { + if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left; + if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top; + if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left; + if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top; + } + + if(o.grid) { + var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; + pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; + + var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; + pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; + } + + } + + return { + top: ( + pageY // The absolute mouse position + - this.offset.click.top // Click offset (relative to the element) + - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent + - this.offset.parent.top // The offsetParent's offset without borders (offset + border) + + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) + ), + left: ( + pageX // The absolute mouse position + - this.offset.click.left // Click offset (relative to the element) + - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent + - this.offset.parent.left // The offsetParent's offset without borders (offset + border) + + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) + ) + }; + + }, + + _rearrange: function(event, i, a, hardRefresh) { + + a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling)); + + //Various things done here to improve the performance: + // 1. we create a setTimeout, that calls refreshPositions + // 2. on the instance, we have a counter variable, that get's higher after every append + // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same + // 4. this lets only the last addition to the timeout stack through + this.counter = this.counter ? ++this.counter : 1; + var counter = this.counter; + + this._delay(function() { + if(counter == this.counter) this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove + }); + + }, + + _clear: function(event, noPropagation) { + + this.reverting = false; + // We delay all events that have to be triggered to after the point where the placeholder has been removed and + // everything else normalized again + var delayedTriggers = []; + + // We first have to update the dom position of the actual currentItem + // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088) + if(!this._noFinalSort && this.currentItem.parent().length) this.placeholder.before(this.currentItem); + this._noFinalSort = null; + + if(this.helper[0] == this.currentItem[0]) { + for(var i in this._storedCSS) { + if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = ''; + } + this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); + } else { + this.currentItem.show(); + } + + if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); }); + if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed + + // Check if the items Container has Changed and trigger appropriate + // events. + if (this !== this.currentContainer) { + if(!noPropagation) { + delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); }); + delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer)); + delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer)); + } + } + + + //Post events to containers + for (var i = this.containers.length - 1; i >= 0; i--){ + if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i])); + if(this.containers[i].containerCache.over) { + delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i])); + this.containers[i].containerCache.over = 0; + } + } + + //Do what was originally in plugins + if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor + if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity + if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index + + this.dragging = false; + if(this.cancelHelperRemoval) { + if(!noPropagation) { + this._trigger("beforeStop", event, this._uiHash()); + for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events + this._trigger("stop", event, this._uiHash()); + } + + this.fromOutside = false; + return false; + } + + if(!noPropagation) this._trigger("beforeStop", event, this._uiHash()); + + //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! + this.placeholder[0].parentNode.removeChild(this.placeholder[0]); + + if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null; + + if(!noPropagation) { + for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events + this._trigger("stop", event, this._uiHash()); + } + + this.fromOutside = false; + return true; + + }, + + _trigger: function() { + if ($.Widget.prototype._trigger.apply(this, arguments) === false) { + this.cancel(); + } + }, + + _uiHash: function(_inst) { + var inst = _inst || this; + return { + helper: inst.helper, + placeholder: inst.placeholder || $([]), + position: inst.position, + originalPosition: inst.originalPosition, + offset: inst.positionAbs, + item: inst.currentItem, + sender: _inst ? _inst.element : null + }; + } + +}); + +})(jQuery); +(function( $ ) { + +function modifier( fn ) { + return function() { + var previous = this.element.val(); + fn.apply( this, arguments ); + this._refresh(); + if ( previous !== this.element.val() ) { + this._trigger( "change" ); + } + }; +} + +$.widget( "ui.spinner", { + version: "1.9.2", + defaultElement: "", + widgetEventPrefix: "spin", + options: { + culture: null, + icons: { + down: "ui-icon-triangle-1-s", + up: "ui-icon-triangle-1-n" + }, + incremental: true, + max: null, + min: null, + numberFormat: null, + page: 10, + step: 1, + + change: null, + spin: null, + start: null, + stop: null + }, + + _create: function() { + // handle string values that need to be parsed + this._setOption( "max", this.options.max ); + this._setOption( "min", this.options.min ); + this._setOption( "step", this.options.step ); + + // format the value, but don't constrain + this._value( this.element.val(), true ); + + this._draw(); + this._on( this._events ); + this._refresh(); + + // turning off autocomplete prevents the browser from remembering the + // value when navigating through history, so we re-enable autocomplete + // if the page is unloaded before the widget is destroyed. #7790 + this._on( this.window, { + beforeunload: function() { + this.element.removeAttr( "autocomplete" ); + } + }); + }, + + _getCreateOptions: function() { + var options = {}, + element = this.element; + + $.each( [ "min", "max", "step" ], function( i, option ) { + var value = element.attr( option ); + if ( value !== undefined && value.length ) { + options[ option ] = value; + } + }); + + return options; + }, + + _events: { + keydown: function( event ) { + if ( this._start( event ) && this._keydown( event ) ) { + event.preventDefault(); + } + }, + keyup: "_stop", + focus: function() { + this.previous = this.element.val(); + }, + blur: function( event ) { + if ( this.cancelBlur ) { + delete this.cancelBlur; + return; + } + + this._refresh(); + if ( this.previous !== this.element.val() ) { + this._trigger( "change", event ); + } + }, + mousewheel: function( event, delta ) { + if ( !delta ) { + return; + } + if ( !this.spinning && !this._start( event ) ) { + return false; + } + + this._spin( (delta > 0 ? 1 : -1) * this.options.step, event ); + clearTimeout( this.mousewheelTimer ); + this.mousewheelTimer = this._delay(function() { + if ( this.spinning ) { + this._stop( event ); + } + }, 100 ); + event.preventDefault(); + }, + "mousedown .ui-spinner-button": function( event ) { + var previous; + + // We never want the buttons to have focus; whenever the user is + // interacting with the spinner, the focus should be on the input. + // If the input is focused then this.previous is properly set from + // when the input first received focus. If the input is not focused + // then we need to set this.previous based on the value before spinning. + previous = this.element[0] === this.document[0].activeElement ? + this.previous : this.element.val(); + function checkFocus() { + var isActive = this.element[0] === this.document[0].activeElement; + if ( !isActive ) { + this.element.focus(); + this.previous = previous; + // support: IE + // IE sets focus asynchronously, so we need to check if focus + // moved off of the input because the user clicked on the button. + this._delay(function() { + this.previous = previous; + }); + } + } + + // ensure focus is on (or stays on) the text field + event.preventDefault(); + checkFocus.call( this ); + + // support: IE + // IE doesn't prevent moving focus even with event.preventDefault() + // so we set a flag to know when we should ignore the blur event + // and check (again) if focus moved off of the input. + this.cancelBlur = true; + this._delay(function() { + delete this.cancelBlur; + checkFocus.call( this ); + }); + + if ( this._start( event ) === false ) { + return; + } + + this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event ); + }, + "mouseup .ui-spinner-button": "_stop", + "mouseenter .ui-spinner-button": function( event ) { + // button will add ui-state-active if mouse was down while mouseleave and kept down + if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) { + return; + } + + if ( this._start( event ) === false ) { + return false; + } + this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event ); + }, + // TODO: do we really want to consider this a stop? + // shouldn't we just stop the repeater and wait until mouseup before + // we trigger the stop event? + "mouseleave .ui-spinner-button": "_stop" + }, + + _draw: function() { + var uiSpinner = this.uiSpinner = this.element + .addClass( "ui-spinner-input" ) + .attr( "autocomplete", "off" ) + .wrap( this._uiSpinnerHtml() ) + .parent() + // add buttons + .append( this._buttonHtml() ); + + this.element.attr( "role", "spinbutton" ); + + // button bindings + this.buttons = uiSpinner.find( ".ui-spinner-button" ) + .attr( "tabIndex", -1 ) + .button() + .removeClass( "ui-corner-all" ); + + // IE 6 doesn't understand height: 50% for the buttons + // unless the wrapper has an explicit height + if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) && + uiSpinner.height() > 0 ) { + uiSpinner.height( uiSpinner.height() ); + } + + // disable spinner if element was already disabled + if ( this.options.disabled ) { + this.disable(); + } + }, + + _keydown: function( event ) { + var options = this.options, + keyCode = $.ui.keyCode; + + switch ( event.keyCode ) { + case keyCode.UP: + this._repeat( null, 1, event ); + return true; + case keyCode.DOWN: + this._repeat( null, -1, event ); + return true; + case keyCode.PAGE_UP: + this._repeat( null, options.page, event ); + return true; + case keyCode.PAGE_DOWN: + this._repeat( null, -options.page, event ); + return true; + } + + return false; + }, + + _uiSpinnerHtml: function() { + return ""; + }, + + _buttonHtml: function() { + return "" + + "" + + "" + + "" + + "" + + "" + + ""; + }, + + _start: function( event ) { + if ( !this.spinning && this._trigger( "start", event ) === false ) { + return false; + } + + if ( !this.counter ) { + this.counter = 1; + } + this.spinning = true; + return true; + }, + + _repeat: function( i, steps, event ) { + i = i || 500; + + clearTimeout( this.timer ); + this.timer = this._delay(function() { + this._repeat( 40, steps, event ); + }, i ); + + this._spin( steps * this.options.step, event ); + }, + + _spin: function( step, event ) { + var value = this.value() || 0; + + if ( !this.counter ) { + this.counter = 1; + } + + value = this._adjustValue( value + step * this._increment( this.counter ) ); + + if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) { + this._value( value ); + this.counter++; + } + }, + + _increment: function( i ) { + var incremental = this.options.incremental; + + if ( incremental ) { + return $.isFunction( incremental ) ? + incremental( i ) : + Math.floor( i*i*i/50000 - i*i/500 + 17*i/200 + 1 ); + } + + return 1; + }, + + _precision: function() { + var precision = this._precisionOf( this.options.step ); + if ( this.options.min !== null ) { + precision = Math.max( precision, this._precisionOf( this.options.min ) ); + } + return precision; + }, + + _precisionOf: function( num ) { + var str = num.toString(), + decimal = str.indexOf( "." ); + return decimal === -1 ? 0 : str.length - decimal - 1; + }, + + _adjustValue: function( value ) { + var base, aboveMin, + options = this.options; + + // make sure we're at a valid step + // - find out where we are relative to the base (min or 0) + base = options.min !== null ? options.min : 0; + aboveMin = value - base; + // - round to the nearest step + aboveMin = Math.round(aboveMin / options.step) * options.step; + // - rounding is based on 0, so adjust back to our base + value = base + aboveMin; + + // fix precision from bad JS floating point math + value = parseFloat( value.toFixed( this._precision() ) ); + + // clamp the value + if ( options.max !== null && value > options.max) { + return options.max; + } + if ( options.min !== null && value < options.min ) { + return options.min; + } + + return value; + }, + + _stop: function( event ) { + if ( !this.spinning ) { + return; + } + + clearTimeout( this.timer ); + clearTimeout( this.mousewheelTimer ); + this.counter = 0; + this.spinning = false; + this._trigger( "stop", event ); + }, + + _setOption: function( key, value ) { + if ( key === "culture" || key === "numberFormat" ) { + var prevValue = this._parse( this.element.val() ); + this.options[ key ] = value; + this.element.val( this._format( prevValue ) ); + return; + } + + if ( key === "max" || key === "min" || key === "step" ) { + if ( typeof value === "string" ) { + value = this._parse( value ); + } + } + + this._super( key, value ); + + if ( key === "disabled" ) { + if ( value ) { + this.element.prop( "disabled", true ); + this.buttons.button( "disable" ); + } else { + this.element.prop( "disabled", false ); + this.buttons.button( "enable" ); + } + } + }, + + _setOptions: modifier(function( options ) { + this._super( options ); + this._value( this.element.val() ); + }), + + _parse: function( val ) { + if ( typeof val === "string" && val !== "" ) { + val = window.Globalize && this.options.numberFormat ? + Globalize.parseFloat( val, 10, this.options.culture ) : +val; + } + return val === "" || isNaN( val ) ? null : val; + }, + + _format: function( value ) { + if ( value === "" ) { + return ""; + } + return window.Globalize && this.options.numberFormat ? + Globalize.format( value, this.options.numberFormat, this.options.culture ) : + value; + }, + + _refresh: function() { + this.element.attr({ + "aria-valuemin": this.options.min, + "aria-valuemax": this.options.max, + // TODO: what should we do with values that can't be parsed? + "aria-valuenow": this._parse( this.element.val() ) + }); + }, + + // update the value without triggering change + _value: function( value, allowAny ) { + var parsed; + if ( value !== "" ) { + parsed = this._parse( value ); + if ( parsed !== null ) { + if ( !allowAny ) { + parsed = this._adjustValue( parsed ); + } + value = this._format( parsed ); + } + } + this.element.val( value ); + this._refresh(); + }, + + _destroy: function() { + this.element + .removeClass( "ui-spinner-input" ) + .prop( "disabled", false ) + .removeAttr( "autocomplete" ) + .removeAttr( "role" ) + .removeAttr( "aria-valuemin" ) + .removeAttr( "aria-valuemax" ) + .removeAttr( "aria-valuenow" ); + this.uiSpinner.replaceWith( this.element ); + }, + + stepUp: modifier(function( steps ) { + this._stepUp( steps ); + }), + _stepUp: function( steps ) { + this._spin( (steps || 1) * this.options.step ); + }, + + stepDown: modifier(function( steps ) { + this._stepDown( steps ); + }), + _stepDown: function( steps ) { + this._spin( (steps || 1) * -this.options.step ); + }, + + pageUp: modifier(function( pages ) { + this._stepUp( (pages || 1) * this.options.page ); + }), + + pageDown: modifier(function( pages ) { + this._stepDown( (pages || 1) * this.options.page ); + }), + + value: function( newVal ) { + if ( !arguments.length ) { + return this._parse( this.element.val() ); + } + modifier( this._value ).call( this, newVal ); + }, + + widget: function() { + return this.uiSpinner; + } +}); + +}( jQuery ) ); +(function( $, undefined ) { + +var tabId = 0, + rhash = /#.*$/; + +function getNextTabId() { + return ++tabId; +} + +function isLocal( anchor ) { + return anchor.hash.length > 1 && + anchor.href.replace( rhash, "" ) === + location.href.replace( rhash, "" ) + // support: Safari 5.1 + // Safari 5.1 doesn't encode spaces in window.location + // but it does encode spaces from anchors (#8777) + .replace( /\s/g, "%20" ); +} + +$.widget( "ui.tabs", { + version: "1.9.2", + delay: 300, + options: { + active: null, + collapsible: false, + event: "click", + heightStyle: "content", + hide: null, + show: null, + + // callbacks + activate: null, + beforeActivate: null, + beforeLoad: null, + load: null + }, + + _create: function() { + var that = this, + options = this.options, + active = options.active, + locationHash = location.hash.substring( 1 ); + + this.running = false; + + this.element + .addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" ) + .toggleClass( "ui-tabs-collapsible", options.collapsible ) + // Prevent users from focusing disabled tabs via click + .delegate( ".ui-tabs-nav > li", "mousedown" + this.eventNamespace, function( event ) { + if ( $( this ).is( ".ui-state-disabled" ) ) { + event.preventDefault(); + } + }) + // support: IE <9 + // Preventing the default action in mousedown doesn't prevent IE + // from focusing the element, so if the anchor gets focused, blur. + // We don't have to worry about focusing the previously focused + // element since clicking on a non-focusable element should focus + // the body anyway. + .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() { + if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) { + this.blur(); + } + }); + + this._processTabs(); + + if ( active === null ) { + // check the fragment identifier in the URL + if ( locationHash ) { + this.tabs.each(function( i, tab ) { + if ( $( tab ).attr( "aria-controls" ) === locationHash ) { + active = i; + return false; + } + }); + } + + // check for a tab marked active via a class + if ( active === null ) { + active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); + } + + // no active tab, set to false + if ( active === null || active === -1 ) { + active = this.tabs.length ? 0 : false; + } + } + + // handle numbers: negative, out of range + if ( active !== false ) { + active = this.tabs.index( this.tabs.eq( active ) ); + if ( active === -1 ) { + active = options.collapsible ? false : 0; + } + } + options.active = active; + + // don't allow collapsible: false and active: false + if ( !options.collapsible && options.active === false && this.anchors.length ) { + options.active = 0; + } + + // Take disabling tabs via class attribute from HTML + // into account and update option properly. + if ( $.isArray( options.disabled ) ) { + options.disabled = $.unique( options.disabled.concat( + $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { + return that.tabs.index( li ); + }) + ) ).sort(); + } + + // check for length avoids error when initializing empty list + if ( this.options.active !== false && this.anchors.length ) { + this.active = this._findActive( this.options.active ); + } else { + this.active = $(); + } + + this._refresh(); + + if ( this.active.length ) { + this.load( options.active ); + } + }, + + _getCreateEventData: function() { + return { + tab: this.active, + panel: !this.active.length ? $() : this._getPanelForTab( this.active ) + }; + }, + + _tabKeydown: function( event ) { + var focusedTab = $( this.document[0].activeElement ).closest( "li" ), + selectedIndex = this.tabs.index( focusedTab ), + goingForward = true; + + if ( this._handlePageNav( event ) ) { + return; + } + + switch ( event.keyCode ) { + case $.ui.keyCode.RIGHT: + case $.ui.keyCode.DOWN: + selectedIndex++; + break; + case $.ui.keyCode.UP: + case $.ui.keyCode.LEFT: + goingForward = false; + selectedIndex--; + break; + case $.ui.keyCode.END: + selectedIndex = this.anchors.length - 1; + break; + case $.ui.keyCode.HOME: + selectedIndex = 0; + break; + case $.ui.keyCode.SPACE: + // Activate only, no collapsing + event.preventDefault(); + clearTimeout( this.activating ); + this._activate( selectedIndex ); + return; + case $.ui.keyCode.ENTER: + // Toggle (cancel delayed activation, allow collapsing) + event.preventDefault(); + clearTimeout( this.activating ); + // Determine if we should collapse or activate + this._activate( selectedIndex === this.options.active ? false : selectedIndex ); + return; + default: + return; + } + + // Focus the appropriate tab, based on which key was pressed + event.preventDefault(); + clearTimeout( this.activating ); + selectedIndex = this._focusNextTab( selectedIndex, goingForward ); + + // Navigating with control key will prevent automatic activation + if ( !event.ctrlKey ) { + // Update aria-selected immediately so that AT think the tab is already selected. + // Otherwise AT may confuse the user by stating that they need to activate the tab, + // but the tab will already be activated by the time the announcement finishes. + focusedTab.attr( "aria-selected", "false" ); + this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" ); + + this.activating = this._delay(function() { + this.option( "active", selectedIndex ); + }, this.delay ); + } + }, + + _panelKeydown: function( event ) { + if ( this._handlePageNav( event ) ) { + return; + } + + // Ctrl+up moves focus to the current tab + if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { + event.preventDefault(); + this.active.focus(); + } + }, + + // Alt+page up/down moves focus to the previous/next tab (and activates) + _handlePageNav: function( event ) { + if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) { + this._activate( this._focusNextTab( this.options.active - 1, false ) ); + return true; + } + if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) { + this._activate( this._focusNextTab( this.options.active + 1, true ) ); + return true; + } + }, + + _findNextTab: function( index, goingForward ) { + var lastTabIndex = this.tabs.length - 1; + + function constrain() { + if ( index > lastTabIndex ) { + index = 0; + } + if ( index < 0 ) { + index = lastTabIndex; + } + return index; + } + + while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) { + index = goingForward ? index + 1 : index - 1; + } + + return index; + }, + + _focusNextTab: function( index, goingForward ) { + index = this._findNextTab( index, goingForward ); + this.tabs.eq( index ).focus(); + return index; + }, + + _setOption: function( key, value ) { + if ( key === "active" ) { + // _activate() will handle invalid values and update this.options + this._activate( value ); + return; + } + + if ( key === "disabled" ) { + // don't use the widget factory's disabled handling + this._setupDisabled( value ); + return; + } + + this._super( key, value); + + if ( key === "collapsible" ) { + this.element.toggleClass( "ui-tabs-collapsible", value ); + // Setting collapsible: false while collapsed; open first panel + if ( !value && this.options.active === false ) { + this._activate( 0 ); + } + } + + if ( key === "event" ) { + this._setupEvents( value ); + } + + if ( key === "heightStyle" ) { + this._setupHeightStyle( value ); + } + }, + + _tabId: function( tab ) { + return tab.attr( "aria-controls" ) || "ui-tabs-" + getNextTabId(); + }, + + _sanitizeSelector: function( hash ) { + return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : ""; + }, + + refresh: function() { + var options = this.options, + lis = this.tablist.children( ":has(a[href])" ); + + // get disabled tabs from class attribute from HTML + // this will get converted to a boolean if needed in _refresh() + options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) { + return lis.index( tab ); + }); + + this._processTabs(); + + // was collapsed or no tabs + if ( options.active === false || !this.anchors.length ) { + options.active = false; + this.active = $(); + // was active, but active tab is gone + } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) { + // all remaining tabs are disabled + if ( this.tabs.length === options.disabled.length ) { + options.active = false; + this.active = $(); + // activate previous tab + } else { + this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) ); + } + // was active, active tab still exists + } else { + // make sure active index is correct + options.active = this.tabs.index( this.active ); + } + + this._refresh(); + }, + + _refresh: function() { + this._setupDisabled( this.options.disabled ); + this._setupEvents( this.options.event ); + this._setupHeightStyle( this.options.heightStyle ); + + this.tabs.not( this.active ).attr({ + "aria-selected": "false", + tabIndex: -1 + }); + this.panels.not( this._getPanelForTab( this.active ) ) + .hide() + .attr({ + "aria-expanded": "false", + "aria-hidden": "true" + }); + + // Make sure one tab is in the tab order + if ( !this.active.length ) { + this.tabs.eq( 0 ).attr( "tabIndex", 0 ); + } else { + this.active + .addClass( "ui-tabs-active ui-state-active" ) + .attr({ + "aria-selected": "true", + tabIndex: 0 + }); + this._getPanelForTab( this.active ) + .show() + .attr({ + "aria-expanded": "true", + "aria-hidden": "false" + }); + } + }, + + _processTabs: function() { + var that = this; + + this.tablist = this._getList() + .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ) + .attr( "role", "tablist" ); + + this.tabs = this.tablist.find( "> li:has(a[href])" ) + .addClass( "ui-state-default ui-corner-top" ) + .attr({ + role: "tab", + tabIndex: -1 + }); + + this.anchors = this.tabs.map(function() { + return $( "a", this )[ 0 ]; + }) + .addClass( "ui-tabs-anchor" ) + .attr({ + role: "presentation", + tabIndex: -1 + }); + + this.panels = $(); + + this.anchors.each(function( i, anchor ) { + var selector, panel, panelId, + anchorId = $( anchor ).uniqueId().attr( "id" ), + tab = $( anchor ).closest( "li" ), + originalAriaControls = tab.attr( "aria-controls" ); + + // inline tab + if ( isLocal( anchor ) ) { + selector = anchor.hash; + panel = that.element.find( that._sanitizeSelector( selector ) ); + // remote tab + } else { + panelId = that._tabId( tab ); + selector = "#" + panelId; + panel = that.element.find( selector ); + if ( !panel.length ) { + panel = that._createPanel( panelId ); + panel.insertAfter( that.panels[ i - 1 ] || that.tablist ); + } + panel.attr( "aria-live", "polite" ); + } + + if ( panel.length) { + that.panels = that.panels.add( panel ); + } + if ( originalAriaControls ) { + tab.data( "ui-tabs-aria-controls", originalAriaControls ); + } + tab.attr({ + "aria-controls": selector.substring( 1 ), + "aria-labelledby": anchorId + }); + panel.attr( "aria-labelledby", anchorId ); + }); + + this.panels + .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) + .attr( "role", "tabpanel" ); + }, + + // allow overriding how to find the list for rare usage scenarios (#7715) + _getList: function() { + return this.element.find( "ol,ul" ).eq( 0 ); + }, + + _createPanel: function( id ) { + return $( "
        " ) + .attr( "id", id ) + .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) + .data( "ui-tabs-destroy", true ); + }, + + _setupDisabled: function( disabled ) { + if ( $.isArray( disabled ) ) { + if ( !disabled.length ) { + disabled = false; + } else if ( disabled.length === this.anchors.length ) { + disabled = true; + } + } + + // disable tabs + for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) { + if ( disabled === true || $.inArray( i, disabled ) !== -1 ) { + $( li ) + .addClass( "ui-state-disabled" ) + .attr( "aria-disabled", "true" ); + } else { + $( li ) + .removeClass( "ui-state-disabled" ) + .removeAttr( "aria-disabled" ); + } + } + + this.options.disabled = disabled; + }, + + _setupEvents: function( event ) { + var events = { + click: function( event ) { + event.preventDefault(); + } + }; + if ( event ) { + $.each( event.split(" "), function( index, eventName ) { + events[ eventName ] = "_eventHandler"; + }); + } + + this._off( this.anchors.add( this.tabs ).add( this.panels ) ); + this._on( this.anchors, events ); + this._on( this.tabs, { keydown: "_tabKeydown" } ); + this._on( this.panels, { keydown: "_panelKeydown" } ); + + this._focusable( this.tabs ); + this._hoverable( this.tabs ); + }, + + _setupHeightStyle: function( heightStyle ) { + var maxHeight, overflow, + parent = this.element.parent(); + + if ( heightStyle === "fill" ) { + // IE 6 treats height like minHeight, so we need to turn off overflow + // in order to get a reliable height + // we use the minHeight support test because we assume that only + // browsers that don't support minHeight will treat height as minHeight + if ( !$.support.minHeight ) { + overflow = parent.css( "overflow" ); + parent.css( "overflow", "hidden"); + } + maxHeight = parent.height(); + this.element.siblings( ":visible" ).each(function() { + var elem = $( this ), + position = elem.css( "position" ); + + if ( position === "absolute" || position === "fixed" ) { + return; + } + maxHeight -= elem.outerHeight( true ); + }); + if ( overflow ) { + parent.css( "overflow", overflow ); + } + + this.element.children().not( this.panels ).each(function() { + maxHeight -= $( this ).outerHeight( true ); + }); + + this.panels.each(function() { + $( this ).height( Math.max( 0, maxHeight - + $( this ).innerHeight() + $( this ).height() ) ); + }) + .css( "overflow", "auto" ); + } else if ( heightStyle === "auto" ) { + maxHeight = 0; + this.panels.each(function() { + maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); + }).height( maxHeight ); + } + }, + + _eventHandler: function( event ) { + var options = this.options, + active = this.active, + anchor = $( event.currentTarget ), + tab = anchor.closest( "li" ), + clickedIsActive = tab[ 0 ] === active[ 0 ], + collapsing = clickedIsActive && options.collapsible, + toShow = collapsing ? $() : this._getPanelForTab( tab ), + toHide = !active.length ? $() : this._getPanelForTab( active ), + eventData = { + oldTab: active, + oldPanel: toHide, + newTab: collapsing ? $() : tab, + newPanel: toShow + }; + + event.preventDefault(); + + if ( tab.hasClass( "ui-state-disabled" ) || + // tab is already loading + tab.hasClass( "ui-tabs-loading" ) || + // can't switch durning an animation + this.running || + // click on active header, but not collapsible + ( clickedIsActive && !options.collapsible ) || + // allow canceling activation + ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { + return; + } + + options.active = collapsing ? false : this.tabs.index( tab ); + + this.active = clickedIsActive ? $() : tab; + if ( this.xhr ) { + this.xhr.abort(); + } + + if ( !toHide.length && !toShow.length ) { + $.error( "jQuery UI Tabs: Mismatching fragment identifier." ); + } + + if ( toShow.length ) { + this.load( this.tabs.index( tab ), event ); + } + this._toggle( event, eventData ); + }, + + // handles show/hide for selecting tabs + _toggle: function( event, eventData ) { + var that = this, + toShow = eventData.newPanel, + toHide = eventData.oldPanel; + + this.running = true; + + function complete() { + that.running = false; + that._trigger( "activate", event, eventData ); + } + + function show() { + eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" ); + + if ( toShow.length && that.options.show ) { + that._show( toShow, that.options.show, complete ); + } else { + toShow.show(); + complete(); + } + } + + // start out by hiding, then showing, then completing + if ( toHide.length && this.options.hide ) { + this._hide( toHide, this.options.hide, function() { + eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); + show(); + }); + } else { + eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); + toHide.hide(); + show(); + } + + toHide.attr({ + "aria-expanded": "false", + "aria-hidden": "true" + }); + eventData.oldTab.attr( "aria-selected", "false" ); + // If we're switching tabs, remove the old tab from the tab order. + // If we're opening from collapsed state, remove the previous tab from the tab order. + // If we're collapsing, then keep the collapsing tab in the tab order. + if ( toShow.length && toHide.length ) { + eventData.oldTab.attr( "tabIndex", -1 ); + } else if ( toShow.length ) { + this.tabs.filter(function() { + return $( this ).attr( "tabIndex" ) === 0; + }) + .attr( "tabIndex", -1 ); + } + + toShow.attr({ + "aria-expanded": "true", + "aria-hidden": "false" + }); + eventData.newTab.attr({ + "aria-selected": "true", + tabIndex: 0 + }); + }, + + _activate: function( index ) { + var anchor, + active = this._findActive( index ); + + // trying to activate the already active panel + if ( active[ 0 ] === this.active[ 0 ] ) { + return; + } + + // trying to collapse, simulate a click on the current active header + if ( !active.length ) { + active = this.active; + } + + anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; + this._eventHandler({ + target: anchor, + currentTarget: anchor, + preventDefault: $.noop + }); + }, + + _findActive: function( index ) { + return index === false ? $() : this.tabs.eq( index ); + }, + + _getIndex: function( index ) { + // meta-function to give users option to provide a href string instead of a numerical index. + if ( typeof index === "string" ) { + index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) ); + } + + return index; + }, + + _destroy: function() { + if ( this.xhr ) { + this.xhr.abort(); + } + + this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" ); + + this.tablist + .removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ) + .removeAttr( "role" ); + + this.anchors + .removeClass( "ui-tabs-anchor" ) + .removeAttr( "role" ) + .removeAttr( "tabIndex" ) + .removeData( "href.tabs" ) + .removeData( "load.tabs" ) + .removeUniqueId(); + + this.tabs.add( this.panels ).each(function() { + if ( $.data( this, "ui-tabs-destroy" ) ) { + $( this ).remove(); + } else { + $( this ) + .removeClass( "ui-state-default ui-state-active ui-state-disabled " + + "ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" ) + .removeAttr( "tabIndex" ) + .removeAttr( "aria-live" ) + .removeAttr( "aria-busy" ) + .removeAttr( "aria-selected" ) + .removeAttr( "aria-labelledby" ) + .removeAttr( "aria-hidden" ) + .removeAttr( "aria-expanded" ) + .removeAttr( "role" ); + } + }); + + this.tabs.each(function() { + var li = $( this ), + prev = li.data( "ui-tabs-aria-controls" ); + if ( prev ) { + li.attr( "aria-controls", prev ); + } else { + li.removeAttr( "aria-controls" ); + } + }); + + this.panels.show(); + + if ( this.options.heightStyle !== "content" ) { + this.panels.css( "height", "" ); + } + }, + + enable: function( index ) { + var disabled = this.options.disabled; + if ( disabled === false ) { + return; + } + + if ( index === undefined ) { + disabled = false; + } else { + index = this._getIndex( index ); + if ( $.isArray( disabled ) ) { + disabled = $.map( disabled, function( num ) { + return num !== index ? num : null; + }); + } else { + disabled = $.map( this.tabs, function( li, num ) { + return num !== index ? num : null; + }); + } + } + this._setupDisabled( disabled ); + }, + + disable: function( index ) { + var disabled = this.options.disabled; + if ( disabled === true ) { + return; + } + + if ( index === undefined ) { + disabled = true; + } else { + index = this._getIndex( index ); + if ( $.inArray( index, disabled ) !== -1 ) { + return; + } + if ( $.isArray( disabled ) ) { + disabled = $.merge( [ index ], disabled ).sort(); + } else { + disabled = [ index ]; + } + } + this._setupDisabled( disabled ); + }, + + load: function( index, event ) { + index = this._getIndex( index ); + var that = this, + tab = this.tabs.eq( index ), + anchor = tab.find( ".ui-tabs-anchor" ), + panel = this._getPanelForTab( tab ), + eventData = { + tab: tab, + panel: panel + }; + + // not remote + if ( isLocal( anchor[ 0 ] ) ) { + return; + } + + this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) ); + + // support: jQuery <1.8 + // jQuery <1.8 returns false if the request is canceled in beforeSend, + // but as of 1.8, $.ajax() always returns a jqXHR object. + if ( this.xhr && this.xhr.statusText !== "canceled" ) { + tab.addClass( "ui-tabs-loading" ); + panel.attr( "aria-busy", "true" ); + + this.xhr + .success(function( response ) { + // support: jQuery <1.8 + // http://bugs.jquery.com/ticket/11778 + setTimeout(function() { + panel.html( response ); + that._trigger( "load", event, eventData ); + }, 1 ); + }) + .complete(function( jqXHR, status ) { + // support: jQuery <1.8 + // http://bugs.jquery.com/ticket/11778 + setTimeout(function() { + if ( status === "abort" ) { + that.panels.stop( false, true ); + } + + tab.removeClass( "ui-tabs-loading" ); + panel.removeAttr( "aria-busy" ); + + if ( jqXHR === that.xhr ) { + delete that.xhr; + } + }, 1 ); + }); + } + }, + + // TODO: Remove this function in 1.10 when ajaxOptions is removed + _ajaxSettings: function( anchor, event, eventData ) { + var that = this; + return { + url: anchor.attr( "href" ), + beforeSend: function( jqXHR, settings ) { + return that._trigger( "beforeLoad", event, + $.extend( { jqXHR : jqXHR, ajaxSettings: settings }, eventData ) ); + } + }; + }, + + _getPanelForTab: function( tab ) { + var id = $( tab ).attr( "aria-controls" ); + return this.element.find( this._sanitizeSelector( "#" + id ) ); + } +}); + +// DEPRECATED +if ( $.uiBackCompat !== false ) { + + // helper method for a lot of the back compat extensions + $.ui.tabs.prototype._ui = function( tab, panel ) { + return { + tab: tab, + panel: panel, + index: this.anchors.index( tab ) + }; + }; + + // url method + $.widget( "ui.tabs", $.ui.tabs, { + url: function( index, url ) { + this.anchors.eq( index ).attr( "href", url ); + } + }); + + // TODO: Remove _ajaxSettings() method when removing this extension + // ajaxOptions and cache options + $.widget( "ui.tabs", $.ui.tabs, { + options: { + ajaxOptions: null, + cache: false + }, + + _create: function() { + this._super(); + + var that = this; + + this._on({ tabsbeforeload: function( event, ui ) { + // tab is already cached + if ( $.data( ui.tab[ 0 ], "cache.tabs" ) ) { + event.preventDefault(); + return; + } + + ui.jqXHR.success(function() { + if ( that.options.cache ) { + $.data( ui.tab[ 0 ], "cache.tabs", true ); + } + }); + }}); + }, + + _ajaxSettings: function( anchor, event, ui ) { + var ajaxOptions = this.options.ajaxOptions; + return $.extend( {}, ajaxOptions, { + error: function( xhr, status ) { + try { + // Passing index avoid a race condition when this method is + // called after the user has selected another tab. + // Pass the anchor that initiated this request allows + // loadError to manipulate the tab content panel via $(a.hash) + ajaxOptions.error( + xhr, status, ui.tab.closest( "li" ).index(), ui.tab[ 0 ] ); + } + catch ( error ) {} + } + }, this._superApply( arguments ) ); + }, + + _setOption: function( key, value ) { + // reset cache if switching from cached to not cached + if ( key === "cache" && value === false ) { + this.anchors.removeData( "cache.tabs" ); + } + this._super( key, value ); + }, + + _destroy: function() { + this.anchors.removeData( "cache.tabs" ); + this._super(); + }, + + url: function( index ){ + this.anchors.eq( index ).removeData( "cache.tabs" ); + this._superApply( arguments ); + } + }); + + // abort method + $.widget( "ui.tabs", $.ui.tabs, { + abort: function() { + if ( this.xhr ) { + this.xhr.abort(); + } + } + }); + + // spinner + $.widget( "ui.tabs", $.ui.tabs, { + options: { + spinner: "Loading…" + }, + _create: function() { + this._super(); + this._on({ + tabsbeforeload: function( event, ui ) { + // Don't react to nested tabs or tabs that don't use a spinner + if ( event.target !== this.element[ 0 ] || + !this.options.spinner ) { + return; + } + + var span = ui.tab.find( "span" ), + html = span.html(); + span.html( this.options.spinner ); + ui.jqXHR.complete(function() { + span.html( html ); + }); + } + }); + } + }); + + // enable/disable events + $.widget( "ui.tabs", $.ui.tabs, { + options: { + enable: null, + disable: null + }, + + enable: function( index ) { + var options = this.options, + trigger; + + if ( index && options.disabled === true || + ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) !== -1 ) ) { + trigger = true; + } + + this._superApply( arguments ); + + if ( trigger ) { + this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); + } + }, + + disable: function( index ) { + var options = this.options, + trigger; + + if ( index && options.disabled === false || + ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) === -1 ) ) { + trigger = true; + } + + this._superApply( arguments ); + + if ( trigger ) { + this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); + } + } + }); + + // add/remove methods and events + $.widget( "ui.tabs", $.ui.tabs, { + options: { + add: null, + remove: null, + tabTemplate: "
      • #{label}
      • " + }, + + add: function( url, label, index ) { + if ( index === undefined ) { + index = this.anchors.length; + } + + var doInsertAfter, panel, + options = this.options, + li = $( options.tabTemplate + .replace( /#\{href\}/g, url ) + .replace( /#\{label\}/g, label ) ), + id = !url.indexOf( "#" ) ? + url.replace( "#", "" ) : + this._tabId( li ); + + li.addClass( "ui-state-default ui-corner-top" ).data( "ui-tabs-destroy", true ); + li.attr( "aria-controls", id ); + + doInsertAfter = index >= this.tabs.length; + + // try to find an existing element before creating a new one + panel = this.element.find( "#" + id ); + if ( !panel.length ) { + panel = this._createPanel( id ); + if ( doInsertAfter ) { + if ( index > 0 ) { + panel.insertAfter( this.panels.eq( -1 ) ); + } else { + panel.appendTo( this.element ); + } + } else { + panel.insertBefore( this.panels[ index ] ); + } + } + panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ).hide(); + + if ( doInsertAfter ) { + li.appendTo( this.tablist ); + } else { + li.insertBefore( this.tabs[ index ] ); + } + + options.disabled = $.map( options.disabled, function( n ) { + return n >= index ? ++n : n; + }); + + this.refresh(); + if ( this.tabs.length === 1 && options.active === false ) { + this.option( "active", 0 ); + } + + this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); + return this; + }, + + remove: function( index ) { + index = this._getIndex( index ); + var options = this.options, + tab = this.tabs.eq( index ).remove(), + panel = this._getPanelForTab( tab ).remove(); + + // If selected tab was removed focus tab to the right or + // in case the last tab was removed the tab to the left. + // We check for more than 2 tabs, because if there are only 2, + // then when we remove this tab, there will only be one tab left + // so we don't need to detect which tab to activate. + if ( tab.hasClass( "ui-tabs-active" ) && this.anchors.length > 2 ) { + this._activate( index + ( index + 1 < this.anchors.length ? 1 : -1 ) ); + } + + options.disabled = $.map( + $.grep( options.disabled, function( n ) { + return n !== index; + }), + function( n ) { + return n >= index ? --n : n; + }); + + this.refresh(); + + this._trigger( "remove", null, this._ui( tab.find( "a" )[ 0 ], panel[ 0 ] ) ); + return this; + } + }); + + // length method + $.widget( "ui.tabs", $.ui.tabs, { + length: function() { + return this.anchors.length; + } + }); + + // panel ids (idPrefix option + title attribute) + $.widget( "ui.tabs", $.ui.tabs, { + options: { + idPrefix: "ui-tabs-" + }, + + _tabId: function( tab ) { + var a = tab.is( "li" ) ? tab.find( "a[href]" ) : tab; + a = a[0]; + return $( a ).closest( "li" ).attr( "aria-controls" ) || + a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF\-]/g, "" ) || + this.options.idPrefix + getNextTabId(); + } + }); + + // _createPanel method + $.widget( "ui.tabs", $.ui.tabs, { + options: { + panelTemplate: "
        " + }, + + _createPanel: function( id ) { + return $( this.options.panelTemplate ) + .attr( "id", id ) + .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) + .data( "ui-tabs-destroy", true ); + } + }); + + // selected option + $.widget( "ui.tabs", $.ui.tabs, { + _create: function() { + var options = this.options; + if ( options.active === null && options.selected !== undefined ) { + options.active = options.selected === -1 ? false : options.selected; + } + this._super(); + options.selected = options.active; + if ( options.selected === false ) { + options.selected = -1; + } + }, + + _setOption: function( key, value ) { + if ( key !== "selected" ) { + return this._super( key, value ); + } + + var options = this.options; + this._super( "active", value === -1 ? false : value ); + options.selected = options.active; + if ( options.selected === false ) { + options.selected = -1; + } + }, + + _eventHandler: function() { + this._superApply( arguments ); + this.options.selected = this.options.active; + if ( this.options.selected === false ) { + this.options.selected = -1; + } + } + }); + + // show and select event + $.widget( "ui.tabs", $.ui.tabs, { + options: { + show: null, + select: null + }, + _create: function() { + this._super(); + if ( this.options.active !== false ) { + this._trigger( "show", null, this._ui( + this.active.find( ".ui-tabs-anchor" )[ 0 ], + this._getPanelForTab( this.active )[ 0 ] ) ); + } + }, + _trigger: function( type, event, data ) { + var tab, panel, + ret = this._superApply( arguments ); + + if ( !ret ) { + return false; + } + + if ( type === "beforeActivate" ) { + tab = data.newTab.length ? data.newTab : data.oldTab; + panel = data.newPanel.length ? data.newPanel : data.oldPanel; + ret = this._super( "select", event, { + tab: tab.find( ".ui-tabs-anchor" )[ 0], + panel: panel[ 0 ], + index: tab.closest( "li" ).index() + }); + } else if ( type === "activate" && data.newTab.length ) { + ret = this._super( "show", event, { + tab: data.newTab.find( ".ui-tabs-anchor" )[ 0 ], + panel: data.newPanel[ 0 ], + index: data.newTab.closest( "li" ).index() + }); + } + return ret; + } + }); + + // select method + $.widget( "ui.tabs", $.ui.tabs, { + select: function( index ) { + index = this._getIndex( index ); + if ( index === -1 ) { + if ( this.options.collapsible && this.options.selected !== -1 ) { + index = this.options.selected; + } else { + return; + } + } + this.anchors.eq( index ).trigger( this.options.event + this.eventNamespace ); + } + }); + + // cookie option + (function() { + + var listId = 0; + + $.widget( "ui.tabs", $.ui.tabs, { + options: { + cookie: null // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true } + }, + _create: function() { + var options = this.options, + active; + if ( options.active == null && options.cookie ) { + active = parseInt( this._cookie(), 10 ); + if ( active === -1 ) { + active = false; + } + options.active = active; + } + this._super(); + }, + _cookie: function( active ) { + var cookie = [ this.cookie || + ( this.cookie = this.options.cookie.name || "ui-tabs-" + (++listId) ) ]; + if ( arguments.length ) { + cookie.push( active === false ? -1 : active ); + cookie.push( this.options.cookie ); + } + return $.cookie.apply( null, cookie ); + }, + _refresh: function() { + this._super(); + if ( this.options.cookie ) { + this._cookie( this.options.active, this.options.cookie ); + } + }, + _eventHandler: function() { + this._superApply( arguments ); + if ( this.options.cookie ) { + this._cookie( this.options.active, this.options.cookie ); + } + }, + _destroy: function() { + this._super(); + if ( this.options.cookie ) { + this._cookie( null, this.options.cookie ); + } + } + }); + + })(); + + // load event + $.widget( "ui.tabs", $.ui.tabs, { + _trigger: function( type, event, data ) { + var _data = $.extend( {}, data ); + if ( type === "load" ) { + _data.panel = _data.panel[ 0 ]; + _data.tab = _data.tab.find( ".ui-tabs-anchor" )[ 0 ]; + } + return this._super( type, event, _data ); + } + }); + + // fx option + // The new animation options (show, hide) conflict with the old show callback. + // The old fx option wins over show/hide anyway (always favor back-compat). + // If a user wants to use the new animation API, they must give up the old API. + $.widget( "ui.tabs", $.ui.tabs, { + options: { + fx: null // e.g. { height: "toggle", opacity: "toggle", duration: 200 } + }, + + _getFx: function() { + var hide, show, + fx = this.options.fx; + + if ( fx ) { + if ( $.isArray( fx ) ) { + hide = fx[ 0 ]; + show = fx[ 1 ]; + } else { + hide = show = fx; + } + } + + return fx ? { show: show, hide: hide } : null; + }, + + _toggle: function( event, eventData ) { + var that = this, + toShow = eventData.newPanel, + toHide = eventData.oldPanel, + fx = this._getFx(); + + if ( !fx ) { + return this._super( event, eventData ); + } + + that.running = true; + + function complete() { + that.running = false; + that._trigger( "activate", event, eventData ); + } + + function show() { + eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" ); + + if ( toShow.length && fx.show ) { + toShow + .animate( fx.show, fx.show.duration, function() { + complete(); + }); + } else { + toShow.show(); + complete(); + } + } + + // start out by hiding, then showing, then completing + if ( toHide.length && fx.hide ) { + toHide.animate( fx.hide, fx.hide.duration, function() { + eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); + show(); + }); + } else { + eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); + toHide.hide(); + show(); + } + } + }); +} + +})( jQuery ); +(function( $ ) { + +var increments = 0; + +function addDescribedBy( elem, id ) { + var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ); + describedby.push( id ); + elem + .data( "ui-tooltip-id", id ) + .attr( "aria-describedby", $.trim( describedby.join( " " ) ) ); +} + +function removeDescribedBy( elem ) { + var id = elem.data( "ui-tooltip-id" ), + describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ), + index = $.inArray( id, describedby ); + if ( index !== -1 ) { + describedby.splice( index, 1 ); + } + + elem.removeData( "ui-tooltip-id" ); + describedby = $.trim( describedby.join( " " ) ); + if ( describedby ) { + elem.attr( "aria-describedby", describedby ); + } else { + elem.removeAttr( "aria-describedby" ); + } +} + +$.widget( "ui.tooltip", { + version: "1.9.2", + options: { + content: function() { + return $( this ).attr( "title" ); + }, + hide: true, + // Disabled elements have inconsistent behavior across browsers (#8661) + items: "[title]:not([disabled])", + position: { + my: "left top+15", + at: "left bottom", + collision: "flipfit flip" + }, + show: true, + tooltipClass: null, + track: false, + + // callbacks + close: null, + open: null + }, + + _create: function() { + this._on({ + mouseover: "open", + focusin: "open" + }); + + // IDs of generated tooltips, needed for destroy + this.tooltips = {}; + // IDs of parent tooltips where we removed the title attribute + this.parents = {}; + + if ( this.options.disabled ) { + this._disable(); + } + }, + + _setOption: function( key, value ) { + var that = this; + + if ( key === "disabled" ) { + this[ value ? "_disable" : "_enable" ](); + this.options[ key ] = value; + // disable element style changes + return; + } + + this._super( key, value ); + + if ( key === "content" ) { + $.each( this.tooltips, function( id, element ) { + that._updateContent( element ); + }); + } + }, + + _disable: function() { + var that = this; + + // close open tooltips + $.each( this.tooltips, function( id, element ) { + var event = $.Event( "blur" ); + event.target = event.currentTarget = element[0]; + that.close( event, true ); + }); + + // remove title attributes to prevent native tooltips + this.element.find( this.options.items ).andSelf().each(function() { + var element = $( this ); + if ( element.is( "[title]" ) ) { + element + .data( "ui-tooltip-title", element.attr( "title" ) ) + .attr( "title", "" ); + } + }); + }, + + _enable: function() { + // restore title attributes + this.element.find( this.options.items ).andSelf().each(function() { + var element = $( this ); + if ( element.data( "ui-tooltip-title" ) ) { + element.attr( "title", element.data( "ui-tooltip-title" ) ); + } + }); + }, + + open: function( event ) { + var that = this, + target = $( event ? event.target : this.element ) + // we need closest here due to mouseover bubbling, + // but always pointing at the same event target + .closest( this.options.items ); + + // No element to show a tooltip for or the tooltip is already open + if ( !target.length || target.data( "ui-tooltip-id" ) ) { + return; + } + + if ( target.attr( "title" ) ) { + target.data( "ui-tooltip-title", target.attr( "title" ) ); + } + + target.data( "ui-tooltip-open", true ); + + // kill parent tooltips, custom or native, for hover + if ( event && event.type === "mouseover" ) { + target.parents().each(function() { + var parent = $( this ), + blurEvent; + if ( parent.data( "ui-tooltip-open" ) ) { + blurEvent = $.Event( "blur" ); + blurEvent.target = blurEvent.currentTarget = this; + that.close( blurEvent, true ); + } + if ( parent.attr( "title" ) ) { + parent.uniqueId(); + that.parents[ this.id ] = { + element: this, + title: parent.attr( "title" ) + }; + parent.attr( "title", "" ); + } + }); + } + + this._updateContent( target, event ); + }, + + _updateContent: function( target, event ) { + var content, + contentOption = this.options.content, + that = this, + eventType = event ? event.type : null; + + if ( typeof contentOption === "string" ) { + return this._open( event, target, contentOption ); + } + + content = contentOption.call( target[0], function( response ) { + // ignore async response if tooltip was closed already + if ( !target.data( "ui-tooltip-open" ) ) { + return; + } + // IE may instantly serve a cached response for ajax requests + // delay this call to _open so the other call to _open runs first + that._delay(function() { + // jQuery creates a special event for focusin when it doesn't + // exist natively. To improve performance, the native event + // object is reused and the type is changed. Therefore, we can't + // rely on the type being correct after the event finished + // bubbling, so we set it back to the previous value. (#8740) + if ( event ) { + event.type = eventType; + } + this._open( event, target, response ); + }); + }); + if ( content ) { + this._open( event, target, content ); + } + }, + + _open: function( event, target, content ) { + var tooltip, events, delayedShow, + positionOption = $.extend( {}, this.options.position ); + + if ( !content ) { + return; + } + + // Content can be updated multiple times. If the tooltip already + // exists, then just update the content and bail. + tooltip = this._find( target ); + if ( tooltip.length ) { + tooltip.find( ".ui-tooltip-content" ).html( content ); + return; + } + + // if we have a title, clear it to prevent the native tooltip + // we have to check first to avoid defining a title if none exists + // (we don't want to cause an element to start matching [title]) + // + // We use removeAttr only for key events, to allow IE to export the correct + // accessible attributes. For mouse events, set to empty string to avoid + // native tooltip showing up (happens only when removing inside mouseover). + if ( target.is( "[title]" ) ) { + if ( event && event.type === "mouseover" ) { + target.attr( "title", "" ); + } else { + target.removeAttr( "title" ); + } + } + + tooltip = this._tooltip( target ); + addDescribedBy( target, tooltip.attr( "id" ) ); + tooltip.find( ".ui-tooltip-content" ).html( content ); + + function position( event ) { + positionOption.of = event; + if ( tooltip.is( ":hidden" ) ) { + return; + } + tooltip.position( positionOption ); + } + if ( this.options.track && event && /^mouse/.test( event.type ) ) { + this._on( this.document, { + mousemove: position + }); + // trigger once to override element-relative positioning + position( event ); + } else { + tooltip.position( $.extend({ + of: target + }, this.options.position ) ); + } + + tooltip.hide(); + + this._show( tooltip, this.options.show ); + // Handle tracking tooltips that are shown with a delay (#8644). As soon + // as the tooltip is visible, position the tooltip using the most recent + // event. + if ( this.options.show && this.options.show.delay ) { + delayedShow = setInterval(function() { + if ( tooltip.is( ":visible" ) ) { + position( positionOption.of ); + clearInterval( delayedShow ); + } + }, $.fx.interval ); + } + + this._trigger( "open", event, { tooltip: tooltip } ); + + events = { + keyup: function( event ) { + if ( event.keyCode === $.ui.keyCode.ESCAPE ) { + var fakeEvent = $.Event(event); + fakeEvent.currentTarget = target[0]; + this.close( fakeEvent, true ); + } + }, + remove: function() { + this._removeTooltip( tooltip ); + } + }; + if ( !event || event.type === "mouseover" ) { + events.mouseleave = "close"; + } + if ( !event || event.type === "focusin" ) { + events.focusout = "close"; + } + this._on( true, target, events ); + }, + + close: function( event ) { + var that = this, + target = $( event ? event.currentTarget : this.element ), + tooltip = this._find( target ); + + // disabling closes the tooltip, so we need to track when we're closing + // to avoid an infinite loop in case the tooltip becomes disabled on close + if ( this.closing ) { + return; + } + + // only set title if we had one before (see comment in _open()) + if ( target.data( "ui-tooltip-title" ) ) { + target.attr( "title", target.data( "ui-tooltip-title" ) ); + } + + removeDescribedBy( target ); + + tooltip.stop( true ); + this._hide( tooltip, this.options.hide, function() { + that._removeTooltip( $( this ) ); + }); + + target.removeData( "ui-tooltip-open" ); + this._off( target, "mouseleave focusout keyup" ); + // Remove 'remove' binding only on delegated targets + if ( target[0] !== this.element[0] ) { + this._off( target, "remove" ); + } + this._off( this.document, "mousemove" ); + + if ( event && event.type === "mouseleave" ) { + $.each( this.parents, function( id, parent ) { + $( parent.element ).attr( "title", parent.title ); + delete that.parents[ id ]; + }); + } + + this.closing = true; + this._trigger( "close", event, { tooltip: tooltip } ); + this.closing = false; + }, + + _tooltip: function( element ) { + var id = "ui-tooltip-" + increments++, + tooltip = $( "
        " ) + .attr({ + id: id, + role: "tooltip" + }) + .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " + + ( this.options.tooltipClass || "" ) ); + $( "
        " ) + .addClass( "ui-tooltip-content" ) + .appendTo( tooltip ); + tooltip.appendTo( this.document[0].body ); + if ( $.fn.bgiframe ) { + tooltip.bgiframe(); + } + this.tooltips[ id ] = element; + return tooltip; + }, + + _find: function( target ) { + var id = target.data( "ui-tooltip-id" ); + return id ? $( "#" + id ) : $(); + }, + + _removeTooltip: function( tooltip ) { + tooltip.remove(); + delete this.tooltips[ tooltip.attr( "id" ) ]; + }, + + _destroy: function() { + var that = this; + + // close open tooltips + $.each( this.tooltips, function( id, element ) { + // Delegate to close method to handle common cleanup + var event = $.Event( "blur" ); + event.target = event.currentTarget = element[0]; + that.close( event, true ); + + // Remove immediately; destroying an open tooltip doesn't use the + // hide animation + $( "#" + id ).remove(); + + // Restore the title + if ( element.data( "ui-tooltip-title" ) ) { + element.attr( "title", element.data( "ui-tooltip-title" ) ); + element.removeData( "ui-tooltip-title" ); + } + }); + } +}); + +}( jQuery ) ); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery.layout-latest.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery.layout-latest.js new file mode 100644 index 0000000..434724d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/layout/jquery.layout-latest.js @@ -0,0 +1,6086 @@ +/** + * @preserve + * jquery.layout 1.4.3 + * $Date: 2015/03/13 22:37:04 $ + * $Rev: 1.0403 $ + * + * Copyright (c) 2014 Kevin Dalman (http://jquery-dev.com) + * Based on work by Fabrizio Balliano (http://www.fabrizioballiano.net) + * + * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html) + * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses. + * + * SEE: http://layout.jquery-dev.com/LICENSE.txt + * + * Changelog: http://layout.jquery-dev.com/changelog.cfm + * + * Docs: http://layout.jquery-dev.com/documentation.html + * Tips: http://layout.jquery-dev.com/tips.html + * Help: http://groups.google.com/group/jquery-ui-layout + */ + +/* JavaDoc Info: http://code.google.com/closure/compiler/docs/js-for-compiler.html + * {!Object} non-nullable type (never NULL) + * {?string} nullable type (sometimes NULL) - default for {Object} + * {number=} optional parameter + * {*} ALL types + */ +/* TODO for jQ 2.0 + * change .andSelf() to .addBack() + * check $.fn.disableSelection - this is in jQuery UI 1.9.x + */ + +// NOTE: For best readability, view with a fixed-width font and tabs equal to 4-chars + +;(function ($) { + +// alias Math methods - used a lot! +var min = Math.min +, max = Math.max +, round = Math.floor + +, isStr = function (v) { return $.type(v) === "string"; } + + /** + * @param {!Object} Instance + * @param {Array.} a_fn + */ +, runPluginCallbacks = function (Instance, a_fn) { + if ($.isArray(a_fn)) + for (var i=0, c=a_fn.length; i
        ').appendTo("body") + , d = { width: $c.outerWidth - $c[0].clientWidth, height: 100 - $c[0].clientHeight }; + $c.remove(); + window.scrollbarWidth = d.width; + window.scrollbarHeight = d.height; + return dim.match(/^(width|height)$/) ? d[dim] : d; + } + + +, disableTextSelection: function () { + var $d = $(document) + , s = 'textSelectionDisabled' + , x = 'textSelectionInitialized' + ; + if ($.fn.disableSelection) { + if (!$d.data(x)) // document hasn't been initialized yet + $d.on('mouseup', $.layout.enableTextSelection ).data(x, true); + if (!$d.data(s)) + $d.disableSelection().data(s, true); + } + } +, enableTextSelection: function () { + var $d = $(document) + , s = 'textSelectionDisabled'; + if ($.fn.enableSelection && $d.data(s)) + $d.enableSelection().data(s, false); + } + + + /** + * Returns hash container 'display' and 'visibility' + * + * @see $.swap() - swaps CSS, runs callback, resets CSS + * @param {!Object} $E jQuery element + * @param {boolean=} [force=false] Run even if display != none + * @return {!Object} Returns current style props, if applicable + */ +, showInvisibly: function ($E, force) { + if ($E && $E.length && (force || $E.css("display") === "none")) { // only if not *already hidden* + var s = $E[0].style + // save ONLY the 'style' props because that is what we must restore + , CSS = { display: s.display || '', visibility: s.visibility || '' }; + // show element 'invisibly' so can be measured + $E.css({ display: "block", visibility: "hidden" }); + return CSS; + } + return {}; + } + + /** + * Returns data for setting size of an element (container or a pane). + * + * @see _create(), onWindowResize() for container, plus others for pane + * @return JSON Returns a hash of all dimensions: top, bottom, left, right, outerWidth, innerHeight, etc + */ +, getElementDimensions: function ($E, inset) { + var + // dimensions hash - start with current data IF passed + d = { css: {}, inset: {} } + , x = d.css // CSS hash + , i = { bottom: 0 } // TEMP insets (bottom = complier hack) + , N = $.layout.cssNum + , R = Math.round + , off = $E.offset() + , b, p, ei // TEMP border, padding + ; + d.offsetLeft = off.left; + d.offsetTop = off.top; + + if (!inset) inset = {}; // simplify logic below + + $.each("Left,Right,Top,Bottom".split(","), function (idx, e) { // e = edge + b = x["border" + e] = $.layout.borderWidth($E, e); + p = x["padding"+ e] = $.layout.cssNum($E, "padding"+e); + ei = e.toLowerCase(); + d.inset[ei] = inset[ei] >= 0 ? inset[ei] : p; // any missing insetX value = paddingX + i[ei] = d.inset[ei] + b; // total offset of content from outer side + }); + + x.width = R($E.width()); + x.height = R($E.height()); + x.top = N($E,"top",true); + x.bottom = N($E,"bottom",true); + x.left = N($E,"left",true); + x.right = N($E,"right",true); + + d.outerWidth = R($E.outerWidth()); + d.outerHeight = R($E.outerHeight()); + // calc the TRUE inner-dimensions, even in quirks-mode! + d.innerWidth = max(0, d.outerWidth - i.left - i.right); + d.innerHeight = max(0, d.outerHeight - i.top - i.bottom); + // layoutWidth/Height is used in calcs for manual resizing + // layoutW/H only differs from innerW/H when in quirks-mode - then is like outerW/H + d.layoutWidth = R($E.innerWidth()); + d.layoutHeight = R($E.innerHeight()); + + //if ($E.prop('tagName') === 'BODY') { debugData( d, $E.prop('tagName') ); } // DEBUG + + //d.visible = $E.is(":visible");// && x.width > 0 && x.height > 0; + + return d; + } + +, getElementStyles: function ($E, list) { + var + CSS = {} + , style = $E[0].style + , props = list.split(",") + , sides = "Top,Bottom,Left,Right".split(",") + , attrs = "Color,Style,Width".split(",") + , p, s, a, i, j, k + ; + for (i=0; i < props.length; i++) { + p = props[i]; + if (p.match(/(border|padding|margin)$/)) + for (j=0; j < 4; j++) { + s = sides[j]; + if (p === "border") + for (k=0; k < 3; k++) { + a = attrs[k]; + CSS[p+s+a] = style[p+s+a]; + } + else + CSS[p+s] = style[p+s]; + } + else + CSS[p] = style[p]; + }; + return CSS + } + + /** + * Return the innerWidth for the current browser/doctype + * + * @see initPanes(), sizeMidPanes(), initHandles(), sizeHandles() + * @param {Array.} $E Must pass a jQuery object - first element is processed + * @param {number=} outerWidth (optional) Can pass a width, allowing calculations BEFORE element is resized + * @return {number} Returns the innerWidth of the elem by subtracting padding and borders + */ +, cssWidth: function ($E, outerWidth) { + // a 'calculated' outerHeight can be passed so borders and/or padding are removed if needed + if (outerWidth <= 0) return 0; + + var lb = $.layout.browser + , bs = !lb.boxModel ? "border-box" : lb.boxSizing ? $E.css("boxSizing") : "content-box" + , b = $.layout.borderWidth + , n = $.layout.cssNum + , W = outerWidth + ; + // strip border and/or padding from outerWidth to get CSS Width + if (bs !== "border-box") + W -= (b($E, "Left") + b($E, "Right")); + if (bs === "content-box") + W -= (n($E, "paddingLeft") + n($E, "paddingRight")); + return max(0,W); + } + + /** + * Return the innerHeight for the current browser/doctype + * + * @see initPanes(), sizeMidPanes(), initHandles(), sizeHandles() + * @param {Array.} $E Must pass a jQuery object - first element is processed + * @param {number=} outerHeight (optional) Can pass a width, allowing calculations BEFORE element is resized + * @return {number} Returns the innerHeight of the elem by subtracting padding and borders + */ +, cssHeight: function ($E, outerHeight) { + // a 'calculated' outerHeight can be passed so borders and/or padding are removed if needed + if (outerHeight <= 0) return 0; + + var lb = $.layout.browser + , bs = !lb.boxModel ? "border-box" : lb.boxSizing ? $E.css("boxSizing") : "content-box" + , b = $.layout.borderWidth + , n = $.layout.cssNum + , H = outerHeight + ; + // strip border and/or padding from outerHeight to get CSS Height + if (bs !== "border-box") + H -= (b($E, "Top") + b($E, "Bottom")); + if (bs === "content-box") + H -= (n($E, "paddingTop") + n($E, "paddingBottom")); + return max(0,H); + } + + /** + * Returns the 'current CSS numeric value' for a CSS property - 0 if property does not exist + * + * @see Called by many methods + * @param {Array.} $E Must pass a jQuery object - first element is processed + * @param {string} prop The name of the CSS property, eg: top, width, etc. + * @param {boolean=} [allowAuto=false] true = return 'auto' if that is value; false = return 0 + * @return {(string|number)} Usually used to get an integer value for position (top, left) or size (height, width) + */ +, cssNum: function ($E, prop, allowAuto) { + if (!$E.jquery) $E = $($E); + var CSS = $.layout.showInvisibly($E) + , p = $.css($E[0], prop, true) + , v = allowAuto && p=="auto" ? p : Math.round(parseFloat(p) || 0); + $E.css( CSS ); // RESET + return v; + } + +, borderWidth: function (el, side) { + if (el.jquery) el = el[0]; + var b = "border"+ side.substr(0,1).toUpperCase() + side.substr(1); // left => Left + return $.css(el, b+"Style", true) === "none" ? 0 : Math.round(parseFloat($.css(el, b+"Width", true)) || 0); + } + + /** + * Mouse-tracking utility - FUTURE REFERENCE + * + * init: if (!window.mouse) { + * window.mouse = { x: 0, y: 0 }; + * $(document).mousemove( $.layout.trackMouse ); + * } + * + * @param {Object} evt + * +, trackMouse: function (evt) { + window.mouse = { x: evt.clientX, y: evt.clientY }; + } + */ + + /** + * SUBROUTINE for preventPrematureSlideClose option + * + * @param {Object} evt + * @param {Object=} el + */ +, isMouseOverElem: function (evt, el) { + var + $E = $(el || this) + , d = $E.offset() + , T = d.top + , L = d.left + , R = L + $E.outerWidth() + , B = T + $E.outerHeight() + , x = evt.pageX // evt.clientX ? + , y = evt.pageY // evt.clientY ? + ; + // if X & Y are < 0, probably means is over an open SELECT + return ($.layout.browser.msie && x < 0 && y < 0) || ((x >= L && x <= R) && (y >= T && y <= B)); + } + + /** + * Message/Logging Utility + * + * @example $.layout.msg("My message"); // log text + * @example $.layout.msg("My message", true); // alert text + * @example $.layout.msg({ foo: "bar" }, "Title"); // log hash-data, with custom title + * @example $.layout.msg({ foo: "bar" }, true, "Title", { sort: false }); -OR- + * @example $.layout.msg({ foo: "bar" }, "Title", { sort: false, display: true }); // alert hash-data + * + * @param {(Object|string)} info String message OR Hash/Array + * @param {(Boolean|string|Object)=} [popup=false] True means alert-box - can be skipped + * @param {(Object|string)=} [debugTitle=""] Title for Hash data - can be skipped + * @param {Object=} [debugOpts] Extra options for debug output + */ +, msg: function (info, popup, debugTitle, debugOpts) { + if ($.isPlainObject(info) && window.debugData) { + if (typeof popup === "string") { + debugOpts = debugTitle; + debugTitle = popup; + } + else if (typeof debugTitle === "object") { + debugOpts = debugTitle; + debugTitle = null; + } + var t = debugTitle || "log( )" + , o = $.extend({ sort: false, returnHTML: false, display: false }, debugOpts); + if (popup === true || o.display) + debugData( info, t, o ); + else if (window.console) + console.log(debugData( info, t, o )); + } + else if (popup) + alert(info); + else if (window.console) + console.log(info); + else { + var id = "#layoutLogger" + , $l = $(id); + if (!$l.length) + $l = createLog(); + $l.children("ul").append('
      • '+ info.replace(/\/g,">") +'
      • '); + } + + function createLog () { + var pos = $.support.fixedPosition ? 'fixed' : 'absolute' + , $e = $('
        ' + + '
        ' + + 'XLayout console.log
        ' + + '
          ' + + '
          ' + ).appendTo("body"); + $e.css('left', $(window).width() - $e.outerWidth() - 5) + if ($.ui.draggable) $e.draggable({ handle: ':first-child' }); + return $e; + }; + } + +}; + + +/* + * $.layout.browser REPLACES removed $.browser, with extra data + * Parsing code here adapted from jQuery 1.8 $.browse + */ +(function(){ + var u = navigator.userAgent.toLowerCase() + , m = /(chrome)[ \/]([\w.]+)/.exec( u ) + || /(webkit)[ \/]([\w.]+)/.exec( u ) + || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( u ) + || /(msie) ([\w.]+)/.exec( u ) + || u.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( u ) + || [] + , b = m[1] || "" + , v = m[2] || 0 + , ie = b === "msie" + , cm = document.compatMode + , $s = $.support + , bs = $s.boxSizing !== undefined ? $s.boxSizing : $s.boxSizingReliable + , bm = !ie || !cm || cm === "CSS1Compat" || $s.boxModel || false + , lb = $.layout.browser = { + version: v + , safari: b === "webkit" // webkit (NOT chrome) = safari + , webkit: b === "chrome" // chrome = webkit + , msie: ie + , isIE6: ie && v == 6 + // ONLY IE reverts to old box-model - Note that compatMode was deprecated as of IE8 + , boxModel: bm + , boxSizing: !!(typeof bs === "function" ? bs() : bs) + }; + ; + if (b) lb[b] = true; // set CURRENT browser + /* OLD versions of jQuery only set $.support.boxModel after page is loaded + * so if this is IE, use support.boxModel to test for quirks-mode (ONLY IE changes boxModel) */ + if (!bm && !cm) $(function(){ lb.boxModel = $s.boxModel; }); +})(); + + +// DEFAULT OPTIONS +$.layout.defaults = { +/* + * LAYOUT & LAYOUT-CONTAINER OPTIONS + * - none of these options are applicable to individual panes + */ + name: "" // Not required, but useful for buttons and used for the state-cookie +, containerClass: "ui-layout-container" // layout-container element +, inset: null // custom container-inset values (override padding) +, scrollToBookmarkOnLoad: true // after creating a layout, scroll to bookmark in URL (.../page.htm#myBookmark) +, resizeWithWindow: true // bind thisLayout.resizeAll() to the window.resize event +, resizeWithWindowDelay: 200 // delay calling resizeAll because makes window resizing very jerky +, resizeWithWindowMaxDelay: 0 // 0 = none - force resize every XX ms while window is being resized +, maskPanesEarly: false // true = create pane-masks on resizer.mouseDown instead of waiting for resizer.dragstart +, onresizeall_start: null // CALLBACK when resizeAll() STARTS - NOT pane-specific +, onresizeall_end: null // CALLBACK when resizeAll() ENDS - NOT pane-specific +, onload_start: null // CALLBACK when Layout inits - after options initialized, but before elements +, onload_end: null // CALLBACK when Layout inits - after EVERYTHING has been initialized +, onunload_start: null // CALLBACK when Layout is destroyed OR onWindowUnload +, onunload_end: null // CALLBACK when Layout is destroyed OR onWindowUnload +, initPanes: true // false = DO NOT initialize the panes onLoad - will init later +, showErrorMessages: true // enables fatal error messages to warn developers of common errors +, showDebugMessages: false // display console-and-alert debug msgs - IF this Layout version _has_ debugging code! +// Changing this zIndex value will cause other zIndex values to automatically change +, zIndex: null // the PANE zIndex - resizers and masks will be +1 +// DO NOT CHANGE the zIndex values below unless you clearly understand their relationships +, zIndexes: { // set _default_ z-index values here... + pane_normal: 0 // normal z-index for panes + , content_mask: 1 // applied to overlays used to mask content INSIDE panes during resizing + , resizer_normal: 2 // normal z-index for resizer-bars + , pane_sliding: 100 // applied to *BOTH* the pane and its resizer when a pane is 'slid open' + , pane_animate: 1000 // applied to the pane when being animated - not applied to the resizer + , resizer_drag: 10000 // applied to the CLONED resizer-bar when being 'dragged' + } +, errors: { + pane: "pane" // description of "layout pane element" - used only in error messages + , selector: "selector" // description of "jQuery-selector" - used only in error messages + , addButtonError: "Error Adding Button\nInvalid " + , containerMissing: "UI Layout Initialization Error\nThe specified layout-container does not exist." + , centerPaneMissing: "UI Layout Initialization Error\nThe center-pane element does not exist.\nThe center-pane is a required element." + , noContainerHeight: "UI Layout Initialization Warning\nThe layout-container \"CONTAINER\" has no height.\nTherefore the layout is 0-height and hence 'invisible'!" + , callbackError: "UI Layout Callback Error\nThe EVENT callback is not a valid function." + } +/* + * PANE DEFAULT SETTINGS + * - settings under the 'panes' key become the default settings for *all panes* + * - ALL pane-options can also be set specifically for each panes, which will override these 'default values' + */ +, panes: { // default options for 'all panes' - will be overridden by 'per-pane settings' + applyDemoStyles: false // NOTE: renamed from applyDefaultStyles for clarity + , closable: true // pane can open & close + , resizable: true // when open, pane can be resized + , slidable: true // when closed, pane can 'slide open' over other panes - closes on mouse-out + , initClosed: false // true = init pane as 'closed' + , initHidden: false // true = init pane as 'hidden' - no resizer-bar/spacing + // SELECTORS + //, paneSelector: "" // MUST be pane-specific - jQuery selector for pane + , contentSelector: ".ui-layout-content" // INNER div/element to auto-size so only it scrolls, not the entire pane! + , contentIgnoreSelector: ".ui-layout-ignore" // element(s) to 'ignore' when measuring 'content' + , findNestedContent: false // true = $P.find(contentSelector), false = $P.children(contentSelector) + // GENERIC ROOT-CLASSES - for auto-generated classNames + , paneClass: "ui-layout-pane" // Layout Pane + , resizerClass: "ui-layout-resizer" // Resizer Bar + , togglerClass: "ui-layout-toggler" // Toggler Button + , buttonClass: "ui-layout-button" // CUSTOM Buttons - eg: '[ui-layout-button]-toggle/-open/-close/-pin' + // ELEMENT SIZE & SPACING + //, size: 100 // MUST be pane-specific -initial size of pane + , minSize: 0 // when manually resizing a pane + , maxSize: 0 // ditto, 0 = no limit + , spacing_open: 6 // space between pane and adjacent panes - when pane is 'open' + , spacing_closed: 6 // ditto - when pane is 'closed' + , togglerLength_open: 50 // Length = WIDTH of toggler button on north/south sides - HEIGHT on east/west sides + , togglerLength_closed: 50 // 100% OR -1 means 'full height/width of resizer bar' - 0 means 'hidden' + , togglerAlign_open: "center" // top/left, bottom/right, center, OR... + , togglerAlign_closed: "center" // 1 => nn = offset from top/left, -1 => -nn == offset from bottom/right + , togglerContent_open: "" // text or HTML to put INSIDE the toggler + , togglerContent_closed: "" // ditto + // RESIZING OPTIONS + , resizerDblClickToggle: true // + , autoResize: true // IF size is 'auto' or a percentage, then recalc 'pixel size' whenever the layout resizes + , autoReopen: true // IF a pane was auto-closed due to noRoom, reopen it when there is room? False = leave it closed + , resizerDragOpacity: 1 // option for ui.draggable + //, resizerCursor: "" // MUST be pane-specific - cursor when over resizer-bar + , maskContents: false // true = add DIV-mask over-or-inside this pane so can 'drag' over IFRAMES + , maskObjects: false // true = add IFRAME-mask over-or-inside this pane to cover objects/applets - content-mask will overlay this mask + , maskZindex: null // will override zIndexes.content_mask if specified - not applicable to iframe-panes + , resizingGrid: false // grid size that the resizers will snap-to during resizing, eg: [20,20] + , livePaneResizing: false // true = LIVE Resizing as resizer is dragged + , liveContentResizing: false // true = re-measure header/footer heights as resizer is dragged + , liveResizingTolerance: 1 // how many px change before pane resizes, to control performance + // SLIDING OPTIONS + , sliderCursor: "pointer" // cursor when resizer-bar will trigger 'sliding' + , slideTrigger_open: "click" // click, dblclick, mouseenter + , slideTrigger_close: "mouseleave"// click, mouseleave + , slideDelay_open: 300 // applies only for mouseenter event - 0 = instant open + , slideDelay_close: 300 // applies only for mouseleave event (300ms is the minimum!) + , hideTogglerOnSlide: false // when pane is slid-open, should the toggler show? + , preventQuickSlideClose: $.layout.browser.webkit // Chrome triggers slideClosed as it is opening + , preventPrematureSlideClose: false // handle incorrect mouseleave trigger, like when over a SELECT-list in IE + // PANE-SPECIFIC TIPS & MESSAGES + , tips: { + Open: "Open" // eg: "Open Pane" + , Close: "Close" + , Resize: "Resize" + , Slide: "Slide Open" + , Pin: "Pin" + , Unpin: "Un-Pin" + , noRoomToOpen: "Not enough room to show this panel." // alert if user tries to open a pane that cannot + , minSizeWarning: "Panel has reached its minimum size" // displays in browser statusbar + , maxSizeWarning: "Panel has reached its maximum size" // ditto + } + // HOT-KEYS & MISC + , showOverflowOnHover: false // will bind allowOverflow() utility to pane.onMouseOver + , enableCursorHotkey: true // enabled 'cursor' hotkeys + //, customHotkey: "" // MUST be pane-specific - EITHER a charCode OR a character + , customHotkeyModifier: "SHIFT" // either 'SHIFT', 'CTRL' or 'CTRL+SHIFT' - NOT 'ALT' + // PANE ANIMATION + // NOTE: fxSss_open, fxSss_close & fxSss_size options (eg: fxName_open) are auto-generated if not passed + , fxName: "slide" // ('none' or blank), slide, drop, scale -- only relevant to 'open' & 'close', NOT 'size' + , fxSpeed: null // slow, normal, fast, 200, nnn - if passed, will OVERRIDE fxSettings.duration + , fxSettings: {} // can be passed, eg: { easing: "easeOutBounce", duration: 1500 } + , fxOpacityFix: true // tries to fix opacity in IE to restore anti-aliasing after animation + , animatePaneSizing: false // true = animate resizing after dragging resizer-bar OR sizePane() is called + /* NOTE: Action-specific FX options are auto-generated from the options above if not specifically set: + fxName_open: "slide" // 'Open' pane animation + fnName_close: "slide" // 'Close' pane animation + fxName_size: "slide" // 'Size' pane animation - when animatePaneSizing = true + fxSpeed_open: null + fxSpeed_close: null + fxSpeed_size: null + fxSettings_open: {} + fxSettings_close: {} + fxSettings_size: {} + */ + // CHILD/NESTED LAYOUTS + , children: null // Layout-options for nested/child layout - even {} is valid as options + , containerSelector: '' // if child is NOT 'directly nested', a selector to find it/them (can have more than one child layout!) + , initChildren: true // true = child layout will be created as soon as _this_ layout completes initialization + , destroyChildren: true // true = destroy child-layout if this pane is destroyed + , resizeChildren: true // true = trigger child-layout.resizeAll() when this pane is resized + // EVENT TRIGGERING + , triggerEventsOnLoad: false // true = trigger onopen OR onclose callbacks when layout initializes + , triggerEventsDuringLiveResize: true // true = trigger onresize callback REPEATEDLY if livePaneResizing==true + // PANE CALLBACKS + , onshow_start: null // CALLBACK when pane STARTS to Show - BEFORE onopen/onhide_start + , onshow_end: null // CALLBACK when pane ENDS being Shown - AFTER onopen/onhide_end + , onhide_start: null // CALLBACK when pane STARTS to Close - BEFORE onclose_start + , onhide_end: null // CALLBACK when pane ENDS being Closed - AFTER onclose_end + , onopen_start: null // CALLBACK when pane STARTS to Open + , onopen_end: null // CALLBACK when pane ENDS being Opened + , onclose_start: null // CALLBACK when pane STARTS to Close + , onclose_end: null // CALLBACK when pane ENDS being Closed + , onresize_start: null // CALLBACK when pane STARTS being Resized ***FOR ANY REASON*** + , onresize_end: null // CALLBACK when pane ENDS being Resized ***FOR ANY REASON*** + , onsizecontent_start: null // CALLBACK when sizing of content-element STARTS + , onsizecontent_end: null // CALLBACK when sizing of content-element ENDS + , onswap_start: null // CALLBACK when pane STARTS to Swap + , onswap_end: null // CALLBACK when pane ENDS being Swapped + , ondrag_start: null // CALLBACK when pane STARTS being ***MANUALLY*** Resized + , ondrag_end: null // CALLBACK when pane ENDS being ***MANUALLY*** Resized + } +/* + * PANE-SPECIFIC SETTINGS + * - options listed below MUST be specified per-pane - they CANNOT be set under 'panes' + * - all options under the 'panes' key can also be set specifically for any pane + * - most options under the 'panes' key apply only to 'border-panes' - NOT the the center-pane + */ +, north: { + paneSelector: ".ui-layout-north" + , size: "auto" // eg: "auto", "30%", .30, 200 + , resizerCursor: "n-resize" // custom = url(myCursor.cur) + , customHotkey: "" // EITHER a charCode (43) OR a character ("o") + } +, south: { + paneSelector: ".ui-layout-south" + , size: "50%"//"auto" + , resizerCursor: "s-resize" + , customHotkey: "" + , initClosed: true + } +, east: { + paneSelector: ".ui-layout-east" + , size: "5%"//200 + , resizerCursor: "e-resize" + , customHotkey: "" + } +, west: { + paneSelector: ".ui-layout-west" + , size: "70%" //200 + , resizerCursor: "w-resize" + , customHotkey: "" + , initClosed: true + } +, center: { + paneSelector: ".ui-layout-center" + , size: "30%"//"auto" + , minWidth: 0 + , minHeight: 0 + } +}; + +$.layout.optionsMap = { + // layout/global options - NOT pane-options + layout: ("name,instanceKey,stateManagement,effects,inset,zIndexes,errors," + + "zIndex,scrollToBookmarkOnLoad,showErrorMessages,maskPanesEarly," + + "outset,resizeWithWindow,resizeWithWindowDelay,resizeWithWindowMaxDelay," + + "onresizeall,onresizeall_start,onresizeall_end,onload,onload_start,onload_end,onunload,onunload_start,onunload_end").split(",") +// borderPanes: [ ALL options that are NOT specified as 'layout' ] + // default.panes options that apply to the center-pane (most options apply _only_ to border-panes) +, center: ("paneClass,contentSelector,contentIgnoreSelector,findNestedContent,applyDemoStyles,triggerEventsOnLoad," + + "showOverflowOnHover,maskContents,maskObjects,liveContentResizing," + + "containerSelector,children,initChildren,resizeChildren,destroyChildren," + + "onresize,onresize_start,onresize_end,onsizecontent,onsizecontent_start,onsizecontent_end").split(",") + // options that MUST be specifically set 'per-pane' - CANNOT set in the panes (defaults) key +, noDefault: ("paneSelector,resizerCursor,customHotkey").split(",") +}; + +/** + * Processes options passed in converts flat-format data into subkey (JSON) format + * In flat-format, subkeys are _currently_ separated with 2 underscores, like north__optName + * Plugins may also call this method so they can transform their own data + * + * @param {!Object} hash Data/options passed by user - may be a single level or nested levels + * @param {boolean=} [addKeys=false] Should the primary layout.options keys be added if they do not exist? + * @return {Object} Returns hash of minWidth & minHeight + */ +$.layout.transformData = function (hash, addKeys) { + var json = addKeys ? { panes: {}, center: {} } : {} // init return object + , branch, optKey, keys, key, val, i, c; + + if (typeof hash !== "object") return json; // no options passed + + // convert all 'flat-keys' to 'sub-key' format + for (optKey in hash) { + branch = json; + val = hash[ optKey ]; + keys = optKey.split("__"); // eg: west__size or north__fxSettings__duration + c = keys.length - 1; + // convert underscore-delimited to subkeys + for (i=0; i <= c; i++) { + key = keys[i]; + if (i === c) { // last key = value + if ($.isPlainObject( val )) + branch[key] = $.layout.transformData( val ); // RECURSE + else + branch[key] = val; + } + else { + if (!branch[key]) + branch[key] = {}; // create the subkey + // recurse to sub-key for next loop - if not done + branch = branch[key]; + } + } + } + return json; +}; + +// INTERNAL CONFIG DATA - DO NOT CHANGE THIS! +$.layout.backwardCompatibility = { + // data used by renameOldOptions() + map: { + // OLD Option Name: NEW Option Name + applyDefaultStyles: "applyDemoStyles" + // CHILD/NESTED LAYOUTS + , childOptions: "children" + , initChildLayout: "initChildren" + , destroyChildLayout: "destroyChildren" + , resizeChildLayout: "resizeChildren" + , resizeNestedLayout: "resizeChildren" + // MISC Options + , resizeWhileDragging: "livePaneResizing" + , resizeContentWhileDragging: "liveContentResizing" + , triggerEventsWhileDragging: "triggerEventsDuringLiveResize" + , maskIframesOnResize: "maskContents" + // STATE MANAGEMENT + , useStateCookie: "stateManagement.enabled" + , "cookie.autoLoad": "stateManagement.autoLoad" + , "cookie.autoSave": "stateManagement.autoSave" + , "cookie.keys": "stateManagement.stateKeys" + , "cookie.name": "stateManagement.cookie.name" + , "cookie.domain": "stateManagement.cookie.domain" + , "cookie.path": "stateManagement.cookie.path" + , "cookie.expires": "stateManagement.cookie.expires" + , "cookie.secure": "stateManagement.cookie.secure" + // OLD Language options + , noRoomToOpenTip: "tips.noRoomToOpen" + , togglerTip_open: "tips.Close" // open = Close + , togglerTip_closed: "tips.Open" // closed = Open + , resizerTip: "tips.Resize" + , sliderTip: "tips.Slide" + } + +/** +* @param {Object} opts +*/ +, renameOptions: function (opts) { + var map = $.layout.backwardCompatibility.map + , oldData, newData, value + ; + for (var itemPath in map) { + oldData = getBranch( itemPath ); + value = oldData.branch[ oldData.key ]; + if (value !== undefined) { + newData = getBranch( map[itemPath], true ); + newData.branch[ newData.key ] = value; + delete oldData.branch[ oldData.key ]; + } + } + + /** + * @param {string} path + * @param {boolean=} [create=false] Create path if does not exist + */ + function getBranch (path, create) { + var a = path.split(".") // split keys into array + , c = a.length - 1 + , D = { branch: opts, key: a[c] } // init branch at top & set key (last item) + , i = 0, k, undef; + for (; i 0) { + if (autoHide && $E.data('autoHidden') && $E.innerHeight() > 0) { + $E.show().data('autoHidden', false); + if (!browser.mozilla) // FireFox refreshes iframes - IE does not + // make hidden, then visible to 'refresh' display after animation + $E.css(_c.hidden).css(_c.visible); + } + } + else if (autoHide && !$E.data('autoHidden')) + $E.hide().data('autoHidden', true); + } + + /** + * @param {(string|!Object)} el + * @param {number=} outerHeight + * @param {boolean=} [autoHide=false] + */ +, setOuterHeight = function (el, outerHeight, autoHide) { + var $E = el, h; + if (isStr(el)) $E = $Ps[el]; // west + else if (!el.jquery) $E = $(el); + h = cssH($E, outerHeight); + $E.css({ height: h, visibility: "visible" }); // may have been 'hidden' by sizeContent + if (h > 0 && $E.innerWidth() > 0) { + if (autoHide && $E.data('autoHidden')) { + $E.show().data('autoHidden', false); + if (!browser.mozilla) // FireFox refreshes iframes - IE does not + $E.css(_c.hidden).css(_c.visible); + } + } + else if (autoHide && !$E.data('autoHidden')) + $E.hide().data('autoHidden', true); + } + + + /** + * Converts any 'size' params to a pixel/integer size, if not already + * If 'auto' or a decimal/percentage is passed as 'size', a pixel-size is calculated + * + /** + * @param {string} pane + * @param {(string|number)=} size + * @param {string=} [dir] + * @return {number} + */ +, _parseSize = function (pane, size, dir) { + if (!dir) dir = _c[pane].dir; + + if (isStr(size) && size.match(/%/)) + size = (size === '100%') ? -1 : parseInt(size, 10) / 100; // convert % to decimal + + if (size === 0) + return 0; + else if (size >= 1) + return parseInt(size, 10); + + var o = options, avail = 0; + if (dir=="horz") // north or south or center.minHeight + avail = sC.innerHeight - ($Ps.north ? o.north.spacing_open : 0) - ($Ps.south ? o.south.spacing_open : 0); + else if (dir=="vert") // east or west or center.minWidth + avail = sC.innerWidth - ($Ps.west ? o.west.spacing_open : 0) - ($Ps.east ? o.east.spacing_open : 0); + + if (size === -1) // -1 == 100% + return avail; + else if (size > 0) // percentage, eg: .25 + return round(avail * size); + else if (pane=="center") + return 0; + else { // size < 0 || size=='auto' || size==Missing || size==Invalid + // auto-size the pane + var dim = (dir === "horz" ? "height" : "width") + , $P = $Ps[pane] + , $C = dim === 'height' ? $Cs[pane] : false + , vis = $.layout.showInvisibly($P) // show pane invisibly if hidden + , szP = $P.css(dim) // SAVE current pane size + , szC = $C ? $C.css(dim) : 0 // SAVE current content size + ; + $P.css(dim, "auto"); + if ($C) $C.css(dim, "auto"); + size = (dim === "height") ? $P.outerHeight() : $P.outerWidth(); // MEASURE + $P.css(dim, szP).css(vis); // RESET size & visibility + if ($C) $C.css(dim, szC); + return size; + } + } + + /** + * Calculates current 'size' (outer-width or outer-height) of a border-pane - optionally with 'pane-spacing' added + * + * @param {(string|!Object)} pane + * @param {boolean=} [inclSpace=false] + * @return {number} Returns EITHER Width for east/west panes OR Height for north/south panes + */ +, getPaneSize = function (pane, inclSpace) { + var + $P = $Ps[pane] + , o = options[pane] + , s = state[pane] + , oSp = (inclSpace ? o.spacing_open : 0) + , cSp = (inclSpace ? o.spacing_closed : 0) + ; + if (!$P || s.isHidden) + return 0; + else if (s.isClosed || (s.isSliding && inclSpace)) + return cSp; + else if (_c[pane].dir === "horz") + return $P.outerHeight() + oSp; + else // dir === "vert" + return $P.outerWidth() + oSp; + } + + /** + * Calculate min/max pane dimensions and limits for resizing + * + * @param {string} pane + * @param {boolean=} [slide=false] + */ +, setSizeLimits = function (pane, slide) { + if (!isInitialized()) return; + var + o = options[pane] + , s = state[pane] + , c = _c[pane] + , dir = c.dir + , type = c.sizeType.toLowerCase() + , isSliding = (slide != undefined ? slide : s.isSliding) // only open() passes 'slide' param + , $P = $Ps[pane] + , paneSpacing = o.spacing_open + // measure the pane on the *opposite side* from this pane + , altPane = _c.oppositeEdge[pane] + , altS = state[altPane] + , $altP = $Ps[altPane] + , altPaneSize = (!$altP || altS.isVisible===false || altS.isSliding ? 0 : (dir=="horz" ? $altP.outerHeight() : $altP.outerWidth())) + , altPaneSpacing = ((!$altP || altS.isHidden ? 0 : options[altPane][ altS.isClosed !== false ? "spacing_closed" : "spacing_open" ]) || 0) + // limitSize prevents this pane from 'overlapping' opposite pane + , containerSize = (dir=="horz" ? sC.innerHeight : sC.innerWidth) + , minCenterDims = cssMinDims("center") + , minCenterSize = dir=="horz" ? max(options.center.minHeight, minCenterDims.minHeight) : max(options.center.minWidth, minCenterDims.minWidth) + // if pane is 'sliding', then ignore center and alt-pane sizes - because 'overlays' them + , limitSize = (containerSize - paneSpacing - (isSliding ? 0 : (_parseSize("center", minCenterSize, dir) + altPaneSize + altPaneSpacing))) + , minSize = s.minSize = max( _parseSize(pane, o.minSize), cssMinDims(pane).minSize ) + , maxSize = s.maxSize = min( (o.maxSize ? _parseSize(pane, o.maxSize) : 100000), limitSize ) + , r = s.resizerPosition = {} // used to set resizing limits + , top = sC.inset.top + , left = sC.inset.left + , W = sC.innerWidth + , H = sC.innerHeight + , rW = o.spacing_open // subtract resizer-width to get top/left position for south/east + ; + switch (pane) { + case "north": r.min = top + minSize; + r.max = top + maxSize; + break; + case "west": r.min = left + minSize; + r.max = left + maxSize; + break; + case "south": r.min = top + H - maxSize - rW; + r.max = top + H - minSize - rW; + break; + case "east": r.min = left + W - maxSize - rW; + r.max = left + W - minSize - rW; + break; + }; + } + + /** + * Returns data for setting the size/position of center pane. Also used to set Height for east/west panes + * + * @return JSON Returns a hash of all dimensions: top, bottom, left, right, (outer) width and (outer) height + */ +, calcNewCenterPaneDims = function () { + var d = { + top: getPaneSize("north", true) // true = include 'spacing' value for pane + , bottom: getPaneSize("south", true) + , left: getPaneSize("west", true) + , right: getPaneSize("east", true) + , width: 0 + , height: 0 + }; + + // NOTE: sC = state.container + // calc center-pane outer dimensions + d.width = sC.innerWidth - d.left - d.right; // outerWidth + d.height = sC.innerHeight - d.bottom - d.top; // outerHeight + // add the 'container border/padding' to get final positions relative to the container + d.top += sC.inset.top; + d.bottom += sC.inset.bottom; + d.left += sC.inset.left; + d.right += sC.inset.right; + + return d; + } + + + /** + * @param {!Object} el + * @param {boolean=} [allStates=false] + */ +, getHoverClasses = function (el, allStates) { + var + $El = $(el) + , type = $El.data("layoutRole") + , pane = $El.data("layoutEdge") + , o = options[pane] + , root = o[type +"Class"] + , _pane = "-"+ pane // eg: "-west" + , _open = "-open" + , _closed = "-closed" + , _slide = "-sliding" + , _hover = "-hover " // NOTE the trailing space + , _state = $El.hasClass(root+_closed) ? _closed : _open + , _alt = _state === _closed ? _open : _closed + , classes = (root+_hover) + (root+_pane+_hover) + (root+_state+_hover) + (root+_pane+_state+_hover) + ; + if (allStates) // when 'removing' classes, also remove alternate-state classes + classes += (root+_alt+_hover) + (root+_pane+_alt+_hover); + + if (type=="resizer" && $El.hasClass(root+_slide)) + classes += (root+_slide+_hover) + (root+_pane+_slide+_hover); + + return $.trim(classes); + } +, addHover = function (evt, el) { + var $E = $(el || this); + if (evt && $E.data("layoutRole") === "toggler") + evt.stopPropagation(); // prevent triggering 'slide' on Resizer-bar + $E.addClass( getHoverClasses($E) ); + } +, removeHover = function (evt, el) { + var $E = $(el || this); + $E.removeClass( getHoverClasses($E, true) ); + } + +, onResizerEnter = function (evt) { // ALSO called by toggler.mouseenter + var pane = $(this).data("layoutEdge") + , s = state[pane] + , $d = $(document) + ; + // ignore closed-panes and mouse moving back & forth over resizer! + // also ignore if ANY pane is currently resizing + if ( s.isResizing || state.paneResizing ) return; + + if (options.maskPanesEarly) + showMasks( pane, { resizing: true }); + } +, onResizerLeave = function (evt, el) { + var e = el || this // el is only passed when called by the timer + , pane = $(e).data("layoutEdge") + , name = pane +"ResizerLeave" + , $d = $(document) + ; + timer.clear(pane+"_openSlider"); // cancel slideOpen timer, if set + timer.clear(name); // cancel enableSelection timer - may re/set below + // this method calls itself on a timer because it needs to allow + // enough time for dragging to kick-in and set the isResizing flag + // dragging has a 100ms delay set, so this delay must be >100 + if (!el) // 1st call - mouseleave event + timer.set(name, function(){ onResizerLeave(evt, e); }, 200); + // if user is resizing, dragStop will reset everything, so skip it here + else if (options.maskPanesEarly && !state.paneResizing) // 2nd call - by timer + hideMasks(); + } + +/* + * ########################### + * INITIALIZATION METHODS + * ########################### + */ + + /** + * Initialize the layout - called automatically whenever an instance of layout is created + * + * @see none - triggered onInit + * @return mixed true = fully initialized | false = panes not initialized (yet) | 'cancel' = abort + */ +, _create = function () { + // initialize config/options + initOptions(); + var o = options + , s = state; + + // TEMP state so isInitialized returns true during init process + s.creatingLayout = true; + + // init plugins for this layout, if there are any (eg: stateManagement) + runPluginCallbacks( Instance, $.layout.onCreate ); + + // options & state have been initialized, so now run beforeLoad callback + // onload will CANCEL layout creation if it returns false + if (false === _runCallbacks("onload_start")) + return 'cancel'; + + // initialize the container element + _initContainer(); + + // bind hotkey function - keyDown - if required + initHotkeys(); + + // bind window.onunload + $(window).bind("unload."+ sID, unload); + + // init plugins for this layout, if there are any (eg: customButtons) + runPluginCallbacks( Instance, $.layout.onLoad ); + + // if layout elements are hidden, then layout WILL NOT complete initialization! + // initLayoutElements will set initialized=true and run the onload callback IF successful + if (o.initPanes) _initLayoutElements(); + + delete s.creatingLayout; + + return state.initialized; + } + + /** + * Initialize the layout IF not already + * + * @see All methods in Instance run this test + * @return boolean true = layoutElements have been initialized | false = panes are not initialized (yet) + */ +, isInitialized = function () { + if (state.initialized || state.creatingLayout) return true; // already initialized + else return _initLayoutElements(); // try to init panes NOW + } + + /** + * Initialize the layout - called automatically whenever an instance of layout is created + * + * @see _create() & isInitialized + * @param {boolean=} [retry=false] // indicates this is a 2nd try + * @return An object pointer to the instance created + */ +, _initLayoutElements = function (retry) { + // initialize config/options + var o = options; + // CANNOT init panes inside a hidden container! + if (!$N.is(":visible")) { + // handle Chrome bug where popup window 'has no height' + // if layout is BODY element, try again in 50ms + // SEE: http://layout.jquery-dev.com/samples/test_popup_window.html + if ( !retry && browser.webkit && $N[0].tagName === "BODY" ) + setTimeout(function(){ _initLayoutElements(true); }, 50); + return false; + } + + // a center pane is required, so make sure it exists + if (!getPane("center").length) { + return _log( o.errors.centerPaneMissing ); + } + + // TEMP state so isInitialized returns true during init process + state.creatingLayout = true; + + // update Container dims + $.extend(sC, elDims( $N, o.inset )); // passing inset means DO NOT include insetX values + + // initialize all layout elements + initPanes(); // size & position panes - calls initHandles() - which calls initResizable() + + if (o.scrollToBookmarkOnLoad) { + var l = self.location; + if (l.hash) l.replace( l.hash ); // scrollTo Bookmark + } + + // check to see if this layout 'nested' inside a pane + if (Instance.hasParentLayout) + o.resizeWithWindow = false; + // bind resizeAll() for 'this layout instance' to window.resize event + else if (o.resizeWithWindow) + $(window).bind("resize."+ sID, windowResize); + + delete state.creatingLayout; + state.initialized = true; + + // init plugins for this layout, if there are any + runPluginCallbacks( Instance, $.layout.onReady ); + + // now run the onload callback, if exists + _runCallbacks("onload_end"); + + return true; // elements initialized successfully + } + + /** + * Initialize nested layouts for a specific pane - can optionally pass layout-options + * + * @param {(string|Object)} evt_or_pane The pane being opened, ie: north, south, east, or west + * @param {Object=} [opts] Layout-options - if passed, will OVERRRIDE options[pane].children + * @return An object pointer to the layout instance created - or null + */ +, createChildren = function (evt_or_pane, opts) { + var pane = evtPane.call(this, evt_or_pane) + , $P = $Ps[pane] + ; + if (!$P) return; + var $C = $Cs[pane] + , s = state[pane] + , o = options[pane] + , sm = options.stateManagement || {} + , cos = opts ? (o.children = opts) : o.children + ; + if ( $.isPlainObject( cos ) ) + cos = [ cos ]; // convert a hash to a 1-elem array + else if (!cos || !$.isArray( cos )) + return; + + $.each( cos, function (idx, co) { + if ( !$.isPlainObject( co ) ) return; + + // determine which element is supposed to be the 'child container' + // if pane has a 'containerSelector' OR a 'content-div', use those instead of the pane + var $containers = co.containerSelector ? $P.find( co.containerSelector ) : ($C || $P); + + $containers.each(function(){ + var $cont = $(this) + , child = $cont.data("layout") // see if a child-layout ALREADY exists on this element + ; + // if no layout exists, but children are set, try to create the layout now + if (!child) { + // TODO: see about moving this to the stateManagement plugin, as a method + // set a unique child-instance key for this layout, if not already set + setInstanceKey({ container: $cont, options: co }, s ); + // If THIS layout has a hash in stateManagement.autoLoad, + // then see if it also contains state-data for this child-layout + // If so, copy the stateData to child.options.stateManagement.autoLoad + if ( sm.includeChildren && state.stateData[pane] ) { + // THIS layout's state was cached when its state was loaded + var paneChildren = state.stateData[pane].children || {} + , childState = paneChildren[ co.instanceKey ] + , co_sm = co.stateManagement || (co.stateManagement = { autoLoad: true }) + ; + // COPY the stateData into the autoLoad key + if ( co_sm.autoLoad === true && childState ) { + co_sm.autoSave = false; // disable autoSave because saving handled by parent-layout + co_sm.includeChildren = true; // cascade option - FOR NOW + co_sm.autoLoad = $.extend(true, {}, childState); // COPY the state-hash + } + } + + // create the layout + child = $cont.layout( co ); + + // if successful, update data + if (child) { + // add the child and update all layout-pointers + // MAY have already been done by child-layout calling parent.refreshChildren() + refreshChildren( pane, child ); + } + } + }); + }); + } + +, setInstanceKey = function (child, parentPaneState) { + // create a named key for use in state and instance branches + var $c = child.container + , o = child.options + , sm = o.stateManagement + , key = o.instanceKey || $c.data("layoutInstanceKey") + ; + if (!key) key = (sm && sm.cookie ? sm.cookie.name : '') || o.name; // look for a name/key + if (!key) key = "layout"+ (++parentPaneState.childIdx); // if no name/key found, generate one + else key = key.replace(/[^\w-]/gi, '_').replace(/_{2,}/g, '_'); // ensure is valid as a hash key + o.instanceKey = key; + $c.data("layoutInstanceKey", key); // useful if layout is destroyed and then recreated + return key; + } + + /** + * @param {string} pane The pane being opened, ie: north, south, east, or west + * @param {Object=} newChild New child-layout Instance to add to this pane + */ +, refreshChildren = function (pane, newChild) { + var $P = $Ps[pane] + , pC = children[pane] + , s = state[pane] + , o + ; + // check for destroy()ed layouts and update the child pointers & arrays + if ($.isPlainObject( pC )) { + $.each( pC, function (key, child) { + if (child.destroyed) delete pC[key] + }); + // if no more children, remove the children hash + if ($.isEmptyObject( pC )) + pC = children[pane] = null; // clear children hash + } + + // see if there is a directly-nested layout inside this pane + // if there is, then there can be only ONE child-layout, so check that... + if (!newChild && !pC) { + newChild = $P.data("layout"); + } + + // if a newChild instance was passed, add it to children[pane] + if (newChild) { + // update child.state + newChild.hasParentLayout = true; // set parent-flag in child + // instanceKey is a key-name used in both state and children + o = newChild.options; + // set a unique child-instance key for this layout, if not already set + setInstanceKey( newChild, s ); + // add pointer to pane.children hash + if (!pC) pC = children[pane] = {}; // create an empty children hash + pC[ o.instanceKey ] = newChild.container.data("layout"); // add childLayout instance + } + + // ALWAYS refresh the pane.children alias, even if null + Instance[pane].children = children[pane]; + + // if newChild was NOT passed - see if there is a child layout NOW + if (!newChild) { + createChildren(pane); // MAY create a child and re-call this method + } + } + +, windowResize = function () { + var o = options + , delay = Number(o.resizeWithWindowDelay); + if (delay < 10) delay = 100; // MUST have a delay! + // resizing uses a delay-loop because the resize event fires repeatly - except in FF, but delay anyway + timer.clear("winResize"); // if already running + timer.set("winResize", function(){ + timer.clear("winResize"); + timer.clear("winResizeRepeater"); + var dims = elDims( $N, o.inset ); + // only trigger resizeAll() if container has changed size + if (dims.innerWidth !== sC.innerWidth || dims.innerHeight !== sC.innerHeight) + resizeAll(); + }, delay); + // ALSO set fixed-delay timer, if not already running + if (!timer.data["winResizeRepeater"]) setWindowResizeRepeater(); + } + +, setWindowResizeRepeater = function () { + var delay = Number(options.resizeWithWindowMaxDelay); + if (delay > 0) + timer.set("winResizeRepeater", function(){ setWindowResizeRepeater(); resizeAll(); }, delay); + } + +, unload = function () { + var o = options; + + _runCallbacks("onunload_start"); + + // trigger plugin callabacks for this layout (eg: stateManagement) + runPluginCallbacks( Instance, $.layout.onUnload ); + + _runCallbacks("onunload_end"); + } + + /** + * Validate and initialize container CSS and events + * + * @see _create() + */ +, _initContainer = function () { + var + N = $N[0] + , $H = $("html") + , tag = sC.tagName = N.tagName + , id = sC.id = N.id + , cls = sC.className = N.className + , o = options + , name = o.name + , props = "position,margin,padding,border" + , css = "layoutCSS" + , CSS = {} + , hid = "hidden" // used A LOT! + // see if this container is a 'pane' inside an outer-layout + , parent = $N.data("parentLayout") // parent-layout Instance + , pane = $N.data("layoutEdge") // pane-name in parent-layout + , isChild = parent && pane + , num = $.layout.cssNum + , $parent, n + ; + // sC = state.container + sC.selector = $N.selector.split(".slice")[0]; + sC.ref = (o.name ? o.name +' layout / ' : '') + tag + (id ? "#"+id : cls ? '.['+cls+']' : ''); // used in messages + sC.isBody = (tag === "BODY"); + + // try to find a parent-layout + if (!isChild && !sC.isBody) { + $parent = $N.closest("."+ $.layout.defaults.panes.paneClass); + parent = $parent.data("parentLayout"); + pane = $parent.data("layoutEdge"); + isChild = parent && pane; + } + + $N .data({ + layout: Instance + , layoutContainer: sID // FLAG to indicate this is a layout-container - contains unique internal ID + }) + .addClass(o.containerClass) + ; + var layoutMethods = { + destroy: '' + , initPanes: '' + , resizeAll: 'resizeAll' + , resize: 'resizeAll' + }; + // loop hash and bind all methods - include layoutID namespacing + for (name in layoutMethods) { + $N.bind("layout"+ name.toLowerCase() +"."+ sID, Instance[ layoutMethods[name] || name ]); + } + + // if this container is another layout's 'pane', then set child/parent pointers + if (isChild) { + // update parent flag + Instance.hasParentLayout = true; + // set pointers to THIS child-layout (Instance) in parent-layout + parent.refreshChildren( pane, Instance ); + } + + // SAVE original container CSS for use in destroy() + if (!$N.data(css)) { + // handle props like overflow different for BODY & HTML - has 'system default' values + if (sC.isBody) { + // SAVE CSS + $N.data(css, $.extend( styles($N, props), { + height: $N.css("height") + , overflow: $N.css("overflow") + , overflowX: $N.css("overflowX") + , overflowY: $N.css("overflowY") + })); + // ALSO SAVE CSS + $H.data(css, $.extend( styles($H, 'padding'), { + height: "auto" // FF would return a fixed px-size! + , overflow: $H.css("overflow") + , overflowX: $H.css("overflowX") + , overflowY: $H.css("overflowY") + })); + } + else // handle props normally for non-body elements + $N.data(css, styles($N, props+",top,bottom,left,right,width,height,overflow,overflowX,overflowY") ); + } + + try { + // common container CSS + CSS = { + overflow: hid + , overflowX: hid + , overflowY: hid + }; + $N.css( CSS ); + + if (o.inset && !$.isPlainObject(o.inset)) { + // can specify a single number for equal outset all-around + n = parseInt(o.inset, 10) || 0 + o.inset = { + top: n + , bottom: n + , left: n + , right: n + }; + } + + // format html & body if this is a full page layout + if (sC.isBody) { + // if HTML has padding, use this as an outer-spacing around BODY + if (!o.outset) { + // use padding from parent-elem (HTML) as outset + o.outset = { + top: num($H, "paddingTop") + , bottom: num($H, "paddingBottom") + , left: num($H, "paddingLeft") + , right: num($H, "paddingRight") + }; + } + else if (!$.isPlainObject(o.outset)) { + // can specify a single number for equal outset all-around + n = parseInt(o.outset, 10) || 0 + o.outset = { + top: n + , bottom: n + , left: n + , right: n + }; + } + // HTML + $H.css( CSS ).css({ + height: "100%" + , border: "none" // no border or padding allowed when using height = 100% + , padding: 0 // ditto + , margin: 0 + }); + // BODY + if (browser.isIE6) { + // IE6 CANNOT use the trick of setting absolute positioning on all 4 sides - must have 'height' + $N.css({ + width: "100%" + , height: "100%" + , border: "none" // no border or padding allowed when using height = 100% + , padding: 0 // ditto + , margin: 0 + , position: "relative" + }); + // convert body padding to an inset option - the border cannot be measured in IE6! + if (!o.inset) o.inset = elDims( $N ).inset; + } + else { // use absolute positioning for BODY to allow borders & padding without overflow + $N.css({ + width: "auto" + , height: "auto" + , margin: 0 + , position: "absolute" // allows for border and padding on BODY + }); + // apply edge-positioning created above + $N.css( o.outset ); + } + // set current layout-container dimensions + $.extend(sC, elDims( $N, o.inset )); // passing inset means DO NOT include insetX values + } + else { + // container MUST have 'position' + var p = $N.css("position"); + if (!p || !p.match(/(fixed|absolute|relative)/)) + $N.css("position","relative"); + + // set current layout-container dimensions + if ( $N.is(":visible") ) { + $.extend(sC, elDims( $N, o.inset )); // passing inset means DO NOT change insetX (padding) values + if (sC.innerHeight < 1) // container has no 'height' - warn developer + _log( o.errors.noContainerHeight.replace(/CONTAINER/, sC.ref) ); + } + } + + // if container has min-width/height, then enable scrollbar(s) + if ( num($N, "minWidth") ) $N.parent().css("overflowX","auto"); + if ( num($N, "minHeight") ) $N.parent().css("overflowY","auto"); + + } catch (ex) {} + } + + /** + * Bind layout hotkeys - if options enabled + * + * @see _create() and addPane() + * @param {string=} [panes=""] The edge(s) to process + */ +, initHotkeys = function (panes) { + panes = panes ? panes.split(",") : _c.borderPanes; + // bind keyDown to capture hotkeys, if option enabled for ANY pane + $.each(panes, function (i, pane) { + var o = options[pane]; + if (o.enableCursorHotkey || o.customHotkey) { + $(document).bind("keydown."+ sID, keyDown); // only need to bind this ONCE + return false; // BREAK - binding was done + } + }); + } + + /** + * Build final OPTIONS data + * + * @see _create() + */ +, initOptions = function () { + var data, d, pane, key, val, i, c, o; + + // reprocess user's layout-options to have correct options sub-key structure + opts = $.layout.transformData( opts, true ); // panes = default subkey + + // auto-rename old options for backward compatibility + opts = $.layout.backwardCompatibility.renameAllOptions( opts ); + + // if user-options has 'panes' key (pane-defaults), clean it... + if (!$.isEmptyObject(opts.panes)) { + // REMOVE any pane-defaults that MUST be set per-pane + data = $.layout.optionsMap.noDefault; + for (i=0, c=data.length; i 0) { + z.pane_normal = zo; + z.content_mask = max(zo+1, z.content_mask); // MIN = +1 + z.resizer_normal = max(zo+2, z.resizer_normal); // MIN = +2 + } + + // DELETE 'panes' key now that we are done - values were copied to EACH pane + delete options.panes; + + + function createFxOptions ( pane ) { + var o = options[pane] + , d = options.panes; + // ensure fxSettings key to avoid errors + if (!o.fxSettings) o.fxSettings = {}; + if (!d.fxSettings) d.fxSettings = {}; + + $.each(["_open","_close","_size"], function (i,n) { + var + sName = "fxName"+ n + , sSpeed = "fxSpeed"+ n + , sSettings = "fxSettings"+ n + // recalculate fxName according to specificity rules + , fxName = o[sName] = + o[sName] // options.west.fxName_open + || d[sName] // options.panes.fxName_open + || o.fxName // options.west.fxName + || d.fxName // options.panes.fxName + || "none" // MEANS $.layout.defaults.panes.fxName == "" || false || null || 0 + , fxExists = $.effects && ($.effects[fxName] || ($.effects.effect && $.effects.effect[fxName])) + ; + // validate fxName to ensure is valid effect - MUST have effect-config data in options.effects + if (fxName === "none" || !options.effects[fxName] || !fxExists) + fxName = o[sName] = "none"; // effect not loaded OR unrecognized fxName + + // set vars for effects subkeys to simplify logic + var fx = options.effects[fxName] || {} // effects.slide + , fx_all = fx.all || null // effects.slide.all + , fx_pane = fx[pane] || null // effects.slide.west + ; + // create fxSpeed[_open|_close|_size] + o[sSpeed] = + o[sSpeed] // options.west.fxSpeed_open + || d[sSpeed] // options.west.fxSpeed_open + || o.fxSpeed // options.west.fxSpeed + || d.fxSpeed // options.panes.fxSpeed + || null // DEFAULT - let fxSetting.duration control speed + ; + // create fxSettings[_open|_close|_size] + o[sSettings] = $.extend( + true + , {} + , fx_all // effects.slide.all + , fx_pane // effects.slide.west + , d.fxSettings // options.panes.fxSettings + , o.fxSettings // options.west.fxSettings + , d[sSettings] // options.panes.fxSettings_open + , o[sSettings] // options.west.fxSettings_open + ); + }); + + // DONE creating action-specific-settings for this pane, + // so DELETE generic options - are no longer meaningful + delete o.fxName; + delete o.fxSpeed; + delete o.fxSettings; + } + } + + /** + * Initialize module objects, styling, size and position for all panes + * + * @see _initElements() + * @param {string} pane The pane to process + */ +, getPane = function (pane) { + var sel = options[pane].paneSelector + if (sel.substr(0,1)==="#") // ID selector + // NOTE: elements selected 'by ID' DO NOT have to be 'children' + return $N.find(sel).eq(0); + else { // class or other selector + var $P = $N.children(sel).eq(0); + // look for the pane nested inside a 'form' element + return $P.length ? $P : $N.children("form:first").children(sel).eq(0); + } + } + + /** + * @param {Object=} evt + */ +, initPanes = function (evt) { + // stopPropagation if called by trigger("layoutinitpanes") - use evtPane utility + evtPane(evt); + + // NOTE: do north & south FIRST so we can measure their height - do center LAST + $.each(_c.allPanes, function (idx, pane) { + addPane( pane, true ); + }); + + // init the pane-handles NOW in case we have to hide or close the pane below + initHandles(); + + // now that all panes have been initialized and initially-sized, + // make sure there is really enough space available for each pane + $.each(_c.borderPanes, function (i, pane) { + if ($Ps[pane] && state[pane].isVisible) { // pane is OPEN + setSizeLimits(pane); + makePaneFit(pane); // pane may be Closed, Hidden or Resized by makePaneFit() + } + }); + // size center-pane AGAIN in case we 'closed' a border-pane in loop above + sizeMidPanes("center"); + + // Chrome/Webkit sometimes fires callbacks BEFORE it completes resizing! + // Before RC30.3, there was a 10ms delay here, but that caused layout + // to load asynchrously, which is BAD, so try skipping delay for now + + // process pane contents and callbacks, and init/resize child-layout if exists + $.each(_c.allPanes, function (idx, pane) { + afterInitPane(pane); + }); + } + + /** + * Add a pane to the layout - subroutine of initPanes() + * + * @see initPanes() + * @param {string} pane The pane to process + * @param {boolean=} [force=false] Size content after init + */ +, addPane = function (pane, force) { + if ( !force && !isInitialized() ) return; + var + o = options[pane] + , s = state[pane] + , c = _c[pane] + , dir = c.dir + , fx = s.fx + , spacing = o.spacing_open || 0 + , isCenter = (pane === "center") + , CSS = {} + , $P = $Ps[pane] + , size, minSize, maxSize, child + ; + // if pane-pointer already exists, remove the old one first + if ($P) + removePane( pane, false, true, false ); + else + $Cs[pane] = false; // init + + $P = $Ps[pane] = getPane(pane); + if (!$P.length) { + $Ps[pane] = false; // logic + return; + } + + // SAVE original Pane CSS + if (!$P.data("layoutCSS")) { + var props = "position,top,left,bottom,right,width,height,overflow,zIndex,display,backgroundColor,padding,margin,border"; + $P.data("layoutCSS", styles($P, props)); + } + + // create alias for pane data in Instance - initHandles will add more + Instance[pane] = { + name: pane + , pane: $Ps[pane] + , content: $Cs[pane] + , options: options[pane] + , state: state[pane] + , children: children[pane] + }; + + // add classes, attributes & events + $P .data({ + parentLayout: Instance // pointer to Layout Instance + , layoutPane: Instance[pane] // NEW pointer to pane-alias-object + , layoutEdge: pane + , layoutRole: "pane" + }) + .css(c.cssReq).css("zIndex", options.zIndexes.pane_normal) + .css(o.applyDemoStyles ? c.cssDemo : {}) // demo styles + .addClass( o.paneClass +" "+ o.paneClass+"-"+pane ) // default = "ui-layout-pane ui-layout-pane-west" - may be a dupe of 'paneSelector' + .bind("mouseenter."+ sID, addHover ) + .bind("mouseleave."+ sID, removeHover ) + ; + var paneMethods = { + hide: '' + , show: '' + , toggle: '' + , close: '' + , open: '' + , slideOpen: '' + , slideClose: '' + , slideToggle: '' + , size: 'sizePane' + , sizePane: 'sizePane' + , sizeContent: '' + , sizeHandles: '' + , enableClosable: '' + , disableClosable: '' + , enableSlideable: '' + , disableSlideable: '' + , enableResizable: '' + , disableResizable: '' + , swapPanes: 'swapPanes' + , swap: 'swapPanes' + , move: 'swapPanes' + , removePane: 'removePane' + , remove: 'removePane' + , createChildren: '' + , resizeChildren: '' + , resizeAll: 'resizeAll' + , resizeLayout: 'resizeAll' + } + , name; + // loop hash and bind all methods - include layoutID namespacing + for (name in paneMethods) { + $P.bind("layoutpane"+ name.toLowerCase() +"."+ sID, Instance[ paneMethods[name] || name ]); + } + + // see if this pane has a 'scrolling-content element' + initContent(pane, false); // false = do NOT sizeContent() - called later + + if (!isCenter) { + // call _parseSize AFTER applying pane classes & styles - but before making visible (if hidden) + // if o.size is auto or not valid, then MEASURE the pane and use that as its 'size' + size = s.size = _parseSize(pane, o.size); + minSize = _parseSize(pane,o.minSize) || 1; + maxSize = _parseSize(pane,o.maxSize) || 100000; + if (size > 0) size = max(min(size, maxSize), minSize); + s.autoResize = o.autoResize; // used with percentage sizes + + // state for border-panes + s.isClosed = false; // true = pane is closed + s.isSliding = false; // true = pane is currently open by 'sliding' over adjacent panes + s.isResizing= false; // true = pane is in process of being resized + s.isHidden = false; // true = pane is hidden - no spacing, resizer or toggler is visible! + + // array for 'pin buttons' whose classNames are auto-updated on pane-open/-close + if (!s.pins) s.pins = []; + } + // states common to ALL panes + s.tagName = $P[0].tagName; + s.edge = pane; // useful if pane is (or about to be) 'swapped' - easy find out where it is (or is going) + s.noRoom = false; // true = pane 'automatically' hidden due to insufficient room - will unhide automatically + s.isVisible = true; // false = pane is invisible - closed OR hidden - simplify logic + + // init pane positioning + setPanePosition( pane ); + + // if pane is not visible, + if (dir === "horz") // north or south pane + CSS.height = cssH($P, size); + else if (dir === "vert") // east or west pane + CSS.width = cssW($P, size); + //else if (isCenter) {} + + $P.css(CSS); // apply size -- top, bottom & height will be set by sizeMidPanes + if (dir != "horz") sizeMidPanes(pane, true); // true = skipCallback + + // if manually adding a pane AFTER layout initialization, then... + if (state.initialized) { + initHandles( pane ); + initHotkeys( pane ); + } + + // close or hide the pane if specified in settings + if (o.initClosed && o.closable && !o.initHidden) + close(pane, true, true); // true, true = force, noAnimation + else if (o.initHidden || o.initClosed) + hide(pane); // will be completely invisible - no resizer or spacing + else if (!s.noRoom) + // make the pane visible - in case was initially hidden + $P.css("display","block"); + // ELSE setAsOpen() - called later by initHandles() + + // RESET visibility now - pane will appear IF display:block + $P.css("visibility","visible"); + + // check option for auto-handling of pop-ups & drop-downs + if (o.showOverflowOnHover) + $P.hover( allowOverflow, resetOverflow ); + + // if manually adding a pane AFTER layout initialization, then... + if (state.initialized) { + afterInitPane( pane ); + } + } + +, afterInitPane = function (pane) { + var $P = $Ps[pane] + , s = state[pane] + , o = options[pane] + ; + if (!$P) return; + + // see if there is a directly-nested layout inside this pane + if ($P.data("layout")) + refreshChildren( pane, $P.data("layout") ); + + // process pane contents and callbacks, and init/resize child-layout if exists + if (s.isVisible) { // pane is OPEN + if (state.initialized) // this pane was added AFTER layout was created + resizeAll(); // will also sizeContent + else + sizeContent(pane); + + if (o.triggerEventsOnLoad) + _runCallbacks("onresize_end", pane); + else // automatic if onresize called, otherwise call it specifically + // resize child - IF inner-layout already exists (created before this layout) + resizeChildren(pane, true); // a previously existing childLayout + } + + // init childLayouts - even if pane is not visible + if (o.initChildren && o.children) + createChildren(pane); + } + + /** + * @param {string=} panes The pane(s) to process + */ +, setPanePosition = function (panes) { + panes = panes ? panes.split(",") : _c.borderPanes; + + // create toggler DIVs for each pane, and set object pointers for them, eg: $R.north = north toggler DIV + $.each(panes, function (i, pane) { + var $P = $Ps[pane] + , $R = $Rs[pane] + , o = options[pane] + , s = state[pane] + , side = _c[pane].side + , CSS = {} + ; + if (!$P) return; // pane does not exist - skip + + // set css-position to account for container borders & padding + switch (pane) { + case "north": CSS.top = sC.inset.top; + CSS.left = sC.inset.left; + CSS.right = sC.inset.right; + break; + case "south": CSS.bottom = sC.inset.bottom; + CSS.left = sC.inset.left; + CSS.right = sC.inset.right; + break; + case "west": CSS.left = sC.inset.left; // top, bottom & height set by sizeMidPanes() + break; + case "east": CSS.right = sC.inset.right; // ditto + break; + case "center": // top, left, width & height set by sizeMidPanes() + } + // apply position + $P.css(CSS); + + // update resizer position + if ($R && s.isClosed) + $R.css(side, sC.inset[side]); + else if ($R && !s.isHidden) + $R.css(side, sC.inset[side] + getPaneSize(pane)); + }); + } + + /** + * Initialize module objects, styling, size and position for all resize bars and toggler buttons + * + * @see _create() + * @param {string=} [panes=""] The edge(s) to process + */ +, initHandles = function (panes) { + panes = panes ? panes.split(",") : _c.borderPanes; + + // create toggler DIVs for each pane, and set object pointers for them, eg: $R.north = north toggler DIV + $.each(panes, function (i, pane) { + var $P = $Ps[pane]; + $Rs[pane] = false; // INIT + $Ts[pane] = false; + if (!$P) return; // pane does not exist - skip + + var o = options[pane] + , s = state[pane] + , c = _c[pane] + , paneId = o.paneSelector.substr(0,1) === "#" ? o.paneSelector.substr(1) : "" + , rClass = o.resizerClass + , tClass = o.togglerClass + , spacing = (s.isVisible ? o.spacing_open : o.spacing_closed) + , _pane = "-"+ pane // used for classNames + , _state = (s.isVisible ? "-open" : "-closed") // used for classNames + , I = Instance[pane] + // INIT RESIZER BAR + , $R = I.resizer = $Rs[pane] = $("
          ") + // INIT TOGGLER BUTTON + , $T = I.toggler = (o.closable ? $Ts[pane] = $("
          ") : false) + ; + + //if (s.isVisible && o.resizable) ... handled by initResizable + if (!s.isVisible && o.slidable) + $R.attr("title", o.tips.Slide).css("cursor", o.sliderCursor); + + $R // if paneSelector is an ID, then create a matching ID for the resizer, eg: "#paneLeft" => "paneLeft-resizer" + .attr("id", paneId ? paneId +"-resizer" : "" ) + .data({ + parentLayout: Instance + , layoutPane: Instance[pane] // NEW pointer to pane-alias-object + , layoutEdge: pane + , layoutRole: "resizer" + }) + .css(_c.resizers.cssReq).css("zIndex", options.zIndexes.resizer_normal) + .css(o.applyDemoStyles ? _c.resizers.cssDemo : {}) // add demo styles + .addClass(rClass +" "+ rClass+_pane) + .hover(addHover, removeHover) // ALWAYS add hover-classes, even if resizing is not enabled - handle with CSS instead + .hover(onResizerEnter, onResizerLeave) // ALWAYS NEED resizer.mouseleave to balance toggler.mouseenter + .mousedown($.layout.disableTextSelection) // prevent text-selection OUTSIDE resizer + .mouseup($.layout.enableTextSelection) // not really necessary, but just in case + .appendTo($N) // append DIV to container + ; + if ($.fn.disableSelection) + $R.disableSelection(); // prevent text-selection INSIDE resizer + if (o.resizerDblClickToggle) + $R.bind("dblclick."+ sID, toggle ); + + if ($T) { + $T // if paneSelector is an ID, then create a matching ID for the resizer, eg: "#paneLeft" => "#paneLeft-toggler" + .attr("id", paneId ? paneId +"-toggler" : "" ) + .data({ + parentLayout: Instance + , layoutPane: Instance[pane] // NEW pointer to pane-alias-object + , layoutEdge: pane + , layoutRole: "toggler" + }) + .css(_c.togglers.cssReq) // add base/required styles + .css(o.applyDemoStyles ? _c.togglers.cssDemo : {}) // add demo styles + .addClass(tClass +" "+ tClass+_pane) + .hover(addHover, removeHover) // ALWAYS add hover-classes, even if toggling is not enabled - handle with CSS instead + .bind("mouseenter", onResizerEnter) // NEED toggler.mouseenter because mouseenter MAY NOT fire on resizer + .appendTo($R) // append SPAN to resizer DIV + ; + // ADD INNER-SPANS TO TOGGLER + if (o.togglerContent_open) // ui-layout-open + $(""+ o.togglerContent_open +"") + .data({ + layoutEdge: pane + , layoutRole: "togglerContent" + }) + .data("layoutRole", "togglerContent") + .data("layoutEdge", pane) + .addClass("content content-open") + .css("display","none") + .appendTo( $T ) + //.hover( addHover, removeHover ) // use ui-layout-toggler-west-hover .content-open instead! + ; + if (o.togglerContent_closed) // ui-layout-closed + $(""+ o.togglerContent_closed +"") + .data({ + layoutEdge: pane + , layoutRole: "togglerContent" + }) + .addClass("content content-closed") + .css("display","none") + .appendTo( $T ) + //.hover( addHover, removeHover ) // use ui-layout-toggler-west-hover .content-closed instead! + ; + // ADD TOGGLER.click/.hover + enableClosable(pane); + } + + // add Draggable events + initResizable(pane); + + // ADD CLASSNAMES & SLIDE-BINDINGS - eg: class="resizer resizer-west resizer-open" + if (s.isVisible) + setAsOpen(pane); // onOpen will be called, but NOT onResize + else { + setAsClosed(pane); // onClose will be called + bindStartSlidingEvents(pane, true); // will enable events IF option is set + } + + }); + + // SET ALL HANDLE DIMENSIONS + sizeHandles(); + } + + + /** + * Initialize scrolling ui-layout-content div - if exists + * + * @see initPane() - or externally after an Ajax injection + * @param {string} pane The pane to process + * @param {boolean=} [resize=true] Size content after init + */ +, initContent = function (pane, resize) { + if (!isInitialized()) return; + var + o = options[pane] + , sel = o.contentSelector + , I = Instance[pane] + , $P = $Ps[pane] + , $C + ; + if (sel) $C = I.content = $Cs[pane] = (o.findNestedContent) + ? $P.find(sel).eq(0) // match 1-element only + : $P.children(sel).eq(0) + ; + if ($C && $C.length) { + $C.data("layoutRole", "content"); + // SAVE original Content CSS + if (!$C.data("layoutCSS")) + $C.data("layoutCSS", styles($C, "height")); + $C.css( _c.content.cssReq ); + if (o.applyDemoStyles) { + $C.css( _c.content.cssDemo ); // add padding & overflow: auto to content-div + $P.css( _c.content.cssDemoPane ); // REMOVE padding/scrolling from pane + } + // ensure no vertical scrollbar on pane - will mess up measurements + if ($P.css("overflowX").match(/(scroll|auto)/)) { + $P.css("overflow", "hidden"); + } + state[pane].content = {}; // init content state + if (resize !== false) sizeContent(pane); + // sizeContent() is called AFTER init of all elements + } + else + I.content = $Cs[pane] = false; + } + + + /** + * Add resize-bars to all panes that specify it in options + * -dependancy: $.fn.resizable - will skip if not found + * + * @see _create() + * @param {string=} [panes=""] The edge(s) to process + */ +, initResizable = function (panes) { + var draggingAvailable = $.layout.plugins.draggable + , side // set in start() + ; + panes = panes ? panes.split(",") : _c.borderPanes; + + $.each(panes, function (idx, pane) { + var o = options[pane]; + if (!draggingAvailable || !$Ps[pane] || !o.resizable) { + o.resizable = false; + return true; // skip to next + } + + var s = state[pane] + , z = options.zIndexes + , c = _c[pane] + , side = c.dir=="horz" ? "top" : "left" + , $P = $Ps[pane] + , $R = $Rs[pane] + , base = o.resizerClass + , lastPos = 0 // used when live-resizing + , r, live // set in start because may change + // 'drag' classes are applied to the ORIGINAL resizer-bar while dragging is in process + , resizerClass = base+"-drag" // resizer-drag + , resizerPaneClass = base+"-"+pane+"-drag" // resizer-north-drag + // 'helper' class is applied to the CLONED resizer-bar while it is being dragged + , helperClass = base+"-dragging" // resizer-dragging + , helperPaneClass = base+"-"+pane+"-dragging" // resizer-north-dragging + , helperLimitClass = base+"-dragging-limit" // resizer-drag + , helperPaneLimitClass = base+"-"+pane+"-dragging-limit" // resizer-north-drag + , helperClassesSet = false // logic var + ; + + if (!s.isClosed) + $R.attr("title", o.tips.Resize) + .css("cursor", o.resizerCursor); // n-resize, s-resize, etc + + $R.draggable({ + containment: $N[0] // limit resizing to layout container + , axis: (c.dir=="horz" ? "y" : "x") // limit resizing to horz or vert axis + , delay: 0 + , distance: 1 + , grid: o.resizingGrid + // basic format for helper - style it using class: .ui-draggable-dragging + , helper: "clone" + , opacity: o.resizerDragOpacity + , addClasses: false // avoid ui-state-disabled class when disabled + //, iframeFix: o.draggableIframeFix // TODO: consider using when bug is fixed + , zIndex: z.resizer_drag + + , start: function (e, ui) { + // REFRESH options & state pointers in case we used swapPanes + o = options[pane]; + s = state[pane]; + // re-read options + live = o.livePaneResizing; + + // ondrag_start callback - will CANCEL hide if returns false + // TODO: dragging CANNOT be cancelled like this, so see if there is a way? + if (false === _runCallbacks("ondrag_start", pane)) return false; + + s.isResizing = true; // prevent pane from closing while resizing + state.paneResizing = pane; // easy to see if ANY pane is resizing + timer.clear(pane+"_closeSlider"); // just in case already triggered + + // SET RESIZER LIMITS - used in drag() + setSizeLimits(pane); // update pane/resizer state + r = s.resizerPosition; + lastPos = ui.position[ side ] + + $R.addClass( resizerClass +" "+ resizerPaneClass ); // add drag classes + helperClassesSet = false; // reset logic var - see drag() + + // MASK PANES CONTAINING IFRAMES, APPLETS OR OTHER TROUBLESOME ELEMENTS + showMasks( pane, { resizing: true }); + } + + , drag: function (e, ui) { + if (!helperClassesSet) { // can only add classes after clone has been added to the DOM + //$(".ui-draggable-dragging") + ui.helper + .addClass( helperClass +" "+ helperPaneClass ) // add helper classes + .css({ right: "auto", bottom: "auto" }) // fix dir="rtl" issue + .children().css("visibility","hidden") // hide toggler inside dragged resizer-bar + ; + helperClassesSet = true; + // draggable bug!? RE-SET zIndex to prevent E/W resize-bar showing through N/S pane! + if (s.isSliding) $Ps[pane].css("zIndex", z.pane_sliding); + } + // CONTAIN RESIZER-BAR TO RESIZING LIMITS + var limit = 0; + if (ui.position[side] < r.min) { + ui.position[side] = r.min; + limit = -1; + } + else if (ui.position[side] > r.max) { + ui.position[side] = r.max; + limit = 1; + } + // ADD/REMOVE dragging-limit CLASS + if (limit) { + ui.helper.addClass( helperLimitClass +" "+ helperPaneLimitClass ); // at dragging-limit + window.defaultStatus = (limit>0 && pane.match(/(north|west)/)) || (limit<0 && pane.match(/(south|east)/)) ? o.tips.maxSizeWarning : o.tips.minSizeWarning; + } + else { + ui.helper.removeClass( helperLimitClass +" "+ helperPaneLimitClass ); // not at dragging-limit + window.defaultStatus = ""; + } + // DYNAMICALLY RESIZE PANES IF OPTION ENABLED + // won't trigger unless resizer has actually moved! + if (live && Math.abs(ui.position[side] - lastPos) >= o.liveResizingTolerance) { + lastPos = ui.position[side]; + resizePanes(e, ui, pane) + } + } + + , stop: function (e, ui) { + $('body').enableSelection(); // RE-ENABLE TEXT SELECTION + window.defaultStatus = ""; // clear 'resizing limit' message from statusbar + $R.removeClass( resizerClass +" "+ resizerPaneClass ); // remove drag classes from Resizer + s.isResizing = false; + state.paneResizing = false; // easy to see if ANY pane is resizing + resizePanes(e, ui, pane, true); // true = resizingDone + } + + }); + }); + + /** + * resizePanes + * + * Sub-routine called from stop() - and drag() if livePaneResizing + * + * @param {!Object} evt + * @param {!Object} ui + * @param {string} pane + * @param {boolean=} [resizingDone=false] + */ + var resizePanes = function (evt, ui, pane, resizingDone) { + var dragPos = ui.position + , c = _c[pane] + , o = options[pane] + , s = state[pane] + , resizerPos + ; + switch (pane) { + case "north": resizerPos = dragPos.top; break; + case "west": resizerPos = dragPos.left; break; + case "south": resizerPos = sC.layoutHeight - dragPos.top - o.spacing_open; break; + case "east": resizerPos = sC.layoutWidth - dragPos.left - o.spacing_open; break; + }; + // remove container margin from resizer position to get the pane size + var newSize = resizerPos - sC.inset[c.side]; + + // Disable OR Resize Mask(s) created in drag.start + if (!resizingDone) { + // ensure we meet liveResizingTolerance criteria + if (Math.abs(newSize - s.size) < o.liveResizingTolerance) + return; // SKIP resize this time + // resize the pane + manualSizePane(pane, newSize, false, true); // true = noAnimation + sizeMasks(); // resize all visible masks + } + else { // resizingDone + // ondrag_end callback + if (false !== _runCallbacks("ondrag_end", pane)) + manualSizePane(pane, newSize, false, true); // true = noAnimation + hideMasks(true); // true = force hiding all masks even if one is 'sliding' + if (s.isSliding) // RE-SHOW 'object-masks' so objects won't show through sliding pane + showMasks( pane, { resizing: true }); + } + }; + } + + /** + * sizeMask + * + * Needed to overlay a DIV over an IFRAME-pane because mask CANNOT be *inside* the pane + * Called when mask created, and during livePaneResizing + */ +, sizeMask = function () { + var $M = $(this) + , pane = $M.data("layoutMask") // eg: "west" + , s = state[pane] + ; + // only masks over an IFRAME-pane need manual resizing + if (s.tagName == "IFRAME" && s.isVisible) // no need to mask closed/hidden panes + $M.css({ + top: s.offsetTop + , left: s.offsetLeft + , width: s.outerWidth + , height: s.outerHeight + }); + /* ALT Method... + var $P = $Ps[pane]; + $M.css( $P.position() ).css({ width: $P[0].offsetWidth, height: $P[0].offsetHeight }); + */ + } +, sizeMasks = function () { + $Ms.each( sizeMask ); // resize all 'visible' masks + } + + /** + * @param {string} pane The pane being resized, animated or isSliding + * @param {Object=} [args] (optional) Options: which masks to apply, and to which panes + */ +, showMasks = function (pane, args) { + var c = _c[pane] + , panes = ["center"] + , z = options.zIndexes + , a = $.extend({ + objectsOnly: false + , animation: false + , resizing: true + , sliding: state[pane].isSliding + }, args ) + , o, s + ; + if (a.resizing) + panes.push( pane ); + if (a.sliding) + panes.push( _c.oppositeEdge[pane] ); // ADD the oppositeEdge-pane + + if (c.dir === "horz") { + panes.push("west"); + panes.push("east"); + } + + $.each(panes, function(i,p){ + s = state[p]; + o = options[p]; + if (s.isVisible && ( o.maskObjects || (!a.objectsOnly && o.maskContents) )) { + getMasks(p).each(function(){ + sizeMask.call(this); + this.style.zIndex = s.isSliding ? z.pane_sliding+1 : z.pane_normal+1 + this.style.display = "block"; + }); + } + }); + } + + /** + * @param {boolean=} force Hide masks even if a pane is sliding + */ +, hideMasks = function (force) { + // ensure no pane is resizing - could be a timing issue + if (force || !state.paneResizing) { + $Ms.hide(); // hide ALL masks + } + // if ANY pane is sliding, then DO NOT remove masks from panes with maskObjects enabled + else if (!force && !$.isEmptyObject( state.panesSliding )) { + var i = $Ms.length - 1 + , p, $M; + for (; i >= 0; i--) { + $M = $Ms.eq(i); + p = $M.data("layoutMask"); + if (!options[p].maskObjects) { + $M.hide(); + } + } + } + } + + /** + * @param {string} pane + */ +, getMasks = function (pane) { + var $Masks = $([]) + , $M, i = 0, c = $Ms.length + ; + for (; i CSS + if (sC.tagName === "BODY" && ($N = $("html")).data(css)) // RESET CSS + $N.css( $N.data(css) ).removeData(css); + + // trigger plugins for this layout, if there are any + runPluginCallbacks( Instance, $.layout.onDestroy ); + + // trigger state-management and onunload callback + unload(); + + // clear the Instance of everything except for container & options (so could recreate) + // RE-CREATE: myLayout = myLayout.container.layout( myLayout.options ); + for (var n in Instance) + if (!n.match(/^(container|options)$/)) delete Instance[ n ]; + // add a 'destroyed' flag to make it easy to check + Instance.destroyed = true; + + // if this is a child layout, CLEAR the child-pointer in the parent + /* for now the pointer REMAINS, but with only container, options and destroyed keys + if (parentPane) { + var layout = parentPane.pane.data("parentLayout") + , key = layout.options.instanceKey || 'error'; + // THIS SYNTAX MAY BE WRONG! + parentPane.children[key] = layout.children[ parentPane.name ].children[key] = null; + } + */ + + return Instance; // for coding convenience + } + + /** + * Remove a pane from the layout - subroutine of destroy() + * + * @see destroy() + * @param {(string|Object)} evt_or_pane The pane to process + * @param {boolean=} [remove=false] Remove the DOM element? + * @param {boolean=} [skipResize=false] Skip calling resizeAll()? + * @param {boolean=} [destroyChild=true] Destroy Child-layouts? If not passed, obeys options setting + */ +, removePane = function (evt_or_pane, remove, skipResize, destroyChild) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , $P = $Ps[pane] + , $C = $Cs[pane] + , $R = $Rs[pane] + , $T = $Ts[pane] + ; + // NOTE: elements can still exist even after remove() + // so check for missing data(), which is cleared by removed() + if ($P && $.isEmptyObject( $P.data() )) $P = false; + if ($C && $.isEmptyObject( $C.data() )) $C = false; + if ($R && $.isEmptyObject( $R.data() )) $R = false; + if ($T && $.isEmptyObject( $T.data() )) $T = false; + + if ($P) $P.stop(true, true); + + var o = options[pane] + , s = state[pane] + , d = "layout" + , css = "layoutCSS" + , pC = children[pane] + , hasChildren = $.isPlainObject( pC ) && !$.isEmptyObject( pC ) + , destroy = destroyChild !== undefined ? destroyChild : o.destroyChildren + ; + // FIRST destroy the child-layout(s) + if (hasChildren && destroy) { + $.each( pC, function (key, child) { + if (!child.destroyed) + child.destroy(true);// tell child-layout to destroy ALL its child-layouts too + if (child.destroyed) // destroy was successful + delete pC[key]; + }); + // if no more children, remove the children hash + if ($.isEmptyObject( pC )) { + pC = children[pane] = null; // clear children hash + hasChildren = false; + } + } + + // Note: can't 'remove' a pane element with non-destroyed children + if ($P && remove && !hasChildren) + $P.remove(); // remove the pane-element and everything inside it + else if ($P && $P[0]) { + // create list of ALL pane-classes that need to be removed + var root = o.paneClass // default="ui-layout-pane" + , pRoot = root +"-"+ pane // eg: "ui-layout-pane-west" + , _open = "-open" + , _sliding= "-sliding" + , _closed = "-closed" + , classes = [ root, root+_open, root+_closed, root+_sliding, // generic classes + pRoot, pRoot+_open, pRoot+_closed, pRoot+_sliding ] // pane-specific classes + ; + $.merge(classes, getHoverClasses($P, true)); // ADD hover-classes + // remove all Layout classes from pane-element + $P .removeClass( classes.join(" ") ) // remove ALL pane-classes + .removeData("parentLayout") + .removeData("layoutPane") + .removeData("layoutRole") + .removeData("layoutEdge") + .removeData("autoHidden") // in case set + .unbind("."+ sID) // remove ALL Layout events + // TODO: remove these extra unbind commands when jQuery is fixed + //.unbind("mouseenter"+ sID) + //.unbind("mouseleave"+ sID) + ; + // do NOT reset CSS if this pane/content is STILL the container of a nested layout! + // the nested layout will reset its 'container' CSS when/if it is destroyed + if (hasChildren && $C) { + // a content-div may not have a specific width, so give it one to contain the Layout + $C.width( $C.width() ); + $.each( pC, function (key, child) { + child.resizeAll(); // resize the Layout + }); + } + else if ($C) + $C.css( $C.data(css) ).removeData(css).removeData("layoutRole"); + // remove pane AFTER content in case there was a nested layout + if (!$P.data(d)) + $P.css( $P.data(css) ).removeData(css); + } + + // REMOVE pane resizer and toggler elements + if ($T) $T.remove(); + if ($R) $R.remove(); + + // CLEAR all pointers and state data + Instance[pane] = $Ps[pane] = $Cs[pane] = $Rs[pane] = $Ts[pane] = false; + s = { removed: true }; + + if (!skipResize) + resizeAll(); + } + + +/* + * ########################### + * ACTION METHODS + * ########################### + */ + + /** + * @param {string} pane + */ +, _hidePane = function (pane) { + var $P = $Ps[pane] + , o = options[pane] + , s = $P[0].style + ; + if (o.useOffscreenClose) { + if (!$P.data(_c.offscreenReset)) + $P.data(_c.offscreenReset, { left: s.left, right: s.right }); + $P.css( _c.offscreenCSS ); + } + else + $P.hide().removeData(_c.offscreenReset); + } + + /** + * @param {string} pane + */ +, _showPane = function (pane) { + var $P = $Ps[pane] + , o = options[pane] + , off = _c.offscreenCSS + , old = $P.data(_c.offscreenReset) + , s = $P[0].style + ; + $P .show() // ALWAYS show, just in case + .removeData(_c.offscreenReset); + if (o.useOffscreenClose && old) { + if (s.left == off.left) + s.left = old.left; + if (s.right == off.right) + s.right = old.right; + } + } + + + /** + * Completely 'hides' a pane, including its spacing - as if it does not exist + * The pane is not actually 'removed' from the source, so can use 'show' to un-hide it + * + * @param {(string|Object)} evt_or_pane The pane being hidden, ie: north, south, east, or west + * @param {boolean=} [noAnimation=false] + */ +, hide = function (evt_or_pane, noAnimation) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , o = options[pane] + , s = state[pane] + , $P = $Ps[pane] + , $R = $Rs[pane] + ; + if (pane === "center" || !$P || s.isHidden) return; // pane does not exist OR is already hidden + + // onhide_start callback - will CANCEL hide if returns false + if (state.initialized && false === _runCallbacks("onhide_start", pane)) return; + + s.isSliding = false; // just in case + delete state.panesSliding[pane]; + + // now hide the elements + if ($R) $R.hide(); // hide resizer-bar + if (!state.initialized || s.isClosed) { + s.isClosed = true; // to trigger open-animation on show() + s.isHidden = true; + s.isVisible = false; + if (!state.initialized) + _hidePane(pane); // no animation when loading page + sizeMidPanes(_c[pane].dir === "horz" ? "" : "center"); + if (state.initialized || o.triggerEventsOnLoad) + _runCallbacks("onhide_end", pane); + } + else { + s.isHiding = true; // used by onclose + close(pane, false, noAnimation); // adjust all panes to fit + } + } + + /** + * Show a hidden pane - show as 'closed' by default unless openPane = true + * + * @param {(string|Object)} evt_or_pane The pane being opened, ie: north, south, east, or west + * @param {boolean=} [openPane=false] + * @param {boolean=} [noAnimation=false] + * @param {boolean=} [noAlert=false] + */ +, show = function (evt_or_pane, openPane, noAnimation, noAlert) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , o = options[pane] + , s = state[pane] + , $P = $Ps[pane] + , $R = $Rs[pane] + ; + if (pane === "center" || !$P || !s.isHidden) return; // pane does not exist OR is not hidden + + // onshow_start callback - will CANCEL show if returns false + if (false === _runCallbacks("onshow_start", pane)) return; + + s.isShowing = true; // used by onopen/onclose + //s.isHidden = false; - will be set by open/close - if not cancelled + s.isSliding = false; // just in case + delete state.panesSliding[pane]; + + // now show the elements + //if ($R) $R.show(); - will be shown by open/close + if (openPane === false) + close(pane, true); // true = force + else + open(pane, false, noAnimation, noAlert); // adjust all panes to fit + } + + + /** + * Toggles a pane open/closed by calling either open or close + * + * @param {(string|Object)} evt_or_pane The pane being toggled, ie: north, south, east, or west + * @param {boolean=} [slide=false] + */ +, toggle = function (evt_or_pane, slide) { + if (!isInitialized()) return; + var evt = evtObj(evt_or_pane) + , pane = evtPane.call(this, evt_or_pane) + , s = state[pane] + ; + if (evt) // called from to $R.dblclick OR triggerPaneEvent + evt.stopImmediatePropagation(); + if (s.isHidden) + show(pane); // will call 'open' after unhiding it + else if (s.isClosed) + open(pane, !!slide); + else + close(pane); + } + + + /** + * Utility method used during init or other auto-processes + * + * @param {string} pane The pane being closed + * @param {boolean=} [setHandles=false] + */ +, _closePane = function (pane, setHandles) { + var + $P = $Ps[pane] + , s = state[pane] + ; + _hidePane(pane); + s.isClosed = true; + s.isVisible = false; + if (setHandles) setAsClosed(pane); + } + + /** + * Close the specified pane (animation optional), and resize all other panes as needed + * + * @param {(string|Object)} evt_or_pane The pane being closed, ie: north, south, east, or west + * @param {boolean=} [force=false] + * @param {boolean=} [noAnimation=false] + * @param {boolean=} [skipCallback=false] + */ +, close = function (evt_or_pane, force, noAnimation, skipCallback) { + var pane = evtPane.call(this, evt_or_pane); + if (pane === "center") return; // validate + // if pane has been initialized, but NOT the complete layout, close pane instantly + if (!state.initialized && $Ps[pane]) { + _closePane(pane, true); // INIT pane as closed + return; + } + if (!isInitialized()) return; + + var + $P = $Ps[pane] + , $R = $Rs[pane] + , $T = $Ts[pane] + , o = options[pane] + , s = state[pane] + , c = _c[pane] + , doFX, isShowing, isHiding, wasSliding; + + // QUEUE in case another action/animation is in progress + $N.queue(function( queueNext ){ + + if ( !$P + || (!o.closable && !s.isShowing && !s.isHiding) // invalid request // (!o.resizable && !o.closable) ??? + || (!force && s.isClosed && !s.isShowing) // already closed + ) return queueNext(); + + // onclose_start callback - will CANCEL hide if returns false + // SKIP if just 'showing' a hidden pane as 'closed' + var abort = !s.isShowing && false === _runCallbacks("onclose_start", pane); + + // transfer logic vars to temp vars + isShowing = s.isShowing; + isHiding = s.isHiding; + wasSliding = s.isSliding; + // now clear the logic vars (REQUIRED before aborting) + delete s.isShowing; + delete s.isHiding; + + if (abort) return queueNext(); + + doFX = !noAnimation && !s.isClosed && (o.fxName_close != "none"); + s.isMoving = true; + s.isClosed = true; + s.isVisible = false; + // update isHidden BEFORE sizing panes + if (isHiding) s.isHidden = true; + else if (isShowing) s.isHidden = false; + + if (s.isSliding) // pane is being closed, so UNBIND trigger events + bindStopSlidingEvents(pane, false); // will set isSliding=false + else // resize panes adjacent to this one + sizeMidPanes(_c[pane].dir === "horz" ? "" : "center", false); // false = NOT skipCallback + + // if this pane has a resizer bar, move it NOW - before animation + setAsClosed(pane); + + // CLOSE THE PANE + if (doFX) { // animate the close + lockPaneForFX(pane, true); // need to set left/top so animation will work + $P.hide( o.fxName_close, o.fxSettings_close, o.fxSpeed_close, function () { + lockPaneForFX(pane, false); // undo + if (s.isClosed) close_2(); + queueNext(); + }); + } + else { // hide the pane without animation + _hidePane(pane); + close_2(); + queueNext(); + }; + }); + + // SUBROUTINE + function close_2 () { + s.isMoving = false; + bindStartSlidingEvents(pane, true); // will enable if o.slidable = true + + // if opposite-pane was autoClosed, see if it can be autoOpened now + var altPane = _c.oppositeEdge[pane]; + if (state[ altPane ].noRoom) { + setSizeLimits( altPane ); + makePaneFit( altPane ); + } + + if (!skipCallback && (state.initialized || o.triggerEventsOnLoad)) { + // onclose callback - UNLESS just 'showing' a hidden pane as 'closed' + if (!isShowing) _runCallbacks("onclose_end", pane); + // onhide OR onshow callback + if (isShowing) _runCallbacks("onshow_end", pane); + if (isHiding) _runCallbacks("onhide_end", pane); + } + } + } + + /** + * @param {string} pane The pane just closed, ie: north, south, east, or west + */ +, setAsClosed = function (pane) { + if (!$Rs[pane]) return; // handles not initialized yet! + var + $P = $Ps[pane] + , $R = $Rs[pane] + , $T = $Ts[pane] + , o = options[pane] + , s = state[pane] + , side = _c[pane].side + , rClass = o.resizerClass + , tClass = o.togglerClass + , _pane = "-"+ pane // used for classNames + , _open = "-open" + , _sliding= "-sliding" + , _closed = "-closed" + ; + $R + .css(side, sC.inset[side]) // move the resizer + .removeClass( rClass+_open +" "+ rClass+_pane+_open ) + .removeClass( rClass+_sliding +" "+ rClass+_pane+_sliding ) + .addClass( rClass+_closed +" "+ rClass+_pane+_closed ) + ; + // handle already-hidden panes in case called by swap() or a similar method + if (s.isHidden) $R.hide(); // hide resizer-bar + + // DISABLE 'resizing' when closed - do this BEFORE bindStartSlidingEvents? + if (o.resizable && $.layout.plugins.draggable) + $R + .draggable("disable") + .removeClass("ui-state-disabled") // do NOT apply disabled styling - not suitable here + .css("cursor", "default") + .attr("title","") + ; + + // if pane has a toggler button, adjust that too + if ($T) { + $T + .removeClass( tClass+_open +" "+ tClass+_pane+_open ) + .addClass( tClass+_closed +" "+ tClass+_pane+_closed ) + .attr("title", o.tips.Open) // may be blank + ; + // toggler-content - if exists + $T.children(".content-open").hide(); + $T.children(".content-closed").css("display","block"); + } + + // sync any 'pin buttons' + syncPinBtns(pane, false); + + if (state.initialized) { + // resize 'length' and position togglers for adjacent panes + sizeHandles(); + } + } + + /** + * Open the specified pane (animation optional), and resize all other panes as needed + * + * @param {(string|Object)} evt_or_pane The pane being opened, ie: north, south, east, or west + * @param {boolean=} [slide=false] + * @param {boolean=} [noAnimation=false] + * @param {boolean=} [noAlert=false] + */ +, open = function (evt_or_pane, slide, noAnimation, noAlert) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , $P = $Ps[pane] + , $R = $Rs[pane] + , $T = $Ts[pane] + , o = options[pane] + , s = state[pane] + , c = _c[pane] + , doFX, isShowing + ; + if (pane === "center") return; // validate + // QUEUE in case another action/animation is in progress + $N.queue(function( queueNext ){ + + if ( !$P + || (!o.resizable && !o.closable && !s.isShowing) // invalid request + || (s.isVisible && !s.isSliding) // already open + ) return queueNext(); + + // pane can ALSO be unhidden by just calling show(), so handle this scenario + if (s.isHidden && !s.isShowing) { + queueNext(); // call before show() because it needs the queue free + show(pane, true); + return; + } + + if (s.autoResize && s.size != o.size) // resize pane to original size set in options + sizePane(pane, o.size, true, true, true); // true=skipCallback/noAnimation/forceResize + else + // make sure there is enough space available to open the pane + setSizeLimits(pane, slide); + + // onopen_start callback - will CANCEL open if returns false + var cbReturn = _runCallbacks("onopen_start", pane); + + if (cbReturn === "abort") + return queueNext(); + + // update pane-state again in case options were changed in onopen_start + if (cbReturn !== "NC") // NC = "No Callback" + setSizeLimits(pane, slide); + + if (s.minSize > s.maxSize) { // INSUFFICIENT ROOM FOR PANE TO OPEN! + syncPinBtns(pane, false); // make sure pin-buttons are reset + if (!noAlert && o.tips.noRoomToOpen) + alert(o.tips.noRoomToOpen); + return queueNext(); // ABORT + } + + if (slide) // START Sliding - will set isSliding=true + bindStopSlidingEvents(pane, true); // BIND trigger events to close sliding-pane + else if (s.isSliding) // PIN PANE (stop sliding) - open pane 'normally' instead + bindStopSlidingEvents(pane, false); // UNBIND trigger events - will set isSliding=false + else if (o.slidable) + bindStartSlidingEvents(pane, false); // UNBIND trigger events + + s.noRoom = false; // will be reset by makePaneFit if 'noRoom' + makePaneFit(pane); + + // transfer logic var to temp var + isShowing = s.isShowing; + // now clear the logic var + delete s.isShowing; + + doFX = !noAnimation && s.isClosed && (o.fxName_open != "none"); + s.isMoving = true; + s.isVisible = true; + s.isClosed = false; + // update isHidden BEFORE sizing panes - WHY??? Old? + if (isShowing) s.isHidden = false; + + if (doFX) { // ANIMATE + // mask adjacent panes with objects + lockPaneForFX(pane, true); // need to set left/top so animation will work + $P.show( o.fxName_open, o.fxSettings_open, o.fxSpeed_open, function() { + lockPaneForFX(pane, false); // undo + if (s.isVisible) open_2(); // continue + queueNext(); + }); + } + else { // no animation + _showPane(pane);// just show pane and... + open_2(); // continue + queueNext(); + }; + }); + + // SUBROUTINE + function open_2 () { + s.isMoving = false; + + // cure iframe display issues + _fixIframe(pane); + + // NOTE: if isSliding, then other panes are NOT 'resized' + if (!s.isSliding) { // resize all panes adjacent to this one + sizeMidPanes(_c[pane].dir=="vert" ? "center" : "", false); // false = NOT skipCallback + } + + // set classes, position handles and execute callbacks... + setAsOpen(pane); + }; + + } + + /** + * @param {string} pane The pane just opened, ie: north, south, east, or west + * @param {boolean=} [skipCallback=false] + */ +, setAsOpen = function (pane, skipCallback) { + var + $P = $Ps[pane] + , $R = $Rs[pane] + , $T = $Ts[pane] + , o = options[pane] + , s = state[pane] + , side = _c[pane].side + , rClass = o.resizerClass + , tClass = o.togglerClass + , _pane = "-"+ pane // used for classNames + , _open = "-open" + , _closed = "-closed" + , _sliding= "-sliding" + ; + $R + .css(side, sC.inset[side] + getPaneSize(pane)) // move the resizer + .removeClass( rClass+_closed +" "+ rClass+_pane+_closed ) + .addClass( rClass+_open +" "+ rClass+_pane+_open ) + ; + if (s.isSliding) + $R.addClass( rClass+_sliding +" "+ rClass+_pane+_sliding ) + else // in case 'was sliding' + $R.removeClass( rClass+_sliding +" "+ rClass+_pane+_sliding ) + + removeHover( 0, $R ); // remove hover classes + if (o.resizable && $.layout.plugins.draggable) + $R .draggable("enable") + .css("cursor", o.resizerCursor) + .attr("title", o.tips.Resize); + else if (!s.isSliding) + $R.css("cursor", "default"); // n-resize, s-resize, etc + + // if pane also has a toggler button, adjust that too + if ($T) { + $T .removeClass( tClass+_closed +" "+ tClass+_pane+_closed ) + .addClass( tClass+_open +" "+ tClass+_pane+_open ) + .attr("title", o.tips.Close); // may be blank + removeHover( 0, $T ); // remove hover classes + // toggler-content - if exists + $T.children(".content-closed").hide(); + $T.children(".content-open").css("display","block"); + } + + // sync any 'pin buttons' + syncPinBtns(pane, !s.isSliding); + + // update pane-state dimensions - BEFORE resizing content + $.extend(s, elDims($P)); + + if (state.initialized) { + // resize resizer & toggler sizes for all panes + sizeHandles(); + // resize content every time pane opens - to be sure + sizeContent(pane, true); // true = remeasure headers/footers, even if 'pane.isMoving' + } + + if (!skipCallback && (state.initialized || o.triggerEventsOnLoad) && $P.is(":visible")) { + // onopen callback + _runCallbacks("onopen_end", pane); + // onshow callback - TODO: should this be here? + if (s.isShowing) _runCallbacks("onshow_end", pane); + + // ALSO call onresize because layout-size *may* have changed while pane was closed + if (state.initialized) + _runCallbacks("onresize_end", pane); + } + + // TODO: Somehow sizePane("north") is being called after this point??? + } + + + /** + * slideOpen / slideClose / slideToggle + * + * Pass-though methods for sliding + */ +, slideOpen = function (evt_or_pane) { + if (!isInitialized()) return; + var evt = evtObj(evt_or_pane) + , pane = evtPane.call(this, evt_or_pane) + , s = state[pane] + , delay = options[pane].slideDelay_open + ; + if (pane === "center") return; // validate + // prevent event from triggering on NEW resizer binding created below + if (evt) evt.stopImmediatePropagation(); + + if (s.isClosed && evt && evt.type === "mouseenter" && delay > 0) + // trigger = mouseenter - use a delay + timer.set(pane+"_openSlider", open_NOW, delay); + else + open_NOW(); // will unbind events if is already open + + /** + * SUBROUTINE for timed open + */ + function open_NOW () { + if (!s.isClosed) // skip if no longer closed! + bindStopSlidingEvents(pane, true); // BIND trigger events to close sliding-pane + else if (!s.isMoving) + open(pane, true); // true = slide - open() will handle binding + }; + } + +, slideClose = function (evt_or_pane) { + if (!isInitialized()) return; + var evt = evtObj(evt_or_pane) + , pane = evtPane.call(this, evt_or_pane) + , o = options[pane] + , s = state[pane] + , delay = s.isMoving ? 1000 : 300 // MINIMUM delay - option may override + ; + if (pane === "center") return; // validate + if (s.isClosed || s.isResizing) + return; // skip if already closed OR in process of resizing + else if (o.slideTrigger_close === "click") + close_NOW(); // close immediately onClick + else if (o.preventQuickSlideClose && s.isMoving) + return; // handle Chrome quick-close on slide-open + else if (o.preventPrematureSlideClose && evt && $.layout.isMouseOverElem(evt, $Ps[pane])) + return; // handle incorrect mouseleave trigger, like when over a SELECT-list in IE + else if (evt) // trigger = mouseleave - use a delay + // 1 sec delay if 'opening', else .3 sec + timer.set(pane+"_closeSlider", close_NOW, max(o.slideDelay_close, delay)); + else // called programically + close_NOW(); + + /** + * SUBROUTINE for timed close + */ + function close_NOW () { + if (s.isClosed) // skip 'close' if already closed! + bindStopSlidingEvents(pane, false); // UNBIND trigger events - TODO: is this needed here? + else if (!s.isMoving) + close(pane); // close will handle unbinding + }; + } + + /** + * @param {(string|Object)} evt_or_pane The pane being opened, ie: north, south, east, or west + */ +, slideToggle = function (evt_or_pane) { + var pane = evtPane.call(this, evt_or_pane); + toggle(pane, true); + } + + + /** + * Must set left/top on East/South panes so animation will work properly + * + * @param {string} pane The pane to lock, 'east' or 'south' - any other is ignored! + * @param {boolean} doLock true = set left/top, false = remove + */ +, lockPaneForFX = function (pane, doLock) { + var $P = $Ps[pane] + , s = state[pane] + , o = options[pane] + , z = options.zIndexes + ; + if (doLock) { + showMasks( pane, { animation: true, objectsOnly: true }); + $P.css({ zIndex: z.pane_animate }); // overlay all elements during animation + if (pane=="south") + $P.css({ top: sC.inset.top + sC.innerHeight - $P.outerHeight() }); + else if (pane=="east") + $P.css({ left: sC.inset.left + sC.innerWidth - $P.outerWidth() }); + } + else { // animation DONE - RESET CSS + hideMasks(); + $P.css({ zIndex: (s.isSliding ? z.pane_sliding : z.pane_normal) }); + if (pane=="south") + $P.css({ top: "auto" }); + // if pane is positioned 'off-screen', then DO NOT screw with it! + else if (pane=="east" && !$P.css("left").match(/\-99999/)) + $P.css({ left: "auto" }); + // fix anti-aliasing in IE - only needed for animations that change opacity + if (browser.msie && o.fxOpacityFix && o.fxName_open != "slide" && $P.css("filter") && $P.css("opacity") == 1) + $P[0].style.removeAttribute('filter'); + } + } + + + /** + * Toggle sliding functionality of a specific pane on/off by adding removing 'slide open' trigger + * + * @see open(), close() + * @param {string} pane The pane to enable/disable, 'north', 'south', etc. + * @param {boolean} enable Enable or Disable sliding? + */ +, bindStartSlidingEvents = function (pane, enable) { + var o = options[pane] + , $P = $Ps[pane] + , $R = $Rs[pane] + , evtName = o.slideTrigger_open.toLowerCase() + ; + if (!$R || (enable && !o.slidable)) return; + + // make sure we have a valid event + if (evtName.match(/mouseover/)) + evtName = o.slideTrigger_open = "mouseenter"; + else if (!evtName.match(/(click|dblclick|mouseenter)/)) + evtName = o.slideTrigger_open = "click"; + + // must remove double-click-toggle when using dblclick-slide + if (o.resizerDblClickToggle && evtName.match(/click/)) { + $R[enable ? "unbind" : "bind"]('dblclick.'+ sID, toggle) + } + + $R + // add or remove event + [enable ? "bind" : "unbind"](evtName +'.'+ sID, slideOpen) + // set the appropriate cursor & title/tip + .css("cursor", enable ? o.sliderCursor : "default") + .attr("title", enable ? o.tips.Slide : "") + ; + } + + /** + * Add or remove 'mouseleave' events to 'slide close' when pane is 'sliding' open or closed + * Also increases zIndex when pane is sliding open + * See bindStartSlidingEvents for code to control 'slide open' + * + * @see slideOpen(), slideClose() + * @param {string} pane The pane to process, 'north', 'south', etc. + * @param {boolean} enable Enable or Disable events? + */ +, bindStopSlidingEvents = function (pane, enable) { + var o = options[pane] + , s = state[pane] + , c = _c[pane] + , z = options.zIndexes + , evtName = o.slideTrigger_close.toLowerCase() + , action = (enable ? "bind" : "unbind") + , $P = $Ps[pane] + , $R = $Rs[pane] + ; + timer.clear(pane+"_closeSlider"); // just in case + + if (enable) { + s.isSliding = true; + state.panesSliding[pane] = true; + // remove 'slideOpen' event from resizer + // ALSO will raise the zIndex of the pane & resizer + bindStartSlidingEvents(pane, false); + } + else { + s.isSliding = false; + delete state.panesSliding[pane]; + } + + // RE/SET zIndex - increases when pane is sliding-open, resets to normal when not + $P.css("zIndex", enable ? z.pane_sliding : z.pane_normal); + $R.css("zIndex", enable ? z.pane_sliding+2 : z.resizer_normal); // NOTE: mask = pane_sliding+1 + + // make sure we have a valid event + if (!evtName.match(/(click|mouseleave)/)) + evtName = o.slideTrigger_close = "mouseleave"; // also catches 'mouseout' + + // add/remove slide triggers + $R[action](evtName, slideClose); // base event on resize + // need extra events for mouseleave + if (evtName === "mouseleave") { + // also close on pane.mouseleave + $P[action]("mouseleave."+ sID, slideClose); + // cancel timer when mouse moves between 'pane' and 'resizer' + $R[action]("mouseenter."+ sID, cancelMouseOut); + $P[action]("mouseenter."+ sID, cancelMouseOut); + } + + if (!enable) + timer.clear(pane+"_closeSlider"); + else if (evtName === "click" && !o.resizable) { + // IF pane is not resizable (which already has a cursor and tip) + // then set the a cursor & title/tip on resizer when sliding + $R.css("cursor", enable ? o.sliderCursor : "default"); + $R.attr("title", enable ? o.tips.Close : ""); // use Toggler-tip, eg: "Close Pane" + } + + // SUBROUTINE for mouseleave timer clearing + function cancelMouseOut (evt) { + timer.clear(pane+"_closeSlider"); + evt.stopPropagation(); + } + } + + + /** + * Hides/closes a pane if there is insufficient room - reverses this when there is room again + * MUST have already called setSizeLimits() before calling this method + * + * @param {string} pane The pane being resized + * @param {boolean=} [isOpening=false] Called from onOpen? + * @param {boolean=} [skipCallback=false] Should the onresize callback be run? + * @param {boolean=} [force=false] + */ +, makePaneFit = function (pane, isOpening, skipCallback, force) { + var o = options[pane] + , s = state[pane] + , c = _c[pane] + , $P = $Ps[pane] + , $R = $Rs[pane] + , isSidePane = c.dir==="vert" + , hasRoom = false + ; + // special handling for center & east/west panes + if (pane === "center" || (isSidePane && s.noVerticalRoom)) { + // see if there is enough room to display the pane + // ERROR: hasRoom = s.minHeight <= s.maxHeight && (isSidePane || s.minWidth <= s.maxWidth); + hasRoom = (s.maxHeight >= 0); + if (hasRoom && s.noRoom) { // previously hidden due to noRoom, so show now + _showPane(pane); + if ($R) $R.show(); + s.isVisible = true; + s.noRoom = false; + if (isSidePane) s.noVerticalRoom = false; + _fixIframe(pane); + } + else if (!hasRoom && !s.noRoom) { // not currently hidden, so hide now + _hidePane(pane); + if ($R) $R.hide(); + s.isVisible = false; + s.noRoom = true; + } + } + + // see if there is enough room to fit the border-pane + if (pane === "center") { + // ignore center in this block + } + else if (s.minSize <= s.maxSize) { // pane CAN fit + hasRoom = true; + if (s.size > s.maxSize) // pane is too big - shrink it + sizePane(pane, s.maxSize, skipCallback, true, force); // true = noAnimation + else if (s.size < s.minSize) // pane is too small - enlarge it + sizePane(pane, s.minSize, skipCallback, true, force); // true = noAnimation + // need s.isVisible because new pseudoClose method keeps pane visible, but off-screen + else if ($R && s.isVisible && $P.is(":visible")) { + // make sure resizer-bar is positioned correctly + // handles situation where nested layout was 'hidden' when initialized + var pos = s.size + sC.inset[c.side]; + if ($.layout.cssNum( $R, c.side ) != pos) $R.css( c.side, pos ); + } + + // if was previously hidden due to noRoom, then RESET because NOW there is room + if (s.noRoom) { + // s.noRoom state will be set by open or show + if (s.wasOpen && o.closable) { + if (o.autoReopen) + open(pane, false, true, true); // true = noAnimation, true = noAlert + else // leave the pane closed, so just update state + s.noRoom = false; + } + else + show(pane, s.wasOpen, true, true); // true = noAnimation, true = noAlert + } + } + else { // !hasRoom - pane CANNOT fit + if (!s.noRoom) { // pane not set as noRoom yet, so hide or close it now... + s.noRoom = true; // update state + s.wasOpen = !s.isClosed && !s.isSliding; + if (s.isClosed){} // SKIP + else if (o.closable) // 'close' if possible + close(pane, true, true); // true = force, true = noAnimation + else // 'hide' pane if cannot just be closed + hide(pane, true); // true = noAnimation + } + } + } + + + /** + * manualSizePane is an exposed flow-through method allowing extra code when pane is 'manually resized' + * + * @param {(string|Object)} evt_or_pane The pane being resized + * @param {number} size The *desired* new size for this pane - will be validated + * @param {boolean=} [skipCallback=false] Should the onresize callback be run? + * @param {boolean=} [noAnimation=false] + * @param {boolean=} [force=false] Force resizing even if does not seem necessary + */ +, manualSizePane = function (evt_or_pane, size, skipCallback, noAnimation, force) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , o = options[pane] + , s = state[pane] + // if resizing callbacks have been delayed and resizing is now DONE, force resizing to complete... + , forceResize = force || (o.livePaneResizing && !s.isResizing) + ; + if (pane === "center") return; // validate + // ANY call to manualSizePane disables autoResize - ie, percentage sizing + s.autoResize = false; + // flow-through... + sizePane(pane, size, skipCallback, noAnimation, forceResize); // will animate resize if option enabled + } + + /** + * sizePane is called only by internal methods whenever a pane needs to be resized + * + * @param {(string|Object)} evt_or_pane The pane being resized + * @param {number} size The *desired* new size for this pane - will be validated + * @param {boolean=} [skipCallback=false] Should the onresize callback be run? + * @param {boolean=} [noAnimation=false] + * @param {boolean=} [force=false] Force resizing even if does not seem necessary + */ +, sizePane = function (evt_or_pane, size, skipCallback, noAnimation, force) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) // probably NEVER called from event? + , o = options[pane] + , s = state[pane] + , $P = $Ps[pane] + , $R = $Rs[pane] + , side = _c[pane].side + , dimName = _c[pane].sizeType.toLowerCase() + , skipResizeWhileDragging = s.isResizing && !o.triggerEventsDuringLiveResize + , doFX = noAnimation !== true && o.animatePaneSizing + , oldSize, newSize + ; + if (pane === "center") return; // validate + // QUEUE in case another action/animation is in progress + $N.queue(function( queueNext ){ + // calculate 'current' min/max sizes + setSizeLimits(pane); // update pane-state + oldSize = s.size; + size = _parseSize(pane, size); // handle percentages & auto + size = max(size, _parseSize(pane, o.minSize)); + size = min(size, s.maxSize); + if (size < s.minSize) { // not enough room for pane! + queueNext(); // call before makePaneFit() because it needs the queue free + makePaneFit(pane, false, skipCallback); // will hide or close pane + return; + } + + // IF newSize is same as oldSize, then nothing to do - abort + if (!force && size === oldSize) + return queueNext(); + + s.newSize = size; + + // onresize_start callback CANNOT cancel resizing because this would break the layout! + if (!skipCallback && state.initialized && s.isVisible) + _runCallbacks("onresize_start", pane); + + // resize the pane, and make sure its visible + newSize = cssSize(pane, size); + + if (doFX && $P.is(":visible")) { // ANIMATE + var fx = $.layout.effects.size[pane] || $.layout.effects.size.all + , easing = o.fxSettings_size.easing || fx.easing + , z = options.zIndexes + , props = {}; + props[ dimName ] = newSize +'px'; + s.isMoving = true; + // overlay all elements during animation + $P.css({ zIndex: z.pane_animate }) + .show().animate( props, o.fxSpeed_size, easing, function(){ + // reset zIndex after animation + $P.css({ zIndex: (s.isSliding ? z.pane_sliding : z.pane_normal) }); + s.isMoving = false; + delete s.newSize; + sizePane_2(); // continue + queueNext(); + }); + } + else { // no animation + $P.css( dimName, newSize ); // resize pane + delete s.newSize; + // if pane is visible, then + if ($P.is(":visible")) + sizePane_2(); // continue + else { + // pane is NOT VISIBLE, so just update state data... + // when pane is *next opened*, it will have the new size + s.size = size; // update state.size + //$.extend(s, elDims($P)); // update state dimensions - CANNOT do this when not visible! } + } + queueNext(); + }; + + }); + + // SUBROUTINE + function sizePane_2 () { + /* Panes are sometimes not sized precisely in some browsers!? + * This code will resize the pane up to 3 times to nudge the pane to the correct size + */ + var actual = dimName==='width' ? $P.outerWidth() : $P.outerHeight() + , tries = [{ + pane: pane + , count: 1 + , target: size + , actual: actual + , correct: (size === actual) + , attempt: size + , cssSize: newSize + }] + , lastTry = tries[0] + , thisTry = {} + , msg = 'Inaccurate size after resizing the '+ pane +'-pane.' + ; + while ( !lastTry.correct ) { + thisTry = { pane: pane, count: lastTry.count+1, target: size }; + + if (lastTry.actual > size) + thisTry.attempt = max(0, lastTry.attempt - (lastTry.actual - size)); + else // lastTry.actual < size + thisTry.attempt = max(0, lastTry.attempt + (size - lastTry.actual)); + + thisTry.cssSize = cssSize(pane, thisTry.attempt); + $P.css( dimName, thisTry.cssSize ); + + thisTry.actual = dimName=='width' ? $P.outerWidth() : $P.outerHeight(); + thisTry.correct = (size === thisTry.actual); + + // log attempts and alert the user of this *non-fatal error* (if showDebugMessages) + if ( tries.length === 1) { + _log(msg, false, true); + _log(lastTry, false, true); + } + _log(thisTry, false, true); + // after 4 tries, is as close as its gonna get! + if (tries.length > 3) break; + + tries.push( thisTry ); + lastTry = tries[ tries.length - 1 ]; + } + // END TESTING CODE + + // update pane-state dimensions + s.size = size; + $.extend(s, elDims($P)); + + if (s.isVisible && $P.is(":visible")) { + // reposition the resizer-bar + if ($R) $R.css( side, size + sC.inset[side] ); + // resize the content-div + sizeContent(pane); + } + + if (!skipCallback && !skipResizeWhileDragging && state.initialized && s.isVisible) + _runCallbacks("onresize_end", pane); + + // resize all the adjacent panes, and adjust their toggler buttons + // when skipCallback passed, it means the controlling method will handle 'other panes' + if (!skipCallback) { + // also no callback if live-resize is in progress and NOT triggerEventsDuringLiveResize + if (!s.isSliding) sizeMidPanes(_c[pane].dir=="horz" ? "" : "center", skipResizeWhileDragging, force); + sizeHandles(); + } + + // if opposite-pane was autoClosed, see if it can be autoOpened now + var altPane = _c.oppositeEdge[pane]; + if (size < oldSize && state[ altPane ].noRoom) { + setSizeLimits( altPane ); + makePaneFit( altPane, false, skipCallback ); + } + + // DEBUG - ALERT user/developer so they know there was a sizing problem + if (tries.length > 1) + _log(msg +'\nSee the Error Console for details.', true, true); + } + } + + /** + * @see initPanes(), sizePane(), resizeAll(), open(), close(), hide() + * @param {(Array.|string)} panes The pane(s) being resized, comma-delmited string + * @param {boolean=} [skipCallback=false] Should the onresize callback be run? + * @param {boolean=} [force=false] + */ +, sizeMidPanes = function (panes, skipCallback, force) { + panes = (panes ? panes : "east,west,center").split(","); + + $.each(panes, function (i, pane) { + if (!$Ps[pane]) return; // NO PANE - skip + var + o = options[pane] + , s = state[pane] + , $P = $Ps[pane] + , $R = $Rs[pane] + , isCenter= (pane=="center") + , hasRoom = true + , CSS = {} + // if pane is not visible, show it invisibly NOW rather than for *each call* in this script + , visCSS = $.layout.showInvisibly($P) + + , newCenter = calcNewCenterPaneDims() + ; + + // update pane-state dimensions + $.extend(s, elDims($P)); + + if (pane === "center") { + if (!force && s.isVisible && newCenter.width === s.outerWidth && newCenter.height === s.outerHeight) { + $P.css(visCSS); + return true; // SKIP - pane already the correct size + } + // set state for makePaneFit() logic + $.extend(s, cssMinDims(pane), { + maxWidth: newCenter.width + , maxHeight: newCenter.height + }); + CSS = newCenter; + s.newWidth = CSS.width; + s.newHeight = CSS.height; + // convert OUTER width/height to CSS width/height + CSS.width = cssW($P, CSS.width); + // NEW - allow pane to extend 'below' visible area rather than hide it + CSS.height = cssH($P, CSS.height); + hasRoom = CSS.width >= 0 && CSS.height >= 0; // height >= 0 = ALWAYS TRUE NOW + + // during layout init, try to shrink east/west panes to make room for center + if (!state.initialized && o.minWidth > newCenter.width) { + var + reqPx = o.minWidth - s.outerWidth + , minE = options.east.minSize || 0 + , minW = options.west.minSize || 0 + , sizeE = state.east.size + , sizeW = state.west.size + , newE = sizeE + , newW = sizeW + ; + if (reqPx > 0 && state.east.isVisible && sizeE > minE) { + newE = max( sizeE-minE, sizeE-reqPx ); + reqPx -= sizeE-newE; + } + if (reqPx > 0 && state.west.isVisible && sizeW > minW) { + newW = max( sizeW-minW, sizeW-reqPx ); + reqPx -= sizeW-newW; + } + // IF we found enough extra space, then resize the border panes as calculated + if (reqPx === 0) { + if (sizeE && sizeE != minE) + sizePane('east', newE, true, true, force); // true = skipCallback/noAnimation - initPanes will handle when done + if (sizeW && sizeW != minW) + sizePane('west', newW, true, true, force); // true = skipCallback/noAnimation + // now start over! + sizeMidPanes('center', skipCallback, force); + $P.css(visCSS); + return; // abort this loop + } + } + } + else { // for east and west, set only the height, which is same as center height + // set state.min/maxWidth/Height for makePaneFit() logic + if (s.isVisible && !s.noVerticalRoom) + $.extend(s, elDims($P), cssMinDims(pane)) + if (!force && !s.noVerticalRoom && newCenter.height === s.outerHeight) { + $P.css(visCSS); + return true; // SKIP - pane already the correct size + } + // east/west have same top, bottom & height as center + CSS.top = newCenter.top; + CSS.bottom = newCenter.bottom; + s.newSize = newCenter.height + // NEW - allow pane to extend 'below' visible area rather than hide it + CSS.height = cssH($P, newCenter.height); + s.maxHeight = CSS.height; + hasRoom = (s.maxHeight >= 0); // ALWAYS TRUE NOW + if (!hasRoom) s.noVerticalRoom = true; // makePaneFit() logic + } + + if (hasRoom) { + // resizeAll passes skipCallback because it triggers callbacks after ALL panes are resized + if (!skipCallback && state.initialized) + _runCallbacks("onresize_start", pane); + + $P.css(CSS); // apply the CSS to pane + if (pane !== "center") + sizeHandles(pane); // also update resizer length + if (s.noRoom && !s.isClosed && !s.isHidden) + makePaneFit(pane); // will re-open/show auto-closed/hidden pane + if (s.isVisible) { + $.extend(s, elDims($P)); // update pane dimensions + if (state.initialized) sizeContent(pane); // also resize the contents, if exists + } + } + else if (!s.noRoom && s.isVisible) // no room for pane + makePaneFit(pane); // will hide or close pane + + // reset visibility, if necessary + $P.css(visCSS); + + delete s.newSize; + delete s.newWidth; + delete s.newHeight; + + if (!s.isVisible) + return true; // DONE - next pane + + /* + * Extra CSS for IE6 or IE7 in Quirks-mode - add 'width' to NORTH/SOUTH panes + * Normally these panes have only 'left' & 'right' positions so pane auto-sizes + * ALSO required when pane is an IFRAME because will NOT default to 'full width' + * TODO: Can I use width:100% for a north/south iframe? + * TODO: Sounds like a job for $P.outerWidth( sC.innerWidth ) SETTER METHOD + */ + if (pane === "center") { // finished processing midPanes + var fix = browser.isIE6 || !browser.boxModel; + if ($Ps.north && (fix || state.north.tagName=="IFRAME")) + $Ps.north.css("width", cssW($Ps.north, sC.innerWidth)); + if ($Ps.south && (fix || state.south.tagName=="IFRAME")) + $Ps.south.css("width", cssW($Ps.south, sC.innerWidth)); + } + + // resizeAll passes skipCallback because it triggers callbacks after ALL panes are resized + if (!skipCallback && state.initialized) + _runCallbacks("onresize_end", pane); + }); + } + + + /** + * @see window.onresize(), callbacks or custom code + * @param {(Object|boolean)=} evt_or_refresh If 'true', then also reset pane-positioning + */ +, resizeAll = function (evt_or_refresh) { + var oldW = sC.innerWidth + , oldH = sC.innerHeight + ; + // stopPropagation if called by trigger("layoutdestroy") - use evtPane utility + evtPane(evt_or_refresh); + + // cannot size layout when 'container' is hidden or collapsed + if (!$N.is(":visible")) return; + + if (!state.initialized) { + _initLayoutElements(); + return; // no need to resize since we just initialized! + } + + if (evt_or_refresh === true && $.isPlainObject(options.outset)) { + // update container CSS in case outset option has changed + $N.css( options.outset ); + } + // UPDATE container dimensions + $.extend(sC, elDims( $N, options.inset )); + if (!sC.outerHeight) return; + + // if 'true' passed, refresh pane & handle positioning too + if (evt_or_refresh === true) { + setPanePosition(); + } + + // onresizeall_start will CANCEL resizing if returns false + // state.container has already been set, so user can access this info for calcuations + if (false === _runCallbacks("onresizeall_start")) return false; + + var // see if container is now 'smaller' than before + shrunkH = (sC.innerHeight < oldH) + , shrunkW = (sC.innerWidth < oldW) + , $P, o, s + ; + // NOTE special order for sizing: S-N-E-W + $.each(["south","north","east","west"], function (i, pane) { + if (!$Ps[pane]) return; // no pane - SKIP + o = options[pane]; + s = state[pane]; + if (s.autoResize && s.size != o.size) // resize pane to original size set in options + sizePane(pane, o.size, true, true, true); // true=skipCallback/noAnimation/forceResize + else { + setSizeLimits(pane); + makePaneFit(pane, false, true, true); // true=skipCallback/forceResize + } + }); + + sizeMidPanes("", true, true); // true=skipCallback/forceResize + sizeHandles(); // reposition the toggler elements + + // trigger all individual pane callbacks AFTER layout has finished resizing + $.each(_c.allPanes, function (i, pane) { + $P = $Ps[pane]; + if (!$P) return; // SKIP + if (state[pane].isVisible) // undefined for non-existent panes + _runCallbacks("onresize_end", pane); // callback - if exists + }); + + _runCallbacks("onresizeall_end"); + //_triggerLayoutEvent(pane, 'resizeall'); + } + + /** + * Whenever a pane resizes or opens that has a nested layout, trigger resizeAll + * + * @param {(string|Object)} evt_or_pane The pane just resized or opened + */ +, resizeChildren = function (evt_or_pane, skipRefresh) { + var pane = evtPane.call(this, evt_or_pane); + + if (!options[pane].resizeChildren) return; + + // ensure the pane-children are up-to-date + if (!skipRefresh) refreshChildren( pane ); + var pC = children[pane]; + if ($.isPlainObject( pC )) { + // resize one or more children + $.each( pC, function (key, child) { + if (!child.destroyed) child.resizeAll(); + }); + } + } + + /** + * IF pane has a content-div, then resize all elements inside pane to fit pane-height + * + * @param {(string|Object)} evt_or_panes The pane(s) being resized + * @param {boolean=} [remeasure=false] Should the content (header/footer) be remeasured? + */ +, sizeContent = function (evt_or_panes, remeasure) { + if (!isInitialized()) return; + + var panes = evtPane.call(this, evt_or_panes); + panes = panes ? panes.split(",") : _c.allPanes; + + $.each(panes, function (idx, pane) { + var + $P = $Ps[pane] + , $C = $Cs[pane] + , o = options[pane] + , s = state[pane] + , m = s.content // m = measurements + ; + if (!$P || !$C || !$P.is(":visible")) return true; // NOT VISIBLE - skip + + // if content-element was REMOVED, update OR remove the pointer + if (!$C.length) { + initContent(pane, false); // false = do NOT sizeContent() - already there! + if (!$C) return; // no replacement element found - pointer have been removed + } + + // onsizecontent_start will CANCEL resizing if returns false + if (false === _runCallbacks("onsizecontent_start", pane)) return; + + // skip re-measuring offsets if live-resizing + if ((!s.isMoving && !s.isResizing) || o.liveContentResizing || remeasure || m.top == undefined) { + _measure(); + // if any footers are below pane-bottom, they may not measure correctly, + // so allow pane overflow and re-measure + if (m.hiddenFooters > 0 && $P.css("overflow") === "hidden") { + $P.css("overflow", "visible"); + _measure(); // remeasure while overflowing + $P.css("overflow", "hidden"); + } + } + // NOTE: spaceAbove/Below *includes* the pane paddingTop/Bottom, but not pane.borders + var newH = s.innerHeight - (m.spaceAbove - s.css.paddingTop) - (m.spaceBelow - s.css.paddingBottom); + + if (!$C.is(":visible") || m.height != newH) { + // size the Content element to fit new pane-size - will autoHide if not enough room + setOuterHeight($C, newH, true); // true=autoHide + m.height = newH; // save new height + }; + + if (state.initialized) + _runCallbacks("onsizecontent_end", pane); + + function _below ($E) { + return max(s.css.paddingBottom, (parseInt($E.css("marginBottom"), 10) || 0)); + }; + + function _measure () { + var + ignore = options[pane].contentIgnoreSelector + , $Fs = $C.nextAll().not(".ui-layout-mask").not(ignore || ":lt(0)") // not :lt(0) = ALL + , $Fs_vis = $Fs.filter(':visible') + , $F = $Fs_vis.filter(':last') + ; + m = { + top: $C[0].offsetTop + , height: $C.outerHeight() + , numFooters: $Fs.length + , hiddenFooters: $Fs.length - $Fs_vis.length + , spaceBelow: 0 // correct if no content footer ($E) + } + m.spaceAbove = m.top; // just for state - not used in calc + m.bottom = m.top + m.height; + if ($F.length) + //spaceBelow = (LastFooter.top + LastFooter.height) [footerBottom] - Content.bottom + max(LastFooter.marginBottom, pane.paddingBotom) + m.spaceBelow = ($F[0].offsetTop + $F.outerHeight()) - m.bottom + _below($F); + else // no footer - check marginBottom on Content element itself + m.spaceBelow = _below($C); + }; + }); + } + + + /** + * Called every time a pane is opened, closed, or resized to slide the togglers to 'center' and adjust their length if necessary + * + * @see initHandles(), open(), close(), resizeAll() + * @param {(string|Object)=} evt_or_panes The pane(s) being resized + */ +, sizeHandles = function (evt_or_panes) { + var panes = evtPane.call(this, evt_or_panes) + panes = panes ? panes.split(",") : _c.borderPanes; + + $.each(panes, function (i, pane) { + var + o = options[pane] + , s = state[pane] + , $P = $Ps[pane] + , $R = $Rs[pane] + , $T = $Ts[pane] + , $TC + ; + if (!$P || !$R) return; + + var + dir = _c[pane].dir + , _state = (s.isClosed ? "_closed" : "_open") + , spacing = o["spacing"+ _state] + , togAlign = o["togglerAlign"+ _state] + , togLen = o["togglerLength"+ _state] + , paneLen + , left + , offset + , CSS = {} + ; + + if (spacing === 0) { + $R.hide(); + return; + } + else if (!s.noRoom && !s.isHidden) // skip if resizer was hidden for any reason + $R.show(); // in case was previously hidden + + // Resizer Bar is ALWAYS same width/height of pane it is attached to + if (dir === "horz") { // north/south + //paneLen = $P.outerWidth(); // s.outerWidth || + paneLen = sC.innerWidth; // handle offscreen-panes + s.resizerLength = paneLen; + left = $.layout.cssNum($P, "left") + $R.css({ + width: cssW($R, paneLen) // account for borders & padding + , height: cssH($R, spacing) // ditto + , left: left > -9999 ? left : sC.inset.left // handle offscreen-panes + }); + } + else { // east/west + paneLen = $P.outerHeight(); // s.outerHeight || + s.resizerLength = paneLen; + $R.css({ + height: cssH($R, paneLen) // account for borders & padding + , width: cssW($R, spacing) // ditto + , top: sC.inset.top + getPaneSize("north", true) // TODO: what if no North pane? + //, top: $.layout.cssNum($Ps["center"], "top") + }); + } + + // remove hover classes + removeHover( o, $R ); + + if ($T) { + if (togLen === 0 || (s.isSliding && o.hideTogglerOnSlide)) { + $T.hide(); // always HIDE the toggler when 'sliding' + return; + } + else + $T.show(); // in case was previously hidden + + if (!(togLen > 0) || togLen === "100%" || togLen > paneLen) { + togLen = paneLen; + offset = 0; + } + else { // calculate 'offset' based on options.PANE.togglerAlign_open/closed + if (isStr(togAlign)) { + switch (togAlign) { + case "top": + case "left": offset = 0; + break; + case "bottom": + case "right": offset = paneLen - togLen; + break; + case "middle": + case "center": + default: offset = round((paneLen - togLen) / 2); // 'default' catches typos + } + } + else { // togAlign = number + var x = parseInt(togAlign, 10); // + if (togAlign >= 0) offset = x; + else offset = paneLen - togLen + x; // NOTE: x is negative! + } + } + + if (dir === "horz") { // north/south + var width = cssW($T, togLen); + $T.css({ + width: width // account for borders & padding + , height: cssH($T, spacing) // ditto + , left: offset // TODO: VERIFY that toggler positions correctly for ALL values + , top: 0 + }); + // CENTER the toggler content SPAN + $T.children(".content").each(function(){ + $TC = $(this); + $TC.css("marginLeft", round((width-$TC.outerWidth())/2)); // could be negative + }); + } + else { // east/west + var height = cssH($T, togLen); + $T.css({ + height: height // account for borders & padding + , width: cssW($T, spacing) // ditto + , top: offset // POSITION the toggler + , left: 0 + }); + // CENTER the toggler content SPAN + $T.children(".content").each(function(){ + $TC = $(this); + $TC.css("marginTop", round((height-$TC.outerHeight())/2)); // could be negative + }); + } + + // remove ALL hover classes + removeHover( 0, $T ); + } + + // DONE measuring and sizing this resizer/toggler, so can be 'hidden' now + if (!state.initialized && (o.initHidden || s.isHidden)) { + $R.hide(); + if ($T) $T.hide(); + } + }); + } + + + /** + * @param {(string|Object)} evt_or_pane + */ +, enableClosable = function (evt_or_pane) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , $T = $Ts[pane] + , o = options[pane] + ; + if (!$T) return; + o.closable = true; + $T .bind("click."+ sID, function(evt){ evt.stopPropagation(); toggle(pane); }) + .css("visibility", "visible") + .css("cursor", "pointer") + .attr("title", state[pane].isClosed ? o.tips.Open : o.tips.Close) // may be blank + .show(); + } + /** + * @param {(string|Object)} evt_or_pane + * @param {boolean=} [hide=false] + */ +, disableClosable = function (evt_or_pane, hide) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , $T = $Ts[pane] + ; + if (!$T) return; + options[pane].closable = false; + // is closable is disable, then pane MUST be open! + if (state[pane].isClosed) open(pane, false, true); + $T .unbind("."+ sID) + .css("visibility", hide ? "hidden" : "visible") // instead of hide(), which creates logic issues + .css("cursor", "default") + .attr("title", ""); + } + + + /** + * @param {(string|Object)} evt_or_pane + */ +, enableSlidable = function (evt_or_pane) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , $R = $Rs[pane] + ; + if (!$R || !$R.data('draggable')) return; + options[pane].slidable = true; + if (state[pane].isClosed) + bindStartSlidingEvents(pane, true); + } + /** + * @param {(string|Object)} evt_or_pane + */ +, disableSlidable = function (evt_or_pane) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , $R = $Rs[pane] + ; + if (!$R) return; + options[pane].slidable = false; + if (state[pane].isSliding) + close(pane, false, true); + else { + bindStartSlidingEvents(pane, false); + $R .css("cursor", "default") + .attr("title", ""); + removeHover(null, $R[0]); // in case currently hovered + } + } + + + /** + * @param {(string|Object)} evt_or_pane + */ +, enableResizable = function (evt_or_pane) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , $R = $Rs[pane] + , o = options[pane] + ; + if (!$R || !$R.data('draggable')) return; + o.resizable = true; + $R.draggable("enable"); + if (!state[pane].isClosed) + $R .css("cursor", o.resizerCursor) + .attr("title", o.tips.Resize); + } + /** + * @param {(string|Object)} evt_or_pane + */ +, disableResizable = function (evt_or_pane) { + if (!isInitialized()) return; + var pane = evtPane.call(this, evt_or_pane) + , $R = $Rs[pane] + ; + if (!$R || !$R.data('draggable')) return; + options[pane].resizable = false; + $R .draggable("disable") + .css("cursor", "default") + .attr("title", ""); + removeHover(null, $R[0]); // in case currently hovered + } + + + /** + * Move a pane from source-side (eg, west) to target-side (eg, east) + * If pane exists on target-side, move that to source-side, ie, 'swap' the panes + * + * @param {(string|Object)} evt_or_pane1 The pane/edge being swapped + * @param {string} pane2 ditto + */ +, swapPanes = function (evt_or_pane1, pane2) { + if (!isInitialized()) return; + var pane1 = evtPane.call(this, evt_or_pane1); + // change state.edge NOW so callbacks can know where pane is headed... + state[pane1].edge = pane2; + state[pane2].edge = pane1; + // run these even if NOT state.initialized + if (false === _runCallbacks("onswap_start", pane1) + || false === _runCallbacks("onswap_start", pane2) + ) { + state[pane1].edge = pane1; // reset + state[pane2].edge = pane2; + return; + } + + var + oPane1 = copy( pane1 ) + , oPane2 = copy( pane2 ) + , sizes = {} + ; + sizes[pane1] = oPane1 ? oPane1.state.size : 0; + sizes[pane2] = oPane2 ? oPane2.state.size : 0; + + // clear pointers & state + $Ps[pane1] = false; + $Ps[pane2] = false; + state[pane1] = {}; + state[pane2] = {}; + + // ALWAYS remove the resizer & toggler elements + if ($Ts[pane1]) $Ts[pane1].remove(); + if ($Ts[pane2]) $Ts[pane2].remove(); + if ($Rs[pane1]) $Rs[pane1].remove(); + if ($Rs[pane2]) $Rs[pane2].remove(); + $Rs[pane1] = $Rs[pane2] = $Ts[pane1] = $Ts[pane2] = false; + + // transfer element pointers and data to NEW Layout keys + move( oPane1, pane2 ); + move( oPane2, pane1 ); + + // cleanup objects + oPane1 = oPane2 = sizes = null; + + // make panes 'visible' again + if ($Ps[pane1]) $Ps[pane1].css(_c.visible); + if ($Ps[pane2]) $Ps[pane2].css(_c.visible); + + // fix any size discrepancies caused by swap + resizeAll(); + + // run these even if NOT state.initialized + _runCallbacks("onswap_end", pane1); + _runCallbacks("onswap_end", pane2); + + return; + + function copy (n) { // n = pane + var + $P = $Ps[n] + , $C = $Cs[n] + ; + return !$P ? false : { + pane: n + , P: $P ? $P[0] : false + , C: $C ? $C[0] : false + , state: $.extend(true, {}, state[n]) + , options: $.extend(true, {}, options[n]) + } + }; + + function move (oPane, pane) { + if (!oPane) return; + var + P = oPane.P + , C = oPane.C + , oldPane = oPane.pane + , c = _c[pane] + // save pane-options that should be retained + , s = $.extend(true, {}, state[pane]) + , o = options[pane] + // RETAIN side-specific FX Settings - more below + , fx = { resizerCursor: o.resizerCursor } + , re, size, pos + ; + $.each("fxName,fxSpeed,fxSettings".split(","), function (i, k) { + fx[k +"_open"] = o[k +"_open"]; + fx[k +"_close"] = o[k +"_close"]; + fx[k +"_size"] = o[k +"_size"]; + }); + + // update object pointers and attributes + $Ps[pane] = $(P) + .data({ + layoutPane: Instance[pane] // NEW pointer to pane-alias-object + , layoutEdge: pane + }) + .css(_c.hidden) + .css(c.cssReq) + ; + $Cs[pane] = C ? $(C) : false; + + // set options and state + options[pane] = $.extend(true, {}, oPane.options, fx); + state[pane] = $.extend(true, {}, oPane.state); + + // change classNames on the pane, eg: ui-layout-pane-east ==> ui-layout-pane-west + re = new RegExp(o.paneClass +"-"+ oldPane, "g"); + P.className = P.className.replace(re, o.paneClass +"-"+ pane); + + // ALWAYS regenerate the resizer & toggler elements + initHandles(pane); // create the required resizer & toggler + + // if moving to different orientation, then keep 'target' pane size + if (c.dir != _c[oldPane].dir) { + size = sizes[pane] || 0; + setSizeLimits(pane); // update pane-state + size = max(size, state[pane].minSize); + // use manualSizePane to disable autoResize - not useful after panes are swapped + manualSizePane(pane, size, true, true); // true/true = skipCallback/noAnimation + } + else // move the resizer here + $Rs[pane].css(c.side, sC.inset[c.side] + (state[pane].isVisible ? getPaneSize(pane) : 0)); + + + // ADD CLASSNAMES & SLIDE-BINDINGS + if (oPane.state.isVisible && !s.isVisible) + setAsOpen(pane, true); // true = skipCallback + else { + setAsClosed(pane); + bindStartSlidingEvents(pane, true); // will enable events IF option is set + } + + // DESTROY the object + oPane = null; + }; + } + + + /** + * INTERNAL method to sync pin-buttons when pane is opened or closed + * Unpinned means the pane is 'sliding' - ie, over-top of the adjacent panes + * + * @see open(), setAsOpen(), setAsClosed() + * @param {string} pane These are the params returned to callbacks by layout() + * @param {boolean} doPin True means set the pin 'down', False means 'up' + */ +, syncPinBtns = function (pane, doPin) { + if ($.layout.plugins.buttons) + $.each(state[pane].pins, function (i, selector) { + $.layout.buttons.setPinState(Instance, $(selector), pane, doPin); + }); + } + +; // END var DECLARATIONS + + /** + * Capture keys when enableCursorHotkey - toggle pane if hotkey pressed + * + * @see document.keydown() + */ + function keyDown (evt) { + if (!evt) return true; + var code = evt.keyCode; + if (code < 33) return true; // ignore special keys: ENTER, TAB, etc + + var + PANE = { + 38: "north" // Up Cursor - $.ui.keyCode.UP + , 40: "south" // Down Cursor - $.ui.keyCode.DOWN + , 37: "west" // Left Cursor - $.ui.keyCode.LEFT + , 39: "east" // Right Cursor - $.ui.keyCode.RIGHT + } + , ALT = evt.altKey // no worky! + , SHIFT = evt.shiftKey + , CTRL = evt.ctrlKey + , CURSOR = (CTRL && code >= 37 && code <= 40) + , o, k, m, pane + ; + + if (CURSOR && options[PANE[code]].enableCursorHotkey) // valid cursor-hotkey + pane = PANE[code]; + else if (CTRL || SHIFT) // check to see if this matches a custom-hotkey + $.each(_c.borderPanes, function (i, p) { // loop each pane to check its hotkey + o = options[p]; + k = o.customHotkey; + m = o.customHotkeyModifier; // if missing or invalid, treated as "CTRL+SHIFT" + if ((SHIFT && m=="SHIFT") || (CTRL && m=="CTRL") || (CTRL && SHIFT)) { // Modifier matches + if (k && code === (isNaN(k) || k <= 9 ? k.toUpperCase().charCodeAt(0) : k)) { // Key matches + pane = p; + return false; // BREAK + } + } + }); + + // validate pane + if (!pane || !$Ps[pane] || !options[pane].closable || state[pane].isHidden) + return true; + + toggle(pane); + + evt.stopPropagation(); + evt.returnValue = false; // CANCEL key + return false; + }; + + +/* + * ###################################### + * UTILITY METHODS + * called externally or by initButtons + * ###################################### + */ + + /** + * Change/reset a pane overflow setting & zIndex to allow popups/drop-downs to work + * + * @param {Object=} [el] (optional) Can also be 'bound' to a click, mouseOver, or other event + */ + function allowOverflow (el) { + if (!isInitialized()) return; + if (this && this.tagName) el = this; // BOUND to element + var $P; + if (isStr(el)) + $P = $Ps[el]; + else if ($(el).data("layoutRole")) + $P = $(el); + else + $(el).parents().each(function(){ + if ($(this).data("layoutRole")) { + $P = $(this); + return false; // BREAK + } + }); + if (!$P || !$P.length) return; // INVALID + + var + pane = $P.data("layoutEdge") + , s = state[pane] + ; + + // if pane is already raised, then reset it before doing it again! + // this would happen if allowOverflow is attached to BOTH the pane and an element + if (s.cssSaved) + resetOverflow(pane); // reset previous CSS before continuing + + // if pane is raised by sliding or resizing, or its closed, then abort + if (s.isSliding || s.isResizing || s.isClosed) { + s.cssSaved = false; + return; + } + + var + newCSS = { zIndex: (options.zIndexes.resizer_normal + 1) } + , curCSS = {} + , of = $P.css("overflow") + , ofX = $P.css("overflowX") + , ofY = $P.css("overflowY") + ; + // determine which, if any, overflow settings need to be changed + if (of != "visible") { + curCSS.overflow = of; + newCSS.overflow = "visible"; + } + if (ofX && !ofX.match(/(visible|auto)/)) { + curCSS.overflowX = ofX; + newCSS.overflowX = "visible"; + } + if (ofY && !ofY.match(/(visible|auto)/)) { + curCSS.overflowY = ofX; + newCSS.overflowY = "visible"; + } + + // save the current overflow settings - even if blank! + s.cssSaved = curCSS; + + // apply new CSS to raise zIndex and, if necessary, make overflow 'visible' + $P.css( newCSS ); + + // make sure the zIndex of all other panes is normal + $.each(_c.allPanes, function(i, p) { + if (p != pane) resetOverflow(p); + }); + + }; + /** + * @param {Object=} [el] (optional) Can also be 'bound' to a click, mouseOver, or other event + */ + function resetOverflow (el) { + if (!isInitialized()) return; + if (this && this.tagName) el = this; // BOUND to element + var $P; + if (isStr(el)) + $P = $Ps[el]; + else if ($(el).data("layoutRole")) + $P = $(el); + else + $(el).parents().each(function(){ + if ($(this).data("layoutRole")) { + $P = $(this); + return false; // BREAK + } + }); + if (!$P || !$P.length) return; // INVALID + + var + pane = $P.data("layoutEdge") + , s = state[pane] + , CSS = s.cssSaved || {} + ; + // reset the zIndex + if (!s.isSliding && !s.isResizing) + $P.css("zIndex", options.zIndexes.pane_normal); + + // reset Overflow - if necessary + $P.css( CSS ); + + // clear var + s.cssSaved = false; + }; + +/* + * ##################### + * CREATE/RETURN LAYOUT + * ##################### + */ + + // validate that container exists + var $N = $(this).eq(0); // FIRST matching Container element + if (!$N.length) { + return _log( options.errors.containerMissing ); + }; + + // Users retrieve Instance of a layout with: $N.layout() OR $N.data("layout") + // return the Instance-pointer if layout has already been initialized + if ($N.data("layoutContainer") && $N.data("layout")) + return $N.data("layout"); // cached pointer + + // init global vars + var + $Ps = {} // Panes x5 - set in initPanes() + , $Cs = {} // Content x5 - set in initPanes() + , $Rs = {} // Resizers x4 - set in initHandles() + , $Ts = {} // Togglers x4 - set in initHandles() + , $Ms = $([]) // Masks - up to 2 masks per pane (IFRAME + DIV) + // aliases for code brevity + , sC = state.container // alias for easy access to 'container dimensions' + , sID = state.id // alias for unique layout ID/namespace - eg: "layout435" + ; + + // create Instance object to expose data & option Properties, and primary action Methods + var Instance = { + // layout data + options: options // property - options hash + , state: state // property - dimensions hash + // object pointers + , container: $N // property - object pointers for layout container + , panes: $Ps // property - object pointers for ALL Panes: panes.north, panes.center + , contents: $Cs // property - object pointers for ALL Content: contents.north, contents.center + , resizers: $Rs // property - object pointers for ALL Resizers, eg: resizers.north + , togglers: $Ts // property - object pointers for ALL Togglers, eg: togglers.north + // border-pane open/close + , hide: hide // method - ditto + , show: show // method - ditto + , toggle: toggle // method - pass a 'pane' ("north", "west", etc) + , open: open // method - ditto + , close: close // method - ditto + , slideOpen: slideOpen // method - ditto + , slideClose: slideClose // method - ditto + , slideToggle: slideToggle // method - ditto + // pane actions + , setSizeLimits: setSizeLimits // method - pass a 'pane' - update state min/max data + , _sizePane: sizePane // method -intended for user by plugins only! + , sizePane: manualSizePane // method - pass a 'pane' AND an 'outer-size' in pixels or percent, or 'auto' + , sizeContent: sizeContent // method - pass a 'pane' + , swapPanes: swapPanes // method - pass TWO 'panes' - will swap them + , showMasks: showMasks // method - pass a 'pane' OR list of panes - default = all panes with mask option set + , hideMasks: hideMasks // method - ditto' + // pane element methods + , initContent: initContent // method - ditto + , addPane: addPane // method - pass a 'pane' + , removePane: removePane // method - pass a 'pane' to remove from layout, add 'true' to delete the pane-elem + , createChildren: createChildren // method - pass a 'pane' and (optional) layout-options (OVERRIDES options[pane].children + , refreshChildren: refreshChildren // method - pass a 'pane' and a layout-instance + // special pane option setting + , enableClosable: enableClosable // method - pass a 'pane' + , disableClosable: disableClosable // method - ditto + , enableSlidable: enableSlidable // method - ditto + , disableSlidable: disableSlidable // method - ditto + , enableResizable: enableResizable // method - ditto + , disableResizable: disableResizable// method - ditto + // utility methods for panes + , allowOverflow: allowOverflow // utility - pass calling element (this) + , resetOverflow: resetOverflow // utility - ditto + // layout control + , destroy: destroy // method - no parameters + , initPanes: isInitialized // method - no parameters + , resizeAll: resizeAll // method - no parameters + // callback triggering + , runCallbacks: _runCallbacks // method - pass evtName & pane (if a pane-event), eg: trigger("onopen", "west") + // alias collections of options, state and children - created in addPane and extended elsewhere + , hasParentLayout: false // set by initContainer() + , children: children // pointers to child-layouts, eg: Instance.children.west.layoutName + , north: false // alias group: { name: pane, pane: $Ps[pane], options: options[pane], state: state[pane], children: children[pane] } + , south: false // ditto + , west: false // ditto + , east: false // ditto + , center: false // ditto + }; + + // create the border layout NOW + if (_create() === 'cancel') // onload_start callback returned false to CANCEL layout creation + return null; + else // true OR false -- if layout-elements did NOT init (hidden or do not exist), can auto-init later + return Instance; // return the Instance object + +} + + +})( jQuery ); + + + + +/** + * jquery.layout.state 1.2 + * $Date: 2015/03/13 22:37:04 $ + * + * Copyright (c) 2014 + * Kevin Dalman (http://allpro.net) + * + * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html) + * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses. + * + * @requires: UI Layout 1.4.0 or higher + * @requires: $.ui.cookie (above) + * + * @see: http://groups.google.com/group/jquery-ui-layout + */ +;(function ($) { + +if (!$.layout) return; + + +/** + * UI COOKIE UTILITY + * + * A $.cookie OR $.ui.cookie namespace *should be standard*, but until then... + * This creates $.ui.cookie so Layout does not need the cookie.jquery.js plugin + * NOTE: This utility is REQUIRED by the layout.state plugin + * + * Cookie methods in Layout are created as part of State Management + */ +if (!$.ui) $.ui = {}; +$.ui.cookie = { + + // cookieEnabled is not in DOM specs, but DOES works in all browsers,including IE6 + acceptsCookies: !!navigator.cookieEnabled + +, read: function (name) { + var + c = document.cookie + , cs = c ? c.split(';') : [] + , pair, data, i + ; + for (i=0; pair=cs[i]; i++) { + data = $.trim(pair).split('='); // name=value => [ name, value ] + if (data[0] == name) // found the layout cookie + return decodeURIComponent(data[1]); + } + return null; + } + +, write: function (name, val, cookieOpts) { + var params = "" + , date = "" + , clear = false + , o = cookieOpts || {} + , x = o.expires || null + , t = $.type(x) + ; + if (t === "date") + date = x; + else if (t === "string" && x > 0) { + x = parseInt(x,10); + t = "number"; + } + if (t === "number") { + date = new Date(); + if (x > 0) + date.setDate(date.getDate() + x); + else { + date.setFullYear(1970); + clear = true; + } + } + if (date) params += ";expires="+ date.toUTCString(); + if (o.path) params += ";path="+ o.path; + if (o.domain) params += ";domain="+ o.domain; + if (o.secure) params += ";secure"; + document.cookie = name +"="+ (clear ? "" : encodeURIComponent( val )) + params; // write or clear cookie + } + +, clear: function (name) { + $.ui.cookie.write(name, "", {expires: -1}); + } + +}; +// if cookie.jquery.js is not loaded, create an alias to replicate it +// this may be useful to other plugins or code dependent on that plugin +if (!$.cookie) $.cookie = function (k, v, o) { + var C = $.ui.cookie; + if (v === null) + C.clear(k); + else if (v === undefined) + return C.read(k); + else + C.write(k, v, o); +}; + + + +/** + * State-management options stored in options.stateManagement, which includes a .cookie hash + * Default options saves ALL KEYS for ALL PANES, ie: pane.size, pane.isClosed, pane.isHidden + * + * // STATE/COOKIE OPTIONS + * @example $(el).layout({ + stateManagement: { + enabled: true + , stateKeys: "east.size,west.size,east.isClosed,west.isClosed" + , cookie: { name: "appLayout", path: "/" } + } + }) + * @example $(el).layout({ stateManagement__enabled: true }) // enable auto-state-management using cookies + * @example $(el).layout({ stateManagement__cookie: { name: "appLayout", path: "/" } }) + * @example $(el).layout({ stateManagement__cookie__name: "appLayout", stateManagement__cookie__path: "/" }) + * + * // STATE/COOKIE METHODS + * @example myLayout.saveCookie( "west.isClosed,north.size,south.isHidden", {expires: 7} ); + * @example myLayout.loadCookie(); + * @example myLayout.deleteCookie(); + * @example var JSON = myLayout.readState(); // CURRENT Layout State + * @example var JSON = myLayout.readCookie(); // SAVED Layout State (from cookie) + * @example var JSON = myLayout.state.stateData; // LAST LOADED Layout State (cookie saved in layout.state hash) + * + * CUSTOM STATE-MANAGEMENT (eg, saved in a database) + * @example var JSON = myLayout.readState( "west.isClosed,north.size,south.isHidden" ); + * @example myLayout.loadState( JSON ); + */ + +// tell Layout that the state plugin is available +$.layout.plugins.stateManagement = true; + +// Add State-Management options to layout.defaults +$.layout.defaults.stateManagement = { + enabled: false // true = enable state-management, even if not using cookies +, autoSave: true // Save a state-cookie when page exits? +, autoLoad: true // Load the state-cookie when Layout inits? +, animateLoad: true // animate panes when loading state into an active layout +, includeChildren: true // recurse into child layouts to include their state as well + // List state-data to save - must be pane-specific +, stateKeys: "north.size,south.size,east.size,west.size,"+ + "north.isClosed,south.isClosed,east.isClosed,west.isClosed,"+ + "north.isHidden,south.isHidden,east.isHidden,west.isHidden" +, cookie: { + name: "" // If not specified, will use Layout.name, else just "Layout" + , domain: "" // blank = current domain + , path: "" // blank = current page, "/" = entire website + , expires: "" // 'days' to keep cookie - leave blank for 'session cookie' + , secure: false + } +}; + +// Set stateManagement as a 'layout-option', NOT a 'pane-option' +$.layout.optionsMap.layout.push("stateManagement"); +// Update config so layout does not move options into the pane-default branch (panes) +$.layout.config.optionRootKeys.push("stateManagement"); + +/* + * State Management methods + */ +$.layout.state = { + + /** + * Get the current layout state and save it to a cookie + * + * myLayout.saveCookie( keys, cookieOpts ) + * + * @param {Object} inst + * @param {(string|Array)=} keys + * @param {Object=} cookieOpts + */ + saveCookie: function (inst, keys, cookieOpts) { + var o = inst.options + , sm = o.stateManagement + , oC = $.extend(true, {}, sm.cookie, cookieOpts || null) + , data = inst.state.stateData = inst.readState( keys || sm.stateKeys ) // read current panes-state + ; + $.ui.cookie.write( oC.name || o.name || "Layout", $.layout.state.encodeJSON(data), oC ); + return $.extend(true, {}, data); // return COPY of state.stateData data + } + + /** + * Remove the state cookie + * + * @param {Object} inst + */ +, deleteCookie: function (inst) { + var o = inst.options; + $.ui.cookie.clear( o.stateManagement.cookie.name || o.name || "Layout" ); + } + + /** + * Read & return data from the cookie - as JSON + * + * @param {Object} inst + */ +, readCookie: function (inst) { + var o = inst.options; + var c = $.ui.cookie.read( o.stateManagement.cookie.name || o.name || "Layout" ); + // convert cookie string back to a hash and return it + return c ? $.layout.state.decodeJSON(c) : {}; + } + + /** + * Get data from the cookie and USE IT to loadState + * + * @param {Object} inst + */ +, loadCookie: function (inst) { + var c = $.layout.state.readCookie(inst); // READ the cookie + if (c && !$.isEmptyObject( c )) { + inst.state.stateData = $.extend(true, {}, c); // SET state.stateData + inst.loadState(c); // LOAD the retrieved state + } + return c; + } + + /** + * Update layout options from the cookie, if one exists + * + * @param {Object} inst + * @param {Object=} stateData + * @param {boolean=} animate + */ +, loadState: function (inst, data, opts) { + if (!$.isPlainObject( data ) || $.isEmptyObject( data )) return; + + // normalize data & cache in the state object + data = inst.state.stateData = $.layout.transformData( data ); // panes = default subkey + + // add missing/default state-restore options + var smo = inst.options.stateManagement; + opts = $.extend({ + animateLoad: false //smo.animateLoad + , includeChildren: smo.includeChildren + }, opts ); + + if (!inst.state.initialized) { + /* + * layout NOT initialized, so just update its options + */ + // MUST remove pane.children keys before applying to options + // use a copy so we don't remove keys from original data + var o = $.extend(true, {}, data); + //delete o.center; // center has no state-data - only children + $.each($.layout.config.allPanes, function (idx, pane) { + if (o[pane]) delete o[pane].children; + }); + // update CURRENT layout-options with saved state data + $.extend(true, inst.options, o); + } + else { + /* + * layout already initialized, so modify layout's configuration + */ + var noAnimate = !opts.animateLoad + , o, c, h, state, open + ; + $.each($.layout.config.borderPanes, function (idx, pane) { + o = data[ pane ]; + if (!$.isPlainObject( o )) return; // no key, skip pane + + s = o.size; + c = o.initClosed; + h = o.initHidden; + ar = o.autoResize + state = inst.state[pane]; + open = state.isVisible; + + // reset autoResize + if (ar) + state.autoResize = ar; + // resize BEFORE opening + if (!open) + inst._sizePane(pane, s, false, false, false); // false=skipCallback/noAnimation/forceResize + // open/close as necessary - DO NOT CHANGE THIS ORDER! + if (h === true) inst.hide(pane, noAnimate); + else if (c === true) inst.close(pane, false, noAnimate); + else if (c === false) inst.open (pane, false, noAnimate); + else if (h === false) inst.show (pane, false, noAnimate); + // resize AFTER any other actions + if (open) + inst._sizePane(pane, s, false, false, noAnimate); // animate resize if option passed + }); + + /* + * RECURSE INTO CHILD-LAYOUTS + */ + if (opts.includeChildren) { + var paneStateChildren, childState; + $.each(inst.children, function (pane, paneChildren) { + paneStateChildren = data[pane] ? data[pane].children : 0; + if (paneStateChildren && paneChildren) { + $.each(paneChildren, function (stateKey, child) { + childState = paneStateChildren[stateKey]; + if (child && childState) + child.loadState( childState ); + }); + } + }); + } + } + } + + /** + * Get the *current layout state* and return it as a hash + * + * @param {Object=} inst // Layout instance to get state for + * @param {object=} [opts] // State-Managements override options + */ +, readState: function (inst, opts) { + // backward compatility + if ($.type(opts) === 'string') opts = { keys: opts }; + if (!opts) opts = {}; + var sm = inst.options.stateManagement + , ic = opts.includeChildren + , recurse = ic !== undefined ? ic : sm.includeChildren + , keys = opts.stateKeys || sm.stateKeys + , alt = { isClosed: 'initClosed', isHidden: 'initHidden' } + , state = inst.state + , panes = $.layout.config.allPanes + , data = {} + , pair, pane, key, val + , ps, pC, child, array, count, branch + ; + if ($.isArray(keys)) keys = keys.join(","); + // convert keys to an array and change delimiters from '__' to '.' + keys = keys.replace(/__/g, ".").split(','); + // loop keys and create a data hash + for (var i=0, n=keys.length; i < n; i++) { + pair = keys[i].split("."); + pane = pair[0]; + key = pair[1]; + if ($.inArray(pane, panes) < 0) continue; // bad pane! + val = state[ pane ][ key ]; + if (val == undefined) continue; + if (key=="isClosed" && state[pane]["isSliding"]) + val = true; // if sliding, then *really* isClosed + ( data[pane] || (data[pane]={}) )[ alt[key] ? alt[key] : key ] = val; + } + + // recurse into the child-layouts for each pane + if (recurse) { + $.each(panes, function (idx, pane) { + pC = inst.children[pane]; + ps = state.stateData[pane]; + if ($.isPlainObject( pC ) && !$.isEmptyObject( pC )) { + // ensure a key exists for this 'pane', eg: branch = data.center + branch = data[pane] || (data[pane] = {}); + if (!branch.children) branch.children = {}; + $.each( pC, function (key, child) { + // ONLY read state from an initialize layout + if ( child.state.initialized ) + branch.children[ key ] = $.layout.state.readState( child ); + // if we have PREVIOUS (onLoad) state for this child-layout, KEEP IT! + else if ( ps && ps.children && ps.children[ key ] ) { + branch.children[ key ] = $.extend(true, {}, ps.children[ key ] ); + } + }); + } + }); + } + + return data; + } + + /** + * Stringify a JSON hash so can save in a cookie or db-field + */ +, encodeJSON: function (json) { + var local = window.JSON || {}; + return (local.stringify || stringify)(json); + + function stringify (h) { + var D=[], i=0, k, v, t // k = key, v = value + , a = $.isArray(h) + ; + for (k in h) { + v = h[k]; + t = typeof v; + if (t == 'string') // STRING - add quotes + v = '"'+ v +'"'; + else if (t == 'object') // SUB-KEY - recurse into it + v = parse(v); + D[i++] = (!a ? '"'+ k +'":' : '') + v; + } + return (a ? '[' : '{') + D.join(',') + (a ? ']' : '}'); + }; + } + + /** + * Convert stringified JSON back to a hash object + * @see $.parseJSON(), adding in jQuery 1.4.1 + */ +, decodeJSON: function (str) { + try { return $.parseJSON ? $.parseJSON(str) : window["eval"]("("+ str +")") || {}; } + catch (e) { return {}; } + } + + +, _create: function (inst) { + var s = $.layout.state + , o = inst.options + , sm = o.stateManagement + ; + // ADD State-Management plugin methods to inst + $.extend( inst, { + // readCookie - update options from cookie - returns hash of cookie data + readCookie: function () { return s.readCookie(inst); } + // deleteCookie + , deleteCookie: function () { s.deleteCookie(inst); } + // saveCookie - optionally pass keys-list and cookie-options (hash) + , saveCookie: function (keys, cookieOpts) { return s.saveCookie(inst, keys, cookieOpts); } + // loadCookie - readCookie and use to loadState() - returns hash of cookie data + , loadCookie: function () { return s.loadCookie(inst); } + // loadState - pass a hash of state to use to update options + , loadState: function (stateData, opts) { s.loadState(inst, stateData, opts); } + // readState - returns hash of current layout-state + , readState: function (keys) { return s.readState(inst, keys); } + // add JSON utility methods too... + , encodeJSON: s.encodeJSON + , decodeJSON: s.decodeJSON + }); + + // init state.stateData key, even if plugin is initially disabled + inst.state.stateData = {}; + + // autoLoad MUST BE one of: data-array, data-hash, callback-function, or TRUE + if ( !sm.autoLoad ) return; + + // When state-data exists in the autoLoad key USE IT, + // even if stateManagement.enabled == false + if ($.isPlainObject( sm.autoLoad )) { + if (!$.isEmptyObject( sm.autoLoad )) { + inst.loadState( sm.autoLoad ); + } + } + else if ( sm.enabled ) { + // update the options from cookie or callback + // if options is a function, call it to get stateData + if ($.isFunction( sm.autoLoad )) { + var d = {}; + try { + d = sm.autoLoad( inst, inst.state, inst.options, inst.options.name || '' ); // try to get data from fn + } catch (e) {} + if (d && $.isPlainObject( d ) && !$.isEmptyObject( d )) + inst.loadState(d); + } + else // any other truthy value will trigger loadCookie + inst.loadCookie(); + } + } + +, _unload: function (inst) { + var sm = inst.options.stateManagement; + if (sm.enabled && sm.autoSave) { + // if options is a function, call it to save the stateData + if ($.isFunction( sm.autoSave )) { + try { + sm.autoSave( inst, inst.state, inst.options, inst.options.name || '' ); // try to get data from fn + } catch (e) {} + } + else // any truthy value will trigger saveCookie + inst.saveCookie(); + } + } + +}; + +// add state initialization method to Layout's onCreate array of functions +$.layout.onCreate.push( $.layout.state._create ); +$.layout.onUnload.push( $.layout.state._unload ); + +})( jQuery ); + + + +/** + * @preserve jquery.layout.buttons 1.0 + * $Date: 2015/03/13 22:37:04 $ + * + * Copyright (c) 2011 + * Kevin Dalman (http://allpro.net) + * + * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html) + * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses. + * + * @dependancies: UI Layout 1.3.0.rc30.1 or higher + * + * @support: http://groups.google.com/group/jquery-ui-layout + * + * Docs: [ to come ] + * Tips: [ to come ] + */ +;(function ($) { + +if (!$.layout) return; + + +// tell Layout that the state plugin is available +$.layout.plugins.buttons = true; + +// Add State-Management options to layout.defaults +$.layout.defaults.autoBindCustomButtons = false; +// Set stateManagement as a layout-option, NOT a pane-option +$.layout.optionsMap.layout.push("autoBindCustomButtons"); + +var lang = $.layout.language; + +/* + * Button methods + */ +$.layout.buttons = { + // set data used by multiple methods below + config: { + borderPanes: "north,south,west,east" + } + + /** + * Searches for .ui-layout-button-xxx elements and auto-binds them as layout-buttons + * + * @see _create() + */ +, init: function (inst) { + var pre = "ui-layout-button-" + , layout = inst.options.name || "" + , name; + $.each("toggle,open,close,pin,toggle-slide,open-slide".split(","), function (i, action) { + $.each($.layout.buttons.config.borderPanes.split(","), function (ii, pane) { + $("."+pre+action+"-"+pane).each(function(){ + // if button was previously 'bound', data.layoutName was set, but is blank if layout has no 'name' + name = $(this).data("layoutName") || $(this).attr("layoutName"); + if (name == undefined || name === layout) + inst.bindButton(this, action, pane); + }); + }); + }); + } + + /** + * Helper function to validate params received by addButton utilities + * + * Two classes are added to the element, based on the buttonClass... + * The type of button is appended to create the 2nd className: + * - ui-layout-button-pin + * - ui-layout-pane-button-toggle + * - ui-layout-pane-button-open + * - ui-layout-pane-button-close + * + * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" + * @param {string} pane Name of the pane the button is for: 'north', 'south', etc. + * @return {Array.} If both params valid, the element matching 'selector' in a jQuery wrapper - otherwise returns null + */ +, get: function (inst, selector, pane, action) { + var $E = $(selector) + , o = inst.options + , err = o.showErrorMessages + ; + if (!$E.length) { // element not found + if (err) alert(lang.errButton + lang.selector +": "+ selector); + } + else if ($.layout.buttons.config.borderPanes.indexOf(pane) === -1) { // invalid 'pane' sepecified + if (err) alert(lang.errButton + lang.pane +": "+ pane); + $E = $(""); // NO BUTTON + } + else { // VALID + var btn = o[pane].buttonClass +"-"+ action; + $E .addClass( btn +" "+ btn +"-"+ pane ) + .data("layoutName", o.name); // add layout identifier - even if blank! + } + return $E; + } + + + /** + * NEW syntax for binding layout-buttons - will eventually replace addToggle, addOpen, etc. + * + * @param {(string|!Object)} sel jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" + * @param {string} action + * @param {string} pane + */ +, bind: function (inst, sel, action, pane) { + var _ = $.layout.buttons; + switch (action.toLowerCase()) { + case "toggle": _.addToggle (inst, sel, pane); break; + case "open": _.addOpen (inst, sel, pane); break; + case "close": _.addClose (inst, sel, pane); break; + case "pin": _.addPin (inst, sel, pane); break; + case "toggle-slide": _.addToggle (inst, sel, pane, true); break; + case "open-slide": _.addOpen (inst, sel, pane, true); break; + } + return inst; + } + + /** + * Add a custom Toggler button for a pane + * + * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" + * @param {string} pane Name of the pane the button is for: 'north', 'south', etc. + * @param {boolean=} slide true = slide-open, false = pin-open + */ +, addToggle: function (inst, selector, pane, slide) { + $.layout.buttons.get(inst, selector, pane, "toggle") + .click(function(evt){ + inst.toggle(pane, !!slide); + evt.stopPropagation(); + }); + return inst; + } + + /** + * Add a custom Open button for a pane + * + * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" + * @param {string} pane Name of the pane the button is for: 'north', 'south', etc. + * @param {boolean=} slide true = slide-open, false = pin-open + */ +, addOpen: function (inst, selector, pane, slide) { + $.layout.buttons.get(inst, selector, pane, "open") + .attr("title", lang.Open) + .click(function (evt) { + inst.open(pane, !!slide); + evt.stopPropagation(); + }); + return inst; + } + + /** + * Add a custom Close button for a pane + * + * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" + * @param {string} pane Name of the pane the button is for: 'north', 'south', etc. + */ +, addClose: function (inst, selector, pane) { + $.layout.buttons.get(inst, selector, pane, "close") + .attr("title", lang.Close) + .click(function (evt) { + inst.close(pane); + evt.stopPropagation(); + }); + return inst; + } + + /** + * Add a custom Pin button for a pane + * + * Four classes are added to the element, based on the paneClass for the associated pane... + * Assuming the default paneClass and the pin is 'up', these classes are added for a west-pane pin: + * - ui-layout-pane-pin + * - ui-layout-pane-west-pin + * - ui-layout-pane-pin-up + * - ui-layout-pane-west-pin-up + * + * @param {(string|!Object)} selector jQuery selector (or element) for button, eg: ".ui-layout-north .toggle-button" + * @param {string} pane Name of the pane the pin is for: 'north', 'south', etc. + */ +, addPin: function (inst, selector, pane) { + var $E = $.layout.buttons.get(inst, selector, pane, "pin"); + if ($E.length) { + var s = inst.state[pane]; + $E.click(function (evt) { + $.layout.buttons.setPinState(inst, $(this), pane, (s.isSliding || s.isClosed)); + if (s.isSliding || s.isClosed) inst.open( pane ); // change from sliding to open + else inst.close( pane ); // slide-closed + evt.stopPropagation(); + }); + // add up/down pin attributes and classes + $.layout.buttons.setPinState(inst, $E, pane, (!s.isClosed && !s.isSliding)); + // add this pin to the pane data so we can 'sync it' automatically + // PANE.pins key is an array so we can store multiple pins for each pane + s.pins.push( selector ); // just save the selector string + } + return inst; + } + + /** + * Change the class of the pin button to make it look 'up' or 'down' + * + * @see addPin(), syncPins() + * @param {Array.} $Pin The pin-span element in a jQuery wrapper + * @param {string} pane These are the params returned to callbacks by layout() + * @param {boolean} doPin true = set the pin 'down', false = set it 'up' + */ +, setPinState: function (inst, $Pin, pane, doPin) { + var updown = $Pin.attr("pin"); + if (updown && doPin === (updown=="down")) return; // already in correct state + var + pin = inst.options[pane].buttonClass +"-pin" + , side = pin +"-"+ pane + , UP = pin +"-up "+ side +"-up" + , DN = pin +"-down "+side +"-down" + ; + $Pin + .attr("pin", doPin ? "down" : "up") // logic + .attr("title", doPin ? lang.Unpin : lang.Pin) + .removeClass( doPin ? UP : DN ) + .addClass( doPin ? DN : UP ) + ; + } + + /** + * INTERNAL function to sync 'pin buttons' when pane is opened or closed + * Unpinned means the pane is 'sliding' - ie, over-top of the adjacent panes + * + * @see open(), close() + * @param {string} pane These are the params returned to callbacks by layout() + * @param {boolean} doPin True means set the pin 'down', False means 'up' + */ +, syncPinBtns: function (inst, pane, doPin) { + // REAL METHOD IS _INSIDE_ LAYOUT - THIS IS HERE JUST FOR REFERENCE + $.each(state[pane].pins, function (i, selector) { + $.layout.buttons.setPinState(inst, $(selector), pane, doPin); + }); + } + + +, _load: function (inst) { + // ADD Button methods to Layout Instance + $.extend( inst, { + bindButton: function (selector, action, pane) { return $.layout.buttons.bind(inst, selector, action, pane); } + // DEPRECATED METHODS... + , addToggleBtn: function (selector, pane, slide) { return $.layout.buttons.addToggle(inst, selector, pane, slide); } + , addOpenBtn: function (selector, pane, slide) { return $.layout.buttons.addOpen(inst, selector, pane, slide); } + , addCloseBtn: function (selector, pane) { return $.layout.buttons.addClose(inst, selector, pane); } + , addPinBtn: function (selector, pane) { return $.layout.buttons.addPin(inst, selector, pane); } + }); + + // init state array to hold pin-buttons + for (var i=0; i<4; i++) { + var pane = $.layout.buttons.config.borderPanes[i]; + inst.state[pane].pins = []; + } + + // auto-init buttons onLoad if option is enabled + if ( inst.options.autoBindCustomButtons ) + $.layout.buttons.init(inst); + } + +, _unload: function (inst) { + // TODO: unbind all buttons??? + } + +}; + +// add initialization method to Layout's onLoad array of functions +$.layout.onLoad.push( $.layout.buttons._load ); +//$.layout.onUnload.push( $.layout.buttons._unload ); + +})( jQuery ); + + + + +/** + * jquery.layout.browserZoom 1.0 + * $Date: 2015/03/13 22:37:04 $ + * + * Copyright (c) 2012 + * Kevin Dalman (http://allpro.net) + * + * Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html) + * and MIT (http://www.opensource.org/licenses/mit-license.php) licenses. + * + * @requires: UI Layout 1.3.0.rc30.1 or higher + * + * @see: http://groups.google.com/group/jquery-ui-layout + * + * TODO: Extend logic to handle other problematic zooming in browsers + * TODO: Add hotkey/mousewheel bindings to _instantly_ respond to these zoom event + */ +(function ($) { + +// tell Layout that the plugin is available +$.layout.plugins.browserZoom = true; + +$.layout.defaults.browserZoomCheckInterval = 1000; +$.layout.optionsMap.layout.push("browserZoomCheckInterval"); + +/* + * browserZoom methods + */ +$.layout.browserZoom = { + + _init: function (inst) { + // abort if browser does not need this check + if ($.layout.browserZoom.ratio() !== false) + $.layout.browserZoom._setTimer(inst); + } + +, _setTimer: function (inst) { + // abort if layout destroyed or browser does not need this check + if (inst.destroyed) return; + var o = inst.options + , s = inst.state + // don't need check if inst has parentLayout, but check occassionally in case parent destroyed! + // MINIMUM 100ms interval, for performance + , ms = inst.hasParentLayout ? 5000 : Math.max( o.browserZoomCheckInterval, 100 ) + ; + // set the timer + setTimeout(function(){ + if (inst.destroyed || !o.resizeWithWindow) return; + var d = $.layout.browserZoom.ratio(); + if (d !== s.browserZoom) { + s.browserZoom = d; + inst.resizeAll(); + } + // set a NEW timeout + $.layout.browserZoom._setTimer(inst); + } + , ms ); + } + +, ratio: function () { + var w = window + , s = screen + , d = document + , dE = d.documentElement || d.body + , b = $.layout.browser + , v = b.version + , r, sW, cW + ; + // we can ignore all browsers that fire window.resize event onZoom + if (!b.msie || v > 8) + return false; // don't need to track zoom + if (s.deviceXDPI && s.systemXDPI) // syntax compiler hack + return calc(s.deviceXDPI, s.systemXDPI); + // everything below is just for future reference! + if (b.webkit && (r = d.body.getBoundingClientRect)) + return calc((r.left - r.right), d.body.offsetWidth); + if (b.webkit && (sW = w.outerWidth)) + return calc(sW, w.innerWidth); + if ((sW = s.width) && (cW = dE.clientWidth)) + return calc(sW, cW); + return false; // no match, so cannot - or don't need to - track zoom + + function calc (x,y) { return (parseInt(x,10) / parseInt(y,10) * 100).toFixed(); } + } + +}; +// add initialization method to Layout's onLoad array of functions +$.layout.onReady.push( $.layout.browserZoom._init ); + + +})( jQuery ); + + + + +/** + * UI Layout Plugin: Slide-Offscreen Animation + * + * Prevent panes from being 'hidden' so that an iframes/objects + * does not reload/refresh when pane 'opens' again. + * This plug-in adds a new animation called "slideOffscreen". + * It is identical to the normal "slide" effect, but avoids hiding the element + * + * Requires Layout 1.3.0.RC30.1 or later for Close offscreen + * Requires Layout 1.3.0.RC30.5 or later for Hide, initClosed & initHidden offscreen + * + * Version: 1.1 - 2012-11-18 + * Author: Kevin Dalman (kevin@jquery-dev.com) + * @preserve jquery.layout.slideOffscreen-1.1.js + */ +;(function ($) { + +// Add a new "slideOffscreen" effect +if ($.effects) { + + // add an option so initClosed and initHidden will work + $.layout.defaults.panes.useOffscreenClose = false; // user must enable when needed + /* set the new animation as the default for all panes + $.layout.defaults.panes.fxName = "slideOffscreen"; + */ + + if ($.layout.plugins) + $.layout.plugins.effects.slideOffscreen = true; + + // dupe 'slide' effect defaults as new effect defaults + $.layout.effects.slideOffscreen = $.extend(true, {}, $.layout.effects.slide); + + // add new effect to jQuery UI + $.effects.slideOffscreen = function(o) { + return this.queue(function(){ + + var fx = $.effects + , opt = o.options + , $el = $(this) + , pane = $el.data('layoutEdge') + , state = $el.data('parentLayout').state + , dist = state[pane].size + , s = this.style + , props = ['top','bottom','left','right'] + // Set options + , mode = fx.setMode($el, opt.mode || 'show') // Set Mode + , show = (mode == 'show') + , dir = opt.direction || 'left' // Default Direction + , ref = (dir == 'up' || dir == 'down') ? 'top' : 'left' + , pos = (dir == 'up' || dir == 'left') + , offscrn = $.layout.config.offscreenCSS || {} + , keyLR = $.layout.config.offscreenReset + , keyTB = 'offscreenResetTop' // only used internally + , animation = {} + ; + // Animation settings + animation[ref] = (show ? (pos ? '+=' : '-=') : (pos ? '-=' : '+=')) + dist; + + if (show) { // show() animation, so save top/bottom but retain left/right set when 'hidden' + $el.data(keyTB, { top: s.top, bottom: s.bottom }); + + // set the top or left offset in preparation for animation + // Note: ALL animations work by shifting the top or left edges + if (pos) { // top (north) or left (west) + $el.css(ref, isNaN(dist) ? "-" + dist : -dist); // Shift outside the left/top edge + } + else { // bottom (south) or right (east) - shift all the way across container + if (dir === 'right') + $el.css({ left: state.container.layoutWidth, right: 'auto' }); + else // dir === bottom + $el.css({ top: state.container.layoutHeight, bottom: 'auto' }); + } + // restore the left/right setting if is a top/bottom animation + if (ref === 'top') + $el.css( $el.data( keyLR ) || {} ); + } + else { // hide() animation, so save ALL CSS + $el.data(keyTB, { top: s.top, bottom: s.bottom }); + $el.data(keyLR, { left: s.left, right: s.right }); + } + + // Animate + $el.show().animate(animation, { queue: false, duration: o.duration, easing: opt.easing, complete: function(){ + // Restore top/bottom + if ($el.data( keyTB )) + $el.css($el.data( keyTB )).removeData( keyTB ); + if (show) // Restore left/right too + $el.css($el.data( keyLR ) || {}).removeData( keyLR ); + else // Move the pane off-screen (left: -99999, right: 'auto') + $el.css( offscrn ); + + if (o.callback) o.callback.apply(this, arguments); // Callback + $el.dequeue(); + }}); + + }); + }; + +} + +})( jQuery ); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/moment.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/moment.min.js new file mode 100644 index 0000000..62b1697 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/js/moment.min.js @@ -0,0 +1,6 @@ +// moment.js +// version : 2.1.0 +// author : Tim Wood +// license : MIT +// momentjs.com +!function(t){function e(t,e){return function(n){return u(t.call(this,n),e)}}function n(t,e){return function(n){return this.lang().ordinal(t.call(this,n),e)}}function s(){}function i(t){a(this,t)}function r(t){var e=t.years||t.year||t.y||0,n=t.months||t.month||t.M||0,s=t.weeks||t.week||t.w||0,i=t.days||t.day||t.d||0,r=t.hours||t.hour||t.h||0,a=t.minutes||t.minute||t.m||0,o=t.seconds||t.second||t.s||0,u=t.milliseconds||t.millisecond||t.ms||0;this._input=t,this._milliseconds=u+1e3*o+6e4*a+36e5*r,this._days=i+7*s,this._months=n+12*e,this._data={},this._bubble()}function a(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function o(t){return 0>t?Math.ceil(t):Math.floor(t)}function u(t,e){for(var n=t+"";n.lengthn;n++)~~t[n]!==~~e[n]&&r++;return r+i}function f(t){return t?ie[t]||t.toLowerCase().replace(/(.)s$/,"$1"):t}function l(t,e){return e.abbr=t,x[t]||(x[t]=new s),x[t].set(e),x[t]}function _(t){if(!t)return H.fn._lang;if(!x[t]&&A)try{require("./lang/"+t)}catch(e){return H.fn._lang}return x[t]}function m(t){return t.match(/\[.*\]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function y(t){var e,n,s=t.match(E);for(e=0,n=s.length;n>e;e++)s[e]=ue[s[e]]?ue[s[e]]:m(s[e]);return function(i){var r="";for(e=0;n>e;e++)r+=s[e]instanceof Function?s[e].call(i,t):s[e];return r}}function M(t,e){function n(e){return t.lang().longDateFormat(e)||e}for(var s=5;s--&&N.test(e);)e=e.replace(N,n);return re[e]||(re[e]=y(e)),re[e](t)}function g(t,e){switch(t){case"DDDD":return V;case"YYYY":return X;case"YYYYY":return $;case"S":case"SS":case"SSS":case"DDD":return I;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return R;case"a":case"A":return _(e._l)._meridiemParse;case"X":return B;case"Z":case"ZZ":return j;case"T":return q;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return J;default:return new RegExp(t.replace("\\",""))}}function p(t){var e=(j.exec(t)||[])[0],n=(e+"").match(ee)||["-",0,0],s=+(60*n[1])+~~n[2];return"+"===n[0]?-s:s}function D(t,e,n){var s,i=n._a;switch(t){case"M":case"MM":i[1]=null==e?0:~~e-1;break;case"MMM":case"MMMM":s=_(n._l).monthsParse(e),null!=s?i[1]=s:n._isValid=!1;break;case"D":case"DD":case"DDD":case"DDDD":null!=e&&(i[2]=~~e);break;case"YY":i[0]=~~e+(~~e>68?1900:2e3);break;case"YYYY":case"YYYYY":i[0]=~~e;break;case"a":case"A":n._isPm=_(n._l).isPM(e);break;case"H":case"HH":case"h":case"hh":i[3]=~~e;break;case"m":case"mm":i[4]=~~e;break;case"s":case"ss":i[5]=~~e;break;case"S":case"SS":case"SSS":i[6]=~~(1e3*("0."+e));break;case"X":n._d=new Date(1e3*parseFloat(e));break;case"Z":case"ZZ":n._useUTC=!0,n._tzm=p(e)}null==e&&(n._isValid=!1)}function Y(t){var e,n,s=[];if(!t._d){for(e=0;7>e;e++)t._a[e]=s[e]=null==t._a[e]?2===e?1:0:t._a[e];s[3]+=~~((t._tzm||0)/60),s[4]+=~~((t._tzm||0)%60),n=new Date(0),t._useUTC?(n.setUTCFullYear(s[0],s[1],s[2]),n.setUTCHours(s[3],s[4],s[5],s[6])):(n.setFullYear(s[0],s[1],s[2]),n.setHours(s[3],s[4],s[5],s[6])),t._d=n}}function w(t){var e,n,s=t._f.match(E),i=t._i;for(t._a=[],e=0;eo&&(u=o,s=n);a(t,s)}function v(t){var e,n=t._i,s=K.exec(n);if(s){for(t._f="YYYY-MM-DD"+(s[2]||" "),e=0;4>e;e++)if(te[e][1].exec(n)){t._f+=te[e][0];break}j.exec(n)&&(t._f+=" Z"),w(t)}else t._d=new Date(n)}function T(e){var n=e._i,s=G.exec(n);n===t?e._d=new Date:s?e._d=new Date(+s[1]):"string"==typeof n?v(e):d(n)?(e._a=n.slice(0),Y(e)):e._d=n instanceof Date?new Date(+n):new Date(n)}function b(t,e,n,s,i){return i.relativeTime(e||1,!!n,t,s)}function S(t,e,n){var s=W(Math.abs(t)/1e3),i=W(s/60),r=W(i/60),a=W(r/24),o=W(a/365),u=45>s&&["s",s]||1===i&&["m"]||45>i&&["mm",i]||1===r&&["h"]||22>r&&["hh",r]||1===a&&["d"]||25>=a&&["dd",a]||45>=a&&["M"]||345>a&&["MM",W(a/30)]||1===o&&["y"]||["yy",o];return u[2]=e,u[3]=t>0,u[4]=n,b.apply({},u)}function F(t,e,n){var s,i=n-e,r=n-t.day();return r>i&&(r-=7),i-7>r&&(r+=7),s=H(t).add("d",r),{week:Math.ceil(s.dayOfYear()/7),year:s.year()}}function O(t){var e=t._i,n=t._f;return null===e||""===e?null:("string"==typeof e&&(t._i=e=_().preparse(e)),H.isMoment(e)?(t=a({},e),t._d=new Date(+e._d)):n?d(n)?k(t):w(t):T(t),new i(t))}function z(t,e){H.fn[t]=H.fn[t+"s"]=function(t){var n=this._isUTC?"UTC":"";return null!=t?(this._d["set"+n+e](t),H.updateOffset(this),this):this._d["get"+n+e]()}}function C(t){H.duration.fn[t]=function(){return this._data[t]}}function L(t,e){H.duration.fn["as"+t]=function(){return+this/e}}for(var H,P,U="2.1.0",W=Math.round,x={},A="undefined"!=typeof module&&module.exports,G=/^\/?Date\((\-?\d+)/i,Z=/(\-)?(\d*)?\.?(\d+)\:(\d+)\:(\d+)\.?(\d{3})?/,E=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,N=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,J=/\d\d?/,I=/\d{1,3}/,V=/\d{3}/,X=/\d{1,4}/,$=/[+\-]?\d{1,6}/,R=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,j=/Z|[\+\-]\d\d:?\d\d/i,q=/T/i,B=/[\+\-]?\d+(\.\d{1,3})?/,K=/^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,Q="YYYY-MM-DDTHH:mm:ssZ",te=[["HH:mm:ss.S",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],ee=/([\+\-]|\d\d)/gi,ne="Date|Hours|Minutes|Seconds|Milliseconds".split("|"),se={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},ie={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",w:"week",M:"month",y:"year"},re={},ae="DDD w W M D d".split(" "),oe="M D H h m s w W".split(" "),ue={M:function(){return this.month()+1},MMM:function(t){return this.lang().monthsShort(this,t)},MMMM:function(t){return this.lang().months(this,t)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(t){return this.lang().weekdaysMin(this,t)},ddd:function(t){return this.lang().weekdaysShort(this,t)},dddd:function(t){return this.lang().weekdays(this,t)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return u(this.year()%100,2)},YYYY:function(){return u(this.year(),4)},YYYYY:function(){return u(this.year(),5)},gg:function(){return u(this.weekYear()%100,2)},gggg:function(){return this.weekYear()},ggggg:function(){return u(this.weekYear(),5)},GG:function(){return u(this.isoWeekYear()%100,2)},GGGG:function(){return this.isoWeekYear()},GGGGG:function(){return u(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return u(~~(this.milliseconds()/10),2)},SSS:function(){return u(this.milliseconds(),3)},Z:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+u(~~(t/60),2)+":"+u(~~t%60,2)},ZZ:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+u(~~(10*t/6),4)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()}};ae.length;)P=ae.pop(),ue[P+"o"]=n(ue[P],P);for(;oe.length;)P=oe.pop(),ue[P+P]=e(ue[P],2);for(ue.DDDD=e(ue.DDD,3),s.prototype={set:function(t){var e,n;for(n in t)e=t[n],"function"==typeof e?this[n]=e:this["_"+n]=e},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(t){return this._months[t.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(t){return this._monthsShort[t.month()]},monthsParse:function(t){var e,n,s;for(this._monthsParse||(this._monthsParse=[]),e=0;12>e;e++)if(this._monthsParse[e]||(n=H([2e3,e]),s="^"+this.months(n,"")+"|^"+this.monthsShort(n,""),this._monthsParse[e]=new RegExp(s.replace(".",""),"i")),this._monthsParse[e].test(t))return e},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(t){return this._weekdays[t.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(t){return this._weekdaysShort[t.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(t){return this._weekdaysMin[t.day()]},weekdaysParse:function(t){var e,n,s;for(this._weekdaysParse||(this._weekdaysParse=[]),e=0;7>e;e++)if(this._weekdaysParse[e]||(n=H([2e3,1]).day(e),s="^"+this.weekdays(n,"")+"|^"+this.weekdaysShort(n,"")+"|^"+this.weekdaysMin(n,""),this._weekdaysParse[e]=new RegExp(s.replace(".",""),"i")),this._weekdaysParse[e].test(t))return e},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(t){var e=this._longDateFormat[t];return!e&&this._longDateFormat[t.toUpperCase()]&&(e=this._longDateFormat[t.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t]=e),e},isPM:function(t){return"p"===(t+"").toLowerCase()[0]},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(t,e){var n=this._calendar[t];return"function"==typeof n?n.apply(e):n},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(t,e,n,s){var i=this._relativeTime[n];return"function"==typeof i?i(t,e,n,s):i.replace(/%d/i,t)},pastFuture:function(t,e){var n=this._relativeTime[t>0?"future":"past"];return"function"==typeof n?n(e):n.replace(/%s/i,e)},ordinal:function(t){return this._ordinal.replace("%d",t)},_ordinal:"%d",preparse:function(t){return t},postformat:function(t){return t},week:function(t){return F(t,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6}},H=function(t,e,n){return O({_i:t,_f:e,_l:n,_isUTC:!1})},H.utc=function(t,e,n){return O({_useUTC:!0,_isUTC:!0,_l:n,_i:t,_f:e})},H.unix=function(t){return H(1e3*t)},H.duration=function(t,e){var n,s,i=H.isDuration(t),a="number"==typeof t,o=i?t._input:a?{}:t,u=Z.exec(t);return a?e?o[e]=t:o.milliseconds=t:u&&(n="-"===u[1]?-1:1,o={y:0,d:~~u[2]*n,h:~~u[3]*n,m:~~u[4]*n,s:~~u[5]*n,ms:~~u[6]*n}),s=new r(o),i&&t.hasOwnProperty("_lang")&&(s._lang=t._lang),s},H.version=U,H.defaultFormat=Q,H.updateOffset=function(){},H.lang=function(t,e){return t?(e?l(t,e):x[t]||_(t),H.duration.fn._lang=H.fn._lang=_(t),void 0):H.fn._lang._abbr},H.langData=function(t){return t&&t._lang&&t._lang._abbr&&(t=t._lang._abbr),_(t)},H.isMoment=function(t){return t instanceof i},H.isDuration=function(t){return t instanceof r},H.fn=i.prototype={clone:function(){return H(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){return M(H(this).utc(),"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var t=this;return[t.year(),t.month(),t.date(),t.hours(),t.minutes(),t.seconds(),t.milliseconds()]},isValid:function(){return null==this._isValid&&(this._isValid=this._a?!c(this._a,(this._isUTC?H.utc(this._a):H(this._a)).toArray()):!isNaN(this._d.getTime())),!!this._isValid},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(t){var e=M(this,t||H.defaultFormat);return this.lang().postformat(e)},add:function(t,e){var n;return n="string"==typeof t?H.duration(+e,t):H.duration(t,e),h(this,n,1),this},subtract:function(t,e){var n;return n="string"==typeof t?H.duration(+e,t):H.duration(t,e),h(this,n,-1),this},diff:function(t,e,n){var s,i,r=this._isUTC?H(t).zone(this._offset||0):H(t).local(),a=6e4*(this.zone()-r.zone());return e=f(e),"year"===e||"month"===e?(s=432e5*(this.daysInMonth()+r.daysInMonth()),i=12*(this.year()-r.year())+(this.month()-r.month()),i+=(this-H(this).startOf("month")-(r-H(r).startOf("month")))/s,i-=6e4*(this.zone()-H(this).startOf("month").zone()-(r.zone()-H(r).startOf("month").zone()))/s,"year"===e&&(i/=12)):(s=this-r,i="second"===e?s/1e3:"minute"===e?s/6e4:"hour"===e?s/36e5:"day"===e?(s-a)/864e5:"week"===e?(s-a)/6048e5:s),n?i:o(i)},from:function(t,e){return H.duration(this.diff(t)).lang(this.lang()._abbr).humanize(!e)},fromNow:function(t){return this.from(H(),t)},calendar:function(){var t=this.diff(H().startOf("day"),"days",!0),e=-6>t?"sameElse":-1>t?"lastWeek":0>t?"lastDay":1>t?"sameDay":2>t?"nextDay":7>t?"nextWeek":"sameElse";return this.format(this.lang().calendar(e,this))},isLeapYear:function(){var t=this.year();return 0===t%4&&0!==t%100||0===t%400},isDST:function(){return this.zone()+H(t).startOf(e)},isBefore:function(t,e){return e="undefined"!=typeof e?e:"millisecond",+this.clone().startOf(e)<+H(t).startOf(e)},isSame:function(t,e){return e="undefined"!=typeof e?e:"millisecond",+this.clone().startOf(e)===+H(t).startOf(e)},min:function(t){return t=H.apply(null,arguments),this>t?this:t},max:function(t){return t=H.apply(null,arguments),t>this?this:t},zone:function(t){var e=this._offset||0;return null==t?this._isUTC?e:this._d.getTimezoneOffset():("string"==typeof t&&(t=p(t)),Math.abs(t)<16&&(t=60*t),this._offset=t,this._isUTC=!0,e!==t&&h(this,H.duration(e-t,"m"),1,!0),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},daysInMonth:function(){return H.utc([this.year(),this.month()+1,0]).date()},dayOfYear:function(t){var e=W((H(this).startOf("day")-H(this).startOf("year"))/864e5)+1;return null==t?e:this.add("d",t-e)},weekYear:function(t){var e=F(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==t?e:this.add("y",t-e)},isoWeekYear:function(t){var e=F(this,1,4).year;return null==t?e:this.add("y",t-e)},week:function(t){var e=this.lang().week(this);return null==t?e:this.add("d",7*(t-e))},isoWeek:function(t){var e=F(this,1,4).week;return null==t?e:this.add("d",7*(t-e))},weekday:function(t){var e=(this._d.getDay()+7-this.lang()._week.dow)%7;return null==t?e:this.add("d",t-e)},isoWeekday:function(t){return null==t?this.day()||7:this.day(this.day()%7?t:t-7)},lang:function(e){return e===t?this._lang:(this._lang=_(e),this)}},P=0;P.z-cell { + background-color: white; + color: black; + font-weight: bold; +} + +.GridReport tr.z-row td.z-row-inner,tr.z-row,div.z-grid-body div.z-cell,div.z-grid + { + background-color: white; + border-top: none; + border-left: none; + border-right: none; + border-bottom: none; + padding-top: 4px; + padding-bottom: 4px; + padding-left: 6px; + padding-right: 6px; + vertical-align:middle; + border-right-color: #ccc; + border-bottom-color: #ccc; + /*overflow:hidden;*/ +} +.GridReportodd, .GridReportodd > td + { + color: black; background-color: rgb(255,255,204) !important; + } + + +.z-toolbarbutton { + display: inline-block; + height: 24px; + border: 1px solid transparent; + -webkit-border-radius: 3px; + border-radius: 3px; + margin: 0 2px; + padding: 1px 0; + line-height: 14px; + position: relative; + cursor: pointer; + float: right; +} + +.z-paging-input { + font-family:Arial,Sans-serif; + font-size:12px; + font-weight:normal; + font-style:normal; + color:#000; + height:24px; + border:1px solid #8fb9d0; + margin-left:6px; + padding:3px 0; + line-height:20px; + vertical-align:baseline; +} +.z-paging-text { + font-family:Arial,Sans-serif; + font-size:12px; + font-weight:normal; + font-style:normal; + color:#000; + margin-right:12px +} +.z-paging-info { + font-family:Arial,Sans-serif; + font-size:12px; + font-weight:normal; + font-style:normal; + color:#000; + padding:4px 0; + position:absolute; + top:4px; + right:10px; +} +.z-menu-text,.z-menuitem-text { + font-family:"Helvetica Neue",Helvetica,Arial,sans-serif; + font-size:12px; + font-weight:normal; + display:inline-block; + line-height:16px; + text-shadow:0 0px #fff +} +.z-menubar { + border-top: 0px + border-bottom: 0px; +} +.z-column-content { + font-family: Arial,Sans-serif; + font-size: 12px; + color: #fff; + padding: 4px 5px; + line-height: 24px; + overflow: hidden; +} +.z-column-hover { + background: -webkit-linear-gradient(top, #336699 0%, #336699 100%); /* Chrome10+,Safari5.1+ */ + background: linear-gradient(to bottom, #336699 0%, #336699 100%); /* W3C */ +} +/* +.z-row:hover>.z-row-inner, .z-row:hover>.z-cell { +background: #6ba6bf; +background-clip: padding-box; +position: relative;*/ + +.z-messagebox .z-label { + font-family: Arial,Sans-serif; + font-size: 12px; + color: #000; +} + +.z-popup .z-popup-content{ + font-family: Arial,Sans-serif; + font-size: 12px; + font-weight: normal; + font-style: normal; + color: #000; + height: 100%; + padding: 10px; + line-height: 14px; +} + +.z-notification-pointer ~ .z-notification-content { + display:table-cell; + width:150px; + height:50px; + min-height:60px; + ${t:borderRadius('5px') }; + padding:5px 18px 5px 45px; + vertical-align:middle; +} +.z-loading { + background-color:#808080; + border:1px outset #A0A0A0; + font-weight: bold; + padding:2px; +} +.z-loading-indicator { + color: gray; + border:0 none; +} +.z-toolbarbutton-content { + color: #fff; + text-shadow: 0 0px; +} + +.z-groupbox>.z-groupbox-header { + color: #000; +} + +.z-combobox-button, .z-bandbox-button, .z-datebox-button, .z-timebox-button, .z-spinner-button, .z-doublespinner-button { + color: #000; +} + + +/*.z-panel-header { +font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; +font-size: 12px; +font-weight: normal; +font-style: normal; +color: #fff; +border: 0; +padding: 3px 0 5px 0; +line-height: 0px; +background: #369; +overflow: hidden; +zoom: 1; +display: none; +}*/ + + + + .z-menupopup .z-menu-image, .z-menupopup .z-menuitem-image { +min-width: 16px; +min-height: 16px; +margin-right: 9px; +display: none; +} + + + .z-menupopup-separator { +width: 2px; +height: 100%; +border-width: 3px 1px 3px 0; +border-style: solid; +border-color: #d9f0fc; +background: #a2c0ce; +position: absolute; +top: 0; +left: 31px; +z-index: 10; +display: none; +} + + + .z-menupopup-content { +left: 0px; +} + + .z-menu-icon.z-icon-caret-right { +font-size: 15px; +color: red; +} + + + .z-menu-content:hover, .z-menuitem-content:hover { +border-color: #8fb9d0; +background: -webkit-linear-gradient(top, #e2f3fc 0%, #336699 100%); +background: linear-gradient(to bottom, #e2f3fc 0%, #336699 100%); +} + +/*.toolBarRaptor .z-toolbar { + background:white; +} + +.toolBarRaptor .z-menuitem-content { + color:#000; +} + +.toolBarRaptor .z-menuitem-content { + color:#000; +}*/ + +/*.z-caption .z-label { + float: right; +} + +.z-caption-content, .z-caption .z-label { + display: inline-block; + padding: 0; + line-height: 24px; + float: right; +} */ + + + +.ChartPanel .z-panel-head { + border:; +} +.ChartPanel .z-panel-header { +line-height: 12px; +color: #000; +background:; +} +.ChartPanel .z-panel-icon { +color: #000; +display: block; +-webkit-border-radius: ; +border-radius: ; +text-align: left; +overflow: hidden; +cursor: pointer; +float: left; +} + +.ChartPanel .z-panel-icon:hover { + color: ; + border-color: ; + background: 0; +filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); + background:; + float:left; +} + +.ChartPanel .z-panel-expand { +font-size: 9px; +width: 12px; +line-height: 12px; +} + +/*[class^="z-icon-"], [class*=" z-icon-"] {*/ +.ChartPanel .z-icon { +display: inline-block; +font-family: FontAwesome; +font-size: 10px; +font-weight: normal; +font-style: normal; +-webkit-font-smoothing: antialiased; +-moz-osx-font-smoothing: grayscale; +} + +.ChartPanel .z-icon-caret-up:before { + content: "\f068"; +} + +.ChartPanel .z-icon-caret-down:before { + content: "\f067"; +} + +.ie8 .z-column { +background: #369; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/calendar.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/calendar.css new file mode 100644 index 0000000..fdd2242 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/calendar.css @@ -0,0 +1,97 @@ +.TESTcpYearNavigation, +.raptorcpMonthNavigation + { + background-color:#336699; + text-align:center; + vertical-align:center; + text-decoration:none; + color:#FFFFFF; + font-weight:bold; + } +.raptorcpDayColumnHeader, +.raptorcpYearNavigation, +.raptorcpMonthNavigation, +.raptorcpCurrentMonthDate, +.raptorcpCurrentMonthDateDisabled, +.raptorcpOtherMonthDate, +.raptorcpOtherMonthDateDisabled, +.raptorcpCurrentDate, +.raptorcpCurrentDateDisabled, +.raptorcpTodayText, +.raptorcpTodayTextDisabled, +.raptorcpText + { + font-family:arial; + font-size:8pt; + } +TD.raptorcpDayColumnHeader + { + text-align:right; + border:solid thin #336699; + border-width:0 0 1 0; + } +.raptorcpCurrentMonthDate, +.raptorcpOtherMonthDate, +.raptorcpCurrentDate + { + text-align:right; + text-decoration:none; + } +.raptorcpCurrentMonthDateDisabled, +.raptorcpOtherMonthDateDisabled, +.raptorcpCurrentDateDisabled + { + color:#D0D0D0; + text-align:right; + text-decoration:line-through; + } +.raptorcpCurrentMonthDate + { + color:#336699; + font-weight:bold; + } +.raptorcpCurrentDate + { + color: #FFFFFF; + font-weight:bold; + } +.raptorcpOtherMonthDate + { + color:#808080; + } +TD.raptorcpCurrentDate + { + color:#FFFFFF; + background-color: red; + border-width:1; + border:solid thin #000000; + } +TD.raptorcpCurrentDateDisabled + { + border-width:1; + border:solid thin #FFAAAA; + } +TD.raptorcpTodayText, +TD.raptorcpTodayTextDisabled + { + border:solid thin #336699; + border-width:1 0 0 0; + } +A.raptorcpTodayText, +SPAN.raptorcpTodayTextDisabled + { + height:20px; + } +A.raptorcpTodayText + { + color:#336699; + font-weight:bold; + } +SPAN.raptorcpTodayTextDisabled + { + color:#D0D0D0; + } +.raptorcpBorder + { + border:solid thin #336699; + } diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/dashboard.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/dashboard.css new file mode 100644 index 0000000..2c79da2 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/dashboard.css @@ -0,0 +1,36 @@ +#news1{ + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 4pt; + margin: 0px; + background-color:#FFFFDF; + overflow: auto; + } + +#news2{ + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 4pt; + margin: 0px; + background-color:#E2E2E2; + overflow: auto; + } +#news3{ + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 4pt; + margin: 0px; + background-color:#E2E2E2; + overflow: auto; + } + +#news4{ + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 4pt; + margin: 0px; + background-color:#FFFFDF; + overflow: auto; + } + +#superTable { + width: 100%; + height: 100%; + /*table-layout: fixed;*/ +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/drupal.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/drupal.css new file mode 100644 index 0000000..1585079 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/drupal.css @@ -0,0 +1,83 @@ + + +#aggregator .feed-source .feed-title{margin-top:0;}#aggregator .feed-source .feed-image img{margin-bottom:0.75em;}#aggregator .feed-source .feed-icon{float:right;display:block;}#aggregator .feed-item{margin-bottom:1.5em;}#aggregator .feed-item-title{margin-bottom:0;font-size:1.3em;}#aggregator .feed-item-meta,#aggregator .feed-item-body{margin-bottom:0.5em;}#aggregator .feed-item-categories{font-size:0.9em;}#aggregator td{vertical-align:bottom;}#aggregator td.categorize-item{white-space:nowrap;}#aggregator .categorize-item .news-item .body{margin-top:0;}#aggregator .categorize-item h3{margin-bottom:1em;margin-top:0;} + + +.book-navigation .menu{border-top:1px solid #888;padding:1em 0 0 3em;}.book-navigation .page-links{border-top:1px solid #888;border-bottom:1px solid #888;text-align:center;padding:0.5em;}.book-navigation .page-previous{text-align:left;width:42%;display:block;float:left;}.book-navigation .page-up{margin:0 5%;width:4%;display:block;float:left;}.book-navigation .page-next{text-align:right;width:42%;display:block;float:right;}#book-outline{min-width:56em;}.book-outline-form .form-item{margin-top:0;margin-bottom:0;}#edit-book-bid-wrapper .description{clear:both;}#book-admin-edit select{margin-right:24px;}#book-admin-edit select.progress-disabled{margin-right:0;}#book-admin-edit tr.ahah-new-content{background-color:#ffd;}#book-admin-edit .form-item{float:left;} + + +.node-unpublished{background-color:#fff4f4;}.preview .node{background-color:#ffffea;}#node-admin-filter ul{list-style-type:none;padding:0;margin:0;width:100%;}#node-admin-buttons{float:left;margin-left:0.5em;clear:right;}td.revision-current{background:#ffc;}.node-form .form-text{display:block;width:95%;}.node-form .container-inline .form-text{display:inline;width:auto;}.node-form .standard{clear:both;}.node-form textarea{display:block;width:95%;}.node-form .attachments fieldset{float:none;display:block;}.terms-inline{display:inline;} + + + +fieldset{margin-bottom:1em;padding:.5em;}form{margin:0;padding:0;}hr{height:1px;border:1px solid gray;}img{border:0;}table{border-collapse:collapse;}th{text-align:left;padding-right:1em;border-bottom:3px solid #ccc;}.clear-block:after{content:".";display:block;height:0;clear:both;visibility:hidden;}.clear-block{display:inline-block;}/*_\*/ +* html .clear-block{height:1%;}.clear-block{display:block;}/* End hide from IE-mac */ + + + + +body.drag{cursor:move;}th.active img{display:inline;}tr.even,tr.odd{background-color:#eee;border-bottom:1px solid #ccc;padding:0.1em 0.6em;}tr.drag{background-color:#fffff0;}tr.drag-previous{background-color:#ffd;}td.active{background-color:#ddd;}td.checkbox,th.checkbox{text-align:center;}tbody{border-top:1px solid #ccc;}tbody th{border-bottom:1px solid #ccc;}thead th{text-align:left;padding-right:1em;border-bottom:3px solid #ccc;}.breadcrumb{padding-bottom:.5em}div.indentation{width:20px;height:1.7em;margin:-0.4em 0.2em -0.4em -0.4em;padding:0.42em 0 0.42em 0.6em;float:left;}div.tree-child{background:url(/misc/tree.png) no-repeat 11px center;}div.tree-child-last{background:url(/misc/tree-bottom.png) no-repeat 11px center;}div.tree-child-horizontal{background:url(/misc/tree.png) no-repeat -11px center;}.error{color:#e55;}div.error{border:1px solid #d77;}div.error,tr.error{background:#fcc;color:#200;padding:2px;}.warning{color:#e09010;}div.warning{border:1px solid #f0c020;}div.warning,tr.warning{background:#ffd;color:#220;padding:2px;}.ok{color:#008000;}div.ok{border:1px solid #00aa00;}div.ok,tr.ok{background:#dfd;color:#020;padding:2px;}.item-list .icon{color:#555;float:right;padding-left:0.25em;clear:right;}.item-list .title{font-weight:bold;}.item-list ul{margin:0 0 0.75em 0;padding:0;}.item-list ul li{margin:0 0 0.25em 1.5em;padding:0;list-style:disc;}ol.task-list li.active{font-weight:bold;}.form-item{margin-top:1em;margin-bottom:1em;}tr.odd .form-item,tr.even .form-item{margin-top:0;margin-bottom:0;white-space:nowrap;}tr.merge-down,tr.merge-down td,tr.merge-down th{border-bottom-width:0 !important;}tr.merge-up,tr.merge-up td,tr.merge-up th{border-top-width:0 !important;}.form-item input.error,.form-item textarea.error,.form-item select.error{border:2px solid red;}.form-item .description{font-size:0.85em;}.form-item label{display:block;font-weight:bold;}.form-item label.option{display:inline;font-weight:normal;}.form-checkboxes,.form-radios{margin:1em 0;}.form-checkboxes .form-item,.form-radios .form-item{margin-top:0.4em;margin-bottom:0.4em;}.marker,.form-required{color:#f00;}.more-link{text-align:right;}.more-help-link{font-size:0.85em;text-align:right;}.nowrap{white-space:nowrap;}.item-list .pager{clear:both;text-align:center;}.item-list .pager li{background-image:none;display:inline;list-style-type:none;padding:0.5em;}.pager-current{font-weight:bold;}.tips{margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;font-size:0.9em;}dl.multiselect dd.b,dl.multiselect dd.b .form-item,dl.multiselect dd.b select{font-family:inherit;font-size:inherit;width:14em;}dl.multiselect dd.a,dl.multiselect dd.a .form-item{width:8em;}dl.multiselect dt,dl.multiselect dd{float:left;line-height:1.75em;padding:0;margin:0 1em 0 0;}dl.multiselect .form-item{height:1.75em;margin:0;}.container-inline div,.container-inline label{display:inline;}ul.primary{border-collapse:collapse;padding:0 0 0 1em;white-space:nowrap;list-style:none;margin:5px;height:auto;line-height:normal;border-bottom:1px solid #bbb;}ul.primary li{display:inline;}ul.primary li a{background-color:#ddd;border-color:#bbb;border-width:1px;border-style:solid solid none solid;height:auto;margin-right:0.5em;padding:0 1em;text-decoration:none;}ul.primary li.active a{background-color:#fff;border:1px solid #bbb;border-bottom:#fff 1px solid;}ul.primary li a:hover{background-color:#eee;border-color:#ccc;border-bottom-color:#eee;}ul.secondary{border-bottom:1px solid #bbb;padding:0.5em 1em;margin:5px;}ul.secondary li{display:inline;padding:0 1em;border-right:1px solid #ccc;}ul.secondary a{padding:0;text-decoration:none;}ul.secondary a.active{border-bottom:4px solid #999;}#autocomplete{position:absolute;border:1px solid;overflow:hidden;z-index:100;}#autocomplete ul{margin:0;padding:0;list-style:none;}#autocomplete li{background:#fff;color:#000;white-space:pre;cursor:default;}#autocomplete li.selected{background:#0072b9;color:#fff;}html.js input.form-autocomplete{background-image:url(/misc/throbber.gif);background-repeat:no-repeat;background-position:100% 2px;}html.js input.throbbing{background-position:100% -18px;}html.js fieldset.collapsed{border-bottom-width:0;border-left-width:0;border-right-width:0;margin-bottom:0;height:1em;}html.js fieldset.collapsed *{display:none;}html.js fieldset.collapsed legend{display:block;}html.js fieldset.collapsible legend a{padding-left:15px;background:url(/misc/menu-expanded.png) 5px 75% no-repeat;}html.js fieldset.collapsed legend a{background-image:url(/misc/menu-collapsed.png);background-position:5px 50%;}* html.js fieldset.collapsed legend,* html.js fieldset.collapsed legend *,* html.js fieldset.collapsed table *{display:inline;}html.js fieldset.collapsible{position:relative;}html.js fieldset.collapsible legend a{display:block;}html.js fieldset.collapsible .fieldset-wrapper{overflow:auto;}.resizable-textarea{width:95%;}.resizable-textarea .grippie{height:9px;overflow:hidden;background:#eee url(/misc/grippie.png) no-repeat center 2px;border:1px solid #ddd;border-top-width:0;cursor:s-resize;}html.js .resizable-textarea textarea{margin-bottom:0;width:100%;display:block;}.draggable a.tabledrag-handle{cursor:move;float:left;height:1.7em;margin:-0.4em 0 -0.4em -0.5em;padding:0.42em 1.5em 0.42em 0.5em;text-decoration:none;}a.tabledrag-handle:hover{text-decoration:none;}a.tabledrag-handle .handle{margin-top:4px;height:13px;width:13px;background:url(/misc/draggable.png) no-repeat 0 0;}a.tabledrag-handle-hover .handle{background-position:0 -20px;}.joined + .grippie{height:5px;background-position:center 1px;margin-bottom:-2px;}.teaser-checkbox{padding-top:1px;}div.teaser-button-wrapper{float:right;padding-right:5%;margin:0;}.teaser-checkbox div.form-item{float:right;margin:0 5% 0 0;padding:0;}textarea.teaser{display:none;}html.js .no-js{display:none;}.progress{font-weight:bold;}.progress .bar{background:#fff url(/misc/progress.gif);border:1px solid #00375a;height:1.5em;margin:0 0.2em;}.progress .filled{background:#0072b9;height:1em;border-bottom:0.5em solid #004a73;width:0%;}.progress .percentage{float:right;}.progress-disabled{float:left;}.ahah-progress{float:left;}.ahah-progress .throbber{width:15px;height:15px;margin:2px;background:transparent url(/misc/throbber.gif) no-repeat 0px -18px;float:left;}tr .ahah-progress .throbber{margin:0 2px;}.ahah-progress-bar{width:16em;}#first-time strong{display:block;padding:1.5em 0 .5em;}tr.selected td{background:#ffc;}table.sticky-header{margin-top:0;background:#fff;}#clean-url.install{display:none;}html.js .js-hide{display:none;}#system-modules div.incompatible{font-weight:bold;}#system-themes-form div.incompatible{font-weight:bold;}span.password-strength{visibility:hidden;}input.password-field{margin-right:10px;}div.password-description{padding:0 2px;margin:4px 0 0 0;font-size:0.85em;max-width:500px;}div.password-description ul{margin-bottom:0;}.password-parent{margin:0 0 0 0;}input.password-confirm{margin-right:10px;}.confirm-parent{margin:5px 0 0 0;}span.password-confirm{visibility:hidden;}span.password-confirm span{font-weight:normal;} + + +ul.menu{list-style:none;border:none;text-align:left;}ul.menu li{margin:0 0 0 0.5em;}li.expanded{list-style-type:circle;list-style-image:url(/misc/menu-expanded.png);padding:0.2em 0.5em 0 0;margin:0;}li.collapsed{list-style-type:disc;list-style-image:url(/misc/menu-collapsed.png);padding:0.2em 0.5em 0 0;margin:0;}li.leaf{list-style-type:square;list-style-image:url(/misc/menu-leaf.png);padding:0.2em 0.5em 0 0;margin:0;}li a.active{color:#000;}td.menu-disabled{background:#ccc;}ul.links{margin:0;padding:0;}ul.links.inline{display:inline;}ul.links li{display:inline;list-style-type:none;padding:0 0.5em;}.block ul{margin:0;padding:0 0 0.25em 1em;} + + +#permissions td.module{font-weight:bold;}#permissions td.permission{padding-left:1.5em;}#access-rules .access-type,#access-rules .rule-type{margin-right:1em;float:left;}#access-rules .access-type .form-item,#access-rules .rule-type .form-item{margin-top:0;}#access-rules .mask{clear:both;}#user-login-form{text-align:center;}#user-admin-filter ul{list-style-type:none;padding:0;margin:0;width:100%;}#user-admin-buttons{float:left;margin-left:0.5em;clear:right;}#user-admin-settings fieldset .description{font-size:0.85em;padding-bottom:.5em;}.profile{clear:both;margin:1em 0;}.profile .picture{float:right;margin:0 1em 1em 0;}.profile h3{border-bottom:1px solid #ccc;}.profile dl{margin:0 0 1.5em 0;}.profile dt{margin:0 0 0.2em 0;font-weight:bold;}.profile dd{margin:0 0 1em 0;} +div.codeblock{padding:5px;border:1px solid #CCC;background-color:#EEE;} + +.ctools-locked{color:red;border:1px solid red;padding:1em;}.ctools-owns-lock{background:#FFFFDD none repeat scroll 0 0;border:1px solid #F0C020;padding:1em;}a.ctools-ajaxing,input.ctools-ajaxing,button.ctools-ajaxing,select.ctools-ajaxing{padding-right:18px !important;background:url(/sites/all/modules/ctools/images/status-active.gif) right center no-repeat;}div.ctools-ajaxing{float:left;width:18px;background:url(/sites/all/modules/ctools/images/status-active.gif) center center no-repeat;} +.gam-banner{line-height:0;position:absolute;}.gam-holder{margin:0 auto;}.block-google_admanager{line-height:0;} +#html5-user-geolocation-map{width:450px;height:250px;background:url(/sites/all/modules/html5_user_geolocation/world-map.png);position:relative;}#html5-user-geolocation-map-wrapper,#html5-user-geolocation-messages-wrapper .geolocating{display:none;}#html5-user-geolocation-map .dot{position:absolute;border:4px solid #064771;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;margin:-4px -4px -4px -4px;display:none;} + + +#forum .description{font-size:0.9em;margin:0.5em;}#forum td.created,#forum td.posts,#forum td.topics,#forum td.last-reply,#forum td.replies,#forum td.pager{white-space:nowrap;}#forum td.posts,#forum td.topics,#forum td.replies,#forum td.pager{text-align:center;}#forum tr td.forum{padding-left:25px;background-position:2px 2px;background-image:url(/misc/forum-default.png);background-repeat:no-repeat;}#forum tr.new-topics td.forum{background-image:url(/misc/forum-new.png);}#forum div.indent{margin-left:20px;}.forum-topic-navigation{padding:1em 0 0 3em;border-top:1px solid #888;border-bottom:1px solid #888;text-align:center;padding:0.5em;}.forum-topic-navigation .topic-previous{text-align:right;float:left;width:46%;}.forum-topic-navigation .topic-next{text-align:left;float:right;width:46%;} + + +.project table{width:auto;}.project tbody,.project tr{border:0;}.project td{vertical-align:top;padding:0.4em 0.1em;}.project .links{font-size:0.8em;}.project .author{color:#999;font-size:0.8em;}.project .downloads td{border-bottom:1px solid #ccc;padding-bottom:1em;}.project .downloads ul{margin:0px;}.project .downloads li{list-style-type:none;margin:0px;}.project-links-section div{float:left;padding-right:1.2em;width:30%;}#edit-project-goto{width:150px;}.node-form .project-taxonomy-element{float:left;padding-right:2em;}ul.project-terms{padding-left:1.5em;}.project-feed-icon{padding-left:1em;} + + +.node-form .version-elements .form-item{float:left;padding-right:0.8em;margin:0.05em 0.1em;}table.releases{margin-top:.5em;}table.releases .release-title{width:15%;}table.releases .release-date{width:15%;}table.releases .release-size{width:10%;}table.releases .release-links{width:33%;}table.releases .release-status{width:25%;}table.releases .release-icon{width:2%;}.download-table h4{margin-bottom:0.67em;}.download-table-ok tr.odd,.download-table-ok tr.odd td.active,.download-table-ok tr.even,.download-table-ok tr.even td.active,table.releases tr.ok{background-color:#dfd;}.project-release tr.release-update-status-1,.download-table-warning tr.odd,.download-table-warning tr.odd td.active,.download-table-warning tr.even,.download-table-warning tr.even td.active,table.releases tr.warning{background-color:#ffd;}.project-release tr.release-update-status-2,.download-table-error tr.odd,.download-table-error tr.odd td.active,.download-table-error tr.even,.download-table-error tr.even td.active,table.releases tr.error{background-color:#fdd;}.view-project-release-download-table table{width:99%;}.view-project-release-download-table td.views-field-version{width:20%;}.view-project-release-download-table td.views-field-files{width:30%;}.view-project-release-download-table td.views-field-files span.filesize{font-size:80%;}.view-project-release-download-table td.views-field-file-timestamp{width:15%;}.view-project-release-download-table td.views-field-view-node{width:15%;}.view-project-release-download-table td.views-field-update-status{width:20%;}.project-release-files .views-field-filehash{color:#999;} + + + +#project-issue-summary-table{float:left;}#project-issue-summary-links{float:right;}#project-issue-summary-links li{background:none;list-style-type:none;margin-left:0;padding-left:0;}.project-issue .header{font-weight:bold;padding-top:0.5em;}.project-issue .summary table{border-collapse:collapse;width:auto;border:1px;border-style:solid;border-color:#eee;}.project-issue .summary table td{color:#333;background-color:transparent;font-size:90%;padding:0em 1em;border:0;}.project-issue tbody{border:0;}.project-issue .summary table tr{border:0;}.project-issue .node-form div.inline-options .form-item{float:left;padding-right:0.8em;margin:0.05em 0.1em;}.project-issue .node-form div.inline-options{overflow:hidden;}.project-issue .node-form div.inline-options:after{content:".";display:block;height:0;clear:both;visibility:hidden;}.project-issue .node-form fieldset{display:inline-block;width:97%;}.project-issue .node-form #edit-pid,.project-issue .node-form #edit-project-info-pid{width:225px;}table.projects{width:100%;margin-bottom:3em;}table.projects .project-name{width:24%;}table.projects .project-issue-updated{width:15%;}table.projects .project-issues{width:11%;text-align:center;}table.projects .project-issue-links{width:28%;padding-left:0.4em;padding-right:0.4em;text-align:center;}table.projects .project-project-links{width:22%;text-align:center;}table.projects .project-project-links a{white-space:nowrap;}.project-issue .quick-search #edit-projects,.project-issue .quick-search #edit-states{width:150px;}.view-project-issues-project .form-item #edit-filter1,.view-project-issues-project-search .form-item #edit-filter1,#edit-filter2{width:150px;}.view-project-issues-project-search #views-filters{width:100%;overflow:auto;}.project-issue .quick-search tr td .form-item,.project-issue .quick-search tr td input{margin:0;padding:0;}.project-issue .quick-search tr td{vertical-align:bottom;}.project-issue-status-info a,.project-issue-status-info .project-issue-assigned-user{background-color:#cdcdcd;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;padding:2px 4px;}.project-issue-status-info .project-issue-assigned-user{white-space:nowrap;}.project-issue tr.state-1,.project-issue-status-1 a{background-color:#fff;}.project-issue tr.state-1 td.active{background-color:#e1e7eb;}.project-issue tr.state-2,.project-issue-status-2 a{background-color:#c0ffc0;}.project-issue tr.state-2 td.active{background-color:#cec;}.project-issue tr.state-3,.project-issue-status-3 a,.project-issue tr.state-4,.project-issue-status-4 a,.project-issue tr.state-5,.project-issue-status-5 a,.project-issue tr.state-6,.project-issue-status-6 a{background-color:#ddf;}.project-issue tr.state-3 td.active,.project-issue tr.state-4 td.active,.project-issue tr.state-5 td.active,.project-issue tr.state-6 td.active{background-color:#cce;}.project-issue tr.state-7,.project-issue-status-7 a{background-color:#ffc9c9;}.project-issue tr.state-7 td.active{background-color:#eeb9b9;}.project-issue tr.state-8,.project-issue-status-8 a{background-color:#ffd;}.project-issue tr.state-8 td.active{background-color:#eed;}.project-issue tr.state-13,.project-issue-status-13 a{background-color:#ffe7dd;}.project-issue tr.state-13 td.active{background-color:#eed7cc;}.project-issue tr.state-14,.project-issue-status-14 a{background-color:#e7ffdd;}.project-issue tr.state-14 td.active{background-color:#d7eecc;}.project-issue-numeric{text-align:center;}.project-issue-numeric-light{text-align:center;color:#999;}.project-issue-statistics-overview-table{overflow:auto;}.project-issue-status-2,.project-issue-status-3,.project-issue-status-5,.project-issue-status-6,.project-issue-status-7{text-decoration:line-through;}.wrapper-throbber{background:url(/misc/throbber.gif) no-repeat right -18px;width:20px;height:18px;margin-top:20px;float:left;} + + +tr.pift-pass{background-color:#99FF99 !important;}tr.pift-fail{background-color:#FF9999 !important;}tr.pift-retest{background-color:#FFFF77 !important;} + +.views-exposed-form .views-exposed-widget{float:left;padding:.5em 1em 0 0;}.views-exposed-form .views-exposed-widget .form-submit{margin-top:1.6em;}.views-exposed-form .form-item,.views-exposed-form .form-submit{margin-top:0;margin-bottom:0;}.views-exposed-form label{font-weight:bold;}.views-exposed-widgets{margin-bottom:.5em;}html.js a.views-throbbing,html.js span.views-throbbing{background:url(/sites/all/modules/views/images/status-active.gif) no-repeat right center;padding-right:18px;}div.view div.views-admin-links{font-size:xx-small;margin-right:1em;margin-top:1em;}.block div.view div.views-admin-links{margin-top:0;}div.view div.views-admin-links ul{padding-left:0;}div.view div.views-admin-links li a{color:#ccc;}div.view div.views-admin-links li{padding-bottom:2px;z-index:201;}div.view div.views-admin-links-hover a,div.view div.views-admin-links:hover a{color:#000;}div.view div.views-admin-links-hover,div.view div.views-admin-links:hover{background:transparent;;}div.view div.views-admin-links a:before{content:"[";}div.view div.views-admin-links a:after{content:"]";}div.view div.views-hide{display:none;}div.view div.views-hide-hover,div.view:hover div.views-hide{display:block;position:absolute;z-index:200;}div.view:hover div.views-hide{margin-top:-1.5em;}.views-view-grid tbody{border-top:none;} + + + +html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{border:0;background:transparent;font-size:100%;margin:0;padding:0;vertical-align:baseline;}img{border:0;background:transparent;font-size:100%;padding:0;vertical-align:baseline;}body{line-height:1;}ol,ul{list-style:none;}blockquote,q{quotes:none;}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none;}ins{text-decoration:none;}del{text-decoration:line-through;}table{border-collapse:collapse;border-spacing:0;}ul.primary,ul.primary li,ul.primary li.active,ul.secondary,ul.secondary li,ul.secondary li.active{display:inline;}ul.primary,ul.primary li,ul.primary li a,ul.primary li.active a,ul.secondary,ul.secondary li,ul.secondary li a,ul.secondary li.active,ul.secondary li.active a{margin:0;padding:0;border:none;background:none;}.item-list ul li{margin:0;padding:0;list-style:none;list-style-image:none;list-style-position:inherit;list-style-type:none;}.block ul{margin:0;padding:0;} + + +.container-12{margin-left:auto;margin-right:auto;width:960px;}#homebox.column-count-3 .homebox-column-wrapper,.grid-1,.grid-2,.grid-3,.grid-4,.grid-5,.grid-6,.grid-7,.grid-8,.grid-9,.grid-10,.grid-11,.grid-12,.grid-footer{display:inline;float:left;margin-left:10px;margin-right:10px;position:relative;}[dir=rtl] #homebox.column-count-3 .homebox-column-wrapper,[dir=rtl] .grid-1,[dir=rtl] .grid-2,[dir=rtl] .grid-3,[dir=rtl] .grid-4,[dir=rtl] .grid-5,[dir=rtl] .grid-6,[dir=rtl] .grid-7,[dir=rtl] .grid-8,[dir=rtl] .grid-9,[dir=rtl] .grid-10,[dir=rtl] .grid-11,[dir=rtl] .grid-12,[dir=rtl] .grid-footer{float:right;}#homebox.column-count-3 .homebox-column-wrapper-1,.alpha{margin-left:0;}[dir=rtl] #homebox.column-count-3 .homebox-column-wrapper-1,[dir=rtl] .alpha{margin-left:10px;margin-right:0;}#homebox.column-count-3 .homebox-column-wrapper-3,.omega{margin-right:0;}[dir=rtl] #homebox.column-count-3 .homebox-column-wrapper-3,[dir=rtl] .omega{margin-right:10px;margin-left:0;}.grid-1{width:60px;}.grid-2{width:140px;}.grid-3{width:220px;}#homebox.column-count-3 .homebox-column-wrapper,.grid-4{width:300px;}.grid-5{width:380px;}.grid-6{width:460px;}.grid-7{width:540px;}.grid-8{width:620px;}.grid-9{width:700px;}.grid-10{width:780px;}.grid-11{width:860px;}.grid-12{width:940px;}.grid-footer{width:172px;}.clear{clear:both;}.clearleft{clear:left;}.clearright{clear:right;}img.right{clear:right;float:right;margin:0 0 0.692em 20px;}img.left{clear:left;float:left;margin:0 20px 0.692em 0;}img.no-clear{clear:none;}.clear-block:after{clear:both;content:".";display:block;font-size:0;height:0;visibility:hidden;}.clear-block{display:inline-block;}/*_\*/ +* html .clear-block{height:1%;}.clear-block{display:block;}/* End hide from IE/Mac */ + + + + + + +body{color:#222;background-color:#fff;font-size:0.8125em;}body,caption,th,td,input,textarea,select,option,legend,fieldset{font-family:"Lucida Grande","DejaVu Sans","Bitstream Vera Sans",Verdana,Arial,sans-serif;line-height:1.384615em;}h1,h2,h3,h4,.h1,.h2,.h3,.h4{color:#555;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:normal;line-height:1.5em;}h1,.h1{color:#000;font-size:1.846em;line-height:1.25em;margin:1.125em 0 0.375em;}#aggregator .feed-item-title,h2,.h2{font-size:1.615em;line-height:1.286em;margin:0.619em 0 0.238em;}.block h2{margin-top:0;}#profile .name,h3,.h3{font-size:1.231em;line-height:1.125em;margin:1.125em 0 0.563em;}h4,.h4,h5,.h5,h6,.h6{color:#000;font-size:1em;line-height:1.385em;font-weight:bold;}#content h4,#content .h4{margin:0.5em 0 0.166667em;}#content h5,#content .h5{margin:1em 0 0;}#content h6,#content .h6{margin:0.5em 0 0;}p{margin-bottom:0.692em;}a,a:link,a:visited,a:active{color:#0678BE;text-decoration:none;}a:hover,a:focus{color:#0678BE;text-decoration:underline;}code,tt,pre{background-color:#F6F6F2;font-family:"Bitstream Vera Sans Mono",Monaco,"Lucida Console",monospace;font-size:0.9230em;padding:1px;white-space:pre-wrap;} + + +table{margin-bottom:0.5em;}thead th{border-bottom:0;padding:0.25em 0.5em;}th,td{padding:0.25em 0.5em;}th{background:#eaeae1;font-weight:bold;}th span.sort-header{float:left;}.table-sort-asc,.table-sort-desc{padding:0 14px 0 0;}.table-sort-asc{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:right -636px;}.table-sort-desc{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:right -600px;}th a,th a:link,th a:visited{color:#222;}th.active{background:#d7d7c7;}tr.even td.active{background:#e5e5d4;border-bottom:1px solid #D7D7C7;border-top:1px solid #D7D7C7;}tr.odd td.active{background:#eaeae1;}tr.even{background:#EEEEE0;border-bottom:1px solid #D8D8D2;border-top:1px solid #D8D8D2;position:relative;}tr.odd{background-color:#fff;border:0;border-bottom:1px solid #D8D8D2;position:relative;}#forum td > td{border:1px solid #f0f;}#forum ul{padding:0;}#forum .forum.first.last a{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:0 -415px;padding-left:15px;}#forum tr td.container{padding-left:10px;}#forum tr td.container .name{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:0 3px;padding:0px 0 5px 20px;min-width:20px;}#forum div.indent{margin-left:30px;}#forum tr td.forum{background:none;padding:0.25em 0.5em;}#forum tr td.forum .name{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:0 -155px;min-width:20px;}#forum tr td.forum .name,#forum .description{margin:0;padding:0 0 0 20px;}td.icon{margin:5px 0 0 0;}.icon16{width:16px;height:16px;display:block;}.forum-default,.forum-hot{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:0 -155px;}.forum-hot-new,.forum-new{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:0 -410px;}.forum-closed{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:0 -380px;}.forum-sticky{background:transparent url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat;background-position:0 5px;}table.releases tr.ok td{background-color:#F9FFEC;border-bottom:1px solid #EAEAE1;}table.releases tr.release-dev td{background-color:#F6E8E8;border-bottom:1px solid #EBCCCC;}table.releases td{vertical-align:middle;}#content table.releases td ul.links{margin:0;padding:0;}table.releases td.release-icon{padding:0 5px;vertical-align:middle;}table.releases td.release-icon img{display:block;}table.project-issue td{}table tr.notrecommended td{background:#F6E8E8;border-bottom:1px solid #EBCCCC;} + + +#project-solr-browse-projects-form .results-count{border-bottom:1px solid #DDDDDD;margin:0 0 1em 0;padding-bottom:0.5em;} + + + + + +#skip-links a,#skip-links a:link,#skip-links a:visited,#skip-links a:hover{height:1px;left:0;overflow:hidden;position:absolute;top:-500px;width:1px;}#skip-links a:active,#skip-links a:focus{position:static;height:auto;width:auto;}blockquote{background:#fff url(/sites/all/themes/bluecheese/images/blockquote-66.png) no-repeat 0 0;margin:1.384em 40px 1.384em 20px;padding-left:30px;}acronym{border-bottom:1px dotted #666;}sub{font-size:0.923em;text-align:sub;}small{font-size:0.923em;}#column-left{z-index:1;}#content-top-region,#content,#content-bottom-region,#column-right-region{margin-bottom:13px;}#header,#footer,#page{min-width:960px;}#header{background-color:#56B3E6;height:10.846153em;}#header-content{position:relative;z-index:2;height:6.69230769em;}body.drupalorg-front #header{height:22.153846em;}body.drupalorg-front #header-content{height:18em;}#drupalorg-site-status{background-color:#D32101;color:#FFF;padding:0.5em;text-align:center;position:relative;-moz-box-shadow:0 2px 2px 1px rgba(68,68,68,0.5);-webkit-box-shadow:0 2px 2px 1px rgba(68,68,68,0.5);box-shadow:0 2px 2px 1px rgba(68,68,68,0.5);z-index:1;}#drupalorg-site-status a{color:#FFF;text-decoration:underline;}h1#site-name{margin:0;}#site-name a{display:block;height:63px;overflow:hidden;text-indent:-999em;width:181px;}#site-name a:focus,#site-name a:active{outline:#FFF dotted thin;}#header-left h2{color:#FFF;font-size:1.6153em;font-weight:lighter;margin:24px 0 12px 0;}#header-left-inner a{color:#fff;}.standfirst{font-size:1em;height:6.15384em;line-height:1.538461em;margin-top:0.5em;overflow:auto;}#header-right-inner{margin-top:46px;}#page{margin-bottom:30px;}#page-subtitle{margin-top:0;}.breadcrumb{padding-bottom:0;}#page-tools{margin:0.692em 0 0;float:right;text-align:right;}#page-tools li{display:block;padding:0;}#page-tools a{color:#96BC44;}#footer{background-color:#F6F6F2;font-size:0.92307em;line-height:1.5em;padding:30px 0 20px;}#footer-region li.first a{color:#222;}#footer-region .grid-footer:hover li.first a,#footer-region li.first a:hover{color:#0678BE;}#footer-message{border-top:1px solid #E2E2DF;margin-top:50px;padding-top:10px;}#footer-message-inner{color:#666;text-align:center;}#search-theme-form{float:right;vertical-align:middle;}#edit-search-theme-form-1-wrapper{display:inline;margin-bottom:0;}#edit-search-theme-form-1{background-color:#FFF;border:3px solid #1885C8;color:#999;float:left;font-size:0.92307em;min-height:18px;line-height:1.61538em;margin:0 5px 0 0;padding:8px 10px 8px 30px;width:229px;}#edit-search-theme-form-1-wrapper input.has-value,body.front #edit-search-theme-form-1-wrapper input{color:#222;font-size:1.0769em;}#edit-search-theme-form-1:focus{outline:#E4E4E4 solid 2px;}#edit-search-theme-form-1-wrapper label{display:none;}.drupalorg-front #edit-search-theme-form-1-wrapper label{color:#FFF;display:block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:1.61538em;font-weight:lighter;margin:0 0 .5em 0;}#search-theme-form-advanced{clear:left;display:none;float:left;margin-top:-3px;width:275px;}#search-theme-form-advanced fieldset{border:0;line-height:1.538461em;margin:0;padding:0;}.drupalorg-front #search-theme-form-advanced{display:block;margin:9px 0 0 3px;}#search-theme-form-advanced{display:none;}html.js #search-theme-form-advanced{display:block;}#search-theme-form-advanced fieldset.collapsible{background:url(/sites/all/themes/bluecheese/images/search-bottom.png) 0 100% no-repeat;border:0;margin:0;padding:0;padding-bottom:12px;}#search-theme-form-advanced fieldset.collapsed{background:transparent;}#search-theme-form-advanced fieldset.collapsible .fieldset-wrapper{background-color:#0678BE;padding:2em 10px 0;}#search-theme-form-advanced fieldset.collapsed .fieldset-wrapper{background-color:transparent;}#search-theme-form-advanced fieldset.collapsible .form-radios{border:0;color:#FFF;}html.js #search-theme-form-advanced fieldset.collapsible .fieldset-wrapper{overflow:visible;float:left;}#search-theme-form-advanced legend{margin:0;height:1.538461em;line-height:1.538461em;}#search-theme-form-advanced fieldset.collapsible legend{height:auto;position:absolute;right:0;top:4px;}#search-theme-form-advanced fieldset.collapsible legend a{color:#000;padding:0 16px 0 0;text-decoration:none;}#search-theme-form-advanced fieldset.collapsible legend a:hover{text-decoration:underline;}#search-theme-form-advanced fieldset.collapsible legend a:focus{outline:none;}#search-theme-form-advanced .form-radios,#search-theme-form-advanced .form-radios .form-item{margin:0;float:left;}#search-theme-form-advanced .form-radios{padding-top:0;width:275px;position:relative;}#search-theme-form-advanced fieldset.collapsible .form-radios{width:255px;}#search-theme-form-advanced .form-radios .form-item{min-height:1.538461em;width:135px;}#search-theme-form-advanced fieldset.collapsible .form-radios .form-item{font-size:0.923076em;width:127px;}#search-theme-form-advanced .form-radios .form-divider{float:left;width:127px;}#search-theme-form-advanced .form-radios .form-item input{margin:0;}#search-theme-form-advanced .form-radios label{color:#FFF;}#search-theme-form-submit{display:inline;margin-top:3px;}.page-search h1{background-color:#F6F6F2;color:#555555;font-size:1.38461em;padding:10px;}.page-search h1 em{font-style:normal;font-weight:bold;}.page-search #project-solr-browse-projects-form{background:none;margin-bottom:1em;padding:0;}.page-search #project-solr-browse-projects-form label{font-weight:normal;}.page-search #drupalorg-search-sort-form{margin-bottom:1em;}.page-search #drupalorg-search-sort-form .form-item{margin-top:0;}.page-search #edit-solrsort-wrapper label,.page-search #edit-solrsort-wrapper select{display:inline;font-weight:normal;margin:0 10px 0 0;}.page-search #edit-solrsort-wrapper{margin-right:0;}.search-results dd{padding-left:0;}.search-results .search-info{color:#666;font-size:0.92307em;}.search-results dt{font-size:1em;}.page-search #column-right .block{background:none;}.page-search #column-right .item-list ul{list-style-image:none;list-style-position:outside;list-style-type:none;margin-left:-10px;}.page-search #column-right .item-list ul li{list-style-type:none;margin-bottom:3px;margin-left:0;}#block-drupalorg_news-news-terms ul.links li a,.page-search #column-right .item-list ul li a{color:#0678BE;padding:0.153846em 0.384615em 0.230769em 1em;}.page-search #column-right .item-list ul li a.selected,.page-search #column-right .item-list ul li a:hover,#block-drupalorg_news-news-terms ul.links li a.active,#block-drupalorg_news-news-terms ul.links li a:hover,#block-drupalorg_news-news-terms ul.links li a:focus{background-color:#666;color:#fff;text-decoration:none;}.page-search #drupalorg-search-block-form .form-text{height:1.5em;width:150px;}.page-search #content-top-region form.drupalorgSearch-processed input[type=submit]{display:none;}#autocomplete{background-color:#FFF;}#content #autocomplete ul{padding-left:5px;}#content #autocomplete ul li{list-style-type:none;}div#page-title{margin-top:1.048em;}#nav-header{font-size:0.923076em;}#nav-header ul{background:#064771;float:right;padding:0 0.75em 0 0.75em;}#nav-header ul li{float:left;margin:0.333333em 0.833333em;}#nav-header ul li a{color:#FFF;}#nav-header ul li a:hover,#nav-header ul li a:focus{color:#A5E2FF;text-decoration:none;}#nav-masthead{display:block;float:left;position:relative;z-index:1;}#nav-masthead ul li{list-style:none;float:left;font-size:0.923076em;margin:0;padding:0 0.615384em;}#nav-masthead ul li a{color:#FFF;display:block;float:left;margin:0;padding:0.416666em .75em 0.416666em 0;text-decoration:none;}#nav-masthead ul li.active a,#nav-masthead ul li:hover a,#nav-masthead ul li:focus a{color:#000;}#userinfo{float:left;margin:5px 0 0 .75em;}#userinfo a{color:#FFF;font-size:0.92307em;margin:0 1em 0 0;text-decoration:none;}#nav-content ul{border-bottom:1px solid #DDD;float:left;margin-bottom:1.154em;width:100%;}#nav-content ul li{float:left;margin-bottom:-1px;padding:4px 12px 5px 12px;position:relative;}#nav-content ul li a:hover,#nav-content ul li a:focus,#nav-content ul li.active-parent a{color:#000;text-decoration:none;}#nav-content ul li.active,#nav-content ul li.active-parent{background-color:transparent;border:none;}#nav-content ul li.active a:hover,#nav-content ul li.active a:focus{text-decoration:none;}#nav-content li.active,#nav-content li.active-parent{padding:0 0 0 0.384615em;}#nav-content li.active a.active,#nav-content li.active-parent a{display:block;padding:0.307692em 0.692307em 0.846153em 0.230769em;}.ui-tabs-nav{width:100%;float:left;border-bottom:1px solid #BFBFBA;}.ui-tabs-nav li{float:left;padding:0 0 0 10px;position:relative;margin-bottom:-1px;}.ui-tabs-nav a{color:#27537A;display:block;float:left;height:25px;padding:6px 11px 0 0;}.ui-tabs-nav li.ui-tabs-selected a{color:#000;}.ui-tabs-nav li a:hover,.ui-tabs-nav li a:focus{text-decoration:none;}.ui-tabs-hide{display:none;}.ui-tabs-nav a:active{outline:none;}.ui-tabs-nav .icon{display:inline-block;height:13px;margin-right:3px;width:11px;}#content .ui-tabs-panel h6{margin:0;}#tabs{margin-bottom:20px;}#tabs ul.tabs{display:block;}#tabs ul.tabs li{float:left;margin-right:5px;}#tabs ul.tabs li a{color:#96BC44;display:block;float:left;}#tabs ul.tabs li a:hover,#tabs ul.tabs li a:focus{background:#96BC44;color:#FFF;text-decoration:none;}#tabs ul.tabs li.active{}#tabs ul.tabs li.active a{background:#96BC44;color:#FFF;}#tabs ul.tabs li.active a:hover,#tabs ul.tabs li.active a:focus{}#tabs ul.primary{height:23px;}#tabs ul.primary li{}#tabs ul.primary li a{padding:0.230769em 0.615384em;}#tabs ul.primary li.parent-active{}#tabs ul.primary li.parent-active a{background:#E6FCB6;height:20px;}#tabs ul.primary li.parent-active a:hover{background:#96BC44;}#tabs ul.secondary{background:#E6FCB6;font-size:0.92307em;height:22px;}#tabs ul.secondary li{}#tabs ul.secondary li a{height:20px;padding:2px 10px 0 10px;}#content ul,ol{margin-bottom:0.692em;padding-left:2em;}#content [dir=rtl] ul,[dir=rtl] ol{padding-left:0;padding-right:2em;}ol{list-style:decimal outside;}.block ol{list-style:none;padding-left:0;}#content .profile ul,#homebox ul,#homebox ol{margin-bottom:0;padding-left:0;}#content ul{list-style-type:disc;}#node-type-page #content ul{list-style-type:none;}#content .item-list ul.flat,#content .item-list ul.links,#content .item-list ul.flat li,#content .item-list ul.links li,#content ul.flat,#content ul.links,#content ul.flat li,#content ul.links li{list-style-type:none;list-style-image:none;margin-left:0;padding-left:0;}#content .node,#aggregator .feed-item{margin-bottom:1.385em;}#content .sticky{background-color:#F6F6F2;padding:10px;}#content .sticky h2.node-title{margin-top:0;}#content .comment h3.comment-title{word-spacing:0.2em;color:#888;margin-bottom:0;}#content .comment h3.comment-title a{word-spacing:normal;}#content .submitted,#content .modified,#aggregator .feed-item-meta,#content .comment .links{color:#666;font-size:0.923em;line-height:1.5em;margin-bottom:0.75em;}#content .comment .links{float:right;}#aggregator .feed-item-date{font-style:italic;}body.page-node #content .tabs{float:right;}body.page-node #content .tabs ul.tabs li{float:left;display:block;font-size:0.92307em;margin:0 5px;padding:1px 4px;text-decoration:none;}body.page-node #content .tabs ul.tabs li.active{display:none;}.feed-source,#content .node-footer,#aggregator .feed-item-categories,.user-signature,#block-drupalorg_handbook-license{color:#666;font-size:0.92307em;}#content .item-list .pager{padding:1em 0 0;text-align:left;}.item-list ul.pager li{margin:0;padding:0 5px;}.pager li.first{padding:0;}ul.pager a{color:#2E6AB1;}.pager li.pager-current{background-color:#2E6AB1;color:#FFF;}.forum-topic-navigation{margin-bottom:10px;}.book-navigation{clear:both;}.book-navigation ul.menu{border-top:1px solid #E1E1DB;display:block;padding-bottom:.5em;}.book-navigation .page-links{border-top:1px solid #E1E1DB;border-bottom:1px solid #E1E1DB;margin-bottom:20px;}#column-right .block{background:#F6F6F2;}#column-right .block-inner{padding:1em;}.profile .item-list li,#column-right .block .item-list li,#homebox .block .item-list li{line-height:1.2em;margin-bottom:0.6em;}.front .block-content h4{clear:both;font-weight:bold;}.front .block-content .front-get-started{border:1px solid #DDD;border-width:1px 0;margin:1em 0;padding:20px 0;text-align:center;}.front #content .block-content ul{list-style:none;padding-left:0;}#front-middle-inner .block-content{margin-top:1.846em;height:5.538461em;padding:1.385em 0 0 64px;}#front-drupal-stats{border-top:1px solid #EEE;color:#9D9D93;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:1.846em;font-weight:lighter;line-height:1.5em;padding-top:5px;padding-left:16px;}#front-drupal-stats em{font-style:normal;color:#55554A;}#block-project-5 p.date{color:#666;font-size:0.92307em;}#cvs ul{margin:0 0 0.5em 0;padding:0;}#cvs ul,#cvs li{list-style:none;}#cvs li div.title{color:#555;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:1em;font-weight:bold;margin:0 0 0.5em 0;}#cvs li div.files{margin:0 0 0.5em 0;}#cvs li div.description{border-bottom:1px solid #E1E1DB;margin:0 0 2em 0;padding:0 0 1em 0;}#block-cvs-cvs_project_maintainers div.cvs-commit-times{color:#666;font-size:0.92307em;margin-bottom:0.5em;}#block-cvs-cvs_project_maintainers span.cvs-commits{white-space:nowrap;}.block ul.menu{padding:0 0 0.25em 1em;}#block-user-1 .h2{overflow:hidden;}.node-type-project-issue .comment-inner{margin-left:40px;}.node-type-project-issue #content h3.comment-title{float:left;font-size:1.1538em;margin-left:-40px;}.node-type-project-issue #content .comment .submitted{padding-top:1.4em;}.node-type-project-issue #content .comment .submitted a{font-size:1.2307em;}.comment .new{background-color:#E6FCB6;padding:1px 6px 2px;}.comment .picture{float:left;margin:0 1.5em 1.5em 0;}.comment-with-picture .content{margin-left:5.5em;}.node .picture{float:right;margin:0 1.5em 1.5em 0;}.indented{margin-left:30px;}.indented .indented .indented .indented{margin-left:0;}dl{margin-bottom:0.692em;}dt{font-weight:bold;margin:0.692em 0 0;}dl.documentation{margin-bottom:0;}dl.documentation dt{font-size:1.23076em;margin-top:0.563em;}a.all{font-weight:bold;}.narrow-box{margin-bottom:18px;padding:18px;}.narrow-box ul{padding-left:0!important;}.narrow-box ul li{list-style-type:none;}.narrow-box a.link-button{margin:20px 0 15px 0;}.narrow-box a.link-button span{font-size:0.92307em;white-space:nowrap;}.narrow-box-list{margin-bottom:1.5em;}#getting-started img{float:left;}a.action-button{display:inline-block;color:#fff;background:#9fc748;padding:0.643em 1.5em;font-size:1.077em;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;}a.action-button:hover{text-decoration:none;background:#8aaf3c;}#download h2,#content .drupal-modules-facets h2{margin-top:0;}#download .core ul li.download-core{margin-bottom:1.5em;}#content li.more a,#content li.more a:link,#content li.more a:visited,#content li.more a:active,#content li.all a,#content li.all a:link,#content li.all a:visited,#content li.all a:active{font-weight:bold;}#project-solr-version-form{margin-bottom:1em;}#edit-drupal-core-wrapper,#project-solr-version-form label,#project-solr-version-form select,#project-solr-version-form .form-submit{float:left;font-weight:normal;margin:0 10px 0 0;}#edit-drupal-core-wrapper{margin-right:0;}#project-solr-version-form .form-submit{padding:0 3px;}.feed-item-categories a,.feed-item-categories a:link,.feed-item-categories a:visited,.terms a,.terms a:link,.terms a:visited{background-color:#EEE;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;color:#666;display:inline-block;margin:3px 0;padding:3px 5px;text-decoration:none;}.feed-item-categories a:hover,.feed-item-categories a:active,.feed-item-categories a:focus,.terms a:hover,.terms a:active,.terms a:focus{background-color:#999;color:#FFF;}div.codeblock{background-color:#F6F6F2;margin-bottom:.5em;}.meta{background:#fffbd9;border-color:#ffebc5;border-style:solid none;border-width:1px;color:#666;font-size:0.92307em;margin:0.5em 0 1em;padding:0.5em 1em;}#content .meta h5{margin:0;}#page ul ul li{margin-left:1em;}#content .meta ul{list-style-type:none;margin:0;padding:0;}.profile{clear:none;margin-top:0;margin-bottom:0.692em;}.profile.alpha{clear:left;}.profile h3{border-bottom:none;clear:left;}.profile dl{margin:0;}.profile dt{clear:left;margin:0 10px 0 0;}.profile dd{margin-bottom:0.692em;}.profile .picture{float:right;margin-top:6px;}a.link-button{color:#FFF;display:inline-block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:1.38461em;height:36px;overflow:hidden;padding-left:1em;text-align:center;}a.link-button:focus,a.link-button:active{outline:#000 dotted thin;}a.link-button:hover{text-decoration:none;}.link-button span{cursor:pointer;display:inline-block;line-height:36px;padding:0 1em 0 0;}input.default{color:#888;}div.help,div.messages,div.warning{border:none;min-height:1em;padding:1em 1em 1em 3.5em;}div.help a,div.messages a,div.warning a{font-weight:bold;}#content div.help ul,#content div.messages ul{margin-bottom:1em;margin-left:0;padding:0;}#content div.help ul li,#content div.messages ul li{margin-bottom:.25em;}div.help{background:rgb(205,228,242) url(/sites/all/themes/bluecheese/images/icon-help.gif) 10px 14px no-repeat;margin-bottom:20px;}div.help ul li{list-style-image:url(/sites/all/themes/bluecheese/images/bullet-dot-blue.png);}div.more-help-link{margin-bottom:.5em;}div.messages,div.warning{margin-bottom:10px;}div.messages-multiple{padding-bottom:0;padding-left:4.5em;}div.messages-status{background:rgb(212,239,204) url(/sites/all/themes/bluecheese/images/icon-success.png) 10px 14px no-repeat;}div.messages-status ul li{list-style-image:url(/sites/all/themes/bluecheese/images/bullet-dot-green.png);}div.messages-warning,div.warning{background:#E6FCB6 url(/sites/all/themes/bluecheese/images/icon-warning.gif) 10px 14px no-repeat;}div.messages-warning ul li{list-style-image:url(/sites/all/themes/bluecheese/images/bullet-dot-yellow.png);}div.messages-error{background:#EBCCCC url(/sites/all/themes/bluecheese/images/icon-error.png) 10px 14px no-repeat;}div.messages-error ul li{list-style-image:url(/sites/all/themes/bluecheese/images/bullet-dot-red.png);}div.warning{margin-top:20px;}span.warning{color:rgb(227,144,27);margin-left:.5em;}div.warning span.warning{display:none;}tr.drag-previous{background:#E6FCB6;}.image-tags span{background-color:#49A9E4;display:inline-block;font-size:.6em;line-height:18px;padding-left:4px;}.image-tags span a{color:#FFF;display:inline-block;line-height:18px;padding-right:4px;}.source-tags .source-tag-688{background-color:#9FCA44;}.source-tags .source-tag-689{background-color:#EEE;}.source-tags .source-tag-689 a{color:#666;}.image-tags span:hover{background-color:#044771;}.image-tags span:hover a{text-decoration:none;}.source-tags span.source-tag-688:hover{background-color:#688A1F;}.source-tags span.source-tag-689:hover{background-color:#999;}.source-tags .source-tag-689 a:hover{color:#FFF;}.feature-tags span{background-color:#EBE3A4;color:#000;}.feature-tags span a{color:#000;}.feature-tags span:hover{background-color:#E9B538;}.feature-tags span:hover a{color:#FFF;}h2 .image-tags span{margin-left:1em;}.aggregator-promote-link{text-align:center;width:120px;padding:2px 0;}.aggregator-promote-link a{color:#96BC44;}.aggregator-promote-link:hover{background-color:#96BC44;}.aggregator-promote-link a:hover{color:#FFF;text-decoration:none;}#block-drupalorg_news-news-terms .block-inner{padding-left:3px;}#column-right #block-block-40,#column-right #block-drupalorg-drupalorg_activity,#block-drupalorg_news-news-terms.block{background-color:#FFF;}#block-drupalorg_news-news-terms h2{margin-bottom:.5em;}#block-drupalorg_news-news-terms ul.links{margin-left:-10px;}#block-drupalorg_news-news-terms ul.links li{display:list-item;margin-bottom:4px;}#about-features h3{font:bold 1em "Lucida Grande",Helvetica,Arial,sans-serif;text-transform:uppercase;}#about-features h3 a{display:block;padding:4px 0 0 70px;min-height:50px;}.node-section{border-bottom:1px solid #D8D8D2;padding-bottom:0.692em;}.comment{margin-top:0.692em;border-top:1px solid #D8D8D2;}.node-footer-section h3{margin:1em 0 .5em;}.aboutsmall{color:#555;font-size:0.92307em;}#content .aboutsmall ul{list-style:none;margin-bottom:1.5em;padding-left:0;}.aboutsmall dd{padding-left:0;}.aboutsmall h3{border-top:1px solid #DDD;margin-top:1em;padding-top:1em;}.aboutsmall .link-button{float:left;margin:1em 0;}.aboutsmall strong,.aboutsmall dt{color:#555;}.drupalorg-front #page{margin-top:1.385em;}.homepage-map{background:url(/sites/all/themes/bluecheese/images/world-map.png);height:250px;position:relative;width:450px;white-space:nowrap;}.homepage-map .homepage-pin{position:absolute;width:10px;height:10px;display:none;margin:0 0 -5px -5px;}.homepage-map .homepage-pin .latitude,.homepage-map .homepage-pin .longitude{display:none;}.homepage-map .homepage-pin .content{background:#fff;position:absolute;border:1px solid #bfbfba;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;padding:1px 4px;bottom:11px;}.homepage-map .homepage-pin-east .content{right:-40px;}.homepage-map .homepage-pin-west .content{left:-40px;}.homepage-map .homepage-pin .content:after{content:' ';display:block;position:absolute;width:12px;height:10px;bottom:-10px;background:url(/sites/all/themes/bluecheese/images/small-icons.png) no-repeat 0 -734px;}.homepage-map .homepage-pin-east .content:after{right:39px;}.homepage-map .homepage-pin-west .content:after{left:37px;}.homepage-map .drupalcon a{font-weight:bold;color:#d32101;}div.things-we-made-wrapper{width:300px;overflow:hidden;margin:0 0 1em 0;}#project-overview .project{border-bottom:1px solid #E1E1DB;margin-bottom:20px;padding-bottom:20px;}#project-overview .image-attach-teaser{float:right;margin:0 0 20px 20px;}#project-overview .image-attach-teaser img{border:1px solid #9D9D93;display:block;}#project-overview ul.project-meta li{color:#666;font-size:0.92307em;margin-bottom:0;}#project-overview .links{font-size:1em;}#content #project-overview .project ul,#content #project-overview .project ol{overflow:auto;}#project-solr-browse-projects-form{background-color:#F6F6F2;margin:0 0 20px 0;padding:10px;}#project-solr-browse-projects-form .form-item,#project-solr-browse-projects-form #edit-submit,#project-solr-browse-projects-form #edit-submit-2{float:none;}#project-solr-browse-projects-form #edit-submit,#project-solr-browse-projects-form #edit-submit-2{margin-bottom:0;}#project-solr-browse-projects-form .form-item>*{display:inline;}.project-links-section div{margin:1em 0;}#content .project-links-section ul{margin-left:0;padding-left:0;}body .project-issue tr.odd,body .project-issue tr.even{background:none;border:none;}table{border-collapse:separate;}.project-issue tr td,.project-issue tr td.active{background-color:#F9F9F9;border-bottom:1px solid #D8D8D2;border-top:2px solid #CCC;}.project-issue tr td.active{background-color:#FFF;border-top:2px solid #939393;}.project-issue tr.state-1 td{background-color:#F9F9F9;border-top:2px solid #ccc;}.project-issue tr.state-1 td.active{background-color:#FFF;border-top:2px solid #939393;}.project-issue tr.state-2 td{background-color:#D7FFD8;border-top:2px solid #A8FF98;}.project-issue tr.state-2 td.active{background-color:#EDFFEC;border-top:2px solid #96bc44;}.project-issue tr.state-3 td,.project-issue tr.state-4 td,.project-issue tr.state-5 td,.project-issue tr.state-6 td,.project-issue tr.state-16 td{background-color:#EFF1FE;border-top:2px solid #B5C4FE;}.project-issue tr.state-3 td.active,.project-issue tr.state-4 td.active,.project-issue tr.state-5 td.active,.project-issue tr.state-6 td.active,.project-issue tr.state-16 td.active{background-color:#F2F4FE;border-top:2px solid #4988FE;}.project-issue tr.state-7 td,.project-issue tr.state-18 td{background-color:#FDDDDD;border-top:2px solid #FC8596;}.project-issue tr.state-7 td.active,.project-issue tr.state-18 td.active{background-color:#FDEBED;border-top:2px solid #FC2843;}.project-issue tr.state-8 td{background-color:#FFFFDD;border-top:2px solid #FFCF73;}.project-issue tr.state-8 td.active{background-color:#FEFFEC;border-top:2px solid #FFB404;}.project-issue tr.state-13 td{background-color:#FFECE8;border-top:2px solid #FFDCCD;}.project-issue tr.state-13 td.active{background-color:#FFF6F6;border-top:2px solid #FFBCA4;}.project-issue tr.state-14 td,.project-issue tr.state-15 td{background-color:#F1FFE8;border-top:2px solid #BCFFB3;}.project-issue tr.state-14 td.active,.project-issue tr.state-15 td.active{background-color:#F8FFF1;border-top:2px solid #93FF88;}#block-project_issue-issue_cockpit .block-inner,#block-cvs-cvs_project_maintainers .block-inner{margin:0;}#block-project_issue-issue_cockpit .block-content,#homebox-block-project_issue_issue_cockpit .portlet-content{color:#888;}form#project-issue-issue-cockpit-searchbox,.issue-cockpit-categories,.issue-cockpit-subscribe,.issue-cockpit-statistics,.issue-cockpit-oldest{color:#222;}form#project-issue-issue-cockpit-searchbox{margin-bottom:0.5em;margin-top:0.5em;}form#project-issue-issue-cockpit-searchbox .form-item{float:left;margin:0 10px 0.5em 0;}form#project-issue-issue-cockpit-searchbox a{clear:left;display:block;}#block-project_issue-issue_cockpit .category-header,#homebox-block-project_issue_issue_cockpit .category-header{color:#555;display:block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:1.2307em;font-weight:normal;margin-top:0.5em;}.issue-cockpit-bug,.issue-cockpit-statistics{margin-bottom:0.5em;}.issue-cockpit-oldest{color:#888;}.view-project-issue-user-issues div.project-title{font-weight:bold;}#homebox #homebox-block-views_a512ec6dea837b33a2b010c2af17ed85 .portlet-content{padding:0;}#homebox .homebox-portlet .view-project-issue-user-issues .more-link{padding:0px 10px 10px 0px;}#homebox #homebox-block-views_a512ec6dea837b33a2b010c2af17ed85 th{display:none;}#homebox #homebox-block-views_a512ec6dea837b33a2b010c2af17ed85 td{padding:0.25em 10px;}.project-info .count{font-weight:bold;}#homebox .homebox-column{background:none;margin:0;padding:0;}#homebox .homebox-portlet{border:0;margin:0 0 20px;}#homebox .homebox-placeholder{margin:0 0 14px;}#homebox .homebox-portlet .homebox-portlet-inner{background-color:#F6F6F2;border:0;}#homebox .portlet-config{padding:0 10px 10px;}#homebox .portlet-content{padding:10px;}#homebox .homebox-portlet .portlet-header{background:none;font-size:1.38461em;padding:10px 10px 8px;}#homebox .homebox-portlet .portlet-minus,#homebox .homebox-portlet .portlet-maximize{display:none;}#homebox .homebox-portlet .portlet-icon{margin-top:4px;margin-left:4px;}#homebox-buttons,#homebox-add{margin-bottom:10px;}#homebox-add a.restore{display:inline;height:auto;padding:0;width:auto;}#drupalorg-set-home a,html.js #drupalorg-set-home input{display:none;}html.js #drupalorg-set-home a{display:inline;}#drupalorg-set-home .ahah-progress{float:right;}#drupalorg-search-help-form{background-color:#F6F5F1;margin-bottom:20px;padding:20px 20px 15px 20px;}#drupalorg-search-help-form label{font-size:1.61538em;font-weight:normal;margin:0 0 1em 0;}#drupalorg-search-help-form .form-text{background:#FFFFFF url(/sites/all/themes/bluecheese/images/throbber-large.gif) 231px 8px no-repeat;border:2px solid #c8c9c4;color:#858585;font-size:1.61538em;height:35px;margin:0 0 5px 0;padding:0 30px 0 5px;width:221px;}#drupalorg-search-help-form .form-text.throbbing{background:#FFFFFF url(/sites/all/themes/bluecheese/images/throbber-large.gif) 231px -92px no-repeat;}#edit-search-term-results p.help-result-text{font-weight:bold;margin-left:10px;}#edit-search-term-results ul{list-style-type:none;margin:0 0 5px 0;padding:0;}#edit-search-term-results ul a{font-weight:bold;}#edit-search-term-results li .help-result-value{border-top:1px solid #E1E1DB;line-height:2em;list-style-type:none;margin:0;padding:0 0 0 10px;}#recent-activity ul{margin-left:0;padding-left:0;}#page .block-google_admanager{background-color:#f6f6f2;line-height:inherit;}.gam-holder{margin:0 0 1em;}.gam-prefix,.gam-suffix{padding:12px;}.gam-suffix{color:#666;font-size:0.92307em;}.gam-suffix a{color:#000;}.gam-holder .text{background-color:#f6f6f2;width:274px;line-height:1.5em;padding:13px;}.gam-holder .text a{font-weight:bold;}#column-right .block-google_admanager{margin:12px 0 12px 0;}#column-right .block-google_admanager .block-inner{padding:0;}.front-current-activity{float:left;margin-bottom:1.385em;}.front-current-activity:first-child{margin-right:1.5em;}.front-current-activity td{padding:0;white-space:nowrap;}.front-current-activity td:first-child{text-align:right;padding-right:0.4em;}.front-current-activity th{background:transparent;font-weight:normal;border-bottom:none;padding:0;}body.front .gam-holder{margin:1.385em 0 0 0;}#block-google_admanager-89caa04f148acdc52719b3d001e487c4 .gam-prefix h3{margin-top:0;}#block-google_admanager-89caa04f148acdc52719b3d001e487c4 .gam-prefix p{margin-bottom:0;}#google_ads_div_Security_books img,#google_ads_div_Redesign_books img{padding:0 12px;}.view-drupalorg-community-spotlight.view-display-id-block_1 .node-footer .links{display:block;}.view-drupalorg-community-spotlight.view-display-id-block_1 .node-footer .separator{display:none;}#block-drupalorg_search-drupalorg_search_users form,#block-drupalorg_search-drupalorg_search_users .form-item{margin:0;}#block-drupalorg_search-drupalorg_search_users .form-text{width:150px;}.drupalorg-front #header-screen{background:url(/sites/all/themes/bluecheese/images/fireworks.png) 5% 0 no-repeat;}.link-button span.celebrating{display:inline-block;margin-left:-1em;padding:0 0 0 1em;background:url(/sites/all/themes/bluecheese/images/fireworks-link-button.png) 0 0 no-repeat;} + + + +div.block-region{background:none;border:2px dashed #53B0EB;color:#53B0EB;font-size:1.0769em;margin:10px 0;padding:10px;}.views-tabs .ui-tabs-nav li,.views-tabs .ui-tabs-nav a{float:none;}#content .views-tabs ul.ui-tabs-nav{padding-left:0;} + + + +#content .node-footer a.comment_comments,#content .node-footer a.comment_add,html.js #search-theme-form-advanced fieldset.collapsible legend a,div.nav-content-dashboard ul li.active span.hover a.edit span,div.nav-content-dashboard ul li.active span.hover a.delete,#page-tools a.add,#dashboard a.remove-widget,.meta .alert,.project-info .alert,.rss-feed-link,.search-results .search-info .comments,.portlet-header .portlet-settings,.portlet-plus,.portlet-minus,.portlet-close,.portlet-maximize,.portlet-maximized .portlet-minimize{background-image:url(/sites/all/themes/bluecheese/images/small-icons.png);background-repeat:no-repeat;}#content .node-footer a.comment_comments,#content .node-footer a.comment_add{background-position:0 -415px;padding-left:15px;}html.js #search-theme-form-advanced fieldset.collapsible legend a{background-position:100% -473px;}div.nav-content-dashboard ul li.active span.hover a.edit span{background-position:8px -61px;padding-left:20px;}div.nav-content-dashboard ul li.active span.hover a.delete{background-position:8px -125px;height:12px;padding-left:20px;}#dashboard a.remove-widget{background-position:0 -128px;height:12px;padding-left:12px;}#page-tools a.add{background-position:right -188px;padding-right:18px;}.meta .alert{background-position:0 -225px;padding-left:14px;}.project-info .alert{background-position:0 -223px;padding-left:16px;}.rss-feed-link{background-position:0 -30px;padding-left:20px;}.search-results .search-info .comments{background-position:0 -415px;padding-left:14px;}.portlet-header .portlet-settings{background-position:2px -64px;}.portlet-plus{background-position:2px -192px;}.portlet-close{background-position:2px -128px;}.page-search #column-right .item-list ul li,#block-drupalorg_news-news-terms ul.links li{line-height:1.5em;}.page-search #column-right .item-list ul li a.selected,.page-search #column-right .item-list ul li a:hover,#block-drupalorg_news-news-terms ul.links li a.active,#block-drupalorg_news-news-terms ul.links li a:hover,#block-drupalorg_news-news-terms ul.links li a:focus{background-image:url(/sites/all/themes/bluecheese/images/pointer.png);background-repeat:no-repeat;background-position:0 center;}#edit-search-theme-form-1,#aboutwebbased a,#aboutcontentmanagement a,#aboutmodules a,#aboutthemes a,#aboutsearching a,#aboutsocial a,#aboutcommunity a,#aboutpersonalisation a{background:#fff url(/sites/all/themes/bluecheese/images/large-icons.png) no-repeat;}#edit-search-theme-form-1{background-position:8px -856px;}#aboutwebbased a{background-position:4px 0;}#aboutcontentmanagement a{background-position:4px -96px;}#aboutmodules a{background-position:4px -192px;}#aboutthemes a{background-position:4px -288px;}#aboutsearching a{background-position:4px -384px;}#aboutsocial a{background-position:4px -480px;}#aboutcommunity a{background-position:4px -576px;}#aboutpersonalisation a{background-position:4px -1056px;}#header{background-image:url(/sites/all/themes/bluecheese/images/sprites-horizontal.png);background-repeat:repeat-x;}#header{background-position:0 -1088px;}body.drupalorg-front #header{background-position:0 0;}#site-name a,#nav-content li.active,#nav-content li.active a.active,#nav-content li.active-parent,#nav-content li.active-parent a,#nav-masthead li,#nav-masthead li a,.ui-tabs-nav li.ui-tabs-selected,.ui-tabs-nav li.ui-tabs-selected a,.ui-tabs-nav .icon,a.link-button,a.link-button span,#front-middle-inner .block-content,.homepage-pin,.image-tags span,.image-tags span a{background-image:url(/sites/all/themes/bluecheese/images/sprites.png);background-repeat:no-repeat;}#site-name a{background-position:0 -467px;}.homepage-pin-doc{background-position:-22px -753px;}.ui-tabs-docs-updates .icon{background-position:-22px -750px;}.homepage-pin-forum{background-position:-11px -753px;}.ui-tabs-forum-posts .icon{background-position:-11px -750px;}.homepage-pin-commit{background-position:0 -753px;}.ui-tabs-commits .icon{background-position:0 -750px;}#nav-content li.active,#nav-content li.active-parent,.ui-tabs-nav li.ui-tabs-selected{background-position:0 -1300px;}#nav-content li.active a.active,#nav-content li.active-parent a,.ui-tabs-nav li.ui-tabs-selected a{background-position:100% -1200px;}#nav-masthead li a{background-position:100% -800px;}#nav-masthead li{background-position:0 -900px;}#nav-masthead li.active a,#nav-masthead li:hover a{background-position:100% -1000px;}#nav-masthead li.active,#nav-masthead li:hover{background-position:0 -1100px;}a.link-button{background-position:0 -48px;}a.link-button span{background-position:100% 0;}#front-middle-inner .block-content{background-position:0 -537px;}.image-tags span{background-position:0 -224px;}.image-tags a{background-position:100% -192px;}.feature-tags span{background-position:0 -288px;}.feature-tags a{background-position:100% -256px;}.sticky .image-tags span{background-position:0 -352px;}.sticky .image-tags a{background-position:100% -320px;} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/form-field-tooltip.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/form-field-tooltip.css new file mode 100644 index 0000000..24b40da --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/form-field-tooltip.css @@ -0,0 +1,12 @@ +#DHTMLgoodies_formTooltipDiv{ + color:#000000; + font-family:arial; + font-weight:bold; + font-size:0.8em; + line-height:120%; +} +.DHTMLgoodies_formTooltip_closeMessage{ + color:#000000; + font-weight:normal; + font-size:0.7em; +} \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/mobile_raptor.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/mobile_raptor.css new file mode 100644 index 0000000..b47fc43 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/mobile_raptor.css @@ -0,0 +1,73 @@ +#reportContainer {text-align:center;margin-bottom:5px;} + +#chartContainer {-webkit-border-radius:5px;margin-bottom:5px;} + +#reportTitleContainer { + background-color: rgb(57,91,162); + padding:8px 5px 0px 10px; + font-family:Helvetica; + color:#fff; + -webkit-border-top-left-radius: 5px; + -webkit-border-top-right-radius: 5px; +} + +#reportTitle,#eventTitle{ + font-size:15px; + font-weight:bold; + text-align:left; +} + +#reportSubTitleContainer{ + font-family:Helvetica; + font-weight:bold; + color:rgb(255,255,102); + padding:2px 10px 3px 10px; + background-color: rgb(57,91,162); +} + +#reportFooter{ + background-color: rgb(57,91,162); + -webkit-border-bottom-left-radius: 5px; + -webkit-border-bottom-right-radius: 5px; +} + +.reportHeadRow { + background-color: rgb(57,91,162); + border-top:1px solid rgb(148,175,222); + border-bottom:1px solid rgb(148,175,222); +} + +.reportHeadCell { + font-family:Helvetica; + font-weight:bold; + font-size:12px; + height:20px; +} + +.rcolheader{ + font-family:Helvetica; + font-size:13px; + color:#fff; +} + +.reportRow { + border-top: 1px solid solid rgb(109,132,162); + background-color: rgb(112,137,193); +} + +.reportAltRow { + border-top: 1px solid solid rgb(109,132,162); + background-color: rgb(57,91,162); +} + +.reportCell { + padding-left:3px; + padding-right:3px; + padding-top:10px; + padding-bottom:10px; + font-family:Helvetica; + font-size:13px; + color:#fff; +} + +.reportCellLink {font-family:Helvetica;font-size:13px;color:#fff;word-break:break-all} \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/novamap.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/novamap.css new file mode 100644 index 0000000..7bbf4bf --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/novamap.css @@ -0,0 +1,25 @@ +@CHARSET "ISO-8859-1"; + +.buttondefault { + background: lightgrey; + border-left: 2px lightgrey solid; + border-top: 2px lightgrey solid; + border-right: 2px gray solid; + border-bottom: 2px gray solid; +} + +.buttonover { + cursor: hand; + background: #F0F8FF; +} + +.buttonout { + background: lightgrey; +} + +.buttonclick { + border-left: 2px gray solid; + border-top: 2px gray solid; + border-right: 2px white solid; + border-bottom: 2px white solid; +} \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/picker.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/picker.css new file mode 100644 index 0000000..bbc439e --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/picker.css @@ -0,0 +1,40 @@ +.picker_layer { + font-family: Arial, Helvetica, sans-serif; + font-size: 12px; + text-decoration: none; + background-color: #d4d0c8; + border-width: 1px; + border-style: solid; + border-color: #666666; + overflow: visible; + height: auto; + width: auto; +} +.picker_buttons { + font-family: Arial, Helvetica, sans-serif; + font-size: 12px; + background-color:#d4d0c8; + border-style:solid; + border-color:#666666; + border-width:1px; + padding:1px; + cursor:pointer; + color:#000000; +} +.cell_color { + cursor:pointer; + width:9px; + height:9px; +} +.color_table { + font-family: Arial, Helvetica, sans-serif; + font-size: 12px; + text-decoration: none; +} +.choosed_color_cell{ + border-style:solid; border-color:#000000; border-width:1px; +} +.default_color_btn{ + width:17px; height:17px; background-image:url(defaultcolor.jpg); + background-repeat:no-repeat; background-position:center; +} \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/ral.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/ral.css new file mode 100644 index 0000000..4e45ddc --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/ral.css @@ -0,0 +1,1437 @@ +/* +Reusable Asset Library - CSS Positioning Version (v3.2) +Release Date: 1/26/07 +Core Styles +*/ + +/*------------------------General-----------------------------------*/ +body{ +background:#FFF; +font-family:Arial,Verdana,Geneva,Helvetica,sans-serif; +font-size:.71em; +padding:0; +margin:0px; +margin-right:1px; +border:0; +} +.nested{ +border:0; +padding:0; +margin:0; +} +.btm{ +vertical-align:bottom !important; +} +.nowrap{ +white-space:nowrap; +} +.top, .top td{ +vertical-align:top !important; +} +table{ /*IE5.5 hack*/ +font-size:100%; +} +td,tr,th{ /*IE5.5 hack*/ +font-size:inherit; +} +.hide{ +display:none !important; +} +.mid { +vertical-align:middle !important; +} +.value { +text-align:right; +} +.show{ +display:block !important; +} +ul{ +padding:0; +margin:0; +border:0; +} +.indent{ +margin-left:10px !important; +} +.code{ +font-family: Courier,serif; +} +p{ +padding:5px 0; +margin:0; +border:0; +} +h1{ +font-size:150%; +margin:2px 0px; +display:block; +position:relative; +clear:both; +} +h2{ +font-size:130%; +margin:2px 0px; +clear:both; +position:relative; +display:block; +} +h2.blue{ +position:relative; +top:0; +left:0; +font-size:100%; +background:#369; +color:#FFF; +margin:0; +margin-top:10px; +padding:2px 5px 2px 8px; +height:14px; +width:auto; +vertical-align:middle; +} +h3{ +font-size:120%; +clear:both; +margin:2px 0px; +position:relative; +display:block; +} +h4 { +font-size:100%; +clear:both; +margin:2px 0px; +position:relative; +display:block; +} + +/*----------------------Horizontal Rules----------------------------*/ +.hrule-blue { +height:1px; +border-top:1px #369 solid; +margin-top:6px; +margin-bottom:2px; +line-height:0px; +padding:0; +clear:both; +} +hr{ +border:0; +height:1px; +margin:10px 0; +background:#CCC; +width:100%; +clear:both; +} + +/*--------------Primay Window Banner--------------------------------*/ +#tBAN{ +padding:0; +border:0; +margin:0; +position:relative; +background:no-repeat url(../images/swoosh.gif) 100% 0; +min-width:800px; +display:table; /*For vertical centering in standards complaint browsers*/ +height:69px; +overflow-x:hidden; /*Remove horizonal scroll in IE*/ +} +#banner-spacer{ +display:block; +width:650px; +height:1px; +position:relative; +top:-1px; +} +#tBAN #logo{ +border:0; +padding:0; +margin:0; +top:10px; +position:absolute; +} +#tBAN #company { +color:#FFF; +font-weight:bold; +font-size:10pt; +padding-right:10px; +_position:absolute; /*IE Hack for vertical centering*/ +_top:48%; /*IE Hack for vertical centering*/ +display:table-cell; /*For standards complaint browsers*/ +vertical-align:middle; /*For standards complaint browsers*/ +text-align:right; +width:99%; +} +#tBAN #txt{ +_position:relative; /*IE Hack for vertical centering*/ +_top:-48%; /*IE Hack for vertical centering*/ +width:205px; +float:right; +overflow:hidden; +} +#appName{ +position:absolute; +left:112px; +top:45px; +color:#09C; +font-size:11pt; +font-weight:bold; +white-space:nowrap; +} + +/*---------------------Secondary Window Banner----------------------*/ +#tSWB{ +background:#FFF; +height:69px; +border-bottom:2px #369 solid; +} +#tSWB #appName{ +top:35px; +} + + +/*--------------------Secondary Windows (General)-------------------*/ +.pHW{ +background:#FFC; +} +.pSW{ +background:#FFF; +} +.pSW .tPH,.pHW .tPH{ +margin:0; +} +/*--------------------mIC: Introductory Copy------------------------*/ +p.mIC{ +padding:0; +margin:0; +} + +/*-----------------------mQH: Quick Help----------------------------*/ +.qh-link{ +float:right; +width:12px; +height:14px; +background:url(../images/quickhelp_lt.gif) no-repeat 0 50%; +cursor:pointer; +position:relative; +vertical-align:middle; +} +.qh-link-field{ +width:12px; +height:12px; +background:url(../images/quickhelp_lt.gif) no-repeat 0px 0px; +cursor:pointer; +position:relative; +top:0px; +} +.qh-element{ +margin-left:5px; +vertical-align:middle; +} +.icon-quick-help{ +display:inline; +} +.mQH { +clear:both !important; +display:none; +background:#9CF !important; +margin:0 !important; +border:0 !important; +height:auto !important; +padding:4px 8px !important; +position:relative !important; +z-index:0; +} +.mQH .label{ +font-weight:bold; +padding-right:5px; +} + +/*----------------------bPF: Footer---------------------------------*/ +#bPF{ +position:relative; +bottom:0px; +display:block; +/*float:none;*/ +height:60px; +clear:both; +padding:25px 0 20px 10px; +line-height:100%; +color:#333; +white-space:nowrap; +} +#bPF ul{ +position:relative; +top:0px; +left:0px; +margin:0 !important; +padding:0 !important; +margin-left:0px !important; +} +#bPF li{ +display:inline; +} +#bPF .pipe{ +padding-right:5px; +padding-left:5px; +} + +/*---------------------------LAYOUT---------------------------------*/ +#grid{ +display:block; +clear:both !important; +height:50%; +width:auto; +position:relative; +width:95%; +min-width:800px; +margin-left:10px; +z-index:10; +} +.grid-secondary{ +margin-top:10px; +margin-left:10px; +width:95%; +position:relative; +} + +/* One column-------------------------------------------------------*/ +.one-col .col1 { +width:95%; +} +.one-col .col2 { +display:none; +} +.one-col .col3 { +display:none; +} + +/* Two column, wide left:------------------------------------------*/ +.two-col-wl .col1 { +width:75%; +float:left; +} +.two-col-wl .col2 { +width:15%; +float:left; +margin-left:10px; +} +.two-col-wl .col3 { +display:none; +} + +/* Two column, wide right:------------------------------------------*/ +.two-col-wr .col1 { +width:15%; +float:left; +} +.two-col-wr .col2 { +width:75%; +float:left; +margin-left:10px; +} +.two-col-wr .col3 { +display:none; +} + +/* Three column-----------------------------------------------------*/ +.three-col .col1 { +width:15%; +float:left; +min-width:140px; +} +.three-col .col2 { +width:60%; +float:left; +margin-left:10px; +} +.three-col .col3 { +width:15%; +float:left; +margin-left:10px; +min-width:140px; +} + + +/*---------------------------Forms----------------------------------*/ +.first-row td{ +padding-top:5px !important; +} +.last-row td{ +padding-bottom:5px !important; +} +.checkbox{ +height:13px; +width:13px; +vertical-align:middle; +padding:0; +margin:0; +margin-right:10px; +text-align:center !important; +} +.col-ast{ +width:10px !important; +} +.col-ast div,.col-ast img{ +width:9px; +height:14px; +} +.form-grid td { +padding:5px 0; +vertical-align:middle; +} +.form-grid label.twoline, +label.br { +display:block; +} + + +.inline{ /*When multiple text input fields */ +margin-right:10px !important; /*are adjacent, space them out!!*/ +} +label{ +white-space:nowrap; +margin-right:15px; +vertical-align:middle; +} +.noborder{ +border:0 !important; +} +.rcb-spacer,.rcb-spacer img{ +width:20px; +} +p .ast{ +position:relative; +left:0px; +padding-right:3px; +} +.spacer-left { +padding:0 !important; +margin:0 !important; +width:5px; +} +.spacer-left img{ +margin:0; +padding:0; +border:0; +width:5px; +height:1px; +} +label span.br{ +display:block; +padding-left:5px; +} +label.text{ +vertical-align:top !important; +} +label.spacer{ +color:white; +} +form { +margin:0; +padding:0; +border:0; +} +.form-buttons{ +margin:10px 0; +white-space:nowrap; +margin-left:0px; +} +.top-border{ +border-top:1px #666 solid; +padding-top:10px; +margin-top:15px; +} +.form-buttons td { +vertical-align:middle; +padding:5px 0; +} +fieldset{ +border:0; +border-bottom:1px #000 solid; +padding:5px; +} +fieldset td{ +padding:3px 0; +} +fieldset .btm-row td{ +border-top:1px #CCC solid !important; +} +fieldset legend{ +color:#000; +font-weight:bold; +padding-bottom:5px; +margin-top:5px; +margin-left:-6px; +} +input.button{ +padding:1px 4px; +font-size:85%; +margin:0; +background:#ccc; +} +input.arrow-up{ +background:#CCC url(../images/button_arrow_up.gif) no-repeat 90% 50%; +padding-right:20px; +font-size:11px; +} +input.arrow-down{ +background:#CCC url(../images/button_arrow_down.gif) no-repeat 90% 50%; +padding-right:20px; +font-size:11px; +} +input.button-blue{ +padding:1px 4px; +font-size:85%; +margin:0; +color:#FFF; +background:#369; +} +input.button-sm{ +padding:1px; +font-size:78%; +margin:0; +} +textarea{ +font-size:100%; +font-family:sans-serif; +} +td.spacer{ +height:1px; +padding:0; +} +.disabled { +color:#CCC !important; +} +.abled { +color:#000 !important; +} +input.text, input.password{ +font-size:100%; +vertical-align:middle; +} +input.text:focus,textarea:focus{ +background:#FFC; +} +.radio{ +padding:0; +margin:0; +border:0; +height:12px; +width:12px; +vertical-align:middle; +margin-right:8px !important; +text-align:center !important; +} +.rcb { +line-height:120%; +} +select { +font-size:85%; +} +.tip{ +font-size:80%; +padding-left:5px; +display:inline; +position:relative; +} +td.tier2 label{ +padding-left:22px !important; +} +td.tier2 .checkbox{ +margin-left:-1px; +} +.col-radio{ +text-align:center; +} +/*---------------------------Help-----------------------------------*/ +.app-help{ +margin-right:auto; +margin-left:auto; +} +.nobullet li{ +list-style:none; +} +.plain{ +position:relative; +top:0px; +left:0px; +margin:0 !important; +padding:0 !important; +margin-left:1px !important; +} +.plain .list-label{ +padding-right:10px; +} +.plain li{ +list-style:none; +} +.index{ +clear:both; +padding:0; +margin:0; +border:0; +} +.index ul{ +padding:0px; +margin:0px; +border:0px; +height:15px; +} +.index ul li{ +float:left; +padding:4px; +list-style:none; +} +.index a{ +text-decoration:none !important; +} +.index a:hover{ +text-decoration:underline !important; +} + +/*--------------------------Glossary--------------------------------*/ +.glossary-index{ +height:12px; +display:block; +margin:0; +padding:0; +border:0; +padding-top:5px; +padding-bottom:5px; +margin-right:auto; +margin-left:auto; +text-transform:uppercase; +} +.glossary-index li{ +list-style:none; +display:inline; +padding-right:2px; +padding-left:2px; +font-weight:bold; +} +.glossary-index a{ +padding-left:2px; +padding-right:2px; +} +.glossary-index a:hover{ +background:#CCC; +} +dl{ +margin:0; +} +dt{ +font-weight:bold; +} +dd { +margin-left:20px; +} +.marker { +font-weight:bold; +color:#369; +width:100%; +text-transform:uppercase; +} +.section{ +border-bottom:1px #999 solid; +} +p.link{ +width:100%; +text-align:center; +margin-top:0px; +padding:0; +padding-bottom:5px; +} +.blocks { +padding:0; +margin:0; +border:0; +} +.blocks li{ +list-style:none; +float:left; +padding:10px; +} +.last{ +border-right:0 !important; +} +table { +clear:both; +} +.noline td { +border-bottom:0 !important; +} +.scroll{ +overflow:auto; +} +.ital{ +font-style:oblique; +} +.em{ +font-weight:bold !important; +} +.left{ +float:left; +} +.right{ +float:right; +} + +/*--------------------mTIE: Table of Interactive Elements-----------*/ +th{ +font-weight:bold !important; +} +th a{ +font-weight:bold !important; +} +.mTIE { +margin:10px 0; +border:0; +padding:0; +border-left:1px #CCC solid; +border-top:1px #CCC solid; +width:100%; +} +.date, .date-ss, .time { +text-align:right; +white-space:nowrap; + +} +.mTIE td{ +margin:0; +border:0; +border-bottom:1px #CCC solid; +border-right:1px #CCC solid; +padding:4px 6px; +vertical-align:middle; +} +.mTIE .headerRow td { +text-align:center; +} +.mTIE th { +margin:0; +border:0; +border-bottom:1px #CCC solid; +border-right:1px #CCC solid; +padding:3px 6px; +} +.mTIE a { +text-decoration:underline; +} +.headerRow{ +background:#369 !important; +color:#FFF; +font-weight:bold; +} +.button-mTIE{ /*Check All-Clear All button*/ +padding:1px 4px; +background:#CCC; +font-size:85%; +margin:0; +width:75px; +} +.decimal{ +text-align:right; +} +#totalRow { +background:#FFF !important; +} +#totalRow .decTotal { +text-align:right; +} +#totalRow .total{ +text-align:right; +} + +/*------------------------mTAB--------------------------------------*/ +.mTAB { +margin:0px 0; +border:0; +padding:0; +border-left:1px #CCC solid; +border-top:1px #CCC solid; +/*width:100%;*/ +} +.mTAB .date{ +text-align:right; +white-space:nowrap; +} +.mTAB td{ +margin:0; +border:0; +border-bottom:1px #CCC solid; +border-right:1px #CCC solid; +padding:4px 6px; +vertical-align:middle; +} +.mTAB .headerRow td { +text-align:center; +} +.mTAB th { +margin:0; +border:0; +border-bottom:1px #CCC solid; +border-right:1px #CCC solid; +padding:4px 6px; +} +/*.mTAB a { +text-decoration:underline; +}*/ +.headerRow{ +background:#369 !important; +color:#FFF; +font-weight:bold; +} +.button-mTAB{ /*Check All-Clear All button*/ +font-size:10px; +padding:1px 4px; +height:20px; +line-height:12px; +width:75px; +} + +/* LISTS and mTS */ +/*----------------------mIM: Inline Messages------------------------*/ +.mIM{ +background:#9CF; +margin:5px 0; +padding:5px; +background-position:9px 5px !important; +clear:both; +display:block; +} +.mIM p,.mIM ul,.mIM ol{ +position:relative; +top:0; +left:0; +padding:0; +margin:0; +padding-left:48px; +padding-bottom:5px; +border:0; +display:block; +} +.mIM ul{ +padding-left:65px; +width:80%; +} +.mIM ol{ +padding-left:70px; +width:80%; +} +* html .mIM { /*IE Hack*/ +height:35px; /*set the height in IE5.5*/ +voice-family:"\"}\""; +voice-family:inherit; +height:30px; /*set the height in IE6.0*/ +} +*+.mIM{ /*high end browser hack*/ +min-height:30px; +} +div.error { +background:#9CF url(../images/icon_error.gif) no-repeat; +} +.error .txt{ +font-size:100%; +color:#F00; +font-weight:bold; +text-align:right; +padding-right:10px; +padding-left:44px; +width:35px; +} +.error table{ +position:relative; +} +.error table td{ +vertical-align:top; +} +.error .list-errors { +padding:0; +display:block; +clear:both; +left:-1px; +position:relative; +} +.error .list-errors li { +list-style:none; +background:url(../images/dash.gif) no-repeat 0 50%; +padding-left:12px; +} +.error p, +.error ul{ +padding-left:0; +} +.error p{ +padding-top:0; +margin-top:0; +} +.info { +background:#9CF url(../images/icon_info.gif) no-repeat; +} +.confirmation { +background:#9CF url(../images/icon_confirmation.gif) no-repeat; +} +.alert { +background:#9CF url(../images/icon_alert.gif) no-repeat; +} +.help { +background:#9CF url(../images/icon_help.gif) no-repeat; +} + +/*---------------------mRT: Return to Top---------------------------*/ +.mRT { +margin:10px 0; +clear:both; +display:block; +} +.mRT a { +background:url(../images/return_to_top.gif) no-repeat 0 2px; +padding-left:15px; +} +/*---------------------mPW:Please Wait------------------------------*/ +.mPW { +border-top:1px #666 solid; +border-bottom:1px #666 solid; +background:#FFF; +padding:10px; +text-align:center; +height:auto; +width:auto; +clear:both; +display:block; +margin:10px 0px; +} +.icon-wait { +background:url(../images/please_wait.gif) no-repeat 50% 100%; +width:100px; +height:20px; +margin-left:auto; +margin-right:auto; +clear:both; +display:block; +} + +/*---------------------mDL: Data List-------------------------------*/ +.mDL{ +width:100%; +margin:10px 0; +} +.mDL td{ +padding:4px 0px 4px 10px; +} +.mDL th{ +background:#369; +color:#FFF; +text-align:left; +padding:2px 5px; +} +.mDL .label{ +text-align:right; +} +.mDL .total{ /*are these being duplicated?*/ +text-align:right; +font-weight:bold; +padding-right:10px; +} +.mDL .decimal{ +text-align:right; +padding-right:10px; +} + +/*------------------mDDL: Double Data List--------------------------*/ +.mDDL .plain{ +margin-bottom:10px !important; +} +.mDDL{ +width:100%; +margin:10px 0; +} +.mDDL td{ +padding:4px 0px 4px 10px; +} +.mDDL th{ +background:#369; +color:#FFF; +text-align:left; +padding:2px 5px; +} +.mDDL .label{ +text-align:right; +} +.mDDL .total{ +text-align:right; +font-weight:bold; +padding-right:10px; +} +.mDDL .decimal{ +text-align:right; +padding-right:10px; +} + +/*------------------------mCA: Contact-------------------------*/ +.mCA{ +position:relative; +width:50%; +height:auto; +margin:10px 0; +} +.mCA .number { +position:relative; +} +.mCA .mail{ +font-weight:bold; +position:relative; +background:inherit; +} +.mCA address{ +margin-left:150px; +font-weight:normal; +font-style:normal; +} + + +/*----------mDSR:Data Summary/Review Verification-------------------*/ +.mDSR { +border-bottom:1px #000 solid; +width:100%; +margin:10px 0; +} +.mDSR th { +text-align:left; +padding:4px 6px; +} +.mDSR td { +text-align:left; +padding:4px 4px; +vertical-align:top; +} +th a{ +font-weight:normal; +margin-left:5px; +} + +/*---------------------mLL: Link Listing----------------------------*/ +.mLL { +margin:10px 0; +width:100%; +display:block; +height:auto; +position:relative; +clear:both; +float:none; +} +.mLL ul{ +margin:0; +padding:10px 0px; +width:45%; +position:relative; +} +.mLL ul li{ +list-style:none; +border:0; +margin:0; +padding-bottom:2px; +} + + +/*-----------------mPN: Pagination/Navigation-----------------------*/ +.mPN{ +position:relative; +display:block; +clear:both; +height:45px; +margin:10px 0; +white-space:nowrap; +} +.mPN p, +.mPN label { +line-height:160% !important; +padding:0; +margin:0; +border:0; +vertical-align:top; +} +.mPN .current{ +font-weight:bold; +} +.mPN a{ +font-weight:bold; +} +.mPN .left,.mPN .right{ +float:left; +vertical-align:top; +height:100%; +color:#999; +font-weight:bold; +} +.mPN .left{ +padding-right:40px; +} +.mPN .right{ +padding-left:45px; +} +.mPN .middle{ +float:left; +text-align:left; +height:100%; +padding-top:0px; +} +.mPN input.text{ +vertical-align:top; +} + +/*-----------------mSN: Simple Navigation---------------------------*/ +.mSN{ +padding:5px 0 !important; +margin:0; +border:0; +width:90%; +} +.mSN *{ /*IE Hack to fix jumping*/ +position:relative; +top:0; +left:0; +} +.mSN ul{ +clear:both; +width:80%; +margin:0 !important; +left:15px; +} +.mSN li { +list-style:none; +padding-bottom:3px; +} + +/*----------------------mTC: Task Confirmation----------------------*/ +.mTC{ +border:1px #9CF solid; +border-top:0; +margin:10px 0; +min-width:300px; +} +.mTC ul{ +margin-left:65px; +} +.mTC p{ +margin-left:60px; +} +.mTC table{ +padding:0; +margin:0; +border:0; +margin-left:58px; +} +.mTC h2{ +position:relative; +top:0; +left:0; +width:auto; +background:#9CF url(../images/banner-confirmation.gif) repeat-x 0 0; +padding:12px 10px 12px 60px; +font-size:100%; +font-weight:normal; +margin-bottom:10px; +} + +/*--------------------mHL: Helpful Links (new)----------------------*/ +.mHL{ +border-top:1px #333 solid; +border-bottom:1px #333 solid; +padding:10px 0; +margin-bottom:10px; +} +.mHL h3{ +font-size:100%; +} +.mHL ul{ +margin-left:65px; +} + +/*--------------------mTI: Task Instructions------------------------*/ +.mTI{ +display:block; +clear:both; +margin:10px 0; +} +.mTI ul{ +position:relative; +display:block; +left:.1em; +padding:0; +border:0; +} +/*---------------bSWN: Secondary Window Navigation------------------*/ +.bSWN{ +padding:10px 0; +border-top:1px #369 solid; +} + +/*----------------mSD: Status Dashboard-----------------------------*/ +.mSD{ +border:1px #369 solid; +margin:10px 0; +width:100%; +} +.mSD th{ +background:#369; +color:#FFF; +text-align:left; +padding:2px 5px; +} + +/*----------------mSDL: Summary Data Listing-----------------------*/ +.mSDL{ +border:1px #369 solid; +margin:10px 0; +min-width:250px; +width:100%; +} +.mSDL td{ +border:0; +margin:0; +padding:2px 0 2px 8px; +vertical-align:middle; +} +.mSDL th{ +background:#369; +color:#FFF; +text-align:left; +padding:2px 5px; +} +.mSDL .value{ +text-align:right; +} + +/*----------------------mDEE: Data Entry/Edit ----------------------*/ +.mDEE{ +margin:10px 0; +width:100%; +} +table.mDEE{ +border:1px #369 solid; +} +.mDEE td{ +border:0; +margin:0; +padding:5px 0; +vertical-align:middle; +} +.mDEE th{ +background:#369; +color:#FFF; +text-align:left; +padding:2px 5px; +} +.nopad{ +padding:0 !important; +border:0; +margin:0; +width:100%; +} +.desc { +text-align:right; +} + +/*---------------------Supporting Text------------------------------*/ +.mST{ +margin:10px 0; +display:block; +clear:both; +} + +/*------------------------tPH: Page header--------------------------*/ +.tPH { +margin:10px 100px 1px 10px; +display:block; +clear:both; +} + +/*----------------Topic index found in pHW2.html--------------------*/ +.topic-index{ +padding:0; +margin:5px 0; +width:100%; +height:14px; +display:block; +clear:both; +position:relative; +top:0; +left:0; +} +.topic-index li{ +list-style:none; +float:left; +margin-right:25px; +padding:0; +border:0; +} +.topic-index li a{ +padding-left:10px; +background:url(../images/arrow_down_alt.gif) no-repeat 0 50%; +} +.alt li a{ +padding-left:10px; +background:url(../images/arrow_down_alt2.gif) no-repeat 0 50%; +} + +/*------------------Freezing header mods for NS7------------------- */ +div[class="class_float"] table { +padding:0; +margin:0; +border:1px #CCC solid !important; +background:#369; +width:100%; +} +div[class="class_float"] th { +margin:0; +border-right:0; +border-bottom:0; +vertical-align:middle; +} +.headerRow nobr{ +border-left:2px #369 solid; +} + +/*------------------mSD:Status Dashboard----------------------------*/ +.data-mSD{ +width:90%; +margin:0 10px; +} +.data-mSD td{ +padding:2px 0 !important; +margin:0 !important; +border:0 !important; +} +.data-mSD .value{ +text-align:right !important; +} +.wrap { +white-space:normal; +} +.input-error{ +color:#F00; +font-weight:bold; +} + + +/*-------------------mCC: Convenence Choices------------------------*/ +.mCC{ +margin:10px 0; +width:100%; +} +table.mCC{ +border:1px #369 solid; +} +.mCC td{ +border:0; +margin:0; +padding:5px 0; +vertical-align:middle; +} +.mCC th{ +background:#369; +color:#FFF; +text-align:left; +padding:2px 5px; +} + +/*-----------------------Layout sample pages------------------------*/ +.layout-template .col1, +.layout-template .col2, +.layout-template .col3{ +background:#efefef; +height:350px; +border:1px #CCC dotted; +text-align:center; +} +.layout-template #grid{ +padding-top:10px; +} +.center{ +text-align:center; +} + +/*----------------------Row Exchange Module-------------------------*/ +div.mREX{ +border:1px #999 solid; +padding:5px 10px; +margin-bottom:20px; +background:#efefef; +} +h1.mREX{ +background:#999; +color:#FFF; +padding:5px 10px; +margin:0; +font-size:100%; +margin-top:20px; +} + +/*---------------508 Complaint Skip Navigation Link-----------------*/ +#skip{ +display:inline; +color:#FFF !important; +text-decoration:none; +font-size:1px; +position:absolute; +top:0; +left:0; +z-index:10; +} +.cal-label{ +font-size:90%; +color:#999; +position: relative; +top:4px; +} +caption{ +font-weight:bold; +color:#369; +} +#grid a:visited{ +text-decoration:none; +border-bottom:1px dotted; +} +.clear{ +display:block !imporatn; +clear:both; +} + +/*---------------------mTS: Task Steps------------------------------*/ +.mTS { +border:1px #9CF solid; +width:140px; +background:#FFF; +margin:10px 0; +} +.mTS h2 { +text-transform:uppercase; +text-align:center; +color:#369; +padding:0px 4px; +margin:0; +border:0; +font-size:100%; +border-bottom:1px #9CF solid; +} +.mTS ul { +margin:0; +border:0; +padding:5px 0; +width:90%; +} +.mTS ul li { +list-style:none; +padding-bottom:8px; +padding-left:20px; +padding-right:5px; +} +.mTS li.current { +font-weight:bold; +background:url(../images/task_arrow_on.gif) no-repeat; +} +.mTS li.complete { +background:url(../images/check.gif) no-repeat; +} \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/raptor.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/raptor.css new file mode 100644 index 0000000..ea37015 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/css/raptor.css @@ -0,0 +1,62 @@ + .rowalt1 {background-color: rgb(255, 255, 255);} + .rowalt2 {background-color: rgb(255, 255, 204);} + .rowalt3 {background-color: rgb(255, 0, 0);} +.rbg1 { background-color:#336699; } /* header background (gray) */ + .rbg1d { background:#747474; } /* tab dark background (gray) */ + .rbg2 { background:#FFFFFF;/*background:#D6DCE4;*/ } /* darker background */ + .rbg3 { background:#FFFFFF;/*background:#EDEDED;*/ } /* light background */ + .rbg4 { background:#88CAFB; } /* second header - dark */ + .rbg6 { background:#ffbbbb; } /* light error background */ + .rbg7 { background:#ff9999; } /* dark error background - header */ + .rcolheader { font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#FFFFFF;font-weight:700;text-decoration:none } + .rcolheader:hover { font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#FFFFFF;font-weight:700;text-decoration:underline } + .rtableheader { font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#FFFFFF;font-weight:700; } + .rtabletext { font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#000000; } + .rtabletextwhite { font-family:Arial;font-size:11px;color:#FFFFFF; } + .rtext { font-family:Arial,Helvetica,sans-serif;font-size:13px;color:#000000; } + .rtext2 { font-family:Arial,Helvetica,sans-serif;font-size:13px;color:#ffffff; } + .rerrortext { font-family:Arial,Helvetica,sans-serif;font-size:16px;color:#000000; } + .rerrortextsm { font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#000000; } + .rprismsbutton { margin:3px 3px 3px 0px; padding:1px 5px 1px 5px; font-family: Arial; font-weight: 700; font-size: 11px; color: #ffffff; background-color: #336699 } + .rsmallbutton { margin:3px 3px 3px 0px; padding:1px 5px 1px 5px; font-family: Arial; font-weight: 700; font-size: 11px; color: #336699; background-color: #EDEDED } + .rrequired { background-image:url(raptor/images/required.gif); background-position:top right; background-repeat:no-repeat;} + .rtabselected { font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#FFFFFF;font-weight:700; } + .rtabtext { font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#CCCCCC;font-weight:700; } + .buttonLabelField { margin:3px 3px 3px 0px; } + + /* Added to better customize the UI with FUSION */ + .rbg8 { border: 1px outset #8DA9D1; background: #EDEDED; color: #000000; } /* alternate table row background */ + .tableBorder { border:1px outset teal } + .unpaddedButton { margin:3px 3px 3px 0px; font-family: Arial; font-weight: 700; font-size: 11px; color: #ffffff; background-color: #336699 } + .normalText { font-family: Arial; font-size: 11px; color: #000000; } + .popText { font-size:11px;font-family:Arial,Helvetica,sans-serif;color:#000000;padding:1px;font-weight:700;text-decoration:none; } + .hyperref1 { font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#000000;text-decoration: none} + A:link {text-decoration: none} + A:visited {text-decoration: none} + A:active {text-decoration: none} + A:hover {text-decoration: none; color: blue;} + .tdborder {margin:0;border:0;border-bottom:1px #CCC solid;border-right:1px #CCC solid;padding:4px 6px;vertical-align:middle;} + +div.scrollableTable { + clear: both; + border: 1px solid #963; + height:100%; + overflow: auto; +} +div.scrollableTable table {float:left;width:100%} + +thead.scrollableTableHeader tr { + position: relative; + top: expression(this.offsetParent.scrollTop); + background:white; +} + +thead.scrollableTableHeader tr th {position: relative;background: #336699;} +/*thead.scrollableTableHeader tr td {position: relative;top: expression(this.offsetParent.scrollTop);background: #8a9bb3;}*/ +thead.scrollableTableHeader tr td {position: relative;top: expression(this.offsetParent.scrollTop);background: #336699;} +tbody[class].scrollableTableContent { + display: block; + overflow: auto; +} + .trhideunhidecolor {background: #ffffff;} + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/css/nv.d3.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/css/nv.d3.css new file mode 100644 index 0000000..28ccd05 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/css/nv.d3.css @@ -0,0 +1,656 @@ + +/******************** + * HTML CSS + */ + + +.chartWrap { + margin: 0; + padding: 0; + overflow: hidden; +} + + +/******************** + * TOOLTIP CSS + */ + +.nvtooltip { + position: absolute; + background-color: rgba(255,255,255,1); + padding: 10px; + border: 1px solid #ddd; + z-index: 10000; + + font-family: Arial; + font-size: 13px; + + transition: opacity 500ms linear; + -moz-transition: opacity 500ms linear; + -webkit-transition: opacity 500ms linear; + + transition-delay: 500ms; + -moz-transition-delay: 500ms; + -webkit-transition-delay: 500ms; + + -moz-box-shadow: 4px 4px 8px rgba(0,0,0,.5); + -webkit-box-shadow: 4px 4px 8px rgba(0,0,0,.5); + box-shadow: 4px 4px 8px rgba(0,0,0,.5); + + -moz-border-radius: 10px; + border-radius: 10px; + + pointer-events: none; + + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.nvtooltip h3 { + margin: 0; + padding: 0; + text-align: center; +} + +.nvtooltip p { + margin: 0; + padding: 0; + text-align: center; +} + +.nvtooltip span { + display: inline-block; + margin: 2px 0; +} + +.nvtooltip-pending-removal { + position: absolute; + pointer-events: none; +} + + +/******************** + * SVG CSS + */ + + +svg { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + /* Trying to get SVG to act like a greedy block in all browsers */ + display: block; + width:100%; + height:100%; +} + + +svg text { + font: normal 12px Arial; +} + +svg .title { + font: bold 14px Arial; +} + +.nvd3 .nv-background { + fill: white; + fill-opacity: 0; + /* + pointer-events: none; + */ +} + +.nvd3.nv-noData { + font-size: 18px; + font-weight: bolf; +} + + +/********** +* Brush +*/ + +.nv-brush .extent { + fill-opacity: .125; + shape-rendering: crispEdges; +} + + + +/********** +* Legend +*/ + +.nvd3 .nv-legend .nv-series { + cursor: pointer; +} + +.nvd3 .nv-legend .disabled circle { + fill-opacity: 0; +} + + + +/********** +* Axes +*/ + +.nvd3 .nv-axis path { + fill: none; + stroke: #000; + stroke-opacity: .75; + shape-rendering: crispEdges; +} + +.nvd3 .nv-axis path.domain { + stroke-opacity: .75; +} + +.nvd3 .nv-axis.nv-x path.domain { + stroke-opacity: 0; +} + +.nvd3 .nv-axis line { + fill: none; + stroke: #000; + stroke-opacity: .25; + shape-rendering: crispEdges; +} + +.nvd3 .nv-axis line.zero { + stroke-opacity: .75; +} + +.nvd3 .nv-axis .nv-axisMaxMin text { + font-weight: bold; +} + +.nvd3 .x .nv-axis .nv-axisMaxMin text, +.nvd3 .x2 .nv-axis .nv-axisMaxMin text, +.nvd3 .x3 .nv-axis .nv-axisMaxMin text { + text-anchor: middle +} + + + +/********** +* Brush +*/ + +.nv-brush .resize path { + fill: #eee; + stroke: #666; +} + + + +/********** +* Bars +*/ + +.nvd3 .nv-bars .negative rect { + zfill: brown; +} + +.nvd3 .nv-bars rect { + zfill: steelblue; + fill-opacity: .75; + + transition: fill-opacity 250ms linear; + -moz-transition: fill-opacity 250ms linear; + -webkit-transition: fill-opacity 250ms linear; +} + +.nvd3 .nv-bars rect:hover { + fill-opacity: 1; +} + +.nvd3 .nv-bars .hover rect { + fill: lightblue; +} + +.nvd3 .nv-bars text { + fill: rgba(0,0,0,0); +} + +.nvd3 .nv-bars .hover text { + fill: rgba(0,0,0,1); +} + + +/********** +* Bars +*/ + +.nvd3 .nv-multibar .nv-groups rect, +.nvd3 .nv-multibarHorizontal .nv-groups rect, +.nvd3 .nv-discretebar .nv-groups rect { + stroke-opacity: 0; + + transition: fill-opacity 250ms linear; + -moz-transition: fill-opacity 250ms linear; + -webkit-transition: fill-opacity 250ms linear; +} + +.nvd3 .nv-multibar .nv-groups rect:hover, +.nvd3 .nv-multibarHorizontal .nv-groups rect:hover, +.nvd3 .nv-discretebar .nv-groups rect:hover { + fill-opacity: 1; +} + +.nvd3 .nv-discretebar .nv-groups text, +.nvd3 .nv-multibarHorizontal .nv-groups text { + font-weight: bold; + fill: rgba(0,0,0,1); + stroke: rgba(0,0,0,0); +} + +/*********** +* Pie Chart +*/ + +.nvd3.nv-pie path { + stroke-opacity: 0; + + transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear; + -moz-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear; + -webkit-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear; + +} + +.nvd3.nv-pie .nv-slice text { + stroke: #000; + stroke-width: 0; +} + +.nvd3.nv-pie path { + stroke: #fff; + stroke-width: 1px; + stroke-opacity: 1; +} + +.nvd3.nv-pie .hover path { + fill-opacity: .7; +/* + stroke-width: 6px; + stroke-opacity: 1; +*/ +} + +.nvd3.nv-pie .nv-label rect { + fill-opacity: 0; + stroke-opacity: 0; +} + +/********** +* Lines +*/ + +.nvd3 .nv-groups path.nv-line { + fill: none; + stroke-width: 2.5px; + /* + stroke-linecap: round; + shape-rendering: geometricPrecision; + + transition: stroke-width 250ms linear; + -moz-transition: stroke-width 250ms linear; + -webkit-transition: stroke-width 250ms linear; + + transition-delay: 250ms + -moz-transition-delay: 250ms; + -webkit-transition-delay: 250ms; + */ +} + +.nvd3 .nv-groups path.nv-area { + stroke: none; + /* + stroke-linecap: round; + shape-rendering: geometricPrecision; + + stroke-width: 2.5px; + transition: stroke-width 250ms linear; + -moz-transition: stroke-width 250ms linear; + -webkit-transition: stroke-width 250ms linear; + + transition-delay: 250ms + -moz-transition-delay: 250ms; + -webkit-transition-delay: 250ms; + */ +} + +.nvd3 .nv-line.hover path { + stroke-width: 6px; +} + +/* +.nvd3.scatter .groups .point { + fill-opacity: 0.1; + stroke-opacity: 0.1; +} + */ + +.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point { + fill-opacity: 0; + stroke-opacity: 0; +} + +.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point { + fill-opacity: .5 !important; + stroke-opacity: .5 !important; +} + + +.nvd3 .nv-groups .nv-point { + transition: stroke-width 250ms linear, stroke-opacity 250ms linear; + -moz-transition: stroke-width 250ms linear, stroke-opacity 250ms linear; + -webkit-transition: stroke-width 250ms linear, stroke-opacity 250ms linear; +} + +.nvd3.nv-scatter .nv-groups .nv-point.hover, +.nvd3 .nv-groups .nv-point.hover { + stroke-width: 20px; + fill-opacity: .5 !important; + stroke-opacity: .5 !important; +} + + +.nvd3 .nv-point-paths path { + stroke: #aaa; + stroke-opacity: 0; + fill: #eee; + fill-opacity: 0; +} + + + +.nvd3 .nv-indexLine { + cursor: ew-resize; +} + + +/********** +* Distribution +*/ + +.nvd3 .nv-distribution { + pointer-events: none; +} + + + +/********** +* Scatter +*/ + +/* **Attempting to remove this for useVoronoi(false), need to see if it's required anywhere +.nvd3 .nv-groups .nv-point { + pointer-events: none; +} +*/ + +.nvd3 .nv-groups .nv-point.hover { + stroke-width: 20px; + stroke-opacity: .5; +} + +.nvd3 .nv-scatter .nv-point.hover { + fill-opacity: 1; +} + +/* +.nv-group.hover .nv-point { + fill-opacity: 1; +} +*/ + + +/********** +* Stacked Area +*/ + +.nvd3.nv-stackedarea path.nv-area { + fill-opacity: .7; + /* + stroke-opacity: .65; + fill-opacity: 1; + */ + stroke-opacity: 0; + + transition: fill-opacity 250ms linear, stroke-opacity 250ms linear; + -moz-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear; + -webkit-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear; + + /* + transition-delay: 500ms; + -moz-transition-delay: 500ms; + -webkit-transition-delay: 500ms; + */ + +} + +.nvd3.nv-stackedarea path.nv-area.hover { + fill-opacity: .9; + /* + stroke-opacity: .85; + */ +} +/* +.d3stackedarea .groups path { + stroke-opacity: 0; +} + */ + + + +.nvd3.nv-stackedarea .nv-groups .nv-point { + stroke-opacity: 0; + fill-opacity: 0; +} + +.nvd3.nv-stackedarea .nv-groups .nv-point.hover { + stroke-width: 20px; + stroke-opacity: .75; + fill-opacity: 1; +} + + + +/********** +* Line Plus Bar +*/ + +.nvd3.nv-linePlusBar .nv-bar rect { + fill-opacity: .75; +} + +.nvd3.nv-linePlusBar .nv-bar rect:hover { + fill-opacity: 1; +} + + +/********** +* Bullet +*/ + +.nvd3.nv-bullet { font: 10px sans-serif; } +.nvd3.nv-bullet .nv-measure { fill-opacity: .8; } +.nvd3.nv-bullet .nv-measure:hover { fill-opacity: 1; } +.nvd3.nv-bullet .nv-marker { stroke: #000; stroke-width: 2px; } +.nvd3.nv-bullet .nv-markerTriangle { stroke: #000; fill: #fff; stroke-width: 1.5px; } +.nvd3.nv-bullet .nv-tick line { stroke: #666; stroke-width: .5px; } +.nvd3.nv-bullet .nv-range.nv-s0 { fill: #eee; } +.nvd3.nv-bullet .nv-range.nv-s1 { fill: #ddd; } +.nvd3.nv-bullet .nv-range.nv-s2 { fill: #ccc; } +.nvd3.nv-bullet .nv-title { font-size: 14px; font-weight: bold; } +.nvd3.nv-bullet .nv-subtitle { fill: #999; } + + +.nvd3.nv-bullet .nv-range { + fill: #999; + fill-opacity: .4; +} +.nvd3.nv-bullet .nv-range:hover { + fill-opacity: .7; +} + + + +/********** +* Sparkline +*/ + +.nvd3.nv-sparkline path { + fill: none; +} + +.nvd3.nv-sparklineplus g.nv-hoverValue { + pointer-events: none; +} + +.nvd3.nv-sparklineplus .nv-hoverValue line { + stroke: #333; + stroke-width: 1.5px; + } + +.nvd3.nv-sparklineplus, +.nvd3.nv-sparklineplus g { + pointer-events: all; +} + +.nvd3 .nv-hoverArea { + fill-opacity: 0; + stroke-opacity: 0; +} + +.nvd3.nv-sparklineplus .nv-xValue, +.nvd3.nv-sparklineplus .nv-yValue { + /* + stroke: #666; + */ + stroke-width: 0; + font-size: .9em; + font-weight: normal; +} + +.nvd3.nv-sparklineplus .nv-yValue { + stroke: #f66; +} + +.nvd3.nv-sparklineplus .nv-maxValue { + stroke: #2ca02c; + fill: #2ca02c; +} + +.nvd3.nv-sparklineplus .nv-minValue { + stroke: #d62728; + fill: #d62728; +} + +.nvd3.nv-sparklineplus .nv-currentValue { + /* + stroke: #444; + fill: #000; + */ + font-weight: bold; + font-size: 1.1em; +} + +/********** +* historical stock +*/ + +.nvd3.nv-ohlcBar .nv-ticks .nv-tick { + stroke-width: 2px; +} + +.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover { + stroke-width: 4px; +} + +.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive { + stroke: #2ca02c; +} + +.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative { + stroke: #d62728; +} + +.nvd3.nv-historicalStockChart .nv-axis .nv-axislabel { + font-weight: bold; +} + +.nvd3.nv-historicalStockChart .nv-dragTarget { + fill-opacity: 0; + stroke: none; + cursor: move; +} + +.nvd3 .nv-brush .extent { + /* + cursor: ew-resize !important; + */ + fill-opacity: 0 !important; +} + +.nvd3 .nv-brushBackground rect { + stroke: #000; + stroke-width: .4; + fill: #fff; + fill-opacity: .7; +} + + + +/********** +* Indented Tree +*/ + + +/** + * TODO: the following 3 selectors are based on classes used in the example. I should either make them standard and leave them here, or move to a CSS file not included in the library + */ +.nvd3.nv-indentedtree .name { + margin-left: 5px; +} + +.nvd3.nv-indentedtree .clickable { + color: #08C; + cursor: pointer; +} + +.nvd3.nv-indentedtree span.clickable:hover { + color: #005580; + text-decoration: underline; +} + + +.nvd3.nv-indentedtree .nv-childrenCount { + display: inline-block; + margin-left: 5px; +} + +.nvd3.nv-indentedtree .nv-treeicon { + cursor: pointer; + /* + cursor: n-resize; + */ +} + +.nvd3.nv-indentedtree .nv-treeicon.nv-folded { + cursor: pointer; + /* + cursor: s-resize; + */ +} + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/cie.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/cie.js new file mode 100644 index 0000000..45f0132 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/cie.js @@ -0,0 +1,155 @@ +(function(d3) { + var cie = d3.cie = {}; + + cie.lab = function(l, a, b) { + return arguments.length === 1 + ? (l instanceof Lab ? lab(l.l, l.a, l.b) + : (l instanceof Lch ? lch_lab(l.l, l.c, l.h) + : rgb_lab((l = d3.rgb(l)).r, l.g, l.b))) + : lab(+l, +a, +b); + }; + + cie.lch = function(l, c, h) { + return arguments.length === 1 + ? (l instanceof Lch ? lch(l.l, l.c, l.h) + : (l instanceof Lab ? lab_lch(l.l, l.a, l.b) + : lab_lch((l = rgb_lab((l = d3.rgb(l)).r, l.g, l.b)).l, l.a, l.b))) + : lch(+l, +c, +h); + }; + + cie.interpolateLab = function(a, b) { + a = cie.lab(a); + b = cie.lab(b); + var al = a.l, + aa = a.a, + ab = a.b, + bl = b.l - al, + ba = b.a - aa, + bb = b.b - ab; + return function(t) { + return lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + ""; + }; + }; + + cie.interpolateLch = function(a, b) { + a = cie.lch(a); + b = cie.lch(b); + var al = a.l, + ac = a.c, + ah = a.h, + bl = b.l - al, + bc = b.c - ac, + bh = b.h - ah; + if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; // shortest path + return function(t) { + return lch_lab(al + bl * t, ac + bc * t, ah + bh * t) + ""; + }; + }; + + function lab(l, a, b) { + return new Lab(l, a, b); + } + + function Lab(l, a, b) { + this.l = l; + this.a = a; + this.b = b; + } + + Lab.prototype.brighter = function(k) { + return lab(Math.min(100, this.l + K * (arguments.length ? k : 1)), this.a, this.b); + }; + + Lab.prototype.darker = function(k) { + return lab(Math.max(0, this.l - K * (arguments.length ? k : 1)), this.a, this.b); + }; + + Lab.prototype.rgb = function() { + return lab_rgb(this.l, this.a, this.b); + }; + + Lab.prototype.toString = function() { + return this.rgb() + ""; + }; + + function lch(l, c, h) { + return new Lch(l, c, h); + } + + function Lch(l, c, h) { + this.l = l; + this.c = c; + this.h = h; + } + + Lch.prototype.brighter = function(k) { + return lch(Math.min(100, this.l + K * (arguments.length ? k : 1)), this.c, this.h); + }; + + Lch.prototype.darker = function(k) { + return lch(Math.max(0, this.l - K * (arguments.length ? k : 1)), this.c, this.h); + }; + + Lch.prototype.rgb = function() { + return lch_lab(this.l, this.c, this.h).rgb(); + }; + + Lch.prototype.toString = function() { + return this.rgb() + ""; + }; + + // Corresponds roughly to RGB brighter/darker + var K = 18; + + // D65 standard referent + var X = 0.950470, Y = 1, Z = 1.088830; + + function lab_rgb(l, a, b) { + var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200; + x = lab_xyz(x) * X; + y = lab_xyz(y) * Y; + z = lab_xyz(z) * Z; + return d3.rgb( + xyz_rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), + xyz_rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z), + xyz_rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z) + ); + } + + function rgb_lab(r, g, b) { + r = rgb_xyz(r); + g = rgb_xyz(g); + b = rgb_xyz(b); + var x = xyz_lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / X), + y = xyz_lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / Y), + z = xyz_lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / Z); + return lab(116 * y - 16, 500 * (x - y), 200 * (y - z)); + } + + function lab_lch(l, a, b) { + var c = Math.sqrt(a * a + b * b), + h = Math.atan2(b, a) / Math.PI * 180; + return lch(l, c, h); + } + + function lch_lab(l, c, h) { + h = h * Math.PI / 180; + return lab(l, Math.cos(h) * c, Math.sin(h) * c); + } + + function lab_xyz(x) { + return x > 0.206893034 ? x * x * x : (x - 4 / 29) / 7.787037; + } + + function xyz_lab(x) { + return x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29; + } + + function xyz_rgb(r) { + return Math.round(255 * (r <= 0.00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - 0.055)); + } + + function rgb_xyz(r) { + return (r /= 255) <= 0.04045 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4); + } +})(d3); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/colorbrewer.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/colorbrewer.js new file mode 100644 index 0000000..2295527 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/colorbrewer.js @@ -0,0 +1,302 @@ +// This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/). +var colorbrewer = {YlGn: { +3: ["#f7fcb9","#addd8e","#31a354"], +4: ["#ffffcc","#c2e699","#78c679","#238443"], +5: ["#ffffcc","#c2e699","#78c679","#31a354","#006837"], +6: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"], +7: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"], +8: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"], +9: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"] +},YlGnBu: { +3: ["#edf8b1","#7fcdbb","#2c7fb8"], +4: ["#ffffcc","#a1dab4","#41b6c4","#225ea8"], +5: ["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"], +6: ["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"], +7: ["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"], +8: ["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"], +9: ["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"] +},GnBu: { +3: ["#e0f3db","#a8ddb5","#43a2ca"], +4: ["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"], +5: ["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"], +6: ["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"], +7: ["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"], +8: ["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"], +9: ["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"] +},BuGn: { +3: ["#e5f5f9","#99d8c9","#2ca25f"], +4: ["#edf8fb","#b2e2e2","#66c2a4","#238b45"], +5: ["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"], +6: ["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"], +7: ["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"], +8: ["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"], +9: ["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"] +},PuBuGn: { +3: ["#ece2f0","#a6bddb","#1c9099"], +4: ["#f6eff7","#bdc9e1","#67a9cf","#02818a"], +5: ["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"], +6: ["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"], +7: ["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"], +8: ["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"], +9: ["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"] +},PuBu: { +3: ["#ece7f2","#a6bddb","#2b8cbe"], +4: ["#f1eef6","#bdc9e1","#74a9cf","#0570b0"], +5: ["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"], +6: ["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"], +7: ["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"], +8: ["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"], +9: ["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"] +},BuPu: { +3: ["#e0ecf4","#9ebcda","#8856a7"], +4: ["#edf8fb","#b3cde3","#8c96c6","#88419d"], +5: ["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"], +6: ["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"], +7: ["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"], +8: ["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"], +9: ["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"] +},RdPu: { +3: ["#fde0dd","#fa9fb5","#c51b8a"], +4: ["#feebe2","#fbb4b9","#f768a1","#ae017e"], +5: ["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"], +6: ["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"], +7: ["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"], +8: ["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"], +9: ["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"] +},PuRd: { +3: ["#e7e1ef","#c994c7","#dd1c77"], +4: ["#f1eef6","#d7b5d8","#df65b0","#ce1256"], +5: ["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"], +6: ["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"], +7: ["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"], +8: ["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"], +9: ["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"] +},OrRd: { +3: ["#fee8c8","#fdbb84","#e34a33"], +4: ["#fef0d9","#fdcc8a","#fc8d59","#d7301f"], +5: ["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"], +6: ["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"], +7: ["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"], +8: ["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"], +9: ["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"] +},YlOrRd: { +3: ["#ffeda0","#feb24c","#f03b20"], +4: ["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"], +5: ["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"], +6: ["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"], +7: ["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"], +8: ["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"], +9: ["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"] +},YlOrBr: { +3: ["#fff7bc","#fec44f","#d95f0e"], +4: ["#ffffd4","#fed98e","#fe9929","#cc4c02"], +5: ["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"], +6: ["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"], +7: ["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"], +8: ["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"], +9: ["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"] +},Purples: { +3: ["#efedf5","#bcbddc","#756bb1"], +4: ["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"], +5: ["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"], +6: ["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"], +7: ["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"], +8: ["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"], +9: ["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"] +},Blues: { +3: ["#deebf7","#9ecae1","#3182bd"], +4: ["#eff3ff","#bdd7e7","#6baed6","#2171b5"], +5: ["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"], +6: ["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"], +7: ["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"], +8: ["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"], +9: ["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"] +},Greens: { +3: ["#e5f5e0","#a1d99b","#31a354"], +4: ["#edf8e9","#bae4b3","#74c476","#238b45"], +5: ["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"], +6: ["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"], +7: ["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"], +8: ["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"], +9: ["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"] +},Oranges: { +3: ["#fee6ce","#fdae6b","#e6550d"], +4: ["#feedde","#fdbe85","#fd8d3c","#d94701"], +5: ["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"], +6: ["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"], +7: ["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"], +8: ["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"], +9: ["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"] +},Reds: { +3: ["#fee0d2","#fc9272","#de2d26"], +4: ["#fee5d9","#fcae91","#fb6a4a","#cb181d"], +5: ["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"], +6: ["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"], +7: ["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"], +8: ["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"], +9: ["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"] +},Greys: { +3: ["#f0f0f0","#bdbdbd","#636363"], +4: ["#f7f7f7","#cccccc","#969696","#525252"], +5: ["#f7f7f7","#cccccc","#969696","#636363","#252525"], +6: ["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"], +7: ["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"], +8: ["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"], +9: ["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"] +},PuOr: { +3: ["#f1a340","#f7f7f7","#998ec3"], +4: ["#e66101","#fdb863","#b2abd2","#5e3c99"], +5: ["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"], +6: ["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"], +7: ["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"], +8: ["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"], +9: ["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"], +10: ["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"], +11: ["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"] +},BrBG: { +3: ["#d8b365","#f5f5f5","#5ab4ac"], +4: ["#a6611a","#dfc27d","#80cdc1","#018571"], +5: ["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"], +6: ["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"], +7: ["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"], +8: ["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"], +9: ["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"], +10: ["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"], +11: ["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"] +},PRGn: { +3: ["#af8dc3","#f7f7f7","#7fbf7b"], +4: ["#7b3294","#c2a5cf","#a6dba0","#008837"], +5: ["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"], +6: ["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"], +7: ["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"], +8: ["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"], +9: ["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"], +10: ["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"], +11: ["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"] +},PiYG: { +3: ["#e9a3c9","#f7f7f7","#a1d76a"], +4: ["#d01c8b","#f1b6da","#b8e186","#4dac26"], +5: ["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"], +6: ["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"], +7: ["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"], +8: ["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"], +9: ["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"], +10: ["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"], +11: ["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"] +},RdBu: { +3: ["#ef8a62","#f7f7f7","#67a9cf"], +4: ["#ca0020","#f4a582","#92c5de","#0571b0"], +5: ["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"], +6: ["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"], +7: ["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"], +8: ["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"], +9: ["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"], +10: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"], +11: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"] +},RdGy: { +3: ["#ef8a62","#ffffff","#999999"], +4: ["#ca0020","#f4a582","#bababa","#404040"], +5: ["#ca0020","#f4a582","#ffffff","#bababa","#404040"], +6: ["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"], +7: ["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"], +8: ["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"], +9: ["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"], +10: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"], +11: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"] +},RdYlBu: { +3: ["#fc8d59","#ffffbf","#91bfdb"], +4: ["#d7191c","#fdae61","#abd9e9","#2c7bb6"], +5: ["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"], +6: ["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"], +7: ["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"], +8: ["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"], +9: ["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"], +10: ["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"], +11: ["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"] +},Spectral: { +3: ["#fc8d59","#ffffbf","#99d594"], +4: ["#d7191c","#fdae61","#abdda4","#2b83ba"], +5: ["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"], +6: ["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"], +7: ["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"], +8: ["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"], +9: ["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"], +10: ["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"], +11: ["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"] +},RdYlGn: { +3: ["#fc8d59","#ffffbf","#91cf60"], +4: ["#d7191c","#fdae61","#a6d96a","#1a9641"], +5: ["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"], +6: ["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"], +7: ["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"], +8: ["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"], +9: ["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"], +10: ["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"], +11: ["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"] +},Accent: { +3: ["#7fc97f","#beaed4","#fdc086"], +4: ["#7fc97f","#beaed4","#fdc086","#ffff99"], +5: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"], +6: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"], +7: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"], +8: ["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"] +},Dark2: { +3: ["#1b9e77","#d95f02","#7570b3"], +4: ["#1b9e77","#d95f02","#7570b3","#e7298a"], +5: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"], +6: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"], +7: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"], +8: ["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"] +},Paired: { +3: ["#a6cee3","#1f78b4","#b2df8a"], +4: ["#a6cee3","#1f78b4","#b2df8a","#33a02c"], +5: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"], +6: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"], +7: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"], +8: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"], +9: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"], +10: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"], +11: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"], +12: ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"] +},Pastel1: { +3: ["#fbb4ae","#b3cde3","#ccebc5"], +4: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4"], +5: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"], +6: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"], +7: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"], +8: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"], +9: ["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"] +},Pastel2: { +3: ["#b3e2cd","#fdcdac","#cbd5e8"], +4: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"], +5: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"], +6: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"], +7: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"], +8: ["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"] +},Set1: { +3: ["#e41a1c","#377eb8","#4daf4a"], +4: ["#e41a1c","#377eb8","#4daf4a","#984ea3"], +5: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"], +6: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"], +7: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"], +8: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"], +9: ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"] +},Set2: { +3: ["#66c2a5","#fc8d62","#8da0cb"], +4: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3"], +5: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"], +6: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f"], +7: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494"], +8: ["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"] +},Set3: { +3: ["#8dd3c7","#ffffb3","#bebada"], +4: ["#8dd3c7","#ffffb3","#bebada","#fb8072"], +5: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3"], +6: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462"], +7: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"], +8: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5"], +9: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"], +10: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd"], +11: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5"], +12: ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"] +}}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/core.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/core.js new file mode 100644 index 0000000..912de8d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/core.js @@ -0,0 +1,122 @@ + +var nv = window.nv || {}; + + +nv.version = '1.1.13b'; +nv.dev = true //set false when in production + +window.nv = nv; + +nv.tooltip = {}; // For the tooltip system +nv.utils = nv.utils || {}; // Utility subsystem +nv.models = {}; //stores all the possible models/components +nv.charts = {}; //stores all the ready to use charts +nv.graphs = []; //stores all the graphs currently on the page +nv.logs = {}; //stores some statistics and potential error messages + +nv.dispatch = d3.dispatch('render_start', 'render_end'); + +// ************************************************************************* +// Development render timers - disabled if dev = false + +if (nv.dev) { + nv.dispatch.on('render_start', function(e) { + nv.logs.startTime = +new Date(); + }); + + nv.dispatch.on('render_end', function(e) { + nv.logs.endTime = +new Date(); + nv.logs.totalTime = nv.logs.endTime - nv.logs.startTime; + nv.log('total', nv.logs.totalTime); // used for development, to keep track of graph generation times + }); +} + +// ******************************************** +// Public Core NV functions + +// Logs all arguments, and returns the last so you can test things in place +// Note: in IE8 console.log is an object not a function, and if modernizr is used +// then calling Function.prototype.bind with with anything other than a function +// causes a TypeError to be thrown. +nv.log = function() { + if (nv.dev && console.log && console.log.apply) + console.log.apply(console, arguments) + else if (nv.dev && typeof console.log == "function" && Function.prototype.bind) { + var log = Function.prototype.bind.call(console.log, console); + log.apply(console, arguments); + } + return arguments[arguments.length - 1]; +}; + + +nv.render = function render(step) { + step = step || 1; // number of graphs to generate in each timeout loop + + nv.render.active = true; + nv.dispatch.render_start(); + + setTimeout(function() { + var chart, graph; + + for (var i = 0; i < step && (graph = nv.render.queue[i]); i++) { + chart = graph.generate(); + if (typeof graph.callback == typeof(Function)) graph.callback(chart); + nv.graphs.push(chart); + } + + nv.render.queue.splice(0, i); + + if (nv.render.queue.length) setTimeout(arguments.callee, 0); + else { nv.render.active = false; nv.dispatch.render_end(); } + }, 0); +}; + +nv.render.active = false; +nv.render.queue = []; + +nv.addGraph = function(obj) { + if (typeof arguments[0] === typeof(Function)) + obj = {generate: arguments[0], callback: arguments[1]}; + + nv.render.queue.push(obj); + + if (!nv.render.active) nv.render(); +}; + +nv.identity = function(d) { return d; }; + +nv.strip = function(s) { return s.replace(/(\s|&)/g,''); }; + +function daysInMonth(month,year) { + return (new Date(year, month+1, 0)).getDate(); +} + +function d3_time_range(floor, step, number) { + return function(t0, t1, dt) { + var time = floor(t0), times = []; + if (time < t0) step(time); + if (dt > 1) { + while (time < t1) { + var date = new Date(+time); + if ((number(date) % dt === 0)) times.push(date); + step(time); + } + } else { + while (time < t1) { times.push(new Date(+time)); step(time); } + } + return times; + }; +} + +d3.time.monthEnd = function(date) { + return new Date(date.getFullYear(), date.getMonth(), 0); +}; + +d3.time.monthEnds = d3_time_range(d3.time.monthEnd, function(date) { + date.setUTCDate(date.getUTCDate() + 1); + date.setDate(daysInMonth(date.getMonth() + 1, date.getFullYear())); + }, function(date) { + return date.getMonth(); + } +); + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/crossfilter.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/crossfilter.js new file mode 100644 index 0000000..1aaabca --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/crossfilter.js @@ -0,0 +1,1180 @@ +(function(exports){ +crossfilter.version = "1.0.3"; +function crossfilter_identity(d) { + return d; +} +crossfilter.permute = permute; + +function permute(array, index) { + for (var i = 0, n = index.length, copy = new Array(n); i < n; ++i) { + copy[i] = array[index[i]]; + } + return copy; +} +var bisect = crossfilter.bisect = bisect_by(crossfilter_identity); + +bisect.by = bisect_by; + +function bisect_by(f) { + + // Locate the insertion point for x in a to maintain sorted order. The + // arguments lo and hi may be used to specify a subset of the array which + // should be considered; by default the entire array is used. If x is already + // present in a, the insertion point will be before (to the left of) any + // existing entries. The return value is suitable for use as the first + // argument to `array.splice` assuming that a is already sorted. + // + // The returned insertion point i partitions the array a into two halves so + // that all v < x for v in a[lo:i] for the left side and all v >= x for v in + // a[i:hi] for the right side. + function bisectLeft(a, x, lo, hi) { + while (lo < hi) { + var mid = lo + hi >> 1; + if (f(a[mid]) < x) lo = mid + 1; + else hi = mid; + } + return lo; + } + + // Similar to bisectLeft, but returns an insertion point which comes after (to + // the right of) any existing entries of x in a. + // + // The returned insertion point i partitions the array into two halves so that + // all v <= x for v in a[lo:i] for the left side and all v > x for v in + // a[i:hi] for the right side. + function bisectRight(a, x, lo, hi) { + while (lo < hi) { + var mid = lo + hi >> 1; + if (x < f(a[mid])) hi = mid; + else lo = mid + 1; + } + return lo; + } + + bisectRight.right = bisectRight; + bisectRight.left = bisectLeft; + return bisectRight; +} +var heap = crossfilter.heap = heap_by(crossfilter_identity); + +heap.by = heap_by; + +function heap_by(f) { + + // Builds a binary heap within the specified array a[lo:hi]. The heap has the + // property such that the parent a[lo+i] is always less than or equal to its + // two children: a[lo+2*i+1] and a[lo+2*i+2]. + function heap(a, lo, hi) { + var n = hi - lo, + i = (n >>> 1) + 1; + while (--i > 0) sift(a, i, n, lo); + return a; + } + + // Sorts the specified array a[lo:hi] in descending order, assuming it is + // already a heap. + function sort(a, lo, hi) { + var n = hi - lo, + t; + while (--n > 0) t = a[lo], a[lo] = a[lo + n], a[lo + n] = t, sift(a, 1, n, lo); + return a; + } + + // Sifts the element a[lo+i-1] down the heap, where the heap is the contiguous + // slice of array a[lo:lo+n]. This method can also be used to update the heap + // incrementally, without incurring the full cost of reconstructing the heap. + function sift(a, i, n, lo) { + var d = a[--lo + i], + x = f(d), + child; + while ((child = i << 1) <= n) { + if (child < n && f(a[lo + child]) > f(a[lo + child + 1])) child++; + if (x <= f(a[lo + child])) break; + a[lo + i] = a[lo + child]; + i = child; + } + a[lo + i] = d; + } + + heap.sort = sort; + return heap; +} +var heapselect = crossfilter.heapselect = heapselect_by(crossfilter_identity); + +heapselect.by = heapselect_by; + +function heapselect_by(f) { + var heap = heap_by(f); + + // Returns a new array containing the top k elements in the array a[lo:hi]. + // The returned array is not sorted, but maintains the heap property. If k is + // greater than hi - lo, then fewer than k elements will be returned. The + // order of elements in a is unchanged by this operation. + function heapselect(a, lo, hi, k) { + var queue = new Array(k = Math.min(hi - lo, k)), + min, + i, + x, + d; + + for (i = 0; i < k; ++i) queue[i] = a[lo++]; + heap(queue, 0, k); + + if (lo < hi) { + min = f(queue[0]); + do { + if (x = f(d = a[lo]) > min) { + queue[0] = d; + min = f(heap(queue, 0, k)[0]); + } + } while (++lo < hi); + } + + return queue; + } + + return heapselect; +} +var insertionsort = crossfilter.insertionsort = insertionsort_by(crossfilter_identity); + +insertionsort.by = insertionsort_by; + +function insertionsort_by(f) { + + function insertionsort(a, lo, hi) { + for (var i = lo + 1; i < hi; ++i) { + for (var j = i, t = a[i], x = f(t); j > lo && f(a[j - 1]) > x; --j) { + a[j] = a[j - 1]; + } + a[j] = t; + } + return a; + } + + return insertionsort; +} +// Algorithm designed by Vladimir Yaroslavskiy. +// Implementation based on the Dart project; see lib/dart/LICENSE for details. + +var quicksort = crossfilter.quicksort = quicksort_by(crossfilter_identity); + +quicksort.by = quicksort_by; + +function quicksort_by(f) { + var insertionsort = insertionsort_by(f); + + function sort(a, lo, hi) { + return (hi - lo < quicksort_sizeThreshold + ? insertionsort + : quicksort)(a, lo, hi); + } + + function quicksort(a, lo, hi) { + + // Compute the two pivots by looking at 5 elements. + var sixth = (hi - lo) / 6 | 0, + i1 = lo + sixth, + i5 = hi - 1 - sixth, + i3 = lo + hi - 1 >> 1, // The midpoint. + i2 = i3 - sixth, + i4 = i3 + sixth; + + var e1 = a[i1], x1 = f(e1), + e2 = a[i2], x2 = f(e2), + e3 = a[i3], x3 = f(e3), + e4 = a[i4], x4 = f(e4), + e5 = a[i5], x5 = f(e5); + + var t; + + // Sort the selected 5 elements using a sorting network. + if (x1 > x2) t = e1, e1 = e2, e2 = t, t = x1, x1 = x2, x2 = t; + if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t; + if (x1 > x3) t = e1, e1 = e3, e3 = t, t = x1, x1 = x3, x3 = t; + if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t; + if (x1 > x4) t = e1, e1 = e4, e4 = t, t = x1, x1 = x4, x4 = t; + if (x3 > x4) t = e3, e3 = e4, e4 = t, t = x3, x3 = x4, x4 = t; + if (x2 > x5) t = e2, e2 = e5, e5 = t, t = x2, x2 = x5, x5 = t; + if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t; + if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t; + + var pivot1 = e2, pivotValue1 = x2, + pivot2 = e4, pivotValue2 = x4; + + // e2 and e4 have been saved in the pivot variables. They will be written + // back, once the partitioning is finished. + a[i1] = e1; + a[i2] = a[lo]; + a[i3] = e3; + a[i4] = a[hi - 1]; + a[i5] = e5; + + var less = lo + 1, // First element in the middle partition. + great = hi - 2; // Last element in the middle partition. + + // Note that for value comparison, <, <=, >= and > coerce to a primitive via + // Object.prototype.valueOf; == and === do not, so in order to be consistent + // with natural order (such as for Date objects), we must do two compares. + var pivotsEqual = pivotValue1 <= pivotValue2 && pivotValue1 >= pivotValue2; + if (pivotsEqual) { + + // Degenerated case where the partitioning becomes a dutch national flag + // problem. + // + // [ | < pivot | == pivot | unpartitioned | > pivot | ] + // ^ ^ ^ ^ ^ + // left less k great right + // + // a[left] and a[right] are undefined and are filled after the + // partitioning. + // + // Invariants: + // 1) for x in ]left, less[ : x < pivot. + // 2) for x in [less, k[ : x == pivot. + // 3) for x in ]great, right[ : x > pivot. + for (var k = less; k <= great; ++k) { + var ek = a[k], xk = f(ek); + if (xk < pivotValue1) { + if (k !== less) { + a[k] = a[less]; + a[less] = ek; + } + ++less; + } else if (xk > pivotValue1) { + + // Find the first element <= pivot in the range [k - 1, great] and + // put [:ek:] there. We know that such an element must exist: + // When k == less, then el3 (which is equal to pivot) lies in the + // interval. Otherwise a[k - 1] == pivot and the search stops at k-1. + // Note that in the latter case invariant 2 will be violated for a + // short amount of time. The invariant will be restored when the + // pivots are put into their final positions. + while (true) { + var greatValue = f(a[great]); + if (greatValue > pivotValue1) { + great--; + // This is the only location in the while-loop where a new + // iteration is started. + continue; + } else if (greatValue < pivotValue1) { + // Triple exchange. + a[k] = a[less]; + a[less++] = a[great]; + a[great--] = ek; + break; + } else { + a[k] = a[great]; + a[great--] = ek; + // Note: if great < k then we will exit the outer loop and fix + // invariant 2 (which we just violated). + break; + } + } + } + } + } else { + + // We partition the list into three parts: + // 1. < pivot1 + // 2. >= pivot1 && <= pivot2 + // 3. > pivot2 + // + // During the loop we have: + // [ | < pivot1 | >= pivot1 && <= pivot2 | unpartitioned | > pivot2 | ] + // ^ ^ ^ ^ ^ + // left less k great right + // + // a[left] and a[right] are undefined and are filled after the + // partitioning. + // + // Invariants: + // 1. for x in ]left, less[ : x < pivot1 + // 2. for x in [less, k[ : pivot1 <= x && x <= pivot2 + // 3. for x in ]great, right[ : x > pivot2 + for (var k = less; k <= great; k++) { + var ek = a[k], xk = f(ek); + if (xk < pivotValue1) { + if (k !== less) { + a[k] = a[less]; + a[less] = ek; + } + ++less; + } else { + if (xk > pivotValue2) { + while (true) { + var greatValue = f(a[great]); + if (greatValue > pivotValue2) { + great--; + if (great < k) break; + // This is the only location inside the loop where a new + // iteration is started. + continue; + } else { + // a[great] <= pivot2. + if (greatValue < pivotValue1) { + // Triple exchange. + a[k] = a[less]; + a[less++] = a[great]; + a[great--] = ek; + } else { + // a[great] >= pivot1. + a[k] = a[great]; + a[great--] = ek; + } + break; + } + } + } + } + } + } + + // Move pivots into their final positions. + // We shrunk the list from both sides (a[left] and a[right] have + // meaningless values in them) and now we move elements from the first + // and third partition into these locations so that we can store the + // pivots. + a[lo] = a[less - 1]; + a[less - 1] = pivot1; + a[hi - 1] = a[great + 1]; + a[great + 1] = pivot2; + + // The list is now partitioned into three partitions: + // [ < pivot1 | >= pivot1 && <= pivot2 | > pivot2 ] + // ^ ^ ^ ^ + // left less great right + + // Recursive descent. (Don't include the pivot values.) + sort(a, lo, less - 1); + sort(a, great + 2, hi); + + if (pivotsEqual) { + // All elements in the second partition are equal to the pivot. No + // need to sort them. + return a; + } + + // In theory it should be enough to call _doSort recursively on the second + // partition. + // The Android source however removes the pivot elements from the recursive + // call if the second partition is too large (more than 2/3 of the list). + if (less < i1 && great > i5) { + var lessValue, greatValue; + while ((lessValue = f(a[less])) <= pivotValue1 && lessValue >= pivotValue1) ++less; + while ((greatValue = f(a[great])) <= pivotValue2 && greatValue >= pivotValue2) --great; + + // Copy paste of the previous 3-way partitioning with adaptions. + // + // We partition the list into three parts: + // 1. == pivot1 + // 2. > pivot1 && < pivot2 + // 3. == pivot2 + // + // During the loop we have: + // [ == pivot1 | > pivot1 && < pivot2 | unpartitioned | == pivot2 ] + // ^ ^ ^ + // less k great + // + // Invariants: + // 1. for x in [ *, less[ : x == pivot1 + // 2. for x in [less, k[ : pivot1 < x && x < pivot2 + // 3. for x in ]great, * ] : x == pivot2 + for (var k = less; k <= great; k++) { + var ek = a[k], xk = f(ek); + if (xk <= pivotValue1 && xk >= pivotValue1) { + if (k !== less) { + a[k] = a[less]; + a[less] = ek; + } + less++; + } else { + if (xk <= pivotValue2 && xk >= pivotValue2) { + while (true) { + var greatValue = f(a[great]); + if (greatValue <= pivotValue2 && greatValue >= pivotValue2) { + great--; + if (great < k) break; + // This is the only location inside the loop where a new + // iteration is started. + continue; + } else { + // a[great] < pivot2. + if (greatValue < pivotValue1) { + // Triple exchange. + a[k] = a[less]; + a[less++] = a[great]; + a[great--] = ek; + } else { + // a[great] == pivot1. + a[k] = a[great]; + a[great--] = ek; + } + break; + } + } + } + } + } + } + + // The second partition has now been cleared of pivot elements and looks + // as follows: + // [ * | > pivot1 && < pivot2 | * ] + // ^ ^ + // less great + // Sort the second partition using recursive descent. + + // The second partition looks as follows: + // [ * | >= pivot1 && <= pivot2 | * ] + // ^ ^ + // less great + // Simply sort it by recursive descent. + + return sort(a, less, great + 1); + } + + return sort; +} + +var quicksort_sizeThreshold = 32; +var crossfilter_array8 = crossfilter_arrayUntyped, + crossfilter_array16 = crossfilter_arrayUntyped, + crossfilter_array32 = crossfilter_arrayUntyped, + crossfilter_arrayLengthen = crossfilter_identity, + crossfilter_arrayWiden = crossfilter_identity; + +if (typeof Uint8Array !== "undefined") { + crossfilter_array8 = function(n) { return new Uint8Array(n); }; + crossfilter_array16 = function(n) { return new Uint16Array(n); }; + crossfilter_array32 = function(n) { return new Uint32Array(n); }; + + crossfilter_arrayLengthen = function(array, length) { + var copy = new array.constructor(length); + copy.set(array); + return copy; + }; + + crossfilter_arrayWiden = function(array, width) { + var copy; + switch (width) { + case 16: copy = crossfilter_array16(array.length); break; + case 32: copy = crossfilter_array32(array.length); break; + default: throw new Error("invalid array width!"); + } + copy.set(array); + return copy; + }; +} + +function crossfilter_arrayUntyped(n) { + return new Array(n); +} +function crossfilter_filterExact(bisect, value) { + return function(values) { + var n = values.length; + return [bisect.left(values, value, 0, n), bisect.right(values, value, 0, n)]; + }; +} + +function crossfilter_filterRange(bisect, range) { + var min = range[0], + max = range[1]; + return function(values) { + var n = values.length; + return [bisect.left(values, min, 0, n), bisect.left(values, max, 0, n)]; + }; +} + +function crossfilter_filterAll(values) { + return [0, values.length]; +} +function crossfilter_null() { + return null; +} +function crossfilter_zero() { + return 0; +} +function crossfilter_reduceIncrement(p) { + return p + 1; +} + +function crossfilter_reduceDecrement(p) { + return p - 1; +} + +function crossfilter_reduceAdd(f) { + return function(p, v) { + return p + +f(v); + }; +} + +function crossfilter_reduceSubtract(f) { + return function(p, v) { + return p - f(v); + }; +} +exports.crossfilter = crossfilter; + +function crossfilter() { + var crossfilter = { + add: add, + dimension: dimension, + groupAll: groupAll, + size: size + }; + + var data = [], // the records + n = 0, // the number of records; data.length + m = 0, // number of dimensions in use + M = 8, // number of dimensions that can fit in `filters` + filters = crossfilter_array8(0), // M bits per record; 1 is filtered out + filterListeners = [], // when the filters change + dataListeners = []; // when data is added + + // Adds the specified new records to this crossfilter. + function add(newData) { + var n0 = n, + n1 = newData.length; + + // If there's actually new data to add… + // Merge the new data into the existing data. + // Lengthen the filter bitset to handle the new records. + // Notify listeners (dimensions and groups) that new data is available. + if (n1) { + data = data.concat(newData); + filters = crossfilter_arrayLengthen(filters, n += n1); + dataListeners.forEach(function(l) { l(newData, n0, n1); }); + } + + return crossfilter; + } + + // Adds a new dimension with the specified value accessor function. + function dimension(value) { + var dimension = { + filter: filter, + filterExact: filterExact, + filterRange: filterRange, + filterAll: filterAll, + top: top, + group: group, + groupAll: groupAll + }; + + var one = 1 << m++, // bit mask, e.g., 00001000 + zero = ~one, // inverted one, e.g., 11110111 + values, // sorted, cached array + index, // value rank ↦ object id + newValues, // temporary array storing newly-added values + newIndex, // temporary array storing newly-added index + sort = quicksort_by(function(i) { return newValues[i]; }), + refilter = crossfilter_filterAll, // for recomputing filter + indexListeners = [], // when data is added + lo0 = 0, + hi0 = 0; + + // Updating a dimension is a two-stage process. First, we must update the + // associated filters for the newly-added records. Once all dimensions have + // updated their filters, the groups are notified to update. + dataListeners.unshift(preAdd); + dataListeners.push(postAdd); + + // Incorporate any existing data into this dimension, and make sure that the + // filter bitset is wide enough to handle the new dimension. + if (m > M) filters = crossfilter_arrayWiden(filters, M <<= 1); + preAdd(data, 0, n); + postAdd(data, 0, n); + + // Incorporates the specified new records into this dimension. + // This function is responsible for updating filters, values, and index. + function preAdd(newData, n0, n1) { + + // Permute new values into natural order using a sorted index. + newValues = newData.map(value); + newIndex = sort(crossfilter_range(n1), 0, n1); + newValues = permute(newValues, newIndex); + + // Bisect newValues to determine which new records are selected. + var bounds = refilter(newValues), lo1 = bounds[0], hi1 = bounds[1], i; + for (i = 0; i < lo1; ++i) filters[newIndex[i] + n0] |= one; + for (i = hi1; i < n1; ++i) filters[newIndex[i] + n0] |= one; + + // If this dimension previously had no data, then we don't need to do the + // more expensive merge operation; use the new values and index as-is. + if (!n0) { + values = newValues; + index = newIndex; + lo0 = lo1; + hi0 = hi1; + return; + } + + var oldValues = values, + oldIndex = index, + i0 = 0, + i1 = 0; + + // Otherwise, create new arrays into which to merge new and old. + values = new Array(n); + index = crossfilter_index(n, n); + + // Merge the old and new sorted values, and old and new index. + for (i = 0; i0 < n0 && i1 < n1; ++i) { + if (oldValues[i0] < newValues[i1]) { + values[i] = oldValues[i0]; + index[i] = oldIndex[i0++]; + } else { + values[i] = newValues[i1]; + index[i] = newIndex[i1++] + n0; + } + } + + // Add any remaining old values. + for (; i0 < n0; ++i0, ++i) { + values[i] = oldValues[i0]; + index[i] = oldIndex[i0]; + } + + // Add any remaining new values. + for (; i1 < n1; ++i1, ++i) { + values[i] = newValues[i1]; + index[i] = newIndex[i1] + n0; + } + + // Bisect again to recompute lo0 and hi0. + bounds = refilter(values), lo0 = bounds[0], hi0 = bounds[1]; + } + + // When all filters have updated, notify index listeners of the new values. + function postAdd(newData, n0, n1) { + indexListeners.forEach(function(l) { l(newValues, newIndex, n0, n1); }); + newValues = newIndex = null; + } + + // Updates the selected values based on the specified bounds [lo, hi]. + // This implementation is used by all the public filter methods. + function filterIndex(bounds) { + var i, + j, + k, + lo1 = bounds[0], + hi1 = bounds[1], + added = [], + removed = []; + + // Fast incremental update based on previous lo index. + if (lo1 < lo0) { + for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { + filters[k = index[i]] ^= one; + added.push(k); + } + } else if (lo1 > lo0) { + for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { + filters[k = index[i]] ^= one; + removed.push(k); + } + } + + // Fast incremental update based on previous hi index. + if (hi1 > hi0) { + for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { + filters[k = index[i]] ^= one; + added.push(k); + } + } else if (hi1 < hi0) { + for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { + filters[k = index[i]] ^= one; + removed.push(k); + } + } + + lo0 = lo1; + hi0 = hi1; + filterListeners.forEach(function(l) { l(one, added, removed); }); + return dimension; + } + + // Filters this dimension using the specified range, value, or null. + // If the range is null, this is equivalent to filterAll. + // If the range is an array, this is equivalent to filterRange. + // Otherwise, this is equivalent to filterExact. + function filter(range) { + return range == null + ? filterAll() : Array.isArray(range) + ? filterRange(range) + : filterExact(range); + } + + // Filters this dimension to select the exact value. + function filterExact(value) { + return filterIndex((refilter = crossfilter_filterExact(bisect, value))(values)); + } + + // Filters this dimension to select the specified range [lo, hi]. + // The lower bound is inclusive, and the upper bound is exclusive. + function filterRange(range) { + return filterIndex((refilter = crossfilter_filterRange(bisect, range))(values)); + } + + // Clears any filters on this dimension. + function filterAll() { + return filterIndex((refilter = crossfilter_filterAll)(values)); + } + + // Returns the top K selected records, based on this dimension's order. + // Note: observes this dimension's filter, unlike group and groupAll. + function top(k) { + var array = [], + i = hi0, + j; + + while (--i >= lo0 && k > 0) { + if (!filters[j = index[i]]) { + array.push(data[j]); + --k; + } + } + + return array; + } + + // Adds a new group to this dimension, using the specified key function. + function group(key) { + var group = { + top: top, + all: all, + reduce: reduce, + reduceCount: reduceCount, + reduceSum: reduceSum, + order: order, + orderNatural: orderNatural, + size: size + }; + + var groups, // array of {key, value} + groupIndex, // object id ↦ group id + groupWidth = 8, + groupCapacity = crossfilter_capacity(groupWidth), + k = 0, // cardinality + select, + heap, + reduceAdd, + reduceRemove, + reduceInitial, + update = crossfilter_null, + reset = crossfilter_null, + resetNeeded = true; + + if (arguments.length < 1) key = crossfilter_identity; + + // The group listens to the crossfilter for when any dimension changes, so + // that it can update the associated reduce values. It must also listen to + // the parent dimension for when data is added, and compute new keys. + filterListeners.push(update); + indexListeners.push(add); + + // Incorporate any existing data into the grouping. + add(values, index, 0, n); + + // Incorporates the specified new values into this group. + // This function is responsible for updating groups and groupIndex. + function add(newValues, newIndex, n0, n1) { + var oldGroups = groups, + reIndex = crossfilter_index(k, groupCapacity), + add = reduceAdd, + initial = reduceInitial, + k0 = k, // old cardinality + i0 = 0, // index of old group + i1 = 0, // index of new record + j, // object id + g0, // old group + x0, // old key + x1, // new key + g, // group to add + x; // key of group to add + + // If a reset is needed, we don't need to update the reduce values. + if (resetNeeded) add = initial = crossfilter_null; + + // Reset the new groups (k is a lower bound). + // Also, make sure that groupIndex exists and is long enough. + groups = new Array(k), k = 0; + groupIndex = k0 > 1 ? crossfilter_arrayLengthen(groupIndex, n) : crossfilter_index(n, groupCapacity); + + // Get the first old key (x0 of g0), if it exists. + if (k0) x0 = (g0 = oldGroups[0]).key; + + // Find the first new key (x1), skipping NaN keys. + while (i1 < n1 && !((x1 = key(newValues[i1])) >= x1)) ++i1; + + // While new keys remain… + while (i1 < n1) { + + // Determine the lesser of the two current keys; new and old. + // If there are no old keys remaining, then always add the new key. + if (g0 && x0 <= x1) { + g = g0, x = x0; + + // Record the new index of the old group. + reIndex[i0] = k; + + // Retrieve the next old key. + if (g0 = oldGroups[++i0]) x0 = g0.key; + } else { + g = {key: x1, value: initial()}, x = x1; + } + + // Add the lesser group. + groups[k] = g; + + // Add any selected records belonging to the added group, while + // advancing the new key and populating the associated group index. + while (!(x1 > x)) { + groupIndex[j = newIndex[i1] + n0] = k; + if (!(filters[j] & zero)) g.value = add(g.value, data[j]); + if (++i1 >= n1) break; + x1 = key(newValues[i1]); + } + + groupIncrement(); + } + + // Add any remaining old groups that were greater than all new keys. + // No incremental reduce is needed; these groups have no new records. + // Also record the new index of the old group. + while (i0 < k0) { + groups[reIndex[i0] = k] = oldGroups[i0++]; + groupIncrement(); + } + + // If we added any new groups before any old groups, + // update the group index of all the old records. + if (k > i0) for (i0 = 0; i0 < n0; ++i0) { + groupIndex[i0] = reIndex[groupIndex[i0]]; + } + + // Modify the update and reset behavior based on the cardinality. + // If the cardinality is less than or equal to one, then the groupIndex + // is not needed. If the cardinality is zero, then there are no records + // and therefore no groups to update or reset. Note that we also must + // change the registered listener to point to the new method. + j = filterListeners.indexOf(update); + if (k > 1) { + update = updateMany; + reset = resetMany; + } else { + if (k === 1) { + update = updateOne; + reset = resetOne; + } else { + update = crossfilter_null; + reset = crossfilter_null; + } + groupIndex = null; + } + filterListeners[j] = update; + + // Count the number of added groups, + // and widen the group index as needed. + function groupIncrement() { + if (++k === groupCapacity) { + reIndex = crossfilter_arrayWiden(reIndex, groupWidth <<= 1); + groupIndex = crossfilter_arrayWiden(groupIndex, groupWidth); + groupCapacity = crossfilter_capacity(groupWidth); + } + } + } + + // Reduces the specified selected or deselected records. + // This function is only used when the cardinality is greater than 1. + function updateMany(filterOne, added, removed) { + if (filterOne === one || resetNeeded) return; + + var i, + k, + n, + g; + + // Add the added values. + for (i = 0, n = added.length; i < n; ++i) { + if (!(filters[k = added[i]] & zero)) { + g = groups[groupIndex[k]]; + g.value = reduceAdd(g.value, data[k]); + } + } + + // Remove the removed values. + for (i = 0, n = removed.length; i < n; ++i) { + if ((filters[k = removed[i]] & zero) === filterOne) { + g = groups[groupIndex[k]]; + g.value = reduceRemove(g.value, data[k]); + } + } + } + + // Reduces the specified selected or deselected records. + // This function is only used when the cardinality is 1. + function updateOne(filterOne, added, removed) { + if (filterOne === one || resetNeeded) return; + + var i, + k, + n, + g = groups[0]; + + // Add the added values. + for (i = 0, n = added.length; i < n; ++i) { + if (!(filters[k = added[i]] & zero)) { + g.value = reduceAdd(g.value, data[k]); + } + } + + // Remove the removed values. + for (i = 0, n = removed.length; i < n; ++i) { + if ((filters[k = removed[i]] & zero) === filterOne) { + g.value = reduceRemove(g.value, data[k]); + } + } + } + + // Recomputes the group reduce values from scratch. + // This function is only used when the cardinality is greater than 1. + function resetMany() { + var i, + g; + + // Reset all group values. + for (i = 0; i < k; ++i) { + groups[i].value = reduceInitial(); + } + + // Add any selected records. + for (i = 0; i < n; ++i) { + if (!(filters[i] & zero)) { + g = groups[groupIndex[i]]; + g.value = reduceAdd(g.value, data[i]); + } + } + } + + // Recomputes the group reduce values from scratch. + // This function is only used when the cardinality is 1. + function resetOne() { + var i, + g = groups[0]; + + // Reset the singleton group values. + g.value = reduceInitial(); + + // Add any selected records. + for (i = 0; i < n; ++i) { + if (!(filters[i] & zero)) { + g.value = reduceAdd(g.value, data[i]); + } + } + } + + // Returns the array of group values, in the dimension's natural order. + function all() { + if (resetNeeded) reset(), resetNeeded = false; + return groups; + } + + // Returns a new array containing the top K group values, in reduce order. + function top(k) { + var top = select(all(), 0, groups.length, k); + return heap.sort(top, 0, top.length); + } + + // Sets the reduce behavior for this group to use the specified functions. + // This method lazily recomputes the reduce values, waiting until needed. + function reduce(add, remove, initial) { + reduceAdd = add; + reduceRemove = remove; + reduceInitial = initial; + resetNeeded = true; + return group; + } + + // A convenience method for reducing by count. + function reduceCount() { + return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero); + } + + // A convenience method for reducing by sum(value). + function reduceSum(value) { + return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero); + } + + // Sets the reduce order, using the specified accessor. + function order(value) { + select = heapselect_by(valueOf); + heap = heap_by(valueOf); + function valueOf(d) { return value(d.value); } + return group; + } + + // A convenience method for natural ordering by reduce value. + function orderNatural() { + return order(crossfilter_identity); + } + + // Returns the cardinality of this group, irrespective of any filters. + function size() { + return k; + } + + return reduceCount().orderNatural(); + } + + // A convenience function for generating a singleton group. + function groupAll() { + var g = group(crossfilter_null), all = g.all; + delete g.all; + delete g.top; + delete g.order; + delete g.orderNatural; + delete g.size; + g.value = function() { return all()[0].value; }; + return g; + } + + return dimension; + } + + // A convenience method for groupAll on a dummy dimension. + // This implementation can be optimized since it is always cardinality 1. + function groupAll() { + var group = { + reduce: reduce, + reduceCount: reduceCount, + reduceSum: reduceSum, + value: value + }; + + var reduceValue, + reduceAdd, + reduceRemove, + reduceInitial, + resetNeeded = true; + + // The group listens to the crossfilter for when any dimension changes, so + // that it can update the reduce value. It must also listen to the parent + // dimension for when data is added. + filterListeners.push(update); + dataListeners.push(add); + + // For consistency; actually a no-op since resetNeeded is true. + add(data, 0, n); + + // Incorporates the specified new values into this group. + function add(newData, n0, n1) { + var i; + + if (resetNeeded) return; + + // Add the added values. + for (i = n0; i < n; ++i) { + if (!filters[i]) { + reduceValue = reduceAdd(reduceValue, data[i]); + } + } + } + + // Reduces the specified selected or deselected records. + function update(filterOne, added, removed) { + var i, + k, + n; + + if (resetNeeded) return; + + // Add the added values. + for (i = 0, n = added.length; i < n; ++i) { + if (!filters[k = added[i]]) { + reduceValue = reduceAdd(reduceValue, data[k]); + } + } + + // Remove the removed values. + for (i = 0, n = removed.length; i < n; ++i) { + if (filters[k = removed[i]] === filterOne) { + reduceValue = reduceRemove(reduceValue, data[k]); + } + } + } + + // Recomputes the group reduce value from scratch. + function reset() { + var i; + + reduceValue = reduceInitial(); + + for (i = 0; i < n; ++i) { + if (!filters[i]) { + reduceValue = reduceAdd(reduceValue, data[i]); + } + } + } + + // Sets the reduce behavior for this group to use the specified functions. + // This method lazily recomputes the reduce value, waiting until needed. + function reduce(add, remove, initial) { + reduceAdd = add; + reduceRemove = remove; + reduceInitial = initial; + resetNeeded = true; + return group; + } + + // A convenience method for reducing by count. + function reduceCount() { + return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero); + } + + // A convenience method for reducing by sum(value). + function reduceSum(value) { + return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero); + } + + // Returns the computed reduce value. + function value() { + if (resetNeeded) reset(), resetNeeded = false; + return reduceValue; + } + + return reduceCount(); + } + + // Returns the number of records in this crossfilter, irrespective of any filters. + function size() { + return n; + } + + return arguments.length + ? add(arguments[0]) + : crossfilter; +} + +// Returns an array of size n, big enough to store ids up to m. +function crossfilter_index(n, m) { + return (m < 0x101 + ? crossfilter_array8 : m < 0x10001 + ? crossfilter_array16 + : crossfilter_array32)(n); +} + +// Constructs a new array of size n, with sequential values from 0 to n - 1. +function crossfilter_range(n) { + var range = crossfilter_index(n, n); + for (var i = -1; ++i < n;) range[i] = i; + return range; +} + +function crossfilter_capacity(w) { + return w === 8 + ? 0x100 : w === 16 + ? 0x10000 + : 0x100000000; +} +})(this); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/crossfilter.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/crossfilter.min.js new file mode 100644 index 0000000..981f0d6 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/crossfilter.min.js @@ -0,0 +1 @@ +(function(a){function b(a){return a}function c(a,b){for(var c=0,d=b.length,e=new Array(d);c>1;a(b[f])>1;c>>1)+1;while(--f>0)d(a,f,e,b);return a}function c(a,b,c){var e=c-b,f;while(--e>0)f=a[b],a[b]=a[b+e],a[b+e]=f,d(a,1,e,b);return a}function d(b,c,d,e){var f=b[--e+c],g=a(f),h;while((h=c<<1)<=d){ha(b[e+h+1])&&h++;if(g<=a(b[e+h]))break;b[e+c]=b[e+h],c=h}b[e+c]=f}return b.sort=c,b}function i(a){function c(c,d,e,f){var g=new Array(f=Math.min(e-d,f)),h,i,j,k;for(i=0;ih)g[0]=k,h=a(b(g,0,f)[0]);while(++dc&&a(b[f-1])>h;--f)b[f]=b[f-1];b[f]=g}return b}return b}function m(a){function c(a,c,e){return(e-c>1,j=i-f,k=i+f,l=b[g],m=a(l),n=b[j],o=a(n),p=b[i],q=a(p),r=b[k],s=a(r),t=b[h],u=a(t),v;m>o&&(v=l,l=n,n=v,v=m,m=o,o=v),s>u&&(v=r,r=t,t=v,v=s,s=u,u=v),m>q&&(v=l,l=p,p=v,v=m,m=q,q=v),o>q&&(v=n,n=p,p=v,v=o,o=q,q=v),m>s&&(v=l,l=r,r=v,v=m,m=s,s=v),q>s&&(v=p,p=r,r=v,v=q,q=s,s=v),o>u&&(v=n,n=t,t=v,v=o,o=u,u=v),o>q&&(v=n,n=p,p=v,v=o,o=q,q=v),s>u&&(v=r,r=t,t=v,v=s,s=u,u=v);var w=n,x=o,y=r,z=s;b[g]=l,b[j]=b[d],b[i]=p,b[k]=b[e-1],b[h]=t;var A=d+1,B=e-2,C=x<=z&&x>=z;if(C)for(var D=A;D<=B;++D){var E=b[D],F=a(E);if(Fx)for(;;){var G=a(b[B]);if(G>x){B--;continue}if(Gz)for(;;){var G=a(b[B]);if(G>z){B--;if(Bh){var H,G;while((H=a(b[A]))<=x&&H>=x)++A;while((G=a(b[B]))<=z&&G>=z)--B;for(var D=A;D<=B;D++){var E=b[D],F=a(E);if(F<=x&&F>=x)D!==A&&(b[D]=b[A],b[A]=E),A++;else if(F<=z&&F>=z)for(;;){var G=a(b[B]);if(G<=z&&G>=z){B--;if(BN)for(b=N,c=Math.min(e,O);bO)for(b=Math.max(e,O),c=f;b=N&&a>0)k[d=D[c]]||(b.push(e[d]),--a);return b}function X(a){function K(b,c,g,i){function Q(){++n===m&&(p=s(p,j<<=1),h=s(h,j),m=G(j))}var o=d,p=E(n,m),t=v,u=F,w=n,y=0,z=0,A,B,C,D,K,L;J&&(t=u=x),d=new Array(n),n=0,h=w>1?r(h,f):E(f,m),w&&(C=(B=o[0]).key);while(z=D))++z;while(zL)){h[A=c[z]+g]=n,k[A]&q||(K.value=t(K.value,e[A]));if(++z>=i)break;D=a(b[z])}Q()}while(yy)for(y=0;y1?(H=M,I=O):(n===1?(H=N,I=P):(H=x,I=x),h=null),l[A]=H}function M(a,b,c){if(a===p||J)return;var f,g,i,j;for(f=0,i=b.length;fj&&(k=s(k,j<<=1)),P(e,0,f),Q(e,0,f),o}function t(){function i(a,d,g){var i;if(h)return;for(i=d;imarching + * squares algorithm. Returns the contour polygon as an array of points. + * + * @param grid a two-input function(x, y) that returns true for values + * inside the contour and false for values outside the contour. + * @param start an optional starting point [x, y] on the grid. + * @returns polygon [[x1, y1], [x2, y2], …] + */ +d3.geom.contour = function(grid, start) { + var s = start || d3_geom_contourStart(grid), // starting point + c = [], // contour polygon + x = s[0], // current x position + y = s[1], // current y position + dx = 0, // next x direction + dy = 0, // next y direction + pdx = NaN, // previous x direction + pdy = NaN, // previous y direction + i = 0; + + do { + // determine marching squares index + i = 0; + if (grid(x-1, y-1)) i += 1; + if (grid(x, y-1)) i += 2; + if (grid(x-1, y )) i += 4; + if (grid(x, y )) i += 8; + + // determine next direction + if (i == 6) { + dx = pdy == -1 ? -1 : 1; + dy = 0; + } else if (i == 9) { + dx = 0; + dy = pdx == 1 ? -1 : 1; + } else { + dx = d3_geom_contourDx[i]; + dy = d3_geom_contourDy[i]; + } + + // update contour polygon + if (dx != pdx && dy != pdy) { + c.push([x, y]); + pdx = dx; + pdy = dy; + } + + x += dx; + y += dy; + } while (s[0] != x || s[1] != y); + + return c; +}; + +// lookup tables for marching directions +var d3_geom_contourDx = [1, 0, 1, 1,-1, 0,-1, 1,0, 0,0,0,-1, 0,-1,NaN], + d3_geom_contourDy = [0,-1, 0, 0, 0,-1, 0, 0,1,-1,1,1, 0,-1, 0,NaN]; + +function d3_geom_contourStart(grid) { + var x = 0, + y = 0; + + // search for a starting point; begin at origin + // and proceed along outward-expanding diagonals + while (true) { + if (grid(x,y)) { + return [x,y]; + } + if (x == 0) { + x = y + 1; + y = 0; + } else { + x = x - 1; + y = y + 1; + } + } +}/** + * Computes the 2D convex hull of a set of points using Graham's scanning + * algorithm. The algorithm has been implemented as described in Cormen, + * Leiserson, and Rivest's Introduction to Algorithms. The running time of + * this algorithm is O(n log n), where n is the number of input points. + * + * @param vertices [[x1, y1], [x2, y2], …] + * @returns polygon [[x1, y1], [x2, y2], …] + */ +d3.geom.hull = function(vertices) { + if (vertices.length < 3) return []; + + var len = vertices.length, + plen = len - 1, + points = [], + stack = [], + i, j, h = 0, x1, y1, x2, y2, u, v, a, sp; + + // find the starting ref point: leftmost point with the minimum y coord + for (i=1; i= (x2*x2 + y2*y2)) { + points[i].index = -1; + } else { + points[u].index = -1; + a = points[i].angle; + u = i; + v = j; + } + } else { + a = points[i].angle; + u = i; + v = j; + } + } + + // initialize the stack + stack.push(h); + for (i=0, j=0; i<2; ++j) { + if (points[j].index != -1) { + stack.push(points[j].index); + i++; + } + } + sp = stack.length; + + // do graham's scan + for (; j 0; +}// Note: requires coordinates to be counterclockwise and convex! +d3.geom.polygon = function(coordinates) { + + coordinates.area = function() { + var i = 0, + n = coordinates.length, + a = coordinates[n - 1][0] * coordinates[0][1], + b = coordinates[n - 1][1] * coordinates[0][0]; + while (++i < n) { + a += coordinates[i - 1][0] * coordinates[i][1]; + b += coordinates[i - 1][1] * coordinates[i][0]; + } + return (b - a) * .5; + }; + + coordinates.centroid = function(k) { + var i = -1, + n = coordinates.length - 1, + x = 0, + y = 0, + a, + b, + c; + if (!arguments.length) k = 1 / (6 * coordinates.area()); + while (++i < n) { + a = coordinates[i]; + b = coordinates[i + 1]; + c = a[0] * b[1] - b[0] * a[1]; + x += (a[0] + b[0]) * c; + y += (a[1] + b[1]) * c; + } + return [x * k, y * k]; + }; + + // The Sutherland-Hodgman clipping algorithm. + coordinates.clip = function(subject) { + var input, + i = -1, + n = coordinates.length, + j, + m, + a = coordinates[n - 1], + b, + c, + d; + while (++i < n) { + input = subject.slice(); + subject.length = 0; + b = coordinates[i]; + c = input[(m = input.length) - 1]; + j = -1; + while (++j < m) { + d = input[j]; + if (d3_geom_polygonInside(d, a, b)) { + if (!d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + subject.push(d); + } else if (d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + c = d; + } + a = b; + } + return subject; + }; + + return coordinates; +}; + +function d3_geom_polygonInside(p, a, b) { + return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]); +} + +// Intersect two infinite lines cd and ab. +function d3_geom_polygonIntersect(c, d, a, b) { + var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0], + y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1], + x13 = x1 - x3, + x21 = x2 - x1, + x43 = x4 - x3, + y13 = y1 - y3, + y21 = y2 - y1, + y43 = y4 - y3, + ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21); + return [x1 + ua * x21, y1 + ua * y21]; +} +// Adapted from Nicolas Garcia Belmonte's JIT implementation: +// http://blog.thejit.org/2010/02/12/voronoi-tessellation/ +// http://blog.thejit.org/assets/voronoijs/voronoi.js +// See lib/jit/LICENSE for details. + +/** + * @param vertices [[x1, y1], [x2, y2], …] + * @returns polygons [[[x1, y1], [x2, y2], …], …] + */ +d3.geom.voronoi = function(vertices) { + var polygons = vertices.map(function() { return []; }); + + // Note: we expect the caller to clip the polygons, if needed. + d3_voronoi_tessellate(vertices, function(e) { + var s1, + s2, + x1, + x2, + y1, + y2; + if (e.a == 1 && e.b >= 0) { + s1 = e.ep.r; + s2 = e.ep.l; + } else { + s1 = e.ep.l; + s2 = e.ep.r; + } + if (e.a == 1) { + y1 = s1 ? s1.y : -1e6; + x1 = e.c - e.b * y1; + y2 = s2 ? s2.y : 1e6; + x2 = e.c - e.b * y2; + } else { + x1 = s1 ? s1.x : -1e6; + y1 = e.c - e.a * x1; + x2 = s2 ? s2.x : 1e6; + y2 = e.c - e.a * x2; + } + var v1 = [x1, y1], + v2 = [x2, y2]; + polygons[e.region.l.index].push(v1, v2); + polygons[e.region.r.index].push(v1, v2); + }); + + // Reconnect the polygon segments into counterclockwise loops. + return polygons.map(function(polygon, i) { + var cx = vertices[i][0], + cy = vertices[i][1]; + polygon.forEach(function(v) { + v.angle = Math.atan2(v[0] - cx, v[1] - cy); + }); + return polygon.sort(function(a, b) { + return a.angle - b.angle; + }).filter(function(d, i) { + return !i || (d.angle - polygon[i - 1].angle > 1e-10); + }); + }); +}; + +var d3_voronoi_opposite = {"l": "r", "r": "l"}; + +function d3_voronoi_tessellate(vertices, callback) { + + var Sites = { + list: vertices + .map(function(v, i) { + return { + index: i, + x: v[0], + y: v[1] + }; + }) + .sort(function(a, b) { + return a.y < b.y ? -1 + : a.y > b.y ? 1 + : a.x < b.x ? -1 + : a.x > b.x ? 1 + : 0; + }), + bottomSite: null + }; + + var EdgeList = { + list: [], + leftEnd: null, + rightEnd: null, + + init: function() { + EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.leftEnd.r = EdgeList.rightEnd; + EdgeList.rightEnd.l = EdgeList.leftEnd; + EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd); + }, + + createHalfEdge: function(edge, side) { + return { + edge: edge, + side: side, + vertex: null, + "l": null, + "r": null + }; + }, + + insert: function(lb, he) { + he.l = lb; + he.r = lb.r; + lb.r.l = he; + lb.r = he; + }, + + leftBound: function(p) { + var he = EdgeList.leftEnd; + do { + he = he.r; + } while (he != EdgeList.rightEnd && Geom.rightOf(he, p)); + he = he.l; + return he; + }, + + del: function(he) { + he.l.r = he.r; + he.r.l = he.l; + he.edge = null; + }, + + right: function(he) { + return he.r; + }, + + left: function(he) { + return he.l; + }, + + leftRegion: function(he) { + return he.edge == null + ? Sites.bottomSite + : he.edge.region[he.side]; + }, + + rightRegion: function(he) { + return he.edge == null + ? Sites.bottomSite + : he.edge.region[d3_voronoi_opposite[he.side]]; + } + }; + + var Geom = { + + bisect: function(s1, s2) { + var newEdge = { + region: {"l": s1, "r": s2}, + ep: {"l": null, "r": null} + }; + + var dx = s2.x - s1.x, + dy = s2.y - s1.y, + adx = dx > 0 ? dx : -dx, + ady = dy > 0 ? dy : -dy; + + newEdge.c = s1.x * dx + s1.y * dy + + (dx * dx + dy * dy) * .5; + + if (adx > ady) { + newEdge.a = 1; + newEdge.b = dy / dx; + newEdge.c /= dx; + } else { + newEdge.b = 1; + newEdge.a = dx / dy; + newEdge.c /= dy; + } + + return newEdge; + }, + + intersect: function(el1, el2) { + var e1 = el1.edge, + e2 = el2.edge; + if (!e1 || !e2 || (e1.region.r == e2.region.r)) { + return null; + } + var d = (e1.a * e2.b) - (e1.b * e2.a); + if (Math.abs(d) < 1e-10) { + return null; + } + var xint = (e1.c * e2.b - e2.c * e1.b) / d, + yint = (e2.c * e1.a - e1.c * e2.a) / d, + e1r = e1.region.r, + e2r = e2.region.r, + el, + e; + if ((e1r.y < e2r.y) || + (e1r.y == e2r.y && e1r.x < e2r.x)) { + el = el1; + e = e1; + } else { + el = el2; + e = e2; + } + var rightOfSite = (xint >= e.region.r.x); + if ((rightOfSite && (el.side == "l")) || + (!rightOfSite && (el.side == "r"))) { + return null; + } + return { + x: xint, + y: yint + }; + }, + + rightOf: function(he, p) { + var e = he.edge, + topsite = e.region.r, + rightOfSite = (p.x > topsite.x); + + if (rightOfSite && (he.side == "l")) { + return 1; + } + if (!rightOfSite && (he.side == "r")) { + return 0; + } + if (e.a == 1) { + var dyp = p.y - topsite.y, + dxp = p.x - topsite.x, + fast = 0, + above = 0; + + if ((!rightOfSite && (e.b < 0)) || + (rightOfSite && (e.b >= 0))) { + above = fast = (dyp >= e.b * dxp); + } else { + above = ((p.x + p.y * e.b) > e.c); + if (e.b < 0) { + above = !above; + } + if (!above) { + fast = 1; + } + } + if (!fast) { + var dxs = topsite.x - e.region.l.x; + above = (e.b * (dxp * dxp - dyp * dyp)) < + (dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b)); + + if (e.b < 0) { + above = !above; + } + } + } else /* e.b == 1 */ { + var yl = e.c - e.a * p.x, + t1 = p.y - yl, + t2 = p.x - topsite.x, + t3 = yl - topsite.y; + + above = (t1 * t1) > (t2 * t2 + t3 * t3); + } + return he.side == "l" ? above : !above; + }, + + endPoint: function(edge, side, site) { + edge.ep[side] = site; + if (!edge.ep[d3_voronoi_opposite[side]]) return; + callback(edge); + }, + + distance: function(s, t) { + var dx = s.x - t.x, + dy = s.y - t.y; + return Math.sqrt(dx * dx + dy * dy); + } + }; + + var EventQueue = { + list: [], + + insert: function(he, site, offset) { + he.vertex = site; + he.ystar = site.y + offset; + for (var i=0, list=EventQueue.list, l=list.length; i next.ystar || + (he.ystar == next.ystar && + site.x > next.vertex.x)) { + continue; + } else { + break; + } + } + list.splice(i, 0, he); + }, + + del: function(he) { + for (var i=0, ls=EventQueue.list, l=ls.length; i top.y) { + temp = bot; + bot = top; + top = temp; + pm = "r"; + } + e = Geom.bisect(bot, top); + bisector = EdgeList.createHalfEdge(e, pm); + EdgeList.insert(llbnd, bisector); + Geom.endPoint(e, d3_voronoi_opposite[pm], v); + p = Geom.intersect(llbnd, bisector); + if (p) { + EventQueue.del(llbnd); + EventQueue.insert(llbnd, p, Geom.distance(p, bot)); + } + p = Geom.intersect(bisector, rrbnd); + if (p) { + EventQueue.insert(bisector, p, Geom.distance(p, bot)); + } + } else { + break; + } + }//end while + + for (lbnd = EdgeList.right(EdgeList.leftEnd); + lbnd != EdgeList.rightEnd; + lbnd = EdgeList.right(lbnd)) { + callback(lbnd.edge); + } +} +/** +* @param vertices [[x1, y1], [x2, y2], …] +* @returns triangles [[[x1, y1], [x2, y2], [x3, y3]], …] + */ +d3.geom.delaunay = function(vertices) { + var edges = vertices.map(function() { return []; }), + triangles = []; + + // Use the Voronoi tessellation to determine Delaunay edges. + d3_voronoi_tessellate(vertices, function(e) { + edges[e.region.l.index].push(vertices[e.region.r.index]); + }); + + // Reconnect the edges into counterclockwise triangles. + edges.forEach(function(edge, i) { + var v = vertices[i], + cx = v[0], + cy = v[1]; + edge.forEach(function(v) { + v.angle = Math.atan2(v[0] - cx, v[1] - cy); + }); + edge.sort(function(a, b) { + return a.angle - b.angle; + }); + for (var j = 0, m = edge.length - 1; j < m; j++) { + triangles.push([v, edge[j], edge[j + 1]]); + } + }); + + return triangles; +}; +/** + * Constructs a new quadtree for the specified array of points. A quadtree is a + * two-dimensional recursive spatial subdivision. This implementation uses + * square partitions, dividing each square into four equally-sized squares. Each + * point exists in a unique node; if multiple points are in the same position, + * some points may be stored on internal nodes rather than leaf nodes. Quadtrees + * can be used to accelerate various spatial operations, such as the Barnes-Hut + * approximation for computing n-body forces, or collision detection. + * + * @param points [[x1, y1], [x2, y2], …] + * @return quadtree root {left: boolean, nodes: […], point: [x, y]} + */ +d3.geom.quadtree = function(points) { + var p, + i = -1, + n = points.length; + + /* Compute bounds. */ + var x1 = Number.POSITIVE_INFINITY, y1 = x1, + x2 = Number.NEGATIVE_INFINITY, y2 = x2; + while (++i < n) { + p = points[i]; + if (p[0] < x1) x1 = p[0]; + if (p[1] < y1) y1 = p[1]; + if (p[0] > x2) x2 = p[0]; + if (p[1] > y2) y2 = p[1]; + } + + /* Squarify the bounds. */ + var dx = x2 - x1, + dy = y2 - y1; + if (dx > dy) y2 = y1 + dx; + else x2 = x1 + dy; + + /** + * @ignore Recursively inserts the specified point p at the node + * n or one of its descendants. The bounds are defined by [x1, + * x2] and [y1, y2]. + */ + function insert(n, p, x1, y1, x2, y2) { + if (isNaN(p[0]) || isNaN(p[1])) return; // ignore invalid points + if (n.leaf) { + var v = n.point; + if (v) { + /* + * If the point at this leaf node is at the same position as the new + * point we are adding, we leave the point associated with the + * internal node while adding the new point to a child node. This + * avoids infinite recursion. + */ + if ((Math.abs(v[0] - p[0]) + Math.abs(v[1] - p[1])) < .01) { + insertChild(n, p, x1, y1, x2, y2); + } else { + n.point = null; + insertChild(n, v, x1, y1, x2, y2); + insertChild(n, p, x1, y1, x2, y2); + } + } else { + n.point = p; + } + } else { + insertChild(n, p, x1, y1, x2, y2); + } + } + + /** + * @ignore Recursively inserts the specified point p into a + * descendant of node n. The bounds are defined by [x1, + * x2] and [y1, y2]. + */ + function insertChild(n, p, x1, y1, x2, y2) { + /* Compute the split point, and the quadrant in which to insert p. */ + var sx = (x1 + x2) * .5, + sy = (y1 + y2) * .5, + right = p[0] >= sx, + bottom = p[1] >= sy, + i = (bottom << 1) + right; + + /* Recursively insert into the child node. */ + n.leaf = false; + n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); + + /* Update the bounds as we recurse. */ + if (right) x1 = sx; else x2 = sx; + if (bottom) y1 = sy; else y2 = sy; + insert(n, p, x1, y1, x2, y2); + } + + /* Create the root node. */ + var root = d3_geom_quadtreeNode(); + + /* Insert all points. */ + i = -1; + while (++i < n) insert(root, points[i], x1, y1, x2, y2); + + /* Register a visitor function for the root. */ + root.visit = function(f) { + d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2); + }; + + return root; +}; + +function d3_geom_quadtreeNode() { + return { + leaf: true, + nodes: [], + point: null + }; +} + +function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { + if (!f(node, x1, y1, x2, y2)) { + var sx = (x1 + x2) * .5, + sy = (y1 + y2) * .5, + children = node.nodes; + if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); + if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); + if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); + if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); + } +} +})() \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.js new file mode 100644 index 0000000..250d976 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.js @@ -0,0 +1,3015 @@ +(function(){d3 = {version: "1.8.5"}; // semver +if (!Date.now) Date.now = function() { + return +new Date(); +}; +if (!Object.create) Object.create = function(o) { + /** @constructor */ function f() {} + f.prototype = o; + return new f(); +}; +var d3_array = d3_arraySlice; // conversion for NodeLists + +function d3_arrayCopy(psuedoarray) { + var i = -1, n = psuedoarray.length, array = []; + while (++i < n) array.push(psuedoarray[i]); + return array; +} + +function d3_arraySlice(psuedoarray) { + return Array.prototype.slice.call(psuedoarray); +} + +try { + d3_array(document.documentElement.childNodes)[0].nodeType; +} catch(e) { + d3_array = d3_arrayCopy; +} +function d3_functor(v) { + return typeof v == "function" ? v : function() { return v; }; +} +// A getter-setter method that preserves the appropriate `this` context. +d3.rebind = function(object, method) { + return function() { + var x = method.apply(object, arguments); + return arguments.length ? object : x; + }; +}; +d3.ascending = function(a, b) { + return a < b ? -1 : a > b ? 1 : 0; +}; +d3.descending = function(a, b) { + return b < a ? -1 : b > a ? 1 : 0; +}; +d3.min = function(array, f) { + var i = 0, + n = array.length, + a = array[0], + b; + if (arguments.length == 1) { + while (++i < n) if (a > (b = array[i])) a = b; + } else { + a = f(array[0]); + while (++i < n) if (a > (b = f(array[i]))) a = b; + } + return a; +}; +d3.max = function(array, f) { + var i = 0, + n = array.length, + a = array[0], + b; + if (arguments.length == 1) { + while (++i < n) if (a < (b = array[i])) a = b; + } else { + a = f(a); + while (++i < n) if (a < (b = f(array[i]))) a = b; + } + return a; +}; +d3.nest = function() { + var nest = {}, + keys = [], + sortKeys = [], + sortValues, + rollup; + + function map(array, depth) { + if (depth >= keys.length) return rollup + ? rollup.call(nest, array) : (sortValues + ? array.sort(sortValues) + : array); + + var i = -1, + n = array.length, + key = keys[depth++], + keyValue, + object, + o = {}; + + while (++i < n) { + if ((keyValue = key(object = array[i])) in o) { + o[keyValue].push(object); + } else { + o[keyValue] = [object]; + } + } + + for (keyValue in o) { + o[keyValue] = map(o[keyValue], depth); + } + + return o; + } + + function entries(map, depth) { + if (depth >= keys.length) return map; + + var a = [], + sortKey = sortKeys[depth++], + key; + + for (key in map) { + a.push({key: key, values: entries(map[key], depth)}); + } + + if (sortKey) a.sort(function(a, b) { + return sortKey(a.key, b.key); + }); + + return a; + } + + nest.map = function(array) { + return map(array, 0); + }; + + nest.entries = function(array) { + return entries(map(array, 0), 0); + }; + + nest.key = function(d) { + keys.push(d); + return nest; + }; + + // Specifies the order for the most-recently specified key. + // Note: only applies to entries. Map keys are unordered! + nest.sortKeys = function(order) { + sortKeys[keys.length - 1] = order; + return nest; + }; + + // Specifies the order for leaf values. + // Applies to both maps and entries array. + nest.sortValues = function(order) { + sortValues = order; + return nest; + }; + + nest.rollup = function(f) { + rollup = f; + return nest; + }; + + return nest; +}; +d3.keys = function(map) { + var keys = []; + for (var key in map) keys.push(key); + return keys; +}; +d3.values = function(map) { + var values = []; + for (var key in map) values.push(map[key]); + return values; +}; +d3.entries = function(map) { + var entries = []; + for (var key in map) entries.push({key: key, value: map[key]}); + return entries; +}; +d3.merge = function(arrays) { + return Array.prototype.concat.apply([], arrays); +}; +d3.split = function(array, f) { + var arrays = [], + values = [], + value, + i = -1, + n = array.length; + if (arguments.length < 2) f = d3_splitter; + while (++i < n) { + if (f.call(values, value = array[i], i)) { + values = []; + } else { + if (!values.length) arrays.push(values); + values.push(value); + } + } + return arrays; +}; + +function d3_splitter(d) { + return d == null; +} +function d3_collapse(s) { + return s.replace(/(^\s+)|(\s+$)/g, "").replace(/\s+/g, " "); +} +// +// Note: assigning to the arguments array simultaneously changes the value of +// the corresponding argument! +// +// TODO The `this` argument probably shouldn't be the first argument to the +// callback, anyway, since it's redundant. However, that will require a major +// version bump due to backwards compatibility, so I'm not changing it right +// away. +// +function d3_call(callback) { + callback.apply(this, (arguments[0] = this, arguments)); + return this; +} +/** + * @param {number} start + * @param {number=} stop + * @param {number=} step + */ +d3.range = function(start, stop, step) { + if (arguments.length == 1) { stop = start; start = 0; } + if (step == null) step = 1; + if ((stop - start) / step == Infinity) throw new Error("infinite range"); + var range = [], + i = -1, + j; + if (step < 0) while ((j = start + step * ++i) > stop) range.push(j); + else while ((j = start + step * ++i) < stop) range.push(j); + return range; +}; +d3.requote = function(s) { + return s.replace(d3_requote_re, "\\$&"); +}; + +var d3_requote_re = /[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g; +d3.xhr = function(url, mime, callback) { + var req = new XMLHttpRequest(); + if (arguments.length < 3) callback = mime; + else if (mime && req.overrideMimeType) req.overrideMimeType(mime); + req.open("GET", url, true); + req.onreadystatechange = function() { + if (req.readyState == 4) callback(req.status < 300 ? req : null); + }; + req.send(null); +}; +d3.text = function(url, mime, callback) { + function ready(req) { + callback(req && req.responseText); + } + if (arguments.length < 3) { + callback = mime; + mime = null; + } + d3.xhr(url, mime, ready); +}; +d3.json = function(url, callback) { + d3.text(url, "application/json", function(text) { + callback(text ? JSON.parse(text) : null); + }); +}; +d3.html = function(url, callback) { + d3.text(url, "text/html", function(text) { + if (text != null) { // Treat empty string as valid HTML. + var range = document.createRange(); + range.selectNode(document.body); + text = range.createContextualFragment(text); + } + callback(text); + }); +}; +d3.xml = function(url, mime, callback) { + function ready(req) { + callback(req && req.responseXML); + } + if (arguments.length < 3) { + callback = mime; + mime = null; + } + d3.xhr(url, mime, ready); +}; +d3.ns = { + + prefix: { + svg: "http://www.w3.org/2000/svg", + xhtml: "http://www.w3.org/1999/xhtml", + xlink: "http://www.w3.org/1999/xlink", + xml: "http://www.w3.org/XML/1998/namespace", + xmlns: "http://www.w3.org/2000/xmlns/" + }, + + qualify: function(name) { + var i = name.indexOf(":"); + return i < 0 ? name : { + space: d3.ns.prefix[name.substring(0, i)], + local: name.substring(i + 1) + }; + } + +}; +/** @param {...string} types */ +d3.dispatch = function(types) { + var dispatch = {}, + type; + for (var i = 0, n = arguments.length; i < n; i++) { + type = arguments[i]; + dispatch[type] = d3_dispatch(type); + } + return dispatch; +}; + +function d3_dispatch(type) { + var dispatch = {}, + listeners = []; + + dispatch.add = function(listener) { + for (var i = 0; i < listeners.length; i++) { + if (listeners[i].listener == listener) return dispatch; // already registered + } + listeners.push({listener: listener, on: true}); + return dispatch; + }; + + dispatch.remove = function(listener) { + for (var i = 0; i < listeners.length; i++) { + var l = listeners[i]; + if (l.listener == listener) { + l.on = false; + listeners = listeners.slice(0, i).concat(listeners.slice(i + 1)); + break; + } + } + return dispatch; + }; + + dispatch.dispatch = function() { + var ls = listeners; // defensive reference + for (var i = 0, n = ls.length; i < n; i++) { + var l = ls[i]; + if (l.on) l.listener.apply(this, arguments); + } + }; + + return dispatch; +}; +// TODO align, type +d3.format = function(specifier) { + var match = d3_format_re.exec(specifier), + fill = match[1] || " ", + sign = match[3] || "", + zfill = match[5], + width = +match[6], + comma = match[7], + precision = match[8], + type = match[9]; + if (precision) precision = precision.substring(1); + if (zfill) { + fill = "0"; // TODO align = "="; + if (comma) width -= Math.floor((width - 1) / 4); + } + if (type == "d") precision = "0"; + return function(value) { + var number = +value, + negative = (number < 0) && (number = -number) ? "\u2212" : sign; + + // Return the empty string for floats formatted as ints. + if ((type == "d") && (number % 1)) return ""; + + // Convert the input value to the desired precision. + if (precision) value = number.toFixed(precision); + else value = "" + number; + + // If the fill character is 0, the sign and group is applied after the fill. + if (zfill) { + var length = value.length + negative.length; + if (length < width) value = new Array(width - length + 1).join(fill) + value; + if (comma) value = d3_format_group(value); + value = negative + value; + } + + // Otherwise (e.g., space-filling), the sign and group is applied before. + else { + if (comma) value = d3_format_group(value); + value = negative + value; + var length = value.length; + if (length < width) value = new Array(width - length + 1).join(fill) + value; + } + + return value; + }; +}; + +// [[fill]align][sign][#][0][width][,][.precision][type] +var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/; + +// Apply comma grouping for thousands. +function d3_format_group(value) { + var i = value.lastIndexOf("."), + f = i >= 0 ? value.substring(i) : (i = value.length, ""), + t = []; + while (i > 0) t.push(value.substring(i -= 3, i + 3)); + return t.reverse().join(",") + f; +} +/* + * TERMS OF USE - EASING EQUATIONS + * + * Open source under the BSD License. + * + * Copyright 2001 Robert Penner + * 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 author nor the names of contributors may be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. + */ + +var d3_ease_quad = d3_ease_poly(2), + d3_ease_cubic = d3_ease_poly(3); + +var d3_ease = { + linear: function() { return d3_ease_linear; }, + poly: d3_ease_poly, + quad: function() { return d3_ease_quad; }, + cubic: function() { return d3_ease_cubic; }, + sin: function() { return d3_ease_sin; }, + exp: function() { return d3_ease_exp; }, + circle: function() { return d3_ease_circle; }, + elastic: d3_ease_elastic, + back: d3_ease_back, + bounce: function() { return d3_ease_bounce; } +}; + +var d3_ease_mode = { + "in": function(f) { return f; }, + "out": d3_ease_reverse, + "in-out": d3_ease_reflect, + "out-in": function(f) { return d3_ease_reflect(d3_ease_reverse(f)); } +}; + +d3.ease = function(name) { + var i = name.indexOf("-"), + t = i >= 0 ? name.substring(0, i) : name, + m = i >= 0 ? name.substring(i + 1) : "in"; + return d3_ease_mode[m](d3_ease[t].apply(null, Array.prototype.slice.call(arguments, 1))); +}; + +function d3_ease_reverse(f) { + return function(t) { + return 1 - f(1 - t); + }; +} + +function d3_ease_reflect(f) { + return function(t) { + return .5 * (t < .5 ? f(2 * t) : (2 - f(2 - 2 * t))); + }; +} + +function d3_ease_linear(t) { + return t; +} + +function d3_ease_poly(e) { + return function(t) { + return Math.pow(t, e); + } +} + +function d3_ease_sin(t) { + return 1 - Math.cos(t * Math.PI / 2); +} + +function d3_ease_exp(t) { + return t ? Math.pow(2, 10 * (t - 1)) - 1e-3 : 0; +} + +function d3_ease_circle(t) { + return 1 - Math.sqrt(1 - t * t); +} + +function d3_ease_elastic(a, p) { + var s; + if (arguments.length < 2) p = 0.45; + if (arguments.length < 1) { a = 1; s = p / 4; } + else s = p / (2 * Math.PI) * Math.asin(1 / a); + return function(t) { + return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p); + }; +} + +function d3_ease_back(s) { + if (!s) s = 1.70158; + return function(t) { + return t * t * ((s + 1) * t - s); + }; +} + +function d3_ease_bounce(t) { + return t < 1 / 2.75 ? 7.5625 * t * t + : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 + : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 + : 7.5625 * (t -= 2.625 / 2.75) * t + .984375; +} +d3.event = null; +d3.interpolate = function(a, b) { + if (typeof b == "number") return d3.interpolateNumber(+a, b); + if (typeof b == "string") { + return (b in d3_rgb_names) || /^(#|rgb\(|hsl\()/.test(b) + ? d3.interpolateRgb(String(a), b) + : d3.interpolateString(String(a), b); + } + if (b instanceof Array) return d3.interpolateArray(a, b); + return d3.interpolateObject(a, b); +}; + +d3.interpolateNumber = function(a, b) { + b -= a; + return function(t) { return a + b * t; }; +}; + +d3.interpolateRound = function(a, b) { + b -= a; + return function(t) { return Math.round(a + b * t); }; +}; + +d3.interpolateString = function(a, b) { + var m, // current match + i, // current index + j, // current index (for coallescing) + s0 = 0, // start index of current string prefix + s1 = 0, // end index of current string prefix + s = [], // string constants and placeholders + q = [], // number interpolators + n, // q.length + o; + + // Find all numbers in b. + for (i = 0; m = d3_interpolate_number.exec(b); ++i) { + if (m.index) s.push(b.substring(s0, s1 = m.index)); + q.push({i: s.length, x: m[0]}); + s.push(null); + s0 = d3_interpolate_number.lastIndex; + } + if (s0 < b.length) s.push(b.substring(s0)); + + // Find all numbers in a. + for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) { + o = q[i]; + if (o.x == m[0]) { // The numbers match, so coallesce. + if (o.i) { + if (s[o.i + 1] == null) { // This match is followed by another number. + s[o.i - 1] += o.x; + s.splice(o.i, 1); + for (j = i + 1; j < n; ++j) q[j].i--; + } else { // This match is followed by a string, so coallesce twice. + s[o.i - 1] += o.x + s[o.i + 1]; + s.splice(o.i, 2); + for (j = i + 1; j < n; ++j) q[j].i -= 2; + } + } else { + if (s[o.i + 1] == null) { // This match is followed by another number. + s[o.i] = o.x; + } else { // This match is followed by a string, so coallesce twice. + s[o.i] = o.x + s[o.i + 1]; + s.splice(o.i + 1, 1); + for (j = i + 1; j < n; ++j) q[j].i--; + } + } + q.splice(i, 1); + n--; + i--; + } else { + o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x)); + } + } + + // Remove any numbers in b not found in a. + while (i < n) { + o = q.pop(); + if (s[o.i + 1] == null) { // This match is followed by another number. + s[o.i] = o.x; + } else { // This match is followed by a string, so coallesce twice. + s[o.i] = o.x + s[o.i + 1]; + s.splice(o.i + 1, 1); + } + n--; + } + + // Special optimization for only a single match. + if (s.length == 1) { + return s[0] == null ? q[0].x : function() { return b; }; + } + + // Otherwise, interpolate each of the numbers and rejoin the string. + return function(t) { + for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; +}; + +d3.interpolateRgb = function(a, b) { + a = d3.rgb(a); + b = d3.rgb(b); + var ar = a.r, + ag = a.g, + ab = a.b, + br = b.r - ar, + bg = b.g - ag, + bb = b.b - ab; + return function(t) { + return "rgb(" + Math.round(ar + br * t) + + "," + Math.round(ag + bg * t) + + "," + Math.round(ab + bb * t) + + ")"; + }; +}; + +// interpolates HSL space, but outputs RGB string (for compatibility) +d3.interpolateHsl = function(a, b) { + a = d3.hsl(a); + b = d3.hsl(b); + var h0 = a.h, + s0 = a.s, + l0 = a.l, + h1 = b.h - h0, + s1 = b.s - s0, + l1 = b.l - l0; + return function(t) { + return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t).toString(); + }; +}; + +d3.interpolateArray = function(a, b) { + var x = [], + c = [], + na = a.length, + nb = b.length, + n0 = Math.min(a.length, b.length), + i; + for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i])); + for (; i < na; ++i) c[i] = a[i]; + for (; i < nb; ++i) c[i] = b[i]; + return function(t) { + for (i = 0; i < n0; ++i) c[i] = x[i](t); + return c; + }; +}; + +d3.interpolateObject = function(a, b) { + var i = {}, + c = {}, + k; + for (k in a) { + if (k in b) { + i[k] = d3_interpolateByName(k)(a[k], b[k]); + } else { + c[k] = a[k]; + } + } + for (k in b) { + if (!(k in a)) { + c[k] = b[k]; + } + } + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; +} + +var d3_interpolate_number = /[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g, + d3_interpolate_digits = /[-+]?\d*\.?\d*(?:[eE][-]?\d+)?(.*)/, + d3_interpolate_rgb = {background: 1, fill: 1, stroke: 1}; + +function d3_interpolateByName(n) { + return n in d3_interpolate_rgb || /\bcolor\b/.test(n) + ? d3.interpolateRgb + : d3.interpolate; +} +/** + * @param {number=} g + * @param {number=} b + */ +d3.rgb = function(r, g, b) { + return arguments.length == 1 + ? d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) + : d3_rgb(~~r, ~~g, ~~b); +}; + +function d3_rgb(r, g, b) { + return {r: r, g: g, b: b, toString: d3_rgb_format}; +} + +/** @this d3_rgb */ +function d3_rgb_format() { + return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b); +} + +function d3_rgb_hex(v) { + return v < 0x10 ? "0" + v.toString(16) : v.toString(16); +} + +function d3_rgb_parse(format, rgb, hsl) { + var r = 0, // red channel; int in [0, 255] + g = 0, // green channel; int in [0, 255] + b = 0, // blue channel; int in [0, 255] + m1, // CSS color specification match + m2, // CSS color specification type (e.g., rgb) + name; + + /* Handle hsl, rgb. */ + m1 = /([a-z]+)\((.*)\)/i.exec(format); + if (m1) { + m2 = m1[2].split(","); + switch (m1[1]) { + case "hsl": { + return hsl( + parseFloat(m2[0]), // degrees + parseFloat(m2[1]) / 100, // percentage + parseFloat(m2[2]) / 100 // percentage + ); + } + case "rgb": { + return rgb( + d3_rgb_parseNumber(m2[0]), + d3_rgb_parseNumber(m2[1]), + d3_rgb_parseNumber(m2[2]) + ); + } + } + } + + /* Named colors. */ + if (name = d3_rgb_names[format]) return rgb(name.r, name.g, name.b); + + /* Hexadecimal colors: #rgb and #rrggbb. */ + if (format != null && format.charAt(0) == "#") { + if (format.length == 4) { + r = format.charAt(1); r += r; + g = format.charAt(2); g += g; + b = format.charAt(3); b += b; + } else if (format.length == 7) { + r = format.substring(1, 3); + g = format.substring(3, 5); + b = format.substring(5, 7); + } + r = parseInt(r, 16); + g = parseInt(g, 16); + b = parseInt(b, 16); + } + + return rgb(r, g, b); +} + +function d3_rgb_hsl(r, g, b) { + var min = Math.min(r /= 255, g /= 255, b /= 255), + max = Math.max(r, g, b), + d = max - min, + h, + s, + l = (max + min) / 2; + if (d) { + s = l < .5 ? d / (max + min) : d / (2 - max - min); + if (r == max) h = (g - b) / d + (g < b ? 6 : 0); + else if (g == max) h = (b - r) / d + 2; + else h = (r - g) / d + 4; + h *= 60; + } else { + s = h = 0; + } + return d3_hsl(h, s, l); +} + +function d3_rgb_parseNumber(c) { // either integer or percentage + var f = parseFloat(c); + return c.charAt(c.length - 1) == "%" ? Math.round(f * 2.55) : f; +} + +var d3_rgb_names = { + aliceblue: "#f0f8ff", + antiquewhite: "#faebd7", + aqua: "#00ffff", + aquamarine: "#7fffd4", + azure: "#f0ffff", + beige: "#f5f5dc", + bisque: "#ffe4c4", + black: "#000000", + blanchedalmond: "#ffebcd", + blue: "#0000ff", + blueviolet: "#8a2be2", + brown: "#a52a2a", + burlywood: "#deb887", + cadetblue: "#5f9ea0", + chartreuse: "#7fff00", + chocolate: "#d2691e", + coral: "#ff7f50", + cornflowerblue: "#6495ed", + cornsilk: "#fff8dc", + crimson: "#dc143c", + cyan: "#00ffff", + darkblue: "#00008b", + darkcyan: "#008b8b", + darkgoldenrod: "#b8860b", + darkgray: "#a9a9a9", + darkgreen: "#006400", + darkgrey: "#a9a9a9", + darkkhaki: "#bdb76b", + darkmagenta: "#8b008b", + darkolivegreen: "#556b2f", + darkorange: "#ff8c00", + darkorchid: "#9932cc", + darkred: "#8b0000", + darksalmon: "#e9967a", + darkseagreen: "#8fbc8f", + darkslateblue: "#483d8b", + darkslategray: "#2f4f4f", + darkslategrey: "#2f4f4f", + darkturquoise: "#00ced1", + darkviolet: "#9400d3", + deeppink: "#ff1493", + deepskyblue: "#00bfff", + dimgray: "#696969", + dimgrey: "#696969", + dodgerblue: "#1e90ff", + firebrick: "#b22222", + floralwhite: "#fffaf0", + forestgreen: "#228b22", + fuchsia: "#ff00ff", + gainsboro: "#dcdcdc", + ghostwhite: "#f8f8ff", + gold: "#ffd700", + goldenrod: "#daa520", + gray: "#808080", + green: "#008000", + greenyellow: "#adff2f", + grey: "#808080", + honeydew: "#f0fff0", + hotpink: "#ff69b4", + indianred: "#cd5c5c", + indigo: "#4b0082", + ivory: "#fffff0", + khaki: "#f0e68c", + lavender: "#e6e6fa", + lavenderblush: "#fff0f5", + lawngreen: "#7cfc00", + lemonchiffon: "#fffacd", + lightblue: "#add8e6", + lightcoral: "#f08080", + lightcyan: "#e0ffff", + lightgoldenrodyellow: "#fafad2", + lightgray: "#d3d3d3", + lightgreen: "#90ee90", + lightgrey: "#d3d3d3", + lightpink: "#ffb6c1", + lightsalmon: "#ffa07a", + lightseagreen: "#20b2aa", + lightskyblue: "#87cefa", + lightslategray: "#778899", + lightslategrey: "#778899", + lightsteelblue: "#b0c4de", + lightyellow: "#ffffe0", + lime: "#00ff00", + limegreen: "#32cd32", + linen: "#faf0e6", + magenta: "#ff00ff", + maroon: "#800000", + mediumaquamarine: "#66cdaa", + mediumblue: "#0000cd", + mediumorchid: "#ba55d3", + mediumpurple: "#9370db", + mediumseagreen: "#3cb371", + mediumslateblue: "#7b68ee", + mediumspringgreen: "#00fa9a", + mediumturquoise: "#48d1cc", + mediumvioletred: "#c71585", + midnightblue: "#191970", + mintcream: "#f5fffa", + mistyrose: "#ffe4e1", + moccasin: "#ffe4b5", + navajowhite: "#ffdead", + navy: "#000080", + oldlace: "#fdf5e6", + olive: "#808000", + olivedrab: "#6b8e23", + orange: "#ffa500", + orangered: "#ff4500", + orchid: "#da70d6", + palegoldenrod: "#eee8aa", + palegreen: "#98fb98", + paleturquoise: "#afeeee", + palevioletred: "#db7093", + papayawhip: "#ffefd5", + peachpuff: "#ffdab9", + peru: "#cd853f", + pink: "#ffc0cb", + plum: "#dda0dd", + powderblue: "#b0e0e6", + purple: "#800080", + red: "#ff0000", + rosybrown: "#bc8f8f", + royalblue: "#4169e1", + saddlebrown: "#8b4513", + salmon: "#fa8072", + sandybrown: "#f4a460", + seagreen: "#2e8b57", + seashell: "#fff5ee", + sienna: "#a0522d", + silver: "#c0c0c0", + skyblue: "#87ceeb", + slateblue: "#6a5acd", + slategray: "#708090", + slategrey: "#708090", + snow: "#fffafa", + springgreen: "#00ff7f", + steelblue: "#4682b4", + tan: "#d2b48c", + teal: "#008080", + thistle: "#d8bfd8", + tomato: "#ff6347", + turquoise: "#40e0d0", + violet: "#ee82ee", + wheat: "#f5deb3", + white: "#ffffff", + whitesmoke: "#f5f5f5", + yellow: "#ffff00", + yellowgreen: "#9acd32" +}; + +for (var d3_rgb_name in d3_rgb_names) { + d3_rgb_names[d3_rgb_name] = d3_rgb_parse( + d3_rgb_names[d3_rgb_name], + d3_rgb, + d3_hsl_rgb); +} +/** + * @param {number=} s + * @param {number=} l + */ +d3.hsl = function(h, s, l) { + return arguments.length == 1 + ? d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) + : d3_hsl(+h, +s, +l); +}; + +function d3_hsl(h, s, l) { + return {h: h, s: s, l: l, toString: d3_hsl_format}; +} + +/** @this d3_hsl */ +function d3_hsl_format() { + return "hsl(" + this.h + "," + this.s * 100 + "%," + this.l * 100 + "%)"; +} + +function d3_hsl_rgb(h, s, l) { + var m1, + m2; + + /* Some simple corrections for h, s and l. */ + h = h % 360; if (h < 0) h += 360; + s = s < 0 ? 0 : s > 1 ? 1 : s; + l = l < 0 ? 0 : l > 1 ? 1 : l; + + /* From FvD 13.37, CSS Color Module Level 3 */ + m2 = l <= .5 ? l * (1 + s) : l + s - l * s; + m1 = 2 * l - m2; + + function v(h) { + if (h > 360) h -= 360; + else if (h < 0) h += 360; + if (h < 60) return m1 + (m2 - m1) * h / 60; + if (h < 180) return m2; + if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; + return m1; + } + + function vv(h) { + return Math.round(v(h) * 255); + } + + return d3_rgb(vv(h + 120), vv(h), vv(h - 120)); +} +var d3_select = function(s, n) { return n.querySelector(s); }, + d3_selectAll = function(s, n) { return d3_array(n.querySelectorAll(s)); }; + +// Use Sizzle, if available. +if (typeof Sizzle == "function") { + d3_select = function(s, n) { return Sizzle(s, n)[0]; }; + d3_selectAll = function(s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); }; +} + +var d3_root = d3_selection([[document]]); +d3_root[0].parentNode = document.documentElement; + +// TODO fast singleton implementation! +d3.select = function(selector) { + return typeof selector == "string" + ? d3_root.select(selector) + : d3_selection([[selector]]); // assume node +}; + +d3.selectAll = function(selector) { + return typeof selector == "string" + ? d3_root.selectAll(selector) + : d3_selection([d3_array(selector)]); // assume node[] +}; + +function d3_selection(groups) { + + function select(select) { + var subgroups = [], + subgroup, + subnode, + group, + node; + for (var j = 0, m = groups.length; j < m; j++) { + group = groups[j]; + subgroups.push(subgroup = []); + subgroup.parentNode = group.parentNode; + subgroup.parentData = group.parentData; + for (var i = 0, n = group.length; i < n; i++) { + if (node = group[i]) { + subgroup.push(subnode = select(node)); + if (subnode && "__data__" in node) subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + return d3_selection(subgroups); + } + + function selectAll(selectAll) { + var subgroups = [], + subgroup, + group, + node; + for (var j = 0, m = groups.length; j < m; j++) { + group = groups[j]; + for (var i = 0, n = group.length; i < n; i++) { + if (node = group[i]) { + subgroups.push(subgroup = selectAll(node)); + subgroup.parentNode = node; + subgroup.parentData = node.__data__; + } + } + } + return d3_selection(subgroups); + } + + // TODO select(function)? + groups.select = function(selector) { + return select(function(node) { + return d3_select(selector, node); + }); + }; + + // TODO selectAll(function)? + groups.selectAll = function(selector) { + return selectAll(function(node) { + return d3_selectAll(selector, node); + }); + }; + + // TODO preserve null elements to maintain index? + groups.filter = function(filter) { + var subgroups = [], + subgroup, + group, + node; + for (var j = 0, m = groups.length; j < m; j++) { + group = groups[j]; + subgroups.push(subgroup = []); + subgroup.parentNode = group.parentNode; + subgroup.parentData = group.parentData; + for (var i = 0, n = group.length; i < n; i++) { + if ((node = group[i]) && filter.call(node, node.__data__, i)) { + subgroup.push(node); + } + } + } + return d3_selection(subgroups); + }; + + groups.map = function(map) { + var group, + node; + for (var j = 0, m = groups.length; j < m; j++) { + group = groups[j]; + for (var i = 0, n = group.length; i < n; i++) { + if (node = group[i]) node.__data__ = map.call(node, node.__data__, i); + } + } + return groups; + }; + + // TODO data(null) for clearing data? + groups.data = function(data, join) { + var enter = [], + update = [], + exit = []; + + function bind(group, groupData) { + var i = 0, + n = group.length, + m = groupData.length, + n0 = Math.min(n, m), + n1 = Math.max(n, m), + updateNodes = [], + enterNodes = [], + exitNodes = [], + node, + nodeData; + + function enterNode(data) { + return {__data__: data}; + } + + if (join) { + var nodeByKey = {}, + exitData = [], + keys = [], + key, + j = groupData.length; + + for (i = 0; i < n; i++) { + key = join.call(node = group[i], node.__data__, i); + if (key in nodeByKey) { + exitNodes[j++] = group[i]; + } else { + nodeByKey[key] = node; + keys.push(key); + } + } + + for (i = 0; i < m; i++) { + node = nodeByKey[key = join.call(groupData, nodeData = groupData[i], i)]; + if (node) { + node.__data__ = nodeData; + updateNodes[i] = node; + enterNodes[i] = exitNodes[i] = null; + } else { + enterNodes[i] = enterNode(nodeData), + updateNodes[i] = exitNodes[i] = null; + } + delete nodeByKey[key]; + } + + for (i = 0; i < n; i++) { + if (keys[i] in nodeByKey) { + exitNodes[i] = group[i]; + } + } + } else { + for (; i < n0; i++) { + node = group[i]; + nodeData = groupData[i]; + if (node) { + node.__data__ = nodeData; + updateNodes[i] = node; + enterNodes[i] = exitNodes[i] = null; + } else { + enterNodes[i] = enterNode(nodeData); + updateNodes[i] = exitNodes[i] = null; + } + } + for (; i < m; i++) { + enterNodes[i] = enterNode(groupData[i]); + updateNodes[i] = exitNodes[i] = null; + } + for (; i < n1; i++) { + exitNodes[i] = group[i]; + enterNodes[i] = updateNodes[i] = null; + } + } + + enterNodes.parentNode + = updateNodes.parentNode + = exitNodes.parentNode + = group.parentNode; + + enterNodes.parentData + = updateNodes.parentData + = exitNodes.parentData + = group.parentData; + + enter.push(enterNodes); + update.push(updateNodes); + exit.push(exitNodes); + } + + var i = -1, + n = groups.length, + group; + if (typeof data == "function") { + while (++i < n) { + bind(group = groups[i], data.call(group, group.parentData, i)); + } + } else { + while (++i < n) { + bind(group = groups[i], data); + } + } + + var selection = d3_selection(update); + selection.enter = function() { + return d3_selectionEnter(enter); + }; + selection.exit = function() { + return d3_selection(exit); + }; + return selection; + }; + + // TODO mask forEach? or rename for eachData? + // TODO offer the same semantics for map, reduce, etc.? + groups.each = function(callback) { + for (var j = 0, m = groups.length; j < m; j++) { + var group = groups[j]; + for (var i = 0, n = group.length; i < n; i++) { + var node = group[i]; + if (node) callback.call(node, node.__data__, i); + } + } + return groups; + }; + + function first(callback) { + for (var j = 0, m = groups.length; j < m; j++) { + var group = groups[j]; + for (var i = 0, n = group.length; i < n; i++) { + var node = group[i]; + if (node) return callback.call(node, node.__data__, i); + } + } + return null; + } + + groups.empty = function() { + return !first(function() { return true; }); + }; + + groups.node = function() { + return first(function() { return this; }); + }; + + groups.attr = function(name, value) { + name = d3.ns.qualify(name); + + // If no value is specified, return the first value. + if (arguments.length < 2) { + return first(name.local + ? function() { return this.getAttributeNS(name.space, name.local); } + : function() { return this.getAttribute(name); }); + } + + /** @this {Element} */ + function attrNull() { + this.removeAttribute(name); + } + + /** @this {Element} */ + function attrNullNS() { + this.removeAttributeNS(name.space, name.local); + } + + /** @this {Element} */ + function attrConstant() { + this.setAttribute(name, value); + } + + /** @this {Element} */ + function attrConstantNS() { + this.setAttributeNS(name.space, name.local, value); + } + + /** @this {Element} */ + function attrFunction() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttribute(name); + else this.setAttribute(name, x); + } + + /** @this {Element} */ + function attrFunctionNS() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttributeNS(name.space, name.local); + else this.setAttributeNS(name.space, name.local, x); + } + + return groups.each(value == null + ? (name.local ? attrNullNS : attrNull) : (typeof value == "function" + ? (name.local ? attrFunctionNS : attrFunction) + : (name.local ? attrConstantNS : attrConstant))); + }; + + groups.classed = function(name, value) { + var re = new RegExp("(^|\\s+)" + d3.requote(name) + "(\\s+|$)", "g"); + + // If no value is specified, return the first value. + if (arguments.length < 2) { + return first(function() { + re.lastIndex = 0; + return re.test(this.className); + }); + } + + /** @this {Element} */ + function classedAdd() { + var classes = this.className; + re.lastIndex = 0; + if (!re.test(classes)) { + this.className = d3_collapse(classes + " " + name); + } + } + + /** @this {Element} */ + function classedRemove() { + var classes = d3_collapse(this.className.replace(re, " ")); + this.className = classes.length ? classes : null; + } + + /** @this {Element} */ + function classedFunction() { + (value.apply(this, arguments) + ? classedAdd + : classedRemove).call(this); + } + + return groups.each(typeof value == "function" + ? classedFunction : value + ? classedAdd + : classedRemove); + }; + + groups.style = function(name, value, priority) { + if (arguments.length < 3) priority = null; + + // If no value is specified, return the first value. + if (arguments.length < 2) { + return first(function() { + return window.getComputedStyle(this, null).getPropertyValue(name); + }); + } + + /** @this {Element} */ + function styleNull() { + this.style.removeProperty(name); + } + + /** @this {Element} */ + function styleConstant() { + this.style.setProperty(name, value, priority); + } + + /** @this {Element} */ + function styleFunction() { + var x = value.apply(this, arguments); + if (x == null) this.style.removeProperty(name); + else this.style.setProperty(name, x, priority); + } + + return groups.each(value == null + ? styleNull : (typeof value == "function" + ? styleFunction : styleConstant)); + }; + + groups.property = function(name, value) { + name = d3.ns.qualify(name); + + // If no value is specified, return the first value. + if (arguments.length < 2) { + return first(function() { + return this[name]; + }); + } + + /** @this {Element} */ + function propertyNull() { + delete this[name]; + } + + /** @this {Element} */ + function propertyConstant() { + this[name] = value; + } + + /** @this {Element} */ + function propertyFunction() { + var x = value.apply(this, arguments); + if (x == null) delete this[name]; + else this[name] = x; + } + + return groups.each(value == null + ? propertyNull : (typeof value == "function" + ? propertyFunction : propertyConstant)); + }; + + groups.text = function(value) { + + // If no value is specified, return the first value. + if (arguments.length < 1) { + return first(function() { + return this.textContent; + }); + } + + /** @this {Element} */ + function textNull() { + while (this.lastChild) this.removeChild(this.lastChild); + } + + /** @this {Element} */ + function textConstant() { + this.appendChild(document.createTextNode(value)); + } + + /** @this {Element} */ + function textFunction() { + var x = value.apply(this, arguments); + if (x != null) this.appendChild(document.createTextNode(x)); + } + + groups.each(textNull); + return value == null ? groups + : groups.each(typeof value == "function" + ? textFunction : textConstant); + }; + + groups.html = function(value) { + + // If no value is specified, return the first value. + if (arguments.length < 1) { + return first(function() { + return this.innerHTML; + }); + } + + /** @this {Element} */ + function htmlConstant() { + this.innerHTML = value; + } + + /** @this {Element} */ + function htmlFunction() { + this.innerHTML = value.apply(this, arguments); + } + + return groups.each(typeof value == "function" + ? htmlFunction : htmlConstant); + }; + + // TODO append(node)? + // TODO append(function)? + groups.append = function(name) { + name = d3.ns.qualify(name); + + function append(node) { + return node.appendChild(document.createElement(name)); + } + + function appendNS(node) { + return node.appendChild(document.createElementNS(name.space, name.local)); + } + + return select(name.local ? appendNS : append); + }; + + // TODO insert(node, function)? + // TODO insert(function, string)? + // TODO insert(function, function)? + groups.insert = function(name, before) { + name = d3.ns.qualify(name); + + function insert(node) { + return node.insertBefore( + document.createElement(name), + d3_select(before, node)); + } + + function insertNS(node) { + return node.insertBefore( + document.createElementNS(name.space, name.local), + d3_select(before, node)); + } + + return select(name.local ? insertNS : insert); + }; + + // TODO remove(selector)? + // TODO remove(node)? + // TODO remove(function)? + groups.remove = function() { + return select(function(node) { + var parent = node.parentNode; + parent.removeChild(node); + return parent; + }); + }; + + groups.sort = function(comparator) { + comparator = d3_selection_comparator.apply(this, arguments); + for (var j = 0, m = groups.length; j < m; j++) { + var group = groups[j]; + group.sort(comparator); + for (var i = 1, n = group.length, prev = group[0]; i < n; i++) { + var node = group[i]; + if (node) { + if (prev) prev.parentNode.insertBefore(node, prev.nextSibling); + prev = node; + } + } + } + return groups; + }; + + // type can be namespaced, e.g., "click.foo" + // listener can be null for removal + groups.on = function(type, listener) { + + // parse the type specifier + var i = type.indexOf("."), + typo = i == -1 ? type : type.substring(0, i), + name = "__on" + type; + + // remove the old event listener, and add the new event listener + return groups.each(function(d, i) { + if (this[name]) this.removeEventListener(typo, this[name], false); + if (listener) this.addEventListener(typo, this[name] = l, false); + + // wrapped event listener that preserves d, i + function l(e) { + var o = d3.event; // Events can be reentrant (e.g., focus). + d3.event = e; + try { + listener.call(this, d, i); + } finally { + d3.event = o; + } + } + }); + }; + + // TODO slice? + + groups.transition = function() { + return d3_transition(groups); + }; + + groups.call = d3_call; + + return groups; +} + +function d3_selectionEnter(groups) { + + function select(select) { + var subgroups = [], + subgroup, + subnode, + group, + node; + for (var j = 0, m = groups.length; j < m; j++) { + group = groups[j]; + subgroups.push(subgroup = []); + subgroup.parentNode = group.parentNode; + subgroup.parentData = group.parentData; + for (var i = 0, n = group.length; i < n; i++) { + if (node = group[i]) { + subgroup.push(subnode = select(group.parentNode)); + subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + return d3_selection(subgroups); + } + + // TODO append(node)? + // TODO append(function)? + groups.append = function(name) { + name = d3.ns.qualify(name); + + function append(node) { + return node.appendChild(document.createElement(name)); + } + + function appendNS(node) { + return node.appendChild(document.createElementNS(name.space, name.local)); + } + + return select(name.local ? appendNS : append); + }; + + // TODO insert(node, function)? + // TODO insert(function, string)? + // TODO insert(function, function)? + groups.insert = function(name, before) { + name = d3.ns.qualify(name); + + function insert(node) { + return node.insertBefore( + document.createElement(name), + d3_select(before, node)); + } + + function insertNS(node) { + return node.insertBefore( + document.createElementNS(name.space, name.local), + d3_select(before, node)); + } + + return select(name.local ? insertNS : insert); + }; + + return groups; +} + +function d3_selection_comparator(comparator) { + if (!arguments.length) comparator = d3.ascending; + return function(a, b) { + return comparator(a && a.__data__, b && b.__data__); + }; +} +d3.transition = d3_root.transition; + +var d3_transitionId = 0, + d3_transitionInheritId = 0; + +function d3_transition(groups) { + var transition = {}, + transitionId = d3_transitionInheritId || ++d3_transitionId, + tweens = {}, + interpolators = [], + remove = false, + event = d3.dispatch("start", "end"), + stage = [], + delay = [], + duration = [], + durationMax, + ease = d3.ease("cubic-in-out"); + + // + // Be careful with concurrent transitions! + // + // Say transition A causes an exit. Before A finishes, a transition B is + // created, and believes it only needs to do an update, because the elements + // haven't been removed yet (which happens at the very end of the exit + // transition). + // + // Even worse, what if either transition A or B has a staggered delay? Then, + // some elements may be removed, while others remain. Transition B does not + // know to enter the elements because they were still present at the time + // the transition B was created (but not yet started). + // + // To prevent such confusion, we only trigger end events for transitions if + // the transition ending is the only one scheduled for the given element. + // Similarly, we only allow one transition to be active for any given + // element, so that concurrent transitions do not overwrite each other's + // properties. + // + // TODO Support transition namespaces, so that transitions can proceed + // concurrently on the same element if needed. Hopefully, this is rare! + // + + groups.each(function() { + (this.__transition__ || (this.__transition__ = {})).owner = transitionId; + }); + + function step(elapsed) { + var clear = true, + k = -1; + groups.each(function() { + if (stage[++k] == 2) return; // ended + var t = (elapsed - delay[k]) / duration[k], + tx = this.__transition__, + te, // ease(t) + tk, // tween key + ik = interpolators[k]; + + // Check if the (un-eased) time is outside the range [0,1]. + if (t < 1) { + clear = false; + if (t < 0) return; + } else { + t = 1; + } + + // Determine the stage of this transition. + // 0 - Not yet started. + // 1 - In progress. + // 2 - Ended. + if (stage[k]) { + if (!tx || tx.active != transitionId) { + stage[k] = 2; + return; + } + } else if (!tx || tx.active > transitionId) { + stage[k] = 2; + return; + } else { + stage[k] = 1; + event.start.dispatch.apply(this, arguments); + ik = interpolators[k] = {}; + tx.active = transitionId; + for (tk in tweens) ik[tk] = tweens[tk].apply(this, arguments); + } + + // Apply the interpolators! + te = ease(t); + for (tk in tweens) ik[tk].call(this, te); + + // Handle ending transitions. + if (t == 1) { + stage[k] = 2; + if (tx.active == transitionId) { + var owner = tx.owner; + if (owner == transitionId) { + delete this.__transition__; + if (remove) this.parentNode.removeChild(this); + } + d3_transitionInheritId = transitionId; + event.end.dispatch.apply(this, arguments); + d3_transitionInheritId = 0; + tx.owner = owner; + } + } + }); + return clear; + } + + transition.delay = function(value) { + var delayMin = Infinity, + k = -1; + if (typeof value == "function") { + groups.each(function(d, i) { + var x = delay[++k] = +value.apply(this, arguments); + if (x < delayMin) delayMin = x; + }); + } else { + delayMin = +value; + groups.each(function(d, i) { + delay[++k] = delayMin; + }); + } + d3_timer(step, delayMin); + return transition; + }; + + transition.duration = function(value) { + var k = -1; + if (typeof value == "function") { + durationMax = 0; + groups.each(function(d, i) { + var x = duration[++k] = +value.apply(this, arguments); + if (x > durationMax) durationMax = x; + }); + } else { + durationMax = +value; + groups.each(function(d, i) { + duration[++k] = durationMax; + }); + } + return transition; + }; + + transition.ease = function(value) { + ease = typeof value == "function" ? value : d3.ease.apply(d3, arguments); + return transition; + }; + + transition.attrTween = function(name, tween) { + + /** @this {Element} */ + function attrTween(d, i) { + var f = tween.call(this, d, i, this.getAttribute(name)); + return function(t) { + this.setAttribute(name, f(t)); + }; + } + + /** @this {Element} */ + function attrTweenNS(d, i) { + var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local)); + return function(t) { + this.setAttributeNS(name.space, name.local, f(t)); + }; + } + + tweens["attr." + name] = name.local ? attrTweenNS : attrTween; + return transition; + }; + + transition.attr = function(name, value) { + return transition.attrTween(name, d3_transitionTween(value)); + }; + + transition.styleTween = function(name, tween, priority) { + if (arguments.length < 3) priority = null; + + /** @this {Element} */ + function styleTween(d, i) { + var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name)); + return function(t) { + this.style.setProperty(name, f(t), priority); + }; + } + + tweens["style." + name] = styleTween; + return transition; + }; + + transition.style = function(name, value, priority) { + if (arguments.length < 3) priority = null; + return transition.styleTween(name, d3_transitionTween(value), priority); + }; + + transition.select = function(query) { + var k, t = d3_transition(groups.select(query)).ease(ease); + k = -1; t.delay(function(d, i) { return delay[++k]; }); + k = -1; t.duration(function(d, i) { return duration[++k]; }); + return t; + }; + + transition.selectAll = function(query) { + var k, t = d3_transition(groups.selectAll(query)).ease(ease); + k = -1; t.delay(function(d, i) { return delay[i ? k : ++k]; }) + k = -1; t.duration(function(d, i) { return duration[i ? k : ++k]; }); + return t; + }; + + transition.remove = function() { + remove = true; + return transition; + }; + + transition.each = function(type, listener) { + event[type].add(listener); + return transition; + }; + + transition.call = d3_call; + + return transition.delay(0).duration(250); +} + +function d3_transitionTween(b) { + return typeof b == "function" + ? function(d, i, a) { return d3.interpolate(a, String(b.call(this, d, i))); } + : (b = String(b), function(d, i, a) { return d3.interpolate(a, b); }); +} +var d3_timer_queue = null, + d3_timer_timeout = 0, + d3_timer_interval; + +// The timer will continue to fire until callback returns true. +d3.timer = function(callback) { + d3_timer(callback, 0); +}; + +function d3_timer(callback, delay) { + var now = Date.now(), + found = false, + start = now + delay, + t0, + t1 = d3_timer_queue; + + if (!isFinite(delay)) return; + + // Scan the queue for earliest callback. + while (t1) { + if (t1.callback == callback) { + t1.then = now; + t1.delay = delay; + found = true; + } else { + var x = t1.then + t1.delay; + if (x < start) start = x; + } + t0 = t1; + t1 = t1.next; + } + + // Otherwise, add the callback to the queue. + if (!found) d3_timer_queue = { + callback: callback, + then: now, + delay: delay, + next: d3_timer_queue + }; + + if (!d3_timer_interval) { + clearTimeout(d3_timer_timeout); + d3_timer_timeout = setTimeout(d3_timer_start, Math.max(24, start - now)); + } +} + +function d3_timer_start() { + d3_timer_interval = 1; + d3_timer_timeout = 0; + d3_timer_frame(d3_timer_step); +} + +function d3_timer_step() { + var elapsed, + now = Date.now(), + t0 = null, + t1 = d3_timer_queue; + while (t1) { + elapsed = now - t1.then; + if (elapsed > t1.delay) t1.flush = t1.callback(elapsed); + t1 = (t0 = t1).next; + } + d3_timer_flush(); + if (d3_timer_interval) d3_timer_frame(d3_timer_step); +} + +// Flush after callbacks, to avoid concurrent queue modification. +function d3_timer_flush() { + var t0 = null, + t1 = d3_timer_queue; + while (t1) { + t1 = t1.flush + ? (t0 ? t0.next = t1.next : d3_timer_queue = t1.next) + : (t0 = t1).next; + } + if (!t0) d3_timer_interval = 0; +} + +var d3_timer_frame = window.requestAnimationFrame + || window.webkitRequestAnimationFrame + || window.mozRequestAnimationFrame + || window.oRequestAnimationFrame + || window.msRequestAnimationFrame + || function(callback) { setTimeout(callback, 17); }; +d3.scale = {}; +d3.scale.linear = function() { + var x0 = 0, + x1 = 1, + y0 = 0, + y1 = 1, + kx = 1, // 1 / (x1 - x0) + ky = 1, // (x1 - x0) / (y1 - y0) + interpolate = d3.interpolate, + i = interpolate(y0, y1); + + function scale(x) { + return i((x - x0) * kx); + } + + // Note: requires range is coercible to number! + scale.invert = function(y) { + return (y - y0) * ky + x0; + }; + + scale.domain = function(x) { + if (!arguments.length) return [x0, x1]; + x0 = +x[0]; + x1 = +x[1]; + kx = 1 / (x1 - x0); + ky = (x1 - x0) / (y1 - y0); + return scale; + }; + + scale.range = function(x) { + if (!arguments.length) return [y0, y1]; + y0 = x[0]; + y1 = x[1]; + ky = (x1 - x0) / (y1 - y0); + i = interpolate(y0, y1); + return scale; + }; + + scale.rangeRound = function(x) { + return scale.range(x).interpolate(d3.interpolateRound); + }; + + scale.interpolate = function(x) { + if (!arguments.length) return interpolate; + i = (interpolate = x)(y0, y1); + return scale; + }; + + // TODO Dates? Ugh. + function tickRange(m) { + var start = Math.min(x0, x1), + stop = Math.max(x0, x1), + span = stop - start, + step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), + err = m / (span / step); + + // Filter ticks to get closer to the desired count. + if (err <= .15) step *= 10; + else if (err <= .35) step *= 5; + else if (err <= .75) step *= 2; + + // Round start and stop values to step interval. + return { + start: Math.ceil(start / step) * step, + stop: Math.floor(stop / step) * step + step * .5, // inclusive + step: step + }; + } + + scale.ticks = function(m) { + var range = tickRange(m); + return d3.range(range.start, range.stop, range.step); + }; + + scale.tickFormat = function(m) { + var n = Math.max(0, -Math.floor(Math.log(tickRange(m).step) / Math.LN10 + .01)); + return d3.format(",." + n + "f"); + }; + + return scale; +}; +d3.scale.log = function() { + var linear = d3.scale.linear(), + log = d3_scale_log, + pow = log.pow; + + function scale(x) { + return linear(log(x)); + } + + scale.invert = function(x) { + return pow(linear.invert(x)); + }; + + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(pow); + log = (x[0] || x[1]) < 0 ? d3_scale_logn : d3_scale_log; + pow = log.pow; + linear.domain(x.map(log)); + return scale; + }; + + scale.range = d3.rebind(scale, linear.range); + scale.rangeRound = d3.rebind(scale, linear.rangeRound); + scale.interpolate = d3.rebind(scale, linear.interpolate); + + scale.ticks = function() { + var d = linear.domain(), + ticks = []; + if (d.every(isFinite)) { + var i = Math.floor(d[0]), + j = Math.ceil(d[1]), + u = pow(d[0]), + v = pow(d[1]); + if (log === d3_scale_logn) { + ticks.push(pow(i)); + for (; i++ < j;) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k); + } else { + for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k); + ticks.push(pow(i)); + } + for (i = 0; ticks[i] < u; i++) {} // strip small values + for (j = ticks.length; ticks[j - 1] > v; j--) {} // strip big values + ticks = ticks.slice(i, j); + } + return ticks; + }; + + scale.tickFormat = function() { + return function(d) { return d.toPrecision(1); }; + }; + + return scale; +}; + +function d3_scale_log(x) { + return Math.log(x) / Math.LN10; +} + +function d3_scale_logn(x) { + return -Math.log(-x) / Math.LN10; +} + +d3_scale_log.pow = function(x) { + return Math.pow(10, x); +}; + +d3_scale_logn.pow = function(x) { + return -Math.pow(10, -x); +}; +d3.scale.pow = function() { + var linear = d3.scale.linear(), + tick = d3.scale.linear(), // TODO better tick formatting... + exponent = 1, + powp = Number, + powb = powp; + + function scale(x) { + return linear(powp(x)); + } + + scale.invert = function(x) { + return powb(linear.invert(x)); + }; + + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(powb); + var pow = (x[0] || x[1]) < 0 ? d3_scale_pown : d3_scale_pow; + powp = pow(exponent); + powb = pow(1 / exponent); + linear.domain(x.map(powp)); + tick.domain(x); + return scale; + }; + + scale.range = d3.rebind(scale, linear.range); + scale.rangeRound = d3.rebind(scale, linear.rangeRound); + scale.interpolate = d3.rebind(scale, linear.interpolate); + scale.ticks = tick.ticks; + scale.tickFormat = tick.tickFormat; + + scale.exponent = function(x) { + if (!arguments.length) return exponent; + var domain = scale.domain(); + exponent = x; + return scale.domain(domain); + }; + + return scale; +}; + +function d3_scale_pow(e) { + return function(x) { + return Math.pow(x, e); + }; +} + +function d3_scale_pown(e) { + return function(x) { + return -Math.pow(-x, e); + }; +} +d3.scale.sqrt = function() { + return d3.scale.pow().exponent(.5); +}; +d3.scale.ordinal = function() { + var domain = [], + index = {}, + range = [], + rangeBand = 0; + + function scale(x) { + var i = x in index ? index[x] : (index[x] = domain.push(x) - 1); + return range[i % range.length]; + } + + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x; + index = {}; + var i = -1, j = -1, n = domain.length; while (++i < n) { + x = domain[i]; + if (!(x in index)) index[x] = ++j; + } + return scale; + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return scale; + }; + + scale.rangePoints = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], + stop = x[1], + step = (stop - start) / (domain.length - 1 + padding); + range = domain.length == 1 + ? [(start + stop) / 2] + : d3.range(start + step * padding / 2, stop + step / 2, step); + rangeBand = 0; + return scale; + }; + + scale.rangeBands = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], + stop = x[1], + step = (stop - start) / (domain.length + padding); + range = d3.range(start + step * padding, stop, step); + rangeBand = step * (1 - padding); + return scale; + }; + + scale.rangeRoundBands = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], + stop = x[1], + diff = stop - start, + step = Math.floor(diff / (domain.length + padding)), + err = diff - (domain.length - padding) * step; + range = d3.range(start + Math.round(err / 2), stop, step); + rangeBand = Math.round(step * (1 - padding)); + return scale; + }; + + scale.rangeBand = function() { + return rangeBand; + }; + + return scale; +}; +/* + * This product includes color specifications and designs developed by Cynthia + * Brewer (http://colorbrewer.org/). See lib/colorbrewer for more information. + */ + +d3.scale.category10 = function() { + return d3.scale.ordinal().range(d3_category10); +}; + +d3.scale.category20 = function() { + return d3.scale.ordinal().range(d3_category20); +}; + +d3.scale.category20b = function() { + return d3.scale.ordinal().range(d3_category20b); +}; + +d3.scale.category20c = function() { + return d3.scale.ordinal().range(d3_category20c); +}; + +var d3_category10 = [ + "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", + "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" +]; + +var d3_category20 = [ + "#1f77b4", "#aec7e8", + "#ff7f0e", "#ffbb78", + "#2ca02c", "#98df8a", + "#d62728", "#ff9896", + "#9467bd", "#c5b0d5", + "#8c564b", "#c49c94", + "#e377c2", "#f7b6d2", + "#7f7f7f", "#c7c7c7", + "#bcbd22", "#dbdb8d", + "#17becf", "#9edae5" +]; + +var d3_category20b = [ + "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", + "#637939", "#8ca252", "#b5cf6b", "#cedb9c", + "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", + "#843c39", "#ad494a", "#d6616b", "#e7969c", + "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" +]; + +var d3_category20c = [ + "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", + "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", + "#31a354", "#74c476", "#a1d99b", "#c7e9c0", + "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", + "#636363", "#969696", "#bdbdbd", "#d9d9d9" +]; +d3.scale.quantile = function() { + var domain = [], + range = [], + thresholds = []; + + function rescale() { + var i = -1, + n = thresholds.length = range.length, + k = domain.length / n; + while (++i < n) thresholds[i] = domain[~~(i * k)]; + } + + function quantile(value) { + if (isNaN(value = +value)) return NaN; + var low = 0, high = thresholds.length - 1; + while (low <= high) { + var mid = (low + high) >> 1, midValue = thresholds[mid]; + if (midValue < value) low = mid + 1; + else if (midValue > value) high = mid - 1; + else return mid; + } + return high < 0 ? 0 : high; + } + + function scale(x) { + return range[quantile(x)]; + } + + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.filter(function(d) { return !isNaN(d); }).sort(d3.ascending); + rescale(); + return scale; + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + rescale(); + return scale; + }; + + scale.quantiles = function() { + return thresholds; + }; + + return scale; +}; +d3.scale.quantize = function() { + var x0 = 0, + x1 = 1, + kx = 2, + i = 1, + range = [0, 1]; + + function scale(x) { + return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; + } + + scale.domain = function(x) { + if (!arguments.length) return [x0, x1]; + x0 = x[0]; + x1 = x[1]; + kx = range.length / (x1 - x0); + return scale; + }; + + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + kx = range.length / (x1 - x0); + i = range.length - 1; + return scale; + }; + + return scale; +}; +d3.svg = {}; +d3.svg.arc = function() { + var innerRadius = d3_svg_arcInnerRadius, + outerRadius = d3_svg_arcOuterRadius, + startAngle = d3_svg_arcStartAngle, + endAngle = d3_svg_arcEndAngle; + + function arc() { + var r0 = innerRadius.apply(this, arguments), + r1 = outerRadius.apply(this, arguments), + a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, + a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, + da = a1 - a0, + df = da < Math.PI ? "0" : "1", + c0 = Math.cos(a0), + s0 = Math.sin(a0), + c1 = Math.cos(a1), + s1 = Math.sin(a1); + return da >= d3_svg_arcMax + ? (r0 + ? "M0," + r1 + + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) + + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + + "M0," + r0 + + "A" + r0 + "," + r0 + " 0 1,1 0," + (-r0) + + "A" + r0 + "," + r0 + " 0 1,1 0," + r0 + + "Z" + : "M0," + r1 + + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1) + + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + + "Z") + : (r0 + ? "M" + r1 * c0 + "," + r1 * s0 + + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + + "L" + r0 * c1 + "," + r0 * s1 + + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + + "Z" + : "M" + r1 * c0 + "," + r1 * s0 + + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + + "L0,0" + + "Z"); + } + + arc.innerRadius = function(v) { + if (!arguments.length) return innerRadius; + innerRadius = d3_functor(v); + return arc; + }; + + arc.outerRadius = function(v) { + if (!arguments.length) return outerRadius; + outerRadius = d3_functor(v); + return arc; + }; + + arc.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3_functor(v); + return arc; + }; + + arc.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3_functor(v); + return arc; + }; + + arc.centroid = function() { + var r = (innerRadius.apply(this, arguments) + + outerRadius.apply(this, arguments)) / 2, + a = (startAngle.apply(this, arguments) + + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset; + return [Math.cos(a) * r, Math.sin(a) * r]; + }; + + return arc; +}; + +var d3_svg_arcOffset = -Math.PI / 2, + d3_svg_arcMax = 2 * Math.PI - 1e-6; + +function d3_svg_arcInnerRadius(d) { + return d.innerRadius; +} + +function d3_svg_arcOuterRadius(d) { + return d.outerRadius; +} + +function d3_svg_arcStartAngle(d) { + return d.startAngle; +} + +function d3_svg_arcEndAngle(d) { + return d.endAngle; +} +d3.svg.line = function() { + var x = d3_svg_lineX, + y = d3_svg_lineY, + interpolate = "linear", + interpolator = d3_svg_lineInterpolators[interpolate], + tension = .7; + + function line(d) { + return d.length < 1 ? null + : "M" + interpolator(d3_svg_linePoints(this, d, x, y), tension); + } + + line.x = function(v) { + if (!arguments.length) return x; + x = v; + return line; + }; + + line.y = function(v) { + if (!arguments.length) return y; + y = v; + return line; + }; + + line.interpolate = function(v) { + if (!arguments.length) return interpolate; + interpolator = d3_svg_lineInterpolators[interpolate = v]; + return line; + }; + + line.tension = function(v) { + if (!arguments.length) return tension; + tension = v; + return line; + }; + + return line; +}; + +// Converts the specified array of data into an array of points +// (x-y tuples), by evaluating the specified `x` and `y` functions on each +// data point. The `this` context of the evaluated functions is the specified +// "self" object; each function is passed the current datum and index. +function d3_svg_linePoints(self, d, x, y) { + var points = [], + i = -1, + n = d.length, + fx = typeof x == "function", + fy = typeof y == "function", + value; + if (fx && fy) { + while (++i < n) points.push([ + x.call(self, value = d[i], i), + y.call(self, value, i) + ]); + } else if (fx) { + while (++i < n) points.push([x.call(self, d[i], i), y]); + } else if (fy) { + while (++i < n) points.push([x, y.call(self, d[i], i)]); + } else { + while (++i < n) points.push([x, y]); + } + return points; +} + +// The default `x` property, which references d[0]. +function d3_svg_lineX(d) { + return d[0]; +} + +// The default `y` property, which references d[1]. +function d3_svg_lineY(d) { + return d[1]; +} + +// The various interpolators supported by the `line` class. +var d3_svg_lineInterpolators = { + "linear": d3_svg_lineLinear, + "step-before": d3_svg_lineStepBefore, + "step-after": d3_svg_lineStepAfter, + "basis": d3_svg_lineBasis, + "basis-closed": d3_svg_lineBasisClosed, + "cardinal": d3_svg_lineCardinal, + "cardinal-closed": d3_svg_lineCardinalClosed +}; + +// Linear interpolation; generates "L" commands. +function d3_svg_lineLinear(points) { + var path = [], + i = 0, + n = points.length, + p = points[0]; + path.push(p[0], ",", p[1]); + while (++i < n) path.push("L", (p = points[i])[0], ",", p[1]); + return path.join(""); +} + +// Step interpolation; generates "H" and "V" commands. +function d3_svg_lineStepBefore(points) { + var path = [], + i = 0, + n = points.length, + p = points[0]; + path.push(p[0], ",", p[1]); + while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]); + return path.join(""); +} + +// Step interpolation; generates "H" and "V" commands. +function d3_svg_lineStepAfter(points) { + var path = [], + i = 0, + n = points.length, + p = points[0]; + path.push(p[0], ",", p[1]); + while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]); + return path.join(""); +} + +// Closed cardinal spline interpolation; generates "C" commands. +function d3_svg_lineCardinalClosed(points, tension) { + return points.length < 3 + ? d3_svg_lineLinear(points) + : points[0] + d3_svg_lineHermite(points, + d3_svg_lineCardinalTangents([points[points.length - 2]] + .concat(points, [points[1]]), tension)); +} + +// Cardinal spline interpolation; generates "C" commands. +function d3_svg_lineCardinal(points, tension, closed) { + return points.length < 3 + ? d3_svg_lineLinear(points) + : points[0] + d3_svg_lineHermite(points, + d3_svg_lineCardinalTangents(points, tension)); +} + +// Hermite spline construction; generates "C" commands. +function d3_svg_lineHermite(points, tangents) { + if (tangents.length < 1 + || (points.length != tangents.length + && points.length != tangents.length + 2)) { + return d3_svg_lineLinear(points); + } + + var quad = points.length != tangents.length, + path = "", + p0 = points[0], + p = points[1], + t0 = tangents[0], + t = t0, + pi = 1; + + if (quad) { + path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + + "," + p[0] + "," + p[1]; + p0 = points[1]; + pi = 2; + } + + if (tangents.length > 1) { + t = tangents[1]; + p = points[pi]; + pi++; + path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + + "," + p[0] + "," + p[1]; + for (var i = 2; i < tangents.length; i++, pi++) { + p = points[pi]; + t = tangents[i]; + path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + + "," + p[0] + "," + p[1]; + } + } + + if (quad) { + var lp = points[pi]; + path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + + "," + lp[0] + "," + lp[1]; + } + + return path; +} + +// Generates tangents for a cardinal spline. +function d3_svg_lineCardinalTangents(points, tension) { + var tangents = [], + a = (1 - tension) / 2, + p0 = points[0], + p1 = points[1], + p2 = points[2], + i = 2, + n = points.length; + while (++i < n) { + tangents.push([a * (p2[0] - p0[0]), a * (p2[1] - p0[1])]); + p0 = p1; + p1 = p2; + p2 = points[i]; + } + tangents.push([a * (p2[0] - p0[0]), a * (p2[1] - p0[1])]); + return tangents; +} + +// Open B-spline interpolation; generates "C" commands. +function d3_svg_lineBasis(points) { + if (points.length < 3) return d3_svg_lineLinear(points); + var path = [], + i = 1, + n = points.length, + pi = points[0], + x0 = pi[0], + y0 = pi[1], + px = [x0, x0, x0, (pi = points[1])[0]], + py = [y0, y0, y0, pi[1]]; + path.push(x0, ",", y0); + d3_svg_lineBasisBezier(path, px, py); + while (++i < n) { + pi = points[i]; + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + i = -1; + while (++i < 2) { + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); +} + +// Closed B-spline interpolation; generates "C" commands. +function d3_svg_lineBasisClosed(points) { + var path, + i = -1, + n = points.length, + m = n + 4, + pi, + px = [], + py = []; + while (++i < 4) { + pi = points[i % n]; + px.push(pi[0]); + py.push(pi[1]); + } + path = [ + d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) + ]; + --i; while (++i < m) { + pi = points[i % n]; + px.shift(); px.push(pi[0]); + py.shift(); py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); +} + +// Returns the dot product of the given four-element vectors. +function d3_svg_lineDot4(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; +} + +// Matrix to transform basis (b-spline) control points to bezier +// control points. Derived from FvD 11.2.8. +var d3_svg_lineBasisBezier1 = [0, 2/3, 1/3, 0], + d3_svg_lineBasisBezier2 = [0, 1/3, 2/3, 0], + d3_svg_lineBasisBezier3 = [0, 1/6, 2/3, 1/6]; + +// Pushes a "C" Bézier curve onto the specified path array, given the +// two specified four-element arrays which define the control points. +function d3_svg_lineBasisBezier(path, x, y) { + path.push( + "C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), + ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y)); +} +d3.svg.area = function() { + var x = d3_svg_lineX, + y0 = d3_svg_areaY0, + y1 = d3_svg_lineY, + interpolate = "linear", + interpolator = d3_svg_lineInterpolators[interpolate], + tension = .7; + + // TODO horizontal / vertical / radial orientation + + function area(d) { + return d.length < 1 ? null + : "M" + interpolator(d3_svg_linePoints(this, d, x, y1), tension) + + "L" + interpolator(d3_svg_linePoints(this, d, x, y0).reverse(), tension) + + "Z"; + } + + area.x = function(v) { + if (!arguments.length) return x; + x = v; + return area; + }; + + area.y0 = function(v) { + if (!arguments.length) return y0; + y0 = v; + return area; + }; + + area.y1 = function(v) { + if (!arguments.length) return y1; + y1 = v; + return area; + }; + + area.interpolate = function(v) { + if (!arguments.length) return interpolate; + interpolator = d3_svg_lineInterpolators[interpolate = v]; + return area; + }; + + area.tension = function(v) { + if (!arguments.length) return tension; + tension = v; + return area; + }; + + return area; +}; + +function d3_svg_areaY0() { + return 0; +} +d3.svg.chord = function() { + var source = d3_svg_chordSource, + target = d3_svg_chordTarget, + radius = d3_svg_chordRadius, + startAngle = d3_svg_arcStartAngle, + endAngle = d3_svg_arcEndAngle; + + // TODO Allow control point to be customized. + + function chord(d, i) { + var s = subgroup(this, source, d, i), + t = subgroup(this, target, d, i); + return "M" + s.p0 + + arc(s.r, s.p1) + (equals(s, t) + ? curve(s.r, s.p1, s.r, s.p0) + : curve(s.r, s.p1, t.r, t.p0) + + arc(t.r, t.p1) + + curve(t.r, t.p1, s.r, s.p0)) + + "Z"; + } + + function subgroup(self, f, d, i) { + var subgroup = f.call(self, d, i), + r = radius.call(self, subgroup, i), + a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, + a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset; + return { + r: r, + a0: a0, + a1: a1, + p0: [r * Math.cos(a0), r * Math.sin(a0)], + p1: [r * Math.cos(a1), r * Math.sin(a1)] + }; + } + + function equals(a, b) { + return a.a0 == b.a0 && a.a1 == b.a1; + } + + function arc(r, p) { + return "A" + r + "," + r + " 0 0,1 " + p; + } + + function curve(r0, p0, r1, p1) { + return "Q 0,0 " + p1; + } + + chord.radius = function(v) { + if (!arguments.length) return radius; + radius = d3_functor(v); + return chord; + }; + + chord.source = function(v) { + if (!arguments.length) return source; + source = d3_functor(v); + return chord; + }; + + chord.target = function(v) { + if (!arguments.length) return target; + target = d3_functor(v); + return chord; + }; + + chord.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3_functor(v); + return chord; + }; + + chord.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3_functor(v); + return chord; + }; + + return chord; +}; + +function d3_svg_chordSource(d) { + return d.source; +} + +function d3_svg_chordTarget(d) { + return d.target; +} + +function d3_svg_chordRadius(d) { + return d.radius; +} + +function d3_svg_chordStartAngle(d) { + return d.startAngle; +} + +function d3_svg_chordEndAngle(d) { + return d.endAngle; +} +d3.svg.mouse = function(container) { + var point = (container.ownerSVGElement || container).createSVGPoint(); + if ((d3_mouse_bug44083 < 0) && (window.scrollX || window.scrollY)) { + var svg = d3.select(document.body) + .append("svg:svg") + .style("position", "absolute") + .style("top", 0) + .style("left", 0); + var ctm = svg[0][0].getScreenCTM(); + d3_mouse_bug44083 = !(ctm.f || ctm.e); + svg.remove(); + } + if (d3_mouse_bug44083) { + point.x = d3.event.pageX; + point.y = d3.event.pageY; + } else { + point.x = d3.event.clientX; + point.y = d3.event.clientY; + } + point = point.matrixTransform(container.getScreenCTM().inverse()); + return [point.x, point.y]; +}; + +// https://bugs.webkit.org/show_bug.cgi?id=44083 +var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0; +d3.svg.symbol = function() { + var type = d3_svg_symbolType, + size = d3_svg_symbolSize; + + function symbol(d, i) { + return (d3_svg_symbols[type.call(this, d, i)] + || d3_svg_symbols.circle) + (size.call(this, d, i)); + } + + symbol.type = function(x) { + if (!arguments.length) return type; + type = d3_functor(x); + return symbol; + }; + + // size of symbol in square pixels + symbol.size = function(x) { + if (!arguments.length) return size; + size = d3_functor(x); + return symbol; + }; + + return symbol; +}; + +// TODO cross-diagonal? +d3.svg.symbolTypes = [ + "circle", + "cross", + "diamond", + "square", + "triangle-down", + "triangle-up" +]; + +function d3_svg_symbolSize() { + return 64; +} + +function d3_svg_symbolType() { + return "circle"; +} + +var d3_svg_symbols = { + "circle": function(size) { + var r = Math.sqrt(size / Math.PI); + return "M0," + r + + "A" + r + "," + r + " 0 1,1 0," + (-r) + + "A" + r + "," + r + " 0 1,1 0," + r + + "Z"; + }, + "cross": function(size) { + var r = Math.sqrt(size / 5) / 2; + return "M" + -3 * r + "," + -r + + "H" + -r + + "V" + -3 * r + + "H" + r + + "V" + -r + + "H" + 3 * r + + "V" + r + + "H" + r + + "V" + 3 * r + + "H" + -r + + "V" + r + + "H" + -3 * r + + "Z"; + }, + "diamond": function(size) { + var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), + rx = ry * d3_svg_symbolTan30; + return "M0," + -ry + + "L" + rx + ",0" + + " 0," + ry + + " " + -rx + ",0" + + "Z"; + }, + "square": function(size) { + var r = Math.sqrt(size) / 2; + return "M" + -r + "," + -r + + "L" + r + "," + -r + + " " + r + "," + r + + " " + -r + "," + r + + "Z"; + }, + "triangle-down": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), + ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + ry + + "L" + rx +"," + -ry + + " " + -rx + "," + -ry + + "Z"; + }, + "triangle-up": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), + ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + -ry + + "L" + rx +"," + ry + + " " + -rx + "," + ry + + "Z"; + } +}; + +var d3_svg_symbolSqrt3 = Math.sqrt(3), + d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180); +})() \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.layout.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.layout.js new file mode 100644 index 0000000..abc5ebe --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.layout.js @@ -0,0 +1,908 @@ +(function(){d3.layout = {}; +d3.layout.chord = function() { + var chord = {}, + chords, + groups, + matrix, + n, + padding = 0, + sortGroups, + sortSubgroups, + sortChords; + + function relayout() { + var subgroups = {}, + groupSums = [], + groupIndex = d3.range(n), + subgroupIndex = [], + k, + x, + x0, + i, + j; + + chords = []; + groups = []; + + // Compute the sum. + k = 0, i = -1; while (++i < n) { + x = 0, j = -1; while (++j < n) { + x += matrix[i][j]; + } + groupSums.push(x); + subgroupIndex.push(d3.range(n)); + k += x; + } + + // Sort groups… + if (sortGroups) { + groupIndex.sort(function(a, b) { + return sortGroups(groupSums[a], groupSums[b]); + }); + } + + // Sort subgroups… + if (sortSubgroups) { + subgroupIndex.forEach(function(d, i) { + d.sort(function(a, b) { + return sortSubgroups(matrix[i][a], matrix[i][b]); + }); + }); + } + + // Convert the sum to scaling factor for [0, 2pi]. + // TODO Allow start and end angle to be specified. + // TODO Allow padding to be specified as percentage? + k = (2 * Math.PI - padding * n) / k; + + // Compute the start and end angle for each group and subgroup. + x = 0, i = -1; while (++i < n) { + x0 = x, j = -1; while (++j < n) { + var di = groupIndex[i], + dj = subgroupIndex[i][j], + v = matrix[di][dj]; + subgroups[di + "-" + dj] = { + index: di, + subindex: dj, + startAngle: x, + endAngle: x += v * k, + value: v + }; + } + groups.push({ + index: di, + startAngle: x0, + endAngle: x, + value: (x - x0) / k + }); + x += padding; + } + + // Generate chords for each (non-empty) subgroup-subgroup link. + i = -1; while (++i < n) { + j = i - 1; while (++j < n) { + var source = subgroups[i + "-" + j], + target = subgroups[j + "-" + i]; + if (source.value || target.value) { + chords.push({ + source: source, + target: target + }) + } + } + } + + if (sortChords) resort(); + } + + function resort() { + chords.sort(function(a, b) { + a = Math.min(a.source.value, a.target.value); + b = Math.min(b.source.value, b.target.value); + return sortChords(a, b); + }); + } + + chord.matrix = function(x) { + if (!arguments.length) return matrix; + n = (matrix = x) && matrix.length; + chords = groups = null; + return chord; + }; + + chord.padding = function(x) { + if (!arguments.length) return padding; + padding = x; + chords = groups = null; + return chord; + }; + + chord.sortGroups = function(x) { + if (!arguments.length) return sortGroups; + sortGroups = x; + chords = groups = null; + return chord; + }; + + chord.sortSubgroups = function(x) { + if (!arguments.length) return sortSubgroups; + sortSubgroups = x; + chords = null; + return chord; + }; + + chord.sortChords = function(x) { + if (!arguments.length) return sortChords; + sortChords = x; + if (chords) resort(); + return chord; + }; + + chord.chords = function() { + if (!chords) relayout(); + return chords; + }; + + chord.groups = function() { + if (!groups) relayout(); + return groups; + }; + + return chord; +}; +// A rudimentary force layout using Gauss-Seidel. +d3.layout.force = function() { + var force = {}, + event = d3.dispatch("tick"), + size = [1, 1], + alpha = .5, + distance = 30, + interval, + nodes, + links, + distances; + + function tick() { + var n = distances.length, + i, // current index + o, // current link + s, // current source + t, // current target + l, // current distance + x, // x-distance + y; // y-distance + + // gauss-seidel relaxation + for (i = 0; i < n; ++i) { + o = distances[i]; + s = o.source; + t = o.target; + x = t.x - s.x; + y = t.y - s.y; + if (l = Math.sqrt(x * x + y * y)) { + l = alpha / (o.distance * o.distance) * (l - distance * o.distance) / l; + x *= l; + y *= l; + if (!t.fixed) { + t.x -= x; + t.y -= y; + } + if (!s.fixed) { + s.x += x; + s.y += y; + } + } + } + + event.tick.dispatch({type: "tick"}); + + // simulated annealing, basically + return (alpha *= .99) < .005; + } + + force.on = function(type, listener) { + event[type].add(listener); + return force; + }; + + force.nodes = function(x) { + if (!arguments.length) return nodes; + nodes = x; + return force; + }; + + force.links = function(x) { + if (!arguments.length) return links; + links = x; + return force; + }; + + force.size = function(x) { + if (!arguments.length) return size; + size = x; + return force; + }; + + force.distance = function(d) { + if (!arguments.length) return distance; + distance = d; + return force; + }; + + force.start = function() { + var i, + j, + k, + n = nodes.length, + m = links.length, + w = size[0], + h = size[1], + o; + + var paths = []; + for (i = 0; i < n; ++i) { + o = nodes[i]; + o.x = o.x || Math.random() * w; + o.y = o.y || Math.random() * h; + o.fixed = 0; + paths[i] = []; + for (j = 0; j < n; ++j) { + paths[i][j] = Infinity; + } + paths[i][i] = 0; + } + + for (i = 0; i < m; ++i) { + o = links[i]; + paths[o.source][o.target] = 1; + paths[o.target][o.source] = 1; + o.source = nodes[o.source]; + o.target = nodes[o.target]; + } + + // Floyd-Warshall + for (k = 0; k < n; ++k) { + for (i = 0; i < n; ++i) { + for (j = 0; j < n; ++j) { + paths[i][j] = Math.min(paths[i][j], paths[i][k] + paths[k][j]); + } + } + } + + distances = []; + for (i = 0; i < n; ++i) { + for (j = i + 1; j < n; ++j) { + distances.push({ + source: nodes[i], + target: nodes[j], + distance: paths[i][j] * paths[i][j] + }); + } + } + + distances.sort(function(a, b) { + return a.distance - b.distance; + }); + + d3.timer(tick); + return force; + }; + + force.resume = function() { + alpha = .1; + d3.timer(tick); + return force; + }; + + force.stop = function() { + alpha = 0; + return force; + }; + + // use `node.call(force.drag)` to make nodes draggable + force.drag = function() { + var node, element; + + this + .on("mouseover", function(d) { d.fixed = true; }) + .on("mouseout", function(d) { if (d != node) d.fixed = false; }) + .on("mousedown", mousedown); + + d3.select(window) + .on("mousemove", mousemove) + .on("mouseup", mouseup); + + function mousedown(d) { + (node = d).fixed = true; + element = this; + d3.event.preventDefault(); + } + + function mousemove() { + if (!node) return; + var m = d3.svg.mouse(element); + node.x = m[0]; + node.y = m[1]; + force.resume(); // restart annealing + } + + function mouseup() { + if (!node) return; + mousemove(); + node.fixed = false; + node = element = null; + } + + return force; + }; + + return force; +}; +d3.layout.partition = function() { + var hierarchy = d3.layout.hierarchy(), + size = [1, 1]; // width, height + + function position(node, x, dx, dy) { + var children = node.children; + node.x = x; + node.y = node.depth * dy; + node.dx = dx; + node.dy = dy; + if (children) { + var i = -1, + n = children.length, + c, + d; + dx /= node.value; + while (++i < n) { + position(c = children[i], x, d = c.value * dx, dy); + x += d; + } + } + } + + function depth(node) { + var children = node.children, + d = 0; + if (children) { + var i = -1, + n = children.length; + while (++i < n) d = Math.max(d, depth(children[i])); + } + return 1 + d; + } + + function partition(d, i) { + var nodes = hierarchy.call(this, d, i); + position(nodes[0], 0, size[0], size[1] / depth(nodes[0])); + return nodes; + } + + partition.sort = d3.rebind(partition, hierarchy.sort); + partition.children = d3.rebind(partition, hierarchy.children); + partition.value = d3.rebind(partition, hierarchy.value); + + partition.size = function(x) { + if (!arguments.length) return size; + size = x; + return partition; + }; + + return partition; +}; +d3.layout.pie = function() { + var value = Number, + sort = null, + startAngle = 0, + endAngle = 2 * Math.PI; + + function pie(data, i) { + + // Compute the start angle. + var a = +(typeof startAngle == "function" + ? startAngle.apply(this, arguments) + : startAngle); + + // Compute the angular range (end - start). + var k = (typeof endAngle == "function" + ? endAngle.apply(this, arguments) + : endAngle) - startAngle; + + // Optionally sort the data. + var index = d3.range(data.length); + if (sort != null) index.sort(function(i, j) { + return sort(data[i], data[j]); + }); + + // Compute the numeric values for each data element. + var values = data.map(value); + + // Convert k into a scale factor from value to angle, using the sum. + k /= values.reduce(function(p, d) { return p + d; }, 0); + + // Compute the arcs! + var arcs = index.map(function(i) { + return { + value: d = values[i], + startAngle: a, + endAngle: a += d * k + }; + }); + + // Return the arcs in the original data's order. + return data.map(function(d, i) { + return arcs[index[i]]; + }); + } + + /** + * Specifies the value function *x*, which returns a nonnegative numeric value + * for each datum. The default value function is `Number`. The value function + * is passed two arguments: the current datum and the current index. + */ + pie.value = function(x) { + if (!arguments.length) return value; + value = x; + return pie; + }; + + /** + * Specifies a sort comparison operator *x*. The comparator is passed two data + * elements from the data array, a and b; it returns a negative value if a is + * less than b, a positive value if a is greater than b, and zero if a equals + * b. + */ + pie.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return pie; + }; + + /** + * Specifies the overall start angle of the pie chart. Defaults to 0. The + * start angle can be specified either as a constant or as a function; in the + * case of a function, it is evaluated once per array (as opposed to per + * element). + */ + pie.startAngle = function(x) { + if (!arguments.length) return startAngle; + startAngle = x; + return pie; + }; + + /** + * Specifies the overall end angle of the pie chart. Defaults to 2Ï€. The + * end angle can be specified either as a constant or as a function; in the + * case of a function, it is evaluated once per array (as opposed to per + * element). + */ + pie.endAngle = function(x) { + if (!arguments.length) return endAngle; + endAngle = x; + return pie; + }; + + return pie; +}; +// data is two-dimensional array of x,y; we populate y0 +// TODO perhaps make the `x`, `y` and `y0` structure customizable +d3.layout.stack = function() { + var order = "default", + offset = "zero"; + + function stack(data) { + var n = data.length, + m = data[0].length, + i, + j, + y0; + + // compute the order of series + var index = d3_layout_stackOrders[order](data); + + // set y0 on the baseline + d3_layout_stackOffsets[offset](data, index); + + // propagate offset to other series + for (j = 0; j < m; ++j) { + for (i = 1, y0 = data[index[0]][j].y0; i < n; ++i) { + data[index[i]][j].y0 = y0 += data[index[i - 1]][j].y; + } + } + + return data; + } + + stack.order = function(x) { + if (!arguments.length) return order; + order = x; + return stack; + }; + + stack.offset = function(x) { + if (!arguments.length) return offset; + offset = x; + return stack; + }; + + return stack; +} + +var d3_layout_stackOrders = { + + "inside-out": function(data) { + var n = data.length, + i, + j, + max = data.map(d3_layout_stackMaxIndex), + sums = data.map(d3_layout_stackReduceSum), + index = d3.range(n).sort(function(a, b) { return max[a] - max[b]; }), + top = 0, + bottom = 0, + tops = [], + bottoms = []; + for (i = 0; i < n; i++) { + j = index[i]; + if (top < bottom) { + top += sums[j]; + tops.push(j); + } else { + bottom += sums[j]; + bottoms.push(j); + } + } + return bottoms.reverse().concat(tops); + }, + + "reverse": function(data) { + return d3.range(data.length).reverse(); + }, + + "default": function(data) { + return d3.range(data.length); + } + +}; + +var d3_layout_stackOffsets = { + + "silhouette": function(data, index) { + var n = data.length, + m = data[0].length, + sums = [], + max = 0, + i, + j, + o; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j].y; + if (o > max) max = o; + sums.push(o); + } + for (j = 0, i = index[0]; j < m; ++j) { + data[i][j].y0 = (max - sums[j]) / 2; + } + }, + + "wiggle": function(data, index) { + var n = data.length, + x = data[0], + m = x.length, + max = 0, + i, + j, + k, + ii, + ik, + i0 = index[0], + s1, + s2, + s3, + dx, + o, + o0; + data[i0][0].y0 = o = o0 = 0; + for (j = 1; j < m; ++j) { + for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j].y; + for (i = 0, s2 = 0, dx = x[j].x - x[j - 1].x; i < n; ++i) { + for (k = 0, ii = index[i], s3 = (data[ii][j].y - data[ii][j - 1].y) / (2 * dx); k < i; ++k) { + s3 += (data[ik = index[k]][j].y - data[ik][j - 1].y) / dx; + } + s2 += s3 * data[ii][j].y; + } + data[i0][j].y0 = o -= s1 ? s2 / s1 * dx : 0; + if (o < o0) o0 = o; + } + for (j = 0; j < m; ++j) data[i0][j].y0 -= o0; + }, + + "zero": function(data, index) { + var j = 0, + m = data[0].length, + i0 = index[0]; + for (; j < m; ++j) data[i0][j].y0 = 0; + } + +}; + +function d3_layout_stackReduceSum(d) { + return d.reduce(d3_layout_stackSum, 0); +} + +function d3_layout_stackMaxIndex(array) { + var i = 1, + j = 0, + v = array[0].y, + k, + n = array.length; + for (; i < n; ++i) { + if ((k = array[i].y) > v) { + j = i; + v = k; + } + } + return j; +} + +function d3_layout_stackSum(p, d) { + return p + d.y; +} +d3.layout.hierarchy = function() { + var sort = d3_layout_hierarchySort, + children = d3_layout_hierarchyChildren, + value = d3_layout_hierarchyValue; + + // Recursively compute the node depth and value. + // Also converts the data representation into a standard hierarchy structure. + function recurse(data, depth, nodes) { + var datas = children.call(hierarchy, data, depth), + node = {depth: depth, data: data}; + nodes.push(node); + if (datas) { + var i = -1, + n = datas.length, + c = node.children = [], + v = 0, + j = depth + 1; + while (++i < n) { + d = recurse(datas[i], j, nodes); + if (d.value > 0) { // ignore NaN, negative, etc. + c.push(d); + v += d.value; + d.parent = node; + } + } + if (sort) c.sort(sort); + node.value = v; + } else { + node.value = value.call(hierarchy, data, depth); + } + return node; + } + + // Recursively re-evaluates the node value. + function revalue(node, depth) { + var children = node.children, + v = 0; + if (children) { + var i = -1, + n = children.length, + j = depth + 1; + while (++i < n) v += revalue(children[i], j); + } else { + v = value.call(hierarchy, node.data, depth); + } + return node.value = v; + } + + function hierarchy(d) { + var nodes = []; + recurse(d, 0, nodes); + return nodes; + } + + hierarchy.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return hierarchy; + }; + + hierarchy.children = function(x) { + if (!arguments.length) return children; + children = x; + return hierarchy; + }; + + hierarchy.value = function(x) { + if (!arguments.length) return value; + value = x; + return hierarchy; + }; + + // Re-evaluates the `value` property for the specified hierarchy. + hierarchy.revalue = function(root) { + revalue(root, 0); + return root; + }; + + return hierarchy; +} + +function d3_layout_hierarchyChildren(d) { + return d.children; +} + +function d3_layout_hierarchyValue(d) { + return d.value; +} + +function d3_layout_hierarchySort(a, b) { + return b.value - a.value; +} +// Squarified Treemaps by Mark Bruls, Kees Huizing, and Jarke J. van Wijk +d3.layout.treemap = function() { + var hierarchy = d3.layout.hierarchy(), + round = Math.round, + size = [1, 1], // width, height + sticky = false, + stickies; + + // Recursively compute the node area based on value & scale. + function scale(node, k) { + var children = node.children; + node.area = node.value * k; + if (children) { + var i = -1, + n = children.length; + while (++i < n) scale(children[i], k); + } + } + + // Recursively arranges the specified node's children into squarified rows. + function squarify(node) { + if (!node.children) return; + var rect = {x: node.x, y: node.y, dx: node.dx, dy: node.dy}, + row = [], + children = node.children.slice(), // copy-on-write + child, + best = Infinity, // the best row score so far + score, // the current row score + u = Math.min(rect.dx, rect.dy), // initial orientation + n; + row.area = 0; + while ((n = children.length) > 0) { + row.push(child = children[n - 1]); + row.area += child.area; + if ((score = worst(row, u)) <= best) { // continue with this orientation + children.pop(); + best = score; + } else { // abort, and try a different orientation + row.area -= row.pop().area; + position(row, u, rect, false); + u = Math.min(rect.dx, rect.dy); + row.length = row.area = 0; + best = Infinity; + } + } + if (row.length) { + position(row, u, rect, true); + row.length = row.area = 0; + } + node.children.forEach(squarify); + } + + // Recursively resizes the specified node's children into existing rows. + // Preserves the existing layout! + function stickify(node) { + if (!node.children) return; + var rect = {x: node.x, y: node.y, dx: node.dx, dy: node.dy}, + children = node.children.slice(), // copy-on-write + child, + row = []; + row.area = 0; + while (child = children.pop()) { + row.push(child); + row.area += child.area; + if (child.z != null) { + position(row, child.z ? rect.dx : rect.dy, rect, !children.length); + row.length = row.area = 0; + } + } + node.children.forEach(stickify); + } + + // Computes the score for the specified row, as the worst aspect ratio. + function worst(row, u) { + var s = row.area, + r, + rmax = 0, + rmin = Infinity, + i = -1, + n = row.length; + while (++i < n) { + r = row[i].area; + if (r < rmin) rmin = r; + if (r > rmax) rmax = r; + } + s *= s; + u *= u; + return Math.max((u * rmax) / s, s / (u * rmin)); + } + + // Positions the specified row of nodes. Modifies `rect`. + function position(row, u, rect, flush) { + var i = -1, + n = row.length, + x = rect.x, + y = rect.y, + v = u ? round(row.area / u) : 0, + o; + if (u == rect.dx) { // horizontal subdivision + if (flush || v > rect.dy) v = rect.dy; // over+underflow + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dy = v; + x += o.dx = round(o.area / v); + } + o.z = true; + o.dx += rect.x + rect.dx - x; // rounding error + rect.y += v; + rect.dy -= v; + } else { // vertical subdivision + if (flush || v > rect.dx) v = rect.dx; // over+underflow + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dx = v; + y += o.dy = round(o.area / v); + } + o.z = false; + o.dy += rect.y + rect.dy - y; // rounding error + rect.x += v; + rect.dx -= v; + } + } + + function treemap(d) { + var nodes = stickies || hierarchy(d), + root = nodes[0]; + root.x = 0; + root.y = 0; + root.dx = size[0]; + root.dy = size[1]; + if (stickies) hierarchy.revalue(root); + scale(root, size[0] * size[1] / root.value); + (stickies ? stickify : squarify)(root); + if (sticky) stickies = nodes; + return nodes; + } + + treemap.sort = d3.rebind(treemap, hierarchy.sort); + treemap.children = d3.rebind(treemap, hierarchy.children); + treemap.value = d3.rebind(treemap, hierarchy.value); + + treemap.size = function(x) { + if (!arguments.length) return size; + size = x; + return treemap; + }; + + treemap.round = function(x) { + if (!arguments.length) return round != Number; + round = x ? Math.round : Number; + return treemap; + }; + + treemap.sticky = function(x) { + if (!arguments.length) return sticky; + sticky = x; + stickies = null; + return treemap; + }; + + return treemap; +}; +})() \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v2.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v2.js new file mode 100644 index 0000000..714656b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v2.js @@ -0,0 +1,7033 @@ +(function() { + function d3_class(ctor, properties) { + try { + for (var key in properties) { + Object.defineProperty(ctor.prototype, key, { + value: properties[key], + enumerable: false + }); + } + } catch (e) { + ctor.prototype = properties; + } + } + function d3_arrayCopy(pseudoarray) { + var i = -1, n = pseudoarray.length, array = []; + while (++i < n) array.push(pseudoarray[i]); + return array; + } + function d3_arraySlice(pseudoarray) { + return Array.prototype.slice.call(pseudoarray); + } + function d3_Map() {} + function d3_identity(d) { + return d; + } + function d3_this() { + return this; + } + function d3_true() { + return true; + } + function d3_functor(v) { + return typeof v === "function" ? v : function() { + return v; + }; + } + function d3_rebind(target, source, method) { + return function() { + var value = method.apply(source, arguments); + return arguments.length ? target : value; + }; + } + function d3_number(x) { + return x != null && !isNaN(x); + } + function d3_zipLength(d) { + return d.length; + } + function d3_splitter(d) { + return d == null; + } + function d3_collapse(s) { + return s.trim().replace(/\s+/g, " "); + } + function d3_range_integerScale(x) { + var k = 1; + while (x * k % 1) k *= 10; + return k; + } + function d3_dispatch() {} + function d3_dispatch_event(dispatch) { + function event() { + var z = listeners, i = -1, n = z.length, l; + while (++i < n) if (l = z[i].on) l.apply(this, arguments); + return dispatch; + } + var listeners = [], listenerByName = new d3_Map; + event.on = function(name, listener) { + var l = listenerByName.get(name), i; + if (arguments.length < 2) return l && l.on; + if (l) { + l.on = null; + listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1)); + listenerByName.remove(name); + } + if (listener) listeners.push(listenerByName.set(name, { + on: listener + })); + return dispatch; + }; + return event; + } + function d3_format_precision(x, p) { + return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1); + } + function d3_format_typeDefault(x) { + return x + ""; + } + function d3_format_group(value) { + var i = value.lastIndexOf("."), f = i >= 0 ? value.substring(i) : (i = value.length, ""), t = []; + while (i > 0) t.push(value.substring(i -= 3, i + 3)); + return t.reverse().join(",") + f; + } + function d3_formatPrefix(d, i) { + var k = Math.pow(10, Math.abs(8 - i) * 3); + return { + scale: i > 8 ? function(d) { + return d / k; + } : function(d) { + return d * k; + }, + symbol: d + }; + } + function d3_ease_clamp(f) { + return function(t) { + return t <= 0 ? 0 : t >= 1 ? 1 : f(t); + }; + } + function d3_ease_reverse(f) { + return function(t) { + return 1 - f(1 - t); + }; + } + function d3_ease_reflect(f) { + return function(t) { + return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t)); + }; + } + function d3_ease_identity(t) { + return t; + } + function d3_ease_poly(e) { + return function(t) { + return Math.pow(t, e); + }; + } + function d3_ease_sin(t) { + return 1 - Math.cos(t * Math.PI / 2); + } + function d3_ease_exp(t) { + return Math.pow(2, 10 * (t - 1)); + } + function d3_ease_circle(t) { + return 1 - Math.sqrt(1 - t * t); + } + function d3_ease_elastic(a, p) { + var s; + if (arguments.length < 2) p = .45; + if (arguments.length < 1) { + a = 1; + s = p / 4; + } else s = p / (2 * Math.PI) * Math.asin(1 / a); + return function(t) { + return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p); + }; + } + function d3_ease_back(s) { + if (!s) s = 1.70158; + return function(t) { + return t * t * ((s + 1) * t - s); + }; + } + function d3_ease_bounce(t) { + return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375; + } + function d3_eventCancel() { + d3.event.stopPropagation(); + d3.event.preventDefault(); + } + function d3_eventSource() { + var e = d3.event, s; + while (s = e.sourceEvent) e = s; + return e; + } + function d3_eventDispatch(target) { + var dispatch = new d3_dispatch, i = 0, n = arguments.length; + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); + dispatch.of = function(thiz, argumentz) { + return function(e1) { + try { + var e0 = e1.sourceEvent = d3.event; + e1.target = target; + d3.event = e1; + dispatch[e1.type].apply(thiz, argumentz); + } finally { + d3.event = e0; + } + }; + }; + return dispatch; + } + function d3_transform(m) { + var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0; + if (r0[0] * r1[1] < r1[0] * r0[1]) { + r0[0] *= -1; + r0[1] *= -1; + kx *= -1; + kz *= -1; + } + this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees; + this.translate = [ m.e, m.f ]; + this.scale = [ kx, ky ]; + this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0; + } + function d3_transformDot(a, b) { + return a[0] * b[0] + a[1] * b[1]; + } + function d3_transformNormalize(a) { + var k = Math.sqrt(d3_transformDot(a, a)); + if (k) { + a[0] /= k; + a[1] /= k; + } + return k; + } + function d3_transformCombine(a, b, k) { + a[0] += k * b[0]; + a[1] += k * b[1]; + return a; + } + function d3_interpolateByName(name) { + return name == "transform" ? d3.interpolateTransform : d3.interpolate; + } + function d3_uninterpolateNumber(a, b) { + b = b - (a = +a) ? 1 / (b - a) : 0; + return function(x) { + return (x - a) * b; + }; + } + function d3_uninterpolateClamp(a, b) { + b = b - (a = +a) ? 1 / (b - a) : 0; + return function(x) { + return Math.max(0, Math.min(1, (x - a) * b)); + }; + } + function d3_rgb(r, g, b) { + return new d3_Rgb(r, g, b); + } + function d3_Rgb(r, g, b) { + this.r = r; + this.g = g; + this.b = b; + } + function d3_rgb_hex(v) { + return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16); + } + function d3_rgb_parse(format, rgb, hsl) { + var r = 0, g = 0, b = 0, m1, m2, name; + m1 = /([a-z]+)\((.*)\)/i.exec(format); + if (m1) { + m2 = m1[2].split(","); + switch (m1[1]) { + case "hsl": + { + return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100); + } + case "rgb": + { + return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2])); + } + } + } + if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b); + if (format != null && format.charAt(0) === "#") { + if (format.length === 4) { + r = format.charAt(1); + r += r; + g = format.charAt(2); + g += g; + b = format.charAt(3); + b += b; + } else if (format.length === 7) { + r = format.substring(1, 3); + g = format.substring(3, 5); + b = format.substring(5, 7); + } + r = parseInt(r, 16); + g = parseInt(g, 16); + b = parseInt(b, 16); + } + return rgb(r, g, b); + } + function d3_rgb_hsl(r, g, b) { + var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2; + if (d) { + s = l < .5 ? d / (max + min) : d / (2 - max - min); + if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4; + h *= 60; + } else { + s = h = 0; + } + return d3_hsl(h, s, l); + } + function d3_rgb_lab(r, g, b) { + r = d3_rgb_xyz(r); + g = d3_rgb_xyz(g); + b = d3_rgb_xyz(b); + var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z); + return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z)); + } + function d3_rgb_xyz(r) { + return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4); + } + function d3_rgb_parseNumber(c) { + var f = parseFloat(c); + return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f; + } + function d3_hsl(h, s, l) { + return new d3_Hsl(h, s, l); + } + function d3_Hsl(h, s, l) { + this.h = h; + this.s = s; + this.l = l; + } + function d3_hsl_rgb(h, s, l) { + function v(h) { + if (h > 360) h -= 360; else if (h < 0) h += 360; + if (h < 60) return m1 + (m2 - m1) * h / 60; + if (h < 180) return m2; + if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; + return m1; + } + function vv(h) { + return Math.round(v(h) * 255); + } + var m1, m2; + h = h % 360; + if (h < 0) h += 360; + s = s < 0 ? 0 : s > 1 ? 1 : s; + l = l < 0 ? 0 : l > 1 ? 1 : l; + m2 = l <= .5 ? l * (1 + s) : l + s - l * s; + m1 = 2 * l - m2; + return d3_rgb(vv(h + 120), vv(h), vv(h - 120)); + } + function d3_hcl(h, c, l) { + return new d3_Hcl(h, c, l); + } + function d3_Hcl(h, c, l) { + this.h = h; + this.c = c; + this.l = l; + } + function d3_hcl_lab(h, c, l) { + return d3_lab(l, Math.cos(h *= Math.PI / 180) * c, Math.sin(h) * c); + } + function d3_lab(l, a, b) { + return new d3_Lab(l, a, b); + } + function d3_Lab(l, a, b) { + this.l = l; + this.a = a; + this.b = b; + } + function d3_lab_rgb(l, a, b) { + var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200; + x = d3_lab_xyz(x) * d3_lab_X; + y = d3_lab_xyz(y) * d3_lab_Y; + z = d3_lab_xyz(z) * d3_lab_Z; + return d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z)); + } + function d3_lab_hcl(l, a, b) { + return d3_hcl(Math.atan2(b, a) / Math.PI * 180, Math.sqrt(a * a + b * b), l); + } + function d3_lab_xyz(x) { + return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037; + } + function d3_xyz_lab(x) { + return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29; + } + function d3_xyz_rgb(r) { + return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055)); + } + function d3_selection(groups) { + d3_arraySubclass(groups, d3_selectionPrototype); + return groups; + } + function d3_selection_selector(selector) { + return function() { + return d3_select(selector, this); + }; + } + function d3_selection_selectorAll(selector) { + return function() { + return d3_selectAll(selector, this); + }; + } + function d3_selection_attr(name, value) { + function attrNull() { + this.removeAttribute(name); + } + function attrNullNS() { + this.removeAttributeNS(name.space, name.local); + } + function attrConstant() { + this.setAttribute(name, value); + } + function attrConstantNS() { + this.setAttributeNS(name.space, name.local, value); + } + function attrFunction() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttribute(name); else this.setAttribute(name, x); + } + function attrFunctionNS() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x); + } + name = d3.ns.qualify(name); + return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant; + } + function d3_selection_classedRe(name) { + return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g"); + } + function d3_selection_classed(name, value) { + function classedConstant() { + var i = -1; + while (++i < n) name[i](this, value); + } + function classedFunction() { + var i = -1, x = value.apply(this, arguments); + while (++i < n) name[i](this, x); + } + name = name.trim().split(/\s+/).map(d3_selection_classedName); + var n = name.length; + return typeof value === "function" ? classedFunction : classedConstant; + } + function d3_selection_classedName(name) { + var re = d3_selection_classedRe(name); + return function(node, value) { + if (c = node.classList) return value ? c.add(name) : c.remove(name); + var c = node.className, cb = c.baseVal != null, cv = cb ? c.baseVal : c; + if (value) { + re.lastIndex = 0; + if (!re.test(cv)) { + cv = d3_collapse(cv + " " + name); + if (cb) c.baseVal = cv; else node.className = cv; + } + } else if (cv) { + cv = d3_collapse(cv.replace(re, " ")); + if (cb) c.baseVal = cv; else node.className = cv; + } + }; + } + function d3_selection_style(name, value, priority) { + function styleNull() { + this.style.removeProperty(name); + } + function styleConstant() { + this.style.setProperty(name, value, priority); + } + function styleFunction() { + var x = value.apply(this, arguments); + if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority); + } + return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant; + } + function d3_selection_property(name, value) { + function propertyNull() { + delete this[name]; + } + function propertyConstant() { + this[name] = value; + } + function propertyFunction() { + var x = value.apply(this, arguments); + if (x == null) delete this[name]; else this[name] = x; + } + return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant; + } + function d3_selection_dataNode(data) { + return { + __data__: data + }; + } + function d3_selection_filter(selector) { + return function() { + return d3_selectMatches(this, selector); + }; + } + function d3_selection_sortComparator(comparator) { + if (!arguments.length) comparator = d3.ascending; + return function(a, b) { + return comparator(a && a.__data__, b && b.__data__); + }; + } + function d3_selection_on(type, listener, capture) { + function onRemove() { + var wrapper = this[name]; + if (wrapper) { + this.removeEventListener(type, wrapper, wrapper.$); + delete this[name]; + } + } + function onAdd() { + function wrapper(e) { + var o = d3.event; + d3.event = e; + args[0] = node.__data__; + try { + listener.apply(node, args); + } finally { + d3.event = o; + } + } + var node = this, args = arguments; + onRemove.call(this); + this.addEventListener(type, this[name] = wrapper, wrapper.$ = capture); + wrapper._ = listener; + } + var name = "__on" + type, i = type.indexOf("."); + if (i > 0) type = type.substring(0, i); + return listener ? onAdd : onRemove; + } + function d3_selection_each(groups, callback) { + for (var j = 0, m = groups.length; j < m; j++) { + for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) { + if (node = group[i]) callback(node, i, j); + } + } + return groups; + } + function d3_selection_enter(selection) { + d3_arraySubclass(selection, d3_selection_enterPrototype); + return selection; + } + function d3_transition(groups, id, time) { + d3_arraySubclass(groups, d3_transitionPrototype); + var tweens = new d3_Map, event = d3.dispatch("start", "end"), ease = d3_transitionEase; + groups.id = id; + groups.time = time; + groups.tween = function(name, tween) { + if (arguments.length < 2) return tweens.get(name); + if (tween == null) tweens.remove(name); else tweens.set(name, tween); + return groups; + }; + groups.ease = function(value) { + if (!arguments.length) return ease; + ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments); + return groups; + }; + groups.each = function(type, listener) { + if (arguments.length < 2) return d3_transition_each.call(groups, type); + event.on(type, listener); + return groups; + }; + d3.timer(function(elapsed) { + return d3_selection_each(groups, function(node, i, j) { + function start(elapsed) { + if (lock.active > id) return stop(); + lock.active = id; + tweens.forEach(function(key, value) { + if (value = value.call(node, d, i)) { + tweened.push(value); + } + }); + event.start.call(node, d, i); + if (!tick(elapsed)) d3.timer(tick, 0, time); + return 1; + } + function tick(elapsed) { + if (lock.active !== id) return stop(); + var t = (elapsed - delay) / duration, e = ease(t), n = tweened.length; + while (n > 0) { + tweened[--n].call(node, e); + } + if (t >= 1) { + stop(); + d3_transitionId = id; + event.end.call(node, d, i); + d3_transitionId = 0; + return 1; + } + } + function stop() { + if (!--lock.count) delete node.__transition__; + return 1; + } + var tweened = [], delay = node.delay, duration = node.duration, lock = (node = node.node).__transition__ || (node.__transition__ = { + active: 0, + count: 0 + }), d = node.__data__; + ++lock.count; + delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time); + }); + }, 0, time); + return groups; + } + function d3_transition_each(callback) { + var id = d3_transitionId, ease = d3_transitionEase, delay = d3_transitionDelay, duration = d3_transitionDuration; + d3_transitionId = this.id; + d3_transitionEase = this.ease(); + d3_selection_each(this, function(node, i, j) { + d3_transitionDelay = node.delay; + d3_transitionDuration = node.duration; + callback.call(node = node.node, node.__data__, i, j); + }); + d3_transitionId = id; + d3_transitionEase = ease; + d3_transitionDelay = delay; + d3_transitionDuration = duration; + return this; + } + function d3_tweenNull(d, i, a) { + return a != "" && d3_tweenRemove; + } + function d3_tweenByName(b, name) { + return d3.tween(b, d3_interpolateByName(name)); + } + function d3_timer_step() { + var elapsed, now = Date.now(), t1 = d3_timer_queue; + while (t1) { + elapsed = now - t1.then; + if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed); + t1 = t1.next; + } + var delay = d3_timer_flush() - now; + if (delay > 24) { + if (isFinite(delay)) { + clearTimeout(d3_timer_timeout); + d3_timer_timeout = setTimeout(d3_timer_step, delay); + } + d3_timer_interval = 0; + } else { + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } + } + function d3_timer_flush() { + var t0 = null, t1 = d3_timer_queue, then = Infinity; + while (t1) { + if (t1.flush) { + t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next; + } else { + then = Math.min(then, t1.then + t1.delay); + t1 = (t0 = t1).next; + } + } + return then; + } + function d3_mousePoint(container, e) { + var svg = container.ownerSVGElement || container; + if (svg.createSVGPoint) { + var point = svg.createSVGPoint(); + if (d3_mouse_bug44083 < 0 && (window.scrollX || window.scrollY)) { + svg = d3.select(document.body).append("svg").style("position", "absolute").style("top", 0).style("left", 0); + var ctm = svg[0][0].getScreenCTM(); + d3_mouse_bug44083 = !(ctm.f || ctm.e); + svg.remove(); + } + if (d3_mouse_bug44083) { + point.x = e.pageX; + point.y = e.pageY; + } else { + point.x = e.clientX; + point.y = e.clientY; + } + point = point.matrixTransform(container.getScreenCTM().inverse()); + return [ point.x, point.y ]; + } + var rect = container.getBoundingClientRect(); + return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ]; + } + function d3_noop() {} + function d3_scaleExtent(domain) { + var start = domain[0], stop = domain[domain.length - 1]; + return start < stop ? [ start, stop ] : [ stop, start ]; + } + function d3_scaleRange(scale) { + return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range()); + } + function d3_scale_nice(domain, nice) { + var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx; + if (x1 < x0) { + dx = i0, i0 = i1, i1 = dx; + dx = x0, x0 = x1, x1 = dx; + } + if (nice = nice(x1 - x0)) { + domain[i0] = nice.floor(x0); + domain[i1] = nice.ceil(x1); + } + return domain; + } + function d3_scale_niceDefault() { + return Math; + } + function d3_scale_linear(domain, range, interpolate, clamp) { + function rescale() { + var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber; + output = linear(domain, range, uninterpolate, interpolate); + input = linear(range, domain, uninterpolate, d3.interpolate); + return scale; + } + function scale(x) { + return output(x); + } + var output, input; + scale.invert = function(y) { + return input(y); + }; + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.map(Number); + return rescale(); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + scale.rangeRound = function(x) { + return scale.range(x).interpolate(d3.interpolateRound); + }; + scale.clamp = function(x) { + if (!arguments.length) return clamp; + clamp = x; + return rescale(); + }; + scale.interpolate = function(x) { + if (!arguments.length) return interpolate; + interpolate = x; + return rescale(); + }; + scale.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + scale.tickFormat = function(m) { + return d3_scale_linearTickFormat(domain, m); + }; + scale.nice = function() { + d3_scale_nice(domain, d3_scale_linearNice); + return rescale(); + }; + scale.copy = function() { + return d3_scale_linear(domain, range, interpolate, clamp); + }; + return rescale(); + } + function d3_scale_linearRebind(scale, linear) { + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); + } + function d3_scale_linearNice(dx) { + dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1); + return dx && { + floor: function(x) { + return Math.floor(x / dx) * dx; + }, + ceil: function(x) { + return Math.ceil(x / dx) * dx; + } + }; + } + function d3_scale_linearTickRange(domain, m) { + var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step; + if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2; + extent[0] = Math.ceil(extent[0] / step) * step; + extent[1] = Math.floor(extent[1] / step) * step + step * .5; + extent[2] = step; + return extent; + } + function d3_scale_linearTicks(domain, m) { + return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); + } + function d3_scale_linearTickFormat(domain, m) { + return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f"); + } + function d3_scale_bilinear(domain, range, uninterpolate, interpolate) { + var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]); + return function(x) { + return i(u(x)); + }; + } + function d3_scale_polylinear(domain, range, uninterpolate, interpolate) { + var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1; + if (domain[k] < domain[0]) { + domain = domain.slice().reverse(); + range = range.slice().reverse(); + } + while (++j <= k) { + u.push(uninterpolate(domain[j - 1], domain[j])); + i.push(interpolate(range[j - 1], range[j])); + } + return function(x) { + var j = d3.bisect(domain, x, 1, k) - 1; + return i[j](u[j](x)); + }; + } + function d3_scale_log(linear, log) { + function scale(x) { + return linear(log(x)); + } + var pow = log.pow; + scale.invert = function(x) { + return pow(linear.invert(x)); + }; + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(pow); + log = x[0] < 0 ? d3_scale_logn : d3_scale_logp; + pow = log.pow; + linear.domain(x.map(log)); + return scale; + }; + scale.nice = function() { + linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault)); + return scale; + }; + scale.ticks = function() { + var extent = d3_scaleExtent(linear.domain()), ticks = []; + if (extent.every(isFinite)) { + var i = Math.floor(extent[0]), j = Math.ceil(extent[1]), u = pow(extent[0]), v = pow(extent[1]); + if (log === d3_scale_logn) { + ticks.push(pow(i)); + for (; i++ < j; ) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k); + } else { + for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k); + ticks.push(pow(i)); + } + for (i = 0; ticks[i] < u; i++) {} + for (j = ticks.length; ticks[j - 1] > v; j--) {} + ticks = ticks.slice(i, j); + } + return ticks; + }; + scale.tickFormat = function(n, format) { + if (arguments.length < 2) format = d3_scale_logFormat; + if (arguments.length < 1) return format; + var k = Math.max(.1, n / scale.ticks().length), f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil), e; + return function(d) { + return d / pow(f(log(d) + e)) <= k ? format(d) : ""; + }; + }; + scale.copy = function() { + return d3_scale_log(linear.copy(), log); + }; + return d3_scale_linearRebind(scale, linear); + } + function d3_scale_logp(x) { + return Math.log(x < 0 ? 0 : x) / Math.LN10; + } + function d3_scale_logn(x) { + return -Math.log(x > 0 ? 0 : -x) / Math.LN10; + } + function d3_scale_pow(linear, exponent) { + function scale(x) { + return linear(powp(x)); + } + var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent); + scale.invert = function(x) { + return powb(linear.invert(x)); + }; + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(powb); + linear.domain(x.map(powp)); + return scale; + }; + scale.ticks = function(m) { + return d3_scale_linearTicks(scale.domain(), m); + }; + scale.tickFormat = function(m) { + return d3_scale_linearTickFormat(scale.domain(), m); + }; + scale.nice = function() { + return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice)); + }; + scale.exponent = function(x) { + if (!arguments.length) return exponent; + var domain = scale.domain(); + powp = d3_scale_powPow(exponent = x); + powb = d3_scale_powPow(1 / exponent); + return scale.domain(domain); + }; + scale.copy = function() { + return d3_scale_pow(linear.copy(), exponent); + }; + return d3_scale_linearRebind(scale, linear); + } + function d3_scale_powPow(e) { + return function(x) { + return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e); + }; + } + function d3_scale_ordinal(domain, ranger) { + function scale(x) { + return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length]; + } + function steps(start, step) { + return d3.range(domain.length).map(function(i) { + return start + step * i; + }); + } + var index, range, rangeBand; + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = []; + index = new d3_Map; + var i = -1, n = x.length, xi; + while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi)); + return scale[ranger.t].apply(scale, ranger.a); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + rangeBand = 0; + ranger = { + t: "range", + a: arguments + }; + return scale; + }; + scale.rangePoints = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding); + range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step); + rangeBand = 0; + ranger = { + t: "rangePoints", + a: arguments + }; + return scale; + }; + scale.rangeBands = function(x, padding, outerPadding) { + if (arguments.length < 2) padding = 0; + if (arguments.length < 3) outerPadding = padding; + var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding); + range = steps(start + step * outerPadding, step); + if (reverse) range.reverse(); + rangeBand = step * (1 - padding); + ranger = { + t: "rangeBands", + a: arguments + }; + return scale; + }; + scale.rangeRoundBands = function(x, padding, outerPadding) { + if (arguments.length < 2) padding = 0; + if (arguments.length < 3) outerPadding = padding; + var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)), error = stop - start - (domain.length - padding) * step; + range = steps(start + Math.round(error / 2), step); + if (reverse) range.reverse(); + rangeBand = Math.round(step * (1 - padding)); + ranger = { + t: "rangeRoundBands", + a: arguments + }; + return scale; + }; + scale.rangeBand = function() { + return rangeBand; + }; + scale.rangeExtent = function() { + return d3_scaleExtent(ranger.a[0]); + }; + scale.copy = function() { + return d3_scale_ordinal(domain, ranger); + }; + return scale.domain(domain); + } + function d3_scale_quantile(domain, range) { + function rescale() { + var k = 0, n = domain.length, q = range.length; + thresholds = []; + while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q); + return scale; + } + function scale(x) { + if (isNaN(x = +x)) return NaN; + return range[d3.bisect(thresholds, x)]; + } + var thresholds; + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.filter(function(d) { + return !isNaN(d); + }).sort(d3.ascending); + return rescale(); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + scale.quantiles = function() { + return thresholds; + }; + scale.copy = function() { + return d3_scale_quantile(domain, range); + }; + return rescale(); + } + function d3_scale_quantize(x0, x1, range) { + function scale(x) { + return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; + } + function rescale() { + kx = range.length / (x1 - x0); + i = range.length - 1; + return scale; + } + var kx, i; + scale.domain = function(x) { + if (!arguments.length) return [ x0, x1 ]; + x0 = +x[0]; + x1 = +x[x.length - 1]; + return rescale(); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + scale.copy = function() { + return d3_scale_quantize(x0, x1, range); + }; + return rescale(); + } + function d3_scale_threshold(domain, range) { + function scale(x) { + return range[d3.bisect(domain, x)]; + } + scale.domain = function(_) { + if (!arguments.length) return domain; + domain = _; + return scale; + }; + scale.range = function(_) { + if (!arguments.length) return range; + range = _; + return scale; + }; + scale.copy = function() { + return d3_scale_threshold(domain, range); + }; + return scale; + } + function d3_scale_identity(domain) { + function identity(x) { + return +x; + } + identity.invert = identity; + identity.domain = identity.range = function(x) { + if (!arguments.length) return domain; + domain = x.map(identity); + return identity; + }; + identity.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + identity.tickFormat = function(m) { + return d3_scale_linearTickFormat(domain, m); + }; + identity.copy = function() { + return d3_scale_identity(domain); + }; + return identity; + } + function d3_svg_arcInnerRadius(d) { + return d.innerRadius; + } + function d3_svg_arcOuterRadius(d) { + return d.outerRadius; + } + function d3_svg_arcStartAngle(d) { + return d.startAngle; + } + function d3_svg_arcEndAngle(d) { + return d.endAngle; + } + function d3_svg_line(projection) { + function line(data) { + function segment() { + segments.push("M", interpolate(projection(points), tension)); + } + var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y); + while (++i < n) { + if (defined.call(this, d = data[i], i)) { + points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]); + } else if (points.length) { + segment(); + points = []; + } + } + if (points.length) segment(); + return segments.length ? segments.join("") : null; + } + var x = d3_svg_lineX, y = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7; + line.x = function(_) { + if (!arguments.length) return x; + x = _; + return line; + }; + line.y = function(_) { + if (!arguments.length) return y; + y = _; + return line; + }; + line.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return line; + }; + line.interpolate = function(_) { + if (!arguments.length) return interpolateKey; + if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; + return line; + }; + line.tension = function(_) { + if (!arguments.length) return tension; + tension = _; + return line; + }; + return line; + } + function d3_svg_lineX(d) { + return d[0]; + } + function d3_svg_lineY(d) { + return d[1]; + } + function d3_svg_lineLinear(points) { + return points.join("L"); + } + function d3_svg_lineLinearClosed(points) { + return d3_svg_lineLinear(points) + "Z"; + } + function d3_svg_lineStepBefore(points) { + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; + while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]); + return path.join(""); + } + function d3_svg_lineStepAfter(points) { + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; + while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]); + return path.join(""); + } + function d3_svg_lineCardinalOpen(points, tension) { + return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension)); + } + function d3_svg_lineCardinalClosed(points, tension) { + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension)); + } + function d3_svg_lineCardinal(points, tension, closed) { + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension)); + } + function d3_svg_lineHermite(points, tangents) { + if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) { + return d3_svg_lineLinear(points); + } + var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1; + if (quad) { + path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1]; + p0 = points[1]; + pi = 2; + } + if (tangents.length > 1) { + t = tangents[1]; + p = points[pi]; + pi++; + path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; + for (var i = 2; i < tangents.length; i++, pi++) { + p = points[pi]; + t = tangents[i]; + path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; + } + } + if (quad) { + var lp = points[pi]; + path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1]; + } + return path; + } + function d3_svg_lineCardinalTangents(points, tension) { + var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length; + while (++i < n) { + p0 = p1; + p1 = p2; + p2 = points[i]; + tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]); + } + return tangents; + } + function d3_svg_lineBasis(points) { + if (points.length < 3) return d3_svg_lineLinear(points); + var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0 ]; + d3_svg_lineBasisBezier(path, px, py); + while (++i < n) { + pi = points[i]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + i = -1; + while (++i < 2) { + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); + } + function d3_svg_lineBasisOpen(points) { + if (points.length < 4) return d3_svg_lineLinear(points); + var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ]; + while (++i < 3) { + pi = points[i]; + px.push(pi[0]); + py.push(pi[1]); + } + path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)); + --i; + while (++i < n) { + pi = points[i]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); + } + function d3_svg_lineBasisClosed(points) { + var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = []; + while (++i < 4) { + pi = points[i % n]; + px.push(pi[0]); + py.push(pi[1]); + } + path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ]; + --i; + while (++i < m) { + pi = points[i % n]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); + } + function d3_svg_lineBundle(points, tension) { + var n = points.length - 1; + if (n) { + var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t; + while (++i <= n) { + p = points[i]; + t = i / n; + p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); + p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); + } + } + return d3_svg_lineBasis(points); + } + function d3_svg_lineDot4(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + function d3_svg_lineBasisBezier(path, x, y) { + path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y)); + } + function d3_svg_lineSlope(p0, p1) { + return (p1[1] - p0[1]) / (p1[0] - p0[0]); + } + function d3_svg_lineFiniteDifferences(points) { + var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1); + while (++i < j) { + m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2; + } + m[i] = d; + return m; + } + function d3_svg_lineMonotoneTangents(points) { + var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1; + while (++i < j) { + d = d3_svg_lineSlope(points[i], points[i + 1]); + if (Math.abs(d) < 1e-6) { + m[i] = m[i + 1] = 0; + } else { + a = m[i] / d; + b = m[i + 1] / d; + s = a * a + b * b; + if (s > 9) { + s = d * 3 / Math.sqrt(s); + m[i] = s * a; + m[i + 1] = s * b; + } + } + } + i = -1; + while (++i <= j) { + s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i])); + tangents.push([ s || 0, m[i] * s || 0 ]); + } + return tangents; + } + function d3_svg_lineMonotone(points) { + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points)); + } + function d3_svg_lineRadial(points) { + var point, i = -1, n = points.length, r, a; + while (++i < n) { + point = points[i]; + r = point[0]; + a = point[1] + d3_svg_arcOffset; + point[0] = r * Math.cos(a); + point[1] = r * Math.sin(a); + } + return points; + } + function d3_svg_area(projection) { + function area(data) { + function segment() { + segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z"); + } + var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() { + return x; + } : d3_functor(x1), fy1 = y0 === y1 ? function() { + return y; + } : d3_functor(y1), x, y; + while (++i < n) { + if (defined.call(this, d = data[i], i)) { + points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]); + points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]); + } else if (points0.length) { + segment(); + points0 = []; + points1 = []; + } + } + if (points0.length) segment(); + return segments.length ? segments.join("") : null; + } + var x0 = d3_svg_lineX, x1 = d3_svg_lineX, y0 = 0, y1 = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7; + area.x = function(_) { + if (!arguments.length) return x1; + x0 = x1 = _; + return area; + }; + area.x0 = function(_) { + if (!arguments.length) return x0; + x0 = _; + return area; + }; + area.x1 = function(_) { + if (!arguments.length) return x1; + x1 = _; + return area; + }; + area.y = function(_) { + if (!arguments.length) return y1; + y0 = y1 = _; + return area; + }; + area.y0 = function(_) { + if (!arguments.length) return y0; + y0 = _; + return area; + }; + area.y1 = function(_) { + if (!arguments.length) return y1; + y1 = _; + return area; + }; + area.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return area; + }; + area.interpolate = function(_) { + if (!arguments.length) return interpolateKey; + if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; + interpolateReverse = interpolate.reverse || interpolate; + L = interpolate.closed ? "M" : "L"; + return area; + }; + area.tension = function(_) { + if (!arguments.length) return tension; + tension = _; + return area; + }; + return area; + } + function d3_svg_chordSource(d) { + return d.source; + } + function d3_svg_chordTarget(d) { + return d.target; + } + function d3_svg_chordRadius(d) { + return d.radius; + } + function d3_svg_chordStartAngle(d) { + return d.startAngle; + } + function d3_svg_chordEndAngle(d) { + return d.endAngle; + } + function d3_svg_diagonalProjection(d) { + return [ d.x, d.y ]; + } + function d3_svg_diagonalRadialProjection(projection) { + return function() { + var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset; + return [ r * Math.cos(a), r * Math.sin(a) ]; + }; + } + function d3_svg_symbolSize() { + return 64; + } + function d3_svg_symbolType() { + return "circle"; + } + function d3_svg_symbolCircle(size) { + var r = Math.sqrt(size / Math.PI); + return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z"; + } + function d3_svg_axisX(selection, x) { + selection.attr("transform", function(d) { + return "translate(" + x(d) + ",0)"; + }); + } + function d3_svg_axisY(selection, y) { + selection.attr("transform", function(d) { + return "translate(0," + y(d) + ")"; + }); + } + function d3_svg_axisSubdivide(scale, ticks, m) { + subticks = []; + if (m && ticks.length > 1) { + var extent = d3_scaleExtent(scale.domain()), subticks, i = -1, n = ticks.length, d = (ticks[1] - ticks[0]) / ++m, j, v; + while (++i < n) { + for (j = m; --j > 0; ) { + if ((v = +ticks[i] - j * d) >= extent[0]) { + subticks.push(v); + } + } + } + for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1]; ) { + subticks.push(v); + } + } + return subticks; + } + function d3_behavior_zoomDelta() { + if (!d3_behavior_zoomDiv) { + d3_behavior_zoomDiv = d3.select("body").append("div").style("visibility", "hidden").style("top", 0).style("height", 0).style("width", 0).style("overflow-y", "scroll").append("div").style("height", "2000px").node().parentNode; + } + var e = d3.event, delta; + try { + d3_behavior_zoomDiv.scrollTop = 1e3; + d3_behavior_zoomDiv.dispatchEvent(e); + delta = 1e3 - d3_behavior_zoomDiv.scrollTop; + } catch (error) { + delta = e.wheelDelta || -e.detail * 5; + } + return delta; + } + function d3_layout_bundlePath(link) { + var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ]; + while (start !== lca) { + start = start.parent; + points.push(start); + } + var k = points.length; + while (end !== lca) { + points.splice(k, 0, end); + end = end.parent; + } + return points; + } + function d3_layout_bundleAncestors(node) { + var ancestors = [], parent = node.parent; + while (parent != null) { + ancestors.push(node); + node = parent; + parent = parent.parent; + } + ancestors.push(node); + return ancestors; + } + function d3_layout_bundleLeastCommonAncestor(a, b) { + if (a === b) return a; + var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null; + while (aNode === bNode) { + sharedNode = aNode; + aNode = aNodes.pop(); + bNode = bNodes.pop(); + } + return sharedNode; + } + function d3_layout_forceDragstart(d) { + d.fixed |= 2; + } + function d3_layout_forceDragend(d) { + d.fixed &= 1; + } + function d3_layout_forceMouseover(d) { + d.fixed |= 4; + } + function d3_layout_forceMouseout(d) { + d.fixed &= 3; + } + function d3_layout_forceAccumulate(quad, alpha, charges) { + var cx = 0, cy = 0; + quad.charge = 0; + if (!quad.leaf) { + var nodes = quad.nodes, n = nodes.length, i = -1, c; + while (++i < n) { + c = nodes[i]; + if (c == null) continue; + d3_layout_forceAccumulate(c, alpha, charges); + quad.charge += c.charge; + cx += c.charge * c.cx; + cy += c.charge * c.cy; + } + } + if (quad.point) { + if (!quad.leaf) { + quad.point.x += Math.random() - .5; + quad.point.y += Math.random() - .5; + } + var k = alpha * charges[quad.point.index]; + quad.charge += quad.pointCharge = k; + cx += k * quad.point.x; + cy += k * quad.point.y; + } + quad.cx = cx / quad.charge; + quad.cy = cy / quad.charge; + } + function d3_layout_forceLinkDistance(link) { + return 20; + } + function d3_layout_forceLinkStrength(link) { + return 1; + } + function d3_layout_stackX(d) { + return d.x; + } + function d3_layout_stackY(d) { + return d.y; + } + function d3_layout_stackOut(d, y0, y) { + d.y0 = y0; + d.y = y; + } + function d3_layout_stackOrderDefault(data) { + return d3.range(data.length); + } + function d3_layout_stackOffsetZero(data) { + var j = -1, m = data[0].length, y0 = []; + while (++j < m) y0[j] = 0; + return y0; + } + function d3_layout_stackMaxIndex(array) { + var i = 1, j = 0, v = array[0][1], k, n = array.length; + for (; i < n; ++i) { + if ((k = array[i][1]) > v) { + j = i; + v = k; + } + } + return j; + } + function d3_layout_stackReduceSum(d) { + return d.reduce(d3_layout_stackSum, 0); + } + function d3_layout_stackSum(p, d) { + return p + d[1]; + } + function d3_layout_histogramBinSturges(range, values) { + return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1)); + } + function d3_layout_histogramBinFixed(range, n) { + var x = -1, b = +range[0], m = (range[1] - b) / n, f = []; + while (++x <= n) f[x] = m * x + b; + return f; + } + function d3_layout_histogramRange(values) { + return [ d3.min(values), d3.max(values) ]; + } + function d3_layout_hierarchyRebind(object, hierarchy) { + d3.rebind(object, hierarchy, "sort", "children", "value"); + object.links = d3_layout_hierarchyLinks; + object.nodes = function(d) { + d3_layout_hierarchyInline = true; + return (object.nodes = object)(d); + }; + return object; + } + function d3_layout_hierarchyChildren(d) { + return d.children; + } + function d3_layout_hierarchyValue(d) { + return d.value; + } + function d3_layout_hierarchySort(a, b) { + return b.value - a.value; + } + function d3_layout_hierarchyLinks(nodes) { + return d3.merge(nodes.map(function(parent) { + return (parent.children || []).map(function(child) { + return { + source: parent, + target: child + }; + }); + })); + } + function d3_layout_packSort(a, b) { + return a.value - b.value; + } + function d3_layout_packInsert(a, b) { + var c = a._pack_next; + a._pack_next = b; + b._pack_prev = a; + b._pack_next = c; + c._pack_prev = b; + } + function d3_layout_packSplice(a, b) { + a._pack_next = b; + b._pack_prev = a; + } + function d3_layout_packIntersects(a, b) { + var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r; + return dr * dr - dx * dx - dy * dy > .001; + } + function d3_layout_packSiblings(node) { + function bound(node) { + xMin = Math.min(node.x - node.r, xMin); + xMax = Math.max(node.x + node.r, xMax); + yMin = Math.min(node.y - node.r, yMin); + yMax = Math.max(node.y + node.r, yMax); + } + if (!(nodes = node.children) || !(n = nodes.length)) return; + var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n; + nodes.forEach(d3_layout_packLink); + a = nodes[0]; + a.x = -a.r; + a.y = 0; + bound(a); + if (n > 1) { + b = nodes[1]; + b.x = b.r; + b.y = 0; + bound(b); + if (n > 2) { + c = nodes[2]; + d3_layout_packPlace(a, b, c); + bound(c); + d3_layout_packInsert(a, c); + a._pack_prev = c; + d3_layout_packInsert(c, b); + b = a._pack_next; + for (i = 3; i < n; i++) { + d3_layout_packPlace(a, b, c = nodes[i]); + var isect = 0, s1 = 1, s2 = 1; + for (j = b._pack_next; j !== b; j = j._pack_next, s1++) { + if (d3_layout_packIntersects(j, c)) { + isect = 1; + break; + } + } + if (isect == 1) { + for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) { + if (d3_layout_packIntersects(k, c)) { + break; + } + } + } + if (isect) { + if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b); + i--; + } else { + d3_layout_packInsert(a, c); + b = c; + bound(c); + } + } + } + } + var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0; + for (i = 0; i < n; i++) { + c = nodes[i]; + c.x -= cx; + c.y -= cy; + cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y)); + } + node.r = cr; + nodes.forEach(d3_layout_packUnlink); + } + function d3_layout_packLink(node) { + node._pack_next = node._pack_prev = node; + } + function d3_layout_packUnlink(node) { + delete node._pack_next; + delete node._pack_prev; + } + function d3_layout_packTransform(node, x, y, k) { + var children = node.children; + node.x = x += k * node.x; + node.y = y += k * node.y; + node.r *= k; + if (children) { + var i = -1, n = children.length; + while (++i < n) d3_layout_packTransform(children[i], x, y, k); + } + } + function d3_layout_packPlace(a, b, c) { + var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y; + if (db && (dx || dy)) { + var da = b.r + c.r, dc = dx * dx + dy * dy; + da *= da; + db *= db; + var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc); + c.x = a.x + x * dx + y * dy; + c.y = a.y + x * dy - y * dx; + } else { + c.x = a.x + db; + c.y = a.y; + } + } + function d3_layout_clusterY(children) { + return 1 + d3.max(children, function(child) { + return child.y; + }); + } + function d3_layout_clusterX(children) { + return children.reduce(function(x, child) { + return x + child.x; + }, 0) / children.length; + } + function d3_layout_clusterLeft(node) { + var children = node.children; + return children && children.length ? d3_layout_clusterLeft(children[0]) : node; + } + function d3_layout_clusterRight(node) { + var children = node.children, n; + return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node; + } + function d3_layout_treeSeparation(a, b) { + return a.parent == b.parent ? 1 : 2; + } + function d3_layout_treeLeft(node) { + var children = node.children; + return children && children.length ? children[0] : node._tree.thread; + } + function d3_layout_treeRight(node) { + var children = node.children, n; + return children && (n = children.length) ? children[n - 1] : node._tree.thread; + } + function d3_layout_treeSearch(node, compare) { + var children = node.children; + if (children && (n = children.length)) { + var child, n, i = -1; + while (++i < n) { + if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) { + node = child; + } + } + } + return node; + } + function d3_layout_treeRightmost(a, b) { + return a.x - b.x; + } + function d3_layout_treeLeftmost(a, b) { + return b.x - a.x; + } + function d3_layout_treeDeepest(a, b) { + return a.depth - b.depth; + } + function d3_layout_treeVisitAfter(node, callback) { + function visit(node, previousSibling) { + var children = node.children; + if (children && (n = children.length)) { + var child, previousChild = null, i = -1, n; + while (++i < n) { + child = children[i]; + visit(child, previousChild); + previousChild = child; + } + } + callback(node, previousSibling); + } + visit(node, null); + } + function d3_layout_treeShift(node) { + var shift = 0, change = 0, children = node.children, i = children.length, child; + while (--i >= 0) { + child = children[i]._tree; + child.prelim += shift; + child.mod += shift; + shift += child.shift + (change += child.change); + } + } + function d3_layout_treeMove(ancestor, node, shift) { + ancestor = ancestor._tree; + node = node._tree; + var change = shift / (node.number - ancestor.number); + ancestor.change += change; + node.change -= change; + node.shift += shift; + node.prelim += shift; + node.mod += shift; + } + function d3_layout_treeAncestor(vim, node, ancestor) { + return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor; + } + function d3_layout_treemapPadNull(node) { + return { + x: node.x, + y: node.y, + dx: node.dx, + dy: node.dy + }; + } + function d3_layout_treemapPad(node, padding) { + var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2]; + if (dx < 0) { + x += dx / 2; + dx = 0; + } + if (dy < 0) { + y += dy / 2; + dy = 0; + } + return { + x: x, + y: y, + dx: dx, + dy: dy + }; + } + function d3_dsv(delimiter, mimeType) { + function dsv(url, callback) { + d3.text(url, mimeType, function(text) { + callback(text && dsv.parse(text)); + }); + } + function formatRow(row) { + return row.map(formatValue).join(delimiter); + } + function formatValue(text) { + return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text; + } + var reParse = new RegExp("\r\n|[" + delimiter + "\r\n]", "g"), reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0); + dsv.parse = function(text) { + var header; + return dsv.parseRows(text, function(row, i) { + if (i) { + var o = {}, j = -1, m = header.length; + while (++j < m) o[header[j]] = row[j]; + return o; + } else { + header = row; + return null; + } + }); + }; + dsv.parseRows = function(text, f) { + function token() { + if (reParse.lastIndex >= text.length) return EOF; + if (eol) { + eol = false; + return EOL; + } + var j = reParse.lastIndex; + if (text.charCodeAt(j) === 34) { + var i = j; + while (i++ < text.length) { + if (text.charCodeAt(i) === 34) { + if (text.charCodeAt(i + 1) !== 34) break; + i++; + } + } + reParse.lastIndex = i + 2; + var c = text.charCodeAt(i + 1); + if (c === 13) { + eol = true; + if (text.charCodeAt(i + 2) === 10) reParse.lastIndex++; + } else if (c === 10) { + eol = true; + } + return text.substring(j + 1, i).replace(/""/g, '"'); + } + var m = reParse.exec(text); + if (m) { + eol = m[0].charCodeAt(0) !== delimiterCode; + return text.substring(j, m.index); + } + reParse.lastIndex = text.length; + return text.substring(j); + } + var EOL = {}, EOF = {}, rows = [], n = 0, t, eol; + reParse.lastIndex = 0; + while ((t = token()) !== EOF) { + var a = []; + while (t !== EOL && t !== EOF) { + a.push(t); + t = token(); + } + if (f && !(a = f(a, n++))) continue; + rows.push(a); + } + return rows; + }; + dsv.format = function(rows) { + return rows.map(formatRow).join("\n"); + }; + return dsv; + } + function d3_geo_type(types, defaultValue) { + return function(object) { + return object && types.hasOwnProperty(object.type) ? types[object.type](object) : defaultValue; + }; + } + function d3_path_circle(radius) { + return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + +2 * radius + "z"; + } + function d3_geo_bounds(o, f) { + if (d3_geo_boundsTypes.hasOwnProperty(o.type)) d3_geo_boundsTypes[o.type](o, f); + } + function d3_geo_boundsFeature(o, f) { + d3_geo_bounds(o.geometry, f); + } + function d3_geo_boundsFeatureCollection(o, f) { + for (var a = o.features, i = 0, n = a.length; i < n; i++) { + d3_geo_bounds(a[i].geometry, f); + } + } + function d3_geo_boundsGeometryCollection(o, f) { + for (var a = o.geometries, i = 0, n = a.length; i < n; i++) { + d3_geo_bounds(a[i], f); + } + } + function d3_geo_boundsLineString(o, f) { + for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { + f.apply(null, a[i]); + } + } + function d3_geo_boundsMultiLineString(o, f) { + for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { + for (var b = a[i], j = 0, m = b.length; j < m; j++) { + f.apply(null, b[j]); + } + } + } + function d3_geo_boundsMultiPolygon(o, f) { + for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) { + for (var b = a[i][0], j = 0, m = b.length; j < m; j++) { + f.apply(null, b[j]); + } + } + } + function d3_geo_boundsPoint(o, f) { + f.apply(null, o.coordinates); + } + function d3_geo_boundsPolygon(o, f) { + for (var a = o.coordinates[0], i = 0, n = a.length; i < n; i++) { + f.apply(null, a[i]); + } + } + function d3_geo_greatArcSource(d) { + return d.source; + } + function d3_geo_greatArcTarget(d) { + return d.target; + } + function d3_geo_greatArcInterpolator() { + function interpolate(t) { + var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1; + return [ Math.atan2(y, x) / d3_geo_radians, Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_geo_radians ]; + } + var x0, y0, cy0, sy0, kx0, ky0, x1, y1, cy1, sy1, kx1, ky1, d, k; + interpolate.distance = function() { + if (d == null) k = 1 / Math.sin(d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0))))); + return d; + }; + interpolate.source = function(_) { + var cx0 = Math.cos(x0 = _[0] * d3_geo_radians), sx0 = Math.sin(x0); + cy0 = Math.cos(y0 = _[1] * d3_geo_radians); + sy0 = Math.sin(y0); + kx0 = cy0 * cx0; + ky0 = cy0 * sx0; + d = null; + return interpolate; + }; + interpolate.target = function(_) { + var cx1 = Math.cos(x1 = _[0] * d3_geo_radians), sx1 = Math.sin(x1); + cy1 = Math.cos(y1 = _[1] * d3_geo_radians); + sy1 = Math.sin(y1); + kx1 = cy1 * cx1; + ky1 = cy1 * sx1; + d = null; + return interpolate; + }; + return interpolate; + } + function d3_geo_greatArcInterpolate(a, b) { + var i = d3_geo_greatArcInterpolator().source(a).target(b); + i.distance(); + return i; + } + function d3_geom_contourStart(grid) { + var x = 0, y = 0; + while (true) { + if (grid(x, y)) { + return [ x, y ]; + } + if (x === 0) { + x = y + 1; + y = 0; + } else { + x = x - 1; + y = y + 1; + } + } + } + function d3_geom_hullCCW(i1, i2, i3, v) { + var t, a, b, c, d, e, f; + t = v[i1]; + a = t[0]; + b = t[1]; + t = v[i2]; + c = t[0]; + d = t[1]; + t = v[i3]; + e = t[0]; + f = t[1]; + return (f - b) * (c - a) - (d - b) * (e - a) > 0; + } + function d3_geom_polygonInside(p, a, b) { + return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]); + } + function d3_geom_polygonIntersect(c, d, a, b) { + var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0], y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1], x13 = x1 - x3, x21 = x2 - x1, x43 = x4 - x3, y13 = y1 - y3, y21 = y2 - y1, y43 = y4 - y3, ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21); + return [ x1 + ua * x21, y1 + ua * y21 ]; + } + function d3_voronoi_tessellate(vertices, callback) { + var Sites = { + list: vertices.map(function(v, i) { + return { + index: i, + x: v[0], + y: v[1] + }; + }).sort(function(a, b) { + return a.y < b.y ? -1 : a.y > b.y ? 1 : a.x < b.x ? -1 : a.x > b.x ? 1 : 0; + }), + bottomSite: null + }; + var EdgeList = { + list: [], + leftEnd: null, + rightEnd: null, + init: function() { + EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.leftEnd.r = EdgeList.rightEnd; + EdgeList.rightEnd.l = EdgeList.leftEnd; + EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd); + }, + createHalfEdge: function(edge, side) { + return { + edge: edge, + side: side, + vertex: null, + l: null, + r: null + }; + }, + insert: function(lb, he) { + he.l = lb; + he.r = lb.r; + lb.r.l = he; + lb.r = he; + }, + leftBound: function(p) { + var he = EdgeList.leftEnd; + do { + he = he.r; + } while (he != EdgeList.rightEnd && Geom.rightOf(he, p)); + he = he.l; + return he; + }, + del: function(he) { + he.l.r = he.r; + he.r.l = he.l; + he.edge = null; + }, + right: function(he) { + return he.r; + }, + left: function(he) { + return he.l; + }, + leftRegion: function(he) { + return he.edge == null ? Sites.bottomSite : he.edge.region[he.side]; + }, + rightRegion: function(he) { + return he.edge == null ? Sites.bottomSite : he.edge.region[d3_voronoi_opposite[he.side]]; + } + }; + var Geom = { + bisect: function(s1, s2) { + var newEdge = { + region: { + l: s1, + r: s2 + }, + ep: { + l: null, + r: null + } + }; + var dx = s2.x - s1.x, dy = s2.y - s1.y, adx = dx > 0 ? dx : -dx, ady = dy > 0 ? dy : -dy; + newEdge.c = s1.x * dx + s1.y * dy + (dx * dx + dy * dy) * .5; + if (adx > ady) { + newEdge.a = 1; + newEdge.b = dy / dx; + newEdge.c /= dx; + } else { + newEdge.b = 1; + newEdge.a = dx / dy; + newEdge.c /= dy; + } + return newEdge; + }, + intersect: function(el1, el2) { + var e1 = el1.edge, e2 = el2.edge; + if (!e1 || !e2 || e1.region.r == e2.region.r) { + return null; + } + var d = e1.a * e2.b - e1.b * e2.a; + if (Math.abs(d) < 1e-10) { + return null; + } + var xint = (e1.c * e2.b - e2.c * e1.b) / d, yint = (e2.c * e1.a - e1.c * e2.a) / d, e1r = e1.region.r, e2r = e2.region.r, el, e; + if (e1r.y < e2r.y || e1r.y == e2r.y && e1r.x < e2r.x) { + el = el1; + e = e1; + } else { + el = el2; + e = e2; + } + var rightOfSite = xint >= e.region.r.x; + if (rightOfSite && el.side === "l" || !rightOfSite && el.side === "r") { + return null; + } + return { + x: xint, + y: yint + }; + }, + rightOf: function(he, p) { + var e = he.edge, topsite = e.region.r, rightOfSite = p.x > topsite.x; + if (rightOfSite && he.side === "l") { + return 1; + } + if (!rightOfSite && he.side === "r") { + return 0; + } + if (e.a === 1) { + var dyp = p.y - topsite.y, dxp = p.x - topsite.x, fast = 0, above = 0; + if (!rightOfSite && e.b < 0 || rightOfSite && e.b >= 0) { + above = fast = dyp >= e.b * dxp; + } else { + above = p.x + p.y * e.b > e.c; + if (e.b < 0) { + above = !above; + } + if (!above) { + fast = 1; + } + } + if (!fast) { + var dxs = topsite.x - e.region.l.x; + above = e.b * (dxp * dxp - dyp * dyp) < dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b); + if (e.b < 0) { + above = !above; + } + } + } else { + var yl = e.c - e.a * p.x, t1 = p.y - yl, t2 = p.x - topsite.x, t3 = yl - topsite.y; + above = t1 * t1 > t2 * t2 + t3 * t3; + } + return he.side === "l" ? above : !above; + }, + endPoint: function(edge, side, site) { + edge.ep[side] = site; + if (!edge.ep[d3_voronoi_opposite[side]]) return; + callback(edge); + }, + distance: function(s, t) { + var dx = s.x - t.x, dy = s.y - t.y; + return Math.sqrt(dx * dx + dy * dy); + } + }; + var EventQueue = { + list: [], + insert: function(he, site, offset) { + he.vertex = site; + he.ystar = site.y + offset; + for (var i = 0, list = EventQueue.list, l = list.length; i < l; i++) { + var next = list[i]; + if (he.ystar > next.ystar || he.ystar == next.ystar && site.x > next.vertex.x) { + continue; + } else { + break; + } + } + list.splice(i, 0, he); + }, + del: function(he) { + for (var i = 0, ls = EventQueue.list, l = ls.length; i < l && ls[i] != he; ++i) {} + ls.splice(i, 1); + }, + empty: function() { + return EventQueue.list.length === 0; + }, + nextEvent: function(he) { + for (var i = 0, ls = EventQueue.list, l = ls.length; i < l; ++i) { + if (ls[i] == he) return ls[i + 1]; + } + return null; + }, + min: function() { + var elem = EventQueue.list[0]; + return { + x: elem.vertex.x, + y: elem.ystar + }; + }, + extractMin: function() { + return EventQueue.list.shift(); + } + }; + EdgeList.init(); + Sites.bottomSite = Sites.list.shift(); + var newSite = Sites.list.shift(), newIntStar; + var lbnd, rbnd, llbnd, rrbnd, bisector; + var bot, top, temp, p, v; + var e, pm; + while (true) { + if (!EventQueue.empty()) { + newIntStar = EventQueue.min(); + } + if (newSite && (EventQueue.empty() || newSite.y < newIntStar.y || newSite.y == newIntStar.y && newSite.x < newIntStar.x)) { + lbnd = EdgeList.leftBound(newSite); + rbnd = EdgeList.right(lbnd); + bot = EdgeList.rightRegion(lbnd); + e = Geom.bisect(bot, newSite); + bisector = EdgeList.createHalfEdge(e, "l"); + EdgeList.insert(lbnd, bisector); + p = Geom.intersect(lbnd, bisector); + if (p) { + EventQueue.del(lbnd); + EventQueue.insert(lbnd, p, Geom.distance(p, newSite)); + } + lbnd = bisector; + bisector = EdgeList.createHalfEdge(e, "r"); + EdgeList.insert(lbnd, bisector); + p = Geom.intersect(bisector, rbnd); + if (p) { + EventQueue.insert(bisector, p, Geom.distance(p, newSite)); + } + newSite = Sites.list.shift(); + } else if (!EventQueue.empty()) { + lbnd = EventQueue.extractMin(); + llbnd = EdgeList.left(lbnd); + rbnd = EdgeList.right(lbnd); + rrbnd = EdgeList.right(rbnd); + bot = EdgeList.leftRegion(lbnd); + top = EdgeList.rightRegion(rbnd); + v = lbnd.vertex; + Geom.endPoint(lbnd.edge, lbnd.side, v); + Geom.endPoint(rbnd.edge, rbnd.side, v); + EdgeList.del(lbnd); + EventQueue.del(rbnd); + EdgeList.del(rbnd); + pm = "l"; + if (bot.y > top.y) { + temp = bot; + bot = top; + top = temp; + pm = "r"; + } + e = Geom.bisect(bot, top); + bisector = EdgeList.createHalfEdge(e, pm); + EdgeList.insert(llbnd, bisector); + Geom.endPoint(e, d3_voronoi_opposite[pm], v); + p = Geom.intersect(llbnd, bisector); + if (p) { + EventQueue.del(llbnd); + EventQueue.insert(llbnd, p, Geom.distance(p, bot)); + } + p = Geom.intersect(bisector, rrbnd); + if (p) { + EventQueue.insert(bisector, p, Geom.distance(p, bot)); + } + } else { + break; + } + } + for (lbnd = EdgeList.right(EdgeList.leftEnd); lbnd != EdgeList.rightEnd; lbnd = EdgeList.right(lbnd)) { + callback(lbnd.edge); + } + } + function d3_geom_quadtreeNode() { + return { + leaf: true, + nodes: [], + point: null + }; + } + function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { + if (!f(node, x1, y1, x2, y2)) { + var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes; + if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); + if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); + if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); + if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); + } + } + function d3_geom_quadtreePoint(p) { + return { + x: p[0], + y: p[1] + }; + } + function d3_time_utc() { + this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]); + } + function d3_time_formatAbbreviate(name) { + return name.substring(0, 3); + } + function d3_time_parse(date, template, string, j) { + var c, p, i = 0, n = template.length, m = string.length; + while (i < n) { + if (j >= m) return -1; + c = template.charCodeAt(i++); + if (c == 37) { + p = d3_time_parsers[template.charAt(i++)]; + if (!p || (j = p(date, string, j)) < 0) return -1; + } else if (c != string.charCodeAt(j++)) { + return -1; + } + } + return j; + } + function d3_time_formatRe(names) { + return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i"); + } + function d3_time_formatLookup(names) { + var map = new d3_Map, i = -1, n = names.length; + while (++i < n) map.set(names[i].toLowerCase(), i); + return map; + } + function d3_time_parseWeekdayAbbrev(date, string, i) { + d3_time_dayAbbrevRe.lastIndex = 0; + var n = d3_time_dayAbbrevRe.exec(string.substring(i)); + return n ? i += n[0].length : -1; + } + function d3_time_parseWeekday(date, string, i) { + d3_time_dayRe.lastIndex = 0; + var n = d3_time_dayRe.exec(string.substring(i)); + return n ? i += n[0].length : -1; + } + function d3_time_parseMonthAbbrev(date, string, i) { + d3_time_monthAbbrevRe.lastIndex = 0; + var n = d3_time_monthAbbrevRe.exec(string.substring(i)); + return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i += n[0].length) : -1; + } + function d3_time_parseMonth(date, string, i) { + d3_time_monthRe.lastIndex = 0; + var n = d3_time_monthRe.exec(string.substring(i)); + return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1; + } + function d3_time_parseLocaleFull(date, string, i) { + return d3_time_parse(date, d3_time_formats.c.toString(), string, i); + } + function d3_time_parseLocaleDate(date, string, i) { + return d3_time_parse(date, d3_time_formats.x.toString(), string, i); + } + function d3_time_parseLocaleTime(date, string, i) { + return d3_time_parse(date, d3_time_formats.X.toString(), string, i); + } + function d3_time_parseFullYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 4)); + return n ? (date.y = +n[0], i += n[0].length) : -1; + } + function d3_time_parseYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.y = d3_time_expandYear(+n[0]), i += n[0].length) : -1; + } + function d3_time_expandYear(d) { + return d + (d > 68 ? 1900 : 2e3); + } + function d3_time_parseMonthNumber(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.m = n[0] - 1, i += n[0].length) : -1; + } + function d3_time_parseDay(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.d = +n[0], i += n[0].length) : -1; + } + function d3_time_parseHour24(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.H = +n[0], i += n[0].length) : -1; + } + function d3_time_parseMinutes(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.M = +n[0], i += n[0].length) : -1; + } + function d3_time_parseSeconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.S = +n[0], i += n[0].length) : -1; + } + function d3_time_parseMilliseconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 3)); + return n ? (date.L = +n[0], i += n[0].length) : -1; + } + function d3_time_parseAmPm(date, string, i) { + var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase()); + return n == null ? -1 : (date.p = n, i); + } + function d3_time_zone(d) { + var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(Math.abs(z) / 60), zm = Math.abs(z) % 60; + return zs + d3_time_zfill2(zh) + d3_time_zfill2(zm); + } + function d3_time_formatIsoNative(date) { + return date.toISOString(); + } + function d3_time_interval(local, step, number) { + function round(date) { + var d0 = local(date), d1 = offset(d0, 1); + return date - d0 < d1 - date ? d0 : d1; + } + function ceil(date) { + step(date = local(new d3_time(date - 1)), 1); + return date; + } + function offset(date, k) { + step(date = new d3_time(+date), k); + return date; + } + function range(t0, t1, dt) { + var time = ceil(t0), times = []; + if (dt > 1) { + while (time < t1) { + if (!(number(time) % dt)) times.push(new Date(+time)); + step(time, 1); + } + } else { + while (time < t1) times.push(new Date(+time)), step(time, 1); + } + return times; + } + function range_utc(t0, t1, dt) { + try { + d3_time = d3_time_utc; + var utc = new d3_time_utc; + utc._ = t0; + return range(utc, t1, dt); + } finally { + d3_time = Date; + } + } + local.floor = local; + local.round = round; + local.ceil = ceil; + local.offset = offset; + local.range = range; + var utc = local.utc = d3_time_interval_utc(local); + utc.floor = utc; + utc.round = d3_time_interval_utc(round); + utc.ceil = d3_time_interval_utc(ceil); + utc.offset = d3_time_interval_utc(offset); + utc.range = range_utc; + return local; + } + function d3_time_interval_utc(method) { + return function(date, k) { + try { + d3_time = d3_time_utc; + var utc = new d3_time_utc; + utc._ = date; + return method(utc, k)._; + } finally { + d3_time = Date; + } + }; + } + function d3_time_scale(linear, methods, format) { + function scale(x) { + return linear(x); + } + scale.invert = function(x) { + return d3_time_scaleDate(linear.invert(x)); + }; + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(d3_time_scaleDate); + linear.domain(x); + return scale; + }; + scale.nice = function(m) { + return scale.domain(d3_scale_nice(scale.domain(), function() { + return m; + })); + }; + scale.ticks = function(m, k) { + var extent = d3_time_scaleExtent(scale.domain()); + if (typeof m !== "function") { + var span = extent[1] - extent[0], target = span / m, i = d3.bisect(d3_time_scaleSteps, target); + if (i == d3_time_scaleSteps.length) return methods.year(extent, m); + if (!i) return linear.ticks(m).map(d3_time_scaleDate); + if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i; + m = methods[i]; + k = m[1]; + m = m[0].range; + } + return m(extent[0], new Date(+extent[1] + 1), k); + }; + scale.tickFormat = function() { + return format; + }; + scale.copy = function() { + return d3_time_scale(linear.copy(), methods, format); + }; + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); + } + function d3_time_scaleExtent(domain) { + var start = domain[0], stop = domain[domain.length - 1]; + return start < stop ? [ start, stop ] : [ stop, start ]; + } + function d3_time_scaleDate(t) { + return new Date(t); + } + function d3_time_scaleFormat(formats) { + return function(date) { + var i = formats.length - 1, f = formats[i]; + while (!f[1](date)) f = formats[--i]; + return f[0](date); + }; + } + function d3_time_scaleSetYear(y) { + var d = new Date(y, 0, 1); + d.setFullYear(y); + return d; + } + function d3_time_scaleGetYear(d) { + var y = d.getFullYear(), d0 = d3_time_scaleSetYear(y), d1 = d3_time_scaleSetYear(y + 1); + return y + (d - d0) / (d1 - d0); + } + function d3_time_scaleUTCSetYear(y) { + var d = new Date(Date.UTC(y, 0, 1)); + d.setUTCFullYear(y); + return d; + } + function d3_time_scaleUTCGetYear(d) { + var y = d.getUTCFullYear(), d0 = d3_time_scaleUTCSetYear(y), d1 = d3_time_scaleUTCSetYear(y + 1); + return y + (d - d0) / (d1 - d0); + } + if (!Date.now) Date.now = function() { + return +(new Date); + }; + try { + document.createElement("div").style.setProperty("opacity", 0, ""); + } catch (error) { + var d3_style_prototype = CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty; + d3_style_prototype.setProperty = function(name, value, priority) { + d3_style_setProperty.call(this, name, value + "", priority); + }; + } + d3 = { + version: "2.10.2" + }; + var d3_array = d3_arraySlice; + try { + d3_array(document.documentElement.childNodes)[0].nodeType; + } catch (e) { + d3_array = d3_arrayCopy; + } + var d3_arraySubclass = [].__proto__ ? function(array, prototype) { + array.__proto__ = prototype; + } : function(array, prototype) { + for (var property in prototype) array[property] = prototype[property]; + }; + d3.map = function(object) { + var map = new d3_Map; + for (var key in object) map.set(key, object[key]); + return map; + }; + d3_class(d3_Map, { + has: function(key) { + return d3_map_prefix + key in this; + }, + get: function(key) { + return this[d3_map_prefix + key]; + }, + set: function(key, value) { + return this[d3_map_prefix + key] = value; + }, + remove: function(key) { + key = d3_map_prefix + key; + return key in this && delete this[key]; + }, + keys: function() { + var keys = []; + this.forEach(function(key) { + keys.push(key); + }); + return keys; + }, + values: function() { + var values = []; + this.forEach(function(key, value) { + values.push(value); + }); + return values; + }, + entries: function() { + var entries = []; + this.forEach(function(key, value) { + entries.push({ + key: key, + value: value + }); + }); + return entries; + }, + forEach: function(f) { + for (var key in this) { + if (key.charCodeAt(0) === d3_map_prefixCode) { + f.call(this, key.substring(1), this[key]); + } + } + } + }); + var d3_map_prefix = "\0", d3_map_prefixCode = d3_map_prefix.charCodeAt(0); + d3.functor = d3_functor; + d3.rebind = function(target, source) { + var i = 1, n = arguments.length, method; + while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]); + return target; + }; + d3.ascending = function(a, b) { + return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; + }; + d3.descending = function(a, b) { + return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; + }; + d3.mean = function(array, f) { + var n = array.length, a, m = 0, i = -1, j = 0; + if (arguments.length === 1) { + while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j; + } else { + while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j; + } + return j ? m : undefined; + }; + d3.median = function(array, f) { + if (arguments.length > 1) array = array.map(f); + array = array.filter(d3_number); + return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined; + }; + d3.min = function(array, f) { + var i = -1, n = array.length, a, b; + if (arguments.length === 1) { + while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; + while (++i < n) if ((b = array[i]) != null && a > b) a = b; + } else { + while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b; + } + return a; + }; + d3.max = function(array, f) { + var i = -1, n = array.length, a, b; + if (arguments.length === 1) { + while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; + while (++i < n) if ((b = array[i]) != null && b > a) a = b; + } else { + while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; + } + return a; + }; + d3.extent = function(array, f) { + var i = -1, n = array.length, a, b, c; + if (arguments.length === 1) { + while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined; + while (++i < n) if ((b = array[i]) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } else { + while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } + return [ a, c ]; + }; + d3.random = { + normal: function(µ, σ) { + var n = arguments.length; + if (n < 2) σ = 1; + if (n < 1) µ = 0; + return function() { + var x, y, r; + do { + x = Math.random() * 2 - 1; + y = Math.random() * 2 - 1; + r = x * x + y * y; + } while (!r || r > 1); + return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r); + }; + }, + logNormal: function(µ, σ) { + var n = arguments.length; + if (n < 2) σ = 1; + if (n < 1) µ = 0; + var random = d3.random.normal(); + return function() { + return Math.exp(µ + σ * random()); + }; + }, + irwinHall: function(m) { + return function() { + for (var s = 0, j = 0; j < m; j++) s += Math.random(); + return s / m; + }; + } + }; + d3.sum = function(array, f) { + var s = 0, n = array.length, a, i = -1; + if (arguments.length === 1) { + while (++i < n) if (!isNaN(a = +array[i])) s += a; + } else { + while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a; + } + return s; + }; + d3.quantile = function(values, p) { + var H = (values.length - 1) * p + 1, h = Math.floor(H), v = values[h - 1], e = H - h; + return e ? v + e * (values[h] - v) : v; + }; + d3.transpose = function(matrix) { + return d3.zip.apply(d3, matrix); + }; + d3.zip = function() { + if (!(n = arguments.length)) return []; + for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) { + for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) { + zip[j] = arguments[j][i]; + } + } + return zips; + }; + d3.bisector = function(f) { + return { + left: function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (f.call(a, a[mid], mid) < x) lo = mid + 1; else hi = mid; + } + return lo; + }, + right: function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (x < f.call(a, a[mid], mid)) hi = mid; else lo = mid + 1; + } + return lo; + } + }; + }; + var d3_bisector = d3.bisector(function(d) { + return d; + }); + d3.bisectLeft = d3_bisector.left; + d3.bisect = d3.bisectRight = d3_bisector.right; + d3.first = function(array, f) { + var i = 0, n = array.length, a = array[0], b; + if (arguments.length === 1) f = d3.ascending; + while (++i < n) { + if (f.call(array, a, b = array[i]) > 0) { + a = b; + } + } + return a; + }; + d3.last = function(array, f) { + var i = 0, n = array.length, a = array[0], b; + if (arguments.length === 1) f = d3.ascending; + while (++i < n) { + if (f.call(array, a, b = array[i]) <= 0) { + a = b; + } + } + return a; + }; + d3.nest = function() { + function map(array, depth) { + if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array; + var i = -1, n = array.length, key = keys[depth++], keyValue, object, valuesByKey = new d3_Map, values, o = {}; + while (++i < n) { + if (values = valuesByKey.get(keyValue = key(object = array[i]))) { + values.push(object); + } else { + valuesByKey.set(keyValue, [ object ]); + } + } + valuesByKey.forEach(function(keyValue, values) { + o[keyValue] = map(values, depth); + }); + return o; + } + function entries(map, depth) { + if (depth >= keys.length) return map; + var a = [], sortKey = sortKeys[depth++], key; + for (key in map) { + a.push({ + key: key, + values: entries(map[key], depth) + }); + } + if (sortKey) a.sort(function(a, b) { + return sortKey(a.key, b.key); + }); + return a; + } + var nest = {}, keys = [], sortKeys = [], sortValues, rollup; + nest.map = function(array) { + return map(array, 0); + }; + nest.entries = function(array) { + return entries(map(array, 0), 0); + }; + nest.key = function(d) { + keys.push(d); + return nest; + }; + nest.sortKeys = function(order) { + sortKeys[keys.length - 1] = order; + return nest; + }; + nest.sortValues = function(order) { + sortValues = order; + return nest; + }; + nest.rollup = function(f) { + rollup = f; + return nest; + }; + return nest; + }; + d3.keys = function(map) { + var keys = []; + for (var key in map) keys.push(key); + return keys; + }; + d3.values = function(map) { + var values = []; + for (var key in map) values.push(map[key]); + return values; + }; + d3.entries = function(map) { + var entries = []; + for (var key in map) entries.push({ + key: key, + value: map[key] + }); + return entries; + }; + d3.permute = function(array, indexes) { + var permutes = [], i = -1, n = indexes.length; + while (++i < n) permutes[i] = array[indexes[i]]; + return permutes; + }; + d3.merge = function(arrays) { + return Array.prototype.concat.apply([], arrays); + }; + d3.split = function(array, f) { + var arrays = [], values = [], value, i = -1, n = array.length; + if (arguments.length < 2) f = d3_splitter; + while (++i < n) { + if (f.call(values, value = array[i], i)) { + values = []; + } else { + if (!values.length) arrays.push(values); + values.push(value); + } + } + return arrays; + }; + d3.range = function(start, stop, step) { + if (arguments.length < 3) { + step = 1; + if (arguments.length < 2) { + stop = start; + start = 0; + } + } + if ((stop - start) / step === Infinity) throw new Error("infinite range"); + var range = [], k = d3_range_integerScale(Math.abs(step)), i = -1, j; + start *= k, stop *= k, step *= k; + if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k); + return range; + }; + d3.requote = function(s) { + return s.replace(d3_requote_re, "\\$&"); + }; + var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; + d3.round = function(x, n) { + return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x); + }; + d3.xhr = function(url, mime, callback) { + var req = new XMLHttpRequest; + if (arguments.length < 3) callback = mime, mime = null; else if (mime && req.overrideMimeType) req.overrideMimeType(mime); + req.open("GET", url, true); + if (mime) req.setRequestHeader("Accept", mime); + req.onreadystatechange = function() { + if (req.readyState === 4) { + var s = req.status; + callback(!s && req.response || s >= 200 && s < 300 || s === 304 ? req : null); + } + }; + req.send(null); + }; + d3.text = function(url, mime, callback) { + function ready(req) { + callback(req && req.responseText); + } + if (arguments.length < 3) { + callback = mime; + mime = null; + } + d3.xhr(url, mime, ready); + }; + d3.json = function(url, callback) { + d3.text(url, "application/json", function(text) { + callback(text ? JSON.parse(text) : null); + }); + }; + d3.html = function(url, callback) { + d3.text(url, "text/html", function(text) { + if (text != null) { + var range = document.createRange(); + range.selectNode(document.body); + text = range.createContextualFragment(text); + } + callback(text); + }); + }; + d3.xml = function(url, mime, callback) { + function ready(req) { + callback(req && req.responseXML); + } + if (arguments.length < 3) { + callback = mime; + mime = null; + } + d3.xhr(url, mime, ready); + }; + var d3_nsPrefix = { + svg: "http://www.w3.org/2000/svg", + xhtml: "http://www.w3.org/1999/xhtml", + xlink: "http://www.w3.org/1999/xlink", + xml: "http://www.w3.org/XML/1998/namespace", + xmlns: "http://www.w3.org/2000/xmlns/" + }; + d3.ns = { + prefix: d3_nsPrefix, + qualify: function(name) { + var i = name.indexOf(":"), prefix = name; + if (i >= 0) { + prefix = name.substring(0, i); + name = name.substring(i + 1); + } + return d3_nsPrefix.hasOwnProperty(prefix) ? { + space: d3_nsPrefix[prefix], + local: name + } : name; + } + }; + d3.dispatch = function() { + var dispatch = new d3_dispatch, i = -1, n = arguments.length; + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); + return dispatch; + }; + d3_dispatch.prototype.on = function(type, listener) { + var i = type.indexOf("."), name = ""; + if (i > 0) { + name = type.substring(i + 1); + type = type.substring(0, i); + } + return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener); + }; + d3.format = function(specifier) { + var match = d3_format_re.exec(specifier), fill = match[1] || " ", sign = match[3] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, suffix = "", integer = false; + if (precision) precision = +precision.substring(1); + if (zfill) { + fill = "0"; + if (comma) width -= Math.floor((width - 1) / 4); + } + switch (type) { + case "n": + comma = true; + type = "g"; + break; + case "%": + scale = 100; + suffix = "%"; + type = "f"; + break; + case "p": + scale = 100; + suffix = "%"; + type = "r"; + break; + case "d": + integer = true; + precision = 0; + break; + case "s": + scale = -1; + type = "r"; + break; + } + if (type == "r" && !precision) type = "g"; + type = d3_format_types.get(type) || d3_format_typeDefault; + return function(value) { + if (integer && value % 1) return ""; + var negative = value < 0 && (value = -value) ? "-" : sign; + if (scale < 0) { + var prefix = d3.formatPrefix(value, precision); + value = prefix.scale(value); + suffix = prefix.symbol; + } else { + value *= scale; + } + value = type(value, precision); + if (zfill) { + var length = value.length + negative.length; + if (length < width) value = (new Array(width - length + 1)).join(fill) + value; + if (comma) value = d3_format_group(value); + value = negative + value; + } else { + if (comma) value = d3_format_group(value); + value = negative + value; + var length = value.length; + if (length < width) value = (new Array(width - length + 1)).join(fill) + value; + } + return value + suffix; + }; + }; + var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/; + var d3_format_types = d3.map({ + g: function(x, p) { + return x.toPrecision(p); + }, + e: function(x, p) { + return x.toExponential(p); + }, + f: function(x, p) { + return x.toFixed(p); + }, + r: function(x, p) { + return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p))); + } + }); + var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "μ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix); + d3.formatPrefix = function(value, precision) { + var i = 0; + if (value) { + if (value < 0) value *= -1; + if (precision) value = d3.round(value, d3_format_precision(value, precision)); + i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10); + i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3)); + } + return d3_formatPrefixes[8 + i / 3]; + }; + var d3_ease_quad = d3_ease_poly(2), d3_ease_cubic = d3_ease_poly(3), d3_ease_default = function() { + return d3_ease_identity; + }; + var d3_ease = d3.map({ + linear: d3_ease_default, + poly: d3_ease_poly, + quad: function() { + return d3_ease_quad; + }, + cubic: function() { + return d3_ease_cubic; + }, + sin: function() { + return d3_ease_sin; + }, + exp: function() { + return d3_ease_exp; + }, + circle: function() { + return d3_ease_circle; + }, + elastic: d3_ease_elastic, + back: d3_ease_back, + bounce: function() { + return d3_ease_bounce; + } + }); + var d3_ease_mode = d3.map({ + "in": d3_ease_identity, + out: d3_ease_reverse, + "in-out": d3_ease_reflect, + "out-in": function(f) { + return d3_ease_reflect(d3_ease_reverse(f)); + } + }); + d3.ease = function(name) { + var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in"; + t = d3_ease.get(t) || d3_ease_default; + m = d3_ease_mode.get(m) || d3_ease_identity; + return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1)))); + }; + d3.event = null; + d3.transform = function(string) { + var g = document.createElementNS(d3.ns.prefix.svg, "g"); + return (d3.transform = function(string) { + g.setAttribute("transform", string); + var t = g.transform.baseVal.consolidate(); + return new d3_transform(t ? t.matrix : d3_transformIdentity); + })(string); + }; + d3_transform.prototype.toString = function() { + return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")"; + }; + var d3_transformDegrees = 180 / Math.PI, d3_transformIdentity = { + a: 1, + b: 0, + c: 0, + d: 1, + e: 0, + f: 0 + }; + d3.interpolate = function(a, b) { + var i = d3.interpolators.length, f; + while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ; + return f; + }; + d3.interpolateNumber = function(a, b) { + b -= a; + return function(t) { + return a + b * t; + }; + }; + d3.interpolateRound = function(a, b) { + b -= a; + return function(t) { + return Math.round(a + b * t); + }; + }; + d3.interpolateString = function(a, b) { + var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o; + d3_interpolate_number.lastIndex = 0; + for (i = 0; m = d3_interpolate_number.exec(b); ++i) { + if (m.index) s.push(b.substring(s0, s1 = m.index)); + q.push({ + i: s.length, + x: m[0] + }); + s.push(null); + s0 = d3_interpolate_number.lastIndex; + } + if (s0 < b.length) s.push(b.substring(s0)); + for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) { + o = q[i]; + if (o.x == m[0]) { + if (o.i) { + if (s[o.i + 1] == null) { + s[o.i - 1] += o.x; + s.splice(o.i, 1); + for (j = i + 1; j < n; ++j) q[j].i--; + } else { + s[o.i - 1] += o.x + s[o.i + 1]; + s.splice(o.i, 2); + for (j = i + 1; j < n; ++j) q[j].i -= 2; + } + } else { + if (s[o.i + 1] == null) { + s[o.i] = o.x; + } else { + s[o.i] = o.x + s[o.i + 1]; + s.splice(o.i + 1, 1); + for (j = i + 1; j < n; ++j) q[j].i--; + } + } + q.splice(i, 1); + n--; + i--; + } else { + o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x)); + } + } + while (i < n) { + o = q.pop(); + if (s[o.i + 1] == null) { + s[o.i] = o.x; + } else { + s[o.i] = o.x + s[o.i + 1]; + s.splice(o.i + 1, 1); + } + n--; + } + if (s.length === 1) { + return s[0] == null ? q[0].x : function() { + return b; + }; + } + return function(t) { + for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; + }; + d3.interpolateTransform = function(a, b) { + var s = [], q = [], n, A = d3.transform(a), B = d3.transform(b), ta = A.translate, tb = B.translate, ra = A.rotate, rb = B.rotate, wa = A.skew, wb = B.skew, ka = A.scale, kb = B.scale; + if (ta[0] != tb[0] || ta[1] != tb[1]) { + s.push("translate(", null, ",", null, ")"); + q.push({ + i: 1, + x: d3.interpolateNumber(ta[0], tb[0]) + }, { + i: 3, + x: d3.interpolateNumber(ta[1], tb[1]) + }); + } else if (tb[0] || tb[1]) { + s.push("translate(" + tb + ")"); + } else { + s.push(""); + } + if (ra != rb) { + if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360; + q.push({ + i: s.push(s.pop() + "rotate(", null, ")") - 2, + x: d3.interpolateNumber(ra, rb) + }); + } else if (rb) { + s.push(s.pop() + "rotate(" + rb + ")"); + } + if (wa != wb) { + q.push({ + i: s.push(s.pop() + "skewX(", null, ")") - 2, + x: d3.interpolateNumber(wa, wb) + }); + } else if (wb) { + s.push(s.pop() + "skewX(" + wb + ")"); + } + if (ka[0] != kb[0] || ka[1] != kb[1]) { + n = s.push(s.pop() + "scale(", null, ",", null, ")"); + q.push({ + i: n - 4, + x: d3.interpolateNumber(ka[0], kb[0]) + }, { + i: n - 2, + x: d3.interpolateNumber(ka[1], kb[1]) + }); + } else if (kb[0] != 1 || kb[1] != 1) { + s.push(s.pop() + "scale(" + kb + ")"); + } + n = q.length; + return function(t) { + var i = -1, o; + while (++i < n) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; + }; + d3.interpolateRgb = function(a, b) { + a = d3.rgb(a); + b = d3.rgb(b); + var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab; + return function(t) { + return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t)); + }; + }; + d3.interpolateHsl = function(a, b) { + a = d3.hsl(a); + b = d3.hsl(b); + var h0 = a.h, s0 = a.s, l0 = a.l, h1 = b.h - h0, s1 = b.s - s0, l1 = b.l - l0; + if (h1 > 180) h1 -= 360; else if (h1 < -180) h1 += 360; + return function(t) { + return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t) + ""; + }; + }; + d3.interpolateLab = function(a, b) { + a = d3.lab(a); + b = d3.lab(b); + var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab; + return function(t) { + return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + ""; + }; + }; + d3.interpolateHcl = function(a, b) { + a = d3.hcl(a); + b = d3.hcl(b); + var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al; + if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; + return function(t) { + return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + ""; + }; + }; + d3.interpolateArray = function(a, b) { + var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i; + for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i])); + for (; i < na; ++i) c[i] = a[i]; + for (; i < nb; ++i) c[i] = b[i]; + return function(t) { + for (i = 0; i < n0; ++i) c[i] = x[i](t); + return c; + }; + }; + d3.interpolateObject = function(a, b) { + var i = {}, c = {}, k; + for (k in a) { + if (k in b) { + i[k] = d3_interpolateByName(k)(a[k], b[k]); + } else { + c[k] = a[k]; + } + } + for (k in b) { + if (!(k in a)) { + c[k] = b[k]; + } + } + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; + }; + var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g; + d3.interpolators = [ d3.interpolateObject, function(a, b) { + return b instanceof Array && d3.interpolateArray(a, b); + }, function(a, b) { + return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + ""); + }, function(a, b) { + return (typeof b === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b); + }, function(a, b) { + return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b); + } ]; + d3.rgb = function(r, g, b) { + return arguments.length === 1 ? r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : d3_rgb(~~r, ~~g, ~~b); + }; + d3_Rgb.prototype.brighter = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + var r = this.r, g = this.g, b = this.b, i = 30; + if (!r && !g && !b) return d3_rgb(i, i, i); + if (r && r < i) r = i; + if (g && g < i) g = i; + if (b && b < i) b = i; + return d3_rgb(Math.min(255, Math.floor(r / k)), Math.min(255, Math.floor(g / k)), Math.min(255, Math.floor(b / k))); + }; + d3_Rgb.prototype.darker = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + return d3_rgb(Math.floor(k * this.r), Math.floor(k * this.g), Math.floor(k * this.b)); + }; + d3_Rgb.prototype.hsl = function() { + return d3_rgb_hsl(this.r, this.g, this.b); + }; + d3_Rgb.prototype.toString = function() { + return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b); + }; + var d3_rgb_names = d3.map({ + aliceblue: "#f0f8ff", + antiquewhite: "#faebd7", + aqua: "#00ffff", + aquamarine: "#7fffd4", + azure: "#f0ffff", + beige: "#f5f5dc", + bisque: "#ffe4c4", + black: "#000000", + blanchedalmond: "#ffebcd", + blue: "#0000ff", + blueviolet: "#8a2be2", + brown: "#a52a2a", + burlywood: "#deb887", + cadetblue: "#5f9ea0", + chartreuse: "#7fff00", + chocolate: "#d2691e", + coral: "#ff7f50", + cornflowerblue: "#6495ed", + cornsilk: "#fff8dc", + crimson: "#dc143c", + cyan: "#00ffff", + darkblue: "#00008b", + darkcyan: "#008b8b", + darkgoldenrod: "#b8860b", + darkgray: "#a9a9a9", + darkgreen: "#006400", + darkgrey: "#a9a9a9", + darkkhaki: "#bdb76b", + darkmagenta: "#8b008b", + darkolivegreen: "#556b2f", + darkorange: "#ff8c00", + darkorchid: "#9932cc", + darkred: "#8b0000", + darksalmon: "#e9967a", + darkseagreen: "#8fbc8f", + darkslateblue: "#483d8b", + darkslategray: "#2f4f4f", + darkslategrey: "#2f4f4f", + darkturquoise: "#00ced1", + darkviolet: "#9400d3", + deeppink: "#ff1493", + deepskyblue: "#00bfff", + dimgray: "#696969", + dimgrey: "#696969", + dodgerblue: "#1e90ff", + firebrick: "#b22222", + floralwhite: "#fffaf0", + forestgreen: "#228b22", + fuchsia: "#ff00ff", + gainsboro: "#dcdcdc", + ghostwhite: "#f8f8ff", + gold: "#ffd700", + goldenrod: "#daa520", + gray: "#808080", + green: "#008000", + greenyellow: "#adff2f", + grey: "#808080", + honeydew: "#f0fff0", + hotpink: "#ff69b4", + indianred: "#cd5c5c", + indigo: "#4b0082", + ivory: "#fffff0", + khaki: "#f0e68c", + lavender: "#e6e6fa", + lavenderblush: "#fff0f5", + lawngreen: "#7cfc00", + lemonchiffon: "#fffacd", + lightblue: "#add8e6", + lightcoral: "#f08080", + lightcyan: "#e0ffff", + lightgoldenrodyellow: "#fafad2", + lightgray: "#d3d3d3", + lightgreen: "#90ee90", + lightgrey: "#d3d3d3", + lightpink: "#ffb6c1", + lightsalmon: "#ffa07a", + lightseagreen: "#20b2aa", + lightskyblue: "#87cefa", + lightslategray: "#778899", + lightslategrey: "#778899", + lightsteelblue: "#b0c4de", + lightyellow: "#ffffe0", + lime: "#00ff00", + limegreen: "#32cd32", + linen: "#faf0e6", + magenta: "#ff00ff", + maroon: "#800000", + mediumaquamarine: "#66cdaa", + mediumblue: "#0000cd", + mediumorchid: "#ba55d3", + mediumpurple: "#9370db", + mediumseagreen: "#3cb371", + mediumslateblue: "#7b68ee", + mediumspringgreen: "#00fa9a", + mediumturquoise: "#48d1cc", + mediumvioletred: "#c71585", + midnightblue: "#191970", + mintcream: "#f5fffa", + mistyrose: "#ffe4e1", + moccasin: "#ffe4b5", + navajowhite: "#ffdead", + navy: "#000080", + oldlace: "#fdf5e6", + olive: "#808000", + olivedrab: "#6b8e23", + orange: "#ffa500", + orangered: "#ff4500", + orchid: "#da70d6", + palegoldenrod: "#eee8aa", + palegreen: "#98fb98", + paleturquoise: "#afeeee", + palevioletred: "#db7093", + papayawhip: "#ffefd5", + peachpuff: "#ffdab9", + peru: "#cd853f", + pink: "#ffc0cb", + plum: "#dda0dd", + powderblue: "#b0e0e6", + purple: "#800080", + red: "#ff0000", + rosybrown: "#bc8f8f", + royalblue: "#4169e1", + saddlebrown: "#8b4513", + salmon: "#fa8072", + sandybrown: "#f4a460", + seagreen: "#2e8b57", + seashell: "#fff5ee", + sienna: "#a0522d", + silver: "#c0c0c0", + skyblue: "#87ceeb", + slateblue: "#6a5acd", + slategray: "#708090", + slategrey: "#708090", + snow: "#fffafa", + springgreen: "#00ff7f", + steelblue: "#4682b4", + tan: "#d2b48c", + teal: "#008080", + thistle: "#d8bfd8", + tomato: "#ff6347", + turquoise: "#40e0d0", + violet: "#ee82ee", + wheat: "#f5deb3", + white: "#ffffff", + whitesmoke: "#f5f5f5", + yellow: "#ffff00", + yellowgreen: "#9acd32" + }); + d3_rgb_names.forEach(function(key, value) { + d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb)); + }); + d3.hsl = function(h, s, l) { + return arguments.length === 1 ? h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : d3_hsl(+h, +s, +l); + }; + d3_Hsl.prototype.brighter = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + return d3_hsl(this.h, this.s, this.l / k); + }; + d3_Hsl.prototype.darker = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + return d3_hsl(this.h, this.s, k * this.l); + }; + d3_Hsl.prototype.rgb = function() { + return d3_hsl_rgb(this.h, this.s, this.l); + }; + d3_Hsl.prototype.toString = function() { + return this.rgb().toString(); + }; + d3.hcl = function(h, c, l) { + return arguments.length === 1 ? h instanceof d3_Hcl ? d3_hcl(h.h, h.c, h.l) : h instanceof d3_Lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : d3_hcl(+h, +c, +l); + }; + d3_Hcl.prototype.brighter = function(k) { + return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1))); + }; + d3_Hcl.prototype.darker = function(k) { + return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1))); + }; + d3_Hcl.prototype.rgb = function() { + return d3_hcl_lab(this.h, this.c, this.l).rgb(); + }; + d3_Hcl.prototype.toString = function() { + return this.rgb() + ""; + }; + d3.lab = function(l, a, b) { + return arguments.length === 1 ? l instanceof d3_Lab ? d3_lab(l.l, l.a, l.b) : l instanceof d3_Hcl ? d3_hcl_lab(l.l, l.c, l.h) : d3_rgb_lab((l = d3.rgb(l)).r, l.g, l.b) : d3_lab(+l, +a, +b); + }; + var d3_lab_K = 18; + var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883; + d3_Lab.prototype.brighter = function(k) { + return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); + }; + d3_Lab.prototype.darker = function(k) { + return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); + }; + d3_Lab.prototype.rgb = function() { + return d3_lab_rgb(this.l, this.a, this.b); + }; + d3_Lab.prototype.toString = function() { + return this.rgb() + ""; + }; + var d3_select = function(s, n) { + return n.querySelector(s); + }, d3_selectAll = function(s, n) { + return n.querySelectorAll(s); + }, d3_selectRoot = document.documentElement, d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, d3_selectMatches = function(n, s) { + return d3_selectMatcher.call(n, s); + }; + if (typeof Sizzle === "function") { + d3_select = function(s, n) { + return Sizzle(s, n)[0] || null; + }; + d3_selectAll = function(s, n) { + return Sizzle.uniqueSort(Sizzle(s, n)); + }; + d3_selectMatches = Sizzle.matchesSelector; + } + var d3_selectionPrototype = []; + d3.selection = function() { + return d3_selectionRoot; + }; + d3.selection.prototype = d3_selectionPrototype; + d3_selectionPrototype.select = function(selector) { + var subgroups = [], subgroup, subnode, group, node; + if (typeof selector !== "function") selector = d3_selection_selector(selector); + for (var j = -1, m = this.length; ++j < m; ) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + subgroup.push(subnode = selector.call(node, node.__data__, i)); + if (subnode && "__data__" in node) subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + return d3_selection(subgroups); + }; + d3_selectionPrototype.selectAll = function(selector) { + var subgroups = [], subgroup, node; + if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); + for (var j = -1, m = this.length; ++j < m; ) { + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i))); + subgroup.parentNode = node; + } + } + } + return d3_selection(subgroups); + }; + d3_selectionPrototype.attr = function(name, value) { + if (arguments.length < 2) { + if (typeof name === "string") { + var node = this.node(); + name = d3.ns.qualify(name); + return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name); + } + for (value in name) this.each(d3_selection_attr(value, name[value])); + return this; + } + return this.each(d3_selection_attr(name, value)); + }; + d3_selectionPrototype.classed = function(name, value) { + if (arguments.length < 2) { + if (typeof name === "string") { + var node = this.node(), n = (name = name.trim().split(/^|\s+/g)).length, i = -1; + if (value = node.classList) { + while (++i < n) if (!value.contains(name[i])) return false; + } else { + value = node.className; + if (value.baseVal != null) value = value.baseVal; + while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false; + } + return true; + } + for (value in name) this.each(d3_selection_classed(value, name[value])); + return this; + } + return this.each(d3_selection_classed(name, value)); + }; + d3_selectionPrototype.style = function(name, value, priority) { + var n = arguments.length; + if (n < 3) { + if (typeof name !== "string") { + if (n < 2) value = ""; + for (priority in name) this.each(d3_selection_style(priority, name[priority], value)); + return this; + } + if (n < 2) return window.getComputedStyle(this.node(), null).getPropertyValue(name); + priority = ""; + } + return this.each(d3_selection_style(name, value, priority)); + }; + d3_selectionPrototype.property = function(name, value) { + if (arguments.length < 2) { + if (typeof name === "string") return this.node()[name]; + for (value in name) this.each(d3_selection_property(value, name[value])); + return this; + } + return this.each(d3_selection_property(name, value)); + }; + d3_selectionPrototype.text = function(value) { + return arguments.length < 1 ? this.node().textContent : this.each(typeof value === "function" ? function() { + var v = value.apply(this, arguments); + this.textContent = v == null ? "" : v; + } : value == null ? function() { + this.textContent = ""; + } : function() { + this.textContent = value; + }); + }; + d3_selectionPrototype.html = function(value) { + return arguments.length < 1 ? this.node().innerHTML : this.each(typeof value === "function" ? function() { + var v = value.apply(this, arguments); + this.innerHTML = v == null ? "" : v; + } : value == null ? function() { + this.innerHTML = ""; + } : function() { + this.innerHTML = value; + }); + }; + d3_selectionPrototype.append = function(name) { + function append() { + return this.appendChild(document.createElementNS(this.namespaceURI, name)); + } + function appendNS() { + return this.appendChild(document.createElementNS(name.space, name.local)); + } + name = d3.ns.qualify(name); + return this.select(name.local ? appendNS : append); + }; + d3_selectionPrototype.insert = function(name, before) { + function insert() { + return this.insertBefore(document.createElementNS(this.namespaceURI, name), d3_select(before, this)); + } + function insertNS() { + return this.insertBefore(document.createElementNS(name.space, name.local), d3_select(before, this)); + } + name = d3.ns.qualify(name); + return this.select(name.local ? insertNS : insert); + }; + d3_selectionPrototype.remove = function() { + return this.each(function() { + var parent = this.parentNode; + if (parent) parent.removeChild(this); + }); + }; + d3_selectionPrototype.data = function(value, key) { + function bind(group, groupData) { + var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), n1 = Math.max(n, m), updateNodes = [], enterNodes = [], exitNodes = [], node, nodeData; + if (key) { + var nodeByKeyValue = new d3_Map, keyValues = [], keyValue, j = groupData.length; + for (i = -1; ++i < n; ) { + keyValue = key.call(node = group[i], node.__data__, i); + if (nodeByKeyValue.has(keyValue)) { + exitNodes[j++] = node; + } else { + nodeByKeyValue.set(keyValue, node); + } + keyValues.push(keyValue); + } + for (i = -1; ++i < m; ) { + keyValue = key.call(groupData, nodeData = groupData[i], i); + if (nodeByKeyValue.has(keyValue)) { + updateNodes[i] = node = nodeByKeyValue.get(keyValue); + node.__data__ = nodeData; + enterNodes[i] = exitNodes[i] = null; + } else { + enterNodes[i] = d3_selection_dataNode(nodeData); + updateNodes[i] = exitNodes[i] = null; + } + nodeByKeyValue.remove(keyValue); + } + for (i = -1; ++i < n; ) { + if (nodeByKeyValue.has(keyValues[i])) { + exitNodes[i] = group[i]; + } + } + } else { + for (i = -1; ++i < n0; ) { + node = group[i]; + nodeData = groupData[i]; + if (node) { + node.__data__ = nodeData; + updateNodes[i] = node; + enterNodes[i] = exitNodes[i] = null; + } else { + enterNodes[i] = d3_selection_dataNode(nodeData); + updateNodes[i] = exitNodes[i] = null; + } + } + for (; i < m; ++i) { + enterNodes[i] = d3_selection_dataNode(groupData[i]); + updateNodes[i] = exitNodes[i] = null; + } + for (; i < n1; ++i) { + exitNodes[i] = group[i]; + enterNodes[i] = updateNodes[i] = null; + } + } + enterNodes.update = updateNodes; + enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode; + enter.push(enterNodes); + update.push(updateNodes); + exit.push(exitNodes); + } + var i = -1, n = this.length, group, node; + if (!arguments.length) { + value = new Array(n = (group = this[0]).length); + while (++i < n) { + if (node = group[i]) { + value[i] = node.__data__; + } + } + return value; + } + var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]); + if (typeof value === "function") { + while (++i < n) { + bind(group = this[i], value.call(group, group.parentNode.__data__, i)); + } + } else { + while (++i < n) { + bind(group = this[i], value); + } + } + update.enter = function() { + return enter; + }; + update.exit = function() { + return exit; + }; + return update; + }; + d3_selectionPrototype.datum = d3_selectionPrototype.map = function(value) { + return arguments.length < 1 ? this.property("__data__") : this.property("__data__", value); + }; + d3_selectionPrototype.filter = function(filter) { + var subgroups = [], subgroup, group, node; + if (typeof filter !== "function") filter = d3_selection_filter(filter); + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = 0, n = group.length; i < n; i++) { + if ((node = group[i]) && filter.call(node, node.__data__, i)) { + subgroup.push(node); + } + } + } + return d3_selection(subgroups); + }; + d3_selectionPrototype.order = function() { + for (var j = -1, m = this.length; ++j < m; ) { + for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) { + if (node = group[i]) { + if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next); + next = node; + } + } + } + return this; + }; + d3_selectionPrototype.sort = function(comparator) { + comparator = d3_selection_sortComparator.apply(this, arguments); + for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator); + return this.order(); + }; + d3_selectionPrototype.on = function(type, listener, capture) { + var n = arguments.length; + if (n < 3) { + if (typeof type !== "string") { + if (n < 2) listener = false; + for (capture in type) this.each(d3_selection_on(capture, type[capture], listener)); + return this; + } + if (n < 2) return (n = this.node()["__on" + type]) && n._; + capture = false; + } + return this.each(d3_selection_on(type, listener, capture)); + }; + d3_selectionPrototype.each = function(callback) { + return d3_selection_each(this, function(node, i, j) { + callback.call(node, node.__data__, i, j); + }); + }; + d3_selectionPrototype.call = function(callback) { + callback.apply(this, (arguments[0] = this, arguments)); + return this; + }; + d3_selectionPrototype.empty = function() { + return !this.node(); + }; + d3_selectionPrototype.node = function(callback) { + for (var j = 0, m = this.length; j < m; j++) { + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + var node = group[i]; + if (node) return node; + } + } + return null; + }; + d3_selectionPrototype.transition = function() { + var subgroups = [], subgroup, node; + for (var j = -1, m = this.length; ++j < m; ) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + subgroup.push((node = group[i]) ? { + node: node, + delay: d3_transitionDelay, + duration: d3_transitionDuration + } : null); + } + } + return d3_transition(subgroups, d3_transitionId || ++d3_transitionNextId, Date.now()); + }; + var d3_selectionRoot = d3_selection([ [ document ] ]); + d3_selectionRoot[0].parentNode = d3_selectRoot; + d3.select = function(selector) { + return typeof selector === "string" ? d3_selectionRoot.select(selector) : d3_selection([ [ selector ] ]); + }; + d3.selectAll = function(selector) { + return typeof selector === "string" ? d3_selectionRoot.selectAll(selector) : d3_selection([ d3_array(selector) ]); + }; + var d3_selection_enterPrototype = []; + d3.selection.enter = d3_selection_enter; + d3.selection.enter.prototype = d3_selection_enterPrototype; + d3_selection_enterPrototype.append = d3_selectionPrototype.append; + d3_selection_enterPrototype.insert = d3_selectionPrototype.insert; + d3_selection_enterPrototype.empty = d3_selectionPrototype.empty; + d3_selection_enterPrototype.node = d3_selectionPrototype.node; + d3_selection_enterPrototype.select = function(selector) { + var subgroups = [], subgroup, subnode, upgroup, group, node; + for (var j = -1, m = this.length; ++j < m; ) { + upgroup = (group = this[j]).update; + subgroups.push(subgroup = []); + subgroup.parentNode = group.parentNode; + for (var i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i)); + subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + return d3_selection(subgroups); + }; + var d3_transitionPrototype = [], d3_transitionNextId = 0, d3_transitionId = 0, d3_transitionDefaultDelay = 0, d3_transitionDefaultDuration = 250, d3_transitionDefaultEase = d3.ease("cubic-in-out"), d3_transitionDelay = d3_transitionDefaultDelay, d3_transitionDuration = d3_transitionDefaultDuration, d3_transitionEase = d3_transitionDefaultEase; + d3_transitionPrototype.call = d3_selectionPrototype.call; + d3.transition = function(selection) { + return arguments.length ? d3_transitionId ? selection.transition() : selection : d3_selectionRoot.transition(); + }; + d3.transition.prototype = d3_transitionPrototype; + d3_transitionPrototype.select = function(selector) { + var subgroups = [], subgroup, subnode, node; + if (typeof selector !== "function") selector = d3_selection_selector(selector); + for (var j = -1, m = this.length; ++j < m; ) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) { + if ("__data__" in node.node) subnode.__data__ = node.node.__data__; + subgroup.push({ + node: subnode, + delay: node.delay, + duration: node.duration + }); + } else { + subgroup.push(null); + } + } + } + return d3_transition(subgroups, this.id, this.time).ease(this.ease()); + }; + d3_transitionPrototype.selectAll = function(selector) { + var subgroups = [], subgroup, subnodes, node; + if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); + for (var j = -1, m = this.length; ++j < m; ) { + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + subnodes = selector.call(node.node, node.node.__data__, i); + subgroups.push(subgroup = []); + for (var k = -1, o = subnodes.length; ++k < o; ) { + subgroup.push({ + node: subnodes[k], + delay: node.delay, + duration: node.duration + }); + } + } + } + } + return d3_transition(subgroups, this.id, this.time).ease(this.ease()); + }; + d3_transitionPrototype.filter = function(filter) { + var subgroups = [], subgroup, group, node; + if (typeof filter !== "function") filter = d3_selection_filter(filter); + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + if ((node = group[i]) && filter.call(node.node, node.node.__data__, i)) { + subgroup.push(node); + } + } + } + return d3_transition(subgroups, this.id, this.time).ease(this.ease()); + }; + d3_transitionPrototype.attr = function(name, value) { + if (arguments.length < 2) { + for (value in name) this.attrTween(value, d3_tweenByName(name[value], value)); + return this; + } + return this.attrTween(name, d3_tweenByName(value, name)); + }; + d3_transitionPrototype.attrTween = function(nameNS, tween) { + function attrTween(d, i) { + var f = tween.call(this, d, i, this.getAttribute(name)); + return f === d3_tweenRemove ? (this.removeAttribute(name), null) : f && function(t) { + this.setAttribute(name, f(t)); + }; + } + function attrTweenNS(d, i) { + var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local)); + return f === d3_tweenRemove ? (this.removeAttributeNS(name.space, name.local), null) : f && function(t) { + this.setAttributeNS(name.space, name.local, f(t)); + }; + } + var name = d3.ns.qualify(nameNS); + return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween); + }; + d3_transitionPrototype.style = function(name, value, priority) { + var n = arguments.length; + if (n < 3) { + if (typeof name !== "string") { + if (n < 2) value = ""; + for (priority in name) this.styleTween(priority, d3_tweenByName(name[priority], priority), value); + return this; + } + priority = ""; + } + return this.styleTween(name, d3_tweenByName(value, name), priority); + }; + d3_transitionPrototype.styleTween = function(name, tween, priority) { + if (arguments.length < 3) priority = ""; + return this.tween("style." + name, function(d, i) { + var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name)); + return f === d3_tweenRemove ? (this.style.removeProperty(name), null) : f && function(t) { + this.style.setProperty(name, f(t), priority); + }; + }); + }; + d3_transitionPrototype.text = function(value) { + return this.tween("text", function(d, i) { + this.textContent = typeof value === "function" ? value.call(this, d, i) : value; + }); + }; + d3_transitionPrototype.remove = function() { + return this.each("end.transition", function() { + var p; + if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this); + }); + }; + d3_transitionPrototype.delay = function(value) { + return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { + node.delay = value.call(node = node.node, node.__data__, i, j) | 0; + } : (value = value | 0, function(node) { + node.delay = value; + })); + }; + d3_transitionPrototype.duration = function(value) { + return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { + node.duration = Math.max(1, value.call(node = node.node, node.__data__, i, j) | 0); + } : (value = Math.max(1, value | 0), function(node) { + node.duration = value; + })); + }; + d3_transitionPrototype.transition = function() { + return this.select(d3_this); + }; + d3.tween = function(b, interpolate) { + function tweenFunction(d, i, a) { + var v = b.call(this, d, i); + return v == null ? a != "" && d3_tweenRemove : a != v && interpolate(a, v); + } + function tweenString(d, i, a) { + return a != b && interpolate(a, b); + } + return typeof b === "function" ? tweenFunction : b == null ? d3_tweenNull : (b += "", tweenString); + }; + var d3_tweenRemove = {}; + var d3_timer_queue = null, d3_timer_interval, d3_timer_timeout; + d3.timer = function(callback, delay, then) { + var found = false, t0, t1 = d3_timer_queue; + if (arguments.length < 3) { + if (arguments.length < 2) delay = 0; else if (!isFinite(delay)) return; + then = Date.now(); + } + while (t1) { + if (t1.callback === callback) { + t1.then = then; + t1.delay = delay; + found = true; + break; + } + t0 = t1; + t1 = t1.next; + } + if (!found) d3_timer_queue = { + callback: callback, + then: then, + delay: delay, + next: d3_timer_queue + }; + if (!d3_timer_interval) { + d3_timer_timeout = clearTimeout(d3_timer_timeout); + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } + }; + d3.timer.flush = function() { + var elapsed, now = Date.now(), t1 = d3_timer_queue; + while (t1) { + elapsed = now - t1.then; + if (!t1.delay) t1.flush = t1.callback(elapsed); + t1 = t1.next; + } + d3_timer_flush(); + }; + var d3_timer_frame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) { + setTimeout(callback, 17); + }; + d3.mouse = function(container) { + return d3_mousePoint(container, d3_eventSource()); + }; + var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0; + d3.touches = function(container, touches) { + if (arguments.length < 2) touches = d3_eventSource().touches; + return touches ? d3_array(touches).map(function(touch) { + var point = d3_mousePoint(container, touch); + point.identifier = touch.identifier; + return point; + }) : []; + }; + d3.scale = {}; + d3.scale.linear = function() { + return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3.interpolate, false); + }; + d3.scale.log = function() { + return d3_scale_log(d3.scale.linear(), d3_scale_logp); + }; + var d3_scale_logFormat = d3.format(".0e"); + d3_scale_logp.pow = function(x) { + return Math.pow(10, x); + }; + d3_scale_logn.pow = function(x) { + return -Math.pow(10, -x); + }; + d3.scale.pow = function() { + return d3_scale_pow(d3.scale.linear(), 1); + }; + d3.scale.sqrt = function() { + return d3.scale.pow().exponent(.5); + }; + d3.scale.ordinal = function() { + return d3_scale_ordinal([], { + t: "range", + a: [ [] ] + }); + }; + d3.scale.category10 = function() { + return d3.scale.ordinal().range(d3_category10); + }; + d3.scale.category20 = function() { + return d3.scale.ordinal().range(d3_category20); + }; + d3.scale.category20b = function() { + return d3.scale.ordinal().range(d3_category20b); + }; + d3.scale.category20c = function() { + return d3.scale.ordinal().range(d3_category20c); + }; + var d3_category10 = [ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" ]; + var d3_category20 = [ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ]; + var d3_category20b = [ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" ]; + var d3_category20c = [ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9" ]; + d3.scale.quantile = function() { + return d3_scale_quantile([], []); + }; + d3.scale.quantize = function() { + return d3_scale_quantize(0, 1, [ 0, 1 ]); + }; + d3.scale.threshold = function() { + return d3_scale_threshold([ .5 ], [ 0, 1 ]); + }; + d3.scale.identity = function() { + return d3_scale_identity([ 0, 1 ]); + }; + d3.svg = {}; + d3.svg.arc = function() { + function arc() { + var r0 = innerRadius.apply(this, arguments), r1 = outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0), df = da < Math.PI ? "0" : "1", c0 = Math.cos(a0), s0 = Math.sin(a0), c1 = Math.cos(a1), s1 = Math.sin(a1); + return da >= d3_svg_arcMax ? r0 ? "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "M0," + r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + -r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + "Z" : "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "Z" : r0 ? "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L" + r0 * c1 + "," + r0 * s1 + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + "Z" : "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L0,0" + "Z"; + } + var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; + arc.innerRadius = function(v) { + if (!arguments.length) return innerRadius; + innerRadius = d3_functor(v); + return arc; + }; + arc.outerRadius = function(v) { + if (!arguments.length) return outerRadius; + outerRadius = d3_functor(v); + return arc; + }; + arc.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3_functor(v); + return arc; + }; + arc.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3_functor(v); + return arc; + }; + arc.centroid = function() { + var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset; + return [ Math.cos(a) * r, Math.sin(a) * r ]; + }; + return arc; + }; + var d3_svg_arcOffset = -Math.PI / 2, d3_svg_arcMax = 2 * Math.PI - 1e-6; + d3.svg.line = function() { + return d3_svg_line(d3_identity); + }; + var d3_svg_lineInterpolators = d3.map({ + linear: d3_svg_lineLinear, + "linear-closed": d3_svg_lineLinearClosed, + "step-before": d3_svg_lineStepBefore, + "step-after": d3_svg_lineStepAfter, + basis: d3_svg_lineBasis, + "basis-open": d3_svg_lineBasisOpen, + "basis-closed": d3_svg_lineBasisClosed, + bundle: d3_svg_lineBundle, + cardinal: d3_svg_lineCardinal, + "cardinal-open": d3_svg_lineCardinalOpen, + "cardinal-closed": d3_svg_lineCardinalClosed, + monotone: d3_svg_lineMonotone + }); + d3_svg_lineInterpolators.forEach(function(key, value) { + value.key = key; + value.closed = /-closed$/.test(key); + }); + var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ]; + d3.svg.line.radial = function() { + var line = d3_svg_line(d3_svg_lineRadial); + line.radius = line.x, delete line.x; + line.angle = line.y, delete line.y; + return line; + }; + d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter; + d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore; + d3.svg.area = function() { + return d3_svg_area(d3_identity); + }; + d3.svg.area.radial = function() { + var area = d3_svg_area(d3_svg_lineRadial); + area.radius = area.x, delete area.x; + area.innerRadius = area.x0, delete area.x0; + area.outerRadius = area.x1, delete area.x1; + area.angle = area.y, delete area.y; + area.startAngle = area.y0, delete area.y0; + area.endAngle = area.y1, delete area.y1; + return area; + }; + d3.svg.chord = function() { + function chord(d, i) { + var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i); + return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z"; + } + function subgroup(self, f, d, i) { + var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset; + return { + r: r, + a0: a0, + a1: a1, + p0: [ r * Math.cos(a0), r * Math.sin(a0) ], + p1: [ r * Math.cos(a1), r * Math.sin(a1) ] + }; + } + function equals(a, b) { + return a.a0 == b.a0 && a.a1 == b.a1; + } + function arc(r, p, a) { + return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p; + } + function curve(r0, p0, r1, p1) { + return "Q 0,0 " + p1; + } + var source = d3_svg_chordSource, target = d3_svg_chordTarget, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; + chord.radius = function(v) { + if (!arguments.length) return radius; + radius = d3_functor(v); + return chord; + }; + chord.source = function(v) { + if (!arguments.length) return source; + source = d3_functor(v); + return chord; + }; + chord.target = function(v) { + if (!arguments.length) return target; + target = d3_functor(v); + return chord; + }; + chord.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3_functor(v); + return chord; + }; + chord.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3_functor(v); + return chord; + }; + return chord; + }; + d3.svg.diagonal = function() { + function diagonal(d, i) { + var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, { + x: p0.x, + y: m + }, { + x: p3.x, + y: m + }, p3 ]; + p = p.map(projection); + return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3]; + } + var source = d3_svg_chordSource, target = d3_svg_chordTarget, projection = d3_svg_diagonalProjection; + diagonal.source = function(x) { + if (!arguments.length) return source; + source = d3_functor(x); + return diagonal; + }; + diagonal.target = function(x) { + if (!arguments.length) return target; + target = d3_functor(x); + return diagonal; + }; + diagonal.projection = function(x) { + if (!arguments.length) return projection; + projection = x; + return diagonal; + }; + return diagonal; + }; + d3.svg.diagonal.radial = function() { + var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection; + diagonal.projection = function(x) { + return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection; + }; + return diagonal; + }; + d3.svg.mouse = d3.mouse; + d3.svg.touches = d3.touches; + d3.svg.symbol = function() { + function symbol(d, i) { + return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i)); + } + var type = d3_svg_symbolType, size = d3_svg_symbolSize; + symbol.type = function(x) { + if (!arguments.length) return type; + type = d3_functor(x); + return symbol; + }; + symbol.size = function(x) { + if (!arguments.length) return size; + size = d3_functor(x); + return symbol; + }; + return symbol; + }; + var d3_svg_symbols = d3.map({ + circle: d3_svg_symbolCircle, + cross: function(size) { + var r = Math.sqrt(size / 5) / 2; + return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z"; + }, + diamond: function(size) { + var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30; + return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z"; + }, + square: function(size) { + var r = Math.sqrt(size) / 2; + return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z"; + }, + "triangle-down": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z"; + }, + "triangle-up": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z"; + } + }); + d3.svg.symbolTypes = d3_svg_symbols.keys(); + var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180); + d3.svg.axis = function() { + function axis(g) { + g.each(function() { + var g = d3.select(this); + var ticks = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain() : tickValues, tickFormat = tickFormat_ == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String : tickFormat_; + var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), subtick = g.selectAll(".minor").data(subticks, String), subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6), subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(), subtickUpdate = d3.transition(subtick).style("opacity", 1); + var tick = g.selectAll("g").data(ticks, String), tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform; + var range = d3_scaleRange(scale), path = g.selectAll(".domain").data([ 0 ]), pathEnter = path.enter().append("path").attr("class", "domain"), pathUpdate = d3.transition(path); + var scale1 = scale.copy(), scale0 = this.__chart__ || scale1; + this.__chart__ = scale1; + tickEnter.append("line").attr("class", "tick"); + tickEnter.append("text"); + var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text"); + switch (orient) { + case "bottom": + { + tickTransform = d3_svg_axisX; + subtickEnter.attr("y2", tickMinorSize); + subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize); + lineEnter.attr("y2", tickMajorSize); + textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding); + lineUpdate.attr("x2", 0).attr("y2", tickMajorSize); + textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding); + text.attr("dy", ".71em").attr("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize); + break; + } + case "top": + { + tickTransform = d3_svg_axisX; + subtickEnter.attr("y2", -tickMinorSize); + subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize); + lineEnter.attr("y2", -tickMajorSize); + textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)); + lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize); + textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)); + text.attr("dy", "0em").attr("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize); + break; + } + case "left": + { + tickTransform = d3_svg_axisY; + subtickEnter.attr("x2", -tickMinorSize); + subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0); + lineEnter.attr("x2", -tickMajorSize); + textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)); + lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0); + textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0); + text.attr("dy", ".32em").attr("text-anchor", "end"); + pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize); + break; + } + case "right": + { + tickTransform = d3_svg_axisY; + subtickEnter.attr("x2", tickMinorSize); + subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0); + lineEnter.attr("x2", tickMajorSize); + textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding); + lineUpdate.attr("x2", tickMajorSize).attr("y2", 0); + textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0); + text.attr("dy", ".32em").attr("text-anchor", "start"); + pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize); + break; + } + } + if (scale.ticks) { + tickEnter.call(tickTransform, scale0); + tickUpdate.call(tickTransform, scale1); + tickExit.call(tickTransform, scale1); + subtickEnter.call(tickTransform, scale0); + subtickUpdate.call(tickTransform, scale1); + subtickExit.call(tickTransform, scale1); + } else { + var dx = scale1.rangeBand() / 2, x = function(d) { + return scale1(d) + dx; + }; + tickEnter.call(tickTransform, x); + tickUpdate.call(tickTransform, x); + } + }); + } + var scale = d3.scale.linear(), orient = "bottom", tickMajorSize = 6, tickMinorSize = 6, tickEndSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_, tickSubdivide = 0; + axis.scale = function(x) { + if (!arguments.length) return scale; + scale = x; + return axis; + }; + axis.orient = function(x) { + if (!arguments.length) return orient; + orient = x; + return axis; + }; + axis.ticks = function() { + if (!arguments.length) return tickArguments_; + tickArguments_ = arguments; + return axis; + }; + axis.tickValues = function(x) { + if (!arguments.length) return tickValues; + tickValues = x; + return axis; + }; + axis.tickFormat = function(x) { + if (!arguments.length) return tickFormat_; + tickFormat_ = x; + return axis; + }; + axis.tickSize = function(x, y, z) { + if (!arguments.length) return tickMajorSize; + var n = arguments.length - 1; + tickMajorSize = +x; + tickMinorSize = n > 1 ? +y : tickMajorSize; + tickEndSize = n > 0 ? +arguments[n] : tickMajorSize; + return axis; + }; + axis.tickPadding = function(x) { + if (!arguments.length) return tickPadding; + tickPadding = +x; + return axis; + }; + axis.tickSubdivide = function(x) { + if (!arguments.length) return tickSubdivide; + tickSubdivide = +x; + return axis; + }; + return axis; + }; + d3.svg.brush = function() { + function brush(g) { + g.each(function() { + var g = d3.select(this), bg = g.selectAll(".background").data([ 0 ]), fg = g.selectAll(".extent").data([ 0 ]), tz = g.selectAll(".resize").data(resizes, String), e; + g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart); + bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair"); + fg.enter().append("rect").attr("class", "extent").style("cursor", "move"); + tz.enter().append("g").attr("class", function(d) { + return "resize " + d; + }).style("cursor", function(d) { + return d3_svg_brushCursor[d]; + }).append("rect").attr("x", function(d) { + return /[ew]$/.test(d) ? -3 : null; + }).attr("y", function(d) { + return /^[ns]/.test(d) ? -3 : null; + }).attr("width", 6).attr("height", 6).style("visibility", "hidden"); + tz.style("display", brush.empty() ? "none" : null); + tz.exit().remove(); + if (x) { + e = d3_scaleRange(x); + bg.attr("x", e[0]).attr("width", e[1] - e[0]); + redrawX(g); + } + if (y) { + e = d3_scaleRange(y); + bg.attr("y", e[0]).attr("height", e[1] - e[0]); + redrawY(g); + } + redraw(g); + }); + } + function redraw(g) { + g.selectAll(".resize").attr("transform", function(d) { + return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")"; + }); + } + function redrawX(g) { + g.select(".extent").attr("x", extent[0][0]); + g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]); + } + function redrawY(g) { + g.select(".extent").attr("y", extent[0][1]); + g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]); + } + function brushstart() { + function mouse() { + var touches = d3.event.changedTouches; + return touches ? d3.touches(target, touches)[0] : d3.mouse(target); + } + function keydown() { + if (d3.event.keyCode == 32) { + if (!dragging) { + center = null; + origin[0] -= extent[1][0]; + origin[1] -= extent[1][1]; + dragging = 2; + } + d3_eventCancel(); + } + } + function keyup() { + if (d3.event.keyCode == 32 && dragging == 2) { + origin[0] += extent[1][0]; + origin[1] += extent[1][1]; + dragging = 0; + d3_eventCancel(); + } + } + function brushmove() { + var point = mouse(), moved = false; + if (offset) { + point[0] += offset[0]; + point[1] += offset[1]; + } + if (!dragging) { + if (d3.event.altKey) { + if (!center) center = [ (extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2 ]; + origin[0] = extent[+(point[0] < center[0])][0]; + origin[1] = extent[+(point[1] < center[1])][1]; + } else center = null; + } + if (resizingX && move1(point, x, 0)) { + redrawX(g); + moved = true; + } + if (resizingY && move1(point, y, 1)) { + redrawY(g); + moved = true; + } + if (moved) { + redraw(g); + event_({ + type: "brush", + mode: dragging ? "move" : "resize" + }); + } + } + function move1(point, scale, i) { + var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], size = extent[1][i] - extent[0][i], min, max; + if (dragging) { + r0 -= position; + r1 -= size + position; + } + min = Math.max(r0, Math.min(r1, point[i])); + if (dragging) { + max = (min += position) + size; + } else { + if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min)); + if (position < min) { + max = min; + min = position; + } else { + max = position; + } + } + if (extent[0][i] !== min || extent[1][i] !== max) { + extentDomain = null; + extent[0][i] = min; + extent[1][i] = max; + return true; + } + } + function brushend() { + brushmove(); + g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null); + d3.select("body").style("cursor", null); + w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null); + event_({ + type: "brushend" + }); + d3_eventCancel(); + } + var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), center, origin = mouse(), offset; + var w = d3.select(window).on("mousemove.brush", brushmove).on("mouseup.brush", brushend).on("touchmove.brush", brushmove).on("touchend.brush", brushend).on("keydown.brush", keydown).on("keyup.brush", keyup); + if (dragging) { + origin[0] = extent[0][0] - origin[0]; + origin[1] = extent[0][1] - origin[1]; + } else if (resizing) { + var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing); + offset = [ extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1] ]; + origin[0] = extent[ex][0]; + origin[1] = extent[ey][1]; + } else if (d3.event.altKey) center = origin.slice(); + g.style("pointer-events", "none").selectAll(".resize").style("display", null); + d3.select("body").style("cursor", eventTarget.style("cursor")); + event_({ + type: "brushstart" + }); + brushmove(); + d3_eventCancel(); + } + var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], extentDomain; + brush.x = function(z) { + if (!arguments.length) return x; + x = z; + resizes = d3_svg_brushResizes[!x << 1 | !y]; + return brush; + }; + brush.y = function(z) { + if (!arguments.length) return y; + y = z; + resizes = d3_svg_brushResizes[!x << 1 | !y]; + return brush; + }; + brush.extent = function(z) { + var x0, x1, y0, y1, t; + if (!arguments.length) { + z = extentDomain || extent; + if (x) { + x0 = z[0][0], x1 = z[1][0]; + if (!extentDomain) { + x0 = extent[0][0], x1 = extent[1][0]; + if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + } + } + if (y) { + y0 = z[0][1], y1 = z[1][1]; + if (!extentDomain) { + y0 = extent[0][1], y1 = extent[1][1]; + if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + } + } + return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ]; + } + extentDomain = [ [ 0, 0 ], [ 0, 0 ] ]; + if (x) { + x0 = z[0], x1 = z[1]; + if (y) x0 = x0[0], x1 = x1[0]; + extentDomain[0][0] = x0, extentDomain[1][0] = x1; + if (x.invert) x0 = x(x0), x1 = x(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + extent[0][0] = x0 | 0, extent[1][0] = x1 | 0; + } + if (y) { + y0 = z[0], y1 = z[1]; + if (x) y0 = y0[1], y1 = y1[1]; + extentDomain[0][1] = y0, extentDomain[1][1] = y1; + if (y.invert) y0 = y(y0), y1 = y(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + extent[0][1] = y0 | 0, extent[1][1] = y1 | 0; + } + return brush; + }; + brush.clear = function() { + extentDomain = null; + extent[0][0] = extent[0][1] = extent[1][0] = extent[1][1] = 0; + return brush; + }; + brush.empty = function() { + return x && extent[0][0] === extent[1][0] || y && extent[0][1] === extent[1][1]; + }; + return d3.rebind(brush, event, "on"); + }; + var d3_svg_brushCursor = { + n: "ns-resize", + e: "ew-resize", + s: "ns-resize", + w: "ew-resize", + nw: "nwse-resize", + ne: "nesw-resize", + se: "nwse-resize", + sw: "nesw-resize" + }; + var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ]; + d3.behavior = {}; + d3.behavior.drag = function() { + function drag() { + this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown); + } + function mousedown() { + function point() { + var p = target.parentNode; + return touchId ? d3.touches(p).filter(function(p) { + return p.identifier === touchId; + })[0] : d3.mouse(p); + } + function dragmove() { + if (!target.parentNode) return dragend(); + var p = point(), dx = p[0] - origin_[0], dy = p[1] - origin_[1]; + moved |= dx | dy; + origin_ = p; + d3_eventCancel(); + event_({ + type: "drag", + x: p[0] + offset[0], + y: p[1] + offset[1], + dx: dx, + dy: dy + }); + } + function dragend() { + event_({ + type: "dragend" + }); + if (moved) { + d3_eventCancel(); + if (d3.event.target === eventTarget) w.on("click.drag", click, true); + } + w.on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", null).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", null); + } + function click() { + d3_eventCancel(); + w.on("click.drag", null); + } + var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, touchId = d3.event.touches && d3.event.changedTouches[0].identifier, offset, origin_ = point(), moved = 0; + var w = d3.select(window).on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", dragmove).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", dragend, true); + if (origin) { + offset = origin.apply(target, arguments); + offset = [ offset.x - origin_[0], offset.y - origin_[1] ]; + } else { + offset = [ 0, 0 ]; + } + if (!touchId) d3_eventCancel(); + event_({ + type: "dragstart" + }); + } + var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null; + drag.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + return drag; + }; + return d3.rebind(drag, event, "on"); + }; + d3.behavior.zoom = function() { + function zoom() { + this.on("mousedown.zoom", mousedown).on("mousewheel.zoom", mousewheel).on("mousemove.zoom", mousemove).on("DOMMouseScroll.zoom", mousewheel).on("dblclick.zoom", dblclick).on("touchstart.zoom", touchstart).on("touchmove.zoom", touchmove).on("touchend.zoom", touchstart); + } + function location(p) { + return [ (p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale ]; + } + function point(l) { + return [ l[0] * scale + translate[0], l[1] * scale + translate[1] ]; + } + function scaleTo(s) { + scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s)); + } + function translateTo(p, l) { + l = point(l); + translate[0] += p[0] - l[0]; + translate[1] += p[1] - l[1]; + } + function dispatch(event) { + if (x1) x1.domain(x0.range().map(function(x) { + return (x - translate[0]) / scale; + }).map(x0.invert)); + if (y1) y1.domain(y0.range().map(function(y) { + return (y - translate[1]) / scale; + }).map(y0.invert)); + d3.event.preventDefault(); + event({ + type: "zoom", + scale: scale, + translate: translate + }); + } + function mousedown() { + function mousemove() { + moved = 1; + translateTo(d3.mouse(target), l); + dispatch(event_); + } + function mouseup() { + if (moved) d3_eventCancel(); + w.on("mousemove.zoom", null).on("mouseup.zoom", null); + if (moved && d3.event.target === eventTarget) w.on("click.zoom", click, true); + } + function click() { + d3_eventCancel(); + w.on("click.zoom", null); + } + var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, moved = 0, w = d3.select(window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup), l = location(d3.mouse(target)); + window.focus(); + d3_eventCancel(); + } + function mousewheel() { + if (!translate0) translate0 = location(d3.mouse(this)); + scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale); + translateTo(d3.mouse(this), translate0); + dispatch(event.of(this, arguments)); + } + function mousemove() { + translate0 = null; + } + function dblclick() { + var p = d3.mouse(this), l = location(p); + scaleTo(d3.event.shiftKey ? scale / 2 : scale * 2); + translateTo(p, l); + dispatch(event.of(this, arguments)); + } + function touchstart() { + var touches = d3.touches(this), now = Date.now(); + scale0 = scale; + translate0 = {}; + touches.forEach(function(t) { + translate0[t.identifier] = location(t); + }); + d3_eventCancel(); + if (touches.length === 1) { + if (now - touchtime < 500) { + var p = touches[0], l = location(touches[0]); + scaleTo(scale * 2); + translateTo(p, l); + dispatch(event.of(this, arguments)); + } + touchtime = now; + } + } + function touchmove() { + var touches = d3.touches(this), p0 = touches[0], l0 = translate0[p0.identifier]; + if (p1 = touches[1]) { + var p1, l1 = translate0[p1.identifier]; + p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ]; + l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ]; + scaleTo(d3.event.scale * scale0); + } + translateTo(p0, l0); + touchtime = null; + dispatch(event.of(this, arguments)); + } + var translate = [ 0, 0 ], translate0, scale = 1, scale0, scaleExtent = d3_behavior_zoomInfinity, event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime; + zoom.translate = function(x) { + if (!arguments.length) return translate; + translate = x.map(Number); + return zoom; + }; + zoom.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return zoom; + }; + zoom.scaleExtent = function(x) { + if (!arguments.length) return scaleExtent; + scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number); + return zoom; + }; + zoom.x = function(z) { + if (!arguments.length) return x1; + x1 = z; + x0 = z.copy(); + return zoom; + }; + zoom.y = function(z) { + if (!arguments.length) return y1; + y1 = z; + y0 = z.copy(); + return zoom; + }; + return d3.rebind(zoom, event, "on"); + }; + var d3_behavior_zoomDiv, d3_behavior_zoomInfinity = [ 0, Infinity ]; + d3.layout = {}; + d3.layout.bundle = function() { + return function(links) { + var paths = [], i = -1, n = links.length; + while (++i < n) paths.push(d3_layout_bundlePath(links[i])); + return paths; + }; + }; + d3.layout.chord = function() { + function relayout() { + var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j; + chords = []; + groups = []; + k = 0, i = -1; + while (++i < n) { + x = 0, j = -1; + while (++j < n) { + x += matrix[i][j]; + } + groupSums.push(x); + subgroupIndex.push(d3.range(n)); + k += x; + } + if (sortGroups) { + groupIndex.sort(function(a, b) { + return sortGroups(groupSums[a], groupSums[b]); + }); + } + if (sortSubgroups) { + subgroupIndex.forEach(function(d, i) { + d.sort(function(a, b) { + return sortSubgroups(matrix[i][a], matrix[i][b]); + }); + }); + } + k = (2 * Math.PI - padding * n) / k; + x = 0, i = -1; + while (++i < n) { + x0 = x, j = -1; + while (++j < n) { + var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k; + subgroups[di + "-" + dj] = { + index: di, + subindex: dj, + startAngle: a0, + endAngle: a1, + value: v + }; + } + groups[di] = { + index: di, + startAngle: x0, + endAngle: x, + value: (x - x0) / k + }; + x += padding; + } + i = -1; + while (++i < n) { + j = i - 1; + while (++j < n) { + var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i]; + if (source.value || target.value) { + chords.push(source.value < target.value ? { + source: target, + target: source + } : { + source: source, + target: target + }); + } + } + } + if (sortChords) resort(); + } + function resort() { + chords.sort(function(a, b) { + return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2); + }); + } + var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords; + chord.matrix = function(x) { + if (!arguments.length) return matrix; + n = (matrix = x) && matrix.length; + chords = groups = null; + return chord; + }; + chord.padding = function(x) { + if (!arguments.length) return padding; + padding = x; + chords = groups = null; + return chord; + }; + chord.sortGroups = function(x) { + if (!arguments.length) return sortGroups; + sortGroups = x; + chords = groups = null; + return chord; + }; + chord.sortSubgroups = function(x) { + if (!arguments.length) return sortSubgroups; + sortSubgroups = x; + chords = null; + return chord; + }; + chord.sortChords = function(x) { + if (!arguments.length) return sortChords; + sortChords = x; + if (chords) resort(); + return chord; + }; + chord.chords = function() { + if (!chords) relayout(); + return chords; + }; + chord.groups = function() { + if (!groups) relayout(); + return groups; + }; + return chord; + }; + d3.layout.force = function() { + function repulse(node) { + return function(quad, x1, y1, x2, y2) { + if (quad.point !== node) { + var dx = quad.cx - node.x, dy = quad.cy - node.y, dn = 1 / Math.sqrt(dx * dx + dy * dy); + if ((x2 - x1) * dn < theta) { + var k = quad.charge * dn * dn; + node.px -= dx * k; + node.py -= dy * k; + return true; + } + if (quad.point && isFinite(dn)) { + var k = quad.pointCharge * dn * dn; + node.px -= dx * k; + node.py -= dy * k; + } + } + return !quad.charge; + }; + } + function dragmove(d) { + d.px = d3.event.x; + d.py = d3.event.y; + force.resume(); + } + var force = {}, event = d3.dispatch("start", "tick", "end"), size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, gravity = .1, theta = .8, interval, nodes = [], links = [], distances, strengths, charges; + force.tick = function() { + if ((alpha *= .99) < .005) { + event.end({ + type: "end", + alpha: alpha = 0 + }); + return true; + } + var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y; + for (i = 0; i < m; ++i) { + o = links[i]; + s = o.source; + t = o.target; + x = t.x - s.x; + y = t.y - s.y; + if (l = x * x + y * y) { + l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l; + x *= l; + y *= l; + t.x -= x * (k = s.weight / (t.weight + s.weight)); + t.y -= y * k; + s.x += x * (k = 1 - k); + s.y += y * k; + } + } + if (k = alpha * gravity) { + x = size[0] / 2; + y = size[1] / 2; + i = -1; + if (k) while (++i < n) { + o = nodes[i]; + o.x += (x - o.x) * k; + o.y += (y - o.y) * k; + } + } + if (charge) { + d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges); + i = -1; + while (++i < n) { + if (!(o = nodes[i]).fixed) { + q.visit(repulse(o)); + } + } + } + i = -1; + while (++i < n) { + o = nodes[i]; + if (o.fixed) { + o.x = o.px; + o.y = o.py; + } else { + o.x -= (o.px - (o.px = o.x)) * friction; + o.y -= (o.py - (o.py = o.y)) * friction; + } + } + event.tick({ + type: "tick", + alpha: alpha + }); + }; + force.nodes = function(x) { + if (!arguments.length) return nodes; + nodes = x; + return force; + }; + force.links = function(x) { + if (!arguments.length) return links; + links = x; + return force; + }; + force.size = function(x) { + if (!arguments.length) return size; + size = x; + return force; + }; + force.linkDistance = function(x) { + if (!arguments.length) return linkDistance; + linkDistance = d3_functor(x); + return force; + }; + force.distance = force.linkDistance; + force.linkStrength = function(x) { + if (!arguments.length) return linkStrength; + linkStrength = d3_functor(x); + return force; + }; + force.friction = function(x) { + if (!arguments.length) return friction; + friction = x; + return force; + }; + force.charge = function(x) { + if (!arguments.length) return charge; + charge = typeof x === "function" ? x : +x; + return force; + }; + force.gravity = function(x) { + if (!arguments.length) return gravity; + gravity = x; + return force; + }; + force.theta = function(x) { + if (!arguments.length) return theta; + theta = x; + return force; + }; + force.alpha = function(x) { + if (!arguments.length) return alpha; + if (alpha) { + if (x > 0) alpha = x; else alpha = 0; + } else if (x > 0) { + event.start({ + type: "start", + alpha: alpha = x + }); + d3.timer(force.tick); + } + return force; + }; + force.start = function() { + function position(dimension, size) { + var neighbors = neighbor(i), j = -1, m = neighbors.length, x; + while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x; + return Math.random() * size; + } + function neighbor() { + if (!neighbors) { + neighbors = []; + for (j = 0; j < n; ++j) { + neighbors[j] = []; + } + for (j = 0; j < m; ++j) { + var o = links[j]; + neighbors[o.source.index].push(o.target); + neighbors[o.target.index].push(o.source); + } + } + return neighbors[i]; + } + var i, j, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o; + for (i = 0; i < n; ++i) { + (o = nodes[i]).index = i; + o.weight = 0; + } + distances = []; + strengths = []; + for (i = 0; i < m; ++i) { + o = links[i]; + if (typeof o.source == "number") o.source = nodes[o.source]; + if (typeof o.target == "number") o.target = nodes[o.target]; + distances[i] = linkDistance.call(this, o, i); + strengths[i] = linkStrength.call(this, o, i); + ++o.source.weight; + ++o.target.weight; + } + for (i = 0; i < n; ++i) { + o = nodes[i]; + if (isNaN(o.x)) o.x = position("x", w); + if (isNaN(o.y)) o.y = position("y", h); + if (isNaN(o.px)) o.px = o.x; + if (isNaN(o.py)) o.py = o.y; + } + charges = []; + if (typeof charge === "function") { + for (i = 0; i < n; ++i) { + charges[i] = +charge.call(this, nodes[i], i); + } + } else { + for (i = 0; i < n; ++i) { + charges[i] = charge; + } + } + return force.resume(); + }; + force.resume = function() { + return force.alpha(.1); + }; + force.stop = function() { + return force.alpha(0); + }; + force.drag = function() { + if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart", d3_layout_forceDragstart).on("drag", dragmove).on("dragend", d3_layout_forceDragend); + this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag); + }; + return d3.rebind(force, event, "on"); + }; + d3.layout.partition = function() { + function position(node, x, dx, dy) { + var children = node.children; + node.x = x; + node.y = node.depth * dy; + node.dx = dx; + node.dy = dy; + if (children && (n = children.length)) { + var i = -1, n, c, d; + dx = node.value ? dx / node.value : 0; + while (++i < n) { + position(c = children[i], x, d = c.value * dx, dy); + x += d; + } + } + } + function depth(node) { + var children = node.children, d = 0; + if (children && (n = children.length)) { + var i = -1, n; + while (++i < n) d = Math.max(d, depth(children[i])); + } + return 1 + d; + } + function partition(d, i) { + var nodes = hierarchy.call(this, d, i); + position(nodes[0], 0, size[0], size[1] / depth(nodes[0])); + return nodes; + } + var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ]; + partition.size = function(x) { + if (!arguments.length) return size; + size = x; + return partition; + }; + return d3_layout_hierarchyRebind(partition, hierarchy); + }; + d3.layout.pie = function() { + function pie(data, i) { + var values = data.map(function(d, i) { + return +value.call(pie, d, i); + }); + var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle); + var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - startAngle) / d3.sum(values); + var index = d3.range(data.length); + if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) { + return values[j] - values[i]; + } : function(i, j) { + return sort(data[i], data[j]); + }); + var arcs = []; + index.forEach(function(i) { + var d; + arcs[i] = { + data: data[i], + value: d = values[i], + startAngle: a, + endAngle: a += d * k + }; + }); + return arcs; + } + var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = 2 * Math.PI; + pie.value = function(x) { + if (!arguments.length) return value; + value = x; + return pie; + }; + pie.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return pie; + }; + pie.startAngle = function(x) { + if (!arguments.length) return startAngle; + startAngle = x; + return pie; + }; + pie.endAngle = function(x) { + if (!arguments.length) return endAngle; + endAngle = x; + return pie; + }; + return pie; + }; + var d3_layout_pieSortByValue = {}; + d3.layout.stack = function() { + function stack(data, index) { + var series = data.map(function(d, i) { + return values.call(stack, d, i); + }); + var points = series.map(function(d, i) { + return d.map(function(v, i) { + return [ x.call(stack, v, i), y.call(stack, v, i) ]; + }); + }); + var orders = order.call(stack, points, index); + series = d3.permute(series, orders); + points = d3.permute(points, orders); + var offsets = offset.call(stack, points, index); + var n = series.length, m = series[0].length, i, j, o; + for (j = 0; j < m; ++j) { + out.call(stack, series[0][j], o = offsets[j], points[0][j][1]); + for (i = 1; i < n; ++i) { + out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]); + } + } + return data; + } + var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY; + stack.values = function(x) { + if (!arguments.length) return values; + values = x; + return stack; + }; + stack.order = function(x) { + if (!arguments.length) return order; + order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault; + return stack; + }; + stack.offset = function(x) { + if (!arguments.length) return offset; + offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero; + return stack; + }; + stack.x = function(z) { + if (!arguments.length) return x; + x = z; + return stack; + }; + stack.y = function(z) { + if (!arguments.length) return y; + y = z; + return stack; + }; + stack.out = function(z) { + if (!arguments.length) return out; + out = z; + return stack; + }; + return stack; + }; + var d3_layout_stackOrders = d3.map({ + "inside-out": function(data) { + var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) { + return max[a] - max[b]; + }), top = 0, bottom = 0, tops = [], bottoms = []; + for (i = 0; i < n; ++i) { + j = index[i]; + if (top < bottom) { + top += sums[j]; + tops.push(j); + } else { + bottom += sums[j]; + bottoms.push(j); + } + } + return bottoms.reverse().concat(tops); + }, + reverse: function(data) { + return d3.range(data.length).reverse(); + }, + "default": d3_layout_stackOrderDefault + }); + var d3_layout_stackOffsets = d3.map({ + silhouette: function(data) { + var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o > max) max = o; + sums.push(o); + } + for (j = 0; j < m; ++j) { + y0[j] = (max - sums[j]) / 2; + } + return y0; + }, + wiggle: function(data) { + var n = data.length, x = data[0], m = x.length, max = 0, i, j, k, s1, s2, s3, dx, o, o0, y0 = []; + y0[0] = o = o0 = 0; + for (j = 1; j < m; ++j) { + for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1]; + for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) { + for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) { + s3 += (data[k][j][1] - data[k][j - 1][1]) / dx; + } + s2 += s3 * data[i][j][1]; + } + y0[j] = o -= s1 ? s2 / s1 * dx : 0; + if (o < o0) o0 = o; + } + for (j = 0; j < m; ++j) y0[j] -= o0; + return y0; + }, + expand: function(data) { + var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k; + } + for (j = 0; j < m; ++j) y0[j] = 0; + return y0; + }, + zero: d3_layout_stackOffsetZero + }); + d3.layout.histogram = function() { + function histogram(data, i) { + var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x; + while (++i < m) { + bin = bins[i] = []; + bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]); + bin.y = 0; + } + if (m > 0) { + i = -1; + while (++i < n) { + x = values[i]; + if (x >= range[0] && x <= range[1]) { + bin = bins[d3.bisect(thresholds, x, 1, m) - 1]; + bin.y += k; + bin.push(data[i]); + } + } + } + return bins; + } + var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges; + histogram.value = function(x) { + if (!arguments.length) return valuer; + valuer = x; + return histogram; + }; + histogram.range = function(x) { + if (!arguments.length) return ranger; + ranger = d3_functor(x); + return histogram; + }; + histogram.bins = function(x) { + if (!arguments.length) return binner; + binner = typeof x === "number" ? function(range) { + return d3_layout_histogramBinFixed(range, x); + } : d3_functor(x); + return histogram; + }; + histogram.frequency = function(x) { + if (!arguments.length) return frequency; + frequency = !!x; + return histogram; + }; + return histogram; + }; + d3.layout.hierarchy = function() { + function recurse(data, depth, nodes) { + var childs = children.call(hierarchy, data, depth), node = d3_layout_hierarchyInline ? data : { + data: data + }; + node.depth = depth; + nodes.push(node); + if (childs && (n = childs.length)) { + var i = -1, n, c = node.children = [], v = 0, j = depth + 1, d; + while (++i < n) { + d = recurse(childs[i], j, nodes); + d.parent = node; + c.push(d); + v += d.value; + } + if (sort) c.sort(sort); + if (value) node.value = v; + } else if (value) { + node.value = +value.call(hierarchy, data, depth) || 0; + } + return node; + } + function revalue(node, depth) { + var children = node.children, v = 0; + if (children && (n = children.length)) { + var i = -1, n, j = depth + 1; + while (++i < n) v += revalue(children[i], j); + } else if (value) { + v = +value.call(hierarchy, d3_layout_hierarchyInline ? node : node.data, depth) || 0; + } + if (value) node.value = v; + return v; + } + function hierarchy(d) { + var nodes = []; + recurse(d, 0, nodes); + return nodes; + } + var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue; + hierarchy.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return hierarchy; + }; + hierarchy.children = function(x) { + if (!arguments.length) return children; + children = x; + return hierarchy; + }; + hierarchy.value = function(x) { + if (!arguments.length) return value; + value = x; + return hierarchy; + }; + hierarchy.revalue = function(root) { + revalue(root, 0); + return root; + }; + return hierarchy; + }; + var d3_layout_hierarchyInline = false; + d3.layout.pack = function() { + function pack(d, i) { + var nodes = hierarchy.call(this, d, i), root = nodes[0]; + root.x = 0; + root.y = 0; + d3_layout_treeVisitAfter(root, function(d) { + d.r = Math.sqrt(d.value); + }); + d3_layout_treeVisitAfter(root, d3_layout_packSiblings); + var w = size[0], h = size[1], k = Math.max(2 * root.r / w, 2 * root.r / h); + if (padding > 0) { + var dr = padding * k / 2; + d3_layout_treeVisitAfter(root, function(d) { + d.r += dr; + }); + d3_layout_treeVisitAfter(root, d3_layout_packSiblings); + d3_layout_treeVisitAfter(root, function(d) { + d.r -= dr; + }); + k = Math.max(2 * root.r / w, 2 * root.r / h); + } + d3_layout_packTransform(root, w / 2, h / 2, 1 / k); + return nodes; + } + var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ]; + pack.size = function(x) { + if (!arguments.length) return size; + size = x; + return pack; + }; + pack.padding = function(_) { + if (!arguments.length) return padding; + padding = +_; + return pack; + }; + return d3_layout_hierarchyRebind(pack, hierarchy); + }; + d3.layout.cluster = function() { + function cluster(d, i) { + var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0, kx, ky; + d3_layout_treeVisitAfter(root, function(node) { + var children = node.children; + if (children && children.length) { + node.x = d3_layout_clusterX(children); + node.y = d3_layout_clusterY(children); + } else { + node.x = previousNode ? x += separation(node, previousNode) : 0; + node.y = 0; + previousNode = node; + } + }); + var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2; + d3_layout_treeVisitAfter(root, function(node) { + node.x = (node.x - x0) / (x1 - x0) * size[0]; + node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1]; + }); + return nodes; + } + var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ]; + cluster.separation = function(x) { + if (!arguments.length) return separation; + separation = x; + return cluster; + }; + cluster.size = function(x) { + if (!arguments.length) return size; + size = x; + return cluster; + }; + return d3_layout_hierarchyRebind(cluster, hierarchy); + }; + d3.layout.tree = function() { + function tree(d, i) { + function firstWalk(node, previousSibling) { + var children = node.children, layout = node._tree; + if (children && (n = children.length)) { + var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1; + while (++i < n) { + child = children[i]; + firstWalk(child, previousChild); + ancestor = apportion(child, previousChild, ancestor); + previousChild = child; + } + d3_layout_treeShift(node); + var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim); + if (previousSibling) { + layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); + layout.mod = layout.prelim - midpoint; + } else { + layout.prelim = midpoint; + } + } else { + if (previousSibling) { + layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); + } + } + } + function secondWalk(node, x) { + node.x = node._tree.prelim + x; + var children = node.children; + if (children && (n = children.length)) { + var i = -1, n; + x += node._tree.mod; + while (++i < n) { + secondWalk(children[i], x); + } + } + } + function apportion(node, previousSibling, ancestor) { + if (previousSibling) { + var vip = node, vop = node, vim = previousSibling, vom = node.parent.children[0], sip = vip._tree.mod, sop = vop._tree.mod, sim = vim._tree.mod, som = vom._tree.mod, shift; + while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) { + vom = d3_layout_treeLeft(vom); + vop = d3_layout_treeRight(vop); + vop._tree.ancestor = node; + shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip); + if (shift > 0) { + d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift); + sip += shift; + sop += shift; + } + sim += vim._tree.mod; + sip += vip._tree.mod; + som += vom._tree.mod; + sop += vop._tree.mod; + } + if (vim && !d3_layout_treeRight(vop)) { + vop._tree.thread = vim; + vop._tree.mod += sim - sop; + } + if (vip && !d3_layout_treeLeft(vom)) { + vom._tree.thread = vip; + vom._tree.mod += sip - som; + ancestor = node; + } + } + return ancestor; + } + var nodes = hierarchy.call(this, d, i), root = nodes[0]; + d3_layout_treeVisitAfter(root, function(node, previousSibling) { + node._tree = { + ancestor: node, + prelim: 0, + mod: 0, + change: 0, + shift: 0, + number: previousSibling ? previousSibling._tree.number + 1 : 0 + }; + }); + firstWalk(root); + secondWalk(root, -root._tree.prelim); + var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), right = d3_layout_treeSearch(root, d3_layout_treeRightmost), deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2, y1 = deep.depth || 1; + d3_layout_treeVisitAfter(root, function(node) { + node.x = (node.x - x0) / (x1 - x0) * size[0]; + node.y = node.depth / y1 * size[1]; + delete node._tree; + }); + return nodes; + } + var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ]; + tree.separation = function(x) { + if (!arguments.length) return separation; + separation = x; + return tree; + }; + tree.size = function(x) { + if (!arguments.length) return size; + size = x; + return tree; + }; + return d3_layout_hierarchyRebind(tree, hierarchy); + }; + d3.layout.treemap = function() { + function scale(children, k) { + var i = -1, n = children.length, child, area; + while (++i < n) { + area = (child = children[i]).value * (k < 0 ? 0 : k); + child.area = isNaN(area) || area <= 0 ? 0 : area; + } + } + function squarify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = Math.min(rect.dx, rect.dy), n; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while ((n = remaining.length) > 0) { + row.push(child = remaining[n - 1]); + row.area += child.area; + if ((score = worst(row, u)) <= best) { + remaining.pop(); + best = score; + } else { + row.area -= row.pop().area; + position(row, u, rect, false); + u = Math.min(rect.dx, rect.dy); + row.length = row.area = 0; + best = Infinity; + } + } + if (row.length) { + position(row, u, rect, true); + row.length = row.area = 0; + } + children.forEach(squarify); + } + } + function stickify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), remaining = children.slice(), child, row = []; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while (child = remaining.pop()) { + row.push(child); + row.area += child.area; + if (child.z != null) { + position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length); + row.length = row.area = 0; + } + } + children.forEach(stickify); + } + } + function worst(row, u) { + var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length; + while (++i < n) { + if (!(r = row[i].area)) continue; + if (r < rmin) rmin = r; + if (r > rmax) rmax = r; + } + s *= s; + u *= u; + return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity; + } + function position(row, u, rect, flush) { + var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o; + if (u == rect.dx) { + if (flush || v > rect.dy) v = rect.dy; + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dy = v; + x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0); + } + o.z = true; + o.dx += rect.x + rect.dx - x; + rect.y += v; + rect.dy -= v; + } else { + if (flush || v > rect.dx) v = rect.dx; + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dx = v; + y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0); + } + o.z = false; + o.dy += rect.y + rect.dy - y; + rect.x += v; + rect.dx -= v; + } + } + function treemap(d) { + var nodes = stickies || hierarchy(d), root = nodes[0]; + root.x = 0; + root.y = 0; + root.dx = size[0]; + root.dy = size[1]; + if (stickies) hierarchy.revalue(root); + scale([ root ], root.dx * root.dy / root.value); + (stickies ? stickify : squarify)(root); + if (sticky) stickies = nodes; + return nodes; + } + var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, ratio = .5 * (1 + Math.sqrt(5)); + treemap.size = function(x) { + if (!arguments.length) return size; + size = x; + return treemap; + }; + treemap.padding = function(x) { + function padFunction(node) { + var p = x.call(treemap, node, node.depth); + return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p); + } + function padConstant(node) { + return d3_layout_treemapPad(node, x); + } + if (!arguments.length) return padding; + var type; + pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], padConstant) : padConstant; + return treemap; + }; + treemap.round = function(x) { + if (!arguments.length) return round != Number; + round = x ? Math.round : Number; + return treemap; + }; + treemap.sticky = function(x) { + if (!arguments.length) return sticky; + sticky = x; + stickies = null; + return treemap; + }; + treemap.ratio = function(x) { + if (!arguments.length) return ratio; + ratio = x; + return treemap; + }; + return d3_layout_hierarchyRebind(treemap, hierarchy); + }; + d3.csv = d3_dsv(",", "text/csv"); + d3.tsv = d3_dsv(" ", "text/tab-separated-values"); + d3.geo = {}; + var d3_geo_radians = Math.PI / 180; + d3.geo.azimuthal = function() { + function azimuthal(coordinates) { + var x1 = coordinates[0] * d3_geo_radians - x0, y1 = coordinates[1] * d3_geo_radians, cx1 = Math.cos(x1), sx1 = Math.sin(x1), cy1 = Math.cos(y1), sy1 = Math.sin(y1), cc = mode !== "orthographic" ? sy0 * sy1 + cy0 * cy1 * cx1 : null, c, k = mode === "stereographic" ? 1 / (1 + cc) : mode === "gnomonic" ? 1 / cc : mode === "equidistant" ? (c = Math.acos(cc), c ? c / Math.sin(c) : 0) : mode === "equalarea" ? Math.sqrt(2 / (1 + cc)) : 1, x = k * cy1 * sx1, y = k * (sy0 * cy1 * cx1 - cy0 * sy1); + return [ scale * x + translate[0], scale * y + translate[1] ]; + } + var mode = "orthographic", origin, scale = 200, translate = [ 480, 250 ], x0, y0, cy0, sy0; + azimuthal.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale, p = Math.sqrt(x * x + y * y), c = mode === "stereographic" ? 2 * Math.atan(p) : mode === "gnomonic" ? Math.atan(p) : mode === "equidistant" ? p : mode === "equalarea" ? 2 * Math.asin(.5 * p) : Math.asin(p), sc = Math.sin(c), cc = Math.cos(c); + return [ (x0 + Math.atan2(x * sc, p * cy0 * cc + y * sy0 * sc)) / d3_geo_radians, Math.asin(cc * sy0 - (p ? y * sc * cy0 / p : 0)) / d3_geo_radians ]; + }; + azimuthal.mode = function(x) { + if (!arguments.length) return mode; + mode = x + ""; + return azimuthal; + }; + azimuthal.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + x0 = origin[0] * d3_geo_radians; + y0 = origin[1] * d3_geo_radians; + cy0 = Math.cos(y0); + sy0 = Math.sin(y0); + return azimuthal; + }; + azimuthal.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return azimuthal; + }; + azimuthal.translate = function(x) { + if (!arguments.length) return translate; + translate = [ +x[0], +x[1] ]; + return azimuthal; + }; + return azimuthal.origin([ 0, 0 ]); + }; + d3.geo.albers = function() { + function albers(coordinates) { + var t = n * (d3_geo_radians * coordinates[0] - lng0), p = Math.sqrt(C - 2 * n * Math.sin(d3_geo_radians * coordinates[1])) / n; + return [ scale * p * Math.sin(t) + translate[0], scale * (p * Math.cos(t) - p0) + translate[1] ]; + } + function reload() { + var phi1 = d3_geo_radians * parallels[0], phi2 = d3_geo_radians * parallels[1], lat0 = d3_geo_radians * origin[1], s = Math.sin(phi1), c = Math.cos(phi1); + lng0 = d3_geo_radians * origin[0]; + n = .5 * (s + Math.sin(phi2)); + C = c * c + 2 * n * s; + p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n; + return albers; + } + var origin = [ -98, 38 ], parallels = [ 29.5, 45.5 ], scale = 1e3, translate = [ 480, 250 ], lng0, n, C, p0; + albers.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale, p0y = p0 + y, t = Math.atan2(x, p0y), p = Math.sqrt(x * x + p0y * p0y); + return [ (lng0 + t / n) / d3_geo_radians, Math.asin((C - p * p * n * n) / (2 * n)) / d3_geo_radians ]; + }; + albers.origin = function(x) { + if (!arguments.length) return origin; + origin = [ +x[0], +x[1] ]; + return reload(); + }; + albers.parallels = function(x) { + if (!arguments.length) return parallels; + parallels = [ +x[0], +x[1] ]; + return reload(); + }; + albers.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return albers; + }; + albers.translate = function(x) { + if (!arguments.length) return translate; + translate = [ +x[0], +x[1] ]; + return albers; + }; + return reload(); + }; + d3.geo.albersUsa = function() { + function albersUsa(coordinates) { + var lon = coordinates[0], lat = coordinates[1]; + return (lat > 50 ? alaska : lon < -140 ? hawaii : lat < 21 ? puertoRico : lower48)(coordinates); + } + var lower48 = d3.geo.albers(); + var alaska = d3.geo.albers().origin([ -160, 60 ]).parallels([ 55, 65 ]); + var hawaii = d3.geo.albers().origin([ -160, 20 ]).parallels([ 8, 18 ]); + var puertoRico = d3.geo.albers().origin([ -60, 10 ]).parallels([ 8, 18 ]); + albersUsa.scale = function(x) { + if (!arguments.length) return lower48.scale(); + lower48.scale(x); + alaska.scale(x * .6); + hawaii.scale(x); + puertoRico.scale(x * 1.5); + return albersUsa.translate(lower48.translate()); + }; + albersUsa.translate = function(x) { + if (!arguments.length) return lower48.translate(); + var dz = lower48.scale() / 1e3, dx = x[0], dy = x[1]; + lower48.translate(x); + alaska.translate([ dx - 400 * dz, dy + 170 * dz ]); + hawaii.translate([ dx - 190 * dz, dy + 200 * dz ]); + puertoRico.translate([ dx + 580 * dz, dy + 430 * dz ]); + return albersUsa; + }; + return albersUsa.scale(lower48.scale()); + }; + d3.geo.bonne = function() { + function bonne(coordinates) { + var x = coordinates[0] * d3_geo_radians - x0, y = coordinates[1] * d3_geo_radians - y0; + if (y1) { + var p = c1 + y1 - y, E = x * Math.cos(y) / p; + x = p * Math.sin(E); + y = p * Math.cos(E) - c1; + } else { + x *= Math.cos(y); + y *= -1; + } + return [ scale * x + translate[0], scale * y + translate[1] ]; + } + var scale = 200, translate = [ 480, 250 ], x0, y0, y1, c1; + bonne.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale; + if (y1) { + var c = c1 + y, p = Math.sqrt(x * x + c * c); + y = c1 + y1 - p; + x = x0 + p * Math.atan2(x, c) / Math.cos(y); + } else { + y *= -1; + x /= Math.cos(y); + } + return [ x / d3_geo_radians, y / d3_geo_radians ]; + }; + bonne.parallel = function(x) { + if (!arguments.length) return y1 / d3_geo_radians; + c1 = 1 / Math.tan(y1 = x * d3_geo_radians); + return bonne; + }; + bonne.origin = function(x) { + if (!arguments.length) return [ x0 / d3_geo_radians, y0 / d3_geo_radians ]; + x0 = x[0] * d3_geo_radians; + y0 = x[1] * d3_geo_radians; + return bonne; + }; + bonne.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return bonne; + }; + bonne.translate = function(x) { + if (!arguments.length) return translate; + translate = [ +x[0], +x[1] ]; + return bonne; + }; + return bonne.origin([ 0, 0 ]).parallel(45); + }; + d3.geo.equirectangular = function() { + function equirectangular(coordinates) { + var x = coordinates[0] / 360, y = -coordinates[1] / 360; + return [ scale * x + translate[0], scale * y + translate[1] ]; + } + var scale = 500, translate = [ 480, 250 ]; + equirectangular.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale; + return [ 360 * x, -360 * y ]; + }; + equirectangular.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return equirectangular; + }; + equirectangular.translate = function(x) { + if (!arguments.length) return translate; + translate = [ +x[0], +x[1] ]; + return equirectangular; + }; + return equirectangular; + }; + d3.geo.mercator = function() { + function mercator(coordinates) { + var x = coordinates[0] / 360, y = -(Math.log(Math.tan(Math.PI / 4 + coordinates[1] * d3_geo_radians / 2)) / d3_geo_radians) / 360; + return [ scale * x + translate[0], scale * Math.max(-.5, Math.min(.5, y)) + translate[1] ]; + } + var scale = 500, translate = [ 480, 250 ]; + mercator.invert = function(coordinates) { + var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale; + return [ 360 * x, 2 * Math.atan(Math.exp(-360 * y * d3_geo_radians)) / d3_geo_radians - 90 ]; + }; + mercator.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + return mercator; + }; + mercator.translate = function(x) { + if (!arguments.length) return translate; + translate = [ +x[0], +x[1] ]; + return mercator; + }; + return mercator; + }; + d3.geo.path = function() { + function path(d, i) { + if (typeof pointRadius === "function") pointCircle = d3_path_circle(pointRadius.apply(this, arguments)); + pathType(d); + var result = buffer.length ? buffer.join("") : null; + buffer = []; + return result; + } + function project(coordinates) { + return projection(coordinates).join(","); + } + function polygonArea(coordinates) { + var sum = area(coordinates[0]), i = 0, n = coordinates.length; + while (++i < n) sum -= area(coordinates[i]); + return sum; + } + function polygonCentroid(coordinates) { + var polygon = d3.geom.polygon(coordinates[0].map(projection)), area = polygon.area(), centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1), x = centroid[0], y = centroid[1], z = area, i = 0, n = coordinates.length; + while (++i < n) { + polygon = d3.geom.polygon(coordinates[i].map(projection)); + area = polygon.area(); + centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1); + x -= centroid[0]; + y -= centroid[1]; + z -= area; + } + return [ x, y, 6 * z ]; + } + function area(coordinates) { + return Math.abs(d3.geom.polygon(coordinates.map(projection)).area()); + } + var pointRadius = 4.5, pointCircle = d3_path_circle(pointRadius), projection = d3.geo.albersUsa(), buffer = []; + var pathType = d3_geo_type({ + FeatureCollection: function(o) { + var features = o.features, i = -1, n = features.length; + while (++i < n) buffer.push(pathType(features[i].geometry)); + }, + Feature: function(o) { + pathType(o.geometry); + }, + Point: function(o) { + buffer.push("M", project(o.coordinates), pointCircle); + }, + MultiPoint: function(o) { + var coordinates = o.coordinates, i = -1, n = coordinates.length; + while (++i < n) buffer.push("M", project(coordinates[i]), pointCircle); + }, + LineString: function(o) { + var coordinates = o.coordinates, i = -1, n = coordinates.length; + buffer.push("M"); + while (++i < n) buffer.push(project(coordinates[i]), "L"); + buffer.pop(); + }, + MultiLineString: function(o) { + var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m; + while (++i < n) { + subcoordinates = coordinates[i]; + j = -1; + m = subcoordinates.length; + buffer.push("M"); + while (++j < m) buffer.push(project(subcoordinates[j]), "L"); + buffer.pop(); + } + }, + Polygon: function(o) { + var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m; + while (++i < n) { + subcoordinates = coordinates[i]; + j = -1; + if ((m = subcoordinates.length - 1) > 0) { + buffer.push("M"); + while (++j < m) buffer.push(project(subcoordinates[j]), "L"); + buffer[buffer.length - 1] = "Z"; + } + } + }, + MultiPolygon: function(o) { + var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m, subsubcoordinates, k, p; + while (++i < n) { + subcoordinates = coordinates[i]; + j = -1; + m = subcoordinates.length; + while (++j < m) { + subsubcoordinates = subcoordinates[j]; + k = -1; + if ((p = subsubcoordinates.length - 1) > 0) { + buffer.push("M"); + while (++k < p) buffer.push(project(subsubcoordinates[k]), "L"); + buffer[buffer.length - 1] = "Z"; + } + } + } + }, + GeometryCollection: function(o) { + var geometries = o.geometries, i = -1, n = geometries.length; + while (++i < n) buffer.push(pathType(geometries[i])); + } + }); + var areaType = path.area = d3_geo_type({ + FeatureCollection: function(o) { + var area = 0, features = o.features, i = -1, n = features.length; + while (++i < n) area += areaType(features[i]); + return area; + }, + Feature: function(o) { + return areaType(o.geometry); + }, + Polygon: function(o) { + return polygonArea(o.coordinates); + }, + MultiPolygon: function(o) { + var sum = 0, coordinates = o.coordinates, i = -1, n = coordinates.length; + while (++i < n) sum += polygonArea(coordinates[i]); + return sum; + }, + GeometryCollection: function(o) { + var sum = 0, geometries = o.geometries, i = -1, n = geometries.length; + while (++i < n) sum += areaType(geometries[i]); + return sum; + } + }, 0); + var centroidType = path.centroid = d3_geo_type({ + Feature: function(o) { + return centroidType(o.geometry); + }, + Polygon: function(o) { + var centroid = polygonCentroid(o.coordinates); + return [ centroid[0] / centroid[2], centroid[1] / centroid[2] ]; + }, + MultiPolygon: function(o) { + var area = 0, coordinates = o.coordinates, centroid, x = 0, y = 0, z = 0, i = -1, n = coordinates.length; + while (++i < n) { + centroid = polygonCentroid(coordinates[i]); + x += centroid[0]; + y += centroid[1]; + z += centroid[2]; + } + return [ x / z, y / z ]; + } + }); + path.projection = function(x) { + projection = x; + return path; + }; + path.pointRadius = function(x) { + if (typeof x === "function") pointRadius = x; else { + pointRadius = +x; + pointCircle = d3_path_circle(pointRadius); + } + return path; + }; + return path; + }; + d3.geo.bounds = function(feature) { + var left = Infinity, bottom = Infinity, right = -Infinity, top = -Infinity; + d3_geo_bounds(feature, function(x, y) { + if (x < left) left = x; + if (x > right) right = x; + if (y < bottom) bottom = y; + if (y > top) top = y; + }); + return [ [ left, bottom ], [ right, top ] ]; + }; + var d3_geo_boundsTypes = { + Feature: d3_geo_boundsFeature, + FeatureCollection: d3_geo_boundsFeatureCollection, + GeometryCollection: d3_geo_boundsGeometryCollection, + LineString: d3_geo_boundsLineString, + MultiLineString: d3_geo_boundsMultiLineString, + MultiPoint: d3_geo_boundsLineString, + MultiPolygon: d3_geo_boundsMultiPolygon, + Point: d3_geo_boundsPoint, + Polygon: d3_geo_boundsPolygon + }; + d3.geo.circle = function() { + function circle() {} + function visible(point) { + return arc.distance(point) < radians; + } + function clip(coordinates) { + var i = -1, n = coordinates.length, clipped = [], p0, p1, p2, d0, d1; + while (++i < n) { + d1 = arc.distance(p2 = coordinates[i]); + if (d1 < radians) { + if (p1) clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1))); + clipped.push(p2); + p0 = p1 = null; + } else { + p1 = p2; + if (!p0 && clipped.length) { + clipped.push(d3_geo_greatArcInterpolate(clipped[clipped.length - 1], p1)((radians - d0) / (d1 - d0))); + p0 = p1; + } + } + d0 = d1; + } + p0 = coordinates[0]; + p1 = clipped[0]; + if (p1 && p2[0] === p0[0] && p2[1] === p0[1] && !(p2[0] === p1[0] && p2[1] === p1[1])) { + clipped.push(p1); + } + return resample(clipped); + } + function resample(coordinates) { + var i = 0, n = coordinates.length, j, m, resampled = n ? [ coordinates[0] ] : coordinates, resamples, origin = arc.source(); + while (++i < n) { + resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates; + for (j = 0, m = resamples.length; ++j < m; ) resampled.push(resamples[j]); + } + arc.source(origin); + return resampled; + } + var origin = [ 0, 0 ], degrees = 90 - .01, radians = degrees * d3_geo_radians, arc = d3.geo.greatArc().source(origin).target(d3_identity); + circle.clip = function(d) { + if (typeof origin === "function") arc.source(origin.apply(this, arguments)); + return clipType(d) || null; + }; + var clipType = d3_geo_type({ + FeatureCollection: function(o) { + var features = o.features.map(clipType).filter(d3_identity); + return features && (o = Object.create(o), o.features = features, o); + }, + Feature: function(o) { + var geometry = clipType(o.geometry); + return geometry && (o = Object.create(o), o.geometry = geometry, o); + }, + Point: function(o) { + return visible(o.coordinates) && o; + }, + MultiPoint: function(o) { + var coordinates = o.coordinates.filter(visible); + return coordinates.length && { + type: o.type, + coordinates: coordinates + }; + }, + LineString: function(o) { + var coordinates = clip(o.coordinates); + return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + MultiLineString: function(o) { + var coordinates = o.coordinates.map(clip).filter(function(d) { + return d.length; + }); + return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + Polygon: function(o) { + var coordinates = o.coordinates.map(clip); + return coordinates[0].length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + MultiPolygon: function(o) { + var coordinates = o.coordinates.map(function(d) { + return d.map(clip); + }).filter(function(d) { + return d[0].length; + }); + return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o); + }, + GeometryCollection: function(o) { + var geometries = o.geometries.map(clipType).filter(d3_identity); + return geometries.length && (o = Object.create(o), o.geometries = geometries, o); + } + }); + circle.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + if (typeof origin !== "function") arc.source(origin); + return circle; + }; + circle.angle = function(x) { + if (!arguments.length) return degrees; + radians = (degrees = +x) * d3_geo_radians; + return circle; + }; + return d3.rebind(circle, arc, "precision"); + }; + d3.geo.greatArc = function() { + function greatArc() { + var d = greatArc.distance.apply(this, arguments), t = 0, dt = precision / d, coordinates = [ p0 ]; + while ((t += dt) < 1) coordinates.push(interpolate(t)); + coordinates.push(p1); + return { + type: "LineString", + coordinates: coordinates + }; + } + var source = d3_geo_greatArcSource, p0, target = d3_geo_greatArcTarget, p1, precision = 6 * d3_geo_radians, interpolate = d3_geo_greatArcInterpolator(); + greatArc.distance = function() { + if (typeof source === "function") interpolate.source(p0 = source.apply(this, arguments)); + if (typeof target === "function") interpolate.target(p1 = target.apply(this, arguments)); + return interpolate.distance(); + }; + greatArc.source = function(_) { + if (!arguments.length) return source; + source = _; + if (typeof source !== "function") interpolate.source(p0 = source); + return greatArc; + }; + greatArc.target = function(_) { + if (!arguments.length) return target; + target = _; + if (typeof target !== "function") interpolate.target(p1 = target); + return greatArc; + }; + greatArc.precision = function(_) { + if (!arguments.length) return precision / d3_geo_radians; + precision = _ * d3_geo_radians; + return greatArc; + }; + return greatArc; + }; + d3.geo.greatCircle = d3.geo.circle; + d3.geom = {}; + d3.geom.contour = function(grid, start) { + var s = start || d3_geom_contourStart(grid), c = [], x = s[0], y = s[1], dx = 0, dy = 0, pdx = NaN, pdy = NaN, i = 0; + do { + i = 0; + if (grid(x - 1, y - 1)) i += 1; + if (grid(x, y - 1)) i += 2; + if (grid(x - 1, y)) i += 4; + if (grid(x, y)) i += 8; + if (i === 6) { + dx = pdy === -1 ? -1 : 1; + dy = 0; + } else if (i === 9) { + dx = 0; + dy = pdx === 1 ? -1 : 1; + } else { + dx = d3_geom_contourDx[i]; + dy = d3_geom_contourDy[i]; + } + if (dx != pdx && dy != pdy) { + c.push([ x, y ]); + pdx = dx; + pdy = dy; + } + x += dx; + y += dy; + } while (s[0] != x || s[1] != y); + return c; + }; + var d3_geom_contourDx = [ 1, 0, 1, 1, -1, 0, -1, 1, 0, 0, 0, 0, -1, 0, -1, NaN ], d3_geom_contourDy = [ 0, -1, 0, 0, 0, -1, 0, 0, 1, -1, 1, 1, 0, -1, 0, NaN ]; + d3.geom.hull = function(vertices) { + if (vertices.length < 3) return []; + var len = vertices.length, plen = len - 1, points = [], stack = [], i, j, h = 0, x1, y1, x2, y2, u, v, a, sp; + for (i = 1; i < len; ++i) { + if (vertices[i][1] < vertices[h][1]) { + h = i; + } else if (vertices[i][1] == vertices[h][1]) { + h = vertices[i][0] < vertices[h][0] ? i : h; + } + } + for (i = 0; i < len; ++i) { + if (i === h) continue; + y1 = vertices[i][1] - vertices[h][1]; + x1 = vertices[i][0] - vertices[h][0]; + points.push({ + angle: Math.atan2(y1, x1), + index: i + }); + } + points.sort(function(a, b) { + return a.angle - b.angle; + }); + a = points[0].angle; + v = points[0].index; + u = 0; + for (i = 1; i < plen; ++i) { + j = points[i].index; + if (a == points[i].angle) { + x1 = vertices[v][0] - vertices[h][0]; + y1 = vertices[v][1] - vertices[h][1]; + x2 = vertices[j][0] - vertices[h][0]; + y2 = vertices[j][1] - vertices[h][1]; + if (x1 * x1 + y1 * y1 >= x2 * x2 + y2 * y2) { + points[i].index = -1; + } else { + points[u].index = -1; + a = points[i].angle; + u = i; + v = j; + } + } else { + a = points[i].angle; + u = i; + v = j; + } + } + stack.push(h); + for (i = 0, j = 0; i < 2; ++j) { + if (points[j].index !== -1) { + stack.push(points[j].index); + i++; + } + } + sp = stack.length; + for (; j < plen; ++j) { + if (points[j].index === -1) continue; + while (!d3_geom_hullCCW(stack[sp - 2], stack[sp - 1], points[j].index, vertices)) { + --sp; + } + stack[sp++] = points[j].index; + } + var poly = []; + for (i = 0; i < sp; ++i) { + poly.push(vertices[stack[i]]); + } + return poly; + }; + d3.geom.polygon = function(coordinates) { + coordinates.area = function() { + var i = 0, n = coordinates.length, a = coordinates[n - 1][0] * coordinates[0][1], b = coordinates[n - 1][1] * coordinates[0][0]; + while (++i < n) { + a += coordinates[i - 1][0] * coordinates[i][1]; + b += coordinates[i - 1][1] * coordinates[i][0]; + } + return (b - a) * .5; + }; + coordinates.centroid = function(k) { + var i = -1, n = coordinates.length, x = 0, y = 0, a, b = coordinates[n - 1], c; + if (!arguments.length) k = -1 / (6 * coordinates.area()); + while (++i < n) { + a = b; + b = coordinates[i]; + c = a[0] * b[1] - b[0] * a[1]; + x += (a[0] + b[0]) * c; + y += (a[1] + b[1]) * c; + } + return [ x * k, y * k ]; + }; + coordinates.clip = function(subject) { + var input, i = -1, n = coordinates.length, j, m, a = coordinates[n - 1], b, c, d; + while (++i < n) { + input = subject.slice(); + subject.length = 0; + b = coordinates[i]; + c = input[(m = input.length) - 1]; + j = -1; + while (++j < m) { + d = input[j]; + if (d3_geom_polygonInside(d, a, b)) { + if (!d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + subject.push(d); + } else if (d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + c = d; + } + a = b; + } + return subject; + }; + return coordinates; + }; + d3.geom.voronoi = function(vertices) { + var polygons = vertices.map(function() { + return []; + }); + d3_voronoi_tessellate(vertices, function(e) { + var s1, s2, x1, x2, y1, y2; + if (e.a === 1 && e.b >= 0) { + s1 = e.ep.r; + s2 = e.ep.l; + } else { + s1 = e.ep.l; + s2 = e.ep.r; + } + if (e.a === 1) { + y1 = s1 ? s1.y : -1e6; + x1 = e.c - e.b * y1; + y2 = s2 ? s2.y : 1e6; + x2 = e.c - e.b * y2; + } else { + x1 = s1 ? s1.x : -1e6; + y1 = e.c - e.a * x1; + x2 = s2 ? s2.x : 1e6; + y2 = e.c - e.a * x2; + } + var v1 = [ x1, y1 ], v2 = [ x2, y2 ]; + polygons[e.region.l.index].push(v1, v2); + polygons[e.region.r.index].push(v1, v2); + }); + return polygons.map(function(polygon, i) { + var cx = vertices[i][0], cy = vertices[i][1]; + polygon.forEach(function(v) { + v.angle = Math.atan2(v[0] - cx, v[1] - cy); + }); + return polygon.sort(function(a, b) { + return a.angle - b.angle; + }).filter(function(d, i) { + return !i || d.angle - polygon[i - 1].angle > 1e-10; + }); + }); + }; + var d3_voronoi_opposite = { + l: "r", + r: "l" + }; + d3.geom.delaunay = function(vertices) { + var edges = vertices.map(function() { + return []; + }), triangles = []; + d3_voronoi_tessellate(vertices, function(e) { + edges[e.region.l.index].push(vertices[e.region.r.index]); + }); + edges.forEach(function(edge, i) { + var v = vertices[i], cx = v[0], cy = v[1]; + edge.forEach(function(v) { + v.angle = Math.atan2(v[0] - cx, v[1] - cy); + }); + edge.sort(function(a, b) { + return a.angle - b.angle; + }); + for (var j = 0, m = edge.length - 1; j < m; j++) { + triangles.push([ v, edge[j], edge[j + 1] ]); + } + }); + return triangles; + }; + d3.geom.quadtree = function(points, x1, y1, x2, y2) { + function insert(n, p, x1, y1, x2, y2) { + if (isNaN(p.x) || isNaN(p.y)) return; + if (n.leaf) { + var v = n.point; + if (v) { + if (Math.abs(v.x - p.x) + Math.abs(v.y - p.y) < .01) { + insertChild(n, p, x1, y1, x2, y2); + } else { + n.point = null; + insertChild(n, v, x1, y1, x2, y2); + insertChild(n, p, x1, y1, x2, y2); + } + } else { + n.point = p; + } + } else { + insertChild(n, p, x1, y1, x2, y2); + } + } + function insertChild(n, p, x1, y1, x2, y2) { + var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = p.x >= sx, bottom = p.y >= sy, i = (bottom << 1) + right; + n.leaf = false; + n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); + if (right) x1 = sx; else x2 = sx; + if (bottom) y1 = sy; else y2 = sy; + insert(n, p, x1, y1, x2, y2); + } + var p, i = -1, n = points.length; + if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint); + if (arguments.length < 5) { + if (arguments.length === 3) { + y2 = x2 = y1; + y1 = x1; + } else { + x1 = y1 = Infinity; + x2 = y2 = -Infinity; + while (++i < n) { + p = points[i]; + if (p.x < x1) x1 = p.x; + if (p.y < y1) y1 = p.y; + if (p.x > x2) x2 = p.x; + if (p.y > y2) y2 = p.y; + } + var dx = x2 - x1, dy = y2 - y1; + if (dx > dy) y2 = y1 + dx; else x2 = x1 + dy; + } + } + var root = d3_geom_quadtreeNode(); + root.add = function(p) { + insert(root, p, x1, y1, x2, y2); + }; + root.visit = function(f) { + d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2); + }; + points.forEach(root.add); + return root; + }; + d3.time = {}; + var d3_time = Date, d3_time_daySymbols = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ]; + d3_time_utc.prototype = { + getDate: function() { + return this._.getUTCDate(); + }, + getDay: function() { + return this._.getUTCDay(); + }, + getFullYear: function() { + return this._.getUTCFullYear(); + }, + getHours: function() { + return this._.getUTCHours(); + }, + getMilliseconds: function() { + return this._.getUTCMilliseconds(); + }, + getMinutes: function() { + return this._.getUTCMinutes(); + }, + getMonth: function() { + return this._.getUTCMonth(); + }, + getSeconds: function() { + return this._.getUTCSeconds(); + }, + getTime: function() { + return this._.getTime(); + }, + getTimezoneOffset: function() { + return 0; + }, + valueOf: function() { + return this._.valueOf(); + }, + setDate: function() { + d3_time_prototype.setUTCDate.apply(this._, arguments); + }, + setDay: function() { + d3_time_prototype.setUTCDay.apply(this._, arguments); + }, + setFullYear: function() { + d3_time_prototype.setUTCFullYear.apply(this._, arguments); + }, + setHours: function() { + d3_time_prototype.setUTCHours.apply(this._, arguments); + }, + setMilliseconds: function() { + d3_time_prototype.setUTCMilliseconds.apply(this._, arguments); + }, + setMinutes: function() { + d3_time_prototype.setUTCMinutes.apply(this._, arguments); + }, + setMonth: function() { + d3_time_prototype.setUTCMonth.apply(this._, arguments); + }, + setSeconds: function() { + d3_time_prototype.setUTCSeconds.apply(this._, arguments); + }, + setTime: function() { + d3_time_prototype.setTime.apply(this._, arguments); + } + }; + var d3_time_prototype = Date.prototype; + var d3_time_formatDateTime = "%a %b %e %H:%M:%S %Y", d3_time_formatDate = "%m/%d/%y", d3_time_formatTime = "%H:%M:%S"; + var d3_time_days = d3_time_daySymbols, d3_time_dayAbbreviations = d3_time_days.map(d3_time_formatAbbreviate), d3_time_months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], d3_time_monthAbbreviations = d3_time_months.map(d3_time_formatAbbreviate); + d3.time.format = function(template) { + function format(date) { + var string = [], i = -1, j = 0, c, f; + while (++i < n) { + if (template.charCodeAt(i) == 37) { + string.push(template.substring(j, i), (f = d3_time_formats[c = template.charAt(++i)]) ? f(date) : c); + j = i + 1; + } + } + string.push(template.substring(j, i)); + return string.join(""); + } + var n = template.length; + format.parse = function(string) { + var d = { + y: 1900, + m: 0, + d: 1, + H: 0, + M: 0, + S: 0, + L: 0 + }, i = d3_time_parse(d, template, string, 0); + if (i != string.length) return null; + if ("p" in d) d.H = d.H % 12 + d.p * 12; + var date = new d3_time; + date.setFullYear(d.y, d.m, d.d); + date.setHours(d.H, d.M, d.S, d.L); + return date; + }; + format.toString = function() { + return template; + }; + return format; + }; + var d3_time_zfill2 = d3.format("02d"), d3_time_zfill3 = d3.format("03d"), d3_time_zfill4 = d3.format("04d"), d3_time_sfill2 = d3.format("2d"); + var d3_time_dayRe = d3_time_formatRe(d3_time_days), d3_time_dayAbbrevRe = d3_time_formatRe(d3_time_dayAbbreviations), d3_time_monthRe = d3_time_formatRe(d3_time_months), d3_time_monthLookup = d3_time_formatLookup(d3_time_months), d3_time_monthAbbrevRe = d3_time_formatRe(d3_time_monthAbbreviations), d3_time_monthAbbrevLookup = d3_time_formatLookup(d3_time_monthAbbreviations); + var d3_time_formats = { + a: function(d) { + return d3_time_dayAbbreviations[d.getDay()]; + }, + A: function(d) { + return d3_time_days[d.getDay()]; + }, + b: function(d) { + return d3_time_monthAbbreviations[d.getMonth()]; + }, + B: function(d) { + return d3_time_months[d.getMonth()]; + }, + c: d3.time.format(d3_time_formatDateTime), + d: function(d) { + return d3_time_zfill2(d.getDate()); + }, + e: function(d) { + return d3_time_sfill2(d.getDate()); + }, + H: function(d) { + return d3_time_zfill2(d.getHours()); + }, + I: function(d) { + return d3_time_zfill2(d.getHours() % 12 || 12); + }, + j: function(d) { + return d3_time_zfill3(1 + d3.time.dayOfYear(d)); + }, + L: function(d) { + return d3_time_zfill3(d.getMilliseconds()); + }, + m: function(d) { + return d3_time_zfill2(d.getMonth() + 1); + }, + M: function(d) { + return d3_time_zfill2(d.getMinutes()); + }, + p: function(d) { + return d.getHours() >= 12 ? "PM" : "AM"; + }, + S: function(d) { + return d3_time_zfill2(d.getSeconds()); + }, + U: function(d) { + return d3_time_zfill2(d3.time.sundayOfYear(d)); + }, + w: function(d) { + return d.getDay(); + }, + W: function(d) { + return d3_time_zfill2(d3.time.mondayOfYear(d)); + }, + x: d3.time.format(d3_time_formatDate), + X: d3.time.format(d3_time_formatTime), + y: function(d) { + return d3_time_zfill2(d.getFullYear() % 100); + }, + Y: function(d) { + return d3_time_zfill4(d.getFullYear() % 1e4); + }, + Z: d3_time_zone, + "%": function(d) { + return "%"; + } + }; + var d3_time_parsers = { + a: d3_time_parseWeekdayAbbrev, + A: d3_time_parseWeekday, + b: d3_time_parseMonthAbbrev, + B: d3_time_parseMonth, + c: d3_time_parseLocaleFull, + d: d3_time_parseDay, + e: d3_time_parseDay, + H: d3_time_parseHour24, + I: d3_time_parseHour24, + L: d3_time_parseMilliseconds, + m: d3_time_parseMonthNumber, + M: d3_time_parseMinutes, + p: d3_time_parseAmPm, + S: d3_time_parseSeconds, + x: d3_time_parseLocaleDate, + X: d3_time_parseLocaleTime, + y: d3_time_parseYear, + Y: d3_time_parseFullYear + }; + var d3_time_numberRe = /^\s*\d+/; + var d3_time_amPmLookup = d3.map({ + am: 0, + pm: 1 + }); + d3.time.format.utc = function(template) { + function format(date) { + try { + d3_time = d3_time_utc; + var utc = new d3_time; + utc._ = date; + return local(utc); + } finally { + d3_time = Date; + } + } + var local = d3.time.format(template); + format.parse = function(string) { + try { + d3_time = d3_time_utc; + var date = local.parse(string); + return date && date._; + } finally { + d3_time = Date; + } + }; + format.toString = local.toString; + return format; + }; + var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ"); + d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso; + d3_time_formatIsoNative.parse = function(string) { + var date = new Date(string); + return isNaN(date) ? null : date; + }; + d3_time_formatIsoNative.toString = d3_time_formatIso.toString; + d3.time.second = d3_time_interval(function(date) { + return new d3_time(Math.floor(date / 1e3) * 1e3); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 1e3); + }, function(date) { + return date.getSeconds(); + }); + d3.time.seconds = d3.time.second.range; + d3.time.seconds.utc = d3.time.second.utc.range; + d3.time.minute = d3_time_interval(function(date) { + return new d3_time(Math.floor(date / 6e4) * 6e4); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 6e4); + }, function(date) { + return date.getMinutes(); + }); + d3.time.minutes = d3.time.minute.range; + d3.time.minutes.utc = d3.time.minute.utc.range; + d3.time.hour = d3_time_interval(function(date) { + var timezone = date.getTimezoneOffset() / 60; + return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 36e5); + }, function(date) { + return date.getHours(); + }); + d3.time.hours = d3.time.hour.range; + d3.time.hours.utc = d3.time.hour.utc.range; + d3.time.day = d3_time_interval(function(date) { + var day = new d3_time(1970, 0); + day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate()); + return day; + }, function(date, offset) { + date.setDate(date.getDate() + offset); + }, function(date) { + return date.getDate() - 1; + }); + d3.time.days = d3.time.day.range; + d3.time.days.utc = d3.time.day.utc.range; + d3.time.dayOfYear = function(date) { + var year = d3.time.year(date); + return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5); + }; + d3_time_daySymbols.forEach(function(day, i) { + day = day.toLowerCase(); + i = 7 - i; + var interval = d3.time[day] = d3_time_interval(function(date) { + (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7); + return date; + }, function(date, offset) { + date.setDate(date.getDate() + Math.floor(offset) * 7); + }, function(date) { + var day = d3.time.year(date).getDay(); + return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i); + }); + d3.time[day + "s"] = interval.range; + d3.time[day + "s"].utc = interval.utc.range; + d3.time[day + "OfYear"] = function(date) { + var day = d3.time.year(date).getDay(); + return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7); + }; + }); + d3.time.week = d3.time.sunday; + d3.time.weeks = d3.time.sunday.range; + d3.time.weeks.utc = d3.time.sunday.utc.range; + d3.time.weekOfYear = d3.time.sundayOfYear; + d3.time.month = d3_time_interval(function(date) { + date = d3.time.day(date); + date.setDate(1); + return date; + }, function(date, offset) { + date.setMonth(date.getMonth() + offset); + }, function(date) { + return date.getMonth(); + }); + d3.time.months = d3.time.month.range; + d3.time.months.utc = d3.time.month.utc.range; + d3.time.year = d3_time_interval(function(date) { + date = d3.time.day(date); + date.setMonth(0, 1); + return date; + }, function(date, offset) { + date.setFullYear(date.getFullYear() + offset); + }, function(date) { + return date.getFullYear(); + }); + d3.time.years = d3.time.year.range; + d3.time.years.utc = d3.time.year.utc.range; + var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ]; + var d3_time_scaleLocalMethods = [ [ d3.time.second, 1 ], [ d3.time.second, 5 ], [ d3.time.second, 15 ], [ d3.time.second, 30 ], [ d3.time.minute, 1 ], [ d3.time.minute, 5 ], [ d3.time.minute, 15 ], [ d3.time.minute, 30 ], [ d3.time.hour, 1 ], [ d3.time.hour, 3 ], [ d3.time.hour, 6 ], [ d3.time.hour, 12 ], [ d3.time.day, 1 ], [ d3.time.day, 2 ], [ d3.time.week, 1 ], [ d3.time.month, 1 ], [ d3.time.month, 3 ], [ d3.time.year, 1 ] ]; + var d3_time_scaleLocalFormats = [ [ d3.time.format("%Y"), function(d) { + return true; + } ], [ d3.time.format("%B"), function(d) { + return d.getMonth(); + } ], [ d3.time.format("%b %d"), function(d) { + return d.getDate() != 1; + } ], [ d3.time.format("%a %d"), function(d) { + return d.getDay() && d.getDate() != 1; + } ], [ d3.time.format("%I %p"), function(d) { + return d.getHours(); + } ], [ d3.time.format("%I:%M"), function(d) { + return d.getMinutes(); + } ], [ d3.time.format(":%S"), function(d) { + return d.getSeconds(); + } ], [ d3.time.format(".%L"), function(d) { + return d.getMilliseconds(); + } ] ]; + var d3_time_scaleLinear = d3.scale.linear(), d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats); + d3_time_scaleLocalMethods.year = function(extent, m) { + return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear); + }; + d3.time.scale = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat); + }; + var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) { + return [ m[0].utc, m[1] ]; + }); + var d3_time_scaleUTCFormats = [ [ d3.time.format.utc("%Y"), function(d) { + return true; + } ], [ d3.time.format.utc("%B"), function(d) { + return d.getUTCMonth(); + } ], [ d3.time.format.utc("%b %d"), function(d) { + return d.getUTCDate() != 1; + } ], [ d3.time.format.utc("%a %d"), function(d) { + return d.getUTCDay() && d.getUTCDate() != 1; + } ], [ d3.time.format.utc("%I %p"), function(d) { + return d.getUTCHours(); + } ], [ d3.time.format.utc("%I:%M"), function(d) { + return d.getUTCMinutes(); + } ], [ d3.time.format.utc(":%S"), function(d) { + return d.getUTCSeconds(); + } ], [ d3.time.format.utc(".%L"), function(d) { + return d.getUTCMilliseconds(); + } ] ]; + var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats); + d3_time_scaleUTCMethods.year = function(extent, m) { + return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear); + }; + d3.time.scale.utc = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat); + }; +})(); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v2.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v2.min.js new file mode 100644 index 0000000..cc47f1e --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v2.min.js @@ -0,0 +1,4 @@ +(function(){function e(e,t){try{for(var n in t)Object.defineProperty(e.prototype,n,{value:t[n],enumerable:!1})}catch(r){e.prototype=t}}function t(e){var t=-1,n=e.length,r=[];while(++t=0?e.substring(t):(t=e.length,""),r=[];while(t>0)r.push(e.substring(t-=3,t+3));return r.reverse().join(",")+n}function b(e,t){var n=Math.pow(10,Math.abs(8-t)*3);return{scale:t>8?function(e){return e/n}:function(e){return e*n},symbol:e}}function w(e){return function(t){return t<=0?0:t>=1?1:e(t)}}function E(e){return function(t){return 1-e(1-t)}}function S(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function x(e){return e}function T(e){return function(t){return Math.pow(t,e)}}function N(e){return 1-Math.cos(e*Math.PI/2)}function C(e){return Math.pow(2,10*(e-1))}function k(e){return 1-Math.sqrt(1-e*e)}function L(e,t){var n;return arguments.length<2&&(t=.45),arguments.length<1?(e=1,n=t/4):n=t/(2*Math.PI)*Math.asin(1/e),function(r){return 1+e*Math.pow(2,10*-r)*Math.sin((r-n)*2*Math.PI/t)}}function A(e){return e||(e=1.70158),function(t){return t*t*((e+1)*t-e)}}function O(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function M(){d3.event.stopPropagation(),d3.event.preventDefault()}function _(){var e=d3.event,t;while(t=e.sourceEvent)e=t;return e}function D(e){var t=new d,n=0,r=arguments.length;while(++n360?e-=360:e<0&&(e+=360),e<60?s+(o-s)*e/60:e<180?o:e<240?s+(o-s)*(240-e)/60:s}function i(e){return Math.round(r(e)*255)}var s,o;return e%=360,e<0&&(e+=360),t=t<0?0:t>1?1:t,n=n<0?0:n>1?1:n,o=n<=.5?n*(1+t):n+t-n*t,s=2*n-o,R(i(e+120),i(e),i(e-120))}function Y(e,t,n){return new Z(e,t,n)}function Z(e,t,n){this.h=e,this.c=t,this.l=n}function et(e,t,n){return tt(n,Math.cos(e*=Math.PI/180)*t,Math.sin(e)*t)}function tt(e,t,n){return new nt(e,t,n)}function nt(e,t,n){this.l=e,this.a=t,this.b=n}function rt(e,t,n){var r=(e+16)/116,i=r+t/500,s=r-n/200;return i=st(i)*ds,r=st(r)*vs,s=st(s)*ms,R(ut(3.2404542*i-1.5371385*r-.4985314*s),ut(-0.969266*i+1.8760108*r+.041556*s),ut(.0556434*i-.2040259*r+1.0572252*s))}function it(e,t,n){return Y(Math.atan2(n,t)/Math.PI*180,Math.sqrt(t*t+n*n),e)}function st(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function ot(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function ut(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function at(e){return Ki(e,Ss),e}function ft(e){return function(){return gs(e,this)}}function lt(e){return function(){return ys(e,this)}}function ct(e,t){function n(){this.removeAttribute(e)}function r(){this.removeAttributeNS(e.space,e.local)}function i(){this.setAttribute(e,t)}function s(){this.setAttributeNS(e.space,e.local,t)}function o(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}function u(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}return e=d3.ns.qualify(e),t==null?e.local?r:n:typeof t=="function"?e.local?u:o:e.local?s:i}function ht(e){return new RegExp("(?:^|\\s+)"+d3.requote(e)+"(?:\\s+|$)","g")}function pt(e,t){function n(){var n=-1;while(++n0&&(e=e.substring(0,o)),t?i:r}function Et(e,t){for(var n=0,r=e.length;nt?c():(v.active=t,i.forEach(function(t,n){(n=n.call(e,m,u))&&h.push(n)}),s.start.call(e,m,u),l(r)||d3.timer(l,0,n),1)}function l(n){if(v.active!==t)return c();var r=(n-p)/d,i=o(r),a=h.length;while(a>0)h[--a].call(e,i);if(r>=1)return c(),ks=t,s.end.call(e,m,u),ks=0,1}function c(){return--v.count||delete e.__transition__,1}var h=[],p=e.delay,d=e.duration,v=(e=e.node).__transition__||(e.__transition__={active:0,count:0}),m=e.__data__;++v.count,p<=r?f(r):d3.timer(f,p,n)})},0,n),e}function Tt(e){var t=ks,n=Ds,r=Ms,i=_s;return ks=this.id,Ds=this.ease(),Et(this,function(t,n,r){Ms=t.delay,_s=t.duration,e.call(t=t.node,t.__data__,n,r)}),ks=t,Ds=n,Ms=r,_s=i,this}function Nt(e,t,n){return n!=""&&Ps}function Ct(e,t){return d3.tween(e,F(t))}function kt(){var e,t=Date.now(),n=Hs;while(n)e=t-n.then,e>=n.delay&&(n.flush=n.callback(e)),n=n.next;var r=Lt()-t;r>24?(isFinite(r)&&(clearTimeout(js),js=setTimeout(kt,r)),Bs=0):(Bs=1,Fs(kt))}function Lt(){var e=null,t=Hs,n=Infinity;while(t)t.flush?t=e?e.next=t.next:Hs=t.next:(n=Math.min(n,t.then+t.delay),t=(e=t).next);return n}function At(e,t){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();if(Is<0&&(window.scrollX||window.scrollY)){n=d3.select(document.body).append("svg").style("position","absolute").style("top",0).style("left",0);var i=n[0][0].getScreenCTM();Is=!i.f&&!i.e,n.remove()}return Is?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}function Ot(){}function Mt(e){var t=e[0],n=e[e.length-1];return t2?Ut:Rt,a=r?q:I;return o=i(e,t,a,n),u=i(t,e,a,d3.interpolate),s}function s(e){return o(e)}var o,u;return s.invert=function(e){return u(e)},s.domain=function(t){return arguments.length?(e=t.map(Number),i()):e},s.range=function(e){return arguments.length?(t=e,i()):t},s.rangeRound=function(e){return s.range(e).interpolate(d3.interpolateRound)},s.clamp=function(e){return arguments.length?(r=e,i()):r},s.interpolate=function(e){return arguments.length?(n=e,i()):n},s.ticks=function(t){return It(e,t)},s.tickFormat=function(t){return qt(e,t)},s.nice=function(){return Dt(e,jt),i()},s.copy=function(){return Ht(e,t,n,r)},i()}function Bt(e,t){return d3.rebind(e,t,"range","rangeRound","interpolate","clamp")}function jt(e){return e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1),e&&{floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}}}function Ft(e,t){var n=Mt(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),s=t/r*i;return s<=.15?i*=10:s<=.35?i*=5:s<=.75&&(i*=2),n[0]=Math.ceil(n[0]/i)*i,n[1]=Math.floor(n[1]/i)*i+i*.5,n[2]=i,n}function It(e,t){return d3.range.apply(d3,Ft(e,t))}function qt(e,t){return d3.format(",."+Math.max(0,-Math.floor(Math.log(Ft(e,t)[2])/Math.LN10+.01))+"f")}function Rt(e,t,n,r){var i=n(e[0],e[1]),s=r(t[0],t[1]);return function(e){return s(i(e))}}function Ut(e,t,n,r){var i=[],s=[],o=0,u=Math.min(e.length,t.length)-1;e[u]0;f--)i.push(r(s)*f)}else{for(;sa;o--);i=i.slice(s,o)}return i},n.tickFormat=function(e,i){arguments.length<2&&(i=qs);if(arguments.length<1)return i;var s=Math.max(.1,e/n.ticks().length),o=t===Xt?(u=-1e-12,Math.floor):(u=1e-12,Math.ceil),u;return function(e){return e/r(o(t(e)+u))<=s?i(e):""}},n.copy=function(){return zt(e.copy(),t)},Bt(n,e)}function Wt(e){return Math.log(e<0?0:e)/Math.LN10}function Xt(e){return-Math.log(e>0?0:-e)/Math.LN10}function Vt(e,t){function n(t){return e(r(t))}var r=$t(t),i=$t(1/t);return n.invert=function(t){return i(e.invert(t))},n.domain=function(t){return arguments.length?(e.domain(t.map(r)),n):e.domain().map(i)},n.ticks=function(e){return It(n.domain(),e)},n.tickFormat=function(e){return qt(n.domain(),e)},n.nice=function(){return n.domain(Dt(n.domain(),jt))},n.exponent=function(e){if(!arguments.length)return t;var s=n.domain();return r=$t(t=e),i=$t(1/t),n.domain(s)},n.copy=function(){return Vt(e.copy(),t)},Bt(n,e)}function $t(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Jt(e,t){function n(t){return o[((s.get(t)||s.set(t,e.push(t)))-1)%o.length]}function i(t,n){return d3.range(e.length).map(function(e){return t+n*e})}var s,o,u;return n.domain=function(i){if(!arguments.length)return e;e=[],s=new r;var o=-1,u=i.length,a;while(++o1){u=t[1],s=e[a],a++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1];for(var f=2;f9&&(s=n*3/Math.sqrt(s),o[u]=s*r,o[u+1]=s*i));u=-1;while(++u<=a)s=(e[Math.min(a,u+1)][0]-e[Math.max(0,u-1)][0])/(6*(1+o[u]*o[u])),t.push([s||0,o[u]*s||0]);return t}function Nn(e){return e.length<3?un(e):e[0]+dn(e,Tn(e))}function Cn(e){var t,n=-1,r=e.length,i,s;while(++n1){var r=Mt(e.domain()),i,s=-1,o=t.length,u=(t[1]-t[0])/++n,a,f;while(++s0;)(f=+t[s]-a*u)>=r[0]&&i.push(f);for(--s,a=0;++ar&&(n=t,r=i);return n}function ir(e){return e.reduce(sr,0)}function sr(e,t){return e+t[1]}function or(e,t){return ur(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function ur(e,t){var n=-1,r=+e[0],i=(e[1]-r)/t,s=[];while(++n<=t)s[n]=i*n+r;return s}function ar(e){return[d3.min(e),d3.max(e)]}function fr(e,t){return d3.rebind(e,t,"sort","children","value"),e.links=pr,e.nodes=function(t){return uo=!0,(e.nodes=e)(t)},e}function lr(e){return e.children}function cr(e){return e.value}function hr(e,t){return t.value-e.value}function pr(e){return d3.merge(e.map(function(e){return(e.children||[]).map(function(t){return{source:e,target:t}})}))}function dr(e,t){return e.value-t.value}function vr(e,t){var n=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=n,n._pack_prev=t}function mr(e,t){e._pack_next=t,t._pack_prev=e}function gr(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return i*i-n*n-r*r>.001}function yr(e){function t(e){r=Math.min(e.x-e.r,r),i=Math.max(e.x+e.r,i),s=Math.min(e.y-e.r,s),o=Math.max(e.y+e.r,o)}if(!(n=e.children)||!(p=n.length))return;var n,r=Infinity,i=-Infinity,s=Infinity,o=-Infinity,u,a,f,l,c,h,p;n.forEach(br),u=n[0],u.x=-u.r,u.y=0,t(u);if(p>1){a=n[1],a.x=a.r,a.y=0,t(a);if(p>2){f=n[2],Sr(u,a,f),t(f),vr(u,f),u._pack_prev=f,vr(f,a),a=u._pack_next;for(l=3;l0&&(e=r)}return e}function Mr(e,t){return e.x-t.x}function _r(e,t){return t.x-e.x}function Dr(e,t){return e.depth-t.depth}function Pr(e,t){function n(e,r){var i=e.children;if(i&&(a=i.length)){var s,o=null,u=-1,a;while(++u=0)s=r[i]._tree,s.prelim+=t,s.mod+=t,t+=s.shift+(n+=s.change)}function Br(e,t,n){e=e._tree,t=t._tree;var r=n/(t.number-e.number);e.change+=r,t.change-=r,t.shift+=n,t.prelim+=n,t.mod+=n}function jr(e,t,n){return e._tree.ancestor.parent==t.parent?e._tree.ancestor:n}function Fr(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function Ir(e,t){var n=e.x+t[3],r=e.y+t[0],i=e.dx-t[1]-t[3],s=e.dy-t[0]-t[2];return i<0&&(n+=i/2,i=0),s<0&&(r+=s/2,s=0),{x:n,y:r,dx:i,dy:s}}function qr(e,t){function n(e,r){d3.text(e,t,function(e){r(e&&n.parse(e))})}function r(t){return t.map(i).join(e)}function i(e){return o.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}var s=new RegExp("\r\n|["+e+"\r\n]","g"),o=new RegExp('["'+e+"\n]"),u=e.charCodeAt(0);return n.parse=function(e){var t;return n.parseRows(e,function(e,n){if(n){var r={},i=-1,s=t.length;while(++i=e.length)return i;if(l)return l=!1,r;var t=s.lastIndex;if(e.charCodeAt(t)===34){var n=t;while(n++0}function ii(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function si(e,t,n,r){var i=e[0],s=t[0],o=n[0],u=r[0],a=e[1],f=t[1],l=n[1],c=r[1],h=i-o,p=s-i,d=u-o,v=a-l,m=f-a,g=c-l,y=(d*v-g*h)/(g*p-d*m);return[i+y*p,a+y*m]}function oi(e,t){var n={list:e.map(function(e,t){return{index:t,x:e[0],y:e[1]}}).sort(function(e,t){return e.yt.y?1:e.xt.x?1:0}),bottomSite:null},r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,"l"),r.rightEnd=r.createHalfEdge(null,"l"),r.leftEnd.r=r.rightEnd,r.rightEnd.l=r.leftEnd,r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(e,t){return{edge:e,side:t,vertex:null,l:null,r:null}},insert:function(e,t){t.l=e,t.r=e.r,e.r.l=t,e.r=t},leftBound:function(e){var t=r.leftEnd;do t=t.r;while(t!=r.rightEnd&&i.rightOf(t,e));return t=t.l,t},del:function(e){e.l.r=e.r,e.r.l=e.l,e.edge=null},right:function(e){return e.r},left:function(e){return e.l},leftRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[e.side]},rightRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[ho[e.side]]}},i={bisect:function(e,t){var n={region:{l:e,r:t},ep:{l:null,r:null}},r=t.x-e.x,i=t.y-e.y,s=r>0?r:-r,o=i>0?i:-i;return n.c=e.x*r+e.y*i+(r*r+i*i)*.5,s>o?(n.a=1,n.b=i/r,n.c/=r):(n.b=1,n.a=r/i,n.c/=i),n},intersect:function(e,t){var n=e.edge,r=t.edge;if(!n||!r||n.region.r==r.region.r)return null;var i=n.a*r.b-n.b*r.a;if(Math.abs(i)<1e-10)return null;var s=(n.c*r.b-r.c*n.b)/i,o=(r.c*n.a-n.c*r.a)/i,u=n.region.r,a=r.region.r,f,l;u.y=l.region.r.x;return c&&f.side==="l"||!c&&f.side==="r"?null:{x:s,y:o}},rightOf:function(e,t){var n=e.edge,r=n.region.r,i=t.x>r.x;if(i&&e.side==="l")return 1;if(!i&&e.side==="r")return 0;if(n.a===1){var s=t.y-r.y,o=t.x-r.x,u=0,a=0;!i&&n.b<0||i&&n.b>=0?a=u=s>=n.b*o:(a=t.x+t.y*n.b>n.c,n.b<0&&(a=!a),a||(u=1));if(!u){var f=r.x-n.region.l.x;a=n.b*(o*o-s*s)h*h+p*p}return e.side==="l"?a:!a},endPoint:function(e,n,r){e.ep[n]=r;if(!e.ep[ho[n]])return;t(e)},distance:function(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}},s={list:[],insert:function(e,t,n){e.vertex=t,e.ystar=t.y+n;for(var r=0,i=s.list,o=i.length;ru.ystar||e.ystar==u.ystar&&t.x>u.vertex.x)continue;break}i.splice(r,0,e)},del:function(e){for(var t=0,n=s.list,r=n.length;td.y&&(v=p,p=d,d=v,b="r"),y=i.bisect(p,d),h=r.createHalfEdge(y,b),r.insert(l,h),i.endPoint(y,ho[b],g),m=i.intersect(l,h),m&&(s.del(l),s.insert(l,m,i.distance(m,p))),m=i.intersect(h,c),m&&s.insert(h,m,i.distance(m,p))}}for(a=r.right(r.leftEnd);a!=r.rightEnd;a=r.right(a))t(a.edge)}function ui(){return{leaf:!0,nodes:[],point:null}}function ai(e,t,n,r,i,s){if(!e(t,n,r,i,s)){var o=(n+i)*.5,u=(r+s)*.5,a=t.nodes;a[0]&&ai(e,a[0],n,r,o,u),a[1]&&ai(e,a[1],o,r,i,u),a[2]&&ai(e,a[2],n,u,o,s),a[3]&&ai(e,a[3],o,u,i,s)}}function fi(e){return{x:e[0],y:e[1]}}function li(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function ci(e){return e.substring(0,3)}function hi(e,t,n,r){var i,s,o=0,u=t.length,a=n.length;while(o=a)return-1;i=t.charCodeAt(o++);if(i==37){s=Ho[t.charAt(o++)];if(!s||(r=s(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function pi(e){return new RegExp("^(?:"+e.map(d3.requote).join("|")+")","i")}function di(e){var t=new r,n=-1,i=e.length;while(++n68?1900:2e3)}function Ni(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.m=r[0]-1,n+=r[0].length):-1}function Ci(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.d=+r[0],n+=r[0].length):-1}function ki(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.H=+r[0],n+=r[0].length):-1}function Li(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.M=+r[0],n+=r[0].length):-1}function Ai(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+2));return r?(e.S=+r[0],n+=r[0].length):-1}function Oi(e,t,n){Bo.lastIndex=0;var r=Bo.exec(t.substring(n,n+3));return r?(e.L=+r[0],n+=r[0].length):-1}function Mi(e,t,n){var r=jo.get(t.substring(n,n+=2).toLowerCase());return r==null?-1:(e.p=r,n)}function _i(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=~~(Math.abs(t)/60),i=Math.abs(t)%60;return n+To(r)+To(i)}function Di(e){return e.toISOString()}function Pi(e,t,n){function r(t){var n=e(t),r=s(n,1);return t-n1)while(ot?1:e>=t?0:NaN},d3.descending=function(e,t){return te?1:t>=e?0:NaN},d3.mean=function(e,t){var n=e.length,r,i=0,s=-1,o=0;if(arguments.length===1)while(++s1&&(e=e.map(t)),e=e.filter(f),e.length?d3.quantile(e.sort(d3.ascending),.5):undefined},d3.min=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++ns&&(i=s)}else{while(++ns&&(i=s)}return i},d3.max=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++ni&&(i=s)}else{while(++ni&&(i=s)}return i},d3.extent=function(e,t){var n=-1,r=e.length,i,s,o;if(arguments.length===1){while(++ns&&(i=s),os&&(i=s),o1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(e,t){var n=arguments.length;n<2&&(t=1),n<1&&(e=0);var r=d3.random.normal();return function(){return Math.exp(e+t*r())}},irwinHall:function(e){return function(){for(var t=0,n=0;n>>1;e.call(t,t[s],s)>>1;n0&&(i=s);return i},d3.last=function(e,t){var n=0,r=e.length,i=e[0],s;arguments.length===1&&(t=d3.ascending);while(++n=i.length)return u?u.call(n,t):o?t.sort(o):t;var a=-1,f=t.length,l=i[s++],c,h,p=new r,d,v={};while(++a=i.length)return e;var r=[],o=s[n++],u;for(u in e)r.push({key:u,values:t(e[u],n)});return o&&r.sort(function(e,t){return o(e.key,t.key)}),r}var n={},i=[],s=[],o,u;return n.map=function(t){return e(t,0)},n.entries=function(n){return t(e(n,0),0)},n.key=function(e){return i.push(e),n},n.sortKeys=function(e){return s[i.length-1]=e,n},n.sortValues=function(e){return o=e,n},n.rollup=function(e){return u=e,n},n},d3.keys=function(e){var t=[];for(var n in e)t.push(n);return t},d3.values=function(e){var t=[];for(var n in e)t.push(e[n]);return t},d3.entries=function(e){var t=[];for(var n in e)t.push({key:n,value:e[n]});return t},d3.permute=function(e,t){var n=[],r=-1,i=t.length;while(++rt)r.push(o/i);else while((o=e+n*++s)=200&&e<300||e===304?r:null)}},r.send(null)},d3.text=function(e,t,n){function r(e){n(e&&e.responseText)}arguments.length<3&&(n=t,t=null),d3.xhr(e,t,r)},d3.json=function(e,t){d3.text(e,"application/json",function(e){t(e?JSON.parse(e):null)})},d3.html=function(e,t){d3.text(e,"text/html",function(e){if(e!=null){var n=document.createRange();n.selectNode(document.body),e=n.createContextualFragment(e)}t(e)})},d3.xml=function(e,t,n){function r(e){n(e&&e.responseXML)}arguments.length<3&&(n=t,t=null),d3.xhr(e,t,r)};var es={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};d3.ns={prefix:es,qualify:function(e){var t=e.indexOf(":"),n=e;return t>=0&&(n=e.substring(0,t),e=e.substring(t+1)),es.hasOwnProperty(n)?{space:es[n],local:e}:e}},d3.dispatch=function(){var e=new d,t=-1,n=arguments.length;while(++t0&&(r=e.substring(n+1),e=e.substring(0,n)),arguments.length<2?this[e].on(r):this[e].on(r,t)},d3.format=function(e){var t=ts.exec(e),n=t[1]||" ",r=t[3]||"",i=t[5],s=+t[6],o=t[7],u=t[8],a=t[9],f=1,l="",c=!1;u&&(u=+u.substring(1)),i&&(n="0",o&&(s-=Math.floor((s-1)/4)));switch(a){case"n":o=!0,a="g";break;case"%":f=100,l="%",a="f";break;case"p":f=100,l="%",a="r";break;case"d":c=!0,u=0;break;case"s":f=-1,a="r"}return a=="r"&&!u&&(a="g"),a=ns.get(a)||g,function(e){if(c&&e%1)return"";var t=e<0&&(e=-e)?"-":r;if(f<0){var h=d3.formatPrefix(e,u);e=h.scale(e),l=h.symbol}else e*=f;e=a(e,u);if(i){var p=e.length+t.length;p=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,ns=d3.map({g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(e,t){return d3.round(e,t=m(e,t)).toFixed(Math.max(0,Math.min(20,t)))}}),rs=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(b);d3.formatPrefix=function(e,t){var n=0;return e&&(e<0&&(e*=-1),t&&(e=d3.round(e,m(e,t))),n=1+Math.floor(1e-12+Math.log(e)/Math.LN10),n=Math.max(-24,Math.min(24,Math.floor((n<=0?n+1:n-1)/3)*3))),rs[8+n/3]};var is=T(2),ss=T(3),os=function(){return x},us=d3.map({linear:os,poly:T,quad:function(){return is},cubic:function(){return ss},sin:function(){return N},exp:function(){return C},circle:function(){return k},elastic:L,back:A,bounce:function(){return O}}),as=d3.map({"in":x,out:E,"in-out":S,"out-in":function(e){return S(E(e))}});d3.ease=function(e){var t=e.indexOf("-"),n=t>=0?e.substring(0,t):e,r=t>=0?e.substring(t+1):"in";return n=us.get(n)||os,r=as.get(r)||x,w(r(n.apply(null,Array.prototype.slice.call(arguments,1))))},d3.event=null,d3.transform=function(e){var t=document.createElementNS(d3.ns.prefix.svg,"g");return(d3.transform=function(e){t.setAttribute("transform",e);var n=t.transform.baseVal.consolidate();return new P(n?n.matrix:ls)})(e)},P.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var fs=180/Math.PI,ls={a:1,b:0,c:0,d:1,e:0,f:0};d3.interpolate=function(e,t){var n=d3.interpolators.length,r;while(--n>=0&&!(r=d3.interpolators[n](e,t)));return r},d3.interpolateNumber=function(e,t){return t-=e,function(n){return e+t*n}},d3.interpolateRound=function(e,t){return t-=e,function(n){return Math.round(e+t*n)}},d3.interpolateString=function(e,t){var n,r,i,s=0,o=0,u=[],a=[],f,l;cs.lastIndex=0;for(r=0;n=cs.exec(t);++r)n.index&&u.push(t.substring(s,o=n.index)),a.push({i:u.length,x:n[0]}),u.push(null),s=cs.lastIndex;s180?l+=360:l-f>180&&(f+=360),r.push({i:n.push(n.pop()+"rotate(",null,")")-2,x:d3.interpolateNumber(f,l)})):l&&n.push(n.pop()+"rotate("+l+")"),c!=h?r.push({i:n.push(n.pop()+"skewX(",null,")")-2,x:d3.interpolateNumber(c,h)}):h&&n.push(n.pop()+"skewX("+h+")"),p[0]!=d[0]||p[1]!=d[1]?(i=n.push(n.pop()+"scale(",null,",",null,")"),r.push({i:i-4,x:d3.interpolateNumber(p[0],d[0])},{i:i-2,x:d3.interpolateNumber(p[1],d[1])})):(d[0]!=1||d[1]!=1)&&n.push(n.pop()+"scale("+d+")"),i=r.length,function(e){var t=-1,s;while(++t180?s-=360:s<-180&&(s+=360),function(e){return G(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateLab=function(e,t){e=d3.lab(e),t=d3.lab(t);var n=e.l,r=e.a,i=e.b,s=t.l-n,o=t.a-r,u=t.b-i;return function(e){return rt(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateHcl=function(e,t){e=d3.hcl(e),t=d3.hcl(t);var n=e.h,r=e.c,i=e.l,s=t.h-n,o=t.c-r,u=t.l-i;return s>180?s-=360:s<-180&&(s+=360),function(e){return et(n+s*e,r+o*e,i+u*e)+""}},d3.interpolateArray=function(e,t){var n=[],r=[],i=e.length,s=t.length,o=Math.min(e.length,t.length),u;for(u=0;u=0;)if(s=n[r])i&&i!==s.nextSibling&&i.parentNode.insertBefore(s,i),i=s;return this},Ss.sort=function(e){e=bt.apply(this,arguments);for(var t=-1,n=this.length;++t=Vs?e?"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"M0,"+e+"A"+e+","+e+" 0 1,0 0,"+ -e+"A"+e+","+e+" 0 1,0 0,"+e+"Z":"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"Z":e?"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L"+e*h+","+e*p+"A"+e+","+e+" 0 "+f+",0 "+e*l+","+e*c+"Z":"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L0,0"+"Z"}var t=Zt,n=en,r=tn,i=nn;return e.innerRadius=function(n){return arguments.length?(t=u(n),e):t},e.outerRadius=function(t){return arguments.length?(n=u(t),e):n},e.startAngle=function(t){return arguments.length?(r=u(t),e):r},e.endAngle=function(t){return arguments.length?(i=u(t),e):i},e.centroid=function(){var e=(t.apply(this,arguments)+n.apply(this,arguments))/2,s=(r.apply(this,arguments)+i.apply(this,arguments))/2+Xs;return[Math.cos(s)*e,Math.sin(s)*e]},e};var Xs=-Math.PI/2,Vs=2*Math.PI-1e-6;d3.svg.line=function(){return rn(i)};var $s=d3.map({linear:un,"linear-closed":an,"step-before":fn,"step-after":ln,basis:mn,"basis-open":gn,"basis-closed":yn,bundle:bn,cardinal:pn,"cardinal-open":cn,"cardinal-closed":hn,monotone:Nn});$s.forEach(function(e,t){t.key=e,t.closed=/-closed$/.test(e)});var Js=[0,2/3,1/3,0],Ks=[0,1/3,2/3,0],Qs=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var e=rn(Cn);return e.radius=e.x,delete e.x,e.angle=e.y,delete e.y,e},fn.reverse=ln,ln.reverse=fn,d3.svg.area=function(){return kn(i)},d3.svg.area.radial=function(){var e=kn(Cn);return e.radius=e.x,delete e.x,e.innerRadius=e.x0,delete e.x0,e.outerRadius=e.x1,delete e.x1,e.angle=e.y,delete e.y,e.startAngle=e.y0,delete e.y0,e.endAngle=e.y1,delete e.y1,e},d3.svg.chord=function(){function e(e,u){var a=t(this,s,e,u),f=t(this,o,e,u);return"M"+a.p0+r(a.r,a.p1,a.a1-a.a0)+(n(a,f)?i(a.r,a.p1,a.r,a.p0):i(a.r,a.p1,f.r,f.p0)+r(f.r,f.p1,f.a1-f.a0)+i(f.r,f.p1,a.r,a.p0))+"Z"}function t(e,t,n,r){var i=t.call(e,n,r),s=a.call(e,i,r),o=f.call(e,i,r)+Xs,u=l.call(e,i,r)+Xs;return{r:s,a0:o,a1:u,p0:[s*Math.cos(o),s*Math.sin(o)],p1:[s*Math.cos(u),s*Math.sin(u)]}}function n(e,t){return e.a0==t.a0&&e.a1==t.a1}function r(e,t,n){return"A"+e+","+e+" 0 "+ +(n>Math.PI)+",1 "+t}function i(e,t,n,r){return"Q 0,0 "+r}var s=Ln,o=An,a=On,f=tn,l=nn;return e.radius=function(t){return arguments.length?(a=u(t),e):a},e.source=function(t){return arguments.length?(s=u(t),e):s},e.target=function(t){return arguments.length?(o=u(t),e):o},e.startAngle=function(t){return arguments.length?(f=u(t),e):f},e.endAngle=function(t){return arguments.length?(l=u(t),e):l},e},d3.svg.diagonal=function(){function e(e,i){var s=t.call(this,e,i),o=n.call(this,e,i),u=(s.y+o.y)/2,a=[s,{x:s.x,y:u},{x:o.x,y:u},o];return a=a.map(r),"M"+a[0]+"C"+a[1]+" "+a[2]+" "+a[3]}var t=Ln,n=An,r=Dn;return e.source=function(n){return arguments.length?(t=u(n),e):t},e.target=function(t){return arguments.length?(n=u(t),e):n},e.projection=function(t){return arguments.length?(r=t,e):r},e},d3.svg.diagonal.radial=function(){var e=d3.svg.diagonal(),t=Dn,n=e.projection;return e.projection=function(e){return arguments.length?n(Pn(t=e)):t},e},d3.svg.mouse=d3.mouse,d3.svg.touches=d3.touches,d3.svg.symbol=function(){function e(e,r){return(Gs.get(t.call(this,e,r))||jn)(n.call(this,e,r))}var t=Bn,n=Hn;return e.type=function(n){return arguments.length?(t=u(n),e):t},e.size=function(t){return arguments.length?(n=u(t),e):n},e};var Gs=d3.map({circle:jn,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+ -3*t+","+ -t+"H"+ -t+"V"+ -3*t+"H"+t+"V"+ -t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+ -t+"V"+t+"H"+ -3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*Zs)),n=t*Zs;return"M0,"+ -t+"L"+n+",0"+" 0,"+t+" "+ -n+",0"+"Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+ -t+","+ -t+"L"+t+","+ -t+" "+t+","+t+" "+ -t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/Ys),n=t*Ys/2;return"M0,"+n+"L"+t+","+ -n+" "+ -t+","+ -n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/Ys),n=t*Ys/2;return"M0,"+ -n+"L"+t+","+n+" "+ -t+","+n+"Z"}});d3.svg.symbolTypes=Gs.keys();var Ys=Math.sqrt(3),Zs=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function e(e){e.each(function(){var e=d3.select(this),c=a==null?t.ticks?t.ticks.apply(t,u):t.domain():a,h=f==null?t.tickFormat?t.tickFormat.apply(t,u):String:f,p=qn(t,c,l),d=e.selectAll(".minor").data(p,String),v=d.enter().insert("line","g").attr("class","tick minor").style("opacity",1e-6),m=d3.transition(d.exit()).style("opacity",1e-6).remove(),g=d3.transition(d).style("opacity",1),y=e.selectAll("g").data(c,String),b=y.enter().insert("g","path").style("opacity",1e-6),w=d3.transition(y.exit()).style("opacity",1e-6).remove(),E=d3.transition(y).style("opacity",1),S,x=_t(t),T=e.selectAll(".domain").data([0]),N=T.enter().append("path").attr("class","domain"),C=d3.transition(T),k=t.copy(),L=this.__chart__||k;this.__chart__=k,b.append("line").attr("class","tick"),b.append("text");var A=b.select("line"),O=E.select("line"),M=y.select("text").text(h),_=b.select("text"),D=E.select("text");switch(n){case"bottom":S=Fn,v.attr("y2",i),g.attr("x2",0).attr("y2",i),A.attr("y2",r),_.attr("y",Math.max(r,0)+o),O.attr("x2",0).attr("y2",r),D.attr("x",0).attr("y",Math.max(r,0)+o),M.attr("dy",".71em").attr("text-anchor","middle"),C.attr("d","M"+x[0]+","+s+"V0H"+x[1]+"V"+s);break;case"top":S=Fn,v.attr("y2",-i),g.attr("x2",0).attr("y2",-i),A.attr("y2",-r),_.attr("y",-(Math.max(r,0)+o)),O.attr("x2",0).attr("y2",-r),D.attr("x",0).attr("y",-(Math.max(r,0)+o)),M.attr("dy","0em").attr("text-anchor","middle"),C.attr("d","M"+x[0]+","+ -s+"V0H"+x[1]+"V"+ -s);break;case"left":S=In,v.attr("x2",-i),g.attr("x2",-i).attr("y2",0),A.attr("x2",-r),_.attr("x",-(Math.max(r,0)+o)),O.attr("x2",-r).attr("y2",0),D.attr("x",-(Math.max(r,0)+o)).attr("y",0),M.attr("dy",".32em").attr("text-anchor","end"),C.attr("d","M"+ -s+","+x[0]+"H0V"+x[1]+"H"+ -s);break;case"right":S=In,v.attr("x2",i),g.attr("x2",i).attr("y2",0),A.attr("x2",r),_.attr("x",Math.max(r,0)+o),O.attr("x2",r).attr("y2",0),D.attr("x",Math.max(r,0)+o).attr("y",0),M.attr("dy",".32em").attr("text-anchor","start"),C.attr("d","M"+s+","+x[0]+"H0V"+x[1]+"H"+s)}if(t.ticks)b.call(S,L),E.call(S,k),w.call(S,k),v.call(S,L),g.call(S,k),m.call(S,k);else{var P=k.rangeBand()/2,H=function(e){return k(e)+P};b.call(S,H),E.call(S,H)}})}var t=d3.scale.linear(),n="bottom",r=6,i=6,s=6,o=3,u=[10],a=null,f,l=0;return e.scale=function(n){return arguments.length?(t=n,e):t},e.orient=function(t){return arguments.length?(n=t,e):n},e.ticks=function(){return arguments.length?(u=arguments,e):u},e.tickValues=function(t){return arguments.length?(a=t,e):a},e.tickFormat=function(t){return arguments.length?(f=t,e):f},e.tickSize=function(t,n,o){if(!arguments.length)return r;var u=arguments.length-1;return r=+t,i=u>1?+n:r,s=u>0?+arguments[u]:r,e},e.tickPadding=function(t){return arguments.length?(o=+t,e):o},e.tickSubdivide=function(t){return arguments.length?(l=+t,e):l},e},d3.svg.brush=function(){function e(s){s.each(function(){var s=d3.select(this),f=s.selectAll(".background").data([0]),l=s.selectAll(".extent").data([0]),c=s.selectAll(".resize").data(a,String),h;s.style("pointer-events","all").on("mousedown.brush",i).on("touchstart.brush",i),f.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),l.enter().append("rect").attr("class","extent").style("cursor","move"),c.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return eo[e]}).append("rect").attr("x",function(e){return/[ew]$/.test(e)?-3:null}).attr("y",function(e){return/^[ns]/.test(e)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),c.style("display",e.empty()?"none":null),c.exit().remove(),o&&(h=_t(o),f.attr("x",h[0]).attr("width",h[1]-h[0]),n(s)),u&&(h=_t(u),f.attr("y",h[0]).attr("height",h[1]-h[0]),r(s)),t(s)})}function t(e){e.selectAll(".resize").attr("transform",function(e){return"translate("+f[+/e$/.test(e)][0]+","+f[+/^s/.test(e)][1]+")"})}function n(e){e.select(".extent").attr("x",f[0][0]),e.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1][0]-f[0][0])}function r(e){e.select(".extent").attr("y",f[0][1]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1][1]-f[0][1])}function i(){function i(){var e=d3.event.changedTouches;return e?d3.touches(v,e)[0]:d3.mouse(v)}function a(){d3.event.keyCode==32&&(S||(x=null,T[0]-=f[1][0],T[1]-=f[1][1],S=2),M())}function c(){d3.event.keyCode==32&&S==2&&(T[0]+=f[1][0],T[1]+=f[1][1],S=0,M())}function h(){var e=i(),s=!1;N&&(e[0]+=N[0],e[1]+=N[1]),S||(d3.event.altKey?(x||(x=[(f[0][0]+f[1][0])/2,(f[0][1]+f[1][1])/2]),T[0]=f[+(e[0]0?a=e:a=0:e>0&&(r.start({type:"start",alpha:a=e}),d3.timer(n.tick)),n):a},n.start=function(){function e(e,n){var i=t(r),s=-1,o=i.length,u;while(++si&&(i=u),r.push(u)}for(o=0;o0){s=-1;while(++s=a[0]&&d<=a[1]&&(l=o[d3.bisect(f,d,1,h)-1],l.y+=p,l.push(e[s]))}return o}var t=!0,n=Number,r=ar,i=or;return e.value=function(t){return arguments.length?(n=t,e):n},e.range=function(t){return arguments.length?(r=u(t),e):r},e.bins=function(t){return arguments.length?(i=typeof t=="number"?function(e){return ur(e,t)}:u(t),e):i},e.frequency=function(n){return arguments.length?(t=!!n,e):t},e},d3.layout.hierarchy=function(){function e(t,o,u){var a=i.call(n,t,o),f=uo?t:{data:t};f.depth=o,u.push(f);if(a&&(c=a.length)){var l=-1,c,h=f.children=[],p=0,d=o+1,v;while(++l0){var l=n*f/2;Pr(o,function(e){e.r+=l}),Pr(o,yr),Pr(o,function(e){e.r-=l}),f=Math.max(2*o.r/u,2*o.r/a)}return Er(o,u/2,a/2,1/f),s}var t=d3.layout.hierarchy().sort(dr),n=0,r=[1,1];return e.size=function(t){return arguments.length?(r=t,e):r},e.padding=function(t){return arguments.length?(n=+t,e):n},fr(e,t)},d3.layout.cluster=function(){function e(e,i){var s=t.call(this,e,i),o=s[0],u,a=0,f,l;Pr(o,function(e){var t=e.children;t&&t.length?(e.x=Tr(t),e.y=xr(t)):(e.x=u?a+=n(e,u):0,e.y=0,u=e)});var c=Nr(o),h=Cr(o),p=c.x-n(c,h)/2,d=h.x+n(h,c)/2;return Pr(o,function(e){e.x=(e.x-p)/(d-p)*r[0],e.y=(1-(o.y?e.y/o.y:1))*r[1]}),s}var t=d3.layout.hierarchy().sort(null).value(null),n=kr,r=[1,1];return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(r=t,e):r},fr(e,t)},d3.layout.tree=function(){function e(e,i){function s(e,t){var r=e.children,i=e._tree;if(r&&(o=r.length)){var o,a=r[0],f,l=a,c,h=-1;while(++h0&&(Br(jr(o,e,r),e,h),a+=h,f+=h),l+=o._tree.mod,a+=i._tree.mod,c+=u._tree.mod,f+=s._tree.mod;o&&!Ar(s)&&(s._tree.thread=o,s._tree.mod+=l-f),i&&!Lr(u)&&(u._tree.thread=i,u._tree.mod+=a-c,r=e)}return r}var a=t.call(this,e,i),f=a[0];Pr(f,function(e,t){e._tree={ancestor:e,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}}),s(f),o(f,-f._tree.prelim);var l=Or(f,_r),c=Or(f,Mr),h=Or(f,Dr),p=l.x-n(l,c)/2,d=c.x+n(c,l)/2,v=h.depth||1;return Pr(f,function(e){e.x=(e.x-p)/(d-p)*r[0],e.y=e.depth/v*r[1],delete e._tree}),a}var t=d3.layout.hierarchy().sort(null).value(null),n=kr,r=[1,1];return e.separation=function(t){return arguments.length?(n=t,e):n},e.size=function(t){return arguments.length?(r=t,e):r},fr(e,t)},d3.layout.treemap=function(){function e(e,t){var n=-1,r=e.length,i,s;while(++n0)u.push(f=a[d-1]),u.area+=f.area,(h=r(u,p))<=c?(a.pop(),c=h):(u.area-=u.pop().area,i(u,p,o,!1),p=Math.min(o.dx,o.dy),u.length=u.area=0,c=Infinity);u.length&&(i(u,p,o,!0),u.length=u.area=0),s.forEach(t)}}function n(t){var r=t.children;if(r&&r.length){var s=l(t),o=r.slice(),u,a=[];e(o,s.dx*s.dy/t.value),a.area=0;while(u=o.pop())a.push(u),a.area+=u.area,u.z!=null&&(i(a,u.z?s.dx:s.dy,s,!o.length),a.length=a.area=0);r.forEach(n)}}function r(e,t){var n=e.area,r,i=0,s=Infinity,o=-1,u=e.length;while(++oi&&(i=r)}return n*=n,t*=t,n?Math.max(t*i*p/n,n/(t*s*p)):Infinity}function i(e,t,n,r){var i=-1,s=e.length,o=n.x,a=n.y,f=t?u(e.area/t):0,l;if(t==n.dx){if(r||f>n.dy)f=n.dy;while(++in.dx)f=n.dx;while(++i50?n:s<-140?r:o<21?i:t)(e)}var t=d3.geo.albers(),n=d3.geo.albers().origin([-160,60]).parallels([55,65]),r=d3.geo.albers().origin([-160,20]).parallels([8,18]),i=d3.geo.albers().origin([-60,10]).parallels([8,18]);return e.scale=function(s){return arguments.length?(t.scale(s),n.scale(s*.6),r.scale(s),i.scale(s*1.5),e.translate(t.translate())):t.scale()},e.translate=function(s){if(!arguments.length)return t.translate();var o=t.scale()/1e3,u=s[0],a=s[1];return t.translate(s),n.translate([u-400*o,a+170*o]),r.translate([u-190*o,a+200*o]),i.translate([u+580*o,a+430*o]),e},e.scale(t.scale())},d3.geo.bonne=function(){function e(e){var u=e[0]*ao-r,a=e[1]*ao-i;if(s){var f=o+s-a,l=u*Math.cos(a)/f;u=f*Math.sin(l),a=f*Math.cos(l)-o}else u*=Math.cos(a),a*=-1;return[t*u+n[0],t*a+n[1]]}var t=200,n=[480,250],r,i,s,o;return e.invert=function(e){var i=(e[0]-n[0])/t,u=(e[1]-n[1])/t;if(s){var a=o+u,f=Math.sqrt(i*i+a*a);u=o+s-f,i=r+f*Math.atan2(i,a)/Math.cos(u)}else u*=-1,i/=Math.cos(u);return[i/ao,u/ao]},e.parallel=function(t){return arguments.length?(o=1/Math.tan +(s=t*ao),e):s/ao},e.origin=function(t){return arguments.length?(r=t[0]*ao,i=t[1]*ao,e):[r/ao,i/ao]},e.scale=function(n){return arguments.length?(t=+n,e):t},e.translate=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e.origin([0,0]).parallel(45)},d3.geo.equirectangular=function(){function e(e){var r=e[0]/360,i=-e[1]/360;return[t*r+n[0],t*i+n[1]]}var t=500,n=[480,250];return e.invert=function(e){var r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return[360*r,-360*i]},e.scale=function(n){return arguments.length?(t=+n,e):t},e.translate=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e},d3.geo.mercator=function(){function e(e){var r=e[0]/360,i=-(Math.log(Math.tan(Math.PI/4+e[1]*ao/2))/ao)/360;return[t*r+n[0],t*Math.max(-0.5,Math.min(.5,i))+n[1]]}var t=500,n=[480,250];return e.invert=function(e){var r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return[360*r,2*Math.atan(Math.exp(-360*i*ao))/ao-90]},e.scale=function(n){return arguments.length?(t=+n,e):t},e.translate=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e},d3.geo.path=function(){function e(e,t){typeof s=="function"&&(o=Ur(s.apply(this,arguments))),f(e);var n=a.length?a.join(""):null;return a=[],n}function t(e){return u(e).join(",")}function n(e){var t=i(e[0]),n=0,r=e.length;while(++n0){a.push("M");while(++o0){a.push("M");while(++lr&&(r=e),si&&(i=s)}),[[t,n],[r,i]]};var fo={Feature:Wr,FeatureCollection:Xr,GeometryCollection:Vr,LineString:$r,MultiLineString:Jr,MultiPoint:$r,MultiPolygon:Kr,Point:Qr,Polygon:Gr};d3.geo.circle=function(){function e(){}function t(e){return a.distance(e)=l*l+c*c?r[s].index=-1:(r[h].index=-1,d=r[s].angle,h=s,p=o)):(d=r[s].angle,h=s,p=o);i.push(u);for(s=0,o=0;s<2;++o)r[o].index!==-1&&(i.push(r[o].index),s++);v=i.length;for(;o=0?(n=e.ep.r,r=e.ep.l):(n=e.ep.l,r=e.ep.r),e.a===1?(o=n?n.y:-1e6,i=e.c-e.b*o,u=r?r.y:1e6,s=e.c-e.b*u):(i=n?n.x:-1e6,o=e.c-e.a*i,s=r?r.x:1e6,u=e.c-e.a*s);var a=[i,o],f=[s,u];t[e.region.l.index].push(a,f),t[e.region.r.index].push(a,f)}),t.map(function(t,n){var r=e[n][0],i=e[n][1];return t.forEach(function(e){e.angle=Math.atan2(e[0]-r,e[1]-i)}),t.sort(function(e,t){return e.angle-t.angle}).filter(function(e,n){return!n||e.angle-t[n-1].angle>1e-10})})};var ho={l:"r",r:"l"};d3.geom.delaunay=function(e){var t=e.map(function(){return[]}),n=[];return oi(e,function(n){t[n.region.l.index].push(e[n.region.r.index])}),t.forEach(function(t,r){var i=e[r],s=i[0],o=i[1];t.forEach(function(e){e.angle=Math.atan2(e[0]-s,e[1]-o)}),t.sort(function(e,t){return e.angle-t.angle});for(var u=0,a=t.length-1;u=u,l=t.y>=a,c=(l<<1)+f;e.leaf=!1,e=e.nodes[c]||(e.nodes[c]=ui()),f?n=u:i=u,l?r=a:o=a,s(e,t,n,r,i,o)}var u,a=-1,f=e.length;f&&isNaN(e[0].x)&&(e=e.map(fi));if(arguments.length<5)if(arguments.length===3)i=r=n,n=t;else{t=n=Infinity,r=i=-Infinity;while(++ar&&(r=u.x),u.y>i&&(i=u.y);var l=r-t,c=i-n;l>c?i=n+l:r=t+c}var h=ui();return h.add=function(e){s(h,e,t,n,r,i)},h.visit=function(e){ai(e,h,t,n,r,i)},e.forEach(h.add),h},d3.time={};var po=Date,vo=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];li.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){mo.setUTCDate.apply(this._,arguments)},setDay:function(){mo.setUTCDay.apply(this._,arguments)},setFullYear:function(){mo.setUTCFullYear.apply(this._,arguments)},setHours:function(){mo.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){mo.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){mo.setUTCMinutes.apply(this._,arguments)},setMonth:function(){mo.setUTCMonth.apply(this._,arguments)},setSeconds:function(){mo.setUTCSeconds.apply(this._,arguments)},setTime:function(){mo.setTime.apply(this._,arguments)}};var mo=Date.prototype,go="%a %b %e %H:%M:%S %Y",yo="%m/%d/%y",bo="%H:%M:%S",wo=vo,Eo=wo.map(ci),So=["January","February","March","April","May","June","July","August","September","October","November","December"],xo=So.map(ci);d3.time.format=function(e){function t(t){var r=[],i=-1,s=0,o,u;while(++i=12?"PM":"AM"},S:function(e){return To(e.getSeconds())},U:function(e){return To(d3.time.sundayOfYear(e))},w:function(e){return e.getDay()},W:function(e){return To(d3.time.mondayOfYear(e))},x:d3.time.format(yo),X:d3.time.format(bo),y:function(e){return To(e.getFullYear()%100)},Y:function(e){return Co(e.getFullYear()%1e4)},Z:_i,"%":function(e){return"%"}},Ho={a:vi,A:mi,b:gi,B:yi,c:bi,d:Ci,e:Ci,H:ki,I:ki,L:Oi,m:Ni,M:Li,p:Mi,S:Ai,x:wi,X:Ei,y:xi,Y:Si},Bo=/^\s*\d+/,jo=d3.map({am:0,pm:1});d3.time.format.utc=function(e){function t(e){try{po=li;var t=new po;return t._=e,n(t)}finally{po=Date}}var n=d3.time.format(e);return t.parse=function(e){try{po=li;var t=n.parse(e);return t&&t._}finally{po=Date}},t.toString=n.toString,t};var Fo=d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");d3.time.format.iso=Date.prototype.toISOString?Di:Fo,Di.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Di.toString=Fo.toString,d3.time.second=Pi(function(e){return new po(Math.floor(e/1e3)*1e3)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*1e3)},function(e){return e.getSeconds()}),d3.time.seconds=d3.time.second.range,d3.time.seconds.utc=d3.time.second.utc.range,d3.time.minute=Pi(function(e){return new po(Math.floor(e/6e4)*6e4)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*6e4)},function(e){return e.getMinutes()}),d3.time.minutes=d3.time.minute.range,d3.time.minutes.utc=d3.time.minute.utc.range,d3.time.hour=Pi(function(e){var t=e.getTimezoneOffset()/60;return new po((Math.floor(e/36e5-t)+t)*36e5)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*36e5)},function(e){return e.getHours()}),d3.time.hours=d3.time.hour.range,d3.time.hours.utc=d3.time.hour.utc.range,d3.time.day=Pi(function(e){var t=new po(1970,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t},function(e,t){e.setDate(e.getDate()+t)},function(e){return e.getDate()-1}),d3.time.days=d3.time.day.range,d3.time.days.utc=d3.time.day.utc.range,d3.time.dayOfYear=function(e){var t=d3.time.year(e);return Math.floor((e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5)},vo.forEach(function(e,t){e=e.toLowerCase(),t=7-t;var n=d3.time[e]=Pi(function(e){return(e=d3.time.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e},function(e,t){e.setDate(e.getDate()+Math.floor(t)*7)},function(e){var n=d3.time.year(e).getDay();return Math.floor((d3.time.dayOfYear(e)+(n+t)%7)/7)-(n!==t)});d3.time[e+"s"]=n.range,d3.time[e+"s"].utc=n.utc.range,d3.time[e+"OfYear"]=function(e){var n=d3.time.year(e).getDay();return Math.floor((d3.time.dayOfYear(e)+(n+t)%7)/7)}}),d3.time.week=d3.time.sunday,d3.time.weeks=d3.time.sunday.range,d3.time.weeks.utc=d3.time.sunday.utc.range,d3.time.weekOfYear=d3.time.sundayOfYear,d3.time.month=Pi(function(e){return e=d3.time.day(e),e.setDate(1),e},function(e,t){e.setMonth(e.getMonth()+t)},function(e){return e.getMonth()}),d3.time.months=d3.time.month.range,d3.time.months.utc=d3.time.month.utc.range,d3.time.year=Pi(function(e){return e=d3.time.day(e),e.setMonth(0,1),e},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e){return e.getFullYear()}),d3.time.years=d3.time.year.range,d3.time.years.utc=d3.time.year.utc.range;var Io=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],qo=[[d3.time.second,1],[d3.time.second,5],[d3.time.second,15],[d3.time.second,30],[d3.time.minute,1],[d3.time.minute,5],[d3.time.minute,15],[d3.time.minute,30],[d3.time.hour,1],[d3.time.hour,3],[d3.time.hour,6],[d3.time.hour,12],[d3.time.day,1],[d3.time.day,2],[d3.time.week,1],[d3.time.month,1],[d3.time.month,3],[d3.time.year,1]],Ro=[[d3.time.format("%Y"),function(e){return!0}],[d3.time.format("%B"),function(e){return e.getMonth()}],[d3.time.format("%b %d"),function(e){return e.getDate()!=1}],[d3.time.format("%a %d"),function(e){return e.getDay()&&e.getDate()!=1}],[d3.time.format("%I %p"),function(e){return e.getHours()}],[d3.time.format("%I:%M"),function(e){return e.getMinutes()}],[d3.time.format(":%S"),function(e){return e.getSeconds()}],[d3.time.format(".%L"),function(e){return e.getMilliseconds()}]],Uo=d3.scale.linear(),zo=Ii(Ro);qo.year=function(e,t){return Uo.domain(e.map(Ri)).ticks(t).map(qi)},d3.time.scale=function(){return Bi(d3.scale.linear(),qo,zo)};var Wo=qo.map(function(e){return[e[0].utc,e[1]]}),Xo=[[d3.time.format.utc("%Y"),function(e){return!0}],[d3.time.format.utc("%B"),function(e){return e.getUTCMonth()}],[d3.time.format.utc("%b %d"),function(e){return e.getUTCDate()!=1}],[d3.time.format.utc("%a %d"),function(e){return e.getUTCDay()&&e.getUTCDate()!=1}],[d3.time.format.utc("%I %p"),function(e){return e.getUTCHours()}],[d3.time.format.utc("%I:%M"),function(e){return e.getUTCMinutes()}],[d3.time.format.utc(":%S"),function(e){return e.getUTCSeconds()}],[d3.time.format.utc(".%L"),function(e){return e.getUTCMilliseconds()}]],Vo=Ii(Xo);Wo.year=function(e,t){return Uo.domain(e.map(zi)).ticks(t).map(Ui)},d3.time.scale.utc=function(){return Bi(d3.scale.linear(),Wo,Vo)}})(); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v3.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v3.js new file mode 100644 index 0000000..bf4a8c1 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v3.js @@ -0,0 +1,8444 @@ +d3 = function() { + var d3 = { + version: "3.1.5" + }; + if (!Date.now) Date.now = function() { + return +new Date(); + }; + var d3_document = document, d3_window = window; + try { + d3_document.createElement("div").style.setProperty("opacity", 0, ""); + } catch (error) { + var d3_style_prototype = d3_window.CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty; + d3_style_prototype.setProperty = function(name, value, priority) { + d3_style_setProperty.call(this, name, value + "", priority); + }; + } + d3.ascending = function(a, b) { + return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; + }; + d3.descending = function(a, b) { + return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; + }; + d3.min = function(array, f) { + var i = -1, n = array.length, a, b; + if (arguments.length === 1) { + while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; + while (++i < n) if ((b = array[i]) != null && a > b) a = b; + } else { + while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b; + } + return a; + }; + d3.max = function(array, f) { + var i = -1, n = array.length, a, b; + if (arguments.length === 1) { + while (++i < n && ((a = array[i]) == null || a != a)) a = undefined; + while (++i < n) if ((b = array[i]) != null && b > a) a = b; + } else { + while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; + } + return a; + }; + d3.extent = function(array, f) { + var i = -1, n = array.length, a, b, c; + if (arguments.length === 1) { + while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined; + while (++i < n) if ((b = array[i]) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } else { + while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined; + while (++i < n) if ((b = f.call(array, array[i], i)) != null) { + if (a > b) a = b; + if (c < b) c = b; + } + } + return [ a, c ]; + }; + d3.sum = function(array, f) { + var s = 0, n = array.length, a, i = -1; + if (arguments.length === 1) { + while (++i < n) if (!isNaN(a = +array[i])) s += a; + } else { + while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a; + } + return s; + }; + function d3_number(x) { + return x != null && !isNaN(x); + } + d3.mean = function(array, f) { + var n = array.length, a, m = 0, i = -1, j = 0; + if (arguments.length === 1) { + while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j; + } else { + while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j; + } + return j ? m : undefined; + }; + d3.quantile = function(values, p) { + var H = (values.length - 1) * p + 1, h = Math.floor(H), v = +values[h - 1], e = H - h; + return e ? v + e * (values[h] - v) : v; + }; + d3.median = function(array, f) { + if (arguments.length > 1) array = array.map(f); + array = array.filter(d3_number); + return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined; + }; + d3.bisector = function(f) { + return { + left: function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (f.call(a, a[mid], mid) < x) lo = mid + 1; else hi = mid; + } + return lo; + }, + right: function(a, x, lo, hi) { + if (arguments.length < 3) lo = 0; + if (arguments.length < 4) hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (x < f.call(a, a[mid], mid)) hi = mid; else lo = mid + 1; + } + return lo; + } + }; + }; + var d3_bisector = d3.bisector(function(d) { + return d; + }); + d3.bisectLeft = d3_bisector.left; + d3.bisect = d3.bisectRight = d3_bisector.right; + d3.shuffle = function(array) { + var m = array.length, t, i; + while (m) { + i = Math.random() * m-- | 0; + t = array[m], array[m] = array[i], array[i] = t; + } + return array; + }; + d3.permute = function(array, indexes) { + var permutes = [], i = -1, n = indexes.length; + while (++i < n) permutes[i] = array[indexes[i]]; + return permutes; + }; + d3.zip = function() { + if (!(n = arguments.length)) return []; + for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) { + for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) { + zip[j] = arguments[j][i]; + } + } + return zips; + }; + function d3_zipLength(d) { + return d.length; + } + d3.transpose = function(matrix) { + return d3.zip.apply(d3, matrix); + }; + d3.keys = function(map) { + var keys = []; + for (var key in map) keys.push(key); + return keys; + }; + d3.values = function(map) { + var values = []; + for (var key in map) values.push(map[key]); + return values; + }; + d3.entries = function(map) { + var entries = []; + for (var key in map) entries.push({ + key: key, + value: map[key] + }); + return entries; + }; + d3.merge = function(arrays) { + return Array.prototype.concat.apply([], arrays); + }; + d3.range = function(start, stop, step) { + if (arguments.length < 3) { + step = 1; + if (arguments.length < 2) { + stop = start; + start = 0; + } + } + if ((stop - start) / step === Infinity) throw new Error("infinite range"); + var range = [], k = d3_range_integerScale(Math.abs(step)), i = -1, j; + start *= k, stop *= k, step *= k; + if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k); + return range; + }; + function d3_range_integerScale(x) { + var k = 1; + while (x * k % 1) k *= 10; + return k; + } + function d3_class(ctor, properties) { + try { + for (var key in properties) { + Object.defineProperty(ctor.prototype, key, { + value: properties[key], + enumerable: false + }); + } + } catch (e) { + ctor.prototype = properties; + } + } + d3.map = function(object) { + var map = new d3_Map(); + for (var key in object) map.set(key, object[key]); + return map; + }; + function d3_Map() {} + d3_class(d3_Map, { + has: function(key) { + return d3_map_prefix + key in this; + }, + get: function(key) { + return this[d3_map_prefix + key]; + }, + set: function(key, value) { + return this[d3_map_prefix + key] = value; + }, + remove: function(key) { + key = d3_map_prefix + key; + return key in this && delete this[key]; + }, + keys: function() { + var keys = []; + this.forEach(function(key) { + keys.push(key); + }); + return keys; + }, + values: function() { + var values = []; + this.forEach(function(key, value) { + values.push(value); + }); + return values; + }, + entries: function() { + var entries = []; + this.forEach(function(key, value) { + entries.push({ + key: key, + value: value + }); + }); + return entries; + }, + forEach: function(f) { + for (var key in this) { + if (key.charCodeAt(0) === d3_map_prefixCode) { + f.call(this, key.substring(1), this[key]); + } + } + } + }); + var d3_map_prefix = "\0", d3_map_prefixCode = d3_map_prefix.charCodeAt(0); + d3.nest = function() { + var nest = {}, keys = [], sortKeys = [], sortValues, rollup; + function map(mapType, array, depth) { + if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array; + var i = -1, n = array.length, key = keys[depth++], keyValue, object, setter, valuesByKey = new d3_Map(), values; + while (++i < n) { + if (values = valuesByKey.get(keyValue = key(object = array[i]))) { + values.push(object); + } else { + valuesByKey.set(keyValue, [ object ]); + } + } + if (mapType) { + object = mapType(); + setter = function(keyValue, values) { + object.set(keyValue, map(mapType, values, depth)); + }; + } else { + object = {}; + setter = function(keyValue, values) { + object[keyValue] = map(mapType, values, depth); + }; + } + valuesByKey.forEach(setter); + return object; + } + function entries(map, depth) { + if (depth >= keys.length) return map; + var array = [], sortKey = sortKeys[depth++]; + map.forEach(function(key, keyMap) { + array.push({ + key: key, + values: entries(keyMap, depth) + }); + }); + return sortKey ? array.sort(function(a, b) { + return sortKey(a.key, b.key); + }) : array; + } + nest.map = function(array, mapType) { + return map(mapType, array, 0); + }; + nest.entries = function(array) { + return entries(map(d3.map, array, 0), 0); + }; + nest.key = function(d) { + keys.push(d); + return nest; + }; + nest.sortKeys = function(order) { + sortKeys[keys.length - 1] = order; + return nest; + }; + nest.sortValues = function(order) { + sortValues = order; + return nest; + }; + nest.rollup = function(f) { + rollup = f; + return nest; + }; + return nest; + }; + d3.set = function(array) { + var set = new d3_Set(); + if (array) for (var i = 0; i < array.length; i++) set.add(array[i]); + return set; + }; + function d3_Set() {} + d3_class(d3_Set, { + has: function(value) { + return d3_map_prefix + value in this; + }, + add: function(value) { + this[d3_map_prefix + value] = true; + return value; + }, + remove: function(value) { + value = d3_map_prefix + value; + return value in this && delete this[value]; + }, + values: function() { + var values = []; + this.forEach(function(value) { + values.push(value); + }); + return values; + }, + forEach: function(f) { + for (var value in this) { + if (value.charCodeAt(0) === d3_map_prefixCode) { + f.call(this, value.substring(1)); + } + } + } + }); + d3.behavior = {}; + d3.rebind = function(target, source) { + var i = 1, n = arguments.length, method; + while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]); + return target; + }; + function d3_rebind(target, source, method) { + return function() { + var value = method.apply(source, arguments); + return value === source ? target : value; + }; + } + d3.dispatch = function() { + var dispatch = new d3_dispatch(), i = -1, n = arguments.length; + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); + return dispatch; + }; + function d3_dispatch() {} + d3_dispatch.prototype.on = function(type, listener) { + var i = type.indexOf("."), name = ""; + if (i >= 0) { + name = type.substring(i + 1); + type = type.substring(0, i); + } + if (type) return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener); + if (arguments.length === 2) { + if (listener == null) for (type in this) { + if (this.hasOwnProperty(type)) this[type].on(name, null); + } + return this; + } + }; + function d3_dispatch_event(dispatch) { + var listeners = [], listenerByName = new d3_Map(); + function event() { + var z = listeners, i = -1, n = z.length, l; + while (++i < n) if (l = z[i].on) l.apply(this, arguments); + return dispatch; + } + event.on = function(name, listener) { + var l = listenerByName.get(name), i; + if (arguments.length < 2) return l && l.on; + if (l) { + l.on = null; + listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1)); + listenerByName.remove(name); + } + if (listener) listeners.push(listenerByName.set(name, { + on: listener + })); + return dispatch; + }; + return event; + } + d3.event = null; + function d3_eventCancel() { + d3.event.stopPropagation(); + d3.event.preventDefault(); + } + function d3_eventSource() { + var e = d3.event, s; + while (s = e.sourceEvent) e = s; + return e; + } + function d3_eventSuppress(target, type) { + function off() { + target.on(type, null); + } + target.on(type, function() { + d3_eventCancel(); + off(); + }, true); + setTimeout(off, 0); + } + function d3_eventDispatch(target) { + var dispatch = new d3_dispatch(), i = 0, n = arguments.length; + while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); + dispatch.of = function(thiz, argumentz) { + return function(e1) { + try { + var e0 = e1.sourceEvent = d3.event; + e1.target = target; + d3.event = e1; + dispatch[e1.type].apply(thiz, argumentz); + } finally { + d3.event = e0; + } + }; + }; + return dispatch; + } + d3.mouse = function(container) { + return d3_mousePoint(container, d3_eventSource()); + }; + var d3_mouse_bug44083 = /WebKit/.test(d3_window.navigator.userAgent) ? -1 : 0; + function d3_mousePoint(container, e) { + var svg = container.ownerSVGElement || container; + if (svg.createSVGPoint) { + var point = svg.createSVGPoint(); + if (d3_mouse_bug44083 < 0 && (d3_window.scrollX || d3_window.scrollY)) { + svg = d3.select(d3_document.body).append("svg").style("position", "absolute").style("top", 0).style("left", 0); + var ctm = svg[0][0].getScreenCTM(); + d3_mouse_bug44083 = !(ctm.f || ctm.e); + svg.remove(); + } + if (d3_mouse_bug44083) { + point.x = e.pageX; + point.y = e.pageY; + } else { + point.x = e.clientX; + point.y = e.clientY; + } + point = point.matrixTransform(container.getScreenCTM().inverse()); + return [ point.x, point.y ]; + } + var rect = container.getBoundingClientRect(); + return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ]; + } + var d3_array = d3_arraySlice; + function d3_arrayCopy(pseudoarray) { + var i = -1, n = pseudoarray.length, array = []; + while (++i < n) array.push(pseudoarray[i]); + return array; + } + function d3_arraySlice(pseudoarray) { + return Array.prototype.slice.call(pseudoarray); + } + try { + d3_array(d3_document.documentElement.childNodes)[0].nodeType; + } catch (e) { + d3_array = d3_arrayCopy; + } + var d3_arraySubclass = [].__proto__ ? function(array, prototype) { + array.__proto__ = prototype; + } : function(array, prototype) { + for (var property in prototype) array[property] = prototype[property]; + }; + d3.touches = function(container, touches) { + if (arguments.length < 2) touches = d3_eventSource().touches; + return touches ? d3_array(touches).map(function(touch) { + var point = d3_mousePoint(container, touch); + point.identifier = touch.identifier; + return point; + }) : []; + }; + d3.behavior.drag = function() { + var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null; + function drag() { + this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown); + } + function mousedown() { + var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, touchId = d3.event.touches ? d3.event.changedTouches[0].identifier : null, offset, origin_ = point(), moved = 0; + var w = d3.select(d3_window).on(touchId != null ? "touchmove.drag-" + touchId : "mousemove.drag", dragmove).on(touchId != null ? "touchend.drag-" + touchId : "mouseup.drag", dragend, true); + if (origin) { + offset = origin.apply(target, arguments); + offset = [ offset.x - origin_[0], offset.y - origin_[1] ]; + } else { + offset = [ 0, 0 ]; + } + if (touchId == null) d3_eventCancel(); + event_({ + type: "dragstart" + }); + function point() { + var p = target.parentNode; + return touchId != null ? d3.touches(p).filter(function(p) { + return p.identifier === touchId; + })[0] : d3.mouse(p); + } + function dragmove() { + if (!target.parentNode) return dragend(); + var p = point(), dx = p[0] - origin_[0], dy = p[1] - origin_[1]; + moved |= dx | dy; + origin_ = p; + d3_eventCancel(); + event_({ + type: "drag", + x: p[0] + offset[0], + y: p[1] + offset[1], + dx: dx, + dy: dy + }); + } + function dragend() { + event_({ + type: "dragend" + }); + if (moved) { + d3_eventCancel(); + if (d3.event.target === eventTarget) d3_eventSuppress(w, "click"); + } + w.on(touchId != null ? "touchmove.drag-" + touchId : "mousemove.drag", null).on(touchId != null ? "touchend.drag-" + touchId : "mouseup.drag", null); + } + } + drag.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + return drag; + }; + return d3.rebind(drag, event, "on"); + }; + function d3_selection(groups) { + d3_arraySubclass(groups, d3_selectionPrototype); + return groups; + } + var d3_select = function(s, n) { + return n.querySelector(s); + }, d3_selectAll = function(s, n) { + return n.querySelectorAll(s); + }, d3_selectRoot = d3_document.documentElement, d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, d3_selectMatches = function(n, s) { + return d3_selectMatcher.call(n, s); + }; + if (typeof Sizzle === "function") { + d3_select = function(s, n) { + return Sizzle(s, n)[0] || null; + }; + d3_selectAll = function(s, n) { + return Sizzle.uniqueSort(Sizzle(s, n)); + }; + d3_selectMatches = Sizzle.matchesSelector; + } + var d3_selectionPrototype = []; + d3.selection = function() { + return d3_selectionRoot; + }; + d3.selection.prototype = d3_selectionPrototype; + d3_selectionPrototype.select = function(selector) { + var subgroups = [], subgroup, subnode, group, node; + if (typeof selector !== "function") selector = d3_selection_selector(selector); + for (var j = -1, m = this.length; ++j < m; ) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + subgroup.push(subnode = selector.call(node, node.__data__, i)); + if (subnode && "__data__" in node) subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + return d3_selection(subgroups); + }; + function d3_selection_selector(selector) { + return function() { + return d3_select(selector, this); + }; + } + d3_selectionPrototype.selectAll = function(selector) { + var subgroups = [], subgroup, node; + if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); + for (var j = -1, m = this.length; ++j < m; ) { + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i))); + subgroup.parentNode = node; + } + } + } + return d3_selection(subgroups); + }; + function d3_selection_selectorAll(selector) { + return function() { + return d3_selectAll(selector, this); + }; + } + var d3_nsPrefix = { + svg: "http://www.w3.org/2000/svg", + xhtml: "http://www.w3.org/1999/xhtml", + xlink: "http://www.w3.org/1999/xlink", + xml: "http://www.w3.org/XML/1998/namespace", + xmlns: "http://www.w3.org/2000/xmlns/" + }; + d3.ns = { + prefix: d3_nsPrefix, + qualify: function(name) { + var i = name.indexOf(":"), prefix = name; + if (i >= 0) { + prefix = name.substring(0, i); + name = name.substring(i + 1); + } + return d3_nsPrefix.hasOwnProperty(prefix) ? { + space: d3_nsPrefix[prefix], + local: name + } : name; + } + }; + d3_selectionPrototype.attr = function(name, value) { + if (arguments.length < 2) { + if (typeof name === "string") { + var node = this.node(); + name = d3.ns.qualify(name); + return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name); + } + for (value in name) this.each(d3_selection_attr(value, name[value])); + return this; + } + return this.each(d3_selection_attr(name, value)); + }; + function d3_selection_attr(name, value) { + name = d3.ns.qualify(name); + function attrNull() { + this.removeAttribute(name); + } + function attrNullNS() { + this.removeAttributeNS(name.space, name.local); + } + function attrConstant() { + this.setAttribute(name, value); + } + function attrConstantNS() { + this.setAttributeNS(name.space, name.local, value); + } + function attrFunction() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttribute(name); else this.setAttribute(name, x); + } + function attrFunctionNS() { + var x = value.apply(this, arguments); + if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x); + } + return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant; + } + function d3_collapse(s) { + return s.trim().replace(/\s+/g, " "); + } + d3.requote = function(s) { + return s.replace(d3_requote_re, "\\$&"); + }; + var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; + d3_selectionPrototype.classed = function(name, value) { + if (arguments.length < 2) { + if (typeof name === "string") { + var node = this.node(), n = (name = name.trim().split(/^|\s+/g)).length, i = -1; + if (value = node.classList) { + while (++i < n) if (!value.contains(name[i])) return false; + } else { + value = node.getAttribute("class"); + while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false; + } + return true; + } + for (value in name) this.each(d3_selection_classed(value, name[value])); + return this; + } + return this.each(d3_selection_classed(name, value)); + }; + function d3_selection_classedRe(name) { + return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g"); + } + function d3_selection_classed(name, value) { + name = name.trim().split(/\s+/).map(d3_selection_classedName); + var n = name.length; + function classedConstant() { + var i = -1; + while (++i < n) name[i](this, value); + } + function classedFunction() { + var i = -1, x = value.apply(this, arguments); + while (++i < n) name[i](this, x); + } + return typeof value === "function" ? classedFunction : classedConstant; + } + function d3_selection_classedName(name) { + var re = d3_selection_classedRe(name); + return function(node, value) { + if (c = node.classList) return value ? c.add(name) : c.remove(name); + var c = node.getAttribute("class") || ""; + if (value) { + re.lastIndex = 0; + if (!re.test(c)) node.setAttribute("class", d3_collapse(c + " " + name)); + } else { + node.setAttribute("class", d3_collapse(c.replace(re, " "))); + } + }; + } + d3_selectionPrototype.style = function(name, value, priority) { + var n = arguments.length; + if (n < 3) { + if (typeof name !== "string") { + if (n < 2) value = ""; + for (priority in name) this.each(d3_selection_style(priority, name[priority], value)); + return this; + } + if (n < 2) return d3_window.getComputedStyle(this.node(), null).getPropertyValue(name); + priority = ""; + } + return this.each(d3_selection_style(name, value, priority)); + }; + function d3_selection_style(name, value, priority) { + function styleNull() { + this.style.removeProperty(name); + } + function styleConstant() { + this.style.setProperty(name, value, priority); + } + function styleFunction() { + var x = value.apply(this, arguments); + if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority); + } + return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant; + } + d3_selectionPrototype.property = function(name, value) { + if (arguments.length < 2) { + if (typeof name === "string") return this.node()[name]; + for (value in name) this.each(d3_selection_property(value, name[value])); + return this; + } + return this.each(d3_selection_property(name, value)); + }; + function d3_selection_property(name, value) { + function propertyNull() { + delete this[name]; + } + function propertyConstant() { + this[name] = value; + } + function propertyFunction() { + var x = value.apply(this, arguments); + if (x == null) delete this[name]; else this[name] = x; + } + return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant; + } + d3_selectionPrototype.text = function(value) { + return arguments.length ? this.each(typeof value === "function" ? function() { + var v = value.apply(this, arguments); + this.textContent = v == null ? "" : v; + } : value == null ? function() { + this.textContent = ""; + } : function() { + this.textContent = value; + }) : this.node().textContent; + }; + d3_selectionPrototype.html = function(value) { + return arguments.length ? this.each(typeof value === "function" ? function() { + var v = value.apply(this, arguments); + this.innerHTML = v == null ? "" : v; + } : value == null ? function() { + this.innerHTML = ""; + } : function() { + this.innerHTML = value; + }) : this.node().innerHTML; + }; + d3_selectionPrototype.append = function(name) { + name = d3.ns.qualify(name); + function append() { + return this.appendChild(d3_document.createElementNS(this.namespaceURI, name)); + } + function appendNS() { + return this.appendChild(d3_document.createElementNS(name.space, name.local)); + } + return this.select(name.local ? appendNS : append); + }; + d3_selectionPrototype.insert = function(name, before) { + name = d3.ns.qualify(name); + if (typeof before !== "function") before = d3_selection_selector(before); + function insert(d, i) { + return this.insertBefore(d3_document.createElementNS(this.namespaceURI, name), before.call(this, d, i)); + } + function insertNS(d, i) { + return this.insertBefore(d3_document.createElementNS(name.space, name.local), before.call(this, d, i)); + } + return this.select(name.local ? insertNS : insert); + }; + d3_selectionPrototype.remove = function() { + return this.each(function() { + var parent = this.parentNode; + if (parent) parent.removeChild(this); + }); + }; + d3_selectionPrototype.data = function(value, key) { + var i = -1, n = this.length, group, node; + if (!arguments.length) { + value = new Array(n = (group = this[0]).length); + while (++i < n) { + if (node = group[i]) { + value[i] = node.__data__; + } + } + return value; + } + function bind(group, groupData) { + var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData; + if (key) { + var nodeByKeyValue = new d3_Map(), dataByKeyValue = new d3_Map(), keyValues = [], keyValue; + for (i = -1; ++i < n; ) { + keyValue = key.call(node = group[i], node.__data__, i); + if (nodeByKeyValue.has(keyValue)) { + exitNodes[i] = node; + } else { + nodeByKeyValue.set(keyValue, node); + } + keyValues.push(keyValue); + } + for (i = -1; ++i < m; ) { + keyValue = key.call(groupData, nodeData = groupData[i], i); + if (node = nodeByKeyValue.get(keyValue)) { + updateNodes[i] = node; + node.__data__ = nodeData; + } else if (!dataByKeyValue.has(keyValue)) { + enterNodes[i] = d3_selection_dataNode(nodeData); + } + dataByKeyValue.set(keyValue, nodeData); + nodeByKeyValue.remove(keyValue); + } + for (i = -1; ++i < n; ) { + if (nodeByKeyValue.has(keyValues[i])) { + exitNodes[i] = group[i]; + } + } + } else { + for (i = -1; ++i < n0; ) { + node = group[i]; + nodeData = groupData[i]; + if (node) { + node.__data__ = nodeData; + updateNodes[i] = node; + } else { + enterNodes[i] = d3_selection_dataNode(nodeData); + } + } + for (;i < m; ++i) { + enterNodes[i] = d3_selection_dataNode(groupData[i]); + } + for (;i < n; ++i) { + exitNodes[i] = group[i]; + } + } + enterNodes.update = updateNodes; + enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode; + enter.push(enterNodes); + update.push(updateNodes); + exit.push(exitNodes); + } + var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]); + if (typeof value === "function") { + while (++i < n) { + bind(group = this[i], value.call(group, group.parentNode.__data__, i)); + } + } else { + while (++i < n) { + bind(group = this[i], value); + } + } + update.enter = function() { + return enter; + }; + update.exit = function() { + return exit; + }; + return update; + }; + function d3_selection_dataNode(data) { + return { + __data__: data + }; + } + d3_selectionPrototype.datum = function(value) { + return arguments.length ? this.property("__data__", value) : this.property("__data__"); + }; + d3_selectionPrototype.filter = function(filter) { + var subgroups = [], subgroup, group, node; + if (typeof filter !== "function") filter = d3_selection_filter(filter); + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + subgroup.parentNode = (group = this[j]).parentNode; + for (var i = 0, n = group.length; i < n; i++) { + if ((node = group[i]) && filter.call(node, node.__data__, i)) { + subgroup.push(node); + } + } + } + return d3_selection(subgroups); + }; + function d3_selection_filter(selector) { + return function() { + return d3_selectMatches(this, selector); + }; + } + d3_selectionPrototype.order = function() { + for (var j = -1, m = this.length; ++j < m; ) { + for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) { + if (node = group[i]) { + if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next); + next = node; + } + } + } + return this; + }; + d3_selectionPrototype.sort = function(comparator) { + comparator = d3_selection_sortComparator.apply(this, arguments); + for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator); + return this.order(); + }; + function d3_selection_sortComparator(comparator) { + if (!arguments.length) comparator = d3.ascending; + return function(a, b) { + return !a - !b || comparator(a.__data__, b.__data__); + }; + } + function d3_noop() {} + d3_selectionPrototype.on = function(type, listener, capture) { + var n = arguments.length; + if (n < 3) { + if (typeof type !== "string") { + if (n < 2) listener = false; + for (capture in type) this.each(d3_selection_on(capture, type[capture], listener)); + return this; + } + if (n < 2) return (n = this.node()["__on" + type]) && n._; + capture = false; + } + return this.each(d3_selection_on(type, listener, capture)); + }; + function d3_selection_on(type, listener, capture) { + var name = "__on" + type, i = type.indexOf("."), wrap = d3_selection_onListener; + if (i > 0) type = type.substring(0, i); + var filter = d3_selection_onFilters.get(type); + if (filter) type = filter, wrap = d3_selection_onFilter; + function onRemove() { + var l = this[name]; + if (l) { + this.removeEventListener(type, l, l.$); + delete this[name]; + } + } + function onAdd() { + var l = wrap(listener, d3_array(arguments)); + onRemove.call(this); + this.addEventListener(type, this[name] = l, l.$ = capture); + l._ = listener; + } + function removeAll() { + var re = new RegExp("^__on([^.]+)" + d3.requote(type) + "$"), match; + for (var name in this) { + if (match = name.match(re)) { + var l = this[name]; + this.removeEventListener(match[1], l, l.$); + delete this[name]; + } + } + } + return i ? listener ? onAdd : onRemove : listener ? d3_noop : removeAll; + } + var d3_selection_onFilters = d3.map({ + mouseenter: "mouseover", + mouseleave: "mouseout" + }); + d3_selection_onFilters.forEach(function(k) { + if ("on" + k in d3_document) d3_selection_onFilters.remove(k); + }); + function d3_selection_onListener(listener, argumentz) { + return function(e) { + var o = d3.event; + d3.event = e; + argumentz[0] = this.__data__; + try { + listener.apply(this, argumentz); + } finally { + d3.event = o; + } + }; + } + function d3_selection_onFilter(listener, argumentz) { + var l = d3_selection_onListener(listener, argumentz); + return function(e) { + var target = this, related = e.relatedTarget; + if (!related || related !== target && !(related.compareDocumentPosition(target) & 8)) { + l.call(target, e); + } + }; + } + d3_selectionPrototype.each = function(callback) { + return d3_selection_each(this, function(node, i, j) { + callback.call(node, node.__data__, i, j); + }); + }; + function d3_selection_each(groups, callback) { + for (var j = 0, m = groups.length; j < m; j++) { + for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) { + if (node = group[i]) callback(node, i, j); + } + } + return groups; + } + d3_selectionPrototype.call = function(callback) { + var args = d3_array(arguments); + callback.apply(args[0] = this, args); + return this; + }; + d3_selectionPrototype.empty = function() { + return !this.node(); + }; + d3_selectionPrototype.node = function() { + for (var j = 0, m = this.length; j < m; j++) { + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + var node = group[i]; + if (node) return node; + } + } + return null; + }; + function d3_selection_enter(selection) { + d3_arraySubclass(selection, d3_selection_enterPrototype); + return selection; + } + var d3_selection_enterPrototype = []; + d3.selection.enter = d3_selection_enter; + d3.selection.enter.prototype = d3_selection_enterPrototype; + d3_selection_enterPrototype.append = d3_selectionPrototype.append; + d3_selection_enterPrototype.insert = d3_selectionPrototype.insert; + d3_selection_enterPrototype.empty = d3_selectionPrototype.empty; + d3_selection_enterPrototype.node = d3_selectionPrototype.node; + d3_selection_enterPrototype.select = function(selector) { + var subgroups = [], subgroup, subnode, upgroup, group, node; + for (var j = -1, m = this.length; ++j < m; ) { + upgroup = (group = this[j]).update; + subgroups.push(subgroup = []); + subgroup.parentNode = group.parentNode; + for (var i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i)); + subnode.__data__ = node.__data__; + } else { + subgroup.push(null); + } + } + } + return d3_selection(subgroups); + }; + d3_selectionPrototype.transition = function() { + var id = d3_transitionInheritId || ++d3_transitionId, subgroups = [], subgroup, node, transition = Object.create(d3_transitionInherit); + transition.time = Date.now(); + for (var j = -1, m = this.length; ++j < m; ) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) d3_transitionNode(node, i, id, transition); + subgroup.push(node); + } + } + return d3_transition(subgroups, id); + }; + var d3_selectionRoot = d3_selection([ [ d3_document ] ]); + d3_selectionRoot[0].parentNode = d3_selectRoot; + d3.select = function(selector) { + return typeof selector === "string" ? d3_selectionRoot.select(selector) : d3_selection([ [ selector ] ]); + }; + d3.selectAll = function(selector) { + return typeof selector === "string" ? d3_selectionRoot.selectAll(selector) : d3_selection([ d3_array(selector) ]); + }; + d3.behavior.zoom = function() { + var translate = [ 0, 0 ], translate0, scale = 1, scale0, scaleExtent = d3_behavior_zoomInfinity, event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime; + function zoom() { + this.on("mousedown.zoom", mousedown).on("mousemove.zoom", mousemove).on(d3_behavior_zoomWheel + ".zoom", mousewheel).on("dblclick.zoom", dblclick).on("touchstart.zoom", touchstart).on("touchmove.zoom", touchmove).on("touchend.zoom", touchstart); + } + zoom.translate = function(x) { + if (!arguments.length) return translate; + translate = x.map(Number); + rescale(); + return zoom; + }; + zoom.scale = function(x) { + if (!arguments.length) return scale; + scale = +x; + rescale(); + return zoom; + }; + zoom.scaleExtent = function(x) { + if (!arguments.length) return scaleExtent; + scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number); + return zoom; + }; + zoom.x = function(z) { + if (!arguments.length) return x1; + x1 = z; + x0 = z.copy(); + translate = [ 0, 0 ]; + scale = 1; + return zoom; + }; + zoom.y = function(z) { + if (!arguments.length) return y1; + y1 = z; + y0 = z.copy(); + translate = [ 0, 0 ]; + scale = 1; + return zoom; + }; + function location(p) { + return [ (p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale ]; + } + function point(l) { + return [ l[0] * scale + translate[0], l[1] * scale + translate[1] ]; + } + function scaleTo(s) { + scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s)); + } + function translateTo(p, l) { + l = point(l); + translate[0] += p[0] - l[0]; + translate[1] += p[1] - l[1]; + } + function rescale() { + if (x1) x1.domain(x0.range().map(function(x) { + return (x - translate[0]) / scale; + }).map(x0.invert)); + if (y1) y1.domain(y0.range().map(function(y) { + return (y - translate[1]) / scale; + }).map(y0.invert)); + } + function dispatch(event) { + rescale(); + d3.event.preventDefault(); + event({ + type: "zoom", + scale: scale, + translate: translate + }); + } + function mousedown() { + var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, moved = 0, w = d3.select(d3_window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup), l = location(d3.mouse(target)); + d3_window.focus(); + d3_eventCancel(); + function mousemove() { + moved = 1; + translateTo(d3.mouse(target), l); + dispatch(event_); + } + function mouseup() { + if (moved) d3_eventCancel(); + w.on("mousemove.zoom", null).on("mouseup.zoom", null); + if (moved && d3.event.target === eventTarget) d3_eventSuppress(w, "click.zoom"); + } + } + function mousewheel() { + if (!translate0) translate0 = location(d3.mouse(this)); + scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale); + translateTo(d3.mouse(this), translate0); + dispatch(event.of(this, arguments)); + } + function mousemove() { + translate0 = null; + } + function dblclick() { + var p = d3.mouse(this), l = location(p), k = Math.log(scale) / Math.LN2; + scaleTo(Math.pow(2, d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1)); + translateTo(p, l); + dispatch(event.of(this, arguments)); + } + function touchstart() { + var touches = d3.touches(this), now = Date.now(); + scale0 = scale; + translate0 = {}; + touches.forEach(function(t) { + translate0[t.identifier] = location(t); + }); + d3_eventCancel(); + if (touches.length === 1) { + if (now - touchtime < 500) { + var p = touches[0], l = location(touches[0]); + scaleTo(scale * 2); + translateTo(p, l); + dispatch(event.of(this, arguments)); + } + touchtime = now; + } + } + function touchmove() { + var touches = d3.touches(this), p0 = touches[0], l0 = translate0[p0.identifier]; + if (p1 = touches[1]) { + var p1, l1 = translate0[p1.identifier]; + p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ]; + l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ]; + scaleTo(d3.event.scale * scale0); + } + translateTo(p0, l0); + touchtime = null; + dispatch(event.of(this, arguments)); + } + return d3.rebind(zoom, event, "on"); + }; + var d3_behavior_zoomInfinity = [ 0, Infinity ]; + var d3_behavior_zoomDelta, d3_behavior_zoomWheel = "onwheel" in d3_document ? (d3_behavior_zoomDelta = function() { + return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1); + }, "wheel") : "onmousewheel" in d3_document ? (d3_behavior_zoomDelta = function() { + return d3.event.wheelDelta; + }, "mousewheel") : (d3_behavior_zoomDelta = function() { + return -d3.event.detail; + }, "MozMousePixelScroll"); + function d3_Color() {} + d3_Color.prototype.toString = function() { + return this.rgb() + ""; + }; + d3.hsl = function(h, s, l) { + return arguments.length === 1 ? h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : d3_hsl(+h, +s, +l); + }; + function d3_hsl(h, s, l) { + return new d3_Hsl(h, s, l); + } + function d3_Hsl(h, s, l) { + this.h = h; + this.s = s; + this.l = l; + } + var d3_hslPrototype = d3_Hsl.prototype = new d3_Color(); + d3_hslPrototype.brighter = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + return d3_hsl(this.h, this.s, this.l / k); + }; + d3_hslPrototype.darker = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + return d3_hsl(this.h, this.s, k * this.l); + }; + d3_hslPrototype.rgb = function() { + return d3_hsl_rgb(this.h, this.s, this.l); + }; + function d3_hsl_rgb(h, s, l) { + var m1, m2; + h = h % 360; + if (h < 0) h += 360; + s = s < 0 ? 0 : s > 1 ? 1 : s; + l = l < 0 ? 0 : l > 1 ? 1 : l; + m2 = l <= .5 ? l * (1 + s) : l + s - l * s; + m1 = 2 * l - m2; + function v(h) { + if (h > 360) h -= 360; else if (h < 0) h += 360; + if (h < 60) return m1 + (m2 - m1) * h / 60; + if (h < 180) return m2; + if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; + return m1; + } + function vv(h) { + return Math.round(v(h) * 255); + } + return d3_rgb(vv(h + 120), vv(h), vv(h - 120)); + } + var Ï€ = Math.PI, ε = 1e-6, d3_radians = Ï€ / 180, d3_degrees = 180 / Ï€; + function d3_sgn(x) { + return x > 0 ? 1 : x < 0 ? -1 : 0; + } + function d3_acos(x) { + return Math.acos(Math.max(-1, Math.min(1, x))); + } + function d3_asin(x) { + return x > 1 ? Ï€ / 2 : x < -1 ? -Ï€ / 2 : Math.asin(x); + } + function d3_sinh(x) { + return (Math.exp(x) - Math.exp(-x)) / 2; + } + function d3_cosh(x) { + return (Math.exp(x) + Math.exp(-x)) / 2; + } + function d3_haversin(x) { + return (x = Math.sin(x / 2)) * x; + } + d3.hcl = function(h, c, l) { + return arguments.length === 1 ? h instanceof d3_Hcl ? d3_hcl(h.h, h.c, h.l) : h instanceof d3_Lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : d3_hcl(+h, +c, +l); + }; + function d3_hcl(h, c, l) { + return new d3_Hcl(h, c, l); + } + function d3_Hcl(h, c, l) { + this.h = h; + this.c = c; + this.l = l; + } + var d3_hclPrototype = d3_Hcl.prototype = new d3_Color(); + d3_hclPrototype.brighter = function(k) { + return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1))); + }; + d3_hclPrototype.darker = function(k) { + return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1))); + }; + d3_hclPrototype.rgb = function() { + return d3_hcl_lab(this.h, this.c, this.l).rgb(); + }; + function d3_hcl_lab(h, c, l) { + return d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c); + } + d3.lab = function(l, a, b) { + return arguments.length === 1 ? l instanceof d3_Lab ? d3_lab(l.l, l.a, l.b) : l instanceof d3_Hcl ? d3_hcl_lab(l.l, l.c, l.h) : d3_rgb_lab((l = d3.rgb(l)).r, l.g, l.b) : d3_lab(+l, +a, +b); + }; + function d3_lab(l, a, b) { + return new d3_Lab(l, a, b); + } + function d3_Lab(l, a, b) { + this.l = l; + this.a = a; + this.b = b; + } + var d3_lab_K = 18; + var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883; + var d3_labPrototype = d3_Lab.prototype = new d3_Color(); + d3_labPrototype.brighter = function(k) { + return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); + }; + d3_labPrototype.darker = function(k) { + return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); + }; + d3_labPrototype.rgb = function() { + return d3_lab_rgb(this.l, this.a, this.b); + }; + function d3_lab_rgb(l, a, b) { + var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200; + x = d3_lab_xyz(x) * d3_lab_X; + y = d3_lab_xyz(y) * d3_lab_Y; + z = d3_lab_xyz(z) * d3_lab_Z; + return d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z)); + } + function d3_lab_hcl(l, a, b) { + return d3_hcl(Math.atan2(b, a) * d3_degrees, Math.sqrt(a * a + b * b), l); + } + function d3_lab_xyz(x) { + return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037; + } + function d3_xyz_lab(x) { + return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29; + } + function d3_xyz_rgb(r) { + return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055)); + } + d3.rgb = function(r, g, b) { + return arguments.length === 1 ? r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : d3_rgb(~~r, ~~g, ~~b); + }; + function d3_rgb(r, g, b) { + return new d3_Rgb(r, g, b); + } + function d3_Rgb(r, g, b) { + this.r = r; + this.g = g; + this.b = b; + } + var d3_rgbPrototype = d3_Rgb.prototype = new d3_Color(); + d3_rgbPrototype.brighter = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + var r = this.r, g = this.g, b = this.b, i = 30; + if (!r && !g && !b) return d3_rgb(i, i, i); + if (r && r < i) r = i; + if (g && g < i) g = i; + if (b && b < i) b = i; + return d3_rgb(Math.min(255, Math.floor(r / k)), Math.min(255, Math.floor(g / k)), Math.min(255, Math.floor(b / k))); + }; + d3_rgbPrototype.darker = function(k) { + k = Math.pow(.7, arguments.length ? k : 1); + return d3_rgb(Math.floor(k * this.r), Math.floor(k * this.g), Math.floor(k * this.b)); + }; + d3_rgbPrototype.hsl = function() { + return d3_rgb_hsl(this.r, this.g, this.b); + }; + d3_rgbPrototype.toString = function() { + return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b); + }; + function d3_rgb_hex(v) { + return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16); + } + function d3_rgb_parse(format, rgb, hsl) { + var r = 0, g = 0, b = 0, m1, m2, name; + m1 = /([a-z]+)\((.*)\)/i.exec(format); + if (m1) { + m2 = m1[2].split(","); + switch (m1[1]) { + case "hsl": + { + return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100); + } + + case "rgb": + { + return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2])); + } + } + } + if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b); + if (format != null && format.charAt(0) === "#") { + if (format.length === 4) { + r = format.charAt(1); + r += r; + g = format.charAt(2); + g += g; + b = format.charAt(3); + b += b; + } else if (format.length === 7) { + r = format.substring(1, 3); + g = format.substring(3, 5); + b = format.substring(5, 7); + } + r = parseInt(r, 16); + g = parseInt(g, 16); + b = parseInt(b, 16); + } + return rgb(r, g, b); + } + function d3_rgb_hsl(r, g, b) { + var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2; + if (d) { + s = l < .5 ? d / (max + min) : d / (2 - max - min); + if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4; + h *= 60; + } else { + s = h = 0; + } + return d3_hsl(h, s, l); + } + function d3_rgb_lab(r, g, b) { + r = d3_rgb_xyz(r); + g = d3_rgb_xyz(g); + b = d3_rgb_xyz(b); + var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z); + return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z)); + } + function d3_rgb_xyz(r) { + return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4); + } + function d3_rgb_parseNumber(c) { + var f = parseFloat(c); + return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f; + } + var d3_rgb_names = d3.map({ + aliceblue: "#f0f8ff", + antiquewhite: "#faebd7", + aqua: "#00ffff", + aquamarine: "#7fffd4", + azure: "#f0ffff", + beige: "#f5f5dc", + bisque: "#ffe4c4", + black: "#000000", + blanchedalmond: "#ffebcd", + blue: "#0000ff", + blueviolet: "#8a2be2", + brown: "#a52a2a", + burlywood: "#deb887", + cadetblue: "#5f9ea0", + chartreuse: "#7fff00", + chocolate: "#d2691e", + coral: "#ff7f50", + cornflowerblue: "#6495ed", + cornsilk: "#fff8dc", + crimson: "#dc143c", + cyan: "#00ffff", + darkblue: "#00008b", + darkcyan: "#008b8b", + darkgoldenrod: "#b8860b", + darkgray: "#a9a9a9", + darkgreen: "#006400", + darkgrey: "#a9a9a9", + darkkhaki: "#bdb76b", + darkmagenta: "#8b008b", + darkolivegreen: "#556b2f", + darkorange: "#ff8c00", + darkorchid: "#9932cc", + darkred: "#8b0000", + darksalmon: "#e9967a", + darkseagreen: "#8fbc8f", + darkslateblue: "#483d8b", + darkslategray: "#2f4f4f", + darkslategrey: "#2f4f4f", + darkturquoise: "#00ced1", + darkviolet: "#9400d3", + deeppink: "#ff1493", + deepskyblue: "#00bfff", + dimgray: "#696969", + dimgrey: "#696969", + dodgerblue: "#1e90ff", + firebrick: "#b22222", + floralwhite: "#fffaf0", + forestgreen: "#228b22", + fuchsia: "#ff00ff", + gainsboro: "#dcdcdc", + ghostwhite: "#f8f8ff", + gold: "#ffd700", + goldenrod: "#daa520", + gray: "#808080", + green: "#008000", + greenyellow: "#adff2f", + grey: "#808080", + honeydew: "#f0fff0", + hotpink: "#ff69b4", + indianred: "#cd5c5c", + indigo: "#4b0082", + ivory: "#fffff0", + khaki: "#f0e68c", + lavender: "#e6e6fa", + lavenderblush: "#fff0f5", + lawngreen: "#7cfc00", + lemonchiffon: "#fffacd", + lightblue: "#add8e6", + lightcoral: "#f08080", + lightcyan: "#e0ffff", + lightgoldenrodyellow: "#fafad2", + lightgray: "#d3d3d3", + lightgreen: "#90ee90", + lightgrey: "#d3d3d3", + lightpink: "#ffb6c1", + lightsalmon: "#ffa07a", + lightseagreen: "#20b2aa", + lightskyblue: "#87cefa", + lightslategray: "#778899", + lightslategrey: "#778899", + lightsteelblue: "#b0c4de", + lightyellow: "#ffffe0", + lime: "#00ff00", + limegreen: "#32cd32", + linen: "#faf0e6", + magenta: "#ff00ff", + maroon: "#800000", + mediumaquamarine: "#66cdaa", + mediumblue: "#0000cd", + mediumorchid: "#ba55d3", + mediumpurple: "#9370db", + mediumseagreen: "#3cb371", + mediumslateblue: "#7b68ee", + mediumspringgreen: "#00fa9a", + mediumturquoise: "#48d1cc", + mediumvioletred: "#c71585", + midnightblue: "#191970", + mintcream: "#f5fffa", + mistyrose: "#ffe4e1", + moccasin: "#ffe4b5", + navajowhite: "#ffdead", + navy: "#000080", + oldlace: "#fdf5e6", + olive: "#808000", + olivedrab: "#6b8e23", + orange: "#ffa500", + orangered: "#ff4500", + orchid: "#da70d6", + palegoldenrod: "#eee8aa", + palegreen: "#98fb98", + paleturquoise: "#afeeee", + palevioletred: "#db7093", + papayawhip: "#ffefd5", + peachpuff: "#ffdab9", + peru: "#cd853f", + pink: "#ffc0cb", + plum: "#dda0dd", + powderblue: "#b0e0e6", + purple: "#800080", + red: "#ff0000", + rosybrown: "#bc8f8f", + royalblue: "#4169e1", + saddlebrown: "#8b4513", + salmon: "#fa8072", + sandybrown: "#f4a460", + seagreen: "#2e8b57", + seashell: "#fff5ee", + sienna: "#a0522d", + silver: "#c0c0c0", + skyblue: "#87ceeb", + slateblue: "#6a5acd", + slategray: "#708090", + slategrey: "#708090", + snow: "#fffafa", + springgreen: "#00ff7f", + steelblue: "#4682b4", + tan: "#d2b48c", + teal: "#008080", + thistle: "#d8bfd8", + tomato: "#ff6347", + turquoise: "#40e0d0", + violet: "#ee82ee", + wheat: "#f5deb3", + white: "#ffffff", + whitesmoke: "#f5f5f5", + yellow: "#ffff00", + yellowgreen: "#9acd32" + }); + d3_rgb_names.forEach(function(key, value) { + d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb)); + }); + function d3_functor(v) { + return typeof v === "function" ? v : function() { + return v; + }; + } + d3.functor = d3_functor; + function d3_identity(d) { + return d; + } + d3.xhr = function(url, mimeType, callback) { + var xhr = {}, dispatch = d3.dispatch("progress", "load", "error"), headers = {}, response = d3_identity, request = new (d3_window.XDomainRequest && /^(http(s)?:)?\/\//.test(url) ? XDomainRequest : XMLHttpRequest)(); + "onload" in request ? request.onload = request.onerror = respond : request.onreadystatechange = function() { + request.readyState > 3 && respond(); + }; + function respond() { + var s = request.status; + !s && request.responseText || s >= 200 && s < 300 || s === 304 ? dispatch.load.call(xhr, response.call(xhr, request)) : dispatch.error.call(xhr, request); + } + request.onprogress = function(event) { + var o = d3.event; + d3.event = event; + try { + dispatch.progress.call(xhr, request); + } finally { + d3.event = o; + } + }; + xhr.header = function(name, value) { + name = (name + "").toLowerCase(); + if (arguments.length < 2) return headers[name]; + if (value == null) delete headers[name]; else headers[name] = value + ""; + return xhr; + }; + xhr.mimeType = function(value) { + if (!arguments.length) return mimeType; + mimeType = value == null ? null : value + ""; + return xhr; + }; + xhr.response = function(value) { + response = value; + return xhr; + }; + [ "get", "post" ].forEach(function(method) { + xhr[method] = function() { + return xhr.send.apply(xhr, [ method ].concat(d3_array(arguments))); + }; + }); + xhr.send = function(method, data, callback) { + if (arguments.length === 2 && typeof data === "function") callback = data, data = null; + request.open(method, url, true); + if (mimeType != null && !("accept" in headers)) headers["accept"] = mimeType + ",*/*"; + if (request.setRequestHeader) for (var name in headers) request.setRequestHeader(name, headers[name]); + if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType); + if (callback != null) xhr.on("error", callback).on("load", function(request) { + callback(null, request); + }); + request.send(data == null ? null : data); + return xhr; + }; + xhr.abort = function() { + request.abort(); + return xhr; + }; + d3.rebind(xhr, dispatch, "on"); + if (arguments.length === 2 && typeof mimeType === "function") callback = mimeType, + mimeType = null; + return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback)); + }; + function d3_xhr_fixCallback(callback) { + return callback.length === 1 ? function(error, request) { + callback(error == null ? request : null); + } : callback; + } + function d3_dsv(delimiter, mimeType) { + var reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0); + function dsv(url, row, callback) { + if (arguments.length < 3) callback = row, row = null; + var xhr = d3.xhr(url, mimeType, callback); + xhr.row = function(_) { + return arguments.length ? xhr.response((row = _) == null ? response : typedResponse(_)) : row; + }; + return xhr.row(row); + } + function response(request) { + return dsv.parse(request.responseText); + } + function typedResponse(f) { + return function(request) { + return dsv.parse(request.responseText, f); + }; + } + dsv.parse = function(text, f) { + var o; + return dsv.parseRows(text, function(row, i) { + if (o) return o(row, i - 1); + var a = new Function("d", "return {" + row.map(function(name, i) { + return JSON.stringify(name) + ": d[" + i + "]"; + }).join(",") + "}"); + o = f ? function(row, i) { + return f(a(row), i); + } : a; + }); + }; + dsv.parseRows = function(text, f) { + var EOL = {}, EOF = {}, rows = [], N = text.length, I = 0, n = 0, t, eol; + function token() { + if (I >= N) return EOF; + if (eol) return eol = false, EOL; + var j = I; + if (text.charCodeAt(j) === 34) { + var i = j; + while (i++ < N) { + if (text.charCodeAt(i) === 34) { + if (text.charCodeAt(i + 1) !== 34) break; + ++i; + } + } + I = i + 2; + var c = text.charCodeAt(i + 1); + if (c === 13) { + eol = true; + if (text.charCodeAt(i + 2) === 10) ++I; + } else if (c === 10) { + eol = true; + } + return text.substring(j + 1, i).replace(/""/g, '"'); + } + while (I < N) { + var c = text.charCodeAt(I++), k = 1; + if (c === 10) eol = true; else if (c === 13) { + eol = true; + if (text.charCodeAt(I) === 10) ++I, ++k; + } else if (c !== delimiterCode) continue; + return text.substring(j, I - k); + } + return text.substring(j); + } + while ((t = token()) !== EOF) { + var a = []; + while (t !== EOL && t !== EOF) { + a.push(t); + t = token(); + } + if (f && !(a = f(a, n++))) continue; + rows.push(a); + } + return rows; + }; + dsv.format = function(rows) { + if (Array.isArray(rows[0])) return dsv.formatRows(rows); + var fieldSet = new d3_Set(), fields = []; + rows.forEach(function(row) { + for (var field in row) { + if (!fieldSet.has(field)) { + fields.push(fieldSet.add(field)); + } + } + }); + return [ fields.map(formatValue).join(delimiter) ].concat(rows.map(function(row) { + return fields.map(function(field) { + return formatValue(row[field]); + }).join(delimiter); + })).join("\n"); + }; + dsv.formatRows = function(rows) { + return rows.map(formatRow).join("\n"); + }; + function formatRow(row) { + return row.map(formatValue).join(delimiter); + } + function formatValue(text) { + return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text; + } + return dsv; + } + d3.csv = d3_dsv(",", "text/csv"); + d3.tsv = d3_dsv(" ", "text/tab-separated-values"); + var d3_timer_id = 0, d3_timer_byId = {}, d3_timer_queue = null, d3_timer_interval, d3_timer_timeout; + d3.timer = function(callback, delay, then) { + if (arguments.length < 3) { + if (arguments.length < 2) delay = 0; else if (!isFinite(delay)) return; + then = Date.now(); + } + var timer = d3_timer_byId[callback.id]; + if (timer && timer.callback === callback) { + timer.then = then; + timer.delay = delay; + } else d3_timer_byId[callback.id = ++d3_timer_id] = d3_timer_queue = { + callback: callback, + then: then, + delay: delay, + next: d3_timer_queue + }; + if (!d3_timer_interval) { + d3_timer_timeout = clearTimeout(d3_timer_timeout); + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } + }; + function d3_timer_step() { + var elapsed, now = Date.now(), t1 = d3_timer_queue; + while (t1) { + elapsed = now - t1.then; + if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed); + t1 = t1.next; + } + var delay = d3_timer_flush() - now; + if (delay > 24) { + if (isFinite(delay)) { + clearTimeout(d3_timer_timeout); + d3_timer_timeout = setTimeout(d3_timer_step, delay); + } + d3_timer_interval = 0; + } else { + d3_timer_interval = 1; + d3_timer_frame(d3_timer_step); + } + } + d3.timer.flush = function() { + var elapsed, now = Date.now(), t1 = d3_timer_queue; + while (t1) { + elapsed = now - t1.then; + if (!t1.delay) t1.flush = t1.callback(elapsed); + t1 = t1.next; + } + d3_timer_flush(); + }; + function d3_timer_flush() { + var t0 = null, t1 = d3_timer_queue, then = Infinity; + while (t1) { + if (t1.flush) { + delete d3_timer_byId[t1.callback.id]; + t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next; + } else { + then = Math.min(then, t1.then + t1.delay); + t1 = (t0 = t1).next; + } + } + return then; + } + var d3_timer_frame = d3_window.requestAnimationFrame || d3_window.webkitRequestAnimationFrame || d3_window.mozRequestAnimationFrame || d3_window.oRequestAnimationFrame || d3_window.msRequestAnimationFrame || function(callback) { + setTimeout(callback, 17); + }; + var d3_format_decimalPoint = ".", d3_format_thousandsSeparator = ",", d3_format_grouping = [ 3, 3 ]; + var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix); + d3.formatPrefix = function(value, precision) { + var i = 0; + if (value) { + if (value < 0) value *= -1; + if (precision) value = d3.round(value, d3_format_precision(value, precision)); + i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10); + i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3)); + } + return d3_formatPrefixes[8 + i / 3]; + }; + function d3_formatPrefix(d, i) { + var k = Math.pow(10, Math.abs(8 - i) * 3); + return { + scale: i > 8 ? function(d) { + return d / k; + } : function(d) { + return d * k; + }, + symbol: d + }; + } + d3.round = function(x, n) { + return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x); + }; + d3.format = function(specifier) { + var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "", basePrefix = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, suffix = "", integer = false; + if (precision) precision = +precision.substring(1); + if (zfill || fill === "0" && align === "=") { + zfill = fill = "0"; + align = "="; + if (comma) width -= Math.floor((width - 1) / 4); + } + switch (type) { + case "n": + comma = true; + type = "g"; + break; + + case "%": + scale = 100; + suffix = "%"; + type = "f"; + break; + + case "p": + scale = 100; + suffix = "%"; + type = "r"; + break; + + case "b": + case "o": + case "x": + case "X": + if (basePrefix) basePrefix = "0" + type.toLowerCase(); + + case "c": + case "d": + integer = true; + precision = 0; + break; + + case "s": + scale = -1; + type = "r"; + break; + } + if (basePrefix === "#") basePrefix = ""; + if (type == "r" && !precision) type = "g"; + if (precision != null) { + if (type == "g") precision = Math.max(1, Math.min(21, precision)); else if (type == "e" || type == "f") precision = Math.max(0, Math.min(20, precision)); + } + type = d3_format_types.get(type) || d3_format_typeDefault; + var zcomma = zfill && comma; + return function(value) { + if (integer && value % 1) return ""; + var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign; + if (scale < 0) { + var prefix = d3.formatPrefix(value, precision); + value = prefix.scale(value); + suffix = prefix.symbol; + } else { + value *= scale; + } + value = type(value, precision); + if (!zfill && comma) value = d3_format_group(value); + var length = basePrefix.length + value.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : ""; + if (zcomma) value = d3_format_group(padding + value); + if (d3_format_decimalPoint) value.replace(".", d3_format_decimalPoint); + negative += basePrefix; + return (align === "<" ? negative + value + padding : align === ">" ? padding + negative + value : align === "^" ? padding.substring(0, length >>= 1) + negative + value + padding.substring(length) : negative + (zcomma ? value : padding + value)) + suffix; + }; + }; + var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i; + var d3_format_types = d3.map({ + b: function(x) { + return x.toString(2); + }, + c: function(x) { + return String.fromCharCode(x); + }, + o: function(x) { + return x.toString(8); + }, + x: function(x) { + return x.toString(16); + }, + X: function(x) { + return x.toString(16).toUpperCase(); + }, + g: function(x, p) { + return x.toPrecision(p); + }, + e: function(x, p) { + return x.toExponential(p); + }, + f: function(x, p) { + return x.toFixed(p); + }, + r: function(x, p) { + return (x = d3.round(x, d3_format_precision(x, p))).toFixed(Math.max(0, Math.min(20, d3_format_precision(x * (1 + 1e-15), p)))); + } + }); + function d3_format_precision(x, p) { + return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1); + } + function d3_format_typeDefault(x) { + return x + ""; + } + var d3_format_group = d3_identity; + if (d3_format_grouping) { + var d3_format_groupingLength = d3_format_grouping.length; + d3_format_group = function(value) { + var i = value.lastIndexOf("."), f = i >= 0 ? "." + value.substring(i + 1) : (i = value.length, + ""), t = [], j = 0, g = d3_format_grouping[0]; + while (i > 0 && g > 0) { + t.push(value.substring(i -= g, i + g)); + g = d3_format_grouping[j = (j + 1) % d3_format_groupingLength]; + } + return t.reverse().join(d3_format_thousandsSeparator || "") + f; + }; + } + d3.geo = {}; + d3.geo.stream = function(object, listener) { + if (object && d3_geo_streamObjectType.hasOwnProperty(object.type)) { + d3_geo_streamObjectType[object.type](object, listener); + } else { + d3_geo_streamGeometry(object, listener); + } + }; + function d3_geo_streamGeometry(geometry, listener) { + if (geometry && d3_geo_streamGeometryType.hasOwnProperty(geometry.type)) { + d3_geo_streamGeometryType[geometry.type](geometry, listener); + } + } + var d3_geo_streamObjectType = { + Feature: function(feature, listener) { + d3_geo_streamGeometry(feature.geometry, listener); + }, + FeatureCollection: function(object, listener) { + var features = object.features, i = -1, n = features.length; + while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener); + } + }; + var d3_geo_streamGeometryType = { + Sphere: function(object, listener) { + listener.sphere(); + }, + Point: function(object, listener) { + var coordinate = object.coordinates; + listener.point(coordinate[0], coordinate[1]); + }, + MultiPoint: function(object, listener) { + var coordinates = object.coordinates, i = -1, n = coordinates.length, coordinate; + while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1]); + }, + LineString: function(object, listener) { + d3_geo_streamLine(object.coordinates, listener, 0); + }, + MultiLineString: function(object, listener) { + var coordinates = object.coordinates, i = -1, n = coordinates.length; + while (++i < n) d3_geo_streamLine(coordinates[i], listener, 0); + }, + Polygon: function(object, listener) { + d3_geo_streamPolygon(object.coordinates, listener); + }, + MultiPolygon: function(object, listener) { + var coordinates = object.coordinates, i = -1, n = coordinates.length; + while (++i < n) d3_geo_streamPolygon(coordinates[i], listener); + }, + GeometryCollection: function(object, listener) { + var geometries = object.geometries, i = -1, n = geometries.length; + while (++i < n) d3_geo_streamGeometry(geometries[i], listener); + } + }; + function d3_geo_streamLine(coordinates, listener, closed) { + var i = -1, n = coordinates.length - closed, coordinate; + listener.lineStart(); + while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1]); + listener.lineEnd(); + } + function d3_geo_streamPolygon(coordinates, listener) { + var i = -1, n = coordinates.length; + listener.polygonStart(); + while (++i < n) d3_geo_streamLine(coordinates[i], listener, 1); + listener.polygonEnd(); + } + d3.geo.area = function(object) { + d3_geo_areaSum = 0; + d3.geo.stream(object, d3_geo_area); + return d3_geo_areaSum; + }; + var d3_geo_areaSum, d3_geo_areaRingU, d3_geo_areaRingV; + var d3_geo_area = { + sphere: function() { + d3_geo_areaSum += 4 * Ï€; + }, + point: d3_noop, + lineStart: d3_noop, + lineEnd: d3_noop, + polygonStart: function() { + d3_geo_areaRingU = 1, d3_geo_areaRingV = 0; + d3_geo_area.lineStart = d3_geo_areaRingStart; + }, + polygonEnd: function() { + var area = 2 * Math.atan2(d3_geo_areaRingV, d3_geo_areaRingU); + d3_geo_areaSum += area < 0 ? 4 * Ï€ + area : area; + d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop; + } + }; + function d3_geo_areaRingStart() { + var λ00, φ00, λ0, cosφ0, sinφ0; + d3_geo_area.point = function(λ, φ) { + d3_geo_area.point = nextPoint; + λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + Ï€ / 4), + sinφ0 = Math.sin(φ); + }; + function nextPoint(λ, φ) { + λ *= d3_radians; + φ = φ * d3_radians / 2 + Ï€ / 4; + var dλ = λ - λ0, cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u0 = d3_geo_areaRingU, v0 = d3_geo_areaRingV, u = cosφ0 * cosφ + k * Math.cos(dλ), v = k * Math.sin(dλ); + d3_geo_areaRingU = u0 * u - v0 * v; + d3_geo_areaRingV = v0 * u + u0 * v; + λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ; + } + d3_geo_area.lineEnd = function() { + nextPoint(λ00, φ00); + }; + } + d3.geo.bounds = d3_geo_bounds(d3_identity); + function d3_geo_bounds(projectStream) { + var x0, y0, x1, y1; + var bound = { + point: boundPoint, + lineStart: d3_noop, + lineEnd: d3_noop, + polygonStart: function() { + bound.lineEnd = boundPolygonLineEnd; + }, + polygonEnd: function() { + bound.point = boundPoint; + } + }; + function boundPoint(x, y) { + if (x < x0) x0 = x; + if (x > x1) x1 = x; + if (y < y0) y0 = y; + if (y > y1) y1 = y; + } + function boundPolygonLineEnd() { + bound.point = bound.lineEnd = d3_noop; + } + return function(feature) { + y1 = x1 = -(x0 = y0 = Infinity); + d3.geo.stream(feature, projectStream(bound)); + return [ [ x0, y0 ], [ x1, y1 ] ]; + }; + } + d3.geo.centroid = function(object) { + d3_geo_centroidDimension = d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0; + d3.geo.stream(object, d3_geo_centroid); + var m; + if (d3_geo_centroidW && Math.abs(m = Math.sqrt(d3_geo_centroidX * d3_geo_centroidX + d3_geo_centroidY * d3_geo_centroidY + d3_geo_centroidZ * d3_geo_centroidZ)) > ε) { + return [ Math.atan2(d3_geo_centroidY, d3_geo_centroidX) * d3_degrees, Math.asin(Math.max(-1, Math.min(1, d3_geo_centroidZ / m))) * d3_degrees ]; + } + }; + var d3_geo_centroidDimension, d3_geo_centroidW, d3_geo_centroidX, d3_geo_centroidY, d3_geo_centroidZ; + var d3_geo_centroid = { + sphere: function() { + if (d3_geo_centroidDimension < 2) { + d3_geo_centroidDimension = 2; + d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0; + } + }, + point: d3_geo_centroidPoint, + lineStart: d3_geo_centroidLineStart, + lineEnd: d3_geo_centroidLineEnd, + polygonStart: function() { + if (d3_geo_centroidDimension < 2) { + d3_geo_centroidDimension = 2; + d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0; + } + d3_geo_centroid.lineStart = d3_geo_centroidRingStart; + }, + polygonEnd: function() { + d3_geo_centroid.lineStart = d3_geo_centroidLineStart; + } + }; + function d3_geo_centroidPoint(λ, φ) { + if (d3_geo_centroidDimension) return; + ++d3_geo_centroidW; + λ *= d3_radians; + var cosφ = Math.cos(φ *= d3_radians); + d3_geo_centroidX += (cosφ * Math.cos(λ) - d3_geo_centroidX) / d3_geo_centroidW; + d3_geo_centroidY += (cosφ * Math.sin(λ) - d3_geo_centroidY) / d3_geo_centroidW; + d3_geo_centroidZ += (Math.sin(φ) - d3_geo_centroidZ) / d3_geo_centroidW; + } + function d3_geo_centroidRingStart() { + var λ00, φ00; + d3_geo_centroidDimension = 1; + d3_geo_centroidLineStart(); + d3_geo_centroidDimension = 2; + var linePoint = d3_geo_centroid.point; + d3_geo_centroid.point = function(λ, φ) { + linePoint(λ00 = λ, φ00 = φ); + }; + d3_geo_centroid.lineEnd = function() { + d3_geo_centroid.point(λ00, φ00); + d3_geo_centroidLineEnd(); + d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd; + }; + } + function d3_geo_centroidLineStart() { + var x0, y0, z0; + if (d3_geo_centroidDimension > 1) return; + if (d3_geo_centroidDimension < 1) { + d3_geo_centroidDimension = 1; + d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0; + } + d3_geo_centroid.point = function(λ, φ) { + λ *= d3_radians; + var cosφ = Math.cos(φ *= d3_radians); + x0 = cosφ * Math.cos(λ); + y0 = cosφ * Math.sin(λ); + z0 = Math.sin(φ); + d3_geo_centroid.point = nextPoint; + }; + function nextPoint(λ, φ) { + λ *= d3_radians; + var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), w = Math.atan2(Math.sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z); + d3_geo_centroidW += w; + d3_geo_centroidX += w * (x0 + (x0 = x)); + d3_geo_centroidY += w * (y0 + (y0 = y)); + d3_geo_centroidZ += w * (z0 + (z0 = z)); + } + } + function d3_geo_centroidLineEnd() { + d3_geo_centroid.point = d3_geo_centroidPoint; + } + function d3_geo_cartesian(spherical) { + var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ); + return [ cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ) ]; + } + function d3_geo_cartesianDot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + } + function d3_geo_cartesianCross(a, b) { + return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0] ]; + } + function d3_geo_cartesianAdd(a, b) { + a[0] += b[0]; + a[1] += b[1]; + a[2] += b[2]; + } + function d3_geo_cartesianScale(vector, k) { + return [ vector[0] * k, vector[1] * k, vector[2] * k ]; + } + function d3_geo_cartesianNormalize(d) { + var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); + d[0] /= l; + d[1] /= l; + d[2] /= l; + } + function d3_true() { + return true; + } + function d3_geo_spherical(cartesian) { + return [ Math.atan2(cartesian[1], cartesian[0]), Math.asin(Math.max(-1, Math.min(1, cartesian[2]))) ]; + } + function d3_geo_sphericalEqual(a, b) { + return Math.abs(a[0] - b[0]) < ε && Math.abs(a[1] - b[1]) < ε; + } + function d3_geo_clipPolygon(segments, compare, inside, interpolate, listener) { + var subject = [], clip = []; + segments.forEach(function(segment) { + if ((n = segment.length - 1) <= 0) return; + var n, p0 = segment[0], p1 = segment[n]; + if (d3_geo_sphericalEqual(p0, p1)) { + listener.lineStart(); + for (var i = 0; i < n; ++i) listener.point((p0 = segment[i])[0], p0[1]); + listener.lineEnd(); + return; + } + var a = { + point: p0, + points: segment, + other: null, + visited: false, + entry: true, + subject: true + }, b = { + point: p0, + points: [ p0 ], + other: a, + visited: false, + entry: false, + subject: false + }; + a.other = b; + subject.push(a); + clip.push(b); + a = { + point: p1, + points: [ p1 ], + other: null, + visited: false, + entry: false, + subject: true + }; + b = { + point: p1, + points: [ p1 ], + other: a, + visited: false, + entry: true, + subject: false + }; + a.other = b; + subject.push(a); + clip.push(b); + }); + clip.sort(compare); + d3_geo_clipPolygonLinkCircular(subject); + d3_geo_clipPolygonLinkCircular(clip); + if (!subject.length) return; + if (inside) for (var i = 1, e = !inside(clip[0].point), n = clip.length; i < n; ++i) { + clip[i].entry = e = !e; + } + var start = subject[0], current, points, point; + while (1) { + current = start; + while (current.visited) if ((current = current.next) === start) return; + points = current.points; + listener.lineStart(); + do { + current.visited = current.other.visited = true; + if (current.entry) { + if (current.subject) { + for (var i = 0; i < points.length; i++) listener.point((point = points[i])[0], point[1]); + } else { + interpolate(current.point, current.next.point, 1, listener); + } + current = current.next; + } else { + if (current.subject) { + points = current.prev.points; + for (var i = points.length; --i >= 0; ) listener.point((point = points[i])[0], point[1]); + } else { + interpolate(current.point, current.prev.point, -1, listener); + } + current = current.prev; + } + current = current.other; + points = current.points; + } while (!current.visited); + listener.lineEnd(); + } + } + function d3_geo_clipPolygonLinkCircular(array) { + if (!(n = array.length)) return; + var n, i = 0, a = array[0], b; + while (++i < n) { + a.next = b = array[i]; + b.prev = a; + a = b; + } + a.next = b = array[0]; + b.prev = a; + } + function d3_geo_clip(pointVisible, clipLine, interpolate) { + return function(listener) { + var line = clipLine(listener); + var clip = { + point: point, + lineStart: lineStart, + lineEnd: lineEnd, + polygonStart: function() { + clip.point = pointRing; + clip.lineStart = ringStart; + clip.lineEnd = ringEnd; + invisible = false; + invisibleArea = visibleArea = 0; + segments = []; + listener.polygonStart(); + }, + polygonEnd: function() { + clip.point = point; + clip.lineStart = lineStart; + clip.lineEnd = lineEnd; + segments = d3.merge(segments); + if (segments.length) { + d3_geo_clipPolygon(segments, d3_geo_clipSort, null, interpolate, listener); + } else if (visibleArea < -ε || invisible && invisibleArea < -ε) { + listener.lineStart(); + interpolate(null, null, 1, listener); + listener.lineEnd(); + } + listener.polygonEnd(); + segments = null; + }, + sphere: function() { + listener.polygonStart(); + listener.lineStart(); + interpolate(null, null, 1, listener); + listener.lineEnd(); + listener.polygonEnd(); + } + }; + function point(λ, φ) { + if (pointVisible(λ, φ)) listener.point(λ, φ); + } + function pointLine(λ, φ) { + line.point(λ, φ); + } + function lineStart() { + clip.point = pointLine; + line.lineStart(); + } + function lineEnd() { + clip.point = point; + line.lineEnd(); + } + var segments, visibleArea, invisibleArea, invisible; + var buffer = d3_geo_clipBufferListener(), ringListener = clipLine(buffer), ring; + function pointRing(λ, φ) { + ringListener.point(λ, φ); + ring.push([ λ, φ ]); + } + function ringStart() { + ringListener.lineStart(); + ring = []; + } + function ringEnd() { + pointRing(ring[0][0], ring[0][1]); + ringListener.lineEnd(); + var clean = ringListener.clean(), ringSegments = buffer.buffer(), segment, n = ringSegments.length; + if (!n) { + invisible = true; + invisibleArea += d3_geo_clipAreaRing(ring, -1); + ring = null; + return; + } + ring = null; + if (clean & 1) { + segment = ringSegments[0]; + visibleArea += d3_geo_clipAreaRing(segment, 1); + var n = segment.length - 1, i = -1, point; + listener.lineStart(); + while (++i < n) listener.point((point = segment[i])[0], point[1]); + listener.lineEnd(); + return; + } + if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); + segments.push(ringSegments.filter(d3_geo_clipSegmentLength1)); + } + return clip; + }; + } + function d3_geo_clipSegmentLength1(segment) { + return segment.length > 1; + } + function d3_geo_clipBufferListener() { + var lines = [], line; + return { + lineStart: function() { + lines.push(line = []); + }, + point: function(λ, φ) { + line.push([ λ, φ ]); + }, + lineEnd: d3_noop, + buffer: function() { + var buffer = lines; + lines = []; + line = null; + return buffer; + }, + rejoin: function() { + if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); + } + }; + } + function d3_geo_clipAreaRing(ring, invisible) { + if (!(n = ring.length)) return 0; + var n, i = 0, area = 0, p = ring[0], λ = p[0], φ = p[1], cosφ = Math.cos(φ), x0 = Math.atan2(invisible * Math.sin(λ) * cosφ, Math.sin(φ)), y0 = 1 - invisible * Math.cos(λ) * cosφ, x1 = x0, x, y; + while (++i < n) { + p = ring[i]; + cosφ = Math.cos(φ = p[1]); + x = Math.atan2(invisible * Math.sin(λ = p[0]) * cosφ, Math.sin(φ)); + y = 1 - invisible * Math.cos(λ) * cosφ; + if (Math.abs(y0 - 2) < ε && Math.abs(y - 2) < ε) continue; + if (Math.abs(y) < ε || Math.abs(y0) < ε) {} else if (Math.abs(Math.abs(x - x0) - Ï€) < ε) { + if (y + y0 > 2) area += 4 * (x - x0); + } else if (Math.abs(y0 - 2) < ε) area += 4 * (x - x1); else area += ((3 * Ï€ + x - x0) % (2 * Ï€) - Ï€) * (y0 + y); + x1 = x0, x0 = x, y0 = y; + } + return area; + } + function d3_geo_clipSort(a, b) { + return ((a = a.point)[0] < 0 ? a[1] - Ï€ / 2 - ε : Ï€ / 2 - a[1]) - ((b = b.point)[0] < 0 ? b[1] - Ï€ / 2 - ε : Ï€ / 2 - b[1]); + } + var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate); + function d3_geo_clipAntimeridianLine(listener) { + var λ0 = NaN, φ0 = NaN, sλ0 = NaN, clean; + return { + lineStart: function() { + listener.lineStart(); + clean = 1; + }, + point: function(λ1, φ1) { + var sλ1 = λ1 > 0 ? Ï€ : -Ï€, dλ = Math.abs(λ1 - λ0); + if (Math.abs(dλ - Ï€) < ε) { + listener.point(λ0, φ0 = (φ0 + φ1) / 2 > 0 ? Ï€ / 2 : -Ï€ / 2); + listener.point(sλ0, φ0); + listener.lineEnd(); + listener.lineStart(); + listener.point(sλ1, φ0); + listener.point(λ1, φ0); + clean = 0; + } else if (sλ0 !== sλ1 && dλ >= Ï€) { + if (Math.abs(λ0 - sλ0) < ε) λ0 -= sλ0 * ε; + if (Math.abs(λ1 - sλ1) < ε) λ1 -= sλ1 * ε; + φ0 = d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1); + listener.point(sλ0, φ0); + listener.lineEnd(); + listener.lineStart(); + listener.point(sλ1, φ0); + clean = 0; + } + listener.point(λ0 = λ1, φ0 = φ1); + sλ0 = sλ1; + }, + lineEnd: function() { + listener.lineEnd(); + λ0 = φ0 = NaN; + }, + clean: function() { + return 2 - clean; + } + }; + } + function d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1) { + var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1); + return Math.abs(sinλ0_λ1) > ε ? Math.atan((Math.sin(φ0) * (cosφ1 = Math.cos(φ1)) * Math.sin(λ1) - Math.sin(φ1) * (cosφ0 = Math.cos(φ0)) * Math.sin(λ0)) / (cosφ0 * cosφ1 * sinλ0_λ1)) : (φ0 + φ1) / 2; + } + function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) { + var φ; + if (from == null) { + φ = direction * Ï€ / 2; + listener.point(-Ï€, φ); + listener.point(0, φ); + listener.point(Ï€, φ); + listener.point(Ï€, 0); + listener.point(Ï€, -φ); + listener.point(0, -φ); + listener.point(-Ï€, -φ); + listener.point(-Ï€, 0); + listener.point(-Ï€, φ); + } else if (Math.abs(from[0] - to[0]) > ε) { + var s = (from[0] < to[0] ? 1 : -1) * Ï€; + φ = direction * s / 2; + listener.point(-s, φ); + listener.point(0, φ); + listener.point(s, φ); + } else { + listener.point(to[0], to[1]); + } + } + function d3_geo_clipCircle(radius) { + var cr = Math.cos(radius), smallRadius = cr > 0, notHemisphere = Math.abs(cr) > ε, interpolate = d3_geo_circleInterpolate(radius, 6 * d3_radians); + return d3_geo_clip(visible, clipLine, interpolate); + function visible(λ, φ) { + return Math.cos(λ) * Math.cos(φ) > cr; + } + function clipLine(listener) { + var point0, c0, v0, v00, clean; + return { + lineStart: function() { + v00 = v0 = false; + clean = 1; + }, + point: function(λ, φ) { + var point1 = [ λ, φ ], point2, v = visible(λ, φ), c = smallRadius ? v ? 0 : code(λ, φ) : v ? code(λ + (λ < 0 ? Ï€ : -Ï€), φ) : 0; + if (!point0 && (v00 = v0 = v)) listener.lineStart(); + if (v !== v0) { + point2 = intersect(point0, point1); + if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) { + point1[0] += ε; + point1[1] += ε; + v = visible(point1[0], point1[1]); + } + } + if (v !== v0) { + clean = 0; + if (v) { + listener.lineStart(); + point2 = intersect(point1, point0); + listener.point(point2[0], point2[1]); + } else { + point2 = intersect(point0, point1); + listener.point(point2[0], point2[1]); + listener.lineEnd(); + } + point0 = point2; + } else if (notHemisphere && point0 && smallRadius ^ v) { + var t; + if (!(c & c0) && (t = intersect(point1, point0, true))) { + clean = 0; + if (smallRadius) { + listener.lineStart(); + listener.point(t[0][0], t[0][1]); + listener.point(t[1][0], t[1][1]); + listener.lineEnd(); + } else { + listener.point(t[1][0], t[1][1]); + listener.lineEnd(); + listener.lineStart(); + listener.point(t[0][0], t[0][1]); + } + } + } + if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) { + listener.point(point1[0], point1[1]); + } + point0 = point1, v0 = v, c0 = c; + }, + lineEnd: function() { + if (v0) listener.lineEnd(); + point0 = null; + }, + clean: function() { + return clean | (v00 && v0) << 1; + } + }; + } + function intersect(a, b, two) { + var pa = d3_geo_cartesian(a), pb = d3_geo_cartesian(b); + var n1 = [ 1, 0, 0 ], n2 = d3_geo_cartesianCross(pa, pb), n2n2 = d3_geo_cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; + if (!determinant) return !two && a; + var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = d3_geo_cartesianCross(n1, n2), A = d3_geo_cartesianScale(n1, c1), B = d3_geo_cartesianScale(n2, c2); + d3_geo_cartesianAdd(A, B); + var u = n1xn2, w = d3_geo_cartesianDot(A, u), uu = d3_geo_cartesianDot(u, u), t2 = w * w - uu * (d3_geo_cartesianDot(A, A) - 1); + if (t2 < 0) return; + var t = Math.sqrt(t2), q = d3_geo_cartesianScale(u, (-w - t) / uu); + d3_geo_cartesianAdd(q, A); + q = d3_geo_spherical(q); + if (!two) return q; + var λ0 = a[0], λ1 = b[0], φ0 = a[1], φ1 = b[1], z; + if (λ1 < λ0) z = λ0, λ0 = λ1, λ1 = z; + var δλ = λ1 - λ0, polar = Math.abs(δλ - Ï€) < ε, meridian = polar || δλ < ε; + if (!polar && φ1 < φ0) z = φ0, φ0 = φ1, φ1 = z; + if (meridian ? polar ? φ0 + φ1 > 0 ^ q[1] < (Math.abs(q[0] - λ0) < ε ? φ0 : φ1) : φ0 <= q[1] && q[1] <= φ1 : δλ > Ï€ ^ (λ0 <= q[0] && q[0] <= λ1)) { + var q1 = d3_geo_cartesianScale(u, (-w + t) / uu); + d3_geo_cartesianAdd(q1, A); + return [ q, d3_geo_spherical(q1) ]; + } + } + function code(λ, φ) { + var r = smallRadius ? radius : Ï€ - radius, code = 0; + if (λ < -r) code |= 1; else if (λ > r) code |= 2; + if (φ < -r) code |= 4; else if (φ > r) code |= 8; + return code; + } + } + var d3_geo_clipViewMAX = 1e9; + function d3_geo_clipView(x0, y0, x1, y1) { + return function(listener) { + var listener_ = listener, bufferListener = d3_geo_clipBufferListener(), segments, polygon, ring; + var clip = { + point: point, + lineStart: lineStart, + lineEnd: lineEnd, + polygonStart: function() { + listener = bufferListener; + segments = []; + polygon = []; + }, + polygonEnd: function() { + listener = listener_; + if ((segments = d3.merge(segments)).length) { + listener.polygonStart(); + d3_geo_clipPolygon(segments, compare, inside, interpolate, listener); + listener.polygonEnd(); + } else if (insidePolygon([ x0, y0 ])) { + listener.polygonStart(), listener.lineStart(); + interpolate(null, null, 1, listener); + listener.lineEnd(), listener.polygonEnd(); + } + segments = polygon = ring = null; + } + }; + function inside(point) { + var a = corner(point, -1), i = insidePolygon([ a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0 ]); + return i; + } + function insidePolygon(p) { + var wn = 0, n = polygon.length, y = p[1]; + for (var i = 0; i < n; ++i) { + for (var j = 1, v = polygon[i], m = v.length, a = v[0]; j < m; ++j) { + b = v[j]; + if (a[1] <= y) { + if (b[1] > y && isLeft(a, b, p) > 0) ++wn; + } else { + if (b[1] <= y && isLeft(a, b, p) < 0) --wn; + } + a = b; + } + } + return wn !== 0; + } + function isLeft(a, b, c) { + return (b[0] - a[0]) * (c[1] - a[1]) - (c[0] - a[0]) * (b[1] - a[1]); + } + function interpolate(from, to, direction, listener) { + var a = 0, a1 = 0; + if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoints(from, to) < 0 ^ direction > 0) { + do { + listener.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); + } while ((a = (a + direction + 4) % 4) !== a1); + } else { + listener.point(to[0], to[1]); + } + } + function visible(x, y) { + return x0 <= x && x <= x1 && y0 <= y && y <= y1; + } + function point(x, y) { + if (visible(x, y)) listener.point(x, y); + } + var x__, y__, v__, x_, y_, v_, first; + function lineStart() { + clip.point = linePoint; + if (polygon) polygon.push(ring = []); + first = true; + v_ = false; + x_ = y_ = NaN; + } + function lineEnd() { + if (segments) { + linePoint(x__, y__); + if (v__ && v_) bufferListener.rejoin(); + segments.push(bufferListener.buffer()); + } + clip.point = point; + if (v_) listener.lineEnd(); + } + function linePoint(x, y) { + x = Math.max(-d3_geo_clipViewMAX, Math.min(d3_geo_clipViewMAX, x)); + y = Math.max(-d3_geo_clipViewMAX, Math.min(d3_geo_clipViewMAX, y)); + var v = visible(x, y); + if (polygon) ring.push([ x, y ]); + if (first) { + x__ = x, y__ = y, v__ = v; + first = false; + if (v) { + listener.lineStart(); + listener.point(x, y); + } + } else { + if (v && v_) listener.point(x, y); else { + var a = [ x_, y_ ], b = [ x, y ]; + if (clipLine(a, b)) { + if (!v_) { + listener.lineStart(); + listener.point(a[0], a[1]); + } + listener.point(b[0], b[1]); + if (!v) listener.lineEnd(); + } else { + listener.lineStart(); + listener.point(x, y); + } + } + } + x_ = x, y_ = y, v_ = v; + } + return clip; + }; + function corner(p, direction) { + return Math.abs(p[0] - x0) < ε ? direction > 0 ? 0 : 3 : Math.abs(p[0] - x1) < ε ? direction > 0 ? 2 : 1 : Math.abs(p[1] - y0) < ε ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; + } + function compare(a, b) { + return comparePoints(a.point, b.point); + } + function comparePoints(a, b) { + var ca = corner(a, 1), cb = corner(b, 1); + return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0]; + } + function clipLine(a, b) { + var dx = b[0] - a[0], dy = b[1] - a[1], t = [ 0, 1 ]; + if (Math.abs(dx) < ε && Math.abs(dy) < ε) return x0 <= a[0] && a[0] <= x1 && y0 <= a[1] && a[1] <= y1; + if (d3_geo_clipViewT(x0 - a[0], dx, t) && d3_geo_clipViewT(a[0] - x1, -dx, t) && d3_geo_clipViewT(y0 - a[1], dy, t) && d3_geo_clipViewT(a[1] - y1, -dy, t)) { + if (t[1] < 1) { + b[0] = a[0] + t[1] * dx; + b[1] = a[1] + t[1] * dy; + } + if (t[0] > 0) { + a[0] += t[0] * dx; + a[1] += t[0] * dy; + } + return true; + } + return false; + } + } + function d3_geo_clipViewT(num, denominator, t) { + if (Math.abs(denominator) < ε) return num <= 0; + var u = num / denominator; + if (denominator > 0) { + if (u > t[1]) return false; + if (u > t[0]) t[0] = u; + } else { + if (u < t[0]) return false; + if (u < t[1]) t[1] = u; + } + return true; + } + function d3_geo_compose(a, b) { + function compose(x, y) { + return x = a(x, y), b(x[0], x[1]); + } + if (a.invert && b.invert) compose.invert = function(x, y) { + return x = b.invert(x, y), x && a.invert(x[0], x[1]); + }; + return compose; + } + function d3_geo_resample(project) { + var δ2 = .5, maxDepth = 16; + function resample(stream) { + var λ0, x0, y0, a0, b0, c0; + var resample = { + point: point, + lineStart: lineStart, + lineEnd: lineEnd, + polygonStart: function() { + stream.polygonStart(); + resample.lineStart = polygonLineStart; + }, + polygonEnd: function() { + stream.polygonEnd(); + resample.lineStart = lineStart; + } + }; + function point(x, y) { + x = project(x, y); + stream.point(x[0], x[1]); + } + function lineStart() { + x0 = NaN; + resample.point = linePoint; + stream.lineStart(); + } + function linePoint(λ, φ) { + var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ); + resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); + stream.point(x0, y0); + } + function lineEnd() { + resample.point = point; + stream.lineEnd(); + } + function polygonLineStart() { + var λ00, φ00, x00, y00, a00, b00, c00; + lineStart(); + resample.point = function(λ, φ) { + linePoint(λ00 = λ, φ00 = φ), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; + resample.point = linePoint; + }; + resample.lineEnd = function() { + resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream); + resample.lineEnd = lineEnd; + lineEnd(); + }; + } + return resample; + } + function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) { + var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy; + if (d2 > 4 * δ2 && depth--) { + var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = Math.abs(Math.abs(c) - 1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2; + if (dz * dz / d2 > δ2 || Math.abs((dx * dx2 + dy * dy2) / d2 - .5) > .3) { + resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream); + stream.point(x2, y2); + resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream); + } + } + } + resample.precision = function(_) { + if (!arguments.length) return Math.sqrt(δ2); + maxDepth = (δ2 = _ * _) > 0 && 16; + return resample; + }; + return resample; + } + d3.geo.projection = d3_geo_projection; + d3.geo.projectionMutator = d3_geo_projectionMutator; + function d3_geo_projection(project) { + return d3_geo_projectionMutator(function() { + return project; + })(); + } + function d3_geo_projectionMutator(projectAt) { + var project, rotate, projectRotate, projectResample = d3_geo_resample(function(x, y) { + x = project(x, y); + return [ x[0] * k + δx, δy - x[1] * k ]; + }), k = 150, x = 480, y = 250, λ = 0, φ = 0, δλ = 0, δφ = 0, δγ = 0, δx, δy, preclip = d3_geo_clipAntimeridian, postclip = d3_identity, clipAngle = null, clipExtent = null; + function projection(point) { + point = projectRotate(point[0] * d3_radians, point[1] * d3_radians); + return [ point[0] * k + δx, δy - point[1] * k ]; + } + function invert(point) { + point = projectRotate.invert((point[0] - δx) / k, (δy - point[1]) / k); + return point && [ point[0] * d3_degrees, point[1] * d3_degrees ]; + } + projection.stream = function(stream) { + return d3_geo_projectionRadiansRotate(rotate, preclip(projectResample(postclip(stream)))); + }; + projection.clipAngle = function(_) { + if (!arguments.length) return clipAngle; + preclip = _ == null ? (clipAngle = _, d3_geo_clipAntimeridian) : d3_geo_clipCircle((clipAngle = +_) * d3_radians); + return projection; + }; + projection.clipExtent = function(_) { + if (!arguments.length) return clipExtent; + clipExtent = _; + postclip = _ == null ? d3_identity : d3_geo_clipView(_[0][0], _[0][1], _[1][0], _[1][1]); + return projection; + }; + projection.scale = function(_) { + if (!arguments.length) return k; + k = +_; + return reset(); + }; + projection.translate = function(_) { + if (!arguments.length) return [ x, y ]; + x = +_[0]; + y = +_[1]; + return reset(); + }; + projection.center = function(_) { + if (!arguments.length) return [ λ * d3_degrees, φ * d3_degrees ]; + λ = _[0] % 360 * d3_radians; + φ = _[1] % 360 * d3_radians; + return reset(); + }; + projection.rotate = function(_) { + if (!arguments.length) return [ δλ * d3_degrees, δφ * d3_degrees, δγ * d3_degrees ]; + δλ = _[0] % 360 * d3_radians; + δφ = _[1] % 360 * d3_radians; + δγ = _.length > 2 ? _[2] % 360 * d3_radians : 0; + return reset(); + }; + d3.rebind(projection, projectResample, "precision"); + function reset() { + projectRotate = d3_geo_compose(rotate = d3_geo_rotation(δλ, δφ, δγ), project); + var center = project(λ, φ); + δx = x - center[0] * k; + δy = y + center[1] * k; + return projection; + } + return function() { + project = projectAt.apply(this, arguments); + projection.invert = project.invert && invert; + return reset(); + }; + } + function d3_geo_projectionRadiansRotate(rotate, stream) { + return { + point: function(x, y) { + y = rotate(x * d3_radians, y * d3_radians), x = y[0]; + stream.point(x > Ï€ ? x - 2 * Ï€ : x < -Ï€ ? x + 2 * Ï€ : x, y[1]); + }, + sphere: function() { + stream.sphere(); + }, + lineStart: function() { + stream.lineStart(); + }, + lineEnd: function() { + stream.lineEnd(); + }, + polygonStart: function() { + stream.polygonStart(); + }, + polygonEnd: function() { + stream.polygonEnd(); + } + }; + } + function d3_geo_equirectangular(λ, φ) { + return [ λ, φ ]; + } + (d3.geo.equirectangular = function() { + return d3_geo_projection(d3_geo_equirectangular); + }).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular; + d3.geo.rotation = function(rotate) { + rotate = d3_geo_rotation(rotate[0] % 360 * d3_radians, rotate[1] * d3_radians, rotate.length > 2 ? rotate[2] * d3_radians : 0); + function forward(coordinates) { + coordinates = rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians); + return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates; + } + forward.invert = function(coordinates) { + coordinates = rotate.invert(coordinates[0] * d3_radians, coordinates[1] * d3_radians); + return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates; + }; + return forward; + }; + function d3_geo_rotation(δλ, δφ, δγ) { + return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_equirectangular; + } + function d3_geo_forwardRotationλ(δλ) { + return function(λ, φ) { + return λ += δλ, [ λ > Ï€ ? λ - 2 * Ï€ : λ < -Ï€ ? λ + 2 * Ï€ : λ, φ ]; + }; + } + function d3_geo_rotationλ(δλ) { + var rotation = d3_geo_forwardRotationλ(δλ); + rotation.invert = d3_geo_forwardRotationλ(-δλ); + return rotation; + } + function d3_geo_rotationφγ(δφ, δγ) { + var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ); + function rotation(λ, φ) { + var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδφ + x * sinδφ; + return [ Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), Math.asin(Math.max(-1, Math.min(1, k * cosδγ + y * sinδγ))) ]; + } + rotation.invert = function(λ, φ) { + var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδγ - y * sinδγ; + return [ Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), Math.asin(Math.max(-1, Math.min(1, k * cosδφ - x * sinδφ))) ]; + }; + return rotation; + } + d3.geo.circle = function() { + var origin = [ 0, 0 ], angle, precision = 6, interpolate; + function circle() { + var center = typeof origin === "function" ? origin.apply(this, arguments) : origin, rotate = d3_geo_rotation(-center[0] * d3_radians, -center[1] * d3_radians, 0).invert, ring = []; + interpolate(null, null, 1, { + point: function(x, y) { + ring.push(x = rotate(x, y)); + x[0] *= d3_degrees, x[1] *= d3_degrees; + } + }); + return { + type: "Polygon", + coordinates: [ ring ] + }; + } + circle.origin = function(x) { + if (!arguments.length) return origin; + origin = x; + return circle; + }; + circle.angle = function(x) { + if (!arguments.length) return angle; + interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians); + return circle; + }; + circle.precision = function(_) { + if (!arguments.length) return precision; + interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians); + return circle; + }; + return circle.angle(90); + }; + function d3_geo_circleInterpolate(radius, precision) { + var cr = Math.cos(radius), sr = Math.sin(radius); + return function(from, to, direction, listener) { + if (from != null) { + from = d3_geo_circleAngle(cr, from); + to = d3_geo_circleAngle(cr, to); + if (direction > 0 ? from < to : from > to) from += direction * 2 * Ï€; + } else { + from = radius + direction * 2 * Ï€; + to = radius; + } + var point; + for (var step = direction * precision, t = from; direction > 0 ? t > to : t < to; t -= step) { + listener.point((point = d3_geo_spherical([ cr, -sr * Math.cos(t), -sr * Math.sin(t) ]))[0], point[1]); + } + }; + } + function d3_geo_circleAngle(cr, point) { + var a = d3_geo_cartesian(point); + a[0] -= cr; + d3_geo_cartesianNormalize(a); + var angle = d3_acos(-a[1]); + return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ε) % (2 * Math.PI); + } + d3.geo.distance = function(a, b) { + var Δλ = (b[0] - a[0]) * d3_radians, φ0 = a[1] * d3_radians, φ1 = b[1] * d3_radians, sinΔλ = Math.sin(Δλ), cosΔλ = Math.cos(Δλ), sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), sinφ1 = Math.sin(φ1), cosφ1 = Math.cos(φ1), t; + return Math.atan2(Math.sqrt((t = cosφ1 * sinΔλ) * t + (t = cosφ0 * sinφ1 - sinφ0 * cosφ1 * cosΔλ) * t), sinφ0 * sinφ1 + cosφ0 * cosφ1 * cosΔλ); + }; + d3.geo.graticule = function() { + var x1, x0, X1, X0, y1, y0, Y1, Y0, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5; + function graticule() { + return { + type: "MultiLineString", + coordinates: lines() + }; + } + function lines() { + return d3.range(Math.ceil(X0 / DX) * DX, X1, DX).map(X).concat(d3.range(Math.ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(d3.range(Math.ceil(x0 / dx) * dx, x1, dx).filter(function(x) { + return Math.abs(x % DX) > ε; + }).map(x)).concat(d3.range(Math.ceil(y0 / dy) * dy, y1, dy).filter(function(y) { + return Math.abs(y % DY) > ε; + }).map(y)); + } + graticule.lines = function() { + return lines().map(function(coordinates) { + return { + type: "LineString", + coordinates: coordinates + }; + }); + }; + graticule.outline = function() { + return { + type: "Polygon", + coordinates: [ X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) ] + }; + }; + graticule.extent = function(_) { + if (!arguments.length) return graticule.minorExtent(); + return graticule.majorExtent(_).minorExtent(_); + }; + graticule.majorExtent = function(_) { + if (!arguments.length) return [ [ X0, Y0 ], [ X1, Y1 ] ]; + X0 = +_[0][0], X1 = +_[1][0]; + Y0 = +_[0][1], Y1 = +_[1][1]; + if (X0 > X1) _ = X0, X0 = X1, X1 = _; + if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; + return graticule.precision(precision); + }; + graticule.minorExtent = function(_) { + if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ]; + x0 = +_[0][0], x1 = +_[1][0]; + y0 = +_[0][1], y1 = +_[1][1]; + if (x0 > x1) _ = x0, x0 = x1, x1 = _; + if (y0 > y1) _ = y0, y0 = y1, y1 = _; + return graticule.precision(precision); + }; + graticule.step = function(_) { + if (!arguments.length) return graticule.minorStep(); + return graticule.majorStep(_).minorStep(_); + }; + graticule.majorStep = function(_) { + if (!arguments.length) return [ DX, DY ]; + DX = +_[0], DY = +_[1]; + return graticule; + }; + graticule.minorStep = function(_) { + if (!arguments.length) return [ dx, dy ]; + dx = +_[0], dy = +_[1]; + return graticule; + }; + graticule.precision = function(_) { + if (!arguments.length) return precision; + precision = +_; + x = d3_geo_graticuleX(y0, y1, 90); + y = d3_geo_graticuleY(x0, x1, precision); + X = d3_geo_graticuleX(Y0, Y1, 90); + Y = d3_geo_graticuleY(X0, X1, precision); + return graticule; + }; + return graticule.majorExtent([ [ -180, -90 + ε ], [ 180, 90 - ε ] ]).minorExtent([ [ -180, -80 - ε ], [ 180, 80 + ε ] ]); + }; + function d3_geo_graticuleX(y0, y1, dy) { + var y = d3.range(y0, y1 - ε, dy).concat(y1); + return function(x) { + return y.map(function(y) { + return [ x, y ]; + }); + }; + } + function d3_geo_graticuleY(x0, x1, dx) { + var x = d3.range(x0, x1 - ε, dx).concat(x1); + return function(y) { + return x.map(function(x) { + return [ x, y ]; + }); + }; + } + function d3_source(d) { + return d.source; + } + function d3_target(d) { + return d.target; + } + d3.geo.greatArc = function() { + var source = d3_source, source_, target = d3_target, target_; + function greatArc() { + return { + type: "LineString", + coordinates: [ source_ || source.apply(this, arguments), target_ || target.apply(this, arguments) ] + }; + } + greatArc.distance = function() { + return d3.geo.distance(source_ || source.apply(this, arguments), target_ || target.apply(this, arguments)); + }; + greatArc.source = function(_) { + if (!arguments.length) return source; + source = _, source_ = typeof _ === "function" ? null : _; + return greatArc; + }; + greatArc.target = function(_) { + if (!arguments.length) return target; + target = _, target_ = typeof _ === "function" ? null : _; + return greatArc; + }; + greatArc.precision = function() { + return arguments.length ? greatArc : 0; + }; + return greatArc; + }; + d3.geo.interpolate = function(source, target) { + return d3_geo_interpolate(source[0] * d3_radians, source[1] * d3_radians, target[0] * d3_radians, target[1] * d3_radians); + }; + function d3_geo_interpolate(x0, y0, x1, y1) { + var cy0 = Math.cos(y0), sy0 = Math.sin(y0), cy1 = Math.cos(y1), sy1 = Math.sin(y1), kx0 = cy0 * Math.cos(x0), ky0 = cy0 * Math.sin(x0), kx1 = cy1 * Math.cos(x1), ky1 = cy1 * Math.sin(x1), d = 2 * Math.asin(Math.sqrt(d3_haversin(y1 - y0) + cy0 * cy1 * d3_haversin(x1 - x0))), k = 1 / Math.sin(d); + var interpolate = d ? function(t) { + var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1; + return [ Math.atan2(y, x) * d3_degrees, Math.atan2(z, Math.sqrt(x * x + y * y)) * d3_degrees ]; + } : function() { + return [ x0 * d3_degrees, y0 * d3_degrees ]; + }; + interpolate.distance = d; + return interpolate; + } + d3.geo.length = function(object) { + d3_geo_lengthSum = 0; + d3.geo.stream(object, d3_geo_length); + return d3_geo_lengthSum; + }; + var d3_geo_lengthSum; + var d3_geo_length = { + sphere: d3_noop, + point: d3_noop, + lineStart: d3_geo_lengthLineStart, + lineEnd: d3_noop, + polygonStart: d3_noop, + polygonEnd: d3_noop + }; + function d3_geo_lengthLineStart() { + var λ0, sinφ0, cosφ0; + d3_geo_length.point = function(λ, φ) { + λ0 = λ * d3_radians, sinφ0 = Math.sin(φ *= d3_radians), cosφ0 = Math.cos(φ); + d3_geo_length.point = nextPoint; + }; + d3_geo_length.lineEnd = function() { + d3_geo_length.point = d3_geo_length.lineEnd = d3_noop; + }; + function nextPoint(λ, φ) { + var sinφ = Math.sin(φ *= d3_radians), cosφ = Math.cos(φ), t = Math.abs((λ *= d3_radians) - λ0), cosΔλ = Math.cos(t); + d3_geo_lengthSum += Math.atan2(Math.sqrt((t = cosφ * Math.sin(t)) * t + (t = cosφ0 * sinφ - sinφ0 * cosφ * cosΔλ) * t), sinφ0 * sinφ + cosφ0 * cosφ * cosΔλ); + λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ; + } + } + function d3_geo_conic(projectAt) { + var φ0 = 0, φ1 = Ï€ / 3, m = d3_geo_projectionMutator(projectAt), p = m(φ0, φ1); + p.parallels = function(_) { + if (!arguments.length) return [ φ0 / Ï€ * 180, φ1 / Ï€ * 180 ]; + return m(φ0 = _[0] * Ï€ / 180, φ1 = _[1] * Ï€ / 180); + }; + return p; + } + function d3_geo_conicEqualArea(φ0, φ1) { + var sinφ0 = Math.sin(φ0), n = (sinφ0 + Math.sin(φ1)) / 2, C = 1 + sinφ0 * (2 * n - sinφ0), Ï0 = Math.sqrt(C) / n; + function forward(λ, φ) { + var Ï = Math.sqrt(C - 2 * n * Math.sin(φ)) / n; + return [ Ï * Math.sin(λ *= n), Ï0 - Ï * Math.cos(λ) ]; + } + forward.invert = function(x, y) { + var Ï0_y = Ï0 - y; + return [ Math.atan2(x, Ï0_y) / n, Math.asin((C - (x * x + Ï0_y * Ï0_y) * n * n) / (2 * n)) ]; + }; + return forward; + } + (d3.geo.conicEqualArea = function() { + return d3_geo_conic(d3_geo_conicEqualArea); + }).raw = d3_geo_conicEqualArea; + d3.geo.albersUsa = function() { + var lower48 = d3.geo.conicEqualArea().rotate([ 98, 0 ]).center([ 0, 38 ]).parallels([ 29.5, 45.5 ]); + var alaska = d3.geo.conicEqualArea().rotate([ 160, 0 ]).center([ 0, 60 ]).parallels([ 55, 65 ]); + var hawaii = d3.geo.conicEqualArea().rotate([ 160, 0 ]).center([ 0, 20 ]).parallels([ 8, 18 ]); + var puertoRico = d3.geo.conicEqualArea().rotate([ 60, 0 ]).center([ 0, 10 ]).parallels([ 8, 18 ]); + var alaskaInvert, hawaiiInvert, puertoRicoInvert; + function albersUsa(coordinates) { + return projection(coordinates)(coordinates); + } + function projection(point) { + var lon = point[0], lat = point[1]; + return lat > 50 ? alaska : lon < -140 ? hawaii : lat < 21 ? puertoRico : lower48; + } + albersUsa.invert = function(coordinates) { + return alaskaInvert(coordinates) || hawaiiInvert(coordinates) || puertoRicoInvert(coordinates) || lower48.invert(coordinates); + }; + albersUsa.scale = function(x) { + if (!arguments.length) return lower48.scale(); + lower48.scale(x); + alaska.scale(x * .6); + hawaii.scale(x); + puertoRico.scale(x * 1.5); + return albersUsa.translate(lower48.translate()); + }; + albersUsa.translate = function(x) { + if (!arguments.length) return lower48.translate(); + var dz = lower48.scale(), dx = x[0], dy = x[1]; + lower48.translate(x); + alaska.translate([ dx - .4 * dz, dy + .17 * dz ]); + hawaii.translate([ dx - .19 * dz, dy + .2 * dz ]); + puertoRico.translate([ dx + .58 * dz, dy + .43 * dz ]); + alaskaInvert = d3_geo_albersUsaInvert(alaska, [ [ -180, 50 ], [ -130, 72 ] ]); + hawaiiInvert = d3_geo_albersUsaInvert(hawaii, [ [ -164, 18 ], [ -154, 24 ] ]); + puertoRicoInvert = d3_geo_albersUsaInvert(puertoRico, [ [ -67.5, 17.5 ], [ -65, 19 ] ]); + return albersUsa; + }; + return albersUsa.scale(1e3); + }; + function d3_geo_albersUsaInvert(projection, extent) { + var a = projection(extent[0]), b = projection([ .5 * (extent[0][0] + extent[1][0]), extent[0][1] ]), c = projection([ extent[1][0], extent[0][1] ]), d = projection(extent[1]); + var dya = b[1] - a[1], dxa = b[0] - a[0], dyb = c[1] - b[1], dxb = c[0] - b[0]; + var ma = dya / dxa, mb = dyb / dxb; + var cx = .5 * (ma * mb * (a[1] - c[1]) + mb * (a[0] + b[0]) - ma * (b[0] + c[0])) / (mb - ma), cy = (.5 * (a[0] + b[0]) - cx) / ma + .5 * (a[1] + b[1]); + var dx0 = d[0] - cx, dy0 = d[1] - cy, dx1 = a[0] - cx, dy1 = a[1] - cy, r0 = dx0 * dx0 + dy0 * dy0, r1 = dx1 * dx1 + dy1 * dy1; + var a0 = Math.atan2(dy0, dx0), a1 = Math.atan2(dy1, dx1); + return function(coordinates) { + var dx = coordinates[0] - cx, dy = coordinates[1] - cy, r = dx * dx + dy * dy, a = Math.atan2(dy, dx); + if (r0 < r && r < r1 && a0 < a && a < a1) return projection.invert(coordinates); + }; + } + var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = { + point: d3_noop, + lineStart: d3_noop, + lineEnd: d3_noop, + polygonStart: function() { + d3_geo_pathAreaPolygon = 0; + d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart; + }, + polygonEnd: function() { + d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop; + d3_geo_pathAreaSum += Math.abs(d3_geo_pathAreaPolygon / 2); + } + }; + function d3_geo_pathAreaRingStart() { + var x00, y00, x0, y0; + d3_geo_pathArea.point = function(x, y) { + d3_geo_pathArea.point = nextPoint; + x00 = x0 = x, y00 = y0 = y; + }; + function nextPoint(x, y) { + d3_geo_pathAreaPolygon += y0 * x - x0 * y; + x0 = x, y0 = y; + } + d3_geo_pathArea.lineEnd = function() { + nextPoint(x00, y00); + }; + } + function d3_geo_pathBuffer() { + var pointCircle = d3_geo_pathCircle(4.5), buffer = []; + var stream = { + point: point, + lineStart: function() { + stream.point = pointLineStart; + }, + lineEnd: lineEnd, + polygonStart: function() { + stream.lineEnd = lineEndPolygon; + }, + polygonEnd: function() { + stream.lineEnd = lineEnd; + stream.point = point; + }, + pointRadius: function(_) { + pointCircle = d3_geo_pathCircle(_); + return stream; + }, + result: function() { + if (buffer.length) { + var result = buffer.join(""); + buffer = []; + return result; + } + } + }; + function point(x, y) { + buffer.push("M", x, ",", y, pointCircle); + } + function pointLineStart(x, y) { + buffer.push("M", x, ",", y); + stream.point = pointLine; + } + function pointLine(x, y) { + buffer.push("L", x, ",", y); + } + function lineEnd() { + stream.point = point; + } + function lineEndPolygon() { + buffer.push("Z"); + } + return stream; + } + var d3_geo_pathCentroid = { + point: d3_geo_pathCentroidPoint, + lineStart: d3_geo_pathCentroidLineStart, + lineEnd: d3_geo_pathCentroidLineEnd, + polygonStart: function() { + d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidRingStart; + }, + polygonEnd: function() { + d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; + d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidLineStart; + d3_geo_pathCentroid.lineEnd = d3_geo_pathCentroidLineEnd; + } + }; + function d3_geo_pathCentroidPoint(x, y) { + if (d3_geo_centroidDimension) return; + d3_geo_centroidX += x; + d3_geo_centroidY += y; + ++d3_geo_centroidZ; + } + function d3_geo_pathCentroidLineStart() { + var x0, y0; + if (d3_geo_centroidDimension !== 1) { + if (d3_geo_centroidDimension < 1) { + d3_geo_centroidDimension = 1; + d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0; + } else return; + } + d3_geo_pathCentroid.point = function(x, y) { + d3_geo_pathCentroid.point = nextPoint; + x0 = x, y0 = y; + }; + function nextPoint(x, y) { + var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy); + d3_geo_centroidX += z * (x0 + x) / 2; + d3_geo_centroidY += z * (y0 + y) / 2; + d3_geo_centroidZ += z; + x0 = x, y0 = y; + } + } + function d3_geo_pathCentroidLineEnd() { + d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; + } + function d3_geo_pathCentroidRingStart() { + var x00, y00, x0, y0; + if (d3_geo_centroidDimension < 2) { + d3_geo_centroidDimension = 2; + d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0; + } + d3_geo_pathCentroid.point = function(x, y) { + d3_geo_pathCentroid.point = nextPoint; + x00 = x0 = x, y00 = y0 = y; + }; + function nextPoint(x, y) { + var z = y0 * x - x0 * y; + d3_geo_centroidX += z * (x0 + x); + d3_geo_centroidY += z * (y0 + y); + d3_geo_centroidZ += z * 3; + x0 = x, y0 = y; + } + d3_geo_pathCentroid.lineEnd = function() { + nextPoint(x00, y00); + }; + } + function d3_geo_pathContext(context) { + var pointRadius = 4.5; + var stream = { + point: point, + lineStart: function() { + stream.point = pointLineStart; + }, + lineEnd: lineEnd, + polygonStart: function() { + stream.lineEnd = lineEndPolygon; + }, + polygonEnd: function() { + stream.lineEnd = lineEnd; + stream.point = point; + }, + pointRadius: function(_) { + pointRadius = _; + return stream; + }, + result: d3_noop + }; + function point(x, y) { + context.moveTo(x, y); + context.arc(x, y, pointRadius, 0, 2 * Ï€); + } + function pointLineStart(x, y) { + context.moveTo(x, y); + stream.point = pointLine; + } + function pointLine(x, y) { + context.lineTo(x, y); + } + function lineEnd() { + stream.point = point; + } + function lineEndPolygon() { + context.closePath(); + } + return stream; + } + d3.geo.path = function() { + var pointRadius = 4.5, projection, context, projectStream, contextStream; + function path(object) { + if (object) d3.geo.stream(object, projectStream(contextStream.pointRadius(typeof pointRadius === "function" ? +pointRadius.apply(this, arguments) : pointRadius))); + return contextStream.result(); + } + path.area = function(object) { + d3_geo_pathAreaSum = 0; + d3.geo.stream(object, projectStream(d3_geo_pathArea)); + return d3_geo_pathAreaSum; + }; + path.centroid = function(object) { + d3_geo_centroidDimension = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0; + d3.geo.stream(object, projectStream(d3_geo_pathCentroid)); + return d3_geo_centroidZ ? [ d3_geo_centroidX / d3_geo_centroidZ, d3_geo_centroidY / d3_geo_centroidZ ] : undefined; + }; + path.bounds = function(object) { + return d3_geo_bounds(projectStream)(object); + }; + path.projection = function(_) { + if (!arguments.length) return projection; + projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity; + return path; + }; + path.context = function(_) { + if (!arguments.length) return context; + contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_); + return path; + }; + path.pointRadius = function(_) { + if (!arguments.length) return pointRadius; + pointRadius = typeof _ === "function" ? _ : +_; + return path; + }; + return path.projection(d3.geo.albersUsa()).context(null); + }; + function d3_geo_pathCircle(radius) { + return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + +2 * radius + "z"; + } + function d3_geo_pathProjectStream(project) { + var resample = d3_geo_resample(function(λ, φ) { + return project([ λ * d3_degrees, φ * d3_degrees ]); + }); + return function(stream) { + stream = resample(stream); + return { + point: function(λ, φ) { + stream.point(λ * d3_radians, φ * d3_radians); + }, + sphere: function() { + stream.sphere(); + }, + lineStart: function() { + stream.lineStart(); + }, + lineEnd: function() { + stream.lineEnd(); + }, + polygonStart: function() { + stream.polygonStart(); + }, + polygonEnd: function() { + stream.polygonEnd(); + } + }; + }; + } + d3.geo.albers = function() { + return d3.geo.conicEqualArea().parallels([ 29.5, 45.5 ]).rotate([ 98, 0 ]).center([ 0, 38 ]).scale(1e3); + }; + function d3_geo_azimuthal(scale, angle) { + function azimuthal(λ, φ) { + var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ); + return [ k * cosφ * Math.sin(λ), k * Math.sin(φ) ]; + } + azimuthal.invert = function(x, y) { + var Ï = Math.sqrt(x * x + y * y), c = angle(Ï), sinc = Math.sin(c), cosc = Math.cos(c); + return [ Math.atan2(x * sinc, Ï * cosc), Math.asin(Ï && y * sinc / Ï) ]; + }; + return azimuthal; + } + var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(function(cosλcosφ) { + return Math.sqrt(2 / (1 + cosλcosφ)); + }, function(Ï) { + return 2 * Math.asin(Ï / 2); + }); + (d3.geo.azimuthalEqualArea = function() { + return d3_geo_projection(d3_geo_azimuthalEqualArea); + }).raw = d3_geo_azimuthalEqualArea; + var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(function(cosλcosφ) { + var c = Math.acos(cosλcosφ); + return c && c / Math.sin(c); + }, d3_identity); + (d3.geo.azimuthalEquidistant = function() { + return d3_geo_projection(d3_geo_azimuthalEquidistant); + }).raw = d3_geo_azimuthalEquidistant; + function d3_geo_conicConformal(φ0, φ1) { + var cosφ0 = Math.cos(φ0), t = function(φ) { + return Math.tan(Ï€ / 4 + φ / 2); + }, n = φ0 === φ1 ? Math.sin(φ0) : Math.log(cosφ0 / Math.cos(φ1)) / Math.log(t(φ1) / t(φ0)), F = cosφ0 * Math.pow(t(φ0), n) / n; + if (!n) return d3_geo_mercator; + function forward(λ, φ) { + var Ï = Math.abs(Math.abs(φ) - Ï€ / 2) < ε ? 0 : F / Math.pow(t(φ), n); + return [ Ï * Math.sin(n * λ), F - Ï * Math.cos(n * λ) ]; + } + forward.invert = function(x, y) { + var Ï0_y = F - y, Ï = d3_sgn(n) * Math.sqrt(x * x + Ï0_y * Ï0_y); + return [ Math.atan2(x, Ï0_y) / n, 2 * Math.atan(Math.pow(F / Ï, 1 / n)) - Ï€ / 2 ]; + }; + return forward; + } + (d3.geo.conicConformal = function() { + return d3_geo_conic(d3_geo_conicConformal); + }).raw = d3_geo_conicConformal; + function d3_geo_conicEquidistant(φ0, φ1) { + var cosφ0 = Math.cos(φ0), n = φ0 === φ1 ? Math.sin(φ0) : (cosφ0 - Math.cos(φ1)) / (φ1 - φ0), G = cosφ0 / n + φ0; + if (Math.abs(n) < ε) return d3_geo_equirectangular; + function forward(λ, φ) { + var Ï = G - φ; + return [ Ï * Math.sin(n * λ), G - Ï * Math.cos(n * λ) ]; + } + forward.invert = function(x, y) { + var Ï0_y = G - y; + return [ Math.atan2(x, Ï0_y) / n, G - d3_sgn(n) * Math.sqrt(x * x + Ï0_y * Ï0_y) ]; + }; + return forward; + } + (d3.geo.conicEquidistant = function() { + return d3_geo_conic(d3_geo_conicEquidistant); + }).raw = d3_geo_conicEquidistant; + var d3_geo_gnomonic = d3_geo_azimuthal(function(cosλcosφ) { + return 1 / cosλcosφ; + }, Math.atan); + (d3.geo.gnomonic = function() { + return d3_geo_projection(d3_geo_gnomonic); + }).raw = d3_geo_gnomonic; + function d3_geo_mercator(λ, φ) { + return [ λ, Math.log(Math.tan(Ï€ / 4 + φ / 2)) ]; + } + d3_geo_mercator.invert = function(x, y) { + return [ x, 2 * Math.atan(Math.exp(y)) - Ï€ / 2 ]; + }; + function d3_geo_mercatorProjection(project) { + var m = d3_geo_projection(project), scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, clipAuto; + m.scale = function() { + var v = scale.apply(m, arguments); + return v === m ? clipAuto ? m.clipExtent(null) : m : v; + }; + m.translate = function() { + var v = translate.apply(m, arguments); + return v === m ? clipAuto ? m.clipExtent(null) : m : v; + }; + m.clipExtent = function(_) { + var v = clipExtent.apply(m, arguments); + if (v === m) { + if (clipAuto = _ == null) { + var k = Ï€ * scale(), t = translate(); + clipExtent([ [ t[0] - k, t[1] - k ], [ t[0] + k, t[1] + k ] ]); + } + } else if (clipAuto) { + v = null; + } + return v; + }; + return m.clipExtent(null); + } + (d3.geo.mercator = function() { + return d3_geo_mercatorProjection(d3_geo_mercator); + }).raw = d3_geo_mercator; + var d3_geo_orthographic = d3_geo_azimuthal(function() { + return 1; + }, Math.asin); + (d3.geo.orthographic = function() { + return d3_geo_projection(d3_geo_orthographic); + }).raw = d3_geo_orthographic; + var d3_geo_stereographic = d3_geo_azimuthal(function(cosλcosφ) { + return 1 / (1 + cosλcosφ); + }, function(Ï) { + return 2 * Math.atan(Ï); + }); + (d3.geo.stereographic = function() { + return d3_geo_projection(d3_geo_stereographic); + }).raw = d3_geo_stereographic; + function d3_geo_transverseMercator(λ, φ) { + var B = Math.cos(φ) * Math.sin(λ); + return [ Math.log((1 + B) / (1 - B)) / 2, Math.atan2(Math.tan(φ), Math.cos(λ)) ]; + } + d3_geo_transverseMercator.invert = function(x, y) { + return [ Math.atan2(d3_sinh(x), Math.cos(y)), d3_asin(Math.sin(y) / d3_cosh(x)) ]; + }; + (d3.geo.transverseMercator = function() { + return d3_geo_mercatorProjection(d3_geo_transverseMercator); + }).raw = d3_geo_transverseMercator; + d3.geom = {}; + d3.svg = {}; + function d3_svg_line(projection) { + var x = d3_svg_lineX, y = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7; + function line(data) { + var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y); + function segment() { + segments.push("M", interpolate(projection(points), tension)); + } + while (++i < n) { + if (defined.call(this, d = data[i], i)) { + points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]); + } else if (points.length) { + segment(); + points = []; + } + } + if (points.length) segment(); + return segments.length ? segments.join("") : null; + } + line.x = function(_) { + if (!arguments.length) return x; + x = _; + return line; + }; + line.y = function(_) { + if (!arguments.length) return y; + y = _; + return line; + }; + line.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return line; + }; + line.interpolate = function(_) { + if (!arguments.length) return interpolateKey; + if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; + return line; + }; + line.tension = function(_) { + if (!arguments.length) return tension; + tension = _; + return line; + }; + return line; + } + d3.svg.line = function() { + return d3_svg_line(d3_identity); + }; + function d3_svg_lineX(d) { + return d[0]; + } + function d3_svg_lineY(d) { + return d[1]; + } + var d3_svg_lineInterpolators = d3.map({ + linear: d3_svg_lineLinear, + "linear-closed": d3_svg_lineLinearClosed, + "step-before": d3_svg_lineStepBefore, + "step-after": d3_svg_lineStepAfter, + basis: d3_svg_lineBasis, + "basis-open": d3_svg_lineBasisOpen, + "basis-closed": d3_svg_lineBasisClosed, + bundle: d3_svg_lineBundle, + cardinal: d3_svg_lineCardinal, + "cardinal-open": d3_svg_lineCardinalOpen, + "cardinal-closed": d3_svg_lineCardinalClosed, + monotone: d3_svg_lineMonotone + }); + d3_svg_lineInterpolators.forEach(function(key, value) { + value.key = key; + value.closed = /-closed$/.test(key); + }); + function d3_svg_lineLinear(points) { + return points.join("L"); + } + function d3_svg_lineLinearClosed(points) { + return d3_svg_lineLinear(points) + "Z"; + } + function d3_svg_lineStepBefore(points) { + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; + while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]); + return path.join(""); + } + function d3_svg_lineStepAfter(points) { + var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; + while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]); + return path.join(""); + } + function d3_svg_lineCardinalOpen(points, tension) { + return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension)); + } + function d3_svg_lineCardinalClosed(points, tension) { + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), + points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension)); + } + function d3_svg_lineCardinal(points, tension) { + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension)); + } + function d3_svg_lineHermite(points, tangents) { + if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) { + return d3_svg_lineLinear(points); + } + var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1; + if (quad) { + path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1]; + p0 = points[1]; + pi = 2; + } + if (tangents.length > 1) { + t = tangents[1]; + p = points[pi]; + pi++; + path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; + for (var i = 2; i < tangents.length; i++, pi++) { + p = points[pi]; + t = tangents[i]; + path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; + } + } + if (quad) { + var lp = points[pi]; + path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1]; + } + return path; + } + function d3_svg_lineCardinalTangents(points, tension) { + var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length; + while (++i < n) { + p0 = p1; + p1 = p2; + p2 = points[i]; + tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]); + } + return tangents; + } + function d3_svg_lineBasis(points) { + if (points.length < 3) return d3_svg_lineLinear(points); + var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0 ]; + d3_svg_lineBasisBezier(path, px, py); + while (++i < n) { + pi = points[i]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + i = -1; + while (++i < 2) { + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); + } + function d3_svg_lineBasisOpen(points) { + if (points.length < 4) return d3_svg_lineLinear(points); + var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ]; + while (++i < 3) { + pi = points[i]; + px.push(pi[0]); + py.push(pi[1]); + } + path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)); + --i; + while (++i < n) { + pi = points[i]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); + } + function d3_svg_lineBasisClosed(points) { + var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = []; + while (++i < 4) { + pi = points[i % n]; + px.push(pi[0]); + py.push(pi[1]); + } + path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ]; + --i; + while (++i < m) { + pi = points[i % n]; + px.shift(); + px.push(pi[0]); + py.shift(); + py.push(pi[1]); + d3_svg_lineBasisBezier(path, px, py); + } + return path.join(""); + } + function d3_svg_lineBundle(points, tension) { + var n = points.length - 1; + if (n) { + var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t; + while (++i <= n) { + p = points[i]; + t = i / n; + p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); + p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); + } + } + return d3_svg_lineBasis(points); + } + function d3_svg_lineDot4(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ]; + function d3_svg_lineBasisBezier(path, x, y) { + path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y)); + } + function d3_svg_lineSlope(p0, p1) { + return (p1[1] - p0[1]) / (p1[0] - p0[0]); + } + function d3_svg_lineFiniteDifferences(points) { + var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1); + while (++i < j) { + m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2; + } + m[i] = d; + return m; + } + function d3_svg_lineMonotoneTangents(points) { + var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1; + while (++i < j) { + d = d3_svg_lineSlope(points[i], points[i + 1]); + if (Math.abs(d) < 1e-6) { + m[i] = m[i + 1] = 0; + } else { + a = m[i] / d; + b = m[i + 1] / d; + s = a * a + b * b; + if (s > 9) { + s = d * 3 / Math.sqrt(s); + m[i] = s * a; + m[i + 1] = s * b; + } + } + } + i = -1; + while (++i <= j) { + s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i])); + tangents.push([ s || 0, m[i] * s || 0 ]); + } + return tangents; + } + function d3_svg_lineMonotone(points) { + return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points)); + } + d3.geom.hull = function(vertices) { + var x = d3_svg_lineX, y = d3_svg_lineY; + if (arguments.length) return hull(vertices); + function hull(data) { + if (data.length < 3) return []; + var fx = d3_functor(x), fy = d3_functor(y), n = data.length, vertices, plen = n - 1, points = [], stack = [], d, i, j, h = 0, x1, y1, x2, y2, u, v, a, sp; + if (fx === d3_svg_lineX && y === d3_svg_lineY) vertices = data; else for (i = 0, + vertices = []; i < n; ++i) { + vertices.push([ +fx.call(this, d = data[i], i), +fy.call(this, d, i) ]); + } + for (i = 1; i < n; ++i) { + if (vertices[i][1] < vertices[h][1]) { + h = i; + } else if (vertices[i][1] == vertices[h][1]) { + h = vertices[i][0] < vertices[h][0] ? i : h; + } + } + for (i = 0; i < n; ++i) { + if (i === h) continue; + y1 = vertices[i][1] - vertices[h][1]; + x1 = vertices[i][0] - vertices[h][0]; + points.push({ + angle: Math.atan2(y1, x1), + index: i + }); + } + points.sort(function(a, b) { + return a.angle - b.angle; + }); + a = points[0].angle; + v = points[0].index; + u = 0; + for (i = 1; i < plen; ++i) { + j = points[i].index; + if (a == points[i].angle) { + x1 = vertices[v][0] - vertices[h][0]; + y1 = vertices[v][1] - vertices[h][1]; + x2 = vertices[j][0] - vertices[h][0]; + y2 = vertices[j][1] - vertices[h][1]; + if (x1 * x1 + y1 * y1 >= x2 * x2 + y2 * y2) { + points[i].index = -1; + } else { + points[u].index = -1; + a = points[i].angle; + u = i; + v = j; + } + } else { + a = points[i].angle; + u = i; + v = j; + } + } + stack.push(h); + for (i = 0, j = 0; i < 2; ++j) { + if (points[j].index !== -1) { + stack.push(points[j].index); + i++; + } + } + sp = stack.length; + for (;j < plen; ++j) { + if (points[j].index === -1) continue; + while (!d3_geom_hullCCW(stack[sp - 2], stack[sp - 1], points[j].index, vertices)) { + --sp; + } + stack[sp++] = points[j].index; + } + var poly = []; + for (i = 0; i < sp; ++i) { + poly.push(data[stack[i]]); + } + return poly; + } + hull.x = function(_) { + return arguments.length ? (x = _, hull) : x; + }; + hull.y = function(_) { + return arguments.length ? (y = _, hull) : y; + }; + return hull; + }; + function d3_geom_hullCCW(i1, i2, i3, v) { + var t, a, b, c, d, e, f; + t = v[i1]; + a = t[0]; + b = t[1]; + t = v[i2]; + c = t[0]; + d = t[1]; + t = v[i3]; + e = t[0]; + f = t[1]; + return (f - b) * (c - a) - (d - b) * (e - a) > 0; + } + d3.geom.polygon = function(coordinates) { + coordinates.area = function() { + var i = 0, n = coordinates.length, area = coordinates[n - 1][1] * coordinates[0][0] - coordinates[n - 1][0] * coordinates[0][1]; + while (++i < n) { + area += coordinates[i - 1][1] * coordinates[i][0] - coordinates[i - 1][0] * coordinates[i][1]; + } + return area * .5; + }; + coordinates.centroid = function(k) { + var i = -1, n = coordinates.length, x = 0, y = 0, a, b = coordinates[n - 1], c; + if (!arguments.length) k = -1 / (6 * coordinates.area()); + while (++i < n) { + a = b; + b = coordinates[i]; + c = a[0] * b[1] - b[0] * a[1]; + x += (a[0] + b[0]) * c; + y += (a[1] + b[1]) * c; + } + return [ x * k, y * k ]; + }; + coordinates.clip = function(subject) { + var input, i = -1, n = coordinates.length, j, m, a = coordinates[n - 1], b, c, d; + while (++i < n) { + input = subject.slice(); + subject.length = 0; + b = coordinates[i]; + c = input[(m = input.length) - 1]; + j = -1; + while (++j < m) { + d = input[j]; + if (d3_geom_polygonInside(d, a, b)) { + if (!d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + subject.push(d); + } else if (d3_geom_polygonInside(c, a, b)) { + subject.push(d3_geom_polygonIntersect(c, d, a, b)); + } + c = d; + } + a = b; + } + return subject; + }; + return coordinates; + }; + function d3_geom_polygonInside(p, a, b) { + return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]); + } + function d3_geom_polygonIntersect(c, d, a, b) { + var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21); + return [ x1 + ua * x21, y1 + ua * y21 ]; + } + d3.geom.delaunay = function(vertices) { + var edges = vertices.map(function() { + return []; + }), triangles = []; + d3_geom_voronoiTessellate(vertices, function(e) { + edges[e.region.l.index].push(vertices[e.region.r.index]); + }); + edges.forEach(function(edge, i) { + var v = vertices[i], cx = v[0], cy = v[1]; + edge.forEach(function(v) { + v.angle = Math.atan2(v[0] - cx, v[1] - cy); + }); + edge.sort(function(a, b) { + return a.angle - b.angle; + }); + for (var j = 0, m = edge.length - 1; j < m; j++) { + triangles.push([ v, edge[j], edge[j + 1] ]); + } + }); + return triangles; + }; + d3.geom.voronoi = function(points) { + var size = null, x = d3_svg_lineX, y = d3_svg_lineY, clip; + if (arguments.length) return voronoi(points); + function voronoi(data) { + var points, polygons = data.map(function() { + return []; + }), fx = d3_functor(x), fy = d3_functor(y), d, i, n = data.length, Z = 1e6; + if (fx === d3_svg_lineX && fy === d3_svg_lineY) points = data; else for (points = [], + i = 0; i < n; ++i) { + points.push([ +fx.call(this, d = data[i], i), +fy.call(this, d, i) ]); + } + d3_geom_voronoiTessellate(points, function(e) { + var s1, s2, x1, x2, y1, y2; + if (e.a === 1 && e.b >= 0) { + s1 = e.ep.r; + s2 = e.ep.l; + } else { + s1 = e.ep.l; + s2 = e.ep.r; + } + if (e.a === 1) { + y1 = s1 ? s1.y : -Z; + x1 = e.c - e.b * y1; + y2 = s2 ? s2.y : Z; + x2 = e.c - e.b * y2; + } else { + x1 = s1 ? s1.x : -Z; + y1 = e.c - e.a * x1; + x2 = s2 ? s2.x : Z; + y2 = e.c - e.a * x2; + } + var v1 = [ x1, y1 ], v2 = [ x2, y2 ]; + polygons[e.region.l.index].push(v1, v2); + polygons[e.region.r.index].push(v1, v2); + }); + polygons = polygons.map(function(polygon, i) { + var cx = points[i][0], cy = points[i][1], angle = polygon.map(function(v) { + return Math.atan2(v[0] - cx, v[1] - cy); + }), order = d3.range(polygon.length).sort(function(a, b) { + return angle[a] - angle[b]; + }); + return order.filter(function(d, i) { + return !i || angle[d] - angle[order[i - 1]] > ε; + }).map(function(d) { + return polygon[d]; + }); + }); + polygons.forEach(function(polygon, i) { + var n = polygon.length; + if (!n) return polygon.push([ -Z, -Z ], [ -Z, Z ], [ Z, Z ], [ Z, -Z ]); + if (n > 2) return; + var p0 = points[i], p1 = polygon[0], p2 = polygon[1], x0 = p0[0], y0 = p0[1], x1 = p1[0], y1 = p1[1], x2 = p2[0], y2 = p2[1], dx = Math.abs(x2 - x1), dy = y2 - y1; + if (Math.abs(dy) < ε) { + var y = y0 < y1 ? -Z : Z; + polygon.push([ -Z, y ], [ Z, y ]); + } else if (dx < ε) { + var x = x0 < x1 ? -Z : Z; + polygon.push([ x, -Z ], [ x, Z ]); + } else { + var y = (x2 - x1) * (y1 - y0) < (x1 - x0) * (y2 - y1) ? Z : -Z, z = Math.abs(dy) - dx; + if (Math.abs(z) < ε) { + polygon.push([ dy < 0 ? y : -y, y ]); + } else { + if (z > 0) y *= -1; + polygon.push([ -Z, y ], [ Z, y ]); + } + } + }); + if (clip) for (i = 0; i < n; ++i) clip(polygons[i]); + for (i = 0; i < n; ++i) polygons[i].point = data[i]; + return polygons; + } + voronoi.x = function(_) { + return arguments.length ? (x = _, voronoi) : x; + }; + voronoi.y = function(_) { + return arguments.length ? (y = _, voronoi) : y; + }; + voronoi.size = function(_) { + if (!arguments.length) return size; + if (_ == null) { + clip = null; + } else { + size = [ +_[0], +_[1] ]; + clip = d3.geom.polygon([ [ 0, 0 ], [ 0, size[1] ], size, [ size[0], 0 ] ]).clip; + } + return voronoi; + }; + voronoi.links = function(data) { + var points, graph = data.map(function() { + return []; + }), links = [], fx = d3_functor(x), fy = d3_functor(y), d, i, n = data.length; + if (fx === d3_svg_lineX && fy === d3_svg_lineY) points = data; else for (i = 0; i < n; ++i) { + points.push([ +fx.call(this, d = data[i], i), +fy.call(this, d, i) ]); + } + d3_geom_voronoiTessellate(points, function(e) { + var l = e.region.l.index, r = e.region.r.index; + if (graph[l][r]) return; + graph[l][r] = graph[r][l] = true; + links.push({ + source: data[l], + target: data[r] + }); + }); + return links; + }; + voronoi.triangles = function(data) { + if (x === d3_svg_lineX && y === d3_svg_lineY) return d3.geom.delaunay(data); + var points, point, fx = d3_functor(x), fy = d3_functor(y), d, i, n; + for (i = 0, points = [], n = data.length; i < n; ++i) { + point = [ +fx.call(this, d = data[i], i), +fy.call(this, d, i) ]; + point.data = d; + points.push(point); + } + return d3.geom.delaunay(points).map(function(triangle) { + return triangle.map(function(point) { + return point.data; + }); + }); + }; + return voronoi; + }; + var d3_geom_voronoiOpposite = { + l: "r", + r: "l" + }; + function d3_geom_voronoiTessellate(points, callback) { + var Sites = { + list: points.map(function(v, i) { + return { + index: i, + x: v[0], + y: v[1] + }; + }).sort(function(a, b) { + return a.y < b.y ? -1 : a.y > b.y ? 1 : a.x < b.x ? -1 : a.x > b.x ? 1 : 0; + }), + bottomSite: null + }; + var EdgeList = { + list: [], + leftEnd: null, + rightEnd: null, + init: function() { + EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l"); + EdgeList.leftEnd.r = EdgeList.rightEnd; + EdgeList.rightEnd.l = EdgeList.leftEnd; + EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd); + }, + createHalfEdge: function(edge, side) { + return { + edge: edge, + side: side, + vertex: null, + l: null, + r: null + }; + }, + insert: function(lb, he) { + he.l = lb; + he.r = lb.r; + lb.r.l = he; + lb.r = he; + }, + leftBound: function(p) { + var he = EdgeList.leftEnd; + do { + he = he.r; + } while (he != EdgeList.rightEnd && Geom.rightOf(he, p)); + he = he.l; + return he; + }, + del: function(he) { + he.l.r = he.r; + he.r.l = he.l; + he.edge = null; + }, + right: function(he) { + return he.r; + }, + left: function(he) { + return he.l; + }, + leftRegion: function(he) { + return he.edge == null ? Sites.bottomSite : he.edge.region[he.side]; + }, + rightRegion: function(he) { + return he.edge == null ? Sites.bottomSite : he.edge.region[d3_geom_voronoiOpposite[he.side]]; + } + }; + var Geom = { + bisect: function(s1, s2) { + var newEdge = { + region: { + l: s1, + r: s2 + }, + ep: { + l: null, + r: null + } + }; + var dx = s2.x - s1.x, dy = s2.y - s1.y, adx = dx > 0 ? dx : -dx, ady = dy > 0 ? dy : -dy; + newEdge.c = s1.x * dx + s1.y * dy + (dx * dx + dy * dy) * .5; + if (adx > ady) { + newEdge.a = 1; + newEdge.b = dy / dx; + newEdge.c /= dx; + } else { + newEdge.b = 1; + newEdge.a = dx / dy; + newEdge.c /= dy; + } + return newEdge; + }, + intersect: function(el1, el2) { + var e1 = el1.edge, e2 = el2.edge; + if (!e1 || !e2 || e1.region.r == e2.region.r) { + return null; + } + var d = e1.a * e2.b - e1.b * e2.a; + if (Math.abs(d) < 1e-10) { + return null; + } + var xint = (e1.c * e2.b - e2.c * e1.b) / d, yint = (e2.c * e1.a - e1.c * e2.a) / d, e1r = e1.region.r, e2r = e2.region.r, el, e; + if (e1r.y < e2r.y || e1r.y == e2r.y && e1r.x < e2r.x) { + el = el1; + e = e1; + } else { + el = el2; + e = e2; + } + var rightOfSite = xint >= e.region.r.x; + if (rightOfSite && el.side === "l" || !rightOfSite && el.side === "r") { + return null; + } + return { + x: xint, + y: yint + }; + }, + rightOf: function(he, p) { + var e = he.edge, topsite = e.region.r, rightOfSite = p.x > topsite.x; + if (rightOfSite && he.side === "l") { + return 1; + } + if (!rightOfSite && he.side === "r") { + return 0; + } + if (e.a === 1) { + var dyp = p.y - topsite.y, dxp = p.x - topsite.x, fast = 0, above = 0; + if (!rightOfSite && e.b < 0 || rightOfSite && e.b >= 0) { + above = fast = dyp >= e.b * dxp; + } else { + above = p.x + p.y * e.b > e.c; + if (e.b < 0) { + above = !above; + } + if (!above) { + fast = 1; + } + } + if (!fast) { + var dxs = topsite.x - e.region.l.x; + above = e.b * (dxp * dxp - dyp * dyp) < dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b); + if (e.b < 0) { + above = !above; + } + } + } else { + var yl = e.c - e.a * p.x, t1 = p.y - yl, t2 = p.x - topsite.x, t3 = yl - topsite.y; + above = t1 * t1 > t2 * t2 + t3 * t3; + } + return he.side === "l" ? above : !above; + }, + endPoint: function(edge, side, site) { + edge.ep[side] = site; + if (!edge.ep[d3_geom_voronoiOpposite[side]]) return; + callback(edge); + }, + distance: function(s, t) { + var dx = s.x - t.x, dy = s.y - t.y; + return Math.sqrt(dx * dx + dy * dy); + } + }; + var EventQueue = { + list: [], + insert: function(he, site, offset) { + he.vertex = site; + he.ystar = site.y + offset; + for (var i = 0, list = EventQueue.list, l = list.length; i < l; i++) { + var next = list[i]; + if (he.ystar > next.ystar || he.ystar == next.ystar && site.x > next.vertex.x) { + continue; + } else { + break; + } + } + list.splice(i, 0, he); + }, + del: function(he) { + for (var i = 0, ls = EventQueue.list, l = ls.length; i < l && ls[i] != he; ++i) {} + ls.splice(i, 1); + }, + empty: function() { + return EventQueue.list.length === 0; + }, + nextEvent: function(he) { + for (var i = 0, ls = EventQueue.list, l = ls.length; i < l; ++i) { + if (ls[i] == he) return ls[i + 1]; + } + return null; + }, + min: function() { + var elem = EventQueue.list[0]; + return { + x: elem.vertex.x, + y: elem.ystar + }; + }, + extractMin: function() { + return EventQueue.list.shift(); + } + }; + EdgeList.init(); + Sites.bottomSite = Sites.list.shift(); + var newSite = Sites.list.shift(), newIntStar; + var lbnd, rbnd, llbnd, rrbnd, bisector; + var bot, top, temp, p, v; + var e, pm; + while (true) { + if (!EventQueue.empty()) { + newIntStar = EventQueue.min(); + } + if (newSite && (EventQueue.empty() || newSite.y < newIntStar.y || newSite.y == newIntStar.y && newSite.x < newIntStar.x)) { + lbnd = EdgeList.leftBound(newSite); + rbnd = EdgeList.right(lbnd); + bot = EdgeList.rightRegion(lbnd); + e = Geom.bisect(bot, newSite); + bisector = EdgeList.createHalfEdge(e, "l"); + EdgeList.insert(lbnd, bisector); + p = Geom.intersect(lbnd, bisector); + if (p) { + EventQueue.del(lbnd); + EventQueue.insert(lbnd, p, Geom.distance(p, newSite)); + } + lbnd = bisector; + bisector = EdgeList.createHalfEdge(e, "r"); + EdgeList.insert(lbnd, bisector); + p = Geom.intersect(bisector, rbnd); + if (p) { + EventQueue.insert(bisector, p, Geom.distance(p, newSite)); + } + newSite = Sites.list.shift(); + } else if (!EventQueue.empty()) { + lbnd = EventQueue.extractMin(); + llbnd = EdgeList.left(lbnd); + rbnd = EdgeList.right(lbnd); + rrbnd = EdgeList.right(rbnd); + bot = EdgeList.leftRegion(lbnd); + top = EdgeList.rightRegion(rbnd); + v = lbnd.vertex; + Geom.endPoint(lbnd.edge, lbnd.side, v); + Geom.endPoint(rbnd.edge, rbnd.side, v); + EdgeList.del(lbnd); + EventQueue.del(rbnd); + EdgeList.del(rbnd); + pm = "l"; + if (bot.y > top.y) { + temp = bot; + bot = top; + top = temp; + pm = "r"; + } + e = Geom.bisect(bot, top); + bisector = EdgeList.createHalfEdge(e, pm); + EdgeList.insert(llbnd, bisector); + Geom.endPoint(e, d3_geom_voronoiOpposite[pm], v); + p = Geom.intersect(llbnd, bisector); + if (p) { + EventQueue.del(llbnd); + EventQueue.insert(llbnd, p, Geom.distance(p, bot)); + } + p = Geom.intersect(bisector, rrbnd); + if (p) { + EventQueue.insert(bisector, p, Geom.distance(p, bot)); + } + } else { + break; + } + } + for (lbnd = EdgeList.right(EdgeList.leftEnd); lbnd != EdgeList.rightEnd; lbnd = EdgeList.right(lbnd)) { + callback(lbnd.edge); + } + } + d3.geom.quadtree = function(points, x1, y1, x2, y2) { + var x = d3_svg_lineX, y = d3_svg_lineY, compat; + if (compat = arguments.length) { + x = d3_geom_quadtreeCompatX; + y = d3_geom_quadtreeCompatY; + if (compat === 3) { + y2 = y1; + x2 = x1; + y1 = x1 = 0; + } + return quadtree(points); + } + function quadtree(data) { + var d, fx = d3_functor(x), fy = d3_functor(y), xs, ys, i, n, x1_, y1_, x2_, y2_; + if (x1 != null) { + x1_ = x1, y1_ = y1, x2_ = x2, y2_ = y2; + } else { + x2_ = y2_ = -(x1_ = y1_ = Infinity); + xs = [], ys = []; + n = data.length; + if (compat) for (i = 0; i < n; ++i) { + d = data[i]; + if (d.x < x1_) x1_ = d.x; + if (d.y < y1_) y1_ = d.y; + if (d.x > x2_) x2_ = d.x; + if (d.y > y2_) y2_ = d.y; + xs.push(d.x); + ys.push(d.y); + } else for (i = 0; i < n; ++i) { + var x_ = +fx(d = data[i], i), y_ = +fy(d, i); + if (x_ < x1_) x1_ = x_; + if (y_ < y1_) y1_ = y_; + if (x_ > x2_) x2_ = x_; + if (y_ > y2_) y2_ = y_; + xs.push(x_); + ys.push(y_); + } + } + var dx = x2_ - x1_, dy = y2_ - y1_; + if (dx > dy) y2_ = y1_ + dx; else x2_ = x1_ + dy; + function insert(n, d, x, y, x1, y1, x2, y2) { + if (isNaN(x) || isNaN(y)) return; + if (n.leaf) { + var nx = n.x, ny = n.y; + if (nx != null) { + if (Math.abs(nx - x) + Math.abs(ny - y) < .01) { + insertChild(n, d, x, y, x1, y1, x2, y2); + } else { + var nPoint = n.point; + n.x = n.y = n.point = null; + insertChild(n, nPoint, nx, ny, x1, y1, x2, y2); + insertChild(n, d, x, y, x1, y1, x2, y2); + } + } else { + n.x = x, n.y = y, n.point = d; + } + } else { + insertChild(n, d, x, y, x1, y1, x2, y2); + } + } + function insertChild(n, d, x, y, x1, y1, x2, y2) { + var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = x >= sx, bottom = y >= sy, i = (bottom << 1) + right; + n.leaf = false; + n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); + if (right) x1 = sx; else x2 = sx; + if (bottom) y1 = sy; else y2 = sy; + insert(n, d, x, y, x1, y1, x2, y2); + } + var root = d3_geom_quadtreeNode(); + root.add = function(d) { + insert(root, d, +fx(d, ++i), +fy(d, i), x1_, y1_, x2_, y2_); + }; + root.visit = function(f) { + d3_geom_quadtreeVisit(f, root, x1_, y1_, x2_, y2_); + }; + i = -1; + if (x1 == null) { + while (++i < n) { + insert(root, data[i], xs[i], ys[i], x1_, y1_, x2_, y2_); + } + --i; + } else data.forEach(root.add); + xs = ys = data = d = null; + return root; + } + quadtree.x = function(_) { + return arguments.length ? (x = _, quadtree) : x; + }; + quadtree.y = function(_) { + return arguments.length ? (y = _, quadtree) : y; + }; + quadtree.size = function(_) { + if (!arguments.length) return x1 == null ? null : [ x2, y2 ]; + if (_ == null) { + x1 = y1 = x2 = y2 = null; + } else { + x1 = y1 = 0; + x2 = +_[0], y2 = +_[1]; + } + return quadtree; + }; + return quadtree; + }; + function d3_geom_quadtreeCompatX(d) { + return d.x; + } + function d3_geom_quadtreeCompatY(d) { + return d.y; + } + function d3_geom_quadtreeNode() { + return { + leaf: true, + nodes: [], + point: null, + x: null, + y: null + }; + } + function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { + if (!f(node, x1, y1, x2, y2)) { + var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes; + if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); + if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); + if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); + if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); + } + } + d3.interpolateRgb = d3_interpolateRgb; + function d3_interpolateRgb(a, b) { + a = d3.rgb(a); + b = d3.rgb(b); + var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab; + return function(t) { + return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t)); + }; + } + d3.transform = function(string) { + var g = d3_document.createElementNS(d3.ns.prefix.svg, "g"); + return (d3.transform = function(string) { + g.setAttribute("transform", string); + var t = g.transform.baseVal.consolidate(); + return new d3_transform(t ? t.matrix : d3_transformIdentity); + })(string); + }; + function d3_transform(m) { + var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0; + if (r0[0] * r1[1] < r1[0] * r0[1]) { + r0[0] *= -1; + r0[1] *= -1; + kx *= -1; + kz *= -1; + } + this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees; + this.translate = [ m.e, m.f ]; + this.scale = [ kx, ky ]; + this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0; + } + d3_transform.prototype.toString = function() { + return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")"; + }; + function d3_transformDot(a, b) { + return a[0] * b[0] + a[1] * b[1]; + } + function d3_transformNormalize(a) { + var k = Math.sqrt(d3_transformDot(a, a)); + if (k) { + a[0] /= k; + a[1] /= k; + } + return k; + } + function d3_transformCombine(a, b, k) { + a[0] += k * b[0]; + a[1] += k * b[1]; + return a; + } + var d3_transformIdentity = { + a: 1, + b: 0, + c: 0, + d: 1, + e: 0, + f: 0 + }; + d3.interpolateNumber = d3_interpolateNumber; + function d3_interpolateNumber(a, b) { + b -= a = +a; + return function(t) { + return a + b * t; + }; + } + d3.interpolateTransform = d3_interpolateTransform; + function d3_interpolateTransform(a, b) { + var s = [], q = [], n, A = d3.transform(a), B = d3.transform(b), ta = A.translate, tb = B.translate, ra = A.rotate, rb = B.rotate, wa = A.skew, wb = B.skew, ka = A.scale, kb = B.scale; + if (ta[0] != tb[0] || ta[1] != tb[1]) { + s.push("translate(", null, ",", null, ")"); + q.push({ + i: 1, + x: d3_interpolateNumber(ta[0], tb[0]) + }, { + i: 3, + x: d3_interpolateNumber(ta[1], tb[1]) + }); + } else if (tb[0] || tb[1]) { + s.push("translate(" + tb + ")"); + } else { + s.push(""); + } + if (ra != rb) { + if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360; + q.push({ + i: s.push(s.pop() + "rotate(", null, ")") - 2, + x: d3_interpolateNumber(ra, rb) + }); + } else if (rb) { + s.push(s.pop() + "rotate(" + rb + ")"); + } + if (wa != wb) { + q.push({ + i: s.push(s.pop() + "skewX(", null, ")") - 2, + x: d3_interpolateNumber(wa, wb) + }); + } else if (wb) { + s.push(s.pop() + "skewX(" + wb + ")"); + } + if (ka[0] != kb[0] || ka[1] != kb[1]) { + n = s.push(s.pop() + "scale(", null, ",", null, ")"); + q.push({ + i: n - 4, + x: d3_interpolateNumber(ka[0], kb[0]) + }, { + i: n - 2, + x: d3_interpolateNumber(ka[1], kb[1]) + }); + } else if (kb[0] != 1 || kb[1] != 1) { + s.push(s.pop() + "scale(" + kb + ")"); + } + n = q.length; + return function(t) { + var i = -1, o; + while (++i < n) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; + } + d3.interpolateObject = d3_interpolateObject; + function d3_interpolateObject(a, b) { + var i = {}, c = {}, k; + for (k in a) { + if (k in b) { + i[k] = d3_interpolateByName(k)(a[k], b[k]); + } else { + c[k] = a[k]; + } + } + for (k in b) { + if (!(k in a)) { + c[k] = b[k]; + } + } + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; + } + d3.interpolateString = d3_interpolateString; + function d3_interpolateString(a, b) { + var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o; + a = a + "", b = b + ""; + d3_interpolate_number.lastIndex = 0; + for (i = 0; m = d3_interpolate_number.exec(b); ++i) { + if (m.index) s.push(b.substring(s0, s1 = m.index)); + q.push({ + i: s.length, + x: m[0] + }); + s.push(null); + s0 = d3_interpolate_number.lastIndex; + } + if (s0 < b.length) s.push(b.substring(s0)); + for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) { + o = q[i]; + if (o.x == m[0]) { + if (o.i) { + if (s[o.i + 1] == null) { + s[o.i - 1] += o.x; + s.splice(o.i, 1); + for (j = i + 1; j < n; ++j) q[j].i--; + } else { + s[o.i - 1] += o.x + s[o.i + 1]; + s.splice(o.i, 2); + for (j = i + 1; j < n; ++j) q[j].i -= 2; + } + } else { + if (s[o.i + 1] == null) { + s[o.i] = o.x; + } else { + s[o.i] = o.x + s[o.i + 1]; + s.splice(o.i + 1, 1); + for (j = i + 1; j < n; ++j) q[j].i--; + } + } + q.splice(i, 1); + n--; + i--; + } else { + o.x = d3_interpolateNumber(parseFloat(m[0]), parseFloat(o.x)); + } + } + while (i < n) { + o = q.pop(); + if (s[o.i + 1] == null) { + s[o.i] = o.x; + } else { + s[o.i] = o.x + s[o.i + 1]; + s.splice(o.i + 1, 1); + } + n--; + } + if (s.length === 1) { + return s[0] == null ? q[0].x : function() { + return b; + }; + } + return function(t) { + for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; + } + var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g; + d3.interpolate = d3_interpolate; + function d3_interpolate(a, b) { + var i = d3.interpolators.length, f; + while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ; + return f; + } + function d3_interpolateByName(name) { + return name == "transform" ? d3_interpolateTransform : d3_interpolate; + } + d3.interpolators = [ function(a, b) { + var t = typeof b; + return (t === "string" || t !== typeof a ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) ? d3_interpolateRgb : d3_interpolateString : b instanceof d3_Color ? d3_interpolateRgb : t === "object" ? Array.isArray(b) ? d3_interpolateArray : d3_interpolateObject : d3_interpolateNumber)(a, b); + } ]; + d3.interpolateArray = d3_interpolateArray; + function d3_interpolateArray(a, b) { + var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i; + for (i = 0; i < n0; ++i) x.push(d3_interpolate(a[i], b[i])); + for (;i < na; ++i) c[i] = a[i]; + for (;i < nb; ++i) c[i] = b[i]; + return function(t) { + for (i = 0; i < n0; ++i) c[i] = x[i](t); + return c; + }; + } + var d3_ease_default = function() { + return d3_identity; + }; + var d3_ease = d3.map({ + linear: d3_ease_default, + poly: d3_ease_poly, + quad: function() { + return d3_ease_quad; + }, + cubic: function() { + return d3_ease_cubic; + }, + sin: function() { + return d3_ease_sin; + }, + exp: function() { + return d3_ease_exp; + }, + circle: function() { + return d3_ease_circle; + }, + elastic: d3_ease_elastic, + back: d3_ease_back, + bounce: function() { + return d3_ease_bounce; + } + }); + var d3_ease_mode = d3.map({ + "in": d3_identity, + out: d3_ease_reverse, + "in-out": d3_ease_reflect, + "out-in": function(f) { + return d3_ease_reflect(d3_ease_reverse(f)); + } + }); + d3.ease = function(name) { + var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in"; + t = d3_ease.get(t) || d3_ease_default; + m = d3_ease_mode.get(m) || d3_identity; + return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1)))); + }; + function d3_ease_clamp(f) { + return function(t) { + return t <= 0 ? 0 : t >= 1 ? 1 : f(t); + }; + } + function d3_ease_reverse(f) { + return function(t) { + return 1 - f(1 - t); + }; + } + function d3_ease_reflect(f) { + return function(t) { + return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t)); + }; + } + function d3_ease_quad(t) { + return t * t; + } + function d3_ease_cubic(t) { + return t * t * t; + } + function d3_ease_cubicInOut(t) { + if (t <= 0) return 0; + if (t >= 1) return 1; + var t2 = t * t, t3 = t2 * t; + return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75); + } + function d3_ease_poly(e) { + return function(t) { + return Math.pow(t, e); + }; + } + function d3_ease_sin(t) { + return 1 - Math.cos(t * Ï€ / 2); + } + function d3_ease_exp(t) { + return Math.pow(2, 10 * (t - 1)); + } + function d3_ease_circle(t) { + return 1 - Math.sqrt(1 - t * t); + } + function d3_ease_elastic(a, p) { + var s; + if (arguments.length < 2) p = .45; + if (arguments.length) s = p / (2 * Ï€) * Math.asin(1 / a); else a = 1, s = p / 4; + return function(t) { + return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Ï€ / p); + }; + } + function d3_ease_back(s) { + if (!s) s = 1.70158; + return function(t) { + return t * t * ((s + 1) * t - s); + }; + } + function d3_ease_bounce(t) { + return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375; + } + d3.interpolateHcl = d3_interpolateHcl; + function d3_interpolateHcl(a, b) { + a = d3.hcl(a); + b = d3.hcl(b); + var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al; + if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; + return function(t) { + return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + ""; + }; + } + d3.interpolateHsl = d3_interpolateHsl; + function d3_interpolateHsl(a, b) { + a = d3.hsl(a); + b = d3.hsl(b); + var h0 = a.h, s0 = a.s, l0 = a.l, h1 = b.h - h0, s1 = b.s - s0, l1 = b.l - l0; + if (h1 > 180) h1 -= 360; else if (h1 < -180) h1 += 360; + return function(t) { + return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t) + ""; + }; + } + d3.interpolateLab = d3_interpolateLab; + function d3_interpolateLab(a, b) { + a = d3.lab(a); + b = d3.lab(b); + var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab; + return function(t) { + return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + ""; + }; + } + d3.interpolateRound = d3_interpolateRound; + function d3_interpolateRound(a, b) { + b -= a; + return function(t) { + return Math.round(a + b * t); + }; + } + function d3_uninterpolateNumber(a, b) { + b = b - (a = +a) ? 1 / (b - a) : 0; + return function(x) { + return (x - a) * b; + }; + } + function d3_uninterpolateClamp(a, b) { + b = b - (a = +a) ? 1 / (b - a) : 0; + return function(x) { + return Math.max(0, Math.min(1, (x - a) * b)); + }; + } + d3.layout = {}; + d3.layout.bundle = function() { + return function(links) { + var paths = [], i = -1, n = links.length; + while (++i < n) paths.push(d3_layout_bundlePath(links[i])); + return paths; + }; + }; + function d3_layout_bundlePath(link) { + var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ]; + while (start !== lca) { + start = start.parent; + points.push(start); + } + var k = points.length; + while (end !== lca) { + points.splice(k, 0, end); + end = end.parent; + } + return points; + } + function d3_layout_bundleAncestors(node) { + var ancestors = [], parent = node.parent; + while (parent != null) { + ancestors.push(node); + node = parent; + parent = parent.parent; + } + ancestors.push(node); + return ancestors; + } + function d3_layout_bundleLeastCommonAncestor(a, b) { + if (a === b) return a; + var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null; + while (aNode === bNode) { + sharedNode = aNode; + aNode = aNodes.pop(); + bNode = bNodes.pop(); + } + return sharedNode; + } + d3.layout.chord = function() { + var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords; + function relayout() { + var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j; + chords = []; + groups = []; + k = 0, i = -1; + while (++i < n) { + x = 0, j = -1; + while (++j < n) { + x += matrix[i][j]; + } + groupSums.push(x); + subgroupIndex.push(d3.range(n)); + k += x; + } + if (sortGroups) { + groupIndex.sort(function(a, b) { + return sortGroups(groupSums[a], groupSums[b]); + }); + } + if (sortSubgroups) { + subgroupIndex.forEach(function(d, i) { + d.sort(function(a, b) { + return sortSubgroups(matrix[i][a], matrix[i][b]); + }); + }); + } + k = (2 * Ï€ - padding * n) / k; + x = 0, i = -1; + while (++i < n) { + x0 = x, j = -1; + while (++j < n) { + var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k; + subgroups[di + "-" + dj] = { + index: di, + subindex: dj, + startAngle: a0, + endAngle: a1, + value: v + }; + } + groups[di] = { + index: di, + startAngle: x0, + endAngle: x, + value: (x - x0) / k + }; + x += padding; + } + i = -1; + while (++i < n) { + j = i - 1; + while (++j < n) { + var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i]; + if (source.value || target.value) { + chords.push(source.value < target.value ? { + source: target, + target: source + } : { + source: source, + target: target + }); + } + } + } + if (sortChords) resort(); + } + function resort() { + chords.sort(function(a, b) { + return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2); + }); + } + chord.matrix = function(x) { + if (!arguments.length) return matrix; + n = (matrix = x) && matrix.length; + chords = groups = null; + return chord; + }; + chord.padding = function(x) { + if (!arguments.length) return padding; + padding = x; + chords = groups = null; + return chord; + }; + chord.sortGroups = function(x) { + if (!arguments.length) return sortGroups; + sortGroups = x; + chords = groups = null; + return chord; + }; + chord.sortSubgroups = function(x) { + if (!arguments.length) return sortSubgroups; + sortSubgroups = x; + chords = null; + return chord; + }; + chord.sortChords = function(x) { + if (!arguments.length) return sortChords; + sortChords = x; + if (chords) resort(); + return chord; + }; + chord.chords = function() { + if (!chords) relayout(); + return chords; + }; + chord.groups = function() { + if (!groups) relayout(); + return groups; + }; + return chord; + }; + d3.layout.force = function() { + var force = {}, event = d3.dispatch("start", "tick", "end"), size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, gravity = .1, theta = .8, nodes = [], links = [], distances, strengths, charges; + function repulse(node) { + return function(quad, x1, _, x2) { + if (quad.point !== node) { + var dx = quad.cx - node.x, dy = quad.cy - node.y, dn = 1 / Math.sqrt(dx * dx + dy * dy); + if ((x2 - x1) * dn < theta) { + var k = quad.charge * dn * dn; + node.px -= dx * k; + node.py -= dy * k; + return true; + } + if (quad.point && isFinite(dn)) { + var k = quad.pointCharge * dn * dn; + node.px -= dx * k; + node.py -= dy * k; + } + } + return !quad.charge; + }; + } + force.tick = function() { + if ((alpha *= .99) < .005) { + event.end({ + type: "end", + alpha: alpha = 0 + }); + return true; + } + var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y; + for (i = 0; i < m; ++i) { + o = links[i]; + s = o.source; + t = o.target; + x = t.x - s.x; + y = t.y - s.y; + if (l = x * x + y * y) { + l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l; + x *= l; + y *= l; + t.x -= x * (k = s.weight / (t.weight + s.weight)); + t.y -= y * k; + s.x += x * (k = 1 - k); + s.y += y * k; + } + } + if (k = alpha * gravity) { + x = size[0] / 2; + y = size[1] / 2; + i = -1; + if (k) while (++i < n) { + o = nodes[i]; + o.x += (x - o.x) * k; + o.y += (y - o.y) * k; + } + } + if (charge) { + d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges); + i = -1; + while (++i < n) { + if (!(o = nodes[i]).fixed) { + q.visit(repulse(o)); + } + } + } + i = -1; + while (++i < n) { + o = nodes[i]; + if (o.fixed) { + o.x = o.px; + o.y = o.py; + } else { + o.x -= (o.px - (o.px = o.x)) * friction; + o.y -= (o.py - (o.py = o.y)) * friction; + } + } + event.tick({ + type: "tick", + alpha: alpha + }); + }; + force.nodes = function(x) { + if (!arguments.length) return nodes; + nodes = x; + return force; + }; + force.links = function(x) { + if (!arguments.length) return links; + links = x; + return force; + }; + force.size = function(x) { + if (!arguments.length) return size; + size = x; + return force; + }; + force.linkDistance = function(x) { + if (!arguments.length) return linkDistance; + linkDistance = typeof x === "function" ? x : +x; + return force; + }; + force.distance = force.linkDistance; + force.linkStrength = function(x) { + if (!arguments.length) return linkStrength; + linkStrength = typeof x === "function" ? x : +x; + return force; + }; + force.friction = function(x) { + if (!arguments.length) return friction; + friction = +x; + return force; + }; + force.charge = function(x) { + if (!arguments.length) return charge; + charge = typeof x === "function" ? x : +x; + return force; + }; + force.gravity = function(x) { + if (!arguments.length) return gravity; + gravity = +x; + return force; + }; + force.theta = function(x) { + if (!arguments.length) return theta; + theta = +x; + return force; + }; + force.alpha = function(x) { + if (!arguments.length) return alpha; + x = +x; + if (alpha) { + if (x > 0) alpha = x; else alpha = 0; + } else if (x > 0) { + event.start({ + type: "start", + alpha: alpha = x + }); + d3.timer(force.tick); + } + return force; + }; + force.start = function() { + var i, j, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o; + for (i = 0; i < n; ++i) { + (o = nodes[i]).index = i; + o.weight = 0; + } + for (i = 0; i < m; ++i) { + o = links[i]; + if (typeof o.source == "number") o.source = nodes[o.source]; + if (typeof o.target == "number") o.target = nodes[o.target]; + ++o.source.weight; + ++o.target.weight; + } + for (i = 0; i < n; ++i) { + o = nodes[i]; + if (isNaN(o.x)) o.x = position("x", w); + if (isNaN(o.y)) o.y = position("y", h); + if (isNaN(o.px)) o.px = o.x; + if (isNaN(o.py)) o.py = o.y; + } + distances = []; + if (typeof linkDistance === "function") for (i = 0; i < m; ++i) distances[i] = +linkDistance.call(this, links[i], i); else for (i = 0; i < m; ++i) distances[i] = linkDistance; + strengths = []; + if (typeof linkStrength === "function") for (i = 0; i < m; ++i) strengths[i] = +linkStrength.call(this, links[i], i); else for (i = 0; i < m; ++i) strengths[i] = linkStrength; + charges = []; + if (typeof charge === "function") for (i = 0; i < n; ++i) charges[i] = +charge.call(this, nodes[i], i); else for (i = 0; i < n; ++i) charges[i] = charge; + function position(dimension, size) { + var neighbors = neighbor(i), j = -1, m = neighbors.length, x; + while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x; + return Math.random() * size; + } + function neighbor() { + if (!neighbors) { + neighbors = []; + for (j = 0; j < n; ++j) { + neighbors[j] = []; + } + for (j = 0; j < m; ++j) { + var o = links[j]; + neighbors[o.source.index].push(o.target); + neighbors[o.target.index].push(o.source); + } + } + return neighbors[i]; + } + return force.resume(); + }; + force.resume = function() { + return force.alpha(.1); + }; + force.stop = function() { + return force.alpha(0); + }; + force.drag = function() { + if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart.force", d3_layout_forceDragstart).on("drag.force", dragmove).on("dragend.force", d3_layout_forceDragend); + if (!arguments.length) return drag; + this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag); + }; + function dragmove(d) { + d.px = d3.event.x, d.py = d3.event.y; + force.resume(); + } + return d3.rebind(force, event, "on"); + }; + function d3_layout_forceDragstart(d) { + d.fixed |= 2; + } + function d3_layout_forceDragend(d) { + d.fixed &= ~6; + } + function d3_layout_forceMouseover(d) { + d.fixed |= 4; + d.px = d.x, d.py = d.y; + } + function d3_layout_forceMouseout(d) { + d.fixed &= ~4; + } + function d3_layout_forceAccumulate(quad, alpha, charges) { + var cx = 0, cy = 0; + quad.charge = 0; + if (!quad.leaf) { + var nodes = quad.nodes, n = nodes.length, i = -1, c; + while (++i < n) { + c = nodes[i]; + if (c == null) continue; + d3_layout_forceAccumulate(c, alpha, charges); + quad.charge += c.charge; + cx += c.charge * c.cx; + cy += c.charge * c.cy; + } + } + if (quad.point) { + if (!quad.leaf) { + quad.point.x += Math.random() - .5; + quad.point.y += Math.random() - .5; + } + var k = alpha * charges[quad.point.index]; + quad.charge += quad.pointCharge = k; + cx += k * quad.point.x; + cy += k * quad.point.y; + } + quad.cx = cx / quad.charge; + quad.cy = cy / quad.charge; + } + var d3_layout_forceLinkDistance = 20, d3_layout_forceLinkStrength = 1; + d3.layout.hierarchy = function() { + var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue; + function recurse(node, depth, nodes) { + var childs = children.call(hierarchy, node, depth); + node.depth = depth; + nodes.push(node); + if (childs && (n = childs.length)) { + var i = -1, n, c = node.children = [], v = 0, j = depth + 1, d; + while (++i < n) { + d = recurse(childs[i], j, nodes); + d.parent = node; + c.push(d); + v += d.value; + } + if (sort) c.sort(sort); + if (value) node.value = v; + } else if (value) { + node.value = +value.call(hierarchy, node, depth) || 0; + } + return node; + } + function revalue(node, depth) { + var children = node.children, v = 0; + if (children && (n = children.length)) { + var i = -1, n, j = depth + 1; + while (++i < n) v += revalue(children[i], j); + } else if (value) { + v = +value.call(hierarchy, node, depth) || 0; + } + if (value) node.value = v; + return v; + } + function hierarchy(d) { + var nodes = []; + recurse(d, 0, nodes); + return nodes; + } + hierarchy.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return hierarchy; + }; + hierarchy.children = function(x) { + if (!arguments.length) return children; + children = x; + return hierarchy; + }; + hierarchy.value = function(x) { + if (!arguments.length) return value; + value = x; + return hierarchy; + }; + hierarchy.revalue = function(root) { + revalue(root, 0); + return root; + }; + return hierarchy; + }; + function d3_layout_hierarchyRebind(object, hierarchy) { + d3.rebind(object, hierarchy, "sort", "children", "value"); + object.nodes = object; + object.links = d3_layout_hierarchyLinks; + return object; + } + function d3_layout_hierarchyChildren(d) { + return d.children; + } + function d3_layout_hierarchyValue(d) { + return d.value; + } + function d3_layout_hierarchySort(a, b) { + return b.value - a.value; + } + function d3_layout_hierarchyLinks(nodes) { + return d3.merge(nodes.map(function(parent) { + return (parent.children || []).map(function(child) { + return { + source: parent, + target: child + }; + }); + })); + } + d3.layout.partition = function() { + var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ]; + function position(node, x, dx, dy) { + var children = node.children; + node.x = x; + node.y = node.depth * dy; + node.dx = dx; + node.dy = dy; + if (children && (n = children.length)) { + var i = -1, n, c, d; + dx = node.value ? dx / node.value : 0; + while (++i < n) { + position(c = children[i], x, d = c.value * dx, dy); + x += d; + } + } + } + function depth(node) { + var children = node.children, d = 0; + if (children && (n = children.length)) { + var i = -1, n; + while (++i < n) d = Math.max(d, depth(children[i])); + } + return 1 + d; + } + function partition(d, i) { + var nodes = hierarchy.call(this, d, i); + position(nodes[0], 0, size[0], size[1] / depth(nodes[0])); + return nodes; + } + partition.size = function(x) { + if (!arguments.length) return size; + size = x; + return partition; + }; + return d3_layout_hierarchyRebind(partition, hierarchy); + }; + d3.layout.pie = function() { + var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = 2 * Ï€; + function pie(data) { + var values = data.map(function(d, i) { + return +value.call(pie, d, i); + }); + var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle); + var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - a) / d3.sum(values); + var index = d3.range(data.length); + if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) { + return values[j] - values[i]; + } : function(i, j) { + return sort(data[i], data[j]); + }); + var arcs = []; + index.forEach(function(i) { + var d; + arcs[i] = { + data: data[i], + value: d = values[i], + startAngle: a, + endAngle: a += d * k + }; + }); + return arcs; + } + pie.value = function(x) { + if (!arguments.length) return value; + value = x; + return pie; + }; + pie.sort = function(x) { + if (!arguments.length) return sort; + sort = x; + return pie; + }; + pie.startAngle = function(x) { + if (!arguments.length) return startAngle; + startAngle = x; + return pie; + }; + pie.endAngle = function(x) { + if (!arguments.length) return endAngle; + endAngle = x; + return pie; + }; + return pie; + }; + var d3_layout_pieSortByValue = {}; + d3.layout.stack = function() { + var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY; + function stack(data, index) { + var series = data.map(function(d, i) { + return values.call(stack, d, i); + }); + var points = series.map(function(d) { + return d.map(function(v, i) { + return [ x.call(stack, v, i), y.call(stack, v, i) ]; + }); + }); + var orders = order.call(stack, points, index); + series = d3.permute(series, orders); + points = d3.permute(points, orders); + var offsets = offset.call(stack, points, index); + var n = series.length, m = series[0].length, i, j, o; + for (j = 0; j < m; ++j) { + out.call(stack, series[0][j], o = offsets[j], points[0][j][1]); + for (i = 1; i < n; ++i) { + out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]); + } + } + return data; + } + stack.values = function(x) { + if (!arguments.length) return values; + values = x; + return stack; + }; + stack.order = function(x) { + if (!arguments.length) return order; + order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault; + return stack; + }; + stack.offset = function(x) { + if (!arguments.length) return offset; + offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero; + return stack; + }; + stack.x = function(z) { + if (!arguments.length) return x; + x = z; + return stack; + }; + stack.y = function(z) { + if (!arguments.length) return y; + y = z; + return stack; + }; + stack.out = function(z) { + if (!arguments.length) return out; + out = z; + return stack; + }; + return stack; + }; + function d3_layout_stackX(d) { + return d.x; + } + function d3_layout_stackY(d) { + return d.y; + } + function d3_layout_stackOut(d, y0, y) { + d.y0 = y0; + d.y = y; + } + var d3_layout_stackOrders = d3.map({ + "inside-out": function(data) { + var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) { + return max[a] - max[b]; + }), top = 0, bottom = 0, tops = [], bottoms = []; + for (i = 0; i < n; ++i) { + j = index[i]; + if (top < bottom) { + top += sums[j]; + tops.push(j); + } else { + bottom += sums[j]; + bottoms.push(j); + } + } + return bottoms.reverse().concat(tops); + }, + reverse: function(data) { + return d3.range(data.length).reverse(); + }, + "default": d3_layout_stackOrderDefault + }); + var d3_layout_stackOffsets = d3.map({ + silhouette: function(data) { + var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o > max) max = o; + sums.push(o); + } + for (j = 0; j < m; ++j) { + y0[j] = (max - sums[j]) / 2; + } + return y0; + }, + wiggle: function(data) { + var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = []; + y0[0] = o = o0 = 0; + for (j = 1; j < m; ++j) { + for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1]; + for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) { + for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) { + s3 += (data[k][j][1] - data[k][j - 1][1]) / dx; + } + s2 += s3 * data[i][j][1]; + } + y0[j] = o -= s1 ? s2 / s1 * dx : 0; + if (o < o0) o0 = o; + } + for (j = 0; j < m; ++j) y0[j] -= o0; + return y0; + }, + expand: function(data) { + var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = []; + for (j = 0; j < m; ++j) { + for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; + if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k; + } + for (j = 0; j < m; ++j) y0[j] = 0; + return y0; + }, + zero: d3_layout_stackOffsetZero + }); + function d3_layout_stackOrderDefault(data) { + return d3.range(data.length); + } + function d3_layout_stackOffsetZero(data) { + var j = -1, m = data[0].length, y0 = []; + while (++j < m) y0[j] = 0; + return y0; + } + function d3_layout_stackMaxIndex(array) { + var i = 1, j = 0, v = array[0][1], k, n = array.length; + for (;i < n; ++i) { + if ((k = array[i][1]) > v) { + j = i; + v = k; + } + } + return j; + } + function d3_layout_stackReduceSum(d) { + return d.reduce(d3_layout_stackSum, 0); + } + function d3_layout_stackSum(p, d) { + return p + d[1]; + } + d3.layout.histogram = function() { + var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges; + function histogram(data, i) { + var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x; + while (++i < m) { + bin = bins[i] = []; + bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]); + bin.y = 0; + } + if (m > 0) { + i = -1; + while (++i < n) { + x = values[i]; + if (x >= range[0] && x <= range[1]) { + bin = bins[d3.bisect(thresholds, x, 1, m) - 1]; + bin.y += k; + bin.push(data[i]); + } + } + } + return bins; + } + histogram.value = function(x) { + if (!arguments.length) return valuer; + valuer = x; + return histogram; + }; + histogram.range = function(x) { + if (!arguments.length) return ranger; + ranger = d3_functor(x); + return histogram; + }; + histogram.bins = function(x) { + if (!arguments.length) return binner; + binner = typeof x === "number" ? function(range) { + return d3_layout_histogramBinFixed(range, x); + } : d3_functor(x); + return histogram; + }; + histogram.frequency = function(x) { + if (!arguments.length) return frequency; + frequency = !!x; + return histogram; + }; + return histogram; + }; + function d3_layout_histogramBinSturges(range, values) { + return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1)); + } + function d3_layout_histogramBinFixed(range, n) { + var x = -1, b = +range[0], m = (range[1] - b) / n, f = []; + while (++x <= n) f[x] = m * x + b; + return f; + } + function d3_layout_histogramRange(values) { + return [ d3.min(values), d3.max(values) ]; + } + d3.layout.tree = function() { + var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ]; + function tree(d, i) { + var nodes = hierarchy.call(this, d, i), root = nodes[0]; + function firstWalk(node, previousSibling) { + var children = node.children, layout = node._tree; + if (children && (n = children.length)) { + var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1; + while (++i < n) { + child = children[i]; + firstWalk(child, previousChild); + ancestor = apportion(child, previousChild, ancestor); + previousChild = child; + } + d3_layout_treeShift(node); + var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim); + if (previousSibling) { + layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); + layout.mod = layout.prelim - midpoint; + } else { + layout.prelim = midpoint; + } + } else { + if (previousSibling) { + layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); + } + } + } + function secondWalk(node, x) { + node.x = node._tree.prelim + x; + var children = node.children; + if (children && (n = children.length)) { + var i = -1, n; + x += node._tree.mod; + while (++i < n) { + secondWalk(children[i], x); + } + } + } + function apportion(node, previousSibling, ancestor) { + if (previousSibling) { + var vip = node, vop = node, vim = previousSibling, vom = node.parent.children[0], sip = vip._tree.mod, sop = vop._tree.mod, sim = vim._tree.mod, som = vom._tree.mod, shift; + while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) { + vom = d3_layout_treeLeft(vom); + vop = d3_layout_treeRight(vop); + vop._tree.ancestor = node; + shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip); + if (shift > 0) { + d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift); + sip += shift; + sop += shift; + } + sim += vim._tree.mod; + sip += vip._tree.mod; + som += vom._tree.mod; + sop += vop._tree.mod; + } + if (vim && !d3_layout_treeRight(vop)) { + vop._tree.thread = vim; + vop._tree.mod += sim - sop; + } + if (vip && !d3_layout_treeLeft(vom)) { + vom._tree.thread = vip; + vom._tree.mod += sip - som; + ancestor = node; + } + } + return ancestor; + } + d3_layout_treeVisitAfter(root, function(node, previousSibling) { + node._tree = { + ancestor: node, + prelim: 0, + mod: 0, + change: 0, + shift: 0, + number: previousSibling ? previousSibling._tree.number + 1 : 0 + }; + }); + firstWalk(root); + secondWalk(root, -root._tree.prelim); + var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), right = d3_layout_treeSearch(root, d3_layout_treeRightmost), deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2, y1 = deep.depth || 1; + d3_layout_treeVisitAfter(root, function(node) { + node.x = (node.x - x0) / (x1 - x0) * size[0]; + node.y = node.depth / y1 * size[1]; + delete node._tree; + }); + return nodes; + } + tree.separation = function(x) { + if (!arguments.length) return separation; + separation = x; + return tree; + }; + tree.size = function(x) { + if (!arguments.length) return size; + size = x; + return tree; + }; + return d3_layout_hierarchyRebind(tree, hierarchy); + }; + function d3_layout_treeSeparation(a, b) { + return a.parent == b.parent ? 1 : 2; + } + function d3_layout_treeLeft(node) { + var children = node.children; + return children && children.length ? children[0] : node._tree.thread; + } + function d3_layout_treeRight(node) { + var children = node.children, n; + return children && (n = children.length) ? children[n - 1] : node._tree.thread; + } + function d3_layout_treeSearch(node, compare) { + var children = node.children; + if (children && (n = children.length)) { + var child, n, i = -1; + while (++i < n) { + if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) { + node = child; + } + } + } + return node; + } + function d3_layout_treeRightmost(a, b) { + return a.x - b.x; + } + function d3_layout_treeLeftmost(a, b) { + return b.x - a.x; + } + function d3_layout_treeDeepest(a, b) { + return a.depth - b.depth; + } + function d3_layout_treeVisitAfter(node, callback) { + function visit(node, previousSibling) { + var children = node.children; + if (children && (n = children.length)) { + var child, previousChild = null, i = -1, n; + while (++i < n) { + child = children[i]; + visit(child, previousChild); + previousChild = child; + } + } + callback(node, previousSibling); + } + visit(node, null); + } + function d3_layout_treeShift(node) { + var shift = 0, change = 0, children = node.children, i = children.length, child; + while (--i >= 0) { + child = children[i]._tree; + child.prelim += shift; + child.mod += shift; + shift += child.shift + (change += child.change); + } + } + function d3_layout_treeMove(ancestor, node, shift) { + ancestor = ancestor._tree; + node = node._tree; + var change = shift / (node.number - ancestor.number); + ancestor.change += change; + node.change -= change; + node.shift += shift; + node.prelim += shift; + node.mod += shift; + } + function d3_layout_treeAncestor(vim, node, ancestor) { + return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor; + } + d3.layout.pack = function() { + var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ]; + function pack(d, i) { + var nodes = hierarchy.call(this, d, i), root = nodes[0]; + root.x = 0; + root.y = 0; + d3_layout_treeVisitAfter(root, function(d) { + d.r = Math.sqrt(d.value); + }); + d3_layout_treeVisitAfter(root, d3_layout_packSiblings); + var w = size[0], h = size[1], k = Math.max(2 * root.r / w, 2 * root.r / h); + if (padding > 0) { + var dr = padding * k / 2; + d3_layout_treeVisitAfter(root, function(d) { + d.r += dr; + }); + d3_layout_treeVisitAfter(root, d3_layout_packSiblings); + d3_layout_treeVisitAfter(root, function(d) { + d.r -= dr; + }); + k = Math.max(2 * root.r / w, 2 * root.r / h); + } + d3_layout_packTransform(root, w / 2, h / 2, 1 / k); + return nodes; + } + pack.size = function(x) { + if (!arguments.length) return size; + size = x; + return pack; + }; + pack.padding = function(_) { + if (!arguments.length) return padding; + padding = +_; + return pack; + }; + return d3_layout_hierarchyRebind(pack, hierarchy); + }; + function d3_layout_packSort(a, b) { + return a.value - b.value; + } + function d3_layout_packInsert(a, b) { + var c = a._pack_next; + a._pack_next = b; + b._pack_prev = a; + b._pack_next = c; + c._pack_prev = b; + } + function d3_layout_packSplice(a, b) { + a._pack_next = b; + b._pack_prev = a; + } + function d3_layout_packIntersects(a, b) { + var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r; + return dr * dr - dx * dx - dy * dy > .001; + } + function d3_layout_packSiblings(node) { + if (!(nodes = node.children) || !(n = nodes.length)) return; + var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n; + function bound(node) { + xMin = Math.min(node.x - node.r, xMin); + xMax = Math.max(node.x + node.r, xMax); + yMin = Math.min(node.y - node.r, yMin); + yMax = Math.max(node.y + node.r, yMax); + } + nodes.forEach(d3_layout_packLink); + a = nodes[0]; + a.x = -a.r; + a.y = 0; + bound(a); + if (n > 1) { + b = nodes[1]; + b.x = b.r; + b.y = 0; + bound(b); + if (n > 2) { + c = nodes[2]; + d3_layout_packPlace(a, b, c); + bound(c); + d3_layout_packInsert(a, c); + a._pack_prev = c; + d3_layout_packInsert(c, b); + b = a._pack_next; + for (i = 3; i < n; i++) { + d3_layout_packPlace(a, b, c = nodes[i]); + var isect = 0, s1 = 1, s2 = 1; + for (j = b._pack_next; j !== b; j = j._pack_next, s1++) { + if (d3_layout_packIntersects(j, c)) { + isect = 1; + break; + } + } + if (isect == 1) { + for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) { + if (d3_layout_packIntersects(k, c)) { + break; + } + } + } + if (isect) { + if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b); + i--; + } else { + d3_layout_packInsert(a, c); + b = c; + bound(c); + } + } + } + } + var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0; + for (i = 0; i < n; i++) { + c = nodes[i]; + c.x -= cx; + c.y -= cy; + cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y)); + } + node.r = cr; + nodes.forEach(d3_layout_packUnlink); + } + function d3_layout_packLink(node) { + node._pack_next = node._pack_prev = node; + } + function d3_layout_packUnlink(node) { + delete node._pack_next; + delete node._pack_prev; + } + function d3_layout_packTransform(node, x, y, k) { + var children = node.children; + node.x = x += k * node.x; + node.y = y += k * node.y; + node.r *= k; + if (children) { + var i = -1, n = children.length; + while (++i < n) d3_layout_packTransform(children[i], x, y, k); + } + } + function d3_layout_packPlace(a, b, c) { + var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y; + if (db && (dx || dy)) { + var da = b.r + c.r, dc = dx * dx + dy * dy; + da *= da; + db *= db; + var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc); + c.x = a.x + x * dx + y * dy; + c.y = a.y + x * dy - y * dx; + } else { + c.x = a.x + db; + c.y = a.y; + } + } + d3.layout.cluster = function() { + var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ]; + function cluster(d, i) { + var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0; + d3_layout_treeVisitAfter(root, function(node) { + var children = node.children; + if (children && children.length) { + node.x = d3_layout_clusterX(children); + node.y = d3_layout_clusterY(children); + } else { + node.x = previousNode ? x += separation(node, previousNode) : 0; + node.y = 0; + previousNode = node; + } + }); + var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2; + d3_layout_treeVisitAfter(root, function(node) { + node.x = (node.x - x0) / (x1 - x0) * size[0]; + node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1]; + }); + return nodes; + } + cluster.separation = function(x) { + if (!arguments.length) return separation; + separation = x; + return cluster; + }; + cluster.size = function(x) { + if (!arguments.length) return size; + size = x; + return cluster; + }; + return d3_layout_hierarchyRebind(cluster, hierarchy); + }; + function d3_layout_clusterY(children) { + return 1 + d3.max(children, function(child) { + return child.y; + }); + } + function d3_layout_clusterX(children) { + return children.reduce(function(x, child) { + return x + child.x; + }, 0) / children.length; + } + function d3_layout_clusterLeft(node) { + var children = node.children; + return children && children.length ? d3_layout_clusterLeft(children[0]) : node; + } + function d3_layout_clusterRight(node) { + var children = node.children, n; + return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node; + } + d3.layout.treemap = function() { + var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, mode = "squarify", ratio = .5 * (1 + Math.sqrt(5)); + function scale(children, k) { + var i = -1, n = children.length, child, area; + while (++i < n) { + area = (child = children[i]).value * (k < 0 ? 0 : k); + child.area = isNaN(area) || area <= 0 ? 0 : area; + } + } + function squarify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = mode === "slice" ? rect.dx : mode === "dice" ? rect.dy : mode === "slice-dice" ? node.depth & 1 ? rect.dy : rect.dx : Math.min(rect.dx, rect.dy), n; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while ((n = remaining.length) > 0) { + row.push(child = remaining[n - 1]); + row.area += child.area; + if (mode !== "squarify" || (score = worst(row, u)) <= best) { + remaining.pop(); + best = score; + } else { + row.area -= row.pop().area; + position(row, u, rect, false); + u = Math.min(rect.dx, rect.dy); + row.length = row.area = 0; + best = Infinity; + } + } + if (row.length) { + position(row, u, rect, true); + row.length = row.area = 0; + } + children.forEach(squarify); + } + } + function stickify(node) { + var children = node.children; + if (children && children.length) { + var rect = pad(node), remaining = children.slice(), child, row = []; + scale(remaining, rect.dx * rect.dy / node.value); + row.area = 0; + while (child = remaining.pop()) { + row.push(child); + row.area += child.area; + if (child.z != null) { + position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length); + row.length = row.area = 0; + } + } + children.forEach(stickify); + } + } + function worst(row, u) { + var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length; + while (++i < n) { + if (!(r = row[i].area)) continue; + if (r < rmin) rmin = r; + if (r > rmax) rmax = r; + } + s *= s; + u *= u; + return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity; + } + function position(row, u, rect, flush) { + var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o; + if (u == rect.dx) { + if (flush || v > rect.dy) v = rect.dy; + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dy = v; + x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0); + } + o.z = true; + o.dx += rect.x + rect.dx - x; + rect.y += v; + rect.dy -= v; + } else { + if (flush || v > rect.dx) v = rect.dx; + while (++i < n) { + o = row[i]; + o.x = x; + o.y = y; + o.dx = v; + y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0); + } + o.z = false; + o.dy += rect.y + rect.dy - y; + rect.x += v; + rect.dx -= v; + } + } + function treemap(d) { + var nodes = stickies || hierarchy(d), root = nodes[0]; + root.x = 0; + root.y = 0; + root.dx = size[0]; + root.dy = size[1]; + if (stickies) hierarchy.revalue(root); + scale([ root ], root.dx * root.dy / root.value); + (stickies ? stickify : squarify)(root); + if (sticky) stickies = nodes; + return nodes; + } + treemap.size = function(x) { + if (!arguments.length) return size; + size = x; + return treemap; + }; + treemap.padding = function(x) { + if (!arguments.length) return padding; + function padFunction(node) { + var p = x.call(treemap, node, node.depth); + return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p); + } + function padConstant(node) { + return d3_layout_treemapPad(node, x); + } + var type; + pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], + padConstant) : padConstant; + return treemap; + }; + treemap.round = function(x) { + if (!arguments.length) return round != Number; + round = x ? Math.round : Number; + return treemap; + }; + treemap.sticky = function(x) { + if (!arguments.length) return sticky; + sticky = x; + stickies = null; + return treemap; + }; + treemap.ratio = function(x) { + if (!arguments.length) return ratio; + ratio = x; + return treemap; + }; + treemap.mode = function(x) { + if (!arguments.length) return mode; + mode = x + ""; + return treemap; + }; + return d3_layout_hierarchyRebind(treemap, hierarchy); + }; + function d3_layout_treemapPadNull(node) { + return { + x: node.x, + y: node.y, + dx: node.dx, + dy: node.dy + }; + } + function d3_layout_treemapPad(node, padding) { + var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2]; + if (dx < 0) { + x += dx / 2; + dx = 0; + } + if (dy < 0) { + y += dy / 2; + dy = 0; + } + return { + x: x, + y: y, + dx: dx, + dy: dy + }; + } + d3.random = { + normal: function(µ, σ) { + var n = arguments.length; + if (n < 2) σ = 1; + if (n < 1) µ = 0; + return function() { + var x, y, r; + do { + x = Math.random() * 2 - 1; + y = Math.random() * 2 - 1; + r = x * x + y * y; + } while (!r || r > 1); + return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r); + }; + }, + logNormal: function() { + var random = d3.random.normal.apply(d3, arguments); + return function() { + return Math.exp(random()); + }; + }, + irwinHall: function(m) { + return function() { + for (var s = 0, j = 0; j < m; j++) s += Math.random(); + return s / m; + }; + } + }; + d3.scale = {}; + function d3_scaleExtent(domain) { + var start = domain[0], stop = domain[domain.length - 1]; + return start < stop ? [ start, stop ] : [ stop, start ]; + } + function d3_scaleRange(scale) { + return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range()); + } + function d3_scale_bilinear(domain, range, uninterpolate, interpolate) { + var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]); + return function(x) { + return i(u(x)); + }; + } + function d3_scale_nice(domain, nice) { + var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx; + if (x1 < x0) { + dx = i0, i0 = i1, i1 = dx; + dx = x0, x0 = x1, x1 = dx; + } + if (nice = nice(x1 - x0)) { + domain[i0] = nice.floor(x0); + domain[i1] = nice.ceil(x1); + } + return domain; + } + function d3_scale_polylinear(domain, range, uninterpolate, interpolate) { + var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1; + if (domain[k] < domain[0]) { + domain = domain.slice().reverse(); + range = range.slice().reverse(); + } + while (++j <= k) { + u.push(uninterpolate(domain[j - 1], domain[j])); + i.push(interpolate(range[j - 1], range[j])); + } + return function(x) { + var j = d3.bisect(domain, x, 1, k) - 1; + return i[j](u[j](x)); + }; + } + d3.scale.linear = function() { + return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3_interpolate, false); + }; + function d3_scale_linear(domain, range, interpolate, clamp) { + var output, input; + function rescale() { + var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber; + output = linear(domain, range, uninterpolate, interpolate); + input = linear(range, domain, uninterpolate, d3_interpolate); + return scale; + } + function scale(x) { + return output(x); + } + scale.invert = function(y) { + return input(y); + }; + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.map(Number); + return rescale(); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + scale.rangeRound = function(x) { + return scale.range(x).interpolate(d3_interpolateRound); + }; + scale.clamp = function(x) { + if (!arguments.length) return clamp; + clamp = x; + return rescale(); + }; + scale.interpolate = function(x) { + if (!arguments.length) return interpolate; + interpolate = x; + return rescale(); + }; + scale.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + scale.tickFormat = function(m, format) { + return d3_scale_linearTickFormat(domain, m, format); + }; + scale.nice = function() { + d3_scale_nice(domain, d3_scale_linearNice); + return rescale(); + }; + scale.copy = function() { + return d3_scale_linear(domain, range, interpolate, clamp); + }; + return rescale(); + } + function d3_scale_linearRebind(scale, linear) { + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); + } + function d3_scale_linearNice(dx) { + dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1); + return dx && { + floor: function(x) { + return Math.floor(x / dx) * dx; + }, + ceil: function(x) { + return Math.ceil(x / dx) * dx; + } + }; + } + function d3_scale_linearTickRange(domain, m) { + var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step; + if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2; + extent[0] = Math.ceil(extent[0] / step) * step; + extent[1] = Math.floor(extent[1] / step) * step + step * .5; + extent[2] = step; + return extent; + } + function d3_scale_linearTicks(domain, m) { + return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); + } + function d3_scale_linearTickFormat(domain, m, format) { + var precision = -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01); + return d3.format(format ? format.replace(d3_format_re, function(a, b, c, d, e, f, g, h, i, j) { + return [ b, c, d, e, f, g, h, i || "." + (precision - (j === "%") * 2), j ].join(""); + }) : ",." + precision + "f"); + } + d3.scale.log = function() { + return d3_scale_log(d3.scale.linear().domain([ 0, Math.LN10 ]), 10, d3_scale_logp, d3_scale_powp); + }; + function d3_scale_log(linear, base, log, pow) { + function scale(x) { + return linear(log(x)); + } + scale.invert = function(x) { + return pow(linear.invert(x)); + }; + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(pow); + if (x[0] < 0) log = d3_scale_logn, pow = d3_scale_pown; else log = d3_scale_logp, + pow = d3_scale_powp; + linear.domain(x.map(log)); + return scale; + }; + scale.base = function(_) { + if (!arguments.length) return base; + base = +_; + return scale; + }; + scale.nice = function() { + linear.domain(d3_scale_nice(linear.domain(), d3_scale_logNice(base))); + return scale; + }; + scale.ticks = function() { + var extent = d3_scaleExtent(linear.domain()), ticks = []; + if (extent.every(isFinite)) { + var b = Math.log(base), i = Math.floor(extent[0] / b), j = Math.ceil(extent[1] / b), u = pow(extent[0]), v = pow(extent[1]), n = base % 1 ? 2 : base; + if (log === d3_scale_logn) { + ticks.push(-Math.pow(base, -i)); + for (;i++ < j; ) for (var k = n - 1; k > 0; k--) ticks.push(-Math.pow(base, -i) * k); + } else { + for (;i < j; i++) for (var k = 1; k < n; k++) ticks.push(Math.pow(base, i) * k); + ticks.push(Math.pow(base, i)); + } + for (i = 0; ticks[i] < u; i++) {} + for (j = ticks.length; ticks[j - 1] > v; j--) {} + ticks = ticks.slice(i, j); + } + return ticks; + }; + scale.tickFormat = function(n, format) { + if (arguments.length < 2) format = d3_scale_logFormat; + if (!arguments.length) return format; + var b = Math.log(base), k = Math.max(.1, n / scale.ticks().length), f = log === d3_scale_logn ? (e = -1e-12, + Math.floor) : (e = 1e-12, Math.ceil), e; + return function(d) { + return d / pow(b * f(log(d) / b + e)) <= k ? format(d) : ""; + }; + }; + scale.copy = function() { + return d3_scale_log(linear.copy(), base, log, pow); + }; + return d3_scale_linearRebind(scale, linear); + } + var d3_scale_logFormat = d3.format(".0e"); + function d3_scale_logp(x) { + return Math.log(x < 0 ? 0 : x); + } + function d3_scale_powp(x) { + return Math.exp(x); + } + function d3_scale_logn(x) { + return -Math.log(x > 0 ? 0 : -x); + } + function d3_scale_pown(x) { + return -Math.exp(-x); + } + function d3_scale_logNice(base) { + base = Math.log(base); + var nice = { + floor: function(x) { + return Math.floor(x / base) * base; + }, + ceil: function(x) { + return Math.ceil(x / base) * base; + } + }; + return function() { + return nice; + }; + } + d3.scale.pow = function() { + return d3_scale_pow(d3.scale.linear(), 1); + }; + function d3_scale_pow(linear, exponent) { + var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent); + function scale(x) { + return linear(powp(x)); + } + scale.invert = function(x) { + return powb(linear.invert(x)); + }; + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(powb); + linear.domain(x.map(powp)); + return scale; + }; + scale.ticks = function(m) { + return d3_scale_linearTicks(scale.domain(), m); + }; + scale.tickFormat = function(m, format) { + return d3_scale_linearTickFormat(scale.domain(), m, format); + }; + scale.nice = function() { + return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice)); + }; + scale.exponent = function(x) { + if (!arguments.length) return exponent; + var domain = scale.domain(); + powp = d3_scale_powPow(exponent = x); + powb = d3_scale_powPow(1 / exponent); + return scale.domain(domain); + }; + scale.copy = function() { + return d3_scale_pow(linear.copy(), exponent); + }; + return d3_scale_linearRebind(scale, linear); + } + function d3_scale_powPow(e) { + return function(x) { + return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e); + }; + } + d3.scale.sqrt = function() { + return d3.scale.pow().exponent(.5); + }; + d3.scale.ordinal = function() { + return d3_scale_ordinal([], { + t: "range", + a: [ [] ] + }); + }; + function d3_scale_ordinal(domain, ranger) { + var index, range, rangeBand; + function scale(x) { + return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length]; + } + function steps(start, step) { + return d3.range(domain.length).map(function(i) { + return start + step * i; + }); + } + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = []; + index = new d3_Map(); + var i = -1, n = x.length, xi; + while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi)); + return scale[ranger.t].apply(scale, ranger.a); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + rangeBand = 0; + ranger = { + t: "range", + a: arguments + }; + return scale; + }; + scale.rangePoints = function(x, padding) { + if (arguments.length < 2) padding = 0; + var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding); + range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step); + rangeBand = 0; + ranger = { + t: "rangePoints", + a: arguments + }; + return scale; + }; + scale.rangeBands = function(x, padding, outerPadding) { + if (arguments.length < 2) padding = 0; + if (arguments.length < 3) outerPadding = padding; + var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding); + range = steps(start + step * outerPadding, step); + if (reverse) range.reverse(); + rangeBand = step * (1 - padding); + ranger = { + t: "rangeBands", + a: arguments + }; + return scale; + }; + scale.rangeRoundBands = function(x, padding, outerPadding) { + if (arguments.length < 2) padding = 0; + if (arguments.length < 3) outerPadding = padding; + var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)), error = stop - start - (domain.length - padding) * step; + range = steps(start + Math.round(error / 2), step); + if (reverse) range.reverse(); + rangeBand = Math.round(step * (1 - padding)); + ranger = { + t: "rangeRoundBands", + a: arguments + }; + return scale; + }; + scale.rangeBand = function() { + //Customized + if(rangeBand <= 50) + return rangeBand; + else + return 50; + }; + scale.rangeExtent = function() { + return d3_scaleExtent(ranger.a[0]); + }; + scale.copy = function() { + return d3_scale_ordinal(domain, ranger); + }; + return scale.domain(domain); + } + d3.scale.category10 = function() { + return d3.scale.ordinal().range(d3_category10); + }; + d3.scale.category20 = function() { + return d3.scale.ordinal().range(d3_category20); + }; + d3.scale.category20b = function() { + return d3.scale.ordinal().range(d3_category20b); + }; + d3.scale.category20c = function() { + return d3.scale.ordinal().range(d3_category20c); + }; + d3.scale.category50 = function() { + return d3.scale.ordinal().range(d3_category50); + }; + var d3_category10 = [ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" ]; + var d3_category20 = [ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ]; + var d3_category20b = [ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" ]; + var d3_category20c = [ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9" ]; + var d3_category50 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#8c864b", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf","#DC143C","#800080","#0000FF","#008000","#D2691E","#FF0000","#000000","#DB7093","#FF00FF","#7B68EE","#1f77b6", "#9edae5", "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#aec7e8", "#e7ba52", "#ffbb78", "#e7cb94", "#98df8a", "#843c39", "#ff9896", "#ad494a", "#c5b0d5", "#d6616b", "#c49c94", "#e7969c", "#f7b6d2", "#fd8d3c", "#c7c7c7", "#7b4173", "#dbdb8d", "#a55194", ]; + d3.scale.quantile = function() { + return d3_scale_quantile([], []); + }; + function d3_scale_quantile(domain, range) { + var thresholds; + function rescale() { + var k = 0, q = range.length; + thresholds = []; + while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q); + return scale; + } + function scale(x) { + if (isNaN(x = +x)) return NaN; + return range[d3.bisect(thresholds, x)]; + } + scale.domain = function(x) { + if (!arguments.length) return domain; + domain = x.filter(function(d) { + return !isNaN(d); + }).sort(d3.ascending); + return rescale(); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + scale.quantiles = function() { + return thresholds; + }; + scale.copy = function() { + return d3_scale_quantile(domain, range); + }; + return rescale(); + } + d3.scale.quantize = function() { + return d3_scale_quantize(0, 1, [ 0, 1 ]); + }; + function d3_scale_quantize(x0, x1, range) { + var kx, i; + function scale(x) { + return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; + } + function rescale() { + kx = range.length / (x1 - x0); + i = range.length - 1; + return scale; + } + scale.domain = function(x) { + if (!arguments.length) return [ x0, x1 ]; + x0 = +x[0]; + x1 = +x[x.length - 1]; + return rescale(); + }; + scale.range = function(x) { + if (!arguments.length) return range; + range = x; + return rescale(); + }; + scale.copy = function() { + return d3_scale_quantize(x0, x1, range); + }; + return rescale(); + } + d3.scale.threshold = function() { + return d3_scale_threshold([ .5 ], [ 0, 1 ]); + }; + function d3_scale_threshold(domain, range) { + function scale(x) { + return range[d3.bisect(domain, x)]; + } + scale.domain = function(_) { + if (!arguments.length) return domain; + domain = _; + return scale; + }; + scale.range = function(_) { + if (!arguments.length) return range; + range = _; + return scale; + }; + scale.copy = function() { + return d3_scale_threshold(domain, range); + }; + return scale; + } + d3.scale.identity = function() { + return d3_scale_identity([ 0, 1 ]); + }; + function d3_scale_identity(domain) { + function identity(x) { + return +x; + } + identity.invert = identity; + identity.domain = identity.range = function(x) { + if (!arguments.length) return domain; + domain = x.map(identity); + return identity; + }; + identity.ticks = function(m) { + return d3_scale_linearTicks(domain, m); + }; + identity.tickFormat = function(m, format) { + return d3_scale_linearTickFormat(domain, m, format); + }; + identity.copy = function() { + return d3_scale_identity(domain); + }; + return identity; + } + d3.svg.arc = function() { + var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; + function arc() { + var r0 = innerRadius.apply(this, arguments), r1 = outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, da = (a1 < a0 && (da = a0, + a0 = a1, a1 = da), a1 - a0), df = da < Ï€ ? "0" : "1", c0 = Math.cos(a0), s0 = Math.sin(a0), c1 = Math.cos(a1), s1 = Math.sin(a1); + return da >= d3_svg_arcMax ? r0 ? "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "M0," + r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + -r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + "Z" : "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "Z" : r0 ? "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L" + r0 * c1 + "," + r0 * s1 + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + "Z" : "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L0,0" + "Z"; + } + arc.innerRadius = function(v) { + if (!arguments.length) return innerRadius; + innerRadius = d3_functor(v); + return arc; + }; + arc.outerRadius = function(v) { + if (!arguments.length) return outerRadius; + outerRadius = d3_functor(v); + return arc; + }; + arc.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3_functor(v); + return arc; + }; + arc.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3_functor(v); + return arc; + }; + arc.centroid = function() { + var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset; + return [ Math.cos(a) * r, Math.sin(a) * r ]; + }; + return arc; + }; + var d3_svg_arcOffset = -Ï€ / 2, d3_svg_arcMax = 2 * Ï€ - 1e-6; + function d3_svg_arcInnerRadius(d) { + return d.innerRadius; + } + function d3_svg_arcOuterRadius(d) { + return d.outerRadius; + } + function d3_svg_arcStartAngle(d) { + return d.startAngle; + } + function d3_svg_arcEndAngle(d) { + return d.endAngle; + } + d3.svg.line.radial = function() { + var line = d3_svg_line(d3_svg_lineRadial); + line.radius = line.x, delete line.x; + line.angle = line.y, delete line.y; + return line; + }; + function d3_svg_lineRadial(points) { + var point, i = -1, n = points.length, r, a; + while (++i < n) { + point = points[i]; + r = point[0]; + a = point[1] + d3_svg_arcOffset; + point[0] = r * Math.cos(a); + point[1] = r * Math.sin(a); + } + return points; + } + function d3_svg_area(projection) { + var x0 = d3_svg_lineX, x1 = d3_svg_lineX, y0 = 0, y1 = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7; + function area(data) { + var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() { + return x; + } : d3_functor(x1), fy1 = y0 === y1 ? function() { + return y; + } : d3_functor(y1), x, y; + function segment() { + segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z"); + } + while (++i < n) { + if (defined.call(this, d = data[i], i)) { + points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]); + points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]); + } else if (points0.length) { + segment(); + points0 = []; + points1 = []; + } + } + if (points0.length) segment(); + return segments.length ? segments.join("") : null; + } + area.x = function(_) { + if (!arguments.length) return x1; + x0 = x1 = _; + return area; + }; + area.x0 = function(_) { + if (!arguments.length) return x0; + x0 = _; + return area; + }; + area.x1 = function(_) { + if (!arguments.length) return x1; + x1 = _; + return area; + }; + area.y = function(_) { + if (!arguments.length) return y1; + y0 = y1 = _; + return area; + }; + area.y0 = function(_) { + if (!arguments.length) return y0; + y0 = _; + return area; + }; + area.y1 = function(_) { + if (!arguments.length) return y1; + y1 = _; + return area; + }; + area.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return area; + }; + area.interpolate = function(_) { + if (!arguments.length) return interpolateKey; + if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; + interpolateReverse = interpolate.reverse || interpolate; + L = interpolate.closed ? "M" : "L"; + return area; + }; + area.tension = function(_) { + if (!arguments.length) return tension; + tension = _; + return area; + }; + return area; + } + d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter; + d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore; + d3.svg.area = function() { + return d3_svg_area(d3_identity); + }; + d3.svg.area.radial = function() { + var area = d3_svg_area(d3_svg_lineRadial); + area.radius = area.x, delete area.x; + area.innerRadius = area.x0, delete area.x0; + area.outerRadius = area.x1, delete area.x1; + area.angle = area.y, delete area.y; + area.startAngle = area.y0, delete area.y0; + area.endAngle = area.y1, delete area.y1; + return area; + }; + d3.svg.chord = function() { + var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; + function chord(d, i) { + var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i); + return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z"; + } + function subgroup(self, f, d, i) { + var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset; + return { + r: r, + a0: a0, + a1: a1, + p0: [ r * Math.cos(a0), r * Math.sin(a0) ], + p1: [ r * Math.cos(a1), r * Math.sin(a1) ] + }; + } + function equals(a, b) { + return a.a0 == b.a0 && a.a1 == b.a1; + } + function arc(r, p, a) { + return "A" + r + "," + r + " 0 " + +(a > Ï€) + ",1 " + p; + } + function curve(r0, p0, r1, p1) { + return "Q 0,0 " + p1; + } + chord.radius = function(v) { + if (!arguments.length) return radius; + radius = d3_functor(v); + return chord; + }; + chord.source = function(v) { + if (!arguments.length) return source; + source = d3_functor(v); + return chord; + }; + chord.target = function(v) { + if (!arguments.length) return target; + target = d3_functor(v); + return chord; + }; + chord.startAngle = function(v) { + if (!arguments.length) return startAngle; + startAngle = d3_functor(v); + return chord; + }; + chord.endAngle = function(v) { + if (!arguments.length) return endAngle; + endAngle = d3_functor(v); + return chord; + }; + return chord; + }; + function d3_svg_chordRadius(d) { + return d.radius; + } + d3.svg.diagonal = function() { + var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection; + function diagonal(d, i) { + var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, { + x: p0.x, + y: m + }, { + x: p3.x, + y: m + }, p3 ]; + p = p.map(projection); + return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3]; + } + diagonal.source = function(x) { + if (!arguments.length) return source; + source = d3_functor(x); + return diagonal; + }; + diagonal.target = function(x) { + if (!arguments.length) return target; + target = d3_functor(x); + return diagonal; + }; + diagonal.projection = function(x) { + if (!arguments.length) return projection; + projection = x; + return diagonal; + }; + return diagonal; + }; + function d3_svg_diagonalProjection(d) { + return [ d.x, d.y ]; + } + d3.svg.diagonal.radial = function() { + var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection; + diagonal.projection = function(x) { + return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection; + }; + return diagonal; + }; + function d3_svg_diagonalRadialProjection(projection) { + return function() { + var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset; + return [ r * Math.cos(a), r * Math.sin(a) ]; + }; + } + d3.svg.symbol = function() { + var type = d3_svg_symbolType, size = d3_svg_symbolSize; + function symbol(d, i) { + return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i)); + } + symbol.type = function(x) { + if (!arguments.length) return type; + type = d3_functor(x); + return symbol; + }; + symbol.size = function(x) { + if (!arguments.length) return size; + size = d3_functor(x); + return symbol; + }; + return symbol; + }; + function d3_svg_symbolSize() { + return 64; + } + function d3_svg_symbolType() { + return "circle"; + } + function d3_svg_symbolCircle(size) { + var r = Math.sqrt(size / Ï€); + return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z"; + } + var d3_svg_symbols = d3.map({ + circle: d3_svg_symbolCircle, + cross: function(size) { + var r = Math.sqrt(size / 5) / 2; + return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z"; + }, + diamond: function(size) { + var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30; + return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z"; + }, + square: function(size) { + var r = Math.sqrt(size) / 2; + return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z"; + }, + "triangle-down": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z"; + }, + "triangle-up": function(size) { + var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; + return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z"; + } + }); + d3.svg.symbolTypes = d3_svg_symbols.keys(); + var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians); + function d3_transition(groups, id) { + d3_arraySubclass(groups, d3_transitionPrototype); + groups.id = id; + return groups; + } + var d3_transitionPrototype = [], d3_transitionId = 0, d3_transitionInheritId, d3_transitionInherit = { + ease: d3_ease_cubicInOut, + delay: 0, + duration: 250 + }; + d3_transitionPrototype.call = d3_selectionPrototype.call; + d3_transitionPrototype.empty = d3_selectionPrototype.empty; + d3_transitionPrototype.node = d3_selectionPrototype.node; + d3.transition = function(selection) { + return arguments.length ? d3_transitionInheritId ? selection.transition() : selection : d3_selectionRoot.transition(); + }; + d3.transition.prototype = d3_transitionPrototype; + d3_transitionPrototype.select = function(selector) { + var id = this.id, subgroups = [], subgroup, subnode, node; + if (typeof selector !== "function") selector = d3_selection_selector(selector); + for (var j = -1, m = this.length; ++j < m; ) { + subgroups.push(subgroup = []); + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i))) { + if ("__data__" in node) subnode.__data__ = node.__data__; + d3_transitionNode(subnode, i, id, node.__transition__[id]); + subgroup.push(subnode); + } else { + subgroup.push(null); + } + } + } + return d3_transition(subgroups, id); + }; + d3_transitionPrototype.selectAll = function(selector) { + var id = this.id, subgroups = [], subgroup, subnodes, node, subnode, transition; + if (typeof selector !== "function") selector = d3_selection_selectorAll(selector); + for (var j = -1, m = this.length; ++j < m; ) { + for (var group = this[j], i = -1, n = group.length; ++i < n; ) { + if (node = group[i]) { + transition = node.__transition__[id]; + subnodes = selector.call(node, node.__data__, i); + subgroups.push(subgroup = []); + for (var k = -1, o = subnodes.length; ++k < o; ) { + d3_transitionNode(subnode = subnodes[k], k, id, transition); + subgroup.push(subnode); + } + } + } + } + return d3_transition(subgroups, id); + }; + d3_transitionPrototype.filter = function(filter) { + var subgroups = [], subgroup, group, node; + if (typeof filter !== "function") filter = d3_selection_filter(filter); + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + if ((node = group[i]) && filter.call(node, node.__data__, i)) { + subgroup.push(node); + } + } + } + return d3_transition(subgroups, this.id, this.time).ease(this.ease()); + }; + d3_transitionPrototype.tween = function(name, tween) { + var id = this.id; + if (arguments.length < 2) return this.node().__transition__[id].tween.get(name); + return d3_selection_each(this, tween == null ? function(node) { + node.__transition__[id].tween.remove(name); + } : function(node) { + node.__transition__[id].tween.set(name, tween); + }); + }; + function d3_transition_tween(groups, name, value, tween) { + var id = groups.id; + return d3_selection_each(groups, typeof value === "function" ? function(node, i, j) { + node.__transition__[id].tween.set(name, tween(value.call(node, node.__data__, i, j))); + } : (value = tween(value), function(node) { + node.__transition__[id].tween.set(name, value); + })); + } + d3_transitionPrototype.attr = function(nameNS, value) { + if (arguments.length < 2) { + for (value in nameNS) this.attr(value, nameNS[value]); + return this; + } + var interpolate = d3_interpolateByName(nameNS), name = d3.ns.qualify(nameNS); + function attrNull() { + this.removeAttribute(name); + } + function attrNullNS() { + this.removeAttributeNS(name.space, name.local); + } + return d3_transition_tween(this, "attr." + nameNS, value, function(b) { + function attrString() { + var a = this.getAttribute(name), i; + return a !== b && (i = interpolate(a, b), function(t) { + this.setAttribute(name, i(t)); + }); + } + function attrStringNS() { + var a = this.getAttributeNS(name.space, name.local), i; + return a !== b && (i = interpolate(a, b), function(t) { + this.setAttributeNS(name.space, name.local, i(t)); + }); + } + return b == null ? name.local ? attrNullNS : attrNull : (b += "", name.local ? attrStringNS : attrString); + }); + }; + d3_transitionPrototype.attrTween = function(nameNS, tween) { + var name = d3.ns.qualify(nameNS); + function attrTween(d, i) { + var f = tween.call(this, d, i, this.getAttribute(name)); + return f && function(t) { + this.setAttribute(name, f(t)); + }; + } + function attrTweenNS(d, i) { + var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local)); + return f && function(t) { + this.setAttributeNS(name.space, name.local, f(t)); + }; + } + return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween); + }; + d3_transitionPrototype.style = function(name, value, priority) { + var n = arguments.length; + if (n < 3) { + if (typeof name !== "string") { + if (n < 2) value = ""; + for (priority in name) this.style(priority, name[priority], value); + return this; + } + priority = ""; + } + var interpolate = d3_interpolateByName(name); + function styleNull() { + this.style.removeProperty(name); + } + return d3_transition_tween(this, "style." + name, value, function(b) { + function styleString() { + var a = d3_window.getComputedStyle(this, null).getPropertyValue(name), i; + return a !== b && (i = interpolate(a, b), function(t) { + this.style.setProperty(name, i(t), priority); + }); + } + return b == null ? styleNull : (b += "", styleString); + }); + }; + d3_transitionPrototype.styleTween = function(name, tween, priority) { + if (arguments.length < 3) priority = ""; + return this.tween("style." + name, function(d, i) { + var f = tween.call(this, d, i, d3_window.getComputedStyle(this, null).getPropertyValue(name)); + return f && function(t) { + this.style.setProperty(name, f(t), priority); + }; + }); + }; + d3_transitionPrototype.text = function(value) { + return d3_transition_tween(this, "text", value, d3_transition_text); + }; + function d3_transition_text(b) { + if (b == null) b = ""; + return function() { + this.textContent = b; + }; + } + d3_transitionPrototype.remove = function() { + return this.each("end.transition", function() { + var p; + if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this); + }); + }; + d3_transitionPrototype.ease = function(value) { + var id = this.id; + if (arguments.length < 1) return this.node().__transition__[id].ease; + if (typeof value !== "function") value = d3.ease.apply(d3, arguments); + return d3_selection_each(this, function(node) { + node.__transition__[id].ease = value; + }); + }; + d3_transitionPrototype.delay = function(value) { + var id = this.id; + return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { + node.__transition__[id].delay = value.call(node, node.__data__, i, j) | 0; + } : (value |= 0, function(node) { + node.__transition__[id].delay = value; + })); + }; + d3_transitionPrototype.duration = function(value) { + var id = this.id; + return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { + node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j) | 0); + } : (value = Math.max(1, value | 0), function(node) { + node.__transition__[id].duration = value; + })); + }; + d3_transitionPrototype.each = function(type, listener) { + var id = this.id; + if (arguments.length < 2) { + var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId; + d3_transitionInheritId = id; + d3_selection_each(this, function(node, i, j) { + d3_transitionInherit = node.__transition__[id]; + type.call(node, node.__data__, i, j); + }); + d3_transitionInherit = inherit; + d3_transitionInheritId = inheritId; + } else { + d3_selection_each(this, function(node) { + node.__transition__[id].event.on(type, listener); + }); + } + return this; + }; + d3_transitionPrototype.transition = function() { + var id0 = this.id, id1 = ++d3_transitionId, subgroups = [], subgroup, group, node, transition; + for (var j = 0, m = this.length; j < m; j++) { + subgroups.push(subgroup = []); + for (var group = this[j], i = 0, n = group.length; i < n; i++) { + if (node = group[i]) { + transition = Object.create(node.__transition__[id0]); + transition.delay += transition.duration; + d3_transitionNode(node, i, id1, transition); + } + subgroup.push(node); + } + } + return d3_transition(subgroups, id1); + }; + function d3_transitionNode(node, i, id, inherit) { + var lock = node.__transition__ || (node.__transition__ = { + active: 0, + count: 0 + }), transition = lock[id]; + if (!transition) { + var time = inherit.time; + transition = lock[id] = { + tween: new d3_Map(), + event: d3.dispatch("start", "end"), + time: time, + ease: inherit.ease, + delay: inherit.delay, + duration: inherit.duration + }; + ++lock.count; + d3.timer(function(elapsed) { + var d = node.__data__, ease = transition.ease, event = transition.event, delay = transition.delay, duration = transition.duration, tweened = []; + return delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time), 1; + function start(elapsed) { + if (lock.active > id) return stop(); + lock.active = id; + event.start.call(node, d, i); + transition.tween.forEach(function(key, value) { + if (value = value.call(node, d, i)) { + tweened.push(value); + } + }); + if (!tick(elapsed)) d3.timer(tick, 0, time); + return 1; + } + function tick(elapsed) { + if (lock.active !== id) return stop(); + var t = (elapsed - delay) / duration, e = ease(t), n = tweened.length; + while (n > 0) { + tweened[--n].call(node, e); + } + if (t >= 1) { + stop(); + event.end.call(node, d, i); + return 1; + } + } + function stop() { + if (--lock.count) delete lock[id]; else delete node.__transition__; + return 1; + } + }, 0, time); + return transition; + } + } + d3.svg.axis = function() { + var scale = d3.scale.linear(), orient = d3_svg_axisDefaultOrient, tickMajorSize = 6, tickMinorSize = 6, tickEndSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_, tickSubdivide = 0; + function axis(g) { + g.each(function() { + var g = d3.select(this); + var ticks = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain() : tickValues, tickFormat = tickFormat_ == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String : tickFormat_; + var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), subtick = g.selectAll(".tick.minor").data(subticks, String), subtickEnter = subtick.enter().insert("line", ".tick").attr("class", "tick minor").style("opacity", 1e-6), subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(), subtickUpdate = d3.transition(subtick).style("opacity", 1); + var tick = g.selectAll(".tick.major").data(ticks, String), tickEnter = tick.enter().insert("g", "path").attr("class", "tick major").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform; + var range = d3_scaleRange(scale), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"), + d3.transition(path)); + var scale1 = scale.copy(), scale0 = this.__chart__ || scale1; + this.__chart__ = scale1; + tickEnter.append("line"); + tickEnter.append("text"); + var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text"); + switch (orient) { + case "bottom": + { + tickTransform = d3_svg_axisX; + subtickEnter.attr("y2", tickMinorSize); + subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize); + lineEnter.attr("y2", tickMajorSize); + textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding); + lineUpdate.attr("x2", 0).attr("y2", tickMajorSize); + textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding); + text.attr("dy", ".71em").style("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize); + break; + } + + case "top": + { + tickTransform = d3_svg_axisX; + subtickEnter.attr("y2", -tickMinorSize); + subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize); + lineEnter.attr("y2", -tickMajorSize); + textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)); + lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize); + textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)); + text.attr("dy", "0em").style("text-anchor", "middle"); + pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize); + break; + } + + case "left": + { + tickTransform = d3_svg_axisY; + subtickEnter.attr("x2", -tickMinorSize); + subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0); + lineEnter.attr("x2", -tickMajorSize); + textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)); + lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0); + textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0); + text.attr("dy", ".32em").style("text-anchor", "end"); + pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize); + break; + } + + case "right": + { + tickTransform = d3_svg_axisY; + subtickEnter.attr("x2", tickMinorSize); + subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0); + lineEnter.attr("x2", tickMajorSize); + textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding); + lineUpdate.attr("x2", tickMajorSize).attr("y2", 0); + textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0); + text.attr("dy", ".32em").style("text-anchor", "start"); + pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize); + break; + } + } + if (scale.ticks) { + tickEnter.call(tickTransform, scale0); + tickUpdate.call(tickTransform, scale1); + tickExit.call(tickTransform, scale1); + subtickEnter.call(tickTransform, scale0); + subtickUpdate.call(tickTransform, scale1); + subtickExit.call(tickTransform, scale1); + } else { + var dx = scale1.rangeBand() / 2, x = function(d) { + return scale1(d) + dx; + }; + tickEnter.call(tickTransform, x); + tickUpdate.call(tickTransform, x); + } + }); + } + axis.scale = function(x) { + if (!arguments.length) return scale; + scale = x; + return axis; + }; + axis.orient = function(x) { + if (!arguments.length) return orient; + orient = x in d3_svg_axisOrients ? x + "" : d3_svg_axisDefaultOrient; + return axis; + }; + axis.ticks = function() { + if (!arguments.length) return tickArguments_; + tickArguments_ = arguments; + return axis; + }; + axis.tickValues = function(x) { + if (!arguments.length) return tickValues; + tickValues = x; + return axis; + }; + axis.tickFormat = function(x) { + if (!arguments.length) return tickFormat_; + tickFormat_ = x; + return axis; + }; + axis.tickSize = function(x, y) { + if (!arguments.length) return tickMajorSize; + var n = arguments.length - 1; + tickMajorSize = +x; + tickMinorSize = n > 1 ? +y : tickMajorSize; + tickEndSize = n > 0 ? +arguments[n] : tickMajorSize; + return axis; + }; + axis.tickPadding = function(x) { + if (!arguments.length) return tickPadding; + tickPadding = +x; + return axis; + }; + axis.tickSubdivide = function(x) { + if (!arguments.length) return tickSubdivide; + tickSubdivide = +x; + return axis; + }; + return axis; + }; + var d3_svg_axisDefaultOrient = "bottom", d3_svg_axisOrients = { + top: 1, + right: 1, + bottom: 1, + left: 1 + }; + function d3_svg_axisX(selection, x) { + selection.attr("transform", function(d) { + return "translate(" + x(d) + ",0)"; + }); + } + function d3_svg_axisY(selection, y) { + selection.attr("transform", function(d) { + return "translate(0," + y(d) + ")"; + }); + } + function d3_svg_axisSubdivide(scale, ticks, m) { + subticks = []; + if (m && ticks.length > 1) { + var extent = d3_scaleExtent(scale.domain()), subticks, i = -1, n = ticks.length, d = (ticks[1] - ticks[0]) / ++m, j, v; + while (++i < n) { + for (j = m; --j > 0; ) { + if ((v = +ticks[i] - j * d) >= extent[0]) { + subticks.push(v); + } + } + } + for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1]; ) { + subticks.push(v); + } + } + return subticks; + } + d3.svg.brush = function() { + var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], extentDomain; + function brush(g) { + g.each(function() { + var g = d3.select(this), bg = g.selectAll(".background").data([ 0 ]), fg = g.selectAll(".extent").data([ 0 ]), tz = g.selectAll(".resize").data(resizes, String), e; + g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart); + bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair"); + fg.enter().append("rect").attr("class", "extent").style("cursor", "move"); + tz.enter().append("g").attr("class", function(d) { + return "resize " + d; + }).style("cursor", function(d) { + return d3_svg_brushCursor[d]; + }).append("rect").attr("x", function(d) { + return /[ew]$/.test(d) ? -3 : null; + }).attr("y", function(d) { + return /^[ns]/.test(d) ? -3 : null; + }).attr("width", 6).attr("height", 6).style("visibility", "hidden"); + tz.style("display", brush.empty() ? "none" : null); + tz.exit().remove(); + if (x) { + e = d3_scaleRange(x); + bg.attr("x", e[0]).attr("width", e[1] - e[0]); + redrawX(g); + } + if (y) { + e = d3_scaleRange(y); + bg.attr("y", e[0]).attr("height", e[1] - e[0]); + redrawY(g); + } + redraw(g); + }); + } + function redraw(g) { + g.selectAll(".resize").attr("transform", function(d) { + return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")"; + }); + } + function redrawX(g) { + g.select(".extent").attr("x", extent[0][0]); + g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]); + } + function redrawY(g) { + g.select(".extent").attr("y", extent[0][1]); + g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]); + } + function brushstart() { + var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), center, origin = mouse(), offset; + var w = d3.select(d3_window).on("mousemove.brush", brushmove).on("mouseup.brush", brushend).on("touchmove.brush", brushmove).on("touchend.brush", brushend).on("keydown.brush", keydown).on("keyup.brush", keyup); + if (dragging) { + origin[0] = extent[0][0] - origin[0]; + origin[1] = extent[0][1] - origin[1]; + } else if (resizing) { + var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing); + offset = [ extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1] ]; + origin[0] = extent[ex][0]; + origin[1] = extent[ey][1]; + } else if (d3.event.altKey) center = origin.slice(); + g.style("pointer-events", "none").selectAll(".resize").style("display", null); + d3.select("body").style("cursor", eventTarget.style("cursor")); + event_({ + type: "brushstart" + }); + brushmove(); + d3_eventCancel(); + function mouse() { + var touches = d3.event.changedTouches; + return touches ? d3.touches(target, touches)[0] : d3.mouse(target); + } + function keydown() { + if (d3.event.keyCode == 32) { + if (!dragging) { + center = null; + origin[0] -= extent[1][0]; + origin[1] -= extent[1][1]; + dragging = 2; + } + d3_eventCancel(); + } + } + function keyup() { + if (d3.event.keyCode == 32 && dragging == 2) { + origin[0] += extent[1][0]; + origin[1] += extent[1][1]; + dragging = 0; + d3_eventCancel(); + } + } + function brushmove() { + var point = mouse(), moved = false; + if (offset) { + point[0] += offset[0]; + point[1] += offset[1]; + } + if (!dragging) { + if (d3.event.altKey) { + if (!center) center = [ (extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2 ]; + origin[0] = extent[+(point[0] < center[0])][0]; + origin[1] = extent[+(point[1] < center[1])][1]; + } else center = null; + } + if (resizingX && move1(point, x, 0)) { + redrawX(g); + moved = true; + } + if (resizingY && move1(point, y, 1)) { + redrawY(g); + moved = true; + } + if (moved) { + redraw(g); + event_({ + type: "brush", + mode: dragging ? "move" : "resize" + }); + } + } + function move1(point, scale, i) { + var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], size = extent[1][i] - extent[0][i], min, max; + if (dragging) { + r0 -= position; + r1 -= size + position; + } + min = Math.max(r0, Math.min(r1, point[i])); + if (dragging) { + max = (min += position) + size; + } else { + if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min)); + if (position < min) { + max = min; + min = position; + } else { + max = position; + } + } + if (extent[0][i] !== min || extent[1][i] !== max) { + extentDomain = null; + extent[0][i] = min; + extent[1][i] = max; + return true; + } + } + function brushend() { + brushmove(); + g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null); + d3.select("body").style("cursor", null); + w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null); + event_({ + type: "brushend" + }); + d3_eventCancel(); + } + } + brush.x = function(z) { + if (!arguments.length) return x; + x = z; + resizes = d3_svg_brushResizes[!x << 1 | !y]; + return brush; + }; + brush.y = function(z) { + if (!arguments.length) return y; + y = z; + resizes = d3_svg_brushResizes[!x << 1 | !y]; + return brush; + }; + brush.extent = function(z) { + var x0, x1, y0, y1, t; + if (!arguments.length) { + z = extentDomain || extent; + if (x) { + x0 = z[0][0], x1 = z[1][0]; + if (!extentDomain) { + x0 = extent[0][0], x1 = extent[1][0]; + if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + } + } + if (y) { + y0 = z[0][1], y1 = z[1][1]; + if (!extentDomain) { + y0 = extent[0][1], y1 = extent[1][1]; + if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + } + } + return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ]; + } + extentDomain = [ [ 0, 0 ], [ 0, 0 ] ]; + if (x) { + x0 = z[0], x1 = z[1]; + if (y) x0 = x0[0], x1 = x1[0]; + extentDomain[0][0] = x0, extentDomain[1][0] = x1; + if (x.invert) x0 = x(x0), x1 = x(x1); + if (x1 < x0) t = x0, x0 = x1, x1 = t; + extent[0][0] = x0 | 0, extent[1][0] = x1 | 0; + } + if (y) { + y0 = z[0], y1 = z[1]; + if (x) y0 = y0[1], y1 = y1[1]; + extentDomain[0][1] = y0, extentDomain[1][1] = y1; + if (y.invert) y0 = y(y0), y1 = y(y1); + if (y1 < y0) t = y0, y0 = y1, y1 = t; + extent[0][1] = y0 | 0, extent[1][1] = y1 | 0; + } + return brush; + }; + brush.clear = function() { + extentDomain = null; + extent[0][0] = extent[0][1] = extent[1][0] = extent[1][1] = 0; + return brush; + }; + brush.empty = function() { + return x && extent[0][0] === extent[1][0] || y && extent[0][1] === extent[1][1]; + }; + return d3.rebind(brush, event, "on"); + }; + var d3_svg_brushCursor = { + n: "ns-resize", + e: "ew-resize", + s: "ns-resize", + w: "ew-resize", + nw: "nwse-resize", + ne: "nesw-resize", + se: "nwse-resize", + sw: "nesw-resize" + }; + var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ]; + d3.time = {}; + var d3_time = Date, d3_time_daySymbols = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ]; + function d3_time_utc() { + this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]); + } + d3_time_utc.prototype = { + getDate: function() { + return this._.getUTCDate(); + }, + getDay: function() { + return this._.getUTCDay(); + }, + getFullYear: function() { + return this._.getUTCFullYear(); + }, + getHours: function() { + return this._.getUTCHours(); + }, + getMilliseconds: function() { + return this._.getUTCMilliseconds(); + }, + getMinutes: function() { + return this._.getUTCMinutes(); + }, + getMonth: function() { + return this._.getUTCMonth(); + }, + getSeconds: function() { + return this._.getUTCSeconds(); + }, + getTime: function() { + return this._.getTime(); + }, + getTimezoneOffset: function() { + return 0; + }, + valueOf: function() { + return this._.valueOf(); + }, + setDate: function() { + d3_time_prototype.setUTCDate.apply(this._, arguments); + }, + setDay: function() { + d3_time_prototype.setUTCDay.apply(this._, arguments); + }, + setFullYear: function() { + d3_time_prototype.setUTCFullYear.apply(this._, arguments); + }, + setHours: function() { + d3_time_prototype.setUTCHours.apply(this._, arguments); + }, + setMilliseconds: function() { + d3_time_prototype.setUTCMilliseconds.apply(this._, arguments); + }, + setMinutes: function() { + d3_time_prototype.setUTCMinutes.apply(this._, arguments); + }, + setMonth: function() { + d3_time_prototype.setUTCMonth.apply(this._, arguments); + }, + setSeconds: function() { + d3_time_prototype.setUTCSeconds.apply(this._, arguments); + }, + setTime: function() { + d3_time_prototype.setTime.apply(this._, arguments); + } + }; + var d3_time_prototype = Date.prototype; + var d3_time_formatDateTime = "%a %b %e %X %Y", d3_time_formatDate = "%m/%d/%Y", d3_time_formatTime = "%H:%M:%S"; + var d3_time_days = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], d3_time_dayAbbreviations = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], d3_time_months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], d3_time_monthAbbreviations = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ]; + function d3_time_interval(local, step, number) { + function round(date) { + var d0 = local(date), d1 = offset(d0, 1); + return date - d0 < d1 - date ? d0 : d1; + } + function ceil(date) { + step(date = local(new d3_time(date - 1)), 1); + return date; + } + function offset(date, k) { + step(date = new d3_time(+date), k); + return date; + } + function range(t0, t1, dt) { + var time = ceil(t0), times = []; + if (dt > 1) { + while (time < t1) { + if (!(number(time) % dt)) times.push(new Date(+time)); + step(time, 1); + } + } else { + while (time < t1) times.push(new Date(+time)), step(time, 1); + } + return times; + } + function range_utc(t0, t1, dt) { + try { + d3_time = d3_time_utc; + var utc = new d3_time_utc(); + utc._ = t0; + return range(utc, t1, dt); + } finally { + d3_time = Date; + } + } + local.floor = local; + local.round = round; + local.ceil = ceil; + local.offset = offset; + local.range = range; + var utc = local.utc = d3_time_interval_utc(local); + utc.floor = utc; + utc.round = d3_time_interval_utc(round); + utc.ceil = d3_time_interval_utc(ceil); + utc.offset = d3_time_interval_utc(offset); + utc.range = range_utc; + return local; + } + function d3_time_interval_utc(method) { + return function(date, k) { + try { + d3_time = d3_time_utc; + var utc = new d3_time_utc(); + utc._ = date; + return method(utc, k)._; + } finally { + d3_time = Date; + } + }; + } + d3.time.year = d3_time_interval(function(date) { + date = d3.time.day(date); + date.setMonth(0, 1); + return date; + }, function(date, offset) { + date.setFullYear(date.getFullYear() + offset); + }, function(date) { + return date.getFullYear(); + }); + d3.time.years = d3.time.year.range; + d3.time.years.utc = d3.time.year.utc.range; + d3.time.day = d3_time_interval(function(date) { + var day = new d3_time(1970, 0); + day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate()); + return day; + }, function(date, offset) { + date.setDate(date.getDate() + offset); + }, function(date) { + return date.getDate() - 1; + }); + d3.time.days = d3.time.day.range; + d3.time.days.utc = d3.time.day.utc.range; + d3.time.dayOfYear = function(date) { + var year = d3.time.year(date); + return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5); + }; + d3_time_daySymbols.forEach(function(day, i) { + day = day.toLowerCase(); + i = 7 - i; + var interval = d3.time[day] = d3_time_interval(function(date) { + (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7); + return date; + }, function(date, offset) { + date.setDate(date.getDate() + Math.floor(offset) * 7); + }, function(date) { + var day = d3.time.year(date).getDay(); + return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i); + }); + d3.time[day + "s"] = interval.range; + d3.time[day + "s"].utc = interval.utc.range; + d3.time[day + "OfYear"] = function(date) { + var day = d3.time.year(date).getDay(); + return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7); + }; + }); + d3.time.week = d3.time.sunday; + d3.time.weeks = d3.time.sunday.range; + d3.time.weeks.utc = d3.time.sunday.utc.range; + d3.time.weekOfYear = d3.time.sundayOfYear; + d3.time.format = function(template) { + var n = template.length; + function format(date) { + var string = [], i = -1, j = 0, c, p, f; + while (++i < n) { + if (template.charCodeAt(i) === 37) { + string.push(template.substring(j, i)); + if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i); + if (f = d3_time_formats[c]) c = f(date, p == null ? c === "e" ? " " : "0" : p); + string.push(c); + j = i + 1; + } + } + string.push(template.substring(j, i)); + return string.join(""); + } + format.parse = function(string) { + var d = { + y: 1900, + m: 0, + d: 1, + H: 0, + M: 0, + S: 0, + L: 0 + }, i = d3_time_parse(d, template, string, 0); + if (i != string.length) return null; + if ("p" in d) d.H = d.H % 12 + d.p * 12; + var date = new d3_time(); + date.setFullYear(d.y, d.m, d.d); + date.setHours(d.H, d.M, d.S, d.L); + return date; + }; + format.toString = function() { + return template; + }; + return format; + }; + function d3_time_parse(date, template, string, j) { + var c, p, i = 0, n = template.length, m = string.length; + while (i < n) { + if (j >= m) return -1; + c = template.charCodeAt(i++); + if (c === 37) { + p = d3_time_parsers[template.charAt(i++)]; + if (!p || (j = p(date, string, j)) < 0) return -1; + } else if (c != string.charCodeAt(j++)) { + return -1; + } + } + return j; + } + function d3_time_formatRe(names) { + return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i"); + } + function d3_time_formatLookup(names) { + var map = new d3_Map(), i = -1, n = names.length; + while (++i < n) map.set(names[i].toLowerCase(), i); + return map; + } + function d3_time_formatPad(value, fill, width) { + value += ""; + var length = value.length; + return length < width ? new Array(width - length + 1).join(fill) + value : value; + } + var d3_time_dayRe = d3_time_formatRe(d3_time_days), d3_time_dayAbbrevRe = d3_time_formatRe(d3_time_dayAbbreviations), d3_time_monthRe = d3_time_formatRe(d3_time_months), d3_time_monthLookup = d3_time_formatLookup(d3_time_months), d3_time_monthAbbrevRe = d3_time_formatRe(d3_time_monthAbbreviations), d3_time_monthAbbrevLookup = d3_time_formatLookup(d3_time_monthAbbreviations); + var d3_time_formatPads = { + "-": "", + _: " ", + "0": "0" + }; + var d3_time_formats = { + a: function(d) { + return d3_time_dayAbbreviations[d.getDay()]; + }, + A: function(d) { + return d3_time_days[d.getDay()]; + }, + b: function(d) { + return d3_time_monthAbbreviations[d.getMonth()]; + }, + B: function(d) { + return d3_time_months[d.getMonth()]; + }, + c: d3.time.format(d3_time_formatDateTime), + d: function(d, p) { + return d3_time_formatPad(d.getDate(), p, 2); + }, + e: function(d, p) { + return d3_time_formatPad(d.getDate(), p, 2); + }, + H: function(d, p) { + return d3_time_formatPad(d.getHours(), p, 2); + }, + I: function(d, p) { + return d3_time_formatPad(d.getHours() % 12 || 12, p, 2); + }, + j: function(d, p) { + return d3_time_formatPad(1 + d3.time.dayOfYear(d), p, 3); + }, + L: function(d, p) { + return d3_time_formatPad(d.getMilliseconds(), p, 3); + }, + m: function(d, p) { + return d3_time_formatPad(d.getMonth() + 1, p, 2); + }, + M: function(d, p) { + return d3_time_formatPad(d.getMinutes(), p, 2); + }, + p: function(d) { + return d.getHours() >= 12 ? "PM" : "AM"; + }, + S: function(d, p) { + return d3_time_formatPad(d.getSeconds(), p, 2); + }, + U: function(d, p) { + return d3_time_formatPad(d3.time.sundayOfYear(d), p, 2); + }, + w: function(d) { + return d.getDay(); + }, + W: function(d, p) { + return d3_time_formatPad(d3.time.mondayOfYear(d), p, 2); + }, + x: d3.time.format(d3_time_formatDate), + X: d3.time.format(d3_time_formatTime), + y: function(d, p) { + return d3_time_formatPad(d.getFullYear() % 100, p, 2); + }, + Y: function(d, p) { + return d3_time_formatPad(d.getFullYear() % 1e4, p, 4); + }, + Z: d3_time_zone, + "%": function() { + return "%"; + } + }; + var d3_time_parsers = { + a: d3_time_parseWeekdayAbbrev, + A: d3_time_parseWeekday, + b: d3_time_parseMonthAbbrev, + B: d3_time_parseMonth, + c: d3_time_parseLocaleFull, + d: d3_time_parseDay, + e: d3_time_parseDay, + H: d3_time_parseHour24, + I: d3_time_parseHour24, + L: d3_time_parseMilliseconds, + m: d3_time_parseMonthNumber, + M: d3_time_parseMinutes, + p: d3_time_parseAmPm, + S: d3_time_parseSeconds, + x: d3_time_parseLocaleDate, + X: d3_time_parseLocaleTime, + y: d3_time_parseYear, + Y: d3_time_parseFullYear + }; + function d3_time_parseWeekdayAbbrev(date, string, i) { + d3_time_dayAbbrevRe.lastIndex = 0; + var n = d3_time_dayAbbrevRe.exec(string.substring(i)); + return n ? i += n[0].length : -1; + } + function d3_time_parseWeekday(date, string, i) { + d3_time_dayRe.lastIndex = 0; + var n = d3_time_dayRe.exec(string.substring(i)); + return n ? i += n[0].length : -1; + } + function d3_time_parseMonthAbbrev(date, string, i) { + d3_time_monthAbbrevRe.lastIndex = 0; + var n = d3_time_monthAbbrevRe.exec(string.substring(i)); + return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i += n[0].length) : -1; + } + function d3_time_parseMonth(date, string, i) { + d3_time_monthRe.lastIndex = 0; + var n = d3_time_monthRe.exec(string.substring(i)); + return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1; + } + function d3_time_parseLocaleFull(date, string, i) { + return d3_time_parse(date, d3_time_formats.c.toString(), string, i); + } + function d3_time_parseLocaleDate(date, string, i) { + return d3_time_parse(date, d3_time_formats.x.toString(), string, i); + } + function d3_time_parseLocaleTime(date, string, i) { + return d3_time_parse(date, d3_time_formats.X.toString(), string, i); + } + function d3_time_parseFullYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 4)); + return n ? (date.y = +n[0], i += n[0].length) : -1; + } + function d3_time_parseYear(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.y = d3_time_expandYear(+n[0]), i += n[0].length) : -1; + } + function d3_time_expandYear(d) { + return d + (d > 68 ? 1900 : 2e3); + } + function d3_time_parseMonthNumber(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.m = n[0] - 1, i += n[0].length) : -1; + } + function d3_time_parseDay(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.d = +n[0], i += n[0].length) : -1; + } + function d3_time_parseHour24(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.H = +n[0], i += n[0].length) : -1; + } + function d3_time_parseMinutes(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.M = +n[0], i += n[0].length) : -1; + } + function d3_time_parseSeconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 2)); + return n ? (date.S = +n[0], i += n[0].length) : -1; + } + function d3_time_parseMilliseconds(date, string, i) { + d3_time_numberRe.lastIndex = 0; + var n = d3_time_numberRe.exec(string.substring(i, i + 3)); + return n ? (date.L = +n[0], i += n[0].length) : -1; + } + var d3_time_numberRe = /^\s*\d+/; + function d3_time_parseAmPm(date, string, i) { + var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase()); + return n == null ? -1 : (date.p = n, i); + } + var d3_time_amPmLookup = d3.map({ + am: 0, + pm: 1 + }); + function d3_time_zone(d) { + var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(Math.abs(z) / 60), zm = Math.abs(z) % 60; + return zs + d3_time_formatPad(zh, "0", 2) + d3_time_formatPad(zm, "0", 2); + } + d3.time.format.utc = function(template) { + var local = d3.time.format(template); + function format(date) { + try { + d3_time = d3_time_utc; + var utc = new d3_time(); + utc._ = date; + return local(utc); + } finally { + d3_time = Date; + } + } + format.parse = function(string) { + try { + d3_time = d3_time_utc; + var date = local.parse(string); + return date && date._; + } finally { + d3_time = Date; + } + }; + format.toString = local.toString; + return format; + }; + var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ"); + d3.time.format.iso = Date.prototype.toISOString && +new Date("2000-01-01T00:00:00.000Z") ? d3_time_formatIsoNative : d3_time_formatIso; + function d3_time_formatIsoNative(date) { + return date.toISOString(); + } + d3_time_formatIsoNative.parse = function(string) { + var date = new Date(string); + return isNaN(date) ? null : date; + }; + d3_time_formatIsoNative.toString = d3_time_formatIso.toString; + d3.time.second = d3_time_interval(function(date) { + return new d3_time(Math.floor(date / 1e3) * 1e3); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 1e3); + }, function(date) { + return date.getSeconds(); + }); + d3.time.seconds = d3.time.second.range; + d3.time.seconds.utc = d3.time.second.utc.range; + d3.time.minute = d3_time_interval(function(date) { + return new d3_time(Math.floor(date / 6e4) * 6e4); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 6e4); + }, function(date) { + return date.getMinutes(); + }); + d3.time.minutes = d3.time.minute.range; + d3.time.minutes.utc = d3.time.minute.utc.range; + d3.time.hour = d3_time_interval(function(date) { + var timezone = date.getTimezoneOffset() / 60; + return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5); + }, function(date, offset) { + date.setTime(date.getTime() + Math.floor(offset) * 36e5); + }, function(date) { + return date.getHours(); + }); + d3.time.hours = d3.time.hour.range; + d3.time.hours.utc = d3.time.hour.utc.range; + d3.time.month = d3_time_interval(function(date) { + date = d3.time.day(date); + date.setDate(1); + return date; + }, function(date, offset) { + date.setMonth(date.getMonth() + offset); + }, function(date) { + return date.getMonth(); + }); + d3.time.months = d3.time.month.range; + d3.time.months.utc = d3.time.month.utc.range; + function d3_time_scale(linear, methods, format) { + function scale(x) { + return linear(x); + } + scale.invert = function(x) { + return d3_time_scaleDate(linear.invert(x)); + }; + scale.domain = function(x) { + if (!arguments.length) return linear.domain().map(d3_time_scaleDate); + linear.domain(x); + return scale; + }; + scale.nice = function(m) { + return scale.domain(d3_scale_nice(scale.domain(), function() { + return m; + })); + }; + scale.ticks = function(m, k) { + var extent = d3_time_scaleExtent(scale.domain()); + if (typeof m !== "function") { + var span = extent[1] - extent[0], target = span / m, i = d3.bisect(d3_time_scaleSteps, target); + if (i == d3_time_scaleSteps.length) return methods.year(extent, m); + if (!i) return linear.ticks(m).map(d3_time_scaleDate); + if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i; + m = methods[i]; + k = m[1]; + m = m[0].range; + } + return m(extent[0], new Date(+extent[1] + 1), k); + }; + scale.tickFormat = function() { + return format; + }; + scale.copy = function() { + return d3_time_scale(linear.copy(), methods, format); + }; + return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); + } + function d3_time_scaleExtent(domain) { + var start = domain[0], stop = domain[domain.length - 1]; + return start < stop ? [ start, stop ] : [ stop, start ]; + } + function d3_time_scaleDate(t) { + return new Date(t); + } + function d3_time_scaleFormat(formats) { + return function(date) { + var i = formats.length - 1, f = formats[i]; + while (!f[1](date)) f = formats[--i]; + return f[0](date); + }; + } + function d3_time_scaleSetYear(y) { + var d = new Date(y, 0, 1); + d.setFullYear(y); + return d; + } + function d3_time_scaleGetYear(d) { + var y = d.getFullYear(), d0 = d3_time_scaleSetYear(y), d1 = d3_time_scaleSetYear(y + 1); + return y + (d - d0) / (d1 - d0); + } + var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ]; + var d3_time_scaleLocalMethods = [ [ d3.time.second, 1 ], [ d3.time.second, 5 ], [ d3.time.second, 15 ], [ d3.time.second, 30 ], [ d3.time.minute, 1 ], [ d3.time.minute, 5 ], [ d3.time.minute, 15 ], [ d3.time.minute, 30 ], [ d3.time.hour, 1 ], [ d3.time.hour, 3 ], [ d3.time.hour, 6 ], [ d3.time.hour, 12 ], [ d3.time.day, 1 ], [ d3.time.day, 2 ], [ d3.time.week, 1 ], [ d3.time.month, 1 ], [ d3.time.month, 3 ], [ d3.time.year, 1 ] ]; + var d3_time_scaleLocalFormats = [ [ d3.time.format("%Y"), d3_true ], [ d3.time.format("%B"), function(d) { + return d.getMonth(); + } ], [ d3.time.format("%b %d"), function(d) { + return d.getDate() != 1; + } ], [ d3.time.format("%a %d"), function(d) { + return d.getDay() && d.getDate() != 1; + } ], [ d3.time.format("%I %p"), function(d) { + return d.getHours(); + } ], [ d3.time.format("%I:%M"), function(d) { + return d.getMinutes(); + } ], [ d3.time.format(":%S"), function(d) { + return d.getSeconds(); + } ], [ d3.time.format(".%L"), function(d) { + return d.getMilliseconds(); + } ] ]; + var d3_time_scaleLinear = d3.scale.linear(), d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats); + d3_time_scaleLocalMethods.year = function(extent, m) { + return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear); + }; + d3.time.scale = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat); + }; + var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) { + return [ m[0].utc, m[1] ]; + }); + var d3_time_scaleUTCFormats = [ [ d3.time.format.utc("%Y"), d3_true ], [ d3.time.format.utc("%B"), function(d) { + return d.getUTCMonth(); + } ], [ d3.time.format.utc("%b %d"), function(d) { + return d.getUTCDate() != 1; + } ], [ d3.time.format.utc("%a %d"), function(d) { + return d.getUTCDay() && d.getUTCDate() != 1; + } ], [ d3.time.format.utc("%I %p"), function(d) { + return d.getUTCHours(); + } ], [ d3.time.format.utc("%I:%M"), function(d) { + return d.getUTCMinutes(); + } ], [ d3.time.format.utc(":%S"), function(d) { + return d.getUTCSeconds(); + } ], [ d3.time.format.utc(".%L"), function(d) { + return d.getUTCMilliseconds(); + } ] ]; + var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats); + function d3_time_scaleUTCSetYear(y) { + var d = new Date(Date.UTC(y, 0, 1)); + d.setUTCFullYear(y); + return d; + } + function d3_time_scaleUTCGetYear(d) { + var y = d.getUTCFullYear(), d0 = d3_time_scaleUTCSetYear(y), d1 = d3_time_scaleUTCSetYear(y + 1); + return y + (d - d0) / (d1 - d0); + } + d3_time_scaleUTCMethods.year = function(extent, m) { + return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear); + }; + d3.time.scale.utc = function() { + return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat); + }; + d3.text = function() { + return d3.xhr.apply(d3, arguments).response(d3_text); + }; + function d3_text(request) { + return request.responseText; + } + d3.json = function(url, callback) { + return d3.xhr(url, "application/json", callback).response(d3_json); + }; + function d3_json(request) { + return JSON.parse(request.responseText); + } + d3.html = function(url, callback) { + return d3.xhr(url, "text/html", callback).response(d3_html); + }; + function d3_html(request) { + var range = d3_document.createRange(); + range.selectNode(d3_document.body); + return range.createContextualFragment(request.responseText); + } + d3.xml = function() { + return d3.xhr.apply(d3, arguments).response(d3_xml); + }; + function d3_xml(request) { + return request.responseXML; + } + return d3; +}(); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v3.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v3.min.js new file mode 100644 index 0000000..7975878 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/d3.v3.min.js @@ -0,0 +1 @@ +d3=function(){function o(e){return e!=null&&!isNaN(e)}function a(e){return e.length}function f(e){var t=1;while(e*t%1)t*=10;return t}function l(e,t){try{for(var n in t){Object.defineProperty(e.prototype,n,{value:t[n],enumerable:false})}}catch(r){e.prototype=t}}function c(){}function d(){}function v(e,t,n){return function(){var r=n.apply(t,arguments);return r===t?e:r}}function m(){}function g(e){function r(){var n=t,r=-1,i=n.length,s;while(++r0)t=t.substring(0,s);var u=Z.get(t);if(u)t=u,o=tt;return s?n?f:a:n?G:l}function et(t,n){return function(r){var i=e.event;e.event=r;n[0]=this.__data__;try{t.apply(this,n)}finally{e.event=i}}}function tt(e,t){var n=et(e,t);return function(e){var t=this,r=e.relatedTarget;if(!r||r!==t&&!(r.compareDocumentPosition(t)&8)){n.call(t,e)}}}function nt(e,t){for(var n=0,r=e.length;n360)e-=360;else if(e<0)e+=360;if(e<60)return r+(i-r)*e/60;if(e<180)return i;if(e<240)return r+(i-r)*(240-e)/60;return r}function o(e){return Math.round(s(e)*255)}var r,i;e=e%360;if(e<0)e+=360;t=t<0?0:t>1?1:t;n=n<0?0:n>1?1:n;i=n<=.5?n*(1+t):n+t-n*t;r=2*n-i;return qt(o(e+120),o(e),o(e-120))}function yt(e){return e>0?1:e<0?-1:0}function bt(e){return Math.acos(Math.max(-1,Math.min(1,e)))}function wt(e){return e>1?dt/2:e<-1?-dt/2:Math.asin(e)}function Et(e){return(Math.exp(e)-Math.exp(-e))/2}function St(e){return(Math.exp(e)+Math.exp(-e))/2}function xt(e){return(e=Math.sin(e/2))*e}function Tt(e,t,n){return new Nt(e,t,n)}function Nt(e,t,n){this.h=e;this.c=t;this.l=n}function kt(e,t,n){return Lt(n,Math.cos(e*=mt)*t,Math.sin(e)*t)}function Lt(e,t,n){return new At(e,t,n)}function At(e,t,n){this.l=e;this.a=t;this.b=n}function Ht(e,t,n){var r=(e+16)/116,i=r+t/500,s=r-n/200;i=jt(i)*Mt;r=jt(r)*_t;s=jt(s)*Dt;return qt(It(3.2404542*i-1.5371385*r-.4985314*s),It(-.969266*i+1.8760108*r+.041556*s),It(.0556434*i-.2040259*r+1.0572252*s))}function Bt(e,t,n){return Tt(Math.atan2(n,t)*gt,Math.sqrt(t*t+n*n),e)}function jt(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function Ft(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function It(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function qt(e,t,n){return new Rt(e,t,n)}function Rt(e,t,n){this.r=e;this.g=t;this.b=n}function zt(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function Wt(e,t,n){var r=0,i=0,s=0,o,u,a;o=/([a-z]+)\((.*)\)/i.exec(e);if(o){u=o[2].split(",");switch(o[1]){case"hsl":{return n(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100)};case"rgb":{return t(Jt(u[0]),Jt(u[1]),Jt(u[2]))}}}if(a=Kt.get(e))return t(a.r,a.g,a.b);if(e!=null&&e.charAt(0)==="#"){if(e.length===4){r=e.charAt(1);r+=r;i=e.charAt(2);i+=i;s=e.charAt(3);s+=s}else if(e.length===7){r=e.substring(1,3);i=e.substring(3,5);s=e.substring(5,7)}r=parseInt(r,16);i=parseInt(i,16);s=parseInt(s,16)}return t(r,i,s)}function Xt(e,t,n){var r=Math.min(e/=255,t/=255,n/=255),i=Math.max(e,t,n),s=i-r,o,u,a=(i+r)/2;if(s){u=a<.5?s/(i+r):s/(2-i-r);if(e==i)o=(t-n)/s+(t=o)return r;if(l)return l=false,n;var t=u;if(e.charCodeAt(t)===34){var s=t;while(s++=n.delay)n.flush=n.callback(e);n=n.next}var r=un()-t;if(r>24){if(isFinite(r)){clearTimeout(sn);sn=setTimeout(on,r)}rn=0}else{rn=1;an(on)}}function un(){var e=null,t=nn,n=Infinity;while(t){if(t.flush){delete tn[t.callback.id];t=e?e.next=t.next:nn=t.next}else{n=Math.min(n,t.then+t.delay);t=(e=t).next}}return n}function pn(e,t){var n=Math.pow(10,Math.abs(8-t)*3);return{scale:t>8?function(e){return e/n}:function(e){return e*n},symbol:e}}function mn(e,t){return t-(e?Math.ceil(Math.log(e)/Math.LN10):1)}function gn(e){return e+""}function wn(e,t){if(e&&Sn.hasOwnProperty(e.type)){Sn[e.type](e,t)}}function xn(e,t,n){var r=-1,i=e.length-n,s;t.lineStart();while(++ri)i=e;if(ts)s=t}function a(){o.point=o.lineEnd=G}var n,r,i,s;var o={point:u,lineStart:G,lineEnd:G,polygonStart:function(){o.lineEnd=a},polygonEnd:function(){o.point=u}};return function(u){s=i=-(n=r=Infinity);e.geo.stream(u,t(o));return[[n,r],[i,s]]}}function jn(e,t){if(Mn)return;++_n;e*=mt;var n=Math.cos(t*=mt);Dn+=(n*Math.cos(e)-Dn)/_n;Pn+=(n*Math.sin(e)-Pn)/_n;Hn+=(Math.sin(t)-Hn)/_n}function Fn(){var e,t;Mn=1;In();Mn=2;var n=Bn.point;Bn.point=function(r,i){n(e=r,t=i)};Bn.lineEnd=function(){Bn.point(e,t);qn();Bn.lineEnd=qn}}function In(){function r(r,i){r*=mt;var s=Math.cos(i*=mt),o=s*Math.cos(r),u=s*Math.sin(r),a=Math.sin(i),f=Math.atan2(Math.sqrt((f=t*a-n*u)*f+(f=n*o-e*a)*f+(f=e*u-t*o)*f),e*o+t*u+n*a);_n+=f;Dn+=f*(e+(e=o));Pn+=f*(t+(t=u));Hn+=f*(n+(n=a))}var e,t,n;if(Mn>1)return;if(Mn<1){Mn=1;_n=Dn=Pn=Hn=0}Bn.point=function(i,s){i*=mt;var o=Math.cos(s*=mt);e=o*Math.cos(i);t=o*Math.sin(i);n=Math.sin(s);Bn.point=r}}function qn(){Bn.point=jn}function Rn(e){var t=e[0],n=e[1],r=Math.cos(n);return[r*Math.cos(t),r*Math.sin(t),Math.sin(n)]}function Un(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function zn(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Wn(e,t){e[0]+=t[0];e[1]+=t[1];e[2]+=t[2]}function Xn(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Vn(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t;e[1]/=t;e[2]/=t}function $n(){return true}function Jn(e){return[Math.atan2(e[1],e[0]),Math.asin(Math.max(-1,Math.min(1,e[2])))]}function Kn(e,t){return Math.abs(e[0]-t[0])=0;)i.point((p=h[u])[0],p[1])}else{r(c.point,c.prev.point,-1,i)}c=c.prev}c=c.other;h=c.points}while(!c.visited);i.lineEnd()}}function Gn(e){if(!(t=e.length))return;var t,n=0,r=e[0],i;while(++n1&&e&2)t.push(t.pop().concat(t.shift()));c.push(t.filter(Zn))}var s=n(i);var o={point:u,lineStart:f,lineEnd:l,polygonStart:function(){o.point=y;o.lineStart=b;o.lineEnd=w;d=false;p=h=0;c=[];i.polygonStart()},polygonEnd:function(){o.point=u;o.lineStart=f;o.lineEnd=l;c=e.merge(c);if(c.length){Qn(c,nr,null,r,i)}else if(h<-vt||d&&p<-vt){i.lineStart();r(null,null,1,i);i.lineEnd()}i.polygonEnd();c=null},sphere:function(){i.polygonStart();i.lineStart();r(null,null,1,i);i.lineEnd();i.polygonEnd()}};var c,h,p,d;var v=er(),m=n(v),g;return o}}function Zn(e){return e.length>1}function er(){var e=[],t;return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:G,buffer:function(){var n=e;e=[];t=null;return n},rejoin:function(){if(e.length>1)e.push(e.pop().concat(e.shift()))}}}function tr(e,t){if(!(n=e.length))return 0;var n,r=0,i=0,s=e[0],o=s[0],u=s[1],a=Math.cos(u),f=Math.atan2(t*Math.sin(o)*a,Math.sin(u)),l=1-t*Math.cos(o)*a,c=f,h,p;while(++r2)i+=4*(h-f)}else if(Math.abs(l-2)0?dt:-dt,a=Math.abs(s-t);if(Math.abs(a-dt)0?dt/2:-dt/2);e.point(r,n);e.lineEnd();e.lineStart();e.point(u,n);e.point(s,n);i=0}else if(r!==u&&a>=dt){if(Math.abs(t-r)vt?Math.atan((Math.sin(t)*(s=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(t))*Math.sin(e))/(i*s*o)):(t+r)/2}function or(e,t,n,r){var i;if(e==null){i=n*dt/2;r.point(-dt,i);r.point(0,i);r.point(dt,i);r.point(dt,0);r.point(dt,-i);r.point(0,-i);r.point(-dt,-i);r.point(-dt,0);r.point(-dt,i)}else if(Math.abs(e[0]-t[0])>vt){var s=(e[0]t}function o(e){var t,i,o,f,l;return{lineStart:function(){f=o=false;l=1},point:function(c,h){var p=[c,h],d,v=s(c,h),m=n?v?0:a(c,h):v?a(c+(c<0?dt:-dt),h):0;if(!t&&(f=o=v))e.lineStart();if(v!==o){d=u(t,p);if(Kn(t,d)||Kn(p,d)){p[0]+=vt;p[1]+=vt;v=s(p[0],p[1])}}if(v!==o){l=0;if(v){e.lineStart();d=u(p,t);e.point(d[0],d[1])}else{d=u(t,p);e.point(d[0],d[1]);e.lineEnd()}t=d}else if(r&&t&&n^v){var g;if(!(m&i)&&(g=u(p,t,true))){l=0;if(n){e.lineStart();e.point(g[0][0],g[0][1]);e.point(g[1][0],g[1][1]);e.lineEnd()}else{e.point(g[1][0],g[1][1]);e.lineEnd();e.lineStart();e.point(g[0][0],g[0][1])}}}if(v&&(!t||!Kn(t,p))){e.point(p[0],p[1])}t=p,o=v,i=m},lineEnd:function(){if(o)e.lineEnd();t=null},clean:function(){return l|(f&&o)<<1}}}function u(e,n,r){var i=Rn(e),s=Rn(n);var o=[1,0,0],u=zn(i,s),a=Un(u,u),f=u[0],l=a-f*f;if(!l)return!r&&e;var c=t*a/l,h=-t*f/l,p=zn(o,u),d=Xn(o,c),v=Xn(u,h);Wn(d,v);var m=p,g=Un(d,m),y=Un(m,m),b=g*g-y*(Un(d,d)-1);if(b<0)return;var w=Math.sqrt(b),E=Xn(m,(-g-w)/y);Wn(E,d);E=Jn(E);if(!r)return E;var S=e[0],x=n[0],T=e[1],N=n[1],C;if(x0^E[1]<(Math.abs(E[0]-S)dt^(S<=E[0]&&E[0]<=x)){var O=Xn(m,(-g+w)/y);Wn(O,d);return[E,Jn(O)]}}function a(t,r){var i=n?e:dt-e,s=0;if(t<-i)s|=1;else if(t>i)s|=2;if(r<-i)s|=4;else if(r>i)s|=8;return s}var t=Math.cos(e),n=t>0,r=Math.abs(t)>vt,i=Er(e,6*mt);return Yn(s,o,i)}function fr(t,n,r,i){function s(e,i){return Math.abs(e[0]-t)0?0:3:Math.abs(e[0]-r)0?2:1:Math.abs(e[1]-n)0?1:0:i>0?3:2}function o(e,t){return u(e.point,t.point)}function u(e,t){var n=s(e,1),r=s(t,1);return n!==r?n-r:n===0?t[1]-e[1]:n===1?e[0]-t[0]:n===2?e[1]-t[1]:t[0]-e[0]}function a(e,s){var o=s[0]-e[0],u=s[1]-e[1],a=[0,1];if(Math.abs(o)0){e[0]+=a[0]*o;e[1]+=a[0]*u}return true}return false}return function(f){function m(e){var o=s(e,-1),u=g([o===0||o===3?t:r,o>1?i:n]);return u}function g(e){var t=0,n=p.length,r=e[1];for(var i=0;ir&&y(a,b,e)>0)++t}else{if(b[1]<=r&&y(a,b,e)<0)--t}a=b}}return t!==0}function y(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(t[1]-e[1])}function w(e,o,a,f){var l=0,c=0;if(e==null||(l=s(e,a))!==(c=s(o,a))||u(e,o)<0^a>0){do{f.point(l===0||l===3?t:r,l>1?i:n)}while((l=(l+a+4)%4)!==c)}else{f.point(o[0],o[1])}}function E(e,s){return t<=e&&e<=r&&n<=s&&s<=i}function S(e,t){if(E(e,t))f.point(e,t)}function O(){v.point=_;if(p)p.push(d=[]);A=true;L=false;C=k=NaN}function M(){if(h){_(x,T);if(N&&L)c.rejoin();h.push(c.buffer())}v.point=S;if(L)f.lineEnd()}function _(e,t){e=Math.max(-ar,Math.min(ar,e));t=Math.max(-ar,Math.min(ar,t));var n=E(e,t);if(p)d.push([e,t]);if(A){x=e,T=t,N=n;A=false;if(n){f.lineStart();f.point(e,t)}}else{if(n&&L)f.point(e,t);else{var r=[C,k],i=[e,t];if(a(r,i)){if(!L){f.lineStart();f.point(r[0],r[1])}f.point(i[0],i[1]);if(!n)f.lineEnd()}else{f.lineStart();f.point(e,t)}}}C=e,k=t,L=n}var l=f,c=er(),h,p,d;var v={point:S,lineStart:O,lineEnd:M,polygonStart:function(){f=c;h=[];p=[]},polygonEnd:function(){f=l;if((h=e.merge(h)).length){f.polygonStart();Qn(h,o,m,w,f);f.polygonEnd()}else if(g([t,n])){f.polygonStart(),f.lineStart();w(null,null,1,f);f.lineEnd(),f.polygonEnd()}h=p=d=null}};var x,T,N,C,k,L,A;return v}}function lr(e,t,n){if(Math.abs(t)0){if(r>n[1])return false;if(r>n[0])n[0]=r}else{if(r4*t&&v--){var w=o+h,E=u+p,S=a+d,x=Math.sqrt(w*w+E*E+S*S),T=Math.asin(S/=x),N=Math.abs(Math.abs(S)-1)t||Math.abs((g*A+y*O)/b-.5)>.3){i(n,r,s,o,u,a,k,L,N,w/=x,E/=x,S,v,m);m.point(k,L);i(k,L,N,w,E,S,f,l,c,h,p,d,v,m)}}}var t=.5,n=16;r.precision=function(e){if(!arguments.length)return Math.sqrt(t);n=(t=e*e)>0&&16;return r};return r}function pr(e){return dr(function(){return e})()}function dr(t){function w(e){e=i(e[0]*mt,e[1]*mt);return[e[0]*o+d,v-e[1]*o]}function E(e){e=i.invert((e[0]-d)/o,(v-e[1])/o);return e&&[e[0]*gt,e[1]*gt]}function S(){i=cr(r=gr(c,h,p),n);var e=n(f,l);d=u-e[0]*o;v=a+e[1]*o;return w}var n,r,i,s=hr(function(e,t){e=n(e,t);return[e[0]*o+d,v-e[1]*o]}),o=150,u=480,a=250,f=0,l=0,c=0,h=0,p=0,d,v,m=rr,g=Gt,y=null,b=null;w.stream=function(e){return vr(r,m(s(g(e))))};w.clipAngle=function(e){if(!arguments.length)return y;m=e==null?(y=e,rr):ur((y=+e)*mt);return w};w.clipExtent=function(e){if(!arguments.length)return b;b=e;g=e==null?Gt:fr(e[0][0],e[0][1],e[1][0],e[1][1]);return w};w.scale=function(e){if(!arguments.length)return o;o=+e;return S()};w.translate=function(e){if(!arguments.length)return[u,a];u=+e[0];a=+e[1];return S()};w.center=function(e){if(!arguments.length)return[f*gt,l*gt];f=e[0]%360*mt;l=e[1]%360*mt;return S()};w.rotate=function(e){if(!arguments.length)return[c*gt,h*gt,p*gt];c=e[0]%360*mt;h=e[1]%360*mt;p=e.length>2?e[2]%360*mt:0;return S()};e.rebind(w,s,"precision");return function(){n=t.apply(this,arguments);w.invert=n.invert&&E;return S()}}function vr(e,t){return{point:function(n,r){r=e(n*mt,r*mt),n=r[0];t.point(n>dt?n-2*dt:n<-dt?n+2*dt:n,r[1])},sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function mr(e,t){return[e,t]}function gr(e,t,n){return e?t||n?cr(br(e),wr(t,n)):br(e):t||n?wr(t,n):mr}function yr(e){return function(t,n){return t+=e,[t>dt?t-2*dt:t<-dt?t+2*dt:t,n]}}function br(e){var t=yr(e);t.invert=yr(-e);return t}function wr(e,t){function o(e,t){var o=Math.cos(t),u=Math.cos(e)*o,a=Math.sin(e)*o,f=Math.sin(t),l=f*n+u*r;return[Math.atan2(a*i-l*s,u*n-f*r),Math.asin(Math.max(-1,Math.min(1,l*i+a*s)))]}var n=Math.cos(e),r=Math.sin(e),i=Math.cos(t),s=Math.sin(t);o.invert=function(e,t){var o=Math.cos(t),u=Math.cos(e)*o,a=Math.sin(e)*o,f=Math.sin(t),l=f*i-a*s;return[Math.atan2(a*i+f*s,u*n+l*r),Math.asin(Math.max(-1,Math.min(1,l*n-u*r)))]};return o}function Er(e,t){var n=Math.cos(e),r=Math.sin(e);return function(i,s,o,u){if(i!=null){i=Sr(n,i);s=Sr(n,s);if(o>0?is)i+=o*2*dt}else{i=e+o*2*dt;s=e}var a;for(var f=o*t,l=i;o>0?l>s:l1){u=t[1];s=e[a];a++;r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1];for(var f=2;f9){s=n*3/Math.sqrt(s);o[u]=s*r;o[u+1]=s*i}}}u=-1;while(++u<=a){s=(e[Math.min(a,u+1)][0]-e[Math.max(0,u-1)][0])/(6*(1+o[u]*o[u]));t.push([s||0,o[u]*s||0])}return t}function Ai(e){return e.length<3?ai(e):e[0]+vi(e,Li(e))}function Oi(e,t,n,r){var i,s,o,u,a,f,l;i=r[e];s=i[0];o=i[1];i=r[t];u=i[0];a=i[1];i=r[n];f=i[0];l=i[1];return(l-o)*(u-s)-(a-o)*(f-s)>0}function Mi(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function _i(e,t,n,r){var i=e[0],s=n[0],o=t[0]-i,u=r[0]-s,a=e[1],f=n[1],l=t[1]-a,c=r[1]-f,h=(u*(a-f)-c*(i-s))/(c*o-u*l);return[i+h*o,a+h*l]}function Pi(e,t){var n={list:e.map(function(e,t){return{index:t,x:e[0],y:e[1]}}).sort(function(e,t){return e.yt.y?1:e.xt.x?1:0}),bottomSite:null};var r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,"l");r.rightEnd=r.createHalfEdge(null,"l");r.leftEnd.r=r.rightEnd;r.rightEnd.l=r.leftEnd;r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(e,t){return{edge:e,side:t,vertex:null,l:null,r:null}},insert:function(e,t){t.l=e;t.r=e.r;e.r.l=t;e.r=t},leftBound:function(e){var t=r.leftEnd;do{t=t.r}while(t!=r.rightEnd&&i.rightOf(t,e));t=t.l;return t},del:function(e){e.l.r=e.r;e.r.l=e.l;e.edge=null},right:function(e){return e.r},left:function(e){return e.l},leftRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[e.side]},rightRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[Di[e.side]]}};var i={bisect:function(e,t){var n={region:{l:e,r:t},ep:{l:null,r:null}};var r=t.x-e.x,i=t.y-e.y,s=r>0?r:-r,o=i>0?i:-i;n.c=e.x*r+e.y*i+(r*r+i*i)*.5;if(s>o){n.a=1;n.b=i/r;n.c/=r}else{n.b=1;n.a=r/i;n.c/=i}return n},intersect:function(e,t){var n=e.edge,r=t.edge;if(!n||!r||n.region.r==r.region.r){return null}var i=n.a*r.b-n.b*r.a;if(Math.abs(i)<1e-10){return null}var s=(n.c*r.b-r.c*n.b)/i,o=(r.c*n.a-n.c*r.a)/i,u=n.region.r,a=r.region.r,f,l;if(u.y=l.region.r.x;if(c&&f.side==="l"||!c&&f.side==="r"){return null}return{x:s,y:o}},rightOf:function(e,t){var n=e.edge,r=n.region.r,i=t.x>r.x;if(i&&e.side==="l"){return 1}if(!i&&e.side==="r"){return 0}if(n.a===1){var s=t.y-r.y,o=t.x-r.x,u=0,a=0;if(!i&&n.b<0||i&&n.b>=0){a=u=s>=n.b*o}else{a=t.x+t.y*n.b>n.c;if(n.b<0){a=!a}if(!a){u=1}}if(!u){var f=r.x-n.region.l.x;a=n.b*(o*o-s*s)h*h+p*p}return e.side==="l"?a:!a},endPoint:function(e,n,r){e.ep[n]=r;if(!e.ep[Di[n]])return;t(e)},distance:function(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}};var s={list:[],insert:function(e,t,n){e.vertex=t;e.ystar=t.y+n;for(var r=0,i=s.list,o=i.length;ru.ystar||e.ystar==u.ystar&&t.x>u.vertex.x){continue}else{break}}i.splice(r,0,e)},del:function(e){for(var t=0,n=s.list,r=n.length;td.y){v=p;p=d;d=v;b="r"}y=i.bisect(p,d);h=r.createHalfEdge(y,b);r.insert(l,h);i.endPoint(y,Di[b],g);m=i.intersect(l,h);if(m){s.del(l);s.insert(l,m,i.distance(m,p))}m=i.intersect(h,c);if(m){s.insert(h,m,i.distance(m,p))}}else{break}}for(a=r.right(r.leftEnd);a!=r.rightEnd;a=r.right(a)){t(a.edge)}}function Hi(e){return e.x}function Bi(e){return e.y}function ji(){return{leaf:true,nodes:[],point:null,x:null,y:null}}function Fi(e,t,n,r,i,s){if(!e(t,n,r,i,s)){var o=(n+i)*.5,u=(r+s)*.5,a=t.nodes;if(a[0])Fi(e,a[0],n,r,o,u);if(a[1])Fi(e,a[1],o,r,i,u);if(a[2])Fi(e,a[2],n,u,o,s);if(a[3])Fi(e,a[3],o,u,i,s)}}function Ii(t,n){t=e.rgb(t);n=e.rgb(n);var r=t.r,i=t.g,s=t.b,o=n.r-r,u=n.g-i,a=n.b-s;return function(e){return"#"+zt(Math.round(r+o*e))+zt(Math.round(i+u*e))+zt(Math.round(s+a*e))}}function qi(e){var t=[e.a,e.b],n=[e.c,e.d],r=Ui(t),i=Ri(t,n),s=Ui(zi(n,t,-i))||0;if(t[0]*n[1]180)c+=360;else if(c-l>180)l+=360;i.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:Xi(l,c)})}else if(c){r.push(r.pop()+"rotate("+c+")")}if(h!=p){i.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:Xi(h,p)})}else if(p){r.push(r.pop()+"skewX("+p+")")}if(d[0]!=v[0]||d[1]!=v[1]){s=r.push(r.pop()+"scale(",null,",",null,")");i.push({i:s-4,x:Xi(d[0],v[0])},{i:s-2,x:Xi(d[1],v[1])})}else if(v[0]!=1||v[1]!=1){r.push(r.pop()+"scale("+v+")")}s=i.length;return function(e){var t=-1,n;while(++t=0&&!(i=e.interpolators[r](t,n)));return i}function Gi(e){return e=="transform"?Vi:Qi}function Yi(e,t){var n=[],r=[],i=e.length,s=t.length,o=Math.min(e.length,t.length),u;for(u=0;u=1?1:e(t)}}function rs(e){return function(t){return 1-e(1-t)}}function is(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function ss(e){return e*e}function os(e){return e*e*e}function us(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function as(e){return function(t){return Math.pow(t,e)}}function fs(e){return 1-Math.cos(e*dt/2)}function ls(e){return Math.pow(2,10*(e-1))}function cs(e){return 1-Math.sqrt(1-e*e)}function hs(e,t){var n;if(arguments.length<2)t=.45;if(arguments.length)n=t/(2*dt)*Math.asin(1/e);else e=1,n=t/4;return function(r){return 1+e*Math.pow(2,10*-r)*Math.sin((r-n)*2*dt/t)}}function ps(e){if(!e)e=1.70158;return function(t){return t*t*((e+1)*t-e)}}function ds(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function vs(t,n){t=e.hcl(t);n=e.hcl(n);var r=t.h,i=t.c,s=t.l,o=n.h-r,u=n.c-i,a=n.l-s;if(o>180)o-=360;else if(o<-180)o+=360;return function(e){return kt(r+o*e,i+u*e,s+a*e)+""}}function ms(t,n){t=e.hsl(t);n=e.hsl(n);var r=t.h,i=t.s,s=t.l,o=n.h-r,u=n.s-i,a=n.l-s;if(o>180)o-=360;else if(o<-180)o+=360;return function(e){return pt(r+o*e,i+u*e,s+a*e)+""}}function gs(t,n){t=e.lab(t);n=e.lab(n);var r=t.l,i=t.a,s=t.b,o=n.l-r,u=n.a-i,a=n.b-s;return function(e){return Ht(r+o*e,i+u*e,s+a*e)+""}}function ys(e,t){t-=e;return function(n){return Math.round(e+t*n)}}function bs(e,t){t=t-(e=+e)?1/(t-e):0;return function(n){return(n-e)*t}}function ws(e,t){t=t-(e=+e)?1/(t-e):0;return function(n){return Math.max(0,Math.min(1,(n-e)*t))}}function Es(e){var t=e.source,n=e.target,r=xs(t,n),i=[t];while(t!==r){t=t.parent;i.push(t)}var s=i.length;while(n!==r){i.splice(s,0,n);n=n.parent}return i}function Ss(e){var t=[],n=e.parent;while(n!=null){t.push(e);e=n;n=n.parent}t.push(e);return t}function xs(e,t){if(e===t)return e;var n=Ss(e),r=Ss(t),i=n.pop(),s=r.pop(),o=null;while(i===s){o=i;i=n.pop();s=r.pop()}return o}function Ts(e){e.fixed|=2}function Ns(e){e.fixed&=~6}function Cs(e){e.fixed|=4;e.px=e.x,e.py=e.y}function ks(e){e.fixed&=~4}function Ls(e,t,n){var r=0,i=0;e.charge=0;if(!e.leaf){var s=e.nodes,o=s.length,u=-1,a;while(++ur){n=t;r=i}}return n}function Xs(e){return e.reduce(Vs,0)}function Vs(e,t){return e+t[1]}function $s(e,t){return Js(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function Js(e,t){var n=-1,r=+e[0],i=(e[1]-r)/t,s=[];while(++n<=t)s[n]=i*n+r;return s}function Ks(t){return[e.min(t),e.max(t)]}function Qs(e,t){return e.parent==t.parent?1:2}function Gs(e){var t=e.children;return t&&t.length?t[0]:e._tree.thread}function Ys(e){var t=e.children,n;return t&&(n=t.length)?t[n-1]:e._tree.thread}function Zs(e,t){var n=e.children;if(n&&(i=n.length)){var r,i,s=-1;while(++s0){e=r}}}return e}function eo(e,t){return e.x-t.x}function to(e,t){return t.x-e.x}function no(e,t){return e.depth-t.depth}function ro(e,t){function n(e,r){var i=e.children;if(i&&(a=i.length)){var s,o=null,u=-1,a;while(++u=0){s=r[i]._tree;s.prelim+=t;s.mod+=t;t+=s.shift+(n+=s.change)}}function so(e,t,n){e=e._tree;t=t._tree;var r=n/(t.number-e.number);e.change+=r;t.change-=r;t.shift+=n;t.prelim+=n;t.mod+=n}function oo(e,t,n){return e._tree.ancestor.parent==t.parent?e._tree.ancestor:n}function uo(e,t){return e.value-t.value}function ao(e,t){var n=e._pack_next;e._pack_next=t;t._pack_prev=e;t._pack_next=n;n._pack_prev=t}function fo(e,t){e._pack_next=t;t._pack_prev=e}function lo(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return i*i-n*n-r*r>.001}function co(e){function p(e){n=Math.min(e.x-e.r,n);r=Math.max(e.x+e.r,r);i=Math.min(e.y-e.r,i);s=Math.max(e.y+e.r,s)}if(!(t=e.children)||!(h=t.length))return;var t,n=Infinity,r=-Infinity,i=Infinity,s=-Infinity,o,u,a,f,l,c,h;t.forEach(ho);o=t[0];o.x=-o.r;o.y=0;p(o);if(h>1){u=t[1];u.x=u.r;u.y=0;p(u);if(h>2){a=t[2];mo(o,u,a);p(a);ao(o,a);o._pack_prev=a;ao(a,u);u=o._pack_next;for(f=3;f2?ko:No,a=r?ws:bs;i=o(e,t,a,n);s=o(t,e,a,Qi);return u}function u(e){return i(e)}var i,s;u.invert=function(e){return s(e)};u.domain=function(t){if(!arguments.length)return e;e=t.map(Number);return o()};u.range=function(e){if(!arguments.length)return t;t=e;return o()};u.rangeRound=function(e){return u.range(e).interpolate(ys)};u.clamp=function(e){if(!arguments.length)return r;r=e;return o()};u.interpolate=function(e){if(!arguments.length)return n;n=e;return o()};u.ticks=function(t){return _o(e,t)};u.tickFormat=function(t,n){return Do(e,t,n)};u.nice=function(){Co(e,Oo);return o()};u.copy=function(){return Lo(e,t,n,r)};return o()}function Ao(t,n){return e.rebind(t,n,"range","rangeRound","interpolate","clamp")}function Oo(e){e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1);return e&&{floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}}}function Mo(e,t){var n=xo(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),s=t/r*i;if(s<=.15)i*=10;else if(s<=.35)i*=5;else if(s<=.75)i*=2;n[0]=Math.ceil(n[0]/i)*i;n[1]=Math.floor(n[1]/i)*i+i*.5;n[2]=i;return n}function _o(t,n){return e.range.apply(e,Mo(t,n))}function Do(t,n,r){var i=-Math.floor(Math.log(Mo(t,n)[2])/Math.LN10+.01);return e.format(r?r.replace(dn,function(e,t,n,r,s,o,u,a,f,l){return[t,n,r,s,o,u,a,f||"."+(i-(l==="%")*2),l].join("")}):",."+i+"f")}function Po(e,t,n,r){function i(t){return e(n(t))}i.invert=function(t){return r(e.invert(t))};i.domain=function(t){if(!arguments.length)return e.domain().map(r);if(t[0]<0)n=Fo,r=Io;else n=Bo,r=jo;e.domain(t.map(n));return i};i.base=function(e){if(!arguments.length)return t;t=+e;return i};i.nice=function(){e.domain(Co(e.domain(),qo(t)));return i};i.ticks=function(){var i=xo(e.domain()),s=[];if(i.every(isFinite)){var o=Math.log(t),u=Math.floor(i[0]/o),a=Math.ceil(i[1]/o),f=r(i[0]),l=r(i[1]),c=t%1?2:t;if(n===Fo){s.push(-Math.pow(t,-u));for(;u++0;h--)s.push(-Math.pow(t,-u)*h)}else{for(;ul;a--){}s=s.slice(u,a)}return s};i.tickFormat=function(e,s){if(arguments.length<2)s=Ho;if(!arguments.length)return s;var o=Math.log(t),u=Math.max(.1,e/i.ticks().length),a=n===Fo?(f=-1e-12,Math.floor):(f=1e-12,Math.ceil),f;return function(e){return e/r(o*a(n(e)/o+f))<=u?s(e):""}};i.copy=function(){return Po(e.copy(),t,n,r)};return Ao(i,e)}function Bo(e){return Math.log(e<0?0:e)}function jo(e){return Math.exp(e)}function Fo(e){return-Math.log(e>0?0:-e)}function Io(e){return-Math.exp(-e)}function qo(e){e=Math.log(e);var t={floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}};return function(){return t}}function Ro(e,t){function i(t){return e(n(t))}var n=Uo(t),r=Uo(1/t);i.invert=function(t){return r(e.invert(t))};i.domain=function(t){if(!arguments.length)return e.domain().map(r);e.domain(t.map(n));return i};i.ticks=function(e){return _o(i.domain(),e)};i.tickFormat=function(e,t){return Do(i.domain(),e,t)};i.nice=function(){return i.domain(Co(i.domain(),Oo))};i.exponent=function(e){if(!arguments.length)return t;var s=i.domain();n=Uo(t=e);r=Uo(1/t);return i.domain(s)};i.copy=function(){return Ro(e.copy(),t)};return Ao(i,e)}function Uo(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function zo(t,n){function o(e){return i[((r.get(e)||r.set(e,t.push(e)))-1)%i.length]}function u(n,r){return e.range(t.length).map(function(e){return n+r*e})}var r,i,s;o.domain=function(e){if(!arguments.length)return t;t=[];r=new c;var i=-1,s=e.length,u;while(++ir)return m();s.active=r;l.start.call(t,a,n);o.tween.forEach(function(e,r){if(r=r.call(t,a,n)){p.push(r)}});if(!v(i))e.timer(v,0,u);return 1}function v(e){if(s.active!==r)return m();var i=(e-c)/h,o=f(i),u=p.length;while(u>0){p[--u].call(t,o)}if(i>=1){m();l.end.call(t,a,n);return 1}}function m(){if(--s.count)delete s[r];else delete t.__transition__;return 1}var a=t.__data__,f=o.ease,l=o.event,c=o.delay,h=o.duration,p=[];return c<=i?d(i):e.timer(d,c,u),1},0,u);return o}}function Cu(e,t){e.attr("transform",function(e){return"translate("+t(e)+",0)"})}function ku(e,t){e.attr("transform",function(e){return"translate(0,"+t(e)+")"})}function Lu(e,t,n){i=[];if(n&&t.length>1){var r=xo(e.domain()),i,s=-1,o=t.length,u=(t[1]-t[0])/++n,a,f;while(++s0;){if((f=+t[s]-a*u)>=r[0]){i.push(f)}}}for(--s,a=0;++a1?Date.UTC.apply(this,arguments):arguments[0])}function Uu(e,t,n){function r(t){var n=e(t),r=s(n,1);return t-n1){while(o=a)return-1;i=t.charCodeAt(o++);if(i===37){s=na[t.charAt(o++)];if(!s||(r=s(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++)){return-1}}return r}function Xu(t){return new RegExp("^(?:"+t.map(e.requote).join("|")+")","i")}function Vu(e){var t=new c,n=-1,r=e.length;while(++n68?1900:2e3)}function pa(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.m=r[0]-1,n+=r[0].length):-1}function da(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.d=+r[0],n+=r[0].length):-1}function va(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.H=+r[0],n+=r[0].length):-1}function ma(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.M=+r[0],n+=r[0].length):-1}function ga(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.S=+r[0],n+=r[0].length):-1}function ya(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+3));return r?(e.L=+r[0],n+=r[0].length):-1}function wa(e,t,n){var r=Ea.get(t.substring(n,n+=2).toLowerCase());return r==null?-1:(e.p=r,n)}function Sa(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=~~(Math.abs(t)/60),i=Math.abs(t)%60;return n+$u(r,"0",2)+$u(i,"0",2)}function Ta(e){return e.toISOString()}function Na(t,n,r){function i(e){return t(e)}i.invert=function(e){return ka(t.invert(e))};i.domain=function(e){if(!arguments.length)return t.domain().map(ka);t.domain(e);return i};i.nice=function(e){return i.domain(Co(i.domain(),function(){return e}))};i.ticks=function(r,s){var o=Ca(i.domain());if(typeof r!=="function"){var u=o[1]-o[0],a=u/r,f=e.bisect(Ma,a);if(f==Ma.length)return n.year(o,r);if(!f)return t.ticks(r).map(ka);if(Math.log(a/Ma[f-1])t?1:e>=t?0:NaN};e.descending=function(e,t){return te?1:t>=e?0:NaN};e.min=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++ns)i=s}else{while(++ns)i=s}return i};e.max=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++ni)i=s}else{while(++ni)i=s}return i};e.extent=function(e,t){var n=-1,r=e.length,i,s,o;if(arguments.length===1){while(++ns)i=s;if(os)i=s;if(o1)t=t.map(n);t=t.filter(o);return t.length?e.quantile(t.sort(e.ascending),.5):undefined};e.bisector=function(e){return{left:function(t,n,r,i){if(arguments.length<3)r=0;if(arguments.length<4)i=t.length;while(r>>1;if(e.call(t,t[s],s)>>1;if(nt)r.push(o/i);else while((o=e+n*++s)=n.length)return s?s.call(t,r):i?r.sort(i):r;var a=-1,f=r.length,l=n[u++],h,p,d,v=new c,m;while(++a=n.length)return e;var i=[],s=r[t++];e.forEach(function(e,n){i.push({key:e,values:u(n,t)})});return s?i.sort(function(e,t){return s(e.key,t.key)}):i}var t={},n=[],r=[],i,s;t.map=function(e,t){return o(t,e,0)};t.entries=function(t){return u(o(e.map,t,0),0)};t.key=function(e){n.push(e);return t};t.sortKeys=function(e){r[n.length-1]=e;return t};t.sortValues=function(e){i=e;return t};t.rollup=function(e){s=e;return t};return t};e.set=function(e){var t=new d;if(e)for(var n=0;n=0){r=e.substring(n+1);e=e.substring(0,n)}if(e)return arguments.length<2?this[e].on(r):this[e].on(r,t);if(arguments.length===2){if(t==null)for(e in this){if(this.hasOwnProperty(e))this[e].on(r,null)}return this}};e.event=null;e.mouse=function(e){return T(e,w())};var x=/WebKit/.test(n.navigator.userAgent)?-1:0;var N=k;try{N(t.documentElement.childNodes)[0].nodeType}catch(L){N=C}var A=[].__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]};e.touches=function(e,t){if(arguments.length<2)t=w().touches;return t?N(t).map(function(t){var n=T(e,t);n.identifier=t.identifier;return n}):[]};e.behavior.drag=function(){function i(){this.on("mousedown.drag",s).on("touchstart.drag",s)}function s(){function h(){var t=i.parentNode;return u!=null?e.touches(t).filter(function(e){return e.identifier===u})[0]:e.mouse(t)}function p(){if(!i.parentNode)return d();var e=h(),t=e[0]-f[0],n=e[1]-f[1];l|=t|n;f=e;y();s({type:"drag",x:e[0]+a[0],y:e[1]+a[1],dx:t,dy:n})}function d(){s({type:"dragend"});if(l){y();if(e.event.target===o)E(c,"click")}c.on(u!=null?"touchmove.drag-"+u:"mousemove.drag",null).on(u!=null?"touchend.drag-"+u:"mouseup.drag",null)}var i=this,s=t.of(i,arguments),o=e.event.target,u=e.event.touches?e.event.changedTouches[0].identifier:null,a,f=h(),l=0;var c=e.select(n).on(u!=null?"touchmove.drag-"+u:"mousemove.drag",p).on(u!=null?"touchend.drag-"+u:"mouseup.drag",d,true);if(r){a=r.apply(i,arguments);a=[a.x-f[0],a.y-f[1]]}else{a=[0,0]}if(u==null)y();s({type:"dragstart"})}var t=S(i,"drag","dragstart","dragend"),r=null;i.origin=function(e){if(!arguments.length)return r;r=e;return i};return e.rebind(i,t,"on")};var M=function(e,t){return t.querySelector(e)},_=function(e,t){return t.querySelectorAll(e)},D=t.documentElement,P=D.matchesSelector||D.webkitMatchesSelector||D.mozMatchesSelector||D.msMatchesSelector||D.oMatchesSelector,H=function(e,t){return P.call(e,t)};if(typeof Sizzle==="function"){M=function(e,t){return Sizzle(e,t)[0]||null};_=function(e,t){return Sizzle.uniqueSort(Sizzle(e,t))};H=Sizzle.matchesSelector}var B=[];e.selection=function(){return st};e.selection.prototype=B;B.select=function(e){var t=[],n,r,i,s;if(typeof e!=="function")e=j(e);for(var o=-1,u=this.length;++o=0){n=e.substring(0,t);e=e.substring(t+1)}return I.hasOwnProperty(n)?{space:I[n],local:e}:e}};B.attr=function(t,n){if(arguments.length<2){if(typeof t==="string"){var r=this.node();t=e.ns.qualify(t);return t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(n in t)this.each(q(n,t[n]));return this}return this.each(q(t,n))};e.requote=function(e){return e.replace(U,"\\$&")};var U=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;B.classed=function(e,t){if(arguments.length<2){if(typeof e==="string"){var n=this.node(),r=(e=e.trim().split(/^|\s+/g)).length,i=-1;if(t=n.classList){while(++i=0;){if(s=n[r]){if(i&&i!==s.nextSibling)i.parentNode.insertBefore(s,i);i=s}}}return this};B.sort=function(e){e=Q.apply(this,arguments);for(var t=-1,n=this.length;++t=200&&e<300||e===304?o.load.call(s,a.call(s,f)):o.error.call(s,f)}var s={},o=e.dispatch("progress","load","error"),u={},a=Gt,f=new(n.XDomainRequest&&/^(http(s)?:)?\/\//.test(t)?XDomainRequest:XMLHttpRequest);"onload"in f?f.onload=f.onerror=l:f.onreadystatechange=function(){f.readyState>3&&l()};f.onprogress=function(t){var n=e.event;e.event=t;try{o.progress.call(s,f)}finally{e.event=n}};s.header=function(e,t){e=(e+"").toLowerCase();if(arguments.length<2)return u[e];if(t==null)delete u[e];else u[e]=t+"";return s};s.mimeType=function(e){if(!arguments.length)return r;r=e==null?null:e+"";return s};s.response=function(e){a=e;return s};["get","post"].forEach(function(e){s[e]=function(){return s.send.apply(s,[e].concat(N(arguments)))}});s.send=function(e,n,i){if(arguments.length===2&&typeof n==="function")i=n,n=null;f.open(e,t,true);if(r!=null&&!("accept"in u))u["accept"]=r+",*/*";if(f.setRequestHeader)for(var o in u)f.setRequestHeader(o,u[o]);if(r!=null&&f.overrideMimeType)f.overrideMimeType(r);if(i!=null)s.on("error",i).on("load",function(e){i(null,e)});f.send(n==null?null:n);return s};s.abort=function(){f.abort();return s};e.rebind(s,o,"on");if(arguments.length===2&&typeof r==="function")i=r,r=null;return i==null?s:s.get(Yt(i))};e.csv=Zt(",","text/csv");e.tsv=Zt(" ","text/tab-separated-values");var en=0,tn={},nn=null,rn,sn;e.timer=function(e,t,n){if(arguments.length<3){if(arguments.length<2)t=0;else if(!isFinite(t))return;n=Date.now()}var r=tn[e.id];if(r&&r.callback===e){r.then=n;r.delay=t}else tn[e.id=++en]=nn={callback:e,then:n,delay:t,next:nn};if(!rn){sn=clearTimeout(sn);rn=1;an(on)}};e.timer.flush=function(){var e,t=Date.now(),n=nn;while(n){e=t-n.then;if(!n.delay)n.flush=n.callback(e);n=n.next}un()};var an=n.requestAnimationFrame||n.webkitRequestAnimationFrame||n.mozRequestAnimationFrame||n.oRequestAnimationFrame||n.msRequestAnimationFrame||function(e){setTimeout(e,17)};var fn=".",ln=",",cn=[3,3];var hn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(pn);e.formatPrefix=function(t,n){var r=0;if(t){if(t<0)t*=-1;if(n)t=e.round(t,mn(t,n));r=1+Math.floor(1e-12+Math.log(t)/Math.LN10);r=Math.max(-24,Math.min(24,Math.floor((r<=0?r+1:r-1)/3)*3))}return hn[8+r/3]};e.round=function(e,t){return t?Math.round(e*(t=Math.pow(10,t)))/t:Math.round(e)};e.format=function(t){var n=dn.exec(t),r=n[1]||" ",i=n[2]||">",s=n[3]||"",o=n[4]||"",u=n[5],a=+n[6],f=n[7],l=n[8],c=n[9],h=1,p="",d=false;if(l)l=+l.substring(1);if(u||r==="0"&&i==="="){u=r="0";i="=";if(f)a-=Math.floor((a-1)/4)}switch(c){case"n":f=true;c="g";break;case"%":h=100;p="%";c="f";break;case"p":h=100;p="%";c="r";break;case"b":case"o":case"x":case"X":if(o)o="0"+c.toLowerCase();case"c":case"d":d=true;l=0;break;case"s":h=-1;c="r";break}if(o==="#")o="";if(c=="r"&&!l)c="g";if(l!=null){if(c=="g")l=Math.max(1,Math.min(21,l));else if(c=="e"||c=="f")l=Math.max(0,Math.min(20,l))}c=vn.get(c)||gn;var v=u&&f;return function(t){if(d&&t%1)return"";var n=t<0||t===0&&1/t<0?(t=-t,"-"):s;if(h<0){var m=e.formatPrefix(t,l);t=m.scale(t);p=m.symbol}else{t*=h}t=c(t,l);if(!u&&f)t=yn(t);var g=o.length+t.length+(v?0:n.length),y=g"?y+n+t:i==="^"?y.substring(0,g>>=1)+n+t+y.substring(g):n+(v?t:y+t))+p}};var dn=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i;var vn=e.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(t,n){return(t=e.round(t,mn(t,n))).toFixed(Math.max(0,Math.min(20,mn(t*(1+1e-15),n))))}});var yn=Gt;if(cn){var bn=cn.length;yn=function(e){var t=e.lastIndexOf("."),n=t>=0?"."+e.substring(t+1):(t=e.length,""),r=[],i=0,s=cn[0];while(t>0&&s>0){r.push(e.substring(t-=s,t+s));s=cn[i=(i+1)%bn]}return r.reverse().join(ln||"")+n}}e.geo={};e.geo.stream=function(e,t){if(e&&En.hasOwnProperty(e.type)){En[e.type](e,t)}else{wn(e,t)}};var En={Feature:function(e,t){wn(e.geometry,t)},FeatureCollection:function(e,t){var n=e.features,r=-1,i=n.length;while(++rvt){return[Math.atan2(Pn,Dn)*gt,Math.asin(Math.max(-1,Math.min(1,Hn/n)))*gt]}};var Mn,_n,Dn,Pn,Hn;var Bn={sphere:function(){if(Mn<2){Mn=2;_n=Dn=Pn=Hn=0}},point:jn,lineStart:In,lineEnd:qn,polygonStart:function(){if(Mn<2){Mn=2;_n=Dn=Pn=Hn=0}Bn.lineStart=Fn},polygonEnd:function(){Bn.lineStart=In}};var rr=Yn($n,ir,or);var ar=1e9;e.geo.projection=pr;e.geo.projectionMutator=dr;(e.geo.equirectangular=function(){return pr(mr)}).raw=mr.invert=mr;e.geo.rotation=function(e){function t(t){t=e(t[0]*mt,t[1]*mt);return t[0]*=gt,t[1]*=gt,t}e=gr(e[0]%360*mt,e[1]*mt,e.length>2?e[2]*mt:0);t.invert=function(t){t=e.invert(t[0]*mt,t[1]*mt);return t[0]*=gt,t[1]*=gt,t};return t};e.geo.circle=function(){function i(){var t=typeof e==="function"?e.apply(this,arguments):e,n=gr(-t[0]*mt,-t[1]*mt,0).invert,i=[];r(null,null,1,{point:function(e,t){i.push(e=n(e,t));e[0]*=gt,e[1]*=gt}});return{type:"Polygon",coordinates:[i]}}var e=[0,0],t,n=6,r;i.origin=function(t){if(!arguments.length)return e;e=t;return i};i.angle=function(e){if(!arguments.length)return t;r=Er((t=+e)*mt,n*mt);return i};i.precision=function(e){if(!arguments.length)return n;r=Er(t*mt,(n=+e)*mt);return i};return i.angle(90)};e.geo.distance=function(e,t){var n=(t[0]-e[0])*mt,r=e[1]*mt,i=t[1]*mt,s=Math.sin(n),o=Math.cos(n),u=Math.sin(r),a=Math.cos(r),f=Math.sin(i),l=Math.cos(i),c;return Math.atan2(Math.sqrt((c=l*s)*c+(c=a*f-u*l*o)*c),u*f+a*l*o)};e.geo.graticule=function(){function y(){return{type:"MultiLineString",coordinates:b()}}function b(){return e.range(Math.ceil(i/c)*c,r,c).map(v).concat(e.range(Math.ceil(a/h)*h,u,h).map(m)).concat(e.range(Math.ceil(n/f)*f,t,f).filter(function(e){return Math.abs(e%c)>vt}).map(p)).concat(e.range(Math.ceil(o/l)*l,s,l).filter(function(e){return Math.abs(e%h)>vt}).map(d))}var t,n,r,i,s,o,u,a,f=10,l=f,c=90,h=360,p,d,v,m,g=2.5;y.lines=function(){return b().map(function(e){return{type:"LineString",coordinates:e}})};y.outline=function(){return{type:"Polygon",coordinates:[v(i).concat(m(u).slice(1),v(r).reverse().slice(1),m(a).reverse().slice(1))]}};y.extent=function(e){if(!arguments.length)return y.minorExtent();return y.majorExtent(e).minorExtent(e)};y.majorExtent=function(e){if(!arguments.length)return[[i,a],[r,u]];i=+e[0][0],r=+e[1][0];a=+e[0][1],u=+e[1][1];if(i>r)e=i,i=r,r=e;if(a>u)e=a,a=u,u=e;return y.precision(g)};y.minorExtent=function(e){if(!arguments.length)return[[n,o],[t,s]];n=+e[0][0],t=+e[1][0];o=+e[0][1],s=+e[1][1];if(n>t)e=n,n=t,t=e;if(o>s)e=o,o=s,s=e;return y.precision(g)};y.step=function(e){if(!arguments.length)return y.minorStep();return y.majorStep(e).minorStep(e)};y.majorStep=function(e){if(!arguments.length)return[c,h];c=+e[0],h=+e[1];return y};y.minorStep=function(e){if(!arguments.length)return[f,l];f=+e[0],l=+e[1];return y};y.precision=function(e){if(!arguments.length)return g;g=+e;p=xr(o,s,90);d=Tr(n,t,g);v=xr(a,u,90);m=Tr(i,r,g);return y};return y.majorExtent([[-180,-90+vt],[180,90-vt]]).minorExtent([[-180,-80-vt],[180,80+vt]])};e.geo.greatArc=function(){function s(){return{type:"LineString",coordinates:[n||t.apply(this,arguments),i||r.apply(this,arguments)]}}var t=Nr,n,r=Cr,i;s.distance=function(){return e.geo.distance(n||t.apply(this,arguments),i||r.apply(this,arguments))};s.source=function(e){if(!arguments.length)return t;t=e,n=typeof e==="function"?null:e;return s};s.target=function(e){if(!arguments.length)return r;r=e,i=typeof e==="function"?null:e;return s};s.precision=function(){return arguments.length?s:0};return s};e.geo.interpolate=function(e,t){return kr(e[0]*mt,e[1]*mt,t[0]*mt,t[1]*mt)};e.geo.length=function(t){Lr=0;e.geo.stream(t,Ar);return Lr};var Lr;var Ar={sphere:G,point:G,lineStart:Or,lineEnd:G,polygonStart:G,polygonEnd:G};(e.geo.conicEqualArea=function(){return Mr(_r)}).raw=_r;e.geo.albersUsa=function(){function a(e){return f(e)(e)}function f(e){var s=e[0],o=e[1];return o>50?n:s<-140?r:o<21?i:t}var t=e.geo.conicEqualArea().rotate([98,0]).center([0,38]).parallels([29.5,45.5]);var n=e.geo.conicEqualArea().rotate([160,0]).center([0,60]).parallels([55,65]);var r=e.geo.conicEqualArea().rotate([160,0]).center([0,20]).parallels([8,18]);var i=e.geo.conicEqualArea().rotate([60,0]).center([0,10]).parallels([8,18]);var s,o,u;a.invert=function(e){return s(e)||o(e)||u(e)||t.invert(e)};a.scale=function(e){if(!arguments.length)return t.scale();t.scale(e);n.scale(e*.6);r.scale(e);i.scale(e*1.5);return a.translate(t.translate())};a.translate=function(e){if(!arguments.length)return t.translate();var f=t.scale(),l=e[0],c=e[1];t.translate(e);n.translate([l-.4*f,c+.17*f]);r.translate([l-.19*f,c+.2*f]);i.translate([l+.58*f,c+.43*f]);s=Dr(n,[[-180,50],[-130,72]]);o=Dr(r,[[-164,18],[-154,24]]);u=Dr(i,[[-67.5,17.5],[-65,19]]);return a};return a.scale(1e3)};var Pr,Hr,Br={point:G,lineStart:G,lineEnd:G,polygonStart:function(){Hr=0;Br.lineStart=jr},polygonEnd:function(){Br.lineStart=Br.lineEnd=Br.point=G;Pr+=Math.abs(Hr/2)}};var Ir={point:qr,lineStart:Rr,lineEnd:Ur,polygonStart:function(){Ir.lineStart=zr},polygonEnd:function(){Ir.point=qr;Ir.lineStart=Rr;Ir.lineEnd=Ur}};e.geo.path=function(){function o(n){if(n)e.geo.stream(n,i(s.pointRadius(typeof t==="function"?+t.apply(this,arguments):t)));return s.result()}var t=4.5,n,r,i,s;o.area=function(t){Pr=0;e.geo.stream(t,i(Br));return Pr};o.centroid=function(t){Mn=Dn=Pn=Hn=0;e.geo.stream(t,i(Ir));return Hn?[Dn/Hn,Pn/Hn]:undefined};o.bounds=function(e){return On(i)(e)};o.projection=function(e){if(!arguments.length)return n;i=(n=e)?e.stream||Vr(e):Gt;return o};o.context=function(e){if(!arguments.length)return r;s=(r=e)==null?new Fr:new Wr(e);return o};o.pointRadius=function(e){if(!arguments.length)return t;t=typeof e==="function"?e:+e;return o};return o.projection(e.geo.albersUsa()).context(null)};e.geo.albers=function(){return e.geo.conicEqualArea().parallels([29.5,45.5]).rotate([98,0]).center([0,38]).scale(1e3)};var Jr=$r(function(e){return Math.sqrt(2/(1+e))},function(e){return 2*Math.asin(e/2)});(e.geo.azimuthalEqualArea=function(){return pr(Jr)}).raw=Jr;var Kr=$r(function(e){var t=Math.acos(e);return t&&t/Math.sin(t)},Gt);(e.geo.azimuthalEquidistant=function(){return pr(Kr)}).raw=Kr;(e.geo.conicConformal=function(){return Mr(Qr)}).raw=Qr;(e.geo.conicEquidistant=function(){return Mr(Gr)}).raw=Gr;var Yr=$r(function(e){return 1/e},Math.atan);(e.geo.gnomonic=function(){return pr(Yr)}).raw=Yr;Zr.invert=function(e,t){return[e,2*Math.atan(Math.exp(t))-dt/2]};(e.geo.mercator=function(){return ei(Zr)}).raw=Zr;var ti=$r(function(){return 1},Math.asin);(e.geo.orthographic=function(){return pr(ti)}).raw=ti;var ni=$r(function(e){return 1/(1+e)},function(e){return 2*Math.atan(e)});(e.geo.stereographic=function(){return pr(ni)}).raw=ni;ri.invert=function(e,t){return[Math.atan2(Et(e),Math.cos(t)),wt(Math.sin(t)/St(e))]};(e.geo.transverseMercator=function(){return ei(ri)}).raw=ri;e.geom={};e.svg={};e.svg.line=function(){return ii(Gt)};var ui=e.map({linear:ai,"linear-closed":fi,"step-before":li,"step-after":ci,basis:gi,"basis-open":yi,"basis-closed":bi,bundle:wi,cardinal:di,"cardinal-open":hi,"cardinal-closed":pi,monotone:Ai});ui.forEach(function(e,t){t.key=e;t.closed=/-closed$/.test(e)});var Si=[0,2/3,1/3,0],xi=[0,1/3,2/3,0],Ti=[0,1/6,2/3,1/6];e.geom.hull=function(e){function r(e){if(e.length<3)return[];var r=Qt(t),i=Qt(n),s=e.length,o,u=s-1,a=[],f=[],l,c,h,p=0,d,v,m,g,y,b,w,E;if(r===si&&n===oi)o=e;else for(c=0,o=[];c=m*m+g*g){a[c].index=-1}else{a[y].index=-1;w=a[c].angle;y=c;b=h}}else{w=a[c].angle;y=c;b=h}}f.push(p);for(c=0,h=0;c<2;++h){if(a[h].index!==-1){f.push(a[h].index);c++}}E=f.length;for(;h=0){t=e.ep.r;n=e.ep.l}else{t=e.ep.l;n=e.ep.r}if(e.a===1){s=t?t.y:-h;r=e.c-e.b*s;u=n?n.y:h;i=e.c-e.b*u}else{r=t?t.x:-h;s=e.c-e.a*r;i=n?n.x:h;u=e.c-e.a*i}var a=[r,s],f=[i,u];o[e.region.l.index].push(a,f);o[e.region.r.index].push(a,f)});o=o.map(function(t,r){var i=n[r][0],s=n[r][1],o=t.map(function(e){return Math.atan2(e[0]-i,e[1]-s)}),u=e.range(t.length).sort(function(e,t){return o[e]-o[t]});return u.filter(function(e,t){return!t||o[e]-o[u[t-1]]>vt}).map(function(e){return t[e]})});o.forEach(function(e,t){var r=e.length;if(!r)return e.push([-h,-h],[-h,h],[h,h],[h,-h]);if(r>2)return;var i=n[t],s=e[0],o=e[1],u=i[0],a=i[1],f=s[0],l=s[1],c=o[0],p=o[1],d=Math.abs(c-f),v=p-l;if(Math.abs(v)0)m*=-1;e.push([-h,m],[h,m])}}});if(s)for(l=0;l=a,c=r>=f,h=(c<<1)+l;e.leaf=false;e=e.nodes[h]||(e.nodes[h]=ji());if(l)i=a;else o=a;if(c)s=f;else u=f;x(e,t,n,r,i,s,o,u)}var a,f=Qt(s),l=Qt(o),c,h,p,d,v,m,g,y;if(t!=null){v=t,m=n,g=r,y=i}else{g=y=-(v=m=Infinity);c=[],h=[];d=e.length;if(u)for(p=0;pg)g=a.x;if(a.y>y)y=a.y;c.push(a.x);h.push(a.y)}else for(p=0;pg)g=b;if(w>y)y=w;c.push(b);h.push(w)}}var E=g-v,S=y-m;if(E>S)y=m+E;else g=v+S;var N=ji();N.add=function(e){x(N,e,+f(e,++p),+l(e,p),v,m,g,y)};N.visit=function(e){Fi(e,N,v,m,g,y)};p=-1;if(t==null){while(++p=0?e.substring(0,t):e,r=t>=0?e.substring(t+1):"in";n=es.get(n)||Zi;r=ts.get(r)||Gt;return ns(r(n.apply(null,Array.prototype.slice.call(arguments,1))))};e.interpolateHcl=vs;e.interpolateHsl=ms;e.interpolateLab=gs;e.interpolateRound=ys;e.layout={};e.layout.bundle=function(){return function(e){var t=[],n=-1,r=e.length;while(++n0)s=r;else s=0}else if(r>0){n.start({type:"start",alpha:s=r});e.timer(t.tick)}return t};t.start=function(){function y(t,n){var r=b(e),i=-1,s=r.length,o;while(++ii)i=u;r.push(u)}for(o=0;o0){o=-1;while(++o=f[0]&&v<=f[1]){c=u[e.bisect(l,v,1,p)-1];c.y+=d;c.push(s[o])}}}return u}var t=true,n=Number,r=Ks,i=$s;s.value=function(e){if(!arguments.length)return n;n=e;return s};s.range=function(e){if(!arguments.length)return r;r=Qt(e);return s};s.bins=function(e){if(!arguments.length)return i;i=typeof e==="number"?function(t){return Js(t,e)}:Qt(e);return s};s.frequency=function(e){if(!arguments.length)return t;t=!!e;return s};return s};e.layout.tree=function(){function i(e,i){function u(e,t){var r=e.children,i=e._tree;if(r&&(s=r.length)){var s,o=r[0],a,l=o,c,h=-1;while(++h0){so(oo(o,e,r),e,h);a+=h;f+=h}l+=o._tree.mod;a+=i._tree.mod;c+=u._tree.mod;f+=s._tree.mod}if(o&&!Ys(s)){s._tree.thread=o;s._tree.mod+=l-f}if(i&&!Gs(u)){u._tree.thread=i;u._tree.mod+=a-c;r=e}}return r}var s=t.call(this,e,i),o=s[0];ro(o,function(e,t){e._tree={ancestor:e,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}});u(o);a(o,-o._tree.prelim);var l=Zs(o,to),c=Zs(o,eo),h=Zs(o,no),p=l.x-n(l,c)/2,d=c.x+n(c,l)/2,v=h.depth||1;ro(o,function(e){e.x=(e.x-p)/(d-p)*r[0];e.y=e.depth/v*r[1];delete e._tree});return s}var t=e.layout.hierarchy().sort(null).value(null),n=Qs,r=[1,1];i.separation=function(e){if(!arguments.length)return n;n=e;return i};i.size=function(e){if(!arguments.length)return r;r=e;return i};return Ms(i,t)};e.layout.pack=function(){function i(e,i){var s=t.call(this,e,i),o=s[0];o.x=0;o.y=0;ro(o,function(e){e.r=Math.sqrt(e.value)});ro(o,co);var u=r[0],a=r[1],f=Math.max(2*o.r/u,2*o.r/a);if(n>0){var l=n*f/2;ro(o,function(e){e.r+=l});ro(o,co);ro(o,function(e){e.r-=l});f=Math.max(2*o.r/u,2*o.r/a)}vo(o,u/2,a/2,1/f);return s}var t=e.layout.hierarchy().sort(uo),n=0,r=[1,1];i.size=function(e){if(!arguments.length)return r;r=e;return i};i.padding=function(e){if(!arguments.length)return n;n=+e;return i};return Ms(i,t)};e.layout.cluster=function(){function i(e,i){var s=t.call(this,e,i),o=s[0],u,a=0;ro(o,function(e){var t=e.children;if(t&&t.length){e.x=yo(t);e.y=go(t)}else{e.x=u?a+=n(e,u):0;e.y=0;u=e}});var f=bo(o),l=wo(o),c=f.x-n(f,l)/2,h=l.x+n(l,f)/2;ro(o,function(e){e.x=(e.x-c)/(h-c)*r[0];e.y=(1-(o.y?e.y/o.y:1))*r[1]});return s}var t=e.layout.hierarchy().sort(null).value(null),n=Qs,r=[1,1];i.separation=function(e){if(!arguments.length)return n;n=e;return i};i.size=function(e){if(!arguments.length)return r;r=e;return i};return Ms(i,t)};e.layout.treemap=function(){function l(e,t){var n=-1,r=e.length,i,s;while(++n0){r.push(o=i[v-1]);r.area+=o.area;if(a!=="squarify"||(f=p(r,h))<=u){i.pop();u=f}else{r.area-=r.pop().area;d(r,h,n,false);h=Math.min(n.dx,n.dy);r.length=r.area=0;u=Infinity}}if(r.length){d(r,h,n,true);r.length=r.area=0}t.forEach(c)}}function h(e){var t=e.children;if(t&&t.length){var n=s(e),r=t.slice(),i,o=[];l(r,n.dx*n.dy/e.value);o.area=0;while(i=r.pop()){o.push(i);o.area+=i.area;if(i.z!=null){d(o,i.z?n.dx:n.dy,n,!r.length);o.length=o.area=0}}t.forEach(h)}}function p(e,t){var n=e.area,r,i=0,s=Infinity,o=-1,u=e.length;while(++oi)i=r}n*=n;t*=t;return n?Math.max(t*i*f/n,n/(t*s*f)):Infinity}function d(e,t,r,i){var s=-1,o=e.length,u=r.x,a=r.y,f=t?n(e.area/t):0,l;if(t==r.dx){if(i||f>r.dy)f=r.dy;while(++sr.dx)f=r.dx;while(++s1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=e.random.normal.apply(e,arguments);return function(){return Math.exp(t())}},irwinHall:function(e){return function(){for(var t=0,n=0;n=eu?i?"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"M0,"+i+"A"+i+","+i+" 0 1,0 0,"+ -i+"A"+i+","+i+" 0 1,0 0,"+i+"Z":"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"Z":i?"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L"+i*h+","+i*p+"A"+i+","+i+" 0 "+f+",0 "+i*l+","+i*c+"Z":"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L0,0"+"Z"}var e=tu,t=nu,n=ru,r=iu;i.innerRadius=function(t){if(!arguments.length)return e;e=Qt(t);return i};i.outerRadius=function(e){if(!arguments.length)return t;t=Qt(e);return i};i.startAngle=function(e){if(!arguments.length)return n;n=Qt(e);return i};i.endAngle=function(e){if(!arguments.length)return r;r=Qt(e);return i};i.centroid=function(){var i=(e.apply(this,arguments)+t.apply(this,arguments))/2,s=(n.apply(this,arguments)+r.apply(this,arguments))/2+Zo;return[Math.cos(s)*i,Math.sin(s)*i]};return i};var Zo=-dt/2,eu=2*dt-1e-6;e.svg.line.radial=function(){var e=ii(su);e.radius=e.x,delete e.x;e.angle=e.y,delete e.y;return e};li.reverse=ci;ci.reverse=li;e.svg.area=function(){return ou(Gt)};e.svg.area.radial=function(){var e=ou(su);e.radius=e.x,delete e.x;e.innerRadius=e.x0,delete e.x0;e.outerRadius=e.x1,delete e.x1;e.angle=e.y,delete e.y;e.startAngle=e.y0,delete e.y0;e.endAngle=e.y1,delete e.y1;return e};e.svg.chord=function(){function s(n,r){var i=o(this,e,n,r),s=o(this,t,n,r);return"M"+i.p0+a(i.r,i.p1,i.a1-i.a0)+(u(i,s)?f(i.r,i.p1,i.r,i.p0):f(i.r,i.p1,s.r,s.p0)+a(s.r,s.p1,s.a1-s.a0)+f(s.r,s.p1,i.r,i.p0))+"Z"}function o(e,t,s,o){var u=t.call(e,s,o),a=n.call(e,u,o),f=r.call(e,u,o)+Zo,l=i.call(e,u,o)+Zo;return{r:a,a0:f,a1:l,p0:[a*Math.cos(f),a*Math.sin(f)],p1:[a*Math.cos(l),a*Math.sin(l)]}}function u(e,t){return e.a0==t.a0&&e.a1==t.a1}function a(e,t,n){return"A"+e+","+e+" 0 "+ +(n>dt)+",1 "+t}function f(e,t,n,r){return"Q 0,0 "+r}var e=Nr,t=Cr,n=uu,r=ru,i=iu;s.radius=function(e){if(!arguments.length)return n;n=Qt(e);return s};s.source=function(t){if(!arguments.length)return e;e=Qt(t);return s};s.target=function(e){if(!arguments.length)return t;t=Qt(e);return s};s.startAngle=function(e){if(!arguments.length)return r;r=Qt(e);return s};s.endAngle=function(e){if(!arguments.length)return i;i=Qt(e);return s};return s};e.svg.diagonal=function(){function r(r,i){var s=e.call(this,r,i),o=t.call(this,r,i),u=(s.y+o.y)/2,a=[s,{x:s.x,y:u},{x:o.x,y:u},o];a=a.map(n);return"M"+a[0]+"C"+a[1]+" "+a[2]+" "+a[3]}var e=Nr,t=Cr,n=au;r.source=function(t){if(!arguments.length)return e;e=Qt(t);return r};r.target=function(e){if(!arguments.length)return t;t=Qt(e);return r};r.projection=function(e){if(!arguments.length)return n;n=e;return r};return r};e.svg.diagonal.radial=function(){var t=e.svg.diagonal(),n=au,r=t.projection;t.projection=function(e){return arguments.length?r(fu(n=e)):n};return t};e.svg.symbol=function(){function n(n,r){return(pu.get(e.call(this,n,r))||hu)(t.call(this,n,r))}var e=cu,t=lu;n.type=function(t){if(!arguments.length)return e;e=Qt(t);return n};n.size=function(e){if(!arguments.length)return t;t=Qt(e);return n};return n};var pu=e.map({circle:hu,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+ -3*t+","+ -t+"H"+ -t+"V"+ -3*t+"H"+t+"V"+ -t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+ -t+"V"+t+"H"+ -3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*vu)),n=t*vu;return"M0,"+ -t+"L"+n+",0"+" 0,"+t+" "+ -n+",0"+"Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+ -t+","+ -t+"L"+t+","+ -t+" "+t+","+t+" "+ -t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/du),n=t*du/2;return"M0,"+n+"L"+t+","+ -n+" "+ -t+","+ -n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/du),n=t*du/2;return"M0,"+ -n+"L"+t+","+n+" "+ -t+","+n+"Z"}});e.svg.symbolTypes=pu.keys();var du=Math.sqrt(3),vu=Math.tan(30*mt);var gu=[],yu=0,bu,wu={ease:us,delay:0,duration:250};gu.call=B.call;gu.empty=B.empty;gu.node=B.node;e.transition=function(e){return arguments.length?bu?e.transition():e:st.transition()};e.transition.prototype=gu;gu.select=function(e){var t=this.id,n=[],r,i,s;if(typeof e!=="function")e=j(e);for(var o=-1,u=this.length;++o1?+t:r;s=n>0?+arguments[n]:r;return c};c.tickPadding=function(e){if(!arguments.length)return o;o=+e;return c};c.tickSubdivide=function(e){if(!arguments.length)return l;l=+e;return c};return c};var Tu="bottom",Nu={top:1,right:1,bottom:1,left:1};e.svg.brush=function(){function a(t){t.each(function(){var t=e.select(this),n=t.selectAll(".background").data([0]),o=t.selectAll(".extent").data([0]),u=t.selectAll(".resize").data(s,String),p;t.style("pointer-events","all").on("mousedown.brush",h).on("touchstart.brush",h);n.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair");o.enter().append("rect").attr("class","extent").style("cursor","move");u.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return Au[e]}).append("rect").attr("x",function(e){return/[ew]$/.test(e)?-3:null}).attr("y",function(e){return/^[ns]/.test(e)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden");u.style("display",a.empty()?"none":null);u.exit().remove();if(r){p=To(r);n.attr("x",p[0]).attr("width",p[1]-p[0]);l(t)}if(i){p=To(i);n.attr("y",p[0]).attr("height",p[1]-p[0]);c(t)}f(t)})}function f(e){e.selectAll(".resize").attr("transform",function(e){return"translate("+o[+/e$/.test(e)][0]+","+o[+/^s/.test(e)][1]+")"})}function l(e){e.select(".extent").attr("x",o[0][0]);e.selectAll(".extent,.n>rect,.s>rect").attr("width",o[1][0]-o[0][0])}function c(e){e.select(".extent").attr("y",o[0][1]);e.selectAll(".extent,.e>rect,.w>rect").attr("height",o[1][1]-o[0][1])}function h(){function C(){var t=e.event.changedTouches;return t?e.touches(s,t)[0]:e.mouse(s)}function k(){if(e.event.keyCode==32){if(!b){w=null;E[0]-=o[1][0];E[1]-=o[1][1];b=2}y()}}function L(){if(e.event.keyCode==32&&b==2){E[0]+=o[1][0];E[1]+=o[1][1];b=0;y()}}function A(){var t=C(),n=false;if(S){t[0]+=S[0];t[1]+=S[1]}if(!b){if(e.event.altKey){if(!w)w=[(o[0][0]+o[1][0])/2,(o[0][1]+o[1][1])/2];E[0]=o[+(t[0]=12?"PM":"AM"},S:function(e,t){return $u(e.getSeconds(),t,2)},U:function(t,n){return $u(e.time.sundayOfYear(t),n,2)},w:function(e){return e.getDay()},W:function(t,n){return $u(e.time.mondayOfYear(t),n,2)},x:e.time.format(Bu),X:e.time.format(ju),y:function(e,t){return $u(e.getFullYear()%100,t,2)},Y:function(e,t){return $u(e.getFullYear()%1e4,t,4)},Z:Sa,"%":function(){return"%"}};var na={a:ra,A:ia,b:sa,B:oa,c:ua,d:da,e:da,H:va,I:va,L:ya,m:pa,M:ma,p:wa,S:ga,x:aa,X:fa,y:ca,Y:la};var ba=/^\s*\d+/;var Ea=e.map({am:0,pm:1});e.time.format.utc=function(t){function r(e){try{Mu=Du;var t=new Mu;t._=e;return n(t)}finally{Mu=Date}}var n=e.time.format(t);r.parse=function(e){try{Mu=Du;var t=n.parse(e);return t&&t._}finally{Mu=Date}};r.toString=n.toString;return r};var xa=e.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");e.time.format.iso=Date.prototype.toISOString&&+(new Date("2000-01-01T00:00:00.000Z"))?Ta:xa;Ta.parse=function(e){var t=new Date(e);return isNaN(t)?null:t};Ta.toString=xa.toString;e.time.second=Uu(function(e){return new Mu(Math.floor(e/1e3)*1e3)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*1e3)},function(e){return e.getSeconds()});e.time.seconds=e.time.second.range;e.time.seconds.utc=e.time.second.utc.range;e.time.minute=Uu(function(e){return new Mu(Math.floor(e/6e4)*6e4)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*6e4)},function(e){return e.getMinutes()});e.time.minutes=e.time.minute.range;e.time.minutes.utc=e.time.minute.utc.range;e.time.hour=Uu(function(e){var t=e.getTimezoneOffset()/60;return new Mu((Math.floor(e/36e5-t)+t)*36e5)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*36e5)},function(e){return e.getHours()});e.time.hours=e.time.hour.range;e.time.hours.utc=e.time.hour.utc.range;e.time.month=Uu(function(t){t=e.time.day(t);t.setDate(1);return t},function(e,t){e.setMonth(e.getMonth()+t)},function(e){return e.getMonth()});e.time.months=e.time.month.range;e.time.months.utc=e.time.month.utc.range;var Ma=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6];var _a=[[e.time.second,1],[e.time.second,5],[e.time.second,15],[e.time.second,30],[e.time.minute,1],[e.time.minute,5],[e.time.minute,15],[e.time.minute,30],[e.time.hour,1],[e.time.hour,3],[e.time.hour,6],[e.time.hour,12],[e.time.day,1],[e.time.day,2],[e.time.week,1],[e.time.month,1],[e.time.month,3],[e.time.year,1]];var Da=[[e.time.format("%Y"),$n],[e.time.format("%B"),function(e){return e.getMonth()}],[e.time.format("%b %d"),function(e){return e.getDate()!=1}],[e.time.format("%a %d"),function(e){return e.getDay()&&e.getDate()!=1}],[e.time.format("%I %p"),function(e){return e.getHours()}],[e.time.format("%I:%M"),function(e){return e.getMinutes()}],[e.time.format(":%S"),function(e){return e.getSeconds()}],[e.time.format(".%L"),function(e){return e.getMilliseconds()}]];var Pa=e.scale.linear(),Ha=La(Da);_a.year=function(e,t){return Pa.domain(e.map(Oa)).ticks(t).map(Aa)};e.time.scale=function(){return Na(e.scale.linear(),_a,Ha)};var Ba=_a.map(function(e){return[e[0].utc,e[1]]});var ja=[[e.time.format.utc("%Y"),$n],[e.time.format.utc("%B"),function(e){return e.getUTCMonth()}],[e.time.format.utc("%b %d"),function(e){return e.getUTCDate()!=1}],[e.time.format.utc("%a %d"),function(e){return e.getUTCDay()&&e.getUTCDate()!=1}],[e.time.format.utc("%I %p"),function(e){return e.getUTCHours()}],[e.time.format.utc("%I:%M"),function(e){return e.getUTCMinutes()}],[e.time.format.utc(":%S"),function(e){return e.getUTCSeconds()}],[e.time.format.utc(".%L"),function(e){return e.getUTCMilliseconds()}]];var Fa=La(ja);Ba.year=function(e,t){return Pa.domain(e.map(qa)).ticks(t).map(Ia)};e.time.scale.utc=function(){return Na(e.scale.linear(),Ba,Fa)};e.text=function(){return e.xhr.apply(e,arguments).response(Ra)};e.json=function(t,n){return e.xhr(t,"application/json",n).response(Ua)};e.html=function(t,n){return e.xhr(t,"text/html",n).response(za)};e.xml=function(){return e.xhr.apply(e,arguments).response(Wa)};return e}() \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/fisheye.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/fisheye.js new file mode 100644 index 0000000..e1addd7 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/fisheye.js @@ -0,0 +1,86 @@ +(function() { + d3.fisheye = { + scale: function(scaleType) { + return d3_fisheye_scale(scaleType(), 3, 0); + }, + circular: function() { + var radius = 200, + distortion = 2, + k0, + k1, + focus = [0, 0]; + + function fisheye(d) { + var dx = d.x - focus[0], + dy = d.y - focus[1], + dd = Math.sqrt(dx * dx + dy * dy); + if (!dd || dd >= radius) return {x: d.x, y: d.y, z: 1}; + var k = k0 * (1 - Math.exp(-dd * k1)) / dd * .75 + .25; + return {x: focus[0] + dx * k, y: focus[1] + dy * k, z: Math.min(k, 10)}; + } + + function rescale() { + k0 = Math.exp(distortion); + k0 = k0 / (k0 - 1) * radius; + k1 = distortion / radius; + return fisheye; + } + + fisheye.radius = function(_) { + if (!arguments.length) return radius; + radius = +_; + return rescale(); + }; + + fisheye.distortion = function(_) { + if (!arguments.length) return distortion; + distortion = +_; + return rescale(); + }; + + fisheye.focus = function(_) { + if (!arguments.length) return focus; + focus = _; + return fisheye; + }; + + return rescale(); + } + }; + + function d3_fisheye_scale(scale, d, a) { + + function fisheye(_) { + var x = scale(_), + left = x < a, + v, + range = d3.extent(scale.range()), + min = range[0], + max = range[1], + m = left ? a - min : max - a; + if (m == 0) m = max - min; + return (left ? -1 : 1) * m * (d + 1) / (d + (m / Math.abs(x - a))) + a; + } + + fisheye.distortion = function(_) { + if (!arguments.length) return d; + d = +_; + return fisheye; + }; + + fisheye.focus = function(_) { + if (!arguments.length) return a; + a = +_; + return fisheye; + }; + + fisheye.copy = function() { + return d3_fisheye_scale(scale.copy(), d, a); + }; + + fisheye.nice = scale.nice; + fisheye.ticks = scale.ticks; + fisheye.tickFormat = scale.tickFormat; + return d3.rebind(fisheye, scale, "domain", "range"); + } +})(); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/hive.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/hive.js new file mode 100644 index 0000000..06e53ae --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/hive.js @@ -0,0 +1,80 @@ +d3.hive = {}; + +d3.hive.link = function() { + var source = function(d) { return d.source; }, + target = function(d) { return d.target; }, + angle = function(d) { return d.angle; }, + startRadius = function(d) { return d.radius; }, + endRadius = startRadius, + arcOffset = -Math.PI / 2; + + function link(d, i) { + var s = node(source, this, d, i), + t = node(target, this, d, i), + x; + if (t.a < s.a) x = t, t = s, s = x; + if (t.a - s.a > Math.PI) s.a += 2 * Math.PI; + var a1 = s.a + (t.a - s.a) / 3, + a2 = t.a - (t.a - s.a) / 3; + return s.r0 - s.r1 || t.r0 - t.r1 + ? "M" + Math.cos(s.a) * s.r0 + "," + Math.sin(s.a) * s.r0 + + "L" + Math.cos(s.a) * s.r1 + "," + Math.sin(s.a) * s.r1 + + "C" + Math.cos(a1) * s.r1 + "," + Math.sin(a1) * s.r1 + + " " + Math.cos(a2) * t.r1 + "," + Math.sin(a2) * t.r1 + + " " + Math.cos(t.a) * t.r1 + "," + Math.sin(t.a) * t.r1 + + "L" + Math.cos(t.a) * t.r0 + "," + Math.sin(t.a) * t.r0 + + "C" + Math.cos(a2) * t.r0 + "," + Math.sin(a2) * t.r0 + + " " + Math.cos(a1) * s.r0 + "," + Math.sin(a1) * s.r0 + + " " + Math.cos(s.a) * s.r0 + "," + Math.sin(s.a) * s.r0 + : "M" + Math.cos(s.a) * s.r0 + "," + Math.sin(s.a) * s.r0 + + "C" + Math.cos(a1) * s.r1 + "," + Math.sin(a1) * s.r1 + + " " + Math.cos(a2) * t.r1 + "," + Math.sin(a2) * t.r1 + + " " + Math.cos(t.a) * t.r1 + "," + Math.sin(t.a) * t.r1; + } + + function node(method, thiz, d, i) { + var node = method.call(thiz, d, i), + a = +(typeof angle === "function" ? angle.call(thiz, node, i) : angle) + arcOffset, + r0 = +(typeof startRadius === "function" ? startRadius.call(thiz, node, i) : startRadius), + r1 = (startRadius === endRadius ? r0 : +(typeof endRadius === "function" ? endRadius.call(thiz, node, i) : endRadius)); + return {r0: r0, r1: r1, a: a}; + } + + link.source = function(_) { + if (!arguments.length) return source; + source = _; + return link; + }; + + link.target = function(_) { + if (!arguments.length) return target; + target = _; + return link; + }; + + link.angle = function(_) { + if (!arguments.length) return angle; + angle = _; + return link; + }; + + link.radius = function(_) { + if (!arguments.length) return startRadius; + startRadius = endRadius = _; + return link; + }; + + link.startRadius = function(_) { + if (!arguments.length) return startRadius; + startRadius = _; + return link; + }; + + link.endRadius = function(_) { + if (!arguments.length) return endRadius; + endRadius = _; + return link; + }; + + return link; +}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/horizon.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/horizon.js new file mode 100644 index 0000000..d84c656 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/horizon.js @@ -0,0 +1,192 @@ +(function() { + d3.horizon = function() { + var bands = 1, // between 1 and 5, typically + mode = "offset", // or mirror + interpolate = "linear", // or basis, monotone, step-before, etc. + x = d3_horizonX, + y = d3_horizonY, + w = 960, + h = 40, + duration = 0; + + var color = d3.scale.linear() + .domain([-1, 0, 1]) + .range(["#d62728", "#fff", "#1f77b4"]); + + // For each small multiple… + function horizon(g) { + g.each(function(d, i) { + var g = d3.select(this), + n = 2 * bands + 1, + xMin = Infinity, + xMax = -Infinity, + yMax = -Infinity, + x0, // old x-scale + y0, // old y-scale + id; // unique id for paths + + // Compute x- and y-values along with extents. + var data = d.map(function(d, i) { + var xv = x.call(this, d, i), + yv = y.call(this, d, i); + if (xv < xMin) xMin = xv; + if (xv > xMax) xMax = xv; + if (-yv > yMax) yMax = -yv; + if (yv > yMax) yMax = yv; + return [xv, yv]; + }); + + // Compute the new x- and y-scales, and transform. + var x1 = d3.scale.linear().domain([xMin, xMax]).range([0, w]), + y1 = d3.scale.linear().domain([0, yMax]).range([0, h * bands]), + t1 = d3_horizonTransform(bands, h, mode); + + // Retrieve the old scales, if this is an update. + if (this.__chart__) { + x0 = this.__chart__.x; + y0 = this.__chart__.y; + t0 = this.__chart__.t; + id = this.__chart__.id; + } else { + x0 = x1.copy(); + y0 = y1.copy(); + t0 = t1; + id = ++d3_horizonId; + } + + // We'll use a defs to store the area path and the clip path. + var defs = g.selectAll("defs") + .data([null]); + + // The clip path is a simple rect. + defs.enter().append("defs").append("clipPath") + .attr("id", "d3_horizon_clip" + id) + .append("rect") + .attr("width", w) + .attr("height", h); + + defs.select("rect").transition() + .duration(duration) + .attr("width", w) + .attr("height", h); + + // We'll use a container to clip all horizon layers at once. + g.selectAll("g") + .data([null]) + .enter().append("g") + .attr("clip-path", "url(#d3_horizon_clip" + id + ")"); + + // Instantiate each copy of the path with different transforms. + var path = g.select("g").selectAll("path") + .data(d3.range(-1, -bands - 1, -1).concat(d3.range(1, bands + 1)), Number); + + var d0 = d3_horizonArea + .interpolate(interpolate) + .x(function(d) { return x0(d[0]); }) + .y0(h * bands) + .y1(function(d) { return h * bands - y0(d[1]); }) + (data); + + var d1 = d3_horizonArea + .x(function(d) { return x1(d[0]); }) + .y1(function(d) { return h * bands - y1(d[1]); }) + (data); + + path.enter().append("path") + .style("fill", color) + .attr("transform", t0) + .attr("d", d0); + + path.transition() + .duration(duration) + .style("fill", color) + .attr("transform", t1) + .attr("d", d1); + + path.exit().transition() + .duration(duration) + .attr("transform", t1) + .attr("d", d1) + .remove(); + + // Stash the new scales. + this.__chart__ = {x: x1, y: y1, t: t1, id: id}; + }); + d3.timer.flush(); + } + + horizon.duration = function(x) { + if (!arguments.length) return duration; + duration = +x; + return horizon; + }; + + horizon.bands = function(x) { + if (!arguments.length) return bands; + bands = +x; + color.domain([-bands, 0, bands]); + return horizon; + }; + + horizon.mode = function(x) { + if (!arguments.length) return mode; + mode = x + ""; + return horizon; + }; + + horizon.colors = function(x) { + if (!arguments.length) return color.range(); + color.range(x); + return horizon; + }; + + horizon.interpolate = function(x) { + if (!arguments.length) return interpolate; + interpolate = x + ""; + return horizon; + }; + + horizon.x = function(z) { + if (!arguments.length) return x; + x = z; + return horizon; + }; + + horizon.y = function(z) { + if (!arguments.length) return y; + y = z; + return horizon; + }; + + horizon.width = function(x) { + if (!arguments.length) return w; + w = +x; + return horizon; + }; + + horizon.height = function(x) { + if (!arguments.length) return h; + h = +x; + return horizon; + }; + + return horizon; + }; + + var d3_horizonArea = d3.svg.area(), + d3_horizonId = 0; + + function d3_horizonX(d) { + return d[0]; + } + + function d3_horizonY(d) { + return d[1]; + } + + function d3_horizonTransform(bands, h, mode) { + return mode == "offset" + ? function(d) { return "translate(0," + (d + (d < 0) - bands) * h + ")"; } + : function(d) { return (d < 0 ? "scale(1,-1)" : "") + "translate(0," + (d - bands) * h + ")"; }; + } +})(); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/interactiveLayer.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/interactiveLayer.js new file mode 100644 index 0000000..4dfb68d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/interactiveLayer.js @@ -0,0 +1,251 @@ +/* Utility class to handle creation of an interactive layer. +This places a rectangle on top of the chart. When you mouse move over it, it sends a dispatch +containing the X-coordinate. It can also render a vertical line where the mouse is located. + +dispatch.elementMousemove is the important event to latch onto. It is fired whenever the mouse moves over +the rectangle. The dispatch is given one object which contains the mouseX/Y location. +It also has 'pointXValue', which is the conversion of mouseX to the x-axis scale. +*/ +nv.interactiveGuideline = function() { + "use strict"; + var tooltip = nv.models.tooltip(); + //Public settings + var width = null + , height = null + //Please pass in the bounding chart's top and left margins + //This is important for calculating the correct mouseX/Y positions. + , margin = {left: 0, top: 0} + , xScale = d3.scale.linear() + , yScale = d3.scale.linear() + , dispatch = d3.dispatch('elementMousemove', 'elementMouseout','elementDblclick') + , showGuideLine = true + , svgContainer = null + //Must pass in the bounding chart's container. + //The mousemove event is attached to this container. + ; + + //Private variables + var isMSIE = navigator.userAgent.indexOf("MSIE") !== -1 //Check user-agent for Microsoft Internet Explorer. + ; + + + function layer(selection) { + selection.each(function(data) { + var container = d3.select(this); + + var availableWidth = (width || 960), availableHeight = (height || 400); + + var wrap = container.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([data]); + var wrapEnter = wrap.enter() + .append("g").attr("class", " nv-wrap nv-interactiveLineLayer"); + + + wrapEnter.append("g").attr("class","nv-interactiveGuideLine"); + + if (!svgContainer) { + return; + } + + function mouseHandler() { + var d3mouse = d3.mouse(this); + var mouseX = d3mouse[0]; + var mouseY = d3mouse[1]; + var subtractMargin = true; + var mouseOutAnyReason = false; + if (isMSIE) { + /* + D3.js (or maybe SVG.getScreenCTM) has a nasty bug in Internet Explorer 10. + d3.mouse() returns incorrect X,Y mouse coordinates when mouse moving + over a rect in IE 10. + However, d3.event.offsetX/Y also returns the mouse coordinates + relative to the triggering . So we use offsetX/Y on IE. + */ + mouseX = d3.event.offsetX; + mouseY = d3.event.offsetY; + + /* + On IE, if you attach a mouse event listener to the container, + it will actually trigger it for all the child elements (like , , etc). + When this happens on IE, the offsetX/Y is set to where ever the child element + is located. + As a result, we do NOT need to subtract margins to figure out the mouse X/Y + position under this scenario. Removing the line below *will* cause + the interactive layer to not work right on IE. + */ + if(d3.event.target.tagName !== "svg") + subtractMargin = false; + + if (d3.event.target.className.baseVal.match("nv-legend")) + mouseOutAnyReason = true; + + } + + if(subtractMargin) { + mouseX -= margin.left; + mouseY -= margin.top; + } + + /* If mouseX/Y is outside of the chart's bounds, + trigger a mouseOut event. + */ + if (mouseX < 0 || mouseY < 0 + || mouseX > availableWidth || mouseY > availableHeight + || (d3.event.relatedTarget && d3.event.relatedTarget.ownerSVGElement === undefined) + || mouseOutAnyReason + ) + { + if (isMSIE) { + if (d3.event.relatedTarget + && d3.event.relatedTarget.ownerSVGElement === undefined + && d3.event.relatedTarget.className.match(tooltip.nvPointerEventsClass)) { + return; + } + } + dispatch.elementMouseout({ + mouseX: mouseX, + mouseY: mouseY + }); + layer.renderGuideLine(null); //hide the guideline + return; + } + + var pointXValue = xScale.invert(mouseX); + dispatch.elementMousemove({ + mouseX: mouseX, + mouseY: mouseY, + pointXValue: pointXValue + }); + + //If user double clicks the layer, fire a elementDblclick dispatch. + if (d3.event.type === "dblclick") { + dispatch.elementDblclick({ + mouseX: mouseX, + mouseY: mouseY, + pointXValue: pointXValue + }); + } + } + + svgContainer + .on("mousemove",mouseHandler, true) + .on("mouseout" ,mouseHandler,true) + .on("dblclick" ,mouseHandler) + ; + + //Draws a vertical guideline at the given X postion. + layer.renderGuideLine = function(x) { + if (!showGuideLine) return; + var line = wrap.select(".nv-interactiveGuideLine") + .selectAll("line") + .data((x != null) ? [nv.utils.NaNtoZero(x)] : [], String); + + line.enter() + .append("line") + .attr("class", "nv-guideline") + .attr("x1", function(d) { return d;}) + .attr("x2", function(d) { return d;}) + .attr("y1", availableHeight) + .attr("y2",0) + ; + line.exit().remove(); + + } + }); + } + + layer.dispatch = dispatch; + layer.tooltip = tooltip; + + layer.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return layer; + }; + + layer.width = function(_) { + if (!arguments.length) return width; + width = _; + return layer; + }; + + layer.height = function(_) { + if (!arguments.length) return height; + height = _; + return layer; + }; + + layer.xScale = function(_) { + if (!arguments.length) return xScale; + xScale = _; + return layer; + }; + + layer.showGuideLine = function(_) { + if (!arguments.length) return showGuideLine; + showGuideLine = _; + return layer; + }; + + layer.svgContainer = function(_) { + if (!arguments.length) return svgContainer; + svgContainer = _; + return layer; + }; + + + return layer; +}; + +/* Utility class that uses d3.bisect to find the index in a given array, where a search value can be inserted. +This is different from normal bisectLeft; this function finds the nearest index to insert the search value. + +For instance, lets say your array is [1,2,3,5,10,30], and you search for 28. +Normal d3.bisectLeft will return 4, because 28 is inserted after the number 10. But interactiveBisect will return 5 +because 28 is closer to 30 than 10. + +Unit tests can be found in: interactiveBisectTest.html + +Has the following known issues: + * Will not work if the data points move backwards (ie, 10,9,8,7, etc) or if the data points are in random order. + * Won't work if there are duplicate x coordinate values. +*/ +nv.interactiveBisect = function (values, searchVal, xAccessor) { + "use strict"; + if (! values instanceof Array) return null; + if (typeof xAccessor !== 'function') xAccessor = function(d,i) { return d.x;} + + var bisect = d3.bisector(xAccessor).left; + var index = d3.max([0, bisect(values,searchVal) - 1]); + var currentValue = xAccessor(values[index], index); + if (typeof currentValue === 'undefined') currentValue = index; + + if (currentValue === searchVal) return index; //found exact match + + var nextIndex = d3.min([index+1, values.length - 1]); + var nextValue = xAccessor(values[nextIndex], nextIndex); + if (typeof nextValue === 'undefined') nextValue = nextIndex; + + if (Math.abs(nextValue - searchVal) >= Math.abs(currentValue - searchVal)) + return index; + else + return nextIndex +}; + +/* +Returns the index in the array "values" that is closest to searchVal. +Only returns an index if searchVal is within some "threshold". +Otherwise, returns null. +*/ +nv.nearestValueIndex = function (values, searchVal, threshold) { + "use strict"; + var yDistMax = Infinity, indexToHighlight = null; + values.forEach(function(d,i) { + var delta = Math.abs(searchVal - d); + if ( delta <= yDistMax && delta < threshold) { + yDistMax = delta; + indexToHighlight = i; + } + }); + return indexToHighlight; +}; \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/intro.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/intro.js new file mode 100644 index 0000000..af50383 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/intro.js @@ -0,0 +1 @@ +(function(){ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis-min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis-min.js new file mode 100644 index 0000000..1101dde --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis-min.js @@ -0,0 +1 @@ +nv.models.axis=function(){function o(d){return d.each(function(d){var o=d3.select(this),p=o.selectAll("g.nv-wrap.nv-axis").data([d]),q=p.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");q.append("g");var s=p.select("g");null!==m?a.ticks(m):("top"==a.orient()||"bottom"==a.orient())&&a.ticks(Math.abs(e.range()[1]-e.range()[0])/100),d3.transition(s).call(a),n=n||a.scale();var t=a.tickFormat();null==t&&(t=n.tickFormat());var u=s.selectAll("text.nv-axislabel").data([f||null]);switch(u.exit().remove(),a.orient()){case"top":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",0);var v=2==e.range().length?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);if(u.attr("x",v/2),g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a){return"translate("+e(a)+",0)"}).select("text").attr("dy","0em").attr("y",-a.tickPadding()).attr("text-anchor","middle").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate("+e.range()[b]+",0)"})}break;case"bottom":var x=36,y=30,z=s.selectAll("g").select("text");if(i%360){z.each(function(){var c=this.getBBox().width;c>y&&(y=c)});var A=Math.abs(Math.sin(i*Math.PI/180)),x=(A?A*y:y)+30;z.attr("transform",function(){return"rotate("+i+" 0,0)"}).attr("text-anchor",i%360>0?"start":"end")}u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",x);var v=2==e.range().length?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);if(u.attr("x",v/2),g){var w=p.selectAll("g.nv-axisMaxMin").data([e.domain()[0],e.domain()[e.domain().length-1]]);w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",a.tickPadding()).attr("transform",function(){return"rotate("+i+" 0,0)"}).attr("text-anchor",i?i%360>0?"start":"end":"middle").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"})}k&&z.attr("transform",function(a,b){return"translate(0,"+(0==b%2?"0":"12")+")"});break;case"right":if(u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"begin").attr("transform",j?"rotate(90)":"").attr("y",j?-Math.max(b.right,c)+30:-10),u.attr("x",j?e.range()[0]/2:a.tickPadding()),g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a){return"translate(0,"+e(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",a.tickPadding()).attr("text-anchor","start").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}break;case"left":if(u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"begin").attr("transform",j?"rotate(-90)":"").attr("y",j?-Math.max(b.left,c)+0:-10),u.attr("x",j?-e.range()[0]/2:-a.tickPadding()),g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a){return"translate(0,"+e(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-a.tickPadding()).attr("text-anchor","start").text(function(a){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}}if(u.text(function(a){return a}),!g||"left"!==a.orient()&&"right"!==a.orient()||(s.selectAll("g").each(function(a){d3.select(this).select("text").attr("opacity",1),(e(a)e.range()[0]-10)&&((a>1e-10||-1e-10>a)&&d3.select(this).attr("opacity",0),d3.select(this).select("text").attr("opacity",0))}),e.domain()[0]==e.domain()[1]&&0==e.domain()[0]&&p.selectAll("g.nv-axisMaxMin").style("opacity",function(a,b){return b?0:1})),g&&("top"===a.orient()||"bottom"===a.orient())){var B=[];p.selectAll("g.nv-axisMaxMin").each(function(a,b){try{b?B.push(e(a)-this.getBBox().width-4):B.push(e(a)+this.getBBox().width+4)}catch(c){b?B.push(e(a)-4):B.push(e(a)+4)}}),s.selectAll("g").each(function(a){(e(a)B[1])&&(a>1e-10||-1e-10>a?d3.select(this).remove():d3.select(this).select("text").remove())})}h&&s.selectAll("line.tick").filter(function(a){return!parseFloat(Math.round(1e5*a)/1e6)}).classed("zero",!0),n=e.copy()}),o}var a=d3.svg.axis(),b={top:0,right:0,bottom:0,left:0},c=75,d=60,e=d3.scale.linear(),f=null,g=!1,h=!0,i=0,j=!0,k=!1,l=!1,m=null;a.scale(e).orient("bottom").tickFormat(function(a){return a});var n;return o.axis=a,d3.rebind(o,a,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o.margin=function(a){return arguments.length?(b.top=a.top!==void 0?a.top:b.top,b.right=a.right!==void 0?a.right:b.right,b.bottom=a.bottom!==void 0?a.bottom:b.bottom,b.left=a.left!==void 0?a.left:b.left,o):b},o.width=function(a){return arguments.length?(c=a,o):c},o.ticks=function(a){return arguments.length?(m=a,o):m},o.height=function(a){return arguments.length?(d=a,o):d},o.axisLabel=function(a){return arguments.length?(f=a,o):f},o.showMaxMin=function(a){return arguments.length?(g=a,o):g},o.highlightZero=function(a){return arguments.length?(h=a,o):h},o.scale=function(b){return arguments.length?(e=b,a.scale(e),l="function"==typeof e.rangeBands,d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o):e},o.rotateYLabel=function(a){return arguments.length?(j=a,o):j},o.rotateLabels=function(a){return arguments.length?(i=a,o):i},o.staggerLabels=function(a){return arguments.length?(k=a,o):k},o}; \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis.js new file mode 100644 index 0000000..9895c3f --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis.js @@ -0,0 +1,470 @@ +nv.models.axis = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var axis = d3.svg.axis() + ; + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 75 //only used for tickLabel currently + , height = 60 //only used for tickLabel currently + , scale = d3.scale.linear() + , axisLabelText = null + , showMaxMin = true //TODO: showMaxMin should be disabled on all ordinal scaled axes + , highlightZero = true + , rotateLabels = 0 + , rotateYLabel = true + , staggerLabels = false + , isOrdinal = false + , ticks = null + , logScale = false + , axisLabelDistance = 12 //The larger this number is, the closer the axis label is to the axis. + ; + + axis + .scale(scale) + .orient('bottom') + .tickFormat(function(d) { return d }) + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var scale0; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-axis').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-axis'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + //------------------------------------------------------------ + + + if (ticks !== null) + axis.ticks(ticks); + else if (axis.orient() == 'top' || axis.orient() == 'bottom') + axis.ticks(Math.abs(scale.range()[1] - scale.range()[0]) / 100); + + + //TODO: consider calculating width/height based on whether or not label is added, for reference in charts using this component + + + g.transition().call(axis); + + scale0 = scale0 || axis.scale(); + + var fmt = axis.tickFormat(); + if (fmt == null) { + fmt = scale0.tickFormat(); + } + + var axisLabel = g.selectAll('text.nv-axislabel') + .data([axisLabelText || null]); + axisLabel.exit().remove(); + switch (axis.orient()) { + case 'top': + axisLabel.enter().append('text').attr('class', 'nv-axislabel'); + var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0])); + axisLabel + .attr('text-anchor', 'middle') + .attr('y', 0) + .attr('x', w/2); + if (showMaxMin) { + var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin') + .data(scale.domain()); + axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text'); + axisMaxMin.exit().remove(); + axisMaxMin + .attr('transform', function(d,i) { + return 'translate(' + scale(d) + ',0)' + }) + .select('text') + .attr('dy', '0em') + .attr('y', -axis.tickPadding()) + .attr('text-anchor', 'middle') + .text(function(d,i) { + //var v = fmt(d); + var v = d; + if(logScale) { + v = Math.pow(10,v); + v = fmt(v); + //fmt = d3.format(',.2f'); + //v = fmt(v); + } else + v = fmt(v); + return ('' + v).match('NaN') ? '' : v; + }); + axisMaxMin.transition() + .attr('transform', function(d,i) { + return 'translate(' + scale.range()[i] + ',0)' + }); + } + break; + case 'bottom': + var xLabelMargin = 36; + var maxTextWidth = 30; + var xTicks = g.selectAll('g').select("text"); + if (rotateLabels%360) { + //Calculate the longest xTick width + xTicks.each(function(d,i){ + var width = this.getBBox().width; + if(width > maxTextWidth) maxTextWidth = width; + }); + //Convert to radians before calculating sin. Add 30 to margin for healthy padding. + var sin = Math.abs(Math.sin(rotateLabels*Math.PI/180)); + var xLabelMargin = (sin ? sin*maxTextWidth : maxTextWidth)+30; + //Rotate all xTicks + xTicks + .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' }) + .style('text-anchor', rotateLabels%360 > 0 ? 'start' : 'end'); + } + axisLabel.enter().append('text').attr('class', 'nv-axislabel'); + var w = (scale.range().length==2) ? scale.range()[1] : (scale.range()[scale.range().length-1]+(scale.range()[1]-scale.range()[0])); + axisLabel + .attr('text-anchor', 'middle') + .attr('y', xLabelMargin) + .attr('x', w/2); + if (showMaxMin) { + //if (showMaxMin && !isOrdinal) { + var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin') + //.data(scale.domain()) + .data([scale.domain()[0], scale.domain()[scale.domain().length - 1]]); + axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text'); + axisMaxMin.exit().remove(); + axisMaxMin + .attr('transform', function(d,i) { + return 'translate(' + (scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0)) + ',0)' + }) + .select('text') + .attr('dy', '.71em') + .attr('y', axis.tickPadding()) + .attr('transform', function(d,i,j) { return 'rotate(' + rotateLabels + ' 0,0)' }) + .style('text-anchor', rotateLabels ? (rotateLabels%360 > 0 ? 'start' : 'end') : 'middle') + .text(function(d,i) { + //var v = fmt(d); + var v = d; + if(logScale) { + v = Math.pow(10,v); + v = fmt(v); + //fmt = d3.format(',.2f'); + //v = fmt(v); + } else + v = fmt(v); + return ('' + v).match('NaN') ? '' : v; + }); + axisMaxMin.transition() + .attr('transform', function(d,i) { + //return 'translate(' + scale.range()[i] + ',0)' + //return 'translate(' + scale(d) + ',0)' + return 'translate(' + (scale(d) + (isOrdinal ? scale.rangeBand() / 2 : 0)) + ',0)' + }); + } + if (staggerLabels) + xTicks + .attr('transform', function(d,i) { return 'translate(0,' + (i % 2 == 0 ? '0' : '12') + ')' }); + + break; + case 'right': + axisLabel.enter().append('text').attr('class', 'nv-axislabel'); + axisLabel + .style('text-anchor', rotateYLabel ? 'middle' : 'begin') + .attr('transform', rotateYLabel ? 'rotate(90)' : '') + .attr('y', rotateYLabel ? (-Math.max(margin.right,width) + 12) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart + .attr('x', rotateYLabel ? (scale.range()[0] / 2) : axis.tickPadding()); + if (showMaxMin) { + var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin') + .data(scale.domain()); + axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text') + .style('opacity', 0); + axisMaxMin.exit().remove(); + axisMaxMin + .attr('transform', function(d,i) { + return 'translate(0,' + scale(d) + ')' + }) + .select('text') + .attr('dy', '.32em') + .attr('y', 0) + .attr('x', axis.tickPadding()) + .style('text-anchor', 'start') + .text(function(d,i) { + //var v = fmt(d); + var v = d; + if(logScale) { + v = Math.pow(10,v); + v = fmt(v); + //fmt = d3.format(',.2f'); + //v = fmt(v); + } else + v = fmt(v); + return ('' + v).match('NaN') ? '' : v; + }); + axisMaxMin.transition() + .attr('transform', function(d,i) { + return 'translate(0,' + scale.range()[i] + ')' + }) + .select('text') + .style('opacity', 1); + } + break; + case 'left': + /* + //For dynamically placing the label. Can be used with dynamically-sized chart axis margins + var yTicks = g.selectAll('g').select("text"); + yTicks.each(function(d,i){ + var labelPadding = this.getBBox().width + axis.tickPadding() + 16; + if(labelPadding > width) width = labelPadding; + }); + */ + axisLabel.enter().append('text').attr('class', 'nv-axislabel'); + axisLabel + .style('text-anchor', rotateYLabel ? 'middle' : 'end') + .attr('transform', rotateYLabel ? 'rotate(-90)' : '') + .attr('y', rotateYLabel ? (-Math.max(margin.left,width) + axisLabelDistance) : -10) //TODO: consider calculating this based on largest tick width... OR at least expose this on chart + .attr('x', rotateYLabel ? (-scale.range()[0] / 2) : -axis.tickPadding()); + if (showMaxMin) { + var axisMaxMin = wrap.selectAll('g.nv-axisMaxMin') + .data(scale.domain()); + axisMaxMin.enter().append('g').attr('class', 'nv-axisMaxMin').append('text') + .style('opacity', 0); + axisMaxMin.exit().remove(); + axisMaxMin + .attr('transform', function(d,i) { + return 'translate(0,' + scale0(d) + ')' + }) + .select('text') + .attr('dy', '.32em') + .attr('y', 0) + .attr('x', -axis.tickPadding()) + .attr('text-anchor', 'end') + .text(function(d,i) { + //var v = fmt(d); + var v = d; + if(logScale) { + v = Math.pow(10,v); + v = fmt(v); + //fmt = d3.format(',.2f'); + //v = fmt(v); + } else + v = fmt(v); + return ('' + v).match('NaN') ? '' : v; + }); + axisMaxMin.transition() + .attr('transform', function(d,i) { + return 'translate(0,' + scale.range()[i] + ')' + }) + .select('text') + .style('opacity', 1); + } + break; + } + axisLabel + .text(function(d) { return d }); + + + if (showMaxMin && (axis.orient() === 'left' || axis.orient() === 'right')) { + //check if max and min overlap other values, if so, hide the values that overlap + g.selectAll('g') // the g's wrapping each tick + .each(function(d,i) { + d3.select(this).select('text').attr('opacity', 1); + var v; + if(logScale) { + v = Math.pow(10,d); + v = fmt(v); + //fmt = d3.format(',.2f'); + //v = fmt(v); + } else { + v = fmt(d); + } + + //d3.select(this).select('text').text(fmt(Math.pow(10,d))); + d3.select(this).select('text').text(v); + if (scale(d) < scale.range()[1] + 10 || scale(d) > scale.range()[0] - 10) { // 10 is assuming text height is 16... if d is 0, leave it! + if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL + d3.select(this).attr('opacity', 0); + + d3.select(this).select('text').attr('opacity', 0); // Don't remove the ZERO line!! + } + }); + + //if Max and Min = 0 only show min, Issue #281 + if (scale.domain()[0] == scale.domain()[1] && scale.domain()[0] == 0) + wrap.selectAll('g.nv-axisMaxMin') + .style('opacity', function(d,i) { return !i ? 1 : 0 }); + + } + + if (showMaxMin && (axis.orient() === 'top' || axis.orient() === 'bottom')) { + var maxMinRange = []; + wrap.selectAll('g.nv-axisMaxMin') + .each(function(d,i) { + try { + if (i) // i== 1, max position + maxMinRange.push(scale(d) - this.getBBox().width - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case) + else // i==0, min position + maxMinRange.push(scale(d) + this.getBBox().width + 4) + }catch (err) { + if (i) // i== 1, max position + maxMinRange.push(scale(d) - 4) //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case) + else // i==0, min position + maxMinRange.push(scale(d) + 4) + } + }); + g.selectAll('g') // the g's wrapping each tick + .each(function(d,i) { + var v; + if(logScale) { + v = Math.pow(10,d); + //v = fmt(v); + //fmt = d3.format(',.2f'); + v = fmt(v); + } else { + v = fmt(d); + } + //alert(v); + + //d3.select(this).select('text').text(fmt(Math.pow(10,d))); + d3.select(this).select('text').text(v); + + if (scale(d) < maxMinRange[0] || scale(d) > maxMinRange[1]) { + if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL + d3.select(this).remove(); + else + d3.select(this).select('text').remove(); // Don't remove the ZERO line!! + } + }); + } + + + //highlight zero line ... Maybe should not be an option and should just be in CSS? + if (highlightZero) + g.selectAll('.tick') + .filter(function(d) { return !parseFloat(Math.round(d.__data__*100000)/1000000) && (d.__data__ !== undefined) }) //this is because sometimes the 0 tick is a very small fraction, TODO: think of cleaner technique + .classed('zero', true); + + //store old scales for use in transitions on update + scale0 = scale.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.axis = axis; + + d3.rebind(chart, axis, 'orient', 'tickValues', 'tickSubdivide', 'tickSize', 'tickPadding', 'tickFormat'); + d3.rebind(chart, scale, 'domain', 'range', 'rangeBand', 'rangeBands'); //these are also accessible by chart.scale(), but added common ones directly for ease of use + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if(!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + } + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.ticks = function(_) { + if (!arguments.length) return ticks; + ticks = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.axisLabel = function(_) { + if (!arguments.length) return axisLabelText; + axisLabelText = _; + return chart; + } + + chart.showMaxMin = function(_) { + if (!arguments.length) return showMaxMin; + showMaxMin = _; + return chart; + } + + chart.logScale = function(_) { + if (!arguments.length) return logScale; + logScale = _; + return chart; + } + + chart.highlightZero = function(_) { + if (!arguments.length) return highlightZero; + highlightZero = _; + return chart; + } + + chart.scale = function(_) { + if (!arguments.length) return scale; + scale = _; + axis.scale(scale); + isOrdinal = typeof scale.rangeBands === 'function'; + d3.rebind(chart, scale, 'domain', 'range', 'rangeBand', 'rangeBands'); + return chart; + } + + chart.rotateYLabel = function(_) { + if(!arguments.length) return rotateYLabel; + rotateYLabel = _; + return chart; + } + + chart.rotateLabels = function(_) { + if(!arguments.length) return rotateLabels; + rotateLabels = _; + return chart; + } + + chart.staggerLabels = function(_) { + if (!arguments.length) return staggerLabels; + staggerLabels = _; + return chart; + }; + + chart.axisLabelDistance = function(_) { + if (!arguments.length) return axisLabelDistance; + axisLabelDistance = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis.min.js new file mode 100644 index 0000000..6c8ad6a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/axis.min.js @@ -0,0 +1 @@ +nv.models.axis=function(){"use strict";function m(r){r.each(function(r){var m=d3.select(this);var g=m.selectAll("g.nv-wrap.nv-axis").data([r]);var y=g.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");var b=y.append("g");var w=g.select("g");if(h!==null)e.ticks(h);else if(e.orient()=="top"||e.orient()=="bottom")e.ticks(Math.abs(i.range()[1]-i.range()[0])/100);w.transition().call(e);v=v||e.scale();var E=e.tickFormat();if(E==null){E=v.tickFormat()}var S=w.selectAll("text.nv-axislabel").data([s||null]);S.exit().remove();switch(e.orient()){case"top":S.enter().append("text").attr("class","nv-axislabel");var x=i.range().length==2?i.range()[1]:i.range()[i.range().length-1]+(i.range()[1]-i.range()[0]);S.attr("text-anchor","middle").attr("y",0).attr("x",x/2);if(o){var T=g.selectAll("g.nv-axisMaxMin").data(i.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+i(e)+",0)"}).select("text").attr("dy","0em").attr("y",-e.tickPadding()).attr("text-anchor","middle").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+i.range()[t]+",0)"})}break;case"bottom":var N=36;var C=30;var k=w.selectAll("g").select("text");if(a%360){k.each(function(e,t){var n=this.getBBox().width;if(n>C)C=n});var L=Math.abs(Math.sin(a*Math.PI/180));var N=(L?L*C:C)+30;k.attr("transform",function(e,t,n){return"rotate("+a+" 0,0)"}).style("text-anchor",a%360>0?"start":"end")}S.enter().append("text").attr("class","nv-axislabel");var x=i.range().length==2?i.range()[1]:i.range()[i.range().length-1]+(i.range()[1]-i.range()[0]);S.attr("text-anchor","middle").attr("y",N).attr("x",x/2);if(o){var T=g.selectAll("g.nv-axisMaxMin").data([i.domain()[0],i.domain()[i.domain().length-1]]);T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+(i(e)+(c?i.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",e.tickPadding()).attr("transform",function(e,t,n){return"rotate("+a+" 0,0)"}).style("text-anchor",a?a%360>0?"start":"end":"middle").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+(i(e)+(c?i.rangeBand()/2:0))+",0)"})}if(l)k.attr("transform",function(e,t){return"translate(0,"+(t%2==0?"0":"12")+")"});break;case"right":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",f?"middle":"begin").attr("transform",f?"rotate(90)":"").attr("y",f?-Math.max(t.right,n)+12:-10).attr("x",f?i.range()[0]/2:e.tickPadding());if(o){var T=g.selectAll("g.nv-axisMaxMin").data(i.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+i(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",e.tickPadding()).style("text-anchor","start").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+i.range()[t]+")"}).select("text").style("opacity",1)}break;case"left":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",f?"middle":"end").attr("transform",f?"rotate(-90)":"").attr("y",f?-Math.max(t.left,n)+d:-10).attr("x",f?-i.range()[0]/2:-e.tickPadding());if(o){var T=g.selectAll("g.nv-axisMaxMin").data(i.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+v(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-e.tickPadding()).attr("text-anchor","end").text(function(e,t){var n=e;if(p){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+i.range()[t]+")"}).select("text").style("opacity",1)}break}S.text(function(e){return e});if(o&&(e.orient()==="left"||e.orient()==="right")){w.selectAll("g").each(function(e,t){d3.select(this).select("text").attr("opacity",1);var n;if(p){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(i(e)i.range()[0]-10){if(e>1e-10||e<-1e-10)d3.select(this).attr("opacity",0);d3.select(this).select("text").attr("opacity",0)}});if(i.domain()[0]==i.domain()[1]&&i.domain()[0]==0)g.selectAll("g.nv-axisMaxMin").style("opacity",function(e,t){return!t?1:0})}if(o&&(e.orient()==="top"||e.orient()==="bottom")){var A=[];g.selectAll("g.nv-axisMaxMin").each(function(e,t){try{if(t)A.push(i(e)-this.getBBox().width-4);else A.push(i(e)+this.getBBox().width+4)}catch(n){if(t)A.push(i(e)-4);else A.push(i(e)+4)}});w.selectAll("g").each(function(e,t){var n;if(p){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(i(e)A[1]){if(e>1e-10||e<-1e-10)d3.select(this).remove();else d3.select(this).select("text").remove()}})}if(u)w.selectAll(".tick").filter(function(e){return!parseFloat(Math.round(e.__data__*1e5)/1e6)&&e.__data__!==undefined}).classed("zero",true);v=i.copy()});return m}var e=d3.svg.axis();var t={top:0,right:0,bottom:0,left:0},n=75,r=60,i=d3.scale.linear(),s=null,o=true,u=true,a=0,f=true,l=false,c=false,h=null,p=false,d=12;e.scale(i).orient("bottom").tickFormat(function(e){return e});var v;m.axis=e;d3.rebind(m,e,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat");d3.rebind(m,i,"domain","range","rangeBand","rangeBands");m.options=nv.utils.optionsFunc.bind(m);m.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return m};m.width=function(e){if(!arguments.length)return n;n=e;return m};m.ticks=function(e){if(!arguments.length)return h;h=e;return m};m.height=function(e){if(!arguments.length)return r;r=e;return m};m.axisLabel=function(e){if(!arguments.length)return s;s=e;return m};m.showMaxMin=function(e){if(!arguments.length)return o;o=e;return m};m.logScale=function(e){if(!arguments.length)return p;p=e;return m};m.highlightZero=function(e){if(!arguments.length)return u;u=e;return m};m.scale=function(t){if(!arguments.length)return i;i=t;e.scale(i);c=typeof i.rangeBands==="function";d3.rebind(m,i,"domain","range","rangeBand","rangeBands");return m};m.rotateYLabel=function(e){if(!arguments.length)return f;f=e;return m};m.rotateLabels=function(e){if(!arguments.length)return a;a=e;return m};m.staggerLabels=function(e){if(!arguments.length)return l;l=e;return m};m.axisLabelDistance=function(e){if(!arguments.length)return d;d=e;return m};return m} \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/boilerplate.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/boilerplate.js new file mode 100644 index 0000000..3d2360a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/boilerplate.js @@ -0,0 +1,104 @@ + +nv.models.chartName = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + + var margin = {top: 30, right: 10, bottom: 10, left: 10} + , width = 960 + , height = 500 + , color = nv.utils.getColor(d3.scale.category20c().range()) + , dispatch = d3.dispatch('stateChange', 'changeState') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup Scales + + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-chartName').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-chartName'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + gEnter.append('g').attr('class', 'nv-mainWrap'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + + chart.dispatch = dispatch; + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_) + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/bullet.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/bullet.js new file mode 100644 index 0000000..9b9bf4d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/bullet.js @@ -0,0 +1,385 @@ + +// Chart design based on the recommendations of Stephen Few. Implementation +// based on the work of Clint Ivy, Jamie Love, and Jason Davies. +// http://projects.instantcognition.com/protovis/bulletchart/ + +nv.models.bullet = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , orient = 'left' // TODO top & bottom + , reverse = false + , ranges = function(d) { return d.ranges } + , markers = function(d) { return d.markers } + , measures = function(d) { return d.measures } + , rangeLabels = function(d) { return d.rangeLabels ? d.rangeLabels : [] } + , markerLabels = function(d) { return d.markerLabels ? d.markerLabels : [] } + , measureLabels = function(d) { return d.measureLabels ? d.measureLabels : [] } + , forceX = [0] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.) + , width = 380 + , height = 30 + , tickFormat = null + , color = nv.utils.getColor(['#1f77b4']) + , dispatch = d3.dispatch('elementMouseover', 'elementMouseout') + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(d, i) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + var rangez = ranges.call(this, d, i).slice().sort(d3.descending), + markerz = markers.call(this, d, i).slice().sort(d3.descending), + measurez = measures.call(this, d, i).slice().sort(d3.descending), + rangeLabelz = rangeLabels.call(this, d, i).slice(), + markerLabelz = markerLabels.call(this, d, i).slice(), + measureLabelz = measureLabels.call(this, d, i).slice(); + + + //------------------------------------------------------------ + // Setup Scales + + // Compute the new x-scale. + var x1 = d3.scale.linear() + .domain( d3.extent(d3.merge([forceX, rangez])) ) + .range(reverse ? [availableWidth, 0] : [0, availableWidth]); + + // Retrieve the old x-scale, if this is an update. + var x0 = this.__chart__ || d3.scale.linear() + .domain([0, Infinity]) + .range(x1.range()); + + // Stash the new scale. + this.__chart__ = x1; + + + var rangeMin = d3.min(rangez), //rangez[2] + rangeMax = d3.max(rangez), //rangez[0] + rangeAvg = rangez[1]; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-bullet').data([d]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bullet'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('rect').attr('class', 'nv-range nv-rangeMax'); + gEnter.append('rect').attr('class', 'nv-range nv-rangeAvg'); + gEnter.append('rect').attr('class', 'nv-range nv-rangeMin'); + gEnter.append('rect').attr('class', 'nv-measure'); + gEnter.append('path').attr('class', 'nv-markerTriangle'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0) + w1 = function(d) { return Math.abs(x1(d) - x1(0)) }; + var xp0 = function(d) { return d < 0 ? x0(d) : x0(0) }, + xp1 = function(d) { return d < 0 ? x1(d) : x1(0) }; + + + g.select('rect.nv-rangeMax') + .attr('height', availableHeight) + .attr('width', w1(rangeMax > 0 ? rangeMax : rangeMin)) + .attr('x', xp1(rangeMax > 0 ? rangeMax : rangeMin)) + .datum(rangeMax > 0 ? rangeMax : rangeMin) + /* + .attr('x', rangeMin < 0 ? + rangeMax > 0 ? + x1(rangeMin) + : x1(rangeMax) + : x1(0)) + */ + + g.select('rect.nv-rangeAvg') + .attr('height', availableHeight) + .attr('width', w1(rangeAvg)) + .attr('x', xp1(rangeAvg)) + .datum(rangeAvg) + /* + .attr('width', rangeMax <= 0 ? + x1(rangeMax) - x1(rangeAvg) + : x1(rangeAvg) - x1(rangeMin)) + .attr('x', rangeMax <= 0 ? + x1(rangeAvg) + : x1(rangeMin)) + */ + + g.select('rect.nv-rangeMin') + .attr('height', availableHeight) + .attr('width', w1(rangeMax)) + .attr('x', xp1(rangeMax)) + .attr('width', w1(rangeMax > 0 ? rangeMin : rangeMax)) + .attr('x', xp1(rangeMax > 0 ? rangeMin : rangeMax)) + .datum(rangeMax > 0 ? rangeMin : rangeMax) + /* + .attr('width', rangeMax <= 0 ? + x1(rangeAvg) - x1(rangeMin) + : x1(rangeMax) - x1(rangeAvg)) + .attr('x', rangeMax <= 0 ? + x1(rangeMin) + : x1(rangeAvg)) + */ + + g.select('rect.nv-measure') + .style('fill', color) + .attr('height', availableHeight / 3) + .attr('y', availableHeight / 3) + .attr('width', measurez < 0 ? + x1(0) - x1(measurez[0]) + : x1(measurez[0]) - x1(0)) + .attr('x', xp1(measurez)) + .on('mouseover', function() { + dispatch.elementMouseover({ + value: measurez[0], + label: measureLabelz[0] || 'Current', + pos: [x1(measurez[0]), availableHeight/2] + }) + }) + .on('mouseout', function() { + dispatch.elementMouseout({ + value: measurez[0], + label: measureLabelz[0] || 'Current' + }) + }) + + var h3 = availableHeight / 6; + if (markerz[0]) { + g.selectAll('path.nv-markerTriangle') + .attr('transform', function(d) { return 'translate(' + x1(markerz[0]) + ',' + (availableHeight / 2) + ')' }) + .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z') + .on('mouseover', function() { + dispatch.elementMouseover({ + value: markerz[0], + label: markerLabelz[0] || 'Previous', + pos: [x1(markerz[0]), availableHeight/2] + }) + }) + .on('mouseout', function() { + dispatch.elementMouseout({ + value: markerz[0], + label: markerLabelz[0] || 'Previous' + }) + }); + } else { + g.selectAll('path.nv-markerTriangle').remove(); + } + + + wrap.selectAll('.nv-range') + .on('mouseover', function(d,i) { + var label = rangeLabelz[i] || (!i ? "Maximum" : i == 1 ? "Mean" : "Minimum"); + + dispatch.elementMouseover({ + value: d, + label: label, + pos: [x1(d), availableHeight/2] + }) + }) + .on('mouseout', function(d,i) { + var label = rangeLabelz[i] || (!i ? "Maximum" : i == 1 ? "Mean" : "Minimum"); + + dispatch.elementMouseout({ + value: d, + label: label + }) + }) + +/* // THIS IS THE PREVIOUS BULLET IMPLEMENTATION, WILL REMOVE SHORTLY + // Update the range rects. + var range = g.selectAll('rect.nv-range') + .data(rangez); + + range.enter().append('rect') + .attr('class', function(d, i) { return 'nv-range nv-s' + i; }) + .attr('width', w0) + .attr('height', availableHeight) + .attr('x', reverse ? x0 : 0) + .on('mouseover', function(d,i) { + dispatch.elementMouseover({ + value: d, + label: (i <= 0) ? 'Maximum' : (i > 1) ? 'Minimum' : 'Mean', //TODO: make these labels a variable + pos: [x1(d), availableHeight/2] + }) + }) + .on('mouseout', function(d,i) { + dispatch.elementMouseout({ + value: d, + label: (i <= 0) ? 'Minimum' : (i >=1) ? 'Maximum' : 'Mean' //TODO: make these labels a variable + }) + }) + + d3.transition(range) + .attr('x', reverse ? x1 : 0) + .attr('width', w1) + .attr('height', availableHeight); + + + // Update the measure rects. + var measure = g.selectAll('rect.nv-measure') + .data(measurez); + + measure.enter().append('rect') + .attr('class', function(d, i) { return 'nv-measure nv-s' + i; }) + .style('fill', function(d,i) { return color(d,i ) }) + .attr('width', w0) + .attr('height', availableHeight / 3) + .attr('x', reverse ? x0 : 0) + .attr('y', availableHeight / 3) + .on('mouseover', function(d) { + dispatch.elementMouseover({ + value: d, + label: 'Current', //TODO: make these labels a variable + pos: [x1(d), availableHeight/2] + }) + }) + .on('mouseout', function(d) { + dispatch.elementMouseout({ + value: d, + label: 'Current' //TODO: make these labels a variable + }) + }) + + d3.transition(measure) + .attr('width', w1) + .attr('height', availableHeight / 3) + .attr('x', reverse ? x1 : 0) + .attr('y', availableHeight / 3); + + + + // Update the marker lines. + var marker = g.selectAll('path.nv-markerTriangle') + .data(markerz); + + var h3 = availableHeight / 6; + marker.enter().append('path') + .attr('class', 'nv-markerTriangle') + .attr('transform', function(d) { return 'translate(' + x0(d) + ',' + (availableHeight / 2) + ')' }) + .attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z') + .on('mouseover', function(d,i) { + dispatch.elementMouseover({ + value: d, + label: 'Previous', + pos: [x1(d), availableHeight/2] + }) + }) + .on('mouseout', function(d,i) { + dispatch.elementMouseout({ + value: d, + label: 'Previous' + }) + }); + + d3.transition(marker) + .attr('transform', function(d) { return 'translate(' + (x1(d) - x1(0)) + ',' + (availableHeight / 2) + ')' }); + + marker.exit().remove(); +*/ + + }); + + // d3.timer.flush(); // Not needed? + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.options = nv.utils.optionsFunc.bind(chart); + + // left, right, top, bottom + chart.orient = function(_) { + if (!arguments.length) return orient; + orient = _; + reverse = orient == 'right' || orient == 'bottom'; + return chart; + }; + + // ranges (bad, satisfactory, good) + chart.ranges = function(_) { + if (!arguments.length) return ranges; + ranges = _; + return chart; + }; + + // markers (previous, goal) + chart.markers = function(_) { + if (!arguments.length) return markers; + markers = _; + return chart; + }; + + // measures (actual, forecast) + chart.measures = function(_) { + if (!arguments.length) return measures; + measures = _; + return chart; + }; + + chart.forceX = function(_) { + if (!arguments.length) return forceX; + forceX = _; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.tickFormat = function(_) { + if (!arguments.length) return tickFormat; + tickFormat = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + //============================================================ + + + return chart; +}; + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/bulletChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/bulletChart.js new file mode 100644 index 0000000..fa5bd59 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/bulletChart.js @@ -0,0 +1,343 @@ + +// Chart design based on the recommendations of Stephen Few. Implementation +// based on the work of Clint Ivy, Jamie Love, and Jason Davies. +// http://projects.instantcognition.com/protovis/bulletchart/ +nv.models.bulletChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var bullet = nv.models.bullet() + ; + + var orient = 'left' // TODO top & bottom + , reverse = false + , margin = {top: 5, right: 40, bottom: 20, left: 120} + , ranges = function(d) { return d.ranges } + , markers = function(d) { return d.markers } + , measures = function(d) { return d.measures } + , width = null + , height = 55 + , tickFormat = null + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

          ' + x + '

          ' + + '

          ' + y + '

          ' + } + , noData = 'No Data Available.' + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ) + margin.left, + top = e.pos[1] + ( offsetElement.offsetTop || 0) + margin.top, + content = tooltip(e.key, e.label, e.value, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(d, i) { + var container = d3.select(this); + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + that = this; + + + chart.update = function() { chart(selection) }; + chart.container = this; + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!d || !ranges.call(this, d, i)) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', 18 + margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + + var rangez = ranges.call(this, d, i).slice().sort(d3.descending), + markerz = markers.call(this, d, i).slice().sort(d3.descending), + measurez = measures.call(this, d, i).slice().sort(d3.descending); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-bulletChart').data([d]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-bulletChart'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-bulletWrap'); + gEnter.append('g').attr('class', 'nv-titles'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + // Compute the new x-scale. + var x1 = d3.scale.linear() + .domain([0, Math.max(rangez[0], markerz[0], measurez[0])]) // TODO: need to allow forceX and forceY, and xDomain, yDomain + .range(reverse ? [availableWidth, 0] : [0, availableWidth]); + + // Retrieve the old x-scale, if this is an update. + var x0 = this.__chart__ || d3.scale.linear() + .domain([0, Infinity]) + .range(x1.range()); + + // Stash the new scale. + this.__chart__ = x1; + + /* + // Derive width-scales from the x-scales. + var w0 = bulletWidth(x0), + w1 = bulletWidth(x1); + + function bulletWidth(x) { + var x0 = x(0); + return function(d) { + return Math.abs(x(d) - x(0)); + }; + } + + function bulletTranslate(x) { + return function(d) { + return 'translate(' + x(d) + ',0)'; + }; + } + */ + + var w0 = function(d) { return Math.abs(x0(d) - x0(0)) }, // TODO: could optimize by precalculating x0(0) and x1(0) + w1 = function(d) { return Math.abs(x1(d) - x1(0)) }; + + + var title = gEnter.select('.nv-titles').append('g') + .attr('text-anchor', 'end') + .attr('transform', 'translate(-6,' + (height - margin.top - margin.bottom) / 2 + ')'); + title.append('text') + .attr('class', 'nv-title') + .text(function(d) { return d.title; }); + + title.append('text') + .attr('class', 'nv-subtitle') + .attr('dy', '1em') + .text(function(d) { return d.subtitle; }); + + + + bullet + .width(availableWidth) + .height(availableHeight) + + var bulletWrap = g.select('.nv-bulletWrap'); + + d3.transition(bulletWrap).call(bullet); + + + + // Compute the tick format. + var format = tickFormat || x1.tickFormat( availableWidth / 100 ); + + // Update the tick groups. + var tick = g.selectAll('g.nv-tick') + .data(x1.ticks( availableWidth / 50 ), function(d) { + return this.textContent || format(d); + }); + + // Initialize the ticks with the old scale, x0. + var tickEnter = tick.enter().append('g') + .attr('class', 'nv-tick') + .attr('transform', function(d) { return 'translate(' + x0(d) + ',0)' }) + .style('opacity', 1e-6); + + tickEnter.append('line') + .attr('y1', availableHeight) + .attr('y2', availableHeight * 7 / 6); + + tickEnter.append('text') + .attr('text-anchor', 'middle') + .attr('dy', '1em') + .attr('y', availableHeight * 7 / 6) + .text(format); + + + // Transition the updating ticks to the new scale, x1. + var tickUpdate = d3.transition(tick) + .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' }) + .style('opacity', 1); + + tickUpdate.select('line') + .attr('y1', availableHeight) + .attr('y2', availableHeight * 7 / 6); + + tickUpdate.select('text') + .attr('y', availableHeight * 7 / 6); + + // Transition the exiting ticks to the new scale, x1. + d3.transition(tick.exit()) + .attr('transform', function(d) { return 'translate(' + x1(d) + ',0)' }) + .style('opacity', 1e-6) + .remove(); + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + dispatch.on('tooltipShow', function(e) { + e.key = d.title; + if (tooltips) showTooltip(e, that.parentNode); + }); + + //============================================================ + + }); + + d3.timer.flush(); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + bullet.dispatch.on('elementMouseover.tooltip', function(e) { + dispatch.tooltipShow(e); + }); + + bullet.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + chart.bullet = bullet; + + d3.rebind(chart, bullet, 'color'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + // left, right, top, bottom + chart.orient = function(x) { + if (!arguments.length) return orient; + orient = x; + reverse = orient == 'right' || orient == 'bottom'; + return chart; + }; + + // ranges (bad, satisfactory, good) + chart.ranges = function(x) { + if (!arguments.length) return ranges; + ranges = x; + return chart; + }; + + // markers (previous, goal) + chart.markers = function(x) { + if (!arguments.length) return markers; + markers = x; + return chart; + }; + + // measures (actual, forecast) + chart.measures = function(x) { + if (!arguments.length) return measures; + measures = x; + return chart; + }; + + chart.width = function(x) { + if (!arguments.length) return width; + width = x; + return chart; + }; + + chart.height = function(x) { + if (!arguments.length) return height; + height = x; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.tickFormat = function(x) { + if (!arguments.length) return tickFormat; + tickFormat = x; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +}; + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/cumulativeLineChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/cumulativeLineChart.js new file mode 100644 index 0000000..00f193c --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/cumulativeLineChart.js @@ -0,0 +1,782 @@ + +nv.models.cumulativeLineChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var lines = nv.models.line() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + , controls = nv.models.legend() + , interactiveLayer = nv.interactiveGuideline() + ; + + var margin = {top: 30, right: 30, bottom: 50, left: 60} + , color = nv.utils.defaultColor() + , width = null + , height = null + , showLegend = true + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , tooltips = true + , showControls = true + , useInteractiveGuideline = false + , rescaleY = true + , tooltip = function(key, x, y, e, graph) { + return '

          ' + key + '

          ' + + '

          ' + y + ' at ' + x + '

          ' + } + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , id = lines.id() + , state = { index: 0, rescaleY: rescaleY } + , defaultState = null + , noData = 'No Data Available.' + , average = function(d) { return d.average } + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , transitionDuration = 250 + ; + + xAxis + .orient('bottom') + .tickPadding(7) + ; + yAxis + .orient((rightAlignYAxis) ? 'right' : 'left') + ; + + //============================================================ + controls.updateState(false); + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var dx = d3.scale.linear() + , index = {i: 0, x: 0} + ; + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, null, null, offsetElement); + }; + +/* + //Moved to see if we can get better behavior to fix issue #315 + var indexDrag = d3.behavior.drag() + .on('dragstart', dragStart) + .on('drag', dragMove) + .on('dragend', dragEnd); + + function dragStart(d,i) { + d3.select(chart.container) + .style('cursor', 'ew-resize'); + } + + function dragMove(d,i) { + d.x += d3.event.dx; + d.i = Math.round(dx.invert(d.x)); + + d3.select(this).attr('transform', 'translate(' + dx(d.i) + ',0)'); + chart.update(); + } + + function dragEnd(d,i) { + d3.select(chart.container) + .style('cursor', 'auto'); + chart.update(); + } +*/ + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this).classed('nv-chart-' + id, true), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + + chart.update = function() { container.transition().duration(transitionDuration).call(chart) }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + var indexDrag = d3.behavior.drag() + .on('dragstart', dragStart) + .on('drag', dragMove) + .on('dragend', dragEnd); + + + function dragStart(d,i) { + d3.select(chart.container) + .style('cursor', 'ew-resize'); + } + + function dragMove(d,i) { + index.x = d3.event.x; + index.i = Math.round(dx.invert(index.x)); + updateZero(); + } + + function dragEnd(d,i) { + d3.select(chart.container) + .style('cursor', 'auto'); + + // update state and send stateChange with new index + state.index = index.i; + dispatch.stateChange(state); + } + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = lines.xScale(); + y = lines.yScale(); + + + if (!rescaleY) { + var seriesDomains = data + .filter(function(series) { return !series.disabled }) + .map(function(series,i) { + var initialDomain = d3.extent(series.values, lines.y()); + + //account for series being disabled when losing 95% or more + if (initialDomain[0] < -.95) initialDomain[0] = -.95; + + return [ + (initialDomain[0] - initialDomain[1]) / (1 + initialDomain[1]), + (initialDomain[1] - initialDomain[0]) / (1 + initialDomain[0]) + ]; + }); + + var completeDomain = [ + d3.min(seriesDomains, function(d) { return d[0] }), + d3.max(seriesDomains, function(d) { return d[1] }) + ] + + lines.yDomain(completeDomain); + } else { + lines.yDomain(null); + } + + + dx .domain([0, data[0].values.length - 1]) //Assumes all series have same length + .range([0, availableWidth]) + .clamp(true); + + //------------------------------------------------------------ + + + var data = indexify(index.i, data); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + var interactivePointerEvents = (useInteractiveGuideline) ? "none" : "all"; + var wrap = container.selectAll('g.nv-wrap.nv-cumulativeLine').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-cumulativeLine').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-interactive'); + gEnter.append('g').attr('class', 'nv-x nv-axis').style("pointer-events","none"); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-background'); + gEnter.append('g').attr('class', 'nv-linesWrap').style("pointer-events",interactivePointerEvents); + gEnter.append('g').attr('class', 'nv-avgLinesWrap').style("pointer-events","none"); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')') + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + var controlsData = [ + { key: 'Re-scale y-axis', disabled: !rescaleY } + ]; + + controls.width(140).color(['#444', '#444', '#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + // Show error if series goes below 100% + var tempDisabled = data.filter(function(d) { return d.tempDisabled }); + + wrap.select('.tempDisabled').remove(); //clean-up and prevent duplicates + if (tempDisabled.length) { + wrap.append('text').attr('class', 'tempDisabled') + .attr('x', availableWidth / 2) + .attr('y', '-.71em') + .style('text-anchor', 'end') + .text(tempDisabled.map(function(d) { return d.key }).join(', ') + ' values cannot be calculated for this time period.'); + } + + //------------------------------------------------------------ + // Main Chart Component(s) + + //------------------------------------------------------------ + //Set up interactive layer + if (useInteractiveGuideline) { + interactiveLayer + .width(availableWidth) + .height(availableHeight) + .margin({left:margin.left,top:margin.top}) + .svgContainer(container) + .xScale(x); + wrap.select(".nv-interactive").call(interactiveLayer); + } + + gEnter.select('.nv-background') + .append('rect'); + + g.select('.nv-background rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + lines + //.x(function(d) { return d.x }) + .y(function(d) { return d.display.y }) + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && !data[i].tempDisabled; })); + + + + var linesWrap = g.select('.nv-linesWrap') + .datum(data.filter(function(d) { return !d.disabled && !d.tempDisabled })); + + //d3.transition(linesWrap).call(lines); + linesWrap.call(lines); + + /*Handle average lines [AN-612] ----------------------------*/ + + //Store a series index number in the data array. + data.forEach(function(d,i) { + d.seriesIndex = i; + }); + + var avgLineData = data.filter(function(d) { + return !d.disabled && !!average(d); + }); + + var avgLines = g.select(".nv-avgLinesWrap").selectAll("line") + .data(avgLineData, function(d) { return d.key; }); + + var getAvgLineY = function(d) { + //If average lines go off the svg element, clamp them to the svg bounds. + var yVal = y(average(d)); + if (yVal < 0) return 0; + if (yVal > availableHeight) return availableHeight; + return yVal; + }; + + avgLines.enter() + .append('line') + .style('stroke-width',2) + .style('stroke-dasharray','10,10') + .style('stroke',function (d,i) { + return lines.color()(d,d.seriesIndex); + }) + .attr('x1',0) + .attr('x2',availableWidth) + .attr('y1', getAvgLineY) + .attr('y2', getAvgLineY); + + avgLines + .style('stroke-opacity',function(d){ + //If average lines go offscreen, make them transparent + var yVal = y(average(d)); + if (yVal < 0 || yVal > availableHeight) return 0; + return 1; + }) + .attr('x1',0) + .attr('x2',availableWidth) + .attr('y1', getAvgLineY) + .attr('y2', getAvgLineY); + + avgLines.exit().remove(); + + //Create index line ----------------------------------------- + + var indexLine = linesWrap.selectAll('.nv-indexLine') + .data([index]); + indexLine.enter().append('rect').attr('class', 'nv-indexLine') + .attr('width', 3) + .attr('x', -2) + .attr('fill', 'red') + .attr('fill-opacity', .5) + .style("pointer-events","all") + .call(indexDrag) + + indexLine + .attr('transform', function(d) { return 'translate(' + dx(d.i) + ',0)' }) + .attr('height', availableHeight) + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + if (showXAxis) { + xAxis + .scale(x) + //Suggest how many ticks based on the chart width and D3 should listen (70 is the optimal number for MM/DD/YY dates) + .ticks( Math.min(data[0].values.length,availableWidth/70) ) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')'); + d3.transition(g.select('.nv-x.nv-axis')) + .call(xAxis); + } + + + if (showYAxis) { + yAxis + .scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + d3.transition(g.select('.nv-y.nv-axis')) + .call(yAxis); + } + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + + function updateZero() { + indexLine + .data([index]); + + //When dragging the index line, turn off line transitions. + // Then turn them back on when done dragging. + var oldDuration = chart.transitionDuration(); + chart.transitionDuration(0); + chart.update(); + chart.transitionDuration(oldDuration); + } + + g.select('.nv-background rect') + .on('click', function() { + index.x = d3.mouse(this)[0]; + index.i = Math.round(dx.invert(index.x)); + + // update state and send stateChange with new index + state.index = index.i; + dispatch.stateChange(state); + + updateZero(); + }); + + lines.dispatch.on('elementClick', function(e) { + index.i = e.pointIndex; + index.x = dx(index.i); + + // update state and send stateChange with new index + state.index = index.i; + dispatch.stateChange(state); + + updateZero(); + }); + + controls.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + rescaleY = !d.disabled; + + state.rescaleY = rescaleY; + dispatch.stateChange(state); + chart.update(); + }); + + + legend.dispatch.on('stateChange', function(newState) { + state.disabled = newState.disabled; + dispatch.stateChange(state); + chart.update(); + }); + + interactiveLayer.dispatch.on('elementMousemove', function(e) { + lines.clearHighlights(); + var singlePoint, pointIndex, pointXLocation, allData = []; + + + data + .filter(function(series, i) { + series.seriesIndex = i; + return !series.disabled; + }) + .forEach(function(series,i) { + pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x()); + lines.highlightPoint(i, pointIndex, true); + var point = series.values[pointIndex]; + if (typeof point === 'undefined') return; + if (typeof singlePoint === 'undefined') singlePoint = point; + if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex)); + allData.push({ + key: series.key, + value: chart.y()(point, pointIndex), + color: color(series,series.seriesIndex) + }); + }); + + //Highlight the tooltip entry based on which point the mouse is closest to. + if (allData.length > 2) { + var yValue = chart.yScale().invert(e.mouseY); + var domainExtent = Math.abs(chart.yScale().domain()[0] - chart.yScale().domain()[1]); + var threshold = 0.03 * domainExtent; + var indexToHighlight = nv.nearestValueIndex(allData.map(function(d){return d.value}),yValue,threshold); + if (indexToHighlight !== null) + allData[indexToHighlight].highlight = true; + } + + var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex), pointIndex); + interactiveLayer.tooltip + .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top}) + .chartContainer(that.parentNode) + .enabled(tooltips) + .valueFormatter(function(d,i) { + return yAxis.tickFormat()(d); + }) + .data( + { + value: xValue, + series: allData + } + )(); + + interactiveLayer.renderGuideLine(pointXLocation); + + }); + + interactiveLayer.dispatch.on("elementMouseout",function(e) { + dispatch.tooltipHide(); + lines.clearHighlights(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + + if (typeof e.index !== 'undefined') { + index.i = e.index; + index.x = dx(index.i); + + state.index = e.index; + + indexLine + .data([index]); + } + + + if (typeof e.rescaleY !== 'undefined') { + rescaleY = e.rescaleY; + } + + chart.update(); + }); + + //============================================================ + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.lines = lines; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + chart.interactiveLayer = interactiveLayer; + + d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'xScale','yScale', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi','useVoronoi', 'id'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.rescaleY = function(_) { + if (!arguments.length) return rescaleY; + rescaleY = _; + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.useInteractiveGuideline = function(_) { + if(!arguments.length) return useInteractiveGuideline; + useInteractiveGuideline = _; + if (_ === true) { + chart.interactive(false); + chart.useVoronoi(false); + } + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.average = function(_) { + if(!arguments.length) return average; + average = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + //============================================================ + + + //============================================================ + // Functions + //------------------------------------------------------------ + + /* Normalize the data according to an index point. */ + function indexify(idx, data) { + return data.map(function(line, i) { + if (!line.values) { + return line; + } + var v = lines.y()(line.values[idx], idx); + + //TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue + if (v < -.95) { + //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically correct till it hits 100) + line.tempDisabled = true; + return line; + } + + line.tempDisabled = false; + + line.values = line.values.map(function(point, pointIndex) { + point.display = {'y': (lines.y()(point, pointIndex) - v) / (1 + v) }; + return point; + }) + + return line; + }) + } + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/discreteBar.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/discreteBar.js new file mode 100644 index 0000000..a20f582 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/discreteBar.js @@ -0,0 +1,349 @@ +//TODO: consider deprecating by adding necessary features to multiBar model +nv.models.discreteBar = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , x = d3.scale.ordinal() + , y = d3.scale.linear() + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove + , color = nv.utils.defaultColor() + , showValues = false + , valueFormat = d3.format(',.2f') + , xDomain + , yDomain + , xRange + , yRange + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + , rectClass = 'discreteBar' + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + + //add series index to each data point for reference + data.forEach(function(series, i) { + series.values.forEach(function(point) { + point.series = i; + }); + }); + + + //------------------------------------------------------------ + // Setup Scales + + // remap and flatten the data for use in calculating the scales' domains + var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate + data.map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i), y0: d.y0 } + }) + }); + + x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x })) + .rangeBands(xRange || [0, availableWidth], .1); + + y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y }).concat(forceY))); + + + // If showValues, pad the Y axis range to account for label height + if (showValues) y.range(yRange || [availableHeight - (y.domain()[0] < 0 ? 12 : 0), y.domain()[1] > 0 ? 12 : 0]); + else y.range(yRange || [availableHeight, 0]); + + //store old scales if they exist + x0 = x0 || x; + y0 = y0 || y.copy().range([y(0),y(0)]); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-discretebar').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discretebar'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-groups'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + //TODO: by definition, the discrete bar should not have multiple groups, will modify/remove later + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d) { return d.key }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + groups.exit() + .transition() + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6) + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }); + groups + .transition() + .style('stroke-opacity', 1) + .style('fill-opacity', .75); + + + var bars = groups.selectAll('g.nv-bar') + .data(function(d) { return d.values }); + + bars.exit().remove(); + + + var barsEnter = bars.enter().append('g') + .attr('transform', function(d,i,j) { + return 'translate(' + (x(getX(d,i)) + x.rangeBand() * .05 ) + ', ' + y(0) + ')' + }) + .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('mouseout', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + value: getY(d,i), + point: d, + series: data[d.series], + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('click', function(d,i) { + dispatch.elementClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + dispatch.elementDblClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (d.series + .5) / data.length), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }); + + barsEnter.append('rect') + .attr('height', 0) + .attr('width', x.rangeBand() * .9 / data.length ) + + if (showValues) { + barsEnter.append('text') + .attr('text-anchor', 'middle') + ; + + bars.select('text') + .text(function(d,i) { return valueFormat(getY(d,i)) }) + .transition() + .attr('x', x.rangeBand() * .9 / 2) + .attr('y', function(d,i) { return getY(d,i) < 0 ? y(getY(d,i)) - y(0) + 12 : -4 }) + + ; + } else { + bars.selectAll('text').remove(); + } + + bars + .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive' }) + .style('fill', function(d,i) { return d.color || color(d,i) }) + .style('stroke', function(d,i) { return d.color || color(d,i) }) + .select('rect') + .attr('class', rectClass) + .transition() + .attr('width', x.rangeBand() * .9 / data.length); + bars.transition() + //.delay(function(d,i) { return i * 1200 / data[0].values.length }) + .attr('transform', function(d,i) { + var left = x(getX(d,i)) + x.rangeBand() * .05, + top = getY(d,i) < 0 ? + y(0) : + y(0) - y(getY(d,i)) < 1 ? + y(0) - 1 : //make 1 px positive bars show up above y=0 + y(getY(d,i)); + + return 'translate(' + left + ', ' + top + ')' + }) + .select('rect') + .attr('height', function(d,i) { + return Math.max(Math.abs(y(getY(d,i)) - y((yDomain && yDomain[0]) || 0)) || 1) + }); + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.xRange = function(_) { + if (!arguments.length) return xRange; + xRange = _; + return chart; + }; + + chart.yRange = function(_) { + if (!arguments.length) return yRange; + yRange = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.showValues = function(_) { + if (!arguments.length) return showValues; + showValues = _; + return chart; + }; + + chart.valueFormat= function(_) { + if (!arguments.length) return valueFormat; + valueFormat = _; + return chart; + }; + + chart.rectClass= function(_) { + if (!arguments.length) return rectClass; + rectClass = _; + return chart; + }; + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/discreteBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/discreteBarChart.js new file mode 100644 index 0000000..48a4816 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/discreteBarChart.js @@ -0,0 +1,333 @@ + +nv.models.discreteBarChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var discretebar = nv.models.discreteBar() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + ; + + var margin = {top: 15, right: 10, bottom: 50, left: 60} + , width = null + , height = null + , color = nv.utils.getColor() + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , staggerLabels = false + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

          ' + x + '

          ' + + '

          ' + y + '

          ' + } + , x + , y + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'beforeUpdate') + , transitionDuration = 250 + ; + + xAxis + .orient('bottom') + .highlightZero(false) + .showMaxMin(false) + .tickFormat(function(d) { return d }) + ; + yAxis + .orient((rightAlignYAxis) ? 'right' : 'left') + .tickFormat(d3.format(',.1f')) + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(discretebar.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(discretebar.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + + chart.update = function() { + dispatch.beforeUpdate(); + container.transition().duration(transitionDuration).call(chart); + }; + chart.container = this; + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = discretebar.xScale(); + y = discretebar.yScale().clamp(true); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-discreteBarWithAxes').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-discreteBarWithAxes').append('g'); + var defsEnter = gEnter.append('defs'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-barsWrap'); + + g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Main Chart Component(s) + + discretebar + .width(availableWidth) + .height(availableHeight); + + + var barsWrap = g.select('.nv-barsWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + barsWrap.transition().call(discretebar); + + //------------------------------------------------------------ + + + + defsEnter.append('clipPath') + .attr('id', 'nv-x-label-clip-' + discretebar.id()) + .append('rect'); + + g.select('#nv-x-label-clip-' + discretebar.id() + ' rect') + .attr('width', x.rangeBand() * (staggerLabels ? 2 : 1)) + .attr('height', 16) + .attr('x', -x.rangeBand() / (staggerLabels ? 1 : 2 )); + + + //------------------------------------------------------------ + // Setup Axes + + if (showXAxis) { + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + (y.range()[0] + ((discretebar.showValues() && y.domain()[0] < 0) ? 16 : 0)) + ')'); + //d3.transition(g.select('.nv-x.nv-axis')) + g.select('.nv-x.nv-axis').transition() + .call(xAxis); + + + var xTicks = g.select('.nv-x.nv-axis').selectAll('g'); + + if (staggerLabels) { + xTicks + .selectAll('text') + .attr('transform', function(d,i,j) { return 'translate(0,' + (j % 2 == 0 ? '5' : '17') + ')' }) + } + } + + if (showYAxis) { + yAxis + .scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-y.nv-axis').transition() + .call(yAxis); + } + + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + //============================================================ + + + }); + + return chart; + } + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + discretebar.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + discretebar.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.discretebar = discretebar; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, discretebar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'id', 'showValues', 'valueFormat'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + discretebar.color(color); + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + chart.staggerLabels = function(_) { + if (!arguments.length) return staggerLabels; + staggerLabels = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/distribution.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/distribution.js new file mode 100644 index 0000000..62a7465 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/distribution.js @@ -0,0 +1,148 @@ + +nv.models.distribution = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 400 //technically width or height depending on x or y.... + , size = 8 + , axis = 'x' // 'x' or 'y'... horizontal or vertical + , getData = function(d) { return d[axis] } // defaults d.x or d.y + , color = nv.utils.defaultColor() + , scale = d3.scale.linear() + , domain + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var scale0; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableLength = width - (axis === 'x' ? margin.left + margin.right : margin.top + margin.bottom), + naxis = axis == 'x' ? 'y' : 'x', + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup Scales + + scale0 = scale0 || scale; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-distribution').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-distribution'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')') + + //------------------------------------------------------------ + + + var distWrap = g.selectAll('g.nv-dist') + .data(function(d) { return d }, function(d) { return d.key }); + + distWrap.enter().append('g'); + distWrap + .attr('class', function(d,i) { return 'nv-dist nv-series-' + i }) + .style('stroke', function(d,i) { return color(d, i) }); + + var dist = distWrap.selectAll('line.nv-dist' + axis) + .data(function(d) { return d.values }) + dist.enter().append('line') + .attr(axis + '1', function(d,i) { return scale0(getData(d,i)) }) + .attr(axis + '2', function(d,i) { return scale0(getData(d,i)) }) + distWrap.exit().selectAll('line.nv-dist' + axis) + .transition() + .attr(axis + '1', function(d,i) { return scale(getData(d,i)) }) + .attr(axis + '2', function(d,i) { return scale(getData(d,i)) }) + .style('stroke-opacity', 0) + .remove(); + dist + .attr('class', function(d,i) { return 'nv-dist' + axis + ' nv-dist' + axis + '-' + i }) + .attr(naxis + '1', 0) + .attr(naxis + '2', size); + dist + .transition() + .attr(axis + '1', function(d,i) { return scale(getData(d,i)) }) + .attr(axis + '2', function(d,i) { return scale(getData(d,i)) }) + + + scale0 = scale.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.axis = function(_) { + if (!arguments.length) return axis; + axis = _; + return chart; + }; + + chart.size = function(_) { + if (!arguments.length) return size; + size = _; + return chart; + }; + + chart.getData = function(_) { + if (!arguments.length) return getData; + getData = d3.functor(_); + return chart; + }; + + chart.scale = function(_) { + if (!arguments.length) return scale; + scale = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/historicalBar.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/historicalBar.js new file mode 100644 index 0000000..2a6c644 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/historicalBar.js @@ -0,0 +1,331 @@ +//TODO: consider deprecating and using multibar with single series for this +nv.models.historicalBar = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , x = d3.scale.linear() + , y = d3.scale.linear() + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , forceX = [] + , forceY = [0] + , padData = false + , clipEdge = true + , color = nv.utils.defaultColor() + , xDomain + , yDomain + , xRange + , yRange + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + , interactive = true + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup Scales + + x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) )) + + if (padData) + x.range(xRange || [availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]); + else + x.range(xRange || [0, availableWidth]); + + y .domain(yDomain || d3.extent(data[0].values.map(getY).concat(forceY) )) + .range(yRange || [availableHeight, 0]); + + // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point + + if (x.domain()[0] === x.domain()[1]) + x.domain()[0] ? + x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) + : x.domain([-1,1]); + + if (y.domain()[0] === y.domain()[1]) + y.domain()[0] ? + y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01]) + : y.domain([-1,1]); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-historicalBar-' + id).data([data[0].values]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-historicalBar-' + id); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-bars'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + container + .on('click', function(d,i) { + dispatch.chartClick({ + data: d, + index: i, + pos: d3.event, + id: id + }); + }); + + + defsEnter.append('clipPath') + .attr('id', 'nv-chart-clip-path-' + id) + .append('rect'); + + wrap.select('#nv-chart-clip-path-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : ''); + + + + var bars = wrap.select('.nv-bars').selectAll('.nv-bar') + .data(function(d) { return d }, function(d,i) {return getX(d,i)}); + + bars.exit().remove(); + + + var barsEnter = bars.enter().append('rect') + //.attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i }) + .attr('x', 0 ) + .attr('y', function(d,i) { return nv.utils.NaNtoZero(y(Math.max(0, getY(d,i)))) }) + .attr('height', function(d,i) { return nv.utils.NaNtoZero(Math.abs(y(getY(d,i)) - y(0))) }) + .attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; }) + .on('mouseover', function(d,i) { + if (!interactive) return; + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + point: d, + series: data[0], + pos: [x(getX(d,i)), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: 0, + e: d3.event + }); + + }) + .on('mouseout', function(d,i) { + if (!interactive) return; + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + point: d, + series: data[0], + pointIndex: i, + seriesIndex: 0, + e: d3.event + }); + }) + .on('click', function(d,i) { + if (!interactive) return; + dispatch.elementClick({ + //label: d[label], + value: getY(d,i), + data: d, + index: i, + pos: [x(getX(d,i)), y(getY(d,i))], + e: d3.event, + id: id + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + if (!interactive) return; + dispatch.elementDblClick({ + //label: d[label], + value: getY(d,i), + data: d, + index: i, + pos: [x(getX(d,i)), y(getY(d,i))], + e: d3.event, + id: id + }); + d3.event.stopPropagation(); + }); + + bars + .attr('fill', function(d,i) { return color(d, i); }) + .attr('class', function(d,i,j) { return (getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive') + ' nv-bar-' + j + '-' + i }) + .transition() + .attr('transform', function(d,i) { return 'translate(' + (x(getX(d,i)) - availableWidth / data[0].values.length * .45) + ',0)'; }) + //TODO: better width calculations that don't assume always uniform data spacing;w + .attr('width', (availableWidth / data[0].values.length) * .9 ); + + + bars.transition() + .attr('y', function(d,i) { + var rval = getY(d,i) < 0 ? + y(0) : + y(0) - y(getY(d,i)) < 1 ? + y(0) - 1 : + y(getY(d,i)); + return nv.utils.NaNtoZero(rval); + }) + .attr('height', function(d,i) { return nv.utils.NaNtoZero(Math.max(Math.abs(y(getY(d,i)) - y(0)),1)) }); + + }); + + return chart; + } + + //Create methods to allow outside functions to highlight a specific bar. + chart.highlightPoint = function(pointIndex, isHoverOver) { + d3.select(".nv-historicalBar-" + id) + .select(".nv-bars .nv-bar-0-" + pointIndex) + .classed("hover", isHoverOver) + ; + }; + + chart.clearHighlights = function() { + d3.select(".nv-historicalBar-" + id) + .select(".nv-bars .nv-bar.hover") + .classed("hover", false) + ; + }; + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.xRange = function(_) { + if (!arguments.length) return xRange; + xRange = _; + return chart; + }; + + chart.yRange = function(_) { + if (!arguments.length) return yRange; + yRange = _; + return chart; + }; + + chart.forceX = function(_) { + if (!arguments.length) return forceX; + forceX = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.padData = function(_) { + if (!arguments.length) return padData; + padData = _; + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.interactive = function(_) { + if(!arguments.length) return interactive; + interactive = false; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/historicalBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/historicalBarChart.js new file mode 100644 index 0000000..a5b4a09 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/historicalBarChart.js @@ -0,0 +1,419 @@ + +nv.models.historicalBarChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var bars = nv.models.historicalBar() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + ; + + + var margin = {top: 30, right: 90, bottom: 50, left: 90} + , color = nv.utils.defaultColor() + , width = null + , height = null + , showLegend = false + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

          ' + key + '

          ' + + '

          ' + y + ' at ' + x + '

          ' + } + , x + , y + , state = {} + , defaultState = null + , noData = 'No Data Available.' + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , transitionDuration = 250 + ; + + xAxis + .orient('bottom') + .tickPadding(7) + ; + yAxis + .orient( (rightAlignYAxis) ? 'right' : 'left') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + + // New addition to calculate position if SVG is scaled with viewBox, may move TODO: consider implementing everywhere else + if (offsetElement) { + var svg = d3.select(offsetElement).select('svg'); + var viewBox = (svg.node()) ? svg.attr('viewBox') : null; + if (viewBox) { + viewBox = viewBox.split(' '); + var ratio = parseInt(svg.style('width')) / viewBox[2]; + e.pos[0] = e.pos[0] * ratio; + e.pos[1] = e.pos[1] * ratio; + } + } + + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(bars.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(bars.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, null, null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + + chart.update = function() { container.transition().duration(transitionDuration).call(chart) }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display noData message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = bars.xScale(); + y = bars.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-historicalBarChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-historicalBarChart').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-barsWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + wrap.select('.nv-legendWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')') + } + + //------------------------------------------------------------ + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + + //------------------------------------------------------------ + // Main Chart Component(s) + + bars + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + + + var barsWrap = g.select('.nv-barsWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + barsWrap.transition().call(bars); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + if (showXAxis) { + xAxis + .scale(x) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')'); + g.select('.nv-x.nv-axis') + .transition() + .call(xAxis); + } + + if (showYAxis) { + yAxis + .scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-y.nv-axis') + .transition() + .call(yAxis); + } + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + if (!data.filter(function(d) { return !d.disabled }).length) { + data.map(function(d) { + d.disabled = false; + wrap.selectAll('.nv-series').classed('disabled', false); + return d; + }); + } + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + + selection.transition().call(chart); + }); + + legend.dispatch.on('legendDblclick', function(d) { + //Double clicking should always enable current series, and disabled all others. + data.forEach(function(d) { + d.disabled = true; + }); + d.disabled = false; + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + selection.call(chart); + }); + + //============================================================ + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + bars.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + bars.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.bars = bars; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, bars, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale', + 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate','highlightPoint','clearHighlights', 'interactive'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/indentedTree.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/indentedTree.js new file mode 100644 index 0000000..18c2700 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/indentedTree.js @@ -0,0 +1,337 @@ +nv.models.indentedTree = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} //TODO: implement, maybe as margin on the containing div + , width = 960 + , height = 500 + , color = nv.utils.defaultColor() + , id = Math.floor(Math.random() * 10000) + , header = true + , filterZero = false + , noData = "No Data Available." + , childIndent = 20 + , columns = [{key:'key', label: 'Name', type:'text'}] //TODO: consider functions like chart.addColumn, chart.removeColumn, instead of a block like this + , tableClass = null + , iconOpen = 'images/grey-plus.png' //TODO: consider removing this and replacing with a '+' or '-' unless user defines images + , iconClose = 'images/grey-minus.png' + , dispatch = d3.dispatch('elementClick', 'elementDblclick', 'elementMouseover', 'elementMouseout') + , getUrl = function(d) { return d.url } + ; + + //============================================================ + + var idx = 0; + + function chart(selection) { + selection.each(function(data) { + var depth = 1, + container = d3.select(this); + + var tree = d3.layout.tree() + .children(function(d) { return d.values }) + .size([height, childIndent]); //Not sure if this is needed now that the result is HTML + + chart.update = function() { container.transition().duration(600).call(chart) }; + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + if (!data[0]) data[0] = {key: noData}; + + //------------------------------------------------------------ + + + var nodes = tree.nodes(data[0]); + + // nodes.map(function(d) { + // d.id = i++; + // }) + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = d3.select(this).selectAll('div').data([[nodes]]); + var wrapEnter = wrap.enter().append('div').attr('class', 'nvd3 nv-wrap nv-indentedtree'); + var tableEnter = wrapEnter.append('table'); + var table = wrap.select('table').attr('width', '100%').attr('class', tableClass); + + //------------------------------------------------------------ + + + if (header) { + var thead = tableEnter.append('thead'); + + var theadRow1 = thead.append('tr'); + + columns.forEach(function(column) { + theadRow1 + .append('th') + .attr('width', column.width ? column.width : '10%') + .style('text-align', column.type == 'numeric' ? 'right' : 'left') + .append('span') + .text(column.label); + }); + } + + + var tbody = table.selectAll('tbody') + .data(function(d) { return d }); + tbody.enter().append('tbody'); + + + + //compute max generations + depth = d3.max(nodes, function(node) { return node.depth }); + tree.size([height, depth * childIndent]); //TODO: see if this is necessary at all + + + // Update the nodes… + var node = tbody.selectAll('tr') + // .data(function(d) { return d; }, function(d) { return d.id || (d.id == ++i)}); + .data(function(d) { return d.filter(function(d) { return (filterZero && !d.children) ? filterZero(d) : true; } )}, function(d,i) { return d.id || (d.id || ++idx)}); + //.style('display', 'table-row'); //TODO: see if this does anything + + node.exit().remove(); + + node.select('img.nv-treeicon') + .attr('src', icon) + .classed('folded', folded); + + var nodeEnter = node.enter().append('tr'); + + + columns.forEach(function(column, index) { + + var nodeName = nodeEnter.append('td') + .style('padding-left', function(d) { return (index ? 0 : d.depth * childIndent + 12 + (icon(d) ? 0 : 16)) + 'px' }, 'important') //TODO: check why I did the ternary here + .style('text-align', column.type == 'numeric' ? 'right' : 'left'); + + + if (index == 0) { + nodeName.append('img') + .classed('nv-treeicon', true) + .classed('nv-folded', folded) + .attr('src', icon) + .style('width', '14px') + .style('height', '14px') + .style('padding', '0 1px') + .style('display', function(d) { return icon(d) ? 'inline-block' : 'none'; }) + .on('click', click); + } + + + nodeName.each(function(d) { + if (!index && getUrl(d)) + d3.select(this) + .append('a') + .attr('href',getUrl) + .attr('class', d3.functor(column.classes)) + .append('span') + else + d3.select(this) + .append('span') + + d3.select(this).select('span') + .attr('class', d3.functor(column.classes) ) + .text(function(d) { return column.format ? column.format(d) : + (d[column.key] || '-') }); + }); + + if (column.showCount) { + nodeName.append('span') + .attr('class', 'nv-childrenCount'); + + node.selectAll('span.nv-childrenCount').text(function(d) { + return ((d.values && d.values.length) || (d._values && d._values.length)) ? //If this is a parent + '(' + ((d.values && (d.values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length)) //If children are in values check its children and filter + || (d._values && d._values.filter(function(d) { return filterZero ? filterZero(d) : true; }).length) //Otherwise, do the same, but with the other name, _values... + || 0) + ')' //This is the catch-all in case there are no children after a filter + : '' //If this is not a parent, just give an empty string + }); + } + + // if (column.click) + // nodeName.select('span').on('click', column.click); + + }); + + node + .order() + .on('click', function(d) { + dispatch.elementClick({ + row: this, //TODO: decide whether or not this should be consistent with scatter/line events or should be an html link (a href) + data: d, + pos: [d.x, d.y] + }); + }) + .on('dblclick', function(d) { + dispatch.elementDblclick({ + row: this, + data: d, + pos: [d.x, d.y] + }); + }) + .on('mouseover', function(d) { + dispatch.elementMouseover({ + row: this, + data: d, + pos: [d.x, d.y] + }); + }) + .on('mouseout', function(d) { + dispatch.elementMouseout({ + row: this, + data: d, + pos: [d.x, d.y] + }); + }); + + + + + // Toggle children on click. + function click(d, _, unshift) { + d3.event.stopPropagation(); + + if(d3.event.shiftKey && !unshift) { + //If you shift-click, it'll toggle fold all the children, instead of itself + d3.event.shiftKey = false; + d.values && d.values.forEach(function(node){ + if (node.values || node._values) { + click(node, 0, true); + } + }); + return true; + } + if(!hasChildren(d)) { + //download file + //window.location.href = d.url; + return true; + } + if (d.values) { + d._values = d.values; + d.values = null; + } else { + d.values = d._values; + d._values = null; + } + chart.update(); + } + + + function icon(d) { + return (d._values && d._values.length) ? iconOpen : (d.values && d.values.length) ? iconClose : ''; + } + + function folded(d) { + return (d._values && d._values.length); + } + + function hasChildren(d) { + var values = d.values || d._values; + + return (values && values.length); + } + + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + scatter.color(color); + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.header = function(_) { + if (!arguments.length) return header; + header = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.filterZero = function(_) { + if (!arguments.length) return filterZero; + filterZero = _; + return chart; + }; + + chart.columns = function(_) { + if (!arguments.length) return columns; + columns = _; + return chart; + }; + + chart.tableClass = function(_) { + if (!arguments.length) return tableClass; + tableClass = _; + return chart; + }; + + chart.iconOpen = function(_){ + if (!arguments.length) return iconOpen; + iconOpen = _; + return chart; + } + + chart.iconClose = function(_){ + if (!arguments.length) return iconClose; + iconClose = _; + return chart; + } + + chart.getUrl = function(_){ + if (!arguments.length) return getUrl; + getUrl = _; + return chart; + } + + //============================================================ + + + return chart; +}; \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/legend.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/legend.js new file mode 100644 index 0000000..21f9f9a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/legend.js @@ -0,0 +1,270 @@ +nv.models.legend = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 5, right: 0, bottom: 5, left: 0} + , width = 400 + , height = 20 + , getKey = function(d) { return d.key } + , color = nv.utils.defaultColor() + , align = true + , rightAlign = true + , updateState = true //If true, legend will update data.disabled and trigger a 'stateChange' dispatch. + , radioButtonMode = false //If true, clicking legend items will cause it to behave like a radio button. (only one can be selected at a time) + , dispatch = d3.dispatch('legendClick', 'legendDblclick', 'legendMouseover', 'legendMouseout', 'stateChange') + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-legend').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-legend').append('g'); + var g = wrap.select('g'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + var series = g.selectAll('.nv-series') + .data(function(d) { return d }); + var seriesEnter = series.enter().append('g').attr('class', 'nv-series') + .on('mouseover', function(d,i) { + dispatch.legendMouseover(d,i); //TODO: Make consistent with other event objects + }) + .on('mouseout', function(d,i) { + dispatch.legendMouseout(d,i); + }) + .on('click', function(d,i) { + dispatch.legendClick(d,i); + if (updateState) { + if (radioButtonMode) { + //Radio button mode: set every series to disabled, + // and enable the clicked series. + data.forEach(function(series) { series.disabled = true}); + d.disabled = false; + } + else { + d.disabled = !d.disabled; + if (data.every(function(series) { return series.disabled})) { + //the default behavior of NVD3 legends is, if every single series + // is disabled, turn all series' back on. + data.forEach(function(series) { series.disabled = false}); + } + } + dispatch.stateChange({ + disabled: data.map(function(d) { return !!d.disabled }) + }); + } + }) + .on('dblclick', function(d,i) { + dispatch.legendDblclick(d,i); + if (updateState) { + //the default behavior of NVD3 legends, when double clicking one, + // is to set all other series' to false, and make the double clicked series enabled. + data.forEach(function(series) { + series.disabled = true; + }); + d.disabled = false; + dispatch.stateChange({ + disabled: data.map(function(d) { return !!d.disabled }) + }); + } + }); + seriesEnter.append('circle') + .style('stroke-width', 2) + .attr('class','nv-legend-symbol') + .attr('r', 5); + seriesEnter.append('text') + .attr('text-anchor', 'start') + .attr('class','nv-legend-text') + .attr('dy', '.32em') + .attr('dx', '8'); + series.classed('disabled', function(d) { return d.disabled }); + series.exit().remove(); + series.select('circle') + .style('fill', function(d,i) { return d.color || color(d,i)}) + .style('stroke', function(d,i) { return d.color || color(d, i) }); + series.select('text').text(getKey); + + + //TODO: implement fixed-width and max-width options (max-width is especially useful with the align option) + + // NEW ALIGNING CODE, TODO: clean up + if (align) { + + var seriesWidths = []; + series.each(function(d,i) { + var legendText = d3.select(this).select('text'); + var nodeTextLength; + try { + nodeTextLength = legendText.node().getComputedTextLength(); + } + catch(e) { + nodeTextLength = nv.utils.calcApproxTextWidth(legendText); + } + + seriesWidths.push(nodeTextLength + 28); // 28 is ~ the width of the circle plus some padding + }); + + var seriesPerRow = 0; + var legendWidth = 0; + var columnWidths = []; + + while ( legendWidth < availableWidth && seriesPerRow < seriesWidths.length) { + columnWidths[seriesPerRow] = seriesWidths[seriesPerRow]; + legendWidth += seriesWidths[seriesPerRow++]; + } + if (seriesPerRow === 0) seriesPerRow = 1; //minimum of one series per row + + + while ( legendWidth > availableWidth && seriesPerRow > 1 ) { + columnWidths = []; + seriesPerRow--; + + for (var k = 0; k < seriesWidths.length; k++) { + if (seriesWidths[k] > (columnWidths[k % seriesPerRow] || 0) ) + columnWidths[k % seriesPerRow] = seriesWidths[k]; + } + + legendWidth = columnWidths.reduce(function(prev, cur, index, array) { + return prev + cur; + }); + } + + var xPositions = []; + for (var i = 0, curX = 0; i < seriesPerRow; i++) { + xPositions[i] = curX; + curX += columnWidths[i]; + } + + series + .attr('transform', function(d, i) { + return 'translate(' + xPositions[i % seriesPerRow] + ',' + (5 + Math.floor(i / seriesPerRow) * 20) + ')'; + }); + + //position legend as far right as possible within the total width + if (rightAlign) { + g.attr('transform', 'translate(' + (width - margin.right - legendWidth) + ',' + margin.top + ')'); + } + else { + g.attr('transform', 'translate(0' + ',' + margin.top + ')'); + } + + height = margin.top + margin.bottom + (Math.ceil(seriesWidths.length / seriesPerRow) * 20); + + } else { + + var ypos = 5, + newxpos = 5, + maxwidth = 0, + xpos; + series + .attr('transform', function(d, i) { + var length = d3.select(this).select('text').node().getComputedTextLength() + 28; + xpos = newxpos; + + if (width < margin.left + margin.right + xpos + length) { + newxpos = xpos = 5; + ypos += 20; + } + + newxpos += length; + if (newxpos > maxwidth) maxwidth = newxpos; + + return 'translate(' + xpos + ',' + ypos + ')'; + }); + + //position legend as far right as possible within the total width + g.attr('transform', 'translate(' + (width - margin.right - maxwidth) + ',' + margin.top + ')'); + + height = margin.top + margin.bottom + ypos + 15; + + } + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.key = function(_) { + if (!arguments.length) return getKey; + getKey = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.align = function(_) { + if (!arguments.length) return align; + align = _; + return chart; + }; + + chart.rightAlign = function(_) { + if (!arguments.length) return rightAlign; + rightAlign = _; + return chart; + }; + + chart.updateState = function(_) { + if (!arguments.length) return updateState; + updateState = _; + return chart; + }; + + chart.radioButtonMode = function(_) { + if (!arguments.length) return radioButtonMode; + radioButtonMode = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/line.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/line.js new file mode 100644 index 0000000..855cc54 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/line.js @@ -0,0 +1,284 @@ + +nv.models.line = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var scatter = nv.models.scatter() + ; + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , color = nv.utils.defaultColor() // a function that returns a color + , getX = function(d) { return d.x } // accessor to get the x value from a data point + , getY = function(d) { return d.y } // accessor to get the y value from a data point + , defined = function(d,i) { return !isNaN(getY(d,i)) && getY(d,i) !== null } // allows a line to be not continuous when it is not defined + , isArea = function(d) { return d.area } // decides if a line is an area or just a line + , clipEdge = false // if true, masks lines within x and y scale + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , interpolate = "linear" // controls the line interpolation + ; + + scatter + .size(16) // default size + .sizeDomain([16,256]) //set to speed up calculation, needs to be unset if there is a custom size accessor + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0 //used to store previous scales + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + //------------------------------------------------------------ + // Setup Scales + + x = scatter.xScale(); + y = scatter.yScale(); + + x0 = x0 || x; + y0 = y0 || y; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-line').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-line'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + gEnter.append('g').attr('class', 'nv-groups'); + gEnter.append('g').attr('class', 'nv-scatterWrap'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + + scatter + .width(availableWidth) + .height(availableHeight) + + var scatterWrap = wrap.select('.nv-scatterWrap'); + //.datum(data); // Data automatically trickles down from the wrap + + scatterWrap.transition().call(scatter); + + + + defsEnter.append('clipPath') + .attr('id', 'nv-edge-clip-' + scatter.id()) + .append('rect'); + + wrap.select('#nv-edge-clip-' + scatter.id() + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : ''); + scatterWrap + .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + scatter.id() + ')' : ''); + + + + + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d) { return d.key }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + groups.exit() + .transition() + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6) + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }) + .style('fill', function(d,i){ return color(d, i) }) + .style('stroke', function(d,i){ return color(d, i)}); + groups + .transition() + .style('stroke-opacity', 1) + .style('fill-opacity', .5); + + + + var areaPaths = groups.selectAll('path.nv-area') + .data(function(d) { return isArea(d) ? [d] : [] }); // this is done differently than lines because I need to check if series is an area + areaPaths.enter().append('path') + .attr('class', 'nv-area') + .attr('d', function(d) { + return d3.svg.area() + .interpolate(interpolate) + .defined(defined) + .x(function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) }) + .y0(function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) }) + .y1(function(d,i) { return y0( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) }) + //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this + .apply(this, [d.values]) + }); + groups.exit().selectAll('path.nv-area') + .remove(); + + areaPaths + .transition() + .attr('d', function(d) { + return d3.svg.area() + .interpolate(interpolate) + .defined(defined) + .x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) }) + .y0(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) }) + .y1(function(d,i) { return y( y.domain()[0] <= 0 ? y.domain()[1] >= 0 ? 0 : y.domain()[1] : y.domain()[0] ) }) + //.y1(function(d,i) { return y0(0) }) //assuming 0 is within y domain.. may need to tweak this + .apply(this, [d.values]) + }); + + + + var linePaths = groups.selectAll('path.nv-line') + .data(function(d) { return [d.values] }); + linePaths.enter().append('path') + .attr('class', 'nv-line') + .attr('d', + d3.svg.line() + .interpolate(interpolate) + .defined(defined) + .x(function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) }) + .y(function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) }) + ); + groups.exit().selectAll('path.nv-line') + .transition() + .attr('d', + d3.svg.line() + .interpolate(interpolate) + .defined(defined) + .x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) }) + .y(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) }) + ); + linePaths + .transition() + .attr('d', + d3.svg.line() + .interpolate(interpolate) + .defined(defined) + .x(function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) }) + .y(function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) }) + ); + + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = scatter.dispatch; + chart.scatter = scatter; + + d3.rebind(chart, scatter, 'id', 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', + 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'useVoronoi', 'clipRadius', 'padData','highlightPoint','clearHighlights'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + scatter.x(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + scatter.y(_); + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + scatter.color(color); + return chart; + }; + + chart.interpolate = function(_) { + if (!arguments.length) return interpolate; + interpolate = _; + return chart; + }; + + chart.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return chart; + }; + + chart.isArea = function(_) { + if (!arguments.length) return isArea; + isArea = d3.functor(_); + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineChart.js new file mode 100644 index 0000000..a4ffcf6 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineChart.js @@ -0,0 +1,465 @@ + +nv.models.lineChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var lines = nv.models.line() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + , interactiveLayer = nv.interactiveGuideline() + ; + + var margin = {top: 30, right: 20, bottom: 50, left: 60} + , color = nv.utils.defaultColor() + , width = null + , height = null + , showLegend = true + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , useInteractiveGuideline = false + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

          ' + key + '

          ' + + '

          ' + y + ' at ' + x + '

          ' + } + , x + , y + , state = {} + , defaultState = null + , noData = 'No Data Available.' + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , transitionDuration = 250 + ; + + xAxis + .orient('bottom') + .tickPadding(7) + ; + yAxis + .orient((rightAlignYAxis) ? 'right' : 'left') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, null, null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + + chart.update = function() { container.transition().duration(transitionDuration).call(chart) }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display noData message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = lines.xScale(); + y = lines.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-lineChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g'); + var g = wrap.select('g'); + + gEnter.append("rect").style("opacity",0); + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-linesWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-interactive'); + + g.select("rect").attr("width",availableWidth).attr("height",availableHeight); + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + wrap.select('.nv-legendWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')') + } + + //------------------------------------------------------------ + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + //------------------------------------------------------------ + // Main Chart Component(s) + + + //------------------------------------------------------------ + //Set up interactive layer + if (useInteractiveGuideline) { + interactiveLayer + .width(availableWidth) + .height(availableHeight) + .margin({left:margin.left, top:margin.top}) + .svgContainer(container) + .xScale(x); + wrap.select(".nv-interactive").call(interactiveLayer); + } + + + lines + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + + + var linesWrap = g.select('.nv-linesWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + linesWrap.transition().call(lines); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + if (showXAxis) { + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')'); + g.select('.nv-x.nv-axis') + .transition() + .call(xAxis); + } + + if (showYAxis) { + yAxis + .scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-y.nv-axis') + .transition() + .call(yAxis); + } + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('stateChange', function(newState) { + state = newState; + dispatch.stateChange(state); + chart.update(); + }); + + interactiveLayer.dispatch.on('elementMousemove', function(e) { + lines.clearHighlights(); + var singlePoint, pointIndex, pointXLocation, allData = []; + data + .filter(function(series, i) { + series.seriesIndex = i; + return !series.disabled; + }) + .forEach(function(series,i) { + pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x()); + lines.highlightPoint(i, pointIndex, true); + var point = series.values[pointIndex]; + if (typeof point === 'undefined') return; + if (typeof singlePoint === 'undefined') singlePoint = point; + if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex)); + allData.push({ + key: series.key, + value: chart.y()(point, pointIndex), + color: color(series,series.seriesIndex) + }); + }); + //Highlight the tooltip entry based on which point the mouse is closest to. + if (allData.length > 2) { + var yValue = chart.yScale().invert(e.mouseY); + var domainExtent = Math.abs(chart.yScale().domain()[0] - chart.yScale().domain()[1]); + var threshold = 0.03 * domainExtent; + var indexToHighlight = nv.nearestValueIndex(allData.map(function(d){return d.value}),yValue,threshold); + if (indexToHighlight !== null) + allData[indexToHighlight].highlight = true; + } + + var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex)); + interactiveLayer.tooltip + .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top}) + .chartContainer(that.parentNode) + .enabled(tooltips) + .valueFormatter(function(d,i) { + return yAxis.tickFormat()(d); + }) + .data( + { + value: xValue, + series: allData + } + )(); + + interactiveLayer.renderGuideLine(pointXLocation); + + }); + + interactiveLayer.dispatch.on("elementMouseout",function(e) { + dispatch.tooltipHide(); + lines.clearHighlights(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + chart.update(); + }); + + //============================================================ + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.lines = lines; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + chart.interactiveLayer = interactiveLayer; + + d3.rebind(chart, lines, 'defined', 'isArea', 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'xRange', 'yRange' + , 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'useVoronoi','id', 'interpolate'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + chart.useInteractiveGuideline = function(_) { + if(!arguments.length) return useInteractiveGuideline; + useInteractiveGuideline = _; + if (_ === true) { + chart.interactive(false); + chart.useVoronoi(false); + } + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/linePlusBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/linePlusBarChart.js new file mode 100644 index 0000000..77fcbab --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/linePlusBarChart.js @@ -0,0 +1,433 @@ + +nv.models.linePlusBarChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var lines = nv.models.line() + , bars = nv.models.historicalBar() + , xAxis = nv.models.axis() + , y1Axis = nv.models.axis() + , y2Axis = nv.models.axis() + , legend = nv.models.legend() + ; + + var margin = {top: 30, right: 60, bottom: 50, left: 60} + , width = null + , height = null + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , color = nv.utils.defaultColor() + , showLegend = true + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

          ' + key + '

          ' + + '

          ' + y + ' at ' + x + '

          '; + } + , x + , y1 + , y2 + , state = {} + , defaultState = null + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + ; + + bars + .padData(true) + ; + lines + .clipEdge(false) + .padData(true) + ; + xAxis + .orient('bottom') + .tickPadding(7) + .highlightZero(false) + ; + y1Axis + .orient('left') + ; + y2Axis + .orient('right') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)), + y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + } + ; + + //------------------------------------------------------------ + + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().call(chart); }; + // chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + var dataBars = data.filter(function(d) { return !d.disabled && d.bar }); + var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240 + + //x = xAxis.scale(); + x = dataLines.filter(function(d) { return !d.disabled; }).length && dataLines.filter(function(d) { return !d.disabled; })[0].values.length ? lines.xScale() : bars.xScale(); + //x = dataLines.filter(function(d) { return !d.disabled; }).length ? lines.xScale() : bars.xScale(); //old code before change above + y1 = bars.yScale(); + y2 = lines.yScale(); + + //------------------------------------------------------------ + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = d3.select(this).selectAll('g.nv-wrap.nv-linePlusBar').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-linePlusBar').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y1 nv-axis'); + gEnter.append('g').attr('class', 'nv-y2 nv-axis'); + gEnter.append('g').attr('class', 'nv-barsWrap'); + gEnter.append('g').attr('class', 'nv-linesWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width( availableWidth / 2 ); + + g.select('.nv-legendWrap') + .datum(data.map(function(series) { + series.originalKey = series.originalKey === undefined ? series.key : series.originalKey; + series.key = series.originalKey + (series.bar ? ' (left axis)' : ' (right axis)'); + return series; + })) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Main Chart Component(s) + + + lines + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && !data[i].bar })) + + bars + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && data[i].bar })) + + + + var barsWrap = g.select('.nv-barsWrap') + .datum(dataBars.length ? dataBars : [{values:[]}]) + + var linesWrap = g.select('.nv-linesWrap') + .datum(dataLines[0] && !dataLines[0].disabled ? dataLines : [{values:[]}] ); + //.datum(!dataLines[0].disabled ? dataLines : [{values:dataLines[0].values.map(function(d) { return [d[0], null] }) }] ); + + d3.transition(barsWrap).call(bars); + d3.transition(linesWrap).call(lines); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y1.range()[0] + ')'); + d3.transition(g.select('.nv-x.nv-axis')) + .call(xAxis); + + + y1Axis + .scale(y1) + .ticks( availableHeight / 36 ) + .tickSize(-availableWidth, 0); + + d3.transition(g.select('.nv-y1.nv-axis')) + .style('opacity', dataBars.length ? 1 : 0) + .call(y1Axis); + + + y2Axis + .scale(y2) + .ticks( availableHeight / 36 ) + .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none + + g.select('.nv-y2.nv-axis') + .style('opacity', dataLines.length ? 1 : 0) + .attr('transform', 'translate(' + availableWidth + ',0)'); + //.attr('transform', 'translate(' + x.range()[1] + ',0)'); + + d3.transition(g.select('.nv-y2.nv-axis')) + .call(y2Axis); + + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('stateChange', function(newState) { + state = newState; + dispatch.stateChange(state); + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + chart.update(); + }); + + //============================================================ + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + bars.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + bars.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.legend = legend; + chart.lines = lines; + chart.bars = bars; + chart.xAxis = xAxis; + chart.y1Axis = y1Axis; + chart.y2Axis = y2Axis; + + d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate'); + //TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc. + //d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + lines.x(_); + bars.x(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + lines.y(_); + bars.y(_); + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/linePlusBarWithFocusChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/linePlusBarWithFocusChart.js new file mode 100644 index 0000000..2ef3113 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/linePlusBarWithFocusChart.js @@ -0,0 +1,658 @@ + +nv.models.linePlusBarWithFocusChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var lines = nv.models.line() + , lines2 = nv.models.line() + , bars = nv.models.historicalBar() + , bars2 = nv.models.historicalBar() + , xAxis = nv.models.axis() + , x2Axis = nv.models.axis() + , y1Axis = nv.models.axis() + , y2Axis = nv.models.axis() + , y3Axis = nv.models.axis() + , y4Axis = nv.models.axis() + , legend = nv.models.legend() + , brush = d3.svg.brush() + ; + + var margin = {top: 30, right: 30, bottom: 30, left: 60} + , margin2 = {top: 0, right: 30, bottom: 20, left: 60} + , width = null + , height = null + , height2 = 100 + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , color = nv.utils.defaultColor() + , showLegend = true + , extent + , brushExtent = null + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

          ' + key + '

          ' + + '

          ' + y + ' at ' + x + '

          '; + } + , x + , x2 + , y1 + , y2 + , y3 + , y4 + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush') + , transitionDuration = 0 + ; + + lines + .clipEdge(true) + ; + lines2 + .interactive(false) + ; + xAxis + .orient('bottom') + .tickPadding(5) + ; + y1Axis + .orient('left') + ; + y2Axis + .orient('right') + ; + x2Axis + .orient('bottom') + .tickPadding(5) + ; + y3Axis + .orient('left') + ; + y4Axis + .orient('right') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + if (extent) { + e.pointIndex += Math.ceil(extent[0]); + } + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)), + y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + //------------------------------------------------------------ + + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight1 = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom - height2, + availableHeight2 = height2 - margin2.top - margin2.bottom; + + chart.update = function() { container.transition().duration(transitionDuration).call(chart); }; + chart.container = this; + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight1 / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + var dataBars = data.filter(function(d) { return !d.disabled && d.bar }); + var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240 + + x = bars.xScale(); + x2 = x2Axis.scale(); + y1 = bars.yScale(); + y2 = lines.yScale(); + y3 = bars2.yScale(); + y4 = lines2.yScale(); + + var series1 = data + .filter(function(d) { return !d.disabled && d.bar }) + .map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i) } + }) + }); + + var series2 = data + .filter(function(d) { return !d.disabled && !d.bar }) + .map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i) } + }) + }); + + x .range([0, availableWidth]); + + x2 .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } )) + .range([0, availableWidth]); + + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-linePlusBar').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-linePlusBar').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-legendWrap'); + + var focusEnter = gEnter.append('g').attr('class', 'nv-focus'); + focusEnter.append('g').attr('class', 'nv-x nv-axis'); + focusEnter.append('g').attr('class', 'nv-y1 nv-axis'); + focusEnter.append('g').attr('class', 'nv-y2 nv-axis'); + focusEnter.append('g').attr('class', 'nv-barsWrap'); + focusEnter.append('g').attr('class', 'nv-linesWrap'); + + var contextEnter = gEnter.append('g').attr('class', 'nv-context'); + contextEnter.append('g').attr('class', 'nv-x nv-axis'); + contextEnter.append('g').attr('class', 'nv-y1 nv-axis'); + contextEnter.append('g').attr('class', 'nv-y2 nv-axis'); + contextEnter.append('g').attr('class', 'nv-barsWrap'); + contextEnter.append('g').attr('class', 'nv-linesWrap'); + contextEnter.append('g').attr('class', 'nv-brushBackground'); + contextEnter.append('g').attr('class', 'nv-x nv-brush'); + + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width( availableWidth / 2 ); + + g.select('.nv-legendWrap') + .datum(data.map(function(series) { + series.originalKey = series.originalKey === undefined ? series.key : series.originalKey; + series.key = series.originalKey + (series.bar ? ' (left axis)' : ' (right axis)'); + return series; + })) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight1 = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom - height2; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Context Components + + bars2 + .width(availableWidth) + .height(availableHeight2) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && data[i].bar })); + + lines2 + .width(availableWidth) + .height(availableHeight2) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && !data[i].bar })); + + var bars2Wrap = g.select('.nv-context .nv-barsWrap') + .datum(dataBars.length ? dataBars : [{values:[]}]); + + var lines2Wrap = g.select('.nv-context .nv-linesWrap') + .datum(!dataLines[0].disabled ? dataLines : [{values:[]}]); + + g.select('.nv-context') + .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')') + + bars2Wrap.transition().call(bars2); + lines2Wrap.transition().call(lines2); + + //------------------------------------------------------------ + + + + //------------------------------------------------------------ + // Setup Brush + + brush + .x(x2) + .on('brush', onBrush); + + if (brushExtent) brush.extent(brushExtent); + + var brushBG = g.select('.nv-brushBackground').selectAll('g') + .data([brushExtent || brush.extent()]) + + var brushBGenter = brushBG.enter() + .append('g'); + + brushBGenter.append('rect') + .attr('class', 'left') + .attr('x', 0) + .attr('y', 0) + .attr('height', availableHeight2); + + brushBGenter.append('rect') + .attr('class', 'right') + .attr('x', 0) + .attr('y', 0) + .attr('height', availableHeight2); + + var gBrush = g.select('.nv-x.nv-brush') + .call(brush); + gBrush.selectAll('rect') + //.attr('y', -5) + .attr('height', availableHeight2); + gBrush.selectAll('.resize').append('path').attr('d', resizePath); + + //------------------------------------------------------------ + + //------------------------------------------------------------ + // Setup Secondary (Context) Axes + + x2Axis + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight2, 0); + + g.select('.nv-context .nv-x.nv-axis') + .attr('transform', 'translate(0,' + y3.range()[0] + ')'); + g.select('.nv-context .nv-x.nv-axis').transition() + .call(x2Axis); + + + y3Axis + .scale(y3) + .ticks( availableHeight2 / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-context .nv-y1.nv-axis') + .style('opacity', dataBars.length ? 1 : 0) + .attr('transform', 'translate(0,' + x2.range()[0] + ')'); + + g.select('.nv-context .nv-y1.nv-axis').transition() + .call(y3Axis); + + + y4Axis + .scale(y4) + .ticks( availableHeight2 / 36 ) + .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none + + g.select('.nv-context .nv-y2.nv-axis') + .style('opacity', dataLines.length ? 1 : 0) + .attr('transform', 'translate(' + x2.range()[1] + ',0)'); + + g.select('.nv-context .nv-y2.nv-axis').transition() + .call(y4Axis); + + //------------------------------------------------------------ + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('stateChange', function(newState) { + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + //============================================================ + + + //============================================================ + // Functions + //------------------------------------------------------------ + + // Taken from crossfilter (http://square.github.com/crossfilter/) + function resizePath(d) { + var e = +(d == 'e'), + x = e ? 1 : -1, + y = availableHeight2 / 3; + return 'M' + (.5 * x) + ',' + y + + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6) + + 'V' + (2 * y - 6) + + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y) + + 'Z' + + 'M' + (2.5 * x) + ',' + (y + 8) + + 'V' + (2 * y - 8) + + 'M' + (4.5 * x) + ',' + (y + 8) + + 'V' + (2 * y - 8); + } + + + function updateBrushBG() { + if (!brush.empty()) brush.extent(brushExtent); + brushBG + .data([brush.empty() ? x2.domain() : brushExtent]) + .each(function(d,i) { + var leftWidth = x2(d[0]) - x2.range()[0], + rightWidth = x2.range()[1] - x2(d[1]); + d3.select(this).select('.left') + .attr('width', leftWidth < 0 ? 0 : leftWidth); + + d3.select(this).select('.right') + .attr('x', x2(d[1])) + .attr('width', rightWidth < 0 ? 0 : rightWidth); + }); + } + + + function onBrush() { + brushExtent = brush.empty() ? null : brush.extent(); + extent = brush.empty() ? x2.domain() : brush.extent(); + + + dispatch.brush({extent: extent, brush: brush}); + + updateBrushBG(); + + + //------------------------------------------------------------ + // Prepare Main (Focus) Bars and Lines + + bars + .width(availableWidth) + .height(availableHeight1) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && data[i].bar })); + + + lines + .width(availableWidth) + .height(availableHeight1) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled && !data[i].bar })); + + var focusBarsWrap = g.select('.nv-focus .nv-barsWrap') + .datum(!dataBars.length ? [{values:[]}] : + dataBars + .map(function(d,i) { + return { + key: d.key, + values: d.values.filter(function(d,i) { + return bars.x()(d,i) >= extent[0] && bars.x()(d,i) <= extent[1]; + }) + } + }) + ); + + var focusLinesWrap = g.select('.nv-focus .nv-linesWrap') + .datum(dataLines[0].disabled ? [{values:[]}] : + dataLines + .map(function(d,i) { + return { + key: d.key, + values: d.values.filter(function(d,i) { + return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1]; + }) + } + }) + ); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Update Main (Focus) X Axis + + if (dataBars.length) { + x = bars.xScale(); + } else { + x = lines.xScale(); + } + + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight1, 0); + + xAxis.domain([Math.ceil(extent[0]), Math.floor(extent[1])]); + + g.select('.nv-x.nv-axis').transition().duration(transitionDuration) + .call(xAxis); + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Update Main (Focus) Bars and Lines + + focusBarsWrap.transition().duration(transitionDuration).call(bars); + focusLinesWrap.transition().duration(transitionDuration).call(lines); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup and Update Main (Focus) Y Axes + + g.select('.nv-focus .nv-x.nv-axis') + .attr('transform', 'translate(0,' + y1.range()[0] + ')'); + + + y1Axis + .scale(y1) + .ticks( availableHeight1 / 36 ) + .tickSize(-availableWidth, 0); + + g.select('.nv-focus .nv-y1.nv-axis') + .style('opacity', dataBars.length ? 1 : 0); + + + y2Axis + .scale(y2) + .ticks( availableHeight1 / 36 ) + .tickSize(dataBars.length ? 0 : -availableWidth, 0); // Show the y2 rules only if y1 has none + + g.select('.nv-focus .nv-y2.nv-axis') + .style('opacity', dataLines.length ? 1 : 0) + .attr('transform', 'translate(' + x.range()[1] + ',0)'); + + g.select('.nv-focus .nv-y1.nv-axis').transition().duration(transitionDuration) + .call(y1Axis); + g.select('.nv-focus .nv-y2.nv-axis').transition().duration(transitionDuration) + .call(y2Axis); + } + + //============================================================ + + onBrush(); + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + bars.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + bars.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.legend = legend; + chart.lines = lines; + chart.lines2 = lines2; + chart.bars = bars; + chart.bars2 = bars2; + chart.xAxis = xAxis; + chart.x2Axis = x2Axis; + chart.y1Axis = y1Axis; + chart.y2Axis = y2Axis; + chart.y3Axis = y3Axis; + chart.y4Axis = y4Axis; + + d3.rebind(chart, lines, 'defined', 'size', 'clipVoronoi', 'interpolate'); + //TODO: consider rebinding x, y and some other stuff, and simply do soemthign lile bars.x(lines.x()), etc. + //d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + lines.x(_); + bars.x(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + lines.y(_); + bars.y(_); + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.brushExtent = function(_) { + if (!arguments.length) return brushExtent; + brushExtent = _; + return chart; + }; + + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFisheye.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFisheye.js new file mode 100644 index 0000000..2b41167 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFisheye.js @@ -0,0 +1,200 @@ + +nv.models.line = function() { + "use strict"; + //Default Settings + var margin = {top: 0, right: 0, bottom: 0, left: 0}, + width = 960, + height = 500, + color = nv.utils.defaultColor(), // function that returns colors + id = Math.floor(Math.random() * 10000), //Create semi-unique ID incase user doesn't select one + getX = function(d) { return d.x }, // accessor to get the x value from a data point + getY = function(d) { return d.y }, // accessor to get the y value from a data point + clipEdge = false, // if true, masks lines within x and y scale + interpolate = "linear"; // controls the line interpolation + + + var scatter = nv.models.scatter() + .id(id) + .size(16) // default size + .sizeDomain([16,256]), //set to speed up calculation, needs to be unset if there is a custom size accessor + //x = scatter.xScale(), + //y = scatter.yScale(), + x, y, + x0, y0, timeoutID; + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom; + + //get the scales inscase scatter scale was set manually + x = x || scatter.xScale(); + y = y || scatter.yScale(); + + //store old scales if they exist + x0 = x0 || x; + y0 = y0 || y; + + + var wrap = d3.select(this).selectAll('g.nv-wrap.nv-line').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-line'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + wrapEnter.append('g').attr('class', 'nv-scatterWrap'); + var scatterWrap = wrap.select('.nv-scatterWrap').datum(data); + + gEnter.append('g').attr('class', 'nv-groups'); + + + scatter + .width(availableWidth) + .height(availableHeight) + + d3.transition(scatterWrap).call(scatter); + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + defsEnter.append('clipPath') + .attr('id', 'nv-edge-clip-' + id) + .append('rect'); + + wrap.select('#nv-edge-clip-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); + scatterWrap + .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); + + + + + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d) { return d.key }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + d3.transition(groups.exit()) + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6) + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }) + .style('fill', function(d,i){ return color(d, i) }) + .style('stroke', function(d,i){ return color(d, i) }) + d3.transition(groups) + .style('stroke-opacity', 1) + .style('fill-opacity', .5) + + + var paths = groups.selectAll('path') + .data(function(d, i) { return [d.values] }); + paths.enter().append('path') + .attr('class', 'nv-line') + .attr('d', d3.svg.line() + .interpolate(interpolate) + .x(function(d,i) { return x0(getX(d,i)) }) + .y(function(d,i) { return y0(getY(d,i)) }) + ); + d3.transition(groups.exit().selectAll('path')) + .attr('d', d3.svg.line() + .interpolate(interpolate) + .x(function(d,i) { return x(getX(d,i)) }) + .y(function(d,i) { return y(getY(d,i)) }) + ) + .remove(); // redundant? line is already being removed + d3.transition(paths) + .attr('d', d3.svg.line() + .interpolate(interpolate) + .x(function(d,i) { return x(getX(d,i)) }) + .y(function(d,i) { return y(getY(d,i)) }) + ); + + + //store old scales for use in transitions on update, to animate from old to new positions + x0 = x.copy(); + y0 = y.copy(); + + }); + + return chart; + } + + + chart.dispatch = scatter.dispatch; + + d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin = _; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + scatter.x(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + scatter.y(_); + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + scatter.color(color); + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.interpolate = function(_) { + if (!arguments.length) return interpolate; + interpolate = _; + return chart; + }; + + chart.defined = function(_) { + if (!arguments.length) return defined; + defined = _; + return chart; + }; + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFisheyeChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFisheyeChart.js new file mode 100644 index 0000000..ad89419 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFisheyeChart.js @@ -0,0 +1,297 @@ + +nv.models.lineChart = function() { + "use strict"; + var margin = {top: 30, right: 20, bottom: 50, left: 60}, + color = nv.utils.defaultColor(), + width = null, + height = null, + showLegend = true, + showControls = true, + fisheye = 0, + pauseFisheye = false, + tooltips = true, + tooltip = function(key, x, y, e, graph) { + return '

          ' + key + '

          ' + + '

          ' + y + ' at ' + x + '

          ' + }, + noData = "No Data Available." + ; + + + var x = d3.fisheye.scale(d3.scale.linear).distortion(0); + + var lines = nv.models.line().xScale(x), + //x = lines.xScale(), + y = lines.yScale(), + xAxis = nv.models.axis().scale(x).orient('bottom').tickPadding(5), + yAxis = nv.models.axis().scale(y).orient('left'), + legend = nv.models.legend().height(30), + controls = nv.models.legend().height(30).updateState(false), + dispatch = d3.dispatch('tooltipShow', 'tooltipHide'); + + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, null, null, offsetElement); + }; + + + var controlsData = [ + { key: 'Magnify', disabled: true } + ]; + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().call(chart) }; + chart.container = this; // I need a reference to the container in order to have outside code check if the chart is visible or not + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + container.append('text') + .attr('class', 'nvd3 nv-noData') + .attr('x', availableWidth / 2) + .attr('y', availableHeight / 2) + .attr('dy', '-.7em') + .style('text-anchor', 'middle') + .text(noData); + return chart; + } else { + container.select('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + + var wrap = container.selectAll('g.nv-wrap.nv-lineChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineChart').append('g'); + + + gEnter.append('rect') + .attr('class', 'nvd3 nv-background') + .attr('width', availableWidth) + .attr('height', availableHeight); + + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-linesWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + + var g = wrap.select('g'); + + + + + if (showLegend) { + legend.width(availableWidth); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')') + } + + if (showControls) { + controls.width(180).color(['#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + + + lines + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + + + + g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + var linesWrap = g.select('.nv-linesWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + d3.transition(linesWrap).call(lines); + + + + xAxis + //.scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')'); + d3.transition(g.select('.nv-x.nv-axis')) + .call(xAxis); + + + yAxis + //.scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + d3.transition(g.select('.nv-y.nv-axis')) + .call(yAxis); + + + + g.select('.nv-background').on('mousemove', updateFisheye); + g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye; }); + //g.select('.point-paths').on('mousemove', updateFisheye); + + + function updateFisheye() { + if (pauseFisheye) { + //g.select('.background') .style('pointer-events', 'none'); + g.select('.nv-point-paths').style('pointer-events', 'all'); + return false; + } + + g.select('.nv-background') .style('pointer-events', 'all'); + g.select('.nv-point-paths').style('pointer-events', 'none' ); + + var mouse = d3.mouse(this); + linesWrap.call(lines); + g.select('.nv-x.nv-axis').call(xAxis); + x.distortion(fisheye).focus(mouse[0]); + } + + + controls.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + fisheye = d.disabled ? 0 : 5; + g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all'); + g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' ); + + //scatter.interactive(d.disabled); + //tooltips = d.disabled; + + if (d.disabled) { + x.distortion(fisheye).focus(0); + + linesWrap.call(lines); + g.select('.nv-x.nv-axis').call(xAxis); + } else { + pauseFisheye = false; + } + + chart.update(); + }); + + + legend.dispatch.on('stateChange', function(newState) { + chart.update(); + }); + + lines.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + if (tooltips) dispatch.on('tooltipShow', function(e) { showTooltip(e, that.parentNode) } ); // TODO: maybe merge with above? + + lines.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + if (tooltips) dispatch.on('tooltipHide', nv.tooltip.cleanup); + + }); + + return chart; + } + + + chart.dispatch = dispatch; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, lines, 'defined', 'x', 'y', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin = _; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFocusChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFocusChart.js new file mode 100644 index 0000000..0afd28b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/lineWithFocusChart.js @@ -0,0 +1,574 @@ +nv.models.lineWithFocusChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var lines = nv.models.line() + , lines2 = nv.models.line() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , x2Axis = nv.models.axis() + , y2Axis = nv.models.axis() + , legend = nv.models.legend() + , brush = d3.svg.brush() + ; + + var margin = {top: 30, right: 30, bottom: 30, left: 60} + , margin2 = {top: 0, right: 30, bottom: 20, left: 60} + , color = nv.utils.defaultColor() + , width = null + , height = null + , height2 = 100 + , x + , y + , x2 + , y2 + , showLegend = true + , brushExtent = null + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

          ' + key + '

          ' + + '

          ' + y + ' at ' + x + '

          ' + } + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush') + , transitionDuration = 250 + ; + + lines + .clipEdge(true) + ; + lines2 + .interactive(false) + ; + xAxis + .orient('bottom') + .tickPadding(5) + ; + yAxis + .orient('left') + ; + x2Axis + .orient('bottom') + .tickPadding(5) + ; + y2Axis + .orient('left') + ; + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, null, null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight1 = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom - height2, + availableHeight2 = height2 - margin2.top - margin2.bottom; + + chart.update = function() { container.transition().duration(transitionDuration).call(chart) }; + chart.container = this; + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight1 / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = lines.xScale(); + y = lines.yScale(); + x2 = lines2.xScale(); + y2 = lines2.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-lineWithFocusChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-lineWithFocusChart').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-legendWrap'); + + var focusEnter = gEnter.append('g').attr('class', 'nv-focus'); + focusEnter.append('g').attr('class', 'nv-x nv-axis'); + focusEnter.append('g').attr('class', 'nv-y nv-axis'); + focusEnter.append('g').attr('class', 'nv-linesWrap'); + + var contextEnter = gEnter.append('g').attr('class', 'nv-context'); + contextEnter.append('g').attr('class', 'nv-x nv-axis'); + contextEnter.append('g').attr('class', 'nv-y nv-axis'); + contextEnter.append('g').attr('class', 'nv-linesWrap'); + contextEnter.append('g').attr('class', 'nv-brushBackground'); + contextEnter.append('g').attr('class', 'nv-x nv-brush'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight1 = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom - height2; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')') + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Main Chart Component(s) + + lines + .width(availableWidth) + .height(availableHeight1) + .color( + data + .map(function(d,i) { + return d.color || color(d, i); + }) + .filter(function(d,i) { + return !data[i].disabled; + }) + ); + + lines2 + .defined(lines.defined()) + .width(availableWidth) + .height(availableHeight2) + .color( + data + .map(function(d,i) { + return d.color || color(d, i); + }) + .filter(function(d,i) { + return !data[i].disabled; + }) + ); + + g.select('.nv-context') + .attr('transform', 'translate(0,' + ( availableHeight1 + margin.bottom + margin2.top) + ')') + + var contextLinesWrap = g.select('.nv-context .nv-linesWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + d3.transition(contextLinesWrap).call(lines2); + + //------------------------------------------------------------ + + + /* + var focusLinesWrap = g.select('.nv-focus .nv-linesWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + d3.transition(focusLinesWrap).call(lines); + */ + + + //------------------------------------------------------------ + // Setup Main (Focus) Axes + + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight1, 0); + + yAxis + .scale(y) + .ticks( availableHeight1 / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-focus .nv-x.nv-axis') + .attr('transform', 'translate(0,' + availableHeight1 + ')'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Brush + + brush + .x(x2) + .on('brush', function() { + //When brushing, turn off transitions because chart needs to change immediately. + var oldTransition = chart.transitionDuration(); + chart.transitionDuration(0); + onBrush(); + chart.transitionDuration(oldTransition); + }); + + if (brushExtent) brush.extent(brushExtent); + + var brushBG = g.select('.nv-brushBackground').selectAll('g') + .data([brushExtent || brush.extent()]) + + var brushBGenter = brushBG.enter() + .append('g'); + + brushBGenter.append('rect') + .attr('class', 'left') + .attr('x', 0) + .attr('y', 0) + .attr('height', availableHeight2); + + brushBGenter.append('rect') + .attr('class', 'right') + .attr('x', 0) + .attr('y', 0) + .attr('height', availableHeight2); + + var gBrush = g.select('.nv-x.nv-brush') + .call(brush); + gBrush.selectAll('rect') + //.attr('y', -5) + .attr('height', availableHeight2); + gBrush.selectAll('.resize').append('path').attr('d', resizePath); + + onBrush(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Secondary (Context) Axes + + x2Axis + .scale(x2) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight2, 0); + + g.select('.nv-context .nv-x.nv-axis') + .attr('transform', 'translate(0,' + y2.range()[0] + ')'); + d3.transition(g.select('.nv-context .nv-x.nv-axis')) + .call(x2Axis); + + + y2Axis + .scale(y2) + .ticks( availableHeight2 / 36 ) + .tickSize( -availableWidth, 0); + + d3.transition(g.select('.nv-context .nv-y.nv-axis')) + .call(y2Axis); + + g.select('.nv-context .nv-x.nv-axis') + .attr('transform', 'translate(0,' + y2.range()[0] + ')'); + + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('stateChange', function(newState) { + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + //============================================================ + + + //============================================================ + // Functions + //------------------------------------------------------------ + + // Taken from crossfilter (http://square.github.com/crossfilter/) + function resizePath(d) { + var e = +(d == 'e'), + x = e ? 1 : -1, + y = availableHeight2 / 3; + return 'M' + (.5 * x) + ',' + y + + 'A6,6 0 0 ' + e + ' ' + (6.5 * x) + ',' + (y + 6) + + 'V' + (2 * y - 6) + + 'A6,6 0 0 ' + e + ' ' + (.5 * x) + ',' + (2 * y) + + 'Z' + + 'M' + (2.5 * x) + ',' + (y + 8) + + 'V' + (2 * y - 8) + + 'M' + (4.5 * x) + ',' + (y + 8) + + 'V' + (2 * y - 8); + } + + + function updateBrushBG() { + if (!brush.empty()) brush.extent(brushExtent); + brushBG + .data([brush.empty() ? x2.domain() : brushExtent]) + .each(function(d,i) { + var leftWidth = x2(d[0]) - x.range()[0], + rightWidth = x.range()[1] - x2(d[1]); + d3.select(this).select('.left') + .attr('width', leftWidth < 0 ? 0 : leftWidth); + + d3.select(this).select('.right') + .attr('x', x2(d[1])) + .attr('width', rightWidth < 0 ? 0 : rightWidth); + }); + } + + + function onBrush() { + brushExtent = brush.empty() ? null : brush.extent(); + var extent = brush.empty() ? x2.domain() : brush.extent(); + + //The brush extent cannot be less than one. If it is, don't update the line chart. + if (Math.abs(extent[0] - extent[1]) <= 1) { + return; + } + + dispatch.brush({extent: extent, brush: brush}); + + + updateBrushBG(); + + // Update Main (Focus) + var focusLinesWrap = g.select('.nv-focus .nv-linesWrap') + .datum( + data + .filter(function(d) { return !d.disabled }) + .map(function(d,i) { + return { + key: d.key, + values: d.values.filter(function(d,i) { + return lines.x()(d,i) >= extent[0] && lines.x()(d,i) <= extent[1]; + }) + } + }) + ); + focusLinesWrap.transition().duration(transitionDuration).call(lines); + + + // Update Main (Focus) Axes + g.select('.nv-focus .nv-x.nv-axis').transition().duration(transitionDuration) + .call(xAxis); + g.select('.nv-focus .nv-y.nv-axis').transition().duration(transitionDuration) + .call(yAxis); + } + + //============================================================ + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.legend = legend; + chart.lines = lines; + chart.lines2 = lines2; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + chart.x2Axis = x2Axis; + chart.y2Axis = y2Axis; + + d3.rebind(chart, lines, 'defined', 'isArea', 'size', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return lines.x; + lines.x(_); + lines2.x(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return lines.y; + lines.y(_); + lines2.y(_); + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.margin2 = function(_) { + if (!arguments.length) return margin2; + margin2 = _; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.height2 = function(_) { + if (!arguments.length) return height2; + height2 = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color =nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.interpolate = function(_) { + if (!arguments.length) return lines.interpolate(); + lines.interpolate(_); + lines2.interpolate(_); + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + // Chart has multiple similar Axes, to prevent code duplication, probably need to link all axis functions manually like below + chart.xTickFormat = function(_) { + if (!arguments.length) return xAxis.tickFormat(); + xAxis.tickFormat(_); + x2Axis.tickFormat(_); + return chart; + }; + + chart.yTickFormat = function(_) { + if (!arguments.length) return yAxis.tickFormat(); + yAxis.tickFormat(_); + y2Axis.tickFormat(_); + return chart; + }; + + chart.brushExtent = function(_) { + if (!arguments.length) return brushExtent; + brushExtent = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBar.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBar.js new file mode 100644 index 0000000..1085919 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBar.js @@ -0,0 +1,461 @@ + +nv.models.multiBar = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , x = d3.scale.ordinal() + , y = d3.scale.linear() + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove + , clipEdge = true + , stacked = false + , stackOffset = 'zero' // options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function + , color = nv.utils.defaultColor() + , hideable = false + , barColor = null // adding the ability to set the color for each rather than the whole group + , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled + , delay = 1200 + , xDomain + , yDomain + , xRange + , yRange + , groupSpacing = 0.1 + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0 //used to store previous scales + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + if(hideable && data.length) hideable = [{ + values: data[0].values.map(function(d) { + return { + x: d.x, + y: 0, + series: d.series, + size: 0.01 + };} + )}]; + + if (stacked) + data = d3.layout.stack() + .offset(stackOffset) + .values(function(d){ return d.values }) + .y(getY) + (!data.length && hideable ? hideable : data); + + + //add series index to each data point for reference + data.forEach(function(series, i) { + series.values.forEach(function(point) { + point.series = i; + }); + }); + + + //------------------------------------------------------------ + // HACK for negative value stacking + if (stacked) + data[0].values.map(function(d,i) { + var posBase = 0, negBase = 0; + data.map(function(d) { + var f = d.values[i] + f.size = Math.abs(f.y); + if (f.y<0) { + f.y1 = negBase; + negBase = negBase - f.size; + } else + { + f.y1 = f.size + posBase; + posBase = posBase + f.size; + } + }); + }); + + //------------------------------------------------------------ + // Setup Scales + + // remap and flatten the data for use in calculating the scales' domains + var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate + data.map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1 } + }) + }); + + x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x })) + .rangeBands(xRange || [0, availableWidth], groupSpacing); + + //y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y1 : 0) }).concat(forceY))) + y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 : d.y1 + d.y ) : d.y }).concat(forceY))) + .range(yRange || [availableHeight, 0]); + + // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point + if (x.domain()[0] === x.domain()[1]) + x.domain()[0] ? + x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) + : x.domain([-1,1]); + + if (y.domain()[0] === y.domain()[1]) + y.domain()[0] ? + y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01]) + : y.domain([-1,1]); + + + x0 = x0 || x; + y0 = y0 || y; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-multibar').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibar'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + gEnter.append('g').attr('class', 'nv-groups'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + defsEnter.append('clipPath') + .attr('id', 'nv-edge-clip-' + id) + .append('rect'); + wrap.select('#nv-edge-clip-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); + + + + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d,i) { return i }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + groups.exit() + .transition() + .selectAll('rect.nv-bar') + .delay(function(d,i) { + return i * delay/ data[0].values.length; + }) + .attr('y', function(d) { return stacked ? y0(d.y0) : y0(0) }) + .attr('height', 0) + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }) + .style('fill', function(d,i){ return color(d, i) }) + .style('stroke', function(d,i){ return color(d, i) }); + groups + .transition() + .style('stroke-opacity', 1) + .style('fill-opacity', .75); + + + var bars = groups.selectAll('rect.nv-bar') + .data(function(d) { return (hideable && !data.length) ? hideable.values : d.values }); + + bars.exit().remove(); + + + var barsEnter = bars.enter().append('rect') + .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'}) + .attr('x', function(d,i,j) { + return stacked ? 0 : (j * x.rangeBand() / data.length ) + }) + .attr('y', function(d) { return y0(stacked ? d.y0 : 0) }) + .attr('height', 0) + .attr('width', x.rangeBand() / (stacked ? 1 : data.length) ) + .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; }) + ; + bars + .style('fill', function(d,i,j){ return color(d, j, i); }) + .style('stroke', function(d,i,j){ return color(d, j, i); }) + .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('mouseout', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + value: getY(d,i), + point: d, + series: data[d.series], + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('click', function(d,i) { + dispatch.elementClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + dispatch.elementDblClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }); + bars + .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'}) + .transition() + .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',0)'; }) + + if (barColor) { + if (!disabled) disabled = data.map(function() { return true }); + bars + .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); }) + .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); }); + } + + + if (stacked) + bars.transition() + .delay(function(d,i) { + + return i * delay / data[0].values.length; + }) + .attr('y', function(d,i) { + + return y((stacked ? d.y1 : 0)); + }) + .attr('height', function(d,i) { + return Math.max(Math.abs(y(d.y + (stacked ? d.y0 : 0)) - y((stacked ? d.y0 : 0))),1); + }) + .attr('x', function(d,i) { + return stacked ? 0 : (d.series * x.rangeBand() / data.length ) + }) + .attr('width', x.rangeBand() / (stacked ? 1 : data.length) ); + else + bars.transition() + .delay(function(d,i) { + return i * delay/ data[0].values.length; + }) + .attr('x', function(d,i) { + return d.series * x.rangeBand() / data.length + }) + .attr('width', x.rangeBand() / data.length) + .attr('y', function(d,i) { + return getY(d,i) < 0 ? + y(0) : + y(0) - y(getY(d,i)) < 1 ? + y(0) - 1 : + y(getY(d,i)) || 0; + }) + .attr('height', function(d,i) { + return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) || 0; + }); + + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.xRange = function(_) { + if (!arguments.length) return xRange; + xRange = _; + return chart; + }; + + chart.yRange = function(_) { + if (!arguments.length) return yRange; + yRange = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.stacked = function(_) { + if (!arguments.length) return stacked; + stacked = _; + return chart; + }; + + chart.stackOffset = function(_) { + if (!arguments.length) return stackOffset; + stackOffset = _; + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.barColor = function(_) { + if (!arguments.length) return barColor; + barColor = nv.utils.getColor(_); + return chart; + }; + + chart.disabled = function(_) { + if (!arguments.length) return disabled; + disabled = _; + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.hideable = function(_) { + if (!arguments.length) return hideable; + hideable = _; + return chart; + }; + + chart.delay = function(_) { + if (!arguments.length) return delay; + delay = _; + return chart; + }; + + chart.groupSpacing = function(_) { + if (!arguments.length) return groupSpacing; + groupSpacing = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarChart.js new file mode 100644 index 0000000..0323063 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarChart.js @@ -0,0 +1,524 @@ + +nv.models.multiBarChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var multibar = nv.models.multiBar() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + , controls = nv.models.legend() + ; + + var margin = {top: 30, right: 20, bottom: 50, left: 60} + , width = null + , height = null + , color = nv.utils.defaultColor() + , showControls = true + , showLegend = true + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , reduceXTicks = true // if false a tick will show for every data point + , staggerLabels = false + , rotateLabels = 0 + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

          ' + key + '

          ' + + '

          ' + y + ' on ' + x + '

          ' + } + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , state = { stacked: false } + , defaultState = null + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , controlWidth = function() { return showControls ? 180 : 0 } + , transitionDuration = 250 + ; + + multibar + .stacked(false) + ; + xAxis + .orient('bottom') + .tickPadding(7) + .highlightZero(true) + .showMaxMin(false) + .tickFormat(function(d) { return d }) + ; + yAxis + .orient((rightAlignYAxis) ? 'right' : 'left') + .tickFormat(d3.format(',.1f')) + ; + + controls.updateState(false); + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().duration(transitionDuration).call(chart) }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + //------------------------------------------------------------ + // Display noData message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = multibar.xScale(); + y = multibar.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-multiBarWithLegend').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarWithLegend').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-barsWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth - controlWidth()); + + if (multibar.barColor()) + data.forEach(function(series,i) { + series.color = d3.rgb('#ccc').darker(i * 1.5).toString(); + }) + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + var controlsData = [ + { key: 'Grouped', disabled: multibar.stacked() }, + { key: 'Stacked', disabled: !multibar.stacked() } + ]; + + controls.width(controlWidth()).color(['#444', '#444', '#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + //------------------------------------------------------------ + // Main Chart Component(s) + + multibar + .disabled(data.map(function(series) { return series.disabled })) + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })) + + + var barsWrap = g.select('.nv-barsWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + barsWrap.transition().call(multibar); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + if (showXAxis) { + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')'); + g.select('.nv-x.nv-axis').transition() + .call(xAxis); + + var xTicks = g.select('.nv-x.nv-axis > g').selectAll('g'); + + xTicks + .selectAll('line, text') + .style('opacity', 1) + + if (staggerLabels) { + var getTranslate = function(x,y) { + return "translate(" + x + "," + y + ")"; + }; + + var staggerUp = 5, staggerDown = 17; //pixels to stagger by + // Issue #140 + xTicks + .selectAll("text") + .attr('transform', function(d,i,j) { + return getTranslate(0, (j % 2 == 0 ? staggerUp : staggerDown)); + }); + + var totalInBetweenTicks = d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length; + g.selectAll(".nv-x.nv-axis .nv-axisMaxMin text") + .attr("transform", function(d,i) { + return getTranslate(0, (i === 0 || totalInBetweenTicks % 2 !== 0) ? staggerDown : staggerUp); + }); + } + + if (reduceXTicks) + xTicks + .filter(function(d,i) { + return i % Math.ceil(data[0].values.length / (availableWidth / 100)) !== 0; + }) + .selectAll('text, line') + .style('opacity', 0); + + if(rotateLabels) + xTicks + .selectAll('.tick text') + .attr('transform', 'rotate(' + rotateLabels + ' 0,0)') + .style('text-anchor', rotateLabels > 0 ? 'start' : 'end'); + + g.select('.nv-x.nv-axis').selectAll('g.nv-axisMaxMin text') + .style('opacity', 1); + } + + + if (showYAxis) { + yAxis + .scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-y.nv-axis').transition() + .call(yAxis); + } + + + //------------------------------------------------------------ + + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('stateChange', function(newState) { + state = newState; + dispatch.stateChange(state); + chart.update(); + }); + + controls.dispatch.on('legendClick', function(d,i) { + if (!d.disabled) return; + controlsData = controlsData.map(function(s) { + s.disabled = true; + return s; + }); + d.disabled = false; + + switch (d.key) { + case 'Grouped': + multibar.stacked(false); + break; + case 'Stacked': + multibar.stacked(true); + break; + } + + state.stacked = multibar.stacked(); + dispatch.stateChange(state); + + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode) + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + if (typeof e.stacked !== 'undefined') { + multibar.stacked(e.stacked); + state.stacked = e.stacked; + } + + chart.update(); + }); + + //============================================================ + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + multibar.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + multibar.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.multibar = multibar; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'clipEdge', + 'id', 'stacked', 'stackOffset', 'delay', 'barColor','groupSpacing'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + chart.reduceXTicks= function(_) { + if (!arguments.length) return reduceXTicks; + reduceXTicks = _; + return chart; + }; + + chart.rotateLabels = function(_) { + if (!arguments.length) return rotateLabels; + rotateLabels = _; + return chart; + } + + chart.staggerLabels = function(_) { + if (!arguments.length) return staggerLabels; + staggerLabels = _; + return chart; + }; + + chart.tooltip = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarHorizontal.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarHorizontal.js new file mode 100644 index 0000000..d16d460 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarHorizontal.js @@ -0,0 +1,424 @@ + +nv.models.multiBarHorizontal = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , x = d3.scale.ordinal() + , y = d3.scale.linear() + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove + , color = nv.utils.defaultColor() + , barColor = null // adding the ability to set the color for each rather than the whole group + , disabled // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled + , stacked = false + , showValues = false + , valuePadding = 60 + , valueFormat = d3.format(',.2f') + , delay = 1200 + , xDomain + , yDomain + , xRange + , yRange + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0 //used to store previous scales + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + + if (stacked) + data = d3.layout.stack() + .offset('zero') + .values(function(d){ return d.values }) + .y(getY) + (data); + + + //add series index to each data point for reference + data.forEach(function(series, i) { + series.values.forEach(function(point) { + point.series = i; + }); + }); + + + + //------------------------------------------------------------ + // HACK for negative value stacking + if (stacked) + data[0].values.map(function(d,i) { + var posBase = 0, negBase = 0; + data.map(function(d) { + var f = d.values[i] + f.size = Math.abs(f.y); + if (f.y<0) { + f.y1 = negBase - f.size; + negBase = negBase - f.size; + } else + { + f.y1 = posBase; + posBase = posBase + f.size; + } + }); + }); + + + + //------------------------------------------------------------ + // Setup Scales + + // remap and flatten the data for use in calculating the scales' domains + var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate + data.map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i), y0: d.y0, y1: d.y1 } + }) + }); + + x .domain(xDomain || d3.merge(seriesData).map(function(d) { return d.x })) + .rangeBands(xRange || [0, availableHeight], .1); + + //y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y0 : 0) }).concat(forceY))) + y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return stacked ? (d.y > 0 ? d.y1 + d.y : d.y1 ) : d.y }).concat(forceY))) + + if (showValues && !stacked) + y.range(yRange || [(y.domain()[0] < 0 ? valuePadding : 0), availableWidth - (y.domain()[1] > 0 ? valuePadding : 0) ]); + else + y.range(yRange || [0, availableWidth]); + + x0 = x0 || x; + y0 = y0 || d3.scale.linear().domain(y.domain()).range([y(0),y(0)]); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = d3.select(this).selectAll('g.nv-wrap.nv-multibarHorizontal').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibarHorizontal'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-groups'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d,i) { return i }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + groups.exit().transition() + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6) + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }) + .style('fill', function(d,i){ return color(d, i) }) + .style('stroke', function(d,i){ return color(d, i) }); + groups.transition() + .style('stroke-opacity', 1) + .style('fill-opacity', .75); + + + var bars = groups.selectAll('g.nv-bar') + .data(function(d) { return d.values }); + + bars.exit().remove(); + + + var barsEnter = bars.enter().append('g') + .attr('transform', function(d,i,j) { + return 'translate(' + y0(stacked ? d.y0 : 0) + ',' + (stacked ? 0 : (j * x.rangeBand() / data.length ) + x(getX(d,i))) + ')' + }); + + barsEnter.append('rect') + .attr('width', 0) + .attr('height', x.rangeBand() / (stacked ? 1 : data.length) ) + + bars + .on('mouseover', function(d,i) { //TODO: figure out why j works above, but not here + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [ y(getY(d,i) + (stacked ? d.y0 : 0)), x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length) ], + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('mouseout', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + value: getY(d,i), + point: d, + series: data[d.series], + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + }) + .on('click', function(d,i) { + dispatch.elementClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + dispatch.elementDblClick({ + value: getY(d,i), + point: d, + series: data[d.series], + pos: [x(getX(d,i)) + (x.rangeBand() * (stacked ? data.length / 2 : d.series + .5) / data.length), y(getY(d,i) + (stacked ? d.y0 : 0))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: d.series, + e: d3.event + }); + d3.event.stopPropagation(); + }); + + + barsEnter.append('text'); + + if (showValues && !stacked) { + bars.select('text') + .attr('text-anchor', function(d,i) { return getY(d,i) < 0 ? 'end' : 'start' }) + .attr('y', x.rangeBand() / (data.length * 2)) + .attr('dy', '.32em') + .text(function(d,i) { return valueFormat(getY(d,i)) }) + bars.transition() + .select('text') + .attr('x', function(d,i) { return getY(d,i) < 0 ? -4 : y(getY(d,i)) - y(0) + 4 }) + } else { + bars.selectAll('text').text(''); + } + + bars + .attr('class', function(d,i) { return getY(d,i) < 0 ? 'nv-bar negative' : 'nv-bar positive'}) + + if (barColor) { + if (!disabled) disabled = data.map(function() { return true }); + bars + .style('fill', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); }) + .style('stroke', function(d,i,j) { return d3.rgb(barColor(d,i)).darker( disabled.map(function(d,i) { return i }).filter(function(d,i){ return !disabled[i] })[j] ).toString(); }); + } + + if (stacked) + bars.transition() + .attr('transform', function(d,i) { + return 'translate(' + y(d.y1) + ',' + x(getX(d,i)) + ')' + }) + .select('rect') + .attr('width', function(d,i) { + return Math.abs(y(getY(d,i) + d.y0) - y(d.y0)) + }) + .attr('height', x.rangeBand() ); + else + bars.transition() + .attr('transform', function(d,i) { + //TODO: stacked must be all positive or all negative, not both? + return 'translate(' + + (getY(d,i) < 0 ? y(getY(d,i)) : y(0)) + + ',' + + (d.series * x.rangeBand() / data.length + + + x(getX(d,i)) ) + + ')' + }) + .select('rect') + .attr('height', x.rangeBand() / data.length ) + .attr('width', function(d,i) { + return Math.max(Math.abs(y(getY(d,i)) - y(0)),1) + }); + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.xRange = function(_) { + if (!arguments.length) return xRange; + xRange = _; + return chart; + }; + + chart.yRange = function(_) { + if (!arguments.length) return yRange; + yRange = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.stacked = function(_) { + if (!arguments.length) return stacked; + stacked = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.barColor = function(_) { + if (!arguments.length) return barColor; + barColor = nv.utils.getColor(_); + return chart; + }; + + chart.disabled = function(_) { + if (!arguments.length) return disabled; + disabled = _; + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.delay = function(_) { + if (!arguments.length) return delay; + delay = _; + return chart; + }; + + chart.showValues = function(_) { + if (!arguments.length) return showValues; + showValues = _; + return chart; + }; + + chart.valueFormat= function(_) { + if (!arguments.length) return valueFormat; + valueFormat = _; + return chart; + }; + + chart.valuePadding = function(_) { + if (!arguments.length) return valuePadding; + valuePadding = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarHorizontalChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarHorizontalChart.js new file mode 100644 index 0000000..02aa6fa --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarHorizontalChart.js @@ -0,0 +1,434 @@ + +nv.models.multiBarHorizontalChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var multibar = nv.models.multiBarHorizontal() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend().height(30) + , controls = nv.models.legend().height(30) + ; + + var margin = {top: 30, right: 20, bottom: 50, left: 60} + , width = null + , height = null + , color = nv.utils.defaultColor() + , showControls = true + , showLegend = true + , stacked = false + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

          ' + key + ' - ' + x + '

          ' + + '

          ' + y + '

          ' + } + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , state = { stacked: stacked } + , defaultState = null + , noData = 'No Data Available.' + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , controlWidth = function() { return showControls ? 180 : 0 } + , transitionDuration = 250 + ; + + multibar + .stacked(stacked) + ; + xAxis + .orient('left') + .tickPadding(5) + .highlightZero(false) + .showMaxMin(false) + .tickFormat(function(d) { return d }) + ; + yAxis + .orient('bottom') + .tickFormat(d3.format(',.1f')) + ; + + controls.updateState(false); + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'e' : 'w', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().duration(transitionDuration).call(chart) }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = multibar.xScale(); + y = multibar.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-multiBarHorizontalChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarHorizontalChart').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-barsWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth - controlWidth()); + + if (multibar.barColor()) + data.forEach(function(series,i) { + series.color = d3.rgb('#ccc').darker(i * 1.5).toString(); + }) + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(' + controlWidth() + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + var controlsData = [ + { key: 'Grouped', disabled: multibar.stacked() }, + { key: 'Stacked', disabled: !multibar.stacked() } + ]; + + controls.width(controlWidth()).color(['#444', '#444', '#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Main Chart Component(s) + + multibar + .disabled(data.map(function(series) { return series.disabled })) + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })) + + + var barsWrap = g.select('.nv-barsWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + barsWrap.transition().call(multibar); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + xAxis + .scale(x) + .ticks( availableHeight / 24 ) + .tickSize(-availableWidth, 0); + + g.select('.nv-x.nv-axis').transition() + .call(xAxis); + + var xTicks = g.select('.nv-x.nv-axis').selectAll('g'); + + xTicks + .selectAll('line, text') + .style('opacity', 1) + + + yAxis + .scale(y) + .ticks( availableWidth / 100 ) + .tickSize( -availableHeight, 0); + + g.select('.nv-y.nv-axis') + .attr('transform', 'translate(0,' + availableHeight + ')'); + g.select('.nv-y.nv-axis').transition() + .call(yAxis); + + //------------------------------------------------------------ + + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('stateChange', function(newState) { + state = newState; + dispatch.stateChange(state); + chart.update(); + }); + + controls.dispatch.on('legendClick', function(d,i) { + if (!d.disabled) return; + controlsData = controlsData.map(function(s) { + s.disabled = true; + return s; + }); + d.disabled = false; + + switch (d.key) { + case 'Grouped': + multibar.stacked(false); + break; + case 'Stacked': + multibar.stacked(true); + break; + } + + state.stacked = multibar.stacked(); + dispatch.stateChange(state); + + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + if (typeof e.stacked !== 'undefined') { + multibar.stacked(e.stacked); + state.stacked = e.stacked; + } + + selection.call(chart); + }); + //============================================================ + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + multibar.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + multibar.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.multibar = multibar; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'clipEdge', 'id', 'delay', 'showValues', 'valueFormat', 'stacked', 'barColor'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltip = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarTimeSeries.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarTimeSeries.js new file mode 100644 index 0000000..abc062c --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiBarTimeSeries.js @@ -0,0 +1,384 @@ +nv.models.multiBarTimeSeries = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , x = d3.time.scale() + , y = d3.scale.linear() + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , forceY = [0] // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove + , clipEdge = true + , stacked = false + , color = nv.utils.defaultColor() + , delay = 1200 + , xDomain + , yDomain + , xRange + , yRange + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0 //used to store previous scales + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + if (stacked) + data = d3.layout.stack() + .offset('zero') + .values(function(d){ return d.values }) + .y(getY) + (data); + + + //add series index to each data point for reference + data.forEach(function(series, i) { + series.values.forEach(function(point) { + point.series = i; + }); + }); + + //------------------------------------------------------------ + // Setup Scales + + // remap and flatten the data for use in calculating the scales' domains + var seriesData = (xDomain && yDomain) ? [] : // if we know xDomain and yDomain, no need to calculate + data.map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i), y0: d.y0 } + }) + }); + + x .domain(xDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.x }))) + .range(xRange || [0, availableWidth]); + + y .domain(yDomain || d3.extent(d3.merge(seriesData).map(function(d) { return d.y + (stacked ? d.y0 : 0) }).concat(forceY))) + .range(yRange || [availableHeight, 0]); + + + // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point + if (x.domain()[0] === x.domain()[1]) + x.domain()[0] ? + x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) + : x.domain([-1,1]); + + if (y.domain()[0] === y.domain()[1]) + y.domain()[0] ? + y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01]) + : y.domain([-1,1]); + + + x0 = x0 || x; + y0 = y0 || y; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-multibar').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multibar'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + gEnter.append('g').attr('class', 'nv-groups'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + + defsEnter.append('clipPath') + .attr('id', 'nv-edge-clip-' + id) + .append('rect'); + wrap.select('#nv-edge-clip-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); + + + + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d) { return d.key }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + d3.transition(groups.exit()) + //.style('stroke-opacity', 1e-6) + //.style('fill-opacity', 1e-6) + .selectAll('rect.nv-bar') + .delay(function(d,i) { return i * delay/ data[0].values.length }) + .attr('y', function(d) { return stacked ? y0(d.y0) : y0(0) }) + .attr('height', 0) + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }) + .style('fill', function(d,i){ return color(d, i) }) + .style('stroke', function(d,i){ return color(d, i) }); + d3.transition(groups) + .style('stroke-opacity', 1) + .style('fill-opacity', .75); + + + var bars = groups.selectAll('rect.nv-bar') + .data(function(d) { return d.values }); + + bars.exit().remove(); + + var maxElements = 0; + for(var ei=0; ei' + key + '' + + '

          ' + y + ' on ' + x + '

          ' + } + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide') + ; + + multibar + .stacked(false) + ; + xAxis + .orient('bottom') + .tickPadding(7) + .highlightZero(false) + .showMaxMin(false) + ; + yAxis + .orient('left') + .tickFormat(d3.format(',.1f')) + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(multibar.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(multibar.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { selection.transition().call(chart) }; + chart.container = this; + + + //------------------------------------------------------------ + // Display noData message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = multibar.xScale(); + y = multibar.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-multiBarWithLegend').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-multiBarWithLegend').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-barsWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width(availableWidth / 2); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + var controlsData = [ + { key: 'Grouped', disabled: multibar.stacked() }, + { key: 'Stacked', disabled: !multibar.stacked() } + ]; + + controls.width(180).color(['#444', '#444', '#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Main Chart Component(s) + + multibar + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })) + + + var barsWrap = g.select('.nv-barsWrap') + .datum(data.filter(function(d) { return !d.disabled })) + + d3.transition(barsWrap).call(multibar); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + xAxis + .scale(x) + .ticks(availableWidth / 100) + .tickSize(-availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')'); + d3.transition(g.select('.nv-x.nv-axis')) + .call(xAxis); + + var xTicks = g.select('.nv-x.nv-axis > g').selectAll('g'); + + xTicks + .selectAll('line, text') + .style('opacity', 1) + + if (reduceXTicks) + xTicks + .filter(function(d,i) { + return i % Math.ceil(data[0].values.length / (availableWidth / 100)) !== 0; + }) + .selectAll('text, line') + .style('opacity', 0); + + if(rotateLabels) + xTicks + .selectAll('text') + .attr('transform', function(d,i,j) { return 'rotate('+rotateLabels+' 0,0)' }) + .attr('text-transform', rotateLabels > 0 ? 'start' : 'end'); + + yAxis + .scale(y) + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + d3.transition(g.select('.nv-y.nv-axis')) + .call(yAxis); + + //------------------------------------------------------------ + + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + legend.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + if (!data.filter(function(d) { return !d.disabled }).length) { + data.map(function(d) { + d.disabled = false; + wrap.selectAll('.nv-series').classed('disabled', false); + return d; + }); + } + + selection.transition().call(chart); + }); + + controls.dispatch.on('legendClick', function(d,i) { + if (!d.disabled) return; + controlsData = controlsData.map(function(s) { + s.disabled = true; + return s; + }); + d.disabled = false; + + switch (d.key) { + case 'Grouped': + multibar.stacked(false); + break; + case 'Stacked': + multibar.stacked(true); + break; + } + + selection.transition().call(chart); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode) + }); + + //============================================================ + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + multibar.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + multibar.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.multibar = multibar; + chart.legend = legend; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + + d3.rebind(chart, multibar, 'x', 'y', 'xDomain', 'yDomain', 'xRange', 'yRange', 'forceX', 'forceY', 'clipEdge', 'id', 'stacked', 'delay'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.reduceXTicks= function(_) { + if (!arguments.length) return reduceXTicks; + reduceXTicks = _; + return chart; + }; + + chart.rotateLabels = function(_) { + if (!arguments.length) return rotateLabels; + rotateLabels = _; + return chart; + } + + chart.tooltip = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiChart.js new file mode 100644 index 0000000..e3e2c5e --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/multiChart.js @@ -0,0 +1,452 @@ +nv.models.multiChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 30, right: 20, bottom: 50, left: 60}, + color = d3.scale.category20().range(), + width = null, + height = null, + showLegend = true, + tooltips = true, + tooltip = function(key, x, y, e, graph) { + return '

          ' + key + '

          ' + + '

          ' + y + ' at ' + x + '

          ' + }, + x, + y, + yDomain1, + yDomain2 + ; //can be accessed via chart.lines.[x/y]Scale() + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x = d3.scale.linear(), + yScale1 = d3.scale.linear(), + yScale2 = d3.scale.linear(), + + lines1 = nv.models.line().yScale(yScale1), + lines2 = nv.models.line().yScale(yScale2), + + bars1 = nv.models.multiBar().stacked(false).yScale(yScale1), + bars2 = nv.models.multiBar().stacked(false).yScale(yScale2), + + stack1 = nv.models.stackedArea().yScale(yScale1), + stack2 = nv.models.stackedArea().yScale(yScale2), + + xAxis = nv.models.axis().scale(x).orient('bottom').tickPadding(5), + yAxis1 = nv.models.axis().scale(yScale1).orient('left'), + yAxis2 = nv.models.axis().scale(yScale2).orient('right'), + + legend = nv.models.legend().height(30), + dispatch = d3.dispatch('tooltipShow', 'tooltipHide'); + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(lines1.x()(e.point, e.pointIndex)), + y = ((e.series.yAxis == 2) ? yAxis2 : yAxis1).tickFormat()(lines1.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, undefined, undefined, offsetElement.offsetParent); + }; + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + chart.update = function() { container.transition().call(chart); }; + chart.container = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + var dataLines1 = data.filter(function(d) {return !d.disabled && d.type == 'line' && d.yAxis == 1}) + var dataLines2 = data.filter(function(d) {return !d.disabled && d.type == 'line' && d.yAxis == 2}) + var dataBars1 = data.filter(function(d) {return !d.disabled && d.type == 'bar' && d.yAxis == 1}) + var dataBars2 = data.filter(function(d) {return !d.disabled && d.type == 'bar' && d.yAxis == 2}) + var dataStack1 = data.filter(function(d) {return !d.disabled && d.type == 'area' && d.yAxis == 1}) + var dataStack2 = data.filter(function(d) {return !d.disabled && d.type == 'area' && d.yAxis == 2}) + + var series1 = data.filter(function(d) {return !d.disabled && d.yAxis == 1}) + .map(function(d) { + return d.values.map(function(d,i) { + return { x: d.x, y: d.y } + }) + }) + + var series2 = data.filter(function(d) {return !d.disabled && d.yAxis == 2}) + .map(function(d) { + return d.values.map(function(d,i) { + return { x: d.x, y: d.y } + }) + }) + + x .domain(d3.extent(d3.merge(series1.concat(series2)), function(d) { return d.x } )) + .range([0, availableWidth]); + + var wrap = container.selectAll('g.wrap.multiChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'wrap nvd3 multiChart').append('g'); + + gEnter.append('g').attr('class', 'x axis'); + gEnter.append('g').attr('class', 'y1 axis'); + gEnter.append('g').attr('class', 'y2 axis'); + gEnter.append('g').attr('class', 'lines1Wrap'); + gEnter.append('g').attr('class', 'lines2Wrap'); + gEnter.append('g').attr('class', 'bars1Wrap'); + gEnter.append('g').attr('class', 'bars2Wrap'); + gEnter.append('g').attr('class', 'stack1Wrap'); + gEnter.append('g').attr('class', 'stack2Wrap'); + gEnter.append('g').attr('class', 'legendWrap'); + + var g = wrap.select('g'); + + if (showLegend) { + legend.width( availableWidth / 2 ); + + g.select('.legendWrap') + .datum(data.map(function(series) { + series.originalKey = series.originalKey === undefined ? series.key : series.originalKey; + series.key = series.originalKey + (series.yAxis == 1 ? '' : ' (right axis)'); + return series; + })) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.legendWrap') + .attr('transform', 'translate(' + ( availableWidth / 2 ) + ',' + (-margin.top) +')'); + } + + + lines1 + .width(availableWidth) + .height(availableHeight) + .interpolate("monotone") + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'line'})); + + lines2 + .width(availableWidth) + .height(availableHeight) + .interpolate("monotone") + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'line'})); + + bars1 + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'bar'})); + + bars2 + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'bar'})); + + stack1 + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 1 && data[i].type == 'area'})); + + stack2 + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color[i % color.length]; + }).filter(function(d,i) { return !data[i].disabled && data[i].yAxis == 2 && data[i].type == 'area'})); + + g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + var lines1Wrap = g.select('.lines1Wrap') + .datum(dataLines1) + var bars1Wrap = g.select('.bars1Wrap') + .datum(dataBars1) + var stack1Wrap = g.select('.stack1Wrap') + .datum(dataStack1) + + var lines2Wrap = g.select('.lines2Wrap') + .datum(dataLines2) + var bars2Wrap = g.select('.bars2Wrap') + .datum(dataBars2) + var stack2Wrap = g.select('.stack2Wrap') + .datum(dataStack2) + + var extraValue1 = dataStack1.length ? dataStack1.map(function(a){return a.values}).reduce(function(a,b){ + return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}}) + }).concat([{x:0, y:0}]) : [] + var extraValue2 = dataStack2.length ? dataStack2.map(function(a){return a.values}).reduce(function(a,b){ + return a.map(function(aVal,i){return {x: aVal.x, y: aVal.y + b[i].y}}) + }).concat([{x:0, y:0}]) : [] + + yScale1 .domain(yDomain1 || d3.extent(d3.merge(series1).concat(extraValue1), function(d) { return d.y } )) + .range([0, availableHeight]) + + yScale2 .domain(yDomain2 || d3.extent(d3.merge(series2).concat(extraValue2), function(d) { return d.y } )) + .range([0, availableHeight]) + + lines1.yDomain(yScale1.domain()) + bars1.yDomain(yScale1.domain()) + stack1.yDomain(yScale1.domain()) + + lines2.yDomain(yScale2.domain()) + bars2.yDomain(yScale2.domain()) + stack2.yDomain(yScale2.domain()) + + if(dataStack1.length){d3.transition(stack1Wrap).call(stack1);} + if(dataStack2.length){d3.transition(stack2Wrap).call(stack2);} + + if(dataBars1.length){d3.transition(bars1Wrap).call(bars1);} + if(dataBars2.length){d3.transition(bars2Wrap).call(bars2);} + + if(dataLines1.length){d3.transition(lines1Wrap).call(lines1);} + if(dataLines2.length){d3.transition(lines2Wrap).call(lines2);} + + + + xAxis + .ticks( availableWidth / 100 ) + .tickSize(-availableHeight, 0); + + g.select('.x.axis') + .attr('transform', 'translate(0,' + availableHeight + ')'); + d3.transition(g.select('.x.axis')) + .call(xAxis); + + yAxis1 + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + + d3.transition(g.select('.y1.axis')) + .call(yAxis1); + + yAxis2 + .ticks( availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + d3.transition(g.select('.y2.axis')) + .call(yAxis2); + + g.select('.y2.axis') + .style('opacity', series2.length ? 1 : 0) + .attr('transform', 'translate(' + x.range()[1] + ',0)'); + + legend.dispatch.on('stateChange', function(newState) { + chart.update(); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + lines1.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines1.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + lines2.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines2.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + bars1.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + bars1.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + bars2.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + bars2.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + stack1.dispatch.on('tooltipShow', function(e) { + //disable tooltips when value ~= 0 + //// TODO: consider removing points from voronoi that have 0 value instead of this hack + if (!Math.round(stack1.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range + setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0); + return false; + } + + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top], + dispatch.tooltipShow(e); + }); + + stack1.dispatch.on('tooltipHide', function(e) { + dispatch.tooltipHide(e); + }); + + stack2.dispatch.on('tooltipShow', function(e) { + //disable tooltips when value ~= 0 + //// TODO: consider removing points from voronoi that have 0 value instead of this hack + if (!Math.round(stack2.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range + setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0); + return false; + } + + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top], + dispatch.tooltipShow(e); + }); + + stack2.dispatch.on('tooltipHide', function(e) { + dispatch.tooltipHide(e); + }); + + lines1.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines1.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + lines2.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + lines2.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + + + //============================================================ + // Global getters and setters + //------------------------------------------------------------ + + chart.dispatch = dispatch; + chart.lines1 = lines1; + chart.lines2 = lines2; + chart.bars1 = bars1; + chart.bars2 = bars2; + chart.stack1 = stack1; + chart.stack2 = stack2; + chart.xAxis = xAxis; + chart.yAxis1 = yAxis1; + chart.yAxis2 = yAxis2; + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + lines1.x(_); + bars1.x(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + lines1.y(_); + bars1.y(_); + return chart; + }; + + chart.yDomain1 = function(_) { + if (!arguments.length) return yDomain1; + yDomain1 = _; + return chart; + }; + + chart.yDomain2 = function(_) { + if (!arguments.length) return yDomain2; + yDomain2 = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin = _; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = _; + legend.color(_); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + return chart; +} + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/ohlcBar.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/ohlcBar.js new file mode 100644 index 0000000..46f2b60 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/ohlcBar.js @@ -0,0 +1,380 @@ + +nv.models.ohlcBar = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , x = d3.scale.linear() + , y = d3.scale.linear() + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , getOpen = function(d) { return d.open } + , getClose = function(d) { return d.close } + , getHigh = function(d) { return d.high } + , getLow = function(d) { return d.low } + , forceX = [] + , forceY = [] + , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart + , clipEdge = true + , color = nv.utils.defaultColor() + , xDomain + , yDomain + , xRange + , yRange + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + //TODO: store old scales for transitions + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup Scales + + x .domain(xDomain || d3.extent(data[0].values.map(getX).concat(forceX) )); + + if (padData) + x.range(xRange || [availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]); + else + x.range(xRange || [0, availableWidth]); + + y .domain(yDomain || [ + d3.min(data[0].values.map(getLow).concat(forceY)), + d3.max(data[0].values.map(getHigh).concat(forceY)) + ]) + .range(yRange || [availableHeight, 0]); + + // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point + if (x.domain()[0] === x.domain()[1]) + x.domain()[0] ? + x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) + : x.domain([-1,1]); + + if (y.domain()[0] === y.domain()[1]) + y.domain()[0] ? + y.domain([y.domain()[0] + y.domain()[0] * 0.01, y.domain()[1] - y.domain()[1] * 0.01]) + : y.domain([-1,1]); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = d3.select(this).selectAll('g.nv-wrap.nv-ohlcBar').data([data[0].values]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-ohlcBar'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-ticks'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + container + .on('click', function(d,i) { + dispatch.chartClick({ + data: d, + index: i, + pos: d3.event, + id: id + }); + }); + + + defsEnter.append('clipPath') + .attr('id', 'nv-chart-clip-path-' + id) + .append('rect'); + + wrap.select('#nv-chart-clip-path-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-chart-clip-path-' + id + ')' : ''); + + + + var ticks = wrap.select('.nv-ticks').selectAll('.nv-tick') + .data(function(d) { return d }); + + ticks.exit().remove(); + + + var ticksEnter = ticks.enter().append('path') + .attr('class', function(d,i,j) { return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i }) + .attr('d', function(d,i) { + var w = (availableWidth / data[0].values.length) * .9; + return 'm0,0l0,' + + (y(getOpen(d,i)) + - y(getHigh(d,i))) + + 'l' + + (-w/2) + + ',0l' + + (w/2) + + ',0l0,' + + (y(getLow(d,i)) - y(getOpen(d,i))) + + 'l0,' + + (y(getClose(d,i)) + - y(getLow(d,i))) + + 'l' + + (w/2) + + ',0l' + + (-w/2) + + ',0z'; + }) + .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; }) + //.attr('fill', function(d,i) { return color[0]; }) + //.attr('stroke', function(d,i) { return color[0]; }) + //.attr('x', 0 ) + //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) }) + //.attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) }) + .on('mouseover', function(d,i) { + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + point: d, + series: data[0], + pos: [x(getX(d,i)), y(getY(d,i))], // TODO: Figure out why the value appears to be shifted + pointIndex: i, + seriesIndex: 0, + e: d3.event + }); + + }) + .on('mouseout', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + point: d, + series: data[0], + pointIndex: i, + seriesIndex: 0, + e: d3.event + }); + }) + .on('click', function(d,i) { + dispatch.elementClick({ + //label: d[label], + value: getY(d,i), + data: d, + index: i, + pos: [x(getX(d,i)), y(getY(d,i))], + e: d3.event, + id: id + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + dispatch.elementDblClick({ + //label: d[label], + value: getY(d,i), + data: d, + index: i, + pos: [x(getX(d,i)), y(getY(d,i))], + e: d3.event, + id: id + }); + d3.event.stopPropagation(); + }); + + ticks + .attr('class', function(d,i,j) { return (getOpen(d,i) > getClose(d,i) ? 'nv-tick negative' : 'nv-tick positive') + ' nv-tick-' + j + '-' + i }) + d3.transition(ticks) + .attr('transform', function(d,i) { return 'translate(' + x(getX(d,i)) + ',' + y(getHigh(d,i)) + ')'; }) + .attr('d', function(d,i) { + var w = (availableWidth / data[0].values.length) * .9; + return 'm0,0l0,' + + (y(getOpen(d,i)) + - y(getHigh(d,i))) + + 'l' + + (-w/2) + + ',0l' + + (w/2) + + ',0l0,' + + (y(getLow(d,i)) + - y(getOpen(d,i))) + + 'l0,' + + (y(getClose(d,i)) + - y(getLow(d,i))) + + 'l' + + (w/2) + + ',0l' + + (-w/2) + + ',0z'; + }) + //.attr('width', (availableWidth / data[0].values.length) * .9 ) + + + //d3.transition(ticks) + //.attr('y', function(d,i) { return y(Math.max(0, getY(d,i))) }) + //.attr('height', function(d,i) { return Math.abs(y(getY(d,i)) - y(0)) }); + //.order(); // not sure if this makes any sense for this model + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = _; + return chart; + }; + + chart.open = function(_) { + if (!arguments.length) return getOpen; + getOpen = _; + return chart; + }; + + chart.close = function(_) { + if (!arguments.length) return getClose; + getClose = _; + return chart; + }; + + chart.high = function(_) { + if (!arguments.length) return getHigh; + getHigh = _; + return chart; + }; + + chart.low = function(_) { + if (!arguments.length) return getLow; + getLow = _; + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.xRange = function(_) { + if (!arguments.length) return xRange; + xRange = _; + return chart; + }; + + chart.yRange = function(_) { + if (!arguments.length) return yRange; + yRange = _; + return chart; + }; + + chart.forceX = function(_) { + if (!arguments.length) return forceX; + forceX = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.padData = function(_) { + if (!arguments.length) return padData; + padData = _; + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/parallelCoordinates.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/parallelCoordinates.js new file mode 100644 index 0000000..107154f --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/parallelCoordinates.js @@ -0,0 +1,239 @@ + +//Code adapted from Jason Davies' "Parallel Coordinates" +// http://bl.ocks.org/jasondavies/1341281 + +nv.models.parallelCoordinates = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + + var margin = {top: 30, right: 10, bottom: 10, left: 10} + , width = 960 + , height = 500 + , x = d3.scale.ordinal() + , y = {} + , dimensions = [] + , color = nv.utils.getColor(d3.scale.category20c().range()) + , axisLabel = function(d) { return d; } + , filters = [] + , active = [] + , dispatch = d3.dispatch('brush') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + active = data; //set all active before first brush call + + chart.update = function() { }; //This is a placeholder until this chart is made resizeable + + //------------------------------------------------------------ + // Setup Scales + + x + .rangePoints([0, availableWidth], 1) + .domain(dimensions); + + // Extract the list of dimensions and create a scale for each. + dimensions.forEach(function(d) { + y[d] = d3.scale.linear() + .domain(d3.extent(data, function(p) { return +p[d]; })) + .range([availableHeight, 0]); + + y[d].brush = d3.svg.brush().y(y[d]).on('brush', brush); + + return d != 'name'; + }) + + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-parallelCoordinates').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-parallelCoordinates'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + gEnter.append('g').attr('class', 'nv-parallelCoordinatesWrap'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + var line = d3.svg.line(), + axis = d3.svg.axis().orient('left'), + background, + foreground; + + + // Add grey background lines for context. + background = gEnter.append('g') + .attr('class', 'background') + .selectAll('path') + .data(data) + .enter().append('path') + .attr('d', path) + ; + + // Add blue foreground lines for focus. + foreground = gEnter.append('g') + .attr('class', 'foreground') + .selectAll('path') + .data(data) + .enter().append('path') + .attr('d', path) + ; + + // Add a group element for each dimension. + var dimension = g.selectAll('.dimension') + .data(dimensions) + .enter().append('g') + .attr('class', 'dimension') + .attr('transform', function(d) { return 'translate(' + x(d) + ',0)'; }); + + // Add an axis and title. + dimension.append('g') + .attr('class', 'axis') + .each(function(d) { d3.select(this).call(axis.scale(y[d])); }) + .append('text') + .attr('text-anchor', 'middle') + .attr('y', -9) + .text(String); + + // Add and store a brush for each axis. + dimension.append('g') + .attr('class', 'brush') + .each(function(d) { d3.select(this).call(y[d].brush); }) + .selectAll('rect') + .attr('x', -8) + .attr('width', 16); + + + // Returns the path for a given data point. + function path(d) { + return line(dimensions.map(function(p) { return [x(p), y[p](d[p])]; })); + } + + // Handles a brush event, toggling the display of foreground lines. + function brush() { + var actives = dimensions.filter(function(p) { return !y[p].brush.empty(); }), + extents = actives.map(function(p) { return y[p].brush.extent(); }); + + filters = []; //erase current filters + actives.forEach(function(d,i) { + filters[i] = { + dimension: d, + extent: extents[i] + } + }); + + active = []; //erase current active list + foreground.style('display', function(d) { + var isActive = actives.every(function(p, i) { + return extents[i][0] <= d[p] && d[p] <= extents[i][1]; + }); + if (isActive) active.push(d); + return isActive ? null : 'none'; + }); + + dispatch.brush({ + filters: filters, + active: active + }); + + } + + + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + + chart.dispatch = dispatch; + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_) + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.dimensions = function(_) { + if (!arguments.length) return dimensions; + dimensions = _; + return chart; + }; + + chart.filters = function() { + return filters; + }; + + chart.active = function() { + return active; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pie.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pie.js new file mode 100644 index 0000000..2099c8f --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pie.js @@ -0,0 +1,400 @@ +nv.models.pie = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 500 + , height = 500 + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , getDescription = function(d) { return d.description } + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , color = nv.utils.defaultColor() + , valueFormat = d3.format(',.2f') + , showLabels = true + , pieLabelsOutside = true + , donutLabelsOutside = false + , labelType = "key" + , labelThreshold = .02 //if slice percentage is under this, don't show label + , donut = false + , labelSunbeamLayout = false + , startAngle = false + , endAngle = false + , donutRatio = 0.5 + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + radius = Math.min(availableWidth, availableHeight) / 2, + arcRadius = radius-(radius / 5), + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + //var wrap = container.selectAll('.nv-wrap.nv-pie').data([data]); + var wrap = container.selectAll('.nv-wrap.nv-pie').data(data); + var wrapEnter = wrap.enter().append('g').attr('class','nvd3 nv-wrap nv-pie nv-chart-' + id); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-pie'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + g.select('.nv-pie').attr('transform', 'translate(' + availableWidth / 2 + ',' + availableHeight / 2 + ')'); + + //------------------------------------------------------------ + + + container + .on('click', function(d,i) { + dispatch.chartClick({ + data: d, + index: i, + pos: d3.event, + id: id + }); + }); + + + var arc = d3.svg.arc() + .outerRadius(arcRadius); + + if (startAngle) arc.startAngle(startAngle) + if (endAngle) arc.endAngle(endAngle); + if (donut) arc.innerRadius(radius * donutRatio); + + // Setup the Pie chart and choose the data element + var pie = d3.layout.pie() + .sort(null) + .value(function(d) { return d.disabled ? 0 : getY(d) }); + + var slices = wrap.select('.nv-pie').selectAll('.nv-slice') + .data(pie); + + slices.exit().remove(); + + var ae = slices.enter().append('g') + .attr('class', 'nv-slice') + .on('mouseover', function(d,i){ + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + label: getX(d.data), + value: getY(d.data), + point: d.data, + pointIndex: i, + pos: [d3.event.pageX, d3.event.pageY], + id: id + }); + }) + .on('mouseout', function(d,i){ + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + label: getX(d.data), + value: getY(d.data), + point: d.data, + index: i, + id: id + }); + }) + .on('click', function(d,i) { + dispatch.elementClick({ + label: getX(d.data), + value: getY(d.data), + point: d.data, + index: i, + pos: d3.event, + id: id + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + dispatch.elementDblClick({ + label: getX(d.data), + value: getY(d.data), + point: d.data, + index: i, + pos: d3.event, + id: id + }); + d3.event.stopPropagation(); + }); + + slices + .attr('fill', function(d,i) { return color(d, i); }) + .attr('stroke', function(d,i) { return color(d, i); }); + + var paths = ae.append('path') + .each(function(d) { this._current = d; }); + //.attr('d', arc); + + d3.transition(slices.select('path')) + .attr('d', arc); + //.attrTween('d', arcTween); + + if (showLabels) { + // This does the normal label + var labelsArc = d3.svg.arc().innerRadius(0); + + if (pieLabelsOutside){ labelsArc = arc; } + + if (donutLabelsOutside) { labelsArc = d3.svg.arc().outerRadius(arc.outerRadius()); } + + ae.append("g").classed("nv-label", true) + .each(function(d, i) { + var group = d3.select(this); + + group + .attr('transform', function(d) { + if (labelSunbeamLayout) { + d.outerRadius = arcRadius + 10; // Set Outer Coordinate + d.innerRadius = arcRadius + 15; // Set Inner Coordinate + var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI); + if ((d.startAngle+d.endAngle)/2 < Math.PI) { + rotateAngle -= 90; + } else { + rotateAngle += 90; + } + return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')'; + } else { + d.outerRadius = radius + 10; // Set Outer Coordinate + d.innerRadius = radius + 15; // Set Inner Coordinate + return 'translate(' + labelsArc.centroid(d) + ')' + } + }); + + group.append('rect') + .style('stroke', '#fff') + .style('fill', '#fff') + .attr("rx", 3) + .attr("ry", 3); + + group.append('text') + .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned + .style('fill', '#000') + + + }); + + slices.select(".nv-label").transition() + .attr('transform', function(d) { + if (labelSunbeamLayout) { + d.outerRadius = arcRadius + 10; // Set Outer Coordinate + d.innerRadius = arcRadius + 15; // Set Inner Coordinate + var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI); + if ((d.startAngle+d.endAngle)/2 < Math.PI) { + rotateAngle -= 90; + } else { + rotateAngle += 90; + } + return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')'; + } else { + d.outerRadius = radius + 10; // Set Outer Coordinate + d.innerRadius = radius + 15; // Set Inner Coordinate + return 'translate(' + labelsArc.centroid(d) + ')' + } + }); + + slices.each(function(d, i) { + var slice = d3.select(this); + + slice + .select(".nv-label text") + .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned + .text(function(d, i) { + var percent = (d.endAngle - d.startAngle) / (2 * Math.PI); + return Math.round(percent*1001/10)+"%"; + /*var labelTypes = { + "key" : getX(d.data), + "value": getY(d.data), + "percent": d3.format('%')(percent) + }; + return (d.value && percent > labelThreshold) ? labelTypes[labelType] : ''; + */ + }); + + var textBox = slice.select('text').node().getBBox(); + slice.select(".nv-label rect") + .attr("width", textBox.width + 10) + .attr("height", textBox.height + 10) + .attr("transform", function() { + return "translate(" + [textBox.x - 5, textBox.y - 5] + ")"; + }); + }); + } + + + // Computes the angle of an arc, converting from radians to degrees. + function angle(d) { + var a = (d.startAngle + d.endAngle) * 90 / Math.PI - 90; + return a > 90 ? a - 180 : a; + } + + function arcTween(a) { + a.endAngle = isNaN(a.endAngle) ? 0 : a.endAngle; + a.startAngle = isNaN(a.startAngle) ? 0 : a.startAngle; + if (!donut) a.innerRadius = 0; + var i = d3.interpolate(this._current, a); + this._current = i(0); + return function(t) { + return arc(i(t)); + }; + } + + function tweenPie(b) { + b.innerRadius = 0; + var i = d3.interpolate({startAngle: 0, endAngle: 0}, b); + return function(t) { + return arc(i(t)); + }; + } + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.values = function(_) { + nv.log("pie.values() is no longer supported."); + return chart; + }; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = d3.functor(_); + return chart; + }; + + chart.description = function(_) { + if (!arguments.length) return getDescription; + getDescription = _; + return chart; + }; + + chart.showLabels = function(_) { + if (!arguments.length) return showLabels; + showLabels = _; + return chart; + }; + + chart.labelSunbeamLayout = function(_) { + if (!arguments.length) return labelSunbeamLayout; + labelSunbeamLayout = _; + return chart; + }; + + chart.donutLabelsOutside = function(_) { + if (!arguments.length) return donutLabelsOutside; + donutLabelsOutside = _; + return chart; + }; + + chart.pieLabelsOutside = function(_) { + if (!arguments.length) return pieLabelsOutside; + pieLabelsOutside = _; + return chart; + }; + + chart.labelType = function(_) { + if (!arguments.length) return labelType; + labelType = _; + labelType = labelType || "key"; + return chart; + }; + + chart.donut = function(_) { + if (!arguments.length) return donut; + donut = _; + return chart; + }; + + chart.donutRatio = function(_) { + if (!arguments.length) return donutRatio; + donutRatio = _; + return chart; + }; + + chart.startAngle = function(_) { + if (!arguments.length) return startAngle; + startAngle = _; + return chart; + }; + + chart.endAngle = function(_) { + if (!arguments.length) return endAngle; + endAngle = _; + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.valueFormat = function(_) { + if (!arguments.length) return valueFormat; + valueFormat = _; + return chart; + }; + + chart.labelThreshold = function(_) { + if (!arguments.length) return labelThreshold; + labelThreshold = _; + return chart; + }; + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pie.js.bak b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pie.js.bak new file mode 100644 index 0000000..aac835d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pie.js.bak @@ -0,0 +1,400 @@ +nv.models.pie = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 500 + , height = 500 + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , getDescription = function(d) { return d.description } + , id = Math.floor(Math.random() * 10000) //Create semi-unique ID in case user doesn't select one + , color = nv.utils.defaultColor() + , valueFormat = d3.format(',.2f') + , showLabels = true + , pieLabelsOutside = true + , donutLabelsOutside = false + , labelType = "key" + , labelThreshold = .02 //if slice percentage is under this, don't show label + , donut = false + , labelSunbeamLayout = false + , startAngle = false + , endAngle = false + , donutRatio = 0.5 + , dispatch = d3.dispatch('chartClick', 'elementClick', 'elementDblClick', 'elementMouseover', 'elementMouseout') + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + radius = Math.min(availableWidth, availableHeight) / 2, + arcRadius = radius-(radius / 5), + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + //var wrap = container.selectAll('.nv-wrap.nv-pie').data([data]); + var wrap = container.selectAll('.nv-wrap.nv-pie').data(data); + var wrapEnter = wrap.enter().append('g').attr('class','nvd3 nv-wrap nv-pie nv-chart-' + id); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-pie'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + g.select('.nv-pie').attr('transform', 'translate(' + availableWidth / 2 + ',' + availableHeight / 2 + ')'); + + //------------------------------------------------------------ + + + container + .on('click', function(d,i) { + dispatch.chartClick({ + data: d, + index: i, + pos: d3.event, + id: id + }); + }); + + + var arc = d3.svg.arc() + .outerRadius(arcRadius); + + if (startAngle) arc.startAngle(startAngle) + if (endAngle) arc.endAngle(endAngle); + if (donut) arc.innerRadius(radius * donutRatio); + + // Setup the Pie chart and choose the data element + var pie = d3.layout.pie() + .sort(null) + .value(function(d) { return d.disabled ? 0 : getY(d) }); + + var slices = wrap.select('.nv-pie').selectAll('.nv-slice') + .data(pie); + + slices.exit().remove(); + + var ae = slices.enter().append('g') + .attr('class', 'nv-slice') + .on('mouseover', function(d,i){ + d3.select(this).classed('hover', true); + dispatch.elementMouseover({ + label: getX(d.data), + value: getY(d.data), + point: d.data, + pointIndex: i, + pos: [d3.event.pageX, d3.event.pageY], + id: id + }); + }) + .on('mouseout', function(d,i){ + d3.select(this).classed('hover', false); + dispatch.elementMouseout({ + label: getX(d.data), + value: getY(d.data), + point: d.data, + index: i, + id: id + }); + }) + .on('click', function(d,i) { + dispatch.elementClick({ + label: getX(d.data), + value: getY(d.data), + point: d.data, + index: i, + pos: d3.event, + id: id + }); + d3.event.stopPropagation(); + }) + .on('dblclick', function(d,i) { + dispatch.elementDblClick({ + label: getX(d.data), + value: getY(d.data), + point: d.data, + index: i, + pos: d3.event, + id: id + }); + d3.event.stopPropagation(); + }); + + slices + .attr('fill', function(d,i) { return color(d, i); }) + .attr('stroke', function(d,i) { return color(d, i); }); + + var paths = ae.append('path') + .each(function(d) { this._current = d; }); + //.attr('d', arc); + + d3.transition(slices.select('path')) + .attr('d', arc) + .attrTween('d', arcTween); + + if (showLabels) { + // This does the normal label + var labelsArc = d3.svg.arc().innerRadius(0); + + if (pieLabelsOutside){ labelsArc = arc; } + + if (donutLabelsOutside) { labelsArc = d3.svg.arc().outerRadius(arc.outerRadius()); } + + ae.append("g").classed("nv-label", true) + .each(function(d, i) { + var group = d3.select(this); + + group + .attr('transform', function(d) { + if (labelSunbeamLayout) { + d.outerRadius = arcRadius + 10; // Set Outer Coordinate + d.innerRadius = arcRadius + 15; // Set Inner Coordinate + var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI); + if ((d.startAngle+d.endAngle)/2 < Math.PI) { + rotateAngle -= 90; + } else { + rotateAngle += 90; + } + return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')'; + } else { + d.outerRadius = radius + 10; // Set Outer Coordinate + d.innerRadius = radius + 15; // Set Inner Coordinate + return 'translate(' + labelsArc.centroid(d) + ')' + } + }); + + group.append('rect') + .style('stroke', '#fff') + .style('fill', '#fff') + .attr("rx", 3) + .attr("ry", 3); + + group.append('text') + .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned + .style('fill', '#000') + + + }); + + slices.select(".nv-label").transition() + .attr('transform', function(d) { + if (labelSunbeamLayout) { + d.outerRadius = arcRadius + 10; // Set Outer Coordinate + d.innerRadius = arcRadius + 15; // Set Inner Coordinate + var rotateAngle = (d.startAngle + d.endAngle) / 2 * (180 / Math.PI); + if ((d.startAngle+d.endAngle)/2 < Math.PI) { + rotateAngle -= 90; + } else { + rotateAngle += 90; + } + return 'translate(' + labelsArc.centroid(d) + ') rotate(' + rotateAngle + ')'; + } else { + d.outerRadius = radius + 10; // Set Outer Coordinate + d.innerRadius = radius + 15; // Set Inner Coordinate + return 'translate(' + labelsArc.centroid(d) + ')' + } + }); + + slices.each(function(d, i) { + var slice = d3.select(this); + + slice + .select(".nv-label text") + .style('text-anchor', labelSunbeamLayout ? ((d.startAngle + d.endAngle) / 2 < Math.PI ? 'start' : 'end') : 'middle') //center the text on it's origin or begin/end if orthogonal aligned + .text(function(d, i) { + var percent = (d.endAngle - d.startAngle) / (2 * Math.PI); + return Math.round(percent*1001/10)+"%"; + /*var labelTypes = { + "key" : getX(d.data), + "value": getY(d.data), + "percent": d3.format('%')(percent) + }; + return (d.value && percent > labelThreshold) ? labelTypes[labelType] : ''; + */ + }); + + var textBox = slice.select('text').node().getBBox(); + slice.select(".nv-label rect") + .attr("width", textBox.width + 10) + .attr("height", textBox.height + 10) + .attr("transform", function() { + return "translate(" + [textBox.x - 5, textBox.y - 5] + ")"; + }); + }); + } + + + // Computes the angle of an arc, converting from radians to degrees. + function angle(d) { + var a = (d.startAngle + d.endAngle) * 90 / Math.PI - 90; + return a > 90 ? a - 180 : a; + } + + function arcTween(a) { + a.endAngle = isNaN(a.endAngle) ? 0 : a.endAngle; + a.startAngle = isNaN(a.startAngle) ? 0 : a.startAngle; + if (!donut) a.innerRadius = 0; + var i = d3.interpolate(this._current, a); + this._current = i(0); + return function(t) { + return arc(i(t)); + }; + } + + function tweenPie(b) { + b.innerRadius = 0; + var i = d3.interpolate({startAngle: 0, endAngle: 0}, b); + return function(t) { + return arc(i(t)); + }; + } + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.values = function(_) { + nv.log("pie.values() is no longer supported."); + return chart; + }; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = _; + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = d3.functor(_); + return chart; + }; + + chart.description = function(_) { + if (!arguments.length) return getDescription; + getDescription = _; + return chart; + }; + + chart.showLabels = function(_) { + if (!arguments.length) return showLabels; + showLabels = _; + return chart; + }; + + chart.labelSunbeamLayout = function(_) { + if (!arguments.length) return labelSunbeamLayout; + labelSunbeamLayout = _; + return chart; + }; + + chart.donutLabelsOutside = function(_) { + if (!arguments.length) return donutLabelsOutside; + donutLabelsOutside = _; + return chart; + }; + + chart.pieLabelsOutside = function(_) { + if (!arguments.length) return pieLabelsOutside; + pieLabelsOutside = _; + return chart; + }; + + chart.labelType = function(_) { + if (!arguments.length) return labelType; + labelType = _; + labelType = labelType || "key"; + return chart; + }; + + chart.donut = function(_) { + if (!arguments.length) return donut; + donut = _; + return chart; + }; + + chart.donutRatio = function(_) { + if (!arguments.length) return donutRatio; + donutRatio = _; + return chart; + }; + + chart.startAngle = function(_) { + if (!arguments.length) return startAngle; + startAngle = _; + return chart; + }; + + chart.endAngle = function(_) { + if (!arguments.length) return endAngle; + endAngle = _; + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.valueFormat = function(_) { + if (!arguments.length) return valueFormat; + valueFormat = _; + return chart; + }; + + chart.labelThreshold = function(_) { + if (!arguments.length) return labelThreshold; + labelThreshold = _; + return chart; + }; + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pieChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pieChart.js new file mode 100644 index 0000000..b4303fd --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/pieChart.js @@ -0,0 +1,292 @@ +nv.models.pieChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var pie = nv.models.pie() + , legend = nv.models.legend() + ; + + var margin = {top: 30, right: 20, bottom: 20, left: 20} + , width = null + , height = null + , showLegend = true + , color = nv.utils.defaultColor() + , tooltips = false + , tooltip = function(key, y, e, graph) { + return '

          ' + key + '

          ' + + '

          ' + y + '

          ' + } + , state = {} + , defaultState = null + , noData = "No Data Available." + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var tooltipLabel = pie.description()(e.point) || pie.x()(e.point) + var left = e.pos[0] + ( (offsetElement && offsetElement.offsetLeft) || 0 ), + top = e.pos[1] + ( (offsetElement && offsetElement.offsetTop) || 0), + y = pie.valueFormat()(pie.y()(e.point)), + content = tooltip(tooltipLabel, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().call(chart); }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-pieChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-pieChart').append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-pieWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend + .width( availableWidth ) + .key(pie.x()); + + wrap.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + wrap.select('.nv-legendWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + + //------------------------------------------------------------ + // Main Chart Component(s) + + pie + .width(availableWidth) + .height(availableHeight); + + + var pieWrap = g.select('.nv-pieWrap') + .datum([data]); + + d3.transition(pieWrap).call(pie); + + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + /*legend.dispatch.on('stateChange', function(newState) { + state = newState; + dispatch.stateChange(state); + chart.update(); + });*/ + + pie.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + chart.update(); + }); + + //============================================================ + + + }); + + return chart; + } + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + pie.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.legend = legend; + chart.dispatch = dispatch; + chart.pie = pie; + + d3.rebind(chart, pie, 'valueFormat', 'values', 'x', 'y', 'description', 'id', 'showLabels', 'donutLabelsOutside', 'pieLabelsOutside', 'labelType', 'donut', 'donutRatio', 'labelThreshold'); + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + pie.color(color); + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatter.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatter.js new file mode 100644 index 0000000..16cbee6 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatter.js @@ -0,0 +1,674 @@ + +nv.models.scatter = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , color = nv.utils.defaultColor() // chooses color + , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't select one + , x = d3.scale.linear() + , y = d3.scale.linear() + , z = d3.scale.linear() //linear because d3.svg.shape.size is treated as area + , getX = function(d) { return d.x } // accessor to get the x value + , getY = function(d) { return d.y } // accessor to get the y value + , getSize = function(d) { return d.size || 1} // accessor to get the point size + , getShape = function(d) { return d.shape || 'circle' } // accessor to get point shape + , onlyCircles = true // Set to false to use shapes + , forceX = [] // List of numbers to Force into the X scale (ie. 0, or a max / min, etc.) + , forceY = [] // List of numbers to Force into the Y scale + , forceSize = [] // List of numbers to Force into the Size scale + , interactive = true // If true, plots a voronoi overlay for advanced point intersection + , pointKey = null + , pointActive = function(d) { return !d.notActive } // any points that return false will be filtered out + , padData = false // If true, adds half a data points width to front and back, for lining up a line chart with a bar chart + , padDataOuter = .1 //outerPadding to imitate ordinal scale outer padding + , clipEdge = false // if true, masks points within x and y scale + , clipVoronoi = true // if true, masks each point with a circle... can turn off to slightly increase performance + , clipRadius = function() { return 25 } // function to get the radius for voronoi point clips + , xDomain = null // Override x domain (skips the calculation from data) + , yDomain = null // Override y domain + , xRange = null // Override x range + , yRange = null // Override y range + , sizeDomain = null // Override point size domain + , sizeRange = null + , singlePoint = false + , dispatch = d3.dispatch('elementClick', 'elementMouseover', 'elementMouseout') + , useVoronoi = true + ; + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0, z0 // used to store previous scales + , timeoutID + , needsUpdate = false // Flag for when the points are visually updating, but the interactive layer is behind, to disable tooltips + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + //add series index to each data point for reference + data.forEach(function(series, i) { + series.values.forEach(function(point) { + point.series = i; + }); + }); + + //------------------------------------------------------------ + // Setup Scales + + // remap and flatten the data for use in calculating the scales' domains + var seriesData = (xDomain && yDomain && sizeDomain) ? [] : // if we know xDomain and yDomain and sizeDomain, no need to calculate.... if Size is constant remember to set sizeDomain to speed up performance + d3.merge( + data.map(function(d) { + return d.values.map(function(d,i) { + return { x: getX(d,i), y: getY(d,i), size: getSize(d,i) } + }) + }) + ); + + x .domain(xDomain || d3.extent(seriesData.map(function(d) { return d.x; }).concat(forceX))) + + if (padData && data[0]) + x.range(xRange || [(availableWidth * padDataOuter + availableWidth) / (2 *data[0].values.length), availableWidth - availableWidth * (1 + padDataOuter) / (2 * data[0].values.length) ]); + //x.range([availableWidth * .5 / data[0].values.length, availableWidth * (data[0].values.length - .5) / data[0].values.length ]); + else + x.range(xRange || [0, availableWidth]); + + y .domain(yDomain || d3.extent(seriesData.map(function(d) { return d.y }).concat(forceY))) + .range(yRange || [availableHeight, 0]); + + z .domain(sizeDomain || d3.extent(seriesData.map(function(d) { return d.size }).concat(forceSize))) + .range(sizeRange || [16, 256]); + + // If scale's domain don't have a range, slightly adjust to make one... so a chart can show a single data point + if (x.domain()[0] === x.domain()[1] || y.domain()[0] === y.domain()[1]) singlePoint = true; + if (x.domain()[0] === x.domain()[1]) + x.domain()[0] ? + x.domain([x.domain()[0] - x.domain()[0] * 0.01, x.domain()[1] + x.domain()[1] * 0.01]) + : x.domain([-1,1]); + + if (y.domain()[0] === y.domain()[1]) + y.domain()[0] ? + y.domain([y.domain()[0] - y.domain()[0] * 0.01, y.domain()[1] + y.domain()[1] * 0.01]) + : y.domain([-1,1]); + + if ( isNaN(x.domain()[0])) { + x.domain([-1,1]); + } + + if ( isNaN(y.domain()[0])) { + y.domain([-1,1]); + } + + + x0 = x0 || x; + y0 = y0 || y; + z0 = z0 || z; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-scatter').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatter nv-chart-' + id + (singlePoint ? ' nv-single-point' : '')); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-groups'); + gEnter.append('g').attr('class', 'nv-point-paths'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + defsEnter.append('clipPath') + .attr('id', 'nv-edge-clip-' + id) + .append('rect'); + + wrap.select('#nv-edge-clip-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); + + + function updateInteractiveLayer() { + + if (!interactive) return false; + + var eventElements; + + var vertices = d3.merge(data.map(function(group, groupIndex) { + return group.values + .map(function(point, pointIndex) { + // *Adding noise to make duplicates very unlikely + // *Injecting series and point index for reference + /* *Adding a 'jitter' to the points, because there's an issue in d3.geom.voronoi. + */ + var pX = getX(point,pointIndex); + var pY = getY(point,pointIndex); + + return [x(pX)+ Math.random() * 1e-7, + y(pY)+ Math.random() * 1e-7, + groupIndex, + pointIndex, point]; //temp hack to add noise untill I think of a better way so there are no duplicates + }) + .filter(function(pointArray, pointIndex) { + return pointActive(pointArray[4], pointIndex); // Issue #237.. move filter to after map, so pointIndex is correct! + }) + }) + ); + + + + //inject series and point index for reference into voronoi + if (useVoronoi === true) { + + if (clipVoronoi) { + var pointClipsEnter = wrap.select('defs').selectAll('.nv-point-clips') + .data([id]) + .enter(); + + pointClipsEnter.append('clipPath') + .attr('class', 'nv-point-clips') + .attr('id', 'nv-points-clip-' + id); + + var pointClips = wrap.select('#nv-points-clip-' + id).selectAll('circle') + .data(vertices); + pointClips.enter().append('circle') + .attr('r', clipRadius); + pointClips.exit().remove(); + pointClips + .attr('cx', function(d) { return d[0] }) + .attr('cy', function(d) { return d[1] }); + + wrap.select('.nv-point-paths') + .attr('clip-path', 'url(#nv-points-clip-' + id + ')'); + } + + + if(vertices.length) { + // Issue #283 - Adding 2 dummy points to the voronoi b/c voronoi requires min 3 points to work + vertices.push([x.range()[0] - 20, y.range()[0] - 20, null, null]); + vertices.push([x.range()[1] + 20, y.range()[1] + 20, null, null]); + vertices.push([x.range()[0] - 20, y.range()[0] + 20, null, null]); + vertices.push([x.range()[1] + 20, y.range()[1] - 20, null, null]); + } + + var bounds = d3.geom.polygon([ + [-10,-10], + [-10,height + 10], + [width + 10,height + 10], + [width + 10,-10] + ]); + + var voronoi = d3.geom.voronoi(vertices).map(function(d, i) { + return { + 'data': bounds.clip(d), + 'series': vertices[i][2], + 'point': vertices[i][3] + } + }); + + + var pointPaths = wrap.select('.nv-point-paths').selectAll('path') + .data(voronoi); + pointPaths.enter().append('path') + .attr('class', function(d,i) { return 'nv-path-'+i; }); + pointPaths.exit().remove(); + pointPaths + .attr('d', function(d) { + if (d.data.length === 0) + return 'M 0 0' + else + return 'M' + d.data.join('L') + 'Z'; + }); + + var mouseEventCallback = function(d,mDispatch) { + if (needsUpdate) return 0; + var series = data[d.series]; + if (typeof series === 'undefined') return; + + var point = series.values[d.point]; + + mDispatch({ + point: point, + series: series, + pos: [x(getX(point, d.point)) + margin.left, y(getY(point, d.point)) + margin.top], + seriesIndex: d.series, + pointIndex: d.point + }); + }; + + pointPaths + .on('click', function(d) { + mouseEventCallback(d, dispatch.elementClick); + }) + .on('mouseover', function(d) { + mouseEventCallback(d, dispatch.elementMouseover); + }) + .on('mouseout', function(d, i) { + mouseEventCallback(d, dispatch.elementMouseout); + }); + + + } else { + /* + // bring data in form needed for click handlers + var dataWithPoints = vertices.map(function(d, i) { + return { + 'data': d, + 'series': vertices[i][2], + 'point': vertices[i][3] + } + }); + */ + + // add event handlers to points instead voronoi paths + wrap.select('.nv-groups').selectAll('.nv-group') + .selectAll('.nv-point') + //.data(dataWithPoints) + //.style('pointer-events', 'auto') // recativate events, disabled by css + .on('click', function(d,i) { + //nv.log('test', d, i); + if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point + var series = data[d.series], + point = series.values[i]; + + dispatch.elementClick({ + point: point, + series: series, + pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top], + seriesIndex: d.series, + pointIndex: i + }); + }) + .on('mouseover', function(d,i) { + if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point + var series = data[d.series], + point = series.values[i]; + + dispatch.elementMouseover({ + point: point, + series: series, + pos: [x(getX(point, i)) + margin.left, y(getY(point, i)) + margin.top], + seriesIndex: d.series, + pointIndex: i + }); + }) + .on('mouseout', function(d,i) { + if (needsUpdate || !data[d.series]) return 0; //check if this is a dummy point + var series = data[d.series], + point = series.values[i]; + + dispatch.elementMouseout({ + point: point, + series: series, + seriesIndex: d.series, + pointIndex: i + }); + }); + } + + needsUpdate = false; + } + + needsUpdate = true; + + var groups = wrap.select('.nv-groups').selectAll('.nv-group') + .data(function(d) { return d }, function(d) { return d.key }); + groups.enter().append('g') + .style('stroke-opacity', 1e-6) + .style('fill-opacity', 1e-6); + groups.exit() + .remove(); + groups + .attr('class', function(d,i) { return 'nv-group nv-series-' + i }) + .classed('hover', function(d) { return d.hover }); + groups + .transition() + .style('fill', function(d,i) { return color(d, i) }) + .style('stroke', function(d,i) { return color(d, i) }) + .style('stroke-opacity', 1) + .style('fill-opacity', .5); + + + if (onlyCircles) { + + var points = groups.selectAll('circle.nv-point') + .data(function(d) { return d.values }, pointKey); + points.enter().append('circle') + .style('fill', function (d,i) { return d.color }) + .style('stroke', function (d,i) { return d.color }) + .attr('cx', function(d,i) { return nv.utils.NaNtoZero(x0(getX(d,i))) }) + .attr('cy', function(d,i) { return nv.utils.NaNtoZero(y0(getY(d,i))) }) + .attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) }); + points.exit().remove(); + groups.exit().selectAll('path.nv-point').transition() + .attr('cx', function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) }) + .attr('cy', function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) }) + .remove(); + points.each(function(d,i) { + d3.select(this) + .classed('nv-point', true) + .classed('nv-point-' + i, true) + .classed('hover',false) + ; + }); + points.transition() + .attr('cx', function(d,i) { return nv.utils.NaNtoZero(x(getX(d,i))) }) + .attr('cy', function(d,i) { return nv.utils.NaNtoZero(y(getY(d,i))) }) + .attr('r', function(d,i) { return Math.sqrt(z(getSize(d,i))/Math.PI) }); + + } else { + + var points = groups.selectAll('path.nv-point') + .data(function(d) { return d.values }); + points.enter().append('path') + .style('fill', function (d,i) { return d.color }) + .style('stroke', function (d,i) { return d.color }) + .attr('transform', function(d,i) { + return 'translate(' + x0(getX(d,i)) + ',' + y0(getY(d,i)) + ')' + }) + .attr('d', + d3.svg.symbol() + .type(getShape) + .size(function(d,i) { return z(getSize(d,i)) }) + ); + points.exit().remove(); + groups.exit().selectAll('path.nv-point') + .transition() + .attr('transform', function(d,i) { + return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')' + }) + .remove(); + points.each(function(d,i) { + d3.select(this) + .classed('nv-point', true) + .classed('nv-point-' + i, true) + .classed('hover',false) + ; + }); + points.transition() + .attr('transform', function(d,i) { + //nv.log(d,i,getX(d,i), x(getX(d,i))); + return 'translate(' + x(getX(d,i)) + ',' + y(getY(d,i)) + ')' + }) + .attr('d', + d3.svg.symbol() + .type(getShape) + .size(function(d,i) { return z(getSize(d,i)) }) + ); + } + + + // Delay updating the invisible interactive layer for smoother animation + clearTimeout(timeoutID); // stop repeat calls to updateInteractiveLayer + timeoutID = setTimeout(updateInteractiveLayer, 300); + //updateInteractiveLayer(); + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + z0 = z.copy(); + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + chart.clearHighlights = function() { + //Remove the 'hover' class from all highlighted points. + d3.selectAll(".nv-chart-" + id + " .nv-point.hover").classed("hover",false); + }; + + chart.highlightPoint = function(seriesIndex,pointIndex,isHoverOver) { + d3.select(".nv-chart-" + id + " .nv-series-" + seriesIndex + " .nv-point-" + pointIndex) + .classed("hover",isHoverOver); + }; + + + dispatch.on('elementMouseover.point', function(d) { + if (interactive) chart.highlightPoint(d.seriesIndex,d.pointIndex,true); + }); + + dispatch.on('elementMouseout.point', function(d) { + if (interactive) chart.highlightPoint(d.seriesIndex,d.pointIndex,false); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + chart.dispatch = dispatch; + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = d3.functor(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = d3.functor(_); + return chart; + }; + + chart.size = function(_) { + if (!arguments.length) return getSize; + getSize = d3.functor(_); + return chart; + }; + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.zScale = function(_) { + if (!arguments.length) return z; + z = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.sizeDomain = function(_) { + if (!arguments.length) return sizeDomain; + sizeDomain = _; + return chart; + }; + + chart.xRange = function(_) { + if (!arguments.length) return xRange; + xRange = _; + return chart; + }; + + chart.yRange = function(_) { + if (!arguments.length) return yRange; + yRange = _; + return chart; + }; + + chart.sizeRange = function(_) { + if (!arguments.length) return sizeRange; + sizeRange = _; + return chart; + }; + + chart.forceX = function(_) { + if (!arguments.length) return forceX; + forceX = _; + return chart; + }; + + chart.forceY = function(_) { + if (!arguments.length) return forceY; + forceY = _; + return chart; + }; + + chart.forceSize = function(_) { + if (!arguments.length) return forceSize; + forceSize = _; + return chart; + }; + + chart.interactive = function(_) { + if (!arguments.length) return interactive; + interactive = _; + return chart; + }; + + chart.pointKey = function(_) { + if (!arguments.length) return pointKey; + pointKey = _; + return chart; + }; + + chart.pointActive = function(_) { + if (!arguments.length) return pointActive; + pointActive = _; + return chart; + }; + + chart.padData = function(_) { + if (!arguments.length) return padData; + padData = _; + return chart; + }; + + chart.padDataOuter = function(_) { + if (!arguments.length) return padDataOuter; + padDataOuter = _; + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.clipVoronoi= function(_) { + if (!arguments.length) return clipVoronoi; + clipVoronoi = _; + return chart; + }; + + chart.useVoronoi= function(_) { + if (!arguments.length) return useVoronoi; + useVoronoi = _; + if (useVoronoi === false) { + clipVoronoi = false; + } + return chart; + }; + + chart.clipRadius = function(_) { + if (!arguments.length) return clipRadius; + clipRadius = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.shape = function(_) { + if (!arguments.length) return getShape; + getShape = _; + return chart; + }; + + chart.onlyCircles = function(_) { + if (!arguments.length) return onlyCircles; + onlyCircles = _; + return chart; + }; + + chart.id = function(_) { + if (!arguments.length) return id; + id = _; + return chart; + }; + + chart.singlePoint = function(_) { + if (!arguments.length) return singlePoint; + singlePoint = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatterChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatterChart.js new file mode 100644 index 0000000..65b6e38 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatterChart.js @@ -0,0 +1,628 @@ +nv.models.scatterChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var scatter = nv.models.scatter() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + , controls = nv.models.legend() + , distX = nv.models.distribution() + , distY = nv.models.distribution() + ; + + var margin = {top: 30, right: 20, bottom: 50, left: 75} + , width = null + , height = null + , color = nv.utils.defaultColor() + , x = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.xScale() + , y = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.yScale() + , xPadding = 0 + , yPadding = 0 + , showDistX = false + , showDistY = false + , showLegend = true + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , showControls = !!d3.fisheye + , fisheye = 0 + , pauseFisheye = false + , tooltips = true + , tooltipX = function(key, x, y) { return '' + x + '' } + , tooltipY = function(key, x, y) { return '' + y + '' } + , tooltip = null + , state = {} + , defaultState = null + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , noData = "No Data Available." + , transitionDuration = 250 + ; + + scatter + .xScale(x) + .yScale(y) + ; + xAxis + .orient('bottom') + .tickPadding(10) + ; + yAxis + .orient((rightAlignYAxis) ? 'right' : 'left') + .tickPadding(10) + ; + distX + .axis('x') + ; + distY + .axis('y') + ; + + controls.updateState(false); + + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0; + + var showTooltip = function(e, offsetElement) { + //TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?) + + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + leftX = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + topX = y.range()[0] + margin.top + ( offsetElement.offsetTop || 0), + leftY = x.range()[0] + margin.left + ( offsetElement.offsetLeft || 0 ), + topY = e.pos[1] + ( offsetElement.offsetTop || 0), + xVal = xAxis.tickFormat()(scatter.x()(e.point, e.pointIndex)), + yVal = yAxis.tickFormat()(scatter.y()(e.point, e.pointIndex)); + + if( tooltipX != null ) + nv.tooltip.show([leftX, topX], tooltipX(e.series.key, xVal, yVal, e, chart), 'n', 1, offsetElement, 'x-nvtooltip'); + if( tooltipY != null ) + nv.tooltip.show([leftY, topY], tooltipY(e.series.key, xVal, yVal, e, chart), 'e', 1, offsetElement, 'y-nvtooltip'); + if( tooltip != null ) + nv.tooltip.show([left, top], tooltip(e.series.key, xVal, yVal, e, chart), e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + var controlsData = [ + { key: 'Magnify', disabled: true } + ]; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().duration(transitionDuration).call(chart); }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display noData message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x0 = x0 || x; + y0 = y0 || y; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id()); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + // background for pointer events + gEnter.append('rect').attr('class', 'nvd3 nv-background'); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-scatterWrap'); + gEnter.append('g').attr('class', 'nv-distWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + var legendWidth = (showControls) ? availableWidth / 2 : availableWidth; + legend.width(legendWidth); + + wrap.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + wrap.select('.nv-legendWrap') + .attr('transform', 'translate(' + (availableWidth - legendWidth) + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + controls.width(180).color(['#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + //------------------------------------------------------------ + // Main Chart Component(s) + + scatter + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + + if (xPadding !== 0) + scatter.xDomain(null); + + if (yPadding !== 0) + scatter.yDomain(null); + + wrap.select('.nv-scatterWrap') + .datum(data.filter(function(d) { return !d.disabled })) + .call(scatter); + + //Adjust for x and y padding + if (xPadding !== 0) { + var xRange = x.domain()[1] - x.domain()[0]; + scatter.xDomain([x.domain()[0] - (xPadding * xRange), x.domain()[1] + (xPadding * xRange)]); + } + + if (yPadding !== 0) { + var yRange = y.domain()[1] - y.domain()[0]; + scatter.yDomain([y.domain()[0] - (yPadding * yRange), y.domain()[1] + (yPadding * yRange)]); + } + + //Only need to update the scatter again if x/yPadding changed the domain. + if (yPadding !== 0 || xPadding !== 0) { + wrap.select('.nv-scatterWrap') + .datum(data.filter(function(d) { return !d.disabled })) + .call(scatter); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + if (showXAxis) { + xAxis + .scale(x) + .ticks( xAxis.ticks() && xAxis.ticks().length ? xAxis.ticks() : availableWidth / 100 ) + .tickSize( -availableHeight , 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')') + .call(xAxis); + + } + + if (showYAxis) { + yAxis + .scale(y) + .ticks( yAxis.ticks() && yAxis.ticks().length ? yAxis.ticks() : availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-y.nv-axis') + .call(yAxis); + } + + + if (showDistX) { + distX + .getData(scatter.x()) + .scale(x) + .width(availableWidth) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + gEnter.select('.nv-distWrap').append('g') + .attr('class', 'nv-distributionX'); + g.select('.nv-distributionX') + .attr('transform', 'translate(0,' + y.range()[0] + ')') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distX); + } + + if (showDistY) { + distY + .getData(scatter.y()) + .scale(y) + .width(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + gEnter.select('.nv-distWrap').append('g') + .attr('class', 'nv-distributionY'); + g.select('.nv-distributionY') + .attr('transform', + 'translate(' + (rightAlignYAxis ? availableWidth : -distY.size() ) + ',0)') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distY); + } + + //------------------------------------------------------------ + + + + + if (d3.fisheye) { + g.select('.nv-background') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g.select('.nv-background').on('mousemove', updateFisheye); + g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye;}); + scatter.dispatch.on('elementClick.freezeFisheye', function() { + pauseFisheye = !pauseFisheye; + }); + } + + + function updateFisheye() { + if (pauseFisheye) { + g.select('.nv-point-paths').style('pointer-events', 'all'); + return false; + } + + g.select('.nv-point-paths').style('pointer-events', 'none' ); + + var mouse = d3.mouse(this); + x.distortion(fisheye).focus(mouse[0]); + y.distortion(fisheye).focus(mouse[1]); + + g.select('.nv-scatterWrap') + .call(scatter); + + if (showXAxis) + g.select('.nv-x.nv-axis').call(xAxis); + + if (showYAxis) + g.select('.nv-y.nv-axis').call(yAxis); + + g.select('.nv-distributionX') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distX); + g.select('.nv-distributionY') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distY); + } + + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + controls.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + fisheye = d.disabled ? 0 : 2.5; + g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all'); + g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' ); + + if (d.disabled) { + x.distortion(fisheye).focus(0); + y.distortion(fisheye).focus(0); + + g.select('.nv-scatterWrap').call(scatter); + g.select('.nv-x.nv-axis').call(xAxis); + g.select('.nv-y.nv-axis').call(yAxis); + } else { + pauseFisheye = false; + } + + chart.update(); + }); + + legend.dispatch.on('stateChange', function(newState) { + state.disabled = newState.disabled; + dispatch.stateChange(state); + chart.update(); + }); + + scatter.dispatch.on('elementMouseover.tooltip', function(e) { + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex) + .attr('y1', function(d,i) { return e.pos[1] - availableHeight;}); + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex) + .attr('x2', e.pos[0] + distX.size()); + + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + chart.update(); + }); + + //============================================================ + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + scatter.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex) + .attr('y1', 0); + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex) + .attr('x2', distY.size()); + }); + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.scatter = scatter; + chart.legend = legend; + chart.controls = controls; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + chart.distX = distX; + chart.distY = distY; + + d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi'); + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + distX.color(color); + distY.color(color); + return chart; + }; + + chart.showDistX = function(_) { + if (!arguments.length) return showDistX; + showDistX = _; + return chart; + }; + + chart.showDistY = function(_) { + if (!arguments.length) return showDistY; + showDistY = _; + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + + chart.fisheye = function(_) { + if (!arguments.length) return fisheye; + fisheye = _; + return chart; + }; + + chart.xPadding = function(_) { + if (!arguments.length) return xPadding; + xPadding = _; + return chart; + }; + + chart.yPadding = function(_) { + if (!arguments.length) return yPadding; + yPadding = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.tooltipXContent = function(_) { + if (!arguments.length) return tooltipX; + tooltipX = _; + return chart; + }; + + chart.tooltipYContent = function(_) { + if (!arguments.length) return tooltipY; + tooltipY = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatterPlusLineChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatterPlusLineChart.js new file mode 100644 index 0000000..23c8785 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/scatterPlusLineChart.js @@ -0,0 +1,620 @@ + +nv.models.scatterPlusLineChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var scatter = nv.models.scatter() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + , controls = nv.models.legend() + , distX = nv.models.distribution() + , distY = nv.models.distribution() + ; + + var margin = {top: 30, right: 20, bottom: 50, left: 75} + , width = null + , height = null + , color = nv.utils.defaultColor() + , x = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.xScale() + , y = d3.fisheye ? d3.fisheye.scale(d3.scale.linear).distortion(0) : scatter.yScale() + , showDistX = false + , showDistY = false + , showLegend = true + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , showControls = !!d3.fisheye + , fisheye = 0 + , pauseFisheye = false + , tooltips = true + , tooltipX = function(key, x, y) { return '' + x + '' } + , tooltipY = function(key, x, y) { return '' + y + '' } + , tooltip = function(key, x, y, date) { return '

          ' + key + '

          ' + + '

          ' + date + '

          ' } + , state = {} + , defaultState = null + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , noData = "No Data Available." + , transitionDuration = 250 + ; + + scatter + .xScale(x) + .yScale(y) + ; + xAxis + .orient('bottom') + .tickPadding(10) + ; + yAxis + .orient((rightAlignYAxis) ? 'right' : 'left') + .tickPadding(10) + ; + distX + .axis('x') + ; + distY + .axis('y') + ; + + controls.updateState(false); + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var x0, y0; + + var showTooltip = function(e, offsetElement) { + //TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?) + + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + leftX = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + topX = y.range()[0] + margin.top + ( offsetElement.offsetTop || 0), + leftY = x.range()[0] + margin.left + ( offsetElement.offsetLeft || 0 ), + topY = e.pos[1] + ( offsetElement.offsetTop || 0), + xVal = xAxis.tickFormat()(scatter.x()(e.point, e.pointIndex)), + yVal = yAxis.tickFormat()(scatter.y()(e.point, e.pointIndex)); + + if( tooltipX != null ) + nv.tooltip.show([leftX, topX], tooltipX(e.series.key, xVal, yVal, e, chart), 'n', 1, offsetElement, 'x-nvtooltip'); + if( tooltipY != null ) + nv.tooltip.show([leftY, topY], tooltipY(e.series.key, xVal, yVal, e, chart), 'e', 1, offsetElement, 'y-nvtooltip'); + if( tooltip != null ) + nv.tooltip.show([left, top], tooltip(e.series.key, xVal, yVal, e.point.tooltip, e, chart), e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + var controlsData = [ + { key: 'Magnify', disabled: true } + ]; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().duration(transitionDuration).call(chart); }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display noData message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = scatter.xScale(); + y = scatter.yScale(); + + x0 = x0 || x; + y0 = y0 || y; + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-scatterChart').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-scatterChart nv-chart-' + scatter.id()); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g') + + // background for pointer events + gEnter.append('rect').attr('class', 'nvd3 nv-background').style("pointer-events","none"); + + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-scatterWrap'); + gEnter.append('g').attr('class', 'nv-regressionLinesWrap'); + gEnter.append('g').attr('class', 'nv-distWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Legend + + if (showLegend) { + legend.width( availableWidth / 2 ); + + wrap.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + wrap.select('.nv-legendWrap') + .attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + controls.width(180).color(['#444']); + g.select('.nv-controlsWrap') + .datum(controlsData) + .attr('transform', 'translate(0,' + (-margin.top) +')') + .call(controls); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Main Chart Component(s) + + scatter + .width(availableWidth) + .height(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })) + + wrap.select('.nv-scatterWrap') + .datum(data.filter(function(d) { return !d.disabled })) + .call(scatter); + + wrap.select('.nv-regressionLinesWrap') + .attr('clip-path', 'url(#nv-edge-clip-' + scatter.id() + ')'); + + var regWrap = wrap.select('.nv-regressionLinesWrap').selectAll('.nv-regLines') + .data(function(d) {return d }); + + regWrap.enter().append('g').attr('class', 'nv-regLines'); + + var regLine = regWrap.selectAll('.nv-regLine').data(function(d){return [d]}); + var regLineEnter = regLine.enter() + .append('line').attr('class', 'nv-regLine') + .style('stroke-opacity', 0); + + regLine + .transition() + .attr('x1', x.range()[0]) + .attr('x2', x.range()[1]) + .attr('y1', function(d,i) {return y(x.domain()[0] * d.slope + d.intercept) }) + .attr('y2', function(d,i) { return y(x.domain()[1] * d.slope + d.intercept) }) + .style('stroke', function(d,i,j) { return color(d,j) }) + .style('stroke-opacity', function(d,i) { + return (d.disabled || typeof d.slope === 'undefined' || typeof d.intercept === 'undefined') ? 0 : 1 + }); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + if (showXAxis) { + xAxis + .scale(x) + .ticks( xAxis.ticks() ? xAxis.ticks() : availableWidth / 100 ) + .tickSize( -availableHeight , 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + y.range()[0] + ')') + .call(xAxis); + } + + if (showYAxis) { + yAxis + .scale(y) + .ticks( yAxis.ticks() ? yAxis.ticks() : availableHeight / 36 ) + .tickSize( -availableWidth, 0); + + g.select('.nv-y.nv-axis') + .call(yAxis); + } + + + if (showDistX) { + distX + .getData(scatter.x()) + .scale(x) + .width(availableWidth) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + gEnter.select('.nv-distWrap').append('g') + .attr('class', 'nv-distributionX'); + g.select('.nv-distributionX') + .attr('transform', 'translate(0,' + y.range()[0] + ')') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distX); + } + + if (showDistY) { + distY + .getData(scatter.y()) + .scale(y) + .width(availableHeight) + .color(data.map(function(d,i) { + return d.color || color(d, i); + }).filter(function(d,i) { return !data[i].disabled })); + gEnter.select('.nv-distWrap').append('g') + .attr('class', 'nv-distributionY'); + g.select('.nv-distributionY') + .attr('transform', 'translate(' + (rightAlignYAxis ? availableWidth : -distY.size() ) + ',0)') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distY); + } + + //------------------------------------------------------------ + + + + + if (d3.fisheye) { + g.select('.nv-background') + .attr('width', availableWidth) + .attr('height', availableHeight) + ; + + g.select('.nv-background').on('mousemove', updateFisheye); + g.select('.nv-background').on('click', function() { pauseFisheye = !pauseFisheye;}); + scatter.dispatch.on('elementClick.freezeFisheye', function() { + pauseFisheye = !pauseFisheye; + }); + } + + + function updateFisheye() { + if (pauseFisheye) { + g.select('.nv-point-paths').style('pointer-events', 'all'); + return false; + } + + g.select('.nv-point-paths').style('pointer-events', 'none' ); + + var mouse = d3.mouse(this); + x.distortion(fisheye).focus(mouse[0]); + y.distortion(fisheye).focus(mouse[1]); + + g.select('.nv-scatterWrap') + .datum(data.filter(function(d) { return !d.disabled })) + .call(scatter); + + if (showXAxis) + g.select('.nv-x.nv-axis').call(xAxis); + + if (showYAxis) + g.select('.nv-y.nv-axis').call(yAxis); + + g.select('.nv-distributionX') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distX); + g.select('.nv-distributionY') + .datum(data.filter(function(d) { return !d.disabled })) + .call(distY); + } + + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + controls.dispatch.on('legendClick', function(d,i) { + d.disabled = !d.disabled; + + fisheye = d.disabled ? 0 : 2.5; + g.select('.nv-background') .style('pointer-events', d.disabled ? 'none' : 'all'); + g.select('.nv-point-paths').style('pointer-events', d.disabled ? 'all' : 'none' ); + + if (d.disabled) { + x.distortion(fisheye).focus(0); + y.distortion(fisheye).focus(0); + + g.select('.nv-scatterWrap').call(scatter); + g.select('.nv-x.nv-axis').call(xAxis); + g.select('.nv-y.nv-axis').call(yAxis); + } else { + pauseFisheye = false; + } + + chart.update(); + }); + + legend.dispatch.on('stateChange', function(newState) { + state = newState; + dispatch.stateChange(state); + chart.update(); + }); + + + scatter.dispatch.on('elementMouseover.tooltip', function(e) { + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex) + .attr('y1', e.pos[1] - availableHeight); + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex) + .attr('x2', e.pos[0] + distX.size()); + + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top]; + dispatch.tooltipShow(e); + }); + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + chart.update(); + }); + + //============================================================ + + + //store old scales for use in transitions on update + x0 = x.copy(); + y0 = y.copy(); + + + }); + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + scatter.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-distx-' + e.pointIndex) + .attr('y1', 0); + d3.select('.nv-chart-' + scatter.id() + ' .nv-series-' + e.seriesIndex + ' .nv-disty-' + e.pointIndex) + .attr('x2', distY.size()); + }); + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.scatter = scatter; + chart.legend = legend; + chart.controls = controls; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + chart.distX = distX; + chart.distY = distY; + + d3.rebind(chart, scatter, 'id', 'interactive', 'pointActive', 'x', 'y', 'shape', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'sizeRange', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'clipRadius', 'useVoronoi'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + distX.color(color); + distY.color(color); + return chart; + }; + + chart.showDistX = function(_) { + if (!arguments.length) return showDistX; + showDistX = _; + return chart; + }; + + chart.showDistY = function(_) { + if (!arguments.length) return showDistY; + showDistY = _; + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + chart.fisheye = function(_) { + if (!arguments.length) return fisheye; + fisheye = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.tooltipXContent = function(_) { + if (!arguments.length) return tooltipX; + tooltipX = _; + return chart; + }; + + chart.tooltipYContent = function(_) { + if (!arguments.length) return tooltipY; + tooltipY = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/sparkline.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/sparkline.js new file mode 100644 index 0000000..e4c2e87 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/sparkline.js @@ -0,0 +1,194 @@ + +nv.models.sparkline = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 2, right: 0, bottom: 2, left: 0} + , width = 400 + , height = 32 + , animate = true + , x = d3.scale.linear() + , y = d3.scale.linear() + , getX = function(d) { return d.x } + , getY = function(d) { return d.y } + , color = nv.utils.getColor(['#000']) + , xDomain + , yDomain + , xRange + , yRange + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + + //------------------------------------------------------------ + // Setup Scales + + x .domain(xDomain || d3.extent(data, getX )) + .range(xRange || [0, availableWidth]); + + y .domain(yDomain || d3.extent(data, getY )) + .range(yRange || [availableHeight, 0]); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-sparkline').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparkline'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')') + + //------------------------------------------------------------ + + + var paths = wrap.selectAll('path') + .data(function(d) { return [d] }); + paths.enter().append('path'); + paths.exit().remove(); + paths + .style('stroke', function(d,i) { return d.color || color(d, i) }) + .attr('d', d3.svg.line() + .x(function(d,i) { return x(getX(d,i)) }) + .y(function(d,i) { return y(getY(d,i)) }) + ); + + + // TODO: Add CURRENT data point (Need Min, Mac, Current / Most recent) + var points = wrap.selectAll('circle.nv-point') + .data(function(data) { + var yValues = data.map(function(d, i) { return getY(d,i); }); + function pointIndex(index) { + if (index != -1) { + var result = data[index]; + result.pointIndex = index; + return result; + } else { + return null; + } + } + var maxPoint = pointIndex(yValues.lastIndexOf(y.domain()[1])), + minPoint = pointIndex(yValues.indexOf(y.domain()[0])), + currentPoint = pointIndex(yValues.length - 1); + return [minPoint, maxPoint, currentPoint].filter(function (d) {return d != null;}); + }); + points.enter().append('circle'); + points.exit().remove(); + points + .attr('cx', function(d,i) { return x(getX(d,d.pointIndex)) }) + .attr('cy', function(d,i) { return y(getY(d,d.pointIndex)) }) + .attr('r', 2) + .attr('class', function(d,i) { + return getX(d, d.pointIndex) == x.domain()[1] ? 'nv-point nv-currentValue' : + getY(d, d.pointIndex) == y.domain()[0] ? 'nv-point nv-minValue' : 'nv-point nv-maxValue' + }); + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = d3.functor(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = d3.functor(_); + return chart; + }; + + chart.xScale = function(_) { + if (!arguments.length) return x; + x = _; + return chart; + }; + + chart.yScale = function(_) { + if (!arguments.length) return y; + y = _; + return chart; + }; + + chart.xDomain = function(_) { + if (!arguments.length) return xDomain; + xDomain = _; + return chart; + }; + + chart.yDomain = function(_) { + if (!arguments.length) return yDomain; + yDomain = _; + return chart; + }; + + chart.xRange = function(_) { + if (!arguments.length) return xRange; + xRange = _; + return chart; + }; + + chart.yRange = function(_) { + if (!arguments.length) return yRange; + yRange = _; + return chart; + }; + + chart.animate = function(_) { + if (!arguments.length) return animate; + animate = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/sparklinePlus.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/sparklinePlus.js new file mode 100644 index 0000000..1535f8a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/sparklinePlus.js @@ -0,0 +1,295 @@ + +nv.models.sparklinePlus = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var sparkline = nv.models.sparkline(); + + var margin = {top: 15, right: 100, bottom: 10, left: 50} + , width = null + , height = null + , x + , y + , index = [] + , paused = false + , xTickFormat = d3.format(',r') + , yTickFormat = d3.format(',.2f') + , showValue = true + , alignValue = true + , rightAlignValue = false + , noData = "No Data Available." + ; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this); + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + + + chart.update = function() { chart(selection) }; + chart.container = this; + + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + var currentValue = sparkline.y()(data[data.length-1], data.length-1); + + //------------------------------------------------------------ + + + + //------------------------------------------------------------ + // Setup Scales + + x = sparkline.xScale(); + y = sparkline.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-sparklineplus').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-sparklineplus'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-sparklineWrap'); + gEnter.append('g').attr('class', 'nv-valueWrap'); + gEnter.append('g').attr('class', 'nv-hoverArea'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Main Chart Component(s) + + var sparklineWrap = g.select('.nv-sparklineWrap'); + + sparkline + .width(availableWidth) + .height(availableHeight); + + sparklineWrap + .call(sparkline); + + //------------------------------------------------------------ + + + var valueWrap = g.select('.nv-valueWrap'); + + var value = valueWrap.selectAll('.nv-currentValue') + .data([currentValue]); + + value.enter().append('text').attr('class', 'nv-currentValue') + .attr('dx', rightAlignValue ? -8 : 8) + .attr('dy', '.9em') + .style('text-anchor', rightAlignValue ? 'end' : 'start'); + + value + .attr('x', availableWidth + (rightAlignValue ? margin.right : 0)) + .attr('y', alignValue ? function(d) { return y(d) } : 0) + .style('fill', sparkline.color()(data[data.length-1], data.length-1)) + .text(yTickFormat(currentValue)); + + + + gEnter.select('.nv-hoverArea').append('rect') + .on('mousemove', sparklineHover) + .on('click', function() { paused = !paused }) + .on('mouseout', function() { index = []; updateValueLine(); }); + //.on('mouseout', function() { index = null; updateValueLine(); }); + + g.select('.nv-hoverArea rect') + .attr('transform', function(d) { return 'translate(' + -margin.left + ',' + -margin.top + ')' }) + .attr('width', availableWidth + margin.left + margin.right) + .attr('height', availableHeight + margin.top); + + + + function updateValueLine() { //index is currently global (within the chart), may or may not keep it that way + if (paused) return; + + var hoverValue = g.selectAll('.nv-hoverValue').data(index) + + var hoverEnter = hoverValue.enter() + .append('g').attr('class', 'nv-hoverValue') + .style('stroke-opacity', 0) + .style('fill-opacity', 0); + + hoverValue.exit() + .transition().duration(250) + .style('stroke-opacity', 0) + .style('fill-opacity', 0) + .remove(); + + hoverValue + .attr('transform', function(d) { return 'translate(' + x(sparkline.x()(data[d],d)) + ',0)' }) + .transition().duration(250) + .style('stroke-opacity', 1) + .style('fill-opacity', 1); + + if (!index.length) return; + + hoverEnter.append('line') + .attr('x1', 0) + .attr('y1', -margin.top) + .attr('x2', 0) + .attr('y2', availableHeight); + + + hoverEnter.append('text').attr('class', 'nv-xValue') + .attr('x', -6) + .attr('y', -margin.top) + .attr('text-anchor', 'end') + .attr('dy', '.9em') + + + g.select('.nv-hoverValue .nv-xValue') + .text(xTickFormat(sparkline.x()(data[index[0]], index[0]))); + + hoverEnter.append('text').attr('class', 'nv-yValue') + .attr('x', 6) + .attr('y', -margin.top) + .attr('text-anchor', 'start') + .attr('dy', '.9em') + + g.select('.nv-hoverValue .nv-yValue') + .text(yTickFormat(sparkline.y()(data[index[0]], index[0]))); + + } + + + function sparklineHover() { + if (paused) return; + + var pos = d3.mouse(this)[0] - margin.left; + + function getClosestIndex(data, x) { + var distance = Math.abs(sparkline.x()(data[0], 0) - x); + var closestIndex = 0; + for (var i = 0; i < data.length; i++){ + if (Math.abs(sparkline.x()(data[i], i) - x) < distance) { + distance = Math.abs(sparkline.x()(data[i], i) - x); + closestIndex = i; + } + } + return closestIndex; + } + + index = [getClosestIndex(data, Math.round(x.invert(pos)))]; + + updateValueLine(); + } + + }); + + return chart; + } + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.sparkline = sparkline; + + d3.rebind(chart, sparkline, 'x', 'y', 'xScale', 'yScale', 'color'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.xTickFormat = function(_) { + if (!arguments.length) return xTickFormat; + xTickFormat = _; + return chart; + }; + + chart.yTickFormat = function(_) { + if (!arguments.length) return yTickFormat; + yTickFormat = _; + return chart; + }; + + chart.showValue = function(_) { + if (!arguments.length) return showValue; + showValue = _; + return chart; + }; + + chart.alignValue = function(_) { + if (!arguments.length) return alignValue; + alignValue = _; + return chart; + }; + + chart.rightAlignValue = function(_) { + if (!arguments.length) return rightAlignValue; + rightAlignValue = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/stackedArea.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/stackedArea.js new file mode 100644 index 0000000..eefeb8f --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/stackedArea.js @@ -0,0 +1,368 @@ + +nv.models.stackedArea = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var margin = {top: 0, right: 0, bottom: 0, left: 0} + , width = 960 + , height = 500 + , color = nv.utils.defaultColor() // a function that computes the color + , id = Math.floor(Math.random() * 100000) //Create semi-unique ID incase user doesn't selet one + , getX = function(d) { return d.x } // accessor to get the x value from a data point + , getY = function(d) { return d.y } // accessor to get the y value from a data point + , style = 'stack' + , offset = 'zero' + , order = 'default' + , interpolate = 'linear' // controls the line interpolation + , clipEdge = false // if true, masks lines within x and y scale + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , scatter = nv.models.scatter() + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'areaClick', 'areaMouseover', 'areaMouseout') + ; + + scatter + .size(2.2) // default size + .sizeDomain([2.2,2.2]) // all the same size by default + ; + + /************************************ + * offset: + * 'wiggle' (stream) + * 'zero' (stacked) + * 'expand' (normalize to 100%) + * 'silhouette' (simple centered) + * + * order: + * 'inside-out' (stream) + * 'default' (input order) + ************************************/ + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var availableWidth = width - margin.left - margin.right, + availableHeight = height - margin.top - margin.bottom, + container = d3.select(this); + + //------------------------------------------------------------ + // Setup Scales + + x = scatter.xScale(); + y = scatter.yScale(); + + //------------------------------------------------------------ + + var dataRaw = data; + // Injecting point index into each point because d3.layout.stack().out does not give index + data.forEach(function(aseries, i) { + aseries.seriesIndex = i; + aseries.values = aseries.values.map(function(d, j) { + d.index = j; + d.seriesIndex = i; + return d; + }); + }); + + var dataFiltered = data.filter(function(series) { + return !series.disabled; + }); + + data = d3.layout.stack() + .order(order) + .offset(offset) + .values(function(d) { return d.values }) //TODO: make values customizeable in EVERY model in this fashion + .x(getX) + .y(getY) + .out(function(d, y0, y) { + var yHeight = (getY(d) === 0) ? 0 : y; + d.display = { + y: yHeight, + y0: y0 + }; + }) + (dataFiltered); + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-stackedarea').data([data]); + var wrapEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedarea'); + var defsEnter = wrapEnter.append('defs'); + var gEnter = wrapEnter.append('g'); + var g = wrap.select('g'); + + gEnter.append('g').attr('class', 'nv-areaWrap'); + gEnter.append('g').attr('class', 'nv-scatterWrap'); + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + //------------------------------------------------------------ + + + scatter + .width(availableWidth) + .height(availableHeight) + .x(getX) + .y(function(d) { return d.display.y + d.display.y0 }) + .forceY([0]) + .color(data.map(function(d,i) { + return d.color || color(d, d.seriesIndex); + })); + + + var scatterWrap = g.select('.nv-scatterWrap') + .datum(data); + + scatterWrap.call(scatter); + + defsEnter.append('clipPath') + .attr('id', 'nv-edge-clip-' + id) + .append('rect'); + + wrap.select('#nv-edge-clip-' + id + ' rect') + .attr('width', availableWidth) + .attr('height', availableHeight); + + g .attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : ''); + + var area = d3.svg.area() + .x(function(d,i) { return x(getX(d,i)) }) + .y0(function(d) { + return y(d.display.y0) + }) + .y1(function(d) { + return y(d.display.y + d.display.y0) + }) + .interpolate(interpolate); + + var zeroArea = d3.svg.area() + .x(function(d,i) { return x(getX(d,i)) }) + .y0(function(d) { return y(d.display.y0) }) + .y1(function(d) { return y(d.display.y0) }); + + + var path = g.select('.nv-areaWrap').selectAll('path.nv-area') + .data(function(d) { return d }); + + path.enter().append('path').attr('class', function(d,i) { return 'nv-area nv-area-' + i }) + .attr('d', function(d,i){ + return zeroArea(d.values, d.seriesIndex); + }) + .on('mouseover', function(d,i) { + d3.select(this).classed('hover', true); + dispatch.areaMouseover({ + point: d, + series: d.key, + pos: [d3.event.pageX, d3.event.pageY], + seriesIndex: i + }); + }) + .on('mouseout', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.areaMouseout({ + point: d, + series: d.key, + pos: [d3.event.pageX, d3.event.pageY], + seriesIndex: i + }); + }) + .on('click', function(d,i) { + d3.select(this).classed('hover', false); + dispatch.areaClick({ + point: d, + series: d.key, + pos: [d3.event.pageX, d3.event.pageY], + seriesIndex: i + }); + }) + path.exit().transition() + .attr('d', function(d,i) { return zeroArea(d.values,i) }) + .remove(); + path + .style('fill', function(d,i){ + return d.color || color(d, d.seriesIndex) + }) + .style('stroke', function(d,i){ return d.color || color(d, d.seriesIndex) }); + path.transition() + .attr('d', function(d,i) { + return area(d.values,i) + }); + + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + scatter.dispatch.on('elementMouseover.area', function(e) { + g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', true); + }); + scatter.dispatch.on('elementMouseout.area', function(e) { + g.select('.nv-chart-' + id + ' .nv-area-' + e.seriesIndex).classed('hover', false); + }); + + //============================================================ + //Special offset functions + chart.d3_stackedOffset_stackPercent = function(stackData) { + var n = stackData.length, //How many series + m = stackData[0].length, //how many points per series + k = 1 / n, + i, + j, + o, + y0 = []; + + for (j = 0; j < m; ++j) { //Looping through all points + for (i = 0, o = 0; i < dataRaw.length; i++) //looping through series' + o += getY(dataRaw[i].values[j]) //total value of all points at a certian point in time. + + if (o) for (i = 0; i < n; i++) + stackData[i][j][1] /= o; + else + for (i = 0; i < n; i++) + stackData[i][j][1] = k; + } + for (j = 0; j < m; ++j) y0[j] = 0; + return y0; + }; + + }); + + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + scatter.dispatch.on('elementClick.area', function(e) { + dispatch.areaClick(e); + }) + scatter.dispatch.on('elementMouseover.tooltip', function(e) { + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top], + dispatch.tooltipShow(e); + }); + scatter.dispatch.on('elementMouseout.tooltip', function(e) { + dispatch.tooltipHide(e); + }); + + //============================================================ + + //============================================================ + // Global getters and setters + //------------------------------------------------------------ + + chart.dispatch = dispatch; + chart.scatter = scatter; + + d3.rebind(chart, scatter, 'interactive', 'size', 'xScale', 'yScale', 'zScale', 'xDomain', 'yDomain', 'xRange', 'yRange', + 'sizeDomain', 'forceX', 'forceY', 'forceSize', 'clipVoronoi', 'useVoronoi','clipRadius','highlightPoint','clearHighlights'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.x = function(_) { + if (!arguments.length) return getX; + getX = d3.functor(_); + return chart; + }; + + chart.y = function(_) { + if (!arguments.length) return getY; + getY = d3.functor(_); + return chart; + } + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.clipEdge = function(_) { + if (!arguments.length) return clipEdge; + clipEdge = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + return chart; + }; + + chart.offset = function(_) { + if (!arguments.length) return offset; + offset = _; + return chart; + }; + + chart.order = function(_) { + if (!arguments.length) return order; + order = _; + return chart; + }; + + //shortcut for offset + order + chart.style = function(_) { + if (!arguments.length) return style; + style = _; + + switch (style) { + case 'stack': + chart.offset('zero'); + chart.order('default'); + break; + case 'stream': + chart.offset('wiggle'); + chart.order('inside-out'); + break; + case 'stream-center': + chart.offset('silhouette'); + chart.order('inside-out'); + break; + case 'expand': + chart.offset('expand'); + chart.order('default'); + break; + case 'stack_percent': + chart.offset(chart.d3_stackedOffset_stackPercent); + chart.order('default'); + break; + } + + return chart; + }; + + chart.interpolate = function(_) { + if (!arguments.length) return interpolate; + interpolate = _; + return chart; + }; + //============================================================ + + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/stackedAreaChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/stackedAreaChart.js new file mode 100644 index 0000000..a036b8b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/models/stackedAreaChart.js @@ -0,0 +1,629 @@ + +nv.models.stackedAreaChart = function() { + "use strict"; + //============================================================ + // Public Variables with Default Settings + //------------------------------------------------------------ + + var stacked = nv.models.stackedArea() + , xAxis = nv.models.axis() + , yAxis = nv.models.axis() + , legend = nv.models.legend() + , controls = nv.models.legend() + , interactiveLayer = nv.interactiveGuideline() + ; + + var margin = {top: 30, right: 25, bottom: 50, left: 60} + , width = null + , height = null + , color = nv.utils.defaultColor() // a function that takes in d, i and returns color + , showControls = true + , showLegend = true + , showXAxis = true + , showYAxis = true + , rightAlignYAxis = false + , useInteractiveGuideline = false + , tooltips = true + , tooltip = function(key, x, y, e, graph) { + return '

          ' + key + '

          ' + + '

          ' + y + ' on ' + x + '

          ' + } + , x //can be accessed via chart.xScale() + , y //can be accessed via chart.yScale() + , yAxisTickFormat = d3.format(',.2f') + , state = { style: stacked.style() } + , defaultState = null + , noData = 'No Data Available.' + , dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState') + , controlWidth = 250 + , cData = ['Stacked','Stream','Expanded'] + , controlLabels = {} + , transitionDuration = 250 + ; + + xAxis + .orient('bottom') + .tickPadding(7) + ; + yAxis + .orient((rightAlignYAxis) ? 'right' : 'left') + ; + + controls.updateState(false); + //============================================================ + + + //============================================================ + // Private Variables + //------------------------------------------------------------ + + var showTooltip = function(e, offsetElement) { + var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ), + top = e.pos[1] + ( offsetElement.offsetTop || 0), + x = xAxis.tickFormat()(stacked.x()(e.point, e.pointIndex)), + y = yAxis.tickFormat()(stacked.y()(e.point, e.pointIndex)), + content = tooltip(e.series.key, x, y, e, chart); + + nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement); + }; + + //============================================================ + + + function chart(selection) { + selection.each(function(data) { + var container = d3.select(this), + that = this; + + var availableWidth = (width || parseInt(container.style('width')) || 960) + - margin.left - margin.right, + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + + chart.update = function() { container.transition().duration(transitionDuration).call(chart); }; + chart.container = this; + + //set state.disabled + state.disabled = data.map(function(d) { return !!d.disabled }); + + if (!defaultState) { + var key; + defaultState = {}; + for (key in state) { + if (state[key] instanceof Array) + defaultState[key] = state[key].slice(0); + else + defaultState[key] = state[key]; + } + } + + //------------------------------------------------------------ + // Display No Data message if there's nothing to show. + + if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) { + var noDataText = container.selectAll('.nv-noData').data([noData]); + + noDataText.enter().append('text') + .attr('class', 'nvd3 nv-noData') + .attr('dy', '-.7em') + .style('text-anchor', 'middle'); + + noDataText + .attr('x', margin.left + availableWidth / 2) + .attr('y', margin.top + availableHeight / 2) + .text(function(d) { return d }); + + return chart; + } else { + container.selectAll('.nv-noData').remove(); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Scales + + x = stacked.xScale(); + y = stacked.yScale(); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup containers and skeleton of chart + + var wrap = container.selectAll('g.nv-wrap.nv-stackedAreaChart').data([data]); + var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-stackedAreaChart').append('g'); + var g = wrap.select('g'); + + gEnter.append("rect").style("opacity",0); + gEnter.append('g').attr('class', 'nv-x nv-axis'); + gEnter.append('g').attr('class', 'nv-y nv-axis'); + gEnter.append('g').attr('class', 'nv-stackedWrap'); + gEnter.append('g').attr('class', 'nv-legendWrap'); + gEnter.append('g').attr('class', 'nv-controlsWrap'); + gEnter.append('g').attr('class', 'nv-interactive'); + + g.select("rect").attr("width",availableWidth).attr("height",availableHeight); + //------------------------------------------------------------ + // Legend + + if (showLegend) { + var legendWidth = (showControls) ? availableWidth - controlWidth : availableWidth; + legend + .width(legendWidth); + + g.select('.nv-legendWrap') + .datum(data) + .call(legend); + + if ( margin.top != legend.height()) { + margin.top = legend.height(); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + g.select('.nv-legendWrap') + .attr('transform', 'translate(' + (availableWidth-legendWidth) + ',' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Controls + + if (showControls) { + var controlsData = [ + { + key: controlLabels.stacked || 'Stacked', + metaKey: 'Stacked', + disabled: stacked.style() != 'stack', + style: 'stack' + }, + { + key: controlLabels.stream || 'Stream', + metaKey: 'Stream', + disabled: stacked.style() != 'stream', + style: 'stream' + }, + { + key: controlLabels.expanded || 'Expanded', + metaKey: 'Expanded', + disabled: stacked.style() != 'expand', + style: 'expand' + }, + { + key: controlLabels.stack_percent || 'Stack %', + metaKey: 'Stack_Percent', + disabled: stacked.style() != 'stack_percent', + style: 'stack_percent' + } + ]; + + controlWidth = (cData.length/3) * 260; + + controlsData = controlsData.filter(function(d) { + return cData.indexOf(d.metaKey) !== -1; + }) + + controls + .width( controlWidth ) + .color(['#444', '#444', '#444']); + + g.select('.nv-controlsWrap') + .datum(controlsData) + .call(controls); + + + if ( margin.top != Math.max(controls.height(), legend.height()) ) { + margin.top = Math.max(controls.height(), legend.height()); + availableHeight = (height || parseInt(container.style('height')) || 400) + - margin.top - margin.bottom; + } + + + g.select('.nv-controlsWrap') + .attr('transform', 'translate(0,' + (-margin.top) +')'); + } + + //------------------------------------------------------------ + + + wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + if (rightAlignYAxis) { + g.select(".nv-y.nv-axis") + .attr("transform", "translate(" + availableWidth + ",0)"); + } + + //------------------------------------------------------------ + // Main Chart Component(s) + + //------------------------------------------------------------ + //Set up interactive layer + if (useInteractiveGuideline) { + interactiveLayer + .width(availableWidth) + .height(availableHeight) + .margin({left: margin.left, top: margin.top}) + .svgContainer(container) + .xScale(x); + wrap.select(".nv-interactive").call(interactiveLayer); + } + + stacked + .width(availableWidth) + .height(availableHeight) + + var stackedWrap = g.select('.nv-stackedWrap') + .datum(data); + + stackedWrap.transition().call(stacked); + + //------------------------------------------------------------ + + + //------------------------------------------------------------ + // Setup Axes + + if (showXAxis) { + xAxis + .scale(x) + .ticks( availableWidth / 100 ) + .tickSize( -availableHeight, 0); + + g.select('.nv-x.nv-axis') + .attr('transform', 'translate(0,' + availableHeight + ')'); + + g.select('.nv-x.nv-axis') + .transition().duration(0) + .call(xAxis); + } + + if (showYAxis) { + yAxis + .scale(y) + .ticks(stacked.offset() == 'wiggle' ? 0 : availableHeight / 36) + .tickSize(-availableWidth, 0) + .setTickFormat( (stacked.style() == 'expand' || stacked.style() == 'stack_percent') + ? d3.format('%') : yAxisTickFormat); + + g.select('.nv-y.nv-axis') + .transition().duration(0) + .call(yAxis); + } + + //------------------------------------------------------------ + + + //============================================================ + // Event Handling/Dispatching (in chart's scope) + //------------------------------------------------------------ + + stacked.dispatch.on('areaClick.toggle', function(e) { + if (data.filter(function(d) { return !d.disabled }).length === 1) + data.forEach(function(d) { + d.disabled = false; + }); + else + data.forEach(function(d,i) { + d.disabled = (i != e.seriesIndex); + }); + + state.disabled = data.map(function(d) { return !!d.disabled }); + dispatch.stateChange(state); + + chart.update(); + }); + + legend.dispatch.on('stateChange', function(newState) { + state.disabled = newState.disabled; + dispatch.stateChange(state); + chart.update(); + }); + + controls.dispatch.on('legendClick', function(d,i) { + if (!d.disabled) return; + + controlsData = controlsData.map(function(s) { + s.disabled = true; + return s; + }); + d.disabled = false; + + stacked.style(d.style); + + + state.style = stacked.style(); + dispatch.stateChange(state); + + chart.update(); + }); + + + interactiveLayer.dispatch.on('elementMousemove', function(e) { + stacked.clearHighlights(); + var singlePoint, pointIndex, pointXLocation, allData = []; + data + .filter(function(series, i) { + series.seriesIndex = i; + return !series.disabled; + }) + .forEach(function(series,i) { + pointIndex = nv.interactiveBisect(series.values, e.pointXValue, chart.x()); + stacked.highlightPoint(i, pointIndex, true); + var point = series.values[pointIndex]; + if (typeof point === 'undefined') return; + if (typeof singlePoint === 'undefined') singlePoint = point; + if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex)); + + //If we are in 'expand' mode, use the stacked percent value instead of raw value. + var tooltipValue = (stacked.style() == 'expand') ? point.display.y : chart.y()(point,pointIndex); + allData.push({ + key: series.key, + value: tooltipValue, + color: color(series,series.seriesIndex), + stackedValue: point.display + }); + }); + + allData.reverse(); + + //Highlight the tooltip entry based on which stack the mouse is closest to. + if (allData.length > 2) { + var yValue = chart.yScale().invert(e.mouseY); + var yDistMax = Infinity, indexToHighlight = null; + allData.forEach(function(series,i) { + if ( yValue >= series.stackedValue.y0 && yValue <= (series.stackedValue.y0 + series.stackedValue.y)) + { + indexToHighlight = i; + return; + } + }); + if (indexToHighlight != null) + allData[indexToHighlight].highlight = true; + } + + var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex)); + + //If we are in 'expand' mode, force the format to be a percentage. + var valueFormatter = (stacked.style() == 'expand') ? + function(d,i) {return d3.format(".1%")(d);} : + function(d,i) {return yAxis.tickFormat()(d); }; + interactiveLayer.tooltip + .position({left: pointXLocation + margin.left, top: e.mouseY + margin.top}) + .chartContainer(that.parentNode) + .enabled(tooltips) + .valueFormatter(valueFormatter) + .data( + { + value: xValue, + series: allData + } + )(); + + interactiveLayer.renderGuideLine(pointXLocation); + + }); + + interactiveLayer.dispatch.on("elementMouseout",function(e) { + dispatch.tooltipHide(); + stacked.clearHighlights(); + }); + + + dispatch.on('tooltipShow', function(e) { + if (tooltips) showTooltip(e, that.parentNode); + }); + + // Update chart from a state object passed to event handler + dispatch.on('changeState', function(e) { + + if (typeof e.disabled !== 'undefined') { + data.forEach(function(series,i) { + series.disabled = e.disabled[i]; + }); + + state.disabled = e.disabled; + } + + if (typeof e.style !== 'undefined') { + stacked.style(e.style); + } + + chart.update(); + }); + + }); + + + return chart; + } + + + //============================================================ + // Event Handling/Dispatching (out of chart's scope) + //------------------------------------------------------------ + + stacked.dispatch.on('tooltipShow', function(e) { + //disable tooltips when value ~= 0 + //// TODO: consider removing points from voronoi that have 0 value instead of this hack + /* + if (!Math.round(stacked.y()(e.point) * 100)) { // 100 will not be good for very small numbers... will have to think about making this valu dynamic, based on data range + setTimeout(function() { d3.selectAll('.point.hover').classed('hover', false) }, 0); + return false; + } + */ + + e.pos = [e.pos[0] + margin.left, e.pos[1] + margin.top], + dispatch.tooltipShow(e); + }); + + stacked.dispatch.on('tooltipHide', function(e) { + dispatch.tooltipHide(e); + }); + + dispatch.on('tooltipHide', function() { + if (tooltips) nv.tooltip.cleanup(); + }); + + //============================================================ + + + //============================================================ + // Expose Public Variables + //------------------------------------------------------------ + + // expose chart's sub-components + chart.dispatch = dispatch; + chart.stacked = stacked; + chart.legend = legend; + chart.controls = controls; + chart.xAxis = xAxis; + chart.yAxis = yAxis; + chart.interactiveLayer = interactiveLayer; + + d3.rebind(chart, stacked, 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'xRange', 'yRange', 'sizeDomain', 'interactive', 'useVoronoi', 'offset', 'order', 'style', 'clipEdge', 'forceX', 'forceY', 'forceSize', 'interpolate'); + + chart.options = nv.utils.optionsFunc.bind(chart); + + chart.margin = function(_) { + if (!arguments.length) return margin; + margin.top = typeof _.top != 'undefined' ? _.top : margin.top; + margin.right = typeof _.right != 'undefined' ? _.right : margin.right; + margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom; + margin.left = typeof _.left != 'undefined' ? _.left : margin.left; + return chart; + }; + + chart.width = function(_) { + if (!arguments.length) return width; + width = _; + return chart; + }; + + chart.height = function(_) { + if (!arguments.length) return height; + height = _; + return chart; + }; + + chart.color = function(_) { + if (!arguments.length) return color; + color = nv.utils.getColor(_); + legend.color(color); + stacked.color(color); + return chart; + }; + + chart.showControls = function(_) { + if (!arguments.length) return showControls; + showControls = _; + return chart; + }; + + chart.showLegend = function(_) { + if (!arguments.length) return showLegend; + showLegend = _; + return chart; + }; + + chart.showXAxis = function(_) { + if (!arguments.length) return showXAxis; + showXAxis = _; + return chart; + }; + + chart.showYAxis = function(_) { + if (!arguments.length) return showYAxis; + showYAxis = _; + return chart; + }; + + chart.rightAlignYAxis = function(_) { + if(!arguments.length) return rightAlignYAxis; + rightAlignYAxis = _; + yAxis.orient( (_) ? 'right' : 'left'); + return chart; + }; + + chart.useInteractiveGuideline = function(_) { + if(!arguments.length) return useInteractiveGuideline; + useInteractiveGuideline = _; + if (_ === true) { + chart.interactive(false); + chart.useVoronoi(false); + } + return chart; + }; + + chart.tooltip = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.tooltips = function(_) { + if (!arguments.length) return tooltips; + tooltips = _; + return chart; + }; + + chart.tooltipContent = function(_) { + if (!arguments.length) return tooltip; + tooltip = _; + return chart; + }; + + chart.state = function(_) { + if (!arguments.length) return state; + state = _; + return chart; + }; + + chart.defaultState = function(_) { + if (!arguments.length) return defaultState; + defaultState = _; + return chart; + }; + + chart.noData = function(_) { + if (!arguments.length) return noData; + noData = _; + return chart; + }; + + chart.transitionDuration = function(_) { + if (!arguments.length) return transitionDuration; + transitionDuration = _; + return chart; + }; + + chart.controlsData = function(_) { + if (!arguments.length) return cData; + cData = _; + return chart; + }; + + chart.controlLabels = function(_) { + if (!arguments.length) return controlLabels; + if (typeof _ !== 'object') return controlLabels; + controlLabels = _; + return chart; + }; + + yAxis.setTickFormat = yAxis.tickFormat; + + yAxis.tickFormat = function(_) { + if (!arguments.length) return yAxisTickFormat; + yAxisTickFormat = _; + return yAxis; + }; + + + //============================================================ + + return chart; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/nv.d3.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/nv.d3.min.js new file mode 100644 index 0000000..892379c --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/nv.d3.min.js @@ -0,0 +1 @@ +(function(){function t(e,t){return(new Date(t,e+1,0)).getDate()}function n(e,t,n){return function(r,i,s){var o=e(r),u=[];if(o1){while(op||r>d||d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined||a){if(l){if(d3.event.relatedTarget&&d3.event.relatedTarget.ownerSVGElement===undefined&&d3.event.relatedTarget.className.match(t.nvPointerEventsClass)){return}}u.elementMouseout({mouseX:n,mouseY:r});c.renderGuideLine(null);return}var f=s.invert(n);u.elementMousemove({mouseX:n,mouseY:r,pointXValue:f});if(d3.event.type==="dblclick"){u.elementDblclick({mouseX:n,mouseY:r,pointXValue:f})}}var h=d3.select(this);var p=n||960,d=r||400;var v=h.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([o]);var m=v.enter().append("g").attr("class"," nv-wrap nv-interactiveLineLayer");m.append("g").attr("class","nv-interactiveGuideLine");if(!f){return}f.on("mousemove",g,true).on("mouseout",g,true).on("dblclick",g);c.renderGuideLine=function(t){if(!a)return;var n=v.select(".nv-interactiveGuideLine").selectAll("line").data(t!=null?[e.utils.NaNtoZero(t)]:[],String);n.enter().append("line").attr("class","nv-guideline").attr("x1",function(e){return e}).attr("x2",function(e){return e}).attr("y1",d).attr("y2",0);n.exit().remove()}})}var t=e.models.tooltip();var n=null,r=null,i={left:0,top:0},s=d3.scale.linear(),o=d3.scale.linear(),u=d3.dispatch("elementMousemove","elementMouseout","elementDblclick"),a=true,f=null;var l=navigator.userAgent.indexOf("MSIE")!==-1;c.dispatch=u;c.tooltip=t;c.margin=function(e){if(!arguments.length)return i;i.top=typeof e.top!="undefined"?e.top:i.top;i.left=typeof e.left!="undefined"?e.left:i.left;return c};c.width=function(e){if(!arguments.length)return n;n=e;return c};c.height=function(e){if(!arguments.length)return r;r=e;return c};c.xScale=function(e){if(!arguments.length)return s;s=e;return c};c.showGuideLine=function(e){if(!arguments.length)return a;a=e;return c};c.svgContainer=function(e){if(!arguments.length)return f;f=e;return c};return c};e.interactiveBisect=function(e,t,n){"use strict";if(!e instanceof Array)return null;if(typeof n!=="function")n=function(e,t){return e.x};var r=d3.bisector(n).left;var i=d3.max([0,r(e,t)-1]);var s=n(e[i],i);if(typeof s==="undefined")s=i;if(s===t)return i;var o=d3.min([i+1,e.length-1]);var u=n(e[o],o);if(typeof u==="undefined")u=o;if(Math.abs(u-t)>=Math.abs(s-t))return i;else return o};e.nearestValueIndex=function(e,t,n){"use strict";var r=Infinity,i=null;e.forEach(function(e,s){var o=Math.abs(t-e);if(o<=r&&oT.height?0:x}v.top=Math.abs(x-S.top);v.left=Math.abs(E.left-S.left)}t+=a.offsetLeft+v.left-2*a.scrollLeft;u+=a.offsetTop+v.top-2*a.scrollTop}if(s&&s>0){u=Math.floor(u/s)*s}e.tooltip.calcTooltipPosition([t,u],r,i,h);return w}var t=null,n=null,r="w",i=50,s=25,o=null,u=null,a=null,f=null,l={left:null,top:null},c=true,h="nvtooltip-"+Math.floor(Math.random()*1e5);var p="nv-pointer-events-none";var d=function(e,t){return e};var v=function(e){return e};var m=function(e){if(t!=null)return t;if(e==null)return"";var n=d3.select(document.createElement("table"));var r=n.selectAll("thead").data([e]).enter().append("thead");r.append("tr").append("td").attr("colspan",3).append("strong").classed("x-value",true).html(v(e.value));var i=n.selectAll("tbody").data([e]).enter().append("tbody");var s=i.selectAll("tr").data(function(e){return e.series}).enter().append("tr").classed("highlight",function(e){return e.highlight});s.append("td").classed("legend-color-guide",true).append("div").style("background-color",function(e){return e.color});s.append("td").classed("key",true).html(function(e){return e.key});s.append("td").classed("value",true).html(function(e,t){return d(e.value,t)});s.selectAll("td").each(function(e){if(e.highlight){var t=d3.scale.linear().domain([0,1]).range(["#fff",e.color]);var n=.6;d3.select(this).style("border-bottom-color",t(n)).style("border-top-color",t(n))}});var o=n.node().outerHTML;if(e.footer!==undefined)o+="";return o};var g=function(e){if(e&&e.series&&e.series.length>0)return true;return false};w.nvPointerEventsClass=p;w.content=function(e){if(!arguments.length)return t;t=e;return w};w.tooltipElem=function(){return f};w.contentGenerator=function(e){if(!arguments.length)return m;if(typeof e==="function"){m=e}return w};w.data=function(e){if(!arguments.length)return n;n=e;return w};w.gravity=function(e){if(!arguments.length)return r;r=e;return w};w.distance=function(e){if(!arguments.length)return i;i=e;return w};w.snapDistance=function(e){if(!arguments.length)return s;s=e;return w};w.classes=function(e){if(!arguments.length)return u;u=e;return w};w.chartContainer=function(e){if(!arguments.length)return a;a=e;return w};w.position=function(e){if(!arguments.length)return l;l.left=typeof e.left!=="undefined"?e.left:l.left;l.top=typeof e.top!=="undefined"?e.top:l.top;return w};w.fixedTop=function(e){if(!arguments.length)return o;o=e;return w};w.enabled=function(e){if(!arguments.length)return c;c=e;return w};w.valueFormatter=function(e){if(!arguments.length)return d;if(typeof e==="function"){d=e}return w};w.headerFormatter=function(e){if(!arguments.length)return v;if(typeof e==="function"){v=e}return w};w.id=function(){return h};return w};e.tooltip.show=function(t,n,r,i,s,o){var u=document.createElement("div");u.className="nvtooltip "+(o?o:"xy-tooltip");var a=s;if(!s||s.tagName.match(/g|svg/i)){a=document.getElementsByTagName("body")[0]}u.style.left=0;u.style.top=0;u.style.opacity=0;u.innerHTML=n;a.appendChild(u);if(s){t[0]=t[0]-s.scrollLeft;t[1]=t[1]-s.scrollTop}e.tooltip.calcTooltipPosition(t,r,i,u)};e.tooltip.findFirstNonSVGParent=function(e){while(e.tagName.match(/^g|svg$/i)!==null){e=e.parentNode}return e};e.tooltip.findTotalOffsetTop=function(e,t){var n=t;do{if(!isNaN(e.offsetTop)){n+=e.offsetTop}}while(e=e.offsetParent);return n};e.tooltip.findTotalOffsetLeft=function(e,t){var n=t;do{if(!isNaN(e.offsetLeft)){n+=e.offsetLeft}}while(e=e.offsetParent);return n};e.tooltip.calcTooltipPosition=function(t,n,r,i){var s=parseInt(i.offsetHeight),o=parseInt(i.offsetWidth),u=e.utils.windowSize().width,a=e.utils.windowSize().height,f=window.pageYOffset,l=window.pageXOffset,c,h;a=window.innerWidth>=document.body.scrollWidth?a:a-16;u=window.innerHeight>=document.body.scrollHeight?u:u-16;n=n||"s";r=r||20;var p=function(t){return e.tooltip.findTotalOffsetTop(t,h)};var d=function(t){return e.tooltip.findTotalOffsetLeft(t,c)};switch(n){case"e":c=t[0]-o-r;h=t[1]-s/2;var v=d(i);var m=p(i);if(vl?t[0]+r:l-v+c;if(mf+a)h=f+a-m+h-s;break;case"w":c=t[0]+r;h=t[1]-s/2;var v=d(i);var m=p(i);if(v+o>u)c=t[0]-o-r;if(mf+a)h=f+a-m+h-s;break;case"n":c=t[0]-o/2-5;h=t[1]+r;var v=d(i);var m=p(i);if(vu)c=c-o/2+5;if(m+s>f+a)h=f+a-m+h-s;break;case"s":c=t[0]-o/2;h=t[1]-s-r;var v=d(i);var m=p(i);if(vu)c=c-o/2+5;if(f>m)h=f;break;case"none":c=t[0];h=t[1]-r;var v=d(i);var m=p(i);break}i.style.left=c+"px";i.style.top=h+"px";i.style.opacity=1;i.style.position="absolute";return i};e.tooltip.cleanup=function(){var e=document.getElementsByClassName("nvtooltip");var t=[];while(e.length){t.push(e[0]);e[0].style.transitionDelay="0 !important";e[0].style.opacity=0;e[0].className="nvtooltip-pending-removal"}setTimeout(function(){while(t.length){var e=t.pop();e.parentNode.removeChild(e)}},500)}})();e.utils.windowSize=function(){var e={width:640,height:480};if(document.body&&document.body.offsetWidth){e.width=document.body.offsetWidth;e.height=document.body.offsetHeight}if(document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth){e.width=document.documentElement.offsetWidth;e.height=document.documentElement.offsetHeight}if(window.innerWidth&&window.innerHeight){e.width=window.innerWidth;e.height=window.innerHeight}return e};e.utils.windowResize=function(e){if(e===undefined)return;var t=window.onresize;window.onresize=function(n){if(typeof t=="function")t(n);e(n)}};e.utils.getColor=function(t){if(!arguments.length)return e.utils.defaultColor();if(Object.prototype.toString.call(t)==="[object Array]")return function(e,n){return e.color||t[n%t.length]};else return t};e.utils.defaultColor=function(){var e=d3.scale.category20().range();return function(t,n){return t.color||e[n%e.length]}};e.utils.customTheme=function(e,t,n){t=t||function(e){return e.key};n=n||d3.scale.category20().range();var r=n.length;return function(i,s){var o=t(i);if(!r)r=n.length;if(typeof e[o]!=="undefined")return typeof e[o]==="function"?e[o]():e[o];else return n[--r]}};e.utils.pjax=function(t,n){function r(r){d3.html(r,function(r){var i=d3.select(n).node();i.parentNode.replaceChild(d3.select(r).select(n).node(),i);e.utils.pjax(t,n)})}d3.selectAll(t).on("click",function(){history.pushState(this.href,this.textContent,this.href);r(this.href);d3.event.preventDefault()});d3.select(window).on("popstate",function(){if(d3.event.state)r(d3.event.state)})};e.utils.calcApproxTextWidth=function(e){if(e instanceof d3.selection){var t=parseInt(e.style("font-size").replace("px",""));var n=e.text().length;return n*t*.5}return 0};e.utils.NaNtoZero=function(e){if(typeof e!=="number"||isNaN(e)||e===null||e===Infinity)return 0;return e};e.utils.optionsFunc=function(e){if(e){d3.map(e).forEach(function(e,t){if(typeof this[e]==="function"){this[e](t)}}.bind(this))}return this};e.models.axis=function(){"use strict";function g(e){e.each(function(e){var i=d3.select(this);var g=i.selectAll("g.nv-wrap.nv-axis").data([e]);var y=g.enter().append("g").attr("class","nvd3 nv-wrap nv-axis");var b=y.append("g");var w=g.select("g");if(p!==null)t.ticks(p);else if(t.orient()=="top"||t.orient()=="bottom")t.ticks(Math.abs(s.range()[1]-s.range()[0])/100);w.transition().call(t);m=m||t.scale();var E=t.tickFormat();if(E==null){E=m.tickFormat()}var S=w.selectAll("text.nv-axislabel").data([o||null]);S.exit().remove();switch(t.orient()){case"top":S.enter().append("text").attr("class","nv-axislabel");var x=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);S.attr("text-anchor","middle").attr("y",0).attr("x",x/2);if(u){var T=g.selectAll("g.nv-axisMaxMin").data(s.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+s(e)+",0)"}).select("text").attr("dy","0em").attr("y",-t.tickPadding()).attr("text-anchor","middle").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+s.range()[t]+",0)"})}break;case"bottom":var N=36;var C=30;var k=w.selectAll("g").select("text");if(f%360){k.each(function(e,t){var n=this.getBBox().width;if(n>C)C=n});var L=Math.abs(Math.sin(f*Math.PI/180));var N=(L?L*C:C)+30;k.attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f%360>0?"start":"end")}S.enter().append("text").attr("class","nv-axislabel");var x=s.range().length==2?s.range()[1]:s.range()[s.range().length-1]+(s.range()[1]-s.range()[0]);S.attr("text-anchor","middle").attr("y",N).attr("x",x/2);if(u){var T=g.selectAll("g.nv-axisMaxMin").data([s.domain()[0],s.domain()[s.domain().length-1]]);T.enter().append("g").attr("class","nv-axisMaxMin").append("text");T.exit().remove();T.attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",t.tickPadding()).attr("transform",function(e,t,n){return"rotate("+f+" 0,0)"}).style("text-anchor",f?f%360>0?"start":"end":"middle").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate("+(s(e)+(h?s.rangeBand()/2:0))+",0)"})}if(c)k.attr("transform",function(e,t){return"translate(0,"+(t%2==0?"0":"12")+")"});break;case"right":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",l?"middle":"begin").attr("transform",l?"rotate(90)":"").attr("y",l?-Math.max(n.right,r)+12:-10).attr("x",l?s.range()[0]/2:t.tickPadding());if(u){var T=g.selectAll("g.nv-axisMaxMin").data(s.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+s(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",t.tickPadding()).style("text-anchor","start").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}break;case"left":S.enter().append("text").attr("class","nv-axislabel");S.style("text-anchor",l?"middle":"end").attr("transform",l?"rotate(-90)":"").attr("y",l?-Math.max(n.left,r)+v:-10).attr("x",l?-s.range()[0]/2:-t.tickPadding());if(u){var T=g.selectAll("g.nv-axisMaxMin").data(s.domain());T.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0);T.exit().remove();T.attr("transform",function(e,t){return"translate(0,"+m(e)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-t.tickPadding()).attr("text-anchor","end").text(function(e,t){var n=e;if(d){n=Math.pow(10,n);n=E(n)}else n=E(n);return(""+n).match("NaN")?"":n});T.transition().attr("transform",function(e,t){return"translate(0,"+s.range()[t]+")"}).select("text").style("opacity",1)}break}S.text(function(e){return e});if(u&&(t.orient()==="left"||t.orient()==="right")){w.selectAll("g").each(function(e,t){d3.select(this).select("text").attr("opacity",1);var n;if(d){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(s(e)s.range()[0]-10){if(e>1e-10||e<-1e-10)d3.select(this).attr("opacity",0);d3.select(this).select("text").attr("opacity",0)}});if(s.domain()[0]==s.domain()[1]&&s.domain()[0]==0)g.selectAll("g.nv-axisMaxMin").style("opacity",function(e,t){return!t?1:0})}if(u&&(t.orient()==="top"||t.orient()==="bottom")){var A=[];g.selectAll("g.nv-axisMaxMin").each(function(e,t){try{if(t)A.push(s(e)-this.getBBox().width-4);else A.push(s(e)+this.getBBox().width+4)}catch(n){if(t)A.push(s(e)-4);else A.push(s(e)+4)}});w.selectAll("g").each(function(e,t){var n;if(d){n=Math.pow(10,e);n=E(n)}else{n=E(e)}d3.select(this).select("text").text(n);if(s(e)A[1]){if(e>1e-10||e<-1e-10)d3.select(this).remove();else d3.select(this).select("text").remove()}})}if(a)w.selectAll(".tick").filter(function(e){return!parseFloat(Math.round(e.__data__*1e5)/1e6)&&e.__data__!==undefined}).classed("zero",true);m=s.copy()});return g}var t=d3.svg.axis();var n={top:0,right:0,bottom:0,left:0},r=75,i=60,s=d3.scale.linear(),o=null,u=true,a=true,f=0,l=true,c=false,h=false,p=null,d=false,v=12;t.scale(s).orient("bottom").tickFormat(function(e){return e});var m;g.axis=t;d3.rebind(g,t,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat");d3.rebind(g,s,"domain","range","rangeBand","rangeBands");g.options=e.utils.optionsFunc.bind(g);g.margin=function(e){if(!arguments.length)return n;n.top=typeof e.top!="undefined"?e.top:n.top;n.right=typeof e.right!="undefined"?e.right:n.right;n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom;n.left=typeof e.left!="undefined"?e.left:n.left;return g};g.width=function(e){if(!arguments.length)return r;r=e;return g};g.ticks=function(e){if(!arguments.length)return p;p=e;return g};g.height=function(e){if(!arguments.length)return i;i=e;return g};g.axisLabel=function(e){if(!arguments.length)return o;o=e;return g};g.showMaxMin=function(e){if(!arguments.length)return u;u=e;return g};g.logScale=function(e){if(!arguments.length)return d;d=e;return g};g.highlightZero=function(e){if(!arguments.length)return a;a=e;return g};g.scale=function(e){if(!arguments.length)return s;s=e;t.scale(s);h=typeof s.rangeBands==="function";d3.rebind(g,s,"domain","range","rangeBand","rangeBands");return g};g.rotateYLabel=function(e){if(!arguments.length)return l;l=e;return g};g.rotateLabels=function(e){if(!arguments.length)return f;f=e;return g};g.staggerLabels=function(e){if(!arguments.length)return c;c=e;return g};g.axisLabelDistance=function(e){if(!arguments.length)return v;v=e;return g};return g};e.models.bullet=function(){"use strict";function m(e){e.each(function(e,n){var p=c-t.left-t.right,m=h-t.top-t.bottom,g=d3.select(this);var y=i.call(this,e,n).slice().sort(d3.descending),b=s.call(this,e,n).slice().sort(d3.descending),w=o.call(this,e,n).slice().sort(d3.descending),E=u.call(this,e,n).slice(),S=a.call(this,e,n).slice(),x=f.call(this,e,n).slice();var T=d3.scale.linear().domain(d3.extent(d3.merge([l,y]))).range(r?[p,0]:[0,p]);var N=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(T.range());this.__chart__=T;var C=d3.min(y),k=d3.max(y),L=y[1];var A=g.selectAll("g.nv-wrap.nv-bullet").data([e]);var O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet");var M=O.append("g");var _=A.select("g");M.append("rect").attr("class","nv-range nv-rangeMax");M.append("rect").attr("class","nv-range nv-rangeAvg");M.append("rect").attr("class","nv-range nv-rangeMin");M.append("rect").attr("class","nv-measure");M.append("path").attr("class","nv-markerTriangle");A.attr("transform","translate("+t.left+","+t.top+")");var D=function(e){return Math.abs(N(e)-N(0))},P=function(e){return Math.abs(T(e)-T(0))};var H=function(e){return e<0?N(e):N(0)},B=function(e){return e<0?T(e):T(0)};_.select("rect.nv-rangeMax").attr("height",m).attr("width",P(k>0?k:C)).attr("x",B(k>0?k:C)).datum(k>0?k:C);_.select("rect.nv-rangeAvg").attr("height",m).attr("width",P(L)).attr("x",B(L)).datum(L);_.select("rect.nv-rangeMin").attr("height",m).attr("width",P(k)).attr("x",B(k)).attr("width",P(k>0?C:k)).attr("x",B(k>0?C:k)).datum(k>0?C:k);_.select("rect.nv-measure").style("fill",d).attr("height",m/3).attr("y",m/3).attr("width",w<0?T(0)-T(w[0]):T(w[0])-T(0)).attr("x",B(w)).on("mouseover",function(){v.elementMouseover({value:w[0],label:x[0]||"Current",pos:[T(w[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:w[0],label:x[0]||"Current"})});var j=m/6;if(b[0]){_.selectAll("path.nv-markerTriangle").attr("transform",function(e){return"translate("+T(b[0])+","+m/2+")"}).attr("d","M0,"+j+"L"+j+","+ -j+" "+ -j+","+ -j+"Z").on("mouseover",function(){v.elementMouseover({value:b[0],label:S[0]||"Previous",pos:[T(b[0]),m/2]})}).on("mouseout",function(){v.elementMouseout({value:b[0],label:S[0]||"Previous"})})}else{_.selectAll("path.nv-markerTriangle").remove()}A.selectAll(".nv-range").on("mouseover",function(e,t){var n=E[t]||(!t?"Maximum":t==1?"Mean":"Minimum");v.elementMouseover({value:e,label:n,pos:[T(e),m/2]})}).on("mouseout",function(e,t){var n=E[t]||(!t?"Maximum":t==1?"Mean":"Minimum");v.elementMouseout({value:e,label:n})})});return m}var t={top:0,right:0,bottom:0,left:0},n="left",r=false,i=function(e){return e.ranges},s=function(e){return e.markers},o=function(e){return e.measures},u=function(e){return e.rangeLabels?e.rangeLabels:[]},a=function(e){return e.markerLabels?e.markerLabels:[]},f=function(e){return e.measureLabels?e.measureLabels:[]},l=[0],c=380,h=30,p=null,d=e.utils.getColor(["#1f77b4"]),v=d3.dispatch("elementMouseover","elementMouseout");m.dispatch=v;m.options=e.utils.optionsFunc.bind(m);m.orient=function(e){if(!arguments.length)return n;n=e;r=n=="right"||n=="bottom";return m};m.ranges=function(e){if(!arguments.length)return i;i=e;return m};m.markers=function(e){if(!arguments.length)return s;s=e;return m};m.measures=function(e){if(!arguments.length)return o;o=e;return m};m.forceX=function(e){if(!arguments.length)return l;l=e;return m};m.width=function(e){if(!arguments.length)return c;c=e;return m};m.height=function(e){if(!arguments.length)return h;h=e;return m};m.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return m};m.tickFormat=function(e){if(!arguments.length)return p;p=e;return m};m.color=function(t){if(!arguments.length)return d;d=e.utils.getColor(t);return m};return m};e.models.bulletChart=function(){"use strict";function m(e){e.each(function(n,h){var g=d3.select(this);var y=(a||parseInt(g.style("width"))||960)-i.left-i.right,b=f-i.top-i.bottom,w=this;m.update=function(){m(e)};m.container=this;if(!n||!s.call(this,n,h)){var E=g.selectAll(".nv-noData").data([p]);E.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");E.attr("x",i.left+y/2).attr("y",18+i.top+b/2).text(function(e){return e});return m}else{g.selectAll(".nv-noData").remove()}var S=s.call(this,n,h).slice().sort(d3.descending),x=o.call(this,n,h).slice().sort(d3.descending),T=u.call(this,n,h).slice().sort(d3.descending);var N=g.selectAll("g.nv-wrap.nv-bulletChart").data([n]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart");var k=C.append("g");var L=N.select("g");k.append("g").attr("class","nv-bulletWrap");k.append("g").attr("class","nv-titles");N.attr("transform","translate("+i.left+","+i.top+")");var A=d3.scale.linear().domain([0,Math.max(S[0],x[0],T[0])]).range(r?[y,0]:[0,y]);var O=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(A.range());this.__chart__=A;var M=function(e){return Math.abs(O(e)-O(0))},_=function(e){return Math.abs(A(e)-A(0))};var D=k.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(f-i.top-i.bottom)/2+")");D.append("text").attr("class","nv-title").text(function(e){return e.title});D.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(e){return e.subtitle});t.width(y).height(b);var P=L.select(".nv-bulletWrap");d3.transition(P).call(t);var H=l||A.tickFormat(y/100);var B=L.selectAll("g.nv-tick").data(A.ticks(y/50),function(e){return this.textContent||H(e)});var j=B.enter().append("g").attr("class","nv-tick").attr("transform",function(e){return"translate("+O(e)+",0)"}).style("opacity",1e-6);j.append("line").attr("y1",b).attr("y2",b*7/6);j.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",b*7/6).text(H);var F=d3.transition(B).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1);F.select("line").attr("y1",b).attr("y2",b*7/6);F.select("text").attr("y",b*7/6);d3.transition(B.exit()).attr("transform",function(e){return"translate("+A(e)+",0)"}).style("opacity",1e-6).remove();d.on("tooltipShow",function(e){e.key=n.title;if(c)v(e,w.parentNode)})});d3.timer.flush();return m}var t=e.models.bullet();var n="left",r=false,i={top:5,right:40,bottom:20,left:120},s=function(e){return e.ranges},o=function(e){return e.markers},u=function(e){return e.measures},a=null,f=55,l=null,c=true,h=function(e,t,n,r,i){return"

          "+t+"

          "+"

          "+n+"

          "},p="No Data Available.",d=d3.dispatch("tooltipShow","tooltipHide");var v=function(t,n){var r=t.pos[0]+(n.offsetLeft||0)+i.left,s=t.pos[1]+(n.offsetTop||0)+i.top,o=h(t.key,t.label,t.value,t,m);e.tooltip.show([r,s],o,t.value<0?"e":"w",null,n)};t.dispatch.on("elementMouseover.tooltip",function(e){d.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){d.tooltipHide(e)});d.on("tooltipHide",function(){if(c)e.tooltip.cleanup()});m.dispatch=d;m.bullet=t;d3.rebind(m,t,"color");m.options=e.utils.optionsFunc.bind(m);m.orient=function(e){if(!arguments.length)return n;n=e;r=n=="right"||n=="bottom";return m};m.ranges=function(e){if(!arguments.length)return s;s=e;return m};m.markers=function(e){if(!arguments.length)return o;o=e;return m};m.measures=function(e){if(!arguments.length)return u;u=e;return m};m.width=function(e){if(!arguments.length)return a;a=e;return m};m.height=function(e){if(!arguments.length)return f;f=e;return m};m.margin=function(e){if(!arguments.length)return i;i.top=typeof e.top!="undefined"?e.top:i.top;i.right=typeof e.right!="undefined"?e.right:i.right;i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom;i.left=typeof e.left!="undefined"?e.left:i.left;return m};m.tickFormat=function(e){if(!arguments.length)return l;l=e;return m};m.tooltips=function(e){if(!arguments.length)return c;c=e;return m};m.tooltipContent=function(e){if(!arguments.length)return h;h=e;return m};m.noData=function(e){if(!arguments.length)return p;p=e;return m};return m};e.models.cumulativeLineChart=function(){"use strict";function _(b){b.each(function(b){function q(e,t){d3.select(_.container).style("cursor","ew-resize")}function R(e,t){O.x=d3.event.x;O.i=Math.round(A.invert(O.x));rt()}function U(e,t){d3.select(_.container).style("cursor","auto");x.index=O.i;k.stateChange(x)}function rt(){nt.data([O]);var e=_.transitionDuration();_.transitionDuration(0);_.update();_.transitionDuration(e)}var P=d3.select(this).classed("nv-chart-"+S,true),H=this;var B=(f||parseInt(P.style("width"))||960)-u.left-u.right,j=(l||parseInt(P.style("height"))||400)-u.top-u.bottom;_.update=function(){P.transition().duration(L).call(_)};_.container=this;x.disabled=b.map(function(e){return!!e.disabled});if(!T){var F;T={};for(F in x){if(x[F]instanceof Array)T[F]=x[F].slice(0);else T[F]=x[F]}}var I=d3.behavior.drag().on("dragstart",q).on("drag",R).on("dragend",U);if(!b||!b.length||!b.filter(function(e){return e.values.length}).length){var z=P.selectAll(".nv-noData").data([N]);z.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");z.attr("x",u.left+B/2).attr("y",u.top+j/2).text(function(e){return e});return _}else{P.selectAll(".nv-noData").remove()}w=t.xScale();E=t.yScale();if(!y){var W=b.filter(function(e){return!e.disabled}).map(function(e,n){var r=d3.extent(e.values,t.y());if(r[0]<-.95)r[0]=-.95;return[(r[0]-r[1])/(1+r[1]),(r[1]-r[0])/(1+r[0])]});var X=[d3.min(W,function(e){return e[0]}),d3.max(W,function(e){return e[1]})];t.yDomain(X)}else{t.yDomain(null)}A.domain([0,b[0].values.length-1]).range([0,B]).clamp(true);var b=D(O.i,b);var V=g?"none":"all";var $=P.selectAll("g.nv-wrap.nv-cumulativeLine").data([b]);var J=$.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g");var K=$.select("g");J.append("g").attr("class","nv-interactive");J.append("g").attr("class","nv-x nv-axis").style("pointer-events","none");J.append("g").attr("class","nv-y nv-axis");J.append("g").attr("class","nv-background");J.append("g").attr("class","nv-linesWrap").style("pointer-events",V);J.append("g").attr("class","nv-avgLinesWrap").style("pointer-events","none");J.append("g").attr("class","nv-legendWrap");J.append("g").attr("class","nv-controlsWrap");if(c){i.width(B);K.select(".nv-legendWrap").datum(b).call(i);if(u.top!=i.height()){u.top=i.height();j=(l||parseInt(P.style("height"))||400)-u.top-u.bottom}K.select(".nv-legendWrap").attr("transform","translate(0,"+ -u.top+")")}if(m){var Q=[{key:"Re-scale y-axis",disabled:!y}];s.width(140).color(["#444","#444","#444"]);K.select(".nv-controlsWrap").datum(Q).attr("transform","translate(0,"+ -u.top+")").call(s)}$.attr("transform","translate("+u.left+","+u.top+")");if(d){K.select(".nv-y.nv-axis").attr("transform","translate("+B+",0)")}var G=b.filter(function(e){return e.tempDisabled});$.select(".tempDisabled").remove();if(G.length){$.append("text").attr("class","tempDisabled").attr("x",B/2).attr("y","-.71em").style("text-anchor","end").text(G.map(function(e){return e.key}).join(", ")+" values cannot be calculated for this time period.")}if(g){o.width(B).height(j).margin({left:u.left,top:u.top}).svgContainer(P).xScale(w);$.select(".nv-interactive").call(o)}J.select(".nv-background").append("rect");K.select(".nv-background rect").attr("width",B).attr("height",j);t.y(function(e){return e.display.y}).width(B).height(j).color(b.map(function(e,t){return e.color||a(e,t)}).filter(function(e,t){return!b[t].disabled&&!b[t].tempDisabled}));var Y=K.select(".nv-linesWrap").datum(b.filter(function(e){return!e.disabled&&!e.tempDisabled}));Y.call(t);b.forEach(function(e,t){e.seriesIndex=t});var Z=b.filter(function(e){return!e.disabled&&!!C(e)});var et=K.select(".nv-avgLinesWrap").selectAll("line").data(Z,function(e){return e.key});var tt=function(e){var t=E(C(e));if(t<0)return 0;if(t>j)return j;return t};et.enter().append("line").style("stroke-width",2).style("stroke-dasharray","10,10").style("stroke",function(e,n){return t.color()(e,e.seriesIndex)}).attr("x1",0).attr("x2",B).attr("y1",tt).attr("y2",tt);et.style("stroke-opacity",function(e){var t=E(C(e));if(t<0||t>j)return 0;return 1}).attr("x1",0).attr("x2",B).attr("y1",tt).attr("y2",tt);et.exit().remove();var nt=Y.selectAll(".nv-indexLine").data([O]);nt.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).style("pointer-events","all").call(I);nt.attr("transform",function(e){return"translate("+A(e.i)+",0)"}).attr("height",j);if(h){n.scale(w).ticks(Math.min(b[0].values.length,B/70)).tickSize(-j,0);K.select(".nv-x.nv-axis").attr("transform","translate(0,"+E.range()[0]+")");d3.transition(K.select(".nv-x.nv-axis")).call(n)}if(p){r.scale(E).ticks(j/36).tickSize(-B,0);d3.transition(K.select(".nv-y.nv-axis")).call(r)}K.select(".nv-background rect").on("click",function(){O.x=d3.mouse(this)[0];O.i=Math.round(A.invert(O.x));x.index=O.i;k.stateChange(x);rt()});t.dispatch.on("elementClick",function(e){O.i=e.pointIndex;O.x=A(O.i);x.index=O.i;k.stateChange(x);rt()});s.dispatch.on("legendClick",function(e,t){e.disabled=!e.disabled;y=!e.disabled;x.rescaleY=y;k.stateChange(x);_.update()});i.dispatch.on("stateChange",function(e){x.disabled=e.disabled;k.stateChange(x);_.update()});o.dispatch.on("elementMousemove",function(i){t.clearHighlights();var s,f,l,c=[];b.filter(function(e,t){e.seriesIndex=t;return!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,_.x());t.highlightPoint(r,f,true);var o=n.values[f];if(typeof o==="undefined")return;if(typeof s==="undefined")s=o;if(typeof l==="undefined")l=_.xScale()(_.x()(o,f));c.push({key:n.key,value:_.y()(o,f),color:a(n,n.seriesIndex)})});if(c.length>2){var h=_.yScale().invert(i.mouseY);var p=Math.abs(_.yScale().domain()[0]-_.yScale().domain()[1]);var d=.03*p;var m=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);if(m!==null)c[m].highlight=true}var g=n.tickFormat()(_.x()(s,f),f);o.tooltip.position({left:l+u.left,top:i.mouseY+u.top}).chartContainer(H.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:g,series:c})();o.renderGuideLine(l)});o.dispatch.on("elementMouseout",function(e){k.tooltipHide();t.clearHighlights()});k.on("tooltipShow",function(e){if(v)M(e,H.parentNode)});k.on("changeState",function(e){if(typeof e.disabled!=="undefined"){b.forEach(function(t,n){t.disabled=e.disabled[n]});x.disabled=e.disabled}if(typeof e.index!=="undefined"){O.i=e.index;O.x=A(O.i);x.index=e.index;nt.data([O])}if(typeof e.rescaleY!=="undefined"){y=e.rescaleY}_.update()})});return _}function D(e,n){return n.map(function(n,r){if(!n.values){return n}var i=t.y()(n.values[e],e);if(i<-.95){n.tempDisabled=true;return n}n.tempDisabled=false;n.values=n.values.map(function(e,n){e.display={y:(t.y()(e,n)-i)/(1+i)};return e});return n})}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline();var u={top:30,right:30,bottom:50,left:60},a=e.utils.defaultColor(),f=null,l=null,c=true,h=true,p=true,d=false,v=true,m=true,g=false,y=true,b=function(e,t,n,r,i){return"

          "+e+"

          "+"

          "+n+" at "+t+"

          "},w,E,S=t.id(),x={index:0,rescaleY:y},T=null,N="No Data Available.",C=function(e){return e.average},k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=250;n.orient("bottom").tickPadding(7);r.orient(d?"right":"left");s.updateState(false);var A=d3.scale.linear(),O={i:0,x:0};var M=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=b(i.series.key,a,f,i,_);e.tooltip.show([o,u],l,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top];k.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){k.tooltipHide(e)});k.on("tooltipHide",function(){if(v)e.tooltip.cleanup()});_.dispatch=k;_.lines=t;_.legend=i;_.xAxis=n;_.yAxis=r;_.interactiveLayer=o;d3.rebind(_,t,"defined","isArea","x","y","xScale","yScale","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id");_.options=e.utils.optionsFunc.bind(_);_.margin=function(e){if(!arguments.length)return u;u.top=typeof e.top!="undefined"?e.top:u.top;u.right=typeof e.right!="undefined"?e.right:u.right;u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom;u.left=typeof e.left!="undefined"?e.left:u.left;return _};_.width=function(e){if(!arguments.length)return f;f=e;return _};_.height=function(e){if(!arguments.length)return l;l=e;return _};_.color=function(t){if(!arguments.length)return a;a=e.utils.getColor(t);i.color(a);return _};_.rescaleY=function(e){if(!arguments.length)return y;y=e;return _};_.showControls=function(e){if(!arguments.length)return m;m=e;return _};_.useInteractiveGuideline=function(e){if(!arguments.length)return g;g=e;if(e===true){_.interactive(false);_.useVoronoi(false)}return _};_.showLegend=function(e){if(!arguments.length)return c;c=e;return _};_.showXAxis=function(e){if(!arguments.length)return h;h=e;return _};_.showYAxis=function(e){if(!arguments.length)return p;p=e;return _};_.rightAlignYAxis=function(e){if(!arguments.length)return d;d=e;r.orient(e?"right":"left");return _};_.tooltips=function(e){if(!arguments.length)return v;v=e;return _};_.tooltipContent=function(e){if(!arguments.length)return b;b=e;return _};_.state=function(e){if(!arguments.length)return x;x=e;return _};_.defaultState=function(e){if(!arguments.length)return T;T=e;return _};_.noData=function(e){if(!arguments.length)return N;N=e;return _};_.average=function(e){if(!arguments.length)return C;C=e;return _};_.transitionDuration=function(e){if(!arguments.length)return L;L=e;return _};return _};e.models.discreteBar=function(){"use strict";function E(e){e.each(function(e){var i=n-t.left-t.right,E=r-t.top-t.bottom,S=d3.select(this);e=e.map(function(e,t){e.values=e.values.map(function(e){e.series=t;return e});return e});var T=p&&d?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0}})});s.domain(p||d3.merge(T).map(function(e){return e.x})).rangeBands(v||[0,i],.1);o.domain(d||d3.extent(d3.merge(T).map(function(e){return e.y}).concat(f)));if(c)o.range(m||[E-(o.domain()[0]<0?12:0),o.domain()[1]>0?12:0]);else o.range(m||[E,0]);b=b||s;w=w||o.copy().range([o(0),o(0)]);var N=S.selectAll("g.nv-wrap.nv-discretebar").data([e]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar");var k=C.append("g");var L=N.select("g");k.append("g").attr("class","nv-groups");N.attr("transform","translate("+t.left+","+t.top+")");var A=N.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});A.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);A.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();A.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover});A.transition().style("stroke-opacity",1).style("fill-opacity",.75);var O=A.selectAll("g.nv-bar").data(function(e){return e.values});O.exit().remove();var M=O.enter().append("g").attr("transform",function(e,t,n){return"translate("+(s(u(e,t))+s.rangeBand()*.05)+", "+o(0)+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",true);g.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);g.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){g.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(t,n){g.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(t.series+.5)/e.length,o(a(t,n))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()});M.append("rect").attr("height",0).attr("width",s.rangeBand()*.9/e.length);if(c){M.append("text").attr("text-anchor","middle");O.select("text").text(function(e,t){return h(a(e,t))}).transition().attr("x",s.rangeBand()*.9/2).attr("y",function(e,t){return a(e,t)<0?o(a(e,t))-o(0)+12:-4})}else{O.selectAll("text").remove()}O.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(e,t){return e.color||l(e,t)}).style("stroke",function(e,t){return e.color||l(e,t)}).select("rect").attr("class",y).transition().attr("width",s.rangeBand()*.9/e.length);O.transition().attr("transform",function(e,t){var n=s(u(e,t))+s.rangeBand()*.05,r=a(e,t)<0?o(0):o(0)-o(a(e,t))<1?o(0)-1:o(a(e,t));return"translate("+n+", "+r+")"}).select("rect").attr("height",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(d&&d[0]||0))||1)});b=s.copy();w=o.copy()});return E}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=false,h=d3.format(",.2f"),p,d,v,m,g=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),y="discreteBar";var b,w;E.dispatch=g;E.options=e.utils.optionsFunc.bind(E);E.x=function(e){if(!arguments.length)return u;u=e;return E};E.y=function(e){if(!arguments.length)return a;a=e;return E};E.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return E};E.width=function(e){if(!arguments.length)return n;n=e;return E};E.height=function(e){if(!arguments.length)return r;r=e;return E};E.xScale=function(e){if(!arguments.length)return s;s=e;return E};E.yScale=function(e){if(!arguments.length)return o;o=e;return E};E.xDomain=function(e){if(!arguments.length)return p;p=e;return E};E.yDomain=function(e){if(!arguments.length)return d;d=e;return E};E.xRange=function(e){if(!arguments.length)return v;v=e;return E};E.yRange=function(e){if(!arguments.length)return m;m=e;return E};E.forceY=function(e){if(!arguments.length)return f;f=e;return E};E.color=function(t){if(!arguments.length)return l;l=e.utils.getColor(t);return E};E.id=function(e){if(!arguments.length)return i;i=e;return E};E.showValues=function(e){if(!arguments.length)return c;c=e;return E};E.valueFormat=function(e){if(!arguments.length)return h;h=e;return E};E.rectClass=function(e){if(!arguments.length)return y;y=e;return E};return E};e.models.discreteBarChart=function(){"use strict";function w(e){e.each(function(e){var u=d3.select(this),p=this;var E=(s||parseInt(u.style("width"))||960)-i.left-i.right,S=(o||parseInt(u.style("height"))||400)-i.top-i.bottom;w.update=function(){g.beforeUpdate();u.transition().duration(y).call(w)};w.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var T=u.selectAll(".nv-noData").data([m]);T.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");T.attr("x",i.left+E/2).attr("y",i.top+S/2).text(function(e){return e});return w}else{u.selectAll(".nv-noData").remove()}d=t.xScale();v=t.yScale().clamp(true);var N=u.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([e]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g");var k=C.append("defs");var L=N.select("g");C.append("g").attr("class","nv-x nv-axis");C.append("g").attr("class","nv-y nv-axis");C.append("g").attr("class","nv-barsWrap");L.attr("transform","translate("+i.left+","+i.top+")");if(l){L.select(".nv-y.nv-axis").attr("transform","translate("+E+",0)")}t.width(E).height(S);var A=L.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));A.transition().call(t);k.append("clipPath").attr("id","nv-x-label-clip-"+t.id()).append("rect");L.select("#nv-x-label-clip-"+t.id()+" rect").attr("width",d.rangeBand()*(c?2:1)).attr("height",16).attr("x",-d.rangeBand()/(c?1:2));if(a){n.scale(d).ticks(E/100).tickSize(-S,0);L.select(".nv-x.nv-axis").attr("transform","translate(0,"+(v.range()[0]+(t.showValues()&&v.domain()[0]<0?16:0))+")");L.select(".nv-x.nv-axis").transition().call(n);var O=L.select(".nv-x.nv-axis").selectAll("g");if(c){O.selectAll("text").attr("transform",function(e,t,n){return"translate(0,"+(n%2==0?"5":"17")+")"})}}if(f){r.scale(v).ticks(S/36).tickSize(-E,0);L.select(".nv-y.nv-axis").transition().call(r)}g.on("tooltipShow",function(e){if(h)b(e,p.parentNode)})});return w}var t=e.models.discreteBar(),n=e.models.axis(),r=e.models.axis();var i={top:15,right:10,bottom:50,left:60},s=null,o=null,u=e.utils.getColor(),a=true,f=true,l=false,c=false,h=true,p=function(e,t,n,r,i){return"

          "+t+"

          "+"

          "+n+"

          "},d,v,m="No Data Available.",g=d3.dispatch("tooltipShow","tooltipHide","beforeUpdate"),y=250;n.orient("bottom").highlightZero(false).showMaxMin(false).tickFormat(function(e){return e});r.orient(l?"right":"left").tickFormat(d3.format(",.1f"));var b=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=p(i.series.key,a,f,i,w);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+i.left,e.pos[1]+i.top];g.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){g.tooltipHide(e)});g.on("tooltipHide",function(){if(h)e.tooltip.cleanup()});w.dispatch=g;w.discretebar=t;w.xAxis=n;w.yAxis=r;d3.rebind(w,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","id","showValues","valueFormat");w.options=e.utils.optionsFunc.bind(w);w.margin=function(e){if(!arguments.length)return i;i.top=typeof e.top!="undefined"?e.top:i.top;i.right=typeof e.right!="undefined"?e.right:i.right;i.bottom=typeof e.bottom!="undefined"?e.bottom:i.bottom;i.left=typeof e.left!="undefined"?e.left:i.left;return w};w.width=function(e){if(!arguments.length)return s;s=e;return w};w.height=function(e){if(!arguments.length)return o;o=e;return w};w.color=function(n){if(!arguments.length)return u;u=e.utils.getColor(n);t.color(u);return w};w.showXAxis=function(e){if(!arguments.length)return a;a=e;return w};w.showYAxis=function(e){if(!arguments.length)return f;f=e;return w};w.rightAlignYAxis=function(e){if(!arguments.length)return l;l=e;r.orient(e?"right":"left");return w};w.staggerLabels=function(e){if(!arguments.length)return c;c=e;return w};w.tooltips=function(e){if(!arguments.length)return h;h=e;return w};w.tooltipContent=function(e){if(!arguments.length)return p;p=e;return w};w.noData=function(e){if(!arguments.length)return m;m=e;return w};w.transitionDuration=function(e){if(!arguments.length)return y;y=e;return w};return w};e.models.distribution=function(){"use strict";function l(e){e.each(function(e){var a=n-(i==="x"?t.left+t.right:t.top+t.bottom),l=i=="x"?"y":"x",c=d3.select(this);f=f||u;var h=c.selectAll("g.nv-distribution").data([e]);var p=h.enter().append("g").attr("class","nvd3 nv-distribution");var d=p.append("g");var v=h.select("g");h.attr("transform","translate("+t.left+","+t.top+")");var m=v.selectAll("g.nv-dist").data(function(e){return e},function(e){return e.key});m.enter().append("g");m.attr("class",function(e,t){return"nv-dist nv-series-"+t}).style("stroke",function(e,t){return o(e,t)});var g=m.selectAll("line.nv-dist"+i).data(function(e){return e.values});g.enter().append("line").attr(i+"1",function(e,t){return f(s(e,t))}).attr(i+"2",function(e,t){return f(s(e,t))});m.exit().selectAll("line.nv-dist"+i).transition().attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))}).style("stroke-opacity",0).remove();g.attr("class",function(e,t){return"nv-dist"+i+" nv-dist"+i+"-"+t}).attr(l+"1",0).attr(l+"2",r);g.transition().attr(i+"1",function(e,t){return u(s(e,t))}).attr(i+"2",function(e,t){return u(s(e,t))});f=u.copy()});return l}var t={top:0,right:0,bottom:0,left:0},n=400,r=8,i="x",s=function(e){return e[i]},o=e.utils.defaultColor(),u=d3.scale.linear(),a;var f;l.options=e.utils.optionsFunc.bind(l);l.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return l};l.width=function(e){if(!arguments.length)return n;n=e;return l};l.axis=function(e){if(!arguments.length)return i;i=e;return l};l.size=function(e){if(!arguments.length)return r;r=e;return l};l.getData=function(e){if(!arguments.length)return s;s=d3.functor(e);return l};l.scale=function(e){if(!arguments.length)return u;u=e;return l};l.color=function(t){if(!arguments.length)return o;o=e.utils.getColor(t);return l};return l};e.models.historicalBar=function(){"use strict";function w(E){E.each(function(w){var E=n-t.left-t.right,S=r-t.top-t.bottom,T=d3.select(this);s.domain(d||d3.extent(w[0].values.map(u).concat(f)));if(c)s.range(m||[E*.5/w[0].values.length,E*(w[0].values.length-.5)/w[0].values.length]);else s.range(m||[0,E]);o.domain(v||d3.extent(w[0].values.map(a).concat(l))).range(g||[S,0]);if(s.domain()[0]===s.domain()[1])s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1]);if(o.domain()[0]===o.domain()[1])o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]);var N=T.selectAll("g.nv-wrap.nv-historicalBar-"+i).data([w[0].values]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBar-"+i);var k=C.append("defs");var L=C.append("g");var A=N.select("g");L.append("g").attr("class","nv-bars");N.attr("transform","translate("+t.left+","+t.top+")");T.on("click",function(e,t){y.chartClick({data:e,index:t,pos:d3.event,id:i})});k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect");N.select("#nv-chart-clip-path-"+i+" rect").attr("width",E).attr("height",S);A.attr("clip-path",h?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-bars").selectAll(".nv-bar").data(function(e){return e},function(e,t){return u(e,t)});O.exit().remove();var M=O.enter().append("rect").attr("x",0).attr("y",function(t,n){return e.utils.NaNtoZero(o(Math.max(0,a(t,n))))}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.abs(o(a(t,n))-o(0)))}).attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).on("mouseover",function(e,t){if(!b)return;d3.select(this).classed("hover",true);y.elementMouseover({point:e,series:w[0],pos:[s(u(e,t)),o(a(e,t))],pointIndex:t,seriesIndex:0,e:d3.event})}).on("mouseout",function(e,t){if(!b)return;d3.select(this).classed("hover",false);y.elementMouseout({point:e,series:w[0],pointIndex:t,seriesIndex:0,e:d3.event})}).on("click",function(e,t){if(!b)return;y.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()}).on("dblclick",function(e,t){if(!b)return;y.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()});O.attr("fill",function(e,t){return p(e,t)}).attr("class",function(e,t,n){return(a(e,t)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+n+"-"+t}).transition().attr("transform",function(e,t){return"translate("+(s(u(e,t))-E/w[0].values.length*.45)+",0)"}).attr("width",E/w[0].values.length*.9);O.transition().attr("y",function(t,n){var r=a(t,n)<0?o(0):o(0)-o(a(t,n))<1?o(0)-1:o(a(t,n));return e.utils.NaNtoZero(r)}).attr("height",function(t,n){return e.utils.NaNtoZero(Math.max(Math.abs(o(a(t,n))-o(0)),1))})});return w}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[],l=[0],c=false,h=true,p=e.utils.defaultColor(),d,v,m,g,y=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),b=true;w.highlightPoint=function(e,t){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar-0-"+e).classed("hover",t)};w.clearHighlights=function(){d3.select(".nv-historicalBar-"+i).select(".nv-bars .nv-bar.hover").classed("hover",false)};w.dispatch=y;w.options=e.utils.optionsFunc.bind(w);w.x=function(e){if(!arguments.length)return u;u=e;return w};w.y=function(e){if(!arguments.length)return a;a=e;return w};w.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return w};w.width=function(e){if(!arguments.length)return n;n=e;return w};w.height=function(e){if(!arguments.length)return r;r=e;return w};w.xScale=function(e){if(!arguments.length)return s;s=e;return w};w.yScale=function(e){if(!arguments.length)return o;o=e;return w};w.xDomain=function(e){if(!arguments.length)return d;d=e;return w};w.yDomain=function(e){if(!arguments.length)return v;v=e;return w};w.xRange=function(e){if(!arguments.length)return m;m=e;return w};w.yRange=function(e){if(!arguments.length)return g;g=e;return w};w.forceX=function(e){if(!arguments.length)return f;f=e;return w};w.forceY=function(e){if(!arguments.length)return l;l=e;return w};w.padData=function(e){if(!arguments.length)return c;c=e;return w};w.clipEdge=function(e){if(!arguments.length)return h;h=e;return w};w.color=function(t){if(!arguments.length)return p;p=e.utils.getColor(t);return w};w.id=function(e){if(!arguments.length)return i;i=e;return w};w.interactive=function(e){if(!arguments.length)return b;b=false;return w};return w};e.models.historicalBarChart=function(){"use strict";function x(e){e.each(function(d){var T=d3.select(this),N=this;var C=(u||parseInt(T.style("width"))||960)-s.left-s.right,k=(a||parseInt(T.style("height"))||400)-s.top-s.bottom;x.update=function(){T.transition().duration(E).call(x)};x.container=this;g.disabled=d.map(function(e){return!!e.disabled});if(!y){var L;y={};for(L in g){if(g[L]instanceof Array)y[L]=g[L].slice(0);else y[L]=g[L]}}if(!d||!d.length||!d.filter(function(e){return e.values.length}).length){var A=T.selectAll(".nv-noData").data([b]);A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");A.attr("x",s.left+C/2).attr("y",s.top+k/2).text(function(e){return e});return x}else{T.selectAll(".nv-noData").remove()}v=t.xScale();m=t.yScale();var O=T.selectAll("g.nv-wrap.nv-historicalBarChart").data([d]);var M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBarChart").append("g");var _=O.select("g");M.append("g").attr("class","nv-x nv-axis");M.append("g").attr("class","nv-y nv-axis");M.append("g").attr("class","nv-barsWrap");M.append("g").attr("class","nv-legendWrap");if(f){i.width(C);_.select(".nv-legendWrap").datum(d).call(i);if(s.top!=i.height()){s.top=i.height();k=(a||parseInt(T.style("height"))||400)-s.top-s.bottom}O.select(".nv-legendWrap").attr("transform","translate(0,"+ -s.top+")")}O.attr("transform","translate("+s.left+","+s.top+")");if(h){_.select(".nv-y.nv-axis").attr("transform","translate("+C+",0)")}t.width(C).height(k).color(d.map(function(e,t){return e.color||o(e,t)}).filter(function(e,t){return!d[t].disabled}));var D=_.select(".nv-barsWrap").datum(d.filter(function(e){return!e.disabled}));D.transition().call(t);if(l){n.scale(v).tickSize(-k,0);_.select(".nv-x.nv-axis").attr("transform","translate(0,"+m.range()[0]+")");_.select(".nv-x.nv-axis").transition().call(n)}if(c){r.scale(m).ticks(k/36).tickSize(-C,0);_.select(".nv-y.nv-axis").transition().call(r)}i.dispatch.on("legendClick",function(t,n){t.disabled=!t.disabled;if(!d.filter(function(e){return!e.disabled}).length){d.map(function(e){e.disabled=false;O.selectAll(".nv-series").classed("disabled",false);return e})}g.disabled=d.map(function(e){return!!e.disabled});w.stateChange(g);e.transition().call(x)});i.dispatch.on("legendDblclick",function(e){d.forEach(function(e){e.disabled=true});e.disabled=false;g.disabled=d.map(function(e){return!!e.disabled});w.stateChange(g);x.update()});w.on("tooltipShow",function(e){if(p)S(e,N.parentNode)});w.on("changeState",function(t){if(typeof t.disabled!=="undefined"){d.forEach(function(e,n){e.disabled=t.disabled[n]});g.disabled=t.disabled}e.call(x)})});return x}var t=e.models.historicalBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend();var s={top:30,right:90,bottom:50,left:90},o=e.utils.defaultColor(),u=null,a=null,f=false,l=true,c=true,h=false,p=true,d=function(e,t,n,r,i){return"

          "+e+"

          "+"

          "+n+" at "+t+"

          "},v,m,g={},y=null,b="No Data Available.",w=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),E=250;n.orient("bottom").tickPadding(7);r.orient(h?"right":"left");var S=function(i,s){if(s){var o=d3.select(s).select("svg");var u=o.node()?o.attr("viewBox"):null;if(u){u=u.split(" ");var a=parseInt(o.style("width"))/u[2];i.pos[0]=i.pos[0]*a;i.pos[1]=i.pos[1]*a}}var f=i.pos[0]+(s.offsetLeft||0),l=i.pos[1]+(s.offsetTop||0),c=n.tickFormat()(t.x()(i.point,i.pointIndex)),h=r.tickFormat()(t.y()(i.point,i.pointIndex)),p=d(i.series.key,c,h,i,x);e.tooltip.show([f,l],p,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+s.left,e.pos[1]+s.top];w.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){w.tooltipHide(e)});w.on("tooltipHide",function(){if(p)e.tooltip.cleanup()});x.dispatch=w;x.bars=t;x.legend=i;x.xAxis=n;x.yAxis=r;d3.rebind(x,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate","highlightPoint","clearHighlights","interactive");x.options=e.utils.optionsFunc.bind(x);x.margin=function(e){if(!arguments.length)return s;s.top=typeof e.top!="undefined"?e.top:s.top;s.right=typeof e.right!="undefined"?e.right:s.right;s.bottom=typeof e.bottom!="undefined"?e.bottom:s.bottom;s.left=typeof e.left!="undefined"?e.left:s.left;return x};x.width=function(e){if(!arguments.length)return u;u=e;return x};x.height=function(e){if(!arguments.length)return a;a=e;return x};x.color=function(t){if(!arguments.length)return o;o=e.utils.getColor(t);i.color(o);return x};x.showLegend=function(e){if(!arguments.length)return f;f=e;return x};x.showXAxis=function(e){if(!arguments.length)return l;l=e;return x};x.showYAxis=function(e){if(!arguments.length)return c;c=e;return x};x.rightAlignYAxis=function(e){if(!arguments.length)return h;h=e;r.orient(e?"right":"left");return x};x.tooltips=function(e){if(!arguments.length)return p;p=e;return x};x.tooltipContent=function(e){if(!arguments.length)return d;d=e;return x};x.state=function(e){if(!arguments.length)return g;g=e;return x};x.defaultState=function(e){if(!arguments.length)return y;y=e;return x};x.noData=function(e){if(!arguments.length)return b;b=e;return x};x.transitionDuration=function(e){if(!arguments.length)return E;E=e;return x};return x};e.models.indentedTree=function(){"use strict";function g(e){e.each(function(e){function k(e,t,n){d3.event.stopPropagation();if(d3.event.shiftKey&&!n){d3.event.shiftKey=false;e.values&&e.values.forEach(function(e){if(e.values||e._values){k(e,0,true)}});return true}if(!O(e)){return true}if(e.values){e._values=e.values;e.values=null}else{e.values=e._values;e._values=null}g.update()}function L(e){return e._values&&e._values.length?h:e.values&&e.values.length?p:""}function A(e){return e._values&&e._values.length}function O(e){var t=e.values||e._values;return t&&t.length}var t=1,n=d3.select(this);var i=d3.layout.tree().children(function(e){return e.values}).size([r,f]);g.update=function(){n.transition().duration(600).call(g)};if(!e[0])e[0]={key:a};var s=i.nodes(e[0]);var y=d3.select(this).selectAll("div").data([[s]]);var b=y.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree");var w=b.append("table");var E=y.select("table").attr("width","100%").attr("class",c);if(o){var S=w.append("thead");var x=S.append("tr");l.forEach(function(e){x.append("th").attr("width",e.width?e.width:"10%").style("text-align",e.type=="numeric"?"right":"left").append("span").text(e.label)})}var T=E.selectAll("tbody").data(function(e){return e});T.enter().append("tbody");t=d3.max(s,function(e){return e.depth});i.size([r,t*f]);var N=T.selectAll("tr").data(function(e){return e.filter(function(e){return u&&!e.children?u(e):true})},function(e,t){return e.id||e.id||++m});N.exit().remove();N.select("img.nv-treeicon").attr("src",L).classed("folded",A);var C=N.enter().append("tr");l.forEach(function(e,t){var n=C.append("td").style("padding-left",function(e){return(t?0:e.depth*f+12+(L(e)?0:16))+"px"},"important").style("text-align",e.type=="numeric"?"right":"left");if(t==0){n.append("img").classed("nv-treeicon",true).classed("nv-folded",A).attr("src",L).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(e){return L(e)?"inline-block":"none"}).on("click",k)}n.each(function(n){if(!t&&v(n))d3.select(this).append("a").attr("href",v).attr("class",d3.functor(e.classes)).append("span");else d3.select(this).append("span");d3.select(this).select("span").attr("class",d3.functor(e.classes)).text(function(t){return e.format?e.format(t):t[e.key]||"-"})});if(e.showCount){n.append("span").attr("class","nv-childrenCount");N.selectAll("span.nv-childrenCount").text(function(e){return e.values&&e.values.length||e._values&&e._values.length?"("+(e.values&&e.values.filter(function(e){return u?u(e):true}).length||e._values&&e._values.filter(function(e){return u?u(e):true}).length||0)+")":""})}});N.order().on("click",function(e){d.elementClick({row:this,data:e,pos:[e.x,e.y]})}).on("dblclick",function(e){d.elementDblclick({row:this,data:e,pos:[e.x,e.y]})}).on("mouseover",function(e){d.elementMouseover({row:this,data:e,pos:[e.x,e.y]})}).on("mouseout",function(e){d.elementMouseout({row:this,data:e,pos:[e.x,e.y]})})});return g}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e4),o=true,u=false,a="No Data Available.",f=20,l=[{key:"key",label:"Name",type:"text"}],c=null,h="images/grey-plus.png",p="images/grey-minus.png",d=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout"),v=function(e){return e.url};var m=0;g.options=e.utils.optionsFunc.bind(g);g.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return g};g.width=function(e){if(!arguments.length)return n;n=e;return g};g.height=function(e){if(!arguments.length)return r;r=e;return g};g.color=function(t){if(!arguments.length)return i;i=e.utils.getColor(t);scatter.color(i);return g};g.id=function(e){if(!arguments.length)return s;s=e;return g};g.header=function(e){if(!arguments.length)return o;o=e;return g};g.noData=function(e){if(!arguments.length)return a;a=e;return g};g.filterZero=function(e){if(!arguments.length)return u;u=e;return g};g.columns=function(e){if(!arguments.length)return l;l=e;return g};g.tableClass=function(e){if(!arguments.length)return c;c=e;return g};g.iconOpen=function(e){if(!arguments.length)return h;h=e;return g};g.iconClose=function(e){if(!arguments.length)return p;p=e;return g};g.getUrl=function(e){if(!arguments.length)return v;v=e;return g};return g};e.models.legend=function(){"use strict";function h(p){p.each(function(h){var p=n-t.left-t.right,d=d3.select(this);var v=d.selectAll("g.nv-legend").data([h]);var m=v.enter().append("g").attr("class","nvd3 nv-legend").append("g");var g=v.select("g");v.attr("transform","translate("+t.left+","+t.top+")");var y=g.selectAll(".nv-series").data(function(e){return e});var b=y.enter().append("g").attr("class","nv-series").on("mouseover",function(e,t){l.legendMouseover(e,t)}).on("mouseout",function(e,t){l.legendMouseout(e,t)}).on("click",function(e,t){if(!c){l.legendClick(e,t);if(a){if(f){h.forEach(function(e){e.disabled=true});e.disabled=false}else{e.disabled=!e.disabled;if(h.every(function(e){return e.disabled})){h.forEach(function(e){e.disabled=false})}}l.stateChange({disabled:h.map(function(e){return!!e.disabled})})}}}).on("dblclick",function(e,t){if(!c){l.legendDblclick(e,t);if(a){h.forEach(function(e){e.disabled=true});e.disabled=false;l.stateChange({disabled:h.map(function(e){return!!e.disabled})})}}});b.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5);b.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8");y.classed("disabled",function(e){return e.disabled});y.exit().remove();y.select("circle").style("fill",function(e,t){return e.color||s(e,t)}).style("stroke",function(e,t){return e.color||s(e,t)});y.select("text").text(i);if(o){var w=[];y.each(function(t,n){var r=d3.select(this).select("text");var i=r.node().getComputedTextLength()||e.utils.calcApproxTextWidth(r);w.push(i+28)});var E=0;var S=0;var x=[];while(Sp&&E>1){x=[];E--;for(var T=0;T(x[T%E]||0))x[T%E]=w[T]}S=x.reduce(function(e,t,n,r){return e+t})}var N=[];for(var C=0,k=0;CO)O=A;return"translate("+M+","+L+")"});g.attr("transform","translate("+(n-t.right-O)+","+t.top+")");r=t.top+t.bottom+L+15}});return h}var t={top:5,right:0,bottom:5,left:0},n=400,r=20,i=function(e){return e.key},s=e.utils.defaultColor(),o=true,u=true,a=true,f=false,l=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange"),c=false;h.dispatch=l;h.options=e.utils.optionsFunc.bind(h);h.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return h};h.width=function(e){if(!arguments.length)return n;n=e;return h};h.height=function(e){if(!arguments.length)return r;r=e;return h};h.key=function(e){if(!arguments.length)return i;i=e;return h};h.color=function(t){if(!arguments.length)return s;s=e.utils.getColor(t);return h};h.align=function(e){if(!arguments.length)return o;o=e;return h};h.rightAlign=function(e){if(!arguments.length)return u;u=e;return h};h.dualaxis=function(e){if(!arguments.length)return c;c=e;return h};h.updateState=function(e){if(!arguments.length)return a;a=e;return h};h.radioButtonMode=function(e){if(!arguments.length)return f;f=e;return h};return h};e.models.line=function(){"use strict";function m(g){g.each(function(m){var g=r-n.left-n.right,b=i-n.top-n.bottom,w=d3.select(this);c=t.xScale();h=t.yScale();d=d||c;v=v||h;var E=w.selectAll("g.nv-wrap.nv-line").data([m]);var S=E.enter().append("g").attr("class","nvd3 nv-wrap nv-line");var T=S.append("defs");var N=S.append("g");var C=E.select("g");N.append("g").attr("class","nv-groups");N.append("g").attr("class","nv-scatterWrap");E.attr("transform","translate("+n.left+","+n.top+")");t.width(g).height(b);var k=E.select(".nv-scatterWrap");k.transition().call(t);T.append("clipPath").attr("id","nv-edge-clip-"+t.id()).append("rect");E.select("#nv-edge-clip-"+t.id()+" rect").attr("width",g).attr("height",b);C.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":"");k.attr("clip-path",l?"url(#nv-edge-clip-"+t.id()+")":"");var L=E.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});L.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);L.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();L.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return s(e,t)}).style("stroke",function(e,t){return s(e,t)});L.transition().style("stroke-opacity",1).style("fill-opacity",.5);var A=L.selectAll("path.nv-area").data(function(e){return f(e)?[e]:[]});A.enter().append("path").attr("class","nv-area").attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))}).y1(function(e,t){return v(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])});L.exit().selectAll("path.nv-area").remove();A.transition().attr("d",function(t){return d3.svg.area().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y0(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}).y1(function(e,t){return h(h.domain()[0]<=0?h.domain()[1]>=0?0:h.domain()[1]:h.domain()[0])}).apply(this,[t.values])});var O=L.selectAll("path.nv-line").data(function(e){return[e.values]});O.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(d(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(v(u(t,n)))}));L.exit().selectAll("path.nv-line").transition().attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}));O.transition().attr("d",d3.svg.line().interpolate(p).defined(a).x(function(t,n){return e.utils.NaNtoZero(c(o(t,n)))}).y(function(t,n){return e.utils.NaNtoZero(h(u(t,n)))}));d=c.copy();v=h.copy()});return m}var t=e.models.scatter();var n={top:0,right:0,bottom:0,left:0},r=960,i=500,s=e.utils.defaultColor(),o=function(e){return e.x},u=function(e){return e.y},a=function(e,t){return!isNaN(u(e,t))&&u(e,t)!==null},f=function(e){return e.area},l=false,c,h,p="linear";t.size(16).sizeDomain([16,256]);var d,v;m.dispatch=t.dispatch;m.scatter=t;d3.rebind(m,t,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","padData","highlightPoint","clearHighlights");m.options=e.utils.optionsFunc.bind(m);m.margin=function(e){if(!arguments.length)return n;n.top=typeof e.top!="undefined"?e.top:n.top;n.right=typeof e.right!="undefined"?e.right:n.right;n.bottom=typeof e.bottom!="undefined"?e.bottom:n.bottom;n.left=typeof e.left!="undefined"?e.left:n.left;return m};m.width=function(e){if(!arguments.length)return r;r=e;return m};m.height=function(e){if(!arguments.length)return i;i=e;return m};m.x=function(e){if(!arguments.length)return o;o=e;t.x(e);return m};m.y=function(e){if(!arguments.length)return u;u=e;t.y(e);return m};m.clipEdge=function(e){if(!arguments.length)return l;l=e;return m};m.color=function(n){if(!arguments.length)return s;s=e.utils.getColor(n);t.color(s);return m};m.interpolate=function(e){if(!arguments.length)return p;p=e;return m};m.defined=function(e){if(!arguments.length)return a;a=e;return m};m.isArea=function(e){if(!arguments.length)return f;f=d3.functor(e);return m};return m};e.models.lineChart=function(){"use strict";function N(m){m.each(function(m){var C=d3.select(this),k=this;var L=(a||parseInt(C.style("width"))||960)-o.left-o.right,A=(f||parseInt(C.style("height"))||400)-o.top-o.bottom;N.update=function(){C.transition().duration(x).call(N)};N.container=this;b.disabled=m.map(function(e){return!!e.disabled});if(!w){var O;w={};for(O in b){if(b[O]instanceof Array)w[O]=b[O].slice(0);else w[O]=b[O]}}if(!m||!m.length||!m.filter(function(e){return e.values.length}).length){var M=C.selectAll(".nv-noData").data([E]);M.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");M.attr("x",o.left+L/2).attr("y",o.top+A/2).text(function(e){return e});return N}else{C.selectAll(".nv-noData").remove()}g=t.xScale();y=t.yScale();var _=C.selectAll("g.nv-wrap.nv-lineChart").data([m]);var D=_.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g");var P=_.select("g");D.append("rect").style("opacity",0);D.append("g").attr("class","nv-x nv-axis");D.append("g").attr("class","nv-y nv-axis");D.append("g").attr("class","nv-linesWrap");D.append("g").attr("class","nv-legendWrap");D.append("g").attr("class","nv-interactive");P.select("rect").attr("width",L).attr("height",A);if(l){i.width(L);P.select(".nv-legendWrap").datum(m).call(i);if(o.top!=i.height()){o.top=i.height();A=(f||parseInt(C.style("height"))||400)-o.top-o.bottom}_.select(".nv-legendWrap").attr("transform","translate(0,"+ -o.top+")")}_.attr("transform","translate("+o.left+","+o.top+")");if(p){P.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)")}if(d){s.width(L).height(A).margin({left:o.left,top:o.top}).svgContainer(C).xScale(g);_.select(".nv-interactive").call(s)}t.width(L).height(A).color(m.map(function(e,t){return e.color||u(e,t)}).filter(function(e,t){return!m[t].disabled}));var H=P.select(".nv-linesWrap").datum(m.filter(function(e){return!e.disabled}));H.transition().call(t);if(c){n.scale(g).ticks(L/100).tickSize(-A,0);P.select(".nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");P.select(".nv-x.nv-axis").transition().call(n)}if(h){r.scale(y).ticks(A/36).tickSize(-L,0);P.select(".nv-y.nv-axis").transition().call(r)}i.dispatch.on("stateChange",function(e){b=e;S.stateChange(b);N.update()});s.dispatch.on("elementMousemove",function(i){t.clearHighlights();var a,f,l,c=[];m.filter(function(e,t){e.seriesIndex=t;return!e.disabled}).forEach(function(n,r){f=e.interactiveBisect(n.values,i.pointXValue,N.x());t.highlightPoint(r,f,true);var s=n.values[f];if(typeof s==="undefined")return;if(typeof a==="undefined")a=s;if(typeof l==="undefined")l=N.xScale()(N.x()(s,f));c.push({key:n.key,value:N.y()(s,f),color:u(n,n.seriesIndex)})});if(c.length>2){var h=N.yScale().invert(i.mouseY);var p=Math.abs(N.yScale().domain()[0]-N.yScale().domain()[1]);var d=.03*p;var g=e.nearestValueIndex(c.map(function(e){return e.value}),h,d);if(g!==null)c[g].highlight=true}var y=n.tickFormat()(N.x()(a,f));s.tooltip.position({left:l+o.left,top:i.mouseY+o.top}).chartContainer(k.parentNode).enabled(v).valueFormatter(function(e,t){return r.tickFormat()(e)}).data({value:y,series:c})();s.renderGuideLine(l)});s.dispatch.on("elementMouseout",function(e){S.tooltipHide();t.clearHighlights()});S.on("tooltipShow",function(e){if(v)T(e,k.parentNode)});S.on("changeState",function(e){if(typeof e.disabled!=="undefined"){m.forEach(function(t,n){t.disabled=e.disabled[n]});b.disabled=e.disabled}N.update()})});return N}var t=e.models.line(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.interactiveGuideline();var o={top:30,right:20,bottom:50,left:60},u=e.utils.defaultColor(),a=null,f=null,l=true,c=true,h=true,p=false,d=false,v=true,m=function(e,t,n,r,i){return"

          "+e+"

          "+"

          "+n+" at "+t+"

          "},g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=250;n.orient("bottom").tickPadding(7);r.orient(p?"right":"left");var T=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=m(i.series.key,a,f,i,N);e.tooltip.show([o,u],l,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top];S.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});S.on("tooltipHide",function(){if(v)e.tooltip.cleanup()});N.dispatch=S;N.lines=t;N.legend=i;N.xAxis=n;N.yAxis=r;N.interactiveLayer=s;d3.rebind(N,t,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id","interpolate");N.options=e.utils.optionsFunc.bind(N);N.margin=function(e){if(!arguments.length)return o;o.top=typeof e.top!="undefined"?e.top:o.top;o.right=typeof e.right!="undefined"?e.right:o.right;o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom;o.left=typeof e.left!="undefined"?e.left:o.left;return N};N.width=function(e){if(!arguments.length)return a;a=e;return N};N.height=function(e){if(!arguments.length)return f;f=e;return N};N.color=function(t){if(!arguments.length)return u;u=e.utils.getColor(t);i.color(u);return N};N.showLegend=function(e){if(!arguments.length)return l;l=e;return N};N.showXAxis=function(e){if(!arguments.length)return c;c=e;return N};N.showYAxis=function(e){if(!arguments.length)return h;h=e;return N};N.rightAlignYAxis=function(e){if(!arguments.length)return p;p=e;r.orient(e?"right":"left");return N};N.useInteractiveGuideline=function(e){if(!arguments.length)return d;d=e;if(e===true){N.interactive(false);N.useVoronoi(false)}return N};N.tooltips=function(e){if(!arguments.length)return v;v=e;return N};N.tooltipContent=function(e){if(!arguments.length)return m;m=e;return N};N.state=function(e){if(!arguments.length)return b;b=e;return N};N.defaultState=function(e){if(!arguments.length)return w;w=e;return N};N.noData=function(e){if(!arguments.length)return E;E=e;return N};N.transitionDuration=function(e){if(!arguments.length)return x;x=e;return N};return N};e.models.linePlusBarChart=function(){"use strict";function T(e){e.each(function(e){var l=d3.select(this),c=this;var v=(a||parseInt(l.style("width"))||960)-u.left-u.right,N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom;T.update=function(){l.transition().call(T)};b.disabled=e.map(function(e){return!!e.disabled});if(!w){var C;w={};for(C in b){if(b[C]instanceof Array)w[C]=b[C].slice(0);else w[C]=b[C]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var k=l.selectAll(".nv-noData").data([E]);k.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");k.attr("x",u.left+v/2).attr("y",u.top+N/2).text(function(e){return e});return T}else{l.selectAll(".nv-noData").remove()}var L=e.filter(function(e){return!e.disabled&&e.bar});var A=e.filter(function(e){return!e.bar});m=A.filter(function(e){return!e.disabled}).length&&A.filter(function(e){return!e.disabled})[0].values.length?t.xScale():n.xScale();g=n.yScale();y=t.yScale();var O=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([e]);var M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g");var _=O.select("g");M.append("g").attr("class","nv-x nv-axis");M.append("g").attr("class","nv-y1 nv-axis");M.append("g").attr("class","nv-y2 nv-axis");M.append("g").attr("class","nv-barsWrap");M.append("g").attr("class","nv-linesWrap");M.append("g").attr("class","nv-legendWrap");if(p){o.width(v/2);_.select(".nv-legendWrap").datum(e.map(function(e){e.originalKey=e.originalKey===undefined?e.key:e.originalKey;e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)");return e})).call(o);if(u.top!=o.height()){u.top=o.height();N=(f||parseInt(l.style("height"))||400)-u.top-u.bottom}_.select(".nv-legendWrap").attr("transform","translate("+v/2+","+ -u.top+")")}O.attr("transform","translate("+u.left+","+u.top+")");t.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));n.width(v).height(N).color(e.map(function(e,t){return e.color||h(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));var D=_.select(".nv-barsWrap").datum(L.length?L:[{values:[]}]);var P=_.select(".nv-linesWrap").datum(A[0]&&!A[0].disabled?A:[{values:[]}]);d3.transition(D).call(n);d3.transition(P).call(t);r.scale(m).ticks(v/100).tickSize(-N,0);_.select(".nv-x.nv-axis").attr("transform","translate(0,"+g.range()[0]+")");d3.transition(_.select(".nv-x.nv-axis")).call(r);i.scale(g).ticks(N/36).tickSize(-v,0);d3.transition(_.select(".nv-y1.nv-axis")).style("opacity",L.length?1:0).call(i);s.scale(y).ticks(N/36).tickSize(L.length?0:-v,0);_.select(".nv-y2.nv-axis").style("opacity",A.length?1:0).attr("transform","translate("+v+",0)");d3.transition(_.select(".nv-y2.nv-axis")).call(s);o.dispatch.on("stateChange",function(e){b=e;S.stateChange(b);T.update()});S.on("tooltipShow",function(e){if(d)x(e,c.parentNode)});S.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});b.disabled=t.disabled}T.update()})});return T}var t=e.models.line(),n=e.models.historicalBar(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.legend();var u={top:30,right:60,bottom:50,left:60},a=null,f=null,l=function(e){return e.x},c=function(e){return e.y},h=e.utils.defaultColor(),p=true,d=true,v=function(e,t,n,r,i){return"

          "+e+"

          "+"

          "+n+" at "+t+"

          "},m,g,y,b={},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");n.padData(true);t.clipEdge(false).padData(true);r.orient("bottom").tickPadding(7).highlightZero(false);i.orient("left");s.orient("right");var x=function(n,o){var u=n.pos[0]+(o.offsetLeft||0),a=n.pos[1]+(o.offsetTop||0),f=r.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?i:s).tickFormat()(t.y()(n.point,n.pointIndex)),c=v(n.series.key,f,l,n,T);e.tooltip.show([u,a],c,n.value<0?"n":"s",null,o)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top];S.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});n.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top];S.tooltipShow(e)});n.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});S.on("tooltipHide",function(){if(d)e.tooltip.cleanup()});T.dispatch=S;T.legend=o;T.lines=t;T.bars=n;T.xAxis=r;T.y1Axis=i;T.y2Axis=s;d3.rebind(T,t,"defined","size","clipVoronoi","interpolate");T.options=e.utils.optionsFunc.bind(T);T.x=function(e){if(!arguments.length)return l;l=e;t.x(e);n.x(e);return T};T.y=function(e){if(!arguments.length)return c;c=e;t.y(e);n.y(e);return T};T.margin=function(e){if(!arguments.length)return u;u.top=typeof e.top!="undefined"?e.top:u.top;u.right=typeof e.right!="undefined"?e.right:u.right;u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom;u.left=typeof e.left!="undefined"?e.left:u.left;return T};T.width=function(e){if(!arguments.length)return a;a=e;return T};T.height=function(e){if(!arguments.length)return f;f=e;return T};T.color=function(t){if(!arguments.length)return h;h=e.utils.getColor(t);o.color(h);return T};T.showLegend=function(e){if(!arguments.length)return p;p=e;return T};T.tooltips=function(e){if(!arguments.length)return d;d=e;return T};T.tooltipContent=function(e){if(!arguments.length)return v;v=e;return T};T.state=function(e){if(!arguments.length)return b;b=e;return T};T.defaultState=function(e){if(!arguments.length)return w;w=e;return T};T.noData=function(e){if(!arguments.length)return E;E=e;return T};return T};e.models.lineWithFocusChart=function(){"use strict";function k(e){e.each(function(e){function U(e){var t=+(e=="e"),n=t?1:-1,r=M/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function z(){if(!a.empty())a.extent(w);I.data([a.empty()?g.domain():w]).each(function(e,t){var n=g(e[0])-v.range()[0],r=v.range()[1]-g(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n);d3.select(this).select(".right").attr("x",g(e[1])).attr("width",r<0?0:r)})}function W(){w=a.empty()?null:a.extent();var n=a.empty()?g.domain():a.extent();if(Math.abs(n[0]-n[1])<=1){return}T.brush({extent:n,brush:a});z();var s=H.select(".nv-focus .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}).map(function(e,r){return{key:e.key,values:e.values.filter(function(e,r){return t.x()(e,r)>=n[0]&&t.x()(e,r)<=n[1]})}}));s.transition().duration(N).call(t);H.select(".nv-focus .nv-x.nv-axis").transition().duration(N).call(r);H.select(".nv-focus .nv-y.nv-axis").transition().duration(N).call(i)}var S=d3.select(this),L=this;var A=(h||parseInt(S.style("width"))||960)-f.left-f.right,O=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d,M=d-l.top-l.bottom;k.update=function(){S.transition().duration(N).call(k)};k.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var _=S.selectAll(".nv-noData").data([x]);_.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");_.attr("x",f.left+A/2).attr("y",f.top+O/2).text(function(e){return e});return k}else{S.selectAll(".nv-noData").remove()}v=t.xScale();m=t.yScale();g=n.xScale();y=n.yScale();var D=S.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([e]);var P=D.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g");var H=D.select("g");P.append("g").attr("class","nv-legendWrap");var B=P.append("g").attr("class","nv-focus");B.append("g").attr("class","nv-x nv-axis");B.append("g").attr("class","nv-y nv-axis");B.append("g").attr("class","nv-linesWrap");var j=P.append("g").attr("class","nv-context");j.append("g").attr("class","nv-x nv-axis");j.append("g").attr("class","nv-y nv-axis");j.append("g").attr("class","nv-linesWrap");j.append("g").attr("class","nv-brushBackground");j.append("g").attr("class","nv-x nv-brush");if(b){u.width(A);H.select(".nv-legendWrap").datum(e).call(u);if(f.top!=u.height()){f.top=u.height();O=(p||parseInt(S.style("height"))||400)-f.top-f.bottom-d}H.select(".nv-legendWrap").attr("transform","translate(0,"+ -f.top+")")}D.attr("transform","translate("+f.left+","+f.top+")");t.width(A).height(O).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));n.defined(t.defined()).width(A).height(M).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));H.select(".nv-context").attr("transform","translate(0,"+(O+f.bottom+l.top)+")");var F=H.select(".nv-context .nv-linesWrap").datum(e.filter(function(e){return!e.disabled}));d3.transition(F).call(n);r.scale(v).ticks(A/100).tickSize(-O,0);i.scale(m).ticks(O/36).tickSize(-A,0);H.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+O+")");a.x(g).on("brush",function(){var e=k.transitionDuration();k.transitionDuration(0);W();k.transitionDuration(e)});if(w)a.extent(w);var I=H.select(".nv-brushBackground").selectAll("g").data([w||a.extent()]);var q=I.enter().append("g");q.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",M);q.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",M);var R=H.select(".nv-x.nv-brush").call(a);R.selectAll("rect").attr("height",M);R.selectAll(".resize").append("path").attr("d",U);W();s.scale(g).ticks(A/100).tickSize(-M,0);H.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");d3.transition(H.select(".nv-context .nv-x.nv-axis")).call(s);o.scale(y).ticks(M/36).tickSize(-A,0);d3.transition(H.select(".nv-context .nv-y.nv-axis")).call(o);H.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+y.range()[0]+")");u.dispatch.on("stateChange",function(e){k.update()});T.on("tooltipShow",function(e){if(E)C(e,L.parentNode)})});return k}var t=e.models.line(),n=e.models.line(),r=e.models.axis(),i=e.models.axis(),s=e.models.axis(),o=e.models.axis(),u=e.models.legend(),a=d3.svg.brush();var f={top:30,right:30,bottom:30,left:60},l={top:0,right:30,bottom:20,left:60},c=e.utils.defaultColor(),h=null,p=null,d=100,v,m,g,y,b=true,w=null,E=true,S=function(e,t,n,r,i){return"

          "+e+"

          "+"

          "+n+" at "+t+"

          "},x="No Data Available.",T=d3.dispatch("tooltipShow","tooltipHide","brush"),N=250;t.clipEdge(true);n.interactive(false);r.orient("bottom").tickPadding(5);i.orient("left");s.orient("bottom").tickPadding(5);o.orient("left");var C=function(n,s){var o=n.pos[0]+(s.offsetLeft||0),u=n.pos[1]+(s.offsetTop||0),a=r.tickFormat()(t.x()(n.point,n.pointIndex)),f=i.tickFormat()(t.y()(n.point,n.pointIndex)),l=S(n.series.key,a,f,n,k);e.tooltip.show([o,u],l,null,null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+f.left,e.pos[1]+f.top];T.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){T.tooltipHide(e)});T.on("tooltipHide",function(){if(E)e.tooltip.cleanup()});k.dispatch=T;k.legend=u;k.lines=t;k.lines2=n;k.xAxis=r;k.yAxis=i;k.x2Axis=s;k.y2Axis=o;d3.rebind(k,t,"defined","isArea","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id");k.options=e.utils.optionsFunc.bind(k);k.x=function(e){if(!arguments.length)return t.x;t.x(e);n.x(e);return k};k.y=function(e){if(!arguments.length)return t.y;t.y(e);n.y(e);return k};k.margin=function(e){if(!arguments.length)return f;f.top=typeof e.top!="undefined"?e.top:f.top;f.right=typeof e.right!="undefined"?e.right:f.right;f.bottom=typeof e.bottom!="undefined"?e.bottom:f.bottom;f.left=typeof e.left!="undefined"?e.left:f.left;return k};k.margin2=function(e){if(!arguments.length)return l;l=e;return k};k.width=function(e){if(!arguments.length)return h;h=e;return k};k.height=function(e){if(!arguments.length)return p;p=e;return k};k.height2=function(e){if(!arguments.length)return d;d=e;return k};k.color=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);u.color(c);return k};k.showLegend=function(e){if(!arguments.length)return b;b=e;return k};k.tooltips=function(e){if(!arguments.length)return E;E=e;return k};k.tooltipContent=function(e){if(!arguments.length)return S;S=e;return k};k.interpolate=function(e){if(!arguments.length)return t.interpolate();t.interpolate(e);n.interpolate(e);return k};k.noData=function(e){if(!arguments.length)return x;x=e;return k};k.xTickFormat=function(e){if(!arguments.length)return r.tickFormat();r.tickFormat(e);s.tickFormat(e);return k};k.yTickFormat=function(e){if(!arguments.length)return i.tickFormat();i.tickFormat(e);o.tickFormat(e);return k};k.brushExtent=function(e){if(!arguments.length)return w;w=e;return k};k.transitionDuration=function(e){if(!arguments.length)return N;N=e;return k};return k};e.models.linePlusBarWithFocusChart=function(){"use strict";function B(e){e.each(function(e){function nt(e){var t=+(e=="e"),n=t?1:-1,r=q/3;return"M"+.5*n+","+r+"A6,6 0 0 "+t+" "+6.5*n+","+(r+6)+"V"+(2*r-6)+"A6,6 0 0 "+t+" "+.5*n+","+2*r+"Z"+"M"+2.5*n+","+(r+8)+"V"+(2*r-8)+"M"+4.5*n+","+(r+8)+"V"+(2*r-8)}function rt(){if(!h.empty())h.extent(x);Z.data([h.empty()?k.domain():x]).each(function(e,t){var n=k(e[0])-k.range()[0],r=k.range()[1]-k(e[1]);d3.select(this).select(".left").attr("width",n<0?0:n);d3.select(this).select(".right").attr("x",k(e[1])).attr("width",r<0?0:r)})}function it(){x=h.empty()?null:h.extent();S=h.empty()?k.domain():h.extent();D.brush({extent:S,brush:h});rt();r.width(F).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));t.width(F).height(I).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var n=J.select(".nv-focus .nv-barsWrap").datum(!U.length?[{values:[]}]:U.map(function(e,t){return{key:e.key,values:e.values.filter(function(e,t){return r.x()(e,t)>=S[0]&&r.x()(e,t)<=S[1]})}}));var i=J.select(".nv-focus .nv-linesWrap").datum(z[0].disabled?[{values:[]}]:z.map(function(e,n){return{key:e.key,values:e.values.filter(function(e,n){return t.x()(e,n)>=S[0]&&t.x()(e,n)<=S[1]})}}));if(U.length){C=r.xScale()}else{C=t.xScale()}s.scale(C).ticks(F/100).tickSize(-I,0);s.domain([Math.ceil(S[0]),Math.floor(S[1])]);J.select(".nv-x.nv-axis").transition().duration(P).call(s);n.transition().duration(P).call(r);i.transition().duration(P).call(t);J.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+L.range()[0]+")");u.scale(L).ticks(I/36).tickSize(-F,0);J.select(".nv-focus .nv-y1.nv-axis").style("opacity",U.length?1:0);a.scale(A).ticks(I/36).tickSize(U.length?0:-F,0);J.select(".nv-focus .nv-y2.nv-axis").style("opacity",z.length?1:0).attr("transform","translate("+C.range()[1]+",0)");J.select(".nv-focus .nv-y1.nv-axis").transition().duration(P).call(u);J.select(".nv-focus .nv-y2.nv-axis").transition().duration(P).call(a)}var N=d3.select(this),j=this;var F=(v||parseInt(N.style("width"))||960)-p.left-p.right,I=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g,q=g-d.top-d.bottom;B.update=function(){N.transition().duration(P).call(B)};B.container=this;if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var R=N.selectAll(".nv-noData").data([_]);R.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");R.attr("x",p.left+F/2).attr("y",p.top+I/2).text(function(e){return e});return B}else{N.selectAll(".nv-noData").remove()}var U=e.filter(function(e){return!e.disabled&&e.bar});var z=e.filter(function(e){return!e.bar});C=r.xScale();k=o.scale();L=r.yScale();A=t.yScale();O=i.yScale();M=n.yScale();var W=e.filter(function(e){return!e.disabled&&e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})});var X=e.filter(function(e){return!e.disabled&&!e.bar}).map(function(e){return e.values.map(function(e,t){return{x:y(e,t),y:b(e,t)}})});C.range([0,F]);k.domain(d3.extent(d3.merge(W.concat(X)),function(e){return e.x})).range([0,F]);var V=N.selectAll("g.nv-wrap.nv-linePlusBar").data([e]);var $=V.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g");var J=V.select("g");$.append("g").attr("class","nv-legendWrap");var K=$.append("g").attr("class","nv-focus");K.append("g").attr("class","nv-x nv-axis");K.append("g").attr("class","nv-y1 nv-axis");K.append("g").attr("class","nv-y2 nv-axis");K.append("g").attr("class","nv-barsWrap");K.append("g").attr("class","nv-linesWrap");var Q=$.append("g").attr("class","nv-context");Q.append("g").attr("class","nv-x nv-axis");Q.append("g").attr("class","nv-y1 nv-axis");Q.append("g").attr("class","nv-y2 nv-axis");Q.append("g").attr("class","nv-barsWrap");Q.append("g").attr("class","nv-linesWrap");Q.append("g").attr("class","nv-brushBackground");Q.append("g").attr("class","nv-x nv-brush");if(E){c.width(F/2);J.select(".nv-legendWrap").datum(e.map(function(e){e.originalKey=e.originalKey===undefined?e.key:e.originalKey;e.key=e.originalKey+(e.bar?" (left axis)":" (right axis)");return e})).call(c);if(p.top!=c.height()){p.top=c.height();I=(m||parseInt(N.style("height"))||400)-p.top-p.bottom-g}J.select(".nv-legendWrap").attr("transform","translate("+F/2+","+ -p.top+")")}V.attr("transform","translate("+p.left+","+p.top+")");i.width(F).height(q).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&e[n].bar}));n.width(F).height(q).color(e.map(function(e,t){return e.color||w(e,t)}).filter(function(t,n){return!e[n].disabled&&!e[n].bar}));var G=J.select(".nv-context .nv-barsWrap").datum(U.length?U:[{values:[]}]);var Y=J.select(".nv-context .nv-linesWrap").datum(!z[0].disabled?z:[{values:[]}]);J.select(".nv-context").attr("transform","translate(0,"+(I+p.bottom+d.top)+")");G.transition().call(i);Y.transition().call(n);h.x(k).on("brush",it);if(x)h.extent(x);var Z=J.select(".nv-brushBackground").selectAll("g").data([x||h.extent()]);var et=Z.enter().append("g");et.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",q);et.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",q);var tt=J.select(".nv-x.nv-brush").call(h);tt.selectAll("rect").attr("height",q);tt.selectAll(".resize").append("path").attr("d",nt);o.ticks(F/100).tickSize(-q,0);J.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+O.range()[0]+")");J.select(".nv-context .nv-x.nv-axis").transition().call(o);f.scale(O).ticks(q/36).tickSize(-F,0);J.select(".nv-context .nv-y1.nv-axis").style("opacity",U.length?1:0).attr("transform","translate(0,"+k.range()[0]+")");J.select(".nv-context .nv-y1.nv-axis").transition().call(f);l.scale(M).ticks(q/36).tickSize(U.length?0:-F,0);J.select(".nv-context .nv-y2.nv-axis").style("opacity",z.length?1:0).attr("transform","translate("+k.range()[1]+",0)");J.select(".nv-context .nv-y2.nv-axis").transition().call(l);c.dispatch.on("stateChange",function(e){B.update()});D.on("tooltipShow",function(e){if(T)H(e,j.parentNode)});it()});return B}var t=e.models.line(),n=e.models.line(),r=e.models.historicalBar(),i=e.models.historicalBar(),s=e.models.axis(),o=e.models.axis(),u=e.models.axis(),a=e.models.axis(),f=e.models.axis(),l=e.models.axis(),c=e.models.legend(),h=d3.svg.brush();var p={top:30,right:30,bottom:30,left:60},d={top:0,right:30,bottom:20,left:60},v=null,m=null,g=100,y=function(e){return e.x},b=function(e){return e.y},w=e.utils.defaultColor(),E=true,S,x=null,T=true,N=function(e,t,n,r,i){return"

          "+e+"

          "+"

          "+n+" at "+t+"

          "},C,k,L,A,O,M,_="No Data Available.",D=d3.dispatch("tooltipShow","tooltipHide","brush"),P=0;t.clipEdge(true);n.interactive(false);s.orient("bottom").tickPadding(5);u.orient("left");a.orient("right");o.orient("bottom").tickPadding(5);f.orient("left");l.orient("right");var H=function(n,r){if(S){n.pointIndex+=Math.ceil(S[0])}var i=n.pos[0]+(r.offsetLeft||0),o=n.pos[1]+(r.offsetTop||0),f=s.tickFormat()(t.x()(n.point,n.pointIndex)),l=(n.series.bar?u:a).tickFormat()(t.y()(n.point,n.pointIndex)),c=N(n.series.key,f,l,n,B);e.tooltip.show([i,o],c,n.value<0?"n":"s",null,r)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top];D.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)});r.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+p.left,e.pos[1]+p.top];D.tooltipShow(e)});r.dispatch.on("elementMouseout.tooltip",function(e){D.tooltipHide(e)});D.on("tooltipHide",function(){if(T)e.tooltip.cleanup()});B.dispatch=D;B.legend=c;B.lines=t;B.lines2=n;B.bars=r;B.bars2=i;B.xAxis=s;B.x2Axis=o;B.y1Axis=u;B.y2Axis=a;B.y3Axis=f;B.y4Axis=l;d3.rebind(B,t,"defined","size","clipVoronoi","interpolate");B.options=e.utils.optionsFunc.bind(B);B.x=function(e){if(!arguments.length)return y;y=e;t.x(e);r.x(e);return B};B.y=function(e){if(!arguments.length)return b;b=e;t.y(e);r.y(e);return B};B.margin=function(e){if(!arguments.length)return p;p.top=typeof e.top!="undefined"?e.top:p.top;p.right=typeof e.right!="undefined"?e.right:p.right;p.bottom=typeof e.bottom!="undefined"?e.bottom:p.bottom;p.left=typeof e.left!="undefined"?e.left:p.left;return B};B.width=function(e){if(!arguments.length)return v;v=e;return B};B.height=function(e){if(!arguments.length)return m;m=e;return B};B.color=function(t){if(!arguments.length)return w;w=e.utils.getColor(t);c.color(w);return B};B.showLegend=function(e){if(!arguments.length)return E;E=e;return B};B.tooltips=function(e){if(!arguments.length)return T;T=e;return B};B.tooltipContent=function(e){if(!arguments.length)return N;N=e;return B};B.noData=function(e){if(!arguments.length)return _;_=e;return B};B.brushExtent=function(e){if(!arguments.length)return x;x=e;return B};return B};e.models.multiBar=function(){"use strict";function C(e){e.each(function(e){var C=n-t.left-t.right,k=r-t.top-t.bottom,L=d3.select(this);if(d&&e.length)d=[{values:e[0].values.map(function(e){return{x:e.x,y:0,series:e.series,size:.01}})}];if(c)e=d3.layout.stack().offset(h).values(function(e){return e.values}).y(a)(!e.length&&d?d:e);e=e.map(function(e,t){e.values=e.values.map(function(e){e.series=t;return e});return e});if(c)e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y);if(t.y<0){t.y1=i;i=i-t.size}else{t.y1=t.size+r;r=r+t.size}})});var A=y&&b?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});i.domain(y||d3.merge(A).map(function(e){return e.x})).rangeBands(w||[0,C],S);s.domain(b||d3.extent(d3.merge(A).map(function(e){return c?e.y>0?e.y1:e.y1+e.y:e.y}).concat(f))).range(E||[k,0]);if(i.domain()[0]===i.domain()[1])i.domain()[0]?i.domain([i.domain()[0]-i.domain()[0]*.01,i.domain()[1]+i.domain()[1]*.01]):i.domain([-1,1]);if(s.domain()[0]===s.domain()[1])s.domain()[0]?s.domain([s.domain()[0]+s.domain()[0]*.01,s.domain()[1]-s.domain()[1]*.01]):s.domain([-1,1]);T=T||i;N=N||s;var O=L.selectAll("g.nv-wrap.nv-multibar").data([e]);var M=O.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar");var _=M.append("defs");var D=M.append("g");var P=O.select("g");D.append("g").attr("class","nv-groups");O.attr("transform","translate("+t.left+","+t.top+")");_.append("clipPath").attr("id","nv-edge-clip-"+o).append("rect");O.select("#nv-edge-clip-"+o+" rect").attr("width",C).attr("height",k);P.attr("clip-path",l?"url(#nv-edge-clip-"+o+")":"");var H=O.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});H.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);H.exit().transition().selectAll("rect.nv-bar").delay(function(t,n){return n*g/e[0].values.length}).attr("y",function(e){return c?N(e.y0):N(0)}).attr("height",0).remove();H.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return p(e,t)}).style("stroke",function(e,t){return p(e,t)});H.transition().style("stroke-opacity",1).style("fill-opacity",.75);var B=H.selectAll("rect.nv-bar").data(function(t){return d&&!e.length?d.values:t.values});B.exit().remove();var j=B.enter().append("rect").attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(t,n,r){return c?0:r*i.rangeBand()/e.length}).attr("y",function(e){return N(c?e.y0:0)}).attr("height",0).attr("width",i.rangeBand()/(c?1:e.length)).attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"});B.style("fill",function(e,t,n){return p(e,n,t)}).style("stroke",function(e,t,n){return p(e,n,t)}).on("mouseover",function(t,n){d3.select(this).classed("hover",true);x.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);x.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){x.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(t,n){x.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[i(u(t,n))+i.rangeBand()*(c?e.length/2:t.series+.5)/e.length,s(a(t,n)+(c?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()});B.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"}).transition().attr("transform",function(e,t){return"translate("+i(u(e,t))+",0)"});if(v){if(!m)m=e.map(function(){return true});B.style("fill",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(v(e,t)).darker(m.map(function(e,t){return t}).filter(function(e,t){return!m[t]})[n]).toString()})}if(c)B.transition().delay(function(t,n){return n*g/e[0].values.length}).attr("y",function(e,t){return s(c?e.y1:0)}).attr("height",function(e,t){if(e.y==null)return 0;return Math.max(Math.abs(s(e.y+(c?e.y0:0))-s(c?e.y0:0)),1)}).attr("x",function(t,n){return c?0:t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/(c?1:e.length));else B.transition().delay(function(t,n){return n*g/e[0].values.length}).attr("x",function(t,n){return t.series*i.rangeBand()/e.length}).attr("width",i.rangeBand()/e.length).attr("y",function(e,t){return a(e,t)<0?s(0):s(0)-s(a(e,t))<1?s(0)-1:s(a(e,t))||0}).attr("height",function(e,t){if(e.y==null)return 0;return Math.max(Math.abs(s(a(e,t))-s(0)),1)||0});T=i.copy();N=s.copy()});return C}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=d3.scale.ordinal(),s=d3.scale.linear(),o=Math.floor(Math.random()*1e4),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=true,c=false,h="zero",p=e.utils.defaultColor(),d=false,v=null,m,g=1200,y,b,w,E,S=.1,x=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");var T,N;C.dispatch=x;C.options=e.utils.optionsFunc.bind(C);C.x=function(e){if(!arguments.length)return u;u=e;return C};C.y=function(e){if(!arguments.length)return a;a=e;return C};C.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return C};C.width=function(e){if(!arguments.length)return n;n=e;return C};C.height=function(e){if(!arguments.length)return r;r=e;return C};C.xScale=function(e){if(!arguments.length)return i;i=e;return C};C.yScale=function(e){if(!arguments.length)return s;s=e;return C};C.xDomain=function(e){if(!arguments.length)return y;y=e;return C};C.yDomain=function(e){if(!arguments.length)return b;b=e;return C};C.xRange=function(e){if(!arguments.length)return w;w=e;return C};C.yRange=function(e){if(!arguments.length)return E;E=e;return C};C.forceY=function(e){if(!arguments.length)return f;f=e;return C};C.stacked=function(e){if(!arguments.length)return c;c=e;return C};C.stackOffset=function(e){if(!arguments.length)return h;h=e;return C};C.clipEdge=function(e){if(!arguments.length)return l;l=e;return C};C.color=function(t){if(!arguments.length)return p;p=e.utils.getColor(t);return C};C.barColor=function(t){if(!arguments.length)return v;v=e.utils.getColor(t);return C};C.disabled=function(e){if(!arguments.length)return m;m=e;return C};C.id=function(e){if(!arguments.length)return o;o=e;return C};C.hideable=function(e){if(!arguments.length)return d;d=e;return C};C.delay=function(e){if(!arguments.length)return g;g=e;return C};C.groupSpacing=function(e){if(!arguments.length)return S;S=e;return C};return C};e.models.multiBarChart=function(){"use strict";function M(e){e.each(function(e){var h=d3.select(this),E=this;var _=(u||parseInt(h.style("width"))||960)-o.left-o.right,D=(a||parseInt(h.style("height"))||400)-o.top-o.bottom;M.update=function(){h.transition().duration(A).call(M)};M.container=this;if(w=="right")_=_-250;T.disabled=e.map(function(e){return!!e.disabled});if(!N){var P;N={};for(P in T){if(T[P]instanceof Array)N[P]=T[P].slice(0);else N[P]=T[P]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var H=h.selectAll(".nv-noData").data([C]);H.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");H.attr("x",o.left+_/2).attr("y",o.top+D/2).text(function(e){return e});return M}else{h.selectAll(".nv-noData").remove()}S=t.xScale();x=t.yScale();var B=h.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([e]);var j=B.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g");var F=B.select("g");j.append("g").attr("class","nv-x nv-axis");j.append("g").attr("class","nv-y nv-axis");j.append("g").attr("class","nv-barsWrap");j.append("g").attr("class","nv-legendWrap");j.append("g").attr("class","nv-controlsWrap");if(c){i.width(_-L());if(t.barColor())e.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()});F.select(".nv-legendWrap").datum(e).call(i);if(o.top!=i.height()){o.top=i.height();D=(a||parseInt(h.style("height"))||400)-o.top-o.bottom}if(w=="right"){F.select(".nv-legendWrap").attr("transform","translate("+_+","+(-o.top+20+30)+")")}else{F.select(".nv-legendWrap").attr("transform","translate("+L()+","+ -o.top+")")}}if(l){var I=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(L()).color(["#444","#444","#444"]);F.select(".nv-controlsWrap").datum(I).call(s);if(w=="right"){F.select(".nv-controlsWrap").attr("transform","translate("+_+","+(-o.top+20)+")")}else{F.select(".nv-controlsWrap").attr("transform","translate("+0+","+ -o.top+")")}}B.attr("transform","translate("+o.left+","+o.top+")");if(v){F.select(".nv-y.nv-axis").attr("transform","translate("+_+",0)")}t.disabled(e.map(function(e){return e.disabled})).width(_).height(D).color(e.map(function(e,t){return e.color||f(e,t)}).filter(function(t,n){return!e[n].disabled}));var q=F.select(".nv-barsWrap").datum(e.filter(function(e){return!e.disabled}));q.transition().call(t);if(p){n.scale(S).ticks(_/100).tickSize(-D,0);F.select(".nv-x.nv-axis").attr("transform","translate(0,"+x.range()[0]+")");F.select(".nv-x.nv-axis").transition().call(n);var R=F.select(".nv-x.nv-axis > g").selectAll("g");R.selectAll("line, text").style("opacity",1);if(g){var U=function(e,t){return"translate("+e+","+t+")"};var z=5,W=17;R.selectAll("text").attr("transform",function(e,t,n){return U(0,n%2==0?z:W)});var X=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;F.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(e,t){return U(0,t===0||X%2!==0?W:z)})}if(m)R.filter(function(t,n){return n%Math.ceil(e[0].values.length/(_/100))!==0}).selectAll("text, line").style("opacity",0);if(y)R.selectAll(".tick text").attr("transform","rotate("+y+" 0,0)").style("text-anchor",y>0?"start":"end");F.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}if(d){r.scale(x).ticks(D/36).tickSize(-_,0);F.select(".nv-y.nv-axis").transition().call(r)}i.dispatch.on("stateChange",function(e){T=e;k.stateChange(T);M.update()});s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;I=I.map(function(e){e.disabled=true;return e});e.disabled=false;switch(e.key){case"Grouped":t.stacked(false);break;case"Stacked":t.stacked(true);break}T.stacked=t.stacked();k.stateChange(T);M.update()});k.on("tooltipShow",function(e){if(b)O(e,E.parentNode)});k.on("changeState",function(n){if(typeof n.disabled!=="undefined"){e.forEach(function(e,t){e.disabled=n.disabled[t]});T.disabled=n.disabled}if(typeof n.stacked!=="undefined"){t.stacked(n.stacked);T.stacked=n.stacked}M.update()})});return M}var t=e.models.multiBar(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend();var o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=true,c=true,h=false,p=true,d=true,v=false,m=true,g=false,y=0,b=true,w="top",E=function(e,t,n,r,i,s){if(s){var o=d3.format(",.2f");return"

          "+e+"

          "+"

          "+o(Math.pow(10,n))+" on "+t+"

          "}else{return"

          "+e+"

          "+"

          "+n+" on "+t+"

          "}},S,x,T={stacked:false},N=null,C="No Data Available.",k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=function(){return l?180:0},A=250;t.stacked(false);n.orient("bottom").tickPadding(7).highlightZero(true).showMaxMin(false).tickFormat(function(e){return e});r.orient(v?"right":"left").tickFormat(d3.format(",.1f"));s.updateState(false);var O=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),a=n.tickFormat()(t.x()(i.point,i.pointIndex)),f=r.tickFormat()(t.y()(i.point,i.pointIndex)),l=E(i.series.key,a,f,i,M,h);e.tooltip.show([o,u],l,i.value<0?"n":"s",null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top];k.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){k.tooltipHide(e)});k.on("tooltipHide",function(){if(b)e.tooltip.cleanup()});M.dispatch=k;M.multibar=t;M.legend=i;M.xAxis=n;M.yAxis=r;d3.rebind(M,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","stacked","stackOffset","delay","barColor","groupSpacing");M.options=e.utils.optionsFunc.bind(M);M.margin=function(e){if(!arguments.length)return o;o.top=typeof e.top!="undefined"?e.top:o.top;o.right=typeof e.right!="undefined"?e.right:o.right;o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom;o.left=typeof e.left!="undefined"?e.left:o.left;return M};M.width=function(e){if(!arguments.length)return u;u=e;return M};M.height=function(e){if(!arguments.length)return a;a=e;return M};M.color=function(t){if(!arguments.length)return f;f=e.utils.getColor(t);i.color(f);return M};M.showControls=function(e){if(!arguments.length)return l;l=e;return M};M.showLegend=function(e){if(!arguments.length)return c;c=e;return M};M.logScale=function(e){if(!arguments.length)return h;h=e;return M};M.showXAxis=function(e){if(!arguments.length)return p;p=e;return M};M.showYAxis=function(e){if(!arguments.length)return d;d=e;return M};M.rightAlignYAxis=function(e){if(!arguments.length)return v;v=e;r.orient(e?"right":"left");return M};M.reduceXTicks=function(e){if(!arguments.length)return m;m=e;return M};M.rotateLabels=function(e){if(!arguments.length)return y;y=e;return M};M.staggerLabels=function(e){if(!arguments.length)return g;g=e;return M};M.tooltip=function(e){if(!arguments.length)return E;E=e;return M};M.tooltips=function(e){if(!arguments.length)return b;b=e;return M};M.legendPos=function(e){if(!arguments.length)return w;w=e;return M};M.tooltipContent=function(e){if(!arguments.length)return E;E=e;return M};M.state=function(e){if(!arguments.length)return T;T=e;return M};M.defaultState=function(e){if(!arguments.length)return N;N=e;return M};M.noData=function(e){if(!arguments.length)return C;C=e;return M};M.transitionDuration=function(e){if(!arguments.length)return A;A=e;return M};return M};e.models.multiBarHorizontal=function(){"use strict";function N(e){e.each(function(e){var i=n-t.left-t.right,g=r-t.top-t.bottom,N=d3.select(this);if(p)e=d3.layout.stack().offset("zero").values(function(e){return e.values}).y(a)(e);e=e.map(function(e,t){e.values=e.values.map(function(e){e.series=t;return e});return e});if(p)e[0].values.map(function(t,n){var r=0,i=0;e.map(function(e){var t=e.values[n];t.size=Math.abs(t.y);if(t.y<0){t.y1=i-t.size;i=i-t.size}else{t.y1=r;r=r+t.size}})});var C=y&&b?[]:e.map(function(e){return e.values.map(function(e,t){return{x:u(e,t),y:a(e,t),y0:e.y0,y1:e.y1}})});s.domain(y||d3.merge(C).map(function(e){return e.x})).rangeBands(w||[0,g],.1);o.domain(b||d3.extent(d3.merge(C).map(function(e){return p?e.y>0?e.y1+e.y:e.y1:e.y}).concat(f)));if(d&&!p)o.range(E||[o.domain()[0]<0?v:0,i-(o.domain()[1]>0?v:0)]);else o.range(E||[0,i]);x=x||s;T=T||d3.scale.linear().domain(o.domain()).range([o(0),o(0)]);var k=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([e]);var L=k.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal");var A=L.append("defs");var O=L.append("g");var M=k.select("g");O.append("g").attr("class","nv-groups");k.attr("transform","translate("+t.left+","+t.top+")");var _=k.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e,t){return t});_.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);_.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove();_.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover}).style("fill",function(e,t){return l(e,t)}).style("stroke",function(e,t){return l(e,t)});_.transition().style("stroke-opacity",1).style("fill-opacity",.75);var D=_.selectAll("g.nv-bar").data(function(e){return e.values});D.exit().remove();var P=D.enter().append("g").attr("transform",function(t,n,r){return"translate("+T(p?t.y0:0)+","+(p?0:r*s.rangeBand()/e.length+s(u(t,n)))+")"});P.append("rect").attr("width",0).attr("height",s.rangeBand()/(p?1:e.length));D.on("mouseover",function(t,n){d3.select(this).classed("hover",true);S.elementMouseover({value:a(t,n),point:t,series:e[t.series],pos:[o(a(t,n)+(p?t.y0:0)),s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);S.elementMouseout({value:a(t,n),point:t,series:e[t.series],pointIndex:n,seriesIndex:t.series,e:d3.event})}).on("click",function(t,n){S.elementClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()}).on("dblclick",function(t,n){S.elementDblClick({value:a(t,n),point:t,series:e[t.series],pos:[s(u(t,n))+s.rangeBand()*(p?e.length/2:t.series+.5)/e.length,o(a(t,n)+(p?t.y0:0))],pointIndex:n,seriesIndex:t.series,e:d3.event});d3.event.stopPropagation()});P.append("text");if(d&&!p){D.select("text").attr("text-anchor",function(e,t){return a(e,t)<0?"end":"start"}).attr("y",s.rangeBand()/(e.length*2)).attr("dy",".32em").text(function(e,t){return m(a(e,t))});D.transition().select("text").attr("x",function(e,t){return a(e,t)<0?-4:o(a(e,t))-o(0)+4})}else{D.selectAll("text").text("")}D.attr("class",function(e,t){return a(e,t)<0?"nv-bar negative":"nv-bar positive"});if(c){if(!h)h=e.map(function(){return true});D.style("fill",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()}).style("stroke",function(e,t,n){return d3.rgb(c(e,t)).darker(h.map(function(e,t){return t}).filter(function(e,t){return!h[t]})[n]).toString()})}if(p)D.transition().attr("transform",function(e,t){return"translate("+o(e.y1)+","+s(u(e,t))+")"}).select("rect").attr("width",function(e,t){return Math.abs(o(a(e,t)+e.y0)-o(e.y0))}).attr("height",s.rangeBand());else D.transition().attr("transform",function(t,n){return"translate("+(a(t,n)<0?o(a(t,n)):o(0))+","+(t.series*s.rangeBand()/e.length+s(u(t,n)))+")"}).select("rect").attr("height",s.rangeBand()/e.length).attr("width",function(e,t){return Math.max(Math.abs(o(a(e,t))-o(0)),1)});x=s.copy();T=o.copy()});return N}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.ordinal(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=[0],l=e.utils.defaultColor(),c=null,h,p=false,d=false,v=60,m=d3.format(",.2f"),g=1200,y,b,w,E,S=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");var x,T;N.dispatch=S;N.options=e.utils.optionsFunc.bind(N);N.x=function(e){if(!arguments.length)return u;u=e;return N};N.y=function(e){if(!arguments.length)return a;a=e;return N};N.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return N};N.width=function(e){if(!arguments.length)return n;n=e;return N};N.height=function(e){if(!arguments.length)return r;r=e;return N};N.xScale=function(e){if(!arguments.length)return s;s=e;return N};N.yScale=function(e){if(!arguments.length)return o;o=e;return N};N.xDomain=function(e){if(!arguments.length)return y;y=e;return N};N.yDomain=function(e){if(!arguments.length)return b;b=e;return N};N.xRange=function(e){if(!arguments.length)return w;w=e;return N};N.yRange=function(e){if(!arguments.length)return E;E=e;return N};N.forceY=function(e){if(!arguments.length)return f;f=e;return N};N.stacked=function(e){if(!arguments.length)return p;p=e;return N};N.color=function(t){if(!arguments.length)return l;l=e.utils.getColor(t);return N};N.barColor=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);return N};N.disabled=function(e){if(!arguments.length)return h;h=e;return N};N.id=function(e){if(!arguments.length)return i;i=e;return N};N.delay=function(e){if(!arguments.length)return g;g=e;return N};N.showValues=function(e){if(!arguments.length)return d;d=e;return N};N.valueFormat=function(e){if(!arguments.length)return m;m=e;return N};N.valuePadding=function(e){if(!arguments.length)return v;v=e;return N};return N};e.models.multiBarHorizontalChart=function(){"use strict";function C(e){e.each(function(h){var p=d3.select(this),m=this;var k=(u||parseInt(p.style("width"))||960)-o.left-o.right,L=(a||parseInt(p.style("height"))||400)-o.top-o.bottom;C.update=function(){p.transition().duration(T).call(C)};C.container=this;if(v=="right")k=k-250;b.disabled=h.map(function(e){return!!e.disabled});if(!w){var A;w={};for(A in b){if(b[A]instanceof Array)w[A]=b[A].slice(0);else w[A]=b[A]}}if(!h||!h.length||!h.filter(function(e){return e.values.length}).length){var O=p.selectAll(".nv-noData").data([E]);O.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");O.attr("x",o.left+k/2).attr("y",o.top+L/2).text(function(e){return e});return C}else{p.selectAll(".nv-noData").remove()}g=t.xScale();y=t.yScale();var M=p.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([h]);var _=M.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g");var D=M.select("g");_.append("g").attr("class","nv-x nv-axis");_.append("g").attr("class","nv-y nv-axis");_.append("g").attr("class","nv-barsWrap");_.append("g").attr("class","nv-legendWrap");_.append("g").attr("class","nv-controlsWrap");if(c){i.width(k-x());if(t.barColor())h.forEach(function(e,t){e.color=d3.rgb("#ccc").darker(t*1.5).toString()});D.select(".nv-legendWrap").datum(h).call(i);if(o.top!=i.height()){o.top=i.height();L=(a||parseInt(p.style("height"))||400)-o.top-o.bottom}if(v=="right"){D.select(".nv-legendWrap").attr("transform","translate("+x()+","+20+")")}else{D.select(".nv-legendWrap").attr("transform","translate("+x()+","+ -o.top+")")}}if(l){var P=[{key:"Grouped",disabled:t.stacked()},{key:"Stacked",disabled:!t.stacked()}];s.width(x()).color(["#444","#444","#444"]);D.select(".nv-controlsWrap").datum(P).attr("transform","translate(0,"+ -o.top+")").call(s)}M.attr("transform","translate("+o.left+","+o.top+")");t.disabled(h.map(function(e){return e.disabled})).width(k).height(L).color(h.map(function(e,t){return e.color||f(e,t)}).filter(function(e,t){return!h[t].disabled}));var H=D.select(".nv-barsWrap").datum(h.filter(function(e){return!e.disabled}));H.transition().call(t);n.scale(g).ticks(L/24).tickSize(-k,0);D.select(".nv-x.nv-axis").transition().call(n);var B=D.select(".nv-x.nv-axis").selectAll("g");B.selectAll("line, text").style("opacity",1);r.scale(y).ticks(k/100).tickSize(-L,0);D.select(".nv-y.nv-axis").attr("transform","translate(0,"+L+")");D.select(".nv-y.nv-axis").transition().call(r);i.dispatch.on("stateChange",function(e){b=e;S.stateChange(b);C.update()});s.dispatch.on("legendClick",function(e,n){if(!e.disabled)return;P=P.map(function(e){e.disabled=true;return e});e.disabled=false;switch(e.key){case"Grouped":t.stacked(false);break;case"Stacked":t.stacked(true);break}b.stacked=t.stacked();S.stateChange(b);C.update()});S.on("tooltipShow",function(e){if(d)N(e,m.parentNode)});S.on("changeState",function(n){if(typeof n.disabled!=="undefined"){h.forEach(function(e,t){e.disabled=n.disabled[t]});b.disabled=n.disabled}if(typeof n.stacked!=="undefined"){t.stacked(n.stacked);b.stacked=n.stacked}e.call(C)})});return C}var t=e.models.multiBarHorizontal(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend().height(30),s=e.models.legend().height(30);var o={top:30,right:20,bottom:50,left:60},u=null,a=null,f=e.utils.defaultColor(),l=true,c=true,h=false,p=false,d=true,v="top",m=function(e,t,n,i,s,o){if(o){return"

          "+e+" - "+t+"

          "+"

          "+r.tickFormat()(Math.pow(10,n))+"

          "}else{return"

          "+e+" - "+t+"

          "+"

          "+n+"

          "}},g,y,b={stacked:p},w=null,E="No Data Available.",S=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),x=function(){return l?180:0},T=250;t.stacked(p);n.orient("left").tickPadding(5).highlightZero(false).showMaxMin(false).tickFormat(function(e){return e});r.orient("bottom").tickFormat(d3.format(",.1f"));s.updateState(false);var N=function(i,s){var o=0;if(i.pos[0]>=200)o=200;else o=i.pos[0];if(h)l=t.y()(i.point,i.pointIndex);else l=r.tickFormat()(t.y()(i.point,i.pointIndex));var u=o+(s.offsetLeft||0),a=i.pos[1]+(s.offsetTop||0),f=n.tickFormat()(t.x()(i.point,i.pointIndex)),l=r.tickFormat()(t.y()(i.point,i.pointIndex)),c=m(i.series.key,f,l,i,C,h);e.tooltip.show([u,a],c,i.value<0?"e":"w",null,s)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+o.left,e.pos[1]+o.top];S.tooltipShow(e)});t.dispatch.on("elementMouseout.tooltip",function(e){S.tooltipHide(e)});S.on("tooltipHide",function(){if(d)e.tooltip.cleanup()});C.dispatch=S;C.multibar=t;C.legend=i;C.xAxis=n;C.yAxis=r;d3.rebind(C,t,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","delay","showValues","valueFormat","stacked","barColor");C.options=e.utils.optionsFunc.bind(C);C.margin=function(e){if(!arguments.length)return o;o.top=typeof e.top!="undefined"?e.top:o.top;o.right=typeof e.right!="undefined"?e.right:o.right;o.bottom=typeof e.bottom!="undefined"?e.bottom:o.bottom;o.left=typeof e.left!="undefined"?e.left:o.left;return C};C.width=function(e){if(!arguments.length)return u;u=e;return C};C.height=function(e){if(!arguments.length)return a;a=e;return C};C.color=function(t){if(!arguments.length)return f;f=e.utils.getColor(t);i.color(f);return C};C.showControls=function(e){if(!arguments.length)return l;l=e;return C};C.showLegend=function(e){if(!arguments.length)return c;c=e;return C};C.logScale=function(e){if(!arguments.length)return h;h=e;return C};C.tooltip=function(e){if(!arguments.length)return m;m=e;return C};C.tooltips=function(e){if(!arguments.length)return d;d=e;return C};C.legendPos=function(e){if(!arguments.length)return v;v=e;return C};C.tooltipContent=function(e){if(!arguments.length)return m;m=e;return C};C.state=function(e){if(!arguments.length)return b;b=e;return C};C.defaultState=function(e){if(!arguments.length)return w;w=e;return C};C.noData=function(e){if(!arguments.length)return E;E=e;return C};C.transitionDuration=function(e){if(!arguments.length)return T;T=e;return C};return C};e.models.multiChart=function(){"use strict";function L(e){e.each(function(e){var f=d3.select(this),c=this;L.update=function(){f.transition().call(L)};L.container=this;var h=(r||parseInt(f.style("width"))||960)-t.left-t.right,p=(i||parseInt(f.style("height"))||400)-t.top-t.bottom;if(a=="right")h=h-250;var A=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==1});var O=e.filter(function(e){return!e.disabled&&e.type=="line"&&e.yAxis==2});var M=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==1});var _=e.filter(function(e){return!e.disabled&&e.type=="bar"&&e.yAxis==2});var D=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==1});var P=e.filter(function(e){return!e.disabled&&e.type=="area"&&e.yAxis==2});var H=e.filter(function(e){return!e.disabled&&e.yAxis==1}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})});var B=e.filter(function(e){return!e.disabled&&e.yAxis==2}).map(function(e){return e.values.map(function(e,t){return{x:e.x,y:e.y}})});l.domain(d3.extent(d3.merge(H.concat(B)),function(e){return e.x})).range([0,h]);var j=f.selectAll("g.wrap.multiChart").data([e]);var F=j.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");F.append("g").attr("class","x axis");F.append("g").attr("class","y1 axis");F.append("g").attr("class","y2 axis");F.append("g").attr("class","lines1Wrap");F.append("g").attr("class","lines2Wrap");F.append("g").attr("class","bars1Wrap");F.append("g").attr("class","bars2Wrap");F.append("g").attr("class","stack1Wrap");F.append("g").attr("class","stack2Wrap");F.append("g").attr("class","legendWrap");var I=j.select("g");if(s){N.width(h/2);I.select(".legendWrap").datum(e.map(function(e){e.originalKey=e.originalKey===undefined?e.key:e.originalKey;e.key=e.originalKey+(e.yAxis==1?"":" (right axis)");return e})).call(N);if(t.top!=N.height()){t.top=N.height();p=(i||parseInt(f.style("height"))||400)-t.top-t.bottom}if(a=="right"){I.select(".legendWrap").attr("transform","translate("+h+","+20+")")}else{I.select(".legendWrap").attr("transform","translate("+h/2+","+ -t.top+")")}}m.width(h).height(p).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="line"}));g.width(h).height(p).interpolate("monotone").color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="line"}));y.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="bar"}));b.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="bar"}));w.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==1&&e[n].type=="area"}));E.width(h).height(p).color(e.map(function(e,t){return e.color||n[t%n.length]}).filter(function(t,n){return!e[n].disabled&&e[n].yAxis==2&&e[n].type=="area"}));if(a=="right"){I.attr("transform","translate("+t.left+","+"20"+")")}else{I.attr("transform","translate("+t.left+","+t.top+")")}var q=I.select(".lines1Wrap").datum(A);var R=I.select(".bars1Wrap").datum(M);var U=I.select(".stack1Wrap").datum(D);var z=I.select(".lines2Wrap").datum(O);var W=I.select(".bars2Wrap").datum(_);var X=I.select(".stack2Wrap").datum(P);var V=D.length?D.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[];var $=P.length?P.map(function(e){return e.values}).reduce(function(e,t){return e.map(function(e,n){return{x:e.x,y:e.y+t[n].y}})}).concat([{x:0,y:0}]):[];d.domain(d3.extent(d3.extent(d3.merge(H).concat(V),function(e){return e.y}).concat(m.forceY()))).range([0,p]);v.domain(d3.extent(d3.extent(d3.merge(B).concat($),function(e){return e.y}).concat(g.forceY()))).range([0,p]);m.yDomain(d.domain());y.yDomain(d.domain());w.yDomain(d.domain());g.yDomain(v.domain());b.yDomain(v.domain());E.yDomain(v.domain());if(D.length){d3.transition(U).call(w)}if(P.length){d3.transition(X).call(E)}if(M.length){d3.transition(R).call(y)}if(_.length){d3.transition(W).call(b)}if(A.length){d3.transition(q).call(m)}if(O.length){d3.transition(z).call(g)}S.ticks(h/100).tickSize(-p,0);I.select(".x.axis").attr("transform","translate(0,"+p+")");d3.transition(I.select(".x.axis")).call(S);x.ticks(p/36).tickSize(-h,0);d3.transition(I.select(".y1.axis")).call(x);T.ticks(p/36).tickSize(-h,0);d3.transition(I.select(".y2.axis")).call(T);I.select(".y2.axis").style("opacity",B.length?1:0).attr("transform","translate("+l.range()[1]+",0)");N.dispatch.on("stateChange",function(e){L.update()});if(u){N.dualaxis(true)}else{N.dualaxis(false)}C.on("tooltipShow",function(e){if(o)k(e,c.parentNode)})});return L}var t={top:30,right:20,bottom:50,left:60},n=d3.scale.category20().range(),r=null,i=null,s=true,o=true,u=false,a="top",f=function(e,t,n,r,i){return"

          "+e+"

          "+"

          "+n+" at "+t+"

          "},l,c,h,p;var l=d3.scale.linear(),d=d3.scale.linear(),v=d3.scale.linear(),m=e.models.line().yScale(d),g=e.models.line().yScale(v),y=e.models.multiBar().stacked(false).yScale(d),b=e.models.multiBar().stacked(false).yScale(v),w=e.models.stackedArea().yScale(d),E=e.models.stackedArea().yScale(v),S=e.models.axis().scale(l).orient("bottom").tickPadding(5),x=e.models.axis().scale(d).orient("left"),T=e.models.axis().scale(v).orient("right"),N=e.models.legend().height(30),C=d3.dispatch("tooltipShow","tooltipHide");var k=function(t,n){var r=t.pos[0]+(n.offsetLeft||0),i=t.pos[1]+(n.offsetTop||0),s=S.tickFormat()(m.x()(t.point,t.pointIndex)),o=(t.series.yAxis==2?T:x).tickFormat()(m.y()(t.point,t.pointIndex)),u=f(t.series.key,s,o,t,L);e.tooltip.show([r,i],u,undefined,undefined,n.offsetParent)};m.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});m.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});g.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});g.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});y.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});y.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});b.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});b.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});w.dispatch.on("tooltipShow",function(e){if(!Math.round(w.y()(e.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",false)},0);return false}e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],C.tooltipShow(e)});w.dispatch.on("tooltipHide",function(e){C.tooltipHide(e)});E.dispatch.on("tooltipShow",function(e){if(!Math.round(E.y()(e.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",false)},0);return false}e.pos=[e.pos[0]+t.left,e.pos[1]+t.top],C.tooltipShow(e)});E.dispatch.on("tooltipHide",function(e){C.tooltipHide(e)});m.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});m.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});g.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+t.left,e.pos[1]+t.top];C.tooltipShow(e)});g.dispatch.on("elementMouseout.tooltip",function(e){C.tooltipHide(e)});C.on("tooltipHide",function(){if(o)e.tooltip.cleanup()});L.dispatch=C;L.lines1=m;L.lines2=g;L.bars1=y;L.bars2=b;L.stack1=w;L.stack2=E;L.xAxis=S;L.yAxis1=x;L.yAxis2=T;L.options=e.utils.optionsFunc.bind(L);L.x=function(e){if(!arguments.length)return getX;getX=e;m.x(e);y.x(e);return L};L.y=function(e){if(!arguments.length)return getY;getY=e;m.y(e);y.y(e);return L};L.yDomain1=function(e){if(!arguments.length)return h;h=e;return L};L.yDomain2=function(e){if(!arguments.length)return p;p=e;return L};L.margin=function(e){if(!arguments.length)return t;t=e;return L};L.width=function(e){if(!arguments.length)return r;r=e;return L};L.height=function(e){if(!arguments.length)return i;i=e;return L};L.color=function(e){if(!arguments.length)return n;n=e;N.color(e);return L};L.showLegend=function(e){if(!arguments.length)return s;s=e;return L};L.tooltips=function(e){if(!arguments.length)return o;o=e;return L};L.dualaxis=function(e){if(!arguments.length)return u;u=e;return L};L.legendPos=function(e){if(!arguments.length)return a;a=e;return L};L.tooltipContent=function(e){if(!arguments.length)return f;f=e;return L};return L};e.models.ohlcBar=function(){"use strict";function x(e){e.each(function(e){var g=n-t.left-t.right,x=r-t.top-t.bottom,T=d3.select(this);s.domain(y||d3.extent(e[0].values.map(u).concat(p)));if(v)s.range(w||[g*.5/e[0].values.length,g*(e[0].values.length-.5)/e[0].values.length]);else s.range(w||[0,g]);o.domain(b||[d3.min(e[0].values.map(h).concat(d)),d3.max(e[0].values.map(c).concat(d))]).range(E||[x,0]);if(s.domain()[0]===s.domain()[1])s.domain()[0]?s.domain([s.domain()[0]-s.domain()[0]*.01,s.domain()[1]+s.domain()[1]*.01]):s.domain([-1,1]);if(o.domain()[0]===o.domain()[1])o.domain()[0]?o.domain([o.domain()[0]+o.domain()[0]*.01,o.domain()[1]-o.domain()[1]*.01]):o.domain([-1,1]);var N=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([e[0].values]);var C=N.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar");var k=C.append("defs");var L=C.append("g");var A=N.select("g");L.append("g").attr("class","nv-ticks");N.attr("transform","translate("+t.left+","+t.top+")");T.on("click",function(e,t){S.chartClick({data:e,index:t,pos:d3.event,id:i})});k.append("clipPath").attr("id","nv-chart-clip-path-"+i).append("rect");N.select("#nv-chart-clip-path-"+i+" rect").attr("width",g).attr("height",x);A.attr("clip-path",m?"url(#nv-chart-clip-path-"+i+")":"");var O=N.select(".nv-ticks").selectAll(".nv-tick").data(function(e){return e});O.exit().remove();var M=O.enter().append("path").attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"}).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).on("mouseover",function(t,n){d3.select(this).classed("hover",true);S.elementMouseover({point:t,series:e[0],pos:[s(u(t,n)),o(a(t,n))],pointIndex:n,seriesIndex:0,e:d3.event})}).on("mouseout",function(t,n){d3.select(this).classed("hover",false);S.elementMouseout({point:t,series:e[0],pointIndex:n,seriesIndex:0,e:d3.event})}).on("click",function(e,t){S.elementClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()}).on("dblclick",function(e,t){S.elementDblClick({value:a(e,t),data:e,index:t,pos:[s(u(e,t)),o(a(e,t))],e:d3.event,id:i});d3.event.stopPropagation()});O.attr("class",function(e,t,n){return(f(e,t)>l(e,t)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+t});d3.transition(O).attr("transform",function(e,t){return"translate("+s(u(e,t))+","+o(c(e,t))+")"}).attr("d",function(t,n){var r=g/e[0].values.length*.9;return"m0,0l0,"+(o(f(t,n))-o(c(t,n)))+"l"+ -r/2+",0l"+r/2+",0l0,"+(o(h(t,n))-o(f(t,n)))+"l0,"+(o(l(t,n))-o(h(t,n)))+"l"+r/2+",0l"+ -r/2+",0z"})});return x}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=Math.floor(Math.random()*1e4),s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=function(e){return e.open},l=function(e){return e.close},c=function(e){return e.high},h=function(e){return e.low},p=[],d=[],v=false,m=true,g=e.utils.defaultColor(),y,b,w,E,S=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");x.dispatch=S;x.options=e.utils.optionsFunc.bind(x);x.x=function(e){if(!arguments.length)return u;u=e;return x};x.y=function(e){if(!arguments.length)return a;a=e;return x};x.open=function(e){if(!arguments.length)return f;f=e;return x};x.close=function(e){if(!arguments.length)return l;l=e;return x};x.high=function(e){if(!arguments.length)return c;c=e;return x};x.low=function(e){if(!arguments.length)return h;h=e;return x};x.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return x};x.width=function(e){if(!arguments.length)return n;n=e;return x};x.height=function(e){if(!arguments.length)return r;r=e;return x};x.xScale=function(e){if(!arguments.length)return s;s=e;return x};x.yScale=function(e){if(!arguments.length)return o;o=e;return x};x.xDomain=function(e){if(!arguments.length)return y;y=e;return x};x.yDomain=function(e){if(!arguments.length)return b;b=e;return x};x.xRange=function(e){if(!arguments.length)return w;w=e;return x};x.yRange=function(e){if(!arguments.length)return E;E=e;return x};x.forceX=function(e){if(!arguments.length)return p;p=e;return x};x.forceY=function(e){if(!arguments.length)return d;d=e;return x};x.padData=function(e){if(!arguments.length)return v;v=e;return x};x.clipEdge=function(e){if(!arguments.length)return m;m=e;return x};x.color=function(t){if(!arguments.length)return g;g=e.utils.getColor(t);return x};x.id=function(e){if(!arguments.length)return i;i=e;return x};return x};e.models.pie=function(){"use strict";function E(e){e.each(function(e){function P(e){var t=(e.startAngle+e.endAngle)*90/Math.PI-90;return t>90?t-180:t}function H(e){e.endAngle=isNaN(e.endAngle)?0:e.endAngle;e.startAngle=isNaN(e.startAngle)?0:e.startAngle;if(!v)e.innerRadius=0;var t=d3.interpolate(this._current,e);this._current=t(0);return function(e){return L(t(e))}}function B(e){e.innerRadius=0;var t=d3.interpolate({startAngle:0,endAngle:0},e);return function(e){return L(t(e))}}var o=n-t.left-t.right,f=r-t.top-t.bottom,E=Math.min(o,f)/2,S=E-E/5,x=d3.select(this);var T=x.selectAll(".nv-wrap.nv-pie").data(e);var N=T.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+u);var C=N.append("g");var k=T.select("g");C.append("g").attr("class","nv-pie");T.attr("transform","translate("+t.left+","+t.top+")");k.select(".nv-pie").attr("transform","translate("+o/2+","+f/2+")");x.on("click",function(e,t){w.chartClick({data:e,index:t,pos:d3.event,id:u})});var L=d3.svg.arc().outerRadius(S);if(g)L.startAngle(g);if(y)L.endAngle(y);if(v)L.innerRadius(E*b);var A=d3.layout.pie().sort(null).value(function(e){return e.disabled?0:s(e)});var O=T.select(".nv-pie").selectAll(".nv-slice").data(A);O.exit().remove();var M=O.enter().append("g").attr("class","nv-slice").on("mouseover",function(e,t){d3.select(this).classed("hover",true);w.elementMouseover({label:i(e.data),value:s(e.data),point:e.data,pointIndex:t,pos:[d3.event.pageX,d3.event.pageY],id:u})}).on("mouseout",function(e,t){d3.select(this).classed("hover",false);w.elementMouseout({label:i(e.data),value:s(e.data),point:e.data,index:t,id:u})}).on("click",function(e,t){w.elementClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u});d3.event.stopPropagation()}).on("dblclick",function(e,t){w.elementDblClick({label:i(e.data),value:s(e.data),point:e.data,index:t,pos:d3.event,id:u});d3.event.stopPropagation()});O.attr("fill",function(e,t){return a(e,t)}).attr("stroke",function(e,t){return a(e,t)});var _=M.append("path").each(function(e){this._current=e});d3.transition(O.select("path")).attr("d",L).attrTween("d",H);if(l){var D=d3.svg.arc().innerRadius(0);if(c){D=L}if(h){D=d3.svg.arc().outerRadius(L.outerRadius())}M.append("g").classed("nv-label",true).each(function(e,t){var n=d3.select(this);n.attr("transform",function(e){if(m){e.outerRadius=S+10;e.innerRadius=S+15;var t=(e.startAngle+e.endAngle)/2*(180/Math.PI);if((e.startAngle+e.endAngle)/2d?r[p]:""});var r=n.select("text").node().getBBox();n.select(".nv-label rect").attr("width",r.width+10).attr("height",r.height+10).attr("transform",function(){return"translate("+[r.x-5,r.y-5]+")"})})}});return E}var t={top:0,right:0,bottom:0,left:0},n=500,r=500,i=function(e){return e.x},s=function(e){return e.y},o=function(e){return e.description},u=Math.floor(Math.random()*1e4),a=e.utils.defaultColor(),f=d3.format(",.2f"),l=true,c=true,h=false,p="key",d=.02,v=false,m=false,g=false,y=false,b=.5,w=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");E.dispatch=w;E.options=e.utils.optionsFunc.bind(E);E.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return E};E.width=function(e){if(!arguments.length)return n;n=e;return E};E.height=function(e){if(!arguments.length)return r;r=e;return E};E.values=function(t){e.log("pie.values() is no longer supported.");return E};E.x=function(e){if(!arguments.length)return i;i=e;return E};E.y=function(e){if(!arguments.length)return s;s=d3.functor(e);return E};E.description=function(e){if(!arguments.length)return o;o=e;return E};E.showLabels=function(e){if(!arguments.length)return l;l=e;return E};E.labelSunbeamLayout=function(e){if(!arguments.length)return m;m=e;return E};E.donutLabelsOutside=function(e){if(!arguments.length)return h;h=e;return E};E.pieLabelsOutside=function(e){if(!arguments.length)return c;c=e;return E};E.labelType=function(e){if(!arguments.length)return p;p=e;p=p||"key";return E};E.donut=function(e){if(!arguments.length)return v;v=e;return E};E.donutRatio=function(e){if(!arguments.length)return b;b=e;return E};E.startAngle=function(e){if(!arguments.length)return g;g=e;return E};E.endAngle=function(e){if(!arguments.length)return y;y=e;return E};E.id=function(e){if(!arguments.length)return u;u=e;return E};E.color=function(t){if(!arguments.length)return a;a=e.utils.getColor(t);return E};E.valueFormat=function(e){if(!arguments.length)return f;f=e;return E};E.labelThreshold=function(e){if(!arguments.length)return d;d=e;return E};return E};e.models.pieChart=function(){"use strict";function v(e){e.each(function(e){var u=d3.select(this),a=this;var f=(i||parseInt(u.style("width"))||960)-r.left-r.right,d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom;v.update=function(){u.transition().call(v)};v.container=this;l.disabled=e.map(function(e){return!!e.disabled});if(!c){var m;c={};for(m in l){if(l[m]instanceof Array)c[m]=l[m].slice(0);else c[m]=l[m]}}if(!e||!e.length){var g=u.selectAll(".nv-noData").data([h]);g.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");g.attr("x",r.left+f/2).attr("y",r.top+d/2).text(function(e){return e});return v}else{u.selectAll(".nv-noData").remove()}var y=u.selectAll("g.nv-wrap.nv-pieChart").data([e]);var b=y.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g");var w=y.select("g");b.append("g").attr("class","nv-pieWrap");b.append("g").attr("class","nv-legendWrap");if(o){n.width(f).key(t.x());y.select(".nv-legendWrap").datum(e).call(n);if(r.top!=n.height()){r.top=n.height();d=(s||parseInt(u.style("height"))||400)-r.top-r.bottom}y.select(".nv-legendWrap").attr("transform","translate(0,"+ -r.top+")")}y.attr("transform","translate("+r.left+","+r.top+")");t.width(f).height(d);var E=w.select(".nv-pieWrap").datum([e]);d3.transition(E).call(t);n.dispatch.on("stateChange",function(e){l=e;p.stateChange(l);v.update()});t.dispatch.on("elementMouseout.tooltip",function(e){p.tooltipHide(e)});p.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});l.disabled=t.disabled}v.update()})});return v}var t=e.models.pie(),n=e.models.legend();var r={top:30,right:20,bottom:20,left:20},i=null,s=null,o=true,u=e.utils.defaultColor(),a=true,f=function(e,t,n,r){return"

          "+e+"

          "+"

          "+t+"

          "},l={},c=null,h="No Data Available.",p=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");var d=function(n,r){var i=t.description()(n.point)||t.x()(n.point);var s=n.pos[0]+(r&&r.offsetLeft||0),o=n.pos[1]+(r&&r.offsetTop||0),u=t.valueFormat()(t.y()(n.point)),a=f(i,u,n,v);e.tooltip.show([s,o],a,n.value<0?"n":"s",null,r)};t.dispatch.on("elementMouseover.tooltip",function(e){e.pos=[e.pos[0]+r.left,e.pos[1]+r.top];p.tooltipShow(e)});p.on("tooltipShow",function(e){if(a)d(e)});p.on("tooltipHide",function(){if(a)e.tooltip.cleanup()});v.legend=n;v.dispatch=p;v.pie=t;d3.rebind(v,t,"valueFormat","values","x","y","description","id","showLabels","donutLabelsOutside","pieLabelsOutside","labelType","donut","donutRatio","labelThreshold");v.options=e.utils.optionsFunc.bind(v);v.margin=function(e){if(!arguments.length)return r;r.top=typeof e.top!="undefined"?e.top:r.top;r.right=typeof e.right!="undefined"?e.right:r.right;r.bottom=typeof e.bottom!="undefined"?e.bottom:r.bottom;r.left=typeof e.left!="undefined"?e.left:r.left;return v};v.width=function(e){if(!arguments.length)return i;i=e;return v};v.height=function(e){if(!arguments.length)return s;s=e;return v};v.color=function(r){if(!arguments.length)return u;u=e.utils.getColor(r);n.color(u);t.color(u);return v};v.showLegend=function(e){if(!arguments.length)return o;o=e;return v};v.tooltips=function(e){if(!arguments.length)return a;a=e;return v};v.tooltipContent=function(e){if(!arguments.length)return f;f=e;return v};v.state=function(e){if(!arguments.length)return l;l=e;return v};v.defaultState=function(e){if(!arguments.length)return c;c=e;return v};v.noData=function(e){if(!arguments.length)return h;h=e;return v};return v};e.models.scatter=function(){"use strict";function I(q){q.each(function(I){function Q(){if(!g)return false;var e;var i=d3.merge(I.map(function(e,t){return e.values.map(function(e,n){var r=f(e,n);var i=l(e,n);return[o(r)+Math.random()*1e-7,u(i)+Math.random()*1e-7,t,n,e]}).filter(function(e,t){return b(e[4],t)})}));if(D===true){if(x){var a=X.select("defs").selectAll(".nv-point-clips").data([s]).enter();a.append("clipPath").attr("class","nv-point-clips").attr("id","nv-points-clip-"+s);var c=X.select("#nv-points-clip-"+s).selectAll("circle").data(i);c.enter().append("circle").attr("r",T);c.exit().remove();c.attr("cx",function(e){return e[0]}).attr("cy",function(e){return e[1]});X.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+s+")")}if(i.length){i.push([o.range()[0]-20,u.range()[0]-20,null,null]);i.push([o.range()[1]+20,u.range()[1]+20,null,null]);i.push([o.range()[0]-20,u.range()[0]+20,null,null]);i.push([o.range()[1]+20,u.range()[1]-20,null,null])}var h=d3.geom.polygon([[-10,-10],[-10,r+10],[n+10,r+10],[n+10,-10]]);var p=d3.geom.voronoi(i).map(function(e,t){return{data:h.clip(e),series:i[t][2],point:i[t][3]}});var d=X.select(".nv-point-paths").selectAll("path").data(p);d.enter().append("path").attr("class",function(e,t){return"nv-path-"+t});d.exit().remove();d.attr("d",function(e){if(e.data.length===0)return"M 0 0";else return"M"+e.data.join("L")+"Z"});var v=function(e,n){if(F)return 0;var r=I[e.series];if(typeof r==="undefined")return;var i=r.values[e.point];n({point:i,series:r,pos:[o(f(i,e.point))+t.left,u(l(i,e.point))+t.top],seriesIndex:e.series,pointIndex:e.point})};d.on("click",function(e){v(e,_.elementClick)}).on("mouseover",function(e){v(e,_.elementMouseover)}).on("mouseout",function(e,t){v(e,_.elementMouseout)})}else{X.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementClick({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseover",function(e,n){if(F||!I[e.series])return 0;var r=I[e.series],i=r.values[n];_.elementMouseover({point:i,series:r,pos:[o(f(i,n))+t.left,u(l(i,n))+t.top],seriesIndex:e.series,pointIndex:n})}).on("mouseout",function(e,t){if(F||!I[e.series])return 0;var n=I[e.series],r=n.values[t];_.elementMouseout({point:r,series:n,seriesIndex:e.series,pointIndex:t})})}F=false}var q=n-t.left-t.right,R=r-t.top-t.bottom,U=d3.select(this);I.forEach(function(e,t){e.values.forEach(function(e){e.series=t})});var W=N&&C&&A?[]:d3.merge(I.map(function(e){return e.values.map(function(e,t){return{x:f(e,t),y:l(e,t),size:c(e,t)}})}));o.domain(N||d3.extent(W.map(function(e){return e.x}).concat(d)));if(w&&I[0])o.range(k||[(q*E+q)/(2*I[0].values.length),q-q*(1+E)/(2*I[0].values.length)]);else o.range(k||[0,q]);u.domain(C||d3.extent(W.map(function(e){return e.y}).concat(v))).range(L||[R,0]);a.domain(A||d3.extent(W.map(function(e){return e.size}).concat(m))).range(O||[16,256]);if(o.domain()[0]===o.domain()[1]||u.domain()[0]===u.domain()[1])M=true;if(o.domain()[0]===o.domain()[1])o.domain()[0]?o.domain([o.domain()[0]-o.domain()[0]*.01,o.domain()[1]+o.domain()[1]*.01]):o.domain([-1,1]);if(u.domain()[0]===u.domain()[1])u.domain()[0]?u.domain([u.domain()[0]-u.domain()[0]*.01,u.domain()[1]+u.domain()[1]*.01]):u.domain([-1,1]);if(isNaN(o.domain()[0])){o.domain([-1,1])}if(isNaN(u.domain()[0])){u.domain([-1,1])}P=P||o;H=H||u;B=B||a;var X=U.selectAll("g.nv-wrap.nv-scatter").data([I]);var V=X.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+s+(M?" nv-single-point":""));var $=V.append("defs");var J=V.append("g");var K=X.select("g");J.append("g").attr("class","nv-groups");J.append("g").attr("class","nv-point-paths");X.attr("transform","translate("+t.left+","+t.top+")");$.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect");X.select("#nv-edge-clip-"+s+" rect").attr("width",q).attr("height",R);K.attr("clip-path",S?"url(#nv-edge-clip-"+s+")":"");F=true;var G=X.select(".nv-groups").selectAll(".nv-group").data(function(e){return e},function(e){return e.key});G.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);G.exit().remove();G.attr("class",function(e,t){return"nv-group nv-series-"+t}).classed("hover",function(e){return e.hover});G.transition().style("fill",function(e,t){return i(e,t)}).style("stroke",function(e,t){return i(e,t)}).style("stroke-opacity",1).style("fill-opacity",.5);if(p){var Y=G.selectAll("circle.nv-point").data(function(e){return e.values},y);Y.enter().append("circle").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("cx",function(t,n){return e.utils.NaNtoZero(P(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(H(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)});Y.exit().remove();G.exit().selectAll("path.nv-point").transition().attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).remove();Y.each(function(e,t){d3.select(this).classed("nv-point",true).classed("nv-point-"+t,true).classed("hover",false)});Y.transition().attr("cx",function(t,n){return e.utils.NaNtoZero(o(f(t,n)))}).attr("cy",function(t,n){return e.utils.NaNtoZero(u(l(t,n)))}).attr("r",function(e,t){return Math.sqrt(a(c(e,t))/Math.PI)})}else{var Y=G.selectAll("path.nv-point").data(function(e){return e.values});Y.enter().append("path").style("fill",function(e,t){return e.color}).style("stroke",function(e,t){return e.color}).attr("transform",function(e,t){return"translate("+P(f(e,t))+","+H(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))}));Y.exit().remove();G.exit().selectAll("path.nv-point").transition().attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).remove();Y.each(function(e,t){d3.select(this).classed("nv-point",true).classed("nv-point-"+t,true).classed("hover",false)});Y.transition().attr("transform",function(e,t){return"translate("+o(f(e,t))+","+u(l(e,t))+")"}).attr("d",d3.svg.symbol().type(h).size(function(e,t){return a(c(e,t))}))}clearTimeout(j);j=setTimeout(Q,300);P=o.copy();H=u.copy();B=a.copy()});return I}var t={top:0,right:0,bottom:0,left:0},n=960,r=500,i=e.utils.defaultColor(),s=Math.floor(Math.random()*1e5),o=d3.scale.linear(),u=d3.scale.linear(),a=d3.scale.linear(),f=function(e){return e.x},l=function(e){return e.y},c=function(e){return e.size||1},h=function(e){return e.shape||"circle"},p=true,d=[],v=[],m=[],g=true,y=null,b=function(e){return!e.notActive},w=false,E=.1,S=false,x=true,T=function(){return 25},N=null,C=null,k=null,L=null,A=null,O=null,M=false,_=d3.dispatch("elementClick","elementMouseover","elementMouseout"),D=true;var P,H,B,j,F=false;I.clearHighlights=function(){d3.selectAll(".nv-chart-"+s+" .nv-point.hover").classed("hover",false)};I.highlightPoint=function(e,t,n){d3.select(".nv-chart-"+s+" .nv-series-"+e+" .nv-point-"+t).classed("hover",n)};_.on("elementMouseover.point",function(e){if(g)I.highlightPoint(e.seriesIndex,e.pointIndex,true)});_.on("elementMouseout.point",function(e){if(g)I.highlightPoint(e.seriesIndex,e.pointIndex,false)});I.dispatch=_;I.options=e.utils.optionsFunc.bind(I);I.x=function(e){if(!arguments.length)return f;f=d3.functor(e);return I};I.y=function(e){if(!arguments.length)return l;l=d3.functor(e);return I};I.size=function(e){if(!arguments.length)return c;c=d3.functor(e);return I};I.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return I};I.width=function(e){if(!arguments.length)return n;n=e;return I};I.height=function(e){if(!arguments.length)return r;r=e;return I};I.xScale=function(e){if(!arguments.length)return o;o=e;return I};I.yScale=function(e){if(!arguments.length)return u;u=e;return I};I.zScale=function(e){if(!arguments.length)return a;a=e;return I};I.xDomain=function(e){if(!arguments.length)return N;N=e;return I};I.yDomain=function(e){if(!arguments.length)return C;C=e;return I};I.sizeDomain=function(e){if(!arguments.length)return A;A=e;return I};I.xRange=function(e){if(!arguments.length)return k;k=e;return I};I.yRange=function(e){if(!arguments.length)return L;L=e;return I};I.sizeRange=function(e){if(!arguments.length)return O;O=e;return I};I.forceX=function(e){if(!arguments.length)return d;d=e;return I};I.forceY=function(e){if(!arguments.length)return v;v=e;return I};I.forceSize=function(e){if(!arguments.length)return m;m=e;return I};I.interactive=function(e){if(!arguments.length)return g;g=e;return I};I.pointKey=function(e){if(!arguments.length)return y;y=e;return I};I.pointActive=function(e){if(!arguments.length)return b;b=e;return I};I.padData=function(e){if(!arguments.length)return w;w=e;return I};I.padDataOuter=function(e){if(!arguments.length)return E;E=e;return I};I.clipEdge=function(e){if(!arguments.length)return S;S=e;return I};I.clipVoronoi=function(e){if(!arguments.length)return x;x=e;return I};I.useVoronoi=function(e){if(!arguments.length)return D;D=e;if(D===false){x=false}return I};I.clipRadius=function(e){if(!arguments.length)return T;T=e;return I};I.color=function(t){if(!arguments.length)return i;i=e.utils.getColor(t);return I};I.shape=function(e){if(!arguments.length)return h;h=e;return I};I.onlyCircles=function(e){if(!arguments.length)return p;p=e;return I};I.id=function(e){if(!arguments.length)return s;s=e;return I};I.singlePoint=function(e){if(!arguments.length)return M;M=e;return I};return I};e.models.scatterChart=function(){"use strict";function F(e){e.each(function(e){function K(){if(T){X.select(".nv-point-paths").style("pointer-events","all");return false}X.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(x).focus(i[0]);p.distortion(x).focus(i[1]);X.select(".nv-scatterWrap").call(t);if(b)X.select(".nv-x.nv-axis").call(n);if(w)X.select(".nv-y.nv-axis").call(r);X.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o);X.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var C=d3.select(this),k=this;var L=(f||parseInt(C.style("width"))||960)-a.left-a.right,I=(l||parseInt(C.style("height"))||400)-a.top-a.bottom;F.update=function(){C.transition().duration(D).call(F)};F.container=this;A.disabled=e.map(function(e){return!!e.disabled});if(!O){var q;O={};for(q in A){if(A[q]instanceof Array)O[q]=A[q].slice(0);else O[q]=A[q]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var R=C.selectAll(".nv-noData").data([_]);R.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");R.attr("x",a.left+L/2).attr("y",a.top+I/2).text(function(e){return e});return F}else{C.selectAll(".nv-noData").remove()}P=P||h;H=H||p;var U=C.selectAll("g.nv-wrap.nv-scatterChart").data([e]);var z=U.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id());var W=z.append("g");var X=U.select("g");W.append("rect").attr("class","nvd3 nv-background");W.append("g").attr("class","nv-x nv-axis");W.append("g").attr("class","nv-y nv-axis");W.append("g").attr("class","nv-scatterWrap");W.append("g").attr("class","nv-distWrap");W.append("g").attr("class","nv-legendWrap");W.append("g").attr("class","nv-controlsWrap");if(y){var V=S?L/2:L;i.width(V);U.select(".nv-legendWrap").datum(e).call(i);if(a.top!=i.height()){a.top=i.height();I=(l||parseInt(C.style("height"))||400)-a.top-a.bottom}U.select(".nv-legendWrap").attr("transform","translate("+(L-V)+","+ -a.top+")")}if(S){s.width(180).color(["#444"]);X.select(".nv-controlsWrap").datum(j).attr("transform","translate(0,"+ -a.top+")").call(s)}U.attr("transform","translate("+a.left+","+a.top+")");if(E){X.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)")}t.width(L).height(I).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));if(d!==0)t.xDomain(null);if(v!==0)t.yDomain(null);U.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);if(d!==0){var $=h.domain()[1]-h.domain()[0];t.xDomain([h.domain()[0]-d*$,h.domain()[1]+d*$])}if(v!==0){var J=p.domain()[1]-p.domain()[0];t.yDomain([p.domain()[0]-v*J,p.domain()[1]+v*J])}if(v!==0||d!==0){U.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t)}if(b){n.scale(h).ticks(n.ticks()&&n.ticks().length?n.ticks():L/100).tickSize(-I,0);X.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)}if(w){r.scale(p).ticks(r.ticks()&&r.ticks().length?r.ticks():I/36).tickSize(-L,0);X.select(".nv-y.nv-axis").call(r)}if(m){o.getData(t.x()).scale(h).width(L).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));W.select(".nv-distWrap").append("g").attr("class","nv-distributionX");X.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)}if(g){u.getData(t.y()).scale(p).width(I).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));W.select(".nv-distWrap").append("g").attr("class","nv-distributionY");X.select(".nv-distributionY").attr("transform","translate("+(E?L:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)}if(d3.fisheye){X.select(".nv-background").attr("width",L).attr("height",I);X.select(".nv-background").on("mousemove",K);X.select(".nv-background").on("click",function(){T=!T});t.dispatch.on("elementClick.freezeFisheye",function(){T=!T})}s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled;x=e.disabled?0:2.5;X.select(".nv-background").style("pointer-events",e.disabled?"none":"all");X.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none");if(e.disabled){h.distortion(x).focus(0);p.distortion(x).focus(0);X.select(".nv-scatterWrap").call(t);X.select(".nv-x.nv-axis").call(n);X.select(".nv-y.nv-axis").call(r)}else{T=false}F.update()});i.dispatch.on("stateChange",function(e){A.disabled=e.disabled;M.stateChange(A);F.update()});t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",function(t,n){return e.pos[1]-I});d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size());e.pos=[e.pos[0]+a.left,e.pos[1]+a.top];M.tooltipShow(e)});M.on("tooltipShow",function(e){if(N)B(e,k.parentNode)});M.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});A.disabled=t.disabled}F.update()});P=h.copy();H=p.copy()});return F}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution();var a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=0,v=0,m=false,g=false,y=true,b=true,w=true,E=false,S=!!d3.fisheye,x=0,T=false,N=true,C=function(e,t,n){return""+t+""},k=function(e,t,n){return""+n+""},L=null,A={},O=null,M=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),_="No Data Available.",D=250;t.xScale(h).yScale(p);n.orient("bottom").tickPadding(10);r.orient(E?"right":"left").tickPadding(10);o.axis("x");u.axis("y");s.updateState(false);var P,H;var B=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));if(C!=null)e.tooltip.show([f,l],C(i.series.key,v,m,i,F),"n",1,s,"x-nvtooltip");if(k!=null)e.tooltip.show([c,d],k(i.series.key,v,m,i,F),"e",1,s,"y-nvtooltip");if(L!=null)e.tooltip.show([o,u],L(i.series.key,v,m,i,F),i.value<0?"n":"s",null,s)};var j=[{key:"Magnify",disabled:true}];t.dispatch.on("elementMouseout.tooltip",function(e){M.tooltipHide(e);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())});M.on("tooltipHide",function(){if(N)e.tooltip.cleanup()});F.dispatch=M;F.scatter=t;F.legend=i;F.controls=s;F.xAxis=n;F.yAxis=r;F.distX=o;F.distY=u;d3.rebind(F,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi");F.options=e.utils.optionsFunc.bind(F);F.margin=function(e){if(!arguments.length)return a;a.top=typeof e.top!="undefined"?e.top:a.top;a.right=typeof e.right!="undefined"?e.right:a.right;a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom;a.left=typeof e.left!="undefined"?e.left:a.left;return F};F.width=function(e){if(!arguments.length)return f;f=e;return F};F.height=function(e){if(!arguments.length)return l;l=e;return F};F.color=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);i.color(c);o.color(c);u.color(c);return F};F.showDistX=function(e){if(!arguments.length)return m;m=e;return F};F.showDistY=function(e){if(!arguments.length)return g;g=e;return F};F.showControls=function(e){if(!arguments.length)return S;S=e;return F};F.showLegend=function(e){if(!arguments.length)return y;y=e;return F};F.showXAxis=function(e){if(!arguments.length)return b;b=e;return F};F.showYAxis=function(e){if(!arguments.length)return w;w=e;return F};F.rightAlignYAxis=function(e){if(!arguments.length)return E;E=e;r.orient(e?"right":"left");return F};F.fisheye=function(e){if(!arguments.length)return x;x=e;return F};F.xPadding=function(e){if(!arguments.length)return d;d=e;return F};F.yPadding=function(e){if(!arguments.length)return v;v=e;return F};F.tooltips=function(e){if(!arguments.length)return N;N=e;return F};F.tooltipContent=function(e){if(!arguments.length)return L;L=e;return F};F.tooltipXContent=function(e){if(!arguments.length)return C;C=e;return F};F.tooltipYContent=function(e){if(!arguments.length)return k;k=e;return F};F.state=function(e){if(!arguments.length)return A;A=e;return F};F.defaultState=function(e){if(!arguments.length)return O;O=e;return F};F.noData=function(e){if(!arguments.length)return _;_=e;return F};F.transitionDuration=function(e){if(!arguments.length)return D;D=e;return F};return F};e.models.scatterPlusLineChart=function(){"use strict";function B(e){e.each(function(e){function $(){if(S){z.select(".nv-point-paths").style("pointer-events","all");return false}z.select(".nv-point-paths").style("pointer-events","none");var i=d3.mouse(this);h.distortion(E).focus(i[0]);p.distortion(E).focus(i[1]);z.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);if(g)z.select(".nv-x.nv-axis").call(n);if(y)z.select(".nv-y.nv-axis").call(r);z.select(".nv-distributionX").datum(e.filter(function(e){return!e.disabled})).call(o);z.select(".nv-distributionY").datum(e.filter(function(e){return!e.disabled})).call(u)}var T=d3.select(this),N=this;var C=(f||parseInt(T.style("width"))||960)-a.left-a.right,j=(l||parseInt(T.style("height"))||400)-a.top-a.bottom;B.update=function(){T.transition().duration(M).call(B)};B.container=this;k.disabled=e.map(function(e){return!!e.disabled});if(!L){var F;L={};for(F in k){if(k[F]instanceof Array)L[F]=k[F].slice(0);else L[F]=k[F]}}if(!e||!e.length||!e.filter(function(e){return e.values.length}).length){var I=T.selectAll(".nv-noData").data([O]);I.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle");I.attr("x",a.left+C/2).attr("y",a.top+j/2).text(function(e){return e});return B}else{T.selectAll(".nv-noData").remove()}h=t.xScale();p=t.yScale();_=_||h;D=D||p;var q=T.selectAll("g.nv-wrap.nv-scatterChart").data([e]);var R=q.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id());var U=R.append("g");var z=q.select("g");U.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none");U.append("g").attr("class","nv-x nv-axis");U.append("g").attr("class","nv-y nv-axis");U.append("g").attr("class","nv-scatterWrap");U.append("g").attr("class","nv-regressionLinesWrap");U.append("g").attr("class","nv-distWrap");U.append("g").attr("class","nv-legendWrap");U.append("g").attr("class","nv-controlsWrap");q.attr("transform","translate("+a.left+","+a.top+")");if(b){z.select(".nv-y.nv-axis").attr("transform","translate("+C+",0)")}if(m){i.width(C/2);q.select(".nv-legendWrap").datum(e).call(i);if(a.top!=i.height()){a.top=i.height();j=(l||parseInt(T.style("height"))||400)-a.top-a.bottom}q.select(".nv-legendWrap").attr("transform","translate("+C/2+","+ -a.top+")")}if(w){s.width(180).color(["#444"]);z.select(".nv-controlsWrap").datum(H).attr("transform","translate(0,"+ -a.top+")").call(s)}t.width(C).height(j).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));q.select(".nv-scatterWrap").datum(e.filter(function(e){return!e.disabled})).call(t);q.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+t.id()+")");var W=q.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(e){return e});W.enter().append("g").attr("class","nv-regLines");var X=W.selectAll(".nv-regLine").data(function(e){return[e]});var V=X.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0);X.transition().attr("x1",h.range()[0]).attr("x2",h.range()[1]).attr("y1",function(e,t){return p(h.domain()[0]*e.slope+e.intercept)}).attr("y2",function(e,t){return p(h.domain()[1]*e.slope+e.intercept)}).style("stroke",function(e,t,n){return c(e,n)}).style("stroke-opacity",function(e,t){return e.disabled||typeof e.slope==="undefined"||typeof e.intercept==="undefined"?0:1});if(g){n.scale(h).ticks(n.ticks()?n.ticks():C/100).tickSize(-j,0);z.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(n)}if(y){r.scale(p).ticks(r.ticks()?r.ticks():j/36).tickSize(-C,0);z.select(".nv-y.nv-axis").call(r)}if(d){o.getData(t.x()).scale(h).width(C).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));U.select(".nv-distWrap").append("g").attr("class","nv-distributionX");z.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(e.filter(function(e){return!e.disabled})).call(o)}if(v){u.getData(t.y()).scale(p).width(j).color(e.map(function(e,t){return e.color||c(e,t)}).filter(function(t,n){return!e[n].disabled}));U.select(".nv-distWrap").append("g").attr("class","nv-distributionY");z.select(".nv-distributionY").attr("transform","translate("+(b?C:-u.size())+",0)").datum(e.filter(function(e){return!e.disabled})).call(u)}if(d3.fisheye){z.select(".nv-background").attr("width",C).attr("height",j);z.select(".nv-background").on("mousemove",$);z.select(".nv-background").on("click",function(){S=!S});t.dispatch.on("elementClick.freezeFisheye",function(){S=!S})}s.dispatch.on("legendClick",function(e,i){e.disabled=!e.disabled;E=e.disabled?0:2.5;z.select(".nv-background").style("pointer-events",e.disabled?"none":"all");z.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none");if(e.disabled){h.distortion(E).focus(0);p.distortion(E).focus(0);z.select(".nv-scatterWrap").call(t);z.select(".nv-x.nv-axis").call(n);z.select(".nv-y.nv-axis").call(r)}else{S=false}B.update()});i.dispatch.on("stateChange",function(e){k=e;A.stateChange(k);B.update()});t.dispatch.on("elementMouseover.tooltip",function(e){d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",e.pos[1]-j);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",e.pos[0]+o.size());e.pos=[e.pos[0]+a.left,e.pos[1]+a.top];A.tooltipShow(e)});A.on("tooltipShow",function(e){if(x)P(e,N.parentNode)});A.on("changeState",function(t){if(typeof t.disabled!=="undefined"){e.forEach(function(e,n){e.disabled=t.disabled[n]});k.disabled=t.disabled}B.update()});_=h.copy();D=p.copy()});return B}var t=e.models.scatter(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.models.distribution(),u=e.models.distribution();var a={top:30,right:20,bottom:50,left:75},f=null,l=null,c=e.utils.defaultColor(),h=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.xScale(),p=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):t.yScale(),d=false,v=false,m=true,g=true,y=true,b=false,w=!!d3.fisheye,E=0,S=false,x=true,T=function(e,t,n){return""+t+""},N=function(e,t,n){return""+n+""},C=function(e,t,n,r){return"

          "+e+"

          "+"

          "+r+"

          "},k={},L=null,A=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),O="No Data Available.",M=250;t.xScale(h).yScale(p);n.orient("bottom").tickPadding(10);r.orient(b?"right":"left").tickPadding(10);o.axis("x");u.axis("y");s.updateState(false);var _,D;var P=function(i,s){var o=i.pos[0]+(s.offsetLeft||0),u=i.pos[1]+(s.offsetTop||0),f=i.pos[0]+(s.offsetLeft||0),l=p.range()[0]+a.top+(s.offsetTop||0),c=h.range()[0]+a.left+(s.offsetLeft||0),d=i.pos[1]+(s.offsetTop||0),v=n.tickFormat()(t.x()(i.point,i.pointIndex)),m=r.tickFormat()(t.y()(i.point,i.pointIndex));if(T!=null)e.tooltip.show([f,l],T(i.series.key,v,m,i,B),"n",1,s,"x-nvtooltip");if(N!=null)e.tooltip.show([c,d],N(i.series.key,v,m,i,B),"e",1,s,"y-nvtooltip");if(C!=null)e.tooltip.show([o,u],C(i.series.key,v,m,i.point.tooltip,i,B),i.value<0?"n":"s",null,s)};var H=[{key:"Magnify",disabled:true}];t.dispatch.on("elementMouseout.tooltip",function(e){A.tooltipHide(e);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0);d3.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",u.size())});A.on("tooltipHide",function(){if(x)e.tooltip.cleanup()});B.dispatch=A;B.scatter=t;B.legend=i;B.controls=s;B.xAxis=n;B.yAxis=r;B.distX=o;B.distY=u;d3.rebind(B,t,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi");B.options=e.utils.optionsFunc.bind(B);B.margin=function(e){if(!arguments.length)return a;a.top=typeof e.top!="undefined"?e.top:a.top;a.right=typeof e.right!="undefined"?e.right:a.right;a.bottom=typeof e.bottom!="undefined"?e.bottom:a.bottom;a.left=typeof e.left!="undefined"?e.left:a.left;return B};B.width=function(e){if(!arguments.length)return f;f=e;return B};B.height=function(e){if(!arguments.length)return l;l=e;return B};B.color=function(t){if(!arguments.length)return c;c=e.utils.getColor(t);i.color(c);o.color(c);u.color(c);return B};B.showDistX=function(e){if(!arguments.length)return d;d=e;return B};B.showDistY=function(e){if(!arguments.length)return v;v=e;return B};B.showControls=function(e){if(!arguments.length)return w;w=e;return B};B.showLegend=function(e){if(!arguments.length)return m;m=e;return B};B.showXAxis=function(e){if(!arguments.length)return g;g=e;return B};B.showYAxis=function(e){if(!arguments.length)return y;y=e;return B};B.rightAlignYAxis=function(e){if(!arguments.length)return b;b=e;r.orient(e?"right":"left");return B};B.fisheye=function(e){if(!arguments.length)return E;E=e;return B};B.tooltips=function(e){if(!arguments.length)return x;x=e;return B};B.tooltipContent=function(e){if(!arguments.length)return C;C=e;return B};B.tooltipXContent=function(e){if(!arguments.length)return T;T=e;return B};B.tooltipYContent=function(e){if(!arguments.length)return N;N=e;return B};B.state=function(e){if(!arguments.length)return k;k=e;return B};B.defaultState=function(e){if(!arguments.length)return L;L=e;return B};B.noData=function(e){if(!arguments.length)return O;O=e;return B};B.transitionDuration=function(e){if(!arguments.length)return M;M=e;return B};return B};e.models.sparkline=function(){"use strict";function d(e){e.each(function(e){var i=n-t.left-t.right,d=r-t.top-t.bottom,v=d3.select(this);s.domain(l||d3.extent(e,u)).range(h||[0,i]);o.domain(c||d3.extent(e,a)).range(p||[d,0]);var m=v.selectAll("g.nv-wrap.nv-sparkline").data([e]);var g=m.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline");var b=g.append("g");var w=m.select("g");m.attr("transform","translate("+t.left+","+t.top+")");var E=m.selectAll("path").data(function(e){return[e]});E.enter().append("path");E.exit().remove();E.style("stroke",function(e,t){return e.color||f(e,t)}).attr("d",d3.svg.line().x(function(e,t){return s(u(e,t))}).y(function(e,t){return o(a(e,t))}));var S=m.selectAll("circle.nv-point").data(function(e){function n(t){if(t!=-1){var n=e[t];n.pointIndex=t;return n}else{return null}}var t=e.map(function(e,t){return a(e,t)});var r=n(t.lastIndexOf(o.domain()[1])),i=n(t.indexOf(o.domain()[0])),s=n(t.length-1);return[i,r,s].filter(function(e){return e!=null})});S.enter().append("circle");S.exit().remove();S.attr("cx",function(e,t){return s(u(e,e.pointIndex))}).attr("cy",function(e,t){return o(a(e,e.pointIndex))}).attr("r",2).attr("class",function(e,t){return u(e,e.pointIndex)==s.domain()[1]?"nv-point nv-currentValue":a(e,e.pointIndex)==o.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})});return d}var t={top:2,right:0,bottom:2,left:0},n=400,r=32,i=true,s=d3.scale.linear(),o=d3.scale.linear(),u=function(e){return e.x},a=function(e){return e.y},f=e.utils.getColor(["#000"]),l,c,h,p;d.options=e.utils.optionsFunc.bind(d);d.margin=function(e){if(!arguments.length)return t;t.top=typeof e.top!="undefined"?e.top:t.top;t.right=typeof e.right!="undefined"?e.right:t.right;t.bottom=typeof e.bottom!="undefined"?e.bottom:t.bottom;t.left=typeof e.left!="undefined"?e.left:t.left;return d};d.width=function(e){if(!arguments.length)return n;n=e;return d};d.height=function(e){if(!arguments.length)return r;r=e;return d};d.x=function(e){if(!arguments.length)return u;u=d3.functor(e);return d};d.y=function(e){if(!arguments.length)return a;a=d3.functor(e);return d};d.xScale=function(e){if(!arguments.length)return s;s=e;return d};d.yScale=function(e){if(!arguments.length)return o;o=e;return d};d.xDomain=function(e){if(!arguments.length)return l;l=e;return d};d.yDomain=function(e){if(!arguments.length)return c;c=e;return d};d.xRange=function(e){if(!arguments.length)return h;h=e;return d};d.yRange=function(e){if(!arguments.length)return p;p=e;return d};d.animate=function(e){if(!arguments.length)return i;i=e;return d};d.color=function(t){if(!arguments.length)return f;f=e.utils.getColor(t);return d};return d};e.models.sparklinePlus=function(){"use strict";function v(e){e.each(function(c){function O(){if(a)return;var e=C.selectAll(".nv-hoverValue").data(u);var r=e.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);e.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove();e.attr("transform",function(e){return"translate("+s(t.x()(c[e],e))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1);if(!u.length)return;r.append("line").attr("x1",0).attr("y1",-n.top).attr("x2",0).attr("y2",b);r.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-n.top).attr("text-anchor","end").attr("dy",".9em");C.select(".nv-hoverValue .nv-xValue").text(f(t.x()(c[u[0]],u[0])));r.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-n.top).attr("text-anchor","start").attr("dy",".9em");C.select(".nv-hoverValue .nv-yValue").text(l(t.y()(c[u[0]],u[0])))}function M(){function r(e,n){var r=Math.abs(t.x()(e[0],0)-n);var i=0;for(var s=0;s2){var h=D.yScale().invert(i.mouseY);var p=Infinity,d=null;c.forEach(function(e,t){if(h>=e.stackedValue.y0&&h<=e.stackedValue.y0+e.stackedValue.y){d=t;return}});if(d!=null)c[d].highlight=true}var v=n.tickFormat()(D.x()(s,a));var m=t.style()=="expand"?function(e,t){return d3.format(".1%")(e)}:function(e,t){return r.tickFormat()(e)};o.tooltip.position({left:f+u.left,top:i.mouseY+u.top}).chartContainer(P.parentNode).enabled(g).valueFormatter(m).data({value:v,series:c})();o.renderGuideLine(f)});o.dispatch.on("elementMouseout",function(e){k.tooltipHide();t.clearHighlights()});k.on("tooltipShow",function(e){if(g)_(e,P.parentNode)});k.on("changeState",function(e){if(typeof e.disabled!=="undefined"){b.forEach(function(t,n){t.disabled=e.disabled[n]});T.disabled=e.disabled}if(typeof e.style!=="undefined"){t.style(e.style)}D.update()})});return D}var t=e.models.stackedArea(),n=e.models.axis(),r=e.models.axis(),i=e.models.legend(),s=e.models.legend(),o=e.interactiveGuideline();var u={top:30,right:25,bottom:50,left:60},a=null,f=null,l=e.utils.defaultColor(),c=true,h=true,p=true,d=true,v=false,m=false,g=true,y="top",b=function(e,t,n,r,i){return"

          "+e+"

          "+"

          "+n+" on "+t+"

          "},w,E,S=d3.format(",.2f"),x=d3.format(",.3f"),T={style:t.style()},N=null,C="No Data Available.",k=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),L=250,A=["Stacked","Stream","Expanded"],O={},M=250;n.orient("bottom").tickPadding(7);r.orient(v?"right":"left");s.updateState(false);var _=function(r,i){var s=r.pos[0]+(i.offsetLeft||0),o=r.pos[1]+(i.offsetTop||0),u=n.tickFormat()(t.x()(r.point,r.pointIndex)),a=x(t.y()(r.point,r.pointIndex)),f=b(r.series.key,u,a,r,D);e.tooltip.show([s,o],f,r.value<0?"n":"s",null,i)};t.dispatch.on("tooltipShow",function(e){e.pos=[e.pos[0]+u.left,e.pos[1]+u.top],k.tooltipShow(e)});t.dispatch.on("tooltipHide",function(e){k.tooltipHide(e)});k.on("tooltipHide",function(){if(g)e.tooltip.cleanup()});D.dispatch=k;D.stacked=t;D.legend=i;D.controls=s;D.xAxis=n;D.yAxis=r;D.interactiveLayer=o;d3.rebind(D,t,"x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","sizeDomain","interactive","useVoronoi","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate");D.options=e.utils.optionsFunc.bind(D);D.margin=function(e){if(!arguments.length)return u;u.top=typeof e.top!="undefined"?e.top:u.top;u.right=typeof e.right!="undefined"?e.right:u.right;u.bottom=typeof e.bottom!="undefined"?e.bottom:u.bottom;u.left=typeof e.left!="undefined"?e.left:u.left;return D};D.width=function(e){if(!arguments.length)return a;a=e;return D};D.height=function(e){if(!arguments.length)return f;f=e;return D};D.color=function(n){if(!arguments.length)return l;l=e.utils.getColor(n);i.color(l);t.color(l);return D};D.showControls=function(e){if(!arguments.length)return c;c=e;return D};D.showLegend=function(e){if(!arguments.length)return h;h=e;return D};D.showXAxis=function(e){if(!arguments.length)return p;p=e;return D};D.showYAxis=function(e){if(!arguments.length)return d;d=e;return D};D.rightAlignYAxis=function(e){if(!arguments.length)return v;v=e;r.orient(e?"right":"left");return D};D.useInteractiveGuideline=function(e){if(!arguments.length)return m;m=e;if(e===true){D.interactive(false);D.useVoronoi(false)}return D};D.tooltip=function(e){if(!arguments.length)return b;b=e;return D};D.tooltips=function(e){if(!arguments.length)return g;g=e;return D};D.legendPos=function(e){if(!arguments.length)return y;y=e;return D};D.tooltipContent=function(e){if(!arguments.length)return b;b=e;return D};D.yAxisTooltipFormat=function(e){if(!arguments.length)return x;x=e;return D};D.state=function(e){if(!arguments.length)return T;T=e;return D};D.defaultState=function(e){if(!arguments.length)return N;N=e;return D};D.noData=function(e){if(!arguments.length)return C;C=e;return D};D.transitionDuration=function(e){if(!arguments.length)return M;M=e;return D};D.controlsData=function(e){if(!arguments.length)return A;A=e;return D};D.controlLabels=function(e){if(!arguments.length)return O;if(typeof e!=="object")return O;O=e;return D};r.setTickFormat=r.tickFormat;r.tickFormat=function(e){if(!arguments.length)return S;S=e;return r};return D}})() \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/outro.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/outro.js new file mode 100644 index 0000000..158693a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/outro.js @@ -0,0 +1 @@ +})(); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/sankey.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/sankey.js new file mode 100644 index 0000000..c3bc59f --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/sankey.js @@ -0,0 +1,292 @@ +d3.sankey = function() { + var sankey = {}, + nodeWidth = 24, + nodePadding = 8, + size = [1, 1], + nodes = [], + links = []; + + sankey.nodeWidth = function(_) { + if (!arguments.length) return nodeWidth; + nodeWidth = +_; + return sankey; + }; + + sankey.nodePadding = function(_) { + if (!arguments.length) return nodePadding; + nodePadding = +_; + return sankey; + }; + + sankey.nodes = function(_) { + if (!arguments.length) return nodes; + nodes = _; + return sankey; + }; + + sankey.links = function(_) { + if (!arguments.length) return links; + links = _; + return sankey; + }; + + sankey.size = function(_) { + if (!arguments.length) return size; + size = _; + return sankey; + }; + + sankey.layout = function(iterations) { + computeNodeLinks(); + computeNodeValues(); + computeNodeBreadths(); + computeNodeDepths(iterations); + computeLinkDepths(); + return sankey; + }; + + sankey.relayout = function() { + computeLinkDepths(); + return sankey; + }; + + sankey.link = function() { + var curvature = .5; + + function link(d) { + var x0 = d.source.x + d.source.dx, + x1 = d.target.x, + xi = d3.interpolateNumber(x0, x1), + x2 = xi(curvature), + x3 = xi(1 - curvature), + y0 = d.source.y + d.sy + d.dy / 2, + y1 = d.target.y + d.ty + d.dy / 2; + return "M" + x0 + "," + y0 + + "C" + x2 + "," + y0 + + " " + x3 + "," + y1 + + " " + x1 + "," + y1; + } + + link.curvature = function(_) { + if (!arguments.length) return curvature; + curvature = +_; + return link; + }; + + return link; + }; + + // Populate the sourceLinks and targetLinks for each node. + // Also, if the source and target are not objects, assume they are indices. + function computeNodeLinks() { + nodes.forEach(function(node) { + node.sourceLinks = []; + node.targetLinks = []; + }); + links.forEach(function(link) { + var source = link.source, + target = link.target; + if (typeof source === "number") source = link.source = nodes[link.source]; + if (typeof target === "number") target = link.target = nodes[link.target]; + source.sourceLinks.push(link); + target.targetLinks.push(link); + }); + } + + // Compute the value (size) of each node by summing the associated links. + function computeNodeValues() { + nodes.forEach(function(node) { + node.value = Math.max( + d3.sum(node.sourceLinks, value), + d3.sum(node.targetLinks, value) + ); + }); + } + + // Iteratively assign the breadth (x-position) for each node. + // Nodes are assigned the maximum breadth of incoming neighbors plus one; + // nodes with no incoming links are assigned breadth zero, while + // nodes with no outgoing links are assigned the maximum breadth. + function computeNodeBreadths() { + var remainingNodes = nodes, + nextNodes, + x = 0; + + while (remainingNodes.length) { + nextNodes = []; + remainingNodes.forEach(function(node) { + node.x = x; + node.dx = nodeWidth; + node.sourceLinks.forEach(function(link) { + nextNodes.push(link.target); + }); + }); + remainingNodes = nextNodes; + ++x; + } + + // + moveSinksRight(x); + scaleNodeBreadths((size[0] - nodeWidth) / (x - 1)); + } + + function moveSourcesRight() { + nodes.forEach(function(node) { + if (!node.targetLinks.length) { + node.x = d3.min(node.sourceLinks, function(d) { return d.target.x; }) - 1; + } + }); + } + + function moveSinksRight(x) { + nodes.forEach(function(node) { + if (!node.sourceLinks.length) { + node.x = x - 1; + } + }); + } + + function scaleNodeBreadths(kx) { + nodes.forEach(function(node) { + node.x *= kx; + }); + } + + function computeNodeDepths(iterations) { + var nodesByBreadth = d3.nest() + .key(function(d) { return d.x; }) + .sortKeys(d3.ascending) + .entries(nodes) + .map(function(d) { return d.values; }); + + // + initializeNodeDepth(); + resolveCollisions(); + for (var alpha = 1; iterations > 0; --iterations) { + relaxRightToLeft(alpha *= .99); + resolveCollisions(); + relaxLeftToRight(alpha); + resolveCollisions(); + } + + function initializeNodeDepth() { + var ky = d3.min(nodesByBreadth, function(nodes) { + return (size[1] - (nodes.length - 1) * nodePadding) / d3.sum(nodes, value); + }); + + nodesByBreadth.forEach(function(nodes) { + nodes.forEach(function(node, i) { + node.y = i; + node.dy = node.value * ky; + }); + }); + + links.forEach(function(link) { + link.dy = link.value * ky; + }); + } + + function relaxLeftToRight(alpha) { + nodesByBreadth.forEach(function(nodes, breadth) { + nodes.forEach(function(node) { + if (node.targetLinks.length) { + var y = d3.sum(node.targetLinks, weightedSource) / d3.sum(node.targetLinks, value); + node.y += (y - center(node)) * alpha; + } + }); + }); + + function weightedSource(link) { + return center(link.source) * link.value; + } + } + + function relaxRightToLeft(alpha) { + nodesByBreadth.slice().reverse().forEach(function(nodes) { + nodes.forEach(function(node) { + if (node.sourceLinks.length) { + var y = d3.sum(node.sourceLinks, weightedTarget) / d3.sum(node.sourceLinks, value); + node.y += (y - center(node)) * alpha; + } + }); + }); + + function weightedTarget(link) { + return center(link.target) * link.value; + } + } + + function resolveCollisions() { + nodesByBreadth.forEach(function(nodes) { + var node, + dy, + y0 = 0, + n = nodes.length, + i; + + // Push any overlapping nodes down. + nodes.sort(ascendingDepth); + for (i = 0; i < n; ++i) { + node = nodes[i]; + dy = y0 - node.y; + if (dy > 0) node.y += dy; + y0 = node.y + node.dy + nodePadding; + } + + // If the bottommost node goes outside the bounds, push it back up. + dy = y0 - nodePadding - size[1]; + if (dy > 0) { + y0 = node.y -= dy; + + // Push any overlapping nodes back up. + for (i = n - 2; i >= 0; --i) { + node = nodes[i]; + dy = node.y + node.dy + nodePadding - y0; + if (dy > 0) node.y -= dy; + y0 = node.y; + } + } + }); + } + + function ascendingDepth(a, b) { + return a.y - b.y; + } + } + + function computeLinkDepths() { + nodes.forEach(function(node) { + node.sourceLinks.sort(ascendingTargetDepth); + node.targetLinks.sort(ascendingSourceDepth); + }); + nodes.forEach(function(node) { + var sy = 0, ty = 0; + node.sourceLinks.forEach(function(link) { + link.sy = sy; + sy += link.dy; + }); + node.targetLinks.forEach(function(link) { + link.ty = ty; + ty += link.dy; + }); + }); + + function ascendingSourceDepth(a, b) { + return a.source.y - b.source.y; + } + + function ascendingTargetDepth(a, b) { + return a.target.y - b.target.y; + } + } + + function center(node) { + return node.y + node.dy / 2; + } + + function value(link) { + return link.value; + } + + return sankey; +}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/tooltip.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/tooltip.js new file mode 100644 index 0000000..46e5a81 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/tooltip.js @@ -0,0 +1,490 @@ +/* Tooltip rendering model for nvd3 charts. +window.nv.models.tooltip is the updated,new way to render tooltips. + +window.nv.tooltip.show is the old tooltip code. +window.nv.tooltip.* also has various helper methods. +*/ +(function() { + "use strict"; + window.nv.tooltip = {}; + + /* Model which can be instantiated to handle tooltip rendering. + Example usage: + var tip = nv.models.tooltip().gravity('w').distance(23) + .data(myDataObject); + + tip(); //just invoke the returned function to render tooltip. + */ + window.nv.models.tooltip = function() { + var content = null //HTML contents of the tooltip. If null, the content is generated via the data variable. + , data = null /* Tooltip data. If data is given in the proper format, a consistent tooltip is generated. + Format of data: + { + key: "Date", + value: "August 2009", + series: [ + { + key: "Series 1", + value: "Value 1", + color: "#000" + }, + { + key: "Series 2", + value: "Value 2", + color: "#00f" + } + ] + + } + + */ + , gravity = 'w' //Can be 'n','s','e','w'. Determines how tooltip is positioned. + , distance = 50 //Distance to offset tooltip from the mouse location. + , snapDistance = 25 //Tolerance allowed before tooltip is moved from its current position (creates 'snapping' effect) + , fixedTop = null //If not null, this fixes the top position of the tooltip. + , classes = null //Attaches additional CSS classes to the tooltip DIV that is created. + , chartContainer = null //Parent DIV, of the SVG Container that holds the chart. + , tooltipElem = null //actual DOM element representing the tooltip. + , position = {left: null, top: null} //Relative position of the tooltip inside chartContainer. + , enabled = true //True -> tooltips are rendered. False -> don't render tooltips. + //Generates a unique id when you create a new tooltip() object + , id = "nvtooltip-" + Math.floor(Math.random() * 100000) + ; + + //CSS class to specify whether element should not have mouse events. + var nvPointerEventsClass = "nv-pointer-events-none"; + + //Format function for the tooltip values column + var valueFormatter = function(d,i) { + return d; + }; + + //Format function for the tooltip header value. + var headerFormatter = function(d) { + return d; + }; + + //By default, the tooltip model renders a beautiful table inside a DIV. + //You can override this function if a custom tooltip is desired. + var contentGenerator = function(d) { + if (content != null) return content; + + if (d == null) return ''; + + var table = d3.select(document.createElement("table")); + var theadEnter = table.selectAll("thead") + .data([d]) + .enter().append("thead"); + theadEnter.append("tr") + .append("td") + .attr("colspan",3) + .append("strong") + .classed("x-value",true) + .html(headerFormatter(d.value)); + + var tbodyEnter = table.selectAll("tbody") + .data([d]) + .enter().append("tbody"); + var trowEnter = tbodyEnter.selectAll("tr") + .data(function(p) { return p.series}) + .enter() + .append("tr") + .classed("highlight", function(p) { return p.highlight}) + ; + + trowEnter.append("td") + .classed("legend-color-guide",true) + .append("div") + .style("background-color", function(p) { return p.color}); + trowEnter.append("td") + .classed("key",true) + .html(function(p) {return p.key}); + trowEnter.append("td") + .classed("value",true) + .html(function(p,i) { return valueFormatter(p.value,i) }); + + + trowEnter.selectAll("td").each(function(p) { + if (p.highlight) { + var opacityScale = d3.scale.linear().domain([0,1]).range(["#fff",p.color]); + var opacity = 0.6; + d3.select(this) + .style("border-bottom-color", opacityScale(opacity)) + .style("border-top-color", opacityScale(opacity)) + ; + } + }); + + var html = table.node().outerHTML; + if (d.footer !== undefined) + html += ""; + return html; + + }; + + var dataSeriesExists = function(d) { + if (d && d.series && d.series.length > 0) return true; + + return false; + }; + + //In situations where the chart is in a 'viewBox', re-position the tooltip based on how far chart is zoomed. + function convertViewBoxRatio() { + if (chartContainer) { + var svg = d3.select(chartContainer); + if (svg.node().tagName !== "svg") { + svg = svg.select("svg"); + } + var viewBox = (svg.node()) ? svg.attr('viewBox') : null; + if (viewBox) { + viewBox = viewBox.split(' '); + var ratio = parseInt(svg.style('width')) / viewBox[2]; + + position.left = position.left * ratio; + position.top = position.top * ratio; + } + } + } + + //Creates new tooltip container, or uses existing one on DOM. + function getTooltipContainer(newContent) { + var body; + if (chartContainer) + body = d3.select(chartContainer); + else + body = d3.select("body"); + + var container = body.select(".nvtooltip"); + if (container.node() === null) { + //Create new tooltip div if it doesn't exist on DOM. + container = body.append("div") + .attr("class", "nvtooltip " + (classes? classes: "xy-tooltip")) + .attr("id",id) + ; + } + + + container.node().innerHTML = newContent; + container.style("top",0).style("left",0).style("opacity",0); + container.selectAll("div, table, td, tr").classed(nvPointerEventsClass,true) + container.classed(nvPointerEventsClass,true); + return container.node(); + } + + + + //Draw the tooltip onto the DOM. + function nvtooltip() { + if (!enabled) return; + if (!dataSeriesExists(data)) return; + + convertViewBoxRatio(); + + var left = position.left; + var top = (fixedTop != null) ? fixedTop : position.top; + var container = getTooltipContainer(contentGenerator(data)); + tooltipElem = container; + if (chartContainer) { + var svgComp = chartContainer.getElementsByTagName("svg")[0]; + var boundRect = (svgComp) ? svgComp.getBoundingClientRect() : chartContainer.getBoundingClientRect(); + var svgOffset = {left:0,top:0}; + if (svgComp) { + var svgBound = svgComp.getBoundingClientRect(); + var chartBound = chartContainer.getBoundingClientRect(); + var svgBoundTop = svgBound.top; + + //Defensive code. Sometimes, svgBoundTop can be a really negative + // number, like -134254. That's a bug. + // If such a number is found, use zero instead. FireFox bug only + if (svgBoundTop < 0) { + var containerBound = chartContainer.getBoundingClientRect(); + svgBoundTop = (Math.abs(svgBoundTop) > containerBound.height) ? 0 : svgBoundTop; + } + svgOffset.top = Math.abs(svgBoundTop - chartBound.top); + svgOffset.left = Math.abs(svgBound.left - chartBound.left); + } + //If the parent container is an overflow
          with scrollbars, subtract the scroll offsets. + //You need to also add any offset between the element and its containing
          + //Finally, add any offset of the containing
          on the whole page. + left += chartContainer.offsetLeft + svgOffset.left - 2*chartContainer.scrollLeft; + top += chartContainer.offsetTop + svgOffset.top - 2*chartContainer.scrollTop; + } + + if (snapDistance && snapDistance > 0) { + top = Math.floor(top/snapDistance) * snapDistance; + } + + nv.tooltip.calcTooltipPosition([left,top], gravity, distance, container); + return nvtooltip; + }; + + nvtooltip.nvPointerEventsClass = nvPointerEventsClass; + + nvtooltip.content = function(_) { + if (!arguments.length) return content; + content = _; + return nvtooltip; + }; + + //Returns tooltipElem...not able to set it. + nvtooltip.tooltipElem = function() { + return tooltipElem; + }; + + nvtooltip.contentGenerator = function(_) { + if (!arguments.length) return contentGenerator; + if (typeof _ === 'function') { + contentGenerator = _; + } + return nvtooltip; + }; + + nvtooltip.data = function(_) { + if (!arguments.length) return data; + data = _; + return nvtooltip; + }; + + nvtooltip.gravity = function(_) { + if (!arguments.length) return gravity; + gravity = _; + return nvtooltip; + }; + + nvtooltip.distance = function(_) { + if (!arguments.length) return distance; + distance = _; + return nvtooltip; + }; + + nvtooltip.snapDistance = function(_) { + if (!arguments.length) return snapDistance; + snapDistance = _; + return nvtooltip; + }; + + nvtooltip.classes = function(_) { + if (!arguments.length) return classes; + classes = _; + return nvtooltip; + }; + + nvtooltip.chartContainer = function(_) { + if (!arguments.length) return chartContainer; + chartContainer = _; + return nvtooltip; + }; + + nvtooltip.position = function(_) { + if (!arguments.length) return position; + position.left = (typeof _.left !== 'undefined') ? _.left : position.left; + position.top = (typeof _.top !== 'undefined') ? _.top : position.top; + return nvtooltip; + }; + + nvtooltip.fixedTop = function(_) { + if (!arguments.length) return fixedTop; + fixedTop = _; + return nvtooltip; + }; + + nvtooltip.enabled = function(_) { + if (!arguments.length) return enabled; + enabled = _; + return nvtooltip; + }; + + nvtooltip.valueFormatter = function(_) { + if (!arguments.length) return valueFormatter; + if (typeof _ === 'function') { + valueFormatter = _; + } + return nvtooltip; + }; + + nvtooltip.headerFormatter = function(_) { + if (!arguments.length) return headerFormatter; + if (typeof _ === 'function') { + headerFormatter = _; + } + return nvtooltip; + }; + + //id() is a read-only function. You can't use it to set the id. + nvtooltip.id = function() { + return id; + }; + + + return nvtooltip; + }; + + + //Original tooltip.show function. Kept for backward compatibility. + // pos = [left,top] + nv.tooltip.show = function(pos, content, gravity, dist, parentContainer, classes) { + + //Create new tooltip div if it doesn't exist on DOM. + var container = document.createElement('div'); + container.className = 'nvtooltip ' + (classes ? classes : 'xy-tooltip'); + + var body = parentContainer; + if ( !parentContainer || parentContainer.tagName.match(/g|svg/i)) { + //If the parent element is an SVG element, place tooltip in the element. + body = document.getElementsByTagName('body')[0]; + } + + container.style.left = 0; + container.style.top = 0; + container.style.opacity = 0; + container.innerHTML = content; + body.appendChild(container); + + //If the parent container is an overflow
          with scrollbars, subtract the scroll offsets. + if (parentContainer) { + pos[0] = pos[0] - parentContainer.scrollLeft; + pos[1] = pos[1] - parentContainer.scrollTop; + } + nv.tooltip.calcTooltipPosition(pos, gravity, dist, container); + }; + + //Looks up the ancestry of a DOM element, and returns the first NON-svg node. + nv.tooltip.findFirstNonSVGParent = function(Elem) { + while(Elem.tagName.match(/^g|svg$/i) !== null) { + Elem = Elem.parentNode; + } + return Elem; + }; + + //Finds the total offsetTop of a given DOM element. + //Looks up the entire ancestry of an element, up to the first relatively positioned element. + nv.tooltip.findTotalOffsetTop = function ( Elem, initialTop ) { + var offsetTop = initialTop; + + do { + if( !isNaN( Elem.offsetTop ) ) { + offsetTop += (Elem.offsetTop); + } + } while( Elem = Elem.offsetParent ); + return offsetTop; + }; + + //Finds the total offsetLeft of a given DOM element. + //Looks up the entire ancestry of an element, up to the first relatively positioned element. + nv.tooltip.findTotalOffsetLeft = function ( Elem, initialLeft) { + var offsetLeft = initialLeft; + + do { + if( !isNaN( Elem.offsetLeft ) ) { + offsetLeft += (Elem.offsetLeft); + } + } while( Elem = Elem.offsetParent ); + return offsetLeft; + }; + + //Global utility function to render a tooltip on the DOM. + //pos = [left,top] coordinates of where to place the tooltip, relative to the SVG chart container. + //gravity = how to orient the tooltip + //dist = how far away from the mouse to place tooltip + //container = tooltip DIV + nv.tooltip.calcTooltipPosition = function(pos, gravity, dist, container) { + + var height = parseInt(container.offsetHeight), + width = parseInt(container.offsetWidth), + windowWidth = nv.utils.windowSize().width, + windowHeight = nv.utils.windowSize().height, + scrollTop = window.pageYOffset, + scrollLeft = window.pageXOffset, + left, top; + + windowHeight = window.innerWidth >= document.body.scrollWidth ? windowHeight : windowHeight - 16; + windowWidth = window.innerHeight >= document.body.scrollHeight ? windowWidth : windowWidth - 16; + + gravity = gravity || 's'; + dist = dist || 20; + + var tooltipTop = function ( Elem ) { + return nv.tooltip.findTotalOffsetTop(Elem, top); + }; + + var tooltipLeft = function ( Elem ) { + return nv.tooltip.findTotalOffsetLeft(Elem,left); + }; + + switch (gravity) { + case 'e': + left = pos[0] - width - dist; + top = pos[1] - (height / 2); + var tLeft = tooltipLeft(container); + var tTop = tooltipTop(container); + if (tLeft < scrollLeft) left = pos[0] + dist > scrollLeft ? pos[0] + dist : scrollLeft - tLeft + left; + if (tTop < scrollTop) top = scrollTop - tTop + top; + if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height; + break; + case 'w': + left = pos[0] + dist; + top = pos[1] - (height / 2); + var tLeft = tooltipLeft(container); + var tTop = tooltipTop(container); + if (tLeft + width > windowWidth) left = pos[0] - width - dist; + if (tTop < scrollTop) top = scrollTop + 5; + if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height; + break; + case 'n': + left = pos[0] - (width / 2) - 5; + top = pos[1] + dist; + var tLeft = tooltipLeft(container); + var tTop = tooltipTop(container); + if (tLeft < scrollLeft) left = scrollLeft + 5; + if (tLeft + width > windowWidth) left = left - width/2 + 5; + if (tTop + height > scrollTop + windowHeight) top = scrollTop + windowHeight - tTop + top - height; + break; + case 's': + left = pos[0] - (width / 2); + top = pos[1] - height - dist; + var tLeft = tooltipLeft(container); + var tTop = tooltipTop(container); + if (tLeft < scrollLeft) left = scrollLeft + 5; + if (tLeft + width > windowWidth) left = left - width/2 + 5; + if (scrollTop > tTop) top = scrollTop; + break; + case 'none': + left = pos[0]; + top = pos[1] - dist; + var tLeft = tooltipLeft(container); + var tTop = tooltipTop(container); + break; + } + + + container.style.left = left+'px'; + container.style.top = top+'px'; + container.style.opacity = 1; + container.style.position = 'absolute'; + + return container; + }; + + //Global utility function to remove tooltips from the DOM. + nv.tooltip.cleanup = function() { + + // Find the tooltips, mark them for removal by this class (so others cleanups won't find it) + var tooltips = document.getElementsByClassName('nvtooltip'); + var purging = []; + while(tooltips.length) { + purging.push(tooltips[0]); + tooltips[0].style.transitionDelay = '0 !important'; + tooltips[0].style.opacity = 0; + tooltips[0].className = 'nvtooltip-pending-removal'; + } + + setTimeout(function() { + + while (purging.length) { + var removeMe = purging.pop(); + removeMe.parentNode.removeChild(removeMe); + } + }, 500); + }; + +})(); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/utils.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/utils.js new file mode 100644 index 0000000..7b99e1d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/d3/js/utils.js @@ -0,0 +1,152 @@ + +nv.utils.windowSize = function() { + // Sane defaults + var size = {width: 640, height: 480}; + + // Earlier IE uses Doc.body + if (document.body && document.body.offsetWidth) { + size.width = document.body.offsetWidth; + size.height = document.body.offsetHeight; + } + + // IE can use depending on mode it is in + if (document.compatMode=='CSS1Compat' && + document.documentElement && + document.documentElement.offsetWidth ) { + size.width = document.documentElement.offsetWidth; + size.height = document.documentElement.offsetHeight; + } + + // Most recent browsers use + if (window.innerWidth && window.innerHeight) { + size.width = window.innerWidth; + size.height = window.innerHeight; + } + return (size); +}; + + + +// Easy way to bind multiple functions to window.onresize +// TODO: give a way to remove a function after its bound, other than removing all of them +nv.utils.windowResize = function(fun){ + if (fun === undefined) return; + var oldresize = window.onresize; + + window.onresize = function(e) { + if (typeof oldresize == 'function') oldresize(e); + fun(e); + } +} + +// Backwards compatible way to implement more d3-like coloring of graphs. +// If passed an array, wrap it in a function which implements the old default +// behavior +nv.utils.getColor = function(color) { + if (!arguments.length) return nv.utils.defaultColor(); //if you pass in nothing, get default colors back + + if( Object.prototype.toString.call( color ) === '[object Array]' ) + return function(d, i) { return d.color || color[i % color.length]; }; + else + return color; + //can't really help it if someone passes rubbish as color +} + +// Default color chooser uses the index of an object as before. +nv.utils.defaultColor = function() { + var colors = d3.scale.category20().range(); + return function(d, i) { return d.color || colors[i % colors.length] }; +} + + +// Returns a color function that takes the result of 'getKey' for each series and +// looks for a corresponding color from the dictionary, +nv.utils.customTheme = function(dictionary, getKey, defaultColors) { + getKey = getKey || function(series) { return series.key }; // use default series.key if getKey is undefined + defaultColors = defaultColors || d3.scale.category20().range(); //default color function + + var defIndex = defaultColors.length; //current default color (going in reverse) + + return function(series, index) { + var key = getKey(series); + + if (!defIndex) defIndex = defaultColors.length; //used all the default colors, start over + + if (typeof dictionary[key] !== "undefined") + return (typeof dictionary[key] === "function") ? dictionary[key]() : dictionary[key]; + else + return defaultColors[--defIndex]; // no match in dictionary, use default color + } +} + + + +// From the PJAX example on d3js.org, while this is not really directly needed +// it's a very cool method for doing pjax, I may expand upon it a little bit, +// open to suggestions on anything that may be useful +nv.utils.pjax = function(links, content) { + d3.selectAll(links).on("click", function() { + history.pushState(this.href, this.textContent, this.href); + load(this.href); + d3.event.preventDefault(); + }); + + function load(href) { + d3.html(href, function(fragment) { + var target = d3.select(content).node(); + target.parentNode.replaceChild(d3.select(fragment).select(content).node(), target); + nv.utils.pjax(links, content); + }); + } + + d3.select(window).on("popstate", function() { + if (d3.event.state) load(d3.event.state); + }); +} + +/* For situations where we want to approximate the width in pixels for an SVG:text element. +Most common instance is when the element is in a display:none; container. +Forumla is : text.length * font-size * constant_factor +*/ +nv.utils.calcApproxTextWidth = function (svgTextElem) { + if (svgTextElem instanceof d3.selection) { + var fontSize = parseInt(svgTextElem.style("font-size").replace("px","")); + var textLength = svgTextElem.text().length; + + return textLength * fontSize * 0.5; + } + return 0; +}; + +/* Numbers that are undefined, null or NaN, convert them to zeros. +*/ +nv.utils.NaNtoZero = function(n) { + if (typeof n !== 'number' + || isNaN(n) + || n === null + || n === Infinity) return 0; + + return n; +}; + +/* +Snippet of code you can insert into each nv.models.* to give you the ability to +do things like: +chart.options({ + showXAxis: true, + tooltips: true +}); + +To enable in the chart: +chart.options = nv.utils.optionsFunc.bind(chart); +*/ +nv.utils.optionsFunc = function(args) { + if (args) { + d3.map(args).forEach((function(key,value) { + if (typeof this[key] === "function") { + this[key](value); + } + }).bind(this)); + } + return this; +}; \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dashed-canvas.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dashed-canvas.js new file mode 100644 index 0000000..cec7729 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dashed-canvas.js @@ -0,0 +1,176 @@ +/** + * @license + * Copyright 2012 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview Adds support for dashed lines to the HTML5 canvas. + * + * Usage: + * var ctx = canvas.getContext("2d"); + * ctx.installPattern([10, 5]) // draw 10 pixels, skip 5 pixels, repeat. + * ctx.beginPath(); + * ctx.moveTo(100, 100); // start the first line segment. + * ctx.lineTo(150, 200); + * ctx.lineTo(200, 100); + * ctx.moveTo(300, 150); // start a second, unconnected line + * ctx.lineTo(400, 250); + * ... + * ctx.stroke(); // draw the dashed line. + * ctx.uninstallPattern(); + * + * This is designed to leave the canvas untouched when it's not used. + * If you never install a pattern, or call uninstallPattern(), then the canvas + * will be exactly as it would have if you'd never used this library. The only + * difference from the standard canvas will be the "installPattern" method of + * the drawing context. + */ + +/** + * Change the stroking style of the canvas drawing context from a solid line to + * a pattern (e.g. dashes, dash-dot-dash, etc.) + * + * Once you've installed the pattern, you can draw with it by using the + * beginPath(), moveTo(), lineTo() and stroke() method calls. Note that some + * more advanced methods (e.g. quadraticCurveTo() and bezierCurveTo()) are not + * supported. See file overview for a working example. + * + * Side effects of calling this method include adding an "isPatternInstalled" + * property and "uninstallPattern" method to this particular canvas context. + * You must call uninstallPattern() before calling installPattern() again. + * + * @param {Array.} pattern A description of the stroke pattern. Even + * indices indicate a draw and odd indices indicate a gap (in pixels). The + * array should have a even length as any odd lengthed array could be expressed + * as a smaller even length array. + */ +CanvasRenderingContext2D.prototype.installPattern = function(pattern) { + "use strict"; + + if (typeof(this.isPatternInstalled) !== 'undefined') { + throw "Must un-install old line pattern before installing a new one."; + } + this.isPatternInstalled = true; + + var dashedLineToHistory = [0, 0]; + + // list of connected line segements: + // [ [x1, y1], ..., [xn, yn] ], [ [x1, y1], ..., [xn, yn] ] + var segments = []; + + // Stash away copies of the unmodified line-drawing functions. + var realBeginPath = this.beginPath; + var realLineTo = this.lineTo; + var realMoveTo = this.moveTo; + var realStroke = this.stroke; + + /** @type {function()|undefined} */ + this.uninstallPattern = function() { + this.beginPath = realBeginPath; + this.lineTo = realLineTo; + this.moveTo = realMoveTo; + this.stroke = realStroke; + this.uninstallPattern = undefined; + this.isPatternInstalled = undefined; + }; + + // Keep our own copies of the line segments as they're drawn. + this.beginPath = function() { + segments = []; + realBeginPath.call(this); + }; + this.moveTo = function(x, y) { + segments.push([[x, y]]); + realMoveTo.call(this, x, y); + }; + this.lineTo = function(x, y) { + var last = segments[segments.length - 1]; + last.push([x, y]); + }; + + this.stroke = function() { + if (segments.length === 0) { + // Maybe the user is drawing something other than a line. + // TODO(danvk): test this case. + realStroke.call(this); + return; + } + + for (var i = 0; i < segments.length; i++) { + var seg = segments[i]; + var x1 = seg[0][0], y1 = seg[0][1]; + for (var j = 1; j < seg.length; j++) { + // Draw a dashed line from (x1, y1) - (x2, y2) + var x2 = seg[j][0], y2 = seg[j][1]; + this.save(); + + // Calculate transformation parameters + var dx = (x2-x1); + var dy = (y2-y1); + var len = Math.sqrt(dx*dx + dy*dy); + var rot = Math.atan2(dy, dx); + + // Set transformation + this.translate(x1, y1); + realMoveTo.call(this, 0, 0); + this.rotate(rot); + + // Set last pattern index we used for this pattern. + var patternIndex = dashedLineToHistory[0]; + var x = 0; + while (len > x) { + // Get the length of the pattern segment we are dealing with. + var segment = pattern[patternIndex]; + // If our last draw didn't complete the pattern segment all the way + // we will try to finish it. Otherwise we will try to do the whole + // segment. + if (dashedLineToHistory[1]) { + x += dashedLineToHistory[1]; + } else { + x += segment; + } + + if (x > len) { + // We were unable to complete this pattern index all the way, keep + // where we are the history so our next draw continues where we + // left off in the pattern. + dashedLineToHistory = [patternIndex, x-len]; + x = len; + } else { + // We completed this patternIndex, we put in the history that we + // are on the beginning of the next segment. + dashedLineToHistory = [(patternIndex+1)%pattern.length, 0]; + } + + // We do a line on a even pattern index and just move on a odd + // pattern index. The move is the empty space in the dash. + if (patternIndex % 2 === 0) { + realLineTo.call(this, x, 0); + } else { + realMoveTo.call(this, x, 0); + } + + // If we are not done, next loop process the next pattern segment, or + // the first segment again if we are at the end of the pattern. + patternIndex = (patternIndex+1) % pattern.length; + } + + this.restore(); + x1 = x2, y1 = y2; + } + } + realStroke.call(this); + segments = []; + }; +}; + +/** + * Removes the previously-installed pattern. + * You must call installPattern() before calling this. You can install at most + * one pattern at a time--there is no pattern stack. + */ +CanvasRenderingContext2D.prototype.uninstallPattern = function() { + // This will be replaced by a non-error version when a pattern is installed. + throw "Must install a line pattern before uninstalling it."; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/data.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/data.js new file mode 100644 index 0000000..d92a633 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/data.js @@ -0,0 +1,63 @@ +function StubbedData() { +return "" + +"Date,A,B\n" + +"20061001,3.01953818828,0.7212041046,2.18487394958,0.599318549691\n" + +"20061002,3.63321799308,0.778297234566,1.69491525424,0.531417655826\n" + +"20061003,2.44328097731,0.644967734352,2.51256281407,0.640539070386\n" + +"20061004,3.52733686067,0.774700921683,2.68456375839,0.66207105053\n" + +"20061005,3.28719723183,0.741636245748,2.35294117647,0.621407707226\n" + +"20061006,1.58450704225,0.523967868159,3.78657487091,0.791868460623\n" + +"20061007,5.32859680284,0.946589405904,4.0404040404,0.807910739509\n" + +"20061008,2.64084507042,0.672799548916,2.37288135593,0.626609885481\n" + +"20061009,2.26480836237,0.620990945917,3.5413153457,0.75897176848\n" + +"20061010,3.29289428076,0.74289969528,2.02702702703,0.579191340004\n" + +"20061011,2.7633851468,0.681234043829,1.1744966443,0.4413034044\n" + +"20061012,3.28719723183,0.741636245748,3.37268128162,0.741327769578\n" + +"20061013,1.77304964539,0.55569466381,1.85810810811,0.555011329732\n" + +"20061014,3.39892665474,0.7664008338,1.67224080268,0.524368852929\n" + +"20061015,2.65017667845,0.675144574777,3.35570469799,0.737661045752\n" + +"20061016,3.63951473137,0.779620631266,2.34899328859,0.620377617453\n" + +"20061017,2.25694444444,0.618859623032,1.68067226891,0.526990133716\n" + +"20061018,4.47504302926,0.857766274964,2.51677852349,0.641599927369\n" + +"20061019,2.44755244755,0.646081155692,1.68067226891,0.526990133716\n" + +"20061020,3.67775831874,0.787656442774,3.066439523,0.711598843969\n" + +"20061021,3.94265232975,0.823839169829,3.85906040268,0.788990618726\n" + +"20061022,2.59067357513,0.660187558973,3.71621621622,0.777438794254\n" + +"20061023,4.33275563258,0.847570482324,3.85906040268,0.788990618726\n" + +"20061024,3.10344827586,0.720049610821,2.84280936455,0.679611549697\n" + +"20061025,1.40350877193,0.492720767725,2.7027027027,0.666482380968\n" + +"20061026,1.95035460993,0.582291234145,2.36486486486,0.624518599275\n" + +"20061027,2.30905861456,0.632980642182,2.03045685279,0.580161203819\n" + +"20061028,4.09252669039,0.835706590809,2.87648054146,0.68754192469\n" + +"20061029,2.66903914591,0.679883997626,2.02360876897,0.578224712918\n" + +"20061030,4.74516695958,0.89127787497,4.36241610738,0.836670992529\n" + +"20061031,2.78260869565,0.685905251933,3.20945945946,0.724388507178\n" + +"20061101,1.5873015873,0.524884521441,1.51260504202,0.500373860545\n" + +"20061102,2.78745644599,0.687083077461,2.0202020202,0.57726130639\n" + +"20061103,5.11463844797,0.925157232782,2.68907563025,0.663168401088\n" + +"20061104,4.9001814882,0.919644816432,3.07692307692,0.713993047527\n" + +"20061105,5.13274336283,0.928343545136,3.55329949239,0.761492892041\n" + +"20061106,1.92644483363,0.575222935029,2.35294117647,0.621407707226\n" + +"20061107,2.46478873239,0.650573541306,1.52027027027,0.502889967904\n" + +"20061108,2.13523131673,0.609772022763,2.6981450253,0.665374048085\n" + +"20061109,3.88007054674,0.811026422222,2.72572402044,0.672079879106\n" + +"20061110,2.63620386643,0.671633132526,3.71621621622,0.777438794254\n" + +"20061111,3.69718309859,0.791736755355,3.0303030303,0.703344064467\n" + +"20061112,3.83944153578,0.802703592906,4.05405405405,0.81058250986\n" + +"20061113,2.47787610619,0.653984033555,2.20338983051,0.604340313133\n" + +"20061114,1.77304964539,0.55569466381,2.22222222222,0.60944692682\n" + +"20061115,2.30088495575,0.630766388737,0.843170320405,0.375484163785\n" + +"20061116,1.57894736842,0.522144132232,2.19594594595,0.602321544724\n" + +"20061118,2.45183887916,0.647198426991,1.69491525424,0.531417655826\n" + +"20061119,3.52733686067,0.774700921683,1.85185185185,0.55316023504\n" + +"20061120,2.97723292469,0.711254751484,2.6981450253,0.665374048085\n" + +"20061121,2.29681978799,0.629665059963,2.01680672269,0.576301104352\n" + +"20061122,3.01418439716,0.719945245328,2.5466893039,0.649125445325\n" + +"20061123,3.78378378378,0.809917534069,2.6936026936,0.664269394219\n" + +"20061124,3.18584070796,0.738851643987,2.01005025126,0.57439025002\n" + +"20061125,2.83185840708,0.697868332879,3.066439523,0.711598843969\n" + +"20061126,3.01953818828,0.7212041046,2.53378378378,0.645878720149\n" + +"20061127,2.81195079086,0.693033387099,1.51006711409,0.499540743312\n" + +"20061128,2.97723292469,0.711254751484,2.54237288136,0.648039583782\n" + +"20061129,1.41093474427,0.495309102312,3.02013422819,0.701020603129"; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-canvas.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-canvas.js new file mode 100644 index 0000000..cba4f44 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-canvas.js @@ -0,0 +1,816 @@ +/** + * @license + * Copyright 2006 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview Based on PlotKit.CanvasRenderer, but modified to meet the + * needs of dygraphs. + * + * In particular, support for: + * - grid overlays + * - error bars + * - dygraphs attribute system + */ + +/** + * The DygraphCanvasRenderer class does the actual rendering of the chart onto + * a canvas. It's based on PlotKit.CanvasRenderer. + * @param {Object} element The canvas to attach to + * @param {Object} elementContext The 2d context of the canvas (injected so it + * can be mocked for testing.) + * @param {Layout} layout The DygraphLayout object for this graph. + * @constructor + */ + +/*jshint globalstrict: true */ +/*global Dygraph:false,RGBColorParser:false */ +"use strict"; + + +/** + * @constructor + * + * This gets called when there are "new points" to chart. This is generally the + * case when the underlying data being charted has changed. It is _not_ called + * in the common case that the user has zoomed or is panning the view. + * + * The chart canvas has already been created by the Dygraph object. The + * renderer simply gets a drawing context. + * + * @param {Dygraph} dygraph The chart to which this renderer belongs. + * @param {HTMLCanvasElement} element The <canvas> DOM element on which to draw. + * @param {CanvasRenderingContext2D} elementContext The drawing context. + * @param {DygraphLayout} layout The chart's DygraphLayout object. + * + * TODO(danvk): remove the elementContext property. + */ +var DygraphCanvasRenderer = function(dygraph, element, elementContext, layout) { + this.dygraph_ = dygraph; + + this.layout = layout; + this.element = element; + this.elementContext = elementContext; + this.container = this.element.parentNode; + + this.height = this.element.height; + this.width = this.element.width; + + // --- check whether everything is ok before we return + // NOTE(konigsberg): isIE is never defined in this object. Bug of some sort. + if (!this.isIE && !(DygraphCanvasRenderer.isSupported(this.element))) + throw "Canvas is not supported."; + + // internal state + this.area = layout.getPlotArea(); + this.container.style.position = "relative"; + this.container.style.width = this.width + "px"; + + // Set up a clipping area for the canvas (and the interaction canvas). + // This ensures that we don't overdraw. + if (this.dygraph_.isUsingExcanvas_) { + this._createIEClipArea(); + } else { + // on Android 3 and 4, setting a clipping area on a canvas prevents it from + // displaying anything. + if (!Dygraph.isAndroid()) { + var ctx = this.dygraph_.canvas_ctx_; + ctx.beginPath(); + ctx.rect(this.area.x, this.area.y, this.area.w, this.area.h); + ctx.clip(); + + ctx = this.dygraph_.hidden_ctx_; + ctx.beginPath(); + ctx.rect(this.area.x, this.area.y, this.area.w, this.area.h); + ctx.clip(); + } + } +}; + +/** + * This just forwards to dygraph.attr_. + * TODO(danvk): remove this? + * @private + */ +DygraphCanvasRenderer.prototype.attr_ = function(name, opt_seriesName) { + return this.dygraph_.attr_(name, opt_seriesName); +}; + +/** + * Clears out all chart content and DOM elements. + * This is called immediately before render() on every frame, including + * during zooms and pans. + * @private + */ +DygraphCanvasRenderer.prototype.clear = function() { + var context; + if (this.isIE) { + // VML takes a while to start up, so we just poll every this.IEDelay + try { + if (this.clearDelay) { + this.clearDelay.cancel(); + this.clearDelay = null; + } + context = this.elementContext; + } + catch (e) { + // TODO(danvk): this is broken, since MochiKit.Async is gone. + // this.clearDelay = MochiKit.Async.wait(this.IEDelay); + // this.clearDelay.addCallback(bind(this.clear, this)); + return; + } + } + + context = this.elementContext; + context.clearRect(0, 0, this.width, this.height); +}; + +/** + * Checks whether the browser supports the <canvas> tag. + * @private + */ +DygraphCanvasRenderer.isSupported = function(canvasName) { + var canvas = null; + try { + if (typeof(canvasName) == 'undefined' || canvasName === null) { + canvas = document.createElement("canvas"); + } else { + canvas = canvasName; + } + canvas.getContext("2d"); + } + catch (e) { + var ie = navigator.appVersion.match(/MSIE (\d\.\d)/); + var opera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1); + if ((!ie) || (ie[1] < 6) || (opera)) + return false; + return true; + } + return true; +}; + +/** + * This method is responsible for drawing everything on the chart, including + * lines, error bars, fills and axes. + * It is called immediately after clear() on every frame, including during pans + * and zooms. + * @private + */ +DygraphCanvasRenderer.prototype.render = function() { + // attaches point.canvas{x,y} + this._updatePoints(); + + // actually draws the chart. + this._renderLineChart(); +}; + +DygraphCanvasRenderer.prototype._createIEClipArea = function() { + var className = 'dygraph-clip-div'; + var graphDiv = this.dygraph_.graphDiv; + + // Remove old clip divs. + for (var i = graphDiv.childNodes.length-1; i >= 0; i--) { + if (graphDiv.childNodes[i].className == className) { + graphDiv.removeChild(graphDiv.childNodes[i]); + } + } + + // Determine background color to give clip divs. + var backgroundColor = document.bgColor; + var element = this.dygraph_.graphDiv; + while (element != document) { + var bgcolor = element.currentStyle.backgroundColor; + if (bgcolor && bgcolor != 'transparent') { + backgroundColor = bgcolor; + break; + } + element = element.parentNode; + } + + function createClipDiv(area) { + if (area.w === 0 || area.h === 0) { + return; + } + var elem = document.createElement('div'); + elem.className = className; + elem.style.backgroundColor = backgroundColor; + elem.style.position = 'absolute'; + elem.style.left = area.x + 'px'; + elem.style.top = area.y + 'px'; + elem.style.width = area.w + 'px'; + elem.style.height = area.h + 'px'; + graphDiv.appendChild(elem); + } + + var plotArea = this.area; + // Left side + createClipDiv({ + x:0, y:0, + w:plotArea.x, + h:this.height + }); + + // Top + createClipDiv({ + x: plotArea.x, y: 0, + w: this.width - plotArea.x, + h: plotArea.y + }); + + // Right side + createClipDiv({ + x: plotArea.x + plotArea.w, y: 0, + w: this.width-plotArea.x - plotArea.w, + h: this.height + }); + + // Bottom + createClipDiv({ + x: plotArea.x, + y: plotArea.y + plotArea.h, + w: this.width - plotArea.x, + h: this.height - plotArea.h - plotArea.y + }); +}; + + +/** + * Returns a predicate to be used with an iterator, which will + * iterate over points appropriately, depending on whether + * connectSeparatedPoints is true. When it's false, the predicate will + * skip over points with missing yVals. + */ +DygraphCanvasRenderer._getIteratorPredicate = function(connectSeparatedPoints) { + return connectSeparatedPoints ? + DygraphCanvasRenderer._predicateThatSkipsEmptyPoints : + null; +}; + +DygraphCanvasRenderer._predicateThatSkipsEmptyPoints = + function(array, idx) { + return array[idx].yval !== null; +}; + +/** + * Draws a line with the styles passed in and calls all the drawPointCallbacks. + * @param {Object} e The dictionary passed to the plotter function. + * @private + */ +DygraphCanvasRenderer._drawStyledLine = function(e, + color, strokeWidth, strokePattern, drawPoints, + drawPointCallback, pointSize) { + var g = e.dygraph; + // TODO(konigsberg): Compute attributes outside this method call. + var stepPlot = g.getOption("stepPlot", e.setName); + + if (!Dygraph.isArrayLike(strokePattern)) { + strokePattern = null; + } + + var drawGapPoints = g.getOption('drawGapEdgePoints', e.setName); + + var points = e.points; + var iter = Dygraph.createIterator(points, 0, points.length, + DygraphCanvasRenderer._getIteratorPredicate( + g.getOption("connectSeparatedPoints"))); // TODO(danvk): per-series? + + var stroking = strokePattern && (strokePattern.length >= 2); + + var ctx = e.drawingContext; + ctx.save(); + if (stroking) { + ctx.installPattern(strokePattern); + } + + var pointsOnLine = DygraphCanvasRenderer._drawSeries( + e, iter, strokeWidth, pointSize, drawPoints, drawGapPoints, stepPlot, color); + DygraphCanvasRenderer._drawPointsOnLine( + e, pointsOnLine, drawPointCallback, color, pointSize); + + if (stroking) { + ctx.uninstallPattern(); + } + + ctx.restore(); +}; + +/** + * This does the actual drawing of lines on the canvas, for just one series. + * Returns a list of [canvasx, canvasy] pairs for points for which a + * drawPointCallback should be fired. These include isolated points, or all + * points if drawPoints=true. + * @param {Object} e The dictionary passed to the plotter function. + * @private + */ +DygraphCanvasRenderer._drawSeries = function(e, + iter, strokeWidth, pointSize, drawPoints, drawGapPoints, stepPlot, color) { + + var prevCanvasX = null; + var prevCanvasY = null; + var nextCanvasY = null; + var isIsolated; // true if this point is isolated (no line segments) + var point; // the point being processed in the while loop + var pointsOnLine = []; // Array of [canvasx, canvasy] pairs. + var first = true; // the first cycle through the while loop + + var ctx = e.drawingContext; + ctx.beginPath(); + ctx.strokeStyle = color; + ctx.lineWidth = strokeWidth; + + // NOTE: we break the iterator's encapsulation here for about a 25% speedup. + var arr = iter.array_; + var limit = iter.end_; + var predicate = iter.predicate_; + + for (var i = iter.start_; i < limit; i++) { + point = arr[i]; + if (predicate) { + while (i < limit && !predicate(arr, i)) { + i++; + } + if (i == limit) break; + point = arr[i]; + } + + if (point.canvasy === null || point.canvasy != point.canvasy) { + if (stepPlot && prevCanvasX !== null) { + // Draw a horizontal line to the start of the missing data + ctx.moveTo(prevCanvasX, prevCanvasY); + ctx.lineTo(point.canvasx, prevCanvasY); + } + prevCanvasX = prevCanvasY = null; + } else { + isIsolated = false; + if (drawGapPoints || !prevCanvasX) { + iter.nextIdx_ = i; + iter.next(); + nextCanvasY = iter.hasNext ? iter.peek.canvasy : null; + + var isNextCanvasYNullOrNaN = nextCanvasY === null || + nextCanvasY != nextCanvasY; + isIsolated = (!prevCanvasX && isNextCanvasYNullOrNaN); + if (drawGapPoints) { + // Also consider a point to be "isolated" if it's adjacent to a + // null point, excluding the graph edges. + if ((!first && !prevCanvasX) || + (iter.hasNext && isNextCanvasYNullOrNaN)) { + isIsolated = true; + } + } + } + + if (prevCanvasX !== null) { + if (strokeWidth) { + if (stepPlot) { + ctx.moveTo(prevCanvasX, prevCanvasY); + ctx.lineTo(point.canvasx, prevCanvasY); + } + + ctx.lineTo(point.canvasx, point.canvasy); + } + } else { + ctx.moveTo(point.canvasx, point.canvasy); + } + if (drawPoints || isIsolated) { + pointsOnLine.push([point.canvasx, point.canvasy, point.idx]); + } + prevCanvasX = point.canvasx; + prevCanvasY = point.canvasy; + } + first = false; + } + ctx.stroke(); + return pointsOnLine; +}; + +/** + * This fires the drawPointCallback functions, which draw dots on the points by + * default. This gets used when the "drawPoints" option is set, or when there + * are isolated points. + * @param {Object} e The dictionary passed to the plotter function. + * @private + */ +DygraphCanvasRenderer._drawPointsOnLine = function( + e, pointsOnLine, drawPointCallback, color, pointSize) { + var ctx = e.drawingContext; + for (var idx = 0; idx < pointsOnLine.length; idx++) { + var cb = pointsOnLine[idx]; + ctx.save(); + drawPointCallback( + e.dygraph, e.setName, ctx, cb[0], cb[1], color, pointSize, cb[2]); + ctx.restore(); + } +}; + +/** + * Attaches canvas coordinates to the points array. + * @private + */ +DygraphCanvasRenderer.prototype._updatePoints = function() { + // Update Points + // TODO(danvk): here + // + // TODO(bhs): this loop is a hot-spot for high-point-count charts. These + // transformations can be pushed into the canvas via linear transformation + // matrices. + // NOTE(danvk): this is trickier than it sounds at first. The transformation + // needs to be done before the .moveTo() and .lineTo() calls, but must be + // undone before the .stroke() call to ensure that the stroke width is + // unaffected. An alternative is to reduce the stroke width in the + // transformed coordinate space, but you can't specify different values for + // each dimension (as you can with .scale()). The speedup here is ~12%. + var sets = this.layout.points; + for (var i = sets.length; i--;) { + var points = sets[i]; + for (var j = points.length; j--;) { + var point = points[j]; + point.canvasx = this.area.w * point.x + this.area.x; + point.canvasy = this.area.h * point.y + this.area.y; + } + } +}; + +/** + * Add canvas Actually draw the lines chart, including error bars. + * + * This function can only be called if DygraphLayout's points array has been + * updated with canvas{x,y} attributes, i.e. by + * DygraphCanvasRenderer._updatePoints. + * + * @param {string=} opt_seriesName when specified, only that series will + * be drawn. (This is used for expedited redrawing with highlightSeriesOpts) + * @param {CanvasRenderingContext2D} opt_ctx when specified, the drawing + * context. However, lines are typically drawn on the object's + * elementContext. + * @private + */ +DygraphCanvasRenderer.prototype._renderLineChart = function(opt_seriesName, opt_ctx) { + var ctx = opt_ctx || this.elementContext; + var i; + + var sets = this.layout.points; + var setNames = this.layout.setNames; + var setName; + + this.colors = this.dygraph_.colorsMap_; + + // Determine which series have specialized plotters. + var plotter_attr = this.attr_("plotter"); + var plotters = plotter_attr; + if (!Dygraph.isArrayLike(plotters)) { + plotters = [plotters]; + } + + var setPlotters = {}; // series name -> plotter fn. + for (i = 0; i < setNames.length; i++) { + setName = setNames[i]; + var setPlotter = this.attr_("plotter", setName); + if (setPlotter == plotter_attr) continue; // not specialized. + + setPlotters[setName] = setPlotter; + } + + for (i = 0; i < plotters.length; i++) { + var plotter = plotters[i]; + var is_last = (i == plotters.length - 1); + + for (var j = 0; j < sets.length; j++) { + setName = setNames[j]; + if (opt_seriesName && setName != opt_seriesName) continue; + + var points = sets[j]; + + // Only throw in the specialized plotters on the last iteration. + var p = plotter; + if (setName in setPlotters) { + if (is_last) { + p = setPlotters[setName]; + } else { + // Don't use the standard plotters in this case. + continue; + } + } + + var color = this.colors[setName]; + var strokeWidth = this.dygraph_.getOption("strokeWidth", setName); + + ctx.save(); + ctx.strokeStyle = color; + ctx.lineWidth = strokeWidth; + p({ + points: points, + setName: setName, + drawingContext: ctx, + color: color, + strokeWidth: strokeWidth, + dygraph: this.dygraph_, + axis: this.dygraph_.axisPropertiesForSeries(setName), + plotArea: this.area, + seriesIndex: j, + seriesCount: sets.length, + singleSeriesName: opt_seriesName, + allSeriesPoints: sets + }); + ctx.restore(); + } + } +}; + +/** + * Standard plotters. These may be used by clients via Dygraph.Plotters. + * See comments there for more details. + */ +DygraphCanvasRenderer._Plotters = { + linePlotter: function(e) { + DygraphCanvasRenderer._linePlotter(e); + }, + + fillPlotter: function(e) { + DygraphCanvasRenderer._fillPlotter(e); + }, + + errorPlotter: function(e) { + DygraphCanvasRenderer._errorPlotter(e); + } +}; + +/** + * Plotter which draws the central lines for a series. + * @private + */ +DygraphCanvasRenderer._linePlotter = function(e) { + var g = e.dygraph; + var setName = e.setName; + var strokeWidth = e.strokeWidth; + + // TODO(danvk): Check if there's any performance impact of just calling + // getOption() inside of _drawStyledLine. Passing in so many parameters makes + // this code a bit nasty. + var borderWidth = g.getOption("strokeBorderWidth", setName); + var drawPointCallback = g.getOption("drawPointCallback", setName) || + Dygraph.Circles.DEFAULT; + var strokePattern = g.getOption("strokePattern", setName); + var drawPoints = g.getOption("drawPoints", setName); + var pointSize = g.getOption("pointSize", setName); + + if (borderWidth && strokeWidth) { + DygraphCanvasRenderer._drawStyledLine(e, + g.getOption("strokeBorderColor", setName), + strokeWidth + 2 * borderWidth, + strokePattern, + drawPoints, + drawPointCallback, + pointSize + ); + } + + DygraphCanvasRenderer._drawStyledLine(e, + e.color, + strokeWidth, + strokePattern, + drawPoints, + drawPointCallback, + pointSize + ); +}; + +/** + * Draws the shaded error bars/confidence intervals for each series. + * This happens before the center lines are drawn, since the center lines + * need to be drawn on top of the error bars for all series. + * @private + */ +DygraphCanvasRenderer._errorPlotter = function(e) { + var g = e.dygraph; + var setName = e.setName; + var errorBars = g.getOption("errorBars") || g.getOption("customBars"); + if (!errorBars) return; + + var fillGraph = g.getOption("fillGraph", setName); + if (fillGraph) { + g.warn("Can't use fillGraph option with error bars"); + } + + var ctx = e.drawingContext; + var color = e.color; + var fillAlpha = g.getOption('fillAlpha', setName); + var stepPlot = g.getOption("stepPlot", setName); + var points = e.points; + + var iter = Dygraph.createIterator(points, 0, points.length, + DygraphCanvasRenderer._getIteratorPredicate( + g.getOption("connectSeparatedPoints"))); + + var newYs; + + // setup graphics context + var prevX = NaN; + var prevY = NaN; + var prevYs = [-1, -1]; + // should be same color as the lines but only 15% opaque. + var rgb = new RGBColorParser(color); + var err_color = + 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + fillAlpha + ')'; + ctx.fillStyle = err_color; + ctx.beginPath(); + + var isNullUndefinedOrNaN = function(x) { + return (x === null || + x === undefined || + isNaN(x)); + }; + + while (iter.hasNext) { + var point = iter.next(); + if ((!stepPlot && isNullUndefinedOrNaN(point.y)) || + (stepPlot && !isNaN(prevY) && isNullUndefinedOrNaN(prevY))) { + prevX = NaN; + continue; + } + + if (stepPlot) { + newYs = [ point.y_bottom, point.y_top ]; + prevY = point.y; + } else { + newYs = [ point.y_bottom, point.y_top ]; + } + newYs[0] = e.plotArea.h * newYs[0] + e.plotArea.y; + newYs[1] = e.plotArea.h * newYs[1] + e.plotArea.y; + if (!isNaN(prevX)) { + if (stepPlot) { + ctx.moveTo(prevX, prevYs[0]); + ctx.lineTo(point.canvasx, prevYs[0]); + ctx.lineTo(point.canvasx, prevYs[1]); + } else { + ctx.moveTo(prevX, prevYs[0]); + ctx.lineTo(point.canvasx, newYs[0]); + ctx.lineTo(point.canvasx, newYs[1]); + } + ctx.lineTo(prevX, prevYs[1]); + ctx.closePath(); + } + prevYs = newYs; + prevX = point.canvasx; + } + ctx.fill(); +}; + +/** + * Draws the shaded regions when "fillGraph" is set. Not to be confused with + * error bars. + * + * For stacked charts, it's more convenient to handle all the series + * simultaneously. So this plotter plots all the points on the first series + * it's asked to draw, then ignores all the other series. + * + * @private + */ +DygraphCanvasRenderer._fillPlotter = function(e) { + // Skip if we're drawing a single series for interactive highlight overlay. + if (e.singleSeriesName) return; + + // We'll handle all the series at once, not one-by-one. + if (e.seriesIndex !== 0) return; + + var g = e.dygraph; + var setNames = g.getLabels().slice(1); // remove x-axis + + // getLabels() includes names for invisible series, which are not included in + // allSeriesPoints. We remove those to make the two match. + // TODO(danvk): provide a simpler way to get this information. + for (var i = setNames.length; i >= 0; i--) { + if (!g.visibility()[i]) setNames.splice(i, 1); + } + + var anySeriesFilled = (function() { + for (var i = 0; i < setNames.length; i++) { + if (g.getOption("fillGraph", setNames[i])) return true; + } + return false; + })(); + + if (!anySeriesFilled) return; + + var ctx = e.drawingContext; + var area = e.plotArea; + var sets = e.allSeriesPoints; + var setCount = sets.length; + + var fillAlpha = g.getOption('fillAlpha'); + var stackedGraph = g.getOption("stackedGraph"); + var colors = g.getColors(); + + // For stacked graphs, track the baseline for filling. + // + // The filled areas below graph lines are trapezoids with two + // vertical edges. The top edge is the line segment being drawn, and + // the baseline is the bottom edge. Each baseline corresponds to the + // top line segment from the previous stacked line. In the case of + // step plots, the trapezoids are rectangles. + var baseline = {}; + var currBaseline; + var prevStepPlot; // for different line drawing modes (line/step) per series + + // process sets in reverse order (needed for stacked graphs) + for (var setIdx = setCount - 1; setIdx >= 0; setIdx--) { + var setName = setNames[setIdx]; + if (!g.getOption('fillGraph', setName)) continue; + + var stepPlot = g.getOption('stepPlot', setName); + var color = colors[setIdx]; + var axis = g.axisPropertiesForSeries(setName); + var axisY = 1.0 + axis.minyval * axis.yscale; + if (axisY < 0.0) axisY = 0.0; + else if (axisY > 1.0) axisY = 1.0; + axisY = area.h * axisY + area.y; + + var points = sets[setIdx]; + var iter = Dygraph.createIterator(points, 0, points.length, + DygraphCanvasRenderer._getIteratorPredicate( + g.getOption("connectSeparatedPoints"))); + + // setup graphics context + var prevX = NaN; + var prevYs = [-1, -1]; + var newYs; + // should be same color as the lines but only 15% opaque. + var rgb = new RGBColorParser(color); + var err_color = + 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + fillAlpha + ')'; + ctx.fillStyle = err_color; + ctx.beginPath(); + var last_x, is_first = true; + while (iter.hasNext) { + var point = iter.next(); + if (!Dygraph.isOK(point.y)) { + prevX = NaN; + if (point.y_stacked !== null && !isNaN(point.y_stacked)) { + baseline[point.canvasx] = area.h * point.y_stacked + area.y; + } + continue; + } + if (stackedGraph) { + if (!is_first && last_x == point.xval) { + continue; + } else { + is_first = false; + last_x = point.xval; + } + + currBaseline = baseline[point.canvasx]; + var lastY; + if (currBaseline === undefined) { + lastY = axisY; + } else { + if(prevStepPlot) { + lastY = currBaseline[0]; + } else { + lastY = currBaseline; + } + } + newYs = [ point.canvasy, lastY ]; + + if(stepPlot) { + // Step plots must keep track of the top and bottom of + // the baseline at each point. + if(prevYs[0] === -1) { + baseline[point.canvasx] = [ point.canvasy, axisY ]; + } else { + baseline[point.canvasx] = [ point.canvasy, prevYs[0] ]; + } + } else { + baseline[point.canvasx] = point.canvasy; + } + + } else { + newYs = [ point.canvasy, axisY ]; + } + if (!isNaN(prevX)) { + ctx.moveTo(prevX, prevYs[0]); + + // Move to top fill point + if (stepPlot) { + ctx.lineTo(point.canvasx, prevYs[0]); + } else { + ctx.lineTo(point.canvasx, newYs[0]); + } + // Move to bottom fill point + if (prevStepPlot && currBaseline) { + // Draw to the bottom of the baseline + ctx.lineTo(point.canvasx, currBaseline[1]); + } else { + ctx.lineTo(point.canvasx, newYs[1]); + } + + ctx.lineTo(prevX, prevYs[1]); + ctx.closePath(); + } + prevYs = newYs; + prevX = point.canvasx; + } + prevStepPlot = stepPlot; + ctx.fill(); + } +}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-combined.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-combined.js new file mode 100644 index 0000000..4f86453 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-combined.js @@ -0,0 +1,2 @@ +/*! @license Copyright 2011 Dan Vanderkam (danvdk@gmail.com) MIT-licensed (http://opensource.org/licenses/MIT) */ +Date.ext={};Date.ext.util={};Date.ext.util.xPad=function(a,c,b){if(typeof(b)=="undefined"){b=10}for(;parseInt(a,10)1;b/=10){a=c.toString()+a}return a.toString()};Date.prototype.locale="en-GB";if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){Date.prototype.locale=document.getElementsByTagName("html")[0].lang}Date.ext.locales={};Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"};Date.ext.locales["en-US"]=Date.ext.locales.en;Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";Date.ext.locales["en-US"].x="%D";Date.ext.locales["en-US"].X="%r";Date.ext.locales["en-GB"]=Date.ext.locales.en;Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];Date.ext.formats={a:function(a){return Date.ext.locales[a.locale].a[a.getDay()]},A:function(a){return Date.ext.locales[a.locale].A[a.getDay()]},b:function(a){return Date.ext.locales[a.locale].b[a.getMonth()]},B:function(a){return Date.ext.locales[a.locale].B[a.getMonth()]},c:"toLocaleString",C:function(a){return Date.ext.util.xPad(parseInt(a.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(a){return Date.ext.util.xPad(parseInt(Date.ext.util.G(a)/100,10),0)},G:function(c){var e=c.getFullYear();var b=parseInt(Date.ext.formats.V(c),10);var a=parseInt(Date.ext.formats.W(c),10);if(a>b){e++}else{if(a===0&&b>=52){e--}}return e},H:["getHours","0"],I:function(b){var a=b.getHours()%12;return Date.ext.util.xPad(a===0?12:a,0)},j:function(c){var a=c-new Date(""+c.getFullYear()+"/1/1 GMT");a+=c.getTimezoneOffset()*60000;var b=parseInt(a/60000/60/24,10)+1;return Date.ext.util.xPad(b,0,100)},m:function(a){return Date.ext.util.xPad(a.getMonth()+1,0)},M:["getMinutes","0"],p:function(a){return Date.ext.locales[a.locale].p[a.getHours()>=12?1:0]},P:function(a){return Date.ext.locales[a.locale].P[a.getHours()>=12?1:0]},S:["getSeconds","0"],u:function(a){var b=a.getDay();return b===0?7:b},U:function(e){var a=parseInt(Date.ext.formats.j(e),10);var c=6-e.getDay();var b=parseInt((a+c)/7,10);return Date.ext.util.xPad(b,0)},V:function(e){var c=parseInt(Date.ext.formats.W(e),10);var a=(new Date(""+e.getFullYear()+"/1/1")).getDay();var b=c+(a>4||a<=1?0:1);if(b==53&&(new Date(""+e.getFullYear()+"/12/31")).getDay()<4){b=1}else{if(b===0){b=Date.ext.formats.V(new Date(""+(e.getFullYear()-1)+"/12/31"))}}return Date.ext.util.xPad(b,0)},w:"getDay",W:function(e){var a=parseInt(Date.ext.formats.j(e),10);var c=7-Date.ext.formats.u(e);var b=parseInt((a+c)/7,10);return Date.ext.util.xPad(b,0,10)},y:function(a){return Date.ext.util.xPad(a.getFullYear()%100,0)},Y:"getFullYear",z:function(c){var b=c.getTimezoneOffset();var a=Date.ext.util.xPad(parseInt(Math.abs(b/60),10),0);var e=Date.ext.util.xPad(b%60,0);return(b>0?"-":"+")+a+e},Z:function(a){return a.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(a){return"%"}};Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};Date.ext.aggregates.z=Date.ext.formats.z(new Date());Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());Date.ext.unsupported={};Date.prototype.strftime=function(a){if(!(this.locale in Date.ext.locales)){if(this.locale.replace(/-[a-zA-Z]+$/,"") in Date.ext.locales){this.locale=this.locale.replace(/-[a-zA-Z]+$/,"")}else{this.locale="en-GB"}}var c=this;while(a.match(/%[cDhnrRtTxXzZ]/)){a=a.replace(/%([cDhnrRtTxXzZ])/g,function(e,d){var g=Date.ext.aggregates[d];return(g=="locale"?Date.ext.locales[c.locale][d]:g)})}var b=a.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g,function(e,d){var g=Date.ext.formats[d];if(typeof(g)=="string"){return c[g]()}else{if(typeof(g)=="function"){return g.call(c,c)}else{if(typeof(g)=="object"&&typeof(g[0])=="string"){return Date.ext.util.xPad(c[g[0]](),g[1])}else{return d}}}});c=null;return b};"use strict";function RGBColorParser(f){this.ok=false;if(f.charAt(0)=="#"){f=f.substr(1,6)}f=f.replace(/ /g,"");f=f.toLowerCase();var b={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};for(var g in b){if(f==g){f=b[g]}}var e=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(i){return[parseInt(i[1]),parseInt(i[2]),parseInt(i[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(i){return[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(i){return[parseInt(i[1]+i[1],16),parseInt(i[2]+i[2],16),parseInt(i[3]+i[3],16)]}}];for(var c=0;c255)?255:this.r);this.g=(this.g<0||isNaN(this.g))?0:((this.g>255)?255:this.g);this.b=(this.b<0||isNaN(this.b))?0:((this.b>255)?255:this.b);this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"};this.toHex=function(){var l=this.r.toString(16);var k=this.g.toString(16);var i=this.b.toString(16);if(l.length==1){l="0"+l}if(k.length==1){k="0"+k}if(i.length==1){i="0"+i}return"#"+l+k+i}}function printStackTrace(b){b=b||{guess:true};var c=b.e||null,e=!!b.guess;var d=new printStackTrace.implementation(),a=d.run(c);return(e)?d.guessAnonymousFunctions(a):a}printStackTrace.implementation=function(){};printStackTrace.implementation.prototype={run:function(a,b){a=a||this.createException();b=b||this.mode(a);if(b==="other"){return this.other(arguments.callee)}else{return this[b](a)}},createException:function(){try{this.undef()}catch(a){return a}},mode:function(a){if(a["arguments"]&&a.stack){return"chrome"}else{if(typeof a.message==="string"&&typeof window!=="undefined"&&window.opera){if(!a.stacktrace){return"opera9"}if(a.message.indexOf("\n")>-1&&a.message.split("\n").length>a.stacktrace.split("\n").length){return"opera9"}if(!a.stack){return"opera10a"}if(a.stacktrace.indexOf("called from line")<0){return"opera10b"}return"opera11"}else{if(a.stack){return"firefox"}}}return"other"},instrumentFunction:function(b,d,e){b=b||window;var a=b[d];b[d]=function c(){e.call(this,printStackTrace().slice(4));return b[d]._instrumented.apply(this,arguments)};b[d]._instrumented=a},deinstrumentFunction:function(a,b){if(a[b].constructor===Function&&a[b]._instrumented&&a[b]._instrumented.constructor===Function){a[b]=a[b]._instrumented}},chrome:function(b){var a=(b.stack+"\n").replace(/^\S[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^([^\(]+?)([\n$])/gm,"{anonymous}()@$1$2").replace(/^Object.\s*\(([^\)]+)\)/gm,"{anonymous}()@$1").split("\n");a.pop();return a},firefox:function(a){return a.stack.replace(/(?:\n@:0)?\s+$/m,"").replace(/^\(/gm,"{anonymous}(").split("\n")},opera11:function(g){var a="{anonymous}",h=/^.*line (\d+), column (\d+)(?: in (.+))? in (\S+):$/;var k=g.stacktrace.split("\n"),l=[];for(var c=0,f=k.length;c/,"$1").replace(//,a);l.push(b+"@"+j+" -- "+k[c+1].replace(/^\s+/,""))}}return l},opera10b:function(g){var a="{anonymous}",h=/^(.*)@(.+):(\d+)$/;var j=g.stacktrace.split("\n"),k=[];for(var c=0,f=j.length;c=0){l=l.substr(0,c)}if(l){b=l+b;d=k.exec(b);if(d&&d[1]){return d[1]}d=g.exec(b);if(d&&d[1]){return d[1]}d=h.exec(b);if(d&&d[1]){return d[1]}}}return"(?)"}};CanvasRenderingContext2D.prototype.installPattern=function(e){if(typeof(this.isPatternInstalled)!=="undefined"){throw"Must un-install old line pattern before installing a new one."}this.isPatternInstalled=true;var g=[0,0];var b=[];var f=this.beginPath;var d=this.lineTo;var c=this.moveTo;var a=this.stroke;this.uninstallPattern=function(){this.beginPath=f;this.lineTo=d;this.moveTo=c;this.stroke=a;this.uninstallPattern=undefined;this.isPatternInstalled=undefined};this.beginPath=function(){b=[];f.call(this)};this.moveTo=function(h,i){b.push([[h,i]]);c.call(this,h,i)};this.lineTo=function(h,j){var i=b[b.length-1];i.push([h,j])};this.stroke=function(){if(b.length===0){a.call(this);return}for(var p=0;pt){var q=e[m];if(g[1]){t+=g[1]}else{t+=q}if(t>r){g=[m,t-r];t=r}else{g=[(m+1)%e.length,0]}if(m%2===0){d.call(this,t,0)}else{c.call(this,t,0)}m=(m+1)%e.length}this.restore();l=h,u=s}}a.call(this);b=[]}};CanvasRenderingContext2D.prototype.uninstallPattern=function(){throw"Must install a line pattern before uninstalling it."};var DygraphOptions=(function(){var a=function(b){this.dygraph_=b;this.yAxes_=[];this.xAxis_={};this.series_={};this.global_=this.dygraph_.attrs_;this.user_=this.dygraph_.user_attrs_||{};this.labels_=[];this.highlightSeries_=this.get("highlightSeriesOpts")||{};this.reparseSeries()};a.AXIS_STRING_MAPPINGS_={y:0,Y:0,y1:0,Y1:0,y2:1,Y2:1};a.axisToIndex_=function(b){if(typeof(b)=="string"){if(a.AXIS_STRING_MAPPINGS_.hasOwnProperty(b)){return a.AXIS_STRING_MAPPINGS_[b]}throw"Unknown axis : "+b}if(typeof(b)=="number"){if(b===0||b===1){return b}throw"Dygraphs only supports two y-axes, indexed from 0-1."}if(b){throw"Unknown axis : "+b}return 0};a.prototype.reparseSeries=function(){var g=this.get("labels");if(!g){return}this.labels_=g.slice(1);this.yAxes_=[{series:[],options:{}}];this.xAxis_={options:{}};this.series_={};var h=!this.user_.series;if(h){var c=0;for(var j=0;j1){Dygraph.update(this.yAxes_[1].options,f.y2||{})}Dygraph.update(this.xAxis_.options,f.x||{})};a.prototype.get=function(c){var b=this.getGlobalUser_(c);if(b!==null){return b}return this.getGlobalDefault_(c)};a.prototype.getGlobalUser_=function(b){if(this.user_.hasOwnProperty(b)){return this.user_[b]}return null};a.prototype.getGlobalDefault_=function(b){if(this.global_.hasOwnProperty(b)){return this.global_[b]}if(Dygraph.DEFAULT_ATTRS.hasOwnProperty(b)){return Dygraph.DEFAULT_ATTRS[b]}return null};a.prototype.getForAxis=function(d,e){var f;var i;if(typeof(e)=="number"){f=e;i=f===0?"y":"y2"}else{if(e=="y1"){e="y"}if(e=="y"){f=0}else{if(e=="y2"){f=1}else{if(e=="x"){f=-1}else{throw"Unknown axis "+e}}}i=e}var g=(f==-1)?this.xAxis_:this.yAxes_[f];if(g){var h=g.options;if(h.hasOwnProperty(d)){return h[d]}}var c=this.getGlobalUser_(d);if(c!==null){return c}var b=Dygraph.DEFAULT_ATTRS.axes[i];if(b.hasOwnProperty(d)){return b[d]}return this.getGlobalDefault_(d)};a.prototype.getForSeries=function(c,e){if(e===this.dygraph_.getHighlightSeries()){if(this.highlightSeries_.hasOwnProperty(c)){return this.highlightSeries_[c]}}if(!this.series_.hasOwnProperty(e)){throw"Unknown series: "+e}var d=this.series_[e];var b=d.options;if(b.hasOwnProperty(c)){return b[c]}return this.getForAxis(c,d.yAxis)};a.prototype.numAxes=function(){return this.yAxes_.length};a.prototype.axisForSeries=function(b){return this.series_[b].yAxis};a.prototype.axisOptions=function(b){return this.yAxes_[b].options};a.prototype.seriesForAxis=function(b){return this.yAxes_[b].series};a.prototype.seriesNames=function(){return this.labels_};return a})();"use strict";var DygraphLayout=function(a){this.dygraph_=a;this.points=[];this.setNames=[];this.annotations=[];this.yAxes_=null;this.xTicks_=null;this.yTicks_=null};DygraphLayout.prototype.attr_=function(a){return this.dygraph_.attr_(a)};DygraphLayout.prototype.addDataset=function(a,b){this.points.push(b);this.setNames.push(a)};DygraphLayout.prototype.getPlotArea=function(){return this.area_};DygraphLayout.prototype.computePlotArea=function(){var a={x:0,y:0};a.w=this.dygraph_.width_-a.x-this.attr_("rightGap");a.h=this.dygraph_.height_;var b={chart_div:this.dygraph_.graphDiv,reserveSpaceLeft:function(c){var d={x:a.x,y:a.y,w:c,h:a.h};a.x+=c;a.w-=c;return d},reserveSpaceRight:function(c){var d={x:a.x+a.w-c,y:a.y,w:c,h:a.h};a.w-=c;return d},reserveSpaceTop:function(c){var d={x:a.x,y:a.y,w:a.w,h:c};a.y+=c;a.h-=c;return d},reserveSpaceBottom:function(c){var d={x:a.x,y:a.y+a.h-c,w:a.w,h:c};a.h-=c;return d},chartRect:function(){return{x:a.x,y:a.y,w:a.w,h:a.h}}};this.dygraph_.cascadeEvents_("layout",b);this.area_=a};DygraphLayout.prototype.setAnnotations=function(d){this.annotations=[];var e=this.attr_("xValueParser")||function(a){return a};for(var c=0;c=0)&&(f<=1)){this.xticks.push([f,b])}}this.yticks=[];for(d=0;d=0)&&(f<=1)){this.yticks.push([d,f,b])}}}};DygraphLayout.prototype._evaluateAnnotations=function(){var d;var g={};for(d=0;d=0;e--){if(f.childNodes[e].className==g){f.removeChild(f.childNodes[e])}}var c=document.bgColor;var d=this.dygraph_.graphDiv;while(d!=document){var a=d.currentStyle.backgroundColor;if(a&&a!="transparent"){c=a;break}d=d.parentNode}function b(j){if(j.w===0||j.h===0){return}var i=document.createElement("div");i.className=g;i.style.backgroundColor=c;i.style.position="absolute";i.style.left=j.x+"px";i.style.top=j.y+"px";i.style.width=j.w+"px";i.style.height=j.h+"px";f.appendChild(i)}var h=this.area;b({x:0,y:0,w:h.x,h:this.height});b({x:h.x,y:0,w:this.width-h.x,h:h.y});b({x:h.x+h.w,y:0,w:this.width-h.x-h.w,h:this.height});b({x:h.x,y:h.y+h.h,w:this.width-h.x,h:this.height-h.h-h.y})};DygraphCanvasRenderer._getIteratorPredicate=function(a){return a?DygraphCanvasRenderer._predicateThatSkipsEmptyPoints:null};DygraphCanvasRenderer._predicateThatSkipsEmptyPoints=function(b,a){return b[a].yval!==null};DygraphCanvasRenderer._drawStyledLine=function(i,a,m,q,f,n,d){var h=i.dygraph;var c=h.getOption("stepPlot",i.setName);if(!Dygraph.isArrayLike(q)){q=null}var l=h.getOption("drawGapEdgePoints",i.setName);var o=i.points;var k=Dygraph.createIterator(o,0,o.length,DygraphCanvasRenderer._getIteratorPredicate(h.getOption("connectSeparatedPoints")));var j=q&&(q.length>=2);var p=i.drawingContext;p.save();if(j){p.installPattern(q)}var b=DygraphCanvasRenderer._drawSeries(i,k,m,d,f,l,c,a);DygraphCanvasRenderer._drawPointsOnLine(i,b,n,a,d);if(j){p.uninstallPattern()}p.restore()};DygraphCanvasRenderer._drawSeries=function(v,t,m,h,p,s,g,q){var b=null;var w=null;var k=null;var j;var o;var l=[];var f=true;var n=v.drawingContext;n.beginPath();n.strokeStyle=q;n.lineWidth=m;var c=t.array_;var u=t.end_;var a=t.predicate_;for(var r=t.start_;r=0;C--){if(!D.visibility()[C]){I.splice(C,1)}}var h=(function(){for(var e=0;e=0;u--){var n=I[u];if(!D.getOption("fillGraph",n)){continue}var p=D.getOption("stepPlot",n);var x=q[u];var f=D.axisPropertiesForSeries(n);var d=1+f.minyval*f.yscale;if(d<0){d=0}else{if(d>1){d=1}}d=E.h*d+E.y;var B=c[u];var A=Dygraph.createIterator(B,0,B.length,DygraphCanvasRenderer._getIteratorPredicate(D.getOption("connectSeparatedPoints")));var m=NaN;var l=[-1,-1];var t;var b=new RGBColorParser(x);var H="rgba("+b.r+","+b.g+","+b.b+","+y+")";w.fillStyle=H;w.beginPath();var j,G=true;while(A.hasNext){var v=A.next();if(!Dygraph.isOK(v.y)){m=NaN;if(v.y_stacked!==null&&!isNaN(v.y_stacked)){s[v.canvasx]=E.h*v.y_stacked+E.y}continue}if(k){if(!G&&j==v.xval){continue}else{G=false;j=v.xval}a=s[v.canvasx];var o;if(a===undefined){o=d}else{if(r){o=a[0]}else{o=a}}t=[v.canvasy,o];if(p){if(l[0]===-1){s[v.canvasx]=[v.canvasy,d]}else{s[v.canvasx]=[v.canvasy,l[0]]}}else{s[v.canvasx]=v.canvasy}}else{t=[v.canvasy,d]}if(!isNaN(m)){w.moveTo(m,l[0]);if(p){w.lineTo(v.canvasx,l[0])}else{w.lineTo(v.canvasx,t[0])}if(r&&a){w.lineTo(v.canvasx,a[1])}else{w.lineTo(v.canvasx,t[1])}w.lineTo(m,l[1]);w.closePath()}l=t;m=v.canvasx}r=p;w.fill()}};"use strict";var Dygraph=function(d,c,b,a){this.is_initial_draw_=true;this.readyFns_=[];if(a!==undefined){this.warn("Using deprecated four-argument dygraph constructor");this.__old_init__(d,c,b,a)}else{this.__init__(d,c,b)}};Dygraph.NAME="Dygraph";Dygraph.VERSION="1.0.0";Dygraph.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};Dygraph.toString=function(){return this.__repr__()};Dygraph.DEFAULT_ROLL_PERIOD=1;Dygraph.DEFAULT_WIDTH=480;Dygraph.DEFAULT_HEIGHT=320;Dygraph.ANIMATION_STEPS=12;Dygraph.ANIMATION_DURATION=200;Dygraph.KMB_LABELS=["K","M","B","T","Q"];Dygraph.KMG2_BIG_LABELS=["k","M","G","T","P","E","Z","Y"];Dygraph.KMG2_SMALL_LABELS=["m","u","n","p","f","a","z","y"];Dygraph.numberValueFormatter=function(s,a,u,l){var e=a("sigFigs");if(e!==null){return Dygraph.floatFormat(s,e)}var c=a("digitsAfterDecimal");var o=a("maxNumberWidth");var b=a("labelsKMB");var r=a("labelsKMG2");var q;if(s!==0&&(Math.abs(s)>=Math.pow(10,o)||Math.abs(s)=0;h--,d/=f){if(p>=d){q=Dygraph.round_(s/d,c)+t[h];break}}if(r){var i=String(s.toExponential()).split("e-");if(i.length===2&&i[1]>=3&&i[1]<=24){if(i[1]%3>0){q=Dygraph.round_(i[0]/Dygraph.pow(10,(i[1]%3)),c)}else{q=Number(i[0]).toFixed(2)}q+=m[Math.floor(i[1]/3)-1]}}}return q};Dygraph.numberAxisLabelFormatter=function(a,d,c,b){return Dygraph.numberValueFormatter(a,c,b)};Dygraph.dateString_=function(e){var i=Dygraph.zeropad;var h=new Date(e);var f=""+h.getFullYear();var g=i(h.getMonth()+1);var a=i(h.getDate());var c="";var b=h.getHours()*3600+h.getMinutes()*60+h.getSeconds();if(b){c=" "+Dygraph.hmsString_(e)}return f+"/"+g+"/"+a+c};Dygraph.dateAxisFormatter=function(b,c){if(c>=Dygraph.DECADAL){return b.strftime("%Y")}else{if(c>=Dygraph.MONTHLY){return b.strftime("%b %y")}else{var a=b.getHours()*3600+b.getMinutes()*60+b.getSeconds()+b.getMilliseconds();if(a===0||c>=Dygraph.DAILY){return new Date(b.getTime()+3600*1000).strftime("%d%b")}else{return Dygraph.hmsString_(b.getTime())}}}};Dygraph.Plotters=DygraphCanvasRenderer._Plotters;Dygraph.DEFAULT_ATTRS={highlightCircleSize:3,highlightSeriesOpts:null,highlightSeriesBackgroundAlpha:0.5,labelsDivWidth:250,labelsDivStyles:{},labelsSeparateLines:false,labelsShowZeroValues:true,labelsKMB:false,labelsKMG2:false,showLabelsOnHighlight:true,digitsAfterDecimal:2,maxNumberWidth:6,sigFigs:null,strokeWidth:1,strokeBorderWidth:0,strokeBorderColor:"white",axisTickSize:3,axisLabelFontSize:14,xAxisLabelWidth:50,yAxisLabelWidth:50,rightGap:5,showRoller:false,xValueParser:Dygraph.dateParser,delimiter:",",sigma:2,errorBars:false,fractions:false,wilsonInterval:true,customBars:false,fillGraph:false,fillAlpha:0.15,connectSeparatedPoints:false,stackedGraph:false,stackedGraphNaNFill:"all",hideOverlayOnMouseOut:true,legend:"onmouseover",stepPlot:false,avoidMinZero:false,xRangePad:0,yRangePad:null,drawAxesAtZero:false,titleHeight:28,xLabelHeight:18,yLabelWidth:18,drawXAxis:true,drawYAxis:true,axisLineColor:"black",axisLineWidth:0.3,gridLineWidth:0.3,axisLabelColor:"black",axisLabelFont:"Arial",axisLabelWidth:50,drawYGrid:true,drawXGrid:true,gridLineColor:"rgb(128,128,128)",interactionModel:null,animatedZooms:false,showRangeSelector:false,rangeSelectorHeight:40,rangeSelectorPlotStrokeColor:"#808FAB",rangeSelectorPlotFillColor:"#A7B1C4",plotter:[Dygraph.Plotters.fillPlotter,Dygraph.Plotters.errorPlotter,Dygraph.Plotters.linePlotter],plugins:[],axes:{x:{pixelsPerLabel:60,axisLabelFormatter:Dygraph.dateAxisFormatter,valueFormatter:Dygraph.dateString_,drawGrid:true,independentTicks:true,ticker:null},y:{pixelsPerLabel:30,valueFormatter:Dygraph.numberValueFormatter,axisLabelFormatter:Dygraph.numberAxisLabelFormatter,drawGrid:true,independentTicks:true,ticker:null},y2:{pixelsPerLabel:30,valueFormatter:Dygraph.numberValueFormatter,axisLabelFormatter:Dygraph.numberAxisLabelFormatter,drawGrid:false,independentTicks:false,ticker:null}}};Dygraph.HORIZONTAL=1;Dygraph.VERTICAL=2;Dygraph.PLUGINS=[];Dygraph.addedAnnotationCSS=false;Dygraph.prototype.__old_init__=function(f,d,e,b){if(e!==null){var a=["Date"];for(var c=0;c=0;d--){var f=a[d][0];var h=a[d][1];h.call(f,g);if(g.propagationStopped){break}}}return g.defaultPrevented};Dygraph.prototype.isZoomed=function(a){if(a===null||a===undefined){return this.zoomed_x_||this.zoomed_y_}if(a==="x"){return this.zoomed_x_}if(a==="y"){return this.zoomed_y_}throw"axis parameter is ["+a+"] must be null, 'x' or 'y'."};Dygraph.prototype.toString=function(){var a=this.maindiv_;var b=(a&&a.id)?a.id:a;return"[Dygraph "+b+"]"};Dygraph.prototype.attr_=function(b,a){return a?this.attributes_.getForSeries(b,a):this.attributes_.get(b)};Dygraph.prototype.getOption=function(a,b){return this.attr_(a,b)};Dygraph.prototype.getOptionForAxis=function(a,b){return this.attributes_.getForAxis(a,b)};Dygraph.prototype.optionsViewForAxis_=function(b){var a=this;return function(c){var d=a.user_attrs_.axes;if(d&&d[b]&&d[b].hasOwnProperty(c)){return d[b][c]}if(typeof(a.user_attrs_[c])!="undefined"){return a.user_attrs_[c]}d=a.attrs_.axes;if(d&&d[b]&&d[b].hasOwnProperty(c)){return d[b][c]}if(b=="y"&&a.axes_[0].hasOwnProperty(c)){return a.axes_[0][c]}else{if(b=="y2"&&a.axes_[1].hasOwnProperty(c)){return a.axes_[1][c]}}return a.attr_(c)}};Dygraph.prototype.rollPeriod=function(){return this.rollPeriod_};Dygraph.prototype.xAxisRange=function(){return this.dateWindow_?this.dateWindow_:this.xAxisExtremes()};Dygraph.prototype.xAxisExtremes=function(){var d=this.attr_("xRangePad")/this.plotter_.area.w;if(this.numRows()===0){return[0-d,1+d]}var c=this.rawData_[0][0];var b=this.rawData_[this.rawData_.length-1][0];if(d){var a=b-c;c-=a*d;b+=a*d}return[c,b]};Dygraph.prototype.yAxisRange=function(a){if(typeof(a)=="undefined"){a=0}if(a<0||a>=this.axes_.length){return null}var b=this.axes_[a];return[b.computedValueRange[0],b.computedValueRange[1]]};Dygraph.prototype.yAxisRanges=function(){var a=[];for(var b=0;bthis.rawData_.length){return null}if(a<0||a>this.rawData_[b].length){return null}return this.rawData_[b][a]};Dygraph.prototype.createInterface_=function(){var a=this.maindiv_;this.graphDiv=document.createElement("div");this.graphDiv.style.textAlign="left";a.appendChild(this.graphDiv);this.canvas_=Dygraph.createCanvas();this.canvas_.style.position="absolute";this.hidden_=this.createPlotKitCanvas_(this.canvas_);this.resizeElements_();this.canvas_ctx_=Dygraph.getContext(this.canvas_);this.hidden_ctx_=Dygraph.getContext(this.hidden_);this.graphDiv.appendChild(this.hidden_);this.graphDiv.appendChild(this.canvas_);this.mouseEventElement_=this.createMouseEventElement_();this.layout_=new DygraphLayout(this);var b=this;this.mouseMoveHandler_=function(c){b.mouseMove_(c)};this.mouseOutHandler_=function(f){var d=f.target||f.fromElement;var c=f.relatedTarget||f.toElement;if(Dygraph.isNodeContainedBy(d,b.graphDiv)&&!Dygraph.isNodeContainedBy(c,b.graphDiv)){b.mouseOut_(f)}};this.addAndTrackEvent(window,"mouseout",this.mouseOutHandler_);this.addAndTrackEvent(this.mouseEventElement_,"mousemove",this.mouseMoveHandler_);if(!this.resizeHandler_){this.resizeHandler_=function(c){b.resize()};this.addAndTrackEvent(window,"resize",this.resizeHandler_)}};Dygraph.prototype.resizeElements_=function(){this.graphDiv.style.width=this.width_+"px";this.graphDiv.style.height=this.height_+"px";this.canvas_.width=this.width_;this.canvas_.height=this.height_;this.canvas_.style.width=this.width_+"px";this.canvas_.style.height=this.height_+"px";this.hidden_.width=this.width_;this.hidden_.height=this.height_;this.hidden_.style.width=this.width_+"px";this.hidden_.style.height=this.height_+"px"};Dygraph.prototype.destroy=function(){this.canvas_ctx_.restore();this.hidden_ctx_.restore();var a=function(c){while(c.hasChildNodes()){a(c.firstChild);c.removeChild(c.firstChild)}};this.removeTrackedEvents_();Dygraph.removeEvent(window,"mouseout",this.mouseOutHandler_);Dygraph.removeEvent(this.mouseEventElement_,"mousemove",this.mouseMoveHandler_);Dygraph.removeEvent(window,"resize",this.resizeHandler_);this.resizeHandler_=null;a(this.maindiv_);var b=function(c){for(var d in c){if(typeof(c[d])==="object"){c[d]=null}}};b(this.layout_);b(this.plotter_);b(this)};Dygraph.prototype.createPlotKitCanvas_=function(a){var b=Dygraph.createCanvas();b.style.position="absolute";b.style.top=a.style.top;b.style.left=a.style.left;b.width=this.width_;b.height=this.height_;b.style.width=this.width_+"px";b.style.height=this.height_+"px";return b};Dygraph.prototype.createMouseEventElement_=function(){if(this.isUsingExcanvas_){var a=document.createElement("div");a.style.position="absolute";a.style.backgroundColor="white";a.style.filter="alpha(opacity=0)";a.style.width=this.width_+"px";a.style.height=this.height_+"px";this.graphDiv.appendChild(a);return a}else{return this.canvas_}};Dygraph.prototype.setColors_=function(){var g=this.getLabels();var e=g.length-1;this.colors_=[];this.colorsMap_={};var a=this.attr_("colors");var d;if(!a){var c=this.attr_("colorSaturation")||1;var b=this.attr_("colorValue")||0.5;var k=Math.ceil(e/2);for(d=1;d<=e;d++){if(!this.visibility()[d-1]){continue}var h=d%2?Math.ceil(d/2):(k+d/2);var f=(1*h/(1+e));var j=Dygraph.hsvToRGB(f,c,b);this.colors_.push(j);this.colorsMap_[g[d]]=j}}else{for(d=0;d=0;--b){var m=this.layout_.points[b];for(var g=0;g=l.length){continue}var m=l[e];if(!Dygraph.isValidPoint(m)){continue}var j=m.canvasy;if(i>m.canvasx&&e+10){var a=(i-m.canvasx)/o;j+=a*(k.canvasy-m.canvasy)}}}else{if(i0){var n=l[e-1];if(Dygraph.isValidPoint(n)){var o=m.canvasx-n.canvasx;if(o>0){var a=(m.canvasx-i)/o;j+=a*(n.canvasy-m.canvasy)}}}}if(d===0||j=0){var j=0;var k=this.attr_("labels");for(h=1;hj){j=c}}var l=this.previousVerticalX_;n.clearRect(l-j-1,0,2*j+2,this.height_)}}if(this.isUsingExcanvas_&&this.currentZoomRectArgs_){Dygraph.prototype.drawZoomRect_.apply(this,this.currentZoomRectArgs_)}if(this.selPoints_.length>0){var b=this.selPoints_[0].canvasx;n.save();for(h=0;h=0){if(f!=this.lastRow_){e=true}this.lastRow_=f;for(var d=0;d=0){e=true}this.lastRow_=-1}if(this.selPoints_.length){this.lastx_=this.selPoints_[0].xval}else{this.lastx_=-1}if(h!==undefined){if(this.highlightSet_!==h){e=true}this.highlightSet_=h}if(g!==undefined){this.lockedSet_=g}if(e){this.updateSelection_(undefined)}return e};Dygraph.prototype.mouseOut_=function(a){if(this.attr_("unhighlightCallback")){this.attr_("unhighlightCallback")(a)}if(this.attr_("hideOverlayOnMouseOut")&&!this.lockedSet_){this.clearSelection()}};Dygraph.prototype.clearSelection=function(){this.cascadeEvents_("deselect",{});this.lockedSet_=false;if(this.fadeLevel){this.animateSelection_(-1);return}this.canvas_ctx_.clearRect(0,0,this.width_,this.height_);this.fadeLevel=0;this.selPoints_=[];this.lastx_=-1;this.lastRow_=-1;this.highlightSet_=null};Dygraph.prototype.getSelection=function(){if(!this.selPoints_||this.selPoints_.length<1){return -1}for(var c=0;cg){a=g}if(ef){f=e}if(h===null||af){f=g}if(h===null||g=i){return}for(var p=i;po[1]){o[1]=a}if(a=1;u--){if(!this.visibility()[u-1]){continue}if(f){l=w[u];var z=f[0];var j=f[1];var g=null,y=null;for(r=0;r=z&&g===null){g=r}if(l[r][0]<=j){y=r}}if(g===null){g=0}var e=g;var d=true;while(d&&e>0){e--;d=b(l[e])}if(y===null){y=l.length-1}var c=y;d=true;while(d&&c0){this.setIndexByName_[g[0]]=0}var e=0;for(var f=1;f0){var a=this.readyFns_.pop();a(this)}}};Dygraph.prototype.computeYAxes_=function(){var b,d,c,f,a;if(this.axes_!==undefined&&this.user_attrs_.hasOwnProperty("valueRange")===false){b=[];for(c=0;c0){D=0}if(A<0){A=0}}if(D==Infinity){D=0}if(A==-Infinity){A=1}x=A-D;if(x===0){if(A!==0){x=Math.abs(A)}else{A=1;x=1}}var h,H;if(C){if(b){h=A+B*x;H=D}else{var E=Math.exp(Math.log(x)*B);h=A*E;H=D/E}}else{h=A+B*x;H=D-B*x;if(b&&!this.attr_("avoidMinZero")){if(H<0&&D>=0){H=0}if(h>0&&A<=0){h=0}}}c.extremeRange=[H,h]}if(c.valueWindow){c.computedValueRange=[c.valueWindow[0],c.valueWindow[1]]}else{if(c.valueRange){var e=g(c.valueRange[0])?c.extremeRange[0]:c.valueRange[0];var d=g(c.valueRange[1])?c.extremeRange[1]:c.valueRange[1];if(!b){if(c.logscale){var E=Math.exp(Math.log(x)*B);e*=E;d/=E}else{x=d-e;e-=x*B;d+=x*B}}c.computedValueRange=[e,d]}else{c.computedValueRange=c.extremeRange}}if(l){c.independentTicks=l;var r=this.optionsViewForAxis_("y"+(y?"2":""));var F=r("ticker");c.ticks=F(c.computedValueRange[0],c.computedValueRange[1],this.height_,r,this);if(!p){p=c}}}if(p===undefined){throw ('Configuration Error: At least one axis has to have the "independentTicks" option activated.')}for(var y=0;y=0){k-=l[z-d][1][0];h-=l[z-d][1][1]}var C=l[z][0];var w=h?k/h:0;if(this.attr_("errorBars")){if(this.attr_("wilsonInterval")){if(h){var s=w<0?0:w,u=h;var B=t*Math.sqrt(s*(1-s)/u+t*t/(4*u*u));var a=1+t*t/h;G=(s+t*t/(2*h)-B)/a;o=(s+t*t/(2*h)+B)/a;b[z]=[C,[s*e,(s-G)*e,(o-s)*e]]}else{b[z]=[C,[0,0,0]]}}else{A=h?t*Math.sqrt(w*(1-w)/h):1;b[z]=[C,[e*w,e*A,e*A]]}}else{b[z]=[C,e*w]}}}else{if(this.attr_("customBars")){G=0;var D=0;o=0;var g=0;for(z=0;z=0){var r=l[z-d];if(r[1][1]!==null&&!isNaN(r[1][1])){G-=r[1][0];D-=r[1][1];o-=r[1][2];g-=1}}if(g){b[z]=[l[z][0],[1*D/g,1*(D-G)/g,1*(o-D)/g]]}else{b[z]=[l[z][0],[null,null,null]]}}}else{if(!this.attr_("errorBars")){if(d==1){return l}for(z=0;z0&&(b[c-1]!="e"&&b[c-1]!="E"))||b.indexOf("/")>=0||isNaN(parseFloat(b))){a=true}else{if(b.length==8&&b>"19700101"&&b<"20371231"){a=true}}this.setXAxisOptions_(a)};Dygraph.prototype.setXAxisOptions_=function(a){if(a){this.attrs_.xValueParser=Dygraph.dateParser;this.attrs_.axes.x.valueFormatter=Dygraph.dateString_;this.attrs_.axes.x.ticker=Dygraph.dateTicker;this.attrs_.axes.x.axisLabelFormatter=Dygraph.dateAxisFormatter}else{this.attrs_.xValueParser=function(b){return parseFloat(b)};this.attrs_.axes.x.valueFormatter=function(b){return b};this.attrs_.axes.x.ticker=Dygraph.numericLinearTicks;this.attrs_.axes.x.axisLabelFormatter=this.attrs_.axes.x.valueFormatter}};Dygraph.prototype.parseFloat_=function(a,c,b){var e=parseFloat(a);if(!isNaN(e)){return e}if(/^ *$/.test(a)){return null}if(/^ *nan *$/i.test(a)){return NaN}var d="Unable to parse '"+a+"' as a number";if(b!==null&&c!==null){d+=" on line "+(1+c)+" ('"+b+"') of CSV."}this.error(d);return null};Dygraph.prototype.parseCSV_=function(t){var r=[];var s=Dygraph.detectLineDelimiter(t);var a=t.split(s||"\n");var g,k;var p=this.attr_("delimiter");if(a[0].indexOf(p)==-1&&a[0].indexOf("\t")>=0){p="\t"}var b=0;if(!("labels" in this.user_attrs_)){b=1;this.attrs_.labels=a[0].split(p);this.attributes_.reparseSeries()}var o=0;var m;var q=false;var c=this.attr_("labels").length;var f=false;for(var l=b;l0&&h[0]0){j=String.fromCharCode(65+(i-1)%26)+j.toLowerCase();i=Math.floor((i-1)/26)}return j};var h=w.getNumberOfColumns();var g=w.getNumberOfRows();var f=w.getColumnType(0);if(f=="date"||f=="datetime"){this.attrs_.xValueParser=Dygraph.dateParser;this.attrs_.axes.x.valueFormatter=Dygraph.dateString_;this.attrs_.axes.x.ticker=Dygraph.dateTicker;this.attrs_.axes.x.axisLabelFormatter=Dygraph.dateAxisFormatter}else{if(f=="number"){this.attrs_.xValueParser=function(i){return parseFloat(i)};this.attrs_.axes.x.valueFormatter=function(i){return i};this.attrs_.axes.x.ticker=Dygraph.numericLinearTicks;this.attrs_.axes.x.axisLabelFormatter=this.attrs_.axes.x.valueFormatter}else{this.error("only 'date', 'datetime' and 'number' types are supported for column 1 of DataTable input (Got '"+f+"')");return null}}var m=[];var t={};var s=false;var q,o;for(q=1;q0&&e[0]0){this.setAnnotations(a,true)}this.attributes_.reparseSeries()};Dygraph.prototype.start_=function(){var d=this.file_;if(typeof d=="function"){d=d()}if(Dygraph.isArrayLike(d)){this.rawData_=this.parseArray_(d);this.predraw_()}else{if(typeof d=="object"&&typeof d.getColumnRange=="function"){this.parseDataTable_(d);this.predraw_()}else{if(typeof d=="string"){var c=Dygraph.detectLineDelimiter(d);if(c){this.loadedEvent_(d)}else{var b;if(window.XMLHttpRequest){b=new XMLHttpRequest()}else{b=new ActiveXObject("Microsoft.XMLHTTP")}var a=this;b.onreadystatechange=function(){if(b.readyState==4){if(b.status===200||b.status===0){a.loadedEvent_(b.responseText)}}};b.open("GET",d,true);b.send(null)}}else{this.error("Unknown data format: "+(typeof d))}}}};Dygraph.prototype.updateOptions=function(e,b){if(typeof(b)=="undefined"){b=false}var d=e.file;var c=Dygraph.mapLegacyOptions_(e);if("rollPeriod" in c){this.rollPeriod_=c.rollPeriod}if("dateWindow" in c){this.dateWindow_=c.dateWindow;if(!("isZoomedIgnoreProgrammaticZoom" in c)){this.zoomed_x_=(c.dateWindow!==null)}}if("valueRange" in c&&!("isZoomedIgnoreProgrammaticZoom" in c)){this.zoomed_y_=(c.valueRange!==null)}var a=Dygraph.isPixelChangingOptionList(this.attr_("labels"),c);Dygraph.updateDeep(this.user_attrs_,c);this.attributes_.reparseSeries();if(d){this.file_=d;if(!b){this.start_()}}else{if(!b){if(a){this.predraw_()}else{this.renderGraph_(false)}}}};Dygraph.mapLegacyOptions_=function(c){var a={};for(var b in c){if(b=="file"){continue}if(c.hasOwnProperty(b)){a[b]=c[b]}}var e=function(g,f,h){if(!a.axes){a.axes={}}if(!a.axes[g]){a.axes[g]={}}a.axes[g][f]=h};var d=function(f,g,h){if(typeof(c[f])!="undefined"){Dygraph.warn("Option "+f+" is deprecated. Use the "+h+" option for the "+g+" axis instead. (e.g. { axes : { "+g+" : { "+h+" : ... } } } (see http://dygraphs.com/per-axis.html for more information.");e(g,h,c[f]);delete a[f]}};d("xValueFormatter","x","valueFormatter");d("pixelsPerXLabel","x","pixelsPerLabel");d("xAxisLabelFormatter","x","axisLabelFormatter");d("xTicker","x","ticker");d("yValueFormatter","y","valueFormatter");d("pixelsPerYLabel","y","pixelsPerLabel");d("yAxisLabelFormatter","y","axisLabelFormatter");d("yTicker","y","ticker");return a};Dygraph.prototype.resize=function(d,b){if(this.resize_lock){return}this.resize_lock=true;if((d===null)!=(b===null)){this.warn("Dygraph.resize() should be called with zero parameters or two non-NULL parameters. Pretending it was zero.");d=b=null}var a=this.width_;var c=this.height_;if(d){this.maindiv_.style.width=d+"px";this.maindiv_.style.height=b+"px";this.width_=d;this.height_=b}else{this.width_=this.maindiv_.clientWidth;this.height_=this.maindiv_.clientHeight}if(a!=this.width_||c!=this.height_){this.resizeElements_();this.predraw_()}this.resize_lock=false};Dygraph.prototype.adjustRoll=function(a){this.rollPeriod_=a;this.predraw_()};Dygraph.prototype.visibility=function(){if(!this.attr_("visibility")){this.attrs_.visibility=[]}while(this.attr_("visibility").length=a.length){this.warn("invalid series number in setVisibility: "+b)}else{a[b]=c;this.predraw_()}};Dygraph.prototype.size=function(){return{width:this.width_,height:this.height_}};Dygraph.prototype.setAnnotations=function(b,a){Dygraph.addAnnotationRule();this.annotations_=b;if(!this.layout_){this.warn("Tried to setAnnotations before dygraph was ready. Try setting them in a ready() block. See dygraphs.com/tests/annotation.html");return}this.layout_.setAnnotations(this.annotations_);if(!a){this.predraw_()}};Dygraph.prototype.annotations=function(){return this.annotations_};Dygraph.prototype.getLabels=function(){var a=this.attr_("labels");return a?a.slice():null};Dygraph.prototype.indexFromSetName=function(a){return this.setIndexByName_[a]};Dygraph.prototype.ready=function(a){if(this.is_initial_draw_){this.readyFns_.push(a)}else{a(this)}};Dygraph.addAnnotationRule=function(){if(Dygraph.addedAnnotationCSS){return}var f="border: 1px solid black; background-color: white; text-align: center;";var e=document.createElement("style");e.type="text/css";document.getElementsByTagName("head")[0].appendChild(e);for(var b=0;bb){return -1}if(i===null||i===undefined){i=0}var h=function(j){return j>=0&&ja){if(i>0){f=g-1;if(h(f)&&d[f]a){return g}}return Dygraph.binarySearch(a,d,i,g+1,b)}}}return -1};Dygraph.dateParser=function(a){var b;var c;if(a.search("-")==-1||a.search("T")!=-1||a.search("Z")!=-1){c=Dygraph.dateStrToMillis(a);if(c&&!isNaN(c)){return c}}if(a.search("-")!=-1){b=a.replace("-","/","g");while(b.search("-")!=-1){b=b.replace("-","/")}c=Dygraph.dateStrToMillis(b)}else{if(a.length==8){b=a.substr(0,4)+"/"+a.substr(4,2)+"/"+a.substr(6,2);c=Dygraph.dateStrToMillis(b)}else{c=Dygraph.dateStrToMillis(a)}}if(!c||isNaN(c)){Dygraph.error("Couldn't parse "+a+" as a date")}return c};Dygraph.dateStrToMillis=function(a){return new Date(a).getTime()};Dygraph.update=function(b,c){if(typeof(c)!="undefined"&&c!==null){for(var a in c){if(c.hasOwnProperty(a)){b[a]=c[a]}}}return b};Dygraph.updateDeep=function(b,d){function c(e){return(typeof Node==="object"?e instanceof Node:typeof e==="object"&&typeof e.nodeType==="number"&&typeof e.nodeName==="string")}if(typeof(d)!="undefined"&&d!==null){for(var a in d){if(d.hasOwnProperty(a)){if(d[a]===null){b[a]=null}else{if(Dygraph.isArrayLike(d[a])){b[a]=d[a].slice()}else{if(c(d[a])){b[a]=d[a]}else{if(typeof(d[a])=="object"){if(typeof(b[a])!="object"||b[a]===null){b[a]={}}Dygraph.updateDeep(b[a],d[a])}else{b[a]=d[a]}}}}}}}return b};Dygraph.isArrayLike=function(b){var a=typeof(b);if((a!="object"&&!(a=="function"&&typeof(b.item)=="function"))||b===null||typeof(b.length)!="number"||b.nodeType===3){return false}return true};Dygraph.isDateLike=function(a){if(typeof(a)!="object"||a===null||typeof(a.getTime)!="function"){return false}return true};Dygraph.clone=function(c){var b=[];for(var a=0;a=g){return}Dygraph.requestAnimFrame.call(window,function(){var l=new Date().getTime();var j=l-b;d=i;i=Math.floor(j/f);var k=i-d;var m=(i+k)>e;if(m||(i>=e)){h(e);a()}else{if(k!==0){h(i)}c()}})})()};Dygraph.isPixelChangingOptionList=function(h,e){var d={annotationClickHandler:true,annotationDblClickHandler:true,annotationMouseOutHandler:true,annotationMouseOverHandler:true,axisLabelColor:true,axisLineColor:true,axisLineWidth:true,clickCallback:true,digitsAfterDecimal:true,drawCallback:true,drawHighlightPointCallback:true,drawPoints:true,drawPointCallback:true,drawXGrid:true,drawYGrid:true,fillAlpha:true,gridLineColor:true,gridLineWidth:true,hideOverlayOnMouseOut:true,highlightCallback:true,highlightCircleSize:true,interactionModel:true,isZoomedIgnoreProgrammaticZoom:true,labelsDiv:true,labelsDivStyles:true,labelsDivWidth:true,labelsKMB:true,labelsKMG2:true,labelsSeparateLines:true,labelsShowZeroValues:true,legend:true,maxNumberWidth:true,panEdgeFraction:true,pixelsPerYLabel:true,pointClickCallback:true,pointSize:true,rangeSelectorPlotFillColor:true,rangeSelectorPlotStrokeColor:true,showLabelsOnHighlight:true,showRoller:true,sigFigs:true,strokeWidth:true,underlayCallback:true,unhighlightCallback:true,xAxisLabelFormatter:true,xTicker:true,xValueFormatter:true,yAxisLabelFormatter:true,yValueFormatter:true,zoomCallback:true};var a=false;var b={};if(h){for(var f=1;fc.boundedDates[1]){h=h-(a-c.boundedDates[1]);a=h+c.dateRange}}k.dateWindow_=[h,a];if(c.is2DPan){var d=c.dragEndY-c.dragStartY;for(var j=0;j=10&&e.dragDirection==Dygraph.HORIZONTAL){var f=Math.min(e.dragStartX,e.dragEndX),k=Math.max(e.dragStartX,e.dragEndX);f=Math.max(f,b.x);k=Math.min(k,b.x+b.w);if(f=10&&e.dragDirection==Dygraph.VERTICAL){var j=Math.min(e.dragStartY,e.dragEndY),a=Math.max(e.dragStartY,e.dragEndY);j=Math.max(j,b.y);a=Math.min(a,b.y+b.h);if(j1){d.startTimeForDoubleTapMs=null}var h=[];for(var c=0;c=2){d.initialPinchCenter={pageX:0.5*(h[0].pageX+h[1].pageX),pageY:0.5*(h[0].pageY+h[1].pageY),dataX:0.5*(h[0].dataX+h[1].dataX),dataY:0.5*(h[0].dataY+h[1].dataY)};var a=180/Math.PI*Math.atan2(d.initialPinchCenter.pageY-h[0].pageY,h[0].pageX-d.initialPinchCenter.pageX);a=Math.abs(a);if(a>90){a=90-a}d.touchDirections={x:(a<(90-45/2)),y:(a>45/2)}}}d.initialRange={x:e.xAxisRange(),y:e.yAxisRange()}};Dygraph.Interaction.moveTouch=function(n,q,d){d.startTimeForDoubleTapMs=null;var p,l=[];for(p=0;p=2){var e=(a[1].pageX-j.pageX);w=(l[1].pageX-h.pageX)/e;var v=(a[1].pageY-j.pageY);c=(l[1].pageY-h.pageY)/v}}w=Math.min(8,Math.max(0.125,w));c=Math.min(8,Math.max(0.125,c));var u=false;if(d.touchDirections.x){q.dateWindow_=[j.dataX-m.dataX+(d.initialRange.x[0]-j.dataX)/w,j.dataX-m.dataX+(d.initialRange.x[1]-j.dataX)/w];u=true}if(d.touchDirections.y){for(p=0;p<1;p++){var b=q.axes_[p];var s=q.attributes_.getForAxis("logscale",p);if(s){}else{b.valueWindow=[j.dataY-m.dataY+(d.initialRange.y[0]-j.dataY)/c,j.dataY-m.dataY+(d.initialRange.y[1]-j.dataY)/c];u=true}}}q.drawGraph_(false);if(u&&l.length>1&&q.attr_("zoomCallback")){var r=q.xAxisRange();q.attr_("zoomCallback")(r[0],r[1],q.yAxisRanges())}};Dygraph.Interaction.endTouch=function(e,d,c){if(e.touches.length!==0){Dygraph.Interaction.startTouch(e,d,c)}else{if(e.changedTouches.length==1){var a=new Date().getTime();var b=e.changedTouches[0];if(c.startTimeForDoubleTapMs&&a-c.startTimeForDoubleTapMs<500&&c.doubleTapX&&Math.abs(c.doubleTapX-b.screenX)<50&&c.doubleTapY&&Math.abs(c.doubleTapY-b.screenY)<50){d.resetZoom()}else{c.startTimeForDoubleTapMs=a;c.doubleTapX=b.screenX;c.doubleTapY=b.screenY}}}};Dygraph.Interaction.defaultModel={mousedown:function(c,b,a){if(c.button&&c.button==2){return}a.initializeMouseDown(c,b,a);if(c.altKey||c.shiftKey){Dygraph.startPan(c,b,a)}else{Dygraph.startZoom(c,b,a)}},mousemove:function(c,b,a){if(a.isZooming){Dygraph.moveZoom(c,b,a)}else{if(a.isPanning){Dygraph.movePan(c,b,a)}}},mouseup:function(c,b,a){if(a.isZooming){Dygraph.endZoom(c,b,a)}else{if(a.isPanning){Dygraph.endPan(c,b,a)}}},touchstart:function(c,b,a){Dygraph.Interaction.startTouch(c,b,a)},touchmove:function(c,b,a){Dygraph.Interaction.moveTouch(c,b,a)},touchend:function(c,b,a){Dygraph.Interaction.endTouch(c,b,a)},mouseout:function(c,b,a){if(a.isZooming){a.dragEndX=null;a.dragEndY=null;b.clearZoomRect_()}},dblclick:function(c,b,a){if(a.cancelNextDblclick){a.cancelNextDblclick=false;return}if(c.altKey||c.shiftKey){return}b.resetZoom()}};Dygraph.DEFAULT_ATTRS.interactionModel=Dygraph.Interaction.defaultModel;Dygraph.defaultInteractionModel=Dygraph.Interaction.defaultModel;Dygraph.endZoom=Dygraph.Interaction.endZoom;Dygraph.moveZoom=Dygraph.Interaction.moveZoom;Dygraph.startZoom=Dygraph.Interaction.startZoom;Dygraph.endPan=Dygraph.Interaction.endPan;Dygraph.movePan=Dygraph.Interaction.movePan;Dygraph.startPan=Dygraph.Interaction.startPan;Dygraph.Interaction.nonInteractiveModel_={mousedown:function(c,b,a){a.initializeMouseDown(c,b,a)},mouseup:function(c,b,a){a.dragEndX=b.dragGetX_(c,a);a.dragEndY=b.dragGetY_(c,a);var e=Math.abs(a.dragEndX-a.dragStartX);var d=Math.abs(a.dragEndY-a.dragStartY);if(e<2&&d<2&&b.lastx_!==undefined&&b.lastx_!=-1){Dygraph.Interaction.treatMouseOpAsClick(b,c,a)}}};Dygraph.Interaction.dragIsPanInteractionModel={mousedown:function(c,b,a){a.initializeMouseDown(c,b,a);Dygraph.startPan(c,b,a)},mousemove:function(c,b,a){if(a.isPanning){Dygraph.movePan(c,b,a)}},mouseup:function(c,b,a){if(a.isPanning){Dygraph.endPan(c,b,a)}}};"use strict";Dygraph.TickList=undefined;Dygraph.Ticker=undefined;Dygraph.numericLinearTicks=function(d,c,i,g,f,h){var e=function(a){if(a==="logscale"){return false}return g(a)};return Dygraph.numericTicks(d,c,i,e,f,h)};Dygraph.numericTicks=function(F,E,u,p,d,q){var z=(p("pixelsPerLabel"));var G=[];var C,A,t,y;if(q){for(C=0;C=y/4){for(var r=H;r>=l;r--){var m=Dygraph.PREFERRED_LOG_TICK_VALUES[r];var k=Math.log(m/F)/Math.log(E/F)*u;var D={v:m};if(s===null){s={tickValue:m,pixel_coord:k}}else{if(Math.abs(k-s.pixel_coord)>=z){s={tickValue:m,pixel_coord:k}}else{D.label=""}}G.push(D)}G.reverse()}}if(G.length===0){var g=p("labelsKMG2");var n,h;if(g){n=[1,2,4,8,16,32,64,128,256];h=16}else{n=[1,2,5,10,20,50,100];h=10}var w=Math.ceil(u/z);var o=Math.abs(E-F)/w;var v=Math.floor(Math.log(o)/Math.log(h));var f=Math.pow(h,v);var I,x,c,e;for(A=0;Az){break}}if(x>c){I*=-1}for(C=0;C=0){return Dygraph.getDateAxis(e,c,d,g,f)}else{return[]}};Dygraph.SECONDLY=0;Dygraph.TWO_SECONDLY=1;Dygraph.FIVE_SECONDLY=2;Dygraph.TEN_SECONDLY=3;Dygraph.THIRTY_SECONDLY=4;Dygraph.MINUTELY=5;Dygraph.TWO_MINUTELY=6;Dygraph.FIVE_MINUTELY=7;Dygraph.TEN_MINUTELY=8;Dygraph.THIRTY_MINUTELY=9;Dygraph.HOURLY=10;Dygraph.TWO_HOURLY=11;Dygraph.SIX_HOURLY=12;Dygraph.DAILY=13;Dygraph.WEEKLY=14;Dygraph.MONTHLY=15;Dygraph.QUARTERLY=16;Dygraph.BIANNUAL=17;Dygraph.ANNUAL=18;Dygraph.DECADAL=19;Dygraph.CENTENNIAL=20;Dygraph.NUM_GRANULARITIES=21;Dygraph.SHORT_SPACINGS=[];Dygraph.SHORT_SPACINGS[Dygraph.SECONDLY]=1000*1;Dygraph.SHORT_SPACINGS[Dygraph.TWO_SECONDLY]=1000*2;Dygraph.SHORT_SPACINGS[Dygraph.FIVE_SECONDLY]=1000*5;Dygraph.SHORT_SPACINGS[Dygraph.TEN_SECONDLY]=1000*10;Dygraph.SHORT_SPACINGS[Dygraph.THIRTY_SECONDLY]=1000*30;Dygraph.SHORT_SPACINGS[Dygraph.MINUTELY]=1000*60;Dygraph.SHORT_SPACINGS[Dygraph.TWO_MINUTELY]=1000*60*2;Dygraph.SHORT_SPACINGS[Dygraph.FIVE_MINUTELY]=1000*60*5;Dygraph.SHORT_SPACINGS[Dygraph.TEN_MINUTELY]=1000*60*10;Dygraph.SHORT_SPACINGS[Dygraph.THIRTY_MINUTELY]=1000*60*30;Dygraph.SHORT_SPACINGS[Dygraph.HOURLY]=1000*3600;Dygraph.SHORT_SPACINGS[Dygraph.TWO_HOURLY]=1000*3600*2;Dygraph.SHORT_SPACINGS[Dygraph.SIX_HOURLY]=1000*3600*6;Dygraph.SHORT_SPACINGS[Dygraph.DAILY]=1000*86400;Dygraph.SHORT_SPACINGS[Dygraph.WEEKLY]=1000*604800;Dygraph.LONG_TICK_PLACEMENTS=[];Dygraph.LONG_TICK_PLACEMENTS[Dygraph.MONTHLY]={months:[0,1,2,3,4,5,6,7,8,9,10,11],year_mod:1};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.QUARTERLY]={months:[0,3,6,9],year_mod:1};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.BIANNUAL]={months:[0,6],year_mod:1};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.ANNUAL]={months:[0],year_mod:1};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.DECADAL]={months:[0],year_mod:10};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.CENTENNIAL]={months:[0],year_mod:100};Dygraph.PREFERRED_LOG_TICK_VALUES=function(){var c=[];for(var b=-39;b<=39;b++){var a=Math.pow(10,b);for(var d=1;d<=9;d++){var e=a*d;c.push(e)}}return c}();Dygraph.pickDateTickGranularity=function(d,c,j,h){var g=(h("pixelsPerLabel"));for(var f=0;f=g){return f}}return -1};Dygraph.numDateTicks=function(e,b,f){if(f=Dygraph.SHORT_SPACINGS[Dygraph.TWO_HOURLY]);for(m=p;m<=l;m+=c){A=new Date(m);if(e&&A.getTimezoneOffset()!=B){var k=A.getTimezoneOffset()-B;m+=k*60*1000;A=new Date(m);B=A.getTimezoneOffset();if(new Date(m+c).getTimezoneOffset()!=B){m+=c;A=new Date(m);B=A.getTimezoneOffset()}}C.push({v:m,label:w(A,a,n,z)})}}else{var f;var r=1;if(al){continue}C.push({v:m,label:w(new Date(m),a,n,z)})}}}return C};if(Dygraph&&Dygraph.DEFAULT_ATTRS&&Dygraph.DEFAULT_ATTRS.axes&&Dygraph.DEFAULT_ATTRS.axes["x"]&&Dygraph.DEFAULT_ATTRS.axes["y"]&&Dygraph.DEFAULT_ATTRS.axes["y2"]){Dygraph.DEFAULT_ATTRS.axes["x"]["ticker"]=Dygraph.dateTicker;Dygraph.DEFAULT_ATTRS.axes["y"]["ticker"]=Dygraph.numericTicks;Dygraph.DEFAULT_ATTRS.axes["y2"]["ticker"]=Dygraph.numericTicks}Dygraph.Plugins={};Dygraph.Plugins.Annotations=(function(){var a=function(){this.annotations_=[]};a.prototype.toString=function(){return"Annotations Plugin"};a.prototype.activate=function(b){return{clearChart:this.clearChart,didDrawChart:this.didDrawChart}};a.prototype.detachLabels=function(){for(var c=0;cu.x+u.w||l.canvasyu.y+u.h){continue}var w=l.annotation;var n=6;if(w.hasOwnProperty("tickHeight")){n=w.tickHeight}var j=document.createElement("div");for(var A in x){if(x.hasOwnProperty(A)){j.style[A]=x[A]}}if(!w.hasOwnProperty("icon")){j.className="dygraphDefaultAnnotation"}if(w.hasOwnProperty("cssClass")){j.className+=" "+w.cssClass}var m=w.hasOwnProperty("width")?w.width:16;var k=w.hasOwnProperty("height")?w.height:16;if(w.hasOwnProperty("icon")){var z=document.createElement("img");z.src=w.icon;z.width=m;z.height=k;j.appendChild(z)}else{if(l.annotation.hasOwnProperty("shortText")){j.appendChild(document.createTextNode(l.annotation.shortText))}}var c=l.canvasx-m/2;j.style.left=c+"px";var f=0;if(w.attachAtBottom){var d=(u.y+u.h-k-n);if(q[c]){d-=q[c]}else{q[c]=0}q[c]+=(n+k);f=d}else{f=l.canvasy-k-n}j.style.top=f+"px";j.style.width=m+"px";j.style.height=k+"px";j.title=l.annotation.text;j.style.color=t.colorsMap_[l.name];j.style.borderColor=t.colorsMap_[l.name];w.div=j;t.addAndTrackEvent(j,"click",b("clickHandler","annotationClickHandler",l,this));t.addAndTrackEvent(j,"mouseover",b("mouseOverHandler","annotationMouseOverHandler",l,this));t.addAndTrackEvent(j,"mouseout",b("mouseOutHandler","annotationMouseOutHandler",l,this));t.addAndTrackEvent(j,"dblclick",b("dblClickHandler","annotationDblClickHandler",l,this));h.appendChild(j);this.annotations_.push(j);var o=v.drawingContext;o.save();o.strokeStyle=t.colorsMap_[l.name];o.beginPath();if(!w.attachAtBottom){o.moveTo(l.canvasx,l.canvasy);o.lineTo(l.canvasx,l.canvasy-2-n)}else{var d=f+k;o.moveTo(l.canvasx,d);o.lineTo(l.canvasx,d+n)}o.closePath();o.stroke();o.restore()}};a.prototype.destroy=function(){this.detachLabels()};return a})();Dygraph.Plugins.Axes=(function(){var a=function(){this.xlabels_=[];this.ylabels_=[]};a.prototype.toString=function(){return"Axes Plugin"};a.prototype.activate=function(b){return{layout:this.layout,clearChart:this.clearChart,willDrawChart:this.willDrawChart}};a.prototype.layout=function(f){var d=f.dygraph;if(d.getOption("drawYAxis")){var b=d.getOption("yAxisLabelWidth")+2*d.getOption("axisTickSize");f.reserveSpaceLeft(b)}if(d.getOption("drawXAxis")){var c;if(d.getOption("xAxisHeight")){c=d.getOption("xAxisHeight")}else{c=d.getOptionForAxis("axisLabelFontSize","x")+2*d.getOption("axisTickSize")}f.reserveSpaceBottom(c)}if(d.numAxes()==2){if(d.getOption("drawYAxis")){var b=d.getOption("yAxisLabelWidth")+2*d.getOption("axisTickSize");f.reserveSpaceRight(b)}}else{if(d.numAxes()>2){d.error("Only two y-axes are supported at this time. (Trying to use "+d.numAxes()+")")}}};a.prototype.detachLabels=function(){function b(d){for(var c=0;c0){var h=F.numAxes();for(D=0;Dd){s.style.bottom="0px"}else{s.style.top=z+"px"}if(E[0]===0){s.style.left=(G.x-F.getOption("yAxisLabelWidth")-F.getOption("axisTickSize"))+"px";s.style.textAlign="right"}else{if(E[0]==1){s.style.left=(G.x+G.w+F.getOption("axisTickSize"))+"px";s.style.textAlign="left"}}s.style.width=F.getOption("yAxisLabelWidth")+"px";v.appendChild(s);this.ylabels_.push(s)}var n=this.ylabels_[0];var k=F.getOptionForAxis("axisLabelFontSize","y");var q=parseInt(n.style.top,10)+k;if(q>d-k){n.style.top=(parseInt(n.style.top,10)-k/2)+"px"}}var c;if(F.getOption("drawAxesAtZero")){var w=F.toPercentXCoord(0);if(w>1||w<0||isNaN(w)){w=0}c=B(G.x+w*G.w)}else{c=B(G.x)}j.strokeStyle=F.getOptionForAxis("axisLineColor","y");j.lineWidth=F.getOptionForAxis("axisLineWidth","y");j.beginPath();j.moveTo(c,A(G.y));j.lineTo(c,A(G.y+G.h));j.closePath();j.stroke();if(F.numAxes()==2){j.strokeStyle=F.getOptionForAxis("axisLineColor","y2");j.lineWidth=F.getOptionForAxis("axisLineWidth","y2");j.beginPath();j.moveTo(A(G.x+G.w),A(G.y));j.lineTo(A(G.x+G.w),A(G.y+G.h));j.closePath();j.stroke()}}if(F.getOption("drawXAxis")){if(I.xticks){for(D=0;DJ){l=J-F.getOption("xAxisLabelWidth");s.style.textAlign="right"}if(l<0){l=0;s.style.textAlign="left"}s.style.left=l+"px";s.style.width=F.getOption("xAxisLabelWidth")+"px";v.appendChild(s);this.xlabels_.push(s)}}j.strokeStyle=F.getOptionForAxis("axisLineColor","x");j.lineWidth=F.getOptionForAxis("axisLineWidth","x");j.beginPath();var b;if(F.getOption("drawAxesAtZero")){var w=F.toPercentYCoord(0,0);if(w>1||w<0){w=1}b=A(G.y+w*G.h)}else{b=A(G.y+G.h)}j.moveTo(B(G.x),b);j.lineTo(B(G.x+G.w),b);j.closePath();j.stroke()}j.restore()};return a})();Dygraph.Plugins.ChartLabels=(function(){var c=function(){this.title_div_=null;this.xlabel_div_=null;this.ylabel_div_=null;this.y2label_div_=null};c.prototype.toString=function(){return"ChartLabels Plugin"};c.prototype.activate=function(d){return{layout:this.layout,didDrawChart:this.didDrawChart}};var b=function(d){var e=document.createElement("div");e.style.position="absolute";e.style.left=d.x+"px";e.style.top=d.y+"px";e.style.width=d.w+"px";e.style.height=d.h+"px";return e};c.prototype.detachLabels_=function(){var e=[this.title_div_,this.xlabel_div_,this.ylabel_div_,this.y2label_div_];for(var d=0;d=2)}}u=t.yticks;l.save();for(p=0;p=2);if(n){l.installPattern(d)}l.strokeStyle=q.getOptionForAxis("gridLineColor","x");l.lineWidth=q.getOptionForAxis("gridLineWidth","x");for(p=0;p":" ")}m=w.getOption("strokePattern",z[u]);s=d(m,q.color,f);r+=""+s+" "+z[u]+""}return r}var A=w.optionsViewForAxis_("x");var o=A("valueFormatter");r=o(p,A,z[0],w);if(r!==""){r+=":"}var v=[];var j=w.numAxes();for(u=0;u"}var q=w.getPropertiesForSeries(t.name);var n=v[q.axis-1];var y=n("valueFormatter");var e=y(t.yval,n,t.name,w);var h=(t.name==B)?" class='highlight'":"";r+=" "+t.name+": "+e+""}return r};d=function(s,h,r){var e=(/MSIE/.test(navigator.userAgent)&&!window.opera);if(e){return"—"}if(!s||s.length<=1){return'
          '}var l,k,f,o;var g=0,q=0;var p=[];var n;for(l=0;l<=s.length;l++){g+=s[l%s.length]}n=Math.floor(r/(g-s[0]));if(n>1){for(l=0;l
          '}}return m};return c})();Dygraph.Plugins.RangeSelector=(function(){var a=function(){this.isIE_=/MSIE/.test(navigator.userAgent)&&!window.opera;this.hasTouchInterface_=typeof(TouchEvent)!="undefined";this.isMobileDevice_=/mobile|android/gi.test(navigator.appVersion);this.interfaceCreated_=false};a.prototype.toString=function(){return"RangeSelector Plugin"};a.prototype.activate=function(b){this.dygraph_=b;this.isUsingExcanvas_=b.isUsingExcanvas_;if(this.getOption_("showRangeSelector")){this.createInterface_()}return{layout:this.reserveSpace_,predraw:this.renderStaticLayer_,didDrawChart:this.renderInteractiveLayer_}};a.prototype.destroy=function(){this.bgcanvas_=null;this.fgcanvas_=null;this.leftZoomHandle_=null;this.rightZoomHandle_=null;this.iePanOverlay_=null};a.prototype.getOption_=function(b){return this.dygraph_.getOption(b)};a.prototype.setDefaultOption_=function(b,c){return this.dygraph_.attrs_[b]=c};a.prototype.createInterface_=function(){this.createCanvases_();if(this.isUsingExcanvas_){this.createIEPanOverlay_()}this.createZoomHandles_();this.initInteraction_();if(this.getOption_("animatedZooms")){this.dygraph_.warn("Animated zooms and range selector are not compatible; disabling animatedZooms.");this.dygraph_.updateOptions({animatedZooms:false},true)}this.interfaceCreated_=true;this.addToGraph_()};a.prototype.addToGraph_=function(){var b=this.graphDiv_=this.dygraph_.graphDiv;b.appendChild(this.bgcanvas_);b.appendChild(this.fgcanvas_);b.appendChild(this.leftZoomHandle_);b.appendChild(this.rightZoomHandle_)};a.prototype.removeFromGraph_=function(){var b=this.graphDiv_;b.removeChild(this.bgcanvas_);b.removeChild(this.fgcanvas_);b.removeChild(this.leftZoomHandle_);b.removeChild(this.rightZoomHandle_);this.graphDiv_=null};a.prototype.reserveSpace_=function(b){if(this.getOption_("showRangeSelector")){b.reserveSpaceBottom(this.getOption_("rangeSelectorHeight")+4)}};a.prototype.renderStaticLayer_=function(){if(!this.updateVisibility_()){return}this.resize_();this.drawStaticLayer_()};a.prototype.renderInteractiveLayer_=function(){if(!this.updateVisibility_()||this.isChangingRange_){return}this.placeZoomHandles_();this.drawInteractiveLayer_()};a.prototype.updateVisibility_=function(){var b=this.getOption_("showRangeSelector");if(b){if(!this.interfaceCreated_){this.createInterface_()}else{if(!this.graphDiv_||!this.graphDiv_.parentNode){this.addToGraph_()}}}else{if(this.graphDiv_){this.removeFromGraph_();var c=this.dygraph_;setTimeout(function(){c.width_=0;c.resize()},1)}}return b};a.prototype.resize_=function(){function d(e,f){e.style.top=f.y+"px";e.style.left=f.x+"px";e.width=f.w;e.height=f.h;e.style.width=e.width+"px";e.style.height=e.height+"px"}var c=this.dygraph_.layout_.getPlotArea();var b=0;if(this.getOption_("drawXAxis")){b=this.getOption_("xAxisHeight")||(this.getOption_("axisLabelFontSize")+2*this.getOption_("axisTickSize"))}this.canvasRect_={x:c.x,y:c.y+c.h+b+4,w:c.w,h:this.getOption_("rangeSelectorHeight")};d(this.bgcanvas_,this.canvasRect_);d(this.fgcanvas_,this.canvasRect_)};a.prototype.createCanvases_=function(){this.bgcanvas_=Dygraph.createCanvas();this.bgcanvas_.className="dygraph-rangesel-bgcanvas";this.bgcanvas_.style.position="absolute";this.bgcanvas_.style.zIndex=9;this.bgcanvas_ctx_=Dygraph.getContext(this.bgcanvas_);this.fgcanvas_=Dygraph.createCanvas();this.fgcanvas_.className="dygraph-rangesel-fgcanvas";this.fgcanvas_.style.position="absolute";this.fgcanvas_.style.zIndex=9;this.fgcanvas_.style.cursor="default";this.fgcanvas_ctx_=Dygraph.getContext(this.fgcanvas_)};a.prototype.createIEPanOverlay_=function(){this.iePanOverlay_=document.createElement("div");this.iePanOverlay_.style.position="absolute";this.iePanOverlay_.style.backgroundColor="white";this.iePanOverlay_.style.filter="alpha(opacity=0)";this.iePanOverlay_.style.display="none";this.iePanOverlay_.style.cursor="move";this.fgcanvas_.appendChild(this.iePanOverlay_)};a.prototype.createZoomHandles_=function(){var b=new Image();b.className="dygraph-rangesel-zoomhandle";b.style.position="absolute";b.style.zIndex=10;b.style.visibility="hidden";b.style.cursor="col-resize";if(/MSIE 7/.test(navigator.userAgent)){b.width=7;b.height=14;b.style.backgroundColor="white";b.style.border="1px solid #333333"}else{b.width=9;b.height=16;b.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAQCAYAAADESFVDAAAAAXNSR0IArs4c6QAAAAZiS0dEANAAzwDP4Z7KegAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAd0SU1FB9sHGw0cMqdt1UwAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAaElEQVQoz+3SsRFAQBCF4Z9WJM8KCDVwownl6YXsTmCUsyKGkZzcl7zkz3YLkypgAnreFmDEpHkIwVOMfpdi9CEEN2nGpFdwD03yEqDtOgCaun7sqSTDH32I1pQA2Pb9sZecAxc5r3IAb21d6878xsAAAAAASUVORK5CYII="}if(this.isMobileDevice_){b.width*=2;b.height*=2}this.leftZoomHandle_=b;this.rightZoomHandle_=b.cloneNode(false)};a.prototype.initInteraction_=function(){var o=this;var i=this.isIE_?document:window;var u=0;var v=null;var s=false;var d=false;var g=!this.isMobileDevice_&&!this.isUsingExcanvas_;var k=new Dygraph.IFrameTarp();var p,f,r,j,w,h,x,t,q,c,l;var e,n,m;p=function(C){var B=o.dygraph_.xAxisExtremes();var z=(B[1]-B[0])/o.canvasRect_.w;var A=B[0]+(C.leftHandlePos-o.canvasRect_.x)*z;var y=B[0]+(C.rightHandlePos-o.canvasRect_.x)*z;return[A,y]};f=function(y){Dygraph.cancelEvent(y);s=true;u=y.clientX;v=y.target?y.target:y.srcElement;if(y.type==="mousedown"||y.type==="dragstart"){Dygraph.addEvent(i,"mousemove",r);Dygraph.addEvent(i,"mouseup",j)}o.fgcanvas_.style.cursor="col-resize";k.cover();return true};r=function(C){if(!s){return false}Dygraph.cancelEvent(C);var z=C.clientX-u;if(Math.abs(z)<4){return true}u=C.clientX;var B=o.getZoomHandleStatus_();var y;if(v==o.leftZoomHandle_){y=B.leftHandlePos+z;y=Math.min(y,B.rightHandlePos-v.width-3);y=Math.max(y,o.canvasRect_.x)}else{y=B.rightHandlePos+z;y=Math.min(y,o.canvasRect_.x+o.canvasRect_.w);y=Math.max(y,B.leftHandlePos+v.width+3)}var A=v.width/2;v.style.left=(y-A)+"px";o.drawInteractiveLayer_();if(g){w()}return true};j=function(y){if(!s){return false}s=false;k.uncover();Dygraph.removeEvent(i,"mousemove",r);Dygraph.removeEvent(i,"mouseup",j);o.fgcanvas_.style.cursor="default";if(!g){w()}return true};w=function(){try{var z=o.getZoomHandleStatus_();o.isChangingRange_=true;if(!z.isZoomed){o.dygraph_.resetZoom()}else{var y=p(z);o.dygraph_.doZoomXDates_(y[0],y[1])}}finally{o.isChangingRange_=false}};h=function(A){if(o.isUsingExcanvas_){return A.srcElement==o.iePanOverlay_}else{var z=o.leftZoomHandle_.getBoundingClientRect();var y=z.left+z.width/2;z=o.rightZoomHandle_.getBoundingClientRect();var B=z.left+z.width/2;return(A.clientX>y&&A.clientX=o.canvasRect_.x+o.canvasRect_.w){y=o.canvasRect_.x+o.canvasRect_.w;E=y-D}else{E+=z;y+=z}}var A=o.leftZoomHandle_.width/2;o.leftZoomHandle_.style.left=(E-A)+"px";o.rightZoomHandle_.style.left=(y-A)+"px";o.drawInteractiveLayer_();if(g){c()}return true};q=function(y){if(!d){return false}d=false;Dygraph.removeEvent(i,"mousemove",t);Dygraph.removeEvent(i,"mouseup",q);if(!g){c()}return true};c=function(){try{o.isChangingRange_=true;o.dygraph_.dateWindow_=p(o.getZoomHandleStatus_());o.dygraph_.drawGraph_(false)}finally{o.isChangingRange_=false}};l=function(y){if(s||d){return}var z=h(y)?"move":"default";if(z!=o.fgcanvas_.style.cursor){o.fgcanvas_.style.cursor=z}};e=function(y){if(y.type=="touchstart"&&y.targetTouches.length==1){if(f(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{if(y.type=="touchmove"&&y.targetTouches.length==1){if(r(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{j(y)}}};n=function(y){if(y.type=="touchstart"&&y.targetTouches.length==1){if(x(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{if(y.type=="touchmove"&&y.targetTouches.length==1){if(t(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{q(y)}}};m=function(B,A){var z=["touchstart","touchend","touchmove","touchcancel"];for(var y=0;y1&&v[t][1]!==null){m=typeof v[t][1]!="number";if(m){d=[];h=[];for(r=0;r0)){b=Math.min(b,g);c=Math.max(c,g)}}var o=0.25;if(u){c=Dygraph.log10(c);c+=c*o;b=Dygraph.log10(b);for(t=0;tthis.canvasRect_.x||b+11;b/=10){a=c.toString()+a}return a.toString()};Date.prototype.locale="en-GB";if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){Date.prototype.locale=document.getElementsByTagName("html")[0].lang}Date.ext.locales={};Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"};Date.ext.locales["en-US"]=Date.ext.locales.en;Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";Date.ext.locales["en-US"].x="%D";Date.ext.locales["en-US"].X="%r";Date.ext.locales["en-GB"]=Date.ext.locales.en;Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];Date.ext.formats={a:function(a){return Date.ext.locales[a.locale].a[a.getDay()]},A:function(a){return Date.ext.locales[a.locale].A[a.getDay()]},b:function(a){return Date.ext.locales[a.locale].b[a.getMonth()]},B:function(a){return Date.ext.locales[a.locale].B[a.getMonth()]},c:"toLocaleString",C:function(a){return Date.ext.util.xPad(parseInt(a.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(a){return Date.ext.util.xPad(parseInt(Date.ext.util.G(a)/100,10),0)},G:function(c){var e=c.getFullYear();var b=parseInt(Date.ext.formats.V(c),10);var a=parseInt(Date.ext.formats.W(c),10);if(a>b){e++}else{if(a===0&&b>=52){e--}}return e},H:["getHours","0"],I:function(b){var a=b.getHours()%12;return Date.ext.util.xPad(a===0?12:a,0)},j:function(c){var a=c-new Date(""+c.getFullYear()+"/1/1 GMT");a+=c.getTimezoneOffset()*60000;var b=parseInt(a/60000/60/24,10)+1;return Date.ext.util.xPad(b,0,100)},m:function(a){return Date.ext.util.xPad(a.getMonth()+1,0)},M:["getMinutes","0"],p:function(a){return Date.ext.locales[a.locale].p[a.getHours()>=12?1:0]},P:function(a){return Date.ext.locales[a.locale].P[a.getHours()>=12?1:0]},S:["getSeconds","0"],u:function(a){var b=a.getDay();return b===0?7:b},U:function(e){var a=parseInt(Date.ext.formats.j(e),10);var c=6-e.getDay();var b=parseInt((a+c)/7,10);return Date.ext.util.xPad(b,0)},V:function(e){var c=parseInt(Date.ext.formats.W(e),10);var a=(new Date(""+e.getFullYear()+"/1/1")).getDay();var b=c+(a>4||a<=1?0:1);if(b==53&&(new Date(""+e.getFullYear()+"/12/31")).getDay()<4){b=1}else{if(b===0){b=Date.ext.formats.V(new Date(""+(e.getFullYear()-1)+"/12/31"))}}return Date.ext.util.xPad(b,0)},w:"getDay",W:function(e){var a=parseInt(Date.ext.formats.j(e),10);var c=7-Date.ext.formats.u(e);var b=parseInt((a+c)/7,10);return Date.ext.util.xPad(b,0,10)},y:function(a){return Date.ext.util.xPad(a.getFullYear()%100,0)},Y:"getFullYear",z:function(c){var b=c.getTimezoneOffset();var a=Date.ext.util.xPad(parseInt(Math.abs(b/60),10),0);var e=Date.ext.util.xPad(b%60,0);return(b>0?"-":"+")+a+e},Z:function(a){return a.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(a){return"%"}};Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};Date.ext.aggregates.z=Date.ext.formats.z(new Date());Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());Date.ext.unsupported={};Date.prototype.strftime=function(a){if(!(this.locale in Date.ext.locales)){if(this.locale.replace(/-[a-zA-Z]+$/,"") in Date.ext.locales){this.locale=this.locale.replace(/-[a-zA-Z]+$/,"")}else{this.locale="en-GB"}}var c=this;while(a.match(/%[cDhnrRtTxXzZ]/)){a=a.replace(/%([cDhnrRtTxXzZ])/g,function(e,d){var g=Date.ext.aggregates[d];return(g=="locale"?Date.ext.locales[c.locale][d]:g)})}var b=a.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g,function(e,d){var g=Date.ext.formats[d];if(typeof(g)=="string"){return c[g]()}else{if(typeof(g)=="function"){return g.call(c,c)}else{if(typeof(g)=="object"&&typeof(g[0])=="string"){return Date.ext.util.xPad(c[g[0]](),g[1])}else{return d}}}});c=null;return b};"use strict";function RGBColorParser(f){this.ok=false;if(f.charAt(0)=="#"){f=f.substr(1,6)}f=f.replace(/ /g,"");f=f.toLowerCase();var b={dodgerBlue:"#1f77b4",vividOrange:"#ff7f0e",forestGreen:"#2ca02c",greenishRed:"#8c864b",desaturatedViolet:"#9467bd",darkModerateRed:"#8c564b",softPink:"#e377c2",darkGray:"#7f7f7f",strongYellow:"#bcbd22",strongCyan:"#17becf",vividRed:"#dc143c",darkMagenta:"#800080",blue:"#0000FF",darkLimeGreen:"#008000",reddishOrange:"#D2691E",red:"#FF0000",black:"#000000",pink:"#DB7093",pureMagenta:"#FF00FF",softBlue:"#7B68EE",strongBlue:"#1f77b6",verySoftCyan:"#9edae5",darkBlue:"#393b79",darkModerateBlue:"#5254a3",slightlyDesaturatedBlue:"#6b6ecf",verySoftBlue:"#9c9ede",darkGreen:"#637939",darkModerateGreen:"#8ca252",slightlyDesaturatedGreen:"#b5cf6b",desaturatedGreen:"#cedb9c",aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};for(var g in b){if(f==g){f=b[g]}}var e=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(i){return[parseInt(i[1]),parseInt(i[2]),parseInt(i[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(i){return[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(i){return[parseInt(i[1]+i[1],16),parseInt(i[2]+i[2],16),parseInt(i[3]+i[3],16)]}}];for(var c=0;c255)?255:this.r);this.g=(this.g<0||isNaN(this.g))?0:((this.g>255)?255:this.g);this.b=(this.b<0||isNaN(this.b))?0:((this.b>255)?255:this.b);this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"};this.toHex=function(){var l=this.r.toString(16);var k=this.g.toString(16);var i=this.b.toString(16);if(l.length==1){l="0"+l}if(k.length==1){k="0"+k}if(i.length==1){i="0"+i}return"#"+l+k+i}}function printStackTrace(b){b=b||{guess:true};var c=b.e||null,e=!!b.guess;var d=new printStackTrace.implementation(),a=d.run(c);return(e)?d.guessAnonymousFunctions(a):a}printStackTrace.implementation=function(){};printStackTrace.implementation.prototype={run:function(a,b){a=a||this.createException();b=b||this.mode(a);if(b==="other"){return this.other(arguments.callee)}else{return this[b](a)}},createException:function(){try{this.undef()}catch(a){return a}},mode:function(a){if(a["arguments"]&&a.stack){return"chrome"}else{if(typeof a.message==="string"&&typeof window!=="undefined"&&window.opera){if(!a.stacktrace){return"opera9"}if(a.message.indexOf("\n")>-1&&a.message.split("\n").length>a.stacktrace.split("\n").length){return"opera9"}if(!a.stack){return"opera10a"}if(a.stacktrace.indexOf("called from line")<0){return"opera10b"}return"opera11"}else{if(a.stack){return"firefox"}}}return"other"},instrumentFunction:function(b,d,e){b=b||window;var a=b[d];b[d]=function c(){e.call(this,printStackTrace().slice(4));return b[d]._instrumented.apply(this,arguments)};b[d]._instrumented=a},deinstrumentFunction:function(a,b){if(a[b].constructor===Function&&a[b]._instrumented&&a[b]._instrumented.constructor===Function){a[b]=a[b]._instrumented}},chrome:function(b){var a=(b.stack+"\n").replace(/^\S[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^([^\(]+?)([\n$])/gm,"{anonymous}()@$1$2").replace(/^Object.\s*\(([^\)]+)\)/gm,"{anonymous}()@$1").split("\n");a.pop();return a},firefox:function(a){return a.stack.replace(/(?:\n@:0)?\s+$/m,"").replace(/^\(/gm,"{anonymous}(").split("\n")},opera11:function(g){var a="{anonymous}",h=/^.*line (\d+), column (\d+)(?: in (.+))? in (\S+):$/;var k=g.stacktrace.split("\n"),l=[];for(var c=0,f=k.length;c/,"$1").replace(//,a);l.push(b+"@"+j+" -- "+k[c+1].replace(/^\s+/,""))}}return l},opera10b:function(g){var a="{anonymous}",h=/^(.*)@(.+):(\d+)$/;var j=g.stacktrace.split("\n"),k=[];for(var c=0,f=j.length;c=0){l=l.substr(0,c)}if(l){b=l+b;d=k.exec(b);if(d&&d[1]){return d[1]}d=g.exec(b);if(d&&d[1]){return d[1]}d=h.exec(b);if(d&&d[1]){return d[1]}}}return"(?)"}};CanvasRenderingContext2D.prototype.installPattern=function(e){if(typeof(this.isPatternInstalled)!=="undefined"){throw"Must un-install old line pattern before installing a new one."}this.isPatternInstalled=true;var g=[0,0];var b=[];var f=this.beginPath;var d=this.lineTo;var c=this.moveTo;var a=this.stroke;this.uninstallPattern=function(){this.beginPath=f;this.lineTo=d;this.moveTo=c;this.stroke=a;this.uninstallPattern=undefined;this.isPatternInstalled=undefined};this.beginPath=function(){b=[];f.call(this)};this.moveTo=function(h,i){b.push([[h,i]]);c.call(this,h,i)};this.lineTo=function(h,j){var i=b[b.length-1];i.push([h,j])};this.stroke=function(){if(b.length===0){a.call(this);return}for(var p=0;pt){var q=e[m];if(g[1]){t+=g[1]}else{t+=q}if(t>r){g=[m,t-r];t=r}else{g=[(m+1)%e.length,0]}if(m%2===0){d.call(this,t,0)}else{c.call(this,t,0)}m=(m+1)%e.length}this.restore();l=h,u=s}}a.call(this);b=[]}};CanvasRenderingContext2D.prototype.uninstallPattern=function(){throw"Must install a line pattern before uninstalling it."};var DygraphOptions=(function(){var a=function(b){this.dygraph_=b;this.yAxes_=[];this.xAxis_={};this.series_={};this.global_=this.dygraph_.attrs_;this.user_=this.dygraph_.user_attrs_||{};this.labels_=[];this.highlightSeries_=this.get("highlightSeriesOpts")||{};this.reparseSeries()};a.AXIS_STRING_MAPPINGS_={y:0,Y:0,y1:0,Y1:0,y2:1,Y2:1};a.axisToIndex_=function(b){if(typeof(b)=="string"){if(a.AXIS_STRING_MAPPINGS_.hasOwnProperty(b)){return a.AXIS_STRING_MAPPINGS_[b]}throw"Unknown axis : "+b}if(typeof(b)=="number"){if(b===0||b===1){return b}throw"Dygraphs only supports two y-axes, indexed from 0-1."}if(b){throw"Unknown axis : "+b}return 0};a.prototype.reparseSeries=function(){var g=this.get("labels");if(!g){return}this.labels_=g.slice(1);this.yAxes_=[{series:[],options:{}}];this.xAxis_={options:{}};this.series_={};var h=!this.user_.series;if(h){var c=0;for(var j=0;j1){Dygraph.update(this.yAxes_[1].options,f.y2||{})}Dygraph.update(this.xAxis_.options,f.x||{})};a.prototype.get=function(c){var b=this.getGlobalUser_(c);if(b!==null){return b}return this.getGlobalDefault_(c)};a.prototype.getGlobalUser_=function(b){if(this.user_.hasOwnProperty(b)){return this.user_[b]}return null};a.prototype.getGlobalDefault_=function(b){if(this.global_.hasOwnProperty(b)){return this.global_[b]}if(Dygraph.DEFAULT_ATTRS.hasOwnProperty(b)){return Dygraph.DEFAULT_ATTRS[b]}return null};a.prototype.getForAxis=function(d,e){var f;var i;if(typeof(e)=="number"){f=e;i=f===0?"y":"y2"}else{if(e=="y1"){e="y"}if(e=="y"){f=0}else{if(e=="y2"){f=1}else{if(e=="x"){f=-1}else{throw"Unknown axis "+e}}}i=e}var g=(f==-1)?this.xAxis_:this.yAxes_[f];if(g){var h=g.options;if(h.hasOwnProperty(d)){return h[d]}}var c=this.getGlobalUser_(d);if(c!==null){return c}var b=Dygraph.DEFAULT_ATTRS.axes[i];if(b.hasOwnProperty(d)){return b[d]}return this.getGlobalDefault_(d)};a.prototype.getForSeries=function(c,e){if(e===this.dygraph_.getHighlightSeries()){if(this.highlightSeries_.hasOwnProperty(c)){return this.highlightSeries_[c]}}if(!this.series_.hasOwnProperty(e)){throw"Unknown series: "+e}var d=this.series_[e];var b=d.options;if(b.hasOwnProperty(c)){return b[c]}return this.getForAxis(c,d.yAxis)};a.prototype.numAxes=function(){return this.yAxes_.length};a.prototype.axisForSeries=function(b){return this.series_[b].yAxis};a.prototype.axisOptions=function(b){return this.yAxes_[b].options};a.prototype.seriesForAxis=function(b){return this.yAxes_[b].series};a.prototype.seriesNames=function(){return this.labels_};return a})();"use strict";var DygraphLayout=function(a){this.dygraph_=a;this.points=[];this.setNames=[];this.annotations=[];this.yAxes_=null;this.xTicks_=null;this.yTicks_=null};DygraphLayout.prototype.attr_=function(a){return this.dygraph_.attr_(a)};DygraphLayout.prototype.addDataset=function(a,b){this.points.push(b);this.setNames.push(a)};DygraphLayout.prototype.getPlotArea=function(){return this.area_};DygraphLayout.prototype.computePlotArea=function(){var a={x:0,y:0};a.w=this.dygraph_.width_-a.x-this.attr_("rightGap");a.h=this.dygraph_.height_;var b={chart_div:this.dygraph_.graphDiv,reserveSpaceLeft:function(c){var d={x:a.x,y:a.y,w:c,h:a.h};a.x+=c;a.w-=c;return d},reserveSpaceRight:function(c){var d={x:a.x+a.w-c,y:a.y,w:c,h:a.h};a.w-=c;return d},reserveSpaceTop:function(c){var d={x:a.x,y:a.y,w:a.w,h:c};a.y+=c;a.h-=c;return d},reserveSpaceBottom:function(c){var d={x:a.x,y:a.y+a.h-c,w:a.w,h:c};a.h-=c;return d},chartRect:function(){return{x:a.x,y:a.y,w:a.w,h:a.h}}};this.dygraph_.cascadeEvents_("layout",b);this.area_=a};DygraphLayout.prototype.setAnnotations=function(d){this.annotations=[];var e=this.attr_("xValueParser")||function(a){return a};for(var c=0;c=0)&&(f<=1)){this.xticks.push([f,b])}}this.yticks=[];for(d=0;d=0)&&(f<=1)){this.yticks.push([d,f,b])}}}};DygraphLayout.prototype._evaluateAnnotations=function(){var d;var g={};for(d=0;d=0;e--){if(f.childNodes[e].className==g){f.removeChild(f.childNodes[e])}}var c=document.bgColor;var d=this.dygraph_.graphDiv;while(d!=document){var a=d.currentStyle.backgroundColor;if(a&&a!="transparent"){c=a;break}d=d.parentNode}function b(j){if(j.w===0||j.h===0){return}var i=document.createElement("div");i.className=g;i.style.backgroundColor=c;i.style.position="absolute";i.style.left=j.x+"px";i.style.top=j.y+"px";i.style.width=j.w+"px";i.style.height=j.h+"px";f.appendChild(i)}var h=this.area;b({x:0,y:0,w:h.x,h:this.height});b({x:h.x,y:0,w:this.width-h.x,h:h.y});b({x:h.x+h.w,y:0,w:this.width-h.x-h.w,h:this.height});b({x:h.x,y:h.y+h.h,w:this.width-h.x,h:this.height-h.h-h.y})};DygraphCanvasRenderer._getIteratorPredicate=function(a){return a?DygraphCanvasRenderer._predicateThatSkipsEmptyPoints:null};DygraphCanvasRenderer._predicateThatSkipsEmptyPoints=function(b,a){return b[a].yval!==null};DygraphCanvasRenderer._drawStyledLine=function(i,a,m,q,f,n,d){var h=i.dygraph;var c=h.getOption("stepPlot",i.setName);if(!Dygraph.isArrayLike(q)){q=null}var l=h.getOption("drawGapEdgePoints",i.setName);var o=i.points;var k=Dygraph.createIterator(o,0,o.length,DygraphCanvasRenderer._getIteratorPredicate(h.getOption("connectSeparatedPoints")));var j=q&&(q.length>=2);var p=i.drawingContext;p.save();if(j){p.installPattern(q)}var b=DygraphCanvasRenderer._drawSeries(i,k,m,d,f,l,c,a);DygraphCanvasRenderer._drawPointsOnLine(i,b,n,a,d);if(j){p.uninstallPattern()}p.restore()};DygraphCanvasRenderer._drawSeries=function(v,t,m,h,p,s,g,q){var b=null;var w=null;var k=null;var j;var o;var l=[];var f=true;var n=v.drawingContext;n.beginPath();n.strokeStyle=q;n.lineWidth=m;var c=t.array_;var u=t.end_;var a=t.predicate_;for(var r=t.start_;r=0;C--){if(!D.visibility()[C]){I.splice(C,1)}}var h=(function(){for(var e=0;e=0;u--){var n=I[u];if(!D.getOption("fillGraph",n)){continue}var p=D.getOption("stepPlot",n);var x=q[u];var f=D.axisPropertiesForSeries(n);var d=1+f.minyval*f.yscale;if(d<0){d=0}else{if(d>1){d=1}}d=E.h*d+E.y;var B=c[u];var A=Dygraph.createIterator(B,0,B.length,DygraphCanvasRenderer._getIteratorPredicate(D.getOption("connectSeparatedPoints")));var m=NaN;var l=[-1,-1];var t;var b=new RGBColorParser(x);var H="rgba("+b.r+","+b.g+","+b.b+","+y+")";w.fillStyle=H;w.beginPath();var j,G=true;while(A.hasNext){var v=A.next();if(!Dygraph.isOK(v.y)){m=NaN;if(v.y_stacked!==null&&!isNaN(v.y_stacked)){s[v.canvasx]=E.h*v.y_stacked+E.y}continue}if(k){if(!G&&j==v.xval){continue}else{G=false;j=v.xval}a=s[v.canvasx];var o;if(a===undefined){o=d}else{if(r){o=a[0]}else{o=a}}t=[v.canvasy,o];if(p){if(l[0]===-1){s[v.canvasx]=[v.canvasy,d]}else{s[v.canvasx]=[v.canvasy,l[0]]}}else{s[v.canvasx]=v.canvasy}}else{t=[v.canvasy,d]}if(!isNaN(m)){w.moveTo(m,l[0]);if(p){w.lineTo(v.canvasx,l[0])}else{w.lineTo(v.canvasx,t[0])}if(r&&a){w.lineTo(v.canvasx,a[1])}else{w.lineTo(v.canvasx,t[1])}w.lineTo(m,l[1]);w.closePath()}l=t;m=v.canvasx}r=p;w.fill()}};"use strict";var Dygraph=function(d,c,b,a){this.is_initial_draw_=true;this.readyFns_=[];if(a!==undefined){this.warn("Using deprecated four-argument dygraph constructor");this.__old_init__(d,c,b,a)}else{this.__init__(d,c,b)}};Dygraph.NAME="Dygraph";Dygraph.VERSION="1.0.0";Dygraph.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};Dygraph.toString=function(){return this.__repr__()};Dygraph.DEFAULT_ROLL_PERIOD=1;Dygraph.DEFAULT_WIDTH=480;Dygraph.DEFAULT_HEIGHT=320;Dygraph.ANIMATION_STEPS=12;Dygraph.ANIMATION_DURATION=200;Dygraph.KMB_LABELS=["K","M","B","T","Q"];Dygraph.KMG2_BIG_LABELS=["k","M","G","T","P","E","Z","Y"];Dygraph.KMG2_SMALL_LABELS=["m","u","n","p","f","a","z","y"];Dygraph.numberValueFormatter=function(s,a,u,l){var e=a("sigFigs");if(e!==null){return Dygraph.floatFormat(s,e)}var c=a("digitsAfterDecimal");var o=a("maxNumberWidth");var b=a("labelsKMB");var r=a("labelsKMG2");var q;if(s!==0&&(Math.abs(s)>=Math.pow(10,o)||Math.abs(s)=0;h--,d/=f){if(p>=d){q=Dygraph.round_(s/d,c)+t[h];break}}if(r){var i=String(s.toExponential()).split("e-");if(i.length===2&&i[1]>=3&&i[1]<=24){if(i[1]%3>0){q=Dygraph.round_(i[0]/Dygraph.pow(10,(i[1]%3)),c)}else{q=Number(i[0]).toFixed(2)}q+=m[Math.floor(i[1]/3)-1]}}}return q};Dygraph.numberAxisLabelFormatter=function(a,d,c,b){return Dygraph.numberValueFormatter(a,c,b)};Dygraph.dateString_=function(e){var i=Dygraph.zeropad;var h=new Date(e);var f=""+h.getFullYear();var g=i(h.getMonth()+1);var a=i(h.getDate());var c="";var b=h.getHours()*3600+h.getMinutes()*60+h.getSeconds();if(b){c=" "+Dygraph.hmsString_(e)}return f+"/"+g+"/"+a+c};Dygraph.dateAxisFormatter=function(b,c){if(c>=Dygraph.DECADAL){return b.strftime("%Y")}else{if(c>=Dygraph.MONTHLY){return b.strftime("%b %y")}else{var a=b.getHours()*3600+b.getMinutes()*60+b.getSeconds()+b.getMilliseconds();if(a===0||c>=Dygraph.DAILY){return new Date(b.getTime()+3600*1000).strftime("%d%b")}else{return Dygraph.hmsString_(b.getTime())}}}};Dygraph.Plotters=DygraphCanvasRenderer._Plotters;Dygraph.DEFAULT_ATTRS={highlightCircleSize:3,highlightSeriesOpts:null,highlightSeriesBackgroundAlpha:0.5,labelsDivWidth:250,labelsDivStyles:{},labelsSeparateLines:false,labelsShowZeroValues:true,labelsKMB:false,labelsKMG2:false,showLabelsOnHighlight:true,digitsAfterDecimal:2,maxNumberWidth:6,sigFigs:null,strokeWidth:1,strokeBorderWidth:0,strokeBorderColor:"white",axisTickSize:3,axisLabelFontSize:14,xAxisLabelWidth:50,yAxisLabelWidth:50,rightGap:5,showRoller:false,xValueParser:Dygraph.dateParser,delimiter:",",sigma:2,errorBars:false,fractions:false,wilsonInterval:true,customBars:false,fillGraph:false,fillAlpha:0.15,connectSeparatedPoints:false,stackedGraph:false,stackedGraphNaNFill:"all",hideOverlayOnMouseOut:true,legend:"onmouseover",stepPlot:false,avoidMinZero:false,xRangePad:0,yRangePad:null,drawAxesAtZero:false,titleHeight:28,xLabelHeight:18,yLabelWidth:18,drawXAxis:true,drawYAxis:true,axisLineColor:"black",axisLineWidth:0.3,gridLineWidth:0.3,axisLabelColor:"black",axisLabelFont:"Arial",axisLabelWidth:50,drawYGrid:true,drawXGrid:true,gridLineColor:"rgb(128,128,128)",interactionModel:null,animatedZooms:false,showRangeSelector:false,rangeSelectorHeight:40,rangeSelectorPlotStrokeColor:"#808FAB",rangeSelectorPlotFillColor:"#A7B1C4",plotter:[Dygraph.Plotters.fillPlotter,Dygraph.Plotters.errorPlotter,Dygraph.Plotters.linePlotter],plugins:[],axes:{x:{pixelsPerLabel:60,axisLabelFormatter:Dygraph.dateAxisFormatter,valueFormatter:Dygraph.dateString_,drawGrid:true,independentTicks:true,ticker:null},y:{pixelsPerLabel:30,valueFormatter:Dygraph.numberValueFormatter,axisLabelFormatter:Dygraph.numberAxisLabelFormatter,drawGrid:true,independentTicks:true,ticker:null},y2:{pixelsPerLabel:30,valueFormatter:Dygraph.numberValueFormatter,axisLabelFormatter:Dygraph.numberAxisLabelFormatter,drawGrid:false,independentTicks:false,ticker:null}}};Dygraph.HORIZONTAL=1;Dygraph.VERTICAL=2;Dygraph.PLUGINS=[];Dygraph.addedAnnotationCSS=false;Dygraph.prototype.__old_init__=function(f,d,e,b){if(e!==null){var a=["Date"];for(var c=0;c=0;d--){var f=a[d][0];var h=a[d][1];h.call(f,g);if(g.propagationStopped){break}}}return g.defaultPrevented};Dygraph.prototype.isZoomed=function(a){if(a===null||a===undefined){return this.zoomed_x_||this.zoomed_y_}if(a==="x"){return this.zoomed_x_}if(a==="y"){return this.zoomed_y_}throw"axis parameter is ["+a+"] must be null, 'x' or 'y'."};Dygraph.prototype.toString=function(){var a=this.maindiv_;var b=(a&&a.id)?a.id:a;return"[Dygraph "+b+"]"};Dygraph.prototype.attr_=function(b,a){return a?this.attributes_.getForSeries(b,a):this.attributes_.get(b)};Dygraph.prototype.getOption=function(a,b){return this.attr_(a,b)};Dygraph.prototype.getOptionForAxis=function(a,b){return this.attributes_.getForAxis(a,b)};Dygraph.prototype.optionsViewForAxis_=function(b){var a=this;return function(c){var d=a.user_attrs_.axes;if(d&&d[b]&&d[b].hasOwnProperty(c)){return d[b][c]}if(typeof(a.user_attrs_[c])!="undefined"){return a.user_attrs_[c]}d=a.attrs_.axes;if(d&&d[b]&&d[b].hasOwnProperty(c)){return d[b][c]}if(b=="y"&&a.axes_[0].hasOwnProperty(c)){return a.axes_[0][c]}else{if(b=="y2"&&a.axes_[1].hasOwnProperty(c)){return a.axes_[1][c]}}return a.attr_(c)}};Dygraph.prototype.rollPeriod=function(){return this.rollPeriod_};Dygraph.prototype.xAxisRange=function(){return this.dateWindow_?this.dateWindow_:this.xAxisExtremes()};Dygraph.prototype.xAxisExtremes=function(){var d=this.attr_("xRangePad")/this.plotter_.area.w;if(this.numRows()===0){return[0-d,1+d]}var c=this.rawData_[0][0];var b=this.rawData_[this.rawData_.length-1][0];if(d){var a=b-c;c-=a*d;b+=a*d}return[c,b]};Dygraph.prototype.yAxisRange=function(a){if(typeof(a)=="undefined"){a=0}if(a<0||a>=this.axes_.length){return null}var b=this.axes_[a];return[b.computedValueRange[0],b.computedValueRange[1]]};Dygraph.prototype.yAxisRanges=function(){var a=[];for(var b=0;bthis.rawData_.length){return null}if(a<0||a>this.rawData_[b].length){return null}return this.rawData_[b][a]};Dygraph.prototype.createInterface_=function(){var a=this.maindiv_;this.graphDiv=document.createElement("div");this.graphDiv.style.textAlign="left";a.appendChild(this.graphDiv);this.canvas_=Dygraph.createCanvas();this.canvas_.style.position="absolute";this.hidden_=this.createPlotKitCanvas_(this.canvas_);this.resizeElements_();this.canvas_ctx_=Dygraph.getContext(this.canvas_);this.hidden_ctx_=Dygraph.getContext(this.hidden_);this.graphDiv.appendChild(this.hidden_);this.graphDiv.appendChild(this.canvas_);this.mouseEventElement_=this.createMouseEventElement_();this.layout_=new DygraphLayout(this);var b=this;this.mouseMoveHandler_=function(c){b.mouseMove_(c)};this.mouseOutHandler_=function(f){var d=f.target||f.fromElement;var c=f.relatedTarget||f.toElement;if(Dygraph.isNodeContainedBy(d,b.graphDiv)&&!Dygraph.isNodeContainedBy(c,b.graphDiv)){b.mouseOut_(f)}};this.addAndTrackEvent(window,"mouseout",this.mouseOutHandler_);this.addAndTrackEvent(this.mouseEventElement_,"mousemove",this.mouseMoveHandler_);if(!this.resizeHandler_){this.resizeHandler_=function(c){b.resize()};this.addAndTrackEvent(window,"resize",this.resizeHandler_)}};Dygraph.prototype.resizeElements_=function(){this.graphDiv.style.width=this.width_+"px";this.graphDiv.style.height=this.height_+"px";this.canvas_.width=this.width_;this.canvas_.height=this.height_;this.canvas_.style.width=this.width_+"px";this.canvas_.style.height=this.height_+"px";this.hidden_.width=this.width_;this.hidden_.height=this.height_;this.hidden_.style.width=this.width_+"px";this.hidden_.style.height=this.height_+"px"};Dygraph.prototype.destroy=function(){this.canvas_ctx_.restore();this.hidden_ctx_.restore();var a=function(c){while(c.hasChildNodes()){a(c.firstChild);c.removeChild(c.firstChild)}};this.removeTrackedEvents_();Dygraph.removeEvent(window,"mouseout",this.mouseOutHandler_);Dygraph.removeEvent(this.mouseEventElement_,"mousemove",this.mouseMoveHandler_);Dygraph.removeEvent(window,"resize",this.resizeHandler_);this.resizeHandler_=null;a(this.maindiv_);var b=function(c){for(var d in c){if(typeof(c[d])==="object"){c[d]=null}}};b(this.layout_);b(this.plotter_);b(this)};Dygraph.prototype.createPlotKitCanvas_=function(a){var b=Dygraph.createCanvas();b.style.position="absolute";b.style.top=a.style.top;b.style.left=a.style.left;b.width=this.width_;b.height=this.height_;b.style.width=this.width_+"px";b.style.height=this.height_+"px";return b};Dygraph.prototype.createMouseEventElement_=function(){if(this.isUsingExcanvas_){var a=document.createElement("div");a.style.position="absolute";a.style.backgroundColor="white";a.style.filter="alpha(opacity=0)";a.style.width=this.width_+"px";a.style.height=this.height_+"px";this.graphDiv.appendChild(a);return a}else{return this.canvas_}};Dygraph.prototype.setColors_=function(){var g=this.getLabels();var e=g.length-1;this.colors_=[];this.colorsMap_={};var a=this.attr_("colors");var d;if(!a){var c=this.attr_("colorSaturation")||1;var b=this.attr_("colorValue")||0.5;var k=Math.ceil(e/2);for(d=1;d<=e;d++){if(!this.visibility()[d-1]){continue}var h=d%2?Math.ceil(d/2):(k+d/2);var f=(1*h/(1+e));var j=Dygraph.hsvToRGB(f,c,b);this.colors_.push(j);this.colorsMap_[g[d]]=j}}else{for(d=0;d=0;--b){var m=this.layout_.points[b];for(var g=0;g=l.length){continue}var m=l[e];if(!Dygraph.isValidPoint(m)){continue}var j=m.canvasy;if(i>m.canvasx&&e+10){var a=(i-m.canvasx)/o;j+=a*(k.canvasy-m.canvasy)}}}else{if(i0){var n=l[e-1];if(Dygraph.isValidPoint(n)){var o=m.canvasx-n.canvasx;if(o>0){var a=(m.canvasx-i)/o;j+=a*(n.canvasy-m.canvasy)}}}}if(d===0||j=0){var j=0;var k=this.attr_("labels");for(h=1;hj){j=c}}var l=this.previousVerticalX_;n.clearRect(l-j-1,0,2*j+2,this.height_)}}if(this.isUsingExcanvas_&&this.currentZoomRectArgs_){Dygraph.prototype.drawZoomRect_.apply(this,this.currentZoomRectArgs_)}if(this.selPoints_.length>0){var b=this.selPoints_[0].canvasx;n.save();for(h=0;h=0){if(f!=this.lastRow_){e=true}this.lastRow_=f;for(var d=0;d=0){e=true}this.lastRow_=-1}if(this.selPoints_.length){this.lastx_=this.selPoints_[0].xval}else{this.lastx_=-1}if(h!==undefined){if(this.highlightSet_!==h){e=true}this.highlightSet_=h}if(g!==undefined){this.lockedSet_=g}if(e){this.updateSelection_(undefined)}return e};Dygraph.prototype.mouseOut_=function(a){if(this.attr_("unhighlightCallback")){this.attr_("unhighlightCallback")(a)}if(this.attr_("hideOverlayOnMouseOut")&&!this.lockedSet_){this.clearSelection()}};Dygraph.prototype.clearSelection=function(){this.cascadeEvents_("deselect",{});this.lockedSet_=false;if(this.fadeLevel){this.animateSelection_(-1);return}this.canvas_ctx_.clearRect(0,0,this.width_,this.height_);this.fadeLevel=0;this.selPoints_=[];this.lastx_=-1;this.lastRow_=-1;this.highlightSet_=null};Dygraph.prototype.getSelection=function(){if(!this.selPoints_||this.selPoints_.length<1){return -1}for(var c=0;cg){a=g}if(ef){f=e}if(h===null||af){f=g}if(h===null||g=i){return}for(var p=i;po[1]){o[1]=a}if(a=1;u--){if(!this.visibility()[u-1]){continue}if(f){l=w[u];var z=f[0];var j=f[1];var g=null,y=null;for(r=0;r=z&&g===null){g=r}if(l[r][0]<=j){y=r}}if(g===null){g=0}var e=g;var d=true;while(d&&e>0){e--;d=b(l[e])}if(y===null){y=l.length-1}var c=y;d=true;while(d&&c0){this.setIndexByName_[g[0]]=0}var e=0;for(var f=1;f0){var a=this.readyFns_.pop();a(this)}}};Dygraph.prototype.computeYAxes_=function(){var b,d,c,f,a;if(this.axes_!==undefined&&this.user_attrs_.hasOwnProperty("valueRange")===false){b=[];for(c=0;c0){D=0}if(A<0){A=0}}if(D==Infinity){D=0}if(A==-Infinity){A=1}x=A-D;if(x===0){if(A!==0){x=Math.abs(A)}else{A=1;x=1}}var h,H;if(C){if(b){h=A+B*x;H=D}else{var E=Math.exp(Math.log(x)*B);h=A*E;H=D/E}}else{h=A+B*x;H=D-B*x;if(b&&!this.attr_("avoidMinZero")){if(H<0&&D>=0){H=0}if(h>0&&A<=0){h=0}}}c.extremeRange=[H,h]}if(c.valueWindow){c.computedValueRange=[c.valueWindow[0],c.valueWindow[1]]}else{if(c.valueRange){var e=g(c.valueRange[0])?c.extremeRange[0]:c.valueRange[0];var d=g(c.valueRange[1])?c.extremeRange[1]:c.valueRange[1];if(!b){if(c.logscale){var E=Math.exp(Math.log(x)*B);e*=E;d/=E}else{x=d-e;e-=x*B;d+=x*B}}c.computedValueRange=[e,d]}else{c.computedValueRange=c.extremeRange}}if(l){c.independentTicks=l;var r=this.optionsViewForAxis_("y"+(y?"2":""));var F=r("ticker");c.ticks=F(c.computedValueRange[0],c.computedValueRange[1],this.height_,r,this);if(!p){p=c}}}if(p===undefined){throw ('Configuration Error: At least one axis has to have the "independentTicks" option activated.')}for(var y=0;y=0){k-=l[z-d][1][0];h-=l[z-d][1][1]}var C=l[z][0];var w=h?k/h:0;if(this.attr_("errorBars")){if(this.attr_("wilsonInterval")){if(h){var s=w<0?0:w,u=h;var B=t*Math.sqrt(s*(1-s)/u+t*t/(4*u*u));var a=1+t*t/h;G=(s+t*t/(2*h)-B)/a;o=(s+t*t/(2*h)+B)/a;b[z]=[C,[s*e,(s-G)*e,(o-s)*e]]}else{b[z]=[C,[0,0,0]]}}else{A=h?t*Math.sqrt(w*(1-w)/h):1;b[z]=[C,[e*w,e*A,e*A]]}}else{b[z]=[C,e*w]}}}else{if(this.attr_("customBars")){G=0;var D=0;o=0;var g=0;for(z=0;z=0){var r=l[z-d];if(r[1][1]!==null&&!isNaN(r[1][1])){G-=r[1][0];D-=r[1][1];o-=r[1][2];g-=1}}if(g){b[z]=[l[z][0],[1*D/g,1*(D-G)/g,1*(o-D)/g]]}else{b[z]=[l[z][0],[null,null,null]]}}}else{if(!this.attr_("errorBars")){if(d==1){return l}for(z=0;z0&&(b[c-1]!="e"&&b[c-1]!="E"))||b.indexOf("/")>=0||isNaN(parseFloat(b))){a=true}else{if(b.length==8&&b>"19700101"&&b<"20371231"){a=true}}this.setXAxisOptions_(a)};Dygraph.prototype.setXAxisOptions_=function(a){if(a){this.attrs_.xValueParser=Dygraph.dateParser;this.attrs_.axes.x.valueFormatter=Dygraph.dateString_;this.attrs_.axes.x.ticker=Dygraph.dateTicker;this.attrs_.axes.x.axisLabelFormatter=Dygraph.dateAxisFormatter}else{this.attrs_.xValueParser=function(b){return parseFloat(b)};this.attrs_.axes.x.valueFormatter=function(b){return b};this.attrs_.axes.x.ticker=Dygraph.numericLinearTicks;this.attrs_.axes.x.axisLabelFormatter=this.attrs_.axes.x.valueFormatter}};Dygraph.prototype.parseFloat_=function(a,c,b){var e=parseFloat(a);if(!isNaN(e)){return e}if(/^ *$/.test(a)){return null}if(/^ *nan *$/i.test(a)){return NaN}var d="Unable to parse '"+a+"' as a number";if(b!==null&&c!==null){d+=" on line "+(1+c)+" ('"+b+"') of CSV."}this.error(d);return null};Dygraph.prototype.parseCSV_=function(t){var r=[];var s=Dygraph.detectLineDelimiter(t);var a=t.split(s||"\n");var g,k;var p=this.attr_("delimiter");if(a[0].indexOf(p)==-1&&a[0].indexOf("\t")>=0){p="\t"}var b=0;if(!("labels" in this.user_attrs_)){b=1;this.attrs_.labels=a[0].split(p);this.attributes_.reparseSeries()}var o=0;var m;var q=false;var c=this.attr_("labels").length;var f=false;for(var l=b;l0&&h[0]0){j=String.fromCharCode(65+(i-1)%26)+j.toLowerCase();i=Math.floor((i-1)/26)}return j};var h=w.getNumberOfColumns();var g=w.getNumberOfRows();var f=w.getColumnType(0);if(f=="date"||f=="datetime"){this.attrs_.xValueParser=Dygraph.dateParser;this.attrs_.axes.x.valueFormatter=Dygraph.dateString_;this.attrs_.axes.x.ticker=Dygraph.dateTicker;this.attrs_.axes.x.axisLabelFormatter=Dygraph.dateAxisFormatter}else{if(f=="number"){this.attrs_.xValueParser=function(i){return parseFloat(i)};this.attrs_.axes.x.valueFormatter=function(i){return i};this.attrs_.axes.x.ticker=Dygraph.numericLinearTicks;this.attrs_.axes.x.axisLabelFormatter=this.attrs_.axes.x.valueFormatter}else{this.error("only 'date', 'datetime' and 'number' types are supported for column 1 of DataTable input (Got '"+f+"')");return null}}var m=[];var t={};var s=false;var q,o;for(q=1;q0&&e[0]0){this.setAnnotations(a,true)}this.attributes_.reparseSeries()};Dygraph.prototype.start_=function(){var d=this.file_;if(typeof d=="function"){d=d()}if(Dygraph.isArrayLike(d)){this.rawData_=this.parseArray_(d);this.predraw_()}else{if(typeof d=="object"&&typeof d.getColumnRange=="function"){this.parseDataTable_(d);this.predraw_()}else{if(typeof d=="string"){var c=Dygraph.detectLineDelimiter(d);if(c){this.loadedEvent_(d)}else{var b;if(window.XMLHttpRequest){b=new XMLHttpRequest()}else{b=new ActiveXObject("Microsoft.XMLHTTP")}var a=this;b.onreadystatechange=function(){if(b.readyState==4){if(b.status===200||b.status===0){a.loadedEvent_(b.responseText)}}};b.open("GET",d,true);b.send(null)}}else{this.error("Unknown data format: "+(typeof d))}}}};Dygraph.prototype.updateOptions=function(e,b){if(typeof(b)=="undefined"){b=false}var d=e.file;var c=Dygraph.mapLegacyOptions_(e);if("rollPeriod" in c){this.rollPeriod_=c.rollPeriod}if("dateWindow" in c){this.dateWindow_=c.dateWindow;if(!("isZoomedIgnoreProgrammaticZoom" in c)){this.zoomed_x_=(c.dateWindow!==null)}}if("valueRange" in c&&!("isZoomedIgnoreProgrammaticZoom" in c)){this.zoomed_y_=(c.valueRange!==null)}var a=Dygraph.isPixelChangingOptionList(this.attr_("labels"),c);Dygraph.updateDeep(this.user_attrs_,c);this.attributes_.reparseSeries();if(d){this.file_=d;if(!b){this.start_()}}else{if(!b){if(a){this.predraw_()}else{this.renderGraph_(false)}}}};Dygraph.mapLegacyOptions_=function(c){var a={};for(var b in c){if(b=="file"){continue}if(c.hasOwnProperty(b)){a[b]=c[b]}}var e=function(g,f,h){if(!a.axes){a.axes={}}if(!a.axes[g]){a.axes[g]={}}a.axes[g][f]=h};var d=function(f,g,h){if(typeof(c[f])!="undefined"){Dygraph.warn("Option "+f+" is deprecated. Use the "+h+" option for the "+g+" axis instead. (e.g. { axes : { "+g+" : { "+h+" : ... } } } (see http://dygraphs.com/per-axis.html for more information.");e(g,h,c[f]);delete a[f]}};d("xValueFormatter","x","valueFormatter");d("pixelsPerXLabel","x","pixelsPerLabel");d("xAxisLabelFormatter","x","axisLabelFormatter");d("xTicker","x","ticker");d("yValueFormatter","y","valueFormatter");d("pixelsPerYLabel","y","pixelsPerLabel");d("yAxisLabelFormatter","y","axisLabelFormatter");d("yTicker","y","ticker");return a};Dygraph.prototype.resize=function(d,b){if(this.resize_lock){return}this.resize_lock=true;if((d===null)!=(b===null)){this.warn("Dygraph.resize() should be called with zero parameters or two non-NULL parameters. Pretending it was zero.");d=b=null}var a=this.width_;var c=this.height_;if(d){this.maindiv_.style.width=d+"px";this.maindiv_.style.height=b+"px";this.width_=d;this.height_=b}else{this.width_=this.maindiv_.clientWidth;this.height_=this.maindiv_.clientHeight}if(a!=this.width_||c!=this.height_){this.resizeElements_();this.predraw_()}this.resize_lock=false};Dygraph.prototype.adjustRoll=function(a){this.rollPeriod_=a;this.predraw_()};Dygraph.prototype.visibility=function(){if(!this.attr_("visibility")){this.attrs_.visibility=[]}while(this.attr_("visibility").length=a.length){this.warn("invalid series number in setVisibility: "+b)}else{a[b]=c;this.predraw_()}};Dygraph.prototype.size=function(){return{width:this.width_,height:this.height_}};Dygraph.prototype.setAnnotations=function(b,a){Dygraph.addAnnotationRule();this.annotations_=b;if(!this.layout_){this.warn("Tried to setAnnotations before dygraph was ready. Try setting them in a ready() block. See dygraphs.com/tests/annotation.html");return}this.layout_.setAnnotations(this.annotations_);if(!a){this.predraw_()}};Dygraph.prototype.annotations=function(){return this.annotations_};Dygraph.prototype.getLabels=function(){var a=this.attr_("labels");return a?a.slice():null};Dygraph.prototype.indexFromSetName=function(a){return this.setIndexByName_[a]};Dygraph.prototype.ready=function(a){if(this.is_initial_draw_){this.readyFns_.push(a)}else{a(this)}};Dygraph.addAnnotationRule=function(){if(Dygraph.addedAnnotationCSS){return}var f="border: 1px solid black; background-color: white; text-align: center;";var e=document.createElement("style");e.type="text/css";document.getElementsByTagName("head")[0].appendChild(e);for(var b=0;bb){return -1}if(i===null||i===undefined){i=0}var h=function(j){return j>=0&&ja){if(i>0){f=g-1;if(h(f)&&d[f]a){return g}}return Dygraph.binarySearch(a,d,i,g+1,b)}}}return -1};Dygraph.dateParser=function(a){var b;var c;if(a.search("-")==-1||a.search("T")!=-1||a.search("Z")!=-1){c=Dygraph.dateStrToMillis(a);if(c&&!isNaN(c)){return c}}if(a.search("-")!=-1){b=a.replace("-","/","g");while(b.search("-")!=-1){b=b.replace("-","/")}c=Dygraph.dateStrToMillis(b)}else{if(a.length==8){b=a.substr(0,4)+"/"+a.substr(4,2)+"/"+a.substr(6,2);c=Dygraph.dateStrToMillis(b)}else{c=Dygraph.dateStrToMillis(a)}}if(!c||isNaN(c)){Dygraph.error("Couldn't parse "+a+" as a date")}return c};Dygraph.dateStrToMillis=function(a){return new Date(a).getTime()};Dygraph.update=function(b,c){if(typeof(c)!="undefined"&&c!==null){for(var a in c){if(c.hasOwnProperty(a)){b[a]=c[a]}}}return b};Dygraph.updateDeep=function(b,d){function c(e){return(typeof Node==="object"?e instanceof Node:typeof e==="object"&&typeof e.nodeType==="number"&&typeof e.nodeName==="string")}if(typeof(d)!="undefined"&&d!==null){for(var a in d){if(d.hasOwnProperty(a)){if(d[a]===null){b[a]=null}else{if(Dygraph.isArrayLike(d[a])){b[a]=d[a].slice()}else{if(c(d[a])){b[a]=d[a]}else{if(typeof(d[a])=="object"){if(typeof(b[a])!="object"||b[a]===null){b[a]={}}Dygraph.updateDeep(b[a],d[a])}else{b[a]=d[a]}}}}}}}return b};Dygraph.isArrayLike=function(b){var a=typeof(b);if((a!="object"&&!(a=="function"&&typeof(b.item)=="function"))||b===null||typeof(b.length)!="number"||b.nodeType===3){return false}return true};Dygraph.isDateLike=function(a){if(typeof(a)!="object"||a===null||typeof(a.getTime)!="function"){return false}return true};Dygraph.clone=function(c){var b=[];for(var a=0;a=g){return}Dygraph.requestAnimFrame.call(window,function(){var l=new Date().getTime();var j=l-b;d=i;i=Math.floor(j/f);var k=i-d;var m=(i+k)>e;if(m||(i>=e)){h(e);a()}else{if(k!==0){h(i)}c()}})})()};Dygraph.isPixelChangingOptionList=function(h,e){var d={annotationClickHandler:true,annotationDblClickHandler:true,annotationMouseOutHandler:true,annotationMouseOverHandler:true,axisLabelColor:true,axisLineColor:true,axisLineWidth:true,clickCallback:true,digitsAfterDecimal:true,drawCallback:true,drawHighlightPointCallback:true,drawPoints:true,drawPointCallback:true,drawXGrid:true,drawYGrid:true,fillAlpha:true,gridLineColor:true,gridLineWidth:true,hideOverlayOnMouseOut:true,highlightCallback:true,highlightCircleSize:true,interactionModel:true,isZoomedIgnoreProgrammaticZoom:true,labelsDiv:true,labelsDivStyles:true,labelsDivWidth:true,labelsKMB:true,labelsKMG2:true,labelsSeparateLines:true,labelsShowZeroValues:true,legend:true,maxNumberWidth:true,panEdgeFraction:true,pixelsPerYLabel:true,pointClickCallback:true,pointSize:true,rangeSelectorPlotFillColor:true,rangeSelectorPlotStrokeColor:true,showLabelsOnHighlight:true,showRoller:true,sigFigs:true,strokeWidth:true,underlayCallback:true,unhighlightCallback:true,xAxisLabelFormatter:true,xTicker:true,xValueFormatter:true,yAxisLabelFormatter:true,yValueFormatter:true,zoomCallback:true};var a=false;var b={};if(h){for(var f=1;fc.boundedDates[1]){h=h-(a-c.boundedDates[1]);a=h+c.dateRange}}k.dateWindow_=[h,a];if(c.is2DPan){var d=c.dragEndY-c.dragStartY;for(var j=0;j=10&&e.dragDirection==Dygraph.HORIZONTAL){var f=Math.min(e.dragStartX,e.dragEndX),k=Math.max(e.dragStartX,e.dragEndX);f=Math.max(f,b.x);k=Math.min(k,b.x+b.w);if(f=10&&e.dragDirection==Dygraph.VERTICAL){var j=Math.min(e.dragStartY,e.dragEndY),a=Math.max(e.dragStartY,e.dragEndY);j=Math.max(j,b.y);a=Math.min(a,b.y+b.h);if(j1){d.startTimeForDoubleTapMs=null}var h=[];for(var c=0;c=2){d.initialPinchCenter={pageX:0.5*(h[0].pageX+h[1].pageX),pageY:0.5*(h[0].pageY+h[1].pageY),dataX:0.5*(h[0].dataX+h[1].dataX),dataY:0.5*(h[0].dataY+h[1].dataY)};var a=180/Math.PI*Math.atan2(d.initialPinchCenter.pageY-h[0].pageY,h[0].pageX-d.initialPinchCenter.pageX);a=Math.abs(a);if(a>90){a=90-a}d.touchDirections={x:(a<(90-45/2)),y:(a>45/2)}}}d.initialRange={x:e.xAxisRange(),y:e.yAxisRange()}};Dygraph.Interaction.moveTouch=function(n,q,d){d.startTimeForDoubleTapMs=null;var p,l=[];for(p=0;p=2){var e=(a[1].pageX-j.pageX);w=(l[1].pageX-h.pageX)/e;var v=(a[1].pageY-j.pageY);c=(l[1].pageY-h.pageY)/v}}w=Math.min(8,Math.max(0.125,w));c=Math.min(8,Math.max(0.125,c));var u=false;if(d.touchDirections.x){q.dateWindow_=[j.dataX-m.dataX+(d.initialRange.x[0]-j.dataX)/w,j.dataX-m.dataX+(d.initialRange.x[1]-j.dataX)/w];u=true}if(d.touchDirections.y){for(p=0;p<1;p++){var b=q.axes_[p];var s=q.attributes_.getForAxis("logscale",p);if(s){}else{b.valueWindow=[j.dataY-m.dataY+(d.initialRange.y[0]-j.dataY)/c,j.dataY-m.dataY+(d.initialRange.y[1]-j.dataY)/c];u=true}}}q.drawGraph_(false);if(u&&l.length>1&&q.attr_("zoomCallback")){var r=q.xAxisRange();q.attr_("zoomCallback")(r[0],r[1],q.yAxisRanges())}};Dygraph.Interaction.endTouch=function(e,d,c){if(e.touches.length!==0){Dygraph.Interaction.startTouch(e,d,c)}else{if(e.changedTouches.length==1){var a=new Date().getTime();var b=e.changedTouches[0];if(c.startTimeForDoubleTapMs&&a-c.startTimeForDoubleTapMs<500&&c.doubleTapX&&Math.abs(c.doubleTapX-b.screenX)<50&&c.doubleTapY&&Math.abs(c.doubleTapY-b.screenY)<50){d.resetZoom()}else{c.startTimeForDoubleTapMs=a;c.doubleTapX=b.screenX;c.doubleTapY=b.screenY}}}};Dygraph.Interaction.defaultModel={mousedown:function(c,b,a){if(c.button&&c.button==2){return}a.initializeMouseDown(c,b,a);if(c.altKey||c.shiftKey){Dygraph.startPan(c,b,a)}else{Dygraph.startZoom(c,b,a)}},mousemove:function(c,b,a){if(a.isZooming){Dygraph.moveZoom(c,b,a)}else{if(a.isPanning){Dygraph.movePan(c,b,a)}}},mouseup:function(c,b,a){if(a.isZooming){Dygraph.endZoom(c,b,a)}else{if(a.isPanning){Dygraph.endPan(c,b,a)}}},touchstart:function(c,b,a){Dygraph.Interaction.startTouch(c,b,a)},touchmove:function(c,b,a){Dygraph.Interaction.moveTouch(c,b,a)},touchend:function(c,b,a){Dygraph.Interaction.endTouch(c,b,a)},mouseout:function(c,b,a){if(a.isZooming){a.dragEndX=null;a.dragEndY=null;b.clearZoomRect_()}},dblclick:function(c,b,a){if(a.cancelNextDblclick){a.cancelNextDblclick=false;return}if(c.altKey||c.shiftKey){return}b.resetZoom()}};Dygraph.DEFAULT_ATTRS.interactionModel=Dygraph.Interaction.defaultModel;Dygraph.defaultInteractionModel=Dygraph.Interaction.defaultModel;Dygraph.endZoom=Dygraph.Interaction.endZoom;Dygraph.moveZoom=Dygraph.Interaction.moveZoom;Dygraph.startZoom=Dygraph.Interaction.startZoom;Dygraph.endPan=Dygraph.Interaction.endPan;Dygraph.movePan=Dygraph.Interaction.movePan;Dygraph.startPan=Dygraph.Interaction.startPan;Dygraph.Interaction.nonInteractiveModel_={mousedown:function(c,b,a){a.initializeMouseDown(c,b,a)},mouseup:function(c,b,a){a.dragEndX=b.dragGetX_(c,a);a.dragEndY=b.dragGetY_(c,a);var e=Math.abs(a.dragEndX-a.dragStartX);var d=Math.abs(a.dragEndY-a.dragStartY);if(e<2&&d<2&&b.lastx_!==undefined&&b.lastx_!=-1){Dygraph.Interaction.treatMouseOpAsClick(b,c,a)}}};Dygraph.Interaction.dragIsPanInteractionModel={mousedown:function(c,b,a){a.initializeMouseDown(c,b,a);Dygraph.startPan(c,b,a)},mousemove:function(c,b,a){if(a.isPanning){Dygraph.movePan(c,b,a)}},mouseup:function(c,b,a){if(a.isPanning){Dygraph.endPan(c,b,a)}}};"use strict";Dygraph.TickList=undefined;Dygraph.Ticker=undefined;Dygraph.numericLinearTicks=function(d,c,i,g,f,h){var e=function(a){if(a==="logscale"){return false}return g(a)};return Dygraph.numericTicks(d,c,i,e,f,h)};Dygraph.numericTicks=function(F,E,u,p,d,q){var z=(p("pixelsPerLabel"));var G=[];var C,A,t,y;if(q){for(C=0;C=y/4){for(var r=H;r>=l;r--){var m=Dygraph.PREFERRED_LOG_TICK_VALUES[r];var k=Math.log(m/F)/Math.log(E/F)*u;var D={v:m};if(s===null){s={tickValue:m,pixel_coord:k}}else{if(Math.abs(k-s.pixel_coord)>=z){s={tickValue:m,pixel_coord:k}}else{D.label=""}}G.push(D)}G.reverse()}}if(G.length===0){var g=p("labelsKMG2");var n,h;if(g){n=[1,2,4,8,16,32,64,128,256];h=16}else{n=[1,2,5,10,20,50,100];h=10}var w=Math.ceil(u/z);var o=Math.abs(E-F)/w;var v=Math.floor(Math.log(o)/Math.log(h));var f=Math.pow(h,v);var I,x,c,e;for(A=0;Az){break}}if(x>c){I*=-1}for(C=0;C=0){return Dygraph.getDateAxis(e,c,d,g,f)}else{return[]}};Dygraph.SECONDLY=0;Dygraph.TWO_SECONDLY=1;Dygraph.FIVE_SECONDLY=2;Dygraph.TEN_SECONDLY=3;Dygraph.THIRTY_SECONDLY=4;Dygraph.MINUTELY=5;Dygraph.TWO_MINUTELY=6;Dygraph.FIVE_MINUTELY=7;Dygraph.TEN_MINUTELY=8;Dygraph.THIRTY_MINUTELY=9;Dygraph.HOURLY=10;Dygraph.TWO_HOURLY=11;Dygraph.SIX_HOURLY=12;Dygraph.DAILY=13;Dygraph.WEEKLY=14;Dygraph.MONTHLY=15;Dygraph.QUARTERLY=16;Dygraph.BIANNUAL=17;Dygraph.ANNUAL=18;Dygraph.DECADAL=19;Dygraph.CENTENNIAL=20;Dygraph.NUM_GRANULARITIES=21;Dygraph.SHORT_SPACINGS=[];Dygraph.SHORT_SPACINGS[Dygraph.SECONDLY]=1000*1;Dygraph.SHORT_SPACINGS[Dygraph.TWO_SECONDLY]=1000*2;Dygraph.SHORT_SPACINGS[Dygraph.FIVE_SECONDLY]=1000*5;Dygraph.SHORT_SPACINGS[Dygraph.TEN_SECONDLY]=1000*10;Dygraph.SHORT_SPACINGS[Dygraph.THIRTY_SECONDLY]=1000*30;Dygraph.SHORT_SPACINGS[Dygraph.MINUTELY]=1000*60;Dygraph.SHORT_SPACINGS[Dygraph.TWO_MINUTELY]=1000*60*2;Dygraph.SHORT_SPACINGS[Dygraph.FIVE_MINUTELY]=1000*60*5;Dygraph.SHORT_SPACINGS[Dygraph.TEN_MINUTELY]=1000*60*10;Dygraph.SHORT_SPACINGS[Dygraph.THIRTY_MINUTELY]=1000*60*30;Dygraph.SHORT_SPACINGS[Dygraph.HOURLY]=1000*3600;Dygraph.SHORT_SPACINGS[Dygraph.TWO_HOURLY]=1000*3600*2;Dygraph.SHORT_SPACINGS[Dygraph.SIX_HOURLY]=1000*3600*6;Dygraph.SHORT_SPACINGS[Dygraph.DAILY]=1000*86400;Dygraph.SHORT_SPACINGS[Dygraph.WEEKLY]=1000*604800;Dygraph.LONG_TICK_PLACEMENTS=[];Dygraph.LONG_TICK_PLACEMENTS[Dygraph.MONTHLY]={months:[0,1,2,3,4,5,6,7,8,9,10,11],year_mod:1};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.QUARTERLY]={months:[0,3,6,9],year_mod:1};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.BIANNUAL]={months:[0,6],year_mod:1};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.ANNUAL]={months:[0],year_mod:1};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.DECADAL]={months:[0],year_mod:10};Dygraph.LONG_TICK_PLACEMENTS[Dygraph.CENTENNIAL]={months:[0],year_mod:100};Dygraph.PREFERRED_LOG_TICK_VALUES=function(){var c=[];for(var b=-39;b<=39;b++){var a=Math.pow(10,b);for(var d=1;d<=9;d++){var e=a*d;c.push(e)}}return c}();Dygraph.pickDateTickGranularity=function(d,c,j,h){var g=(h("pixelsPerLabel"));for(var f=0;f=g){return f}}return -1};Dygraph.numDateTicks=function(e,b,f){if(f=Dygraph.SHORT_SPACINGS[Dygraph.TWO_HOURLY]);for(m=p;m<=l;m+=c){A=new Date(m);if(e&&A.getTimezoneOffset()!=B){var k=A.getTimezoneOffset()-B;m+=k*60*1000;A=new Date(m);B=A.getTimezoneOffset();if(new Date(m+c).getTimezoneOffset()!=B){m+=c;A=new Date(m);B=A.getTimezoneOffset()}}C.push({v:m,label:w(A,a,n,z)})}}else{var f;var r=1;if(al){continue}C.push({v:m,label:w(new Date(m),a,n,z)})}}}return C};if(Dygraph&&Dygraph.DEFAULT_ATTRS&&Dygraph.DEFAULT_ATTRS.axes&&Dygraph.DEFAULT_ATTRS.axes["x"]&&Dygraph.DEFAULT_ATTRS.axes["y"]&&Dygraph.DEFAULT_ATTRS.axes["y2"]){Dygraph.DEFAULT_ATTRS.axes["x"]["ticker"]=Dygraph.dateTicker;Dygraph.DEFAULT_ATTRS.axes["y"]["ticker"]=Dygraph.numericTicks;Dygraph.DEFAULT_ATTRS.axes["y2"]["ticker"]=Dygraph.numericTicks}Dygraph.Plugins={};Dygraph.Plugins.Annotations=(function(){var a=function(){this.annotations_=[]};a.prototype.toString=function(){return"Annotations Plugin"};a.prototype.activate=function(b){return{clearChart:this.clearChart,didDrawChart:this.didDrawChart}};a.prototype.detachLabels=function(){for(var c=0;cu.x+u.w||l.canvasyu.y+u.h){continue}var w=l.annotation;var n=6;if(w.hasOwnProperty("tickHeight")){n=w.tickHeight}var j=document.createElement("div");for(var A in x){if(x.hasOwnProperty(A)){j.style[A]=x[A]}}if(!w.hasOwnProperty("icon")){j.className="dygraphDefaultAnnotation"}if(w.hasOwnProperty("cssClass")){j.className+=" "+w.cssClass}var m=w.hasOwnProperty("width")?w.width:16;var k=w.hasOwnProperty("height")?w.height:16;if(w.hasOwnProperty("icon")){var z=document.createElement("img");z.src=w.icon;z.width=m;z.height=k;j.appendChild(z)}else{if(l.annotation.hasOwnProperty("shortText")){j.appendChild(document.createTextNode(l.annotation.shortText))}}var c=l.canvasx-m/2;j.style.left=c+"px";var f=0;if(w.attachAtBottom){var d=(u.y+u.h-k-n);if(q[c]){d-=q[c]}else{q[c]=0}q[c]+=(n+k);f=d}else{f=l.canvasy-k-n}j.style.top=f+"px";j.style.width=m+"px";j.style.height=k+"px";j.title=l.annotation.text;j.style.color=t.colorsMap_[l.name];j.style.borderColor=t.colorsMap_[l.name];w.div=j;t.addAndTrackEvent(j,"click",b("clickHandler","annotationClickHandler",l,this));t.addAndTrackEvent(j,"mouseover",b("mouseOverHandler","annotationMouseOverHandler",l,this));t.addAndTrackEvent(j,"mouseout",b("mouseOutHandler","annotationMouseOutHandler",l,this));t.addAndTrackEvent(j,"dblclick",b("dblClickHandler","annotationDblClickHandler",l,this));h.appendChild(j);this.annotations_.push(j);var o=v.drawingContext;o.save();o.strokeStyle=t.colorsMap_[l.name];o.beginPath();if(!w.attachAtBottom){o.moveTo(l.canvasx,l.canvasy);o.lineTo(l.canvasx,l.canvasy-2-n)}else{var d=f+k;o.moveTo(l.canvasx,d);o.lineTo(l.canvasx,d+n)}o.closePath();o.stroke();o.restore()}};a.prototype.destroy=function(){this.detachLabels()};return a})();Dygraph.Plugins.Axes=(function(){var a=function(){this.xlabels_=[];this.ylabels_=[]};a.prototype.toString=function(){return"Axes Plugin"};a.prototype.activate=function(b){return{layout:this.layout,clearChart:this.clearChart,willDrawChart:this.willDrawChart}};a.prototype.layout=function(f){var d=f.dygraph;if(d.getOption("drawYAxis")){var b=d.getOption("yAxisLabelWidth")+2*d.getOption("axisTickSize");f.reserveSpaceLeft(b)}if(d.getOption("drawXAxis")){var c;if(d.getOption("xAxisHeight")){c=d.getOption("xAxisHeight")}else{c=d.getOptionForAxis("axisLabelFontSize","x")+2*d.getOption("axisTickSize")}f.reserveSpaceBottom(c)}if(d.numAxes()==2){if(d.getOption("drawYAxis")){var b=d.getOption("yAxisLabelWidth")+2*d.getOption("axisTickSize");f.reserveSpaceRight(b)}}else{if(d.numAxes()>2){d.error("Only two y-axes are supported at this time. (Trying to use "+d.numAxes()+")")}}};a.prototype.detachLabels=function(){function b(d){for(var c=0;c0){var h=F.numAxes();for(D=0;Dd){s.style.bottom="0px"}else{s.style.top=z+"px"}if(E[0]===0){s.style.left=(G.x-F.getOption("yAxisLabelWidth")-F.getOption("axisTickSize"))+"px";s.style.textAlign="right"}else{if(E[0]==1){s.style.left=(G.x+G.w+F.getOption("axisTickSize"))+"px";s.style.textAlign="left"}}s.style.width=F.getOption("yAxisLabelWidth")+"px";v.appendChild(s);this.ylabels_.push(s)}var n=this.ylabels_[0];var k=F.getOptionForAxis("axisLabelFontSize","y");var q=parseInt(n.style.top,10)+k;if(q>d-k){n.style.top=(parseInt(n.style.top,10)-k/2)+"px"}}var c;if(F.getOption("drawAxesAtZero")){var w=F.toPercentXCoord(0);if(w>1||w<0||isNaN(w)){w=0}c=B(G.x+w*G.w)}else{c=B(G.x)}j.strokeStyle=F.getOptionForAxis("axisLineColor","y");j.lineWidth=F.getOptionForAxis("axisLineWidth","y");j.beginPath();j.moveTo(c,A(G.y));j.lineTo(c,A(G.y+G.h));j.closePath();j.stroke();if(F.numAxes()==2){j.strokeStyle=F.getOptionForAxis("axisLineColor","y2");j.lineWidth=F.getOptionForAxis("axisLineWidth","y2");j.beginPath();j.moveTo(A(G.x+G.w),A(G.y));j.lineTo(A(G.x+G.w),A(G.y+G.h));j.closePath();j.stroke()}}if(F.getOption("drawXAxis")){if(I.xticks){for(D=0;DJ){l=J-F.getOption("xAxisLabelWidth");s.style.textAlign="right"}if(l<0){l=0;s.style.textAlign="left"}s.style.left=l+"px";s.style.width=F.getOption("xAxisLabelWidth")+"px";v.appendChild(s);this.xlabels_.push(s)}}j.strokeStyle=F.getOptionForAxis("axisLineColor","x");j.lineWidth=F.getOptionForAxis("axisLineWidth","x");j.beginPath();var b;if(F.getOption("drawAxesAtZero")){var w=F.toPercentYCoord(0,0);if(w>1||w<0){w=1}b=A(G.y+w*G.h)}else{b=A(G.y+G.h)}j.moveTo(B(G.x),b);j.lineTo(B(G.x+G.w),b);j.closePath();j.stroke()}j.restore()};return a})();Dygraph.Plugins.ChartLabels=(function(){var c=function(){this.title_div_=null;this.xlabel_div_=null;this.ylabel_div_=null;this.y2label_div_=null};c.prototype.toString=function(){return"ChartLabels Plugin"};c.prototype.activate=function(d){return{layout:this.layout,didDrawChart:this.didDrawChart}};var b=function(d){var e=document.createElement("div");e.style.position="absolute";e.style.left=d.x+"px";e.style.top=d.y+"px";e.style.width=d.w+"px";e.style.height=d.h+"px";return e};c.prototype.detachLabels_=function(){var e=[this.title_div_,this.xlabel_div_,this.ylabel_div_,this.y2label_div_];for(var d=0;d=2)}}u=t.yticks;l.save();for(p=0;p=2);if(n){l.installPattern(d)}l.strokeStyle=q.getOptionForAxis("gridLineColor","x");l.lineWidth=q.getOptionForAxis("gridLineWidth","x");for(p=0;p":" ")}m=w.getOption("strokePattern",z[u]);s=d(m,q.color,f);r+=""+s+" "+z[u]+""}return r}var A=w.optionsViewForAxis_("x");var o=A("valueFormatter");r=o(p,A,z[0],w);if(r!==""){r+=":"}var v=[];var j=w.numAxes();for(u=0;u"}var q=w.getPropertiesForSeries(t.name);var n=v[q.axis-1];var y=n("valueFormatter");var e=y(t.yval,n,t.name,w);var h=(t.name==B)?" class='highlight'":"";r+=" "+t.name+": "+e+""}return r};d=function(s,h,r){var e=(/MSIE/.test(navigator.userAgent)&&!window.opera);if(e){return"—"}if(!s||s.length<=1){return'
          '}var l,k,f,o;var g=0,q=0;var p=[];var n;for(l=0;l<=s.length;l++){g+=s[l%s.length]}n=Math.floor(r/(g-s[0]));if(n>1){for(l=0;l
          '}}return m};return c})();Dygraph.Plugins.RangeSelector=(function(){var a=function(){this.isIE_=/MSIE/.test(navigator.userAgent)&&!window.opera;this.hasTouchInterface_=typeof(TouchEvent)!="undefined";this.isMobileDevice_=/mobile|android/gi.test(navigator.appVersion);this.interfaceCreated_=false};a.prototype.toString=function(){return"RangeSelector Plugin"};a.prototype.activate=function(b){this.dygraph_=b;this.isUsingExcanvas_=b.isUsingExcanvas_;if(this.getOption_("showRangeSelector")){this.createInterface_()}return{layout:this.reserveSpace_,predraw:this.renderStaticLayer_,didDrawChart:this.renderInteractiveLayer_}};a.prototype.destroy=function(){this.bgcanvas_=null;this.fgcanvas_=null;this.leftZoomHandle_=null;this.rightZoomHandle_=null;this.iePanOverlay_=null};a.prototype.getOption_=function(b){return this.dygraph_.getOption(b)};a.prototype.setDefaultOption_=function(b,c){return this.dygraph_.attrs_[b]=c};a.prototype.createInterface_=function(){this.createCanvases_();if(this.isUsingExcanvas_){this.createIEPanOverlay_()}this.createZoomHandles_();this.initInteraction_();if(this.getOption_("animatedZooms")){this.dygraph_.warn("Animated zooms and range selector are not compatible; disabling animatedZooms.");this.dygraph_.updateOptions({animatedZooms:false},true)}this.interfaceCreated_=true;this.addToGraph_()};a.prototype.addToGraph_=function(){var b=this.graphDiv_=this.dygraph_.graphDiv;b.appendChild(this.bgcanvas_);b.appendChild(this.fgcanvas_);b.appendChild(this.leftZoomHandle_);b.appendChild(this.rightZoomHandle_)};a.prototype.removeFromGraph_=function(){var b=this.graphDiv_;b.removeChild(this.bgcanvas_);b.removeChild(this.fgcanvas_);b.removeChild(this.leftZoomHandle_);b.removeChild(this.rightZoomHandle_);this.graphDiv_=null};a.prototype.reserveSpace_=function(b){if(this.getOption_("showRangeSelector")){b.reserveSpaceBottom(this.getOption_("rangeSelectorHeight")+4)}};a.prototype.renderStaticLayer_=function(){if(!this.updateVisibility_()){return}this.resize_();this.drawStaticLayer_()};a.prototype.renderInteractiveLayer_=function(){if(!this.updateVisibility_()||this.isChangingRange_){return}this.placeZoomHandles_();this.drawInteractiveLayer_()};a.prototype.updateVisibility_=function(){var b=this.getOption_("showRangeSelector");if(b){if(!this.interfaceCreated_){this.createInterface_()}else{if(!this.graphDiv_||!this.graphDiv_.parentNode){this.addToGraph_()}}}else{if(this.graphDiv_){this.removeFromGraph_();var c=this.dygraph_;setTimeout(function(){c.width_=0;c.resize()},1)}}return b};a.prototype.resize_=function(){function d(e,f){e.style.top=f.y+"px";e.style.left=f.x+"px";e.width=f.w;e.height=f.h;e.style.width=e.width+"px";e.style.height=e.height+"px"}var c=this.dygraph_.layout_.getPlotArea();var b=0;if(this.getOption_("drawXAxis")){b=this.getOption_("xAxisHeight")||(this.getOption_("axisLabelFontSize")+2*this.getOption_("axisTickSize"))}this.canvasRect_={x:c.x,y:c.y+c.h+b+4,w:c.w,h:this.getOption_("rangeSelectorHeight")};d(this.bgcanvas_,this.canvasRect_);d(this.fgcanvas_,this.canvasRect_)};a.prototype.createCanvases_=function(){this.bgcanvas_=Dygraph.createCanvas();this.bgcanvas_.className="dygraph-rangesel-bgcanvas";this.bgcanvas_.style.position="absolute";this.bgcanvas_.style.zIndex=9;this.bgcanvas_ctx_=Dygraph.getContext(this.bgcanvas_);this.fgcanvas_=Dygraph.createCanvas();this.fgcanvas_.className="dygraph-rangesel-fgcanvas";this.fgcanvas_.style.position="absolute";this.fgcanvas_.style.zIndex=9;this.fgcanvas_.style.cursor="default";this.fgcanvas_ctx_=Dygraph.getContext(this.fgcanvas_)};a.prototype.createIEPanOverlay_=function(){this.iePanOverlay_=document.createElement("div");this.iePanOverlay_.style.position="absolute";this.iePanOverlay_.style.backgroundColor="white";this.iePanOverlay_.style.filter="alpha(opacity=0)";this.iePanOverlay_.style.display="none";this.iePanOverlay_.style.cursor="move";this.fgcanvas_.appendChild(this.iePanOverlay_)};a.prototype.createZoomHandles_=function(){var b=new Image();b.className="dygraph-rangesel-zoomhandle";b.style.position="absolute";b.style.zIndex=10;b.style.visibility="hidden";b.style.cursor="col-resize";if(/MSIE 7/.test(navigator.userAgent)){b.width=7;b.height=14;b.style.backgroundColor="white";b.style.border="1px solid #333333"}else{b.width=9;b.height=16;b.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAQCAYAAADESFVDAAAAAXNSR0IArs4c6QAAAAZiS0dEANAAzwDP4Z7KegAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAd0SU1FB9sHGw0cMqdt1UwAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAaElEQVQoz+3SsRFAQBCF4Z9WJM8KCDVwownl6YXsTmCUsyKGkZzcl7zkz3YLkypgAnreFmDEpHkIwVOMfpdi9CEEN2nGpFdwD03yEqDtOgCaun7sqSTDH32I1pQA2Pb9sZecAxc5r3IAb21d6878xsAAAAAASUVORK5CYII="}if(this.isMobileDevice_){b.width*=2;b.height*=2}this.leftZoomHandle_=b;this.rightZoomHandle_=b.cloneNode(false)};a.prototype.initInteraction_=function(){var o=this;var i=this.isIE_?document:window;var u=0;var v=null;var s=false;var d=false;var g=!this.isMobileDevice_&&!this.isUsingExcanvas_;var k=new Dygraph.IFrameTarp();var p,f,r,j,w,h,x,t,q,c,l;var e,n,m;p=function(C){var B=o.dygraph_.xAxisExtremes();var z=(B[1]-B[0])/o.canvasRect_.w;var A=B[0]+(C.leftHandlePos-o.canvasRect_.x)*z;var y=B[0]+(C.rightHandlePos-o.canvasRect_.x)*z;return[A,y]};f=function(y){Dygraph.cancelEvent(y);s=true;u=y.clientX;v=y.target?y.target:y.srcElement;if(y.type==="mousedown"||y.type==="dragstart"){Dygraph.addEvent(i,"mousemove",r);Dygraph.addEvent(i,"mouseup",j)}o.fgcanvas_.style.cursor="col-resize";k.cover();return true};r=function(C){if(!s){return false}Dygraph.cancelEvent(C);var z=C.clientX-u;if(Math.abs(z)<4){return true}u=C.clientX;var B=o.getZoomHandleStatus_();var y;if(v==o.leftZoomHandle_){y=B.leftHandlePos+z;y=Math.min(y,B.rightHandlePos-v.width-3);y=Math.max(y,o.canvasRect_.x)}else{y=B.rightHandlePos+z;y=Math.min(y,o.canvasRect_.x+o.canvasRect_.w);y=Math.max(y,B.leftHandlePos+v.width+3)}var A=v.width/2;v.style.left=(y-A)+"px";o.drawInteractiveLayer_();if(g){w()}return true};j=function(y){if(!s){return false}s=false;k.uncover();Dygraph.removeEvent(i,"mousemove",r);Dygraph.removeEvent(i,"mouseup",j);o.fgcanvas_.style.cursor="default";if(!g){w()}return true};w=function(){try{var z=o.getZoomHandleStatus_();o.isChangingRange_=true;if(!z.isZoomed){o.dygraph_.resetZoom()}else{var y=p(z);o.dygraph_.doZoomXDates_(y[0],y[1])}}finally{o.isChangingRange_=false}};h=function(A){if(o.isUsingExcanvas_){return A.srcElement==o.iePanOverlay_}else{var z=o.leftZoomHandle_.getBoundingClientRect();var y=z.left+z.width/2;z=o.rightZoomHandle_.getBoundingClientRect();var B=z.left+z.width/2;return(A.clientX>y&&A.clientX=o.canvasRect_.x+o.canvasRect_.w){y=o.canvasRect_.x+o.canvasRect_.w;E=y-D}else{E+=z;y+=z}}var A=o.leftZoomHandle_.width/2;o.leftZoomHandle_.style.left=(E-A)+"px";o.rightZoomHandle_.style.left=(y-A)+"px";o.drawInteractiveLayer_();if(g){c()}return true};q=function(y){if(!d){return false}d=false;Dygraph.removeEvent(i,"mousemove",t);Dygraph.removeEvent(i,"mouseup",q);if(!g){c()}return true};c=function(){try{o.isChangingRange_=true;o.dygraph_.dateWindow_=p(o.getZoomHandleStatus_());o.dygraph_.drawGraph_(false)}finally{o.isChangingRange_=false}};l=function(y){if(s||d){return}var z=h(y)?"move":"default";if(z!=o.fgcanvas_.style.cursor){o.fgcanvas_.style.cursor=z}};e=function(y){if(y.type=="touchstart"&&y.targetTouches.length==1){if(f(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{if(y.type=="touchmove"&&y.targetTouches.length==1){if(r(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{j(y)}}};n=function(y){if(y.type=="touchstart"&&y.targetTouches.length==1){if(x(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{if(y.type=="touchmove"&&y.targetTouches.length==1){if(t(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{q(y)}}};m=function(B,A){var z=["touchstart","touchend","touchmove","touchcancel"];for(var y=0;y1&&v[t][1]!==null){m=typeof v[t][1]!="number";if(m){d=[];h=[];for(r=0;r0)){b=Math.min(b,g);c=Math.max(c,g)}}var o=0.25;if(u){c=Dygraph.log10(c);c+=c*o;b=Dygraph.log10(b);for(t=0;tthis.canvasRect_.x||b+1\n'); + } +})(); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-externs.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-externs.js new file mode 100644 index 0000000..ed5de4c --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-externs.js @@ -0,0 +1,93 @@ +/** + * @param {Object} dict + * @return {!Array.} + */ +function printStackTrace(dict) {} + + +/** + * @constructor + */ +function G_vmlCanvasManager() {} + +/** + * @param {!HTMLCanvasElement} canvas + */ +G_vmlCanvasManager.initElement = function(canvas) {}; + +// For IE +/** + * @param {string} type + * @param {Object} fn + */ +Element.prototype.detachEvent = function(type, fn) {}; + + +/** + * @typedef {function( + * (number|Date), + * number, + * function(string):*, + * (Dygraph|undefined) + * ):string} + */ +var AxisLabelFormatter; + + +/** + * @typedef {function(number,function(string),Dygraph):string} + */ +var ValueFormatter; + + +/** + * @typedef {Array.>>} + */ +var DygraphDataArray; + +/** + * @constructor + */ +function GVizDataTable() {} + +// TODO(danvk): move the Dygraph definitions out of here once I closure-ify dygraphs.js +/** + * @param {!HTMLDivElement|string} div + * @param {DygraphDataArray| + * GVizDataTable| + * string| + * function():(DygraphDataArray|GVizDataTable|string)} file + * @param {Object} attrs + * @constructor + */ +function Dygraph(div, file, attrs) {} + +/** + * @constructor + */ +function DygraphLayout() {} + +/** + * @type {Array} + */ +DygraphLayout.prototype.datasets; + +// TODO: DygraphOptions should not reach inside Dygraph private data like this. +/** @type {Object} */ +Dygraph.prototype.attrs_; +/** @type {Object} */ +Dygraph.prototype.user_attrs_; + +/** + * @type {DygraphLayout} + */ +Dygraph.prototype.layout_; + +/** @type {function(): string} */ +Dygraph.prototype.getHighlightSeries; + +/** @type {Array.<{elem:Element,type:string,fn:function(!Event):(boolean|undefined|null)}>} */ +Dygraph.prototype.registeredEvents_; + +/** @type {{axes: Object}} */ +Dygraph.DEFAULT_ATTRS; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-gviz.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-gviz.js new file mode 100644 index 0000000..988e0ac --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-gviz.js @@ -0,0 +1,82 @@ +/** + * @license + * Copyright 2011 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview A wrapper around the Dygraph class which implements the + * interface for a GViz (aka Google Visualization API) visualization. + * It is designed to be a drop-in replacement for Google's AnnotatedTimeline, + * so the documentation at + * http://code.google.com/apis/chart/interactive/docs/gallery/annotatedtimeline.html + * translates over directly. + * + * For a full demo, see: + * - http://dygraphs.com/tests/gviz.html + * - http://dygraphs.com/tests/annotation-gviz.html + */ + +/*jshint globalstrict: true */ +/*global Dygraph:false */ +"use strict"; + +/** + * A wrapper around Dygraph that implements the gviz API. + * @param {!HTMLDivElement} container The DOM object the visualization should + * live in. + * @constructor + */ +Dygraph.GVizChart = function(container) { + this.container = container; +}; + +/** + * @param {GVizDataTable} data + * @param {Object.<*>} options + */ +Dygraph.GVizChart.prototype.draw = function(data, options) { + // Clear out any existing dygraph. + // TODO(danvk): would it make more sense to simply redraw using the current + // date_graph object? + this.container.innerHTML = ''; + if (typeof(this.date_graph) != 'undefined') { + this.date_graph.destroy(); + } + + this.date_graph = new Dygraph(this.container, data, options); +}; + +/** + * Google charts compatible setSelection + * Only row selection is supported, all points in the row will be highlighted + * @param {Array.<{row:number}>} selection_array array of the selected cells + * @public + */ +Dygraph.GVizChart.prototype.setSelection = function(selection_array) { + var row = false; + if (selection_array.length) { + row = selection_array[0].row; + } + this.date_graph.setSelection(row); +}; + +/** + * Google charts compatible getSelection implementation + * @return {Array.<{row:number,column:number}>} array of the selected cells + * @public + */ +Dygraph.GVizChart.prototype.getSelection = function() { + var selection = []; + + var row = this.date_graph.getSelection(); + + if (row < 0) return selection; + + var points = this.date_graph.layout_.points; + for (var setIdx = 0; setIdx < points.length; ++setIdx) { + selection.push({row: row, column: setIdx + 1}); + } + + return selection; +}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-interaction-model.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-interaction-model.js new file mode 100644 index 0000000..2af345c --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-interaction-model.js @@ -0,0 +1,676 @@ +/** + * @license + * Copyright 2011 Robert Konigsberg (konigsberg@google.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview The default interaction model for Dygraphs. This is kept out + * of dygraph.js for better navigability. + * @author Robert Konigsberg (konigsberg@google.com) + */ + +/*jshint globalstrict: true */ +/*global Dygraph:false */ +"use strict"; + +/** + * A collection of functions to facilitate build custom interaction models. + * @class + */ +Dygraph.Interaction = {}; + +/** + * Called in response to an interaction model operation that + * should start the default panning behavior. + * + * It's used in the default callback for "mousedown" operations. + * Custom interaction model builders can use it to provide the default + * panning behavior. + * + * @param {Event} event the event object which led to the startPan call. + * @param {Dygraph} g The dygraph on which to act. + * @param {Object} context The dragging context object (with + * dragStartX/dragStartY/etc. properties). This function modifies the + * context. + */ +Dygraph.Interaction.startPan = function(event, g, context) { + var i, axis; + context.isPanning = true; + var xRange = g.xAxisRange(); + context.dateRange = xRange[1] - xRange[0]; + context.initialLeftmostDate = xRange[0]; + context.xUnitsPerPixel = context.dateRange / (g.plotter_.area.w - 1); + + if (g.attr_("panEdgeFraction")) { + var maxXPixelsToDraw = g.width_ * g.attr_("panEdgeFraction"); + var xExtremes = g.xAxisExtremes(); // I REALLY WANT TO CALL THIS xTremes! + + var boundedLeftX = g.toDomXCoord(xExtremes[0]) - maxXPixelsToDraw; + var boundedRightX = g.toDomXCoord(xExtremes[1]) + maxXPixelsToDraw; + + var boundedLeftDate = g.toDataXCoord(boundedLeftX); + var boundedRightDate = g.toDataXCoord(boundedRightX); + context.boundedDates = [boundedLeftDate, boundedRightDate]; + + var boundedValues = []; + var maxYPixelsToDraw = g.height_ * g.attr_("panEdgeFraction"); + + for (i = 0; i < g.axes_.length; i++) { + axis = g.axes_[i]; + var yExtremes = axis.extremeRange; + + var boundedTopY = g.toDomYCoord(yExtremes[0], i) + maxYPixelsToDraw; + var boundedBottomY = g.toDomYCoord(yExtremes[1], i) - maxYPixelsToDraw; + + var boundedTopValue = g.toDataYCoord(boundedTopY, i); + var boundedBottomValue = g.toDataYCoord(boundedBottomY, i); + + boundedValues[i] = [boundedTopValue, boundedBottomValue]; + } + context.boundedValues = boundedValues; + } + + // Record the range of each y-axis at the start of the drag. + // If any axis has a valueRange or valueWindow, then we want a 2D pan. + // We can't store data directly in g.axes_, because it does not belong to us + // and could change out from under us during a pan (say if there's a data + // update). + context.is2DPan = false; + context.axes = []; + for (i = 0; i < g.axes_.length; i++) { + axis = g.axes_[i]; + var axis_data = {}; + var yRange = g.yAxisRange(i); + // TODO(konigsberg): These values should be in |context|. + // In log scale, initialTopValue, dragValueRange and unitsPerPixel are log scale. + var logscale = g.attributes_.getForAxis("logscale", i); + if (logscale) { + axis_data.initialTopValue = Dygraph.log10(yRange[1]); + axis_data.dragValueRange = Dygraph.log10(yRange[1]) - Dygraph.log10(yRange[0]); + } else { + axis_data.initialTopValue = yRange[1]; + axis_data.dragValueRange = yRange[1] - yRange[0]; + } + axis_data.unitsPerPixel = axis_data.dragValueRange / (g.plotter_.area.h - 1); + context.axes.push(axis_data); + + // While calculating axes, set 2dpan. + if (axis.valueWindow || axis.valueRange) context.is2DPan = true; + } +}; + +/** + * Called in response to an interaction model operation that + * responds to an event that pans the view. + * + * It's used in the default callback for "mousemove" operations. + * Custom interaction model builders can use it to provide the default + * panning behavior. + * + * @param {Event} event the event object which led to the movePan call. + * @param {Dygraph} g The dygraph on which to act. + * @param {Object} context The dragging context object (with + * dragStartX/dragStartY/etc. properties). This function modifies the + * context. + */ +Dygraph.Interaction.movePan = function(event, g, context) { + context.dragEndX = g.dragGetX_(event, context); + context.dragEndY = g.dragGetY_(event, context); + + var minDate = context.initialLeftmostDate - + (context.dragEndX - context.dragStartX) * context.xUnitsPerPixel; + if (context.boundedDates) { + minDate = Math.max(minDate, context.boundedDates[0]); + } + var maxDate = minDate + context.dateRange; + if (context.boundedDates) { + if (maxDate > context.boundedDates[1]) { + // Adjust minDate, and recompute maxDate. + minDate = minDate - (maxDate - context.boundedDates[1]); + maxDate = minDate + context.dateRange; + } + } + + g.dateWindow_ = [minDate, maxDate]; + + // y-axis scaling is automatic unless this is a full 2D pan. + if (context.is2DPan) { + + var pixelsDragged = context.dragEndY - context.dragStartY; + + // Adjust each axis appropriately. + for (var i = 0; i < g.axes_.length; i++) { + var axis = g.axes_[i]; + var axis_data = context.axes[i]; + var unitsDragged = pixelsDragged * axis_data.unitsPerPixel; + + var boundedValue = context.boundedValues ? context.boundedValues[i] : null; + + // In log scale, maxValue and minValue are the logs of those values. + var maxValue = axis_data.initialTopValue + unitsDragged; + if (boundedValue) { + maxValue = Math.min(maxValue, boundedValue[1]); + } + var minValue = maxValue - axis_data.dragValueRange; + if (boundedValue) { + if (minValue < boundedValue[0]) { + // Adjust maxValue, and recompute minValue. + maxValue = maxValue - (minValue - boundedValue[0]); + minValue = maxValue - axis_data.dragValueRange; + } + } + var logscale = g.attributes_.getForAxis("logscale", i); + if (logscale) { + axis.valueWindow = [ Math.pow(Dygraph.LOG_SCALE, minValue), + Math.pow(Dygraph.LOG_SCALE, maxValue) ]; + } else { + axis.valueWindow = [ minValue, maxValue ]; + } + } + } + + g.drawGraph_(false); +}; + +/** + * Called in response to an interaction model operation that + * responds to an event that ends panning. + * + * It's used in the default callback for "mouseup" operations. + * Custom interaction model builders can use it to provide the default + * panning behavior. + * + * @param {Event} event the event object which led to the endPan call. + * @param {Dygraph} g The dygraph on which to act. + * @param {Object} context The dragging context object (with + * dragStartX/dragStartY/etc. properties). This function modifies the + * context. + */ +Dygraph.Interaction.endPan = function(event, g, context) { + context.dragEndX = g.dragGetX_(event, context); + context.dragEndY = g.dragGetY_(event, context); + + var regionWidth = Math.abs(context.dragEndX - context.dragStartX); + var regionHeight = Math.abs(context.dragEndY - context.dragStartY); + + if (regionWidth < 2 && regionHeight < 2 && + g.lastx_ !== undefined && g.lastx_ != -1) { + Dygraph.Interaction.treatMouseOpAsClick(g, event, context); + } + + // TODO(konigsberg): mouseup should just delete the + // context object, and mousedown should create a new one. + context.isPanning = false; + context.is2DPan = false; + context.initialLeftmostDate = null; + context.dateRange = null; + context.valueRange = null; + context.boundedDates = null; + context.boundedValues = null; + context.axes = null; +}; + +/** + * Called in response to an interaction model operation that + * responds to an event that starts zooming. + * + * It's used in the default callback for "mousedown" operations. + * Custom interaction model builders can use it to provide the default + * zooming behavior. + * + * @param {Event} event the event object which led to the startZoom call. + * @param {Dygraph} g The dygraph on which to act. + * @param {Object} context The dragging context object (with + * dragStartX/dragStartY/etc. properties). This function modifies the + * context. + */ +Dygraph.Interaction.startZoom = function(event, g, context) { + context.isZooming = true; + context.zoomMoved = false; +}; + +/** + * Called in response to an interaction model operation that + * responds to an event that defines zoom boundaries. + * + * It's used in the default callback for "mousemove" operations. + * Custom interaction model builders can use it to provide the default + * zooming behavior. + * + * @param {Event} event the event object which led to the moveZoom call. + * @param {Dygraph} g The dygraph on which to act. + * @param {Object} context The dragging context object (with + * dragStartX/dragStartY/etc. properties). This function modifies the + * context. + */ +Dygraph.Interaction.moveZoom = function(event, g, context) { + context.zoomMoved = true; + context.dragEndX = g.dragGetX_(event, context); + context.dragEndY = g.dragGetY_(event, context); + + var xDelta = Math.abs(context.dragStartX - context.dragEndX); + var yDelta = Math.abs(context.dragStartY - context.dragEndY); + + // drag direction threshold for y axis is twice as large as x axis + context.dragDirection = (xDelta < yDelta / 2) ? Dygraph.VERTICAL : Dygraph.HORIZONTAL; + + g.drawZoomRect_( + context.dragDirection, + context.dragStartX, + context.dragEndX, + context.dragStartY, + context.dragEndY, + context.prevDragDirection, + context.prevEndX, + context.prevEndY); + + context.prevEndX = context.dragEndX; + context.prevEndY = context.dragEndY; + context.prevDragDirection = context.dragDirection; +}; + +/** + * @param {Dygraph} g + * @param {Event} event + * @param {Object} context + */ +Dygraph.Interaction.treatMouseOpAsClick = function(g, event, context) { + var clickCallback = g.attr_('clickCallback'); + var pointClickCallback = g.attr_('pointClickCallback'); + + var selectedPoint = null; + + // Find out if the click occurs on a point. This only matters if there's a + // pointClickCallback. + if (pointClickCallback) { + var closestIdx = -1; + var closestDistance = Number.MAX_VALUE; + + // check if the click was on a particular point. + for (var i = 0; i < g.selPoints_.length; i++) { + var p = g.selPoints_[i]; + var distance = Math.pow(p.canvasx - context.dragEndX, 2) + + Math.pow(p.canvasy - context.dragEndY, 2); + if (!isNaN(distance) && + (closestIdx == -1 || distance < closestDistance)) { + closestDistance = distance; + closestIdx = i; + } + } + + // Allow any click within two pixels of the dot. + var radius = g.attr_('highlightCircleSize') + 2; + if (closestDistance <= radius * radius) { + selectedPoint = g.selPoints_[closestIdx]; + } + } + + if (selectedPoint) { + pointClickCallback(event, selectedPoint); + } + + // TODO(danvk): pass along more info about the points, e.g. 'x' + if (clickCallback) { + clickCallback(event, g.lastx_, g.selPoints_); + } +}; + +/** + * Called in response to an interaction model operation that + * responds to an event that performs a zoom based on previously defined + * bounds.. + * + * It's used in the default callback for "mouseup" operations. + * Custom interaction model builders can use it to provide the default + * zooming behavior. + * + * @param {Event} event the event object which led to the endZoom call. + * @param {Dygraph} g The dygraph on which to end the zoom. + * @param {Object} context The dragging context object (with + * dragStartX/dragStartY/etc. properties). This function modifies the + * context. + */ +Dygraph.Interaction.endZoom = function(event, g, context) { + context.isZooming = false; + context.dragEndX = g.dragGetX_(event, context); + context.dragEndY = g.dragGetY_(event, context); + var regionWidth = Math.abs(context.dragEndX - context.dragStartX); + var regionHeight = Math.abs(context.dragEndY - context.dragStartY); + + if (regionWidth < 2 && regionHeight < 2 && + g.lastx_ !== undefined && g.lastx_ != -1) { + Dygraph.Interaction.treatMouseOpAsClick(g, event, context); + } + + // The zoom rectangle is visibly clipped to the plot area, so its behavior + // should be as well. + // See http://code.google.com/p/dygraphs/issues/detail?id=280 + var plotArea = g.getArea(); + if (regionWidth >= 10 && context.dragDirection == Dygraph.HORIZONTAL) { + var left = Math.min(context.dragStartX, context.dragEndX), + right = Math.max(context.dragStartX, context.dragEndX); + left = Math.max(left, plotArea.x); + right = Math.min(right, plotArea.x + plotArea.w); + if (left < right) { + g.doZoomX_(left, right); + } + context.cancelNextDblclick = true; + } else if (regionHeight >= 10 && context.dragDirection == Dygraph.VERTICAL) { + var top = Math.min(context.dragStartY, context.dragEndY), + bottom = Math.max(context.dragStartY, context.dragEndY); + top = Math.max(top, plotArea.y); + bottom = Math.min(bottom, plotArea.y + plotArea.h); + if (top < bottom) { + g.doZoomY_(top, bottom); + } + context.cancelNextDblclick = true; + } else { + if (context.zoomMoved) g.clearZoomRect_(); + } + context.dragStartX = null; + context.dragStartY = null; +}; + +/** + * @private + */ +Dygraph.Interaction.startTouch = function(event, g, context) { + event.preventDefault(); // touch browsers are all nice. + if (event.touches.length > 1) { + // If the user ever puts two fingers down, it's not a double tap. + context.startTimeForDoubleTapMs = null; + } + + var touches = []; + for (var i = 0; i < event.touches.length; i++) { + var t = event.touches[i]; + // we dispense with 'dragGetX_' because all touchBrowsers support pageX + touches.push({ + pageX: t.pageX, + pageY: t.pageY, + dataX: g.toDataXCoord(t.pageX), + dataY: g.toDataYCoord(t.pageY) + // identifier: t.identifier + }); + } + context.initialTouches = touches; + + if (touches.length == 1) { + // This is just a swipe. + context.initialPinchCenter = touches[0]; + context.touchDirections = { x: true, y: true }; + } else if (touches.length >= 2) { + // It's become a pinch! + // In case there are 3+ touches, we ignore all but the "first" two. + + // only screen coordinates can be averaged (data coords could be log scale). + context.initialPinchCenter = { + pageX: 0.5 * (touches[0].pageX + touches[1].pageX), + pageY: 0.5 * (touches[0].pageY + touches[1].pageY), + + // TODO(danvk): remove + dataX: 0.5 * (touches[0].dataX + touches[1].dataX), + dataY: 0.5 * (touches[0].dataY + touches[1].dataY) + }; + + // Make pinches in a 45-degree swath around either axis 1-dimensional zooms. + var initialAngle = 180 / Math.PI * Math.atan2( + context.initialPinchCenter.pageY - touches[0].pageY, + touches[0].pageX - context.initialPinchCenter.pageX); + + // use symmetry to get it into the first quadrant. + initialAngle = Math.abs(initialAngle); + if (initialAngle > 90) initialAngle = 90 - initialAngle; + + context.touchDirections = { + x: (initialAngle < (90 - 45/2)), + y: (initialAngle > 45/2) + }; + } + + // save the full x & y ranges. + context.initialRange = { + x: g.xAxisRange(), + y: g.yAxisRange() + }; +}; + +/** + * @private + */ +Dygraph.Interaction.moveTouch = function(event, g, context) { + // If the tap moves, then it's definitely not part of a double-tap. + context.startTimeForDoubleTapMs = null; + + var i, touches = []; + for (i = 0; i < event.touches.length; i++) { + var t = event.touches[i]; + touches.push({ + pageX: t.pageX, + pageY: t.pageY + }); + } + var initialTouches = context.initialTouches; + + var c_now; + + // old and new centers. + var c_init = context.initialPinchCenter; + if (touches.length == 1) { + c_now = touches[0]; + } else { + c_now = { + pageX: 0.5 * (touches[0].pageX + touches[1].pageX), + pageY: 0.5 * (touches[0].pageY + touches[1].pageY) + }; + } + + // this is the "swipe" component + // we toss it out for now, but could use it in the future. + var swipe = { + pageX: c_now.pageX - c_init.pageX, + pageY: c_now.pageY - c_init.pageY + }; + var dataWidth = context.initialRange.x[1] - context.initialRange.x[0]; + var dataHeight = context.initialRange.y[0] - context.initialRange.y[1]; + swipe.dataX = (swipe.pageX / g.plotter_.area.w) * dataWidth; + swipe.dataY = (swipe.pageY / g.plotter_.area.h) * dataHeight; + var xScale, yScale; + + // The residual bits are usually split into scale & rotate bits, but we split + // them into x-scale and y-scale bits. + if (touches.length == 1) { + xScale = 1.0; + yScale = 1.0; + } else if (touches.length >= 2) { + var initHalfWidth = (initialTouches[1].pageX - c_init.pageX); + xScale = (touches[1].pageX - c_now.pageX) / initHalfWidth; + + var initHalfHeight = (initialTouches[1].pageY - c_init.pageY); + yScale = (touches[1].pageY - c_now.pageY) / initHalfHeight; + } + + // Clip scaling to [1/8, 8] to prevent too much blowup. + xScale = Math.min(8, Math.max(0.125, xScale)); + yScale = Math.min(8, Math.max(0.125, yScale)); + + var didZoom = false; + if (context.touchDirections.x) { + g.dateWindow_ = [ + c_init.dataX - swipe.dataX + (context.initialRange.x[0] - c_init.dataX) / xScale, + c_init.dataX - swipe.dataX + (context.initialRange.x[1] - c_init.dataX) / xScale + ]; + didZoom = true; + } + + if (context.touchDirections.y) { + for (i = 0; i < 1 /*g.axes_.length*/; i++) { + var axis = g.axes_[i]; + var logscale = g.attributes_.getForAxis("logscale", i); + if (logscale) { + // TODO(danvk): implement + } else { + axis.valueWindow = [ + c_init.dataY - swipe.dataY + (context.initialRange.y[0] - c_init.dataY) / yScale, + c_init.dataY - swipe.dataY + (context.initialRange.y[1] - c_init.dataY) / yScale + ]; + didZoom = true; + } + } + } + + g.drawGraph_(false); + + // We only call zoomCallback on zooms, not pans, to mirror desktop behavior. + if (didZoom && touches.length > 1 && g.attr_('zoomCallback')) { + var viewWindow = g.xAxisRange(); + g.attr_("zoomCallback")(viewWindow[0], viewWindow[1], g.yAxisRanges()); + } +}; + +/** + * @private + */ +Dygraph.Interaction.endTouch = function(event, g, context) { + if (event.touches.length !== 0) { + // this is effectively a "reset" + Dygraph.Interaction.startTouch(event, g, context); + } else if (event.changedTouches.length == 1) { + // Could be part of a "double tap" + // The heuristic here is that it's a double-tap if the two touchend events + // occur within 500ms and within a 50x50 pixel box. + var now = new Date().getTime(); + var t = event.changedTouches[0]; + if (context.startTimeForDoubleTapMs && + now - context.startTimeForDoubleTapMs < 500 && + context.doubleTapX && Math.abs(context.doubleTapX - t.screenX) < 50 && + context.doubleTapY && Math.abs(context.doubleTapY - t.screenY) < 50) { + g.resetZoom(); + } else { + context.startTimeForDoubleTapMs = now; + context.doubleTapX = t.screenX; + context.doubleTapY = t.screenY; + } + } +}; + +/** + * Default interation model for dygraphs. You can refer to specific elements of + * this when constructing your own interaction model, e.g.: + * g.updateOptions( { + * interactionModel: { + * mousedown: Dygraph.defaultInteractionModel.mousedown + * } + * } ); + */ +Dygraph.Interaction.defaultModel = { + // Track the beginning of drag events + mousedown: function(event, g, context) { + // Right-click should not initiate a zoom. + if (event.button && event.button == 2) return; + + context.initializeMouseDown(event, g, context); + + if (event.altKey || event.shiftKey) { + Dygraph.startPan(event, g, context); + } else { + Dygraph.startZoom(event, g, context); + } + }, + + // Draw zoom rectangles when the mouse is down and the user moves around + mousemove: function(event, g, context) { + if (context.isZooming) { + Dygraph.moveZoom(event, g, context); + } else if (context.isPanning) { + Dygraph.movePan(event, g, context); + } + }, + + mouseup: function(event, g, context) { + if (context.isZooming) { + Dygraph.endZoom(event, g, context); + } else if (context.isPanning) { + Dygraph.endPan(event, g, context); + } + }, + + touchstart: function(event, g, context) { + Dygraph.Interaction.startTouch(event, g, context); + }, + touchmove: function(event, g, context) { + Dygraph.Interaction.moveTouch(event, g, context); + }, + touchend: function(event, g, context) { + Dygraph.Interaction.endTouch(event, g, context); + }, + + // Temporarily cancel the dragging event when the mouse leaves the graph + mouseout: function(event, g, context) { + if (context.isZooming) { + context.dragEndX = null; + context.dragEndY = null; + g.clearZoomRect_(); + } + }, + + // Disable zooming out if panning. + dblclick: function(event, g, context) { + if (context.cancelNextDblclick) { + context.cancelNextDblclick = false; + return; + } + if (event.altKey || event.shiftKey) { + return; + } + g.resetZoom(); + } +}; + +Dygraph.DEFAULT_ATTRS.interactionModel = Dygraph.Interaction.defaultModel; + +// old ways of accessing these methods/properties +Dygraph.defaultInteractionModel = Dygraph.Interaction.defaultModel; +Dygraph.endZoom = Dygraph.Interaction.endZoom; +Dygraph.moveZoom = Dygraph.Interaction.moveZoom; +Dygraph.startZoom = Dygraph.Interaction.startZoom; +Dygraph.endPan = Dygraph.Interaction.endPan; +Dygraph.movePan = Dygraph.Interaction.movePan; +Dygraph.startPan = Dygraph.Interaction.startPan; + +Dygraph.Interaction.nonInteractiveModel_ = { + mousedown: function(event, g, context) { + context.initializeMouseDown(event, g, context); + }, + mouseup: function(event, g, context) { + // TODO(danvk): this logic is repeated in Dygraph.Interaction.endZoom + context.dragEndX = g.dragGetX_(event, context); + context.dragEndY = g.dragGetY_(event, context); + var regionWidth = Math.abs(context.dragEndX - context.dragStartX); + var regionHeight = Math.abs(context.dragEndY - context.dragStartY); + + if (regionWidth < 2 && regionHeight < 2 && + g.lastx_ !== undefined && g.lastx_ != -1) { + Dygraph.Interaction.treatMouseOpAsClick(g, event, context); + } + } +}; + +// Default interaction model when using the range selector. +Dygraph.Interaction.dragIsPanInteractionModel = { + mousedown: function(event, g, context) { + context.initializeMouseDown(event, g, context); + Dygraph.startPan(event, g, context); + }, + mousemove: function(event, g, context) { + if (context.isPanning) { + Dygraph.movePan(event, g, context); + } + }, + mouseup: function(event, g, context) { + if (context.isPanning) { + Dygraph.endPan(event, g, context); + } + } +}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-layout.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-layout.js new file mode 100644 index 0000000..e766e8f --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-layout.js @@ -0,0 +1,349 @@ +/** + * @license + * Copyright 2011 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview Based on PlotKitLayout, but modified to meet the needs of + * dygraphs. + */ + +/*jshint globalstrict: true */ +/*global Dygraph:false */ +"use strict"; + +/** + * Creates a new DygraphLayout object. + * + * This class contains all the data to be charted. + * It uses data coordinates, but also records the chart range (in data + * coordinates) and hence is able to calculate percentage positions ('In this + * view, Point A lies 25% down the x-axis.') + * + * Two things that it does not do are: + * 1. Record pixel coordinates for anything. + * 2. (oddly) determine anything about the layout of chart elements. + * + * The naming is a vestige of Dygraph's original PlotKit roots. + * + * @constructor + */ +var DygraphLayout = function(dygraph) { + this.dygraph_ = dygraph; + /** + * Array of points for each series. + * + * [series index][row index in series] = |Point| structure, + * where series index refers to visible series only, and the + * point index is for the reduced set of points for the current + * zoom region (including one point just outside the window). + * All points in the same row index share the same X value. + * + * @type {Array.>} + */ + this.points = []; + this.setNames = []; + this.annotations = []; + this.yAxes_ = null; + + // TODO(danvk): it's odd that xTicks_ and yTicks_ are inputs, but xticks and + // yticks are outputs. Clean this up. + this.xTicks_ = null; + this.yTicks_ = null; +}; + +DygraphLayout.prototype.attr_ = function(name) { + return this.dygraph_.attr_(name); +}; + +/** + * Add points for a single series. + * + * @param {string} setname Name of the series. + * @param {Array.} set_xy Points for the series. + */ +DygraphLayout.prototype.addDataset = function(setname, set_xy) { + this.points.push(set_xy); + this.setNames.push(setname); +}; + +/** + * Returns the box which the chart should be drawn in. This is the canvas's + * box, less space needed for the axis and chart labels. + * + * @return {{x: number, y: number, w: number, h: number}} + */ +DygraphLayout.prototype.getPlotArea = function() { + return this.area_; +}; + +// Compute the box which the chart should be drawn in. This is the canvas's +// box, less space needed for axis, chart labels, and other plug-ins. +// NOTE: This should only be called by Dygraph.predraw_(). +DygraphLayout.prototype.computePlotArea = function() { + var area = { + // TODO(danvk): per-axis setting. + x: 0, + y: 0 + }; + + area.w = this.dygraph_.width_ - area.x - this.attr_('rightGap'); + area.h = this.dygraph_.height_; + + // Let plugins reserve space. + var e = { + chart_div: this.dygraph_.graphDiv, + reserveSpaceLeft: function(px) { + var r = { + x: area.x, + y: area.y, + w: px, + h: area.h + }; + area.x += px; + area.w -= px; + return r; + }, + reserveSpaceRight: function(px) { + var r = { + x: area.x + area.w - px, + y: area.y, + w: px, + h: area.h + }; + area.w -= px; + return r; + }, + reserveSpaceTop: function(px) { + var r = { + x: area.x, + y: area.y, + w: area.w, + h: px + }; + area.y += px; + area.h -= px; + return r; + }, + reserveSpaceBottom: function(px) { + var r = { + x: area.x, + y: area.y + area.h - px, + w: area.w, + h: px + }; + area.h -= px; + return r; + }, + chartRect: function() { + return {x:area.x, y:area.y, w:area.w, h:area.h}; + } + }; + this.dygraph_.cascadeEvents_('layout', e); + + this.area_ = area; +}; + +DygraphLayout.prototype.setAnnotations = function(ann) { + // The Dygraph object's annotations aren't parsed. We parse them here and + // save a copy. If there is no parser, then the user must be using raw format. + this.annotations = []; + var parse = this.attr_('xValueParser') || function(x) { return x; }; + for (var i = 0; i < ann.length; i++) { + var a = {}; + if (!ann[i].xval && ann[i].x === undefined) { + this.dygraph_.error("Annotations must have an 'x' property"); + return; + } + if (ann[i].icon && + !(ann[i].hasOwnProperty('width') && + ann[i].hasOwnProperty('height'))) { + this.dygraph_.error("Must set width and height when setting " + + "annotation.icon property"); + return; + } + Dygraph.update(a, ann[i]); + if (!a.xval) a.xval = parse(a.x); + this.annotations.push(a); + } +}; + +DygraphLayout.prototype.setXTicks = function(xTicks) { + this.xTicks_ = xTicks; +}; + +// TODO(danvk): add this to the Dygraph object's API or move it into Layout. +DygraphLayout.prototype.setYAxes = function (yAxes) { + this.yAxes_ = yAxes; +}; + +DygraphLayout.prototype.evaluate = function() { + this._evaluateLimits(); + this._evaluateLineCharts(); + this._evaluateLineTicks(); + this._evaluateAnnotations(); +}; + +DygraphLayout.prototype._evaluateLimits = function() { + var xlimits = this.dygraph_.xAxisRange(); + this.minxval = xlimits[0]; + this.maxxval = xlimits[1]; + var xrange = xlimits[1] - xlimits[0]; + this.xscale = (xrange !== 0 ? 1 / xrange : 1.0); + + for (var i = 0; i < this.yAxes_.length; i++) { + var axis = this.yAxes_[i]; + axis.minyval = axis.computedValueRange[0]; + axis.maxyval = axis.computedValueRange[1]; + axis.yrange = axis.maxyval - axis.minyval; + axis.yscale = (axis.yrange !== 0 ? 1.0 / axis.yrange : 1.0); + + if (axis.g.attr_("logscale")) { + axis.ylogrange = Dygraph.log10(axis.maxyval) - Dygraph.log10(axis.minyval); + axis.ylogscale = (axis.ylogrange !== 0 ? 1.0 / axis.ylogrange : 1.0); + if (!isFinite(axis.ylogrange) || isNaN(axis.ylogrange)) { + axis.g.error('axis ' + i + ' of graph at ' + axis.g + + ' can\'t be displayed in log scale for range [' + + axis.minyval + ' - ' + axis.maxyval + ']'); + } + } + } +}; + +DygraphLayout._calcYNormal = function(axis, value, logscale) { + if (logscale) { + return 1.0 - ((Dygraph.log10(value) - Dygraph.log10(axis.minyval)) * axis.ylogscale); + } else { + return 1.0 - ((value - axis.minyval) * axis.yscale); + } +}; + +DygraphLayout.prototype._evaluateLineCharts = function() { + var connectSeparated = this.attr_('connectSeparatedPoints'); + var isStacked = this.attr_("stackedGraph"); + var hasBars = this.attr_('errorBars') || this.attr_('customBars'); + + for (var setIdx = 0; setIdx < this.points.length; setIdx++) { + var points = this.points[setIdx]; + var setName = this.setNames[setIdx]; + var axis = this.dygraph_.axisPropertiesForSeries(setName); + // TODO (konigsberg): use optionsForAxis instead. + var logscale = this.dygraph_.attributes_.getForSeries("logscale", setName); + + for (var j = 0; j < points.length; j++) { + var point = points[j]; + + // Range from 0-1 where 0 represents left and 1 represents right. + point.x = (point.xval - this.minxval) * this.xscale; + // Range from 0-1 where 0 represents top and 1 represents bottom + var yval = point.yval; + if (isStacked) { + point.y_stacked = DygraphLayout._calcYNormal( + axis, point.yval_stacked, logscale); + if (yval !== null && !isNaN(yval)) { + yval = point.yval_stacked; + } + } + if (yval === null) { + yval = NaN; + if (!connectSeparated) { + point.yval = NaN; + } + } + point.y = DygraphLayout._calcYNormal(axis, yval, logscale); + + if (hasBars) { + point.y_top = DygraphLayout._calcYNormal( + axis, yval - point.yval_minus, logscale); + point.y_bottom = DygraphLayout._calcYNormal( + axis, yval + point.yval_plus, logscale); + } + } + } +}; + +/** + * Optimized replacement for parseFloat, which was way too slow when almost + * all values were type number, with few edge cases, none of which were strings. + */ +DygraphLayout.parseFloat_ = function(val) { + // parseFloat(null) is NaN + if (val === null) { + return NaN; + } + + // Assume it's a number or NaN. If it's something else, I'll be shocked. + return val; +}; + +DygraphLayout.prototype._evaluateLineTicks = function() { + var i, tick, label, pos; + this.xticks = []; + for (i = 0; i < this.xTicks_.length; i++) { + tick = this.xTicks_[i]; + label = tick.label; + pos = this.xscale * (tick.v - this.minxval); + if ((pos >= 0.0) && (pos <= 1.0)) { + this.xticks.push([pos, label]); + } + } + + this.yticks = []; + for (i = 0; i < this.yAxes_.length; i++ ) { + var axis = this.yAxes_[i]; + for (var j = 0; j < axis.ticks.length; j++) { + tick = axis.ticks[j]; + label = tick.label; + pos = this.dygraph_.toPercentYCoord(tick.v, i); + if ((pos >= 0.0) && (pos <= 1.0)) { + this.yticks.push([i, pos, label]); + } + } + } +}; + +DygraphLayout.prototype._evaluateAnnotations = function() { + // Add the annotations to the point to which they belong. + // Make a map from (setName, xval) to annotation for quick lookups. + var i; + var annotations = {}; + for (i = 0; i < this.annotations.length; i++) { + var a = this.annotations[i]; + annotations[a.xval + "," + a.series] = a; + } + + this.annotated_points = []; + + // Exit the function early if there are no annotations. + if (!this.annotations || !this.annotations.length) { + return; + } + + // TODO(antrob): loop through annotations not points. + for (var setIdx = 0; setIdx < this.points.length; setIdx++) { + var points = this.points[setIdx]; + for (i = 0; i < points.length; i++) { + var p = points[i]; + var k = p.xval + "," + p.name; + if (k in annotations) { + p.annotation = annotations[k]; + this.annotated_points.push(p); + } + } + } +}; + +/** + * Convenience function to remove all the data sets from a graph + */ +DygraphLayout.prototype.removeAllDatasets = function() { + delete this.points; + delete this.setNames; + delete this.setPointsLengths; + delete this.setPointsOffsets; + this.points = []; + this.setNames = []; + this.setPointsLengths = []; + this.setPointsOffsets = []; +}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-options-reference.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-options-reference.js new file mode 100644 index 0000000..64e738d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-options-reference.js @@ -0,0 +1,867 @@ +/** + * @license + * Copyright 2011 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/*jshint globalstrict: true */ +/*global Dygraph:false */ + +// NOTE: in addition to parsing as JS, this snippet is expected to be valid +// JSON. This assumption cannot be checked in JS, but it will be checked when +// documentation is generated by the generate-documentation.py script. For the +// most part, this just means that you should always use double quotes. +Dygraph.OPTIONS_REFERENCE = // +{ + "xValueParser": { + "default": "parseFloat() or Date.parse()*", + "labels": ["CSV parsing"], + "type": "function(str) -> number", + "description": "A function which parses x-values (i.e. the dependent series). Must return a number, even when the values are dates. In this case, millis since epoch are used. This is used primarily for parsing CSV data. *=Dygraphs is slightly more accepting in the dates which it will parse. See code for details." + }, + "stackedGraph": { + "default": "false", + "labels": ["Data Line display"], + "type": "boolean", + "description": "If set, stack series on top of one another rather than drawing them independently. The first series specified in the input data will wind up on top of the chart and the last will be on bottom. NaN values are drawn as white areas without a line on top, see stackedGraphNaNFill for details." + }, + "stackedGraphNaNFill": { + "default": "all", + "labels": ["Data Line display"], + "type": "string", + "description": "Controls handling of NaN values inside a stacked graph. NaN values are interpolated/extended for stacking purposes, but the actual point value remains NaN in the legend display. Valid option values are \"all\" (interpolate internally, repeat leftmost and rightmost value as needed), \"inside\" (interpolate internally only, use zero outside leftmost and rightmost value), and \"none\" (treat NaN as zero everywhere)." + }, + "pointSize": { + "default": "1", + "labels": ["Data Line display"], + "type": "integer", + "description": "The size of the dot to draw on each point in pixels (see drawPoints). A dot is always drawn when a point is \"isolated\", i.e. there is a missing point on either side of it. This also controls the size of those dots." + }, + "labelsDivStyles": { + "default": "null", + "labels": ["Legend"], + "type": "{}", + "description": "Additional styles to apply to the currently-highlighted points div. For example, { 'fontWeight': 'bold' } will make the labels bold. In general, it is better to use CSS to style the .dygraph-legend class than to use this property." + }, + "drawPoints": { + "default": "false", + "labels": ["Data Line display"], + "type": "boolean", + "description": "Draw a small dot at each point, in addition to a line going through the point. This makes the individual data points easier to see, but can increase visual clutter in the chart. The small dot can be replaced with a custom rendering by supplying a drawPointCallback." + }, + "drawGapEdgePoints": { + "default": "false", + "labels": ["Data Line display"], + "type": "boolean", + "description": "Draw points at the edges of gaps in the data. This improves visibility of small data segments or other data irregularities." + }, + "drawPointCallback": { + "default": "null", + "labels": ["Data Line display"], + "type": "function(g, seriesName, canvasContext, cx, cy, color, pointSize)", + "parameters": [ + [ "g" , "the reference graph" ], + [ "seriesName" , "the name of the series" ], + [ "canvasContext" , "the canvas to draw on" ], + [ "cx" , "center x coordinate" ], + [ "cy" , "center y coordinate" ], + [ "color" , "series color" ], + [ "pointSize" , "the radius of the image." ], + [ "idx" , "the row-index of the point in the data."] + ], + "description": "Draw a custom item when drawPoints is enabled. Default is a small dot matching the series color. This method should constrain drawing to within pointSize pixels from (cx, cy). Also see drawHighlightPointCallback" + }, + "height": { + "default": "320", + "labels": ["Overall display"], + "type": "integer", + "description": "Height, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored." + }, + "zoomCallback": { + "default": "null", + "labels": ["Callbacks"], + "type": "function(minDate, maxDate, yRanges)", + "parameters": [ + [ "minDate" , "milliseconds since epoch" ], + [ "maxDate" , "milliseconds since epoch." ], + [ "yRanges" , "is an array of [bottom, top] pairs, one for each y-axis." ] + ], + "description": "A function to call when the zoom window is changed (either by zooming in or out)." + }, + "pointClickCallback": { + "snippet": "function(e, point){
            alert(point);
          }", + "default": "null", + "labels": ["Callbacks", "Interactive Elements"], + "type": "function(e, point)", + "parameters": [ + [ "e" , "the event object for the click" ], + [ "point" , "the point that was clicked See Point properties for details" ] + ], + "description": "A function to call when a data point is clicked. and the point that was clicked." + }, + "colors": { + "default": "(see description)", + "labels": ["Data Series Colors"], + "type": "array", + "example": "['red', '#00FF00']", + "description": "List of colors for the data series. These can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"yellow\", etc. If not specified, equally-spaced points around a color wheel are used." + }, + "connectSeparatedPoints": { + "default": "false", + "labels": ["Data Line display"], + "type": "boolean", + "description": "Usually, when Dygraphs encounters a missing value in a data series, it interprets this as a gap and draws it as such. If, instead, the missing values represents an x-value for which only a different series has data, then you'll want to connect the dots by setting this to true. To explicitly include a gap with this option set, use a value of NaN." + }, + "highlightCallback": { + "default": "null", + "labels": ["Callbacks"], + "type": "function(event, x, points, row, seriesName)", + "description": "When set, this callback gets called every time a new point is highlighted.", + "parameters": [ + ["event", "the JavaScript mousemove event"], + ["x", "the x-coordinate of the highlighted points"], + ["points", "an array of highlighted points: [ {name: 'series', yval: y-value}, … ]"], + ["row", "integer index of the highlighted row in the data table, starting from 0"], + ["seriesName", "name of the highlighted series, only present if highlightSeriesOpts is set."] + ] + }, + "drawHighlightPointCallback": { + "default": "null", + "labels": ["Data Line display"], + "type": "function(g, seriesName, canvasContext, cx, cy, color, pointSize)", + "parameters": [ + [ "g" , "the reference graph" ], + [ "seriesName" , "the name of the series" ], + [ "canvasContext" , "the canvas to draw on" ], + [ "cx" , "center x coordinate" ], + [ "cy" , "center y coordinate" ], + [ "color" , "series color" ], + [ "pointSize" , "the radius of the image." ], + [ "idx" , "the row-index of the point in the data."] + ], + "description": "Draw a custom item when a point is highlighted. Default is a small dot matching the series color. This method should constrain drawing to within pointSize pixels from (cx, cy) Also see drawPointCallback" + }, + "highlightSeriesOpts": { + "default": "null", + "labels": ["Interactive Elements"], + "type": "Object", + "description": "When set, the options from this object are applied to the timeseries closest to the mouse pointer for interactive highlighting. See also 'highlightCallback'. Example: highlightSeriesOpts: { strokeWidth: 3 }." + }, + "highlightSeriesBackgroundAlpha": { + "default": "0.5", + "labels": ["Interactive Elements"], + "type": "float", + "description": "Fade the background while highlighting series. 1=fully visible background (disable fading), 0=hiddden background (show highlighted series only)." + }, + "includeZero": { + "default": "false", + "labels": ["Axis display"], + "type": "boolean", + "description": "Usually, dygraphs will use the range of the data plus some padding to set the range of the y-axis. If this option is set, the y-axis will always include zero, typically as the lowest value. This can be used to avoid exaggerating the variance in the data" + }, + "rollPeriod": { + "default": "1", + "labels": ["Error Bars", "Rolling Averages"], + "type": "integer >= 1", + "description": "Number of days over which to average data. Discussed extensively above." + }, + "unhighlightCallback": { + "default": "null", + "labels": ["Callbacks"], + "type": "function(event)", + "parameters": [ + [ "event" , "the mouse event" ] + ], + "description": "When set, this callback gets called every time the user stops highlighting any point by mousing out of the graph." + }, + "axisTickSize": { + "default": "3.0", + "labels": ["Axis display"], + "type": "number", + "description": "The size of the line to display next to each tick mark on x- or y-axes." + }, + "labelsSeparateLines": { + "default": "false", + "labels": ["Legend"], + "type": "boolean", + "description": "Put <br/> between lines in the label string. Often used in conjunction with labelsDiv." + }, + "xValueFormatter": { + "default": "", + "labels": ["Deprecated"], + "type": "", + "description": "Prefer axes: { x: { valueFormatter } }" + }, + "valueFormatter": { + "default": "Depends on the type of your data.", + "labels": ["Legend", "Value display/formatting"], + "type": "function(num or millis, opts, dygraph)", + "description": "Function to provide a custom display format for the values displayed on mouseover. This does not affect the values that appear on tick marks next to the axes. To format those, see axisLabelFormatter. This is usually set on a per-axis basis. For date axes, you can call new Date(millis) to get a Date object. opts is a function you can call to access various options (e.g. opts('labelsKMB'))." + }, + "pixelsPerYLabel": { + "default": "", + "labels": ["Deprecated"], + "type": "integer", + "description": "Prefer axes: { y: { pixelsPerLabel } }" + }, + "annotationMouseOverHandler": { + "default": "null", + "labels": ["Annotations"], + "type": "function(annotation, point, dygraph, event)", + "description": "If provided, this function is called whenever the user mouses over an annotation." + }, + "annotationMouseOutHandler": { + "default": "null", + "labels": ["Annotations"], + "type": "function(annotation, point, dygraph, event)", + "parameters": [ + [ "annotation" , "the annotation left" ], + [ "point" , "the point associated with the annotation" ], + [ "dygraph" , "the reference graph" ], + [ "event" , "the mouse event" ] + ], + "description": "If provided, this function is called whenever the user mouses out of an annotation." + }, + "annotationClickHandler": { + "default": "null", + "labels": ["Annotations"], + "type": "function(annotation, point, dygraph, event)", + "parameters": [ + [ "annotation" , "the annotation left" ], + [ "point" , "the point associated with the annotation" ], + [ "dygraph" , "the reference graph" ], + [ "event" , "the mouse event" ] + ], + "description": "If provided, this function is called whenever the user clicks on an annotation." + }, + "annotationDblClickHandler": { + "default": "null", + "labels": ["Annotations"], + "type": "function(annotation, point, dygraph, event)", + "parameters": [ + [ "annotation" , "the annotation left" ], + [ "point" , "the point associated with the annotation" ], + [ "dygraph" , "the reference graph" ], + [ "event" , "the mouse event" ] + ], + "description": "If provided, this function is called whenever the user double-clicks on an annotation." + }, + "drawCallback": { + "default": "null", + "labels": ["Callbacks"], + "type": "function(dygraph, is_initial)", + "parameters": [ + [ "dygraph" , "The graph being drawn" ], + [ "is_initial" , "True if this is the initial draw, false for subsequent draws." ] + ], + "description": "When set, this callback gets called every time the dygraph is drawn. This includes the initial draw, after zooming and repeatedly while panning." + }, + "labelsKMG2": { + "default": "false", + "labels": ["Value display/formatting"], + "type": "boolean", + "description": "Show k/M/G for kilo/Mega/Giga on y-axis. This is different than labelsKMB in that it uses base 2, not 10." + }, + "delimiter": { + "default": ",", + "labels": ["CSV parsing"], + "type": "string", + "description": "The delimiter to look for when separating fields of a CSV file. Setting this to a tab is not usually necessary, since tab-delimited data is auto-detected." + }, + "axisLabelFontSize": { + "default": "14", + "labels": ["Axis display"], + "type": "integer", + "description": "Size of the font (in pixels) to use in the axis labels, both x- and y-axis." + }, + "underlayCallback": { + "default": "null", + "labels": ["Callbacks"], + "type": "function(context, area, dygraph)", + "parameters": [ + [ "context" , "the canvas drawing context on which to draw" ], + [ "area" , "An object with {x,y,w,h} properties describing the drawing area." ], + [ "dygraph" , "the reference graph" ] + ], + "description": "When set, this callback gets called before the chart is drawn. It details on how to use this." + }, + "width": { + "default": "480", + "labels": ["Overall display"], + "type": "integer", + "description": "Width, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored." + }, + "interactionModel": { + "default": "...", + "labels": ["Interactive Elements"], + "type": "Object", + "description": "TODO(konigsberg): document this" + }, + "ticker": { + "default": "Dygraph.dateTicker or Dygraph.numericTicks", + "labels": ["Axis display"], + "type": "function(min, max, pixels, opts, dygraph, vals) -> [{v: ..., label: ...}, ...]", + "parameters": [ + [ "min" , "" ], + [ "max" , "" ], + [ "pixels" , "" ], + [ "opts" , "" ], + [ "dygraph" , "the reference graph" ], + [ "vals" , "" ] + ], + "description": "This lets you specify an arbitrary function to generate tick marks on an axis. The tick marks are an array of (value, label) pairs. The built-in functions go to great lengths to choose good tick marks so, if you set this option, you'll most likely want to call one of them and modify the result. See dygraph-tickers.js for an extensive discussion. This is set on a per-axis basis." + }, + "xAxisLabelWidth": { + "default": "50", + "labels": ["Axis display"], + "type": "integer", + "description": "Width, in pixels, of the x-axis labels." + }, + "xAxisHeight": { + "default": "(null)", + "labels": ["Axis display"], + "type": "integer", + "description": "Height, in pixels, of the x-axis. If not set explicitly, this is computed based on axisLabelFontSize and axisTickSize." + }, + "showLabelsOnHighlight": { + "default": "true", + "labels": ["Interactive Elements", "Legend"], + "type": "boolean", + "description": "Whether to show the legend upon mouseover." + }, + "axis": { + "default": "(none)", + "labels": ["Axis display"], + "type": "string or object", + "description": "Set to either an object ({}) filled with options for this axis or to the name of an existing data series with its own axis to re-use that axis. See tests for usage." + }, + "pixelsPerXLabel": { + "default": "", + "labels": ["Deprecated"], + "type": "integer", + "description": "Prefer axes { x: { pixelsPerLabel } }" + }, + "pixelsPerLabel": { + "default": "60 (x-axis) or 30 (y-axes)", + "labels": ["Axis display", "Grid"], + "type": "integer", + "description": "Number of pixels to require between each x- and y-label. Larger values will yield a sparser axis with fewer ticks. This is set on a per-axis basis." + }, + "labelsDiv": { + "default": "null", + "labels": ["Legend"], + "type": "DOM element or string", + "example": "document.getElementById('foo')or'foo'", + "description": "Show data labels in an external div, rather than on the graph. This value can either be a div element or a div id." + }, + "fractions": { + "default": "false", + "labels": ["CSV parsing", "Error Bars"], + "type": "boolean", + "description": "When set, attempt to parse each cell in the CSV file as \"a/b\", where a and b are integers. The ratio will be plotted. This allows computation of Wilson confidence intervals (see below)." + }, + "logscale": { + "default": "false", + "labels": ["Axis display"], + "type": "boolean", + "description": "When set for a y-axis, the graph shows that axis in log scale. Any values less than or equal to zero are not displayed.\n\nNot compatible with showZero, and ignores connectSeparatedPoints. Also, showing log scale with valueRanges that are less than zero will result in an unviewable graph." + }, + "strokeWidth": { + "default": "1.0", + "labels": ["Data Line display"], + "type": "float", + "example": "0.5, 2.0", + "description": "The width of the lines connecting data points. This can be used to increase the contrast or some graphs." + }, + "strokePattern": { + "default": "null", + "labels": ["Data Line display"], + "type": "array", + "example": "[10, 2, 5, 2]", + "description": "A custom pattern array where the even index is a draw and odd is a space in pixels. If null then it draws a solid line. The array should have a even length as any odd lengthed array could be expressed as a smaller even length array. This is used to create dashed lines." + }, + "strokeBorderWidth": { + "default": "null", + "labels": ["Data Line display"], + "type": "float", + "example": "1.0", + "description": "Draw a border around graph lines to make crossing lines more easily distinguishable. Useful for graphs with many lines." + }, + "strokeBorderColor": { + "default": "white", + "labels": ["Data Line display"], + "type": "string", + "example": "red, #ccffdd", + "description": "Color for the line border used if strokeBorderWidth is set." + }, + "wilsonInterval": { + "default": "true", + "labels": ["Error Bars"], + "type": "boolean", + "description": "Use in conjunction with the \"fractions\" option. Instead of plotting +/- N standard deviations, dygraphs will compute a Wilson confidence interval and plot that. This has more reasonable behavior for ratios close to 0 or 1." + }, + "fillGraph": { + "default": "false", + "labels": ["Data Line display"], + "type": "boolean", + "description": "Should the area underneath the graph be filled? This option is not compatible with error bars. This may be set on a per-series basis." + }, + "highlightCircleSize": { + "default": "3", + "labels": ["Interactive Elements"], + "type": "integer", + "description": "The size in pixels of the dot drawn over highlighted points." + }, + "gridLineColor": { + "default": "rgb(128,128,128)", + "labels": ["Grid"], + "type": "red, blue", + "description": "The color of the gridlines. This may be set on a per-axis basis to define each axis' grid separately." + }, + "visibility": { + "default": "[true, true, ...]", + "labels": ["Data Line display"], + "type": "Array of booleans", + "description": "Which series should initially be visible? Once the Dygraph has been constructed, you can access and modify the visibility of each series using the visibility and setVisibility methods." + }, + "valueRange": { + "default": "Full range of the input is shown", + "labels": ["Axis display"], + "type": "Array of two numbers", + "example": "[10, 110]", + "description": "Explicitly set the vertical range of the graph to [low, high]. This may be set on a per-axis basis to define each y-axis separately. If either limit is unspecified, it will be calculated automatically (e.g. [null, 30] to automatically calculate just the lower bound)" + }, + "labelsDivWidth": { + "default": "250", + "labels": ["Legend"], + "type": "integer", + "description": "Width (in pixels) of the div which shows information on the currently-highlighted points." + }, + "colorSaturation": { + "default": "1.0", + "labels": ["Data Series Colors"], + "type": "float (0.0 - 1.0)", + "description": "If colors is not specified, saturation of the automatically-generated data series colors." + }, + "yAxisLabelWidth": { + "default": "50", + "labels": ["Axis display"], + "type": "integer", + "description": "Width, in pixels, of the y-axis labels. This also affects the amount of space available for a y-axis chart label." + }, + "hideOverlayOnMouseOut": { + "default": "true", + "labels": ["Interactive Elements", "Legend"], + "type": "boolean", + "description": "Whether to hide the legend when the mouse leaves the chart area." + }, + "yValueFormatter": { + "default": "", + "labels": ["Deprecated"], + "type": "", + "description": "Prefer axes: { y: { valueFormatter } }" + }, + "legend": { + "default": "onmouseover", + "labels": ["Legend"], + "type": "string", + "description": "When to display the legend. By default, it only appears when a user mouses over the chart. Set it to \"always\" to always display a legend of some sort." + }, + "labelsShowZeroValues": { + "default": "true", + "labels": ["Legend"], + "type": "boolean", + "description": "Show zero value labels in the labelsDiv." + }, + "stepPlot": { + "default": "false", + "labels": ["Data Line display"], + "type": "boolean", + "description": "When set, display the graph as a step plot instead of a line plot. This option may either be set for the whole graph or for single series." + }, + "labelsKMB": { + "default": "false", + "labels": ["Value display/formatting"], + "type": "boolean", + "description": "Show K/M/B for thousands/millions/billions on y-axis." + }, + "rightGap": { + "default": "5", + "labels": ["Overall display"], + "type": "integer", + "description": "Number of pixels to leave blank at the right edge of the Dygraph. This makes it easier to highlight the right-most data point." + }, + "avoidMinZero": { + "default": "false", + "labels": ["Deprecated"], + "type": "boolean", + "description": "Deprecated, please use yRangePad instead. When set, the heuristic that fixes the Y axis at zero for a data set with the minimum Y value of zero is disabled. \nThis is particularly useful for data sets that contain many zero values, especially for step plots which may otherwise have lines not visible running along the bottom axis." + }, + "drawAxesAtZero": { + "default": "false", + "labels": ["Axis display"], + "type": "boolean", + "description": "When set, draw the X axis at the Y=0 position and the Y axis at the X=0 position if those positions are inside the graph's visible area. Otherwise, draw the axes at the bottom or left graph edge as usual." + }, + "xRangePad": { + "default": "0", + "labels": ["Axis display"], + "type": "float", + "description": "Add the specified amount of extra space (in pixels) around the X-axis value range to ensure points at the edges remain visible." + }, + "yRangePad": { + "default": "null", + "labels": ["Axis display"], + "type": "float", + "description": "If set, add the specified amount of extra space (in pixels) around the Y-axis value range to ensure points at the edges remain visible. If unset, use the traditional Y padding algorithm." + }, + "xAxisLabelFormatter": { + "default": "", + "labels": ["Deprecated"], + "type": "", + "description": "Prefer axes { x: { axisLabelFormatter } }" + }, + "axisLabelFormatter": { + "default": "Depends on the data type", + "labels": ["Axis display"], + "type": "function(number or Date, granularity, opts, dygraph)", + "parameters": [ + [ "number or date" , "Either a number (for a numeric axis) or a Date object (for a date axis)" ], + [ "granularity" , "specifies how fine-grained the axis is. For date axes, this is a reference to the time granularity enumeration, defined in dygraph-tickers.js, e.g. Dygraph.WEEKLY." ], + [ "opts" , "a function which provides access to various options on the dygraph, e.g. opts('labelsKMB')." ], + [ "dygraph" , "the referenced graph" ] + ], + "description": "Function to call to format the tick values that appear along an axis. This is usually set on a per-axis basis." + }, + "clickCallback": { + "snippet": "function(e, date_millis){
            alert(new Date(date_millis));
          }", + "default": "null", + "labels": ["Callbacks"], + "type": "function(e, x, points)", + "parameters": [ + [ "e" , "The event object for the click" ], + [ "x" , "The x value that was clicked (for dates, this is milliseconds since epoch)" ], + [ "points" , "The closest points along that date. See Point properties for details." ] + ], + "description": "A function to call when the canvas is clicked." + }, + "yAxisLabelFormatter": { + "default": "", + "labels": ["Deprecated"], + "type": "", + "description": "Prefer axes: { y: { axisLabelFormatter } }" + }, + "labels": { + "default": "[\"X\", \"Y1\", \"Y2\", ...]*", + "labels": ["Legend"], + "type": "array", + "description": "A name for each data series, including the independent (X) series. For CSV files and DataTable objections, this is determined by context. For raw data, this must be specified. If it is not, default values are supplied and a warning is logged." + }, + "dateWindow": { + "default": "Full range of the input is shown", + "labels": ["Axis display"], + "type": "Array of two Dates or numbers", + "example": "[
            Date.parse('2006-01-01'),
            (new Date()).valueOf()
          ]", + "description": "Initially zoom in on a section of the graph. Is of the form [earliest, latest], where earliest/latest are milliseconds since epoch. If the data for the x-axis is numeric, the values in dateWindow must also be numbers." + }, + "showRoller": { + "default": "false", + "labels": ["Interactive Elements", "Rolling Averages"], + "type": "boolean", + "description": "If the rolling average period text box should be shown." + }, + "sigma": { + "default": "2.0", + "labels": ["Error Bars"], + "type": "float", + "description": "When errorBars is set, shade this many standard deviations above/below each point." + }, + "customBars": { + "default": "false", + "labels": ["CSV parsing", "Error Bars"], + "type": "boolean", + "description": "When set, parse each CSV cell as \"low;middle;high\". Error bars will be drawn for each point between low and high, with the series itself going through middle." + }, + "colorValue": { + "default": "1.0", + "labels": ["Data Series Colors"], + "type": "float (0.0 - 1.0)", + "description": "If colors is not specified, value of the data series colors, as in hue/saturation/value. (0.0-1.0, default 0.5)" + }, + "errorBars": { + "default": "false", + "labels": ["CSV parsing", "Error Bars"], + "type": "boolean", + "description": "Does the data contain standard deviations? Setting this to true alters the input format (see above)." + }, + "displayAnnotations": { + "default": "false", + "labels": ["Annotations"], + "type": "boolean", + "description": "Only applies when Dygraphs is used as a GViz chart. Causes string columns following a data series to be interpreted as annotations on points in that series. This is the same format used by Google's AnnotatedTimeLine chart." + }, + "panEdgeFraction": { + "default": "null", + "labels": ["Axis display", "Interactive Elements"], + "type": "float", + "description": "A value representing the farthest a graph may be panned, in percent of the display. For example, a value of 0.1 means that the graph can only be panned 10% pased the edges of the displayed values. null means no bounds." + }, + "title": { + "labels": ["Chart labels"], + "type": "string", + "default": "null", + "description": "Text to display above the chart. You can supply any HTML for this value, not just text. If you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-title' classes." + }, + "titleHeight": { + "default": "18", + "labels": ["Chart labels"], + "type": "integer", + "description": "Height of the chart title, in pixels. This also controls the default font size of the title. If you style the title on your own, this controls how much space is set aside above the chart for the title's div." + }, + "xlabel": { + "labels": ["Chart labels"], + "type": "string", + "default": "null", + "description": "Text to display below the chart's x-axis. You can supply any HTML for this value, not just text. If you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-xlabel' classes." + }, + "xLabelHeight": { + "labels": ["Chart labels"], + "type": "integer", + "default": "18", + "description": "Height of the x-axis label, in pixels. This also controls the default font size of the x-axis label. If you style the label on your own, this controls how much space is set aside below the chart for the x-axis label's div." + }, + "ylabel": { + "labels": ["Chart labels"], + "type": "string", + "default": "null", + "description": "Text to display to the left of the chart's y-axis. You can supply any HTML for this value, not just text. If you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-ylabel' classes. The text will be rotated 90 degrees by default, so CSS rules may behave in unintuitive ways. No additional space is set aside for a y-axis label. If you need more space, increase the width of the y-axis tick labels using the yAxisLabelWidth option. If you need a wider div for the y-axis label, either style it that way with CSS (but remember that it's rotated, so width is controlled by the 'height' property) or set the yLabelWidth option." + }, + "y2label": { + "labels": ["Chart labels"], + "type": "string", + "default": "null", + "description": "Text to display to the right of the chart's secondary y-axis. This label is only displayed if a secondary y-axis is present. See this test for an example of how to do this. The comments for the 'ylabel' option generally apply here as well. This label gets a 'dygraph-y2label' instead of a 'dygraph-ylabel' class." + }, + "yLabelWidth": { + "labels": ["Chart labels"], + "type": "integer", + "default": "18", + "description": "Width of the div which contains the y-axis label. Since the y-axis label appears rotated 90 degrees, this actually affects the height of its div." + }, + "isZoomedIgnoreProgrammaticZoom" : { + "default": "false", + "labels": ["Zooming"], + "type": "boolean", + "description" : "When this option is passed to updateOptions() along with either the dateWindow or valueRange options, the zoom flags are not changed to reflect a zoomed state. This is primarily useful for when the display area of a chart is changed programmatically and also where manual zooming is allowed and use is made of the isZoomed method to determine this." + }, + "drawXGrid": { + "default": "true", + "labels": ["Grid","Deprecated"], + "type": "boolean", + "description" : "Use the per-axis option drawGrid instead. Whether to display vertical gridlines under the chart." + }, + "drawYGrid": { + "default": "true", + "labels": ["Grid","Deprecated"], + "type": "boolean", + "description" : "Use the per-axis option drawGrid instead. Whether to display horizontal gridlines under the chart." + }, + "drawGrid": { + "default": "true for x and y, false for y2", + "labels": ["Grid"], + "type": "boolean", + "description" : "Whether to display gridlines in the chart. This may be set on a per-axis basis to define the visibility of each axis' grid separately." + }, + "independentTicks": { + "default": "true for y, false for y2", + "labels": ["Axis display", "Grid"], + "type": "boolean", + "description" : "Only valid for y and y2, has no effect on x: This option defines whether the y axes should align their ticks or if they should be independent. Possible combinations: 1.) y=true, y2=false (default): y is the primary axis and the y2 ticks are aligned to the the ones of y. (only 1 grid) 2.) y=false, y2=true: y2 is the primary axis and the y ticks are aligned to the the ones of y2. (only 1 grid) 3.) y=true, y2=true: Both axis are independent and have their own ticks. (2 grids) 4.) y=false, y2=false: Invalid configuration causes an error." + }, + "drawXAxis": { + "default": "true", + "labels": ["Axis display"], + "type": "boolean", + "description" : "Whether to draw the x-axis. Setting this to false also prevents x-axis ticks from being drawn and reclaims the space for the chart grid/lines." + }, + "drawYAxis": { + "default": "true", + "labels": ["Axis display"], + "type": "boolean", + "description" : "Whether to draw the y-axis. Setting this to false also prevents y-axis ticks from being drawn and reclaims the space for the chart grid/lines." + }, + "gridLineWidth": { + "default": "0.3", + "labels": ["Grid"], + "type": "float", + "description" : "Thickness (in pixels) of the gridlines drawn under the chart. The vertical/horizontal gridlines can be turned off entirely by using the drawXGrid and drawYGrid options. This may be set on a per-axis basis to define each axis' grid separately." + }, + "axisLineWidth": { + "default": "0.3", + "labels": ["Axis display"], + "type": "float", + "description" : "Thickness (in pixels) of the x- and y-axis lines." + }, + "axisLineColor": { + "default": "black", + "labels": ["Axis display"], + "type": "string", + "description" : "Color of the x- and y-axis lines. Accepts any value which the HTML canvas strokeStyle attribute understands, e.g. 'black' or 'rgb(0, 100, 255)'." + }, + "fillAlpha": { + "default": "0.15", + "labels": ["Error Bars", "Data Series Colors"], + "type": "float (0.0 - 1.0)", + "description" : "Error bars (or custom bars) for each series are drawn in the same color as the series, but with partial transparency. This sets the transparency. A value of 0.0 means that the error bars will not be drawn, whereas a value of 1.0 means that the error bars will be as dark as the line for the series itself. This can be used to produce chart lines whose thickness varies at each point." + }, + "axisLabelColor": { + "default": "black", + "labels": ["Axis display"], + "type": "string", + "description" : "Color for x- and y-axis labels. This is a CSS color string." + }, + "axisLabelWidth": { + "default": "50", + "labels": ["Axis display", "Chart labels"], + "type": "integer", + "description" : "Width (in pixels) of the containing divs for x- and y-axis labels. For the y-axis, this also controls " + }, + "sigFigs" : { + "default": "null", + "labels": ["Value display/formatting"], + "type": "integer", + "description": "By default, dygraphs displays numbers with a fixed number of digits after the decimal point. If you'd prefer to have a fixed number of significant figures, set this option to that number of sig figs. A value of 2, for instance, would cause 1 to be display as 1.0 and 1234 to be displayed as 1.23e+3." + }, + "digitsAfterDecimal" : { + "default": "2", + "labels": ["Value display/formatting"], + "type": "integer", + "description": "Unless it's run in scientific mode (see the sigFigs option), dygraphs displays numbers with digitsAfterDecimal digits after the decimal point. Trailing zeros are not displayed, so with a value of 2 you'll get '0', '0.1', '0.12', '123.45' but not '123.456' (it will be rounded to '123.46'). Numbers with absolute value less than 0.1^digitsAfterDecimal (i.e. those which would show up as '0.00') will be displayed in scientific notation." + }, + "maxNumberWidth" : { + "default": "6", + "labels": ["Value display/formatting"], + "type": "integer", + "description": "When displaying numbers in normal (not scientific) mode, large numbers will be displayed with many trailing zeros (e.g. 100000000 instead of 1e9). This can lead to unwieldy y-axis labels. If there are more than maxNumberWidth digits to the left of the decimal in a number, dygraphs will switch to scientific notation, even when not operating in scientific mode. If you'd like to see all those digits, set this to something large, like 20 or 30." + }, + "file": { + "default": "(set when constructed)", + "labels": ["Data"], + "type": "string (URL of CSV or CSV), GViz DataTable or 2D Array", + "description": "Sets the data being displayed in the chart. This can only be set when calling updateOptions; it cannot be set from the constructor. For a full description of valid data formats, see the Data Formats page." + }, + "timingName": { + "default": "null", + "labels": [ "Debugging" ], + "type": "string", + "description": "Set this option to log timing information. The value of the option will be logged along with the timimg, so that you can distinguish multiple dygraphs on the same page." + }, + "showRangeSelector": { + "default": "false", + "labels": ["Interactive Elements"], + "type": "boolean", + "description": "Show or hide the range selector widget." + }, + "rangeSelectorHeight": { + "default": "40", + "labels": ["Interactive Elements"], + "type": "integer", + "description": "Height, in pixels, of the range selector widget. This option can only be specified at Dygraph creation time." + }, + "rangeSelectorPlotStrokeColor": { + "default": "#808FAB", + "labels": ["Interactive Elements"], + "type": "string", + "description": "The range selector mini plot stroke color. This can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"yellow\". You can also specify null or \"\" to turn off stroke." + }, + "rangeSelectorPlotFillColor": { + "default": "#A7B1C4", + "labels": ["Interactive Elements"], + "type": "string", + "description": "The range selector mini plot fill color. This can be of the form \"#AABBCC\" or \"rgb(255,100,200)\" or \"yellow\". You can also specify null or \"\" to turn off fill." + }, + "animatedZooms": { + "default": "false", + "labels": ["Interactive Elements"], + "type": "boolean", + "description": "Set this option to animate the transition between zoom windows. Applies to programmatic and interactive zooms. Note that if you also set a drawCallback, it will be called several times on each zoom. If you set a zoomCallback, it will only be called after the animation is complete." + }, + "plotter": { + "default": "[DygraphCanvasRenderer.Plotters.fillPlotter, DygraphCanvasRenderer.Plotters.errorPlotter, DygraphCanvasRenderer.Plotters.linePlotter]", + "labels": ["Data Line display"], + "type": "array or function", + "description": "A function (or array of functions) which plot each data series on the chart. TODO(danvk): more details! May be set per-series." + }, + "series": { + "default": "null", + "labels": ["Series"], + "type": "Object", + "description": "Defines per-series options. Its keys match the y-axis label names, and the values are dictionaries themselves that contain options specific to that series. When this option is missing, it falls back on the old-style of per-series options comingled with global options." + }, + "plugins": { + "default": "[]", + "labels": ["Configuration"], + "type": "Array", + "description": "Defines per-graph plug-ins. Useful for per-graph customization" + } +} +; //
          +// NOTE: in addition to parsing as JS, this snippet is expected to be valid +// JSON. This assumption cannot be checked in JS, but it will be checked when +// documentation is generated by the generate-documentation.py script. For the +// most part, this just means that you should always use double quotes. + +// Do a quick sanity check on the options reference. +(function() { + "use strict"; + var warn = function(msg) { if (window.console) window.console.warn(msg); }; + var flds = ['type', 'default', 'description']; + var valid_cats = [ + 'Annotations', + 'Axis display', + 'Chart labels', + 'CSV parsing', + 'Callbacks', + 'Data', + 'Data Line display', + 'Data Series Colors', + 'Error Bars', + 'Grid', + 'Interactive Elements', + 'Legend', + 'Overall display', + 'Rolling Averages', + 'Series', + 'Value display/formatting', + 'Zooming', + 'Debugging', + 'Configuration', + 'Deprecated' + ]; + var i; + var cats = {}; + for (i = 0; i < valid_cats.length; i++) cats[valid_cats[i]] = true; + + for (var k in Dygraph.OPTIONS_REFERENCE) { + if (!Dygraph.OPTIONS_REFERENCE.hasOwnProperty(k)) continue; + var op = Dygraph.OPTIONS_REFERENCE[k]; + for (i = 0; i < flds.length; i++) { + if (!op.hasOwnProperty(flds[i])) { + warn('Option ' + k + ' missing "' + flds[i] + '" property'); + } else if (typeof(op[flds[i]]) != 'string') { + warn(k + '.' + flds[i] + ' must be of type string'); + } + } + var labels = op.labels; + if (typeof(labels) !== 'object') { + warn('Option "' + k + '" is missing a "labels": [...] option'); + } else { + for (i = 0; i < labels.length; i++) { + if (!cats.hasOwnProperty(labels[i])) { + warn('Option "' + k + '" has label "' + labels[i] + + '", which is invalid.'); + } + } + } + } +})(); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-options.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-options.js new file mode 100644 index 0000000..0f90086 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-options.js @@ -0,0 +1,384 @@ +/** + * @license + * Copyright 2011 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview DygraphOptions is responsible for parsing and returning information about options. + * + * Still tightly coupled to Dygraphs, we could remove some of that, you know. + */ + +var DygraphOptions = (function() { + +/*jshint sub:true */ +/*global Dygraph:false */ +"use strict"; + +/* + * Interesting member variables: (REMOVING THIS LIST AS I CLOSURIZE) + * global_ - global attributes (common among all graphs, AIUI) + * user - attributes set by the user + * series_ - { seriesName -> { idx, yAxis, options }} + */ + +/** + * This parses attributes into an object that can be easily queried. + * + * It doesn't necessarily mean that all options are available, specifically + * if labels are not yet available, since those drive details of the per-series + * and per-axis options. + * + * @param {Dygraph} dygraph The chart to which these options belong. + * @constructor + */ +var DygraphOptions = function(dygraph) { + /** + * The dygraph. + * @type {!Dygraph} + */ + this.dygraph_ = dygraph; + + /** + * Array of axis index to { series : [ series names ] , options : { axis-specific options. } + * @type {Array.<{series : Array., options : Object}>} @private + */ + this.yAxes_ = []; + + /** + * Contains x-axis specific options, which are stored in the options key. + * This matches the yAxes_ object structure (by being a dictionary with an + * options element) allowing for shared code. + * @type {options: Object} @private + */ + this.xAxis_ = {}; + this.series_ = {}; + + // Once these two objects are initialized, you can call get(); + this.global_ = this.dygraph_.attrs_; + this.user_ = this.dygraph_.user_attrs_ || {}; + + /** + * A list of series in columnar order. + * @type {Array.} + */ + this.labels_ = []; + + this.highlightSeries_ = this.get("highlightSeriesOpts") || {}; + this.reparseSeries(); +}; + +/** + * Not optimal, but does the trick when you're only using two axes. + * If we move to more axes, this can just become a function. + * + * @type {Object.} + * @private + */ +DygraphOptions.AXIS_STRING_MAPPINGS_ = { + 'y' : 0, + 'Y' : 0, + 'y1' : 0, + 'Y1' : 0, + 'y2' : 1, + 'Y2' : 1 +}; + +/** + * @param {string|number} axis + * @private + */ +DygraphOptions.axisToIndex_ = function(axis) { + if (typeof(axis) == "string") { + if (DygraphOptions.AXIS_STRING_MAPPINGS_.hasOwnProperty(axis)) { + return DygraphOptions.AXIS_STRING_MAPPINGS_[axis]; + } + throw "Unknown axis : " + axis; + } + if (typeof(axis) == "number") { + if (axis === 0 || axis === 1) { + return axis; + } + throw "Dygraphs only supports two y-axes, indexed from 0-1."; + } + if (axis) { + throw "Unknown axis : " + axis; + } + // No axis specification means axis 0. + return 0; +}; + +/** + * Reparses options that are all related to series. This typically occurs when + * options are either updated, or source data has been made available. + * + * TODO(konigsberg): The method name is kind of weak; fix. + */ +DygraphOptions.prototype.reparseSeries = function() { + var labels = this.get("labels"); + if (!labels) { + return; // -- can't do more for now, will parse after getting the labels. + } + + this.labels_ = labels.slice(1); + + this.yAxes_ = [ { series : [], options : {}} ]; // Always one axis at least. + this.xAxis_ = { options : {} }; + this.series_ = {}; + + // Traditionally, per-series options were specified right up there with the options. For instance + // { + // labels: [ "X", "foo", "bar" ], + // pointSize: 3, + // foo : {}, // options for foo + // bar : {} // options for bar + // } + // + // Moving forward, series really should be specified in the series element, separating them. + // like so: + // + // { + // labels: [ "X", "foo", "bar" ], + // pointSize: 3, + // series : { + // foo : {}, // options for foo + // bar : {} // options for bar + // } + // } + // + // So, if series is found, it's expected to contain per-series data, otherwise we fall + // back. + var oldStyleSeries = !this.user_["series"]; + + if (oldStyleSeries) { + var axisId = 0; // 0-offset; there's always one. + // Go through once, add all the series, and for those with {} axis options, add a new axis. + for (var idx = 0; idx < this.labels_.length; idx++) { + var seriesName = this.labels_[idx]; + + var optionsForSeries = this.user_[seriesName] || {}; + + var yAxis = 0; + var axis = optionsForSeries["axis"]; + if (typeof(axis) == 'object') { + yAxis = ++axisId; + this.yAxes_[yAxis] = { series : [ seriesName ], options : axis }; + } + + // Associate series without axis options with axis 0. + if (!axis) { // undefined + this.yAxes_[0].series.push(seriesName); + } + + this.series_[seriesName] = { idx: idx, yAxis: yAxis, options : optionsForSeries }; + } + + // Go through one more time and assign series to an axis defined by another + // series, e.g. { 'Y1: { axis: {} }, 'Y2': { axis: 'Y1' } } + for (var idx = 0; idx < this.labels_.length; idx++) { + var seriesName = this.labels_[idx]; + var optionsForSeries = this.series_[seriesName]["options"]; + var axis = optionsForSeries["axis"]; + + if (typeof(axis) == 'string') { + if (!this.series_.hasOwnProperty(axis)) { + Dygraph.error("Series " + seriesName + " wants to share a y-axis with " + + "series " + axis + ", which does not define its own axis."); + return; + } + var yAxis = this.series_[axis].yAxis; + this.series_[seriesName].yAxis = yAxis; + this.yAxes_[yAxis].series.push(seriesName); + } + } + } else { + for (var idx = 0; idx < this.labels_.length; idx++) { + var seriesName = this.labels_[idx]; + var optionsForSeries = this.user_.series[seriesName] || {}; + var yAxis = DygraphOptions.axisToIndex_(optionsForSeries["axis"]); + + this.series_[seriesName] = { + idx: idx, + yAxis: yAxis, + options : optionsForSeries }; + + if (!this.yAxes_[yAxis]) { + this.yAxes_[yAxis] = { series : [ seriesName ], options : {} }; + } else { + this.yAxes_[yAxis].series.push(seriesName); + } + } + } + + var axis_opts = this.user_["axes"] || {}; + Dygraph.update(this.yAxes_[0].options, axis_opts["y"] || {}); + if (this.yAxes_.length > 1) { + Dygraph.update(this.yAxes_[1].options, axis_opts["y2"] || {}); + } + Dygraph.update(this.xAxis_.options, axis_opts["x"] || {}); +}; + +/** + * Get a global value. + * + * @param {string} name the name of the option. + */ +DygraphOptions.prototype.get = function(name) { + var result = this.getGlobalUser_(name); + if (result !== null) { + return result; + } + return this.getGlobalDefault_(name); +}; + +DygraphOptions.prototype.getGlobalUser_ = function(name) { + if (this.user_.hasOwnProperty(name)) { + return this.user_[name]; + } + return null; +}; + +DygraphOptions.prototype.getGlobalDefault_ = function(name) { + if (this.global_.hasOwnProperty(name)) { + return this.global_[name]; + } + if (Dygraph.DEFAULT_ATTRS.hasOwnProperty(name)) { + return Dygraph.DEFAULT_ATTRS[name]; + } + return null; +}; + +/** + * Get a value for a specific axis. If there is no specific value for the axis, + * the global value is returned. + * + * @param {string} name the name of the option. + * @param {string|number} axis the axis to search. Can be the string representation + * ("y", "y2") or the axis number (0, 1). + */ +DygraphOptions.prototype.getForAxis = function(name, axis) { + var axisIdx; + var axisString; + + // Since axis can be a number or a string, straighten everything out here. + if (typeof(axis) == 'number') { + axisIdx = axis; + axisString = axisIdx === 0 ? "y" : "y2"; + } else { + if (axis == "y1") { axis = "y"; } // Standardize on 'y'. Is this bad? I think so. + if (axis == "y") { + axisIdx = 0; + } else if (axis == "y2") { + axisIdx = 1; + } else if (axis == "x") { + axisIdx = -1; // simply a placeholder for below. + } else { + throw "Unknown axis " + axis; + } + axisString = axis; + } + + var userAxis = (axisIdx == -1) ? this.xAxis_ : this.yAxes_[axisIdx]; + + // Search the user-specified axis option first. + if (userAxis) { // This condition could be removed if we always set up this.yAxes_ for y2. + var axisOptions = userAxis.options; + if (axisOptions.hasOwnProperty(name)) { + return axisOptions[name]; + } + } + + // User-specified global options second. + var result = this.getGlobalUser_(name); + if (result !== null) { + return result; + } + + // Default axis options third. + var defaultAxisOptions = Dygraph.DEFAULT_ATTRS.axes[axisString]; + if (defaultAxisOptions.hasOwnProperty(name)) { + return defaultAxisOptions[name]; + } + + // Default global options last. + return this.getGlobalDefault_(name); +}; + +/** + * Get a value for a specific series. If there is no specific value for the series, + * the value for the axis is returned (and afterwards, the global value.) + * + * @param {string} name the name of the option. + * @param {string} series the series to search. + */ +DygraphOptions.prototype.getForSeries = function(name, series) { + // Honors indexes as series. + if (series === this.dygraph_.getHighlightSeries()) { + if (this.highlightSeries_.hasOwnProperty(name)) { + return this.highlightSeries_[name]; + } + } + + if (!this.series_.hasOwnProperty(series)) { + throw "Unknown series: " + series; + } + + var seriesObj = this.series_[series]; + var seriesOptions = seriesObj["options"]; + if (seriesOptions.hasOwnProperty(name)) { + return seriesOptions[name]; + } + + return this.getForAxis(name, seriesObj["yAxis"]); +}; + +/** + * Returns the number of y-axes on the chart. + * @return {number} the number of axes. + */ +DygraphOptions.prototype.numAxes = function() { + return this.yAxes_.length; +}; + +/** + * Return the y-axis for a given series, specified by name. + */ +DygraphOptions.prototype.axisForSeries = function(series) { + return this.series_[series].yAxis; +}; + +/** + * Returns the options for the specified axis. + */ +// TODO(konigsberg): this is y-axis specific. Support the x axis. +DygraphOptions.prototype.axisOptions = function(yAxis) { + return this.yAxes_[yAxis].options; +}; + +/** + * Return the series associated with an axis. + */ +DygraphOptions.prototype.seriesForAxis = function(yAxis) { + return this.yAxes_[yAxis].series; +}; + +/** + * Return the list of all series, in their columnar order. + */ +DygraphOptions.prototype.seriesNames = function() { + return this.labels_; +}; + +/* Are we using this? */ +/** + * Return the index of the specified series. + * @param {string} series the series name. + */ +DygraphOptions.prototype.indexOfSeries = function(series) { + return this.series_[series].idx; +}; + +return DygraphOptions; + +})(); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-plugin-base.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-plugin-base.js new file mode 100644 index 0000000..7f758a9 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-plugin-base.js @@ -0,0 +1,4 @@ +/*global Dygraph:false */ + +// Namespace for plugins. Load this before plugins/*.js files. +Dygraph.Plugins = {}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-plugin-install.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-plugin-install.js new file mode 100644 index 0000000..806a927 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-plugin-install.js @@ -0,0 +1,19 @@ +/*global Dygraph:false */ + +// This file defines the ordering of the plugins. +// +// The ordering is from most-general to most-specific. +// This means that, in an event cascade, plugins which have registered for that +// event will be called in reverse order. +// +// This is most relevant for plugins which register a layout event, e.g. +// Axes, Legend and ChartLabels. + +Dygraph.PLUGINS.push( + Dygraph.Plugins.Legend, + Dygraph.Plugins.Axes, + Dygraph.Plugins.RangeSelector, // Has to be before ChartLabels so that its callbacks are called after ChartLabels' callbacks. + Dygraph.Plugins.ChartLabels, + Dygraph.Plugins.Annotations, + Dygraph.Plugins.Grid +); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-tickers.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-tickers.js new file mode 100644 index 0000000..f4778b1 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-tickers.js @@ -0,0 +1,487 @@ +/** + * @license + * Copyright 2011 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview Description of this file. + * @author danvk@google.com (Dan Vanderkam) + * + * A ticker is a function with the following interface: + * + * function(a, b, pixels, options_view, dygraph, forced_values); + * -> [ { v: tick1_v, label: tick1_label[, label_v: label_v1] }, + * { v: tick2_v, label: tick2_label[, label_v: label_v2] }, + * ... + * ] + * + * The returned value is called a "tick list". + * + * Arguments + * --------- + * + * [a, b] is the range of the axis for which ticks are being generated. For a + * numeric axis, these will simply be numbers. For a date axis, these will be + * millis since epoch (convertable to Date objects using "new Date(a)" and "new + * Date(b)"). + * + * opts provides access to chart- and axis-specific options. It can be used to + * access number/date formatting code/options, check for a log scale, etc. + * + * pixels is the length of the axis in pixels. opts('pixelsPerLabel') is the + * minimum amount of space to be allotted to each label. For instance, if + * pixels=400 and opts('pixelsPerLabel')=40 then the ticker should return + * between zero and ten (400/40) ticks. + * + * dygraph is the Dygraph object for which an axis is being constructed. + * + * forced_values is used for secondary y-axes. The tick positions are typically + * set by the primary y-axis, so the secondary y-axis has no choice in where to + * put these. It simply has to generate labels for these data values. + * + * Tick lists + * ---------- + * Typically a tick will have both a grid/tick line and a label at one end of + * that line (at the bottom for an x-axis, at left or right for the y-axis). + * + * A tick may be missing one of these two components: + * - If "label_v" is specified instead of "v", then there will be no tick or + * gridline, just a label. + * - Similarly, if "label" is not specified, then there will be a gridline + * without a label. + * + * This flexibility is useful in a few situations: + * - For log scales, some of the tick lines may be too close to all have labels. + * - For date scales where years are being displayed, it is desirable to display + * tick marks at the beginnings of years but labels (e.g. "2006") in the + * middle of the years. + */ + +/*jshint globalstrict:true, sub:true */ +/*global Dygraph:false */ +"use strict"; + +/** @typedef {Array.<{v:number, label:string, label_v:(string|undefined)}>} */ +Dygraph.TickList = undefined; // the ' = undefined' keeps jshint happy. + +/** @typedef {function( + * number, + * number, + * number, + * function(string):*, + * Dygraph=, + * Array.= + * ): Dygraph.TickList} + */ +Dygraph.Ticker = undefined; // the ' = undefined' keeps jshint happy. + +/** @type {Dygraph.Ticker} */ +Dygraph.numericLinearTicks = function(a, b, pixels, opts, dygraph, vals) { + var nonLogscaleOpts = function(opt) { + if (opt === 'logscale') return false; + return opts(opt); + }; + return Dygraph.numericTicks(a, b, pixels, nonLogscaleOpts, dygraph, vals); +}; + +/** @type {Dygraph.Ticker} */ +Dygraph.numericTicks = function(a, b, pixels, opts, dygraph, vals) { + var pixels_per_tick = /** @type{number} */(opts('pixelsPerLabel')); + var ticks = []; + var i, j, tickV, nTicks; + if (vals) { + for (i = 0; i < vals.length; i++) { + ticks.push({v: vals[i]}); + } + } else { + // TODO(danvk): factor this log-scale block out into a separate function. + if (opts("logscale")) { + nTicks = Math.floor(pixels / pixels_per_tick); + var minIdx = Dygraph.binarySearch(a, Dygraph.PREFERRED_LOG_TICK_VALUES, 1); + var maxIdx = Dygraph.binarySearch(b, Dygraph.PREFERRED_LOG_TICK_VALUES, -1); + if (minIdx == -1) { + minIdx = 0; + } + if (maxIdx == -1) { + maxIdx = Dygraph.PREFERRED_LOG_TICK_VALUES.length - 1; + } + // Count the number of tick values would appear, if we can get at least + // nTicks / 4 accept them. + var lastDisplayed = null; + if (maxIdx - minIdx >= nTicks / 4) { + for (var idx = maxIdx; idx >= minIdx; idx--) { + var tickValue = Dygraph.PREFERRED_LOG_TICK_VALUES[idx]; + var pixel_coord = Math.log(tickValue / a) / Math.log(b / a) * pixels; + var tick = { v: tickValue }; + if (lastDisplayed === null) { + lastDisplayed = { + tickValue : tickValue, + pixel_coord : pixel_coord + }; + } else { + if (Math.abs(pixel_coord - lastDisplayed.pixel_coord) >= pixels_per_tick) { + lastDisplayed = { + tickValue : tickValue, + pixel_coord : pixel_coord + }; + } else { + tick.label = ""; + } + } + ticks.push(tick); + } + // Since we went in backwards order. + ticks.reverse(); + } + } + + // ticks.length won't be 0 if the log scale function finds values to insert. + if (ticks.length === 0) { + // Basic idea: + // Try labels every 1, 2, 5, 10, 20, 50, 100, etc. + // Calculate the resulting tick spacing (i.e. this.height_ / nTicks). + // The first spacing greater than pixelsPerYLabel is what we use. + // TODO(danvk): version that works on a log scale. + var kmg2 = opts("labelsKMG2"); + var mults, base; + if (kmg2) { + mults = [1, 2, 4, 8, 16, 32, 64, 128, 256]; + base = 16; + } else { + mults = [1, 2, 5, 10, 20, 50, 100]; + base = 10; + } + + // Get the maximum number of permitted ticks based on the + // graph's pixel size and pixels_per_tick setting. + var max_ticks = Math.ceil(pixels / pixels_per_tick); + + // Now calculate the data unit equivalent of this tick spacing. + // Use abs() since graphs may have a reversed Y axis. + var units_per_tick = Math.abs(b - a) / max_ticks; + + // Based on this, get a starting scale which is the largest + // integer power of the chosen base (10 or 16) that still remains + // below the requested pixels_per_tick spacing. + var base_power = Math.floor(Math.log(units_per_tick) / Math.log(base)); + var base_scale = Math.pow(base, base_power); + + // Now try multiples of the starting scale until we find one + // that results in tick marks spaced sufficiently far apart. + // The "mults" array should cover the range 1 .. base^2 to + // adjust for rounding and edge effects. + var scale, low_val, high_val, spacing; + for (j = 0; j < mults.length; j++) { + scale = base_scale * mults[j]; + low_val = Math.floor(a / scale) * scale; + high_val = Math.ceil(b / scale) * scale; + nTicks = Math.abs(high_val - low_val) / scale; + spacing = pixels / nTicks; + if (spacing > pixels_per_tick) break; + } + + // Construct the set of ticks. + // Allow reverse y-axis if it's explicitly requested. + if (low_val > high_val) scale *= -1; + for (i = 0; i < nTicks; i++) { + tickV = low_val + i * scale; + ticks.push( {v: tickV} ); + } + } + } + + var formatter = /**@type{AxisLabelFormatter}*/(opts('axisLabelFormatter')); + + // Add labels to the ticks. + for (i = 0; i < ticks.length; i++) { + if (ticks[i].label !== undefined) continue; // Use current label. + // TODO(danvk): set granularity to something appropriate here. + ticks[i].label = formatter(ticks[i].v, 0, opts, dygraph); + } + + return ticks; +}; + + +/** @type {Dygraph.Ticker} */ +Dygraph.dateTicker = function(a, b, pixels, opts, dygraph, vals) { + var chosen = Dygraph.pickDateTickGranularity(a, b, pixels, opts); + + if (chosen >= 0) { + return Dygraph.getDateAxis(a, b, chosen, opts, dygraph); + } else { + // this can happen if self.width_ is zero. + return []; + } +}; + +// Time granularity enumeration +// TODO(danvk): make this an @enum +Dygraph.SECONDLY = 0; +Dygraph.TWO_SECONDLY = 1; +Dygraph.FIVE_SECONDLY = 2; +Dygraph.TEN_SECONDLY = 3; +Dygraph.THIRTY_SECONDLY = 4; +Dygraph.MINUTELY = 5; +Dygraph.TWO_MINUTELY = 6; +Dygraph.FIVE_MINUTELY = 7; +Dygraph.TEN_MINUTELY = 8; +Dygraph.THIRTY_MINUTELY = 9; +Dygraph.HOURLY = 10; +Dygraph.TWO_HOURLY = 11; +Dygraph.SIX_HOURLY = 12; +Dygraph.DAILY = 13; +Dygraph.WEEKLY = 14; +Dygraph.MONTHLY = 15; +Dygraph.QUARTERLY = 16; +Dygraph.BIANNUAL = 17; +Dygraph.ANNUAL = 18; +Dygraph.DECADAL = 19; +Dygraph.CENTENNIAL = 20; +Dygraph.NUM_GRANULARITIES = 21; + +/** @type {Array.} */ +Dygraph.SHORT_SPACINGS = []; +Dygraph.SHORT_SPACINGS[Dygraph.SECONDLY] = 1000 * 1; +Dygraph.SHORT_SPACINGS[Dygraph.TWO_SECONDLY] = 1000 * 2; +Dygraph.SHORT_SPACINGS[Dygraph.FIVE_SECONDLY] = 1000 * 5; +Dygraph.SHORT_SPACINGS[Dygraph.TEN_SECONDLY] = 1000 * 10; +Dygraph.SHORT_SPACINGS[Dygraph.THIRTY_SECONDLY] = 1000 * 30; +Dygraph.SHORT_SPACINGS[Dygraph.MINUTELY] = 1000 * 60; +Dygraph.SHORT_SPACINGS[Dygraph.TWO_MINUTELY] = 1000 * 60 * 2; +Dygraph.SHORT_SPACINGS[Dygraph.FIVE_MINUTELY] = 1000 * 60 * 5; +Dygraph.SHORT_SPACINGS[Dygraph.TEN_MINUTELY] = 1000 * 60 * 10; +Dygraph.SHORT_SPACINGS[Dygraph.THIRTY_MINUTELY] = 1000 * 60 * 30; +Dygraph.SHORT_SPACINGS[Dygraph.HOURLY] = 1000 * 3600; +Dygraph.SHORT_SPACINGS[Dygraph.TWO_HOURLY] = 1000 * 3600 * 2; +Dygraph.SHORT_SPACINGS[Dygraph.SIX_HOURLY] = 1000 * 3600 * 6; +Dygraph.SHORT_SPACINGS[Dygraph.DAILY] = 1000 * 86400; +Dygraph.SHORT_SPACINGS[Dygraph.WEEKLY] = 1000 * 604800; + +/** + * A collection of objects specifying where it is acceptable to place tick + * marks for granularities larger than WEEKLY. + * 'months' is an array of month indexes on which to place tick marks. + * 'year_mod' ticks are placed when year % year_mod = 0. + * @type {Array.} + */ +Dygraph.LONG_TICK_PLACEMENTS = []; +Dygraph.LONG_TICK_PLACEMENTS[Dygraph.MONTHLY] = { + months : [0,1,2,3,4,5,6,7,8,9,10,11], + year_mod : 1 +}; +Dygraph.LONG_TICK_PLACEMENTS[Dygraph.QUARTERLY] = { + months: [0,3,6,9], + year_mod: 1 +}; +Dygraph.LONG_TICK_PLACEMENTS[Dygraph.BIANNUAL] = { + months: [0,6], + year_mod: 1 +}; +Dygraph.LONG_TICK_PLACEMENTS[Dygraph.ANNUAL] = { + months: [0], + year_mod: 1 +}; +Dygraph.LONG_TICK_PLACEMENTS[Dygraph.DECADAL] = { + months: [0], + year_mod: 10 +}; +Dygraph.LONG_TICK_PLACEMENTS[Dygraph.CENTENNIAL] = { + months: [0], + year_mod: 100 +}; + +/** + * This is a list of human-friendly values at which to show tick marks on a log + * scale. It is k * 10^n, where k=1..9 and n=-39..+39, so: + * ..., 1, 2, 3, 4, 5, ..., 9, 10, 20, 30, ..., 90, 100, 200, 300, ... + * NOTE: this assumes that Dygraph.LOG_SCALE = 10. + * @type {Array.} + */ +Dygraph.PREFERRED_LOG_TICK_VALUES = function() { + var vals = []; + for (var power = -39; power <= 39; power++) { + var range = Math.pow(10, power); + for (var mult = 1; mult <= 9; mult++) { + var val = range * mult; + vals.push(val); + } + } + return vals; +}(); + +/** + * Determine the correct granularity of ticks on a date axis. + * + * @param {number} a Left edge of the chart (ms) + * @param {number} b Right edge of the chart (ms) + * @param {number} pixels Size of the chart in the relevant dimension (width). + * @param {function(string):*} opts Function mapping from option name -> + * value. + * @return {number} The appropriate axis granularity for this chart. See the + * enumeration of possible values in dygraph-tickers.js. + */ +Dygraph.pickDateTickGranularity = function(a, b, pixels, opts) { + var pixels_per_tick = /** @type{number} */(opts('pixelsPerLabel')); + for (var i = 0; i < Dygraph.NUM_GRANULARITIES; i++) { + var num_ticks = Dygraph.numDateTicks(a, b, i); + if (pixels / num_ticks >= pixels_per_tick) { + return i; + } + } + return -1; +}; + +/** + * @param {number} start_time + * @param {number} end_time + * @param {number} granularity (one of the granularities enumerated above) + * @return {number} Number of ticks that would result. + */ +Dygraph.numDateTicks = function(start_time, end_time, granularity) { + if (granularity < Dygraph.MONTHLY) { + // Generate one tick mark for every fixed interval of time. + var spacing = Dygraph.SHORT_SPACINGS[granularity]; + return Math.floor(0.5 + 1.0 * (end_time - start_time) / spacing); + } else { + var tickPlacement = Dygraph.LONG_TICK_PLACEMENTS[granularity]; + + var msInYear = 365.2524 * 24 * 3600 * 1000; + var num_years = 1.0 * (end_time - start_time) / msInYear; + return Math.floor(0.5 + 1.0 * num_years * tickPlacement.months.length / tickPlacement.year_mod); + } +}; + +/** + * @param {number} start_time + * @param {number} end_time + * @param {number} granularity (one of the granularities enumerated above) + * @param {function(string):*} opts Function mapping from option name -> value. + * @param {Dygraph=} dg + * @return {!Dygraph.TickList} + */ +Dygraph.getDateAxis = function(start_time, end_time, granularity, opts, dg) { + var formatter = /** @type{AxisLabelFormatter} */( + opts("axisLabelFormatter")); + var ticks = []; + var t; + + if (granularity < Dygraph.MONTHLY) { + // Generate one tick mark for every fixed interval of time. + var spacing = Dygraph.SHORT_SPACINGS[granularity]; + + // Find a time less than start_time which occurs on a "nice" time boundary + // for this granularity. + var g = spacing / 1000; + var d = new Date(start_time); + Dygraph.setDateSameTZ(d, {ms: 0}); + + var x; + if (g <= 60) { // seconds + x = d.getSeconds(); + Dygraph.setDateSameTZ(d, {s: x - x % g}); + } else { + Dygraph.setDateSameTZ(d, {s: 0}); + g /= 60; + if (g <= 60) { // minutes + x = d.getMinutes(); + Dygraph.setDateSameTZ(d, {m: x - x % g}); + } else { + Dygraph.setDateSameTZ(d, {m: 0}); + g /= 60; + + if (g <= 24) { // days + x = d.getHours(); + d.setHours(x - x % g); + } else { + d.setHours(0); + g /= 24; + + if (g == 7) { // one week + d.setDate(d.getDate() - d.getDay()); + } + } + } + } + start_time = d.getTime(); + + // For spacings coarser than two-hourly, we want to ignore daylight + // savings transitions to get consistent ticks. For finer-grained ticks, + // it's essential to show the DST transition in all its messiness. + var start_offset_min = new Date(start_time).getTimezoneOffset(); + var check_dst = (spacing >= Dygraph.SHORT_SPACINGS[Dygraph.TWO_HOURLY]); + + for (t = start_time; t <= end_time; t += spacing) { + d = new Date(t); + + // This ensures that we stay on the same hourly "rhythm" across + // daylight savings transitions. Without this, the ticks could get off + // by an hour. See tests/daylight-savings.html or issue 147. + if (check_dst && d.getTimezoneOffset() != start_offset_min) { + var delta_min = d.getTimezoneOffset() - start_offset_min; + t += delta_min * 60 * 1000; + d = new Date(t); + start_offset_min = d.getTimezoneOffset(); + + // Check whether we've backed into the previous timezone again. + // This can happen during a "spring forward" transition. In this case, + // it's best to skip this tick altogether (we may be shooting for a + // non-existent time like the 2AM that's skipped) and go to the next + // one. + if (new Date(t + spacing).getTimezoneOffset() != start_offset_min) { + t += spacing; + d = new Date(t); + start_offset_min = d.getTimezoneOffset(); + } + } + + ticks.push({ v:t, + label: formatter(d, granularity, opts, dg) + }); + } + } else { + // Display a tick mark on the first of a set of months of each year. + // Years get a tick mark iff y % year_mod == 0. This is useful for + // displaying a tick mark once every 10 years, say, on long time scales. + var months; + var year_mod = 1; // e.g. to only print one point every 10 years. + + if (granularity < Dygraph.NUM_GRANULARITIES) { + months = Dygraph.LONG_TICK_PLACEMENTS[granularity].months; + year_mod = Dygraph.LONG_TICK_PLACEMENTS[granularity].year_mod; + } else { + Dygraph.warn("Span of dates is too long"); + } + + var start_year = new Date(start_time).getFullYear(); + var end_year = new Date(end_time).getFullYear(); + var zeropad = Dygraph.zeropad; + for (var i = start_year; i <= end_year; i++) { + if (i % year_mod !== 0) continue; + for (var j = 0; j < months.length; j++) { + var date_str = i + "/" + zeropad(1 + months[j]) + "/01"; + t = Dygraph.dateStrToMillis(date_str); + if (t < start_time || t > end_time) continue; + ticks.push({ v:t, + label: formatter(new Date(t), granularity, opts, dg) + }); + } + } + } + + return ticks; +}; + +// These are set here so that this file can be included after dygraph.js +// or independently. +if (Dygraph && + Dygraph.DEFAULT_ATTRS && + Dygraph.DEFAULT_ATTRS['axes'] && + Dygraph.DEFAULT_ATTRS['axes']['x'] && + Dygraph.DEFAULT_ATTRS['axes']['y'] && + Dygraph.DEFAULT_ATTRS['axes']['y2']) { + Dygraph.DEFAULT_ATTRS['axes']['x']['ticker'] = Dygraph.dateTicker; + Dygraph.DEFAULT_ATTRS['axes']['y']['ticker'] = Dygraph.numericTicks; + Dygraph.DEFAULT_ATTRS['axes']['y2']['ticker'] = Dygraph.numericTicks; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-utils.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-utils.js new file mode 100644 index 0000000..1ec1795 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph-utils.js @@ -0,0 +1,1305 @@ +/** + * @license + * Copyright 2011 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview This file contains utility functions used by dygraphs. These + * are typically static (i.e. not related to any particular dygraph). Examples + * include date/time formatting functions, basic algorithms (e.g. binary + * search) and generic DOM-manipulation functions. + */ + +/*jshint globalstrict: true */ +/*global Dygraph:false, G_vmlCanvasManager:false, Node:false, printStackTrace: false */ +"use strict"; + +Dygraph.LOG_SCALE = 10; +Dygraph.LN_TEN = Math.log(Dygraph.LOG_SCALE); + +/** + * @private + * @param {number} x + * @return {number} + */ +Dygraph.log10 = function(x) { + return Math.log(x) / Dygraph.LN_TEN; +}; + +// Various logging levels. +Dygraph.DEBUG = 1; +Dygraph.INFO = 2; +Dygraph.WARNING = 3; +Dygraph.ERROR = 3; + +// Set this to log stack traces on warnings, etc. +// This requires stacktrace.js, which is up to you to provide. +// A copy can be found in the dygraphs repo, or at +// https://github.com/eriwen/javascript-stacktrace +Dygraph.LOG_STACK_TRACES = false; + +/** A dotted line stroke pattern. */ +Dygraph.DOTTED_LINE = [2, 2]; +/** A dashed line stroke pattern. */ +Dygraph.DASHED_LINE = [7, 3]; +/** A dot dash stroke pattern. */ +Dygraph.DOT_DASH_LINE = [7, 2, 2, 2]; + +/** + * Log an error on the JS console at the given severity. + * @param {number} severity One of Dygraph.{DEBUG,INFO,WARNING,ERROR} + * @param {string} message The message to log. + * @private + */ +Dygraph.log = function(severity, message) { + var st; + if (typeof(printStackTrace) != 'undefined') { + try { + // Remove uninteresting bits: logging functions and paths. + st = printStackTrace({guess:false}); + while (st[0].indexOf("stacktrace") != -1) { + st.splice(0, 1); + } + + st.splice(0, 2); + for (var i = 0; i < st.length; i++) { + st[i] = st[i].replace(/\([^)]*\/(.*)\)/, '@$1') + .replace(/\@.*\/([^\/]*)/, '@$1') + .replace('[object Object].', ''); + } + var top_msg = st.splice(0, 1)[0]; + message += ' (' + top_msg.replace(/^.*@ ?/, '') + ')'; + } catch(e) { + // Oh well, it was worth a shot! + } + } + + if (typeof(window.console) != 'undefined') { + // In older versions of Firefox, only console.log is defined. + var console = window.console; + var log = function(console, method, msg) { + if (method && typeof(method) == 'function') { + method.call(console, msg); + } else { + console.log(msg); + } + }; + + switch (severity) { + case Dygraph.DEBUG: + log(console, console.debug, 'dygraphs: ' + message); + break; + case Dygraph.INFO: + log(console, console.info, 'dygraphs: ' + message); + break; + case Dygraph.WARNING: + log(console, console.warn, 'dygraphs: ' + message); + break; + case Dygraph.ERROR: + log(console, console.error, 'dygraphs: ' + message); + break; + } + } + + if (Dygraph.LOG_STACK_TRACES) { + window.console.log(st.join('\n')); + } +}; + +/** + * @param {string} message + * @private + */ +Dygraph.info = function(message) { + Dygraph.log(Dygraph.INFO, message); +}; +/** + * @param {string} message + * @private + */ +Dygraph.prototype.info = Dygraph.info; + +/** + * @param {string} message + * @private + */ +Dygraph.warn = function(message) { + Dygraph.log(Dygraph.WARNING, message); +}; +/** + * @param {string} message + * @private + */ +Dygraph.prototype.warn = Dygraph.warn; + +/** + * @param {string} message + */ +Dygraph.error = function(message) { + Dygraph.log(Dygraph.ERROR, message); +}; +/** + * @param {string} message + * @private + */ +Dygraph.prototype.error = Dygraph.error; + +/** + * Return the 2d context for a dygraph canvas. + * + * This method is only exposed for the sake of replacing the function in + * automated tests, e.g. + * + * var oldFunc = Dygraph.getContext(); + * Dygraph.getContext = function(canvas) { + * var realContext = oldFunc(canvas); + * return new Proxy(realContext); + * }; + * @param {!HTMLCanvasElement} canvas + * @return {!CanvasRenderingContext2D} + * @private + */ +Dygraph.getContext = function(canvas) { + return /** @type{!CanvasRenderingContext2D}*/(canvas.getContext("2d")); +}; + +/** + * Add an event handler. This smooths a difference between IE and the rest of + * the world. + * @param { !Element } elem The element to add the event to. + * @param { string } type The type of the event, e.g. 'click' or 'mousemove'. + * @param { function(Event):(boolean|undefined) } fn The function to call + * on the event. The function takes one parameter: the event object. + * @private + */ +Dygraph.addEvent = function addEvent(elem, type, fn) { + if (elem.addEventListener) { + elem.addEventListener(type, fn, false); + } else { + elem[type+fn] = function(){fn(window.event);}; + elem.attachEvent('on'+type, elem[type+fn]); + } +}; + +/** + * Add an event handler. This event handler is kept until the graph is + * destroyed with a call to graph.destroy(). + * + * @param { !Element } elem The element to add the event to. + * @param { string } type The type of the event, e.g. 'click' or 'mousemove'. + * @param { function(Event):(boolean|undefined) } fn The function to call + * on the event. The function takes one parameter: the event object. + * @private + */ +Dygraph.prototype.addAndTrackEvent = function(elem, type, fn) { + Dygraph.addEvent(elem, type, fn); + this.registeredEvents_.push({ elem : elem, type : type, fn : fn }); +}; + +/** + * Remove an event handler. This smooths a difference between IE and the rest + * of the world. + * @param {!Element} elem The element to add the event to. + * @param {string} type The type of the event, e.g. 'click' or 'mousemove'. + * @param {function(Event):(boolean|undefined)} fn The function to call + * on the event. The function takes one parameter: the event object. + * @private + */ +Dygraph.removeEvent = function(elem, type, fn) { + if (elem.removeEventListener) { + elem.removeEventListener(type, fn, false); + } else { + try { + elem.detachEvent('on'+type, elem[type+fn]); + } catch(e) { + // We only detach event listeners on a "best effort" basis in IE. See: + // http://stackoverflow.com/questions/2553632/detachevent-not-working-with-named-inline-functions + } + elem[type+fn] = null; + } +}; + +Dygraph.prototype.removeTrackedEvents_ = function() { + if (this.registeredEvents_) { + for (var idx = 0; idx < this.registeredEvents_.length; idx++) { + var reg = this.registeredEvents_[idx]; + Dygraph.removeEvent(reg.elem, reg.type, reg.fn); + } + } + + this.registeredEvents_ = []; +}; + +/** + * Cancels further processing of an event. This is useful to prevent default + * browser actions, e.g. highlighting text on a double-click. + * Based on the article at + * http://www.switchonthecode.com/tutorials/javascript-tutorial-the-scroll-wheel + * @param { !Event } e The event whose normal behavior should be canceled. + * @private + */ +Dygraph.cancelEvent = function(e) { + e = e ? e : window.event; + if (e.stopPropagation) { + e.stopPropagation(); + } + if (e.preventDefault) { + e.preventDefault(); + } + e.cancelBubble = true; + e.cancel = true; + e.returnValue = false; + return false; +}; + +/** + * Convert hsv values to an rgb(r,g,b) string. Taken from MochiKit.Color. This + * is used to generate default series colors which are evenly spaced on the + * color wheel. + * @param { number } hue Range is 0.0-1.0. + * @param { number } saturation Range is 0.0-1.0. + * @param { number } value Range is 0.0-1.0. + * @return { string } "rgb(r,g,b)" where r, g and b range from 0-255. + * @private + */ +Dygraph.hsvToRGB = function (hue, saturation, value) { + var red; + var green; + var blue; + if (saturation === 0) { + red = value; + green = value; + blue = value; + } else { + var i = Math.floor(hue * 6); + var f = (hue * 6) - i; + var p = value * (1 - saturation); + var q = value * (1 - (saturation * f)); + var t = value * (1 - (saturation * (1 - f))); + switch (i) { + case 1: red = q; green = value; blue = p; break; + case 2: red = p; green = value; blue = t; break; + case 3: red = p; green = q; blue = value; break; + case 4: red = t; green = p; blue = value; break; + case 5: red = value; green = p; blue = q; break; + case 6: // fall through + case 0: red = value; green = t; blue = p; break; + } + } + red = Math.floor(255 * red + 0.5); + green = Math.floor(255 * green + 0.5); + blue = Math.floor(255 * blue + 0.5); + return 'rgb(' + red + ',' + green + ',' + blue + ')'; +}; + +// The following functions are from quirksmode.org with a modification for Safari from +// http://blog.firetree.net/2005/07/04/javascript-find-position/ +// http://www.quirksmode.org/js/findpos.html +// ... and modifications to support scrolling divs. + +/** + * Find the x-coordinate of the supplied object relative to the left side + * of the page. + * TODO(danvk): change obj type from Node -> !Node + * @param {Node} obj + * @return {number} + * @private + */ +Dygraph.findPosX = function(obj) { + var curleft = 0; + if(obj.offsetParent) { + var copyObj = obj; + while(1) { + // NOTE: the if statement here is for IE8. + var borderLeft = "0"; + if (window.getComputedStyle) { + borderLeft = window.getComputedStyle(copyObj, null).borderLeft || "0"; + } + curleft += parseInt(borderLeft, 10) ; + curleft += copyObj.offsetLeft; + if(!copyObj.offsetParent) { + break; + } + copyObj = copyObj.offsetParent; + } + } else if(obj.x) { + curleft += obj.x; + } + // This handles the case where the object is inside a scrolled div. + while(obj && obj != document.body) { + curleft -= obj.scrollLeft; + obj = obj.parentNode; + } + return curleft; +}; + +/** + * Find the y-coordinate of the supplied object relative to the top of the + * page. + * TODO(danvk): change obj type from Node -> !Node + * TODO(danvk): consolidate with findPosX and return an {x, y} object. + * @param {Node} obj + * @return {number} + * @private + */ +Dygraph.findPosY = function(obj) { + var curtop = 0; + if(obj.offsetParent) { + var copyObj = obj; + while(1) { + // NOTE: the if statement here is for IE8. + var borderTop = "0"; + if (window.getComputedStyle) { + borderTop = window.getComputedStyle(copyObj, null).borderTop || "0"; + } + curtop += parseInt(borderTop, 10) ; + curtop += copyObj.offsetTop; + if(!copyObj.offsetParent) { + break; + } + copyObj = copyObj.offsetParent; + } + } else if(obj.y) { + curtop += obj.y; + } + // This handles the case where the object is inside a scrolled div. + while(obj && obj != document.body) { + curtop -= obj.scrollTop; + obj = obj.parentNode; + } + return curtop; +}; + +/** + * Returns the x-coordinate of the event in a coordinate system where the + * top-left corner of the page (not the window) is (0,0). + * Taken from MochiKit.Signal + * @param {!Event} e + * @return {number} + * @private + */ +Dygraph.pageX = function(e) { + if (e.pageX) { + return (!e.pageX || e.pageX < 0) ? 0 : e.pageX; + } else { + var de = document.documentElement; + var b = document.body; + return e.clientX + + (de.scrollLeft || b.scrollLeft) - + (de.clientLeft || 0); + } +}; + +/** + * Returns the y-coordinate of the event in a coordinate system where the + * top-left corner of the page (not the window) is (0,0). + * Taken from MochiKit.Signal + * @param {!Event} e + * @return {number} + * @private + */ +Dygraph.pageY = function(e) { + if (e.pageY) { + return (!e.pageY || e.pageY < 0) ? 0 : e.pageY; + } else { + var de = document.documentElement; + var b = document.body; + return e.clientY + + (de.scrollTop || b.scrollTop) - + (de.clientTop || 0); + } +}; + +/** + * This returns true unless the parameter is 0, null, undefined or NaN. + * TODO(danvk): rename this function to something like 'isNonZeroNan'. + * + * @param {number} x The number to consider. + * @return {boolean} Whether the number is zero or NaN. + * @private + */ +Dygraph.isOK = function(x) { + return !!x && !isNaN(x); +}; + +/** + * @param { {x:?number,y:?number,yval:?number} } p The point to consider, valid + * points are {x, y} objects + * @param { boolean } allowNaNY Treat point with y=NaN as valid + * @return { boolean } Whether the point has numeric x and y. + * @private + */ +Dygraph.isValidPoint = function(p, allowNaNY) { + if (!p) return false; // null or undefined object + if (p.yval === null) return false; // missing point + if (p.x === null || p.x === undefined) return false; + if (p.y === null || p.y === undefined) return false; + if (isNaN(p.x) || (!allowNaNY && isNaN(p.y))) return false; + return true; +}; + +/** + * Number formatting function which mimicks the behavior of %g in printf, i.e. + * either exponential or fixed format (without trailing 0s) is used depending on + * the length of the generated string. The advantage of this format is that + * there is a predictable upper bound on the resulting string length, + * significant figures are not dropped, and normal numbers are not displayed in + * exponential notation. + * + * NOTE: JavaScript's native toPrecision() is NOT a drop-in replacement for %g. + * It creates strings which are too long for absolute values between 10^-4 and + * 10^-6, e.g. '0.00001' instead of '1e-5'. See tests/number-format.html for + * output examples. + * + * @param {number} x The number to format + * @param {number=} opt_precision The precision to use, default 2. + * @return {string} A string formatted like %g in printf. The max generated + * string length should be precision + 6 (e.g 1.123e+300). + */ +Dygraph.floatFormat = function(x, opt_precision) { + // Avoid invalid precision values; [1, 21] is the valid range. + var p = Math.min(Math.max(1, opt_precision || 2), 21); + + // This is deceptively simple. The actual algorithm comes from: + // + // Max allowed length = p + 4 + // where 4 comes from 'e+n' and '.'. + // + // Length of fixed format = 2 + y + p + // where 2 comes from '0.' and y = # of leading zeroes. + // + // Equating the two and solving for y yields y = 2, or 0.00xxxx which is + // 1.0e-3. + // + // Since the behavior of toPrecision() is identical for larger numbers, we + // don't have to worry about the other bound. + // + // Finally, the argument for toExponential() is the number of trailing digits, + // so we take off 1 for the value before the '.'. + return (Math.abs(x) < 1.0e-3 && x !== 0.0) ? + x.toExponential(p - 1) : x.toPrecision(p); +}; + +/** + * Converts '9' to '09' (useful for dates) + * @param {number} x + * @return {string} + * @private + */ +Dygraph.zeropad = function(x) { + if (x < 10) return "0" + x; else return "" + x; +}; + +/** + * Return a string version of the hours, minutes and seconds portion of a date. + * + * @param {number} date The JavaScript date (ms since epoch) + * @return {string} A time of the form "HH:MM:SS" + * @private + */ +Dygraph.hmsString_ = function(date) { + var zeropad = Dygraph.zeropad; + var d = new Date(date); + if (d.getSeconds()) { + return zeropad(d.getHours()) + ":" + + zeropad(d.getMinutes()) + ":" + + zeropad(d.getSeconds()); + } else { + return zeropad(d.getHours()) + ":" + zeropad(d.getMinutes()); + } +}; + +/** + * Round a number to the specified number of digits past the decimal point. + * @param {number} num The number to round + * @param {number} places The number of decimals to which to round + * @return {number} The rounded number + * @private + */ +Dygraph.round_ = function(num, places) { + var shift = Math.pow(10, places); + return Math.round(num * shift)/shift; +}; + +/** + * Implementation of binary search over an array. + * Currently does not work when val is outside the range of arry's values. + * @param {number} val the value to search for + * @param {Array.} arry is the value over which to search + * @param {number} abs If abs > 0, find the lowest entry greater than val + * If abs < 0, find the highest entry less than val. + * If abs == 0, find the entry that equals val. + * @param {number=} low The first index in arry to consider (optional) + * @param {number=} high The last index in arry to consider (optional) + * @return {number} Index of the element, or -1 if it isn't found. + * @private + */ +Dygraph.binarySearch = function(val, arry, abs, low, high) { + if (low === null || low === undefined || + high === null || high === undefined) { + low = 0; + high = arry.length - 1; + } + if (low > high) { + return -1; + } + if (abs === null || abs === undefined) { + abs = 0; + } + var validIndex = function(idx) { + return idx >= 0 && idx < arry.length; + }; + var mid = parseInt((low + high) / 2, 10); + var element = arry[mid]; + var idx; + if (element == val) { + return mid; + } else if (element > val) { + if (abs > 0) { + // Accept if element > val, but also if prior element < val. + idx = mid - 1; + if (validIndex(idx) && arry[idx] < val) { + return mid; + } + } + return Dygraph.binarySearch(val, arry, abs, low, mid - 1); + } else if (element < val) { + if (abs < 0) { + // Accept if element < val, but also if prior element > val. + idx = mid + 1; + if (validIndex(idx) && arry[idx] > val) { + return mid; + } + } + return Dygraph.binarySearch(val, arry, abs, mid + 1, high); + } + return -1; // can't actually happen, but makes closure compiler happy +}; + +/** + * Parses a date, returning the number of milliseconds since epoch. This can be + * passed in as an xValueParser in the Dygraph constructor. + * TODO(danvk): enumerate formats that this understands. + * + * @param {string} dateStr A date in a variety of possible string formats. + * @return {number} Milliseconds since epoch. + * @private + */ +Dygraph.dateParser = function(dateStr) { + var dateStrSlashed; + var d; + + // Let the system try the format first, with one caveat: + // YYYY-MM-DD[ HH:MM:SS] is interpreted as UTC by a variety of browsers. + // dygraphs displays dates in local time, so this will result in surprising + // inconsistencies. But if you specify "T" or "Z" (i.e. YYYY-MM-DDTHH:MM:SS), + // then you probably know what you're doing, so we'll let you go ahead. + // Issue: http://code.google.com/p/dygraphs/issues/detail?id=255 + if (dateStr.search("-") == -1 || + dateStr.search("T") != -1 || dateStr.search("Z") != -1) { + d = Dygraph.dateStrToMillis(dateStr); + if (d && !isNaN(d)) return d; + } + + if (dateStr.search("-") != -1) { // e.g. '2009-7-12' or '2009-07-12' + dateStrSlashed = dateStr.replace("-", "/", "g"); + while (dateStrSlashed.search("-") != -1) { + dateStrSlashed = dateStrSlashed.replace("-", "/"); + } + d = Dygraph.dateStrToMillis(dateStrSlashed); + } else if (dateStr.length == 8) { // e.g. '20090712' + // TODO(danvk): remove support for this format. It's confusing. + dateStrSlashed = dateStr.substr(0,4) + "/" + dateStr.substr(4,2) + "/" + + dateStr.substr(6,2); + d = Dygraph.dateStrToMillis(dateStrSlashed); + } else { + // Any format that Date.parse will accept, e.g. "2009/07/12" or + // "2009/07/12 12:34:56" + d = Dygraph.dateStrToMillis(dateStr); + } + + if (!d || isNaN(d)) { + Dygraph.error("Couldn't parse " + dateStr + " as a date"); + } + return d; +}; + +/** + * This is identical to JavaScript's built-in Date.parse() method, except that + * it doesn't get replaced with an incompatible method by aggressive JS + * libraries like MooTools or Joomla. + * @param {string} str The date string, e.g. "2011/05/06" + * @return {number} millis since epoch + * @private + */ +Dygraph.dateStrToMillis = function(str) { + return new Date(str).getTime(); +}; + +// These functions are all based on MochiKit. +/** + * Copies all the properties from o to self. + * + * @param {!Object} self + * @param {!Object} o + * @return {!Object} + */ +Dygraph.update = function(self, o) { + if (typeof(o) != 'undefined' && o !== null) { + for (var k in o) { + if (o.hasOwnProperty(k)) { + self[k] = o[k]; + } + } + } + return self; +}; + +/** + * Copies all the properties from o to self. + * + * @param {!Object} self + * @param {!Object} o + * @return {!Object} + * @private + */ +Dygraph.updateDeep = function (self, o) { + // Taken from http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object + function isNode(o) { + return ( + typeof Node === "object" ? o instanceof Node : + typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName==="string" + ); + } + + if (typeof(o) != 'undefined' && o !== null) { + for (var k in o) { + if (o.hasOwnProperty(k)) { + if (o[k] === null) { + self[k] = null; + } else if (Dygraph.isArrayLike(o[k])) { + self[k] = o[k].slice(); + } else if (isNode(o[k])) { + // DOM objects are shallowly-copied. + self[k] = o[k]; + } else if (typeof(o[k]) == 'object') { + if (typeof(self[k]) != 'object' || self[k] === null) { + self[k] = {}; + } + Dygraph.updateDeep(self[k], o[k]); + } else { + self[k] = o[k]; + } + } + } + } + return self; +}; + +/** + * @param {Object} o + * @return {boolean} + * @private + */ +Dygraph.isArrayLike = function(o) { + var typ = typeof(o); + if ( + (typ != 'object' && !(typ == 'function' && + typeof(o.item) == 'function')) || + o === null || + typeof(o.length) != 'number' || + o.nodeType === 3 + ) { + return false; + } + return true; +}; + +/** + * @param {Object} o + * @return {boolean} + * @private + */ +Dygraph.isDateLike = function (o) { + if (typeof(o) != "object" || o === null || + typeof(o.getTime) != 'function') { + return false; + } + return true; +}; + +/** + * Note: this only seems to work for arrays. + * @param {!Array} o + * @return {!Array} + * @private + */ +Dygraph.clone = function(o) { + // TODO(danvk): figure out how MochiKit's version works + var r = []; + for (var i = 0; i < o.length; i++) { + if (Dygraph.isArrayLike(o[i])) { + r.push(Dygraph.clone(o[i])); + } else { + r.push(o[i]); + } + } + return r; +}; + +/** + * Create a new canvas element. This is more complex than a simple + * document.createElement("canvas") because of IE and excanvas. + * + * @return {!HTMLCanvasElement} + * @private + */ +Dygraph.createCanvas = function() { + var canvas = document.createElement("canvas"); + + var isIE = (/MSIE/.test(navigator.userAgent) && !window.opera); + if (isIE && (typeof(G_vmlCanvasManager) != 'undefined')) { + canvas = G_vmlCanvasManager.initElement( + /**@type{!HTMLCanvasElement}*/(canvas)); + } + + return canvas; +}; + +/** + * Checks whether the user is on an Android browser. + * Android does not fully support the tag, e.g. w/r/t/ clipping. + * @return {boolean} + * @private + */ +Dygraph.isAndroid = function() { + return (/Android/).test(navigator.userAgent); +}; + + +/** + * TODO(danvk): use @template here when it's better supported for classes. + * @param {!Array} array + * @param {number} start + * @param {number} length + * @param {function(!Array,?):boolean=} predicate + * @constructor + */ +Dygraph.Iterator = function(array, start, length, predicate) { + start = start || 0; + length = length || array.length; + this.hasNext = true; // Use to identify if there's another element. + this.peek = null; // Use for look-ahead + this.start_ = start; + this.array_ = array; + this.predicate_ = predicate; + this.end_ = Math.min(array.length, start + length); + this.nextIdx_ = start - 1; // use -1 so initial advance works. + this.next(); // ignoring result. +}; + +/** + * @return {Object} + */ +Dygraph.Iterator.prototype.next = function() { + if (!this.hasNext) { + return null; + } + var obj = this.peek; + + var nextIdx = this.nextIdx_ + 1; + var found = false; + while (nextIdx < this.end_) { + if (!this.predicate_ || this.predicate_(this.array_, nextIdx)) { + this.peek = this.array_[nextIdx]; + found = true; + break; + } + nextIdx++; + } + this.nextIdx_ = nextIdx; + if (!found) { + this.hasNext = false; + this.peek = null; + } + return obj; +}; + +/** + * Returns a new iterator over array, between indexes start and + * start + length, and only returns entries that pass the accept function + * + * @param {!Array} array the array to iterate over. + * @param {number} start the first index to iterate over, 0 if absent. + * @param {number} length the number of elements in the array to iterate over. + * This, along with start, defines a slice of the array, and so length + * doesn't imply the number of elements in the iterator when accept doesn't + * always accept all values. array.length when absent. + * @param {function(?):boolean=} opt_predicate a function that takes + * parameters array and idx, which returns true when the element should be + * returned. If omitted, all elements are accepted. + * @private + */ +Dygraph.createIterator = function(array, start, length, opt_predicate) { + return new Dygraph.Iterator(array, start, length, opt_predicate); +}; + +// Shim layer with setTimeout fallback. +// From: http://paulirish.com/2011/requestanimationframe-for-smart-animating/ +// Should be called with the window context: +// Dygraph.requestAnimFrame.call(window, function() {}) +Dygraph.requestAnimFrame = (function() { + return window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || + window.oRequestAnimationFrame || + window.msRequestAnimationFrame || + function (callback) { + window.setTimeout(callback, 1000 / 60); + }; +})(); + +/** + * Call a function at most maxFrames times at an attempted interval of + * framePeriodInMillis, then call a cleanup function once. repeatFn is called + * once immediately, then at most (maxFrames - 1) times asynchronously. If + * maxFrames==1, then cleanup_fn() is also called synchronously. This function + * is used to sequence animation. + * @param {function(number)} repeatFn Called repeatedly -- takes the frame + * number (from 0 to maxFrames-1) as an argument. + * @param {number} maxFrames The max number of times to call repeatFn + * @param {number} framePeriodInMillis Max requested time between frames. + * @param {function()} cleanupFn A function to call after all repeatFn calls. + * @private + */ +Dygraph.repeatAndCleanup = function(repeatFn, maxFrames, framePeriodInMillis, + cleanupFn) { + var frameNumber = 0; + var previousFrameNumber; + var startTime = new Date().getTime(); + repeatFn(frameNumber); + if (maxFrames == 1) { + cleanupFn(); + return; + } + var maxFrameArg = maxFrames - 1; + + (function loop() { + if (frameNumber >= maxFrames) return; + Dygraph.requestAnimFrame.call(window, function() { + // Determine which frame to draw based on the delay so far. Will skip + // frames if necessary. + var currentTime = new Date().getTime(); + var delayInMillis = currentTime - startTime; + previousFrameNumber = frameNumber; + frameNumber = Math.floor(delayInMillis / framePeriodInMillis); + var frameDelta = frameNumber - previousFrameNumber; + // If we predict that the subsequent repeatFn call will overshoot our + // total frame target, so our last call will cause a stutter, then jump to + // the last call immediately. If we're going to cause a stutter, better + // to do it faster than slower. + var predictOvershootStutter = (frameNumber + frameDelta) > maxFrameArg; + if (predictOvershootStutter || (frameNumber >= maxFrameArg)) { + repeatFn(maxFrameArg); // Ensure final call with maxFrameArg. + cleanupFn(); + } else { + if (frameDelta !== 0) { // Don't call repeatFn with duplicate frames. + repeatFn(frameNumber); + } + loop(); + } + }); + })(); +}; + +/** + * This function will scan the option list and determine if they + * require us to recalculate the pixel positions of each point. + * @param {!Array.} labels a list of options to check. + * @param {!Object} attrs + * @return {boolean} true if the graph needs new points else false. + * @private + */ +Dygraph.isPixelChangingOptionList = function(labels, attrs) { + // A whitelist of options that do not change pixel positions. + var pixelSafeOptions = { + 'annotationClickHandler': true, + 'annotationDblClickHandler': true, + 'annotationMouseOutHandler': true, + 'annotationMouseOverHandler': true, + 'axisLabelColor': true, + 'axisLineColor': true, + 'axisLineWidth': true, + 'clickCallback': true, + 'digitsAfterDecimal': true, + 'drawCallback': true, + 'drawHighlightPointCallback': true, + 'drawPoints': true, + 'drawPointCallback': true, + 'drawXGrid': true, + 'drawYGrid': true, + 'fillAlpha': true, + 'gridLineColor': true, + 'gridLineWidth': true, + 'hideOverlayOnMouseOut': true, + 'highlightCallback': true, + 'highlightCircleSize': true, + 'interactionModel': true, + 'isZoomedIgnoreProgrammaticZoom': true, + 'labelsDiv': true, + 'labelsDivStyles': true, + 'labelsDivWidth': true, + 'labelsKMB': true, + 'labelsKMG2': true, + 'labelsSeparateLines': true, + 'labelsShowZeroValues': true, + 'legend': true, + 'maxNumberWidth': true, + 'panEdgeFraction': true, + 'pixelsPerYLabel': true, + 'pointClickCallback': true, + 'pointSize': true, + 'rangeSelectorPlotFillColor': true, + 'rangeSelectorPlotStrokeColor': true, + 'showLabelsOnHighlight': true, + 'showRoller': true, + 'sigFigs': true, + 'strokeWidth': true, + 'underlayCallback': true, + 'unhighlightCallback': true, + 'xAxisLabelFormatter': true, + 'xTicker': true, + 'xValueFormatter': true, + 'yAxisLabelFormatter': true, + 'yValueFormatter': true, + 'zoomCallback': true + }; + + // Assume that we do not require new points. + // This will change to true if we actually do need new points. + var requiresNewPoints = false; + + // Create a dictionary of series names for faster lookup. + // If there are no labels, then the dictionary stays empty. + var seriesNamesDictionary = { }; + if (labels) { + for (var i = 1; i < labels.length; i++) { + seriesNamesDictionary[labels[i]] = true; + } + } + + // Iterate through the list of updated options. + for (var property in attrs) { + // Break early if we already know we need new points from a previous option. + if (requiresNewPoints) { + break; + } + if (attrs.hasOwnProperty(property)) { + // Find out of this field is actually a series specific options list. + if (seriesNamesDictionary[property]) { + // This property value is a list of options for this series. + // If any of these sub properties are not pixel safe, set the flag. + for (var subProperty in attrs[property]) { + // Break early if we already know we need new points from a previous option. + if (requiresNewPoints) { + break; + } + if (attrs[property].hasOwnProperty(subProperty) && !pixelSafeOptions[subProperty]) { + requiresNewPoints = true; + } + } + // If this was not a series specific option list, check if its a pixel changing property. + } else if (!pixelSafeOptions[property]) { + requiresNewPoints = true; + } + } + } + + return requiresNewPoints; +}; + +/** + * Compares two arrays to see if they are equal. If either parameter is not an + * array it will return false. Does a shallow compare + * Dygraph.compareArrays([[1,2], [3, 4]], [[1,2], [3,4]]) === false. + * @param {!Array.} array1 first array + * @param {!Array.} array2 second array + * @return {boolean} True if both parameters are arrays, and contents are equal. + * @template T + */ +Dygraph.compareArrays = function(array1, array2) { + if (!Dygraph.isArrayLike(array1) || !Dygraph.isArrayLike(array2)) { + return false; + } + if (array1.length !== array2.length) { + return false; + } + for (var i = 0; i < array1.length; i++) { + if (array1[i] !== array2[i]) { + return false; + } + } + return true; +}; + +/** + * @param {!CanvasRenderingContext2D} ctx the canvas context + * @param {number} sides the number of sides in the shape. + * @param {number} radius the radius of the image. + * @param {number} cx center x coordate + * @param {number} cy center y coordinate + * @param {number=} rotationRadians the shift of the initial angle, in radians. + * @param {number=} delta the angle shift for each line. If missing, creates a + * regular polygon. + * @private + */ +Dygraph.regularShape_ = function( + ctx, sides, radius, cx, cy, rotationRadians, delta) { + rotationRadians = rotationRadians || 0; + delta = delta || Math.PI * 2 / sides; + + ctx.beginPath(); + var initialAngle = rotationRadians; + var angle = initialAngle; + + var computeCoordinates = function() { + var x = cx + (Math.sin(angle) * radius); + var y = cy + (-Math.cos(angle) * radius); + return [x, y]; + }; + + var initialCoordinates = computeCoordinates(); + var x = initialCoordinates[0]; + var y = initialCoordinates[1]; + ctx.moveTo(x, y); + + for (var idx = 0; idx < sides; idx++) { + angle = (idx == sides - 1) ? initialAngle : (angle + delta); + var coords = computeCoordinates(); + ctx.lineTo(coords[0], coords[1]); + } + ctx.fill(); + ctx.stroke(); +}; + +/** + * TODO(danvk): be more specific on the return type. + * @param {number} sides + * @param {number=} rotationRadians + * @param {number=} delta + * @return {Function} + * @private + */ +Dygraph.shapeFunction_ = function(sides, rotationRadians, delta) { + return function(g, name, ctx, cx, cy, color, radius) { + ctx.strokeStyle = color; + ctx.fillStyle = "white"; + Dygraph.regularShape_(ctx, sides, radius, cx, cy, rotationRadians, delta); + }; +}; + +Dygraph.Circles = { + DEFAULT : function(g, name, ctx, canvasx, canvasy, color, radius) { + ctx.beginPath(); + ctx.fillStyle = color; + ctx.arc(canvasx, canvasy, radius, 0, 2 * Math.PI, false); + ctx.fill(); + }, + TRIANGLE : Dygraph.shapeFunction_(3), + SQUARE : Dygraph.shapeFunction_(4, Math.PI / 4), + DIAMOND : Dygraph.shapeFunction_(4), + PENTAGON : Dygraph.shapeFunction_(5), + HEXAGON : Dygraph.shapeFunction_(6), + CIRCLE : function(g, name, ctx, cx, cy, color, radius) { + ctx.beginPath(); + ctx.strokeStyle = color; + ctx.fillStyle = "white"; + ctx.arc(cx, cy, radius, 0, 2 * Math.PI, false); + ctx.fill(); + ctx.stroke(); + }, + STAR : Dygraph.shapeFunction_(5, 0, 4 * Math.PI / 5), + PLUS : function(g, name, ctx, cx, cy, color, radius) { + ctx.strokeStyle = color; + + ctx.beginPath(); + ctx.moveTo(cx + radius, cy); + ctx.lineTo(cx - radius, cy); + ctx.closePath(); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(cx, cy + radius); + ctx.lineTo(cx, cy - radius); + ctx.closePath(); + ctx.stroke(); + }, + EX : function(g, name, ctx, cx, cy, color, radius) { + ctx.strokeStyle = color; + + ctx.beginPath(); + ctx.moveTo(cx + radius, cy + radius); + ctx.lineTo(cx - radius, cy - radius); + ctx.closePath(); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(cx + radius, cy - radius); + ctx.lineTo(cx - radius, cy + radius); + ctx.closePath(); + ctx.stroke(); + } +}; + +/** + * To create a "drag" interaction, you typically register a mousedown event + * handler on the element where the drag begins. In that handler, you register a + * mouseup handler on the window to determine when the mouse is released, + * wherever that release happens. This works well, except when the user releases + * the mouse over an off-domain iframe. In that case, the mouseup event is + * handled by the iframe and never bubbles up to the window handler. + * + * To deal with this issue, we cover iframes with high z-index divs to make sure + * they don't capture mouseup. + * + * Usage: + * element.addEventListener('mousedown', function() { + * var tarper = new Dygraph.IFrameTarp(); + * tarper.cover(); + * var mouseUpHandler = function() { + * ... + * window.removeEventListener(mouseUpHandler); + * tarper.uncover(); + * }; + * window.addEventListener('mouseup', mouseUpHandler); + * }; + * + * @constructor + */ +Dygraph.IFrameTarp = function() { + /** @type {Array.} */ + this.tarps = []; +}; + +/** + * Find all the iframes in the document and cover them with high z-index + * transparent divs. + */ +Dygraph.IFrameTarp.prototype.cover = function() { + var iframes = document.getElementsByTagName("iframe"); + for (var i = 0; i < iframes.length; i++) { + var iframe = iframes[i]; + var x = Dygraph.findPosX(iframe), + y = Dygraph.findPosY(iframe), + width = iframe.offsetWidth, + height = iframe.offsetHeight; + + var div = document.createElement("div"); + div.style.position = "absolute"; + div.style.left = x + 'px'; + div.style.top = y + 'px'; + div.style.width = width + 'px'; + div.style.height = height + 'px'; + div.style.zIndex = 999; + document.body.appendChild(div); + this.tarps.push(div); + } +}; + +/** + * Remove all the iframe covers. You should call this in a mouseup handler. + */ +Dygraph.IFrameTarp.prototype.uncover = function() { + for (var i = 0; i < this.tarps.length; i++) { + this.tarps[i].parentNode.removeChild(this.tarps[i]); + } + this.tarps = []; +}; + +/** + * Determine whether |data| is delimited by CR, CRLF, LF, LFCR. + * @param {string} data + * @return {?string} the delimiter that was detected (or null on failure). + */ +Dygraph.detectLineDelimiter = function(data) { + for (var i = 0; i < data.length; i++) { + var code = data.charAt(i); + if (code === '\r') { + // Might actually be "\r\n". + if (((i + 1) < data.length) && (data.charAt(i + 1) === '\n')) { + return '\r\n'; + } + return code; + } + if (code === '\n') { + // Might actually be "\n\r". + if (((i + 1) < data.length) && (data.charAt(i + 1) === '\r')) { + return '\n\r'; + } + return code; + } + } + + return null; +}; + +/** + * Is one node contained by another? + * @param {Node} containee The contained node. + * @param {Node} container The container node. + * @return {boolean} Whether containee is inside (or equal to) container. + * @private + */ +Dygraph.isNodeContainedBy = function(containee, container) { + if (container === null || containee === null) { + return false; + } + var containeeNode = /** @type {Node} */ (containee); + while (containeeNode && containeeNode !== container) { + containeeNode = containeeNode.parentNode; + } + return (containeeNode === container); +}; + + +// This masks some numeric issues in older versions of Firefox, +// where 1.0/Math.pow(10,2) != Math.pow(10,-2). +/** @type {function(number,number):number} */ +Dygraph.pow = function(base, exp) { + if (exp < 0) { + return 1.0 / Math.pow(base, -exp); + } + return Math.pow(base, exp); +}; + +// For Dygraph.setDateSameTZ, below. +Dygraph.dateSetters = { + ms: Date.prototype.setMilliseconds, + s: Date.prototype.setSeconds, + m: Date.prototype.setMinutes, + h: Date.prototype.setHours +}; + +/** + * This is like calling d.setSeconds(), d.setMinutes(), etc, except that it + * adjusts for time zone changes to keep the date/time parts consistent. + * + * For example, d.getSeconds(), d.getMinutes() and d.getHours() will all be + * the same before/after you call setDateSameTZ(d, {ms: 0}). The same is not + * true if you call d.setMilliseconds(0). + * + * @type {function(!Date, Object.)} + */ +Dygraph.setDateSameTZ = function(d, parts) { + var tz = d.getTimezoneOffset(); + for (var k in parts) { + if (!parts.hasOwnProperty(k)) continue; + var setter = Dygraph.dateSetters[k]; + if (!setter) throw "Invalid setter: " + k; + setter.call(d, parts[k]); + if (d.getTimezoneOffset() != tz) { + d.setTime(d.getTime() + (tz - d.getTimezoneOffset()) * 60 * 1000); + } + } +}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph.js new file mode 100644 index 0000000..1ee711c --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/dygraph.js @@ -0,0 +1,3857 @@ +/** + * @license + * Copyright 2006 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/** + * @fileoverview Creates an interactive, zoomable graph based on a CSV file or + * string. Dygraph can handle multiple series with or without error bars. The + * date/value ranges will be automatically set. Dygraph uses the + * <canvas> tag, so it only works in FF1.5+. + * @author danvdk@gmail.com (Dan Vanderkam) + + Usage: +
          + + + The CSV file is of the form + + Date,SeriesA,SeriesB,SeriesC + YYYYMMDD,A1,B1,C1 + YYYYMMDD,A2,B2,C2 + + If the 'errorBars' option is set in the constructor, the input should be of + the form + Date,SeriesA,SeriesB,... + YYYYMMDD,A1,sigmaA1,B1,sigmaB1,... + YYYYMMDD,A2,sigmaA2,B2,sigmaB2,... + + If the 'fractions' option is set, the input should be of the form: + + Date,SeriesA,SeriesB,... + YYYYMMDD,A1/B1,A2/B2,... + YYYYMMDD,A1/B1,A2/B2,... + + And error bars will be calculated automatically using a binomial distribution. + + For further documentation and examples, see http://dygraphs.com/ + + */ + +/*jshint globalstrict: true */ +/*global DygraphLayout:false, DygraphCanvasRenderer:false, DygraphOptions:false, G_vmlCanvasManager:false */ +"use strict"; + +/** + * Creates an interactive, zoomable chart. + * + * @constructor + * @param {div | String} div A div or the id of a div into which to construct + * the chart. + * @param {String | Function} file A file containing CSV data or a function + * that returns this data. The most basic expected format for each line is + * "YYYY/MM/DD,val1,val2,...". For more information, see + * http://dygraphs.com/data.html. + * @param {Object} attrs Various other attributes, e.g. errorBars determines + * whether the input data contains error ranges. For a complete list of + * options, see http://dygraphs.com/options.html. + */ +var Dygraph = function(div, data, opts, opt_fourth_param) { + if (opt_fourth_param !== undefined) { + // Old versions of dygraphs took in the series labels as a constructor + // parameter. This doesn't make sense anymore, but it's easy to continue + // to support this usage. + this.warn("Using deprecated four-argument dygraph constructor"); + this.__old_init__(div, data, opts, opt_fourth_param); + } else { + this.__init__(div, data, opts); + } +}; + +Dygraph.NAME = "Dygraph"; +Dygraph.VERSION = "1.2"; +Dygraph.__repr__ = function() { + return "[" + this.NAME + " " + this.VERSION + "]"; +}; + +/** + * Returns information about the Dygraph class. + */ +Dygraph.toString = function() { + return this.__repr__(); +}; + +// Various default values +Dygraph.DEFAULT_ROLL_PERIOD = 1; +Dygraph.DEFAULT_WIDTH = 480; +Dygraph.DEFAULT_HEIGHT = 320; + +// For max 60 Hz. animation: +Dygraph.ANIMATION_STEPS = 12; +Dygraph.ANIMATION_DURATION = 200; + +// Label constants for the labelsKMB and labelsKMG2 options. +// (i.e. '100000' -> '100K') +Dygraph.KMB_LABELS = [ 'K', 'M', 'B', 'T', 'Q' ]; +Dygraph.KMG2_BIG_LABELS = [ 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y' ]; +Dygraph.KMG2_SMALL_LABELS = [ 'm', 'u', 'n', 'p', 'f', 'a', 'z', 'y' ]; + +// These are defined before DEFAULT_ATTRS so that it can refer to them. +/** + * @private + * Return a string version of a number. This respects the digitsAfterDecimal + * and maxNumberWidth options. + * @param {Number} x The number to be formatted + * @param {Dygraph} opts An options view + * @param {String} name The name of the point's data series + * @param {Dygraph} g The dygraph object + */ +Dygraph.numberValueFormatter = function(x, opts, pt, g) { + var sigFigs = opts('sigFigs'); + + if (sigFigs !== null) { + // User has opted for a fixed number of significant figures. + return Dygraph.floatFormat(x, sigFigs); + } + + var digits = opts('digitsAfterDecimal'); + var maxNumberWidth = opts('maxNumberWidth'); + + var kmb = opts('labelsKMB'); + var kmg2 = opts('labelsKMG2'); + + var label; + + // switch to scientific notation if we underflow or overflow fixed display. + if (x !== 0.0 && + (Math.abs(x) >= Math.pow(10, maxNumberWidth) || + Math.abs(x) < Math.pow(10, -digits))) { + label = x.toExponential(digits); + } else { + label = '' + Dygraph.round_(x, digits); + } + + if (kmb || kmg2) { + var k; + var k_labels = []; + var m_labels = []; + if (kmb) { + k = 1000; + k_labels = Dygraph.KMB_LABELS; + } + if (kmg2) { + if (kmb) Dygraph.warn("Setting both labelsKMB and labelsKMG2. Pick one!"); + k = 1024; + k_labels = Dygraph.KMG2_BIG_LABELS; + m_labels = Dygraph.KMG2_SMALL_LABELS; + } + + var absx = Math.abs(x); + var n = Dygraph.pow(k, k_labels.length); + for (var j = k_labels.length - 1; j >= 0; j--, n /= k) { + if (absx >= n) { + label = Dygraph.round_(x / n, digits) + k_labels[j]; + break; + } + } + if (kmg2) { + // TODO(danvk): clean up this logic. Why so different than kmb? + var x_parts = String(x.toExponential()).split('e-'); + if (x_parts.length === 2 && x_parts[1] >= 3 && x_parts[1] <= 24) { + if (x_parts[1] % 3 > 0) { + label = Dygraph.round_(x_parts[0] / + Dygraph.pow(10, (x_parts[1] % 3)), + digits); + } else { + label = Number(x_parts[0]).toFixed(2); + } + label += m_labels[Math.floor(x_parts[1] / 3) - 1]; + } + } + } + + return label; +}; + +/** + * variant for use as an axisLabelFormatter. + * @private + */ +Dygraph.numberAxisLabelFormatter = function(x, granularity, opts, g) { + return Dygraph.numberValueFormatter(x, opts, g); +}; + +/** + * Convert a JS date (millis since epoch) to YYYY/MM/DD + * @param {Number} date The JavaScript date (ms since epoch) + * @return {String} A date of the form "YYYY/MM/DD" + * @private + */ +Dygraph.dateString_ = function(date) { + var zeropad = Dygraph.zeropad; + var d = new Date(date); + + // Get the year: + var year = "" + d.getFullYear(); + // Get a 0 padded month string + var month = zeropad(d.getMonth() + 1); //months are 0-offset, sigh + // Get a 0 padded day string + var day = zeropad(d.getDate()); + + var ret = ""; + var frac = d.getHours() * 3600 + d.getMinutes() * 60 + d.getSeconds(); + if (frac) ret = " " + Dygraph.hmsString_(date); + + return year + "/" + month + "/" + day + ret; +}; + +/** + * Convert a JS date to a string appropriate to display on an axis that + * is displaying values at the stated granularity. + * @param {Date} date The date to format + * @param {Number} granularity One of the Dygraph granularity constants + * @return {String} The formatted date + * @private + */ +Dygraph.dateAxisFormatter = function(date, granularity) { + if (granularity >= Dygraph.DECADAL) { + return date.strftime('%Y'); + } else if (granularity >= Dygraph.MONTHLY) { + return date.strftime('%b %y'); + } else { + var frac = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds() + date.getMilliseconds(); + if (frac === 0 || granularity >= Dygraph.DAILY) { + return new Date(date.getTime() + 3600*1000).strftime('%d%b'); + } else { + return Dygraph.hmsString_(date.getTime()); + } + } +}; + +/** + * Standard plotters. These may be used by clients. + * Available plotters are: + * - Dygraph.Plotters.linePlotter: draws central lines (most common) + * - Dygraph.Plotters.errorPlotter: draws error bars + * - Dygraph.Plotters.fillPlotter: draws fills under lines (used with fillGraph) + * + * By default, the plotter is [fillPlotter, errorPlotter, linePlotter]. + * This causes all the lines to be drawn over all the fills/error bars. + */ +Dygraph.Plotters = DygraphCanvasRenderer._Plotters; + + +// Default attribute values. +Dygraph.DEFAULT_ATTRS = { + highlightCircleSize: 3, + highlightSeriesOpts: null, + highlightSeriesBackgroundAlpha: 0.5, + + labelsDivWidth: 250, + labelsDivStyles: { + // TODO(danvk): move defaults from createStatusMessage_ here. + }, + labelsSeparateLines: false, + labelsShowZeroValues: true, + labelsKMB: false, + labelsKMG2: false, + showLabelsOnHighlight: true, + + digitsAfterDecimal: 2, + maxNumberWidth: 6, + sigFigs: null, + + strokeWidth: 1.0, + strokeBorderWidth: 0, + strokeBorderColor: "white", + + axisTickSize: 3, + axisLabelFontSize: 14, + xAxisLabelWidth: 50, + yAxisLabelWidth: 50, + rightGap: 5, + + showRoller: false, + xValueParser: Dygraph.dateParser, + + delimiter: ',', + + sigma: 2.0, + errorBars: false, + fractions: false, + wilsonInterval: true, // only relevant if fractions is true + customBars: false, + fillGraph: false, + fillAlpha: 0.15, + connectSeparatedPoints: false, + + stackedGraph: false, + stackedGraphNaNFill: 'all', + hideOverlayOnMouseOut: true, + + // TODO(danvk): support 'onmouseover' and 'never', and remove synonyms. + legend: 'onmouseover', // the only relevant value at the moment is 'always'. + + stepPlot: false, + avoidMinZero: false, + xRangePad: 0, + yRangePad: null, + drawAxesAtZero: false, + + // Sizes of the various chart labels. + titleHeight: 28, + xLabelHeight: 18, + yLabelWidth: 18, + + drawXAxis: true, + drawYAxis: true, + axisLineColor: "black", + axisLineWidth: 0.3, + gridLineWidth: 0.3, + axisLabelColor: "black", + axisLabelFont: "Arial", // TODO(danvk): is this implemented? + axisLabelWidth: 50, + drawYGrid: true, + drawXGrid: true, + gridLineColor: "rgb(128,128,128)", + + interactionModel: null, // will be set to Dygraph.Interaction.defaultModel + animatedZooms: false, // (for now) + + // Range selector options + showRangeSelector: false, + rangeSelectorHeight: 40, + rangeSelectorPlotStrokeColor: "#808FAB", + rangeSelectorPlotFillColor: "#A7B1C4", + + // The ordering here ensures that central lines always appear above any + // fill bars/error bars. + plotter: [ + Dygraph.Plotters.fillPlotter, + Dygraph.Plotters.errorPlotter, + Dygraph.Plotters.linePlotter + ], + + plugins: [ ], + + // per-axis options + axes: { + x: { + pixelsPerLabel: 60, + axisLabelFormatter: Dygraph.dateAxisFormatter, + valueFormatter: Dygraph.dateString_, + drawGrid: true, + independentTicks: true, + ticker: null // will be set in dygraph-tickers.js + }, + y: { + pixelsPerLabel: 30, + valueFormatter: Dygraph.numberValueFormatter, + axisLabelFormatter: Dygraph.numberAxisLabelFormatter, + drawGrid: true, + independentTicks: true, + ticker: null // will be set in dygraph-tickers.js + }, + y2: { + pixelsPerLabel: 30, + valueFormatter: Dygraph.numberValueFormatter, + axisLabelFormatter: Dygraph.numberAxisLabelFormatter, + drawGrid: false, + independentTicks: false, + ticker: null // will be set in dygraph-tickers.js + } + } +}; + +// Directions for panning and zooming. Use bit operations when combined +// values are possible. +Dygraph.HORIZONTAL = 1; +Dygraph.VERTICAL = 2; + +// Installed plugins, in order of precedence (most-general to most-specific). +// Plugins are installed after they are defined, in plugins/install.js. +Dygraph.PLUGINS = [ +]; + +// Used for initializing annotation CSS rules only once. +Dygraph.addedAnnotationCSS = false; + +Dygraph.prototype.__old_init__ = function(div, file, labels, attrs) { + // Labels is no longer a constructor parameter, since it's typically set + // directly from the data source. It also conains a name for the x-axis, + // which the previous constructor form did not. + if (labels !== null) { + var new_labels = ["Date"]; + for (var i = 0; i < labels.length; i++) new_labels.push(labels[i]); + Dygraph.update(attrs, { 'labels': new_labels }); + } + this.__init__(div, file, attrs); +}; + +/** + * Initializes the Dygraph. This creates a new DIV and constructs the PlotKit + * and context <canvas> inside of it. See the constructor for details. + * on the parameters. + * @param {Element} div the Element to render the graph into. + * @param {String | Function} file Source data + * @param {Object} attrs Miscellaneous other options + * @private + */ +Dygraph.prototype.__init__ = function(div, file, attrs) { + // Hack for IE: if we're using excanvas and the document hasn't finished + // loading yet (and hence may not have initialized whatever it needs to + // initialize), then keep calling this routine periodically until it has. + if (/MSIE/.test(navigator.userAgent) && !window.opera && + typeof(G_vmlCanvasManager) != 'undefined' && + document.readyState != 'complete') { + var self = this; + setTimeout(function() { self.__init__(div, file, attrs); }, 100); + return; + } + + // Support two-argument constructor + if (attrs === null || attrs === undefined) { attrs = {}; } + + attrs = Dygraph.mapLegacyOptions_(attrs); + + if (typeof(div) == 'string') { + div = document.getElementById(div); + } + + if (!div) { + Dygraph.error("Constructing dygraph with a non-existent div!"); + return; + } + + this.isUsingExcanvas_ = typeof(G_vmlCanvasManager) != 'undefined'; + + // Copy the important bits into the object + // TODO(danvk): most of these should just stay in the attrs_ dictionary. + this.maindiv_ = div; + this.file_ = file; + this.rollPeriod_ = attrs.rollPeriod || Dygraph.DEFAULT_ROLL_PERIOD; + this.previousVerticalX_ = -1; + this.fractions_ = attrs.fractions || false; + this.dateWindow_ = attrs.dateWindow || null; + + this.is_initial_draw_ = true; + this.annotations_ = []; + + // Zoomed indicators - These indicate when the graph has been zoomed and on what axis. + this.zoomed_x_ = false; + this.zoomed_y_ = false; + + // Clear the div. This ensure that, if multiple dygraphs are passed the same + // div, then only one will be drawn. + div.innerHTML = ""; + + // For historical reasons, the 'width' and 'height' options trump all CSS + // rules _except_ for an explicit 'width' or 'height' on the div. + // As an added convenience, if the div has zero height (like
          does + // without any styles), then we use a default height/width. + if (div.style.width === '' && attrs.width) { + div.style.width = attrs.width + "px"; + } + if (div.style.height === '' && attrs.height) { + div.style.height = attrs.height + "px"; + } + if (div.style.height === '' && div.clientHeight === 0) { + div.style.height = Dygraph.DEFAULT_HEIGHT + "px"; + if (div.style.width === '') { + div.style.width = Dygraph.DEFAULT_WIDTH + "px"; + } + } + // These will be zero if the dygraph's div is hidden. In that case, + // use the user-specified attributes if present. If not, use zero + // and assume the user will call resize to fix things later. + this.width_ = div.clientWidth || attrs.width || 0; + this.height_ = div.clientHeight || attrs.height || 0; + + // TODO(danvk): set fillGraph to be part of attrs_ here, not user_attrs_. + if (attrs.stackedGraph) { + attrs.fillGraph = true; + // TODO(nikhilk): Add any other stackedGraph checks here. + } + + // DEPRECATION WARNING: All option processing should be moved from + // attrs_ and user_attrs_ to options_, which holds all this information. + // + // Dygraphs has many options, some of which interact with one another. + // To keep track of everything, we maintain two sets of options: + // + // this.user_attrs_ only options explicitly set by the user. + // this.attrs_ defaults, options derived from user_attrs_, data. + // + // Options are then accessed this.attr_('attr'), which first looks at + // user_attrs_ and then computed attrs_. This way Dygraphs can set intelligent + // defaults without overriding behavior that the user specifically asks for. + this.user_attrs_ = {}; + Dygraph.update(this.user_attrs_, attrs); + + // This sequence ensures that Dygraph.DEFAULT_ATTRS is never modified. + this.attrs_ = {}; + Dygraph.updateDeep(this.attrs_, Dygraph.DEFAULT_ATTRS); + + this.boundaryIds_ = []; + this.setIndexByName_ = {}; + this.datasetIndex_ = []; + + this.registeredEvents_ = []; + this.eventListeners_ = {}; + + this.attributes_ = new DygraphOptions(this); + + // Create the containing DIV and other interactive elements + this.createInterface_(); + + // Activate plugins. + this.plugins_ = []; + var plugins = Dygraph.PLUGINS.concat(this.getOption('plugins')); + for (var i = 0; i < plugins.length; i++) { + var Plugin = plugins[i]; + var pluginInstance = new Plugin(); + var pluginDict = { + plugin: pluginInstance, + events: {}, + options: {}, + pluginOptions: {} + }; + + var handlers = pluginInstance.activate(this); + for (var eventName in handlers) { + // TODO(danvk): validate eventName. + pluginDict.events[eventName] = handlers[eventName]; + } + + this.plugins_.push(pluginDict); + } + + // At this point, plugins can no longer register event handlers. + // Construct a map from event -> ordered list of [callback, plugin]. + for (var i = 0; i < this.plugins_.length; i++) { + var plugin_dict = this.plugins_[i]; + for (var eventName in plugin_dict.events) { + if (!plugin_dict.events.hasOwnProperty(eventName)) continue; + var callback = plugin_dict.events[eventName]; + + var pair = [plugin_dict.plugin, callback]; + if (!(eventName in this.eventListeners_)) { + this.eventListeners_[eventName] = [pair]; + } else { + this.eventListeners_[eventName].push(pair); + } + } + } + + this.createDragInterface_(); + + this.start_(); +}; + +/** + * Triggers a cascade of events to the various plugins which are interested in them. + * Returns true if the "default behavior" should be performed, i.e. if none of + * the event listeners called event.preventDefault(). + * @private + */ +Dygraph.prototype.cascadeEvents_ = function(name, extra_props) { + if (!(name in this.eventListeners_)) return true; + + // QUESTION: can we use objects & prototypes to speed this up? + var e = { + dygraph: this, + cancelable: false, + defaultPrevented: false, + preventDefault: function() { + if (!e.cancelable) throw "Cannot call preventDefault on non-cancelable event."; + e.defaultPrevented = true; + }, + propagationStopped: false, + stopPropagation: function() { + e.propagationStopped = true; + } + }; + Dygraph.update(e, extra_props); + + var callback_plugin_pairs = this.eventListeners_[name]; + if (callback_plugin_pairs) { + for (var i = callback_plugin_pairs.length - 1; i >= 0; i--) { + var plugin = callback_plugin_pairs[i][0]; + var callback = callback_plugin_pairs[i][1]; + callback.call(plugin, e); + if (e.propagationStopped) break; + } + } + return e.defaultPrevented; +}; + +/** + * Returns the zoomed status of the chart for one or both axes. + * + * Axis is an optional parameter. Can be set to 'x' or 'y'. + * + * The zoomed status for an axis is set whenever a user zooms using the mouse + * or when the dateWindow or valueRange are updated (unless the + * isZoomedIgnoreProgrammaticZoom option is also specified). + */ +Dygraph.prototype.isZoomed = function(axis) { + if (axis === null || axis === undefined) { + return this.zoomed_x_ || this.zoomed_y_; + } + if (axis === 'x') return this.zoomed_x_; + if (axis === 'y') return this.zoomed_y_; + throw "axis parameter is [" + axis + "] must be null, 'x' or 'y'."; +}; + +/** + * Returns information about the Dygraph object, including its containing ID. + */ +Dygraph.prototype.toString = function() { + var maindiv = this.maindiv_; + var id = (maindiv && maindiv.id) ? maindiv.id : maindiv; + return "[Dygraph " + id + "]"; +}; + +/** + * @private + * Returns the value of an option. This may be set by the user (either in the + * constructor or by calling updateOptions) or by dygraphs, and may be set to a + * per-series value. + * @param { String } name The name of the option, e.g. 'rollPeriod'. + * @param { String } [seriesName] The name of the series to which the option + * will be applied. If no per-series value of this option is available, then + * the global value is returned. This is optional. + * @return { ... } The value of the option. + */ +Dygraph.prototype.attr_ = function(name, seriesName) { +// + if (typeof(Dygraph.OPTIONS_REFERENCE) === 'undefined') { + this.error('Must include options reference JS for testing'); + } else if (!Dygraph.OPTIONS_REFERENCE.hasOwnProperty(name)) { + this.error('Dygraphs is using property ' + name + ', which has no entry ' + + 'in the Dygraphs.OPTIONS_REFERENCE listing.'); + // Only log this error once. + Dygraph.OPTIONS_REFERENCE[name] = true; + } +// + return seriesName ? this.attributes_.getForSeries(name, seriesName) : this.attributes_.get(name); +}; + +/** + * Returns the current value for an option, as set in the constructor or via + * updateOptions. You may pass in an (optional) series name to get per-series + * values for the option. + * + * All values returned by this method should be considered immutable. If you + * modify them, there is no guarantee that the changes will be honored or that + * dygraphs will remain in a consistent state. If you want to modify an option, + * use updateOptions() instead. + * + * @param { String } name The name of the option (e.g. 'strokeWidth') + * @param { String } [opt_seriesName] Series name to get per-series values. + * @return { ... } The value of the option. + */ +Dygraph.prototype.getOption = function(name, opt_seriesName) { + return this.attr_(name, opt_seriesName); +}; + +Dygraph.prototype.getOptionForAxis = function(name, axis) { + return this.attributes_.getForAxis(name, axis); +}; + +/** + * @private + * @param String} axis The name of the axis (i.e. 'x', 'y' or 'y2') + * @return { ... } A function mapping string -> option value + */ +Dygraph.prototype.optionsViewForAxis_ = function(axis) { + var self = this; + return function(opt) { + var axis_opts = self.user_attrs_.axes; + if (axis_opts && axis_opts[axis] && axis_opts[axis].hasOwnProperty(opt)) { + return axis_opts[axis][opt]; + } + // user-specified attributes always trump defaults, even if they're less + // specific. + if (typeof(self.user_attrs_[opt]) != 'undefined') { + return self.user_attrs_[opt]; + } + + axis_opts = self.attrs_.axes; + if (axis_opts && axis_opts[axis] && axis_opts[axis].hasOwnProperty(opt)) { + return axis_opts[axis][opt]; + } + // check old-style axis options + // TODO(danvk): add a deprecation warning if either of these match. + if (axis == 'y' && self.axes_[0].hasOwnProperty(opt)) { + return self.axes_[0][opt]; + } else if (axis == 'y2' && self.axes_[1].hasOwnProperty(opt)) { + return self.axes_[1][opt]; + } + return self.attr_(opt); + }; +}; + +/** + * Returns the current rolling period, as set by the user or an option. + * @return {Number} The number of points in the rolling window + */ +Dygraph.prototype.rollPeriod = function() { + return this.rollPeriod_; +}; + +/** + * Returns the currently-visible x-range. This can be affected by zooming, + * panning or a call to updateOptions. + * Returns a two-element array: [left, right]. + * If the Dygraph has dates on the x-axis, these will be millis since epoch. + */ +Dygraph.prototype.xAxisRange = function() { + return this.dateWindow_ ? this.dateWindow_ : this.xAxisExtremes(); +}; + +/** + * Returns the lower- and upper-bound x-axis values of the + * data set. + */ +Dygraph.prototype.xAxisExtremes = function() { + var pad = this.attr_('xRangePad') / this.plotter_.area.w; + if (this.numRows() === 0) { + return [0 - pad, 1 + pad]; + } + var left = this.rawData_[0][0]; + var right = this.rawData_[this.rawData_.length - 1][0]; + if (pad) { + // Must keep this in sync with dygraph-layout _evaluateLimits() + var range = right - left; + left -= range * pad; + right += range * pad; + } + return [left, right]; +}; + +/** + * Returns the currently-visible y-range for an axis. This can be affected by + * zooming, panning or a call to updateOptions. Axis indices are zero-based. If + * called with no arguments, returns the range of the first axis. + * Returns a two-element array: [bottom, top]. + */ +Dygraph.prototype.yAxisRange = function(idx) { + if (typeof(idx) == "undefined") idx = 0; + if (idx < 0 || idx >= this.axes_.length) { + return null; + } + var axis = this.axes_[idx]; + return [ axis.computedValueRange[0], axis.computedValueRange[1] ]; +}; + +/** + * Returns the currently-visible y-ranges for each axis. This can be affected by + * zooming, panning, calls to updateOptions, etc. + * Returns an array of [bottom, top] pairs, one for each y-axis. + */ +Dygraph.prototype.yAxisRanges = function() { + var ret = []; + for (var i = 0; i < this.axes_.length; i++) { + ret.push(this.yAxisRange(i)); + } + return ret; +}; + +// TODO(danvk): use these functions throughout dygraphs. +/** + * Convert from data coordinates to canvas/div X/Y coordinates. + * If specified, do this conversion for the coordinate system of a particular + * axis. Uses the first axis by default. + * Returns a two-element array: [X, Y] + * + * Note: use toDomXCoord instead of toDomCoords(x, null) and use toDomYCoord + * instead of toDomCoords(null, y, axis). + */ +Dygraph.prototype.toDomCoords = function(x, y, axis) { + return [ this.toDomXCoord(x), this.toDomYCoord(y, axis) ]; +}; + +/** + * Convert from data x coordinates to canvas/div X coordinate. + * If specified, do this conversion for the coordinate system of a particular + * axis. + * Returns a single value or null if x is null. + */ +Dygraph.prototype.toDomXCoord = function(x) { + if (x === null) { + return null; + } + + var area = this.plotter_.area; + var xRange = this.xAxisRange(); + return area.x + (x - xRange[0]) / (xRange[1] - xRange[0]) * area.w; +}; + +/** + * Convert from data x coordinates to canvas/div Y coordinate and optional + * axis. Uses the first axis by default. + * + * returns a single value or null if y is null. + */ +Dygraph.prototype.toDomYCoord = function(y, axis) { + var pct = this.toPercentYCoord(y, axis); + + if (pct === null) { + return null; + } + var area = this.plotter_.area; + return area.y + pct * area.h; +}; + +/** + * Convert from canvas/div coords to data coordinates. + * If specified, do this conversion for the coordinate system of a particular + * axis. Uses the first axis by default. + * Returns a two-element array: [X, Y]. + * + * Note: use toDataXCoord instead of toDataCoords(x, null) and use toDataYCoord + * instead of toDataCoords(null, y, axis). + */ +Dygraph.prototype.toDataCoords = function(x, y, axis) { + return [ this.toDataXCoord(x), this.toDataYCoord(y, axis) ]; +}; + +/** + * Convert from canvas/div x coordinate to data coordinate. + * + * If x is null, this returns null. + */ +Dygraph.prototype.toDataXCoord = function(x) { + if (x === null) { + return null; + } + + var area = this.plotter_.area; + var xRange = this.xAxisRange(); + return xRange[0] + (x - area.x) / area.w * (xRange[1] - xRange[0]); +}; + +/** + * Convert from canvas/div y coord to value. + * + * If y is null, this returns null. + * if axis is null, this uses the first axis. + */ +Dygraph.prototype.toDataYCoord = function(y, axis) { + if (y === null) { + return null; + } + + var area = this.plotter_.area; + var yRange = this.yAxisRange(axis); + + if (typeof(axis) == "undefined") axis = 0; + if (!this.axes_[axis].logscale) { + return yRange[0] + (area.y + area.h - y) / area.h * (yRange[1] - yRange[0]); + } else { + // Computing the inverse of toDomCoord. + var pct = (y - area.y) / area.h; + + // Computing the inverse of toPercentYCoord. The function was arrived at with + // the following steps: + // + // Original calcuation: + // pct = (logr1 - Dygraph.log10(y)) / (logr1 - Dygraph.log10(yRange[0])); + // + // Move denominator to both sides: + // pct * (logr1 - Dygraph.log10(yRange[0])) = logr1 - Dygraph.log10(y); + // + // subtract logr1, and take the negative value. + // logr1 - (pct * (logr1 - Dygraph.log10(yRange[0]))) = Dygraph.log10(y); + // + // Swap both sides of the equation, and we can compute the log of the + // return value. Which means we just need to use that as the exponent in + // e^exponent. + // Dygraph.log10(y) = logr1 - (pct * (logr1 - Dygraph.log10(yRange[0]))); + + var logr1 = Dygraph.log10(yRange[1]); + var exponent = logr1 - (pct * (logr1 - Dygraph.log10(yRange[0]))); + var value = Math.pow(Dygraph.LOG_SCALE, exponent); + return value; + } +}; + +/** + * Converts a y for an axis to a percentage from the top to the + * bottom of the drawing area. + * + * If the coordinate represents a value visible on the canvas, then + * the value will be between 0 and 1, where 0 is the top of the canvas. + * However, this method will return values outside the range, as + * values can fall outside the canvas. + * + * If y is null, this returns null. + * if axis is null, this uses the first axis. + * + * @param { Number } y The data y-coordinate. + * @param { Number } [axis] The axis number on which the data coordinate lives. + * @return { Number } A fraction in [0, 1] where 0 = the top edge. + */ +Dygraph.prototype.toPercentYCoord = function(y, axis) { + if (y === null) { + return null; + } + if (typeof(axis) == "undefined") axis = 0; + + var yRange = this.yAxisRange(axis); + + var pct; + var logscale = this.attributes_.getForAxis("logscale", axis); + if (!logscale) { + // yRange[1] - y is unit distance from the bottom. + // yRange[1] - yRange[0] is the scale of the range. + // (yRange[1] - y) / (yRange[1] - yRange[0]) is the % from the bottom. + pct = (yRange[1] - y) / (yRange[1] - yRange[0]); + } else { + var logr1 = Dygraph.log10(yRange[1]); + pct = (logr1 - Dygraph.log10(y)) / (logr1 - Dygraph.log10(yRange[0])); + } + return pct; +}; + +/** + * Converts an x value to a percentage from the left to the right of + * the drawing area. + * + * If the coordinate represents a value visible on the canvas, then + * the value will be between 0 and 1, where 0 is the left of the canvas. + * However, this method will return values outside the range, as + * values can fall outside the canvas. + * + * If x is null, this returns null. + * @param { Number } x The data x-coordinate. + * @return { Number } A fraction in [0, 1] where 0 = the left edge. + */ +Dygraph.prototype.toPercentXCoord = function(x) { + if (x === null) { + return null; + } + + var xRange = this.xAxisRange(); + return (x - xRange[0]) / (xRange[1] - xRange[0]); +}; + +/** + * Returns the number of columns (including the independent variable). + * @return { Integer } The number of columns. + */ +Dygraph.prototype.numColumns = function() { + if (!this.rawData_) return 0; + return this.rawData_[0] ? this.rawData_[0].length : this.attr_("labels").length; +}; + +/** + * Returns the number of rows (excluding any header/label row). + * @return { Integer } The number of rows, less any header. + */ +Dygraph.prototype.numRows = function() { + if (!this.rawData_) return 0; + return this.rawData_.length; +}; + +/** + * Returns the value in the given row and column. If the row and column exceed + * the bounds on the data, returns null. Also returns null if the value is + * missing. + * @param { Number} row The row number of the data (0-based). Row 0 is the + * first row of data, not a header row. + * @param { Number} col The column number of the data (0-based) + * @return { Number } The value in the specified cell or null if the row/col + * were out of range. + */ +Dygraph.prototype.getValue = function(row, col) { + if (row < 0 || row > this.rawData_.length) return null; + if (col < 0 || col > this.rawData_[row].length) return null; + + return this.rawData_[row][col]; +}; + +/** + * Generates interface elements for the Dygraph: a containing div, a div to + * display the current point, and a textbox to adjust the rolling average + * period. Also creates the Renderer/Layout elements. + * @private + */ +Dygraph.prototype.createInterface_ = function() { + // Create the all-enclosing graph div + var enclosing = this.maindiv_; + + this.graphDiv = document.createElement("div"); + + // TODO(danvk): any other styles that are useful to set here? + this.graphDiv.style.textAlign = 'left'; // This is a CSS "reset" + enclosing.appendChild(this.graphDiv); + + // Create the canvas for interactive parts of the chart. + this.canvas_ = Dygraph.createCanvas(); + this.canvas_.style.position = "absolute"; + + // ... and for static parts of the chart. + this.hidden_ = this.createPlotKitCanvas_(this.canvas_); + + this.resizeElements_(); + + this.canvas_ctx_ = Dygraph.getContext(this.canvas_); + this.hidden_ctx_ = Dygraph.getContext(this.hidden_); + + // The interactive parts of the graph are drawn on top of the chart. + this.graphDiv.appendChild(this.hidden_); + this.graphDiv.appendChild(this.canvas_); + this.mouseEventElement_ = this.createMouseEventElement_(); + + // Create the grapher + this.layout_ = new DygraphLayout(this); + + var dygraph = this; + + this.mouseMoveHandler_ = function(e) { + dygraph.mouseMove_(e); + }; + + this.mouseOutHandler_ = function(e) { + // The mouse has left the chart if: + // 1. e.target is inside the chart + // 2. e.relatedTarget is outside the chart + var target = e.target || e.fromElement; + var relatedTarget = e.relatedTarget || e.toElement; + if (Dygraph.isNodeContainedBy(target, dygraph.graphDiv) && + !Dygraph.isNodeContainedBy(relatedTarget, dygraph.graphDiv)) { + dygraph.mouseOut_(e); + } + }; + + this.addAndTrackEvent(window, 'mouseout', this.mouseOutHandler_); + this.addAndTrackEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler_); + + // Don't recreate and register the resize handler on subsequent calls. + // This happens when the graph is resized. + if (!this.resizeHandler_) { + this.resizeHandler_ = function(e) { + dygraph.resize(); + }; + + // Update when the window is resized. + // TODO(danvk): drop frames depending on complexity of the chart. + this.addAndTrackEvent(window, 'resize', this.resizeHandler_); + } +}; + +Dygraph.prototype.resizeElements_ = function() { + this.graphDiv.style.width = this.width_ + "px"; + this.graphDiv.style.height = this.height_ + "px"; + this.canvas_.width = this.width_; + this.canvas_.height = this.height_; + this.canvas_.style.width = this.width_ + "px"; // for IE + this.canvas_.style.height = this.height_ + "px"; // for IE + this.hidden_.width = this.width_; + this.hidden_.height = this.height_; + this.hidden_.style.width = this.width_ + "px"; // for IE + this.hidden_.style.height = this.height_ + "px"; // for IE +}; + +/** + * Detach DOM elements in the dygraph and null out all data references. + * Calling this when you're done with a dygraph can dramatically reduce memory + * usage. See, e.g., the tests/perf.html example. + */ +Dygraph.prototype.destroy = function() { + this.canvas_ctx_.restore(); + this.hidden_ctx_.restore(); + + var removeRecursive = function(node) { + while (node.hasChildNodes()) { + removeRecursive(node.firstChild); + node.removeChild(node.firstChild); + } + }; + + this.removeTrackedEvents_(); + + // remove mouse event handlers (This may not be necessary anymore) + Dygraph.removeEvent(window, 'mouseout', this.mouseOutHandler_); + Dygraph.removeEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler_); + + // remove window handlers + Dygraph.removeEvent(window,'resize',this.resizeHandler_); + this.resizeHandler_ = null; + + removeRecursive(this.maindiv_); + + var nullOut = function(obj) { + for (var n in obj) { + if (typeof(obj[n]) === 'object') { + obj[n] = null; + } + } + }; + // These may not all be necessary, but it can't hurt... + nullOut(this.layout_); + nullOut(this.plotter_); + nullOut(this); +}; + +/** + * Creates the canvas on which the chart will be drawn. Only the Renderer ever + * draws on this particular canvas. All Dygraph work (i.e. drawing hover dots + * or the zoom rectangles) is done on this.canvas_. + * @param {Object} canvas The Dygraph canvas over which to overlay the plot + * @return {Object} The newly-created canvas + * @private + */ +Dygraph.prototype.createPlotKitCanvas_ = function(canvas) { + var h = Dygraph.createCanvas(); + h.style.position = "absolute"; + // TODO(danvk): h should be offset from canvas. canvas needs to include + // some extra area to make it easier to zoom in on the far left and far + // right. h needs to be precisely the plot area, so that clipping occurs. + h.style.top = canvas.style.top; + h.style.left = canvas.style.left; + h.width = this.width_; + h.height = this.height_; + h.style.width = this.width_ + "px"; // for IE + h.style.height = this.height_ + "px"; // for IE + return h; +}; + +/** + * Creates an overlay element used to handle mouse events. + * @return {Object} The mouse event element. + * @private + */ +Dygraph.prototype.createMouseEventElement_ = function() { + if (this.isUsingExcanvas_) { + var elem = document.createElement("div"); + elem.style.position = 'absolute'; + elem.style.backgroundColor = 'white'; + elem.style.filter = 'alpha(opacity=0)'; + elem.style.width = this.width_ + "px"; + elem.style.height = this.height_ + "px"; + this.graphDiv.appendChild(elem); + return elem; + } else { + return this.canvas_; + } +}; + +/** + * Generate a set of distinct colors for the data series. This is done with a + * color wheel. Saturation/Value are customizable, and the hue is + * equally-spaced around the color wheel. If a custom set of colors is + * specified, that is used instead. + * @private + */ +Dygraph.prototype.setColors_ = function() { + var labels = this.getLabels(); + var num = labels.length - 1; + this.colors_ = []; + this.colorsMap_ = {}; + var colors = this.attr_('colors'); + var i; + if (!colors) { + var sat = this.attr_('colorSaturation') || 1.0; + var val = this.attr_('colorValue') || 0.5; + var half = Math.ceil(num / 2); + for (i = 1; i <= num; i++) { + if (!this.visibility()[i-1]) continue; + // alternate colors for high contrast. + var idx = i % 2 ? Math.ceil(i / 2) : (half + i / 2); + var hue = (1.0 * idx/ (1 + num)); + var colorStr = Dygraph.hsvToRGB(hue, sat, val); + this.colors_.push(colorStr); + this.colorsMap_[labels[i]] = colorStr; + } + } else { + for (i = 0; i < num; i++) { + if (!this.visibility()[i]) continue; + var colorStr = colors[i % colors.length]; + this.colors_.push(colorStr); + this.colorsMap_[labels[1 + i]] = colorStr; + } + } +}; + +/** + * Return the list of colors. This is either the list of colors passed in the + * attributes or the autogenerated list of rgb(r,g,b) strings. + * This does not return colors for invisible series. + * @return {Array} The list of colors. + */ +Dygraph.prototype.getColors = function() { + return this.colors_; +}; + +/** + * Returns a few attributes of a series, i.e. its color, its visibility, which + * axis it's assigned to, and its column in the original data. + * Returns null if the series does not exist. + * Otherwise, returns an object with column, visibility, color and axis properties. + * The "axis" property will be set to 1 for y1 and 2 for y2. + * The "column" property can be fed back into getValue(row, column) to get + * values for this series. + */ +Dygraph.prototype.getPropertiesForSeries = function(series_name) { + var idx = -1; + var labels = this.getLabels(); + for (var i = 1; i < labels.length; i++) { + if (labels[i] == series_name) { + idx = i; + break; + } + } + if (idx == -1) return null; + + return { + name: series_name, + column: idx, + visible: this.visibility()[idx - 1], + color: this.colorsMap_[series_name], + axis: 1 + this.attributes_.axisForSeries(series_name) + }; +}; + +/** + * Create the text box to adjust the averaging period + * @private + */ +Dygraph.prototype.createRollInterface_ = function() { + // Create a roller if one doesn't exist already. + if (!this.roller_) { + this.roller_ = document.createElement("input"); + this.roller_.type = "text"; + this.roller_.style.display = "none"; + this.graphDiv.appendChild(this.roller_); + } + + var display = this.attr_('showRoller') ? 'block' : 'none'; + + var area = this.plotter_.area; + var textAttr = { "position": "absolute", + "zIndex": 10, + "top": (area.y + area.h - 25) + "px", + "left": (area.x + 1) + "px", + "display": display + }; + this.roller_.size = "2"; + this.roller_.value = this.rollPeriod_; + for (var name in textAttr) { + if (textAttr.hasOwnProperty(name)) { + this.roller_.style[name] = textAttr[name]; + } + } + + var dygraph = this; + this.roller_.onchange = function() { dygraph.adjustRoll(dygraph.roller_.value); }; +}; + +/** + * @private + * Converts page the x-coordinate of the event to pixel x-coordinates on the + * canvas (i.e. DOM Coords). + */ +Dygraph.prototype.dragGetX_ = function(e, context) { + return Dygraph.pageX(e) - context.px; +}; + +/** + * @private + * Converts page the y-coordinate of the event to pixel y-coordinates on the + * canvas (i.e. DOM Coords). + */ +Dygraph.prototype.dragGetY_ = function(e, context) { + return Dygraph.pageY(e) - context.py; +}; + +/** + * Set up all the mouse handlers needed to capture dragging behavior for zoom + * events. + * @private + */ +Dygraph.prototype.createDragInterface_ = function() { + var context = { + // Tracks whether the mouse is down right now + isZooming: false, + isPanning: false, // is this drag part of a pan? + is2DPan: false, // if so, is that pan 1- or 2-dimensional? + dragStartX: null, // pixel coordinates + dragStartY: null, // pixel coordinates + dragEndX: null, // pixel coordinates + dragEndY: null, // pixel coordinates + dragDirection: null, + prevEndX: null, // pixel coordinates + prevEndY: null, // pixel coordinates + prevDragDirection: null, + cancelNextDblclick: false, // see comment in dygraph-interaction-model.js + + // The value on the left side of the graph when a pan operation starts. + initialLeftmostDate: null, + + // The number of units each pixel spans. (This won't be valid for log + // scales) + xUnitsPerPixel: null, + + // TODO(danvk): update this comment + // The range in second/value units that the viewport encompasses during a + // panning operation. + dateRange: null, + + // Top-left corner of the canvas, in DOM coords + // TODO(konigsberg): Rename topLeftCanvasX, topLeftCanvasY. + px: 0, + py: 0, + + // Values for use with panEdgeFraction, which limit how far outside the + // graph's data boundaries it can be panned. + boundedDates: null, // [minDate, maxDate] + boundedValues: null, // [[minValue, maxValue] ...] + + // We cover iframes during mouse interactions. See comments in + // dygraph-utils.js for more info on why this is a good idea. + tarp: new Dygraph.IFrameTarp(), + + // contextB is the same thing as this context object but renamed. + initializeMouseDown: function(event, g, contextB) { + // prevents mouse drags from selecting page text. + if (event.preventDefault) { + event.preventDefault(); // Firefox, Chrome, etc. + } else { + event.returnValue = false; // IE + event.cancelBubble = true; + } + + contextB.px = Dygraph.findPosX(g.canvas_); + contextB.py = Dygraph.findPosY(g.canvas_); + contextB.dragStartX = g.dragGetX_(event, contextB); + contextB.dragStartY = g.dragGetY_(event, contextB); + contextB.cancelNextDblclick = false; + contextB.tarp.cover(); + } + }; + + var interactionModel = this.attr_("interactionModel"); + + // Self is the graph. + var self = this; + + // Function that binds the graph and context to the handler. + var bindHandler = function(handler) { + return function(event) { + handler(event, self, context); + }; + }; + + for (var eventName in interactionModel) { + if (!interactionModel.hasOwnProperty(eventName)) continue; + this.addAndTrackEvent(this.mouseEventElement_, eventName, + bindHandler(interactionModel[eventName])); + } + + // If the user releases the mouse button during a drag, but not over the + // canvas, then it doesn't count as a zooming action. + var mouseUpHandler = function(event) { + if (context.isZooming || context.isPanning) { + context.isZooming = false; + context.dragStartX = null; + context.dragStartY = null; + } + + if (context.isPanning) { + context.isPanning = false; + context.draggingDate = null; + context.dateRange = null; + for (var i = 0; i < self.axes_.length; i++) { + delete self.axes_[i].draggingValue; + delete self.axes_[i].dragValueRange; + } + } + + context.tarp.uncover(); + }; + + this.addAndTrackEvent(document, 'mouseup', mouseUpHandler); +}; + +/** + * Draw a gray zoom rectangle over the desired area of the canvas. Also clears + * up any previous zoom rectangles that were drawn. This could be optimized to + * avoid extra redrawing, but it's tricky to avoid interactions with the status + * dots. + * + * @param {Number} direction the direction of the zoom rectangle. Acceptable + * values are Dygraph.HORIZONTAL and Dygraph.VERTICAL. + * @param {Number} startX The X position where the drag started, in canvas + * coordinates. + * @param {Number} endX The current X position of the drag, in canvas coords. + * @param {Number} startY The Y position where the drag started, in canvas + * coordinates. + * @param {Number} endY The current Y position of the drag, in canvas coords. + * @param {Number} prevDirection the value of direction on the previous call to + * this function. Used to avoid excess redrawing + * @param {Number} prevEndX The value of endX on the previous call to this + * function. Used to avoid excess redrawing + * @param {Number} prevEndY The value of endY on the previous call to this + * function. Used to avoid excess redrawing + * @private + */ +Dygraph.prototype.drawZoomRect_ = function(direction, startX, endX, startY, + endY, prevDirection, prevEndX, + prevEndY) { + var ctx = this.canvas_ctx_; + + // Clean up from the previous rect if necessary + if (prevDirection == Dygraph.HORIZONTAL) { + ctx.clearRect(Math.min(startX, prevEndX), this.layout_.getPlotArea().y, + Math.abs(startX - prevEndX), this.layout_.getPlotArea().h); + } else if (prevDirection == Dygraph.VERTICAL) { + ctx.clearRect(this.layout_.getPlotArea().x, Math.min(startY, prevEndY), + this.layout_.getPlotArea().w, Math.abs(startY - prevEndY)); + } + + // Draw a light-grey rectangle to show the new viewing area + if (direction == Dygraph.HORIZONTAL) { + if (endX && startX) { + ctx.fillStyle = "rgba(128,128,128,0.33)"; + ctx.fillRect(Math.min(startX, endX), this.layout_.getPlotArea().y, + Math.abs(endX - startX), this.layout_.getPlotArea().h); + } + } else if (direction == Dygraph.VERTICAL) { + if (endY && startY) { + ctx.fillStyle = "rgba(128,128,128,0.33)"; + ctx.fillRect(this.layout_.getPlotArea().x, Math.min(startY, endY), + this.layout_.getPlotArea().w, Math.abs(endY - startY)); + } + } + + if (this.isUsingExcanvas_) { + this.currentZoomRectArgs_ = [direction, startX, endX, startY, endY, 0, 0, 0]; + } +}; + +/** + * Clear the zoom rectangle (and perform no zoom). + * @private + */ +Dygraph.prototype.clearZoomRect_ = function() { + this.currentZoomRectArgs_ = null; + this.canvas_ctx_.clearRect(0, 0, this.canvas_.width, this.canvas_.height); +}; + +/** + * Zoom to something containing [lowX, highX]. These are pixel coordinates in + * the canvas. The exact zoom window may be slightly larger if there are no data + * points near lowX or highX. Don't confuse this function with doZoomXDates, + * which accepts dates that match the raw data. This function redraws the graph. + * + * @param {Number} lowX The leftmost pixel value that should be visible. + * @param {Number} highX The rightmost pixel value that should be visible. + * @private + */ +Dygraph.prototype.doZoomX_ = function(lowX, highX) { + this.currentZoomRectArgs_ = null; + // Find the earliest and latest dates contained in this canvasx range. + // Convert the call to date ranges of the raw data. + var minDate = this.toDataXCoord(lowX); + var maxDate = this.toDataXCoord(highX); + this.doZoomXDates_(minDate, maxDate); +}; + +/** + * Transition function to use in animations. Returns values between 0.0 + * (totally old values) and 1.0 (totally new values) for each frame. + * @private + */ +Dygraph.zoomAnimationFunction = function(frame, numFrames) { + var k = 1.5; + return (1.0 - Math.pow(k, -frame)) / (1.0 - Math.pow(k, -numFrames)); +}; + +/** + * Zoom to something containing [minDate, maxDate] values. Don't confuse this + * method with doZoomX which accepts pixel coordinates. This function redraws + * the graph. + * + * @param {Number} minDate The minimum date that should be visible. + * @param {Number} maxDate The maximum date that should be visible. + * @private + */ +Dygraph.prototype.doZoomXDates_ = function(minDate, maxDate) { + // TODO(danvk): when yAxisRange is null (i.e. "fit to data", the animation + // can produce strange effects. Rather than the y-axis transitioning slowly + // between values, it can jerk around.) + var old_window = this.xAxisRange(); + var new_window = [minDate, maxDate]; + this.zoomed_x_ = true; + var that = this; + this.doAnimatedZoom(old_window, new_window, null, null, function() { + if (that.attr_("zoomCallback")) { + that.attr_("zoomCallback")(minDate, maxDate, that.yAxisRanges()); + } + }); +}; + +/** + * Zoom to something containing [lowY, highY]. These are pixel coordinates in + * the canvas. This function redraws the graph. + * + * @param {Number} lowY The topmost pixel value that should be visible. + * @param {Number} highY The lowest pixel value that should be visible. + * @private + */ +Dygraph.prototype.doZoomY_ = function(lowY, highY) { + this.currentZoomRectArgs_ = null; + // Find the highest and lowest values in pixel range for each axis. + // Note that lowY (in pixels) corresponds to the max Value (in data coords). + // This is because pixels increase as you go down on the screen, whereas data + // coordinates increase as you go up the screen. + var oldValueRanges = this.yAxisRanges(); + var newValueRanges = []; + for (var i = 0; i < this.axes_.length; i++) { + var hi = this.toDataYCoord(lowY, i); + var low = this.toDataYCoord(highY, i); + newValueRanges.push([low, hi]); + } + + this.zoomed_y_ = true; + var that = this; + this.doAnimatedZoom(null, null, oldValueRanges, newValueRanges, function() { + if (that.attr_("zoomCallback")) { + var xRange = that.xAxisRange(); + that.attr_("zoomCallback")(xRange[0], xRange[1], that.yAxisRanges()); + } + }); +}; + +/** + * Reset the zoom to the original view coordinates. This is the same as + * double-clicking on the graph. + */ +Dygraph.prototype.resetZoom = function() { + var dirty = false, dirtyX = false, dirtyY = false; + if (this.dateWindow_ !== null) { + dirty = true; + dirtyX = true; + } + + for (var i = 0; i < this.axes_.length; i++) { + if (typeof(this.axes_[i].valueWindow) !== 'undefined' && this.axes_[i].valueWindow !== null) { + dirty = true; + dirtyY = true; + } + } + + // Clear any selection, since it's likely to be drawn in the wrong place. + this.clearSelection(); + + if (dirty) { + this.zoomed_x_ = false; + this.zoomed_y_ = false; + + var minDate = this.rawData_[0][0]; + var maxDate = this.rawData_[this.rawData_.length - 1][0]; + + // With only one frame, don't bother calculating extreme ranges. + // TODO(danvk): merge this block w/ the code below. + if (!this.attr_("animatedZooms")) { + this.dateWindow_ = null; + for (i = 0; i < this.axes_.length; i++) { + if (this.axes_[i].valueWindow !== null) { + delete this.axes_[i].valueWindow; + } + } + this.drawGraph_(); + if (this.attr_("zoomCallback")) { + this.attr_("zoomCallback")(minDate, maxDate, this.yAxisRanges()); + } + return; + } + + var oldWindow=null, newWindow=null, oldValueRanges=null, newValueRanges=null; + if (dirtyX) { + oldWindow = this.xAxisRange(); + newWindow = [minDate, maxDate]; + } + + if (dirtyY) { + oldValueRanges = this.yAxisRanges(); + // TODO(danvk): this is pretty inefficient + var packed = this.gatherDatasets_(this.rolledSeries_, null); + var extremes = packed.extremes; + + // this has the side-effect of modifying this.axes_. + // this doesn't make much sense in this context, but it's convenient (we + // need this.axes_[*].extremeValues) and not harmful since we'll be + // calling drawGraph_ shortly, which clobbers these values. + this.computeYAxisRanges_(extremes); + + newValueRanges = []; + for (i = 0; i < this.axes_.length; i++) { + var axis = this.axes_[i]; + newValueRanges.push((axis.valueRange !== null && + axis.valueRange !== undefined) ? + axis.valueRange : axis.extremeRange); + } + } + + var that = this; + this.doAnimatedZoom(oldWindow, newWindow, oldValueRanges, newValueRanges, + function() { + that.dateWindow_ = null; + for (var i = 0; i < that.axes_.length; i++) { + if (that.axes_[i].valueWindow !== null) { + delete that.axes_[i].valueWindow; + } + } + if (that.attr_("zoomCallback")) { + that.attr_("zoomCallback")(minDate, maxDate, that.yAxisRanges()); + } + }); + } +}; + +/** + * Combined animation logic for all zoom functions. + * either the x parameters or y parameters may be null. + * @private + */ +Dygraph.prototype.doAnimatedZoom = function(oldXRange, newXRange, oldYRanges, newYRanges, callback) { + var steps = this.attr_("animatedZooms") ? Dygraph.ANIMATION_STEPS : 1; + + var windows = []; + var valueRanges = []; + var step, frac; + + if (oldXRange !== null && newXRange !== null) { + for (step = 1; step <= steps; step++) { + frac = Dygraph.zoomAnimationFunction(step, steps); + windows[step-1] = [oldXRange[0]*(1-frac) + frac*newXRange[0], + oldXRange[1]*(1-frac) + frac*newXRange[1]]; + } + } + + if (oldYRanges !== null && newYRanges !== null) { + for (step = 1; step <= steps; step++) { + frac = Dygraph.zoomAnimationFunction(step, steps); + var thisRange = []; + for (var j = 0; j < this.axes_.length; j++) { + thisRange.push([oldYRanges[j][0]*(1-frac) + frac*newYRanges[j][0], + oldYRanges[j][1]*(1-frac) + frac*newYRanges[j][1]]); + } + valueRanges[step-1] = thisRange; + } + } + + var that = this; + Dygraph.repeatAndCleanup(function(step) { + if (valueRanges.length) { + for (var i = 0; i < that.axes_.length; i++) { + var w = valueRanges[step][i]; + that.axes_[i].valueWindow = [w[0], w[1]]; + } + } + if (windows.length) { + that.dateWindow_ = windows[step]; + } + that.drawGraph_(); + }, steps, Dygraph.ANIMATION_DURATION / steps, callback); +}; + +/** + * Get the current graph's area object. + * + * Returns: {x, y, w, h} + */ +Dygraph.prototype.getArea = function() { + return this.plotter_.area; +}; + +/** + * Convert a mouse event to DOM coordinates relative to the graph origin. + * + * Returns a two-element array: [X, Y]. + */ +Dygraph.prototype.eventToDomCoords = function(event) { + if (event.offsetX && event.offsetY) { + return [ event.offsetX, event.offsetY ]; + } else { + var canvasx = Dygraph.pageX(event) - Dygraph.findPosX(this.mouseEventElement_); + var canvasy = Dygraph.pageY(event) - Dygraph.findPosY(this.mouseEventElement_); + return [canvasx, canvasy]; + } +}; + +/** + * Given a canvas X coordinate, find the closest row. + * @param {Number} domX graph-relative DOM X coordinate + * Returns: row number, integer + * @private + */ +Dygraph.prototype.findClosestRow = function(domX) { + var minDistX = Infinity; + var closestRow = -1; + var sets = this.layout_.points; + for (var i = 0; i < sets.length; i++) { + var points = sets[i]; + var len = points.length; + for (var j = 0; j < len; j++) { + var point = points[j]; + if (!Dygraph.isValidPoint(point, true)) continue; + var dist = Math.abs(point.canvasx - domX); + if (dist < minDistX) { + minDistX = dist; + closestRow = point.idx; + } + } + } + + return closestRow; +}; + +/** + * Given canvas X,Y coordinates, find the closest point. + * + * This finds the individual data point across all visible series + * that's closest to the supplied DOM coordinates using the standard + * Euclidean X,Y distance. + * + * @param {Number} domX graph-relative DOM X coordinate + * @param {Number} domY graph-relative DOM Y coordinate + * Returns: {row, seriesName, point} + * @private + */ +Dygraph.prototype.findClosestPoint = function(domX, domY) { + var minDist = Infinity; + var dist, dx, dy, point, closestPoint, closestSeries, closestRow; + for ( var setIdx = this.layout_.points.length - 1 ; setIdx >= 0 ; --setIdx ) { + var points = this.layout_.points[setIdx]; + for (var i = 0; i < points.length; ++i) { + point = points[i]; + if (!Dygraph.isValidPoint(point)) continue; + dx = point.canvasx - domX; + dy = point.canvasy - domY; + dist = dx * dx + dy * dy; + if (dist < minDist) { + minDist = dist; + closestPoint = point; + closestSeries = setIdx; + closestRow = point.idx; + } + } + } + var name = this.layout_.setNames[closestSeries]; + return { + row: closestRow, + seriesName: name, + point: closestPoint + }; +}; + +/** + * Given canvas X,Y coordinates, find the touched area in a stacked graph. + * + * This first finds the X data point closest to the supplied DOM X coordinate, + * then finds the series which puts the Y coordinate on top of its filled area, + * using linear interpolation between adjacent point pairs. + * + * @param {Number} domX graph-relative DOM X coordinate + * @param {Number} domY graph-relative DOM Y coordinate + * Returns: {row, seriesName, point} + * @private + */ +Dygraph.prototype.findStackedPoint = function(domX, domY) { + var row = this.findClosestRow(domX); + var closestPoint, closestSeries; + for (var setIdx = 0; setIdx < this.layout_.points.length; ++setIdx) { + var boundary = this.getLeftBoundary_(setIdx); + var rowIdx = row - boundary; + var points = this.layout_.points[setIdx]; + if (rowIdx >= points.length) continue; + var p1 = points[rowIdx]; + if (!Dygraph.isValidPoint(p1)) continue; + var py = p1.canvasy; + if (domX > p1.canvasx && rowIdx + 1 < points.length) { + // interpolate series Y value using next point + var p2 = points[rowIdx + 1]; + if (Dygraph.isValidPoint(p2)) { + var dx = p2.canvasx - p1.canvasx; + if (dx > 0) { + var r = (domX - p1.canvasx) / dx; + py += r * (p2.canvasy - p1.canvasy); + } + } + } else if (domX < p1.canvasx && rowIdx > 0) { + // interpolate series Y value using previous point + var p0 = points[rowIdx - 1]; + if (Dygraph.isValidPoint(p0)) { + var dx = p1.canvasx - p0.canvasx; + if (dx > 0) { + var r = (p1.canvasx - domX) / dx; + py += r * (p0.canvasy - p1.canvasy); + } + } + } + // Stop if the point (domX, py) is above this series' upper edge + if (setIdx === 0 || py < domY) { + closestPoint = p1; + closestSeries = setIdx; + } + } + var name = this.layout_.setNames[closestSeries]; + return { + row: row, + seriesName: name, + point: closestPoint + }; +}; + +/** + * When the mouse moves in the canvas, display information about a nearby data + * point and draw dots over those points in the data series. This function + * takes care of cleanup of previously-drawn dots. + * @param {Object} event The mousemove event from the browser. + * @private + */ +Dygraph.prototype.mouseMove_ = function(event) { + // This prevents JS errors when mousing over the canvas before data loads. + var points = this.layout_.points; + if (points === undefined || points === null) return; + + var canvasCoords = this.eventToDomCoords(event); + var canvasx = canvasCoords[0]; + var canvasy = canvasCoords[1]; + + var highlightSeriesOpts = this.attr_("highlightSeriesOpts"); + var selectionChanged = false; + if (highlightSeriesOpts && !this.isSeriesLocked()) { + var closest; + if (this.attr_("stackedGraph")) { + closest = this.findStackedPoint(canvasx, canvasy); + } else { + closest = this.findClosestPoint(canvasx, canvasy); + } + selectionChanged = this.setSelection(closest.row, closest.seriesName); + } else { + var idx = this.findClosestRow(canvasx); + selectionChanged = this.setSelection(idx); + } + + var callback = this.attr_("highlightCallback"); + if (callback && selectionChanged) { + callback(event, + this.lastx_, + this.selPoints_, + this.lastRow_, + this.highlightSet_); + } +}; + +/** + * Fetch left offset from the specified set index or if not passed, the + * first defined boundaryIds record (see bug #236). + * @private + */ +Dygraph.prototype.getLeftBoundary_ = function(setIdx) { + if (this.boundaryIds_[setIdx]) { + return this.boundaryIds_[setIdx][0]; + } else { + for (var i = 0; i < this.boundaryIds_.length; i++) { + if (this.boundaryIds_[i] !== undefined) { + return this.boundaryIds_[i][0]; + } + } + return 0; + } +}; + +Dygraph.prototype.animateSelection_ = function(direction) { + var totalSteps = 10; + var millis = 30; + if (this.fadeLevel === undefined) this.fadeLevel = 0; + if (this.animateId === undefined) this.animateId = 0; + var start = this.fadeLevel; + var steps = direction < 0 ? start : totalSteps - start; + if (steps <= 0) { + if (this.fadeLevel) { + this.updateSelection_(1.0); + } + return; + } + + var thisId = ++this.animateId; + var that = this; + Dygraph.repeatAndCleanup( + function(n) { + // ignore simultaneous animations + if (that.animateId != thisId) return; + + that.fadeLevel += direction; + if (that.fadeLevel === 0) { + that.clearSelection(); + } else { + that.updateSelection_(that.fadeLevel / totalSteps); + } + }, + steps, millis, function() {}); +}; + +/** + * Draw dots over the selectied points in the data series. This function + * takes care of cleanup of previously-drawn dots. + * @private + */ +Dygraph.prototype.updateSelection_ = function(opt_animFraction) { + /*var defaultPrevented = */ + this.cascadeEvents_('select', { + selectedX: this.lastx_, + selectedPoints: this.selPoints_ + }); + // TODO(danvk): use defaultPrevented here? + + // Clear the previously drawn vertical, if there is one + var i; + var ctx = this.canvas_ctx_; + if (this.attr_('highlightSeriesOpts')) { + ctx.clearRect(0, 0, this.width_, this.height_); + var alpha = 1.0 - this.attr_('highlightSeriesBackgroundAlpha'); + if (alpha) { + // Activating background fade includes an animation effect for a gradual + // fade. TODO(klausw): make this independently configurable if it causes + // issues? Use a shared preference to control animations? + var animateBackgroundFade = true; + if (animateBackgroundFade) { + if (opt_animFraction === undefined) { + // start a new animation + this.animateSelection_(1); + return; + } + alpha *= opt_animFraction; + } + ctx.fillStyle = 'rgba(255,255,255,' + alpha + ')'; + ctx.fillRect(0, 0, this.width_, this.height_); + } + + // Redraw only the highlighted series in the interactive canvas (not the + // static plot canvas, which is where series are usually drawn). + this.plotter_._renderLineChart(this.highlightSet_, ctx); + } else if (this.previousVerticalX_ >= 0) { + // Determine the maximum highlight circle size. + var maxCircleSize = 0; + var labels = this.attr_('labels'); + for (i = 1; i < labels.length; i++) { + var r = this.attr_('highlightCircleSize', labels[i]); + if (r > maxCircleSize) maxCircleSize = r; + } + var px = this.previousVerticalX_; + ctx.clearRect(px - maxCircleSize - 1, 0, + 2 * maxCircleSize + 2, this.height_); + } + + if (this.isUsingExcanvas_ && this.currentZoomRectArgs_) { + Dygraph.prototype.drawZoomRect_.apply(this, this.currentZoomRectArgs_); + } + + if (this.selPoints_.length > 0) { + // Draw colored circles over the center of each selected point + var canvasx = this.selPoints_[0].canvasx; + ctx.save(); + for (i = 0; i < this.selPoints_.length; i++) { + var pt = this.selPoints_[i]; + if (!Dygraph.isOK(pt.canvasy)) continue; + + var circleSize = this.attr_('highlightCircleSize', pt.name); + var callback = this.attr_("drawHighlightPointCallback", pt.name); + var color = this.plotter_.colors[pt.name]; + if (!callback) { + callback = Dygraph.Circles.DEFAULT; + } + ctx.lineWidth = this.attr_('strokeWidth', pt.name); + ctx.strokeStyle = color; + ctx.fillStyle = color; + callback(this.g, pt.name, ctx, canvasx, pt.canvasy, + color, circleSize, pt.idx); + } + ctx.restore(); + + this.previousVerticalX_ = canvasx; + } +}; + +/** + * Manually set the selected points and display information about them in the + * legend. The selection can be cleared using clearSelection() and queried + * using getSelection(). + * @param { Integer } row number that should be highlighted (i.e. appear with + * hover dots on the chart). Set to false to clear any selection. + * @param { seriesName } optional series name to highlight that series with the + * the highlightSeriesOpts setting. + * @param { locked } optional If true, keep seriesName selected when mousing + * over the graph, disabling closest-series highlighting. Call clearSelection() + * to unlock it. + */ +Dygraph.prototype.setSelection = function(row, opt_seriesName, opt_locked) { + // Extract the points we've selected + this.selPoints_ = []; + + var changed = false; + if (row !== false && row >= 0) { + if (row != this.lastRow_) changed = true; + this.lastRow_ = row; + for (var setIdx = 0; setIdx < this.layout_.points.length; ++setIdx) { + var points = this.layout_.points[setIdx]; + var setRow = row - this.getLeftBoundary_(setIdx); + if (setRow < points.length) { + var point = points[setRow]; + if (point.yval !== null) this.selPoints_.push(point); + } + } + } else { + if (this.lastRow_ >= 0) changed = true; + this.lastRow_ = -1; + } + + if (this.selPoints_.length) { + this.lastx_ = this.selPoints_[0].xval; + } else { + this.lastx_ = -1; + } + + if (opt_seriesName !== undefined) { + if (this.highlightSet_ !== opt_seriesName) changed = true; + this.highlightSet_ = opt_seriesName; + } + + if (opt_locked !== undefined) { + this.lockedSet_ = opt_locked; + } + + if (changed) { + this.updateSelection_(undefined); + } + return changed; +}; + +/** + * The mouse has left the canvas. Clear out whatever artifacts remain + * @param {Object} event the mouseout event from the browser. + * @private + */ +Dygraph.prototype.mouseOut_ = function(event) { + if (this.attr_("unhighlightCallback")) { + this.attr_("unhighlightCallback")(event); + } + + if (this.attr_("hideOverlayOnMouseOut") && !this.lockedSet_) { + this.clearSelection(); + } +}; + +/** + * Clears the current selection (i.e. points that were highlighted by moving + * the mouse over the chart). + */ +Dygraph.prototype.clearSelection = function() { + this.cascadeEvents_('deselect', {}); + + this.lockedSet_ = false; + // Get rid of the overlay data + if (this.fadeLevel) { + this.animateSelection_(-1); + return; + } + this.canvas_ctx_.clearRect(0, 0, this.width_, this.height_); + this.fadeLevel = 0; + this.selPoints_ = []; + this.lastx_ = -1; + this.lastRow_ = -1; + this.highlightSet_ = null; +}; + +/** + * Returns the number of the currently selected row. To get data for this row, + * you can use the getValue method. + * @return { Integer } row number, or -1 if nothing is selected + */ +Dygraph.prototype.getSelection = function() { + if (!this.selPoints_ || this.selPoints_.length < 1) { + return -1; + } + + for (var setIdx = 0; setIdx < this.layout_.points.length; setIdx++) { + var points = this.layout_.points[setIdx]; + for (var row = 0; row < points.length; row++) { + if (points[row].x == this.selPoints_[0].x) { + return points[row].idx; + } + } + } + return -1; +}; + +/** + * Returns the name of the currently-highlighted series. + * Only available when the highlightSeriesOpts option is in use. + */ +Dygraph.prototype.getHighlightSeries = function() { + return this.highlightSet_; +}; + +/** + * Returns true if the currently-highlighted series was locked + * via setSelection(..., seriesName, true). + */ +Dygraph.prototype.isSeriesLocked = function() { + return this.lockedSet_; +}; + +/** + * Fires when there's data available to be graphed. + * @param {String} data Raw CSV data to be plotted + * @private + */ +Dygraph.prototype.loadedEvent_ = function(data) { + this.rawData_ = this.parseCSV_(data); + this.predraw_(); +}; + +/** + * Add ticks on the x-axis representing years, months, quarters, weeks, or days + * @private + */ +Dygraph.prototype.addXTicks_ = function() { + // Determine the correct ticks scale on the x-axis: quarterly, monthly, ... + var range; + if (this.dateWindow_) { + range = [this.dateWindow_[0], this.dateWindow_[1]]; + } else { + range = this.xAxisExtremes(); + } + + var xAxisOptionsView = this.optionsViewForAxis_('x'); + var xTicks = xAxisOptionsView('ticker')( + range[0], + range[1], + this.width_, // TODO(danvk): should be area.width + xAxisOptionsView, + this); + // var msg = 'ticker(' + range[0] + ', ' + range[1] + ', ' + this.width_ + ', ' + this.attr_('pixelsPerXLabel') + ') -> ' + JSON.stringify(xTicks); + // console.log(msg); + this.layout_.setXTicks(xTicks); +}; + +/** + * @private + * Computes the range of the data series (including confidence intervals). + * @param { [Array] } series either [ [x1, y1], [x2, y2], ... ] or + * [ [x1, [y1, dev_low, dev_high]], [x2, [y2, dev_low, dev_high]], ... + * @return [low, high] + */ +Dygraph.prototype.extremeValues_ = function(series) { + var minY = null, maxY = null, j, y; + + var bars = this.attr_("errorBars") || this.attr_("customBars"); + if (bars) { + // With custom bars, maxY is the max of the high values. + for (j = 0; j < series.length; j++) { + y = series[j][1][0]; + if (y === null || isNaN(y)) continue; + var low = y - series[j][1][1]; + var high = y + series[j][1][2]; + if (low > y) low = y; // this can happen with custom bars, + if (high < y) high = y; // e.g. in tests/custom-bars.html + if (maxY === null || high > maxY) { + maxY = high; + } + if (minY === null || low < minY) { + minY = low; + } + } + } else { + for (j = 0; j < series.length; j++) { + y = series[j][1]; + if (y === null || isNaN(y)) continue; + if (maxY === null || y > maxY) { + maxY = y; + } + if (minY === null || y < minY) { + minY = y; + } + } + } + + return [minY, maxY]; +}; + +/** + * @private + * This function is called once when the chart's data is changed or the options + * dictionary is updated. It is _not_ called when the user pans or zooms. The + * idea is that values derived from the chart's data can be computed here, + * rather than every time the chart is drawn. This includes things like the + * number of axes, rolling averages, etc. + */ +Dygraph.prototype.predraw_ = function() { + var start = new Date(); + + this.layout_.computePlotArea(); + + // TODO(danvk): move more computations out of drawGraph_ and into here. + this.computeYAxes_(); + + // Create a new plotter. + if (this.plotter_) { + this.cascadeEvents_('clearChart'); + this.plotter_.clear(); + } + + if (!this.is_initial_draw_) { + this.canvas_ctx_.restore(); + this.hidden_ctx_.restore(); + } + + this.canvas_ctx_.save(); + this.hidden_ctx_.save(); + + this.plotter_ = new DygraphCanvasRenderer(this, + this.hidden_, + this.hidden_ctx_, + this.layout_); + + // The roller sits in the bottom left corner of the chart. We don't know where + // this will be until the options are available, so it's positioned here. + this.createRollInterface_(); + + this.cascadeEvents_('predraw'); + + // Convert the raw data (a 2D array) into the internal format and compute + // rolling averages. + this.rolledSeries_ = [null]; // x-axis is the first series and it's special + for (var i = 1; i < this.numColumns(); i++) { + // var logScale = this.attr_('logscale', i); // TODO(klausw): this looks wrong // konigsberg thinks so too. + var logScale = this.attr_('logscale'); + var series = this.extractSeries_(this.rawData_, i, logScale); + series = this.rollingAverage(series, this.rollPeriod_); + this.rolledSeries_.push(series); + } + + // If the data or options have changed, then we'd better redraw. + this.drawGraph_(); + + // This is used to determine whether to do various animations. + var end = new Date(); + this.drawingTimeMs_ = (end - start); +}; + +/** + * Point structure. + * + * xval_* and yval_* are the original unscaled data values, + * while x_* and y_* are scaled to the range (0.0-1.0) for plotting. + * yval_stacked is the cumulative Y value used for stacking graphs, + * and bottom/top/minus/plus are used for error bar graphs. + * + * @typedef {{ + * idx: number, + * name: string, + * x: ?number, + * xval: ?number, + * y_bottom: ?number, + * y: ?number, + * y_stacked: ?number, + * y_top: ?number, + * yval_minus: ?number, + * yval: ?number, + * yval_plus: ?number, + * yval_stacked + * }} + */ +Dygraph.PointType = undefined; + +// TODO(bhs): these loops are a hot-spot for high-point-count charts. In fact, +// on chrome+linux, they are 6 times more expensive than iterating through the +// points and drawing the lines. The brunt of the cost comes from allocating +// the |point| structures. +/** + * Converts a series to a Point array. + * + * @param {Array.)>} series Array where + * series[row] = [x,y] or [x, [y, err]] or [x, [y, yplus, yminus]]. + * @param {boolean} bars True if error bars or custom bars are being drawn. + * @param {string} setName Name of the series. + * @param {number} boundaryIdStart Index offset of the first point, equal to + * the number of skipped points left of the date window minimum (if any). + * @return {Array.} List of points for this series. + */ +Dygraph.seriesToPoints_ = function(series, bars, setName, boundaryIdStart) { + var points = []; + for (var i = 0; i < series.length; ++i) { + var item = series[i]; + var yraw = bars ? item[1][0] : item[1]; + var yval = yraw === null ? null : DygraphLayout.parseFloat_(yraw); + var point = { + x: NaN, + y: NaN, + xval: DygraphLayout.parseFloat_(item[0]), + yval: yval, + name: setName, // TODO(danvk): is this really necessary? + idx: i + boundaryIdStart + }; + + if (bars) { + point.y_top = NaN; + point.y_bottom = NaN; + point.yval_minus = DygraphLayout.parseFloat_(item[1][1]); + point.yval_plus = DygraphLayout.parseFloat_(item[1][2]); + } + points.push(point); + } + return points; +}; + + +/** + * Calculates point stacking for stackedGraph=true. + * + * For stacking purposes, interpolate or extend neighboring data across + * NaN values based on stackedGraphNaNFill settings. This is for display + * only, the underlying data value as shown in the legend remains NaN. + * + * @param {Array.} points Point array for a single series. + * Updates each Point's yval_stacked property. + * @param {Array.} cumulativeYval Accumulated top-of-graph stacked Y + * values for the series seen so far. Index is the row number. Updated + * based on the current series's values. + * @param {Array.} seriesExtremes Min and max values, updated + * to reflect the stacked values. + * @param {string} fillMethod Interpolation method, one of 'all', 'inside', or + * 'none'. + */ +Dygraph.stackPoints_ = function( + points, cumulativeYval, seriesExtremes, fillMethod) { + var lastXval = null; + var prevPoint = null; + var nextPoint = null; + var nextPointIdx = -1; + + // Find the next stackable point starting from the given index. + var updateNextPoint = function(idx) { + // If we've previously found a non-NaN point and haven't gone past it yet, + // just use that. + if (nextPointIdx >= idx) return; + + // We haven't found a non-NaN point yet or have moved past it, + // look towards the right to find a non-NaN point. + for (var j = idx; j < points.length; ++j) { + // Clear out a previously-found point (if any) since it's no longer + // valid, we shouldn't use it for interpolation anymore. + nextPoint = null; + if (!isNaN(points[j].yval) && points[j].yval !== null) { + nextPointIdx = j; + nextPoint = points[j]; + break; + } + } + }; + + for (var i = 0; i < points.length; ++i) { + var point = points[i]; + var xval = point.xval; + if (cumulativeYval[xval] === undefined) { + cumulativeYval[xval] = 0; + } + + var actualYval = point.yval; + if (isNaN(actualYval) || actualYval === null) { + // Interpolate/extend for stacking purposes if possible. + updateNextPoint(i); + if (prevPoint && nextPoint && fillMethod != 'none') { + // Use linear interpolation between prevPoint and nextPoint. + actualYval = prevPoint.yval + (nextPoint.yval - prevPoint.yval) * + ((xval - prevPoint.xval) / (nextPoint.xval - prevPoint.xval)); + } else if (prevPoint && fillMethod == 'all') { + actualYval = prevPoint.yval; + } else if (nextPoint && fillMethod == 'all') { + actualYval = nextPoint.yval; + } else { + actualYval = 0; + } + } else { + prevPoint = point; + } + + var stackedYval = cumulativeYval[xval]; + if (lastXval != xval) { + // If an x-value is repeated, we ignore the duplicates. + stackedYval += actualYval; + cumulativeYval[xval] = stackedYval; + } + lastXval = xval; + + point.yval_stacked = stackedYval; + + if (stackedYval > seriesExtremes[1]) { + seriesExtremes[1] = stackedYval; + } + if (stackedYval < seriesExtremes[0]) { + seriesExtremes[0] = stackedYval; + } + } +}; + + +/** + * Loop over all fields and create datasets, calculating extreme y-values for + * each series and extreme x-indices as we go. + * + * dateWindow is passed in as an explicit parameter so that we can compute + * extreme values "speculatively", i.e. without actually setting state on the + * dygraph. + * + * @param {Array.)>>} rolledSeries, where + * rolledSeries[seriesIndex][row] = raw point, where + * seriesIndex is the column number starting with 1, and + * rawPoint is [x,y] or [x, [y, err]] or [x, [y, yminus, yplus]]. + * @param {?Array.} dateWindow [xmin, xmax] pair, or null. + * @return {{ + * points: Array.>, + * seriesExtremes: Array.>, + * boundaryIds: Array.}} + * @private + */ +Dygraph.prototype.gatherDatasets_ = function(rolledSeries, dateWindow) { + var boundaryIds = []; + var points = []; + var cumulativeYval = []; // For stacked series. + var extremes = {}; // series name -> [low, high] + var i, k; + var errorBars = this.attr_("errorBars"); + var customBars = this.attr_("customBars"); + var bars = errorBars || customBars; + var isValueNull = function(sample) { + if (!bars) { + return sample[1] === null; + } else { + return customBars ? sample[1][1] === null : + errorBars ? sample[1][0] === null : false; + } + }; + + // Loop over the fields (series). Go from the last to the first, + // because if they're stacked that's how we accumulate the values. + var num_series = rolledSeries.length - 1; + var series; + for (i = num_series; i >= 1; i--) { + if (!this.visibility()[i - 1]) continue; + + // Prune down to the desired range, if necessary (for zooming) + // Because there can be lines going to points outside of the visible area, + // we actually prune to visible points, plus one on either side. + if (dateWindow) { + series = rolledSeries[i]; + var low = dateWindow[0]; + var high = dateWindow[1]; + + // TODO(danvk): do binary search instead of linear search. + // TODO(danvk): pass firstIdx and lastIdx directly to the renderer. + var firstIdx = null, lastIdx = null; + for (k = 0; k < series.length; k++) { + if (series[k][0] >= low && firstIdx === null) { + firstIdx = k; + } + if (series[k][0] <= high) { + lastIdx = k; + } + } + + if (firstIdx === null) firstIdx = 0; + var correctedFirstIdx = firstIdx; + var isInvalidValue = true; + while (isInvalidValue && correctedFirstIdx > 0) { + correctedFirstIdx--; + isInvalidValue = isValueNull(series[correctedFirstIdx]); + } + + if (lastIdx === null) lastIdx = series.length - 1; + var correctedLastIdx = lastIdx; + isInvalidValue = true; + while (isInvalidValue && correctedLastIdx < series.length - 1) { + correctedLastIdx++; + isInvalidValue = isValueNull(series[correctedLastIdx]); + } + + + if (correctedFirstIdx!==firstIdx) { + firstIdx = correctedFirstIdx; + } + if (correctedLastIdx !== lastIdx) { + lastIdx = correctedLastIdx; + } + + boundaryIds[i-1] = [firstIdx, lastIdx]; + + // .slice's end is exclusive, we want to include lastIdx. + series = series.slice(firstIdx, lastIdx + 1); + } else { + series = rolledSeries[i]; + boundaryIds[i-1] = [0, series.length-1]; + } + + var seriesName = this.attr_("labels")[i]; + var seriesExtremes = this.extremeValues_(series); + + var seriesPoints = Dygraph.seriesToPoints_( + series, bars, seriesName, boundaryIds[i-1][0]); + + if (this.attr_("stackedGraph")) { + Dygraph.stackPoints_(seriesPoints, cumulativeYval, seriesExtremes, + this.attr_("stackedGraphNaNFill")); + } + + extremes[seriesName] = seriesExtremes; + points[i] = seriesPoints; + } + + return { points: points, extremes: extremes, boundaryIds: boundaryIds }; +}; + +/** + * Update the graph with new data. This method is called when the viewing area + * has changed. If the underlying data or options have changed, predraw_ will + * be called before drawGraph_ is called. + * + * @private + */ +Dygraph.prototype.drawGraph_ = function() { + var start = new Date(); + + // This is used to set the second parameter to drawCallback, below. + var is_initial_draw = this.is_initial_draw_; + this.is_initial_draw_ = false; + + this.layout_.removeAllDatasets(); + this.setColors_(); + this.attrs_.pointSize = 0.5 * this.attr_('highlightCircleSize'); + + var packed = this.gatherDatasets_(this.rolledSeries_, this.dateWindow_); + var points = packed.points; + var extremes = packed.extremes; + this.boundaryIds_ = packed.boundaryIds; + + this.setIndexByName_ = {}; + var labels = this.attr_("labels"); + if (labels.length > 0) { + this.setIndexByName_[labels[0]] = 0; + } + var dataIdx = 0; + for (var i = 1; i < points.length; i++) { + this.setIndexByName_[labels[i]] = i; + if (!this.visibility()[i - 1]) continue; + this.layout_.addDataset(labels[i], points[i]); + this.datasetIndex_[i] = dataIdx++; + } + + this.computeYAxisRanges_(extremes); + this.layout_.setYAxes(this.axes_); + + this.addXTicks_(); + + // Save the X axis zoomed status as the updateOptions call will tend to set it erroneously + var tmp_zoomed_x = this.zoomed_x_; + // Tell PlotKit to use this new data and render itself + this.zoomed_x_ = tmp_zoomed_x; + this.layout_.evaluate(); + this.renderGraph_(is_initial_draw); + + if (this.attr_("timingName")) { + var end = new Date(); + Dygraph.info(this.attr_("timingName") + " - drawGraph: " + (end - start) + "ms"); + } +}; + +/** + * This does the work of drawing the chart. It assumes that the layout and axis + * scales have already been set (e.g. by predraw_). + * + * @private + */ +Dygraph.prototype.renderGraph_ = function(is_initial_draw) { + this.cascadeEvents_('clearChart'); + this.plotter_.clear(); + + if (this.attr_('underlayCallback')) { + // NOTE: we pass the dygraph object to this callback twice to avoid breaking + // users who expect a deprecated form of this callback. + this.attr_('underlayCallback')( + this.hidden_ctx_, this.layout_.getPlotArea(), this, this); + } + + var e = { + canvas: this.hidden_, + drawingContext: this.hidden_ctx_ + }; + this.cascadeEvents_('willDrawChart', e); + this.plotter_.render(); + this.cascadeEvents_('didDrawChart', e); + this.lastRow_ = -1; // because plugins/legend.js clears the legend + + // TODO(danvk): is this a performance bottleneck when panning? + // The interaction canvas should already be empty in that situation. + this.canvas_.getContext('2d').clearRect(0, 0, this.canvas_.width, + this.canvas_.height); + + if (this.attr_("drawCallback") !== null) { + this.attr_("drawCallback")(this, is_initial_draw); + } +}; + +/** + * @private + * Determine properties of the y-axes which are independent of the data + * currently being displayed. This includes things like the number of axes and + * the style of the axes. It does not include the range of each axis and its + * tick marks. + * This fills in this.axes_. + * axes_ = [ { options } ] + * indices are into the axes_ array. + */ +Dygraph.prototype.computeYAxes_ = function() { + // Preserve valueWindow settings if they exist, and if the user hasn't + // specified a new valueRange. + var valueWindows, axis, index, opts, v; + if (this.axes_ !== undefined && this.user_attrs_.hasOwnProperty("valueRange") === false) { + valueWindows = []; + for (index = 0; index < this.axes_.length; index++) { + valueWindows.push(this.axes_[index].valueWindow); + } + } + + // this.axes_ doesn't match this.attributes_.axes_.options. It's used for + // data computation as well as options storage. + // Go through once and add all the axes. + this.axes_ = []; + + for (axis = 0; axis < this.attributes_.numAxes(); axis++) { + // Add a new axis, making a copy of its per-axis options. + opts = { g : this }; + Dygraph.update(opts, this.attributes_.axisOptions(axis)); + this.axes_[axis] = opts; + } + + + // Copy global valueRange option over to the first axis. + // NOTE(konigsberg): Are these two statements necessary? + // I tried removing it. The automated tests pass, and manually + // messing with tests/zoom.html showed no trouble. + v = this.attr_('valueRange'); + if (v) this.axes_[0].valueRange = v; + + if (valueWindows !== undefined) { + // Restore valueWindow settings. + + // When going from two axes back to one, we only restore + // one axis. + var idxCount = Math.min(valueWindows.length, this.axes_.length); + + for (index = 0; index < idxCount; index++) { + this.axes_[index].valueWindow = valueWindows[index]; + } + } + + for (axis = 0; axis < this.axes_.length; axis++) { + if (axis === 0) { + opts = this.optionsViewForAxis_('y' + (axis ? '2' : '')); + v = opts("valueRange"); + if (v) this.axes_[axis].valueRange = v; + } else { // To keep old behavior + var axes = this.user_attrs_.axes; + if (axes && axes.y2) { + v = axes.y2.valueRange; + if (v) this.axes_[axis].valueRange = v; + } + } + } +}; + +/** + * Returns the number of y-axes on the chart. + * @return {Number} the number of axes. + */ +Dygraph.prototype.numAxes = function() { + return this.attributes_.numAxes(); +}; + +/** + * @private + * Returns axis properties for the given series. + * @param { String } setName The name of the series for which to get axis + * properties, e.g. 'Y1'. + * @return { Object } The axis properties. + */ +Dygraph.prototype.axisPropertiesForSeries = function(series) { + // TODO(danvk): handle errors. + return this.axes_[this.attributes_.axisForSeries(series)]; +}; + +/** + * @private + * Determine the value range and tick marks for each axis. + * @param {Object} extremes A mapping from seriesName -> [low, high] + * This fills in the valueRange and ticks fields in each entry of this.axes_. + */ +Dygraph.prototype.computeYAxisRanges_ = function(extremes) { + var isNullUndefinedOrNaN = function(num) { + return isNaN(parseFloat(num)); + }; + var numAxes = this.attributes_.numAxes(); + var ypadCompat, span, series, ypad; + + var p_axis; + + // Compute extreme values, a span and tick marks for each axis. + for (var i = 0; i < numAxes; i++) { + var axis = this.axes_[i]; + var logscale = this.attributes_.getForAxis("logscale", i); + var includeZero = this.attributes_.getForAxis("includeZero", i); + var independentTicks = this.attributes_.getForAxis("independentTicks", i); + series = this.attributes_.seriesForAxis(i); + + // Add some padding. This supports two Y padding operation modes: + // + // - backwards compatible (yRangePad not set): + // 10% padding for automatic Y ranges, but not for user-supplied + // ranges, and move a close-to-zero edge to zero except if + // avoidMinZero is set, since drawing at the edge results in + // invisible lines. Unfortunately lines drawn at the edge of a + // user-supplied range will still be invisible. If logscale is + // set, add a variable amount of padding at the top but + // none at the bottom. + // + // - new-style (yRangePad set by the user): + // always add the specified Y padding. + // + ypadCompat = true; + ypad = 0.1; // add 10% + if (this.attr_('yRangePad') !== null) { + ypadCompat = false; + // Convert pixel padding to ratio + ypad = this.attr_('yRangePad') / this.plotter_.area.h; + } + + if (series.length === 0) { + // If no series are defined or visible then use a reasonable default + axis.extremeRange = [0, 1]; + } else { + // Calculate the extremes of extremes. + var minY = Infinity; // extremes[series[0]][0]; + var maxY = -Infinity; // extremes[series[0]][1]; + var extremeMinY, extremeMaxY; + + for (var j = 0; j < series.length; j++) { + // this skips invisible series + if (!extremes.hasOwnProperty(series[j])) continue; + + // Only use valid extremes to stop null data series' from corrupting the scale. + extremeMinY = extremes[series[j]][0]; + if (extremeMinY !== null) { + minY = Math.min(extremeMinY, minY); + } + extremeMaxY = extremes[series[j]][1]; + if (extremeMaxY !== null) { + maxY = Math.max(extremeMaxY, maxY); + } + } + + // Include zero if requested by the user. + if (includeZero && !logscale) { + if (minY > 0) minY = 0; + if (maxY < 0) maxY = 0; + } + + // Ensure we have a valid scale, otherwise default to [0, 1] for safety. + if (minY == Infinity) minY = 0; + if (maxY == -Infinity) maxY = 1; + + span = maxY - minY; + // special case: if we have no sense of scale, center on the sole value. + if (span === 0) { + if (maxY !== 0) { + span = Math.abs(maxY); + } else { + // ... and if the sole value is zero, use range 0-1. + maxY = 1; + span = 1; + } + } + + var maxAxisY, minAxisY; + if (logscale) { + if (ypadCompat) { + maxAxisY = maxY + ypad * span; + minAxisY = minY; + } else { + var logpad = Math.exp(Math.log(span) * ypad); + maxAxisY = maxY * logpad; + minAxisY = minY / logpad; + } + } else { + maxAxisY = maxY + ypad * span; + minAxisY = minY - ypad * span; + + // Backwards-compatible behavior: Move the span to start or end at zero if it's + // close to zero, but not if avoidMinZero is set. + if (ypadCompat && !this.attr_("avoidMinZero")) { + if (minAxisY < 0 && minY >= 0) minAxisY = 0; + if (maxAxisY > 0 && maxY <= 0) maxAxisY = 0; + } + } + axis.extremeRange = [minAxisY, maxAxisY]; + } + if (axis.valueWindow) { + // This is only set if the user has zoomed on the y-axis. It is never set + // by a user. It takes precedence over axis.valueRange because, if you set + // valueRange, you'd still expect to be able to pan. + axis.computedValueRange = [axis.valueWindow[0], axis.valueWindow[1]]; + } else if (axis.valueRange) { + // This is a user-set value range for this axis. + var y0 = isNullUndefinedOrNaN(axis.valueRange[0]) ? axis.extremeRange[0] : axis.valueRange[0]; + var y1 = isNullUndefinedOrNaN(axis.valueRange[1]) ? axis.extremeRange[1] : axis.valueRange[1]; + if (!ypadCompat) { + if (axis.logscale) { + var logpad = Math.exp(Math.log(span) * ypad); + y0 *= logpad; + y1 /= logpad; + } else { + span = y1 - y0; + y0 -= span * ypad; + y1 += span * ypad; + } + } + axis.computedValueRange = [y0, y1]; + } else { + axis.computedValueRange = axis.extremeRange; + } + + + if (independentTicks) { + axis.independentTicks = independentTicks; + var opts = this.optionsViewForAxis_('y' + (i ? '2' : '')); + var ticker = opts('ticker'); + axis.ticks = ticker(axis.computedValueRange[0], + axis.computedValueRange[1], + this.height_, // TODO(danvk): should be area.height + opts, + this); + // Define the first independent axis as primary axis. + if (!p_axis) p_axis = axis; + } + } + if (p_axis === undefined) { + throw ("Configuration Error: At least one axis has to have the \"independentTicks\" option activated."); + } + // Add ticks. By default, all axes inherit the tick positions of the + // primary axis. However, if an axis is specifically marked as having + // independent ticks, then that is permissible as well. + for (var i = 0; i < numAxes; i++) { + var axis = this.axes_[i]; + + if (!axis.independentTicks) { + var opts = this.optionsViewForAxis_('y' + (i ? '2' : '')); + var ticker = opts('ticker'); + var p_ticks = p_axis.ticks; + var p_scale = p_axis.computedValueRange[1] - p_axis.computedValueRange[0]; + var scale = axis.computedValueRange[1] - axis.computedValueRange[0]; + var tick_values = []; + for (var k = 0; k < p_ticks.length; k++) { + var y_frac = (p_ticks[k].v - p_axis.computedValueRange[0]) / p_scale; + var y_val = axis.computedValueRange[0] + y_frac * scale; + tick_values.push(y_val); + } + + axis.ticks = ticker(axis.computedValueRange[0], + axis.computedValueRange[1], + this.height_, // TODO(danvk): should be area.height + opts, + this, + tick_values); + } + } +}; + +/** + * Extracts one series from the raw data (a 2D array) into an array of (date, + * value) tuples. + * + * This is where undesirable points (i.e. negative values on log scales and + * missing values through which we wish to connect lines) are dropped. + * TODO(danvk): the "missing values" bit above doesn't seem right. + * + * @private + * @param {Array.)>>} rawData Input data. Rectangular + * grid of points, where rawData[row][0] is the X value for the row, + * and rawData[row][i] is the Y data for series #i. + * @param {number} i Series index, starting from 1. + * @param {boolean} logScale True if using logarithmic Y scale. + * @return {Array.)>} Series array, where + * series[row] = [x,y] or [x, [y, err]] or [x, [y, yplus, yminus]]. + */ +Dygraph.prototype.extractSeries_ = function(rawData, i, logScale) { + // TODO(danvk): pre-allocate series here. + var series = []; + var errorBars = this.attr_("errorBars"); + var customBars = this.attr_("customBars"); + for (var j = 0; j < rawData.length; j++) { + var x = rawData[j][0]; + var point = rawData[j][i]; + if (logScale) { + // On the log scale, points less than zero do not exist. + // This will create a gap in the chart. + if (errorBars || customBars) { + // point.length is either 2 (errorBars) or 3 (customBars) + for (var k = 0; k < point.length; k++) { + if (point[k] <= 0) { + point = null; + break; + } + } + } else if (point <= 0) { + point = null; + } + } + // Fix null points to fit the display type standard. + if (point !== null) { + series.push([x, point]); + } else { + series.push([x, errorBars ? [null, null] : customBars ? [null, null, null] : point]); + } + } + return series; +}; + +/** + * @private + * Calculates the rolling average of a data set. + * If originalData is [label, val], rolls the average of those. + * If originalData is [label, [, it's interpreted as [value, stddev] + * and the roll is returned in the same form, with appropriately reduced + * stddev for each value. + * Note that this is where fractional input (i.e. '5/10') is converted into + * decimal values. + * @param {Array} originalData The data in the appropriate format (see above) + * @param {Number} rollPeriod The number of points over which to average the + * data + */ +Dygraph.prototype.rollingAverage = function(originalData, rollPeriod) { + rollPeriod = Math.min(rollPeriod, originalData.length); + var rollingData = []; + var sigma = this.attr_("sigma"); + + var low, high, i, j, y, sum, num_ok, stddev; + if (this.fractions_) { + var num = 0; + var den = 0; // numerator/denominator + var mult = 100.0; + for (i = 0; i < originalData.length; i++) { + num += originalData[i][1][0]; + den += originalData[i][1][1]; + if (i - rollPeriod >= 0) { + num -= originalData[i - rollPeriod][1][0]; + den -= originalData[i - rollPeriod][1][1]; + } + + var date = originalData[i][0]; + var value = den ? num / den : 0.0; + if (this.attr_("errorBars")) { + if (this.attr_("wilsonInterval")) { + // For more details on this confidence interval, see: + // http://en.wikipedia.org/wiki/Binomial_confidence_interval + if (den) { + var p = value < 0 ? 0 : value, n = den; + var pm = sigma * Math.sqrt(p*(1-p)/n + sigma*sigma/(4*n*n)); + var denom = 1 + sigma * sigma / den; + low = (p + sigma * sigma / (2 * den) - pm) / denom; + high = (p + sigma * sigma / (2 * den) + pm) / denom; + rollingData[i] = [date, + [p * mult, (p - low) * mult, (high - p) * mult]]; + } else { + rollingData[i] = [date, [0, 0, 0]]; + } + } else { + stddev = den ? sigma * Math.sqrt(value * (1 - value) / den) : 1.0; + rollingData[i] = [date, [mult * value, mult * stddev, mult * stddev]]; + } + } else { + rollingData[i] = [date, mult * value]; + } + } + } else if (this.attr_("customBars")) { + low = 0; + var mid = 0; + high = 0; + var count = 0; + for (i = 0; i < originalData.length; i++) { + var data = originalData[i][1]; + y = data[1]; + rollingData[i] = [originalData[i][0], [y, y - data[0], data[2] - y]]; + + if (y !== null && !isNaN(y)) { + low += data[0]; + mid += y; + high += data[2]; + count += 1; + } + if (i - rollPeriod >= 0) { + var prev = originalData[i - rollPeriod]; + if (prev[1][1] !== null && !isNaN(prev[1][1])) { + low -= prev[1][0]; + mid -= prev[1][1]; + high -= prev[1][2]; + count -= 1; + } + } + if (count) { + rollingData[i] = [originalData[i][0], [ 1.0 * mid / count, + 1.0 * (mid - low) / count, + 1.0 * (high - mid) / count ]]; + } else { + rollingData[i] = [originalData[i][0], [null, null, null]]; + } + } + } else { + // Calculate the rolling average for the first rollPeriod - 1 points where + // there is not enough data to roll over the full number of points + if (!this.attr_("errorBars")) { + if (rollPeriod == 1) { + return originalData; + } + + for (i = 0; i < originalData.length; i++) { + sum = 0; + num_ok = 0; + for (j = Math.max(0, i - rollPeriod + 1); j < i + 1; j++) { + y = originalData[j][1]; + if (y === null || isNaN(y)) continue; + num_ok++; + sum += originalData[j][1]; + } + if (num_ok) { + rollingData[i] = [originalData[i][0], sum / num_ok]; + } else { + rollingData[i] = [originalData[i][0], null]; + } + } + + } else { + for (i = 0; i < originalData.length; i++) { + sum = 0; + var variance = 0; + num_ok = 0; + for (j = Math.max(0, i - rollPeriod + 1); j < i + 1; j++) { + y = originalData[j][1][0]; + if (y === null || isNaN(y)) continue; + num_ok++; + sum += originalData[j][1][0]; + variance += Math.pow(originalData[j][1][1], 2); + } + if (num_ok) { + stddev = Math.sqrt(variance) / num_ok; + rollingData[i] = [originalData[i][0], + [sum / num_ok, sigma * stddev, sigma * stddev]]; + } else { + // This explicitly preserves NaNs to aid with "independent series". + // See testRollingAveragePreservesNaNs. + var v = (rollPeriod == 1) ? originalData[i][1][0] : null; + rollingData[i] = [originalData[i][0], [v, v, v]]; + } + } + } + } + + return rollingData; +}; + +/** + * Detects the type of the str (date or numeric) and sets the various + * formatting attributes in this.attrs_ based on this type. + * @param {String} str An x value. + * @private + */ +Dygraph.prototype.detectTypeFromString_ = function(str) { + var isDate = false; + var dashPos = str.indexOf('-'); // could be 2006-01-01 _or_ 1.0e-2 + if ((dashPos > 0 && (str[dashPos-1] != 'e' && str[dashPos-1] != 'E')) || + str.indexOf('/') >= 0 || + isNaN(parseFloat(str))) { + isDate = true; + } else if (str.length == 8 && str > '19700101' && str < '20371231') { + // TODO(danvk): remove support for this format. + isDate = true; + } + + this.setXAxisOptions_(isDate); +}; + +Dygraph.prototype.setXAxisOptions_ = function(isDate) { + if (isDate) { + this.attrs_.xValueParser = Dygraph.dateParser; + this.attrs_.axes.x.valueFormatter = Dygraph.dateString_; + this.attrs_.axes.x.ticker = Dygraph.dateTicker; + this.attrs_.axes.x.axisLabelFormatter = Dygraph.dateAxisFormatter; + } else { + /** @private (shut up, jsdoc!) */ + this.attrs_.xValueParser = function(x) { return parseFloat(x); }; + // TODO(danvk): use Dygraph.numberValueFormatter here? + /** @private (shut up, jsdoc!) */ + this.attrs_.axes.x.valueFormatter = function(x) { return x; }; + this.attrs_.axes.x.ticker = Dygraph.numericLinearTicks; + this.attrs_.axes.x.axisLabelFormatter = this.attrs_.axes.x.valueFormatter; + } +}; + +/** + * Parses the value as a floating point number. This is like the parseFloat() + * built-in, but with a few differences: + * - the empty string is parsed as null, rather than NaN. + * - if the string cannot be parsed at all, an error is logged. + * If the string can't be parsed, this method returns null. + * @param {String} x The string to be parsed + * @param {Number} opt_line_no The line number from which the string comes. + * @param {String} opt_line The text of the line from which the string comes. + * @private + */ + +// Parse the x as a float or return null if it's not a number. +Dygraph.prototype.parseFloat_ = function(x, opt_line_no, opt_line) { + var val = parseFloat(x); + if (!isNaN(val)) return val; + + // Try to figure out what happeend. + // If the value is the empty string, parse it as null. + if (/^ *$/.test(x)) return null; + + // If it was actually "NaN", return it as NaN. + if (/^ *nan *$/i.test(x)) return NaN; + + // Looks like a parsing error. + var msg = "Unable to parse '" + x + "' as a number"; + if (opt_line !== null && opt_line_no !== null) { + msg += " on line " + (1+opt_line_no) + " ('" + opt_line + "') of CSV."; + } + this.error(msg); + + return null; +}; + +/** + * @private + * Parses a string in a special csv format. We expect a csv file where each + * line is a date point, and the first field in each line is the date string. + * We also expect that all remaining fields represent series. + * if the errorBars attribute is set, then interpret the fields as: + * date, series1, stddev1, series2, stddev2, ... + * @param {[Object]} data See above. + * + * @return [Object] An array with one entry for each row. These entries + * are an array of cells in that row. The first entry is the parsed x-value for + * the row. The second, third, etc. are the y-values. These can take on one of + * three forms, depending on the CSV and constructor parameters: + * 1. numeric value + * 2. [ value, stddev ] + * 3. [ low value, center value, high value ] + */ +Dygraph.prototype.parseCSV_ = function(data) { + var ret = []; + var line_delimiter = Dygraph.detectLineDelimiter(data); + var lines = data.split(line_delimiter || "\n"); + var vals, j; + + // Use the default delimiter or fall back to a tab if that makes sense. + var delim = this.attr_('delimiter'); + if (lines[0].indexOf(delim) == -1 && lines[0].indexOf('\t') >= 0) { + delim = '\t'; + } + + var start = 0; + if (!('labels' in this.user_attrs_)) { + // User hasn't explicitly set labels, so they're (presumably) in the CSV. + start = 1; + this.attrs_.labels = lines[0].split(delim); // NOTE: _not_ user_attrs_. + this.attributes_.reparseSeries(); + } + var line_no = 0; + + var xParser; + var defaultParserSet = false; // attempt to auto-detect x value type + var expectedCols = this.attr_("labels").length; + var outOfOrder = false; + for (var i = start; i < lines.length; i++) { + var line = lines[i]; + line_no = i; + if (line.length === 0) continue; // skip blank lines + if (line[0] == '#') continue; // skip comment lines + var inFields = line.split(delim); + if (inFields.length < 2) continue; + + var fields = []; + if (!defaultParserSet) { + this.detectTypeFromString_(inFields[0]); + xParser = this.attr_("xValueParser"); + defaultParserSet = true; + } + fields[0] = xParser(inFields[0], this); + + // If fractions are expected, parse the numbers as "A/B" + if (this.fractions_) { + for (j = 1; j < inFields.length; j++) { + // TODO(danvk): figure out an appropriate way to flag parse errors. + vals = inFields[j].split("/"); + if (vals.length != 2) { + this.error('Expected fractional "num/den" values in CSV data ' + + "but found a value '" + inFields[j] + "' on line " + + (1 + i) + " ('" + line + "') which is not of this form."); + fields[j] = [0, 0]; + } else { + fields[j] = [this.parseFloat_(vals[0], i, line), + this.parseFloat_(vals[1], i, line)]; + } + } + } else if (this.attr_("errorBars")) { + // If there are error bars, values are (value, stddev) pairs + if (inFields.length % 2 != 1) { + this.error('Expected alternating (value, stdev.) pairs in CSV data ' + + 'but line ' + (1 + i) + ' has an odd number of values (' + + (inFields.length - 1) + "): '" + line + "'"); + } + for (j = 1; j < inFields.length; j += 2) { + fields[(j + 1) / 2] = [this.parseFloat_(inFields[j], i, line), + this.parseFloat_(inFields[j + 1], i, line)]; + } + } else if (this.attr_("customBars")) { + // Bars are a low;center;high tuple + for (j = 1; j < inFields.length; j++) { + var val = inFields[j]; + if (/^ *$/.test(val)) { + fields[j] = [null, null, null]; + } else { + vals = val.split(";"); + if (vals.length == 3) { + fields[j] = [ this.parseFloat_(vals[0], i, line), + this.parseFloat_(vals[1], i, line), + this.parseFloat_(vals[2], i, line) ]; + } else { + this.warn('When using customBars, values must be either blank ' + + 'or "low;center;high" tuples (got "' + val + + '" on line ' + (1+i)); + } + } + } + } else { + // Values are just numbers + for (j = 1; j < inFields.length; j++) { + fields[j] = this.parseFloat_(inFields[j], i, line); + } + } + if (ret.length > 0 && fields[0] < ret[ret.length - 1][0]) { + outOfOrder = true; + } + + if (fields.length != expectedCols) { + this.error("Number of columns in line " + i + " (" + fields.length + + ") does not agree with number of labels (" + expectedCols + + ") " + line); + } + + // If the user specified the 'labels' option and none of the cells of the + // first row parsed correctly, then they probably double-specified the + // labels. We go with the values set in the option, discard this row and + // log a warning to the JS console. + if (i === 0 && this.attr_('labels')) { + var all_null = true; + for (j = 0; all_null && j < fields.length; j++) { + if (fields[j]) all_null = false; + } + if (all_null) { + this.warn("The dygraphs 'labels' option is set, but the first row of " + + "CSV data ('" + line + "') appears to also contain labels. " + + "Will drop the CSV labels and use the option labels."); + continue; + } + } + ret.push(fields); + } + + if (outOfOrder) { + this.warn("CSV is out of order; order it correctly to speed loading."); + ret.sort(function(a,b) { return a[0] - b[0]; }); + } + + return ret; +}; + +/** + * @private + * The user has provided their data as a pre-packaged JS array. If the x values + * are numeric, this is the same as dygraphs' internal format. If the x values + * are dates, we need to convert them from Date objects to ms since epoch. + * @param {[Object]} data + * @return {[Object]} data with numeric x values. + */ +Dygraph.prototype.parseArray_ = function(data) { + // Peek at the first x value to see if it's numeric. + if (data.length === 0) { + this.error("Can't plot empty data set"); + return null; + } + if (data[0].length === 0) { + this.error("Data set cannot contain an empty row"); + return null; + } + + var i; + if (this.attr_("labels") === null) { + this.warn("Using default labels. Set labels explicitly via 'labels' " + + "in the options parameter"); + this.attrs_.labels = [ "X" ]; + for (i = 1; i < data[0].length; i++) { + this.attrs_.labels.push("Y" + i); // Not user_attrs_. + } + this.attributes_.reparseSeries(); + } else { + var num_labels = this.attr_("labels"); + if (num_labels.length != data[0].length) { + this.error("Mismatch between number of labels (" + num_labels + + ") and number of columns in array (" + data[0].length + ")"); + return null; + } + } + + if (Dygraph.isDateLike(data[0][0])) { + // Some intelligent defaults for a date x-axis. + this.attrs_.axes.x.valueFormatter = Dygraph.dateString_; + this.attrs_.axes.x.ticker = Dygraph.dateTicker; + this.attrs_.axes.x.axisLabelFormatter = Dygraph.dateAxisFormatter; + + // Assume they're all dates. + var parsedData = Dygraph.clone(data); + for (i = 0; i < data.length; i++) { + if (parsedData[i].length === 0) { + this.error("Row " + (1 + i) + " of data is empty"); + return null; + } + if (parsedData[i][0] === null || + typeof(parsedData[i][0].getTime) != 'function' || + isNaN(parsedData[i][0].getTime())) { + this.error("x value in row " + (1 + i) + " is not a Date"); + return null; + } + parsedData[i][0] = parsedData[i][0].getTime(); + } + return parsedData; + } else { + // Some intelligent defaults for a numeric x-axis. + /** @private (shut up, jsdoc!) */ + this.attrs_.axes.x.valueFormatter = function(x) { return x; }; + this.attrs_.axes.x.ticker = Dygraph.numericLinearTicks; + this.attrs_.axes.x.axisLabelFormatter = Dygraph.numberAxisLabelFormatter; + return data; + } +}; + +/** + * Parses a DataTable object from gviz. + * The data is expected to have a first column that is either a date or a + * number. All subsequent columns must be numbers. If there is a clear mismatch + * between this.xValueParser_ and the type of the first column, it will be + * fixed. Fills out rawData_. + * @param {[Object]} data See above. + * @private + */ +Dygraph.prototype.parseDataTable_ = function(data) { + var shortTextForAnnotationNum = function(num) { + // converts [0-9]+ [A-Z][a-z]* + // example: 0=A, 1=B, 25=Z, 26=Aa, 27=Ab + // and continues like.. Ba Bb .. Za .. Zz..Aaa...Zzz Aaaa Zzzz + var shortText = String.fromCharCode(65 /* A */ + num % 26); + num = Math.floor(num / 26); + while ( num > 0 ) { + shortText = String.fromCharCode(65 /* A */ + (num - 1) % 26 ) + shortText.toLowerCase(); + num = Math.floor((num - 1) / 26); + } + return shortText; + }; + + var cols = data.getNumberOfColumns(); + var rows = data.getNumberOfRows(); + + var indepType = data.getColumnType(0); + if (indepType == 'date' || indepType == 'datetime') { + this.attrs_.xValueParser = Dygraph.dateParser; + this.attrs_.axes.x.valueFormatter = Dygraph.dateString_; + this.attrs_.axes.x.ticker = Dygraph.dateTicker; + this.attrs_.axes.x.axisLabelFormatter = Dygraph.dateAxisFormatter; + } else if (indepType == 'number') { + this.attrs_.xValueParser = function(x) { return parseFloat(x); }; + this.attrs_.axes.x.valueFormatter = function(x) { return x; }; + this.attrs_.axes.x.ticker = Dygraph.numericLinearTicks; + this.attrs_.axes.x.axisLabelFormatter = this.attrs_.axes.x.valueFormatter; + } else { + this.error("only 'date', 'datetime' and 'number' types are supported for " + + "column 1 of DataTable input (Got '" + indepType + "')"); + return null; + } + + // Array of the column indices which contain data (and not annotations). + var colIdx = []; + var annotationCols = {}; // data index -> [annotation cols] + var hasAnnotations = false; + var i, j; + for (i = 1; i < cols; i++) { + var type = data.getColumnType(i); + if (type == 'number') { + colIdx.push(i); + } else if (type == 'string' && this.attr_('displayAnnotations')) { + // This is OK -- it's an annotation column. + var dataIdx = colIdx[colIdx.length - 1]; + if (!annotationCols.hasOwnProperty(dataIdx)) { + annotationCols[dataIdx] = [i]; + } else { + annotationCols[dataIdx].push(i); + } + hasAnnotations = true; + } else { + this.error("Only 'number' is supported as a dependent type with Gviz." + + " 'string' is only supported if displayAnnotations is true"); + } + } + + // Read column labels + // TODO(danvk): add support back for errorBars + var labels = [data.getColumnLabel(0)]; + for (i = 0; i < colIdx.length; i++) { + labels.push(data.getColumnLabel(colIdx[i])); + if (this.attr_("errorBars")) i += 1; + } + this.attrs_.labels = labels; + cols = labels.length; + + var ret = []; + var outOfOrder = false; + var annotations = []; + for (i = 0; i < rows; i++) { + var row = []; + if (typeof(data.getValue(i, 0)) === 'undefined' || + data.getValue(i, 0) === null) { + this.warn("Ignoring row " + i + + " of DataTable because of undefined or null first column."); + continue; + } + + if (indepType == 'date' || indepType == 'datetime') { + row.push(data.getValue(i, 0).getTime()); + } else { + row.push(data.getValue(i, 0)); + } + if (!this.attr_("errorBars")) { + for (j = 0; j < colIdx.length; j++) { + var col = colIdx[j]; + row.push(data.getValue(i, col)); + if (hasAnnotations && + annotationCols.hasOwnProperty(col) && + data.getValue(i, annotationCols[col][0]) !== null) { + var ann = {}; + ann.series = data.getColumnLabel(col); + ann.xval = row[0]; + ann.shortText = shortTextForAnnotationNum(annotations.length); + ann.text = ''; + for (var k = 0; k < annotationCols[col].length; k++) { + if (k) ann.text += "\n"; + ann.text += data.getValue(i, annotationCols[col][k]); + } + annotations.push(ann); + } + } + + // Strip out infinities, which give dygraphs problems later on. + for (j = 0; j < row.length; j++) { + if (!isFinite(row[j])) row[j] = null; + } + } else { + for (j = 0; j < cols - 1; j++) { + row.push([ data.getValue(i, 1 + 2 * j), data.getValue(i, 2 + 2 * j) ]); + } + } + if (ret.length > 0 && row[0] < ret[ret.length - 1][0]) { + outOfOrder = true; + } + ret.push(row); + } + + if (outOfOrder) { + this.warn("DataTable is out of order; order it correctly to speed loading."); + ret.sort(function(a,b) { return a[0] - b[0]; }); + } + this.rawData_ = ret; + + if (annotations.length > 0) { + this.setAnnotations(annotations, true); + } + this.attributes_.reparseSeries(); +}; + +/** + * Get the CSV data. If it's in a function, call that function. If it's in a + * file, do an XMLHttpRequest to get it. + * @private + */ +Dygraph.prototype.start_ = function() { + var data = this.file_; + + // Functions can return references of all other types. + if (typeof data == 'function') { + data = data(); + } + + if (Dygraph.isArrayLike(data)) { + this.rawData_ = this.parseArray_(data); + this.predraw_(); + } else if (typeof data == 'object' && + typeof data.getColumnRange == 'function') { + // must be a DataTable from gviz. + this.parseDataTable_(data); + this.predraw_(); + } else if (typeof data == 'string') { + // Heuristic: a newline means it's CSV data. Otherwise it's an URL. + var line_delimiter = Dygraph.detectLineDelimiter(data); + if (line_delimiter) { + this.loadedEvent_(data); + } else { + var req = new XMLHttpRequest(); + var caller = this; + req.onreadystatechange = function () { + if (req.readyState == 4) { + if (req.status === 200 || // Normal http + req.status === 0) { // Chrome w/ --allow-file-access-from-files + caller.loadedEvent_(req.responseText); + } + } + }; + + req.open("GET", data, true); + req.send(null); + } + } else { + this.error("Unknown data format: " + (typeof data)); + } +}; + +/** + * Changes various properties of the graph. These can include: + *
            + *
          • file: changes the source data for the graph
          • + *
          • errorBars: changes whether the data contains stddev
          • + *
          + * + * There's a huge variety of options that can be passed to this method. For a + * full list, see http://dygraphs.com/options.html. + * + * @param {Object} attrs The new properties and values + * @param {Boolean} [block_redraw] Usually the chart is redrawn after every + * call to updateOptions(). If you know better, you can pass true to explicitly + * block the redraw. This can be useful for chaining updateOptions() calls, + * avoiding the occasional infinite loop and preventing redraws when it's not + * necessary (e.g. when updating a callback). + */ +Dygraph.prototype.updateOptions = function(input_attrs, block_redraw) { + if (typeof(block_redraw) == 'undefined') block_redraw = false; + + // mapLegacyOptions_ drops the "file" parameter as a convenience to us. + var file = input_attrs.file; + var attrs = Dygraph.mapLegacyOptions_(input_attrs); + + // TODO(danvk): this is a mess. Move these options into attr_. + if ('rollPeriod' in attrs) { + this.rollPeriod_ = attrs.rollPeriod; + } + if ('dateWindow' in attrs) { + this.dateWindow_ = attrs.dateWindow; + if (!('isZoomedIgnoreProgrammaticZoom' in attrs)) { + this.zoomed_x_ = (attrs.dateWindow !== null); + } + } + if ('valueRange' in attrs && !('isZoomedIgnoreProgrammaticZoom' in attrs)) { + this.zoomed_y_ = (attrs.valueRange !== null); + } + + // TODO(danvk): validate per-series options. + // Supported: + // strokeWidth + // pointSize + // drawPoints + // highlightCircleSize + + // Check if this set options will require new points. + var requiresNewPoints = Dygraph.isPixelChangingOptionList(this.attr_("labels"), attrs); + + Dygraph.updateDeep(this.user_attrs_, attrs); + + this.attributes_.reparseSeries(); + + if (file) { + this.file_ = file; + if (!block_redraw) this.start_(); + } else { + if (!block_redraw) { + if (requiresNewPoints) { + this.predraw_(); + } else { + this.renderGraph_(false); + } + } + } +}; + +/** + * Returns a copy of the options with deprecated names converted into current + * names. Also drops the (potentially-large) 'file' attribute. If the caller is + * interested in that, they should save a copy before calling this. + * @private + */ +Dygraph.mapLegacyOptions_ = function(attrs) { + var my_attrs = {}; + for (var k in attrs) { + if (k == 'file') continue; + if (attrs.hasOwnProperty(k)) my_attrs[k] = attrs[k]; + } + + var set = function(axis, opt, value) { + if (!my_attrs.axes) my_attrs.axes = {}; + if (!my_attrs.axes[axis]) my_attrs.axes[axis] = {}; + my_attrs.axes[axis][opt] = value; + }; + var map = function(opt, axis, new_opt) { + if (typeof(attrs[opt]) != 'undefined') { + Dygraph.warn("Option " + opt + " is deprecated. Use the " + + new_opt + " option for the " + axis + " axis instead. " + + "(e.g. { axes : { " + axis + " : { " + new_opt + " : ... } } } " + + "(see http://dygraphs.com/per-axis.html for more information."); + set(axis, new_opt, attrs[opt]); + delete my_attrs[opt]; + } + }; + + // This maps, e.g., xValueFormater -> axes: { x: { valueFormatter: ... } } + map('xValueFormatter', 'x', 'valueFormatter'); + map('pixelsPerXLabel', 'x', 'pixelsPerLabel'); + map('xAxisLabelFormatter', 'x', 'axisLabelFormatter'); + map('xTicker', 'x', 'ticker'); + map('yValueFormatter', 'y', 'valueFormatter'); + map('pixelsPerYLabel', 'y', 'pixelsPerLabel'); + map('yAxisLabelFormatter', 'y', 'axisLabelFormatter'); + map('yTicker', 'y', 'ticker'); + return my_attrs; +}; + +/** + * Resizes the dygraph. If no parameters are specified, resizes to fill the + * containing div (which has presumably changed size since the dygraph was + * instantiated. If the width/height are specified, the div will be resized. + * + * This is far more efficient than destroying and re-instantiating a + * Dygraph, since it doesn't have to reparse the underlying data. + * + * @param {Number} [width] Width (in pixels) + * @param {Number} [height] Height (in pixels) + */ +Dygraph.prototype.resize = function(width, height) { + if (this.resize_lock) { + return; + } + this.resize_lock = true; + + if ((width === null) != (height === null)) { + this.warn("Dygraph.resize() should be called with zero parameters or " + + "two non-NULL parameters. Pretending it was zero."); + width = height = null; + } + + var old_width = this.width_; + var old_height = this.height_; + + if (width) { + this.maindiv_.style.width = width + "px"; + this.maindiv_.style.height = height + "px"; + this.width_ = width; + this.height_ = height; + } else { + this.width_ = this.maindiv_.clientWidth; + this.height_ = this.maindiv_.clientHeight; + } + + if (old_width != this.width_ || old_height != this.height_) { + // Resizing a canvas erases it, even when the size doesn't change, so + // any resize needs to be followed by a redraw. + this.resizeElements_(); + this.predraw_(); + } + + this.resize_lock = false; +}; + +/** + * Adjusts the number of points in the rolling average. Updates the graph to + * reflect the new averaging period. + * @param {Number} length Number of points over which to average the data. + */ +Dygraph.prototype.adjustRoll = function(length) { + this.rollPeriod_ = length; + this.predraw_(); +}; + +/** + * Returns a boolean array of visibility statuses. + */ +Dygraph.prototype.visibility = function() { + // Do lazy-initialization, so that this happens after we know the number of + // data series. + if (!this.attr_("visibility")) { + this.attrs_.visibility = []; + } + // TODO(danvk): it looks like this could go into an infinite loop w/ user_attrs. + while (this.attr_("visibility").length < this.numColumns() - 1) { + this.attrs_.visibility.push(true); + } + return this.attr_("visibility"); +}; + +/** + * Changes the visiblity of a series. + */ +Dygraph.prototype.setVisibility = function(num, value) { + var x = this.visibility(); + if (num < 0 || num >= x.length) { + this.warn("invalid series number in setVisibility: " + num); + } else { + x[num] = value; + this.predraw_(); + } +}; + +/** + * How large of an area will the dygraph render itself in? + * This is used for testing. + * @return A {width: w, height: h} object. + * @private + */ +Dygraph.prototype.size = function() { + return { width: this.width_, height: this.height_ }; +}; + +/** + * Update the list of annotations and redraw the chart. + * See dygraphs.com/annotations.html for more info on how to use annotations. + * @param ann {Array} An array of annotation objects. + * @param suppressDraw {Boolean} Set to "true" to block chart redraw (optional). + */ +Dygraph.prototype.setAnnotations = function(ann, suppressDraw) { + // Only add the annotation CSS rule once we know it will be used. + Dygraph.addAnnotationRule(); + this.annotations_ = ann; + if (!this.layout_) { + this.warn("Tried to setAnnotations before dygraph was ready. " + + "Try setting them in a drawCallback. See " + + "dygraphs.com/tests/annotation.html"); + return; + } + + this.layout_.setAnnotations(this.annotations_); + if (!suppressDraw) { + this.predraw_(); + } +}; + +/** + * Return the list of annotations. + */ +Dygraph.prototype.annotations = function() { + return this.annotations_; +}; + +/** + * Get the list of label names for this graph. The first column is the + * x-axis, so the data series names start at index 1. + * + * Returns null when labels have not yet been defined. + */ +Dygraph.prototype.getLabels = function() { + var labels = this.attr_("labels"); + return labels ? labels.slice() : null; +}; + +/** + * Get the index of a series (column) given its name. The first column is the + * x-axis, so the data series start with index 1. + */ +Dygraph.prototype.indexFromSetName = function(name) { + return this.setIndexByName_[name]; +}; + +/** + * Get the internal dataset index given its name. These are numbered starting from 0, + * and only count visible sets. + * @private + */ +Dygraph.prototype.datasetIndexFromSetName_ = function(name) { + return this.datasetIndex_[this.indexFromSetName(name)]; +}; + +/** + * @private + * Adds a default style for the annotation CSS classes to the document. This is + * only executed when annotations are actually used. It is designed to only be + * called once -- all calls after the first will return immediately. + */ +Dygraph.addAnnotationRule = function() { + // TODO(danvk): move this function into plugins/annotations.js? + if (Dygraph.addedAnnotationCSS) return; + + var rule = "border: 1px solid black; " + + "background-color: white; " + + "text-align: center;"; + + var styleSheetElement = document.createElement("style"); + styleSheetElement.type = "text/css"; + document.getElementsByTagName("head")[0].appendChild(styleSheetElement); + + // Find the first style sheet that we can access. + // We may not add a rule to a style sheet from another domain for security + // reasons. This sometimes comes up when using gviz, since the Google gviz JS + // adds its own style sheets from google.com. + for (var i = 0; i < document.styleSheets.length; i++) { + if (document.styleSheets[i].disabled) continue; + var mysheet = document.styleSheets[i]; + try { + if (mysheet.insertRule) { // Firefox + var idx = mysheet.cssRules ? mysheet.cssRules.length : 0; + mysheet.insertRule(".dygraphDefaultAnnotation { " + rule + " }", idx); + } else if (mysheet.addRule) { // IE + mysheet.addRule(".dygraphDefaultAnnotation", rule); + } + Dygraph.addedAnnotationCSS = true; + return; + } catch(err) { + // Was likely a security exception. + } + } + + this.warn("Unable to add default annotation CSS rule; display may be off."); +}; + +// Older pages may still use this name. +var DateGraph = Dygraph; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/excanvas.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/excanvas.js new file mode 100644 index 0000000..367764b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/excanvas.js @@ -0,0 +1,924 @@ +// Copyright 2006 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +// Known Issues: +// +// * Patterns are not implemented. +// * Radial gradient are not implemented. The VML version of these look very +// different from the canvas one. +// * Clipping paths are not implemented. +// * Coordsize. The width and height attribute have higher priority than the +// width and height style values which isn't correct. +// * Painting mode isn't implemented. +// * Canvas width/height should is using content-box by default. IE in +// Quirks mode will draw the canvas using border-box. Either change your +// doctype to HTML5 +// (http://www.whatwg.org/specs/web-apps/current-work/#the-doctype) +// or use Box Sizing Behavior from WebFX +// (http://webfx.eae.net/dhtml/boxsizing/boxsizing.html) +// * Non uniform scaling does not correctly scale strokes. +// * Optimize. There is always room for speed improvements. + +// Only add this code if we do not already have a canvas implementation +if (!document.createElement('canvas').getContext) { + +(function() { + + // alias some functions to make (compiled) code shorter + var m = Math; + var mr = m.round; + var ms = m.sin; + var mc = m.cos; + var abs = m.abs; + var sqrt = m.sqrt; + + // this is used for sub pixel precision + var Z = 10; + var Z2 = Z / 2; + + /** + * This funtion is assigned to the elements as element.getContext(). + * @this {HTMLElement} + * @return {CanvasRenderingContext2D_} + */ + function getContext() { + return this.context_ || + (this.context_ = new CanvasRenderingContext2D_(this)); + } + + var slice = Array.prototype.slice; + + /** + * Binds a function to an object. The returned function will always use the + * passed in {@code obj} as {@code this}. + * + * Example: + * + * g = bind(f, obj, a, b) + * g(c, d) // will do f.call(obj, a, b, c, d) + * + * @param {Function} f The function to bind the object to + * @param {Object} obj The object that should act as this when the function + * is called + * @param {*} var_args Rest arguments that will be used as the initial + * arguments when the function is called + * @return {Function} A new function that has bound this + */ + function bind(f, obj, var_args) { + var a = slice.call(arguments, 2); + return function() { + return f.apply(obj, a.concat(slice.call(arguments))); + }; + } + + var G_vmlCanvasManager_ = { + init: function(opt_doc) { + if (/MSIE/.test(navigator.userAgent) && !window.opera) { + var doc = opt_doc || document; + // Create a dummy element so that IE will allow canvas elements to be + // recognized. + doc.createElement('canvas'); + doc.attachEvent('onreadystatechange', bind(this.init_, this, doc)); + } + }, + + init_: function(doc) { + // create xmlns + if (!doc.namespaces['g_vml_']) { + doc.namespaces.add('g_vml_', 'urn:schemas-microsoft-com:vml', + '#default#VML'); + + } + if (!doc.namespaces['g_o_']) { + doc.namespaces.add('g_o_', 'urn:schemas-microsoft-com:office:office', + '#default#VML'); + } + + // Setup default CSS. Only add one style sheet per document + if (!doc.styleSheets['ex_canvas_']) { + var ss = doc.createStyleSheet(); + ss.owningElement.id = 'ex_canvas_'; + ss.cssText = 'canvas{display:inline-block;overflow:hidden;' + + // default size is 300x150 in Gecko and Opera + 'text-align:left;width:300px;height:150px}' + + 'g_vml_\\:*{behavior:url(#default#VML)}' + + 'g_o_\\:*{behavior:url(#default#VML)}'; + + } + + // find all canvas elements + var els = doc.getElementsByTagName('canvas'); + for (var i = 0; i < els.length; i++) { + this.initElement(els[i]); + } + }, + + /** + * Public initializes a canvas element so that it can be used as canvas + * element from now on. This is called automatically before the page is + * loaded but if you are creating elements using createElement you need to + * make sure this is called on the element. + * @param {HTMLElement} el The canvas element to initialize. + * @return {HTMLElement} the element that was created. + */ + initElement: function(el) { + if (!el.getContext) { + + el.getContext = getContext; + + // Remove fallback content. There is no way to hide text nodes so we + // just remove all childNodes. We could hide all elements and remove + // text nodes but who really cares about the fallback content. + el.innerHTML = ''; + + // do not use inline function because that will leak memory + el.attachEvent('onpropertychange', onPropertyChange); + el.attachEvent('onresize', onResize); + + var attrs = el.attributes; + if (attrs.width && attrs.width.specified) { + // TODO: use runtimeStyle and coordsize + // el.getContext().setWidth_(attrs.width.nodeValue); + el.style.width = attrs.width.nodeValue + 'px'; + } else { + el.width = el.clientWidth; + } + if (attrs.height && attrs.height.specified) { + // TODO: use runtimeStyle and coordsize + // el.getContext().setHeight_(attrs.height.nodeValue); + el.style.height = attrs.height.nodeValue + 'px'; + } else { + el.height = el.clientHeight; + } + //el.getContext().setCoordsize_() + } + return el; + } + }; + + function onPropertyChange(e) { + var el = e.srcElement; + + switch (e.propertyName) { + case 'width': + el.style.width = el.attributes.width.nodeValue + 'px'; + el.getContext().clearRect(); + break; + case 'height': + el.style.height = el.attributes.height.nodeValue + 'px'; + el.getContext().clearRect(); + break; + } + } + + function onResize(e) { + var el = e.srcElement; + if (el.firstChild) { + el.firstChild.style.width = el.clientWidth + 'px'; + el.firstChild.style.height = el.clientHeight + 'px'; + } + } + + G_vmlCanvasManager_.init(); + + // precompute "00" to "FF" + var dec2hex = []; + for (var i = 0; i < 16; i++) { + for (var j = 0; j < 16; j++) { + dec2hex[i * 16 + j] = i.toString(16) + j.toString(16); + } + } + + function createMatrixIdentity() { + return [ + [1, 0, 0], + [0, 1, 0], + [0, 0, 1] + ]; + } + + function matrixMultiply(m1, m2) { + var result = createMatrixIdentity(); + + for (var x = 0; x < 3; x++) { + for (var y = 0; y < 3; y++) { + var sum = 0; + + for (var z = 0; z < 3; z++) { + sum += m1[x][z] * m2[z][y]; + } + + result[x][y] = sum; + } + } + return result; + } + + function copyState(o1, o2) { + o2.fillStyle = o1.fillStyle; + o2.lineCap = o1.lineCap; + o2.lineJoin = o1.lineJoin; + o2.lineWidth = o1.lineWidth; + o2.miterLimit = o1.miterLimit; + o2.shadowBlur = o1.shadowBlur; + o2.shadowColor = o1.shadowColor; + o2.shadowOffsetX = o1.shadowOffsetX; + o2.shadowOffsetY = o1.shadowOffsetY; + o2.strokeStyle = o1.strokeStyle; + o2.globalAlpha = o1.globalAlpha; + o2.arcScaleX_ = o1.arcScaleX_; + o2.arcScaleY_ = o1.arcScaleY_; + o2.lineScale_ = o1.lineScale_; + } + + function processStyle(styleString) { + var str, alpha = 1; + + styleString = String(styleString); + if (styleString.substring(0, 3) == 'rgb') { + var start = styleString.indexOf('(', 3); + var end = styleString.indexOf(')', start + 1); + var guts = styleString.substring(start + 1, end).split(','); + + str = '#'; + for (var i = 0; i < 3; i++) { + str += dec2hex[Number(guts[i])]; + } + + if (guts.length == 4 && styleString.substr(3, 1) == 'a') { + alpha = guts[3]; + } + } else { + str = styleString; + } + + return {color: str, alpha: alpha}; + } + + function processLineCap(lineCap) { + switch (lineCap) { + case 'butt': + return 'flat'; + case 'round': + return 'round'; + case 'square': + default: + return 'square'; + } + } + + /** + * This class implements CanvasRenderingContext2D interface as described by + * the WHATWG. + * @param {HTMLElement} surfaceElement The element that the 2D context should + * be associated with + */ + function CanvasRenderingContext2D_(surfaceElement) { + this.m_ = createMatrixIdentity(); + + this.mStack_ = []; + this.aStack_ = []; + this.currentPath_ = []; + + // Canvas context properties + this.strokeStyle = '#000'; + this.fillStyle = '#000'; + + this.lineWidth = 1; + this.lineJoin = 'miter'; + this.lineCap = 'butt'; + this.miterLimit = Z * 1; + this.globalAlpha = 1; + this.canvas = surfaceElement; + + var el = surfaceElement.ownerDocument.createElement('div'); + el.style.width = surfaceElement.clientWidth + 'px'; + el.style.height = surfaceElement.clientHeight + 'px'; + el.style.overflow = 'hidden'; + el.style.position = 'absolute'; + surfaceElement.appendChild(el); + + this.element_ = el; + this.arcScaleX_ = 1; + this.arcScaleY_ = 1; + this.lineScale_ = 1; + } + + var contextPrototype = CanvasRenderingContext2D_.prototype; + contextPrototype.clearRect = function() { + this.element_.innerHTML = ''; + }; + + contextPrototype.beginPath = function() { + // TODO: Branch current matrix so that save/restore has no effect + // as per safari docs. + this.currentPath_ = []; + }; + + contextPrototype.moveTo = function(aX, aY) { + var p = this.getCoords_(aX, aY); + this.currentPath_.push({type: 'moveTo', x: p.x, y: p.y}); + this.currentX_ = p.x; + this.currentY_ = p.y; + }; + + contextPrototype.lineTo = function(aX, aY) { + var p = this.getCoords_(aX, aY); + this.currentPath_.push({type: 'lineTo', x: p.x, y: p.y}); + + this.currentX_ = p.x; + this.currentY_ = p.y; + }; + + contextPrototype.bezierCurveTo = function(aCP1x, aCP1y, + aCP2x, aCP2y, + aX, aY) { + var p = this.getCoords_(aX, aY); + var cp1 = this.getCoords_(aCP1x, aCP1y); + var cp2 = this.getCoords_(aCP2x, aCP2y); + bezierCurveTo(this, cp1, cp2, p); + }; + + // Helper function that takes the already fixed cordinates. + function bezierCurveTo(self, cp1, cp2, p) { + self.currentPath_.push({ + type: 'bezierCurveTo', + cp1x: cp1.x, + cp1y: cp1.y, + cp2x: cp2.x, + cp2y: cp2.y, + x: p.x, + y: p.y + }); + self.currentX_ = p.x; + self.currentY_ = p.y; + } + + contextPrototype.quadraticCurveTo = function(aCPx, aCPy, aX, aY) { + // the following is lifted almost directly from + // http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes + + var cp = this.getCoords_(aCPx, aCPy); + var p = this.getCoords_(aX, aY); + + var cp1 = { + x: this.currentX_ + 2.0 / 3.0 * (cp.x - this.currentX_), + y: this.currentY_ + 2.0 / 3.0 * (cp.y - this.currentY_) + }; + var cp2 = { + x: cp1.x + (p.x - this.currentX_) / 3.0, + y: cp1.y + (p.y - this.currentY_) / 3.0 + }; + + bezierCurveTo(this, cp1, cp2, p); + }; + + contextPrototype.arc = function(aX, aY, aRadius, + aStartAngle, aEndAngle, aClockwise) { + aRadius *= Z; + var arcType = aClockwise ? 'at' : 'wa'; + + var xStart = aX + mc(aStartAngle) * aRadius - Z2; + var yStart = aY + ms(aStartAngle) * aRadius - Z2; + + var xEnd = aX + mc(aEndAngle) * aRadius - Z2; + var yEnd = aY + ms(aEndAngle) * aRadius - Z2; + + // IE won't render arches drawn counter clockwise if xStart == xEnd. + if (xStart == xEnd && !aClockwise) { + xStart += 0.125; // Offset xStart by 1/80 of a pixel. Use something + // that can be represented in binary + } + + var p = this.getCoords_(aX, aY); + var pStart = this.getCoords_(xStart, yStart); + var pEnd = this.getCoords_(xEnd, yEnd); + + this.currentPath_.push({type: arcType, + x: p.x, + y: p.y, + radius: aRadius, + xStart: pStart.x, + yStart: pStart.y, + xEnd: pEnd.x, + yEnd: pEnd.y}); + + }; + + contextPrototype.rect = function(aX, aY, aWidth, aHeight) { + this.moveTo(aX, aY); + this.lineTo(aX + aWidth, aY); + this.lineTo(aX + aWidth, aY + aHeight); + this.lineTo(aX, aY + aHeight); + this.closePath(); + }; + + contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) { + var oldPath = this.currentPath_; + this.beginPath(); + + this.moveTo(aX, aY); + this.lineTo(aX + aWidth, aY); + this.lineTo(aX + aWidth, aY + aHeight); + this.lineTo(aX, aY + aHeight); + this.closePath(); + this.stroke(); + + this.currentPath_ = oldPath; + }; + + contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) { + var oldPath = this.currentPath_; + this.beginPath(); + + this.moveTo(aX, aY); + this.lineTo(aX + aWidth, aY); + this.lineTo(aX + aWidth, aY + aHeight); + this.lineTo(aX, aY + aHeight); + this.closePath(); + this.fill(); + + this.currentPath_ = oldPath; + }; + + contextPrototype.createLinearGradient = function(aX0, aY0, aX1, aY1) { + var gradient = new CanvasGradient_('gradient'); + gradient.x0_ = aX0; + gradient.y0_ = aY0; + gradient.x1_ = aX1; + gradient.y1_ = aY1; + return gradient; + }; + + contextPrototype.createRadialGradient = function(aX0, aY0, aR0, + aX1, aY1, aR1) { + var gradient = new CanvasGradient_('gradientradial'); + gradient.x0_ = aX0; + gradient.y0_ = aY0; + gradient.r0_ = aR0; + gradient.x1_ = aX1; + gradient.y1_ = aY1; + gradient.r1_ = aR1; + return gradient; + }; + + contextPrototype.drawImage = function(image, var_args) { + var dx, dy, dw, dh, sx, sy, sw, sh; + + // to find the original width we overide the width and height + var oldRuntimeWidth = image.runtimeStyle.width; + var oldRuntimeHeight = image.runtimeStyle.height; + image.runtimeStyle.width = 'auto'; + image.runtimeStyle.height = 'auto'; + + // get the original size + var w = image.width; + var h = image.height; + + // and remove overides + image.runtimeStyle.width = oldRuntimeWidth; + image.runtimeStyle.height = oldRuntimeHeight; + + if (arguments.length == 3) { + dx = arguments[1]; + dy = arguments[2]; + sx = sy = 0; + sw = dw = w; + sh = dh = h; + } else if (arguments.length == 5) { + dx = arguments[1]; + dy = arguments[2]; + dw = arguments[3]; + dh = arguments[4]; + sx = sy = 0; + sw = w; + sh = h; + } else if (arguments.length == 9) { + sx = arguments[1]; + sy = arguments[2]; + sw = arguments[3]; + sh = arguments[4]; + dx = arguments[5]; + dy = arguments[6]; + dw = arguments[7]; + dh = arguments[8]; + } else { + throw Error('Invalid number of arguments'); + } + + var d = this.getCoords_(dx, dy); + + var w2 = sw / 2; + var h2 = sh / 2; + + var vmlStr = []; + + var W = 10; + var H = 10; + + // For some reason that I've now forgotten, using divs didn't work + vmlStr.push(' ' , + '', + ''); + + this.element_.insertAdjacentHTML('BeforeEnd', + vmlStr.join('')); + }; + + contextPrototype.stroke = function(aFill) { + var lineStr = []; + var lineOpen = false; + var a = processStyle(aFill ? this.fillStyle : this.strokeStyle); + var color = a.color; + var opacity = a.alpha * this.globalAlpha; + + var W = 10; + var H = 10; + + lineStr.push(''); + + if (!aFill) { + var lineWidth = this.lineScale_ * this.lineWidth; + + // VML cannot correctly render a line if the width is less than 1px. + // In that case, we dilute the color to make the line look thinner. + if (lineWidth < 1) { + opacity *= lineWidth; + } + + lineStr.push( + '' + ); + } else if (typeof this.fillStyle == 'object') { + var fillStyle = this.fillStyle; + var angle = 0; + var focus = {x: 0, y: 0}; + + // additional offset + var shift = 0; + // scale factor for offset + var expansion = 1; + + if (fillStyle.type_ == 'gradient') { + var x0 = fillStyle.x0_ / this.arcScaleX_; + var y0 = fillStyle.y0_ / this.arcScaleY_; + var x1 = fillStyle.x1_ / this.arcScaleX_; + var y1 = fillStyle.y1_ / this.arcScaleY_; + var p0 = this.getCoords_(x0, y0); + var p1 = this.getCoords_(x1, y1); + var dx = p1.x - p0.x; + var dy = p1.y - p0.y; + angle = Math.atan2(dx, dy) * 180 / Math.PI; + + // The angle should be a non-negative number. + if (angle < 0) { + angle += 360; + } + + // Very small angles produce an unexpected result because they are + // converted to a scientific notation string. + if (angle < 1e-6) { + angle = 0; + } + } else { + var p0 = this.getCoords_(fillStyle.x0_, fillStyle.y0_); + var width = max.x - min.x; + var height = max.y - min.y; + focus = { + x: (p0.x - min.x) / width, + y: (p0.y - min.y) / height + }; + + width /= this.arcScaleX_ * Z; + height /= this.arcScaleY_ * Z; + var dimension = m.max(width, height); + shift = 2 * fillStyle.r0_ / dimension; + expansion = 2 * fillStyle.r1_ / dimension - shift; + } + + // We need to sort the color stops in ascending order by offset, + // otherwise IE won't interpret it correctly. + var stops = fillStyle.colors_; + stops.sort(function(cs1, cs2) { + return cs1.offset - cs2.offset; + }); + + var length = stops.length; + var color1 = stops[0].color; + var color2 = stops[length - 1].color; + var opacity1 = stops[0].alpha * this.globalAlpha; + var opacity2 = stops[length - 1].alpha * this.globalAlpha; + + var colors = []; + for (var i = 0; i < length; i++) { + var stop = stops[i]; + colors.push(stop.offset * expansion + shift + ' ' + stop.color); + } + + // When colors attribute is used, the meanings of opacity and o:opacity2 + // are reversed. + lineStr.push(''); + } else { + lineStr.push(''); + } + + lineStr.push(''); + + this.element_.insertAdjacentHTML('beforeEnd', lineStr.join('')); + }; + + contextPrototype.fill = function() { + this.stroke(true); + } + + contextPrototype.closePath = function() { + this.currentPath_.push({type: 'close'}); + }; + + /** + * @private + */ + contextPrototype.getCoords_ = function(aX, aY) { + var m = this.m_; + return { + x: Z * (aX * m[0][0] + aY * m[1][0] + m[2][0]) - Z2, + y: Z * (aX * m[0][1] + aY * m[1][1] + m[2][1]) - Z2 + } + }; + + contextPrototype.save = function() { + var o = {}; + copyState(this, o); + this.aStack_.push(o); + this.mStack_.push(this.m_); + this.m_ = matrixMultiply(createMatrixIdentity(), this.m_); + }; + + contextPrototype.restore = function() { + copyState(this.aStack_.pop(), this); + this.m_ = this.mStack_.pop(); + }; + + function matrixIsFinite(m) { + for (var j = 0; j < 3; j++) { + for (var k = 0; k < 2; k++) { + if (!isFinite(m[j][k]) || isNaN(m[j][k])) { + return false; + } + } + } + return true; + } + + function setM(ctx, m, updateLineScale) { + if (!matrixIsFinite(m)) { + return; + } + ctx.m_ = m; + + if (updateLineScale) { + // Get the line scale. + // Determinant of this.m_ means how much the area is enlarged by the + // transformation. So its square root can be used as a scale factor + // for width. + var det = m[0][0] * m[1][1] - m[0][1] * m[1][0]; + ctx.lineScale_ = sqrt(abs(det)); + } + } + + contextPrototype.translate = function(aX, aY) { + var m1 = [ + [1, 0, 0], + [0, 1, 0], + [aX, aY, 1] + ]; + + setM(this, matrixMultiply(m1, this.m_), false); + }; + + contextPrototype.rotate = function(aRot) { + var c = mc(aRot); + var s = ms(aRot); + + var m1 = [ + [c, s, 0], + [-s, c, 0], + [0, 0, 1] + ]; + + setM(this, matrixMultiply(m1, this.m_), false); + }; + + contextPrototype.scale = function(aX, aY) { + this.arcScaleX_ *= aX; + this.arcScaleY_ *= aY; + var m1 = [ + [aX, 0, 0], + [0, aY, 0], + [0, 0, 1] + ]; + + setM(this, matrixMultiply(m1, this.m_), true); + }; + + contextPrototype.transform = function(m11, m12, m21, m22, dx, dy) { + var m1 = [ + [m11, m12, 0], + [m21, m22, 0], + [dx, dy, 1] + ]; + + setM(this, matrixMultiply(m1, this.m_), true); + }; + + contextPrototype.setTransform = function(m11, m12, m21, m22, dx, dy) { + var m = [ + [m11, m12, 0], + [m21, m22, 0], + [dx, dy, 1] + ]; + + setM(this, m, true); + }; + + /******** STUBS ********/ + contextPrototype.clip = function() { + // TODO: Implement + }; + + contextPrototype.arcTo = function() { + // TODO: Implement + }; + + contextPrototype.createPattern = function() { + return new CanvasPattern_; + }; + + // Gradient / Pattern Stubs + function CanvasGradient_(aType) { + this.type_ = aType; + this.x0_ = 0; + this.y0_ = 0; + this.r0_ = 0; + this.x1_ = 0; + this.y1_ = 0; + this.r1_ = 0; + this.colors_ = []; + } + + CanvasGradient_.prototype.addColorStop = function(aOffset, aColor) { + aColor = processStyle(aColor); + this.colors_.push({offset: aOffset, + color: aColor.color, + alpha: aColor.alpha}); + }; + + function CanvasPattern_() {} + + // set up externs + G_vmlCanvasManager = G_vmlCanvasManager_; + CanvasRenderingContext2D = CanvasRenderingContext2D_; + CanvasGradient = CanvasGradient_; + CanvasPattern = CanvasPattern_; + +})(); + +} // if diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction.js new file mode 100644 index 0000000..2384784 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction.js @@ -0,0 +1,333 @@ + function moveV3(event, g, context) { + if (context.isPanning) { + Dygraph.movePan(event, g, context); + } else if (context.isZooming) { + Dygraph.moveZoom(event, g, context); + } + } + + function upV3(event, g, context) { + if (context.isPanning) { + Dygraph.endPan(event, g, context); + } else if (context.isZooming) { + Dygraph.endZoom(event, g, context); + } + } + +// Take the offset of a mouse event on the dygraph canvas and +// convert it to a pair of percentages from the bottom left. +// (Not top left, bottom is where the lower value is.) +function offsetToPercentage(g, offsetX, offsetY) { + // This is calculating the pixel offset of the leftmost date. + var xOffset = g.toDomCoords(g.xAxisRange()[0], null)[0]; + var yar0 = g.yAxisRange(0); + + // This is calculating the pixel of the higest value. (Top pixel) + var yOffset = g.toDomCoords(null, yar0[1])[1]; + + // x y w and h are relative to the corner of the drawing area, + // so that the upper corner of the drawing area is (0, 0). + var x = offsetX - xOffset; + var y = offsetY - yOffset; + + // This is computing the rightmost pixel, effectively defining the + // width. + var w = g.toDomCoords(g.xAxisRange()[1], null)[0] - xOffset; + + // This is computing the lowest pixel, effectively defining the height. + var h = g.toDomCoords(null, yar0[0])[1] - yOffset; + + // Percentage from the left. + var xPct = w == 0 ? 0 : (x / w); + // Percentage from the top. + var yPct = h == 0 ? 0 : (y / h); + + // The (1-) part below changes it from "% distance down from the top" + // to "% distance up from the bottom". + return [xPct, (1-yPct)]; +} + +function dblClickV3(event, g, context) { + // Reducing by 20% makes it 80% the original size, which means + // to restore to original size it must grow by 25% + /* + if (!(event.offsetX && event.offsetY)){ + event.offsetX = event.layerX - event.target.offsetLeft; + event.offsetY = event.layerY - event.target.offsetTop; + } + + var percentages = offsetToPercentage(g, event.offsetX, event.offsetY); + var xPct = percentages[0]; + var yPct = percentages[1]; + + if (event.ctrlKey) { + zoom(g, -.25, xPct, yPct); + } else { + zoom(g, +.2, xPct, yPct); + } + */ + restorePositioning(g); +} + +var lastClickedGraph = null; + +function clickV3(event, g, context) { + lastClickedGraph = g; + Dygraph.cancelEvent(event); +} + +function scrollV3(event, g, context) { + if (lastClickedGraph != g) { + return; + } + var normal = event.detail ? event.detail * -1 : event.wheelDelta / 40; + // For me the normalized value shows 0.075 for one click. If I took + // that verbatim, it would be a 7.5%. + var percentage = normal / 50; + + if (!(event.offsetX && event.offsetY)){ + event.offsetX = event.layerX - event.target.offsetLeft; + event.offsetY = event.layerY - event.target.offsetTop; + } + + var percentages = offsetToPercentage(g, event.offsetX, event.offsetY); + var xPct = percentages[0]; + var yPct = percentages[1]; + + zoom(g, percentage, xPct, yPct); + Dygraph.cancelEvent(event); +} + +// Adjusts [x, y] toward each other by zoomInPercentage% +// Split it so the left/bottom axis gets xBias/yBias of that change and +// tight/top gets (1-xBias)/(1-yBias) of that change. +// +// If a bias is missing it splits it down the middle. +function zoom(g, zoomInPercentage, xBias, yBias) { + xBias = xBias || 0.5; + yBias = yBias || 0.5; + function adjustAxis(axis, zoomInPercentage, bias) { + var delta = axis[1] - axis[0]; + var increment = delta * zoomInPercentage; + var foo = [increment * bias, increment * (1-bias)]; + return [ axis[0] + foo[0], axis[1] - foo[1] ]; + } + var yAxes = g.yAxisRanges(); + var newYAxes = []; + for (var i = 0; i < yAxes.length; i++) { + newYAxes[i] = adjustAxis(yAxes[i], zoomInPercentage, yBias); + } + + g.updateOptions({ + dateWindow: adjustAxis(g.xAxisRange(), zoomInPercentage, xBias), + valueRange: newYAxes[0] + }); +} + +function restorePositioning(g) { + g.updateOptions({ + dateWindow: null, + valueRange: null + }); +} + +function zoom_custom(res) { + var w = g.xAxisRange(); + desired_range = [w[0] - res * 1000, w[0] ]; + animate(); +} + +function reset() { + desired_range = orig_range; + animate(); +} + +var click = 0; +var desired_range = null; +function approach_range() { + if (!desired_range) return; + // go halfway there + var range = g.xAxisRange(); + if (Math.abs(desired_range[0] - range[0]) < 60 && + Math.abs(desired_range[1] - range[1]) < 60) { + if(desired_range[0]>=orig_range[0]) + g.updateOptions({dateWindow: desired_range}); + else { + g.updateOptions({dateWindow: orig_range}); + click = 8; + } + // (do not set another timeout.) + } else { + var new_range; + new_range = [0.5 * (desired_range[0] + range[0]), + 0.5 * (desired_range[1] + range[1])]; + g.updateOptions({dateWindow: new_range}); + animate(); + } +} + +function animate() { + setTimeout(approach_range, 50); +} + + +var v4Active = false; +var v4Canvas = null; + +function downV4(event, g, context) { + context.initializeMouseDown(event, g, context); + + Dygraph.Interaction.startTouch(event, g, context); + + Dygraph.Interaction.moveTouch(event, g, context); + + Dygraph.Interaction.endTouch(event, g, context); + + v4Active = true; + moveV4(event, g, context); // in case the mouse went down on a data point. +} + +var processed = []; + +function moveV4(event, g, context) { + var RANGE = 7; + + if (v4Active) { + var graphPos = Dygraph.findPos(g.graphDiv); + var canvasx = Dygraph.pageX(event) - graphPos.x; + var canvasy = Dygraph.pageY(event) - graphPos.y; + + var rows = g.numRows(); + // Row layout: + // [date, [val1, stdev1], [val2, stdev2]] + for (var row = 0; row < rows; row++) { + var date = g.getValue(row, 0); + var x = g.toDomCoords(date, null)[0]; + var diff = Math.abs(canvasx - x); + if (diff < RANGE) { + for (var col = 1; col < 3; col++) { + // TODO(konigsberg): these will throw exceptions as data is removed. + var vals = g.getValue(row, col); + if (vals == null) { continue; } + var val = vals[0]; + var y = g.toDomCoords(null, val)[1]; + var diff2 = Math.abs(canvasy - y); + if (diff2 < RANGE) { + var found = false; + for (var i in processed) { + var stored = processed[i]; + if(stored[0] == row && stored[1] == col) { + found = true; + break; + } + } + if (!found) { + //processed.push([row, col]); + //drawV4(x, y); + } + return; + } + } + } + } + } +} + +function upV4(event, g, context) { + if (v4Active) { + v4Active = false; + } +} + +function dblClickV4(event, g, context) { + restorePositioning(g); +} + +function drawV4(x, y) { + var ctx = v4Canvas; + + ctx.strokeStyle = "#000000"; + //ctx.fillStyle = "#FFFF00"; + ctx.fillStyle = "#FF0000"; + ctx.beginPath(); + ctx.arc(x,y,5,0,Math.PI*2,true); + ctx.closePath(); + ctx.stroke(); + ctx.fill(); +} + +function captureCanvas(canvas, area, g) { + v4Canvas = canvas; +} + +function newDygraphTouchstart(event, g, context) { +// This right here is what prevents IOS from doing its own zoom/touch behavior +// It stops the node from being selected too +event.preventDefault(); // touch browsers are all nice. + +if (event.touches.length > 1) { +// If the user ever puts two fingers down, it's not a double tap. +context.startTimeForDoubleTapMs = null; +} + +var touches = []; +for (var i = 0; i < event.touches.length; i++) { +var t = event.touches[i]; +// we dispense with 'dragGetX_' because all touchBrowsers support pageX +touches.push({ +pageX: t.pageX, +pageY: t.pageY, +dataX: g.toDataXCoord(t.pageX), +dataY: g.toDataYCoord(t.pageY) +// identifier: t.identifier +}); +} +context.initialTouches = touches; + +if (touches.length == 1) { +// This is just a swipe. +context.initialPinchCenter = touches[0]; +context.touchDirections = { x: true, y: true }; + +// ADDITION - this needs to select the points +//var closestTouchP = g.findClosestPoint(touches[0].pageX,touches[0].pageY); +//if(closestTouchP) { +//var selectionChanged = g.setSelection(closestTouchP.row, closestTouchP.seriesName); +//} +g.mouseMove_(event); + +} else if (touches.length >= 2) { +// It's become a pinch! +// In case there are 3+ touches, we ignore all but the "first" two. + +// only screen coordinates can be averaged (data coords could be log scale). +context.initialPinchCenter = { +pageX: 0.5 * (touches[0].pageX + touches[1].pageX), +pageY: 0.5 * (touches[0].pageY + touches[1].pageY), + +// TODO(danvk): remove +dataX: 0.5 * (touches[0].dataX + touches[1].dataX), +dataY: 0.5 * (touches[0].dataY + touches[1].dataY) +}; + +// Make pinches in a 45-degree swath around either axis 1-dimensional zooms. +var initialAngle = 180 / Math.PI * Math.atan2( +context.initialPinchCenter.pageY - touches[0].pageY, +touches[0].pageX - context.initialPinchCenter.pageX); + +// use symmetry to get it into the first quadrant. +initialAngle = Math.abs(initialAngle); +if (initialAngle > 90) initialAngle = 90 - initialAngle; + +context.touchDirections = { +x: (initialAngle < (90 - 45/2)), +y: (initialAngle > 45/2) +}; +} + +// save the full x & y ranges. +context.initialRange = { +x: g.xAxisRange(), +y: g.yAxisRange() +}; +}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction.min.js new file mode 100644 index 0000000..e3f736a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction.min.js @@ -0,0 +1 @@ +function moveV3(e,t,n){if(n.isPanning){Dygraph.movePan(e,t,n)}else if(n.isZooming){Dygraph.moveZoom(e,t,n)}}function upV3(e,t,n){if(n.isPanning){Dygraph.endPan(e,t,n)}else if(n.isZooming){Dygraph.endZoom(e,t,n)}}function offsetToPercentage(e,t,n){var r=e.toDomCoords(e.xAxisRange()[0],null)[0];var i=e.yAxisRange(0);var s=e.toDomCoords(null,i[1])[1];var o=t-r;var u=n-s;var a=e.toDomCoords(e.xAxisRange()[1],null)[0]-r;var f=e.toDomCoords(null,i[0])[1]-s;var l=a==0?0:o/a;var c=f==0?0:u/f;return[l,1-c]}function dblClickV3(e,t,n){restorePositioning(t)}function clickV3(e,t,n){lastClickedGraph=t;Dygraph.cancelEvent(e)}function scrollV3(e,t,n){if(lastClickedGraph!=t){return}var r=e.detail?e.detail*-1:e.wheelDelta/40;var i=r/50;if(!(e.offsetX&&e.offsetY)){e.offsetX=e.layerX-e.target.offsetLeft;e.offsetY=e.layerY-e.target.offsetTop}var s=offsetToPercentage(t,e.offsetX,e.offsetY);var o=s[0];var u=s[1];zoom(t,i,o,u);Dygraph.cancelEvent(e)}function zoom(e,t,n,r){function i(e,t,n){var r=e[1]-e[0];var i=r*t;var s=[i*n,i*(1-n)];return[e[0]+s[0],e[1]-s[1]]}n=n||.5;r=r||.5;var s=e.yAxisRanges();var o=[];for(var u=0;u=orig_range[0])g.updateOptions({dateWindow:desired_range});else{g.updateOptions({dateWindow:orig_range});click=8}}else{var t;t=[.5*(desired_range[0]+e[0]),.5*(desired_range[1]+e[1])];g.updateOptions({dateWindow:t});animate()}}function animate(){setTimeout(approach_range,50)}function downV4(e,t,n){n.initializeMouseDown(e,t,n);Dygraph.Interaction.startTouch(e,t,n);Dygraph.Interaction.moveTouch(e,t,n);Dygraph.Interaction.endTouch(e,t,n);v4Active=true;moveV4(e,t,n)}function moveV4(e,t,n){var r=7;if(v4Active){var i=Dygraph.findPos(t.graphDiv);var s=Dygraph.pageX(e)-i.x;var o=Dygraph.pageY(e)-i.y;var u=t.numRows();for(var a=0;a1){n.startTimeForDoubleTapMs=null}var r=[];for(var i=0;i=2){n.initialPinchCenter={pageX:.5*(r[0].pageX+r[1].pageX),pageY:.5*(r[0].pageY+r[1].pageY),dataX:.5*(r[0].dataX+r[1].dataX),dataY:.5*(r[0].dataY+r[1].dataY)};var o=180/Math.PI*Math.atan2(n.initialPinchCenter.pageY-r[0].pageY,r[0].pageX-n.initialPinchCenter.pageX);o=Math.abs(o);if(o>90)o=90-o;n.touchDirections={x:o<90-45/2,y:o>45/2}}n.initialRange={x:t.xAxisRange(),y:t.yAxisRange()}}var lastClickedGraph=null;var click=0;var desired_range=null;var v4Active=false;var v4Canvas=null;var processed=[]; \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction_sun.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction_sun.js new file mode 100644 index 0000000..92a0dbd --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/interaction_sun.js @@ -0,0 +1,303 @@ +// Code for a variety of interaction models. Used in interaction.html, but split out from +// that file so they can be tested in isolation. +// +function downV3(event, g, context) { + context.initializeMouseDown(event, g, context); + if (event.altKey || event.shiftKey) { + Dygraph.startZoom(event, g, context); + } else { + Dygraph.startPan(event, g, context); + } +} + +function moveV3(event, g, context) { + if (context.isPanning) { + Dygraph.movePan(event, g, context); + } else if (context.isZooming) { + Dygraph.moveZoom(event, g, context); + } +} + +function upV3(event, g, context) { + if (context.isPanning) { + Dygraph.endPan(event, g, context); + } else if (context.isZooming) { + Dygraph.endZoom(event, g, context); + } +} + +// Take the offset of a mouse event on the dygraph canvas and +// convert it to a pair of percentages from the bottom left. +// (Not top left, bottom is where the lower value is.) +function offsetToPercentage(g, offsetX, offsetY) { + // This is calculating the pixel offset of the leftmost date. + var xOffset = g.toDomCoords(g.xAxisRange()[0], null)[0]; + var yar0 = g.yAxisRange(0); + + // This is calculating the pixel of the higest value. (Top pixel) + var yOffset = g.toDomCoords(null, yar0[1])[1]; + + // x y w and h are relative to the corner of the drawing area, + // so that the upper corner of the drawing area is (0, 0). + var x = offsetX - xOffset; + var y = offsetY - yOffset; + + // This is computing the rightmost pixel, effectively defining the + // width. + var w = g.toDomCoords(g.xAxisRange()[1], null)[0] - xOffset; + + // This is computing the lowest pixel, effectively defining the height. + var h = g.toDomCoords(null, yar0[0])[1] - yOffset; + + // Percentage from the left. + var xPct = w == 0 ? 0 : (x / w); + // Percentage from the top. + var yPct = h == 0 ? 0 : (y / h); + + // The (1-) part below changes it from "% distance down from the top" + // to "% distance up from the bottom". + return [xPct, (1-yPct)]; +} + +function dblClickV3(event, g, context) { + // Reducing by 20% makes it 80% the original size, which means + // to restore to original size it must grow by 25% + + if (!(event.offsetX && event.offsetY)){ + event.offsetX = event.layerX - event.target.offsetLeft; + event.offsetY = event.layerY - event.target.offsetTop; + } + + var percentages = offsetToPercentage(g, event.offsetX, event.offsetY); + var xPct = percentages[0]; + var yPct = percentages[1]; + + if (event.ctrlKey) { + zoom(g, -.25, xPct, yPct); + } else { + zoom(g, +.2, xPct, yPct); + } +} + +var lastClickedGraph = null; + +function clickV3(event, g, context) { + lastClickedGraph = g; + Dygraph.cancelEvent(event); +} + +function scrollV3(event, g, context) { + if (lastClickedGraph != g) { + return; + } + var normal = event.detail ? event.detail * -1 : event.wheelDelta / 40; + // For me the normalized value shows 0.075 for one click. If I took + // that verbatim, it would be a 7.5%. + var percentage = normal / 50; + + if (!(event.offsetX && event.offsetY)){ + event.offsetX = event.layerX - event.target.offsetLeft; + event.offsetY = event.layerY - event.target.offsetTop; + } + + var percentages = offsetToPercentage(g, event.offsetX, event.offsetY); + var xPct = percentages[0]; + var yPct = percentages[1]; + + zoom(g, percentage, xPct, yPct); + Dygraph.cancelEvent(event); +} + +// Adjusts [x, y] toward each other by zoomInPercentage% +// Split it so the left/bottom axis gets xBias/yBias of that change and +// tight/top gets (1-xBias)/(1-yBias) of that change. +// +// If a bias is missing it splits it down the middle. +function zoom(g, zoomInPercentage, xBias, yBias) { + xBias = xBias || 0.5; + yBias = yBias || 0.5; + function adjustAxis(axis, zoomInPercentage, bias) { + var delta = axis[1] - axis[0]; + var increment = delta * zoomInPercentage; + var foo = [increment * bias, increment * (1-bias)]; + return [ axis[0] + foo[0], axis[1] - foo[1] ]; + } + var yAxes = g.yAxisRanges(); + var newYAxes = []; + for (var i = 0; i < yAxes.length; i++) { + newYAxes[i] = adjustAxis(yAxes[i], zoomInPercentage, yBias); + } + + g.updateOptions({ + dateWindow: adjustAxis(g.xAxisRange(), zoomInPercentage, xBias), + valueRange: newYAxes[0] + }); +} + +var v4Active = false; +var v4Canvas = null; + +function downV4(event, g, context) { + context.initializeMouseDown(event, g, context); + + Dygraph.Interaction.startTouch(event, g, context); + + Dygraph.Interaction.moveTouch(event, g, context); + + Dygraph.Interaction.endTouch(event, g, context); + + v4Active = true; + moveV4(event, g, context); // in case the mouse went down on a data point. +} + +var processed = []; + +function moveV4(event, g, context) { + var RANGE = 7; + + if (v4Active) { + var graphPos = Dygraph.findPos(g.graphDiv); + var canvasx = Dygraph.pageX(event) - graphPos.x; + var canvasy = Dygraph.pageY(event) - graphPos.y; + + var rows = g.numRows(); + // Row layout: + // [date, [val1, stdev1], [val2, stdev2]] + for (var row = 0; row < rows; row++) { + var date = g.getValue(row, 0); + var x = g.toDomCoords(date, null)[0]; + var diff = Math.abs(canvasx - x); + if (diff < RANGE) { + for (var col = 1; col < 3; col++) { + // TODO(konigsberg): these will throw exceptions as data is removed. + var vals = g.getValue(row, col); + if (vals == null) { continue; } + var val = vals[0]; + var y = g.toDomCoords(null, val)[1]; + var diff2 = Math.abs(canvasy - y); + if (diff2 < RANGE) { + var found = false; + for (var i in processed) { + var stored = processed[i]; + if(stored[0] == row && stored[1] == col) { + found = true; + break; + } + } + if (!found) { + //processed.push([row, col]); + //drawV4(x, y); + } + return; + } + } + } + } + } +} + +function upV4(event, g, context) { + if (v4Active) { + v4Active = false; + } +} + +function dblClickV4(event, g, context) { + restorePositioning(g); +} + +function drawV4(x, y) { + var ctx = v4Canvas; + + ctx.strokeStyle = "#000000"; + //ctx.fillStyle = "#FFFF00"; + ctx.fillStyle = "#FF0000"; + ctx.beginPath(); + ctx.arc(x,y,5,0,Math.PI*2,true); + ctx.closePath(); + ctx.stroke(); + ctx.fill(); +} + +function captureCanvas(canvas, area, g) { + v4Canvas = canvas; +} + +function restorePositioning(g) { + g.updateOptions({ + dateWindow: null, + valueRange: null + }); +} + +function newDygraphTouchstart(event, g, context) { +// This right here is what prevents IOS from doing its own zoom/touch behavior +// It stops the node from being selected too +event.preventDefault(); // touch browsers are all nice. + +if (event.touches.length > 1) { +// If the user ever puts two fingers down, it's not a double tap. +context.startTimeForDoubleTapMs = null; +} + +var touches = []; +for (var i = 0; i < event.touches.length; i++) { +var t = event.touches[i]; +// we dispense with 'dragGetX_' because all touchBrowsers support pageX +touches.push({ +pageX: t.pageX, +pageY: t.pageY, +dataX: g.toDataXCoord(t.pageX), +dataY: g.toDataYCoord(t.pageY) +// identifier: t.identifier +}); +} +context.initialTouches = touches; + +if (touches.length == 1) { +// This is just a swipe. +context.initialPinchCenter = touches[0]; +context.touchDirections = { x: true, y: true }; + +// ADDITION - this needs to select the points +//var closestTouchP = g.findClosestPoint(touches[0].pageX,touches[0].pageY); +//if(closestTouchP) { +//var selectionChanged = g.setSelection(closestTouchP.row, closestTouchP.seriesName); +//} +g.mouseMove_(event); + +} else if (touches.length >= 2) { +// It's become a pinch! +// In case there are 3+ touches, we ignore all but the "first" two. + +// only screen coordinates can be averaged (data coords could be log scale). +context.initialPinchCenter = { +pageX: 0.5 * (touches[0].pageX + touches[1].pageX), +pageY: 0.5 * (touches[0].pageY + touches[1].pageY), + +// TODO(danvk): remove +dataX: 0.5 * (touches[0].dataX + touches[1].dataX), +dataY: 0.5 * (touches[0].dataY + touches[1].dataY) +}; + +// Make pinches in a 45-degree swath around either axis 1-dimensional zooms. +var initialAngle = 180 / Math.PI * Math.atan2( +context.initialPinchCenter.pageY - touches[0].pageY, +touches[0].pageX - context.initialPinchCenter.pageX); + +// use symmetry to get it into the first quadrant. +initialAngle = Math.abs(initialAngle); +if (initialAngle > 90) initialAngle = 90 - initialAngle; + +context.touchDirections = { +x: (initialAngle < (90 - 45/2)), +y: (initialAngle > 45/2) +}; +} + +// save the full x & y ranges. +context.initialRange = { +x: g.xAxisRange(), +y: g.yAxisRange() +}; +}; \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/moment.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/moment.min.js new file mode 100644 index 0000000..62b1697 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/moment.min.js @@ -0,0 +1,6 @@ +// moment.js +// version : 2.1.0 +// author : Tim Wood +// license : MIT +// momentjs.com +!function(t){function e(t,e){return function(n){return u(t.call(this,n),e)}}function n(t,e){return function(n){return this.lang().ordinal(t.call(this,n),e)}}function s(){}function i(t){a(this,t)}function r(t){var e=t.years||t.year||t.y||0,n=t.months||t.month||t.M||0,s=t.weeks||t.week||t.w||0,i=t.days||t.day||t.d||0,r=t.hours||t.hour||t.h||0,a=t.minutes||t.minute||t.m||0,o=t.seconds||t.second||t.s||0,u=t.milliseconds||t.millisecond||t.ms||0;this._input=t,this._milliseconds=u+1e3*o+6e4*a+36e5*r,this._days=i+7*s,this._months=n+12*e,this._data={},this._bubble()}function a(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function o(t){return 0>t?Math.ceil(t):Math.floor(t)}function u(t,e){for(var n=t+"";n.lengthn;n++)~~t[n]!==~~e[n]&&r++;return r+i}function f(t){return t?ie[t]||t.toLowerCase().replace(/(.)s$/,"$1"):t}function l(t,e){return e.abbr=t,x[t]||(x[t]=new s),x[t].set(e),x[t]}function _(t){if(!t)return H.fn._lang;if(!x[t]&&A)try{require("./lang/"+t)}catch(e){return H.fn._lang}return x[t]}function m(t){return t.match(/\[.*\]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function y(t){var e,n,s=t.match(E);for(e=0,n=s.length;n>e;e++)s[e]=ue[s[e]]?ue[s[e]]:m(s[e]);return function(i){var r="";for(e=0;n>e;e++)r+=s[e]instanceof Function?s[e].call(i,t):s[e];return r}}function M(t,e){function n(e){return t.lang().longDateFormat(e)||e}for(var s=5;s--&&N.test(e);)e=e.replace(N,n);return re[e]||(re[e]=y(e)),re[e](t)}function g(t,e){switch(t){case"DDDD":return V;case"YYYY":return X;case"YYYYY":return $;case"S":case"SS":case"SSS":case"DDD":return I;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return R;case"a":case"A":return _(e._l)._meridiemParse;case"X":return B;case"Z":case"ZZ":return j;case"T":return q;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return J;default:return new RegExp(t.replace("\\",""))}}function p(t){var e=(j.exec(t)||[])[0],n=(e+"").match(ee)||["-",0,0],s=+(60*n[1])+~~n[2];return"+"===n[0]?-s:s}function D(t,e,n){var s,i=n._a;switch(t){case"M":case"MM":i[1]=null==e?0:~~e-1;break;case"MMM":case"MMMM":s=_(n._l).monthsParse(e),null!=s?i[1]=s:n._isValid=!1;break;case"D":case"DD":case"DDD":case"DDDD":null!=e&&(i[2]=~~e);break;case"YY":i[0]=~~e+(~~e>68?1900:2e3);break;case"YYYY":case"YYYYY":i[0]=~~e;break;case"a":case"A":n._isPm=_(n._l).isPM(e);break;case"H":case"HH":case"h":case"hh":i[3]=~~e;break;case"m":case"mm":i[4]=~~e;break;case"s":case"ss":i[5]=~~e;break;case"S":case"SS":case"SSS":i[6]=~~(1e3*("0."+e));break;case"X":n._d=new Date(1e3*parseFloat(e));break;case"Z":case"ZZ":n._useUTC=!0,n._tzm=p(e)}null==e&&(n._isValid=!1)}function Y(t){var e,n,s=[];if(!t._d){for(e=0;7>e;e++)t._a[e]=s[e]=null==t._a[e]?2===e?1:0:t._a[e];s[3]+=~~((t._tzm||0)/60),s[4]+=~~((t._tzm||0)%60),n=new Date(0),t._useUTC?(n.setUTCFullYear(s[0],s[1],s[2]),n.setUTCHours(s[3],s[4],s[5],s[6])):(n.setFullYear(s[0],s[1],s[2]),n.setHours(s[3],s[4],s[5],s[6])),t._d=n}}function w(t){var e,n,s=t._f.match(E),i=t._i;for(t._a=[],e=0;eo&&(u=o,s=n);a(t,s)}function v(t){var e,n=t._i,s=K.exec(n);if(s){for(t._f="YYYY-MM-DD"+(s[2]||" "),e=0;4>e;e++)if(te[e][1].exec(n)){t._f+=te[e][0];break}j.exec(n)&&(t._f+=" Z"),w(t)}else t._d=new Date(n)}function T(e){var n=e._i,s=G.exec(n);n===t?e._d=new Date:s?e._d=new Date(+s[1]):"string"==typeof n?v(e):d(n)?(e._a=n.slice(0),Y(e)):e._d=n instanceof Date?new Date(+n):new Date(n)}function b(t,e,n,s,i){return i.relativeTime(e||1,!!n,t,s)}function S(t,e,n){var s=W(Math.abs(t)/1e3),i=W(s/60),r=W(i/60),a=W(r/24),o=W(a/365),u=45>s&&["s",s]||1===i&&["m"]||45>i&&["mm",i]||1===r&&["h"]||22>r&&["hh",r]||1===a&&["d"]||25>=a&&["dd",a]||45>=a&&["M"]||345>a&&["MM",W(a/30)]||1===o&&["y"]||["yy",o];return u[2]=e,u[3]=t>0,u[4]=n,b.apply({},u)}function F(t,e,n){var s,i=n-e,r=n-t.day();return r>i&&(r-=7),i-7>r&&(r+=7),s=H(t).add("d",r),{week:Math.ceil(s.dayOfYear()/7),year:s.year()}}function O(t){var e=t._i,n=t._f;return null===e||""===e?null:("string"==typeof e&&(t._i=e=_().preparse(e)),H.isMoment(e)?(t=a({},e),t._d=new Date(+e._d)):n?d(n)?k(t):w(t):T(t),new i(t))}function z(t,e){H.fn[t]=H.fn[t+"s"]=function(t){var n=this._isUTC?"UTC":"";return null!=t?(this._d["set"+n+e](t),H.updateOffset(this),this):this._d["get"+n+e]()}}function C(t){H.duration.fn[t]=function(){return this._data[t]}}function L(t,e){H.duration.fn["as"+t]=function(){return+this/e}}for(var H,P,U="2.1.0",W=Math.round,x={},A="undefined"!=typeof module&&module.exports,G=/^\/?Date\((\-?\d+)/i,Z=/(\-)?(\d*)?\.?(\d+)\:(\d+)\:(\d+)\.?(\d{3})?/,E=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,N=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,J=/\d\d?/,I=/\d{1,3}/,V=/\d{3}/,X=/\d{1,4}/,$=/[+\-]?\d{1,6}/,R=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,j=/Z|[\+\-]\d\d:?\d\d/i,q=/T/i,B=/[\+\-]?\d+(\.\d{1,3})?/,K=/^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,Q="YYYY-MM-DDTHH:mm:ssZ",te=[["HH:mm:ss.S",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],ee=/([\+\-]|\d\d)/gi,ne="Date|Hours|Minutes|Seconds|Milliseconds".split("|"),se={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},ie={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",w:"week",M:"month",y:"year"},re={},ae="DDD w W M D d".split(" "),oe="M D H h m s w W".split(" "),ue={M:function(){return this.month()+1},MMM:function(t){return this.lang().monthsShort(this,t)},MMMM:function(t){return this.lang().months(this,t)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(t){return this.lang().weekdaysMin(this,t)},ddd:function(t){return this.lang().weekdaysShort(this,t)},dddd:function(t){return this.lang().weekdays(this,t)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return u(this.year()%100,2)},YYYY:function(){return u(this.year(),4)},YYYYY:function(){return u(this.year(),5)},gg:function(){return u(this.weekYear()%100,2)},gggg:function(){return this.weekYear()},ggggg:function(){return u(this.weekYear(),5)},GG:function(){return u(this.isoWeekYear()%100,2)},GGGG:function(){return this.isoWeekYear()},GGGGG:function(){return u(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return u(~~(this.milliseconds()/10),2)},SSS:function(){return u(this.milliseconds(),3)},Z:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+u(~~(t/60),2)+":"+u(~~t%60,2)},ZZ:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+u(~~(10*t/6),4)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()}};ae.length;)P=ae.pop(),ue[P+"o"]=n(ue[P],P);for(;oe.length;)P=oe.pop(),ue[P+P]=e(ue[P],2);for(ue.DDDD=e(ue.DDD,3),s.prototype={set:function(t){var e,n;for(n in t)e=t[n],"function"==typeof e?this[n]=e:this["_"+n]=e},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(t){return this._months[t.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(t){return this._monthsShort[t.month()]},monthsParse:function(t){var e,n,s;for(this._monthsParse||(this._monthsParse=[]),e=0;12>e;e++)if(this._monthsParse[e]||(n=H([2e3,e]),s="^"+this.months(n,"")+"|^"+this.monthsShort(n,""),this._monthsParse[e]=new RegExp(s.replace(".",""),"i")),this._monthsParse[e].test(t))return e},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(t){return this._weekdays[t.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(t){return this._weekdaysShort[t.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(t){return this._weekdaysMin[t.day()]},weekdaysParse:function(t){var e,n,s;for(this._weekdaysParse||(this._weekdaysParse=[]),e=0;7>e;e++)if(this._weekdaysParse[e]||(n=H([2e3,1]).day(e),s="^"+this.weekdays(n,"")+"|^"+this.weekdaysShort(n,"")+"|^"+this.weekdaysMin(n,""),this._weekdaysParse[e]=new RegExp(s.replace(".",""),"i")),this._weekdaysParse[e].test(t))return e},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(t){var e=this._longDateFormat[t];return!e&&this._longDateFormat[t.toUpperCase()]&&(e=this._longDateFormat[t.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t]=e),e},isPM:function(t){return"p"===(t+"").toLowerCase()[0]},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(t,e){var n=this._calendar[t];return"function"==typeof n?n.apply(e):n},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(t,e,n,s){var i=this._relativeTime[n];return"function"==typeof i?i(t,e,n,s):i.replace(/%d/i,t)},pastFuture:function(t,e){var n=this._relativeTime[t>0?"future":"past"];return"function"==typeof n?n(e):n.replace(/%s/i,e)},ordinal:function(t){return this._ordinal.replace("%d",t)},_ordinal:"%d",preparse:function(t){return t},postformat:function(t){return t},week:function(t){return F(t,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6}},H=function(t,e,n){return O({_i:t,_f:e,_l:n,_isUTC:!1})},H.utc=function(t,e,n){return O({_useUTC:!0,_isUTC:!0,_l:n,_i:t,_f:e})},H.unix=function(t){return H(1e3*t)},H.duration=function(t,e){var n,s,i=H.isDuration(t),a="number"==typeof t,o=i?t._input:a?{}:t,u=Z.exec(t);return a?e?o[e]=t:o.milliseconds=t:u&&(n="-"===u[1]?-1:1,o={y:0,d:~~u[2]*n,h:~~u[3]*n,m:~~u[4]*n,s:~~u[5]*n,ms:~~u[6]*n}),s=new r(o),i&&t.hasOwnProperty("_lang")&&(s._lang=t._lang),s},H.version=U,H.defaultFormat=Q,H.updateOffset=function(){},H.lang=function(t,e){return t?(e?l(t,e):x[t]||_(t),H.duration.fn._lang=H.fn._lang=_(t),void 0):H.fn._lang._abbr},H.langData=function(t){return t&&t._lang&&t._lang._abbr&&(t=t._lang._abbr),_(t)},H.isMoment=function(t){return t instanceof i},H.isDuration=function(t){return t instanceof r},H.fn=i.prototype={clone:function(){return H(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){return M(H(this).utc(),"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var t=this;return[t.year(),t.month(),t.date(),t.hours(),t.minutes(),t.seconds(),t.milliseconds()]},isValid:function(){return null==this._isValid&&(this._isValid=this._a?!c(this._a,(this._isUTC?H.utc(this._a):H(this._a)).toArray()):!isNaN(this._d.getTime())),!!this._isValid},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(t){var e=M(this,t||H.defaultFormat);return this.lang().postformat(e)},add:function(t,e){var n;return n="string"==typeof t?H.duration(+e,t):H.duration(t,e),h(this,n,1),this},subtract:function(t,e){var n;return n="string"==typeof t?H.duration(+e,t):H.duration(t,e),h(this,n,-1),this},diff:function(t,e,n){var s,i,r=this._isUTC?H(t).zone(this._offset||0):H(t).local(),a=6e4*(this.zone()-r.zone());return e=f(e),"year"===e||"month"===e?(s=432e5*(this.daysInMonth()+r.daysInMonth()),i=12*(this.year()-r.year())+(this.month()-r.month()),i+=(this-H(this).startOf("month")-(r-H(r).startOf("month")))/s,i-=6e4*(this.zone()-H(this).startOf("month").zone()-(r.zone()-H(r).startOf("month").zone()))/s,"year"===e&&(i/=12)):(s=this-r,i="second"===e?s/1e3:"minute"===e?s/6e4:"hour"===e?s/36e5:"day"===e?(s-a)/864e5:"week"===e?(s-a)/6048e5:s),n?i:o(i)},from:function(t,e){return H.duration(this.diff(t)).lang(this.lang()._abbr).humanize(!e)},fromNow:function(t){return this.from(H(),t)},calendar:function(){var t=this.diff(H().startOf("day"),"days",!0),e=-6>t?"sameElse":-1>t?"lastWeek":0>t?"lastDay":1>t?"sameDay":2>t?"nextDay":7>t?"nextWeek":"sameElse";return this.format(this.lang().calendar(e,this))},isLeapYear:function(){var t=this.year();return 0===t%4&&0!==t%100||0===t%400},isDST:function(){return this.zone()+H(t).startOf(e)},isBefore:function(t,e){return e="undefined"!=typeof e?e:"millisecond",+this.clone().startOf(e)<+H(t).startOf(e)},isSame:function(t,e){return e="undefined"!=typeof e?e:"millisecond",+this.clone().startOf(e)===+H(t).startOf(e)},min:function(t){return t=H.apply(null,arguments),this>t?this:t},max:function(t){return t=H.apply(null,arguments),t>this?this:t},zone:function(t){var e=this._offset||0;return null==t?this._isUTC?e:this._d.getTimezoneOffset():("string"==typeof t&&(t=p(t)),Math.abs(t)<16&&(t=60*t),this._offset=t,this._isUTC=!0,e!==t&&h(this,H.duration(e-t,"m"),1,!0),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},daysInMonth:function(){return H.utc([this.year(),this.month()+1,0]).date()},dayOfYear:function(t){var e=W((H(this).startOf("day")-H(this).startOf("year"))/864e5)+1;return null==t?e:this.add("d",t-e)},weekYear:function(t){var e=F(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==t?e:this.add("y",t-e)},isoWeekYear:function(t){var e=F(this,1,4).year;return null==t?e:this.add("y",t-e)},week:function(t){var e=this.lang().week(this);return null==t?e:this.add("d",7*(t-e))},isoWeek:function(t){var e=F(this,1,4).week;return null==t?e:this.add("d",7*(t-e))},weekday:function(t){var e=(this._d.getDay()+7-this.lang()._week.dow)%7;return null==t?e:this.add("d",t-e)},isoWeekday:function(t){return null==t?this.day()||7:this.day(this.day()%7?t:t-7)},lang:function(e){return e===t?this._lang:(this._lang=_(e),this)}},P=0;P 0 && phantom.args[0] === "--verbose") { + verbose = true; + optIdx = 1; + } + if (phantom.args.length == optIdx + 1) { + var parts = phantom.args[optIdx].split('.'); + if (2 != parts.length) { + console.warn('Usage: phantomjs phantom-driver.js [--verbose] [testCase.test]'); + phantom.exit(); + } + testCase = parts[0]; + test = parts[1]; + } + + var loggingOn = false; + + page.onConsoleMessage = function (msg) { + if (msg == 'Running ' + test) { + loggingOn = true; + } else if (msg.substr(0, 'Running'.length) == 'Running') { + loggingOn = false; + } + if (verbose || loggingOn) console.log(msg); + }; + + page.onError = function (msg, trace) { + console.log(msg); + trace.forEach(function(item) { + console.log(' ', item.file, ':', item.line); + }) + }; + + var results; + + // Run all tests. + var start = new Date().getTime(); + results = page.evaluate(function() { + var num_passing = 0, num_failing = 0; + var failures = []; + // Phantom doesn't like stacktrace.js using the "arguments" object + // in stacktrace.js, which it interprets in strict mode. + printStackTrace = undefined; + + jstestdriver.attachListener({ + finish : function(tc, name, result, e) { + console.log("Result:", tc.name, name, result, e); + if (result) { + // console.log(testCase + '.' + test + ' passed'); + num_passing++; + } else { + num_failing++; + failures.push(tc.name + '.' + name); + } + } + }); + var testCases = getAllTestCases(); + for (var idx in testCases) { + var entry = testCases[idx]; + + var prototype = entry.testCase; + var tc = new entry.testCase(); + var result = tc.runAllTests(); + } + return { + num_passing : num_passing, + num_failing : num_failing, + failures : failures + }; + }); + var end = new Date().getTime(); + var elapsed = (end - start) / 1000; + + console.log('Ran ' + (results.num_passing + results.num_failing) + ' tests in ' + elapsed + 's.'); + console.log(results.num_passing + ' test(s) passed'); + console.log(results.num_failing + ' test(s) failed:'); + for (var i = 0; i < results.failures.length; i++) { + // TODO(danvk): print an auto_test/misc/local URL that runs this test. + console.log(' ' + results.failures[i] + ' failed.'); + } + + done_callback(results.num_failing, results.num_passing); +}); + +}; + +// Load all "tests/" pages. +var LoadAllManualTests = function(totally_done_callback) { + +var fs = require('fs'); +var tests = fs.list('tests'); +var pages = []; + +function make_barrier_closure(n, fn) { + var calls = 0; + return function() { + calls++; + if (calls == n) { + fn(); + } else { + // console.log('' + calls + ' done, ' + (n - calls) + ' remain'); + } + }; +} + +var tasks = []; +for (var i = 0; i < tests.length; i++) { + if (tests[i].substr(-5) != '.html') continue; + tasks.push(tests[i]); +} +tasks = [ 'independent-series.html' ]; + +var loaded_page = make_barrier_closure(tasks.length, function() { + // Wait 2 secs to allow JS errors to happen after page load. + setTimeout(function() { + var success = 0, failures = 0; + for (var i = 0; i < pages.length; i++) { + if (pages[i].success && !pages[i].hasErrors) { + success++; + } else { + failures++; + } + } + console.log('Successfully loaded ' + success + ' / ' + + (success + failures) + ' test pages.'); + totally_done_callback(failures, success); + }, 2000); +}); + + +for (var i = 0; i < tasks.length; i++) { + var url = 'file://' + fs.absolute('tests/' + tasks[i]); + pages.push(function(path, url) { + var page = require('webpage').create(); + page.success = false; + page.hasErrors = false; + page.onError = function (msg, trace) { + console.log(path + ': ' + msg); + page.hasErrors = true; + trace.forEach(function(item) { + console.log(' ', item.file, ':', item.line); + }); + }; + page.onLoadFinished = function(status) { + if (status == 'success') { + page.success = true; + } + if (!page.done) loaded_page(); + page.done = true; + }; + page.open(url); + return page; + }(tasks[i], url)); +} + +}; + + +// First run all auto_tests. +// If they all pass, load the manual tests. +RunAllAutoTests(function(num_failing, num_passing) { + if (num_failing !== 0) { + console.log('FAIL'); + phantom.exit(); + } else { + console.log('PASS'); + } + phantom.exit(); + + // This is not yet reliable enough to be useful: + /* + LoadAllManualTests(function(failing, passing) { + if (failing !== 0) { + console.log('FAIL'); + } else { + console.log('PASS'); + } + phantom.exit(); + }); + */ +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/phantom-perf.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/phantom-perf.js new file mode 100644 index 0000000..b98c3f0 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/phantom-perf.js @@ -0,0 +1,94 @@ +// dygraphs command-line performance benchmark. +// +// Invoke as: +// +// phantomjs phantom-perf.js 1000 100 5 +// +// If the test succeeds, it will print out something like: +// +// 1000/100/5: 1309.4+/-43.4 ms (1284, 1245, 1336, 1346, 1336) +// +// This is mean +/- standard deviation, followed by a list of the individual +// times for each repetition, in milliseconds. + +var system = require('system'), + fs = require('fs'); + +var tmpfile = "tmp-dygraph-test-params.js"; +var url = 'tests/dygraph-many-points-benchmark.html'; + +function fail(msg){ + console.warn(msg); + phantom.exit(1); +} + +function assert(condition, msg){ + if (condition) return; + fail(msg); +} + +var config_file_template = + "document.getElementById('points').value = (points);\n" + + "document.getElementById('series').value = (series);\n" + + "document.getElementById('repetitions').value = (repetitions);\n"; + +var RunBenchmark = function(points, series, repetitions, done_callback) { + var page = require('webpage').create(); + + // page.evalute() is seriously locked down. + // This was the only way I could find to pass the parameters to the page. + fs.write(tmpfile, + config_file_template + .replace("(points)", points) + .replace("(series)", series) + .replace("(repetitions)", repetitions), + "w"); + + page.open(url, function(status) { + if (status !== 'success') { + console.warn('Page status: ' + status); + console.log(page); + phantom.exit(); + } + + assert(page.injectJs(tmpfile), "Unable to inject JS."); + fs.remove(tmpfile); + + var start = new Date().getTime(); + var rep_times = page.evaluate(function() { + var rep_times = updatePlot(); + return rep_times; + }); + var end = new Date().getTime(); + var elapsed = (end - start) / 1000; + done_callback(rep_times); + }); +}; + + +var points, series, repetitions; +if (4 != system.args.length) { + console.warn('Usage: phantomjs phantom-driver.js (points) (series) (repititions)'); + phantom.exit(); +} + +points = parseInt(system.args[1]); +series = parseInt(system.args[2]); +repetitions = parseInt(system.args[3]); +assert(points != null, "Couldn't parse " + system.args[1]); +assert(series != null, "Couldn't parse " + system.args[2]); +assert(repetitions != null, "Couldn't parse " + system.args[3]); + + +RunBenchmark(points, series, repetitions, function(rep_times) { + var mean = 0.0, std = 0.0; + rep_times.forEach(function(x) { mean += x; } ); + mean /= rep_times.length; + rep_times.forEach(function(x) { std += Math.pow(x - mean, 2); }); + std = Math.sqrt(std / (rep_times.length - 1)); + + console.log(points + '/' + series + '/' + repetitions + ': ' + + mean.toFixed(1) + '+/-' + std.toFixed(1) + ' ms (' + + rep_times.join(', ') + ')'); + phantom.exit(); +}); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/README b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/README new file mode 100644 index 0000000..f216545 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/README @@ -0,0 +1,113 @@ +dygraphs plugins +---------------- + +A single dygraph is actually a collection of dygraphs plugins, each responsible +for some portion of the chart: the plot area, the axes, the legend, the labels, +etc. + +This forces the dygraphs code to be more modular and encourages better APIs. + +The "legend" plugin (plugins/legend.js) can be used as a template for new +plugins. + +Here is a simplified version of it, with comments to explain the plugin +lifecycle and APIs: + +---------------- + +// (standard JavaScript library wrapper; prevents polluting global namespace) +Dygraph.Plugins.Legend = (function() { + +// Plugin constructor. This is invoked once for every chart which uses the +// plugin. You can't actually access the Dygraph object at this point, so the +// initialization you do here shouldn't be chart-specific. (For that, use +// the activate() method). +var legend = function() { + this.div_ = null; +}; + +// Plugins are expected to implement this method for debugging purposes. +legend.toString = function() { + return "Legend"; +}; + +// This is called once the dygraph is ready. The chart data may not be +// available yet, but the options specified in the constructor are. +// +// Proper tasks to do here include: +// - Reading your own options +// - DOM manipulation +// - Registering event listeners +// +// "dygraph" is the Dygraph object for which this instance is being activated. +// "registerer" allows you to register event listeners. +legend.prototype.activate = function(dygraph, registerer) { + // Create the legend div and attach it to the chart DOM. + this.div_ = document.createElement("div"); + dygraph.graphDiv.appendChild(this.div_); + + // Add event listeners. These will be called whenever points are selected + // (i.e. you hover over them) or deselected (i.e. you mouse away from the + // chart). This is your only chance to register event listeners! Once this + // method returns, the gig is up. + registerer.addEventListener('select', legend.select); + registerer.addEventListener('deselect', legend.deselect); +}; + +// The functions called by event listeners all take a single parameter, an +// event object. This contains properties relevant to the particular event, but +// you can always assume that it has: +// +// 1. A "dygraph" parameter which is a reference to the chart on which the +// event took place. +// 2. A "stopPropagation" method, which you can call to prevent the event from +// being seen by any other plugins after you. This effectively cancels the +// event. +// 3. A "preventDefault" method, which prevents dygraphs from performing the +// default action associated with this event. +// +legend.select = function(e) { + // These are two of the properties specific to the "select" event object: + var xValue = e.selectedX; + var points = e.selectedPoints; + + var html = xValue + ':'; + for (var i = 0; i < points.length; i++) { + var point = points[i]; + html += ' ' + point.name + ':' + point.yval; + } + + // In an event listener, "this" refers to your plugin object. + this.div_.innerHTML = html; +}; + +// This clears out the legend when the user mouses away from the chart. +legend.deselect = function(e) { + this.div_.innerHTML = ''; +}; + +return legend; +})(); + +---------------- + +Plugin Events Reference: + +- predraw +- clearChart +- drawChart +- select +- deselect + +TODO(danvk): document all event properties for each event. + + +Special methods: +- (constructor) +- activate +- destroy + + +---------------- + +Notes on plugin registration and event cascade ordering/behavior. diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/annotations.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/annotations.js new file mode 100644 index 0000000..8576104 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/annotations.js @@ -0,0 +1,182 @@ +/** + * @license + * Copyright 2012 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/*global Dygraph:false */ + +Dygraph.Plugins.Annotations = (function() { + +"use strict"; + +/** +Current bits of jankiness: +- Uses dygraph.layout_ to get the parsed annotations. +- Uses dygraph.plotter_.area + +It would be nice if the plugin didn't require so much special support inside +the core dygraphs classes, but annotations involve quite a bit of parsing and +layout. + +TODO(danvk): cache DOM elements. + +*/ + +var annotations = function() { + this.annotations_ = []; +}; + +annotations.prototype.toString = function() { + return "Annotations Plugin"; +}; + +annotations.prototype.activate = function(g) { + return { + clearChart: this.clearChart, + didDrawChart: this.didDrawChart + }; +}; + +annotations.prototype.detachLabels = function() { + for (var i = 0; i < this.annotations_.length; i++) { + var a = this.annotations_[i]; + if (a.parentNode) a.parentNode.removeChild(a); + this.annotations_[i] = null; + } + this.annotations_ = []; +}; + +annotations.prototype.clearChart = function(e) { + this.detachLabels(); +}; + +annotations.prototype.didDrawChart = function(e) { + var g = e.dygraph; + + // Early out in the (common) case of zero annotations. + var points = g.layout_.annotated_points; + if (!points || points.length === 0) return; + + var containerDiv = e.canvas.parentNode; + var annotationStyle = { + "position": "absolute", + "fontSize": g.getOption('axisLabelFontSize') + "px", + "zIndex": 10, + "overflow": "hidden" + }; + + var bindEvt = function(eventName, classEventName, pt) { + return function(annotation_event) { + var a = pt.annotation; + if (a.hasOwnProperty(eventName)) { + a[eventName](a, pt, g, annotation_event); + } else if (g.getOption(classEventName)) { + g.getOption(classEventName)(a, pt, g, annotation_event ); + } + }; + }; + + // Add the annotations one-by-one. + var area = e.dygraph.plotter_.area; + + // x-coord to sum of previous annotation's heights (used for stacking). + var xToUsedHeight = {}; + + for (var i = 0; i < points.length; i++) { + var p = points[i]; + if (p.canvasx < area.x || p.canvasx > area.x + area.w || + p.canvasy < area.y || p.canvasy > area.y + area.h) { + continue; + } + + var a = p.annotation; + var tick_height = 6; + if (a.hasOwnProperty("tickHeight")) { + tick_height = a.tickHeight; + } + + var div = document.createElement("div"); + for (var name in annotationStyle) { + if (annotationStyle.hasOwnProperty(name)) { + div.style[name] = annotationStyle[name]; + } + } + if (!a.hasOwnProperty('icon')) { + div.className = "dygraphDefaultAnnotation"; + } + if (a.hasOwnProperty('cssClass')) { + div.className += " " + a.cssClass; + } + + var width = a.hasOwnProperty('width') ? a.width : 16; + var height = a.hasOwnProperty('height') ? a.height : 16; + if (a.hasOwnProperty('icon')) { + var img = document.createElement("img"); + img.src = a.icon; + img.width = width; + img.height = height; + div.appendChild(img); + } else if (p.annotation.hasOwnProperty('shortText')) { + div.appendChild(document.createTextNode(p.annotation.shortText)); + } + var left = p.canvasx - width / 2; + div.style.left = left + "px"; + var divTop = 0; + if (a.attachAtBottom) { + var y = (area.y + area.h - height - tick_height); + if (xToUsedHeight[left]) { + y -= xToUsedHeight[left]; + } else { + xToUsedHeight[left] = 0; + } + xToUsedHeight[left] += (tick_height + height); + divTop = y; + } else { + divTop = p.canvasy - height - tick_height; + } + div.style.top = divTop + "px"; + div.style.width = width + "px"; + div.style.height = height + "px"; + div.title = p.annotation.text; + div.style.color = g.colorsMap_[p.name]; + div.style.borderColor = g.colorsMap_[p.name]; + a.div = div; + + g.addAndTrackEvent(div, 'click', + bindEvt('clickHandler', 'annotationClickHandler', p, this)); + g.addAndTrackEvent(div, 'mouseover', + bindEvt('mouseOverHandler', 'annotationMouseOverHandler', p, this)); + g.addAndTrackEvent(div, 'mouseout', + bindEvt('mouseOutHandler', 'annotationMouseOutHandler', p, this)); + g.addAndTrackEvent(div, 'dblclick', + bindEvt('dblClickHandler', 'annotationDblClickHandler', p, this)); + + containerDiv.appendChild(div); + this.annotations_.push(div); + + var ctx = e.drawingContext; + ctx.save(); + ctx.strokeStyle = g.colorsMap_[p.name]; + ctx.beginPath(); + if (!a.attachAtBottom) { + ctx.moveTo(p.canvasx, p.canvasy); + ctx.lineTo(p.canvasx, p.canvasy - 2 - tick_height); + } else { + var y = divTop + height; + ctx.moveTo(p.canvasx, y); + ctx.lineTo(p.canvasx, y + tick_height); + } + ctx.closePath(); + ctx.stroke(); + ctx.restore(); + } +}; + +annotations.prototype.destroy = function() { + this.detachLabels(); +}; + +return annotations; + +})(); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/axes.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/axes.js new file mode 100644 index 0000000..cacda86 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/axes.js @@ -0,0 +1,315 @@ +/** + * @license + * Copyright 2012 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ + +/*global Dygraph:false */ + +Dygraph.Plugins.Axes = (function() { + +"use strict"; + +/* +Bits of jankiness: +- Direct layout access +- Direct area access +- Should include calculation of ticks, not just the drawing. + +Options left to make axis-friendly. + ('axisTickSize') + ('drawAxesAtZero') + ('xAxisHeight') + +These too. What is the difference between axisLablelWidth and {x,y}AxisLabelWidth? + ('axisLabelWidth') + ('xAxisLabelWidth') + ('yAxisLabelWidth') +*/ + +/** + * Draws the axes. This includes the labels on the x- and y-axes, as well + * as the tick marks on the axes. + * It does _not_ draw the grid lines which span the entire chart. + */ +var axes = function() { + this.xlabels_ = []; + this.ylabels_ = []; +}; + +axes.prototype.toString = function() { + return "Axes Plugin"; +}; + +axes.prototype.activate = function(g) { + return { + layout: this.layout, + clearChart: this.clearChart, + willDrawChart: this.willDrawChart + }; +}; + +axes.prototype.layout = function(e) { + var g = e.dygraph; + + if (g.getOption('drawYAxis')) { + var w = g.getOption('yAxisLabelWidth') + 2 * g.getOption('axisTickSize'); + e.reserveSpaceLeft(w); + } + + if (g.getOption('drawXAxis')) { + var h; + // NOTE: I think this is probably broken now, since g.getOption() now + // hits the dictionary. (That is, g.getOption('xAxisHeight') now always + // has a value.) + if (g.getOption('xAxisHeight')) { + h = g.getOption('xAxisHeight'); + } else { + h = g.getOptionForAxis('axisLabelFontSize', 'x') + 2 * g.getOption('axisTickSize'); + } + e.reserveSpaceBottom(h); + } + + if (g.numAxes() == 2) { + // TODO(danvk): introduce a 'drawAxis' per-axis property. + if (g.getOption('drawYAxis')) { + // TODO(danvk): per-axis setting. + var w = g.getOption('yAxisLabelWidth') + 2 * g.getOption('axisTickSize'); + e.reserveSpaceRight(w); + } + } else if (g.numAxes() > 2) { + g.error("Only two y-axes are supported at this time. (Trying " + + "to use " + g.numAxes() + ")"); + } +}; + +axes.prototype.detachLabels = function() { + function removeArray(ary) { + for (var i = 0; i < ary.length; i++) { + var el = ary[i]; + if (el.parentNode) el.parentNode.removeChild(el); + } + } + + removeArray(this.xlabels_); + removeArray(this.ylabels_); + this.xlabels_ = []; + this.ylabels_ = []; +}; + +axes.prototype.clearChart = function(e) { + this.detachLabels(); +}; + +axes.prototype.willDrawChart = function(e) { + var g = e.dygraph; + if (!g.getOption('drawXAxis') && !g.getOption('drawYAxis')) return; + + // Round pixels to half-integer boundaries for crisper drawing. + function halfUp(x) { return Math.round(x) + 0.5; } + function halfDown(y){ return Math.round(y) - 0.5; } + + var context = e.drawingContext; + var containerDiv = e.canvas.parentNode; + var canvasWidth = e.canvas.width; + var canvasHeight = e.canvas.height; + + var label, x, y, tick, i; + + var makeLabelStyle = function(axis) { + return { + position: "absolute", + fontSize: g.getOptionForAxis('axisLabelFontSize', axis) + "px", + zIndex: 10, + color: g.getOptionForAxis('axisLabelColor', axis), + width: g.getOption('axisLabelWidth') + "px", + // height: g.getOptionForAxis('axisLabelFontSize', 'x') + 2 + "px", + lineHeight: "normal", // Something other than "normal" line-height screws up label positioning. + overflow: "hidden" + }; + }; + + var labelStyles = { + x : makeLabelStyle('x'), + y : makeLabelStyle('y'), + y2 : makeLabelStyle('y2') + }; + + var makeDiv = function(txt, axis, prec_axis) { + /* + * This seems to be called with the following three sets of axis/prec_axis: + * x: undefined + * y: y1 + * y: y2 + */ + var div = document.createElement("div"); + var labelStyle = labelStyles[prec_axis == 'y2' ? 'y2' : axis]; + for (var name in labelStyle) { + if (labelStyle.hasOwnProperty(name)) { + div.style[name] = labelStyle[name]; + } + } + var inner_div = document.createElement("div"); + inner_div.className = 'dygraph-axis-label' + + ' dygraph-axis-label-' + axis + + (prec_axis ? ' dygraph-axis-label-' + prec_axis : ''); + inner_div.innerHTML = txt; + div.appendChild(inner_div); + return div; + }; + + // axis lines + context.save(); + + var layout = g.layout_; + var area = e.dygraph.plotter_.area; + + if (g.getOption('drawYAxis')) { + if (layout.yticks && layout.yticks.length > 0) { + var num_axes = g.numAxes(); + for (i = 0; i < layout.yticks.length; i++) { + tick = layout.yticks[i]; + if (typeof(tick) == "function") return; + x = area.x; + var sgn = 1; + var prec_axis = 'y1'; + if (tick[0] == 1) { // right-side y-axis + x = area.x + area.w; + sgn = -1; + prec_axis = 'y2'; + } + var fontSize = g.getOptionForAxis('axisLabelFontSize', prec_axis); + y = area.y + tick[1] * area.h; + + /* Tick marks are currently clipped, so don't bother drawing them. + context.beginPath(); + context.moveTo(halfUp(x), halfDown(y)); + context.lineTo(halfUp(x - sgn * this.attr_('axisTickSize')), halfDown(y)); + context.closePath(); + context.stroke(); + */ + + label = makeDiv(tick[2], 'y', num_axes == 2 ? prec_axis : null); + var top = (y - fontSize / 2); + if (top < 0) top = 0; + + if (top + fontSize + 3 > canvasHeight) { + label.style.bottom = "0px"; + } else { + label.style.top = top + "px"; + } + if (tick[0] === 0) { + label.style.left = (area.x - g.getOption('yAxisLabelWidth') - g.getOption('axisTickSize')) + "px"; + label.style.textAlign = "right"; + } else if (tick[0] == 1) { + label.style.left = (area.x + area.w + + g.getOption('axisTickSize')) + "px"; + label.style.textAlign = "left"; + } + label.style.width = g.getOption('yAxisLabelWidth') + "px"; + containerDiv.appendChild(label); + this.ylabels_.push(label); + } + + // The lowest tick on the y-axis often overlaps with the leftmost + // tick on the x-axis. Shift the bottom tick up a little bit to + // compensate if necessary. + var bottomTick = this.ylabels_[0]; + // Interested in the y2 axis also? + var fontSize = g.getOptionForAxis('axisLabelFontSize', "y"); + var bottom = parseInt(bottomTick.style.top, 10) + fontSize; + if (bottom > canvasHeight - fontSize) { + bottomTick.style.top = (parseInt(bottomTick.style.top, 10) - + fontSize / 2) + "px"; + } + } + + // draw a vertical line on the left to separate the chart from the labels. + var axisX; + if (g.getOption('drawAxesAtZero')) { + var r = g.toPercentXCoord(0); + if (r > 1 || r < 0 || isNaN(r)) r = 0; + axisX = halfUp(area.x + r * area.w); + } else { + axisX = halfUp(area.x); + } + + context.strokeStyle = g.getOptionForAxis('axisLineColor', 'y'); + context.lineWidth = g.getOptionForAxis('axisLineWidth', 'y'); + + context.beginPath(); + context.moveTo(axisX, halfDown(area.y)); + context.lineTo(axisX, halfDown(area.y + area.h)); + context.closePath(); + context.stroke(); + + // if there's a secondary y-axis, draw a vertical line for that, too. + if (g.numAxes() == 2) { + context.strokeStyle = g.getOptionForAxis('axisLineColor', 'y2'); + context.lineWidth = g.getOptionForAxis('axisLineWidth', 'y2'); + context.beginPath(); + context.moveTo(halfDown(area.x + area.w), halfDown(area.y)); + context.lineTo(halfDown(area.x + area.w), halfDown(area.y + area.h)); + context.closePath(); + context.stroke(); + } + } + + if (g.getOption('drawXAxis')) { + if (layout.xticks) { + for (i = 0; i < layout.xticks.length; i++) { + tick = layout.xticks[i]; + x = area.x + tick[0] * area.w; + y = area.y + area.h; + + /* Tick marks are currently clipped, so don't bother drawing them. + context.beginPath(); + context.moveTo(halfUp(x), halfDown(y)); + context.lineTo(halfUp(x), halfDown(y + this.attr_('axisTickSize'))); + context.closePath(); + context.stroke(); + */ + + label = makeDiv(tick[1], 'x'); + label.style.textAlign = "center"; + label.style.top = (y + g.getOption('axisTickSize')) + 'px'; + + var left = (x - g.getOption('axisLabelWidth')/2); + if (left + g.getOption('axisLabelWidth') > canvasWidth) { + left = canvasWidth - g.getOption('xAxisLabelWidth'); + label.style.textAlign = "right"; + } + if (left < 0) { + left = 0; + label.style.textAlign = "left"; + } + + label.style.left = left + "px"; + label.style.width = g.getOption('xAxisLabelWidth') + "px"; + containerDiv.appendChild(label); + this.xlabels_.push(label); + } + } + + context.strokeStyle = g.getOptionForAxis('axisLineColor', 'x'); + context.lineWidth = g.getOptionForAxis('axisLineWidth', 'x'); + context.beginPath(); + var axisY; + if (g.getOption('drawAxesAtZero')) { + var r = g.toPercentYCoord(0, 0); + if (r > 1 || r < 0) r = 1; + axisY = halfDown(area.y + r * area.h); + } else { + axisY = halfDown(area.y + area.h); + } + context.moveTo(halfUp(area.x), axisY); + context.lineTo(halfUp(area.x + area.w), axisY); + context.closePath(); + context.stroke(); + } + + context.restore(); +}; + +return axes; +})(); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/chart-labels.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/chart-labels.js new file mode 100644 index 0000000..da231d8 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/chart-labels.js @@ -0,0 +1,202 @@ +/** + * @license + * Copyright 2012 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ +/*global Dygraph:false */ + +Dygraph.Plugins.ChartLabels = (function() { + +"use strict"; + +// TODO(danvk): move chart label options out of dygraphs and into the plugin. +// TODO(danvk): only tear down & rebuild the DIVs when it's necessary. + +var chart_labels = function() { + this.title_div_ = null; + this.xlabel_div_ = null; + this.ylabel_div_ = null; + this.y2label_div_ = null; +}; + +chart_labels.prototype.toString = function() { + return "ChartLabels Plugin"; +}; + +chart_labels.prototype.activate = function(g) { + return { + layout: this.layout, + // clearChart: this.clearChart, + didDrawChart: this.didDrawChart + }; +}; + +// QUESTION: should there be a plugin-utils.js? +var createDivInRect = function(r) { + var div = document.createElement('div'); + div.style.position = 'absolute'; + div.style.left = r.x + 'px'; + div.style.top = r.y + 'px'; + div.style.width = r.w + 'px'; + div.style.height = r.h + 'px'; + return div; +}; + +// Detach and null out any existing nodes. +chart_labels.prototype.detachLabels_ = function() { + var els = [ this.title_div_, + this.xlabel_div_, + this.ylabel_div_, + this.y2label_div_ ]; + for (var i = 0; i < els.length; i++) { + var el = els[i]; + if (!el) continue; + if (el.parentNode) el.parentNode.removeChild(el); + } + + this.title_div_ = null; + this.xlabel_div_ = null; + this.ylabel_div_ = null; + this.y2label_div_ = null; +}; + +var createRotatedDiv = function(g, box, axis, classes, html) { + // TODO(danvk): is this outer div actually necessary? + var div = document.createElement("div"); + div.style.position = 'absolute'; + if (axis == 1) { + // NOTE: this is cheating. Should be positioned relative to the box. + div.style.left = '0px'; + } else { + div.style.left = box.x + 'px'; + } + div.style.top = box.y + 'px'; + div.style.width = box.w + 'px'; + div.style.height = box.h + 'px'; + div.style.fontSize = (g.getOption('yLabelWidth') - 2) + 'px'; + + var inner_div = document.createElement("div"); + inner_div.style.position = 'absolute'; + inner_div.style.width = box.h + 'px'; + inner_div.style.height = box.w + 'px'; + inner_div.style.top = (box.h / 2 - box.w / 2) + 'px'; + inner_div.style.left = (box.w / 2 - box.h / 2) + 'px'; + inner_div.style.textAlign = 'center'; + + // CSS rotation is an HTML5 feature which is not standardized. Hence every + // browser has its own name for the CSS style. + var val = 'rotate(' + (axis == 1 ? '-' : '') + '90deg)'; + inner_div.style.transform = val; // HTML5 + inner_div.style.WebkitTransform = val; // Safari/Chrome + inner_div.style.MozTransform = val; // Firefox + inner_div.style.OTransform = val; // Opera + inner_div.style.msTransform = val; // IE9 + + if (typeof(document.documentMode) !== 'undefined' && + document.documentMode < 9) { + // We're dealing w/ an old version of IE, so we have to rotate the text + // using a BasicImage transform. This uses a different origin of rotation + // than HTML5 rotation (top left of div vs. its center). + inner_div.style.filter = + 'progid:DXImageTransform.Microsoft.BasicImage(rotation=' + + (axis == 1 ? '3' : '1') + ')'; + inner_div.style.left = '0px'; + inner_div.style.top = '0px'; + } + + var class_div = document.createElement("div"); + class_div.className = classes; + class_div.innerHTML = html; + + inner_div.appendChild(class_div); + div.appendChild(inner_div); + return div; +}; + +chart_labels.prototype.layout = function(e) { + this.detachLabels_(); + + var g = e.dygraph; + var div = e.chart_div; + if (g.getOption('title')) { + // QUESTION: should this return an absolutely-positioned div instead? + var title_rect = e.reserveSpaceTop(g.getOption('titleHeight')); + this.title_div_ = createDivInRect(title_rect); + this.title_div_.style.textAlign = 'center'; + this.title_div_.style.fontSize = (g.getOption('titleHeight') - 8) + 'px'; + this.title_div_.style.fontWeight = 'bold'; + this.title_div_.style.zIndex = 10; + + var class_div = document.createElement("div"); + class_div.className = 'dygraph-label dygraph-title'; + class_div.innerHTML = g.getOption('title'); + this.title_div_.appendChild(class_div); + div.appendChild(this.title_div_); + } + + if (g.getOption('xlabel')) { + var x_rect = e.reserveSpaceBottom(g.getOption('xLabelHeight')); + this.xlabel_div_ = createDivInRect(x_rect); + this.xlabel_div_.style.textAlign = 'center'; + this.xlabel_div_.style.fontSize = (g.getOption('xLabelHeight') - 2) + 'px'; + + var class_div = document.createElement("div"); + class_div.className = 'dygraph-label dygraph-xlabel'; + class_div.innerHTML = g.getOption('xlabel'); + this.xlabel_div_.appendChild(class_div); + div.appendChild(this.xlabel_div_); + } + + if (g.getOption('ylabel')) { + // It would make sense to shift the chart here to make room for the y-axis + // label, but the default yAxisLabelWidth is large enough that this results + // in overly-padded charts. The y-axis label should fit fine. If it + // doesn't, the yAxisLabelWidth option can be increased. + var y_rect = e.reserveSpaceLeft(0); + + this.ylabel_div_ = createRotatedDiv( + g, y_rect, + 1, // primary (left) y-axis + 'dygraph-label dygraph-ylabel', + g.getOption('ylabel')); + div.appendChild(this.ylabel_div_); + } + + if (g.getOption('y2label') && g.numAxes() == 2) { + // same logic applies here as for ylabel. + var y2_rect = e.reserveSpaceRight(0); + this.y2label_div_ = createRotatedDiv( + g, y2_rect, + 2, // secondary (right) y-axis + 'dygraph-label dygraph-y2label', + g.getOption('y2label')); + div.appendChild(this.y2label_div_); + } +}; + +chart_labels.prototype.didDrawChart = function(e) { + var g = e.dygraph; + if (this.title_div_) { + this.title_div_.children[0].innerHTML = g.getOption('title'); + } + if (this.xlabel_div_) { + this.xlabel_div_.children[0].innerHTML = g.getOption('xlabel'); + } + if (this.ylabel_div_) { + this.ylabel_div_.children[0].children[0].innerHTML = g.getOption('ylabel'); + } + if (this.y2label_div_) { + this.y2label_div_.children[0].children[0].innerHTML = g.getOption('y2label'); + } +}; + +chart_labels.prototype.clearChart = function() { +}; + +chart_labels.prototype.destroy = function() { + this.detachLabels_(); +}; + + +return chart_labels; +})(); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/grid.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/grid.js new file mode 100644 index 0000000..425d93f --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/grid.js @@ -0,0 +1,124 @@ +/** + * @license + * Copyright 2012 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ +/*global Dygraph:false */ + +Dygraph.Plugins.Grid = (function() { + +/* + +Current bits of jankiness: +- Direct layout access +- Direct area access + +*/ + +"use strict"; + + +/** + * Draws the gridlines, i.e. the gray horizontal & vertical lines running the + * length of the chart. + * + * @constructor + */ +var grid = function() { +}; + +grid.prototype.toString = function() { + return "Gridline Plugin"; +}; + +grid.prototype.activate = function(g) { + return { + willDrawChart: this.willDrawChart + }; +}; + +grid.prototype.willDrawChart = function(e) { + // Draw the new X/Y grid. Lines appear crisper when pixels are rounded to + // half-integers. This prevents them from drawing in two rows/cols. + var g = e.dygraph; + var ctx = e.drawingContext; + var layout = g.layout_; + var area = e.dygraph.plotter_.area; + + function halfUp(x) { return Math.round(x) + 0.5; } + function halfDown(y){ return Math.round(y) - 0.5; } + + var x, y, i, ticks; + if (g.getOption('drawYGrid')) { + var axes = ["y", "y2"]; + var strokeStyles = [], lineWidths = [], drawGrid = [], stroking = [], strokePattern = []; + for (var i = 0; i < axes.length; i++) { + drawGrid[i] = g.getOptionForAxis("drawGrid", axes[i]); + if (drawGrid[i]) { + strokeStyles[i] = g.getOptionForAxis('gridLineColor', axes[i]); + lineWidths[i] = g.getOptionForAxis('gridLineWidth', axes[i]); + strokePattern[i] = g.getOptionForAxis('gridLinePattern', axes[i]); + stroking[i] = strokePattern[i] && (strokePattern[i].length >= 2); + } + } + ticks = layout.yticks; + ctx.save(); + // draw grids for the different y axes + for (i = 0; i < ticks.length; i++) { + var axis = ticks[i][0]; + if(drawGrid[axis]) { + if (stroking[axis]) { + ctx.installPattern(strokePattern[axis]); + } + ctx.strokeStyle = strokeStyles[axis]; + ctx.lineWidth = lineWidths[axis]; + + x = halfUp(area.x); + y = halfDown(area.y + ticks[i][1] * area.h); + ctx.beginPath(); + ctx.moveTo(x, y); + ctx.lineTo(x + area.w, y); + ctx.closePath(); + ctx.stroke(); + + if (stroking[axis]) { + ctx.uninstallPattern(); + } + } + } + ctx.restore(); + } + + // draw grid for x axis + if (g.getOption('drawXGrid') && g.getOptionForAxis("drawGrid", 'x')) { + ticks = layout.xticks; + ctx.save(); + var strokePattern = g.getOptionForAxis('gridLinePattern', 'x'); + var stroking = strokePattern && (strokePattern.length >= 2); + if (stroking) { + ctx.installPattern(strokePattern); + } + ctx.strokeStyle = g.getOptionForAxis('gridLineColor', 'x'); + ctx.lineWidth = g.getOptionForAxis('gridLineWidth', 'x'); + for (i = 0; i < ticks.length; i++) { + x = halfUp(area.x + ticks[i][0] * area.w); + y = halfDown(area.y + area.h); + ctx.beginPath(); + ctx.moveTo(x, y); + ctx.lineTo(x, area.y); + ctx.closePath(); + ctx.stroke(); + } + if (stroking) { + ctx.uninstallPattern(); + } + ctx.restore(); + } +}; + +grid.prototype.destroy = function() { +}; + +return grid; + +})(); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/legend.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/legend.js new file mode 100644 index 0000000..7406f82 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/legend.js @@ -0,0 +1,332 @@ +/** + * @license + * Copyright 2012 Dan Vanderkam (danvdk@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ +/*global Dygraph:false */ + +Dygraph.Plugins.Legend = (function() { +/* + +Current bits of jankiness: +- Uses two private APIs: + 1. Dygraph.optionsViewForAxis_ + 2. dygraph.plotter_.area +- Registers for a "predraw" event, which should be renamed. +- I call calculateEmWidthInDiv more often than needed. + +*/ + +/*jshint globalstrict: true */ +/*global Dygraph:false */ +"use strict"; + + +/** + * Creates the legend, which appears when the user hovers over the chart. + * The legend can be either a user-specified or generated div. + * + * @constructor + */ +var legend = function() { + this.legend_div_ = null; + this.is_generated_div_ = false; // do we own this div, or was it user-specified? +}; + +legend.prototype.toString = function() { + return "Legend Plugin"; +}; + +// (defined below) +var generateLegendHTML, generateLegendDashHTML; + +/** + * This is called during the dygraph constructor, after options have been set + * but before the data is available. + * + * Proper tasks to do here include: + * - Reading your own options + * - DOM manipulation + * - Registering event listeners + * + * @param {Dygraph} g Graph instance. + * @return {object.} Mapping of event names to callbacks. + */ +legend.prototype.activate = function(g) { + var div; + var divWidth = g.getOption('labelsDivWidth'); + + var userLabelsDiv = g.getOption('labelsDiv'); + if (userLabelsDiv && null !== userLabelsDiv) { + if (typeof(userLabelsDiv) == "string" || userLabelsDiv instanceof String) { + div = document.getElementById(userLabelsDiv); + } else { + div = userLabelsDiv; + } + } else { + // Default legend styles. These can be overridden in CSS by adding + // "!important" after your rule, e.g. "left: 30px !important;" + var messagestyle = { + "position": "absolute", + "fontSize": "14px", + "zIndex": 10, + "width": divWidth + "px", + "top": "0px", + "left": (g.size().width - divWidth - 2) + "px", + "background": "white", + "lineHeight": "normal", + "textAlign": "left", + "overflow": "hidden"}; + + // TODO(danvk): get rid of labelsDivStyles? CSS is better. + Dygraph.update(messagestyle, g.getOption('labelsDivStyles')); + div = document.createElement("div"); + div.className = "dygraph-legend"; + for (var name in messagestyle) { + if (!messagestyle.hasOwnProperty(name)) continue; + + try { + div.style[name] = messagestyle[name]; + } catch (e) { + this.warn("You are using unsupported css properties for your " + + "browser in labelsDivStyles"); + } + } + + // TODO(danvk): come up with a cleaner way to expose this. + g.graphDiv.appendChild(div); + this.is_generated_div_ = true; + } + + this.legend_div_ = div; + this.one_em_width_ = 10; // just a guess, will be updated. + + return { + select: this.select, + deselect: this.deselect, + // TODO(danvk): rethink the name "predraw" before we commit to it in any API. + predraw: this.predraw, + didDrawChart: this.didDrawChart + }; +}; + +// Needed for dashed lines. +var calculateEmWidthInDiv = function(div) { + var sizeSpan = document.createElement('span'); + sizeSpan.setAttribute('style', 'margin: 0; padding: 0 0 0 1em; border: 0;'); + div.appendChild(sizeSpan); + var oneEmWidth=sizeSpan.offsetWidth; + div.removeChild(sizeSpan); + return oneEmWidth; +}; + +legend.prototype.select = function(e) { + var xValue = e.selectedX; + var points = e.selectedPoints; + + var html = generateLegendHTML(e.dygraph, xValue, points, this.one_em_width_); + this.legend_div_.innerHTML = html; +}; + +legend.prototype.deselect = function(e) { + // Have to do this every time, since styles might have changed. + var oneEmWidth = calculateEmWidthInDiv(this.legend_div_); + this.one_em_width_ = oneEmWidth; + + var html = generateLegendHTML(e.dygraph, undefined, undefined, oneEmWidth); + this.legend_div_.innerHTML = html; +}; + +legend.prototype.didDrawChart = function(e) { + this.deselect(e); +}; + +// Right edge should be flush with the right edge of the charting area (which +// may not be the same as the right edge of the div, if we have two y-axes. +// TODO(danvk): is any of this really necessary? Could just set "right" in "activate". +/** + * Position the labels div so that: + * - its right edge is flush with the right edge of the charting area + * - its top edge is flush with the top edge of the charting area + * @private + */ +legend.prototype.predraw = function(e) { + // Don't touch a user-specified labelsDiv. + if (!this.is_generated_div_) return; + + // TODO(danvk): only use real APIs for this. + e.dygraph.graphDiv.appendChild(this.legend_div_); + var area = e.dygraph.plotter_.area; + var labelsDivWidth = e.dygraph.getOption("labelsDivWidth"); + this.legend_div_.style.left = area.x + area.w - labelsDivWidth - 1 + "px"; + this.legend_div_.style.top = area.y + "px"; + this.legend_div_.style.width = labelsDivWidth + "px"; +}; + +/** + * Called when dygraph.destroy() is called. + * You should null out any references and detach any DOM elements. + */ +legend.prototype.destroy = function() { + this.legend_div_ = null; +}; + +/** + * @private + * Generates HTML for the legend which is displayed when hovering over the + * chart. If no selected points are specified, a default legend is returned + * (this may just be the empty string). + * @param { Number } [x] The x-value of the selected points. + * @param { [Object] } [sel_points] List of selected points for the given + * x-value. Should have properties like 'name', 'yval' and 'canvasy'. + * @param { Number } [oneEmWidth] The pixel width for 1em in the legend. Only + * relevant when displaying a legend with no selection (i.e. {legend: + * 'always'}) and with dashed lines. + */ +generateLegendHTML = function(g, x, sel_points, oneEmWidth) { + // TODO(danvk): deprecate this option in place of {legend: 'never'} + if (g.getOption('showLabelsOnHighlight') !== true) return ''; + + // If no points are selected, we display a default legend. Traditionally, + // this has been blank. But a better default would be a conventional legend, + // which provides essential information for a non-interactive chart. + var html, sepLines, i, dash, strokePattern; + var labels = g.getLabels(); + + if (typeof(x) === 'undefined') { + if (g.getOption('legend') != 'always') { + return ''; + } + + sepLines = g.getOption('labelsSeparateLines'); + html = ''; + for (i = 1; i < labels.length; i++) { + var series = g.getPropertiesForSeries(labels[i]); + if (!series.visible) continue; + + if (html !== '') html += (sepLines ? '
          ' : ' '); + strokePattern = g.getOption("strokePattern", labels[i]); + dash = generateLegendDashHTML(strokePattern, series.color, oneEmWidth); + html += "" + + dash + " " + labels[i] + ""; + } + return html; + } + + // TODO(danvk): remove this use of a private API + var xOptView = g.optionsViewForAxis_('x'); + var xvf = xOptView('valueFormatter'); + html = xvf(x, xOptView, labels[0], g); + if (html !== '') { + html += ':'; + } + + var yOptViews = []; + var num_axes = g.numAxes(); + for (i = 0; i < num_axes; i++) { + // TODO(danvk): remove this use of a private API + yOptViews[i] = g.optionsViewForAxis_('y' + (i ? 1 + i : '')); + } + var showZeros = g.getOption("labelsShowZeroValues"); + sepLines = g.getOption("labelsSeparateLines"); + var highlightSeries = g.getHighlightSeries(); + for (i = 0; i < sel_points.length; i++) { + var pt = sel_points[i]; + if (pt.yval === 0 && !showZeros) continue; + if (!Dygraph.isOK(pt.canvasy)) continue; + if (sepLines) html += "
          "; + + var series = g.getPropertiesForSeries(pt.name); + var yOptView = yOptViews[series.axis - 1]; + var fmtFunc = yOptView('valueFormatter'); + var yval = fmtFunc(pt.yval, yOptView, pt.name, g); + + var cls = (pt.name == highlightSeries) ? " class='highlight'" : ""; + + // TODO(danvk): use a template string here and make it an attribute. + html += "" + " " + + pt.name + ": " + yval + ""; + } + return html; +}; + + +/** + * Generates html for the "dash" displayed on the legend when using "legend: always". + * In particular, this works for dashed lines with any stroke pattern. It will + * try to scale the pattern to fit in 1em width. Or if small enough repeat the + * pattern for 1em width. + * + * @param strokePattern The pattern + * @param color The color of the series. + * @param oneEmWidth The width in pixels of 1em in the legend. + * @private + */ +generateLegendDashHTML = function(strokePattern, color, oneEmWidth) { + // IE 7,8 fail at these divs, so they get boring legend, have not tested 9. + var isIE = (/MSIE/.test(navigator.userAgent) && !window.opera); + if (isIE) return "—"; + + // Easy, common case: a solid line + if (!strokePattern || strokePattern.length <= 1) { + return "
          "; + } + + var i, j, paddingLeft, marginRight; + var strokePixelLength = 0, segmentLoop = 0; + var normalizedPattern = []; + var loop; + + // Compute the length of the pixels including the first segment twice, + // since we repeat it. + for (i = 0; i <= strokePattern.length; i++) { + strokePixelLength += strokePattern[i%strokePattern.length]; + } + + // See if we can loop the pattern by itself at least twice. + loop = Math.floor(oneEmWidth/(strokePixelLength-strokePattern[0])); + if (loop > 1) { + // This pattern fits at least two times, no scaling just convert to em; + for (i = 0; i < strokePattern.length; i++) { + normalizedPattern[i] = strokePattern[i]/oneEmWidth; + } + // Since we are repeating the pattern, we don't worry about repeating the + // first segment in one draw. + segmentLoop = normalizedPattern.length; + } else { + // If the pattern doesn't fit in the legend we scale it to fit. + loop = 1; + for (i = 0; i < strokePattern.length; i++) { + normalizedPattern[i] = strokePattern[i]/strokePixelLength; + } + // For the scaled patterns we do redraw the first segment. + segmentLoop = normalizedPattern.length+1; + } + + // Now make the pattern. + var dash = ""; + for (j = 0; j < loop; j++) { + for (i = 0; i < segmentLoop; i+=2) { + // The padding is the drawn segment. + paddingLeft = normalizedPattern[i%normalizedPattern.length]; + if (i < strokePattern.length) { + // The margin is the space segment. + marginRight = normalizedPattern[(i+1)%normalizedPattern.length]; + } else { + // The repeated first segment has no right margin. + marginRight = 0; + } + dash += "
          "; + } + } + return dash; +}; + + +return legend; +})(); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/range-selector.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/range-selector.js new file mode 100644 index 0000000..089e64a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/plugins/range-selector.js @@ -0,0 +1,852 @@ +/** + * @license + * Copyright 2011 Paul Felix (paul.eric.felix@gmail.com) + * MIT-licensed (http://opensource.org/licenses/MIT) + */ +/*global Dygraph:false,TouchEvent:false */ + +/** + * @fileoverview This file contains the RangeSelector plugin used to provide + * a timeline range selector widget for dygraphs. + */ + +Dygraph.Plugins.RangeSelector = (function() { + +/*jshint globalstrict: true */ +/*global Dygraph:false */ +"use strict"; + +var rangeSelector = function() { + this.isIE_ = /MSIE/.test(navigator.userAgent) && !window.opera; + this.hasTouchInterface_ = typeof(TouchEvent) != 'undefined'; + this.isMobileDevice_ = /mobile|android/gi.test(navigator.appVersion); + this.interfaceCreated_ = false; +}; + +rangeSelector.prototype.toString = function() { + return "RangeSelector Plugin"; +}; + +rangeSelector.prototype.activate = function(dygraph) { + this.dygraph_ = dygraph; + this.isUsingExcanvas_ = dygraph.isUsingExcanvas_; + if (this.getOption_('showRangeSelector')) { + this.createInterface_(); + } + return { + layout: this.reserveSpace_, + predraw: this.renderStaticLayer_, + didDrawChart: this.renderInteractiveLayer_ + }; +}; + +rangeSelector.prototype.destroy = function() { + this.bgcanvas_ = null; + this.fgcanvas_ = null; + this.leftZoomHandle_ = null; + this.rightZoomHandle_ = null; + this.iePanOverlay_ = null; +}; + +//------------------------------------------------------------------ +// Private methods +//------------------------------------------------------------------ + +rangeSelector.prototype.getOption_ = function(name) { + return this.dygraph_.getOption(name); +}; + +rangeSelector.prototype.setDefaultOption_ = function(name, value) { + return this.dygraph_.attrs_[name] = value; +}; + +/** + * @private + * Creates the range selector elements and adds them to the graph. + */ +rangeSelector.prototype.createInterface_ = function() { + this.createCanvases_(); + if (this.isUsingExcanvas_) { + this.createIEPanOverlay_(); + } + this.createZoomHandles_(); + this.initInteraction_(); + + // Range selector and animatedZooms have a bad interaction. See issue 359. + if (this.getOption_('animatedZooms')) { + this.dygraph_.warn('Animated zooms and range selector are not compatible; disabling animatedZooms.'); + this.dygraph_.updateOptions({animatedZooms: false}, true); + } + + this.interfaceCreated_ = true; + this.addToGraph_(); +}; + +/** + * @private + * Adds the range selector to the graph. + */ +rangeSelector.prototype.addToGraph_ = function() { + var graphDiv = this.graphDiv_ = this.dygraph_.graphDiv; + graphDiv.appendChild(this.bgcanvas_); + graphDiv.appendChild(this.fgcanvas_); + graphDiv.appendChild(this.leftZoomHandle_); + graphDiv.appendChild(this.rightZoomHandle_); +}; + +/** + * @private + * Removes the range selector from the graph. + */ +rangeSelector.prototype.removeFromGraph_ = function() { + var graphDiv = this.graphDiv_; + graphDiv.removeChild(this.bgcanvas_); + graphDiv.removeChild(this.fgcanvas_); + graphDiv.removeChild(this.leftZoomHandle_); + graphDiv.removeChild(this.rightZoomHandle_); + this.graphDiv_ = null; +}; + +/** + * @private + * Called by Layout to allow range selector to reserve its space. + */ +rangeSelector.prototype.reserveSpace_ = function(e) { + if (this.getOption_('showRangeSelector')) { + e.reserveSpaceBottom(this.getOption_('rangeSelectorHeight') + 4); + } +}; + +/** + * @private + * Renders the static portion of the range selector at the predraw stage. + */ +rangeSelector.prototype.renderStaticLayer_ = function() { + if (!this.updateVisibility_()) { + return; + } + this.resize_(); + this.drawStaticLayer_(); +}; + +/** + * @private + * Renders the interactive portion of the range selector after the chart has been drawn. + */ +rangeSelector.prototype.renderInteractiveLayer_ = function() { + if (!this.updateVisibility_() || this.isChangingRange_) { + return; + } + this.placeZoomHandles_(); + this.drawInteractiveLayer_(); +}; + +/** + * @private + * Check to see if the range selector is enabled/disabled and update visibility accordingly. + */ +rangeSelector.prototype.updateVisibility_ = function() { + var enabled = this.getOption_('showRangeSelector'); + if (enabled) { + if (!this.interfaceCreated_) { + this.createInterface_(); + } else if (!this.graphDiv_ || !this.graphDiv_.parentNode) { + this.addToGraph_(); + } + } else if (this.graphDiv_) { + this.removeFromGraph_(); + var dygraph = this.dygraph_; + setTimeout(function() { dygraph.width_ = 0; dygraph.resize(); }, 1); + } + return enabled; +}; + +/** + * @private + * Resizes the range selector. + */ +rangeSelector.prototype.resize_ = function() { + function setElementRect(canvas, rect) { + canvas.style.top = rect.y + 'px'; + canvas.style.left = rect.x + 'px'; + canvas.width = rect.w; + canvas.height = rect.h; + canvas.style.width = canvas.width + 'px'; // for IE + canvas.style.height = canvas.height + 'px'; // for IE + } + + var plotArea = this.dygraph_.layout_.getPlotArea(); + + var xAxisLabelHeight = 0; + if(this.getOption_('drawXAxis')){ + xAxisLabelHeight = this.getOption_('xAxisHeight') || (this.getOption_('axisLabelFontSize') + 2 * this.getOption_('axisTickSize')); + } + this.canvasRect_ = { + x: plotArea.x, + y: plotArea.y + plotArea.h + xAxisLabelHeight + 4, + w: plotArea.w, + h: this.getOption_('rangeSelectorHeight') + }; + + setElementRect(this.bgcanvas_, this.canvasRect_); + setElementRect(this.fgcanvas_, this.canvasRect_); +}; + +/** + * @private + * Creates the background and foreground canvases. + */ +rangeSelector.prototype.createCanvases_ = function() { + this.bgcanvas_ = Dygraph.createCanvas(); + this.bgcanvas_.className = 'dygraph-rangesel-bgcanvas'; + this.bgcanvas_.style.position = 'absolute'; + this.bgcanvas_.style.zIndex = 9; + this.bgcanvas_ctx_ = Dygraph.getContext(this.bgcanvas_); + + this.fgcanvas_ = Dygraph.createCanvas(); + this.fgcanvas_.className = 'dygraph-rangesel-fgcanvas'; + this.fgcanvas_.style.position = 'absolute'; + this.fgcanvas_.style.zIndex = 9; + this.fgcanvas_.style.cursor = 'default'; + this.fgcanvas_ctx_ = Dygraph.getContext(this.fgcanvas_); +}; + +/** + * @private + * Creates overlay divs for IE/Excanvas so that mouse events are handled properly. + */ +rangeSelector.prototype.createIEPanOverlay_ = function() { + this.iePanOverlay_ = document.createElement("div"); + this.iePanOverlay_.style.position = 'absolute'; + this.iePanOverlay_.style.backgroundColor = 'white'; + this.iePanOverlay_.style.filter = 'alpha(opacity=0)'; + this.iePanOverlay_.style.display = 'none'; + this.iePanOverlay_.style.cursor = 'move'; + this.fgcanvas_.appendChild(this.iePanOverlay_); +}; + +/** + * @private + * Creates the zoom handle elements. + */ +rangeSelector.prototype.createZoomHandles_ = function() { + var img = new Image(); + img.className = 'dygraph-rangesel-zoomhandle'; + img.style.position = 'absolute'; + img.style.zIndex = 10; + img.style.visibility = 'hidden'; // Initially hidden so they don't show up in the wrong place. + img.style.cursor = 'col-resize'; + + if (/MSIE 7/.test(navigator.userAgent)) { // IE7 doesn't support embedded src data. + img.width = 7; + img.height = 14; + img.style.backgroundColor = 'white'; + img.style.border = '1px solid #333333'; // Just show box in IE7. + } else { + img.width = 9; + img.height = 16; + img.src = 'data:image/png;base64,' + +'iVBORw0KGgoAAAANSUhEUgAAAAkAAAAQCAYAAADESFVDAAAAAXNSR0IArs4c6QAAAAZiS0dEANAA' + +'zwDP4Z7KegAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAd0SU1FB9sHGw0cMqdt1UwAAAAZdEVYdENv' + +'bW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAaElEQVQoz+3SsRFAQBCF4Z9WJM8KCDVwownl' + +'6YXsTmCUsyKGkZzcl7zkz3YLkypgAnreFmDEpHkIwVOMfpdi9CEEN2nGpFdwD03yEqDtOgCaun7s' + +'qSTDH32I1pQA2Pb9sZecAxc5r3IAb21d6878xsAAAAAASUVORK5CYII='; + } + + if (this.isMobileDevice_) { + img.width *= 2; + img.height *= 2; + } + + this.leftZoomHandle_ = img; + this.rightZoomHandle_ = img.cloneNode(false); +}; + +/** + * @private + * Sets up the interaction for the range selector. + */ +rangeSelector.prototype.initInteraction_ = function() { + var self = this; + var topElem = this.isIE_ ? document : window; + var clientXLast = 0; + var handle = null; + var isZooming = false; + var isPanning = false; + var dynamic = !this.isMobileDevice_ && !this.isUsingExcanvas_; + + // We cover iframes during mouse interactions. See comments in + // dygraph-utils.js for more info on why this is a good idea. + var tarp = new Dygraph.IFrameTarp(); + + // functions, defined below. Defining them this way (rather than with + // "function foo() {...}" makes JSHint happy. + var toXDataWindow, onZoomStart, onZoom, onZoomEnd, doZoom, isMouseInPanZone, + onPanStart, onPan, onPanEnd, doPan, onCanvasHover; + + // Touch event functions + var onZoomHandleTouchEvent, onCanvasTouchEvent, addTouchEvents; + + toXDataWindow = function(zoomHandleStatus) { + var xDataLimits = self.dygraph_.xAxisExtremes(); + var fact = (xDataLimits[1] - xDataLimits[0])/self.canvasRect_.w; + var xDataMin = xDataLimits[0] + (zoomHandleStatus.leftHandlePos - self.canvasRect_.x)*fact; + var xDataMax = xDataLimits[0] + (zoomHandleStatus.rightHandlePos - self.canvasRect_.x)*fact; + return [xDataMin, xDataMax]; + }; + + onZoomStart = function(e) { + Dygraph.cancelEvent(e); + isZooming = true; + clientXLast = e.clientX; + handle = e.target ? e.target : e.srcElement; + if (e.type === 'mousedown' || e.type === 'dragstart') { + // These events are removed manually. + Dygraph.addEvent(topElem, 'mousemove', onZoom); + Dygraph.addEvent(topElem, 'mouseup', onZoomEnd); + } + self.fgcanvas_.style.cursor = 'col-resize'; + tarp.cover(); + return true; + }; + + onZoom = function(e) { + if (!isZooming) { + return false; + } + Dygraph.cancelEvent(e); + + var delX = e.clientX - clientXLast; + if (Math.abs(delX) < 4) { + return true; + } + clientXLast = e.clientX; + + // Move handle. + var zoomHandleStatus = self.getZoomHandleStatus_(); + var newPos; + if (handle == self.leftZoomHandle_) { + newPos = zoomHandleStatus.leftHandlePos + delX; + newPos = Math.min(newPos, zoomHandleStatus.rightHandlePos - handle.width - 3); + newPos = Math.max(newPos, self.canvasRect_.x); + } else { + newPos = zoomHandleStatus.rightHandlePos + delX; + newPos = Math.min(newPos, self.canvasRect_.x + self.canvasRect_.w); + newPos = Math.max(newPos, zoomHandleStatus.leftHandlePos + handle.width + 3); + } + var halfHandleWidth = handle.width/2; + handle.style.left = (newPos - halfHandleWidth) + 'px'; + self.drawInteractiveLayer_(); + + // Zoom on the fly (if not using excanvas). + if (dynamic) { + doZoom(); + } + return true; + }; + + onZoomEnd = function(e) { + if (!isZooming) { + return false; + } + isZooming = false; + tarp.uncover(); + Dygraph.removeEvent(topElem, 'mousemove', onZoom); + Dygraph.removeEvent(topElem, 'mouseup', onZoomEnd); + self.fgcanvas_.style.cursor = 'default'; + + // If using excanvas, Zoom now. + if (!dynamic) { + doZoom(); + } + return true; + }; + + doZoom = function() { + try { + var zoomHandleStatus = self.getZoomHandleStatus_(); + self.isChangingRange_ = true; + if (!zoomHandleStatus.isZoomed) { + self.dygraph_.resetZoom(); + } else { + var xDataWindow = toXDataWindow(zoomHandleStatus); + self.dygraph_.doZoomXDates_(xDataWindow[0], xDataWindow[1]); + } + } finally { + self.isChangingRange_ = false; + } + }; + + isMouseInPanZone = function(e) { + if (self.isUsingExcanvas_) { + return e.srcElement == self.iePanOverlay_; + } else { + var rect = self.leftZoomHandle_.getBoundingClientRect(); + var leftHandleClientX = rect.left + rect.width/2; + rect = self.rightZoomHandle_.getBoundingClientRect(); + var rightHandleClientX = rect.left + rect.width/2; + return (e.clientX > leftHandleClientX && e.clientX < rightHandleClientX); + } + }; + + onPanStart = function(e) { + if (!isPanning && isMouseInPanZone(e) && self.getZoomHandleStatus_().isZoomed) { + Dygraph.cancelEvent(e); + isPanning = true; + clientXLast = e.clientX; + if (e.type === 'mousedown') { + // These events are removed manually. + Dygraph.addEvent(topElem, 'mousemove', onPan); + Dygraph.addEvent(topElem, 'mouseup', onPanEnd); + } + return true; + } + return false; + }; + + onPan = function(e) { + if (!isPanning) { + return false; + } + Dygraph.cancelEvent(e); + + var delX = e.clientX - clientXLast; + if (Math.abs(delX) < 4) { + return true; + } + clientXLast = e.clientX; + + // Move range view + var zoomHandleStatus = self.getZoomHandleStatus_(); + var leftHandlePos = zoomHandleStatus.leftHandlePos; + var rightHandlePos = zoomHandleStatus.rightHandlePos; + var rangeSize = rightHandlePos - leftHandlePos; + if (leftHandlePos + delX <= self.canvasRect_.x) { + leftHandlePos = self.canvasRect_.x; + rightHandlePos = leftHandlePos + rangeSize; + } else if (rightHandlePos + delX >= self.canvasRect_.x + self.canvasRect_.w) { + rightHandlePos = self.canvasRect_.x + self.canvasRect_.w; + leftHandlePos = rightHandlePos - rangeSize; + } else { + leftHandlePos += delX; + rightHandlePos += delX; + } + var halfHandleWidth = self.leftZoomHandle_.width/2; + self.leftZoomHandle_.style.left = (leftHandlePos - halfHandleWidth) + 'px'; + self.rightZoomHandle_.style.left = (rightHandlePos - halfHandleWidth) + 'px'; + self.drawInteractiveLayer_(); + + // Do pan on the fly (if not using excanvas). + if (dynamic) { + doPan(); + } + return true; + }; + + onPanEnd = function(e) { + if (!isPanning) { + return false; + } + isPanning = false; + Dygraph.removeEvent(topElem, 'mousemove', onPan); + Dygraph.removeEvent(topElem, 'mouseup', onPanEnd); + // If using excanvas, do pan now. + if (!dynamic) { + doPan(); + } + return true; + }; + + doPan = function() { + try { + self.isChangingRange_ = true; + self.dygraph_.dateWindow_ = toXDataWindow(self.getZoomHandleStatus_()); + self.dygraph_.drawGraph_(false); + } finally { + self.isChangingRange_ = false; + } + }; + + onCanvasHover = function(e) { + if (isZooming || isPanning) { + return; + } + var cursor = isMouseInPanZone(e) ? 'move' : 'default'; + if (cursor != self.fgcanvas_.style.cursor) { + self.fgcanvas_.style.cursor = cursor; + } + }; + + onZoomHandleTouchEvent = function(e) { + if (e.type == 'touchstart' && e.targetTouches.length == 1) { + if (onZoomStart(e.targetTouches[0])) { + Dygraph.cancelEvent(e); + } + } else if (e.type == 'touchmove' && e.targetTouches.length == 1) { + if (onZoom(e.targetTouches[0])) { + Dygraph.cancelEvent(e); + } + } else { + onZoomEnd(e); + } + }; + + onCanvasTouchEvent = function(e) { + if (e.type == 'touchstart' && e.targetTouches.length == 1) { + if (onPanStart(e.targetTouches[0])) { + Dygraph.cancelEvent(e); + } + } else if (e.type == 'touchmove' && e.targetTouches.length == 1) { + if (onPan(e.targetTouches[0])) { + Dygraph.cancelEvent(e); + } + } else { + onPanEnd(e); + } + }; + + addTouchEvents = function(elem, fn) { + var types = ['touchstart', 'touchend', 'touchmove', 'touchcancel']; + for (var i = 0; i < types.length; i++) { + self.dygraph_.addAndTrackEvent(elem, types[i], fn); + } + }; + + this.setDefaultOption_('interactionModel', Dygraph.Interaction.dragIsPanInteractionModel); + this.setDefaultOption_('panEdgeFraction', 0.0001); + + var dragStartEvent = window.opera ? 'mousedown' : 'dragstart'; + this.dygraph_.addAndTrackEvent(this.leftZoomHandle_, dragStartEvent, onZoomStart); + this.dygraph_.addAndTrackEvent(this.rightZoomHandle_, dragStartEvent, onZoomStart); + + if (this.isUsingExcanvas_) { + this.dygraph_.addAndTrackEvent(this.iePanOverlay_, 'mousedown', onPanStart); + } else { + this.dygraph_.addAndTrackEvent(this.fgcanvas_, 'mousedown', onPanStart); + this.dygraph_.addAndTrackEvent(this.fgcanvas_, 'mousemove', onCanvasHover); + } + + // Touch events + if (this.hasTouchInterface_) { + addTouchEvents(this.leftZoomHandle_, onZoomHandleTouchEvent); + addTouchEvents(this.rightZoomHandle_, onZoomHandleTouchEvent); + addTouchEvents(this.fgcanvas_, onCanvasTouchEvent); + } +}; + +/** + * @private + * Draws the static layer in the background canvas. + */ +rangeSelector.prototype.drawStaticLayer_ = function() { + var ctx = this.bgcanvas_ctx_; + ctx.clearRect(0, 0, this.canvasRect_.w, this.canvasRect_.h); + try { + this.drawMiniPlot_(); + } catch(ex) { + Dygraph.warn(ex); + } + + var margin = 0.5; + this.bgcanvas_ctx_.lineWidth = 1; + ctx.strokeStyle = 'gray'; + ctx.beginPath(); + ctx.moveTo(margin, margin); + ctx.lineTo(margin, this.canvasRect_.h-margin); + ctx.lineTo(this.canvasRect_.w-margin, this.canvasRect_.h-margin); + ctx.lineTo(this.canvasRect_.w-margin, margin); + ctx.stroke(); +}; + + +/** + * @private + * Draws the mini plot in the background canvas. + */ +rangeSelector.prototype.drawMiniPlot_ = function() { + var fillStyle = this.getOption_('rangeSelectorPlotFillColor'); + var strokeStyle = this.getOption_('rangeSelectorPlotStrokeColor'); + if (!fillStyle && !strokeStyle) { + return; + } + + var stepPlot = this.getOption_('stepPlot'); + + var combinedSeriesData = this.computeCombinedSeriesAndLimits_(); + var yRange = combinedSeriesData.yMax - combinedSeriesData.yMin; + + // Draw the mini plot. + var ctx = this.bgcanvas_ctx_; + var margin = 0.5; + + var xExtremes = this.dygraph_.xAxisExtremes(); + var xRange = Math.max(xExtremes[1] - xExtremes[0], 1.e-30); + var xFact = (this.canvasRect_.w - margin)/xRange; + var yFact = (this.canvasRect_.h - margin)/yRange; + var canvasWidth = this.canvasRect_.w - margin; + var canvasHeight = this.canvasRect_.h - margin; + + var prevX = null, prevY = null; + + ctx.beginPath(); + ctx.moveTo(margin, canvasHeight); + for (var i = 0; i < combinedSeriesData.data.length; i++) { + var dataPoint = combinedSeriesData.data[i]; + var x = ((dataPoint[0] !== null) ? ((dataPoint[0] - xExtremes[0])*xFact) : NaN); + var y = ((dataPoint[1] !== null) ? (canvasHeight - (dataPoint[1] - combinedSeriesData.yMin)*yFact) : NaN); + if (isFinite(x) && isFinite(y)) { + if(prevX === null) { + ctx.lineTo(x, canvasHeight); + } + else if (stepPlot) { + ctx.lineTo(x, prevY); + } + ctx.lineTo(x, y); + prevX = x; + prevY = y; + } + else { + if(prevX !== null) { + if (stepPlot) { + ctx.lineTo(x, prevY); + ctx.lineTo(x, canvasHeight); + } + else { + ctx.lineTo(prevX, canvasHeight); + } + } + prevX = prevY = null; + } + } + ctx.lineTo(canvasWidth, canvasHeight); + ctx.closePath(); + + if (fillStyle) { + var lingrad = this.bgcanvas_ctx_.createLinearGradient(0, 0, 0, canvasHeight); + lingrad.addColorStop(0, 'white'); + lingrad.addColorStop(1, fillStyle); + this.bgcanvas_ctx_.fillStyle = lingrad; + ctx.fill(); + } + + if (strokeStyle) { + this.bgcanvas_ctx_.strokeStyle = strokeStyle; + this.bgcanvas_ctx_.lineWidth = 1.5; + ctx.stroke(); + } +}; + +/** + * @private + * Computes and returns the combinded series data along with min/max for the mini plot. + * @return {Object} An object containing combinded series array, ymin, ymax. + */ +rangeSelector.prototype.computeCombinedSeriesAndLimits_ = function() { + var data = this.dygraph_.rawData_; + var logscale = this.getOption_('logscale'); + + // Create a combined series (average of all series values). + var combinedSeries = []; + var sum; + var count; + var mutipleValues; + var i, j, k; + var xVal, yVal; + + // Find out if data has multiple values per datapoint. + // Go to first data point that actually has values (see http://code.google.com/p/dygraphs/issues/detail?id=246) + for (i = 0; i < data.length; i++) { + if (data[i].length > 1 && data[i][1] !== null) { + mutipleValues = typeof data[i][1] != 'number'; + if (mutipleValues) { + sum = []; + count = []; + for (k = 0; k < data[i][1].length; k++) { + sum.push(0); + count.push(0); + } + } + break; + } + } + + for (i = 0; i < data.length; i++) { + var dataPoint = data[i]; + xVal = dataPoint[0]; + + if (mutipleValues) { + for (k = 0; k < sum.length; k++) { + sum[k] = count[k] = 0; + } + } else { + sum = count = 0; + } + + for (j = 1; j < dataPoint.length; j++) { + if (this.dygraph_.visibility()[j-1]) { + var y; + if (mutipleValues) { + for (k = 0; k < sum.length; k++) { + y = dataPoint[j][k]; + if (y === null || isNaN(y)) continue; + sum[k] += y; + count[k]++; + } + } else { + y = dataPoint[j]; + if (y === null || isNaN(y)) continue; + sum += y; + count++; + } + } + } + + if (mutipleValues) { + for (k = 0; k < sum.length; k++) { + sum[k] /= count[k]; + } + yVal = sum.slice(0); + } else { + yVal = sum/count; + } + + combinedSeries.push([xVal, yVal]); + } + + // Account for roll period, fractions. + combinedSeries = this.dygraph_.rollingAverage(combinedSeries, this.dygraph_.rollPeriod_); + + if (typeof combinedSeries[0][1] != 'number') { + for (i = 0; i < combinedSeries.length; i++) { + yVal = combinedSeries[i][1]; + combinedSeries[i][1] = yVal[0]; + } + } + + // Compute the y range. + var yMin = Number.MAX_VALUE; + var yMax = -Number.MAX_VALUE; + for (i = 0; i < combinedSeries.length; i++) { + yVal = combinedSeries[i][1]; + if (yVal !== null && isFinite(yVal) && (!logscale || yVal > 0)) { + yMin = Math.min(yMin, yVal); + yMax = Math.max(yMax, yVal); + } + } + + // Convert Y data to log scale if needed. + // Also, expand the Y range to compress the mini plot a little. + var extraPercent = 0.25; + if (logscale) { + yMax = Dygraph.log10(yMax); + yMax += yMax*extraPercent; + yMin = Dygraph.log10(yMin); + for (i = 0; i < combinedSeries.length; i++) { + combinedSeries[i][1] = Dygraph.log10(combinedSeries[i][1]); + } + } else { + var yExtra; + var yRange = yMax - yMin; + if (yRange <= Number.MIN_VALUE) { + yExtra = yMax*extraPercent; + } else { + yExtra = yRange*extraPercent; + } + yMax += yExtra; + yMin -= yExtra; + } + + return {data: combinedSeries, yMin: yMin, yMax: yMax}; +}; + +/** + * @private + * Places the zoom handles in the proper position based on the current X data window. + */ +rangeSelector.prototype.placeZoomHandles_ = function() { + var xExtremes = this.dygraph_.xAxisExtremes(); + var xWindowLimits = this.dygraph_.xAxisRange(); + var xRange = xExtremes[1] - xExtremes[0]; + var leftPercent = Math.max(0, (xWindowLimits[0] - xExtremes[0])/xRange); + var rightPercent = Math.max(0, (xExtremes[1] - xWindowLimits[1])/xRange); + var leftCoord = this.canvasRect_.x + this.canvasRect_.w*leftPercent; + var rightCoord = this.canvasRect_.x + this.canvasRect_.w*(1 - rightPercent); + var handleTop = Math.max(this.canvasRect_.y, this.canvasRect_.y + (this.canvasRect_.h - this.leftZoomHandle_.height)/2); + var halfHandleWidth = this.leftZoomHandle_.width/2; + this.leftZoomHandle_.style.left = (leftCoord - halfHandleWidth) + 'px'; + this.leftZoomHandle_.style.top = handleTop + 'px'; + this.rightZoomHandle_.style.left = (rightCoord - halfHandleWidth) + 'px'; + this.rightZoomHandle_.style.top = this.leftZoomHandle_.style.top; + + this.leftZoomHandle_.style.visibility = 'visible'; + this.rightZoomHandle_.style.visibility = 'visible'; +}; + +/** + * @private + * Draws the interactive layer in the foreground canvas. + */ +rangeSelector.prototype.drawInteractiveLayer_ = function() { + var ctx = this.fgcanvas_ctx_; + ctx.clearRect(0, 0, this.canvasRect_.w, this.canvasRect_.h); + var margin = 1; + var width = this.canvasRect_.w - margin; + var height = this.canvasRect_.h - margin; + var zoomHandleStatus = this.getZoomHandleStatus_(); + + ctx.strokeStyle = 'black'; + if (!zoomHandleStatus.isZoomed) { + ctx.beginPath(); + ctx.moveTo(margin, margin); + ctx.lineTo(margin, height); + ctx.lineTo(width, height); + ctx.lineTo(width, margin); + ctx.stroke(); + if (this.iePanOverlay_) { + this.iePanOverlay_.style.display = 'none'; + } + } else { + var leftHandleCanvasPos = Math.max(margin, zoomHandleStatus.leftHandlePos - this.canvasRect_.x); + var rightHandleCanvasPos = Math.min(width, zoomHandleStatus.rightHandlePos - this.canvasRect_.x); + + ctx.fillStyle = 'rgba(240, 240, 240, 0.6)'; + ctx.fillRect(0, 0, leftHandleCanvasPos, this.canvasRect_.h); + ctx.fillRect(rightHandleCanvasPos, 0, this.canvasRect_.w - rightHandleCanvasPos, this.canvasRect_.h); + + ctx.beginPath(); + ctx.moveTo(margin, margin); + ctx.lineTo(leftHandleCanvasPos, margin); + ctx.lineTo(leftHandleCanvasPos, height); + ctx.lineTo(rightHandleCanvasPos, height); + ctx.lineTo(rightHandleCanvasPos, margin); + ctx.lineTo(width, margin); + ctx.stroke(); + + if (this.isUsingExcanvas_) { + this.iePanOverlay_.style.width = (rightHandleCanvasPos - leftHandleCanvasPos) + 'px'; + this.iePanOverlay_.style.left = leftHandleCanvasPos + 'px'; + this.iePanOverlay_.style.height = height + 'px'; + this.iePanOverlay_.style.display = 'inline'; + } + } +}; + +/** + * @private + * Returns the current zoom handle position information. + * @return {Object} The zoom handle status. + */ +rangeSelector.prototype.getZoomHandleStatus_ = function() { + var halfHandleWidth = this.leftZoomHandle_.width/2; + var leftHandlePos = parseFloat(this.leftZoomHandle_.style.left) + halfHandleWidth; + var rightHandlePos = parseFloat(this.rightZoomHandle_.style.left) + halfHandleWidth; + return { + leftHandlePos: leftHandlePos, + rightHandlePos: rightHandlePos, + isZoomed: (leftHandlePos - 1 > this.canvasRect_.x || rightHandlePos + 1 < this.canvasRect_.x+this.canvasRect_.w) + }; +}; + +return rangeSelector; + +})(); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/rgbcolor/rgbcolor.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/rgbcolor/rgbcolor.js new file mode 100644 index 0000000..5a88244 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/rgbcolor/rgbcolor.js @@ -0,0 +1,257 @@ +/** + * A class to parse color values + * + * NOTE: modified by danvk. I removed the "getHelpXML" function to reduce the + * file size, added "use strict" and a few "var" declarations where needed. + * + * Modifications by adilh: + * Original "RGBColor" function name collides with: + * http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-RGBColor + * so renamed to "RGBColorParser" + * + * @author Stoyan Stefanov + * @link http://www.phpied.com/rgb-color-parser-in-javascript/ + * @license Use it if you like it + */ +"use strict"; + +function RGBColorParser(color_string) +{ + this.ok = false; + + // strip any leading # + if (color_string.charAt(0) == '#') { // remove # if any + color_string = color_string.substr(1,6); + } + + color_string = color_string.replace(/ /g,''); + color_string = color_string.toLowerCase(); + + // before getting into regexps, try simple matches + // and overwrite the input + var simple_colors = { + aliceblue: 'f0f8ff', + antiquewhite: 'faebd7', + aqua: '00ffff', + aquamarine: '7fffd4', + azure: 'f0ffff', + beige: 'f5f5dc', + bisque: 'ffe4c4', + black: '000000', + blanchedalmond: 'ffebcd', + blue: '0000ff', + blueviolet: '8a2be2', + brown: 'a52a2a', + burlywood: 'deb887', + cadetblue: '5f9ea0', + chartreuse: '7fff00', + chocolate: 'd2691e', + coral: 'ff7f50', + cornflowerblue: '6495ed', + cornsilk: 'fff8dc', + crimson: 'dc143c', + cyan: '00ffff', + darkblue: '00008b', + darkcyan: '008b8b', + darkgoldenrod: 'b8860b', + darkgray: 'a9a9a9', + darkgreen: '006400', + darkkhaki: 'bdb76b', + darkmagenta: '8b008b', + darkolivegreen: '556b2f', + darkorange: 'ff8c00', + darkorchid: '9932cc', + darkred: '8b0000', + darksalmon: 'e9967a', + darkseagreen: '8fbc8f', + darkslateblue: '483d8b', + darkslategray: '2f4f4f', + darkturquoise: '00ced1', + darkviolet: '9400d3', + deeppink: 'ff1493', + deepskyblue: '00bfff', + dimgray: '696969', + dodgerblue: '1e90ff', + feldspar: 'd19275', + firebrick: 'b22222', + floralwhite: 'fffaf0', + forestgreen: '228b22', + fuchsia: 'ff00ff', + gainsboro: 'dcdcdc', + ghostwhite: 'f8f8ff', + gold: 'ffd700', + goldenrod: 'daa520', + gray: '808080', + green: '008000', + greenyellow: 'adff2f', + honeydew: 'f0fff0', + hotpink: 'ff69b4', + indianred : 'cd5c5c', + indigo : '4b0082', + ivory: 'fffff0', + khaki: 'f0e68c', + lavender: 'e6e6fa', + lavenderblush: 'fff0f5', + lawngreen: '7cfc00', + lemonchiffon: 'fffacd', + lightblue: 'add8e6', + lightcoral: 'f08080', + lightcyan: 'e0ffff', + lightgoldenrodyellow: 'fafad2', + lightgrey: 'd3d3d3', + lightgreen: '90ee90', + lightpink: 'ffb6c1', + lightsalmon: 'ffa07a', + lightseagreen: '20b2aa', + lightskyblue: '87cefa', + lightslateblue: '8470ff', + lightslategray: '778899', + lightsteelblue: 'b0c4de', + lightyellow: 'ffffe0', + lime: '00ff00', + limegreen: '32cd32', + linen: 'faf0e6', + magenta: 'ff00ff', + maroon: '800000', + mediumaquamarine: '66cdaa', + mediumblue: '0000cd', + mediumorchid: 'ba55d3', + mediumpurple: '9370d8', + mediumseagreen: '3cb371', + mediumslateblue: '7b68ee', + mediumspringgreen: '00fa9a', + mediumturquoise: '48d1cc', + mediumvioletred: 'c71585', + midnightblue: '191970', + mintcream: 'f5fffa', + mistyrose: 'ffe4e1', + moccasin: 'ffe4b5', + navajowhite: 'ffdead', + navy: '000080', + oldlace: 'fdf5e6', + olive: '808000', + olivedrab: '6b8e23', + orange: 'ffa500', + orangered: 'ff4500', + orchid: 'da70d6', + palegoldenrod: 'eee8aa', + palegreen: '98fb98', + paleturquoise: 'afeeee', + palevioletred: 'd87093', + papayawhip: 'ffefd5', + peachpuff: 'ffdab9', + peru: 'cd853f', + pink: 'ffc0cb', + plum: 'dda0dd', + powderblue: 'b0e0e6', + purple: '800080', + red: 'ff0000', + rosybrown: 'bc8f8f', + royalblue: '4169e1', + saddlebrown: '8b4513', + salmon: 'fa8072', + sandybrown: 'f4a460', + seagreen: '2e8b57', + seashell: 'fff5ee', + sienna: 'a0522d', + silver: 'c0c0c0', + skyblue: '87ceeb', + slateblue: '6a5acd', + slategray: '708090', + snow: 'fffafa', + springgreen: '00ff7f', + steelblue: '4682b4', + tan: 'd2b48c', + teal: '008080', + thistle: 'd8bfd8', + tomato: 'ff6347', + turquoise: '40e0d0', + violet: 'ee82ee', + violetred: 'd02090', + wheat: 'f5deb3', + white: 'ffffff', + whitesmoke: 'f5f5f5', + yellow: 'ffff00', + yellowgreen: '9acd32' + }; + for (var key in simple_colors) { + if (color_string == key) { + color_string = simple_colors[key]; + } + } + // emd of simple type-in colors + + // array of color definition objects + var color_defs = [ + { + re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/, + example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'], + process: function (bits){ + return [ + parseInt(bits[1]), + parseInt(bits[2]), + parseInt(bits[3]) + ]; + } + }, + { + re: /^(\w{2})(\w{2})(\w{2})$/, + example: ['#00ff00', '336699'], + process: function (bits){ + return [ + parseInt(bits[1], 16), + parseInt(bits[2], 16), + parseInt(bits[3], 16) + ]; + } + }, + { + re: /^(\w{1})(\w{1})(\w{1})$/, + example: ['#fb0', 'f0f'], + process: function (bits){ + return [ + parseInt(bits[1] + bits[1], 16), + parseInt(bits[2] + bits[2], 16), + parseInt(bits[3] + bits[3], 16) + ]; + } + } + ]; + + // search through the definitions to find a match + for (var i = 0; i < color_defs.length; i++) { + var re = color_defs[i].re; + var processor = color_defs[i].process; + var bits = re.exec(color_string); + if (bits) { + var channels = processor(bits); + this.r = channels[0]; + this.g = channels[1]; + this.b = channels[2]; + this.ok = true; + } + + } + + // validate/cleanup values + this.r = (this.r < 0 || isNaN(this.r)) ? 0 : ((this.r > 255) ? 255 : this.r); + this.g = (this.g < 0 || isNaN(this.g)) ? 0 : ((this.g > 255) ? 255 : this.g); + this.b = (this.b < 0 || isNaN(this.b)) ? 0 : ((this.b > 255) ? 255 : this.b); + + // some getters + this.toRGB = function () { + return 'rgb(' + this.r + ', ' + this.g + ', ' + this.b + ')'; + } + this.toHex = function () { + var r = this.r.toString(16); + var g = this.g.toString(16); + var b = this.b.toString(16); + if (r.length == 1) r = '0' + r; + if (g.length == 1) g = '0' + g; + if (b.length == 1) b = '0' + b; + return '#' + r + g + b; + } + + +} + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/stacktrace.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/stacktrace.js new file mode 100644 index 0000000..4d0384d --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/stacktrace.js @@ -0,0 +1,411 @@ +// Domain Public by Eric Wendelin http://eriwen.com/ (2008) +// Luke Smith http://lucassmith.name/ (2008) +// Loic Dachary (2008) +// Johan Euphrosine (2008) +// Oyvind Sean Kinsey http://kinsey.no/blog (2010) +// Victor Homyakov (2010) + +/** + * Main function giving a function stack trace with a forced or passed in Error + * + * @cfg {Error} e The error to create a stacktrace from (optional) + * @cfg {Boolean} guess If we should try to resolve the names of anonymous functions + * @return {Array} of Strings with functions, lines, files, and arguments where possible + */ +function printStackTrace(options) { + options = options || {guess: true}; + var ex = options.e || null, guess = !!options.guess; + var p = new printStackTrace.implementation(), result = p.run(ex); + return (guess) ? p.guessAnonymousFunctions(result) : result; +} + +printStackTrace.implementation = function() { +}; + +printStackTrace.implementation.prototype = { + /** + * @param {Error} ex The error to create a stacktrace from (optional) + * @param {String} mode Forced mode (optional, mostly for unit tests) + */ + run: function(ex, mode) { + ex = ex || this.createException(); + // examine exception properties w/o debugger + //for (var prop in ex) {alert("Ex['" + prop + "']=" + ex[prop]);} + mode = mode || this.mode(ex); + if (mode === 'other') { + return this.other(arguments.callee); + } else { + return this[mode](ex); + } + }, + + createException: function() { + try { + this.undef(); + } catch (e) { + return e; + } + }, + + /** + * Mode could differ for different exception, e.g. + * exceptions in Chrome may or may not have arguments or stack. + * + * @return {String} mode of operation for the exception + */ + mode: function(e) { + if (e['arguments'] && e.stack) { + return 'chrome'; + } else if (typeof e.message === 'string' && typeof window !== 'undefined' && window.opera) { + // e.message.indexOf("Backtrace:") > -1 -> opera + // !e.stacktrace -> opera + if (!e.stacktrace) { + return 'opera9'; // use e.message + } + // 'opera#sourceloc' in e -> opera9, opera10a + if (e.message.indexOf('\n') > -1 && e.message.split('\n').length > e.stacktrace.split('\n').length) { + return 'opera9'; // use e.message + } + // e.stacktrace && !e.stack -> opera10a + if (!e.stack) { + return 'opera10a'; // use e.stacktrace + } + // e.stacktrace && e.stack -> opera10b + if (e.stacktrace.indexOf("called from line") < 0) { + return 'opera10b'; // use e.stacktrace, format differs from 'opera10a' + } + // e.stacktrace && e.stack -> opera11 + return 'opera11'; // use e.stacktrace, format differs from 'opera10a', 'opera10b' + } else if (e.stack) { + return 'firefox'; + } + return 'other'; + }, + + /** + * Given a context, function name, and callback function, overwrite it so that it calls + * printStackTrace() first with a callback and then runs the rest of the body. + * + * @param {Object} context of execution (e.g. window) + * @param {String} functionName to instrument + * @param {Function} function to call with a stack trace on invocation + */ + instrumentFunction: function(context, functionName, callback) { + context = context || window; + var original = context[functionName]; + context[functionName] = function instrumented() { + callback.call(this, printStackTrace().slice(4)); + return context[functionName]._instrumented.apply(this, arguments); + }; + context[functionName]._instrumented = original; + }, + + /** + * Given a context and function name of a function that has been + * instrumented, revert the function to it's original (non-instrumented) + * state. + * + * @param {Object} context of execution (e.g. window) + * @param {String} functionName to de-instrument + */ + deinstrumentFunction: function(context, functionName) { + if (context[functionName].constructor === Function && + context[functionName]._instrumented && + context[functionName]._instrumented.constructor === Function) { + context[functionName] = context[functionName]._instrumented; + } + }, + + /** + * Given an Error object, return a formatted Array based on Chrome's stack string. + * + * @param e - Error object to inspect + * @return Array of function calls, files and line numbers + */ + chrome: function(e) { + var stack = (e.stack + '\n').replace(/^\S[^\(]+?[\n$]/gm, ''). + replace(/^\s+at\s+/gm, ''). + replace(/^([^\(]+?)([\n$])/gm, '{anonymous}()@$1$2'). + replace(/^Object.\s*\(([^\)]+)\)/gm, '{anonymous}()@$1').split('\n'); + stack.pop(); + return stack; + }, + + /** + * Given an Error object, return a formatted Array based on Firefox's stack string. + * + * @param e - Error object to inspect + * @return Array of function calls, files and line numbers + */ + firefox: function(e) { + return e.stack.replace(/(?:\n@:0)?\s+$/m, '').replace(/^\(/gm, '{anonymous}(').split('\n'); + }, + + opera11: function(e) { + // "Error thrown at line 42, column 12 in () in file://localhost/G:/js/stacktrace.js:\n" + // "Error thrown at line 42, column 12 in () in file://localhost/G:/js/stacktrace.js:\n" + // "called from line 7, column 4 in bar(n) in file://localhost/G:/js/test/functional/testcase1.html:\n" + // "called from line 15, column 3 in file://localhost/G:/js/test/functional/testcase1.html:\n" + var ANON = '{anonymous}', lineRE = /^.*line (\d+), column (\d+)(?: in (.+))? in (\S+):$/; + var lines = e.stacktrace.split('\n'), result = []; + + for (var i = 0, len = lines.length; i < len; i += 2) { + var match = lineRE.exec(lines[i]); + if (match) { + var location = match[4] + ':' + match[1] + ':' + match[2]; + var fnName = match[3] || "global code"; + fnName = fnName.replace(//, "$1").replace(//, ANON); + result.push(fnName + '@' + location + ' -- ' + lines[i + 1].replace(/^\s+/, '')); + } + } + + return result; + }, + + opera10b: function(e) { + // "([arguments not available])@file://localhost/G:/js/stacktrace.js:27\n" + + // "printStackTrace([arguments not available])@file://localhost/G:/js/stacktrace.js:18\n" + + // "@file://localhost/G:/js/test/functional/testcase1.html:15" + var ANON = '{anonymous}', lineRE = /^(.*)@(.+):(\d+)$/; + var lines = e.stacktrace.split('\n'), result = []; + + for (var i = 0, len = lines.length; i < len; i++) { + var match = lineRE.exec(lines[i]); + if (match) { + var fnName = match[1]? (match[1] + '()') : "global code"; + result.push(fnName + '@' + match[2] + ':' + match[3]); + } + } + + return result; + }, + + /** + * Given an Error object, return a formatted Array based on Opera 10's stacktrace string. + * + * @param e - Error object to inspect + * @return Array of function calls, files and line numbers + */ + opera10a: function(e) { + // " Line 27 of linked script file://localhost/G:/js/stacktrace.js\n" + // " Line 11 of inline#1 script in file://localhost/G:/js/test/functional/testcase1.html: In function foo\n" + var ANON = '{anonymous}', lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i; + var lines = e.stacktrace.split('\n'), result = []; + + for (var i = 0, len = lines.length; i < len; i += 2) { + var match = lineRE.exec(lines[i]); + if (match) { + var fnName = match[3] || ANON; + result.push(fnName + '()@' + match[2] + ':' + match[1] + ' -- ' + lines[i + 1].replace(/^\s+/, '')); + } + } + + return result; + }, + + // Opera 7.x-9.2x only! + opera9: function(e) { + // " Line 43 of linked script file://localhost/G:/js/stacktrace.js\n" + // " Line 7 of inline#1 script in file://localhost/G:/js/test/functional/testcase1.html\n" + var ANON = '{anonymous}', lineRE = /Line (\d+).*script (?:in )?(\S+)/i; + var lines = e.message.split('\n'), result = []; + + for (var i = 2, len = lines.length; i < len; i += 2) { + var match = lineRE.exec(lines[i]); + if (match) { + result.push(ANON + '()@' + match[2] + ':' + match[1] + ' -- ' + lines[i + 1].replace(/^\s+/, '')); + } + } + + return result; + }, + + // Safari, IE, and others + other: function(curr) { + var ANON = '{anonymous}', fnRE = /function\s*([\w\-$]+)?\s*\(/i, stack = [], fn, args, maxStackSize = 10; + while (curr && stack.length < maxStackSize) { + fn = fnRE.test(curr.toString()) ? RegExp.$1 || ANON : ANON; + args = Array.prototype.slice.call(curr['arguments'] || []); + stack[stack.length] = fn + '(' + this.stringifyArguments(args) + ')'; + curr = curr.caller; + } + return stack; + }, + + /** + * Given arguments array as a String, subsituting type names for non-string types. + * + * @param {Arguments} object + * @return {Array} of Strings with stringified arguments + */ + stringifyArguments: function(args) { + var result = []; + var slice = Array.prototype.slice; + for (var i = 0; i < args.length; ++i) { + var arg = args[i]; + if (arg === undefined) { + result[i] = 'undefined'; + } else if (arg === null) { + result[i] = 'null'; + } else if (arg.constructor) { + if (arg.constructor === Array) { + if (arg.length < 3) { + result[i] = '[' + this.stringifyArguments(arg) + ']'; + } else { + result[i] = '[' + this.stringifyArguments(slice.call(arg, 0, 1)) + '...' + this.stringifyArguments(slice.call(arg, -1)) + ']'; + } + } else if (arg.constructor === Object) { + result[i] = '#object'; + } else if (arg.constructor === Function) { + result[i] = '#function'; + } else if (arg.constructor === String) { + result[i] = '"' + arg + '"'; + } else if (arg.constructor === Number) { + result[i] = arg; + } + } + } + return result.join(','); + }, + + sourceCache: {}, + + /** + * @return the text from a given URL + */ + ajax: function(url) { + var req = this.createXMLHTTPObject(); + if (req) { + try { + req.open('GET', url, false); + req.send(null); + return req.responseText; + } catch (e) { + } + } + return ''; + }, + + /** + * Try XHR methods in order and store XHR factory. + * + * @return XHR function or equivalent + */ + createXMLHTTPObject: function() { + var xmlhttp, XMLHttpFactories = [ + function() { + return new XMLHttpRequest(); + }, function() { + return new ActiveXObject('Msxml2.XMLHTTP'); + }, function() { + return new ActiveXObject('Msxml3.XMLHTTP'); + }, function() { + return new ActiveXObject('Microsoft.XMLHTTP'); + } + ]; + for (var i = 0; i < XMLHttpFactories.length; i++) { + try { + xmlhttp = XMLHttpFactories[i](); + // Use memoization to cache the factory + this.createXMLHTTPObject = XMLHttpFactories[i]; + return xmlhttp; + } catch (e) { + } + } + }, + + /** + * Given a URL, check if it is in the same domain (so we can get the source + * via Ajax). + * + * @param url source url + * @return False if we need a cross-domain request + */ + isSameDomain: function(url) { + return url.indexOf(location.hostname) !== -1; + }, + + /** + * Get source code from given URL if in the same domain. + * + * @param url JS source URL + * @return Array of source code lines + */ + getSource: function(url) { + // TODO reuse source from script tags? + if (!(url in this.sourceCache)) { + this.sourceCache[url] = this.ajax(url).split('\n'); + } + return this.sourceCache[url]; + }, + + guessAnonymousFunctions: function(stack) { + for (var i = 0; i < stack.length; ++i) { + var reStack = /\{anonymous\}\(.*\)@(.*)/, + reRef = /^(.*?)(?::(\d+))(?::(\d+))?(?: -- .+)?$/, + frame = stack[i], ref = reStack.exec(frame); + + if (ref) { + var m = reRef.exec(ref[1]), file = m[1], + lineno = m[2], charno = m[3] || 0; + if (file && this.isSameDomain(file) && lineno) { + var functionName = this.guessAnonymousFunction(file, lineno, charno); + stack[i] = frame.replace('{anonymous}', functionName); + } + } + } + return stack; + }, + + guessAnonymousFunction: function(url, lineNo, charNo) { + var ret; + try { + ret = this.findFunctionName(this.getSource(url), lineNo); + } catch (e) { + ret = 'getSource failed with url: ' + url + ', exception: ' + e.toString(); + } + return ret; + }, + + findFunctionName: function(source, lineNo) { + // FIXME findFunctionName fails for compressed source + // (more than one function on the same line) + // TODO use captured args + // function {name}({args}) m[1]=name m[2]=args + var reFunctionDeclaration = /function\s+([^(]*?)\s*\(([^)]*)\)/; + // {name} = function ({args}) TODO args capture + // /['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*function(?:[^(]*)/ + var reFunctionExpression = /['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*function\b/; + // {name} = eval() + var reFunctionEvaluation = /['"]?([0-9A-Za-z_]+)['"]?\s*[:=]\s*(?:eval|new Function)\b/; + // Walk backwards in the source lines until we find + // the line which matches one of the patterns above + var code = "", line, maxLines = Math.min(lineNo, 20), m, commentPos; + for (var i = 0; i < maxLines; ++i) { + // lineNo is 1-based, source[] is 0-based + line = source[lineNo - i - 1]; + commentPos = line.indexOf('//'); + if (commentPos >= 0) { + line = line.substr(0, commentPos); + } + // TODO check other types of comments? Commented code may lead to false positive + if (line) { + code = line + code; + m = reFunctionExpression.exec(code); + if (m && m[1]) { + return m[1]; + } + m = reFunctionDeclaration.exec(code); + if (m && m[1]) { + //return m[1] + "(" + (m[2] || "") + ")"; + return m[1]; + } + m = reFunctionEvaluation.exec(code); + if (m && m[1]) { + return m[1]; + } + } + } + return '(?)'; + } +}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/Doxyfile b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/Doxyfile new file mode 100644 index 0000000..26ac5a5 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/Doxyfile @@ -0,0 +1,243 @@ +# Doxyfile 1.5.3 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = strftime +PROJECT_NUMBER = 1.3 +OUTPUT_DIRECTORY = /home/philip/public_html/hacks/strftime/docs/ +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class " \ + "The $name widget " \ + "The $name file " \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = /home/philip/public_html/hacks/strftime/ +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = NO +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = YES +HIDE_UNDOC_CLASSES = YES +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = NO +SHOW_DIRECTORIES = NO +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text " +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = /home/philip/public_html/hacks/strftime +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.js +RECURSIVE = NO +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = . +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +REFERENCES_LINK_SOURCE = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = Date \ + Date.ext \ + Date.prototype +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +HTML_DYNAMIC_SECTIONS = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = YES +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = NO +MSCGEN_PATH = +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = YES +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 1000 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = YES diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/strftime-min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/strftime-min.js new file mode 100644 index 0000000..8207714 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/strftime-min.js @@ -0,0 +1 @@ +Date.ext={};Date.ext.util={};Date.ext.util.xPad=function(x,pad,r){if(typeof (r)=="undefined"){r=10}for(;parseInt(x,10)1;r/=10){x=pad.toString()+x}return x.toString()};Date.prototype.locale="en-GB";if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){Date.prototype.locale=document.getElementsByTagName("html")[0].lang}Date.ext.locales={};Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"};Date.ext.locales["en-US"]=Date.ext.locales.en;Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";Date.ext.locales["en-US"].x="%D";Date.ext.locales["en-US"].X="%r";Date.ext.locales["en-GB"]=Date.ext.locales.en;Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];Date.ext.formats={a:function(d){return Date.ext.locales[d.locale].a[d.getDay()]},A:function(d){return Date.ext.locales[d.locale].A[d.getDay()]},b:function(d){return Date.ext.locales[d.locale].b[d.getMonth()]},B:function(d){return Date.ext.locales[d.locale].B[d.getMonth()]},c:"toLocaleString",C:function(d){return Date.ext.util.xPad(parseInt(d.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(d){return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100,10),0)},G:function(d){var y=d.getFullYear();var V=parseInt(Date.ext.formats.V(d),10);var W=parseInt(Date.ext.formats.W(d),10);if(W>V){y++}else{if(W===0&&V>=52){y--}}return y},H:["getHours","0"],I:function(d){var I=d.getHours()%12;return Date.ext.util.xPad(I===0?12:I,0)},j:function(d){var ms=d-new Date(""+d.getFullYear()+"/1/1 GMT");ms+=d.getTimezoneOffset()*60000;var doy=parseInt(ms/60000/60/24,10)+1;return Date.ext.util.xPad(doy,0,100)},m:function(d){return Date.ext.util.xPad(d.getMonth()+1,0)},M:["getMinutes","0"],p:function(d){return Date.ext.locales[d.locale].p[d.getHours()>=12?1:0]},P:function(d){return Date.ext.locales[d.locale].P[d.getHours()>=12?1:0]},S:["getSeconds","0"],u:function(d){var dow=d.getDay();return dow===0?7:dow},U:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=6-d.getDay();var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0)},V:function(d){var woy=parseInt(Date.ext.formats.W(d),10);var dow1_1=(new Date(""+d.getFullYear()+"/1/1")).getDay();var idow=woy+(dow1_1>4||dow1_1<=1?0:1);if(idow==53&&(new Date(""+d.getFullYear()+"/12/31")).getDay()<4){idow=1}else{if(idow===0){idow=Date.ext.formats.V(new Date(""+(d.getFullYear()-1)+"/12/31"))}}return Date.ext.util.xPad(idow,0)},w:"getDay",W:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=7-Date.ext.formats.u(d);var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0,10)},y:function(d){return Date.ext.util.xPad(d.getFullYear()%100,0)},Y:"getFullYear",z:function(d){var o=d.getTimezoneOffset();var H=Date.ext.util.xPad(parseInt(Math.abs(o/60),10),0);var M=Date.ext.util.xPad(o%60,0);return(o>0?"-":"+")+H+M},Z:function(d){return d.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(d){return"%"}};Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};Date.ext.aggregates.z=Date.ext.formats.z(new Date());Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());Date.ext.unsupported={};Date.prototype.strftime=function(fmt){if(!(this.locale in Date.ext.locales)){if(this.locale.replace(/-[a-zA-Z]+$/,"") in Date.ext.locales){this.locale=this.locale.replace(/-[a-zA-Z]+$/,"")}else{this.locale="en-GB"}}var d=this;while(fmt.match(/%[cDhnrRtTxXzZ]/)){fmt=fmt.replace(/%([cDhnrRtTxXzZ])/g,function(m0,m1){var f=Date.ext.aggregates[m1];return(f=="locale"?Date.ext.locales[d.locale][m1]:f)})}var str=fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g,function(m0,m1){var f=Date.ext.formats[m1];if(typeof (f)=="string"){return d[f]()}else{if(typeof (f)=="function"){return f.call(d,d)}else{if(typeof (f)=="object"&&typeof (f[0])=="string"){return Date.ext.util.xPad(d[f[0]](),f[1])}else{return m1}}}});d=null;return str}; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/strftime.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/strftime.js new file mode 100644 index 0000000..d622df9 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/dy3/js/strftime/strftime.js @@ -0,0 +1,731 @@ +/* + strftime for Javascript + Copyright (c) 2008, Philip S Tellis + All rights reserved. + + This code is distributed under the terms of the BSD licence + + Redistribution and use of this software 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. + * The names of the contributors to this file may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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. + */ + +/** + * \file strftime.js + * \author Philip S Tellis \ + * \version 1.3 + * \date 2008/06 + * \brief Javascript implementation of strftime + * + * Implements strftime for the Date object in javascript based on the PHP implementation described at + * http://www.php.net/strftime This is in turn based on the Open Group specification defined + * at http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html This implementation does not + * include modified conversion specifiers (i.e., Ex and Ox) + * + * The following format specifiers are supported: + * + * \copydoc formats + * + * \%a, \%A, \%b and \%B should be localised for non-English locales. + * + * \par Usage: + * This library may be used as follows: + * \code + * var d = new Date(); + * + * var ymd = d.strftime('%Y/%m/%d'); + * var iso = d.strftime('%Y-%m-%dT%H:%M:%S%z'); + * + * \endcode + * + * \sa \link Date.prototype.strftime Date.strftime \endlink for a description of each of the supported format specifiers + * \sa Date.ext.locales for localisation information + * \sa http://www.php.net/strftime for the PHP implementation which is the basis for this + * \sa http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html for feedback + */ + +//! Date extension object - all supporting objects go in here. +Date.ext = {}; + +//! Utility methods +Date.ext.util = {}; + +/** +\brief Left pad a number with something +\details Takes a number and pads it to the left with the passed in pad character +\param x The number to pad +\param pad The string to pad with +\param r [optional] Upper limit for pad. A value of 10 pads to 2 digits, a value of 100 pads to 3 digits. + Default is 10. + +\return The number left padded with the pad character. This function returns a string and not a number. +*/ +Date.ext.util.xPad=function(x, pad, r) +{ + if(typeof(r) == 'undefined') + { + r=10; + } + for( ; parseInt(x, 10)1; r/=10) + x = pad.toString() + x; + return x.toString(); +}; + +/** +\brief Currently selected locale. +\details +The locale for a specific date object may be changed using \code Date.locale = "new-locale"; \endcode +The default will be based on the lang attribute of the HTML tag of your document +*/ +Date.prototype.locale = 'en-GB'; +//! \cond FALSE +if(document.getElementsByTagName('html') && document.getElementsByTagName('html')[0].lang) +{ + Date.prototype.locale = document.getElementsByTagName('html')[0].lang; +} +//! \endcond + +/** +\brief Localised strings for days of the week and months of the year. +\details +To create your own local strings, add a locale object to the locales object. +The key of your object should be the same as your locale name. For example: + en-US, + fr, + fr-CH, + de-DE +Names are case sensitive and are described at http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes +Your locale object must contain the following keys: +\param a Short names of days of week starting with Sunday +\param A Long names days of week starting with Sunday +\param b Short names of months of the year starting with January +\param B Long names of months of the year starting with February +\param c The preferred date and time representation in your locale +\param p AM or PM in your locale +\param P am or pm in your locale +\param x The preferred date representation for the current locale without the time. +\param X The preferred time representation for the current locale without the date. + +\sa Date.ext.locales.en for a sample implementation +\sa \ref localisation for detailed documentation on localising strftime for your own locale +*/ +Date.ext.locales = { }; + +/** + * \brief Localised strings for English (British). + * \details + * This will be used for any of the English dialects unless overridden by a country specific one. + * This is the default locale if none specified + */ +Date.ext.locales.en = { + a: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], + A: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], + b: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + B: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + c: '%a %d %b %Y %T %Z', + p: ['AM', 'PM'], + P: ['am', 'pm'], + x: '%d/%m/%y', + X: '%T' +}; + +//! \cond FALSE +// Localised strings for US English +Date.ext.locales['en-US'] = Date.ext.locales.en; +Date.ext.locales['en-US'].c = '%a %d %b %Y %r %Z'; +Date.ext.locales['en-US'].x = '%D'; +Date.ext.locales['en-US'].X = '%r'; + +// Localised strings for British English +Date.ext.locales['en-GB'] = Date.ext.locales.en; + +// Localised strings for Australian English +Date.ext.locales['en-AU'] = Date.ext.locales['en-GB']; +//! \endcond + +//! \brief List of supported format specifiers. +/** + * \details + * \arg \%a - abbreviated weekday name according to the current locale + * \arg \%A - full weekday name according to the current locale + * \arg \%b - abbreviated month name according to the current locale + * \arg \%B - full month name according to the current locale + * \arg \%c - preferred date and time representation for the current locale + * \arg \%C - century number (the year divided by 100 and truncated to an integer, range 00 to 99) + * \arg \%d - day of the month as a decimal number (range 01 to 31) + * \arg \%D - same as %m/%d/%y + * \arg \%e - day of the month as a decimal number, a single digit is preceded by a space (range ' 1' to '31') + * \arg \%g - like %G, but without the century + * \arg \%G - The 4-digit year corresponding to the ISO week number + * \arg \%h - same as %b + * \arg \%H - hour as a decimal number using a 24-hour clock (range 00 to 23) + * \arg \%I - hour as a decimal number using a 12-hour clock (range 01 to 12) + * \arg \%j - day of the year as a decimal number (range 001 to 366) + * \arg \%m - month as a decimal number (range 01 to 12) + * \arg \%M - minute as a decimal number + * \arg \%n - newline character + * \arg \%p - either `AM' or `PM' according to the given time value, or the corresponding strings for the current locale + * \arg \%P - like %p, but lower case + * \arg \%r - time in a.m. and p.m. notation equal to %I:%M:%S %p + * \arg \%R - time in 24 hour notation equal to %H:%M + * \arg \%S - second as a decimal number + * \arg \%t - tab character + * \arg \%T - current time, equal to %H:%M:%S + * \arg \%u - weekday as a decimal number [1,7], with 1 representing Monday + * \arg \%U - week number of the current year as a decimal number, starting with + * the first Sunday as the first day of the first week + * \arg \%V - The ISO 8601:1988 week number of the current year as a decimal number, + * range 01 to 53, where week 1 is the first week that has at least 4 days + * in the current year, and with Monday as the first day of the week. + * \arg \%w - day of the week as a decimal, Sunday being 0 + * \arg \%W - week number of the current year as a decimal number, starting with the + * first Monday as the first day of the first week + * \arg \%x - preferred date representation for the current locale without the time + * \arg \%X - preferred time representation for the current locale without the date + * \arg \%y - year as a decimal number without a century (range 00 to 99) + * \arg \%Y - year as a decimal number including the century + * \arg \%z - numerical time zone representation + * \arg \%Z - time zone name or abbreviation + * \arg \%% - a literal `\%' character + */ +Date.ext.formats = { + a: function(d) { return Date.ext.locales[d.locale].a[d.getDay()]; }, + A: function(d) { return Date.ext.locales[d.locale].A[d.getDay()]; }, + b: function(d) { return Date.ext.locales[d.locale].b[d.getMonth()]; }, + B: function(d) { return Date.ext.locales[d.locale].B[d.getMonth()]; }, + c: 'toLocaleString', + C: function(d) { return Date.ext.util.xPad(parseInt(d.getFullYear()/100, 10), 0); }, + d: ['getDate', '0'], + e: ['getDate', ' '], + g: function(d) { return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100, 10), 0); }, + G: function(d) { + var y = d.getFullYear(); + var V = parseInt(Date.ext.formats.V(d), 10); + var W = parseInt(Date.ext.formats.W(d), 10); + + if(W > V) { + y++; + } else if(W===0 && V>=52) { + y--; + } + + return y; + }, + H: ['getHours', '0'], + I: function(d) { var I=d.getHours()%12; return Date.ext.util.xPad(I===0?12:I, 0); }, + j: function(d) { + var ms = d - new Date('' + d.getFullYear() + '/1/1 GMT'); + ms += d.getTimezoneOffset()*60000; + var doy = parseInt(ms/60000/60/24, 10)+1; + return Date.ext.util.xPad(doy, 0, 100); + }, + m: function(d) { return Date.ext.util.xPad(d.getMonth()+1, 0); }, + M: ['getMinutes', '0'], + p: function(d) { return Date.ext.locales[d.locale].p[d.getHours() >= 12 ? 1 : 0 ]; }, + P: function(d) { return Date.ext.locales[d.locale].P[d.getHours() >= 12 ? 1 : 0 ]; }, + S: ['getSeconds', '0'], + u: function(d) { var dow = d.getDay(); return dow===0?7:dow; }, + U: function(d) { + var doy = parseInt(Date.ext.formats.j(d), 10); + var rdow = 6-d.getDay(); + var woy = parseInt((doy+rdow)/7, 10); + return Date.ext.util.xPad(woy, 0); + }, + V: function(d) { + var woy = parseInt(Date.ext.formats.W(d), 10); + var dow1_1 = (new Date('' + d.getFullYear() + '/1/1')).getDay(); + // First week is 01 and not 00 as in the case of %U and %W, + // so we add 1 to the final result except if day 1 of the year + // is a Monday (then %W returns 01). + // We also need to subtract 1 if the day 1 of the year is + // Friday-Sunday, so the resulting equation becomes: + var idow = woy + (dow1_1 > 4 || dow1_1 <= 1 ? 0 : 1); + if(idow == 53 && (new Date('' + d.getFullYear() + '/12/31')).getDay() < 4) + { + idow = 1; + } + else if(idow === 0) + { + idow = Date.ext.formats.V(new Date('' + (d.getFullYear()-1) + '/12/31')); + } + + return Date.ext.util.xPad(idow, 0); + }, + w: 'getDay', + W: function(d) { + var doy = parseInt(Date.ext.formats.j(d), 10); + var rdow = 7-Date.ext.formats.u(d); + var woy = parseInt((doy+rdow)/7, 10); + return Date.ext.util.xPad(woy, 0, 10); + }, + y: function(d) { return Date.ext.util.xPad(d.getFullYear()%100, 0); }, + Y: 'getFullYear', + z: function(d) { + var o = d.getTimezoneOffset(); + var H = Date.ext.util.xPad(parseInt(Math.abs(o/60), 10), 0); + var M = Date.ext.util.xPad(o%60, 0); + return (o>0?'-':'+') + H + M; + }, + Z: function(d) { return d.toString().replace(/^.*\(([^)]+)\)$/, '$1'); }, + '%': function(d) { return '%'; } +}; + +/** +\brief List of aggregate format specifiers. +\details +Aggregate format specifiers map to a combination of basic format specifiers. +These are implemented in terms of Date.ext.formats. + +A format specifier that maps to 'locale' is read from Date.ext.locales[current-locale]. + +\sa Date.ext.formats +*/ +Date.ext.aggregates = { + c: 'locale', + D: '%m/%d/%y', + h: '%b', + n: '\n', + r: '%I:%M:%S %p', + R: '%H:%M', + t: '\t', + T: '%H:%M:%S', + x: 'locale', + X: 'locale' +}; + +//! \cond FALSE +// Cache timezone values because they will never change for a given JS instance +Date.ext.aggregates.z = Date.ext.formats.z(new Date()); +Date.ext.aggregates.Z = Date.ext.formats.Z(new Date()); +//! \endcond + +//! List of unsupported format specifiers. +/** + * \details + * All format specifiers supported by the PHP implementation are supported by + * this javascript implementation. + */ +Date.ext.unsupported = { }; + + +/** + * \brief Formats the date according to the specified format. + * \param fmt The format to format the date in. This may be a combination of the following: + * \copydoc formats + * + * \return A string representation of the date formatted based on the passed in parameter + * \sa http://www.php.net/strftime for documentation on format specifiers +*/ +Date.prototype.strftime=function(fmt) +{ + // Fix locale if declared locale hasn't been defined + // After the first call this condition should never be entered unless someone changes the locale + if(!(this.locale in Date.ext.locales)) + { + if(this.locale.replace(/-[a-zA-Z]+$/, '') in Date.ext.locales) + { + this.locale = this.locale.replace(/-[a-zA-Z]+$/, ''); + } + else + { + this.locale = 'en-GB'; + } + } + + var d = this; + // First replace aggregates + while(fmt.match(/%[cDhnrRtTxXzZ]/)) + { + fmt = fmt.replace(/%([cDhnrRtTxXzZ])/g, function(m0, m1) + { + var f = Date.ext.aggregates[m1]; + return (f == 'locale' ? Date.ext.locales[d.locale][m1] : f); + }); + } + + + // Now replace formats - we need a closure so that the date object gets passed through + var str = fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g, function(m0, m1) + { + var f = Date.ext.formats[m1]; + if(typeof(f) == 'string') { + return d[f](); + } else if(typeof(f) == 'function') { + return f.call(d, d); + } else if(typeof(f) == 'object' && typeof(f[0]) == 'string') { + return Date.ext.util.xPad(d[f[0]](), f[1]); + } else { + return m1; + } + }); + d=null; + return str; +}; + +/** + * \mainpage strftime for Javascript + * + * \section toc Table of Contents + * - \ref intro_sec + * - Download full source / minified + * - \subpage usage + * - \subpage format_specifiers + * - \subpage localisation + * - \link strftime.js API Documentation \endlink + * - \subpage demo + * - \subpage changelog + * - \subpage faq + * - Feedback + * - \subpage copyright_licence + * + * \section intro_sec Introduction + * + * C and PHP developers have had access to a built in strftime function for a long time. + * This function is an easy way to format dates and times for various display needs. + * + * This library brings the flexibility of strftime to the javascript Date object + * + * Use this library if you frequently need to format dates in javascript in a variety of ways. For example, + * if you have PHP code that writes out formatted dates, and want to mimic the functionality using + * progressively enhanced javascript, then this library can do exactly what you want. + * + * + * + * + * \page usage Example usage + * + * \section usage_sec Usage + * This library may be used as follows: + * \code + * var d = new Date(); + * + * var ymd = d.strftime('%Y/%m/%d'); + * var iso = d.strftime('%Y-%m-%dT%H:%M:%S%z'); + * + * \endcode + * + * \subsection examples Examples + * + * To get the current time in hours and minutes: + * \code + * var d = new Date(); + * d.strftime("%H:%M"); + * \endcode + * + * To get the current time with seconds in AM/PM notation: + * \code + * var d = new Date(); + * d.strftime("%r"); + * \endcode + * + * To get the year and day of the year for August 23, 2009: + * \code + * var d = new Date('2009/8/23'); + * d.strftime("%Y-%j"); + * \endcode + * + * \section demo_sec Demo + * + * Try your own examples on the \subpage demo page. You can use any of the supported + * \subpage format_specifiers. + * + * + * + * + * \page localisation Localisation + * You can localise strftime by implementing the short and long forms for days of the + * week and months of the year, and the localised aggregates for the preferred date + * and time representation for your locale. You need to add your locale to the + * Date.ext.locales object. + * + * \section localising_fr Localising for french + * + * For example, this is how we'd add French language strings to the locales object: + * \dontinclude index.html + * \skip Generic french + * \until }; + * The % format specifiers are all defined in \ref formats. You can use any of those. + * + * This locale definition may be included in your own source file, or in the HTML file + * including \c strftime.js, however it must be defined \em after including \c strftime.js + * + * The above definition includes generic french strings and formats that are used in France. + * Other french speaking countries may have other representations for dates and times, so we + * need to override this for them. For example, Canadian french uses a Y-m-d date format, + * while French french uses d.m.Y. We fix this by defining Canadian french to be the same + * as generic french, and then override the format specifiers for \c x for the \c fr-CA locale: + * \until End french + * + * You can now use any of the French locales at any time by setting \link Date.prototype.locale Date.locale \endlink + * to \c "fr", \c "fr-FR", \c "fr-CA", or any other french dialect: + * \code + * var d = new Date("2008/04/22"); + * d.locale = "fr"; + * + * d.strftime("%A, %d %B == %x"); + * \endcode + * will return: + * \code + * mardi, 22 avril == 22.04.2008 + * \endcode + * While changing the locale to "fr-CA": + * \code + * d.locale = "fr-CA"; + * + * d.strftime("%A, %d %B == %x"); + * \endcode + * will return: + * \code + * mardi, 22 avril == 2008-04-22 + * \endcode + * + * You can use any of the format specifiers defined at \ref formats + * + * The locale for all dates defaults to the value of the \c lang attribute of your HTML document if + * it is set, or to \c "en" otherwise. + * \note + * Your locale definitions \b MUST be added to the locale object before calling + * \link Date.prototype.strftime Date.strftime \endlink. + * + * \sa \ref formats for a list of format specifiers that can be used in your definitions + * for c, x and X. + * + * \section locale_names Locale names + * + * Locale names are defined in RFC 1766. Typically, a locale would be a two letter ISO639 + * defined language code and an optional ISO3166 defined country code separated by a - + * + * eg: fr-FR, de-DE, hi-IN + * + * \sa http://www.ietf.org/rfc/rfc1766.txt + * \sa http://www.loc.gov/standards/iso639-2/php/code_list.php + * \sa http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm + * + * \section locale_fallback Locale fallbacks + * + * If a locale object corresponding to the fully specified locale isn't found, an attempt will be made + * to fall back to the two letter language code. If a locale object corresponding to that isn't found + * either, then the locale will fall back to \c "en". No warning will be issued. + * + * For example, if we define a locale for de: + * \until }; + * Then set the locale to \c "de-DE": + * \code + * d.locale = "de-DE"; + * + * d.strftime("%a, %d %b"); + * \endcode + * In this case, the \c "de" locale will be used since \c "de-DE" has not been defined: + * \code + * Di, 22 Apr + * \endcode + * + * Swiss german will return the same since it will also fall back to \c "de": + * \code + * d.locale = "de-CH"; + * + * d.strftime("%a, %d %b"); + * \endcode + * \code + * Di, 22 Apr + * \endcode + * + * We need to override the \c a specifier for Swiss german, since it's different from German german: + * \until End german + * We now get the correct results: + * \code + * d.locale = "de-CH"; + * + * d.strftime("%a, %d %b"); + * \endcode + * \code + * Die, 22 Apr + * \endcode + * + * \section builtin_locales Built in locales + * + * This library comes with pre-defined locales for en, en-GB, en-US and en-AU. + * + * + * + * + * \page format_specifiers Format specifiers + * + * \section specifiers Format specifiers + * strftime has several format specifiers defined by the Open group at + * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html + * + * PHP added a few of its own, defined at http://www.php.net/strftime + * + * This javascript implementation supports all the PHP specifiers + * + * \subsection supp Supported format specifiers: + * \copydoc formats + * + * \subsection unsupportedformats Unsupported format specifiers: + * \copydoc unsupported + * + * + * + * + * \page demo strftime demo + *
          + * \copydoc formats + *
          + * \htmlinclude index.html + * + * + * + * + * \page faq FAQ + * + * \section how_tos Usage + * + * \subsection howtouse Is there a manual on how to use this library? + * + * Yes, see \ref usage + * + * \subsection wheretoget Where can I get a minified version of this library? + * + * The minified version is available here. + * + * \subsection which_specifiers Which format specifiers are supported? + * + * See \ref format_specifiers + * + * \section whys Why? + * + * \subsection why_lib Why this library? + * + * I've used the strftime function in C, PHP and the Unix shell, and found it very useful + * to do date formatting. When I needed to do date formatting in javascript, I decided + * that it made the most sense to just reuse what I'm already familiar with. + * + * \subsection why_another Why another strftime implementation for Javascript? + * + * Yes, there are other strftime implementations for Javascript, but I saw problems with + * all of them that meant I couldn't use them directly. Some implementations had bad + * designs. For example, iterating through all possible specifiers and scanning the string + * for them. Others were tied to specific libraries like prototype. + * + * Trying to extend any of the existing implementations would have required only slightly + * less effort than writing this from scratch. In the end it took me just about 3 hours + * to write the code and about 6 hours battling with doxygen to write these docs. + * + * I also had an idea of how I wanted to implement this, so decided to try it. + * + * \subsection why_extend_date Why extend the Date class rather than subclass it? + * + * I tried subclassing Date and failed. I didn't want to waste time on figuring + * out if there was a problem in my code or if it just wasn't possible. Adding to the + * Date.prototype worked well, so I stuck with it. + * + * I did have some worries because of the way for..in loops got messed up after json.js added + * to the Object.prototype, but that isn't an issue here since {} is not a subclass of Date. + * + * My last doubt was about the Date.ext namespace that I created. I still don't like this, + * but I felt that \c ext at least makes clear that this is external or an extension. + * + * It's quite possible that some future version of javascript will add an \c ext or a \c locale + * or a \c strftime property/method to the Date class, but this library should probably + * check for capabilities before doing what it does. + * + * \section curiosity Curiosity + * + * \subsection how_big How big is the code? + * + * \arg 26K bytes with documentation + * \arg 4242 bytes minified using YUI Compressor + * \arg 1477 bytes minified and gzipped + * + * \subsection how_long How long did it take to write this? + * + * 15 minutes for the idea while I was composing this blog post: + * http://tech.bluesmoon.info/2008/04/javascript-date-functions.html + * + * 3 hours in one evening to write v1.0 of the code and 6 hours the same + * night to write the docs and this manual. As you can tell, I'm fairly + * sleepy. + * + * Versions 1.1 and 1.2 were done in a couple of hours each, and version 1.3 + * in under one hour. + * + * \section contributing Contributing + * + * \subsection how_to_rfe How can I request features or make suggestions? + * + * You can leave a comment on my blog post about this library here: + * http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html + * + * \subsection how_to_contribute Can I/How can I contribute code to this library? + * + * Yes, that would be very nice, thank you. You can do various things. You can make changes + * to the library, and make a diff against the current file and mail me that diff at + * philip@bluesmoon.info, or you could just host the new file on your own servers and add + * your name to the copyright list at the top stating which parts you've added. + * + * If you do mail me a diff, let me know how you'd like to be listed in the copyright section. + * + * \subsection copyright_signover Who owns the copyright on contributed code? + * + * The contributor retains copyright on contributed code. + * + * In some cases I may use contributed code as a template and write the code myself. In this + * case I'll give the contributor credit for the idea, but will not add their name to the + * copyright holders list. + * + * + * + * + * \page copyright_licence Copyright & Licence + * + * \section copyright Copyright + * \dontinclude strftime.js + * \skip Copyright + * \until rights + * + * \section licence Licence + * \skip This code + * \until SUCH DAMAGE. + * + * + * + * \page changelog ChangeLog + * + * \par 1.3 - 2008/06/17: + * - Fixed padding issue with negative timezone offsets in %r + * reported and fixed by Mikko + * - Added support for %P + * - Internationalised %r, %p and %P + * + * \par 1.2 - 2008/04/27: + * - Fixed support for c (previously it just returned toLocaleString()) + * - Add support for c, x and X + * - Add locales for en-GB, en-US and en-AU + * - Make en-GB the default locale (previous was en) + * - Added more localisation docs + * + * \par 1.1 - 2008/04/27: + * - Fix bug in xPad which wasn't padding more than a single digit + * - Fix bug in j which had an off by one error for days after March 10th because of daylight savings + * - Add support for g, G, U, V and W + * + * \par 1.0 - 2008/04/22: + * - Initial release with support for a, A, b, B, c, C, d, D, e, H, I, j, m, M, p, r, R, S, t, T, u, w, y, Y, z, Z, and % + */ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.css new file mode 100644 index 0000000..a44c356 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.css @@ -0,0 +1,557 @@ +/** + * @license angular-circular-timepicker version: 0.1.0 + * Copyright 2016 sidaudhi.com, Inc. http://www.sidaudhi.com + * License: MIT + * + * @author Siddharth Audhinarayanan + * @since 2016-Jan-31 + */ + +.datetimepicker { + font-family: Arial; +} + +.datetimepicker div, +.datetimepicker span, +.datetimepicker object, +.datetimepicker iframe, +.datetimepicker h1, +.datetimepicker h2, +.datetimepicker h3, +.datetimepicker h4, +.datetimepicker h5, +.datetimepicker h6, +.datetimepicker p, +.datetimepicker pre, +.datetimepicker a, +.datetimepicker abbr, +.datetimepicker acronym, +.datetimepicker address, +.datetimepicker code, +.datetimepicker del, +.datetimepicker dfn, +.datetimepicker em, +.datetimepicker img, +.datetimepicker dl, +.datetimepicker dt, +.datetimepicker dd, +.datetimepicker ol, +.datetimepicker ul, +.datetimepicker li, +.datetimepicker fieldset, +.datetimepicker form, +.datetimepicker label, +.datetimepicker legend, +.datetimepicker caption, +.datetimepicker tbody, +.datetimepicker tfoot, +.datetimepicker thead, +.datetimepicker tr { + margin: 0; + padding: 0; + border: 0; + outline: 0; + font-weight: inherit; + font-style: inherit; + font-family: inherit; + font-size: 100%; + vertical-align: baseline; +} + +.datetimepicker table { + border-collapse: separate; + border-spacing: 0; + vertical-align: middle; +} + +.datetimepicker caption, +.datetimepicker th, +.datetimepicker td { + text-align: left; + font-weight: normal; + vertical-align: middle; +} + +.datetimepicker a img { + border: none; +} + +.datetimepicker .left { + float: left; +} + +.datetimepicker .right { + float: right; +} + +.datetimepicker .datetimepicker-display { + padding: 6px 12px; + border: 1px solid rgba(0,0,0,0.15); + font-size: 15px; + min-height: 34px; +} + +.datetimepicker .datetimepicker-toggle { + float: right; + padding: 7px; + border: 0px; + cursor: pointer; +} + +.datetimepicker .datetimepicker-modal { + top: 0; + bottom: 0; + left: 0; + right: 0; + background-color: rgba(0,0,0,0.5); + position: fixed; + z-index: 990; +} + +.datetimepicker .datetimepicker-close { + position: fixed; + right: 10px; + top: 5px; + color: #fff; + font-size: 24px; + cursor: pointer; + z-index: 999; +} + +.datetimepicker .datetimepicker-preview { + padding: 5px; + text-align: center; + cursor: pointer; + font-size: 18px; + background-color: #0574AC; + color: #fff; +} + +.datetimepicker .datetimepicker-content { + min-height: 300px; + background-color: #fff; + border: 1px solid rgba(0,0,0,0.15); + border-top: 0px; + position: relative; + width: 290px; + z-index: 998; +} + +.datetimepicker .datetimepicker-content.datetimepicker-absolute { + position: fixed; + top: calc(30% - 100px); + left: calc(50% - 145px); + border: 0px; + -webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5); + box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5); +} + +.datetimepicker .datetimepicker-content .datetimepicker-tabs { + background-color: #0574AC; +} + +.datetimepicker .datetimepicker-content .datetimepicker-tabs .datetimepicker-tab { + width: 50%; + display: inline-block; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + padding: 5px; + text-align: center; + font-size: 13px; + text-transform: uppercase; + color: #fff; + cursor: pointer; + background-color: #f3f3f4; + color: #0574AC; +} + +.datetimepicker .datetimepicker-content .datetimepicker-tabs .datetimepicker-tab.active { + background-color: #0574AC; + color: #f3f3f4; + font-weight: bold; +} + +.datetimepicker .datetimepicker-content .datetimepicker-month { + border-bottom: 1px solid rgba(0,0,0,0.2); + background-color: #fff; +} + +.datetimepicker .datetimepicker-content .datetimepicker-month .datetimepicker-current-month { + text-align: center; + padding: 10px 10px; +} + +.datetimepicker .datetimepicker-calendar { + text-align: center; + padding: 10px 0px; +} + +.datetimepicker .datetimepicker-calendar .datetimepicker-day { + width: 38px; + display: inline-block; + text-align: center; + padding: 10px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + font-weight: bold; + color: #0574AC; + font-size: 15px; +} + +.datetimepicker .datetimepicker-calendar .datetimepicker-day.datetimepicker-leading-day, +.datetimepicker .datetimepicker-calendar .datetimepicker-day.datetimepicker-trailing-day { + font-weight: normal; + color: rgba(0,0,0,0.25); +} + +.datetimepicker .datetimepicker-calendar .datetimepicker-day.datetimepicker-active-day { + font-weight: normal; + color: rgba(0,0,0,0.75); + font-size: 14px; +} + +.datetimepicker .datetimepicker-calendar .datetimepicker-day.datetimepicker-active-day.selected, +.datetimepicker .datetimepicker-calendar .datetimepicker-day.datetimepicker-active-day:hover { + color: #fff; + background-color: #0574AC; + cursor: pointer; +} + +.datetimepicker .time-circle-outer { + width: 240px; + height: 240px; + border: 3px dashed rgba(0,0,0,0.1); + -webkit-border-radius: 50%; + border-radius: 50%; + margin: 30px auto; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + position: relative; +} + +.datetimepicker .time-circle-outer .time-circle-center { + position: absolute; + top: calc(50% - 10px); + left: calc(50% - 10px); + width: 20px; + height: 20px; + background-color: #0574AC; + -webkit-border-radius: 50%; + border-radius: 50%; +} + +.datetimepicker .time-circle-outer .time-meridian { + position: absolute; + top: -70px; + width: 30px; + height: 30px; + padding: 7px 5px; + -webkit-border-radius: 50%; + border-radius: 50%; + font-size: 13px; + font-weight: bold; + cursor: pointer; + color: #0574AC; + text-align: center; +} + +.datetimepicker .time-circle-outer .time-meridian.time-left { + left: -15px; +} + +.datetimepicker .time-circle-outer .time-meridian.time-right { + right: -15px; +} + +.datetimepicker .time-circle-outer .time-meridian.selected { + background-color: #0574AC; + color: #fff; +} + +.datetimepicker .time-circle-outer .time-circle-hand { + width: 6px; + height: 82px; + position: absolute; + left: calc(50% - 3px); + top: calc(50% - 82px); + -webkit-transform-origin: 50% 100%; + -moz-transform-origin: 50% 100%; + -o-transform-origin: 50% 100%; + -ms-transform-origin: 50% 100%; + transform-origin: 50% 100%; + background-color: #0574AC; +} + +.datetimepicker .time-circle-outer .time-circle-hand.deg-1 { + -webkit-transform: rotate(30deg); + -moz-transform: rotate(30deg); + -o-transform: rotate(30deg); + -ms-transform: rotate(30deg); + transform: rotate(30deg); +} + +.datetimepicker .time-circle-outer .time-circle-hand.deg-2 { + -webkit-transform: rotate(60deg); + -moz-transform: rotate(60deg); + -o-transform: rotate(60deg); + -ms-transform: rotate(60deg); + transform: rotate(60deg); +} + +.datetimepicker .time-circle-outer .time-circle-hand.deg-3 { + -webkit-transform: rotate(90deg); + -moz-transform: rotate(90deg); + -o-transform: rotate(90deg); + -ms-transform: rotate(90deg); + transform: rotate(90deg); +} + +.datetimepicker .time-circle-outer .time-circle-hand.deg-4 { + -webkit-transform: rotate(120deg); + -moz-transform: rotate(120deg); + -o-transform: rotate(120deg); + -ms-transform: rotate(120deg); + transform: rotate(120deg); +} + +.datetimepicker .time-circle-outer .time-circle-hand.deg-5 { + -webkit-transform: rotate(150deg); + -moz-transform: rotate(150deg); + -o-transform: rotate(150deg); + -ms-transform: rotate(150deg); + transform: rotate(150deg); +} + +.datetimepicker .time-circle-outer .time-circle-hand.deg-6 { + -webkit-transform: rotate(180deg); + -moz-transform: rotate(180deg); + -o-transform: rotate(180deg); + -ms-transform: rotate(180deg); + transform: rotate(180deg); +} + +.datetimepicker .time-circle-outer .time-circle-hand.deg-7 { + -webkit-transform: rotate(210deg); + -moz-transform: rotate(210deg); + -o-transform: rotate(210deg); + -ms-transform: rotate(210deg); + transform: rotate(210deg); +} + +.datetimepicker .time-circle-outer .time-circle-hand.deg-8 { + -webkit-transform: rotate(240deg); + -moz-transform: rotate(240deg); + -o-transform: rotate(240deg); + -ms-transform: rotate(240deg); + transform: rotate(240deg); +} + +.datetimepicker .time-circle-outer .time-circle-hand.deg-9 { + -webkit-transform: rotate(270deg); + -moz-transform: rotate(270deg); + -o-transform: rotate(270deg); + -ms-transform: rotate(270deg); + transform: rotate(270deg); +} + +.datetimepicker .time-circle-outer .time-circle-hand.deg-10 { + -webkit-transform: rotate(300deg); + -moz-transform: rotate(300deg); + -o-transform: rotate(300deg); + -ms-transform: rotate(300deg); + transform: rotate(300deg); +} + +.datetimepicker .time-circle-outer .time-circle-hand.deg-11 { + -webkit-transform: rotate(330deg); + -moz-transform: rotate(330deg); + -o-transform: rotate(330deg); + -ms-transform: rotate(330deg); + transform: rotate(330deg); +} + +.datetimepicker .time-circle-outer .time-circle-hand.deg-12 { + -webkit-transform: rotate(360deg); + -moz-transform: rotate(360deg); + -o-transform: rotate(360deg); + -ms-transform: rotate(360deg); + transform: rotate(360deg); +} + +.datetimepicker .time-circle-outer .time-circle-hand-large { + height: 120px; + top: calc(50% - 120px); +} + +.datetimepicker .time-circle-outer .time { + position: absolute; + margin-top: -15px; + margin-left: -15px; + background-color: #b4b4b4; + -webkit-border-radius: 50%; + border-radius: 50%; + padding: 5px; + height: 28px; + width: 28px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + text-align: center; + font-size: 13px; + cursor: pointer; + color: rgba(0,0,0,0.75); +} + +.datetimepicker .time-circle-outer .time:hover, +.datetimepicker .time-circle-outer .time.selected { + background-color: #0574AC; + color: #fff; +} + +.datetimepicker .time-circle-outer .time-1 { + left: calc(50% + 60px); + top: 16.076951545867374px; +} + +.datetimepicker .time-circle-outer .time-2 { + left: calc(50% + 103.92304845413263px); + top: 60px; +} + +.datetimepicker .time-circle-outer .time-3 { + left: calc(50% + 120px); + top: 120px; +} + +.datetimepicker .time-circle-outer .time-4 { + left: calc(50% + 103.92304845413263px); + top: 180px; +} + +.datetimepicker .time-circle-outer .time-5 { + left: calc(50% + 60px); + top: 223.92304845413264px; +} + +.datetimepicker .time-circle-outer .time-6 { + left: 50%; + top: 240px; +} + +.datetimepicker .time-circle-outer .time-11 { + left: calc(50% - 60px); + top: 16.076951545867374px; +} + +.datetimepicker .time-circle-outer .time-10 { + left: calc(50% - 103.92304845413263px); + top: 60px; +} + +.datetimepicker .time-circle-outer .time-9 { + left: calc(50% - 120px); + top: 120px; +} + +.datetimepicker .time-circle-outer .time-8 { + left: calc(50% - 103.92304845413263px); + top: 180px; +} + +.datetimepicker .time-circle-outer .time-7 { + left: calc(50% - 60px); + top: 223.92304845413264px; +} + +.datetimepicker .time-circle-outer .time-12 { + left: 50%; + top: 0px; +} + +.datetimepicker .time-circle-outer .time-circle-inner { + width: 164px; + height: 164px; + border: 3px dashed rgba(0,0,0,0.1); + -webkit-border-radius: 50%; + border-radius: 50%; + margin: 35px auto; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + position: relative; +} + +.datetimepicker .time-circle-outer .time-circle-inner .time-1 { + left: calc(50% + 41px); + top: 10.985916889676034px; +} + +.datetimepicker .time-circle-outer .time-circle-inner .time-2 { + left: calc(50% + 71.01408311032397px); + top: 41px; +} + +.datetimepicker .time-circle-outer .time-circle-inner .time-3 { + left: calc(50% + 82px); + top: 82px; +} + +.datetimepicker .time-circle-outer .time-circle-inner .time-4 { + left: calc(50% + 71.01408311032397px); + top: 123px; +} + +.datetimepicker .time-circle-outer .time-circle-inner .time-5 { + left: calc(50% + 41px); + top: 153.01408311032395px; +} + +.datetimepicker .time-circle-outer .time-circle-inner .time-6 { + left: 50%; + top: 164px; +} + +.datetimepicker .time-circle-outer .time-circle-inner .time-11 { + left: calc(50% - 41px); + top: 10.985916889676034px; +} + +.datetimepicker .time-circle-outer .time-circle-inner .time-10 { + left: calc(50% - 71.01408311032397px); + top: 41px; +} + +.datetimepicker .time-circle-outer .time-circle-inner .time-9 { + left: calc(50% - 82px); + top: 82px; +} + +.datetimepicker .time-circle-outer .time-circle-inner .time-8 { + left: calc(50% - 71.01408311032397px); + top: 123px; +} + +.datetimepicker .time-circle-outer .time-circle-inner .time-7 { + left: calc(50% - 41px); + top: 153.01408311032395px; +} + +.datetimepicker .time-circle-outer .time-circle-inner .time-12 { + left: 50%; + top: 0px; +} + +.datetimepicker .datetimepicker-action { + cursor: pointer; + font-weight: bold; + line-height: 18px; + padding: 10px 10px; +} + +.datetimepicker .datetimepicker-action:hover { + background-color: rgba(5, 116, 172, 1); + cursor: pointer; +} \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.js new file mode 100644 index 0000000..ae69a91 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/date_time_picker.js @@ -0,0 +1,277 @@ + String.prototype.paddingLeft = function (paddingValue) { + return String(paddingValue + this).slice(-paddingValue.length); + }; + +angular.module("app/scripts/ng_js_att_tpls/datepicker/dateTimePickerPopup.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("app/scripts/ng_js_att_tpls/datepicker/dateTimePickerPopup.html", + "
          \n" + + "
          \n" + + " \n" + + + " \n" + + "
          \n" + + + '
          ' + + '
          ' + + + '
            ' + + '
          • ' + + 'Date' + + '
          • ' + + '
          • ' + + 'Time' + + '
          • ' + + '
          ' + + + '
          ' + + '
          ' + +'
          ' + +'
          ' + + '
          {{displayMonth}} {{year}}
          ' + + '
          ' + + '
          ' + + '
          {{day | limitTo: 1}}
          ' + + '
          {{d}}
          ' + + '
          {{d}}
          ' + + '
          {{d}}
          ' + + '
          ' + + '
          ' + + + '
          ' + + '
          ' + + '
          {{hour}}:{{minute}}
          ' + + '
          ' + + '
          ' + + '
          AM
          ' + + '
          PM
          ' + + '
          ' + + '
          ' + + '
          {{time}}
          ' + + '
          ' + + '
          ' + + '
          {{time}}
          ' + + '
          ' + + '
          ' + + '
          ' + + + '
          ' + + '
          ' + + + "
          \n" + + ""); +}]); + +angular.module('quantum').requires.push("app/scripts/ng_js_att_tpls/datepicker/dateTimePickerPopup.html"); + +angular.module('quantum') +.directive('dateTimePickerPopup', ['$document', 'datepickerService', '$isElement', '$documentBind', function($document, datepickerService, $isElement, $documentBind) { + var link = function (scope, elem, attr) { + datepickerService.bindScope(attr, scope); + + scope.isOpen = false; + + var toggle = scope.toggle = function (show) { + if(show === true || show === false) { + scope.isOpen = show; + } else { + scope.isOpen = !scope.isOpen; + } + }; + +// scope.$watch('current', function () { +// toggle(false); +// }); + + var outsideClick = function (e) { + var isElement = $isElement(angular.element(e.target), elem, $document); + if(!isElement) { + toggle(false); + scope.$apply(); + } + }; + + $documentBind.click('isOpen', outsideClick, scope); + + scope.tabs = [{ + title: 'DATE', + url: '#option1' + }, { + title: 'TIME', + url: '#option2', + selected: true + } + ]; + + //-------------------------------------- + + scope.state = false; + scope.tab = 'time'; + scope.setTab = function(tab){ + scope.tab = tab; + }; + scope.config = { + modal: true, + color:'rgba(5, 116, 172, 1)', + backgroundColor: 'rgba(0,0,0,0.75)' + }; + scope.months = ["January","February","March","April","May","June","July","Augusta","September","October","November","December"]; + scope.dayNames = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]; + scope.$watch('current',function(value){ + var m; + if(value) + m = moment(value); + else + m = moment(); + m = m.minute(5*Math.ceil(m.minute()/5)); + scope.display = m.format('YYYY-MM-DD hh:mm A'); + scope.days = scope.getDaysInMonth(m.year(),m.month()); + scope.minute = m.minute(); + scope.meridian = m.format('A'); + scope.hour = scope.meridian == 'PM' ? m.hour() - 12: m.hour(); + if(scope.hour==0) scope.hour = 12; + scope.datePreview = m.format('YYYY-MM-DD'); + scope.timePreview = m.format('hh:mm A'); + scope.displayMonth = scope.months[m.month()]; + scope.day = m.date(); + scope.year = m.year(); + + }); + + scope.setDay = function(date){ + scope.current = moment(scope.current).date(date).toDate(); + }; + + scope.setState = function(state){ + scope.state = false; + }; + + scope.setHour = function(hour){ + if(scope.meridian == 'PM' && hour < 12) + hour = hour + 12; + if(scope.meridian == 'AM' && hour == 12) + hour = hour - 12; + scope.current = moment(scope.current).hour(hour).toDate(); + }; + + scope.setMeridian = function(meridian){ + var m = moment(scope.current); + + if(meridian == 'AM'){ + if(m.hours()>=12){ + m = m.add(-12,'hours'); + scope.current = m.toDate(); + } + }else{ + if(m.hours()<12){ + m = m.add(12,'hours'); + scope.current = m.toDate(); + } + } + }; + + scope.setMinutes = function(minutes){ + scope.current = moment(scope.current).minute(minutes).toDate(); + }; + + var days = []; + for(var i=1;i<=31;i++){ + days.push(i); + } + scope.getDaysInMonth = function(year,month){ + var firstDayOfWeek = 0; + var firstDayOfMonth = new Date(year, month, 1), + lastDayOfMonth = new Date(year, month + 1, 0), + lastDayOfPreviousMonth = new Date(year, month, 0), + daysInMonth = lastDayOfMonth.getDate(), + daysInLastMonth = lastDayOfPreviousMonth.getDate(), + dayOfWeek = firstDayOfMonth.getDay(), + leadingDays = (dayOfWeek - firstDayOfWeek + 7) % 7 || 7, + trailingDays = days.slice(0, 6 * 7 - (leadingDays + daysInMonth)); + if (trailingDays.length > 7) { + trailingDays = trailingDays.slice(0, trailingDays.length-7); + } + + return { + year: year, + month: month, + days: days.slice(0, daysInMonth), + leadingDays: days.slice(- leadingDays - (31 - daysInLastMonth), daysInLastMonth), + trailingDays: trailingDays + }; + }; + + scope.addMonth = function(increment){ + scope.current = moment(scope.current).add(increment,'months').toDate(); + }; + + }; + + return { + restrict: 'EA', + replace: true, + transclude: true, + templateUrl: 'app/scripts/ng_js_att_tpls/datepicker/dateTimePickerPopup.html', + scope: { + current: "=current" + }, + compile: function (elem, attr) { + var wrapperElement = elem.find('span').eq(1); + wrapperElement.attr('current', 'current'); + datepickerService.setAttributes(attr, wrapperElement); + + return link; + } + }; +}]) +.directive('attDateTimePicker', ['$log', function($log) { + return { + restrict: 'A', + require: 'ngModel', + scope: {}, + controller: ['$scope', '$element', '$attrs', '$compile', 'datepickerConfig', 'datepickerService', function($scope, $element, $attrs, $compile, datepickerConfig, datepickerService) { + var dateFormatString = angular.isDefined($attrs.dateFormat) ? $scope.$parent.$eval($attrs.dateFormat) : datepickerConfig.dateFormat; + var selectedDateMessage = '
          the date you selected is {{$parent.current | date : \'' + dateFormatString + '\'}}
          '; + + $element.removeAttr('att-date-time-picker'); + $element.removeAttr('ng-model'); + $element.attr('ng-model', '$parent.current'); + $element.attr('aria-describedby', 'datepicker'); + $element.attr('format-date', dateFormatString); + $element.attr('att-input-deny', '[^0-9ampAMP \/:-]'); + $element.attr('maxlength', 20); + + var wrapperElement = angular.element('
          '); + wrapperElement.attr('date-time-picker-popup', ''); + wrapperElement.attr('current', 'current'); + + datepickerService.setAttributes($attrs, wrapperElement); + datepickerService.bindScope($attrs, $scope); + + wrapperElement.html(''); + wrapperElement.append($element.prop('outerHTML')); + if (navigator.userAgent.match(/MSIE 8/) === null) { + wrapperElement.append(selectedDateMessage); + } + var elm = wrapperElement.prop('outerHTML'); + + elm = $compile(elm)($scope); + $element.replaceWith(elm); + }], + link: function(scope, elem, attr, ctrl) { + if (!ctrl) { + // do nothing if no ng-model + $log.error("ng-model is required."); + return; + } + + scope.$watch('current', function(value) { + ctrl.$setViewValue(value); + }); + ctrl.$render = function() { + scope.current = ctrl.$viewValue; + }; + } + }; +}]); + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/dynamicform.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/dynamicform.js new file mode 100644 index 0000000..e711f41 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/dynamicform.js @@ -0,0 +1,112 @@ +angular.module('quantum') + .directive('formBuilder', ['$q', '$parse', '$http', '$templateCache', '$compile', '$document', '$timeout', function ($q, $parse, $http, $templateCache, $compile, $document, $timeout) { + return { + restrict: 'E', // supports using directive as element only + scope:{ + ngModel: '=', + ngFormFields: '=', + ngNumFormCols: '=', + ngTriggerMethod: '=', + ngShowFieldId: '=' + }, + link: function ($scope, element, attrs) { + $scope.element=element; + $scope.datetimeformat = "MM/dd/yyyy hh:mm a"; + + $scope.buildField = function (field, parentElement) { + var x = ''; + if(field.visible) { + if (field.fieldType === 'LIST_MULTI_SELECT') { + x = angular.element('
          '+ + '
          '+ + ''+ + '
          '); + } else if (field.fieldType === 'LIST_BOX') { + x = angular.element('
          '); + } else if((field.fieldType === 'text' || field.fieldType === 'TEXT') && field.validationType === 'DATE'){ + x = angular.element('
          '); + } else if((field.fieldType === 'text' || field.fieldType === 'TEXT') && field.validationType === 'TIMESTAMP_MIN'){ + x = angular.element('
          '); + } else if(field.fieldType === 'text' || field.fieldType === 'TEXT'){ + x = angular.element('
          '); + } else if(field.fieldType === 'CHECK_BOX'){ + x = angular.element('
          '); + } + } + parentElement.append(x); + $compile(x)($scope); + }; + $scope.buildForm = function() { + // create elements
        and a + var tbl = angular.element("
        "); + var tblBody = angular.element(""); + var row = angular.element(""); + + var ngFormFieldsLength = $scope.ngFormFields.length; + + for (var j = 0; j < ngFormFieldsLength; j++) { + var cell = angular.element(""); + $scope.buildField($scope.ngFormFields[j],cell); + row.append(cell); + + if((j!=0 && (j+1)%$scope.ngNumFormCols==0) || j==(ngFormFieldsLength-1)){ + tblBody.append(row); + row = angular.element(""); + } + } + tbl.append(tblBody); + angular.element($scope.element).html(''); + $scope.element.append(tbl); + }; + + + $scope.formFieldLuValues = {}; + $scope.getEBZFormat = function() { + if($scope.ngFormFields && $scope.ngFormFields.length>0){ + $scope.ngFormFields.forEach(function(formField) { + if(formField.fieldType === 'LIST_MULTI_SELECT') { + $scope.ngModel[formField.fieldId]= []; + if(formField.formFieldValues && formField.formFieldValues.length>0){ + formField.formFieldValues.forEach(function(entry,i) { + $scope.ngModel[formField.fieldId].push({ index: i, value: entry.id, title: entry.name, defaultValue: entry.defaultValue}); + }); + } + } else if(formField.fieldType==='LIST_BOX') { + $scope.formFieldLuValues[formField.fieldId]= []; + if(formField.formFieldValues && formField.formFieldValues.length>0){ + formField.formFieldValues.forEach(function(entry,i) { + $scope.formFieldLuValues[formField.fieldId].push({ index: i, value: entry.id, title: entry.name}); + if(entry.defaultValue){ + $scope.ngModel[formField.fieldId]={ index: i, value: entry.id, title: entry.name}; + } + }); + } + } else if(formField.fieldType === 'text' || formField.fieldType === 'TEXT' || + formField.validationType === 'DATE' || formField.validationType === 'TIMESTAMP_MIN') { + if(formField.formFieldValues && formField.formFieldValues.length>0){ + $scope.ngModel[formField.fieldId]=formField.formFieldValues[0].id; + } + } + }); + } + }; + + $scope.$watch("ngFormFields",function(newValue,oldValue) { + if($scope.ngFormFields){ + $scope.getEBZFormat(); + $scope.buildForm(); + } + }); + + $scope.triggerFormFields = function(triggerFlag) { + if(triggerFlag){ + $scope.element.html('Loading...'); + $scope.ngTriggerMethod(); + } + }; + + } + }; + }]); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/moment.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/moment.js new file mode 100644 index 0000000..b5f0b36 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/moment.js @@ -0,0 +1,3688 @@ +//! moment.js +//! version : 2.12.0 +//! authors : Tim Wood, Iskren Chernev, Moment.js contributors +//! license : MIT +//! momentjs.com + +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + global.moment = factory() +}(this, function () { 'use strict'; + + var hookCallback; + + function utils_hooks__hooks () { + return hookCallback.apply(null, arguments); + } + + // This is done to register the method called with moment() + // without creating circular dependencies. + function setHookCallback (callback) { + hookCallback = callback; + } + + function isArray(input) { + return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; + } + + function isDate(input) { + return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; + } + + function map(arr, fn) { + var res = [], i; + for (i = 0; i < arr.length; ++i) { + res.push(fn(arr[i], i)); + } + return res; + } + + function hasOwnProp(a, b) { + return Object.prototype.hasOwnProperty.call(a, b); + } + + function extend(a, b) { + for (var i in b) { + if (hasOwnProp(b, i)) { + a[i] = b[i]; + } + } + + if (hasOwnProp(b, 'toString')) { + a.toString = b.toString; + } + + if (hasOwnProp(b, 'valueOf')) { + a.valueOf = b.valueOf; + } + + return a; + } + + function create_utc__createUTC (input, format, locale, strict) { + return createLocalOrUTC(input, format, locale, strict, true).utc(); + } + + function defaultParsingFlags() { + // We need to deep clone this object. + return { + empty : false, + unusedTokens : [], + unusedInput : [], + overflow : -2, + charsLeftOver : 0, + nullInput : false, + invalidMonth : null, + invalidFormat : false, + userInvalidated : false, + iso : false + }; + } + + function getParsingFlags(m) { + if (m._pf == null) { + m._pf = defaultParsingFlags(); + } + return m._pf; + } + + function valid__isValid(m) { + if (m._isValid == null) { + var flags = getParsingFlags(m); + m._isValid = !isNaN(m._d.getTime()) && + flags.overflow < 0 && + !flags.empty && + !flags.invalidMonth && + !flags.invalidWeekday && + !flags.nullInput && + !flags.invalidFormat && + !flags.userInvalidated; + + if (m._strict) { + m._isValid = m._isValid && + flags.charsLeftOver === 0 && + flags.unusedTokens.length === 0 && + flags.bigHour === undefined; + } + } + return m._isValid; + } + + function valid__createInvalid (flags) { + var m = create_utc__createUTC(NaN); + if (flags != null) { + extend(getParsingFlags(m), flags); + } + else { + getParsingFlags(m).userInvalidated = true; + } + + return m; + } + + function isUndefined(input) { + return input === void 0; + } + + // Plugins that add properties should also add the key here (null value), + // so we can properly clone ourselves. + var momentProperties = utils_hooks__hooks.momentProperties = []; + + function copyConfig(to, from) { + var i, prop, val; + + if (!isUndefined(from._isAMomentObject)) { + to._isAMomentObject = from._isAMomentObject; + } + if (!isUndefined(from._i)) { + to._i = from._i; + } + if (!isUndefined(from._f)) { + to._f = from._f; + } + if (!isUndefined(from._l)) { + to._l = from._l; + } + if (!isUndefined(from._strict)) { + to._strict = from._strict; + } + if (!isUndefined(from._tzm)) { + to._tzm = from._tzm; + } + if (!isUndefined(from._isUTC)) { + to._isUTC = from._isUTC; + } + if (!isUndefined(from._offset)) { + to._offset = from._offset; + } + if (!isUndefined(from._pf)) { + to._pf = getParsingFlags(from); + } + if (!isUndefined(from._locale)) { + to._locale = from._locale; + } + + if (momentProperties.length > 0) { + for (i in momentProperties) { + prop = momentProperties[i]; + val = from[prop]; + if (!isUndefined(val)) { + to[prop] = val; + } + } + } + + return to; + } + + var updateInProgress = false; + + // Moment prototype object + function Moment(config) { + copyConfig(this, config); + this._d = new Date(config._d != null ? config._d.getTime() : NaN); + // Prevent infinite loop in case updateOffset creates new moment + // objects. + if (updateInProgress === false) { + updateInProgress = true; + utils_hooks__hooks.updateOffset(this); + updateInProgress = false; + } + } + + function isMoment (obj) { + return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); + } + + function absFloor (number) { + if (number < 0) { + return Math.ceil(number); + } else { + return Math.floor(number); + } + } + + function toInt(argumentForCoercion) { + var coercedNumber = +argumentForCoercion, + value = 0; + + if (coercedNumber !== 0 && isFinite(coercedNumber)) { + value = absFloor(coercedNumber); + } + + return value; + } + + // compare two arrays, return the number of differences + function compareArrays(array1, array2, dontConvert) { + var len = Math.min(array1.length, array2.length), + lengthDiff = Math.abs(array1.length - array2.length), + diffs = 0, + i; + for (i = 0; i < len; i++) { + if ((dontConvert && array1[i] !== array2[i]) || + (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { + diffs++; + } + } + return diffs + lengthDiff; + } + + function warn(msg) { + if (utils_hooks__hooks.suppressDeprecationWarnings === false && + (typeof console !== 'undefined') && console.warn) { + console.warn('Deprecation warning: ' + msg); + } + } + + function deprecate(msg, fn) { + var firstTime = true; + + return extend(function () { + if (firstTime) { + warn(msg + '\nArguments: ' + Array.prototype.slice.call(arguments).join(', ') + '\n' + (new Error()).stack); + firstTime = false; + } + return fn.apply(this, arguments); + }, fn); + } + + var deprecations = {}; + + function deprecateSimple(name, msg) { + if (!deprecations[name]) { + warn(msg); + deprecations[name] = true; + } + } + + utils_hooks__hooks.suppressDeprecationWarnings = false; + + function isFunction(input) { + return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; + } + + function isObject(input) { + return Object.prototype.toString.call(input) === '[object Object]'; + } + + function locale_set__set (config) { + var prop, i; + for (i in config) { + prop = config[i]; + if (isFunction(prop)) { + this[i] = prop; + } else { + this['_' + i] = prop; + } + } + this._config = config; + // Lenient ordinal parsing accepts just a number in addition to + // number + (possibly) stuff coming from _ordinalParseLenient. + this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source); + } + + function mergeConfigs(parentConfig, childConfig) { + var res = extend({}, parentConfig), prop; + for (prop in childConfig) { + if (hasOwnProp(childConfig, prop)) { + if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { + res[prop] = {}; + extend(res[prop], parentConfig[prop]); + extend(res[prop], childConfig[prop]); + } else if (childConfig[prop] != null) { + res[prop] = childConfig[prop]; + } else { + delete res[prop]; + } + } + } + return res; + } + + function Locale(config) { + if (config != null) { + this.set(config); + } + } + + // internal storage for locale config files + var locales = {}; + var globalLocale; + + function normalizeLocale(key) { + return key ? key.toLowerCase().replace('_', '-') : key; + } + + // pick the locale from the array + // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each + // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root + function chooseLocale(names) { + var i = 0, j, next, locale, split; + + while (i < names.length) { + split = normalizeLocale(names[i]).split('-'); + j = split.length; + next = normalizeLocale(names[i + 1]); + next = next ? next.split('-') : null; + while (j > 0) { + locale = loadLocale(split.slice(0, j).join('-')); + if (locale) { + return locale; + } + if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { + //the next array item is better than a shallower substring of this one + break; + } + j--; + } + i++; + } + return null; + } + + function loadLocale(name) { + var oldLocale = null; + // TODO: Find a better way to register and load all the locales in Node + if (!locales[name] && (typeof module !== 'undefined') && + module && module.exports) { + try { + oldLocale = globalLocale._abbr; + require('./locale/' + name); + // because defineLocale currently also sets the global locale, we + // want to undo that for lazy loaded locales + locale_locales__getSetGlobalLocale(oldLocale); + } catch (e) { } + } + return locales[name]; + } + + // This function will load locale and then set the global locale. If + // no arguments are passed in, it will simply return the current global + // locale key. + function locale_locales__getSetGlobalLocale (key, values) { + var data; + if (key) { + if (isUndefined(values)) { + data = locale_locales__getLocale(key); + } + else { + data = defineLocale(key, values); + } + + if (data) { + // moment.duration._locale = moment._locale = data; + globalLocale = data; + } + } + + return globalLocale._abbr; + } + + function defineLocale (name, config) { + if (config !== null) { + config.abbr = name; + if (locales[name] != null) { + deprecateSimple('defineLocaleOverride', + 'use moment.updateLocale(localeName, config) to change ' + + 'an existing locale. moment.defineLocale(localeName, ' + + 'config) should only be used for creating a new locale'); + config = mergeConfigs(locales[name]._config, config); + } else if (config.parentLocale != null) { + if (locales[config.parentLocale] != null) { + config = mergeConfigs(locales[config.parentLocale]._config, config); + } else { + // treat as if there is no base config + deprecateSimple('parentLocaleUndefined', + 'specified parentLocale is not defined yet'); + } + } + locales[name] = new Locale(config); + + // backwards compat for now: also set the locale + locale_locales__getSetGlobalLocale(name); + + return locales[name]; + } else { + // useful for testing + delete locales[name]; + return null; + } + } + + function updateLocale(name, config) { + if (config != null) { + var locale; + if (locales[name] != null) { + config = mergeConfigs(locales[name]._config, config); + } + locale = new Locale(config); + locale.parentLocale = locales[name]; + locales[name] = locale; + + // backwards compat for now: also set the locale + locale_locales__getSetGlobalLocale(name); + } else { + // pass null for config to unupdate, useful for tests + if (locales[name] != null) { + if (locales[name].parentLocale != null) { + locales[name] = locales[name].parentLocale; + } else if (locales[name] != null) { + delete locales[name]; + } + } + } + return locales[name]; + } + + // returns locale data + function locale_locales__getLocale (key) { + var locale; + + if (key && key._locale && key._locale._abbr) { + key = key._locale._abbr; + } + + if (!key) { + return globalLocale; + } + + if (!isArray(key)) { + //short-circuit everything else + locale = loadLocale(key); + if (locale) { + return locale; + } + key = [key]; + } + + return chooseLocale(key); + } + + function locale_locales__listLocales() { + return Object.keys(locales); + } + + var aliases = {}; + + function addUnitAlias (unit, shorthand) { + var lowerCase = unit.toLowerCase(); + aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; + } + + function normalizeUnits(units) { + return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; + } + + function normalizeObjectUnits(inputObject) { + var normalizedInput = {}, + normalizedProp, + prop; + + for (prop in inputObject) { + if (hasOwnProp(inputObject, prop)) { + normalizedProp = normalizeUnits(prop); + if (normalizedProp) { + normalizedInput[normalizedProp] = inputObject[prop]; + } + } + } + + return normalizedInput; + } + + function makeGetSet (unit, keepTime) { + return function (value) { + if (value != null) { + get_set__set(this, unit, value); + utils_hooks__hooks.updateOffset(this, keepTime); + return this; + } else { + return get_set__get(this, unit); + } + }; + } + + function get_set__get (mom, unit) { + return mom.isValid() ? + mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; + } + + function get_set__set (mom, unit, value) { + if (mom.isValid()) { + mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); + } + } + + // MOMENTS + + function getSet (units, value) { + var unit; + if (typeof units === 'object') { + for (unit in units) { + this.set(unit, units[unit]); + } + } else { + units = normalizeUnits(units); + if (isFunction(this[units])) { + return this[units](value); + } + } + return this; + } + + function zeroFill(number, targetLength, forceSign) { + var absNumber = '' + Math.abs(number), + zerosToFill = targetLength - absNumber.length, + sign = number >= 0; + return (sign ? (forceSign ? '+' : '') : '-') + + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; + } + + var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; + + var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; + + var formatFunctions = {}; + + var formatTokenFunctions = {}; + + // token: 'M' + // padded: ['MM', 2] + // ordinal: 'Mo' + // callback: function () { this.month() + 1 } + function addFormatToken (token, padded, ordinal, callback) { + var func = callback; + if (typeof callback === 'string') { + func = function () { + return this[callback](); + }; + } + if (token) { + formatTokenFunctions[token] = func; + } + if (padded) { + formatTokenFunctions[padded[0]] = function () { + return zeroFill(func.apply(this, arguments), padded[1], padded[2]); + }; + } + if (ordinal) { + formatTokenFunctions[ordinal] = function () { + return this.localeData().ordinal(func.apply(this, arguments), token); + }; + } + } + + function removeFormattingTokens(input) { + if (input.match(/\[[\s\S]/)) { + return input.replace(/^\[|\]$/g, ''); + } + return input.replace(/\\/g, ''); + } + + function makeFormatFunction(format) { + var array = format.match(formattingTokens), i, length; + + for (i = 0, length = array.length; i < length; i++) { + if (formatTokenFunctions[array[i]]) { + array[i] = formatTokenFunctions[array[i]]; + } else { + array[i] = removeFormattingTokens(array[i]); + } + } + + return function (mom) { + var output = ''; + for (i = 0; i < length; i++) { + output += array[i] instanceof Function ? array[i].call(mom, format) : array[i]; + } + return output; + }; + } + + // format date using native date object + function formatMoment(m, format) { + if (!m.isValid()) { + return m.localeData().invalidDate(); + } + + format = expandFormat(format, m.localeData()); + formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); + + return formatFunctions[format](m); + } + + function expandFormat(format, locale) { + var i = 5; + + function replaceLongDateFormatTokens(input) { + return locale.longDateFormat(input) || input; + } + + localFormattingTokens.lastIndex = 0; + while (i >= 0 && localFormattingTokens.test(format)) { + format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); + localFormattingTokens.lastIndex = 0; + i -= 1; + } + + return format; + } + + var match1 = /\d/; // 0 - 9 + var match2 = /\d\d/; // 00 - 99 + var match3 = /\d{3}/; // 000 - 999 + var match4 = /\d{4}/; // 0000 - 9999 + var match6 = /[+-]?\d{6}/; // -999999 - 999999 + var match1to2 = /\d\d?/; // 0 - 99 + var match3to4 = /\d\d\d\d?/; // 999 - 9999 + var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 + var match1to3 = /\d{1,3}/; // 0 - 999 + var match1to4 = /\d{1,4}/; // 0 - 9999 + var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 + + var matchUnsigned = /\d+/; // 0 - inf + var matchSigned = /[+-]?\d+/; // -inf - inf + + var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z + var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z + + var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 + + // any word (or two) characters or numbers including two/three word month in arabic. + // includes scottish gaelic two word and hyphenated months + var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i; + + + var regexes = {}; + + function addRegexToken (token, regex, strictRegex) { + regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { + return (isStrict && strictRegex) ? strictRegex : regex; + }; + } + + function getParseRegexForToken (token, config) { + if (!hasOwnProp(regexes, token)) { + return new RegExp(unescapeFormat(token)); + } + + return regexes[token](config._strict, config._locale); + } + + // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript + function unescapeFormat(s) { + return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { + return p1 || p2 || p3 || p4; + })); + } + + function regexEscape(s) { + return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); + } + + var tokens = {}; + + function addParseToken (token, callback) { + var i, func = callback; + if (typeof token === 'string') { + token = [token]; + } + if (typeof callback === 'number') { + func = function (input, array) { + array[callback] = toInt(input); + }; + } + for (i = 0; i < token.length; i++) { + tokens[token[i]] = func; + } + } + + function addWeekParseToken (token, callback) { + addParseToken(token, function (input, array, config, token) { + config._w = config._w || {}; + callback(input, config._w, config, token); + }); + } + + function addTimeToArrayFromToken(token, input, config) { + if (input != null && hasOwnProp(tokens, token)) { + tokens[token](input, config._a, config, token); + } + } + + var YEAR = 0; + var MONTH = 1; + var DATE = 2; + var HOUR = 3; + var MINUTE = 4; + var SECOND = 5; + var MILLISECOND = 6; + var WEEK = 7; + var WEEKDAY = 8; + + function daysInMonth(year, month) { + return new Date(Date.UTC(year, month + 1, 0)).getUTCDate(); + } + + // FORMATTING + + addFormatToken('M', ['MM', 2], 'Mo', function () { + return this.month() + 1; + }); + + addFormatToken('MMM', 0, 0, function (format) { + return this.localeData().monthsShort(this, format); + }); + + addFormatToken('MMMM', 0, 0, function (format) { + return this.localeData().months(this, format); + }); + + // ALIASES + + addUnitAlias('month', 'M'); + + // PARSING + + addRegexToken('M', match1to2); + addRegexToken('MM', match1to2, match2); + addRegexToken('MMM', function (isStrict, locale) { + return locale.monthsShortRegex(isStrict); + }); + addRegexToken('MMMM', function (isStrict, locale) { + return locale.monthsRegex(isStrict); + }); + + addParseToken(['M', 'MM'], function (input, array) { + array[MONTH] = toInt(input) - 1; + }); + + addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { + var month = config._locale.monthsParse(input, token, config._strict); + // if we didn't find a month name, mark the date as invalid. + if (month != null) { + array[MONTH] = month; + } else { + getParsingFlags(config).invalidMonth = input; + } + }); + + // LOCALES + + var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/; + var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); + function localeMonths (m, format) { + return isArray(this._months) ? this._months[m.month()] : + this._months[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; + } + + var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); + function localeMonthsShort (m, format) { + return isArray(this._monthsShort) ? this._monthsShort[m.month()] : + this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; + } + + function localeMonthsParse (monthName, format, strict) { + var i, mom, regex; + + if (!this._monthsParse) { + this._monthsParse = []; + this._longMonthsParse = []; + this._shortMonthsParse = []; + } + + for (i = 0; i < 12; i++) { + // make the regex if we don't have it already + mom = create_utc__createUTC([2000, i]); + if (strict && !this._longMonthsParse[i]) { + this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); + this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); + } + if (!strict && !this._monthsParse[i]) { + regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); + this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); + } + // test the regex + if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { + return i; + } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { + return i; + } else if (!strict && this._monthsParse[i].test(monthName)) { + return i; + } + } + } + + // MOMENTS + + function setMonth (mom, value) { + var dayOfMonth; + + if (!mom.isValid()) { + // No op + return mom; + } + + if (typeof value === 'string') { + if (/^\d+$/.test(value)) { + value = toInt(value); + } else { + value = mom.localeData().monthsParse(value); + // TODO: Another silent failure? + if (typeof value !== 'number') { + return mom; + } + } + } + + dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); + mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); + return mom; + } + + function getSetMonth (value) { + if (value != null) { + setMonth(this, value); + utils_hooks__hooks.updateOffset(this, true); + return this; + } else { + return get_set__get(this, 'Month'); + } + } + + function getDaysInMonth () { + return daysInMonth(this.year(), this.month()); + } + + var defaultMonthsShortRegex = matchWord; + function monthsShortRegex (isStrict) { + if (this._monthsParseExact) { + if (!hasOwnProp(this, '_monthsRegex')) { + computeMonthsParse.call(this); + } + if (isStrict) { + return this._monthsShortStrictRegex; + } else { + return this._monthsShortRegex; + } + } else { + return this._monthsShortStrictRegex && isStrict ? + this._monthsShortStrictRegex : this._monthsShortRegex; + } + } + + var defaultMonthsRegex = matchWord; + function monthsRegex (isStrict) { + if (this._monthsParseExact) { + if (!hasOwnProp(this, '_monthsRegex')) { + computeMonthsParse.call(this); + } + if (isStrict) { + return this._monthsStrictRegex; + } else { + return this._monthsRegex; + } + } else { + return this._monthsStrictRegex && isStrict ? + this._monthsStrictRegex : this._monthsRegex; + } + } + + function computeMonthsParse () { + function cmpLenRev(a, b) { + return b.length - a.length; + } + + var shortPieces = [], longPieces = [], mixedPieces = [], + i, mom; + for (i = 0; i < 12; i++) { + // make the regex if we don't have it already + mom = create_utc__createUTC([2000, i]); + shortPieces.push(this.monthsShort(mom, '')); + longPieces.push(this.months(mom, '')); + mixedPieces.push(this.months(mom, '')); + mixedPieces.push(this.monthsShort(mom, '')); + } + // Sorting makes sure if one month (or abbr) is a prefix of another it + // will match the longer piece. + shortPieces.sort(cmpLenRev); + longPieces.sort(cmpLenRev); + mixedPieces.sort(cmpLenRev); + for (i = 0; i < 12; i++) { + shortPieces[i] = regexEscape(shortPieces[i]); + longPieces[i] = regexEscape(longPieces[i]); + mixedPieces[i] = regexEscape(mixedPieces[i]); + } + + this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._monthsShortRegex = this._monthsRegex; + this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')$', 'i'); + this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')$', 'i'); + } + + function checkOverflow (m) { + var overflow; + var a = m._a; + + if (a && getParsingFlags(m).overflow === -2) { + overflow = + a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : + a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : + a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : + a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : + a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : + a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : + -1; + + if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { + overflow = DATE; + } + if (getParsingFlags(m)._overflowWeeks && overflow === -1) { + overflow = WEEK; + } + if (getParsingFlags(m)._overflowWeekday && overflow === -1) { + overflow = WEEKDAY; + } + + getParsingFlags(m).overflow = overflow; + } + + return m; + } + + // iso 8601 regex + // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) + var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/; + var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/; + + var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; + + var isoDates = [ + ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], + ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], + ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], + ['GGGG-[W]WW', /\d{4}-W\d\d/, false], + ['YYYY-DDD', /\d{4}-\d{3}/], + ['YYYY-MM', /\d{4}-\d\d/, false], + ['YYYYYYMMDD', /[+-]\d{10}/], + ['YYYYMMDD', /\d{8}/], + // YYYYMM is NOT allowed by the standard + ['GGGG[W]WWE', /\d{4}W\d{3}/], + ['GGGG[W]WW', /\d{4}W\d{2}/, false], + ['YYYYDDD', /\d{7}/] + ]; + + // iso time formats and regexes + var isoTimes = [ + ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], + ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], + ['HH:mm:ss', /\d\d:\d\d:\d\d/], + ['HH:mm', /\d\d:\d\d/], + ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], + ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], + ['HHmmss', /\d\d\d\d\d\d/], + ['HHmm', /\d\d\d\d/], + ['HH', /\d\d/] + ]; + + var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; + + // date from iso format + function configFromISO(config) { + var i, l, + string = config._i, + match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), + allowTime, dateFormat, timeFormat, tzFormat; + + if (match) { + getParsingFlags(config).iso = true; + + for (i = 0, l = isoDates.length; i < l; i++) { + if (isoDates[i][1].exec(match[1])) { + dateFormat = isoDates[i][0]; + allowTime = isoDates[i][2] !== false; + break; + } + } + if (dateFormat == null) { + config._isValid = false; + return; + } + if (match[3]) { + for (i = 0, l = isoTimes.length; i < l; i++) { + if (isoTimes[i][1].exec(match[3])) { + // match[2] should be 'T' or space + timeFormat = (match[2] || ' ') + isoTimes[i][0]; + break; + } + } + if (timeFormat == null) { + config._isValid = false; + return; + } + } + if (!allowTime && timeFormat != null) { + config._isValid = false; + return; + } + if (match[4]) { + if (tzRegex.exec(match[4])) { + tzFormat = 'Z'; + } else { + config._isValid = false; + return; + } + } + config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); + configFromStringAndFormat(config); + } else { + config._isValid = false; + } + } + + // date from iso format or fallback + function configFromString(config) { + var matched = aspNetJsonRegex.exec(config._i); + + if (matched !== null) { + config._d = new Date(+matched[1]); + return; + } + + configFromISO(config); + if (config._isValid === false) { + delete config._isValid; + utils_hooks__hooks.createFromInputFallback(config); + } + } + + utils_hooks__hooks.createFromInputFallback = deprecate( + 'moment construction falls back to js Date. This is ' + + 'discouraged and will be removed in upcoming major ' + + 'release. Please refer to ' + + 'https://github.com/moment/moment/issues/1407 for more info.', + function (config) { + config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); + } + ); + + function createDate (y, m, d, h, M, s, ms) { + //can't just apply() to create a date: + //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply + var date = new Date(y, m, d, h, M, s, ms); + + //the date constructor remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0 && isFinite(date.getFullYear())) { + date.setFullYear(y); + } + return date; + } + + function createUTCDate (y) { + var date = new Date(Date.UTC.apply(null, arguments)); + + //the Date.UTC function remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { + date.setUTCFullYear(y); + } + return date; + } + + // FORMATTING + + addFormatToken('Y', 0, 0, function () { + var y = this.year(); + return y <= 9999 ? '' + y : '+' + y; + }); + + addFormatToken(0, ['YY', 2], 0, function () { + return this.year() % 100; + }); + + addFormatToken(0, ['YYYY', 4], 0, 'year'); + addFormatToken(0, ['YYYYY', 5], 0, 'year'); + addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); + + // ALIASES + + addUnitAlias('year', 'y'); + + // PARSING + + addRegexToken('Y', matchSigned); + addRegexToken('YY', match1to2, match2); + addRegexToken('YYYY', match1to4, match4); + addRegexToken('YYYYY', match1to6, match6); + addRegexToken('YYYYYY', match1to6, match6); + + addParseToken(['YYYYY', 'YYYYYY'], YEAR); + addParseToken('YYYY', function (input, array) { + array[YEAR] = input.length === 2 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input); + }); + addParseToken('YY', function (input, array) { + array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input); + }); + addParseToken('Y', function (input, array) { + array[YEAR] = parseInt(input, 10); + }); + + // HELPERS + + function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; + } + + function isLeapYear(year) { + return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; + } + + // HOOKS + + utils_hooks__hooks.parseTwoDigitYear = function (input) { + return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); + }; + + // MOMENTS + + var getSetYear = makeGetSet('FullYear', false); + + function getIsLeapYear () { + return isLeapYear(this.year()); + } + + // start-of-first-week - start-of-year + function firstWeekOffset(year, dow, doy) { + var // first-week day -- which january is always in the first week (4 for iso, 1 for other) + fwd = 7 + dow - doy, + // first-week day local weekday -- which local weekday is fwd + fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; + + return -fwdlw + fwd - 1; + } + + //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday + function dayOfYearFromWeeks(year, week, weekday, dow, doy) { + var localWeekday = (7 + weekday - dow) % 7, + weekOffset = firstWeekOffset(year, dow, doy), + dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, + resYear, resDayOfYear; + + if (dayOfYear <= 0) { + resYear = year - 1; + resDayOfYear = daysInYear(resYear) + dayOfYear; + } else if (dayOfYear > daysInYear(year)) { + resYear = year + 1; + resDayOfYear = dayOfYear - daysInYear(year); + } else { + resYear = year; + resDayOfYear = dayOfYear; + } + + return { + year: resYear, + dayOfYear: resDayOfYear + }; + } + + function weekOfYear(mom, dow, doy) { + var weekOffset = firstWeekOffset(mom.year(), dow, doy), + week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, + resWeek, resYear; + + if (week < 1) { + resYear = mom.year() - 1; + resWeek = week + weeksInYear(resYear, dow, doy); + } else if (week > weeksInYear(mom.year(), dow, doy)) { + resWeek = week - weeksInYear(mom.year(), dow, doy); + resYear = mom.year() + 1; + } else { + resYear = mom.year(); + resWeek = week; + } + + return { + week: resWeek, + year: resYear + }; + } + + function weeksInYear(year, dow, doy) { + var weekOffset = firstWeekOffset(year, dow, doy), + weekOffsetNext = firstWeekOffset(year + 1, dow, doy); + return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; + } + + // Pick the first defined of two or three arguments. + function defaults(a, b, c) { + if (a != null) { + return a; + } + if (b != null) { + return b; + } + return c; + } + + function currentDateArray(config) { + // hooks is actually the exported moment object + var nowValue = new Date(utils_hooks__hooks.now()); + if (config._useUTC) { + return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; + } + return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; + } + + // convert an array to a date. + // the array should mirror the parameters below + // note: all values past the year are optional and will default to the lowest possible value. + // [year, month, day , hour, minute, second, millisecond] + function configFromArray (config) { + var i, date, input = [], currentDate, yearToUse; + + if (config._d) { + return; + } + + currentDate = currentDateArray(config); + + //compute day of the year from weeks and weekdays + if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { + dayOfYearFromWeekInfo(config); + } + + //if the day of the year is set, figure out what it is + if (config._dayOfYear) { + yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); + + if (config._dayOfYear > daysInYear(yearToUse)) { + getParsingFlags(config)._overflowDayOfYear = true; + } + + date = createUTCDate(yearToUse, 0, config._dayOfYear); + config._a[MONTH] = date.getUTCMonth(); + config._a[DATE] = date.getUTCDate(); + } + + // Default to current date. + // * if no year, month, day of month are given, default to today + // * if day of month is given, default month and year + // * if month is given, default only year + // * if year is given, don't default anything + for (i = 0; i < 3 && config._a[i] == null; ++i) { + config._a[i] = input[i] = currentDate[i]; + } + + // Zero out whatever was not defaulted, including time + for (; i < 7; i++) { + config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; + } + + // Check for 24:00:00.000 + if (config._a[HOUR] === 24 && + config._a[MINUTE] === 0 && + config._a[SECOND] === 0 && + config._a[MILLISECOND] === 0) { + config._nextDay = true; + config._a[HOUR] = 0; + } + + config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); + // Apply timezone offset from input. The actual utcOffset can be changed + // with parseZone. + if (config._tzm != null) { + config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); + } + + if (config._nextDay) { + config._a[HOUR] = 24; + } + } + + function dayOfYearFromWeekInfo(config) { + var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; + + w = config._w; + if (w.GG != null || w.W != null || w.E != null) { + dow = 1; + doy = 4; + + // TODO: We need to take the current isoWeekYear, but that depends on + // how we interpret now (local, utc, fixed offset). So create + // a now version of current config (take local/utc/offset flags, and + // create now). + weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(local__createLocal(), 1, 4).year); + week = defaults(w.W, 1); + weekday = defaults(w.E, 1); + if (weekday < 1 || weekday > 7) { + weekdayOverflow = true; + } + } else { + dow = config._locale._week.dow; + doy = config._locale._week.doy; + + weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year); + week = defaults(w.w, 1); + + if (w.d != null) { + // weekday -- low day numbers are considered next week + weekday = w.d; + if (weekday < 0 || weekday > 6) { + weekdayOverflow = true; + } + } else if (w.e != null) { + // local weekday -- counting starts from begining of week + weekday = w.e + dow; + if (w.e < 0 || w.e > 6) { + weekdayOverflow = true; + } + } else { + // default to begining of week + weekday = dow; + } + } + if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { + getParsingFlags(config)._overflowWeeks = true; + } else if (weekdayOverflow != null) { + getParsingFlags(config)._overflowWeekday = true; + } else { + temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); + config._a[YEAR] = temp.year; + config._dayOfYear = temp.dayOfYear; + } + } + + // constant that refers to the ISO standard + utils_hooks__hooks.ISO_8601 = function () {}; + + // date from string and format string + function configFromStringAndFormat(config) { + // TODO: Move this to another part of the creation flow to prevent circular deps + if (config._f === utils_hooks__hooks.ISO_8601) { + configFromISO(config); + return; + } + + config._a = []; + getParsingFlags(config).empty = true; + + // This array is used to make a Date, either with `new Date` or `Date.UTC` + var string = '' + config._i, + i, parsedInput, tokens, token, skipped, + stringLength = string.length, + totalParsedInputLength = 0; + + tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; + + for (i = 0; i < tokens.length; i++) { + token = tokens[i]; + parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; + // console.log('token', token, 'parsedInput', parsedInput, + // 'regex', getParseRegexForToken(token, config)); + if (parsedInput) { + skipped = string.substr(0, string.indexOf(parsedInput)); + if (skipped.length > 0) { + getParsingFlags(config).unusedInput.push(skipped); + } + string = string.slice(string.indexOf(parsedInput) + parsedInput.length); + totalParsedInputLength += parsedInput.length; + } + // don't parse if it's not a known token + if (formatTokenFunctions[token]) { + if (parsedInput) { + getParsingFlags(config).empty = false; + } + else { + getParsingFlags(config).unusedTokens.push(token); + } + addTimeToArrayFromToken(token, parsedInput, config); + } + else if (config._strict && !parsedInput) { + getParsingFlags(config).unusedTokens.push(token); + } + } + + // add remaining unparsed input length to the string + getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; + if (string.length > 0) { + getParsingFlags(config).unusedInput.push(string); + } + + // clear _12h flag if hour is <= 12 + if (getParsingFlags(config).bigHour === true && + config._a[HOUR] <= 12 && + config._a[HOUR] > 0) { + getParsingFlags(config).bigHour = undefined; + } + // handle meridiem + config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); + + configFromArray(config); + checkOverflow(config); + } + + + function meridiemFixWrap (locale, hour, meridiem) { + var isPm; + + if (meridiem == null) { + // nothing to do + return hour; + } + if (locale.meridiemHour != null) { + return locale.meridiemHour(hour, meridiem); + } else if (locale.isPM != null) { + // Fallback + isPm = locale.isPM(meridiem); + if (isPm && hour < 12) { + hour += 12; + } + if (!isPm && hour === 12) { + hour = 0; + } + return hour; + } else { + // this is not supposed to happen + return hour; + } + } + + // date from string and array of format strings + function configFromStringAndArray(config) { + var tempConfig, + bestMoment, + + scoreToBeat, + i, + currentScore; + + if (config._f.length === 0) { + getParsingFlags(config).invalidFormat = true; + config._d = new Date(NaN); + return; + } + + for (i = 0; i < config._f.length; i++) { + currentScore = 0; + tempConfig = copyConfig({}, config); + if (config._useUTC != null) { + tempConfig._useUTC = config._useUTC; + } + tempConfig._f = config._f[i]; + configFromStringAndFormat(tempConfig); + + if (!valid__isValid(tempConfig)) { + continue; + } + + // if there is any input that was not parsed add a penalty for that format + currentScore += getParsingFlags(tempConfig).charsLeftOver; + + //or tokens + currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; + + getParsingFlags(tempConfig).score = currentScore; + + if (scoreToBeat == null || currentScore < scoreToBeat) { + scoreToBeat = currentScore; + bestMoment = tempConfig; + } + } + + extend(config, bestMoment || tempConfig); + } + + function configFromObject(config) { + if (config._d) { + return; + } + + var i = normalizeObjectUnits(config._i); + config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) { + return obj && parseInt(obj, 10); + }); + + configFromArray(config); + } + + function createFromConfig (config) { + var res = new Moment(checkOverflow(prepareConfig(config))); + if (res._nextDay) { + // Adding is smart enough around DST + res.add(1, 'd'); + res._nextDay = undefined; + } + + return res; + } + + function prepareConfig (config) { + var input = config._i, + format = config._f; + + config._locale = config._locale || locale_locales__getLocale(config._l); + + if (input === null || (format === undefined && input === '')) { + return valid__createInvalid({nullInput: true}); + } + + if (typeof input === 'string') { + config._i = input = config._locale.preparse(input); + } + + if (isMoment(input)) { + return new Moment(checkOverflow(input)); + } else if (isArray(format)) { + configFromStringAndArray(config); + } else if (format) { + configFromStringAndFormat(config); + } else if (isDate(input)) { + config._d = input; + } else { + configFromInput(config); + } + + if (!valid__isValid(config)) { + config._d = null; + } + + return config; + } + + function configFromInput(config) { + var input = config._i; + if (input === undefined) { + config._d = new Date(utils_hooks__hooks.now()); + } else if (isDate(input)) { + config._d = new Date(+input); + } else if (typeof input === 'string') { + configFromString(config); + } else if (isArray(input)) { + config._a = map(input.slice(0), function (obj) { + return parseInt(obj, 10); + }); + configFromArray(config); + } else if (typeof(input) === 'object') { + configFromObject(config); + } else if (typeof(input) === 'number') { + // from milliseconds + config._d = new Date(input); + } else { + utils_hooks__hooks.createFromInputFallback(config); + } + } + + function createLocalOrUTC (input, format, locale, strict, isUTC) { + var c = {}; + + if (typeof(locale) === 'boolean') { + strict = locale; + locale = undefined; + } + // object construction must be done this way. + // https://github.com/moment/moment/issues/1423 + c._isAMomentObject = true; + c._useUTC = c._isUTC = isUTC; + c._l = locale; + c._i = input; + c._f = format; + c._strict = strict; + + return createFromConfig(c); + } + + function local__createLocal (input, format, locale, strict) { + return createLocalOrUTC(input, format, locale, strict, false); + } + + var prototypeMin = deprecate( + 'moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548', + function () { + var other = local__createLocal.apply(null, arguments); + if (this.isValid() && other.isValid()) { + return other < this ? this : other; + } else { + return valid__createInvalid(); + } + } + ); + + var prototypeMax = deprecate( + 'moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548', + function () { + var other = local__createLocal.apply(null, arguments); + if (this.isValid() && other.isValid()) { + return other > this ? this : other; + } else { + return valid__createInvalid(); + } + } + ); + + // Pick a moment m from moments so that m[fn](other) is true for all + // other. This relies on the function fn to be transitive. + // + // moments should either be an array of moment objects or an array, whose + // first element is an array of moment objects. + function pickBy(fn, moments) { + var res, i; + if (moments.length === 1 && isArray(moments[0])) { + moments = moments[0]; + } + if (!moments.length) { + return local__createLocal(); + } + res = moments[0]; + for (i = 1; i < moments.length; ++i) { + if (!moments[i].isValid() || moments[i][fn](res)) { + res = moments[i]; + } + } + return res; + } + + // TODO: Use [].sort instead? + function min () { + var args = [].slice.call(arguments, 0); + + return pickBy('isBefore', args); + } + + function max () { + var args = [].slice.call(arguments, 0); + + return pickBy('isAfter', args); + } + + var now = function () { + return Date.now ? Date.now() : +(new Date()); + }; + + function Duration (duration) { + var normalizedInput = normalizeObjectUnits(duration), + years = normalizedInput.year || 0, + quarters = normalizedInput.quarter || 0, + months = normalizedInput.month || 0, + weeks = normalizedInput.week || 0, + days = normalizedInput.day || 0, + hours = normalizedInput.hour || 0, + minutes = normalizedInput.minute || 0, + seconds = normalizedInput.second || 0, + milliseconds = normalizedInput.millisecond || 0; + + // representation for dateAddRemove + this._milliseconds = +milliseconds + + seconds * 1e3 + // 1000 + minutes * 6e4 + // 1000 * 60 + hours * 36e5; // 1000 * 60 * 60 + // Because of dateAddRemove treats 24 hours as different from a + // day when working around DST, we need to store them separately + this._days = +days + + weeks * 7; + // It is impossible translate months into days without knowing + // which months you are are talking about, so we have to store + // it separately. + this._months = +months + + quarters * 3 + + years * 12; + + this._data = {}; + + this._locale = locale_locales__getLocale(); + + this._bubble(); + } + + function isDuration (obj) { + return obj instanceof Duration; + } + + // FORMATTING + + function offset (token, separator) { + addFormatToken(token, 0, 0, function () { + var offset = this.utcOffset(); + var sign = '+'; + if (offset < 0) { + offset = -offset; + sign = '-'; + } + return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2); + }); + } + + offset('Z', ':'); + offset('ZZ', ''); + + // PARSING + + addRegexToken('Z', matchShortOffset); + addRegexToken('ZZ', matchShortOffset); + addParseToken(['Z', 'ZZ'], function (input, array, config) { + config._useUTC = true; + config._tzm = offsetFromString(matchShortOffset, input); + }); + + // HELPERS + + // timezone chunker + // '+10:00' > ['10', '00'] + // '-1530' > ['-15', '30'] + var chunkOffset = /([\+\-]|\d\d)/gi; + + function offsetFromString(matcher, string) { + var matches = ((string || '').match(matcher) || []); + var chunk = matches[matches.length - 1] || []; + var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; + var minutes = +(parts[1] * 60) + toInt(parts[2]); + + return parts[0] === '+' ? minutes : -minutes; + } + + // Return a moment from input, that is local/utc/zone equivalent to model. + function cloneWithOffset(input, model) { + var res, diff; + if (model._isUTC) { + res = model.clone(); + diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res); + // Use low-level api, because this fn is low-level api. + res._d.setTime(+res._d + diff); + utils_hooks__hooks.updateOffset(res, false); + return res; + } else { + return local__createLocal(input).local(); + } + } + + function getDateOffset (m) { + // On Firefox.24 Date#getTimezoneOffset returns a floating point. + // https://github.com/moment/moment/pull/1871 + return -Math.round(m._d.getTimezoneOffset() / 15) * 15; + } + + // HOOKS + + // This function will be called whenever a moment is mutated. + // It is intended to keep the offset in sync with the timezone. + utils_hooks__hooks.updateOffset = function () {}; + + // MOMENTS + + // keepLocalTime = true means only change the timezone, without + // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> + // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset + // +0200, so we adjust the time as needed, to be valid. + // + // Keeping the time actually adds/subtracts (one hour) + // from the actual represented time. That is why we call updateOffset + // a second time. In case it wants us to change the offset again + // _changeInProgress == true case, then we have to adjust, because + // there is no such time in the given timezone. + function getSetOffset (input, keepLocalTime) { + var offset = this._offset || 0, + localAdjust; + if (!this.isValid()) { + return input != null ? this : NaN; + } + if (input != null) { + if (typeof input === 'string') { + input = offsetFromString(matchShortOffset, input); + } else if (Math.abs(input) < 16) { + input = input * 60; + } + if (!this._isUTC && keepLocalTime) { + localAdjust = getDateOffset(this); + } + this._offset = input; + this._isUTC = true; + if (localAdjust != null) { + this.add(localAdjust, 'm'); + } + if (offset !== input) { + if (!keepLocalTime || this._changeInProgress) { + add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false); + } else if (!this._changeInProgress) { + this._changeInProgress = true; + utils_hooks__hooks.updateOffset(this, true); + this._changeInProgress = null; + } + } + return this; + } else { + return this._isUTC ? offset : getDateOffset(this); + } + } + + function getSetZone (input, keepLocalTime) { + if (input != null) { + if (typeof input !== 'string') { + input = -input; + } + + this.utcOffset(input, keepLocalTime); + + return this; + } else { + return -this.utcOffset(); + } + } + + function setOffsetToUTC (keepLocalTime) { + return this.utcOffset(0, keepLocalTime); + } + + function setOffsetToLocal (keepLocalTime) { + if (this._isUTC) { + this.utcOffset(0, keepLocalTime); + this._isUTC = false; + + if (keepLocalTime) { + this.subtract(getDateOffset(this), 'm'); + } + } + return this; + } + + function setOffsetToParsedOffset () { + if (this._tzm) { + this.utcOffset(this._tzm); + } else if (typeof this._i === 'string') { + this.utcOffset(offsetFromString(matchOffset, this._i)); + } + return this; + } + + function hasAlignedHourOffset (input) { + if (!this.isValid()) { + return false; + } + input = input ? local__createLocal(input).utcOffset() : 0; + + return (this.utcOffset() - input) % 60 === 0; + } + + function isDaylightSavingTime () { + return ( + this.utcOffset() > this.clone().month(0).utcOffset() || + this.utcOffset() > this.clone().month(5).utcOffset() + ); + } + + function isDaylightSavingTimeShifted () { + if (!isUndefined(this._isDSTShifted)) { + return this._isDSTShifted; + } + + var c = {}; + + copyConfig(c, this); + c = prepareConfig(c); + + if (c._a) { + var other = c._isUTC ? create_utc__createUTC(c._a) : local__createLocal(c._a); + this._isDSTShifted = this.isValid() && + compareArrays(c._a, other.toArray()) > 0; + } else { + this._isDSTShifted = false; + } + + return this._isDSTShifted; + } + + function isLocal () { + return this.isValid() ? !this._isUTC : false; + } + + function isUtcOffset () { + return this.isValid() ? this._isUTC : false; + } + + function isUtc () { + return this.isValid() ? this._isUTC && this._offset === 0 : false; + } + + // ASP.NET json date format regex + var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/; + + // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html + // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere + // and further modified to allow for strings containing both week and day + var isoRegex = /^(-)?P(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)W)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?$/; + + function create__createDuration (input, key) { + var duration = input, + // matching against regexp is expensive, do it on demand + match = null, + sign, + ret, + diffRes; + + if (isDuration(input)) { + duration = { + ms : input._milliseconds, + d : input._days, + M : input._months + }; + } else if (typeof input === 'number') { + duration = {}; + if (key) { + duration[key] = input; + } else { + duration.milliseconds = input; + } + } else if (!!(match = aspNetRegex.exec(input))) { + sign = (match[1] === '-') ? -1 : 1; + duration = { + y : 0, + d : toInt(match[DATE]) * sign, + h : toInt(match[HOUR]) * sign, + m : toInt(match[MINUTE]) * sign, + s : toInt(match[SECOND]) * sign, + ms : toInt(match[MILLISECOND]) * sign + }; + } else if (!!(match = isoRegex.exec(input))) { + sign = (match[1] === '-') ? -1 : 1; + duration = { + y : parseIso(match[2], sign), + M : parseIso(match[3], sign), + w : parseIso(match[4], sign), + d : parseIso(match[5], sign), + h : parseIso(match[6], sign), + m : parseIso(match[7], sign), + s : parseIso(match[8], sign) + }; + } else if (duration == null) {// checks for null or undefined + duration = {}; + } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { + diffRes = momentsDifference(local__createLocal(duration.from), local__createLocal(duration.to)); + + duration = {}; + duration.ms = diffRes.milliseconds; + duration.M = diffRes.months; + } + + ret = new Duration(duration); + + if (isDuration(input) && hasOwnProp(input, '_locale')) { + ret._locale = input._locale; + } + + return ret; + } + + create__createDuration.fn = Duration.prototype; + + function parseIso (inp, sign) { + // We'd normally use ~~inp for this, but unfortunately it also + // converts floats to ints. + // inp may be undefined, so careful calling replace on it. + var res = inp && parseFloat(inp.replace(',', '.')); + // apply sign while we're at it + return (isNaN(res) ? 0 : res) * sign; + } + + function positiveMomentsDifference(base, other) { + var res = {milliseconds: 0, months: 0}; + + res.months = other.month() - base.month() + + (other.year() - base.year()) * 12; + if (base.clone().add(res.months, 'M').isAfter(other)) { + --res.months; + } + + res.milliseconds = +other - +(base.clone().add(res.months, 'M')); + + return res; + } + + function momentsDifference(base, other) { + var res; + if (!(base.isValid() && other.isValid())) { + return {milliseconds: 0, months: 0}; + } + + other = cloneWithOffset(other, base); + if (base.isBefore(other)) { + res = positiveMomentsDifference(base, other); + } else { + res = positiveMomentsDifference(other, base); + res.milliseconds = -res.milliseconds; + res.months = -res.months; + } + + return res; + } + + function absRound (number) { + if (number < 0) { + return Math.round(-1 * number) * -1; + } else { + return Math.round(number); + } + } + + // TODO: remove 'name' arg after deprecation is removed + function createAdder(direction, name) { + return function (val, period) { + var dur, tmp; + //invert the arguments, but complain about it + if (period !== null && !isNaN(+period)) { + deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period).'); + tmp = val; val = period; period = tmp; + } + + val = typeof val === 'string' ? +val : val; + dur = create__createDuration(val, period); + add_subtract__addSubtract(this, dur, direction); + return this; + }; + } + + function add_subtract__addSubtract (mom, duration, isAdding, updateOffset) { + var milliseconds = duration._milliseconds, + days = absRound(duration._days), + months = absRound(duration._months); + + if (!mom.isValid()) { + // No op + return; + } + + updateOffset = updateOffset == null ? true : updateOffset; + + if (milliseconds) { + mom._d.setTime(+mom._d + milliseconds * isAdding); + } + if (days) { + get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding); + } + if (months) { + setMonth(mom, get_set__get(mom, 'Month') + months * isAdding); + } + if (updateOffset) { + utils_hooks__hooks.updateOffset(mom, days || months); + } + } + + var add_subtract__add = createAdder(1, 'add'); + var add_subtract__subtract = createAdder(-1, 'subtract'); + + function moment_calendar__calendar (time, formats) { + // We want to compare the start of today, vs this. + // Getting start-of-today depends on whether we're local/utc/offset or not. + var now = time || local__createLocal(), + sod = cloneWithOffset(now, this).startOf('day'), + diff = this.diff(sod, 'days', true), + format = diff < -6 ? 'sameElse' : + diff < -1 ? 'lastWeek' : + diff < 0 ? 'lastDay' : + diff < 1 ? 'sameDay' : + diff < 2 ? 'nextDay' : + diff < 7 ? 'nextWeek' : 'sameElse'; + + var output = formats && (isFunction(formats[format]) ? formats[format]() : formats[format]); + + return this.format(output || this.localeData().calendar(format, this, local__createLocal(now))); + } + + function clone () { + return new Moment(this); + } + + function isAfter (input, units) { + var localInput = isMoment(input) ? input : local__createLocal(input); + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); + if (units === 'millisecond') { + return +this > +localInput; + } else { + return +localInput < +this.clone().startOf(units); + } + } + + function isBefore (input, units) { + var localInput = isMoment(input) ? input : local__createLocal(input); + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); + if (units === 'millisecond') { + return +this < +localInput; + } else { + return +this.clone().endOf(units) < +localInput; + } + } + + function isBetween (from, to, units) { + return this.isAfter(from, units) && this.isBefore(to, units); + } + + function isSame (input, units) { + var localInput = isMoment(input) ? input : local__createLocal(input), + inputMs; + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(units || 'millisecond'); + if (units === 'millisecond') { + return +this === +localInput; + } else { + inputMs = +localInput; + return +(this.clone().startOf(units)) <= inputMs && inputMs <= +(this.clone().endOf(units)); + } + } + + function isSameOrAfter (input, units) { + return this.isSame(input, units) || this.isAfter(input,units); + } + + function isSameOrBefore (input, units) { + return this.isSame(input, units) || this.isBefore(input,units); + } + + function diff (input, units, asFloat) { + var that, + zoneDelta, + delta, output; + + if (!this.isValid()) { + return NaN; + } + + that = cloneWithOffset(input, this); + + if (!that.isValid()) { + return NaN; + } + + zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; + + units = normalizeUnits(units); + + if (units === 'year' || units === 'month' || units === 'quarter') { + output = monthDiff(this, that); + if (units === 'quarter') { + output = output / 3; + } else if (units === 'year') { + output = output / 12; + } + } else { + delta = this - that; + output = units === 'second' ? delta / 1e3 : // 1000 + units === 'minute' ? delta / 6e4 : // 1000 * 60 + units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60 + units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst + units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst + delta; + } + return asFloat ? output : absFloor(output); + } + + function monthDiff (a, b) { + // difference in months + var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()), + // b is in (anchor - 1 month, anchor + 1 month) + anchor = a.clone().add(wholeMonthDiff, 'months'), + anchor2, adjust; + + if (b - anchor < 0) { + anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); + // linear across the month + adjust = (b - anchor) / (anchor - anchor2); + } else { + anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); + // linear across the month + adjust = (b - anchor) / (anchor2 - anchor); + } + + return -(wholeMonthDiff + adjust); + } + + utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; + + function toString () { + return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); + } + + function moment_format__toISOString () { + var m = this.clone().utc(); + if (0 < m.year() && m.year() <= 9999) { + if (isFunction(Date.prototype.toISOString)) { + // native implementation is ~50x faster, use it when we can + return this.toDate().toISOString(); + } else { + return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); + } + } else { + return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); + } + } + + function format (inputString) { + var output = formatMoment(this, inputString || utils_hooks__hooks.defaultFormat); + return this.localeData().postformat(output); + } + + function from (time, withoutSuffix) { + if (this.isValid() && + ((isMoment(time) && time.isValid()) || + local__createLocal(time).isValid())) { + return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); + } else { + return this.localeData().invalidDate(); + } + } + + function fromNow (withoutSuffix) { + return this.from(local__createLocal(), withoutSuffix); + } + + function to (time, withoutSuffix) { + if (this.isValid() && + ((isMoment(time) && time.isValid()) || + local__createLocal(time).isValid())) { + return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix); + } else { + return this.localeData().invalidDate(); + } + } + + function toNow (withoutSuffix) { + return this.to(local__createLocal(), withoutSuffix); + } + + // If passed a locale key, it will set the locale for this + // instance. Otherwise, it will return the locale configuration + // variables for this instance. + function locale (key) { + var newLocaleData; + + if (key === undefined) { + return this._locale._abbr; + } else { + newLocaleData = locale_locales__getLocale(key); + if (newLocaleData != null) { + this._locale = newLocaleData; + } + return this; + } + } + + var lang = deprecate( + 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', + function (key) { + if (key === undefined) { + return this.localeData(); + } else { + return this.locale(key); + } + } + ); + + function localeData () { + return this._locale; + } + + function startOf (units) { + units = normalizeUnits(units); + // the following switch intentionally omits break keywords + // to utilize falling through the cases. + switch (units) { + case 'year': + this.month(0); + /* falls through */ + case 'quarter': + case 'month': + this.date(1); + /* falls through */ + case 'week': + case 'isoWeek': + case 'day': + this.hours(0); + /* falls through */ + case 'hour': + this.minutes(0); + /* falls through */ + case 'minute': + this.seconds(0); + /* falls through */ + case 'second': + this.milliseconds(0); + } + + // weeks are a special case + if (units === 'week') { + this.weekday(0); + } + if (units === 'isoWeek') { + this.isoWeekday(1); + } + + // quarters are also special + if (units === 'quarter') { + this.month(Math.floor(this.month() / 3) * 3); + } + + return this; + } + + function endOf (units) { + units = normalizeUnits(units); + if (units === undefined || units === 'millisecond') { + return this; + } + return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); + } + + function to_type__valueOf () { + return +this._d - ((this._offset || 0) * 60000); + } + + function unix () { + return Math.floor(+this / 1000); + } + + function toDate () { + return this._offset ? new Date(+this) : this._d; + } + + function toArray () { + var m = this; + return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; + } + + function toObject () { + var m = this; + return { + years: m.year(), + months: m.month(), + date: m.date(), + hours: m.hours(), + minutes: m.minutes(), + seconds: m.seconds(), + milliseconds: m.milliseconds() + }; + } + + function toJSON () { + // new Date(NaN).toJSON() === null + return this.isValid() ? this.toISOString() : null; + } + + function moment_valid__isValid () { + return valid__isValid(this); + } + + function parsingFlags () { + return extend({}, getParsingFlags(this)); + } + + function invalidAt () { + return getParsingFlags(this).overflow; + } + + function creationData() { + return { + input: this._i, + format: this._f, + locale: this._locale, + isUTC: this._isUTC, + strict: this._strict + }; + } + + // FORMATTING + + addFormatToken(0, ['gg', 2], 0, function () { + return this.weekYear() % 100; + }); + + addFormatToken(0, ['GG', 2], 0, function () { + return this.isoWeekYear() % 100; + }); + + function addWeekYearFormatToken (token, getter) { + addFormatToken(0, [token, token.length], 0, getter); + } + + addWeekYearFormatToken('gggg', 'weekYear'); + addWeekYearFormatToken('ggggg', 'weekYear'); + addWeekYearFormatToken('GGGG', 'isoWeekYear'); + addWeekYearFormatToken('GGGGG', 'isoWeekYear'); + + // ALIASES + + addUnitAlias('weekYear', 'gg'); + addUnitAlias('isoWeekYear', 'GG'); + + // PARSING + + addRegexToken('G', matchSigned); + addRegexToken('g', matchSigned); + addRegexToken('GG', match1to2, match2); + addRegexToken('gg', match1to2, match2); + addRegexToken('GGGG', match1to4, match4); + addRegexToken('gggg', match1to4, match4); + addRegexToken('GGGGG', match1to6, match6); + addRegexToken('ggggg', match1to6, match6); + + addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { + week[token.substr(0, 2)] = toInt(input); + }); + + addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { + week[token] = utils_hooks__hooks.parseTwoDigitYear(input); + }); + + // MOMENTS + + function getSetWeekYear (input) { + return getSetWeekYearHelper.call(this, + input, + this.week(), + this.weekday(), + this.localeData()._week.dow, + this.localeData()._week.doy); + } + + function getSetISOWeekYear (input) { + return getSetWeekYearHelper.call(this, + input, this.isoWeek(), this.isoWeekday(), 1, 4); + } + + function getISOWeeksInYear () { + return weeksInYear(this.year(), 1, 4); + } + + function getWeeksInYear () { + var weekInfo = this.localeData()._week; + return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); + } + + function getSetWeekYearHelper(input, week, weekday, dow, doy) { + var weeksTarget; + if (input == null) { + return weekOfYear(this, dow, doy).year; + } else { + weeksTarget = weeksInYear(input, dow, doy); + if (week > weeksTarget) { + week = weeksTarget; + } + return setWeekAll.call(this, input, week, weekday, dow, doy); + } + } + + function setWeekAll(weekYear, week, weekday, dow, doy) { + var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), + date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); + + this.year(date.getUTCFullYear()); + this.month(date.getUTCMonth()); + this.date(date.getUTCDate()); + return this; + } + + // FORMATTING + + addFormatToken('Q', 0, 'Qo', 'quarter'); + + // ALIASES + + addUnitAlias('quarter', 'Q'); + + // PARSING + + addRegexToken('Q', match1); + addParseToken('Q', function (input, array) { + array[MONTH] = (toInt(input) - 1) * 3; + }); + + // MOMENTS + + function getSetQuarter (input) { + return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); + } + + // FORMATTING + + addFormatToken('w', ['ww', 2], 'wo', 'week'); + addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); + + // ALIASES + + addUnitAlias('week', 'w'); + addUnitAlias('isoWeek', 'W'); + + // PARSING + + addRegexToken('w', match1to2); + addRegexToken('ww', match1to2, match2); + addRegexToken('W', match1to2); + addRegexToken('WW', match1to2, match2); + + addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { + week[token.substr(0, 1)] = toInt(input); + }); + + // HELPERS + + // LOCALES + + function localeWeek (mom) { + return weekOfYear(mom, this._week.dow, this._week.doy).week; + } + + var defaultLocaleWeek = { + dow : 0, // Sunday is the first day of the week. + doy : 6 // The week that contains Jan 1st is the first week of the year. + }; + + function localeFirstDayOfWeek () { + return this._week.dow; + } + + function localeFirstDayOfYear () { + return this._week.doy; + } + + // MOMENTS + + function getSetWeek (input) { + var week = this.localeData().week(this); + return input == null ? week : this.add((input - week) * 7, 'd'); + } + + function getSetISOWeek (input) { + var week = weekOfYear(this, 1, 4).week; + return input == null ? week : this.add((input - week) * 7, 'd'); + } + + // FORMATTING + + addFormatToken('D', ['DD', 2], 'Do', 'date'); + + // ALIASES + + addUnitAlias('date', 'D'); + + // PARSING + + addRegexToken('D', match1to2); + addRegexToken('DD', match1to2, match2); + addRegexToken('Do', function (isStrict, locale) { + return isStrict ? locale._ordinalParse : locale._ordinalParseLenient; + }); + + addParseToken(['D', 'DD'], DATE); + addParseToken('Do', function (input, array) { + array[DATE] = toInt(input.match(match1to2)[0], 10); + }); + + // MOMENTS + + var getSetDayOfMonth = makeGetSet('Date', true); + + // FORMATTING + + addFormatToken('d', 0, 'do', 'day'); + + addFormatToken('dd', 0, 0, function (format) { + return this.localeData().weekdaysMin(this, format); + }); + + addFormatToken('ddd', 0, 0, function (format) { + return this.localeData().weekdaysShort(this, format); + }); + + addFormatToken('dddd', 0, 0, function (format) { + return this.localeData().weekdays(this, format); + }); + + addFormatToken('e', 0, 0, 'weekday'); + addFormatToken('E', 0, 0, 'isoWeekday'); + + // ALIASES + + addUnitAlias('day', 'd'); + addUnitAlias('weekday', 'e'); + addUnitAlias('isoWeekday', 'E'); + + // PARSING + + addRegexToken('d', match1to2); + addRegexToken('e', match1to2); + addRegexToken('E', match1to2); + addRegexToken('dd', matchWord); + addRegexToken('ddd', matchWord); + addRegexToken('dddd', matchWord); + + addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { + var weekday = config._locale.weekdaysParse(input, token, config._strict); + // if we didn't get a weekday name, mark the date as invalid + if (weekday != null) { + week.d = weekday; + } else { + getParsingFlags(config).invalidWeekday = input; + } + }); + + addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { + week[token] = toInt(input); + }); + + // HELPERS + + function parseWeekday(input, locale) { + if (typeof input !== 'string') { + return input; + } + + if (!isNaN(input)) { + return parseInt(input, 10); + } + + input = locale.weekdaysParse(input); + if (typeof input === 'number') { + return input; + } + + return null; + } + + // LOCALES + + var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); + function localeWeekdays (m, format) { + return isArray(this._weekdays) ? this._weekdays[m.day()] : + this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; + } + + var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); + function localeWeekdaysShort (m) { + return this._weekdaysShort[m.day()]; + } + + var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); + function localeWeekdaysMin (m) { + return this._weekdaysMin[m.day()]; + } + + function localeWeekdaysParse (weekdayName, format, strict) { + var i, mom, regex; + + if (!this._weekdaysParse) { + this._weekdaysParse = []; + this._minWeekdaysParse = []; + this._shortWeekdaysParse = []; + this._fullWeekdaysParse = []; + } + + for (i = 0; i < 7; i++) { + // make the regex if we don't have it already + + mom = local__createLocal([2000, 1]).day(i); + if (strict && !this._fullWeekdaysParse[i]) { + this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i'); + this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i'); + this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i'); + } + if (!this._weekdaysParse[i]) { + regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); + this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); + } + // test the regex + if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { + return i; + } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { + return i; + } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { + return i; + } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { + return i; + } + } + } + + // MOMENTS + + function getSetDayOfWeek (input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); + if (input != null) { + input = parseWeekday(input, this.localeData()); + return this.add(input - day, 'd'); + } else { + return day; + } + } + + function getSetLocaleDayOfWeek (input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; + return input == null ? weekday : this.add(input - weekday, 'd'); + } + + function getSetISODayOfWeek (input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + // behaves the same as moment#day except + // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) + // as a setter, sunday should belong to the previous week. + return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7); + } + + // FORMATTING + + addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); + + // ALIASES + + addUnitAlias('dayOfYear', 'DDD'); + + // PARSING + + addRegexToken('DDD', match1to3); + addRegexToken('DDDD', match3); + addParseToken(['DDD', 'DDDD'], function (input, array, config) { + config._dayOfYear = toInt(input); + }); + + // HELPERS + + // MOMENTS + + function getSetDayOfYear (input) { + var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; + return input == null ? dayOfYear : this.add((input - dayOfYear), 'd'); + } + + // FORMATTING + + function hFormat() { + return this.hours() % 12 || 12; + } + + addFormatToken('H', ['HH', 2], 0, 'hour'); + addFormatToken('h', ['hh', 2], 0, hFormat); + + addFormatToken('hmm', 0, 0, function () { + return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); + }); + + addFormatToken('hmmss', 0, 0, function () { + return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + + zeroFill(this.seconds(), 2); + }); + + addFormatToken('Hmm', 0, 0, function () { + return '' + this.hours() + zeroFill(this.minutes(), 2); + }); + + addFormatToken('Hmmss', 0, 0, function () { + return '' + this.hours() + zeroFill(this.minutes(), 2) + + zeroFill(this.seconds(), 2); + }); + + function meridiem (token, lowercase) { + addFormatToken(token, 0, 0, function () { + return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); + }); + } + + meridiem('a', true); + meridiem('A', false); + + // ALIASES + + addUnitAlias('hour', 'h'); + + // PARSING + + function matchMeridiem (isStrict, locale) { + return locale._meridiemParse; + } + + addRegexToken('a', matchMeridiem); + addRegexToken('A', matchMeridiem); + addRegexToken('H', match1to2); + addRegexToken('h', match1to2); + addRegexToken('HH', match1to2, match2); + addRegexToken('hh', match1to2, match2); + + addRegexToken('hmm', match3to4); + addRegexToken('hmmss', match5to6); + addRegexToken('Hmm', match3to4); + addRegexToken('Hmmss', match5to6); + + addParseToken(['H', 'HH'], HOUR); + addParseToken(['a', 'A'], function (input, array, config) { + config._isPm = config._locale.isPM(input); + config._meridiem = input; + }); + addParseToken(['h', 'hh'], function (input, array, config) { + array[HOUR] = toInt(input); + getParsingFlags(config).bigHour = true; + }); + addParseToken('hmm', function (input, array, config) { + var pos = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos)); + array[MINUTE] = toInt(input.substr(pos)); + getParsingFlags(config).bigHour = true; + }); + addParseToken('hmmss', function (input, array, config) { + var pos1 = input.length - 4; + var pos2 = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos1)); + array[MINUTE] = toInt(input.substr(pos1, 2)); + array[SECOND] = toInt(input.substr(pos2)); + getParsingFlags(config).bigHour = true; + }); + addParseToken('Hmm', function (input, array, config) { + var pos = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos)); + array[MINUTE] = toInt(input.substr(pos)); + }); + addParseToken('Hmmss', function (input, array, config) { + var pos1 = input.length - 4; + var pos2 = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos1)); + array[MINUTE] = toInt(input.substr(pos1, 2)); + array[SECOND] = toInt(input.substr(pos2)); + }); + + // LOCALES + + function localeIsPM (input) { + // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays + // Using charAt should be more compatible. + return ((input + '').toLowerCase().charAt(0) === 'p'); + } + + var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; + function localeMeridiem (hours, minutes, isLower) { + if (hours > 11) { + return isLower ? 'pm' : 'PM'; + } else { + return isLower ? 'am' : 'AM'; + } + } + + + // MOMENTS + + // Setting the hour should keep the time, because the user explicitly + // specified which hour he wants. So trying to maintain the same hour (in + // a new timezone) makes sense. Adding/subtracting hours does not follow + // this rule. + var getSetHour = makeGetSet('Hours', true); + + // FORMATTING + + addFormatToken('m', ['mm', 2], 0, 'minute'); + + // ALIASES + + addUnitAlias('minute', 'm'); + + // PARSING + + addRegexToken('m', match1to2); + addRegexToken('mm', match1to2, match2); + addParseToken(['m', 'mm'], MINUTE); + + // MOMENTS + + var getSetMinute = makeGetSet('Minutes', false); + + // FORMATTING + + addFormatToken('s', ['ss', 2], 0, 'second'); + + // ALIASES + + addUnitAlias('second', 's'); + + // PARSING + + addRegexToken('s', match1to2); + addRegexToken('ss', match1to2, match2); + addParseToken(['s', 'ss'], SECOND); + + // MOMENTS + + var getSetSecond = makeGetSet('Seconds', false); + + // FORMATTING + + addFormatToken('S', 0, 0, function () { + return ~~(this.millisecond() / 100); + }); + + addFormatToken(0, ['SS', 2], 0, function () { + return ~~(this.millisecond() / 10); + }); + + addFormatToken(0, ['SSS', 3], 0, 'millisecond'); + addFormatToken(0, ['SSSS', 4], 0, function () { + return this.millisecond() * 10; + }); + addFormatToken(0, ['SSSSS', 5], 0, function () { + return this.millisecond() * 100; + }); + addFormatToken(0, ['SSSSSS', 6], 0, function () { + return this.millisecond() * 1000; + }); + addFormatToken(0, ['SSSSSSS', 7], 0, function () { + return this.millisecond() * 10000; + }); + addFormatToken(0, ['SSSSSSSS', 8], 0, function () { + return this.millisecond() * 100000; + }); + addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { + return this.millisecond() * 1000000; + }); + + + // ALIASES + + addUnitAlias('millisecond', 'ms'); + + // PARSING + + addRegexToken('S', match1to3, match1); + addRegexToken('SS', match1to3, match2); + addRegexToken('SSS', match1to3, match3); + + var token; + for (token = 'SSSS'; token.length <= 9; token += 'S') { + addRegexToken(token, matchUnsigned); + } + + function parseMs(input, array) { + array[MILLISECOND] = toInt(('0.' + input) * 1000); + } + + for (token = 'S'; token.length <= 9; token += 'S') { + addParseToken(token, parseMs); + } + // MOMENTS + + var getSetMillisecond = makeGetSet('Milliseconds', false); + + // FORMATTING + + addFormatToken('z', 0, 0, 'zoneAbbr'); + addFormatToken('zz', 0, 0, 'zoneName'); + + // MOMENTS + + function getZoneAbbr () { + return this._isUTC ? 'UTC' : ''; + } + + function getZoneName () { + return this._isUTC ? 'Coordinated Universal Time' : ''; + } + + var momentPrototype__proto = Moment.prototype; + + momentPrototype__proto.add = add_subtract__add; + momentPrototype__proto.calendar = moment_calendar__calendar; + momentPrototype__proto.clone = clone; + momentPrototype__proto.diff = diff; + momentPrototype__proto.endOf = endOf; + momentPrototype__proto.format = format; + momentPrototype__proto.from = from; + momentPrototype__proto.fromNow = fromNow; + momentPrototype__proto.to = to; + momentPrototype__proto.toNow = toNow; + momentPrototype__proto.get = getSet; + momentPrototype__proto.invalidAt = invalidAt; + momentPrototype__proto.isAfter = isAfter; + momentPrototype__proto.isBefore = isBefore; + momentPrototype__proto.isBetween = isBetween; + momentPrototype__proto.isSame = isSame; + momentPrototype__proto.isSameOrAfter = isSameOrAfter; + momentPrototype__proto.isSameOrBefore = isSameOrBefore; + momentPrototype__proto.isValid = moment_valid__isValid; + momentPrototype__proto.lang = lang; + momentPrototype__proto.locale = locale; + momentPrototype__proto.localeData = localeData; + momentPrototype__proto.max = prototypeMax; + momentPrototype__proto.min = prototypeMin; + momentPrototype__proto.parsingFlags = parsingFlags; + momentPrototype__proto.set = getSet; + momentPrototype__proto.startOf = startOf; + momentPrototype__proto.subtract = add_subtract__subtract; + momentPrototype__proto.toArray = toArray; + momentPrototype__proto.toObject = toObject; + momentPrototype__proto.toDate = toDate; + momentPrototype__proto.toISOString = moment_format__toISOString; + momentPrototype__proto.toJSON = toJSON; + momentPrototype__proto.toString = toString; + momentPrototype__proto.unix = unix; + momentPrototype__proto.valueOf = to_type__valueOf; + momentPrototype__proto.creationData = creationData; + + // Year + momentPrototype__proto.year = getSetYear; + momentPrototype__proto.isLeapYear = getIsLeapYear; + + // Week Year + momentPrototype__proto.weekYear = getSetWeekYear; + momentPrototype__proto.isoWeekYear = getSetISOWeekYear; + + // Quarter + momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter; + + // Month + momentPrototype__proto.month = getSetMonth; + momentPrototype__proto.daysInMonth = getDaysInMonth; + + // Week + momentPrototype__proto.week = momentPrototype__proto.weeks = getSetWeek; + momentPrototype__proto.isoWeek = momentPrototype__proto.isoWeeks = getSetISOWeek; + momentPrototype__proto.weeksInYear = getWeeksInYear; + momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear; + + // Day + momentPrototype__proto.date = getSetDayOfMonth; + momentPrototype__proto.day = momentPrototype__proto.days = getSetDayOfWeek; + momentPrototype__proto.weekday = getSetLocaleDayOfWeek; + momentPrototype__proto.isoWeekday = getSetISODayOfWeek; + momentPrototype__proto.dayOfYear = getSetDayOfYear; + + // Hour + momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour; + + // Minute + momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute; + + // Second + momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond; + + // Millisecond + momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond; + + // Offset + momentPrototype__proto.utcOffset = getSetOffset; + momentPrototype__proto.utc = setOffsetToUTC; + momentPrototype__proto.local = setOffsetToLocal; + momentPrototype__proto.parseZone = setOffsetToParsedOffset; + momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset; + momentPrototype__proto.isDST = isDaylightSavingTime; + momentPrototype__proto.isDSTShifted = isDaylightSavingTimeShifted; + momentPrototype__proto.isLocal = isLocal; + momentPrototype__proto.isUtcOffset = isUtcOffset; + momentPrototype__proto.isUtc = isUtc; + momentPrototype__proto.isUTC = isUtc; + + // Timezone + momentPrototype__proto.zoneAbbr = getZoneAbbr; + momentPrototype__proto.zoneName = getZoneName; + + // Deprecations + momentPrototype__proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); + momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); + momentPrototype__proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); + momentPrototype__proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779', getSetZone); + + var momentPrototype = momentPrototype__proto; + + function moment__createUnix (input) { + return local__createLocal(input * 1000); + } + + function moment__createInZone () { + return local__createLocal.apply(null, arguments).parseZone(); + } + + var defaultCalendar = { + sameDay : '[Today at] LT', + nextDay : '[Tomorrow at] LT', + nextWeek : 'dddd [at] LT', + lastDay : '[Yesterday at] LT', + lastWeek : '[Last] dddd [at] LT', + sameElse : 'L' + }; + + function locale_calendar__calendar (key, mom, now) { + var output = this._calendar[key]; + return isFunction(output) ? output.call(mom, now) : output; + } + + var defaultLongDateFormat = { + LTS : 'h:mm:ss A', + LT : 'h:mm A', + L : 'MM/DD/YYYY', + LL : 'MMMM D, YYYY', + LLL : 'MMMM D, YYYY h:mm A', + LLLL : 'dddd, MMMM D, YYYY h:mm A' + }; + + function longDateFormat (key) { + var format = this._longDateFormat[key], + formatUpper = this._longDateFormat[key.toUpperCase()]; + + if (format || !formatUpper) { + return format; + } + + this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { + return val.slice(1); + }); + + return this._longDateFormat[key]; + } + + var defaultInvalidDate = 'Invalid date'; + + function invalidDate () { + return this._invalidDate; + } + + var defaultOrdinal = '%d'; + var defaultOrdinalParse = /\d{1,2}/; + + function ordinal (number) { + return this._ordinal.replace('%d', number); + } + + function preParsePostFormat (string) { + return string; + } + + var defaultRelativeTime = { + future : 'in %s', + past : '%s ago', + s : 'a few seconds', + m : 'a minute', + mm : '%d minutes', + h : 'an hour', + hh : '%d hours', + d : 'a day', + dd : '%d days', + M : 'a month', + MM : '%d months', + y : 'a year', + yy : '%d years' + }; + + function relative__relativeTime (number, withoutSuffix, string, isFuture) { + var output = this._relativeTime[string]; + return (isFunction(output)) ? + output(number, withoutSuffix, string, isFuture) : + output.replace(/%d/i, number); + } + + function pastFuture (diff, output) { + var format = this._relativeTime[diff > 0 ? 'future' : 'past']; + return isFunction(format) ? format(output) : format.replace(/%s/i, output); + } + + var prototype__proto = Locale.prototype; + + prototype__proto._calendar = defaultCalendar; + prototype__proto.calendar = locale_calendar__calendar; + prototype__proto._longDateFormat = defaultLongDateFormat; + prototype__proto.longDateFormat = longDateFormat; + prototype__proto._invalidDate = defaultInvalidDate; + prototype__proto.invalidDate = invalidDate; + prototype__proto._ordinal = defaultOrdinal; + prototype__proto.ordinal = ordinal; + prototype__proto._ordinalParse = defaultOrdinalParse; + prototype__proto.preparse = preParsePostFormat; + prototype__proto.postformat = preParsePostFormat; + prototype__proto._relativeTime = defaultRelativeTime; + prototype__proto.relativeTime = relative__relativeTime; + prototype__proto.pastFuture = pastFuture; + prototype__proto.set = locale_set__set; + + // Month + prototype__proto.months = localeMonths; + prototype__proto._months = defaultLocaleMonths; + prototype__proto.monthsShort = localeMonthsShort; + prototype__proto._monthsShort = defaultLocaleMonthsShort; + prototype__proto.monthsParse = localeMonthsParse; + prototype__proto._monthsRegex = defaultMonthsRegex; + prototype__proto.monthsRegex = monthsRegex; + prototype__proto._monthsShortRegex = defaultMonthsShortRegex; + prototype__proto.monthsShortRegex = monthsShortRegex; + + // Week + prototype__proto.week = localeWeek; + prototype__proto._week = defaultLocaleWeek; + prototype__proto.firstDayOfYear = localeFirstDayOfYear; + prototype__proto.firstDayOfWeek = localeFirstDayOfWeek; + + // Day of Week + prototype__proto.weekdays = localeWeekdays; + prototype__proto._weekdays = defaultLocaleWeekdays; + prototype__proto.weekdaysMin = localeWeekdaysMin; + prototype__proto._weekdaysMin = defaultLocaleWeekdaysMin; + prototype__proto.weekdaysShort = localeWeekdaysShort; + prototype__proto._weekdaysShort = defaultLocaleWeekdaysShort; + prototype__proto.weekdaysParse = localeWeekdaysParse; + + // Hours + prototype__proto.isPM = localeIsPM; + prototype__proto._meridiemParse = defaultLocaleMeridiemParse; + prototype__proto.meridiem = localeMeridiem; + + function lists__get (format, index, field, setter) { + var locale = locale_locales__getLocale(); + var utc = create_utc__createUTC().set(setter, index); + return locale[field](utc, format); + } + + function list (format, index, field, count, setter) { + if (typeof format === 'number') { + index = format; + format = undefined; + } + + format = format || ''; + + if (index != null) { + return lists__get(format, index, field, setter); + } + + var i; + var out = []; + for (i = 0; i < count; i++) { + out[i] = lists__get(format, i, field, setter); + } + return out; + } + + function lists__listMonths (format, index) { + return list(format, index, 'months', 12, 'month'); + } + + function lists__listMonthsShort (format, index) { + return list(format, index, 'monthsShort', 12, 'month'); + } + + function lists__listWeekdays (format, index) { + return list(format, index, 'weekdays', 7, 'day'); + } + + function lists__listWeekdaysShort (format, index) { + return list(format, index, 'weekdaysShort', 7, 'day'); + } + + function lists__listWeekdaysMin (format, index) { + return list(format, index, 'weekdaysMin', 7, 'day'); + } + + locale_locales__getSetGlobalLocale('en', { + ordinalParse: /\d{1,2}(th|st|nd|rd)/, + ordinal : function (number) { + var b = number % 10, + output = (toInt(number % 100 / 10) === 1) ? 'th' : + (b === 1) ? 'st' : + (b === 2) ? 'nd' : + (b === 3) ? 'rd' : 'th'; + return number + output; + } + }); + + // Side effect imports + utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale); + utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale); + + var mathAbs = Math.abs; + + function duration_abs__abs () { + var data = this._data; + + this._milliseconds = mathAbs(this._milliseconds); + this._days = mathAbs(this._days); + this._months = mathAbs(this._months); + + data.milliseconds = mathAbs(data.milliseconds); + data.seconds = mathAbs(data.seconds); + data.minutes = mathAbs(data.minutes); + data.hours = mathAbs(data.hours); + data.months = mathAbs(data.months); + data.years = mathAbs(data.years); + + return this; + } + + function duration_add_subtract__addSubtract (duration, input, value, direction) { + var other = create__createDuration(input, value); + + duration._milliseconds += direction * other._milliseconds; + duration._days += direction * other._days; + duration._months += direction * other._months; + + return duration._bubble(); + } + + // supports only 2.0-style add(1, 's') or add(duration) + function duration_add_subtract__add (input, value) { + return duration_add_subtract__addSubtract(this, input, value, 1); + } + + // supports only 2.0-style subtract(1, 's') or subtract(duration) + function duration_add_subtract__subtract (input, value) { + return duration_add_subtract__addSubtract(this, input, value, -1); + } + + function absCeil (number) { + if (number < 0) { + return Math.floor(number); + } else { + return Math.ceil(number); + } + } + + function bubble () { + var milliseconds = this._milliseconds; + var days = this._days; + var months = this._months; + var data = this._data; + var seconds, minutes, hours, years, monthsFromDays; + + // if we have a mix of positive and negative values, bubble down first + // check: https://github.com/moment/moment/issues/2166 + if (!((milliseconds >= 0 && days >= 0 && months >= 0) || + (milliseconds <= 0 && days <= 0 && months <= 0))) { + milliseconds += absCeil(monthsToDays(months) + days) * 864e5; + days = 0; + months = 0; + } + + // The following code bubbles up values, see the tests for + // examples of what that means. + data.milliseconds = milliseconds % 1000; + + seconds = absFloor(milliseconds / 1000); + data.seconds = seconds % 60; + + minutes = absFloor(seconds / 60); + data.minutes = minutes % 60; + + hours = absFloor(minutes / 60); + data.hours = hours % 24; + + days += absFloor(hours / 24); + + // convert days to months + monthsFromDays = absFloor(daysToMonths(days)); + months += monthsFromDays; + days -= absCeil(monthsToDays(monthsFromDays)); + + // 12 months -> 1 year + years = absFloor(months / 12); + months %= 12; + + data.days = days; + data.months = months; + data.years = years; + + return this; + } + + function daysToMonths (days) { + // 400 years have 146097 days (taking into account leap year rules) + // 400 years have 12 months === 4800 + return days * 4800 / 146097; + } + + function monthsToDays (months) { + // the reverse of daysToMonths + return months * 146097 / 4800; + } + + function as (units) { + var days; + var months; + var milliseconds = this._milliseconds; + + units = normalizeUnits(units); + + if (units === 'month' || units === 'year') { + days = this._days + milliseconds / 864e5; + months = this._months + daysToMonths(days); + return units === 'month' ? months : months / 12; + } else { + // handle milliseconds separately because of floating point math errors (issue #1867) + days = this._days + Math.round(monthsToDays(this._months)); + switch (units) { + case 'week' : return days / 7 + milliseconds / 6048e5; + case 'day' : return days + milliseconds / 864e5; + case 'hour' : return days * 24 + milliseconds / 36e5; + case 'minute' : return days * 1440 + milliseconds / 6e4; + case 'second' : return days * 86400 + milliseconds / 1000; + // Math.floor prevents floating point math errors here + case 'millisecond': return Math.floor(days * 864e5) + milliseconds; + default: throw new Error('Unknown unit ' + units); + } + } + } + + // TODO: Use this.as('ms')? + function duration_as__valueOf () { + return ( + this._milliseconds + + this._days * 864e5 + + (this._months % 12) * 2592e6 + + toInt(this._months / 12) * 31536e6 + ); + } + + function makeAs (alias) { + return function () { + return this.as(alias); + }; + } + + var asMilliseconds = makeAs('ms'); + var asSeconds = makeAs('s'); + var asMinutes = makeAs('m'); + var asHours = makeAs('h'); + var asDays = makeAs('d'); + var asWeeks = makeAs('w'); + var asMonths = makeAs('M'); + var asYears = makeAs('y'); + + function duration_get__get (units) { + units = normalizeUnits(units); + return this[units + 's'](); + } + + function makeGetter(name) { + return function () { + return this._data[name]; + }; + } + + var milliseconds = makeGetter('milliseconds'); + var seconds = makeGetter('seconds'); + var minutes = makeGetter('minutes'); + var hours = makeGetter('hours'); + var days = makeGetter('days'); + var months = makeGetter('months'); + var years = makeGetter('years'); + + function weeks () { + return absFloor(this.days() / 7); + } + + var round = Math.round; + var thresholds = { + s: 45, // seconds to minute + m: 45, // minutes to hour + h: 22, // hours to day + d: 26, // days to month + M: 11 // months to year + }; + + // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize + function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { + return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); + } + + function duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) { + var duration = create__createDuration(posNegDuration).abs(); + var seconds = round(duration.as('s')); + var minutes = round(duration.as('m')); + var hours = round(duration.as('h')); + var days = round(duration.as('d')); + var months = round(duration.as('M')); + var years = round(duration.as('y')); + + var a = seconds < thresholds.s && ['s', seconds] || + minutes <= 1 && ['m'] || + minutes < thresholds.m && ['mm', minutes] || + hours <= 1 && ['h'] || + hours < thresholds.h && ['hh', hours] || + days <= 1 && ['d'] || + days < thresholds.d && ['dd', days] || + months <= 1 && ['M'] || + months < thresholds.M && ['MM', months] || + years <= 1 && ['y'] || ['yy', years]; + + a[2] = withoutSuffix; + a[3] = +posNegDuration > 0; + a[4] = locale; + return substituteTimeAgo.apply(null, a); + } + + // This function allows you to set a threshold for relative time strings + function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) { + if (thresholds[threshold] === undefined) { + return false; + } + if (limit === undefined) { + return thresholds[threshold]; + } + thresholds[threshold] = limit; + return true; + } + + function humanize (withSuffix) { + var locale = this.localeData(); + var output = duration_humanize__relativeTime(this, !withSuffix, locale); + + if (withSuffix) { + output = locale.pastFuture(+this, output); + } + + return locale.postformat(output); + } + + var iso_string__abs = Math.abs; + + function iso_string__toISOString() { + // for ISO strings we do not use the normal bubbling rules: + // * milliseconds bubble up until they become hours + // * days do not bubble at all + // * months bubble up until they become years + // This is because there is no context-free conversion between hours and days + // (think of clock changes) + // and also not between days and months (28-31 days per month) + var seconds = iso_string__abs(this._milliseconds) / 1000; + var days = iso_string__abs(this._days); + var months = iso_string__abs(this._months); + var minutes, hours, years; + + // 3600 seconds -> 60 minutes -> 1 hour + minutes = absFloor(seconds / 60); + hours = absFloor(minutes / 60); + seconds %= 60; + minutes %= 60; + + // 12 months -> 1 year + years = absFloor(months / 12); + months %= 12; + + + // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js + var Y = years; + var M = months; + var D = days; + var h = hours; + var m = minutes; + var s = seconds; + var total = this.asSeconds(); + + if (!total) { + // this is the same as C#'s (Noda) and python (isodate)... + // but not other JS (goog.date) + return 'P0D'; + } + + return (total < 0 ? '-' : '') + + 'P' + + (Y ? Y + 'Y' : '') + + (M ? M + 'M' : '') + + (D ? D + 'D' : '') + + ((h || m || s) ? 'T' : '') + + (h ? h + 'H' : '') + + (m ? m + 'M' : '') + + (s ? s + 'S' : ''); + } + + var duration_prototype__proto = Duration.prototype; + + duration_prototype__proto.abs = duration_abs__abs; + duration_prototype__proto.add = duration_add_subtract__add; + duration_prototype__proto.subtract = duration_add_subtract__subtract; + duration_prototype__proto.as = as; + duration_prototype__proto.asMilliseconds = asMilliseconds; + duration_prototype__proto.asSeconds = asSeconds; + duration_prototype__proto.asMinutes = asMinutes; + duration_prototype__proto.asHours = asHours; + duration_prototype__proto.asDays = asDays; + duration_prototype__proto.asWeeks = asWeeks; + duration_prototype__proto.asMonths = asMonths; + duration_prototype__proto.asYears = asYears; + duration_prototype__proto.valueOf = duration_as__valueOf; + duration_prototype__proto._bubble = bubble; + duration_prototype__proto.get = duration_get__get; + duration_prototype__proto.milliseconds = milliseconds; + duration_prototype__proto.seconds = seconds; + duration_prototype__proto.minutes = minutes; + duration_prototype__proto.hours = hours; + duration_prototype__proto.days = days; + duration_prototype__proto.weeks = weeks; + duration_prototype__proto.months = months; + duration_prototype__proto.years = years; + duration_prototype__proto.humanize = humanize; + duration_prototype__proto.toISOString = iso_string__toISOString; + duration_prototype__proto.toString = iso_string__toISOString; + duration_prototype__proto.toJSON = iso_string__toISOString; + duration_prototype__proto.locale = locale; + duration_prototype__proto.localeData = localeData; + + // Deprecations + duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString); + duration_prototype__proto.lang = lang; + + // Side effect imports + + // FORMATTING + + addFormatToken('X', 0, 0, 'unix'); + addFormatToken('x', 0, 0, 'valueOf'); + + // PARSING + + addRegexToken('x', matchSigned); + addRegexToken('X', matchTimestamp); + addParseToken('X', function (input, array, config) { + config._d = new Date(parseFloat(input, 10) * 1000); + }); + addParseToken('x', function (input, array, config) { + config._d = new Date(toInt(input)); + }); + + // Side effect imports + + + utils_hooks__hooks.version = '2.12.0'; + + setHookCallback(local__createLocal); + + utils_hooks__hooks.fn = momentPrototype; + utils_hooks__hooks.min = min; + utils_hooks__hooks.max = max; + utils_hooks__hooks.now = now; + utils_hooks__hooks.utc = create_utc__createUTC; + utils_hooks__hooks.unix = moment__createUnix; + utils_hooks__hooks.months = lists__listMonths; + utils_hooks__hooks.isDate = isDate; + utils_hooks__hooks.locale = locale_locales__getSetGlobalLocale; + utils_hooks__hooks.invalid = valid__createInvalid; + utils_hooks__hooks.duration = create__createDuration; + utils_hooks__hooks.isMoment = isMoment; + utils_hooks__hooks.weekdays = lists__listWeekdays; + utils_hooks__hooks.parseZone = moment__createInZone; + utils_hooks__hooks.localeData = locale_locales__getLocale; + utils_hooks__hooks.isDuration = isDuration; + utils_hooks__hooks.monthsShort = lists__listMonthsShort; + utils_hooks__hooks.weekdaysMin = lists__listWeekdaysMin; + utils_hooks__hooks.defineLocale = defineLocale; + utils_hooks__hooks.updateLocale = updateLocale; + utils_hooks__hooks.locales = locale_locales__listLocales; + utils_hooks__hooks.weekdaysShort = lists__listWeekdaysShort; + utils_hooks__hooks.normalizeUnits = normalizeUnits; + utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold; + utils_hooks__hooks.prototype = momentPrototype; + + var _moment = utils_hooks__hooks; + + return _moment; + +})); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/multiselect.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/multiselect.js new file mode 100644 index 0000000..eda8da0 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/multiselect.js @@ -0,0 +1,62 @@ +'use strict'; + +angular.module('quantum').directive('dropdownMultiselect', ['$document', function($document){ + return { + restrict: 'E', + scope:{ + model: '=ngModel', + options: '=' + }, + template: "
        "+ + "Multi-Select"+ + ""+ + "" + + "
        " , + link: function($scope,element,attr){ + + $scope.$watch("options",function(newValue,oldValue) { + $scope.model = []; + }); + + $scope.selectAll = function () { + $scope.model = _.pluck($scope.options, 'value'); + }; + $scope.deselectAll = function() { + $scope.model=[]; + }; + $scope.setSelectedItem = function(){ + var value = this.option.value; + if (_.contains($scope.model, value)) { + $scope.model = _.without($scope.model, value); + } else { + $scope.model.push(value); + } + return false; + }; + $scope.isChecked = function (value) { + if (_.contains($scope.model, value)) { + return 'icon-included-checkmark pull-right'; + } + return false; + }; + + $document.bind('click', function(event){ + var isClickedElementChildOfPopup = element + .find(event.target) + .length > 0; + + if (isClickedElementChildOfPopup) + return; + + $scope.open = false; + $scope.$apply(); + }); + + } + }; +}]); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/quick_links.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/quick_links.js new file mode 100644 index 0000000..81e8276 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/quick_links.js @@ -0,0 +1,33 @@ +'use strict'; +angular.module('quantum').directive('quickLinks', ['$http','$window', function($http,$window){ + return { + restrict: 'E', + scope:{ + ngModel: '=' + }, + template: "", + link: function($scope,element,attr){ + $scope.ngDisplayType=attr.ngDisplayType; + $scope.popUpWindowSize = "top=" + ((screen.height*.2)/2) + ",left=" + ((screen.width*.05)/2) + ",width="+(screen.width-(screen.width*.06))+",height="+(screen.height-(screen.height*.25)); + + $scope.openLink = function(url){ + if($scope.ngDisplayType){ + if($scope.ngDisplayType=='1'){ + $window.open(url,'_self'); + }else if($scope.ngDisplayType=='2'){ + $window.open(url, '_blank'); + }else if($scope.ngDisplayType=='3'){ + $window.open(url, '', $scope.popUpWindowSize); + } + } + }; + + $http.get('raptor.htm?action=quicklinks.json&quick_links_menu_id='+attr.ngMenuId).then(function(result){ + $scope.quickLinks=result.data; + }); + } + }; +}]); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_chart_wizard.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_chart_wizard.html new file mode 100644 index 0000000..35fad2b --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_chart_wizard.html @@ -0,0 +1,313 @@ +
        Your configurations have been successfully submitted
        + +
        +
        +
        +
        +
        + + +
        +
        +
        +
        +
        + +
        +
        + +
        + +
        +
        + +
        +
        + +
        +
        + Show + Hide +
        +
        + + +
        +
        +
        +
        + +
        +
        +
        +
        +
        + +
        +
        +
        +
        +
        +
        +
        + + +
        +
        + +
        + +
        +
        + +
        + +
        +
        +
        +
        + +
        +
        +
        +
        + +
        +
        + +
        + +
        + Add + + Remove +
        +
        +
        +
        +
        + + + +
        +
        + +
        +
        +
        + +
        +
        +
        +
        + +
        +
        +
        + +

        +
        +
        + + + + +
        + + + + + +
        +
        +
        + Vertical + Horizontal +
        + +
        +
        + Yes + No +
        + +
        +
        + Yes + No +
        + +
        +
        + Yes + No +
        + +
        +
        + Yes + No +

        + +
        +
        + Yes + No +
        + +
        +
        + + +
        +
        + +
        +
        +
        + +
        + + + + +
        +
        +
        +
        + Line + Area +
        + +
        +
        + +

        + +
        +
        + +
        + +
        +
        + Yes + No +
        + +
        +
        + Yes + No +
        +
        +
        + +
        +
        + +
        + +
        + + + + + + +
        +
        +
        +
        + +
        + +
        +
        + Weekly + Daily + Hourly + 30 Min +
        +
        +
        +
        +
        + +
        + + + + + + + + + + + + +
        +
        +
        +
        + up 45° + up 90° + down 45° + down 90° + Standard +
        + +
        +
        + Top + Bottom +

        + +
        +
        + Yes + No +
        + +
        +
        + Yes + No +

        + +
        +
        + +
        +
        +
        + +
        +
        +
        + +
        +
        +
        + +

        +
        +
        +
        +
        +

        + Save + Run + + + + + +
        + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_chart_wizard.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_chart_wizard.js new file mode 100644 index 0000000..7fc167c --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_chart_wizard.js @@ -0,0 +1,671 @@ +app.controller('ChartController', function ($scope, $rootScope, $timeout, $window, $http, $routeParams,modalService) { + //$scope.test="1223"; + //alert($scope.chartType.value); + + $scope.populateChrtWzdFields = function() { + + $scope.reportRunJson = {}; + // console.log($routeParams.reportId); + $http.get("raptor.htm?action=chart.json&c_master="+$routeParams.reportId).then(function (response) { + //$scope.myData = JSON.stringify(response.data); + // response.data.rangeAxisList[0].rangeColorJSON = {}; + $scope.reportRunJson = response.data; + // $scope.chrtheight = $scope.reportRunJson.height; + // console.log(JSON.stringify($scope.reportRunJson)); + /* if ($scope.reportRunJson.showTitle==false) + $scope.reportRunJson.showTitle="false"; + else + $scope.reportRunJson.showTitle="true"; */ + + console.log($scope.reportRunJson); + + + + + + //Set chart type + if ($scope.reportRunJson.chartTypeJSON) { + var chrtTypeValue = $scope.reportRunJson.chartTypeJSON.value; + for(var i = 0; i < $scope.chartTypes.length; i++) { + var obj = $scope.chartTypes[i]; + //console.log(obj.id); + if ($scope.chartTypes[i].value==chrtTypeValue) { + $scope.reportRunJson.chartTypeJSON.index=$scope.chartTypes[i].index; + $scope.reportRunJson.chartTypeJSON.title=$scope.chartTypes[i].title; + } + + } + } + + //Set Domain Axis + if ($scope.reportRunJson.domainAxisJSON) { + var domaninAxisValue = $scope.reportRunJson.domainAxisJSON.value; + for(var i = 0; i < $scope.reportRunJson.chartColumnJSONList.length; i++) { + if ($scope.reportRunJson.chartColumnJSONList[i].value==domaninAxisValue) { + $scope.reportRunJson.domainAxisJSON.index=$scope.reportRunJson.chartColumnJSONList[i].index; + $scope.reportRunJson.domainAxisJSON.title=$scope.reportRunJson.chartColumnJSONList[i].title; + } + + } + } + + //Set Category + if ($scope.reportRunJson.categoryAxisJSON) { + var categoryAxisValue = $scope.reportRunJson.categoryAxisJSON.value; + for(var i = 0; i < $scope.reportRunJson.chartColumnJSONList.length; i++) { + if ($scope.reportRunJson.chartColumnJSONList[i].value==categoryAxisValue) { + $scope.reportRunJson.categoryAxisJSON.index=$scope.reportRunJson.chartColumnJSONList[i].index; + $scope.reportRunJson.categoryAxisJSON.title=$scope.reportRunJson.chartColumnJSONList[i].title; + } + + } + } + + //Set range axis label + if ($scope.reportRunJson.rangeAxisList) { + for(var j = 0; j < $scope.reportRunJson.rangeAxisList.length; j++) { + + if ($scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON) { + var rangeAxisLabelValue = $scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON.value; + for(var i = 0; i < $scope.reportRunJson.chartColumnJSONList.length; i++) { + if ($scope.reportRunJson.chartColumnJSONList[i].value==rangeAxisLabelValue) { + $scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON.index=$scope.reportRunJson.chartColumnJSONList[i].index; + $scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON.title=$scope.reportRunJson.chartColumnJSONList[i].title; + } + + } + } + } + } + + + //set range linetype + if ($scope.reportRunJson.rangeAxisList) { + for(var j = 0; j < $scope.reportRunJson.rangeAxisList.length; j++) { + if ($scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON != null && $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON.value != "" + && $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON.value != null) { + var lineTypeValue = $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON.value; + for(var i = 0; i < $scope.lineTypes.length; i++) { + if ($scope.lineTypes[i].value==lineTypeValue) { + $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON.index=$scope.lineTypes[i].index; + $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON.title=$scope.lineTypes[i].title; + } + + } + } else { + $scope.reportRunJson.rangeAxisList[j].rangeLineTypeJSON = null; + } + } + + } + //set range color + if ($scope.reportRunJson.rangeAxisList) { + for(var j = 0; j < $scope.reportRunJson.rangeAxisList.length; j++) { + if ($scope.reportRunJson.rangeAxisList[j].rangeColorJSON != null && $scope.reportRunJson.rangeAxisList[j].rangeColorJSON.value != "" + && $scope.reportRunJson.rangeAxisList[j].rangeColorJSON.value != null) { + var colorValue = $scope.reportRunJson.rangeAxisList[j].rangeColorJSON.value; + + for(var i = 0; i < $scope.rangeColors.length; i++) { + + if ($scope.rangeColors[i].value==colorValue) { + $scope.reportRunJson.rangeAxisList[j].rangeColorJSON.index=$scope.rangeColors[i].index; + $scope.reportRunJson.rangeAxisList[j].rangeColorJSON.title=$scope.rangeColors[i].title; + } + } + }else { + $scope.reportRunJson.rangeAxisList[j].rangeColorJSON = null; + } + } + } + + + + + /* var data = $.param({ + json: JSON.stringify($scope.reportRunJson) + }); + console.log(data); + $http.post("/ecomp-sdk-app/testraptorchart", JSON.stringify($scope.reportRunJson)).success(function(data, status) { + console.log(data); + console.log(status); + + })*/ + + }); + + + /* $scope.chrtwidth = $scope.reportRunJson.width; + + $scope.chrtheight = $scope.reportRunJson.height; + $scope.title="false"; + $scope.domainAxes = $scope.reportRunJson.chartColumnJSONList; + $scope.categories = $scope.reportRunJson.chartColumnJSONList; + $scope.rangeAxes = $scope.reportRunJson.chartColumnJSONList; */ + + // $scope.Color = $scope.rangeColors; + // $scope.lineType = $scope.lineTypes; + // $scope.praxis = $scope.reportRunJson.primaryAxisLabel; + // $scope.secaxis = $scope.reportRunJson.secondaryAxisLabel; + // $scope.raxisminrange = $scope.reportRunJson.minRange; + // $scope.raxismaxrange = $scope.reportRunJson.maxRange; + // $scope.reportRunJson.legendangle = "up_45"; + $scope.legend = "true"; + // $scope.animate = "true"; + // $scope.topmargin = $scope.reportRunJson.topMargin; + // $scope.bottommargin = $scope.reportRunJson.bottomMargin; + // $scope.leftmargin = $scope.reportRunJson.leftMargin; + // $scope.rightmargin = $scope.reportRunJson.rightMargin; + // $scope.tt1=false; + + + + } + + $scope.saveChartData = function() { + //console.log(JSON.stringify($scope.reportRunJson)); + + //Converting string variables to numbers + $scope.reportRunJson.commonChartOptions.rightMargin = Number($scope.reportRunJson.commonChartOptions.rightMargin); + $scope.reportRunJson.commonChartOptions.topMargin = Number($scope.reportRunJson.commonChartOptions.topMargin); + $scope.reportRunJson.commonChartOptions.bottomMargin = Number($scope.reportRunJson.commonChartOptions.bottomMargin); + $scope.reportRunJson.commonChartOptions.leftMargin = Number($scope.reportRunJson.commonChartOptions.leftMargin); + + //Concatenate range Y axis with range label with pipe delimiter + /* if ($scope.reportRunJson.rangeAxisList) { + + for(var j = 0; j < $scope.reportRunJson.rangeAxisList.length; j++) { + + if ($scope.reportRunJson.rangeAxisList[j].rangeYAxis) { + if ($scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON != "" && $scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON != null) { + $scope.reportRunJson.rangeAxisList[j].rangeYAxis = + $scope.reportRunJson.rangeAxisList[j].rangeYAxis + "|"+ $scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON.value; + + //document.getElementById('yaxs').value = $scope.reportRunJson.rangeAxisList[j].rangeYAxis.substring(0,$scope.reportRunJson.rangeAxisList[j].rangeYAxis.indexOf('|')); + } + } else { + if ($scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON != "" && $scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON != null) + $scope.reportRunJson.rangeAxisList[j].rangeYAxis = "|"+ $scope.reportRunJson.rangeAxisList[j].rangeAxisLabelJSON.value; + + } + } + + + }*/ + + if ($scope.reportRunJson.categoryAxisJSON == "") { + console.log('Inside categoryAxisJSON value'); + $scope.reportRunJson.categoryAxisJSON = {}; + $scope.reportRunJson.categoryAxisJSON.value = -1; + console.log('$scope.reportRunJson.categoryAxisJSON',$scope.reportRunJson.categoryAxisJSON); + } + + + $http.post("save_chart", JSON.stringify($scope.reportRunJson)).success(function(data, status) { + // console.log(data); + // console.log(status); + $scope.successSubmit=true; + // modalService.showSuccess("Success","Chart Wizard details have been successfully submitted."); + // saveProfile(); + + }) + + + /* $http.post("/ecomp-sdk-app/testraptorchart", $scope.reportRunJson).then(function(response) { + console.log(response.data); + console.log(response.status); + + });*/ + } + + //$scope.samplearray = ["abc","test"]; + + + $scope.addRangeAxisRow = function (rangeaxisitem) { + + + + + $scope.reportRunJson.rangeAxisList.push({ + + /* "rangeColor":{ + "index":0, + "value":rangeaxisitem.rangeColor.value, + "title":rangeaxisitem.rangeColor.title + + }, + "rangeLineType":{ + "index":0, + "value":rangeaxisitem.rangeLineType.value, + "title":rangeaxisitem.rangeLineType.title + + }, + "rangeaxisLabel":{ + "index":0, + "value":rangeaxisitem.rangeaxisLabel.value, + "title":rangeaxisitem.rangeaxisLabel.value + + }, + "YAxis":"", + "chartTitle":""*/ + }); + // alert($scope.reportRunJson.rangeAxisList.length); + console.log($scope.reportRunJson.rangeAxisList); + + }; + + $scope.removeRangeAxisRow = function (index) { + $scope.reportRunJson.rangeAxisList.splice(index, 1); + //console.log($scope.hardCodeReport.rangeAxisList) + }; + + + + /*$scope.saveProfile = function() { + var uuu = "profile/saveProfile?profile_id=" + $scope.profileId;; + var postData={profile: $scope.profile, + selectedCountry:$scope.selectedCountry!=null?$scope.selectedCountry.value:"", + selectedState:$scope.stateList.selected!=null?$scope.stateList.selected.value:"", + selectedTimeZone:$scope.selectedTimeZone!=null?$scope.selectedTimeZone.value:"" + }; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + modalService.showSuccess("Success","Update Successful."); + }, + error : function(data){ + modalService.showFailure("Fail","Error while saving."); + } + }); + };*/ + + + /* $scope.actionClicked = function(){ + + if ($scope.chartType=="Bar Chart") { + $scope.tt1=true; + } else if ($scope.chartType=="Time Series/Area Chart") { + $scope.tt2=true; + }else + // $scope.tt3=true; + };*/ + + $scope.init = function () { + // console.time("In init"); + if ($scope) { + $scope.populateChrtWzdFields(); + // $scope.saveChartData(); + } + + }; + + + /*$scope.accgroups = [ + { + title: "Accordion Item #1", + content:"Unit test me bro! Proin eu quam malesuada, accumsan velit eu, tristique orci. Donec neque nisl, dignissim ut hendrerit sit amet, tempor id erat. Donec fermentum commodo semper. Sed lectus odio, egestas non volutpat eu, venenatis eu turpis. Donec eget fringilla lorem. Fusce sit amet semper velit. ", + open: false + }, + { + title: "Accordion Item #2", + content: "Lint me too! Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi eleifend aliquam eros quis fringilla. Integer eu justo turpis. Nam mauris augue, posuere interdum dignissim sed, tempor sit amet neque. In nec tortor id nibh sollicitudin aliquam sit amet ac augue", + open: false + }, + { + title: "Accordion Item #3", + content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi eleifend aliquam eros quis fringilla. Integer eu justo turpis. Nam mauris augue, posuere interdum dignissim sed, tempor sit amet neque. In nec tortor id nibh sollicitudin aliquam sit amet ac augue", + open: false + } + ];*/ + + $scope.domainItems = [{title:"Domain Axis1", content:"Test1", open: false},{title:"Domain Axis2", content:"Test2", open: false}]; + + $scope.chartTypes = [ + {index: 0, value: 'BarChart3D', title: 'Bar Chart'}, + {index: 1, value: 'TimeSeriesChart', title: 'Time Series/Area Chart'}, + {index: 2, value: 'PieChart', title: 'Pie Chart'}, + {index: 3, value: 'AnnotationChart', title: 'Annotation Chart'}, + {index: 4, value: 'FlexTimeChart', title: 'Flexible Time Chart'} + ]; + + /* $scope.domainAxes = [ + {index: 0, value: 'scenario_name', title: 'scenario_name'}, + {index: 1, value: 'total_traffic_in_PB', title: 'Total Traffic in PB'}, + {index: 2, value: 'Avg Utilization Day', title: 'Avg Utilization Day'} + + ];*/ + + $scope.categories = [ + {index: 0, value: 'scenario_name', title: 'scenario_name'}, + {index: 1, value: 'total_traffic_in_PB', title: 'Total Traffic in PB'}, + {index: 2, value: 'Avg Utilization Day', title: 'Avg Utilization Day'} + + ]; + + $scope.rangeColors = [ + + {index: 0, value: "#1f77b4",title: "Dodger Blue"}, + {index: 1, value: "#ff7f0e",title: "Vivid orange"}, + {index: 2, value: "#2ca02c",title: "Forest Green"}, + {index: 3, value: "#8c864b",title: "Greenish Red"}, + {index: 4, value: "#9467bd",title: "Desaturated violet"}, + {index: 5, value: "#8c564b",title: "Dark moderate red"}, + {index: 6, value: "#e377c2",title: "Soft pink"}, + {index: 7, value: "#7f7f7f",title: "Dark gray"}, + {index: 8, value: "#bcbd22",title: "Strong yellow"}, + {index: 9, value: "#17becf",title: "Strong cyan"}, + {index: 10, value: "#dc143c",title: "Vivid red"}, + {index: 11, value: "#800080",title: "Dark magenta"}, + {index: 12, value: "#0000FF",title: "Blue"}, + {index: 13, value: "#008000",title: "Dark lime green"}, + {index: 14, value: "#D2691E",title: "Reddish Orange"}, + {index: 15, value: "#FF0000",title: "Red"}, + {index: 16, value: "#000000",title: "Black"}, + {index: 17, value: "#DB7093",title: "Pink"}, + {index: 18, value: "#FF00FF",title: "Pure Magenta"}, + {index: 19, value: "#7B68EE",title: "Soft blue"}, + {index: 20, value: "#1f77b6",title: "Strong blue"}, + {index: 21, value: "#9edae5",title: "Very soft cyan"}, + {index: 22, value: "#393b79",title: "Dark Blue"}, + {index: 23, value: "#5254a3",title: "Dark moderate Blue"}, + {index: 24, value: "#6b6ecf",title: "Slightly desaturated blue"}, + {index: 25, value: "#9c9ede",title: "Very soft blue"}, + {index: 26, value: "#637939",title: "Dark Green"}, + {index: 27, value: "#8ca252",title: "Dark moderate green"}, + {index: 28, value: "#b5cf6b",title: "Slightly desaturated green"}, + {index: 29, value: "#cedb9c",title: "Desaturated Green"}, + + /* Old Colors */ + {index: 30, value: "#00FFFF",title: "Aqua"}, + {index: 31, value: "#000000",title: "Black"}, + {index: 32, value: "#0000FF",title: "Blue"}, + {index: 33, value: "#FF00FF",title: "Fuchsia"}, + {index: 34, value: "#808080",title: "Gray"}, + {index: 35, value: "#008000",title: "Green"}, + {index: 36, value: "#00FF00",title: "Lime"}, + {index: 37, value: "#800000",title: "Maroon"}, + {index: 38, value: "#000080",title: "Navy"}, + {index: 39, value: "#808000",title: "Olive"}, + {index: 40, value: "#FF9900",title: "Orange"}, + {index: 41, value: "#800080",title: "Purple"}, + {index: 42, value: "#FF0000",title: "Red"}, + {index: 43, value: "#C0C0C0",title: "Silver"}, + {index: 44, value: "#008080",title: "Teal"}, + {index: 45, value: "#FFFFFF",title: "White"}, + {index: 46, value: "#FFFF00",title: "Yellow"} + ]; + + + $scope.lineTypes = [ + {index: 0, value: 'default', title: 'Default'}, + {index: 1, value: 'dotted_lines', title: 'Dotted Lines'}, + {index: 2, value: 'dashed_lines', title: 'Dashed Lines'} + + ]; + + + $scope.hardCodeReport= { + "reportID":"3356", + "reportName":"Test: Line Chart", + "reportDescr":"", + "reportTitle":"", + "reportSubTitle":"", + "formFieldList":[ + + ], + "chartColumnJSONList":[ + { + "index":0, + "value":"tr0", + "title":"traffic_date", + "$$hashKey":"056" + }, + { + "index":1, + "value":"ut1", + "title":"util_perc", + "$$hashKey":"057" + } + ], + "formfield_comments":null, + "totalRows":0, + "chartSqlWhole":"SELECT traffic_date tr0, traffic_date tr0_1,util_perc ut1, 1 FROM portal.demo_util_chart ORDER BY 1", + "chartAvailable":true, + "chartType":{"index": "", "value": "Bar Chart", "title": ""}, + "width":"700", + "height":"420", + "animation":false, + "rotateLabels":"90", + "staggerLabels":false, + "showTitle":"false", + "domainAxis":{ + "index":0, + "value":"tr0", + "title":"traffic_date", + "$$hashKey":"11H" + }, + + "categoryAxis":{ + "index":1, + "value":"ut1", + "title":"util_perc", + "$$hashKey":"11I" + }, + + "hasCategoryAxis":false, + "rangeAxisList":[ + { + + "rangeColor":{ + "index":"", + "value":"#bcbd22", + "title":"" + + }, + + "rangeLineType":{ + "index":"", + "value":"dotted_lines", + "title":"" + + + }, + + "rangeAxisLabel":{ + "index":0, + "value":"tr0", + "title":"traffic_date", + "$$hashKey":"056" + }, + "YAxis":"10", + "chartTitle":"test" + }, + { + + "rangeColor":{ + "index":"", + "value":"#2ca02c", + "title":"" + + }, + + "rangeLineType":{ + "index":"", + "value":"dashed_lines", + "title":"" + + + }, + + "rangeAxisLabel":{ + "index":0, + "value":"tr0", + "title":"traffic_date", + "$$hashKey":"056" + }, + "YAxis":"10", + "chartTitle":"test" + } + + + ], + + "primaryAxisLabel":"testlabel", + "secondaryAxisLabel":"testseclabel", + "minRange":"10", + "maxRange":"20", + "topMargin":"6", + "bottomMargin":"5", + "leftMargin":"4", + "rightMargin":"3" + }; + + var colorValue = $scope.hardCodeReport.rangeAxisList[0].rangeColor.value; + + //console.log($scope.hardCodeReport.chartType); + + // prefill range color + /* for(var i = 0; i < $scope.rangeColors.length; i++) { + var obj = $scope.rangeColors[i]; + //console.log(obj.id); + if ($scope.rangeColors[i].value==colorValue) { + $scope.hardCodeReport.rangeAxisList[0].rangeColor.index=$scope.rangeColors[i].index; + $scope.hardCodeReport.rangeAxisList[0].rangeColor.title=$scope.rangeColors[i].title; + } + + }*/ + + //prefill chart type + +// console.log($scope.hardCodeReport.chartType); + +// console.log($scope.hardCodeReport.chartType); + + // console.log($scope.hardCodeReport.rangeAxisList); + //prefill rangle line type + /* for(var j = 0; j < $scope.hardCodeReport.rangeAxisList.length; j++) { + + var lineTypeValue = $scope.hardCodeReport.rangeAxisList[j].rangeLineType.value; + for(var i = 0; i < $scope.lineTypes.length; i++) { + var obj = $scope.lineTypes[i]; + //console.log(obj.id); + if ($scope.lineTypes[i].value==lineTypeValue) { + $scope.hardCodeReport.rangeAxisList[j].rangeLineType.index=$scope.lineTypes[i].index; + $scope.hardCodeReport.rangeAxisList[j].rangeLineType.title=$scope.lineTypes[i].title; + } + + } + }*/ +// console.log($scope.hardCodeReport.rangeAxisList); + + + + + // console.log($scope.hardCodeReport.rangeAxisList[0].rangeColor); + /* $scope.hardCodeReport.rangeAxisList[0].rangeColor.index=4; + $scope.hardCodeReport.rangeAxisList[0].rangeColor.title="Desaturated violet";*/ + + + //console.log($scope.hardCodeReport); + + + + + + /*$scope.reportRunJson = + { + "reportID":"3356", + "reportName":"Test: Line Chart", + "reportDescr":"", + "reportTitle":"", + "reportSubTitle":"", + "formFieldList":[ + + ], + "chartColumnJSONList":[ + { + "index":0, + "value":"tr0", + "title":"traffic_date" + }, + { + "index":1, + "value":"ut1", + "title":"util_perc" + } + ], + "formfield_comments":null, + "totalRows":0, + "chartSqlWhole":"SELECT traffic_date tr0, traffic_date tr0_1,util_perc ut1, 1 FROM portal.demo_util_chart ORDER BY 1", + "chartAvailable":true, + "chartType":"TimeSeriesChart", + "width":"700", + "height":"420", + "animation":false, + "rotateLabels":"90", + "staggerLabels":false, + "showTitle":false, + "domainAxis":"tr0", + "categoryAxis":null, + "hasCategoryAxis":false, + "rangeAxisList":[ + { + "YAxis":"", + "chartTitle":"" + } + ], + "primaryAxisLabel":"", + "secondaryAxisLabel":"", + "minRange":"", + "maxRange":"", + "topMargin":"", + "bottomMargin":"", + "leftMargin":"", + "rightMargin":"3" + }; */ + $timeout(function() { + $rootScope.isViewRendering = false; + }); + + +}); + +app.directive('onlyDigits', function () { + + return { + restrict: 'A', + require: '?ngModel', + link: function (scope, element, attrs, ngModel) { + if (!ngModel) return; + ngModel.$parsers.unshift(function (inputValue) { + var digits = inputValue.split('').filter(function (s) { return (!isNaN(s) && s != ' '); }).join(''); + ngModel.$viewValue = digits; + ngModel.$render(); + return digits; + }); + } + }; +}); + +app.directive('onlyCharacters', function () { + + return { + restrict: 'A', + require: '?ngModel', + link: function (scope, element, attrs, ngModel) { + if (!ngModel) return; + ngModel.$parsers.unshift(function (inputValue) { + var digits = inputValue.split('').filter(function (s) { return (isNaN(s) && s != ' '); }).join(''); + ngModel.$viewValue = digits; + ngModel.$render(); + return digits; + }); + } + }; +}); + + + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_run.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_run.html new file mode 100644 index 0000000..afdb692 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_run.html @@ -0,0 +1,67 @@ + + + +
        +

        {{reportData.reportName}} + +     +     + + +

        +
        Loading...
        + +
        + +

        + +
        + Back + +
        +
        +
        +
        +
        + {{reportData.message}} +
        +
        +
        +
        +
        diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_run.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_run.js new file mode 100644 index 0000000..0df5679 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_run.js @@ -0,0 +1,293 @@ +app.controller("reportRunController", ['$scope','$rootScope','$routeParams','$http','dateFilter', '$window', '$timeout', 'rowSorter', + function ($scope,$rootScope,$routeParams,$http,dateFilter,$window,$timeout,rowSorter) { + $scope.dateformat = "MM/dd/yyyy"; + $scope.datetimeformat = "MM/dd/yyyy hh:mm a"; + $scope.showFormFields = false; + $scope.showGrid = false; + $scope.showChart = false; + $scope.showBackButton = false; + $scope.reportData = {}; + $scope.reportData.allowEdit = false; + $scope.formFieldSelectedValues = {}; + $scope.showFormFieldIds = false; + + $scope.isInProgress = true; + + if($routeParams.reportUrlParams.indexOf("parent___params===")>-1) { + $scope.showBackButton = true; + $scope.parentReportUrlParams = $routeParams.reportUrlParams.substring($routeParams.reportUrlParams.indexOf("parent___params===")+18); + $scope.currentReportUrlParams = $routeParams.reportUrlParams.substring(0,$routeParams.reportUrlParams.indexOf("parent___params===")); + } else { + $scope.currentReportUrlParams = $routeParams.reportUrlParams; + } + console.log($routeParams.reportUrlParams); + var parseQueryString = function( queryString ) { + var params = {}, queries, temp, i, l; + // Split into key/value pairs + queries = queryString.split("&"); + // Convert the array of strings into an object + for ( i = 0, l = queries.length; i < l; i++ ) { + temp = queries[i].split('='); + //console.log(temp[0]); + //console.log(temp[0] != "refresh"); + if(temp[0] && temp[0] != "refresh") + params[temp[0]] = temp[1]; + } + return params; + }; + + var convertQueryString = function(queryString) { + var keys = ""; var str = ""; + keys = Object.keys(queryString); + //console.log(keys); + for ( i = 0, l = keys.length; i < l; i++ ) { + str += keys[i]+"="+queryString[keys[i]] + "&"; + + } + return str; + //queryString = + } + + + + + $scope.urlParams = parseQueryString($scope.currentReportUrlParams); + + $scope.reportChartURL = 'report#/report_chart_wizard/'+$scope.urlParams.c_master; + + $scope.reportEditURL = 'report_wizard.htm?action=report.edit&c_master='+$scope.urlParams.c_master; + + + $http.get('raptor.htm?action=report.run.container&'+$scope.currentReportUrlParams).then( + function(response){ + console.log(response); + $scope.isInProgress = false; + $scope.reportData = response.data; + if(!$scope.urlParams.hideChart && $scope.reportData.chartAvailable && $scope.reportData.totalRows>1){ + console.log('raptor.htm?action=chart.run&'+convertQueryString($scope.urlParams)); + $http.get('raptor.htm?action=chart.run&'+convertQueryString($scope.urlParams)).then( + function(response){ + $scope.showChart = true; + document.getElementById('chartiframe').contentWindow.document.write(response.data); + document.getElementById('chartiframe').contentWindow.document.close(); + }); + } + + if($scope.reportData.displayForm && $scope.reportData.formFieldList && $scope.reportData.formFieldList.length>0 && !$scope.urlParams.hideFormFields){ + $scope.showFormFields = true; + } + }); + $scope.getFormFieldSelectedValuesAsURL = function(){ + var formFieldsUrl = ''; + $scope.reportData.formFieldList.forEach(function(formField) { + if(formField.fieldType==='LIST_BOX') { + if($scope.formFieldSelectedValues && $scope.formFieldSelectedValues[formField.fieldId] && $scope.formFieldSelectedValues[formField.fieldId].value != '') { + formFieldsUrl = formFieldsUrl+formField.fieldId+'='+$scope.formFieldSelectedValues[formField.fieldId].value+'&'; + } + } else if(formField.fieldType==='LIST_MULTI_SELECT') { + if($scope.formFieldSelectedValues[formField.fieldId].length >0) { + for (var i = 0; i < $scope.formFieldSelectedValues[formField.fieldId].length; i++) { + if($scope.formFieldSelectedValues[formField.fieldId][i].defaultValue){ + formFieldsUrl = formFieldsUrl+formField.fieldId+'='+$scope.formFieldSelectedValues[formField.fieldId][i].value+'&'; + } + } + } + } else if((formField.fieldType === 'text' || formField.fieldType === 'TEXT') && formField.validationType === 'DATE'){ + formFieldsUrl = formFieldsUrl+formField.fieldId+'='+dateFilter($scope.formFieldSelectedValues[formField.fieldId],$scope.dateformat)+'&'; + } else if((formField.fieldType === 'text' || formField.fieldType === 'TEXT') && formField.validationType === 'TIMESTAMP_MIN'){ + formFieldsUrl = formFieldsUrl+formField.fieldId+'='+dateFilter($scope.formFieldSelectedValues[formField.fieldId],$scope.datetimeformat)+'&'; + } else if((formField.fieldType === 'text' || formField.fieldType === 'TEXT') && $scope.formFieldSelectedValues[formField.fieldId] && $scope.formFieldSelectedValues[formField.fieldId] != ''){ + formFieldsUrl = formFieldsUrl+formField.fieldId+'='+$scope.formFieldSelectedValues[formField.fieldId]+'&'; + } + }); + return formFieldsUrl; + + } + + $scope.runReport = function(pagination){ + + var formFieldsUrl = $scope.getFormFieldSelectedValuesAsURL(); + console.log("pagination"); + if(!pagination) { + console.log("refreshed ..."); + $scope.gridOptions.pageNumber = 1; + $scope.gridOptions.paginationPageSizes= [$scope.reportData.pageSize]; + $scope.gridOptions.paginationPageSize= $scope.reportData.pageSize; + if($scope.reportData.totalRows<14){ + $scope.gridHeight = ($scope.reportData.totalRows+7)*30+'px'; + } else{ + $scope.gridHeight = '400px'; + } + $scope.gridOptions.totalItems = $scope.reportData.totalRows; + $scope.gridOptions.data= $scope.reportData.reportDataRows; + $scope.gridOptions.exporterPdfHeader.text= $scope.reportData.reportName; + + } + $scope.currentReportUrlParams = 'c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'&display_content=Y&r_page='+(paginationOptions.pageNumber-1); + console.log('raptor.htm?action=report.run.container&c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'refresh=Y&display_content=Y&r_page='+(paginationOptions.pageNumber-1)); + $http.get('raptor.htm?action=report.run.container&c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'refresh=Y&display_content=Y&r_page='+(paginationOptions.pageNumber-1)).then( + function(response){ + $scope.reportData = response.data; + if($scope.reportData.errormessage) { + document.getElementById('errorDiv').innerHTML = $scope.reportData.errormessage; + console.log(document.getElementById('errorDiv').innerHtml); + console.log($scope.reportData.errormessage); + } + if(!pagination) { + if(!$scope.urlParams.hideChart && $scope.reportData.chartAvailable && $scope.reportData.totalRows>1){ + console.log('raptor.htm?action=chart.run&c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'display_content=Y&r_page='+(paginationOptions.pageNumber-1)); + $http.get('raptor.htm?action=chart.run&c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'display_content=Y&r_page='+(paginationOptions.pageNumber-1)).then( + function(response) { + console.log(response.data); + $scope.showChart = true; + document.getElementById('chartiframe').contentWindow.document.write(response.data); + document.getElementById('chartiframe').contentWindow.document.close(); + }); + } else { + $scope.showChart = false; + } + } + if($scope.reportData.displayForm && $scope.reportData.formFieldList && $scope.reportData.formFieldList.length>0 && !$scope.urlParams.hideFormFields){ + $scope.showFormFields = true; + } else { + $scope.showFormFields = false; + } + }); + }; + + var paginationOptions = { + pageNumber: 1, + pageSize: 5, + sort: null + }; + + $scope.gridOptions = { + pageNumber: 1, + sort : null, + paginationPageSizes: [5], + paginationPageSize: 5, + useExternalPagination: true, + columnDefs: [], + data: [], + enableGridMenu: true, + enableSelectAll: true, + gridMenuCustomItems : [ + { title : 'All Reports', + action : function($event) { + $window.open('report.htm','_self'); + }, order : 210 }, + { title : 'Edit Report', + action : function($event) { + $window.open($scope.reportEditURL,'_self'); + }, order : 211 }, + { title : 'Export All data as Excel 2007', + action : function($event) { + $window.open('raptor.htm?c_master='+$scope.reportData.reportID+'&r_action=report.download.excel2007.session','_self'); + }, order : 212 }, + { title : 'Export All data as Excel', + action : function($event) { + $window.open('raptor.htm?c_master='+$scope.reportData.reportID+'&r_action=report.download.excel.session','_self'); + }, order : 213 }, + { title : 'Export All data as CSV', + action : function($event) { + $window.open('raptor.htm?c_master='+$scope.reportData.reportID+'&r_action=report.download.csv.session','_self'); + }, order : 214 }, + { title : 'Export All data as PDF', + action : function($event) { + $window.open('raptor.htm?c_master='+$scope.reportData.reportID+'&r_action=report.download.pdf.session','_self'); + }, order : 215 } ], + exporterMenuPdf: false, + exporterMenuCsv: false, + exporterCsvFilename: 'myFile.csv', + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi) { + $scope.gridApi = gridApi; + gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) { + paginationOptions.pageNumber = newPage; + paginationOptions.pageSize = pageSize; + $scope.runReport(true); + }); + } + }; + + $scope.uiGridRefresh = function(){ + var columnDefsArray = []; + var columnFreezeEndColumn = $scope.reportData.colIdxTobeFreezed; + var doColumnNeedToFreeze = false; + if(columnFreezeEndColumn && columnFreezeEndColumn.length>0) { + doColumnNeedToFreeze = true; + } + $scope.reportData.reportDataColumns.forEach(function(entry) { + var tempColumnDef = { displayName: entry.columnTitle, field: entry.colId, enableSorting: entry.sortable, + sortingAlgorithm: function(a, b) { + return rowSorter.sortAlpha(a.displayValue, b.displayValue); + }, + cellTemplate: '
        '+ + '
        {{COL_FIELD.displayValue}}
        ' + + ' {{COL_FIELD.displayValue}}' + + '
        '}; + if(entry.columnWidth && entry.columnWidth!='null' && entry.columnWidth!='pxpx' && entry.columnWidth!='nullpx' && entry.columnWidth!='nullpxpx'){ + tempColumnDef['minWidth'] = entry.columnWidth.substring(0, entry.columnWidth.length - 2); + } else { + tempColumnDef['minWidth'] = '100'; + } + if(doColumnNeedToFreeze) { + tempColumnDef['pinnedLeft']= true; + if(columnFreezeEndColumn === entry.colId){ + doColumnNeedToFreeze = false; + } + } + columnDefsArray.push(tempColumnDef); + }); + + $scope.gridOptions.paginationPageSizes= [$scope.reportData.pageSize]; + $scope.gridOptions.paginationPageSize= $scope.reportData.pageSize; + if($scope.reportData.totalRows<14){ + $scope.gridHeight = ($scope.reportData.totalRows+5)*30+'px'; + }else{ + $scope.gridHeight = '400px'; + } + $scope.gridOptions.totalItems = $scope.reportData.totalRows; + $scope.gridOptions.columnDefs= columnDefsArray; + $scope.gridOptions.data= $scope.reportData.reportDataRows; + $scope.gridOptions.exporterPdfHeader.text= $scope.reportData.reportName; + }; + + $scope.$watch("reportData",function(newValue,oldValue) { + if(!$scope.urlParams.hideGrid){ + if($scope.reportData){ + if($scope.reportData.displayData && $scope.reportData.reportDataColumns){ + $scope.showGrid = true; + $scope.uiGridRefresh(); + } + } + } + }); + + $scope.triggerOtherFormFields = function(){ + console.log("report_run"); + var formFieldsUrl = $scope.getFormFieldSelectedValuesAsURL(); + $http.get('raptor.htm?action=report.formfields.run.container&c_master='+$scope.reportData.reportID+'&'+formFieldsUrl).then( + function(response){ + $scope.reportData = response.data; + }); + }; + $timeout(function() { + $rootScope.isViewRendering = false; + }); +}]); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_search.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_search.html new file mode 100644 index 0000000..db00037 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_search.html @@ -0,0 +1,34 @@ + +

        Report search

        +
        +
        + +
        +
        +
        +
        + +
        + + +
        +
        +
        +
        + +
        + +
        +
        +
        diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_search.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_search.js new file mode 100644 index 0000000..d219422 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/ebz/report_search.js @@ -0,0 +1,136 @@ +app.controller("reportSearchController", ['$scope','$rootScope','$http','$timeout',function ($scope,$rootScope,$http,$timeout) { + + $http.get('raptor.htm?action=report.search.execute&r_page=0').then( + function(result){$scope.searchdData = result.data; + }); + + $scope.runReport = function(){ + var searchParams = ''; + if($scope.reportId && $scope.reportId!=''){ + searchParams = '&rep_id='+$scope.reportId+'&rep_id_options='+$scope.operatorRepId.index; + } + if($scope.reportName && $scope.reportName!=''){ + searchParams = searchParams+'&rep_name='+$scope.reportName+'&rep_name_options='+$scope.operatorRepName.index; + } + + console.log('raptor.htm?action=report.search.execute&r_page='+(paginationOptions.pageNumber-1)+searchParams); + $http.get('raptor.htm?action=report.search.execute&r_page='+(paginationOptions.pageNumber-1)+searchParams).then( + function(result){$scope.searchdData = result.data; + }); + //quantum/raptor.htm?action=report.search.execute&rep_id=1000&rep_id_options=2&rep_name=cross&rep_name_options=2 + }; + + + var paginationOptions = { + pageNumber: 1, + pageSize: 5, + sort: null + }; + + $scope.gridOptions = { + paginationPageSizes: [5], + paginationPageSize: 5, + useExternalPagination: true, + columnDefs: [], + data: [], + enableGridMenu: true, + enableSelectAll: true, + exporterMenuPdf: false, + exporterMenuCsv: false, + exporterCsvFilename: 'myFile.csv', + exporterPdfDefaultStyle: {fontSize: 9}, + exporterPdfTableStyle: {margin: [30, 30, 30, 30]}, + exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'}, + exporterPdfHeader: { text: "My Header", style: 'headerStyle' }, + exporterPdfFooter: function ( currentPage, pageCount ) { + return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' }; + }, + exporterPdfCustomFormatter: function ( docDefinition ) { + docDefinition.styles.headerStyle = { fontSize: 22, bold: true }; + docDefinition.styles.footerStyle = { fontSize: 10, bold: true }; + return docDefinition; + }, + exporterPdfOrientation: 'portrait', + exporterPdfPageSize: 'LETTER', + exporterPdfMaxGridWidth: 500, + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function(gridApi) { + $scope.gridApi = gridApi; + gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) { + paginationOptions.pageNumber = newPage; + paginationOptions.pageSize = pageSize; + $scope.runReport(); + }); + } + }; + + + var getPage = function() { + $scope.gridOptions.columnDefs = []; + $scope.searchdData.columns[0].forEach(function(entry) { + if(entry.columnTitle=='Run'){ + $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId+'==drillDownLink', enableSorting: false, + cellTemplate: '
        ' + }); + } else if(entry.columnTitle=='Edit'){ + $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId+'==drillDownLink', enableSorting: false, + cellTemplate: '
        ' + }); + } else if(entry.columnTitle=='Delete'){ + $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId+'==drillDownLink', enableSorting: false, + cellTemplate: '
        ' + }); + } else if(entry.columnTitle=='Copy'){ + $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId+'==drillDownLink', enableSorting: false, + cellTemplate: '
        ' + }); + } else if(entry.columnTitle=='Schedule'){ + //$scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId+'==drillDownLink', + // cellTemplate: '
        ' + //}); + } else if(entry.columnTitle=='No'){ + } else { + $scope.gridOptions.columnDefs.push({ displayName: entry.columnTitle, field: entry.columnId+'==displayValue'}); + } + }); + $scope.gridOptions.data = $scope.searchdData.rows[0]; + $scope.gridOptions.paginationPageSizes= [$scope.searchdData.metaReport.pageSize]; + $scope.gridOptions.paginationPageSize= $scope.searchdData.metaReport.pageSize; + $scope.gridOptions.totalItems = $scope.searchdData.metaReport.totalSize; + }; + + $scope.$watch("searchdData",function(newValue,oldValue) { + if($scope.searchdData){ + getPage(); + } + }); + + $scope.operatorsRepId = [{index: 0, value: 'Equal To', title: 'Equal To', alias:'Equal To'}, + {index: 1, value: 'Less Than', title: 'Less Than', alias:'Less Than'}, + {index: 2, value: 'Greater Than', title: 'Greater Than', alias:'Greater Than'}]; + $scope.operatorsRepName = [{index: 0, value: 'Starts With', title: 'Starts With', alias:'Starts With'}, + {index:1, value: 'Ends With', title: 'Ends With', alias:'Ends With'}, + {index: 2, value: 'Contains', title: 'Contains', alias:'Contains'}]; + + $scope.deleteReport = function(reportDeleteUrl,row) { + if (confirm("Please confirm: Are you sure you want to delete report #" + reportDeleteUrl.substr(41) + "?")) { + $http.get(reportDeleteUrl).then( + function(result){ + if(result.data=='deleted:true'){ + var index = $scope.gridOptions.data.indexOf(row.entity); + $scope.gridOptions.data.splice(index, 1); + alert("Report deleted."); + } else { + alert("Report not deleted."); + } + } + ); + } + }; + + $timeout(function() { + $rootScope.isViewRendering = false; + }); + + +}]); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/CalendarPopup.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/CalendarPopup.js new file mode 100644 index 0000000..07cd7ee --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/CalendarPopup.js @@ -0,0 +1,1486 @@ +// =================================================================== +// Author: Matt Kruse +// WWW: http://www.mattkruse.com/ +// +// NOTICE: You may use this code for any purpose, commercial or +// private, without any further permission from the author. You may +// remove this notice from your final code if you wish, however it is +// appreciated by the author if at least my web site address is kept. +// +// You may *NOT* re-distribute this code in any way except through its +// use. That means, you can include it in your product, or your web +// site, or any other form where the code is actually being used. You +// may not put the plain javascript up on your site for download or +// include it in your javascript libraries for download. +// If you wish to share this code with others, please just point them +// to the URL instead. +// Please DO NOT link directly to my .js files from your site. Copy +// the files to your server and use them there. Thank you. +// =================================================================== + + +/* SOURCE FILE: date.js */ + +// HISTORY +// ------------------------------------------------------------------ +// May 17, 2003: Fixed bug in parseDate() for dates <1970 +// March 11, 2003: Added parseDate() function +// March 11, 2003: Added "NNN" formatting option. Doesn't match up +// perfectly with SimpleDateFormat formats, but +// backwards-compatability was required. + +// ------------------------------------------------------------------ +// These functions use the same 'format' strings as the +// java.text.SimpleDateFormat class, with minor exceptions. +// The format string consists of the following abbreviations: +// +// Field | Full Form | Short Form +// -------------+--------------------+----------------------- +// Year | yyyy (4 digits) | yy (2 digits), y (2 or 4 digits) +// Month | MMM (name or abbr.)| MM (2 digits), M (1 or 2 digits) +// | NNN (abbr.) | +// Day of Month | dd (2 digits) | d (1 or 2 digits) +// Day of Week | EE (name) | E (abbr) +// Hour (1-12) | hh (2 digits) | h (1 or 2 digits) +// Hour (0-23) | HH (2 digits) | H (1 or 2 digits) +// Hour (0-11) | KK (2 digits) | K (1 or 2 digits) +// Hour (1-24) | kk (2 digits) | k (1 or 2 digits) +// Minute | mm (2 digits) | m (1 or 2 digits) +// Second | ss (2 digits) | s (1 or 2 digits) +// AM/PM | a | +// +// NOTE THE DIFFERENCE BETWEEN MM and mm! Month=MM, not mm! +// Examples: +// "MMM d, y" matches: January 01, 2000 +// Dec 1, 1900 +// Nov 20, 00 +// "M/d/yy" matches: 01/20/00 +// 9/2/00 +// "MMM dd, yyyy hh:mm:ssa" matches: "January 01, 2000 12:30:45AM" +// ------------------------------------------------------------------ + +var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); +var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat'); +function LZ(x) {return(x<0||x>9?"":"0")+x} + +// ------------------------------------------------------------------ +// isDate ( date_string, format_string ) +// Returns true if date string matches format of format string and +// is a valid date. Else returns false. +// It is recommended that you trim whitespace around the value before +// passing it to this function, as whitespace is NOT ignored! +// ------------------------------------------------------------------ +function isDate(val,format) { + var date=getDateFromFormat(val,format); + if (date==0) { return false; } + return true; + } + +// ------------------------------------------------------------------- +// compareDates(date1,date1format,date2,date2format) +// Compare two date strings to see which is greater. +// Returns: +// 1 if date1 is greater than date2 +// 0 if date2 is greater than date1 of if they are the same +// -1 if either of the dates is in an invalid format +// ------------------------------------------------------------------- +function compareDates(date1,dateformat1,date2,dateformat2) { + var d1=getDateFromFormat(date1,dateformat1); + var d2=getDateFromFormat(date2,dateformat2); + if (d1==0 || d2==0) { + return -1; + } + else if (d1 > d2) { + return 1; + } + return 0; + } + +// ------------------------------------------------------------------ +// formatDate (date_object, format) +// Returns a date in the output format specified. +// The format string uses the same abbreviations as in getDateFromFormat() +// ------------------------------------------------------------------ +function formatDate(date,format) { + format=format+""; + var result=""; + var i_format=0; + var c=""; + var token=""; + var y=date.getYear()+""; + var M=date.getMonth()+1; + var d=date.getDate(); + var E=date.getDay(); + var H=date.getHours(); + var m=date.getMinutes(); + var s=date.getSeconds(); + var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k; + // Convert real date parts into formatted versions + var value=new Object(); + if (y.length < 4) {y=""+(y-0+1900);} + value["y"]=""+y; + value["yyyy"]=y; + value["yy"]=y.substring(2,4); + value["M"]=M; + value["MM"]=LZ(M); + value["MMM"]=MONTH_NAMES[M-1]; + value["NNN"]=MONTH_NAMES[M+11]; + value["d"]=d; + value["dd"]=LZ(d); + value["E"]=DAY_NAMES[E+7]; + value["EE"]=DAY_NAMES[E]; + value["H"]=H; + value["HH"]=LZ(H); + if (H==0){value["h"]=12;} + else if (H>12){value["h"]=H-12;} + else {value["h"]=H;} + value["hh"]=LZ(value["h"]); + if (H>11){value["K"]=H-12;} else {value["K"]=H;} + value["k"]=H+1; + value["KK"]=LZ(value["K"]); + value["kk"]=LZ(value["k"]); + if (H > 11) { value["a"]="PM"; } + else { value["a"]="AM"; } + value["m"]=m; + value["mm"]=LZ(m); + value["s"]=s; + value["ss"]=LZ(s); + while (i_format < format.length) { + c=format.charAt(i_format); + token=""; + while ((format.charAt(i_format)==c) && (i_format < format.length)) { + token += format.charAt(i_format++); + } + if (value[token] != null) { result=result + value[token]; } + else { result=result + token; } + } + return result; + } + +// ------------------------------------------------------------------ +// Utility functions for parsing in getDateFromFormat() +// ------------------------------------------------------------------ +function _isInteger(val) { + var digits="1234567890"; + for (var i=0; i < val.length; i++) { + if (digits.indexOf(val.charAt(i))==-1) { return false; } + } + return true; + } +function _getInt(str,i,minlength,maxlength) { + for (var x=maxlength; x>=minlength; x--) { + var token=str.substring(i,i+x); + if (token.length < minlength) { return null; } + if (_isInteger(token)) { return token; } + } + return null; + } + +// ------------------------------------------------------------------ +// getDateFromFormat( date_string , format_string ) +// +// This function takes a date string and a format string. It matches +// If the date string matches the format string, it returns the +// getTime() of the date. If it does not match, it returns 0. +// ------------------------------------------------------------------ +function getDateFromFormat(val,format) { + val=val+""; + format=format+""; + var i_val=0; + var i_format=0; + var c=""; + var token=""; + var token2=""; + var x,y; + var now=new Date(); + + var year=now.getYear(); + var month=now.getMonth()+1; + var date=1; + var hh=now.getHours(); + var mm=now.getMinutes(); + var ss=now.getSeconds(); + var ampm=""; + + while (i_format < format.length) { + // Get next token from format string + c=format.charAt(i_format); + token=""; + while ((format.charAt(i_format)==c) && (i_format < format.length)) { + token += format.charAt(i_format++); + } + // Extract contents of value based on format token + if (token=="yyyy" || token=="yy" || token=="y") { + if (token=="yyyy") { x=4;y=4; } + if (token=="yy") { x=2;y=2; } + if (token=="y") { x=2;y=4; } + year=_getInt(val,i_val,x,y); + if (year==null) { return 0; } + i_val += year.length; + if (year.length==2) { + if (year > 70) { year=1900+(year-0); } + else { year=2000+(year-0); } + } + } + else if (token=="MMM"||token=="NNN"){ + month=0; + for (var i=0; i11)) { + month=i+1; + if (month>12) { month -= 12; } + i_val += month_name.length; + break; + } + } + } + if ((month < 1)||(month>12)){return 0;} + } + else if (token=="EE"||token=="E"){ + for (var i=0; i12)){return 0;} + i_val+=month.length;} + else if (token=="dd"||token=="d") { + date=_getInt(val,i_val,token.length,2); + if(date==null||(date<1)||(date>31)){return 0;} + i_val+=date.length;} + else if (token=="hh"||token=="h") { + hh=_getInt(val,i_val,token.length,2); + if(hh==null||(hh<1)||(hh>12)){return 0;} + i_val+=hh.length;} + else if (token=="HH"||token=="H") { + hh=_getInt(val,i_val,token.length,2); + if(hh==null||(hh<0)||(hh>23)){return 0;} + i_val+=hh.length;} + else if (token=="KK"||token=="K") { + hh=_getInt(val,i_val,token.length,2); + if(hh==null||(hh<0)||(hh>11)){return 0;} + i_val+=hh.length;} + else if (token=="kk"||token=="k") { + hh=_getInt(val,i_val,token.length,2); + if(hh==null||(hh<1)||(hh>24)){return 0;} + i_val+=hh.length;hh--;} + else if (token=="mm"||token=="m") { + mm=_getInt(val,i_val,token.length,2); + if(mm==null||(mm<0)||(mm>59)){return 0;} + i_val+=mm.length;} + else if (token=="ss"||token=="s") { + ss=_getInt(val,i_val,token.length,2); + if(ss==null||(ss<0)||(ss>59)){return 0;} + i_val+=ss.length;} + else if (token=="a") { + if (val.substring(i_val,i_val+2).toLowerCase()=="am") {ampm="AM";} + else if (val.substring(i_val,i_val+2).toLowerCase()=="pm") {ampm="PM";} + else {return 0;} + i_val+=2;} + else { + if (val.substring(i_val,i_val+token.length)!=token) {return 0;} + else {i_val+=token.length;} + } + } + // If there are any trailing characters left in the value, it doesn't match + if (i_val != val.length) { return 0; } + // Is date valid for month? + if (month==2) { + // Check for leap year + if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year + if (date > 29){ return 0; } + } + else { if (date > 28) { return 0; } } + } + if ((month==4)||(month==6)||(month==9)||(month==11)) { + if (date > 30) { return 0; } + } + // Correct hours value + if (hh<12 && ampm=="PM") { hh=hh-0+12; } + else if (hh>11 && ampm=="AM") { hh-=12; } + var newdate=new Date(year,month-1,date,hh,mm,ss); + return newdate.getTime(); + } + +// ------------------------------------------------------------------ +// parseDate( date_string [, prefer_euro_format] ) +// +// This function takes a date string and tries to match it to a +// number of possible date formats to get the value. It will try to +// match against the following international formats, in this order: +// y-M-d MMM d, y MMM d,y y-MMM-d d-MMM-y MMM d +// M/d/y M-d-y M.d.y MMM-d M/d M-d +// d/M/y d-M-y d.M.y d-MMM d/M d-M +// A second argument may be passed to instruct the method to search +// for formats like d/M/y (european format) before M/d/y (American). +// Returns a Date object or null if no patterns match. +// ------------------------------------------------------------------ +function parseDate(val) { + var preferEuro=(arguments.length==2)?arguments[1]:false; + generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d'); + monthFirst=new Array('M/d/y','M-d-y','M.d.y','MMM-d','M/d','M-d'); + dateFirst =new Array('d/M/y','d-M-y','d.M.y','d-MMM','d/M','d-M'); + var checkList=new Array('generalFormats',preferEuro?'dateFirst':'monthFirst',preferEuro?'monthFirst':'dateFirst'); + var d=null; + for (var i=0; i tags may cause errors. + +USAGE: +// Create an object for a WINDOW popup +var win = new PopupWindow(); + +// Create an object for a DIV window using the DIV named 'mydiv' +var win = new PopupWindow('mydiv'); + +// Set the window to automatically hide itself when the user clicks +// anywhere else on the page except the popup +win.autoHide(); + +// Show the window relative to the anchor name passed in +win.showPopup(anchorname); + +// Hide the popup +win.hidePopup(); + +// Set the size of the popup window (only applies to WINDOW popups +win.setSize(width,height); + +// Populate the contents of the popup window that will be shown. If you +// change the contents while it is displayed, you will need to refresh() +win.populate(string); + +// set the URL of the window, rather than populating its contents +// manually +win.setUrl("http://www.site.com/"); + +// Refresh the contents of the popup +win.refresh(); + +// Specify how many pixels to the right of the anchor the popup will appear +win.offsetX = 50; + +// Specify how many pixels below the anchor the popup will appear +win.offsetY = 100; + +NOTES: +1) Requires the functions in AnchorPosition.js + +2) Your anchor tag MUST contain both NAME and ID attributes which are the + same. For example: + + +3) There must be at least a space between for IE5.5 to see the + anchor tag correctly. Do not do with no space. + +4) When a PopupWindow object is created, a handler for 'onmouseup' is + attached to any event handler you may have already defined. Do NOT define + an event handler for 'onmouseup' after you define a PopupWindow object or + the autoHide() will not work correctly. +*/ +function getPos(e) +{ + var posx = 0; + var posy = 0; + var coordinates = new Object(); + if (!e) var e = window.event; + if (e.pageX || e.pageY) + { + posx = e.pageX; + posy = e.pageY; + } + else if (e.clientX || e.clientY) + { + + posx = e.clientX + document.body.scrollLeft + + document.documentElement.scrollLeft; + posy = e.clientY + document.body.scrollTop + + document.documentElement.scrollTop; + } + + //alert("posx: " + posx + " posy: " + posy); + coordinates.x = posx; + coordinates.y = posy; + return coordinates; +} +// Set the position of the popup window based on the anchor +function PopupWindow_getXYPosition(anchorname) { + var coordintes + if (this.type == "WINDOW") { + coordinates = getAnchorWindowPosition(anchorname); + coordinates = getPos(anchorname); // Replaced using getPost(event) + } + else { + //alert("envent: " + anchorname); + //coordinates = getAnchorPosition(anchorname); + coordinates = getPos(anchorname); // Replaced using getPost(event) + } + + this.x = coordinates.x; + this.y = coordinates.y; + //alert("PopupWindow_getXYPosition x: " + this.x + " y: " + this.y); + } +// Set width/height of DIV/popup window +function PopupWindow_setSize(width,height) { + this.width = width; + this.height = height; + } +// Fill the window with contents +function PopupWindow_populate(contents) { + this.contents = contents; + this.populated = false; + } +// Set the URL to go to +function PopupWindow_setUrl(url) { + this.url = url; + } +// Set the window popup properties +function PopupWindow_setWindowProperties(props) { + this.windowProperties = props; + } +// Refresh the displayed contents of the popup +function PopupWindow_refresh() { + if (this.divName != null) { + // refresh the DIV object + if (this.use_gebi) { + document.getElementById(this.divName).innerHTML = this.contents; + } + else if (this.use_css) { + document.all[this.divName].innerHTML = this.contents; + } + else if (this.use_layers) { + var d = document.layers[this.divName]; + d.document.open(); + d.document.writeln(this.contents); + d.document.close(); + } + } + else { + if (this.popupWindow != null && !this.popupWindow.closed) { + if (this.url!="") { + this.popupWindow.location.href=this.url; + } + else { + this.popupWindow.document.open(); + this.popupWindow.document.writeln(this.contents); + this.popupWindow.document.close(); + } + this.popupWindow.focus(); + } + } + } + +var offsetLeft = 0; +var offsetTop = 0; +function parenName(ref) + { + ok=0; // it's just to start the loop, we don't use it to get out. + while (!ok) + { + ref = ref.parentNode; + if (ref.nodeType==1) //check that the node is a tag, not text (type=3) + { + if (String(ref.nodeName)=="DIV") + { + offsetLeft = ref.offsetLeft; + offsetTop = ref.offsetTop; + + return ; + } + if (String(ref.nodeName)=="BODY") + { + return ; + } + } + } + } + +// Position and show the popup, relative to an anchor object +function PopupWindow_showPopup(anchorname) { + this.getXYPosition(anchorname); + this.x += this.offsetX - 125; + this.y += this.offsetY; + if (!this.populated && (this.contents != "")) { + this.populated = true; + this.refresh(); + } + if (this.divName != null) { + // Show the DIV object + var oDiv = document.getElementById(this.divName); + parenName(oDiv); + if (this.use_gebi) { + document.getElementById(this.divName).style.left = this.x - offsetLeft + "px"; + document.getElementById(this.divName).style.top = this.y - offsetTop + "px"; + document.getElementById(this.divName).style.visibility = "visible"; + } + else if (this.use_css) { + document.all[this.divName].style.left = this.x; + document.all[this.divName].style.top = this.y; + document.all[this.divName].style.visibility = "visible"; + } + else if (this.use_layers) { + document.layers[this.divName].left = this.x; + document.layers[this.divName].top = this.y; + document.layers[this.divName].visibility = "visible"; + } + } + else { + if (this.popupWindow == null || this.popupWindow.closed) { + // If the popup window will go off-screen, move it so it doesn't + if (this.x<0) { this.x=0; } + if (this.y<0) { this.y=0; } + if (screen && screen.availHeight) { + if ((this.y + this.height) > screen.availHeight) { + this.y = screen.availHeight - this.height; + } + } + if (screen && screen.availWidth) { + if ((this.x + this.width) > screen.availWidth) { + this.x = screen.availWidth - this.width; + } + } + var avoidAboutBlank = window.opera || ( document.layers && !navigator.mimeTypes['*'] ) || navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled ); + this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+""); + } + this.refresh(); + } + + //added for IE6 issue + /////////////////////// + showFrame(this.divName, this.frameName); + /*var oIfr = document.getElementById(this.frameName); + var oCal = document.getElementById(this.divName); + oIfr.style.display='block'; + oIfr.style.top=oCal.style.top; + oIfr.style.left=oCal.style.left;*/ + + + } +// Hide the popup +function PopupWindow_hidePopup() { + if (this.divName != null) { + if (this.use_gebi) { + + document.getElementById(this.divName).style.visibility = "hidden"; + } + else if (this.use_css) { + document.all[this.divName].style.visibility = "hidden"; + } + else if (this.use_layers) { + document.layers[this.divName].visibility = "hidden"; + } + } + else { + if (this.popupWindow && !this.popupWindow.closed) { + this.popupWindow.close(); + this.popupWindow = null; + } + } + + + //added for IE6 issue + ////////////// + hideFrame(this.divName, this.frameName); + /*var oIfr = document.getElementById(this.frameName); + oIfr.style.display='none'; */ + } +// Pass an event and return whether or not it was the popup DIV that was clicked +function PopupWindow_isClicked(e) { + if (this.divName != null) { + if (this.use_layers) { + var clickX = e.pageX; + var clickY = e.pageY; + var t = document.layers[this.divName]; + if ((clickX > t.left) && (clickX < t.left+t.clip.width) && (clickY > t.top) && (clickY < t.top+t.clip.height)) { + window.calendarAction='Y'; + return true; + } + else { return false; } + } + else if (document.all) { // Need to hard-code this to trap IE for error-handling + var t = window.event.srcElement; + while (t.parentElement != null) { + if (t.id==this.divName) { + window.calendarAction='Y'; + return true; + } + t = t.parentElement; + } + return false; + } + else if (this.use_gebi && e) { + var t = e.originalTarget; + //console.log(t); + while (t && t.parentNode != null) { + if (t.id==this.divName) { + window.calendarAction='Y'; + return true; + } + t = t.parentNode; + } + return false; + } + return false; + } + return false; + } + +// Check an onMouseDown event to see if we should hide +function PopupWindow_hideIfNotClicked(e) { + if (this.autoHideEnabled && !this.isClicked(e)) { + + this.hidePopup(); + } + } +// Call this to make the DIV disable automatically when mouse is clicked outside it +function PopupWindow_autoHide() { + this.autoHideEnabled = true; + } +// This global function checks all PopupWindow objects onmouseup to see if they should be hidden +function PopupWindow_hidePopupWindows(e) { + for (var i=0; i0) { + this.type="DIV"; + this.divName = arguments[0]; + //added for IE6 issue + + if (arguments.length>1) + this.frameName = arguments[1]; + } + else { + this.type="WINDOW"; + } + this.use_gebi = false; + this.use_css = false; + this.use_layers = false; + if (document.getElementById) { this.use_gebi = true; } + else if (document.all) { this.use_css = true; } + else if (document.layers) { this.use_layers = true; } + else { this.type = "WINDOW"; } + this.offsetX = 0; + this.offsetY = 0; + // Method mappings + this.getXYPosition = PopupWindow_getXYPosition; + this.populate = PopupWindow_populate; + this.setUrl = PopupWindow_setUrl; + this.setWindowProperties = PopupWindow_setWindowProperties; + this.refresh = PopupWindow_refresh; + this.showPopup = PopupWindow_showPopup; + this.hidePopup = PopupWindow_hidePopup; + this.setSize = PopupWindow_setSize; + this.isClicked = PopupWindow_isClicked; + this.autoHide = PopupWindow_autoHide; + this.hideIfNotClicked = PopupWindow_hideIfNotClicked; + + // Added to reset the Calendar DIV when it related with another DIV + this.resetPosition = PopupWindow_resetPosition; + } + +/* SOURCE FILE: CalendarPopup.js */ + +// HISTORY +// ------------------------------------------------------------------ +// Feb 7, 2005: Fixed a CSS styles to use px unit +// March 29, 2004: Added check in select() method for the form field +// being disabled. If it is, just return and don't do anything. +// March 24, 2004: Fixed bug - when month name and abbreviations were +// changed, date format still used original values. +// January 26, 2004: Added support for drop-down month and year +// navigation (Thanks to Chris Reid for the idea) +// September 22, 2003: Fixed a minor problem in YEAR calendar with +// CSS prefix. +// August 19, 2003: Renamed the function to get styles, and made it +// work correctly without an object reference +// August 18, 2003: Changed showYearNavigation and +// showYearNavigationInput to optionally take an argument of +// true or false +// July 31, 2003: Added text input option for year navigation. +// Added a per-calendar CSS prefix option to optionally use +// different styles for different calendars. +// July 29, 2003: Fixed bug causing the Today link to be clickable +// even though today falls in a disabled date range. +// Changed formatting to use pure CSS, allowing greater control +// over look-and-feel options. +// June 11, 2003: Fixed bug causing the Today link to be unselectable +// under certain cases when some days of week are disabled +// March 14, 2003: Added ability to disable individual dates or date +// ranges, display as light gray and strike-through +// March 14, 2003: Removed dependency on graypixel.gif and instead +/// use table border coloring +// March 12, 2003: Modified showCalendar() function to allow optional +// start-date parameter +// March 11, 2003: Modified select() function to allow optional +// start-date parameter +/* +DESCRIPTION: This object implements a popup calendar to allow the user to +select a date, month, quarter, or year. + +COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small +positioning errors - usually with Window positioning - occur on the +Macintosh platform. +The calendar can be modified to work for any location in the world by +changing which weekday is displayed as the first column, changing the month +names, and changing the column headers for each day. + +USAGE: +// Create a new CalendarPopup object of type WINDOW +var cal = new CalendarPopup(); + +// Create a new CalendarPopup object of type DIV using the DIV named 'mydiv' +var cal = new CalendarPopup('mydiv'); + +// Easy method to link the popup calendar with an input box. +cal.select(inputObject, anchorname, dateFormat); +// Same method, but passing a default date other than the field's current value +cal.select(inputObject, anchorname, dateFormat, '01/02/2000'); +// This is an example call to the popup calendar from a link to populate an +// input box. Note that to use this, date.js must also be included!! +Select + +// Set the type of date select to be used. By default it is 'date'. +cal.setDisplayType(type); + +// When a date, month, quarter, or year is clicked, a function is called and +// passed the details. You must write this function, and tell the calendar +// popup what the function name is. +// Function to be called for 'date' select receives y, m, d +cal.setReturnFunction(functionname); +// Function to be called for 'month' select receives y, m +cal.setReturnMonthFunction(functionname); +// Function to be called for 'quarter' select receives y, q +cal.setReturnQuarterFunction(functionname); +// Function to be called for 'year' select receives y +cal.setReturnYearFunction(functionname); + +// Show the calendar relative to a given anchor +cal.showCalendar(anchorname); + +// Hide the calendar. The calendar is set to autoHide automatically +cal.hideCalendar(); + +// Set the month names to be used. Default are English month names +cal.setMonthNames("January","February","March",...); + +// Set the month abbreviations to be used. Default are English month abbreviations +cal.setMonthAbbreviations("Jan","Feb","Mar",...); + +// Show navigation for changing by the year, not just one month at a time +cal.showYearNavigation(); + +// Show month and year dropdowns, for quicker selection of month of dates +cal.showNavigationDropdowns(); + +// Set the text to be used above each day column. The days start with +// sunday regardless of the value of WeekStartDay +cal.setDayHeaders("S","M","T",...); + +// Set the day for the first column in the calendar grid. By default this +// is Sunday (0) but it may be changed to fit the conventions of other +// countries. +cal.setWeekStartDay(1); // week is Monday - Sunday + +// Set the weekdays which should be disabled in the 'date' select popup. You can +// then allow someone to only select week end dates, or Tuedays, for example +cal.setDisabledWeekDays(0,1); // To disable selecting the 1st or 2nd days of the week + +// Selectively disable individual days or date ranges. Disabled days will not +// be clickable, and show as strike-through text on current browsers. +// Date format is any format recognized by parseDate() in date.js +// Pass a single date to disable: +cal.addDisabledDates("2003-01-01"); +// Pass null as the first parameter to mean "anything up to and including" the +// passed date: +cal.addDisabledDates(null, "01/02/03"); +// Pass null as the second parameter to mean "including the passed date and +// anything after it: +cal.addDisabledDates("Jan 01, 2003", null); +// Pass two dates to disable all dates inbetween and including the two +cal.addDisabledDates("January 01, 2003", "Dec 31, 2003"); + +// When the 'year' select is displayed, set the number of years back from the +// current year to start listing years. Default is 2. +// This is also used for year drop-down, to decide how many years +/- to display +cal.setYearSelectStartOffset(2); + +// Text for the word "Today" appearing on the calendar +cal.setTodayText("Today"); + +// The calendar uses CSS classes for formatting. If you want your calendar to +// have unique styles, you can set the prefix that will be added to all the +// classes in the output. +// For example, normal output may have this: +// Today +// But if you set the prefix like this: +cal.setCssPrefix("Test"); +// The output will then look like: +// Today +// And you can define that style somewhere in your page. + +// When using Year navigation, you can make the year be an input box, so +// the user can manually change it and jump to any year +cal.showYearNavigationInput(); + +// Set the calendar offset to be different than the default. By default it +// will appear just below and to the right of the anchorname. So if you have +// a text box where the date will go and and anchor immediately after the +// text box, the calendar will display immediately under the text box. +cal.offsetX = 20; +cal.offsetY = 20; + +NOTES: +1) Requires the functions in AnchorPosition.js and PopupWindow.js + +2) Your anchor tag MUST contain both NAME and ID attributes which are the + same. For example: + + +3) There must be at least a space between for IE5.5 to see the + anchor tag correctly. Do not do with no space. + +4) When a CalendarPopup object is created, a handler for 'onmouseup' is + attached to any event handler you may have already defined. Do NOT define + an event handler for 'onmouseup' after you define a CalendarPopup object + or the autoHide() will not work correctly. + +5) The calendar popup display uses style sheets to make it look nice. + +*/ + +// CONSTRUCTOR for the CalendarPopup Object +function CalendarPopup() { + var c; + //added for IE6 issue + if (arguments.length>1) { + c = new PopupWindow(arguments[0], arguments[1]); + } + else if (arguments.length>0) { + c = new PopupWindow(arguments[0]); + } + else { + c = new PopupWindow(); + c.setSize(150,175); + } + c.offsetX = 20; + c.offsetY = 0; + c.autoHide(); + // Calendar-specific properties + c.monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December"); + c.monthAbbreviations = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); + c.dayHeaders = new Array("S","M","T","W","T","F","S"); + c.returnFunction = "CP_tmpReturnFunction"; + c.returnMonthFunction = "CP_tmpReturnMonthFunction"; + c.returnQuarterFunction = "CP_tmpReturnQuarterFunction"; + c.returnYearFunction = "CP_tmpReturnYearFunction"; + c.weekStartDay = 0; + c.isShowYearNavigation = false; + c.displayType = "date"; + c.disabledWeekDays = new Object(); + c.disabledDatesExpression = ""; + c.yearSelectStartOffset = 2; + c.currentDate = null; + c.todayText="Today"; + c.cssPrefix=""; + c.isShowNavigationDropdowns=false; + c.isShowYearNavigationInput=false; + window.CP_calendarObject = null; + window.CP_targetInput = null; + window.CP_dateFormat = "MM/dd/yyyy"; + // Method mappings + c.copyMonthNamesToWindow = CP_copyMonthNamesToWindow; + c.setReturnFunction = CP_setReturnFunction; + c.setReturnMonthFunction = CP_setReturnMonthFunction; + c.setReturnQuarterFunction = CP_setReturnQuarterFunction; + c.setReturnYearFunction = CP_setReturnYearFunction; + c.setMonthNames = CP_setMonthNames; + c.setMonthAbbreviations = CP_setMonthAbbreviations; + c.setDayHeaders = CP_setDayHeaders; + c.setWeekStartDay = CP_setWeekStartDay; + c.setDisplayType = CP_setDisplayType; + c.setDisabledWeekDays = CP_setDisabledWeekDays; + c.addDisabledDates = CP_addDisabledDates; + c.setYearSelectStartOffset = CP_setYearSelectStartOffset; + c.setTodayText = CP_setTodayText; + c.showYearNavigation = CP_showYearNavigation; + c.showCalendar = CP_showCalendar; + c.hideCalendar = CP_hideCalendar; + c.getStyles = getCalendarStyles; + c.refreshCalendar = CP_refreshCalendar; + c.getCalendar = CP_getCalendar; + c.select = CP_select; + c.setCssPrefix = CP_setCssPrefix; + c.showNavigationDropdowns = CP_showNavigationDropdowns; + c.showYearNavigationInput = CP_showYearNavigationInput; + c.copyMonthNamesToWindow(); + // Return the object + return c; + } +function CP_copyMonthNamesToWindow() { + // Copy these values over to the date.js + if (typeof(window.MONTH_NAMES)!="undefined" && window.MONTH_NAMES!=null) { + window.MONTH_NAMES = new Array(); + for (var i=0; i\n"; + result += '
        \n'; + } + else { + result += '
        \n'; + result += '
        \n'; + result += '
        \n'; + } + // Code for DATE display (default) + // ------------------------------- + if (this.displayType=="date" || this.displayType=="week-end") { + if (this.currentDate==null) { this.currentDate = now; } + if (arguments.length > 0) { var month = arguments[0]; } + else { var month = this.currentDate.getMonth()+1; } + if (arguments.length > 1 && arguments[1]>0 && arguments[1]-0==arguments[1]) { var year = arguments[1]; } + else { var year = this.currentDate.getFullYear(); } + var daysinmonth= new Array(0,31,28,31,30,31,30,31,31,30,31,30,31); + if ( ( (year%4 == 0)&&(year%100 != 0) ) || (year%400 == 0) ) { + daysinmonth[2] = 29; + } + var current_month = new Date(year,month-1,1); + var display_year = year; + var display_month = month; + var display_date = 1; + var weekday= current_month.getDay(); + var offset = 0; + + offset = (weekday >= this.weekStartDay) ? weekday-this.weekStartDay : 7-this.weekStartDay+weekday ; + if (offset > 0) { + display_month--; + if (display_month < 1) { display_month = 12; display_year--; } + display_date = daysinmonth[display_month]-offset+1; + } + var next_month = month+1; + var next_month_year = year; + if (next_month > 12) { next_month=1; next_month_year++; } + var last_month = month-1; + var last_month_year = year; + if (last_month < 1) { last_month=12; last_month_year--; } + var date_class; + if (this.type!="WINDOW") { + result += ""; + } + result += '\n'; + var refresh = windowref+'CP_refreshCalendar'; + var refreshLink = 'javascript:' + refresh; + if (this.isShowNavigationDropdowns) { + result += ''; + result += ''; + + result += ''; + } + else { + if (this.isShowYearNavigation) { + result += ''; + result += ''; + result += ''; + result += ''; + + result += ''; + if (this.isShowYearNavigationInput) { + result += ''; + } + else { + result += ''; + } + result += ''; + } + else { + result += '\n'; + result += '\n'; + result += '\n'; + } + } + result += '
         <'+this.monthNames[month-1]+'> <'+year+'><<'+this.monthNames[month-1]+' '+year+'>>
        \n'; + result += '\n'; + result += '\n'; + for (var j=0; j<7; j++) { + + result += '\n'; + } + result += '\n'; + for (var row=1; row<=6; row++) { + result += '\n'; + for (var col=1; col<=7; col++) { + var disabled=false; + if (this.disabledDatesExpression!="") { + var ds=""+display_year+LZ(display_month)+LZ(display_date); + eval("disabled=("+this.disabledDatesExpression+")"); + } + var dateClass = ""; + if ((display_month == this.currentDate.getMonth()+1) && (display_date==this.currentDate.getDate()) && (display_year==this.currentDate.getFullYear())) { + dateClass = "cpCurrentDate"; + } + else if (display_month == month) { + dateClass = "cpCurrentMonthDate"; + } + else { + dateClass = "cpOtherMonthDate"; + } + if (disabled || this.disabledWeekDays[col-1]) { + result += ' \n'; + } + else { + var selected_date = display_date; + var selected_month = display_month; + var selected_year = display_year; + if (this.displayType=="week-end") { + var d = new Date(selected_year,selected_month-1,selected_date,0,0,0,0); + d.setDate(d.getDate() + (7-col)); + selected_year = d.getYear(); + if (selected_year < 1000) { selected_year += 1900; } + selected_month = d.getMonth()+1; + selected_date = d.getDate(); + } + result += ' \n'; + } + display_date++; + if (display_date > daysinmonth[display_month]) { + display_date=1; + display_month++; + } + if (display_month > 12) { + display_month=1; + display_year++; + } + } + result += ''; + } + var current_weekday = now.getDay() - this.weekStartDay; + if (current_weekday < 0) { + current_weekday += 7; + } + result += '\n'; + result += '
        '+this.dayHeaders[(this.weekStartDay+j)%7]+'
        '+display_date+''+display_date+'
        \n'; + if (this.disabledDatesExpression!="") { + var ds=""+now.getFullYear()+LZ(now.getMonth()+1)+LZ(now.getDate()); + eval("disabled=("+this.disabledDatesExpression+")"); + } + if (disabled || this.disabledWeekDays[current_weekday+1]) { + result += ' '+this.todayText+'\n'; + } + else { + result += ' '+this.todayText+'\n'; + } + result += '
        \n'; + result += '
        \n'; + } + + // Code common for MONTH, QUARTER, YEAR + // ------------------------------------ + if (this.displayType=="month" || this.displayType=="quarter" || this.displayType=="year") { + if (arguments.length > 0) { var year = arguments[0]; } + else { + if (this.displayType=="year") { var year = now.getFullYear()-this.yearSelectStartOffset; } + else { var year = now.getFullYear(); } + } + if (this.displayType!="year" && this.isShowYearNavigation) { + result += ""; + result += '\n'; + result += ' \n'; + result += ' \n'; + result += ' \n'; + result += '
        <<'+year+'>>
        \n'; + } + } + + // Code for MONTH display + // ---------------------- + if (this.displayType=="month") { + // If POPUP, write entire HTML document + result += '\n'; + for (var i=0; i<4; i++) { + result += ''; + for (var j=0; j<3; j++) { + var monthindex = ((i*3)+j); + result += ''; + } + result += ''; + } + result += '
        '+this.monthAbbreviations[monthindex]+'
        \n'; + } + + // Code for QUARTER display + // ------------------------ + if (this.displayType=="quarter") { + result += '
        \n'; + for (var i=0; i<2; i++) { + result += ''; + for (var j=0; j<2; j++) { + var quarter = ((i*2)+j+1); + result += ''; + } + result += ''; + } + result += '

        Q'+quarter+'

        \n'; + } + + // Code for YEAR display + // --------------------- + if (this.displayType=="year") { + var yearColumnSize = 4; + result += ""; + result += '\n'; + result += ' \n'; + result += ' \n'; + result += '
        <<>>
        \n'; + result += '\n'; + for (var i=0; i'+currentyear+''; + } + result += ''; + } + result += '
        \n'; + } + // Common + if (this.type == "WINDOW") { + result += "\n"; + } + return result; + } + +//added for IE6 issue + +function showFrame(divName, frameName){ + + // added to show Iframe behind calender + var oIfr = document.getElementById(frameName); + var oCal = document.getElementById(divName); + if (oIfr != null){ + oIfr.style.display='block'; + oIfr.style.top=oCal.style.top; + oIfr.style.left=oCal.style.left; + } + +} +function hideFrame(divName, frameName){ + var oIfr = document.getElementById(frameName); + if (oIfr != null){ + oIfr.style.display='none'; + } +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/ajax.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/ajax.js new file mode 100644 index 0000000..c24c268 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/ajax.js @@ -0,0 +1,214 @@ +/* Simple AJAX Code-Kit (SACK) v1.6.1 */ +/* ©2005 Gregory Wild-Smith */ +/* www.twilightuniverse.com */ +/* Software licenced under a modified X11 licence, + see documentation or authors website for more details */ + +function sack(file) { + this.xmlhttp = null; + + this.resetData = function() { + this.method = "POST"; + this.queryStringSeparator = "?"; + this.argumentSeparator = "&"; + this.URLString = ""; + this.encodeURIString = true; + this.execute = false; + this.element = null; + this.elementObj = null; + this.requestFile = file; + this.vars = new Object(); + this.responseStatus = new Array(2); + }; + + this.resetFunctions = function() { + this.onLoading = function() { }; + this.onLoaded = function() { }; + this.onInteractive = function() { }; + this.onCompletion = function() { }; + this.onError = function() { }; + this.onFail = function() { }; + }; + + this.reset = function() { + this.resetFunctions(); + this.resetData(); + }; + + this.createAJAX = function() { + try { + this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e1) { + try { + this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (e2) { + this.xmlhttp = null; + } + } + + if (! this.xmlhttp) { + if (typeof XMLHttpRequest != "undefined") { + this.xmlhttp = new XMLHttpRequest(); + } else { + this.failed = true; + } + } + }; + + /*Modified by Sundar: to accept POST request*/ + this.setVar = function(name, value, index){ + if(index) + this.vars[name+'~'+index] = Array(value, false); + else + this.vars[name+'~'+0] = Array(value, false); + }; + + this.encVar = function(name, value, returnvars) { + if (true == returnvars) { + return Array(encodeURIComponent(name), encodeURIComponent(value)); + } else { + this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true); + } + } + + this.processURLString = function(string, encode) { + encoded = encodeURIComponent(this.argumentSeparator); + regexp = new RegExp(this.argumentSeparator + "|" + encoded); + varArray = string.split(regexp); + for (i = 0; i < varArray.length; i++){ + urlVars = varArray[i].split("="); + if (true == encode){ + this.encVar(urlVars[0], urlVars[1]); + } else { + this.setVar(urlVars[0], urlVars[1]); + } + } + } + + this.createURLString = function(urlstring) { + if (this.encodeURIString && this.URLString.length) { + this.processURLString(this.URLString, true); + } + + if (urlstring) { + if (this.URLString.length) { + this.URLString += this.argumentSeparator + urlstring; + } else { + this.URLString = urlstring; + } + } + + // prevents caching of URLString + this.setVar("rndval", new Date().getTime()); + + urlstringtemp = new Array(); + /*Modified by Sundar: to accept POST request*/ + var key1 = ""; + for (key in this.vars) { + if (false == this.vars[key][1] && true == this.encodeURIString) { + encoded = this.encVar(key, this.vars[key][0], true); + delete this.vars[key]; + this.vars[encoded[0]] = Array(encoded[1], true); + key = encoded[0]; + } + key1 = key.substr(0,key.indexOf('~')); + //alert("Key " + key1); + urlstringtemp[urlstringtemp.length] = key1 + "=" + this.vars[key][0]; + } + if (urlstring){ + this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator); + } else { + this.URLString += urlstringtemp.join(this.argumentSeparator); + } + //alert("URLString " + this.URLString); + + } + + this.runResponse = function() { + eval(this.response); + } + + + this.runAJAX = function(urlstring,noWaitForResponse,timeOut) { + + if(noWaitForResponse == null){ + noWaitForResponse = true; + } + + if (this.failed) { + this.onFail(); + } else { + this.createURLString(urlstring); + if (this.element) { + this.elementObj = document.getElementById(this.element); + } + if (this.xmlhttp) { + var self = this; + //SUNDAR: Added timeout for synchronous AJAX + if(!noWaitForResponse && timeOut != null && !isNaN(timeOut)){ + window.setTimeout("dummyFunction()",timeOut); + } + if (this.method == "GET") { + totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString; + this.xmlhttp.open(this.method, totalurlstring, noWaitForResponse); + } else { + + this.xmlhttp.open(this.method, this.requestFile, noWaitForResponse); + try { + this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") + } catch (e) { } + } + + this.xmlhttp.onreadystatechange = function() { + //alert("AJAX READY " + self.xmlhttp.readyState); + switch (self.xmlhttp.readyState) { + case 1: + self.onLoading(); + break; + case 2: + self.onLoaded(); + break; + case 3: + self.onInteractive(); + break; + case 4: + self.response = self.xmlhttp.responseText; + self.responseXML = self.xmlhttp.responseXML; + self.responseStatus[0] = self.xmlhttp.status; + self.responseStatus[1] = self.xmlhttp.statusText; + + if (self.execute) { + self.runResponse(); + } + + if (self.elementObj) { + elemNodeName = self.elementObj.nodeName; + elemNodeName.toLowerCase(); + if (elemNodeName == "input" + || elemNodeName == "select" + || elemNodeName == "option" + || elemNodeName == "textarea") { + self.elementObj.value = self.response; + } else { + self.elementObj.innerHTML = self.response; + } + } + if (self.responseStatus[0] == "200") { + self.onCompletion(); + } else { + self.onError(); + } + + self.URLString = ""; + break; + } + }; + + this.xmlhttp.send(this.URLString); + } + } + }; + + this.reset(); + this.createAJAX(); +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/ajax_dynamic_content.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/ajax_dynamic_content.js new file mode 100644 index 0000000..077932e --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/ajax_dynamic_content.js @@ -0,0 +1,97 @@ + +/*********************************************** +* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com) +* This notice MUST stay intact for legal use +* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code +***********************************************/ + +var loadedobjects="" +var rootdomain="http://"+window.location.hostname + +function ajaxpage(url, containerid){ + +var page_request = false; + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); + } catch (e) { + //alert("Permission UniversalBrowserRead denied."); + } +if (window.XMLHttpRequest) // if Mozilla, Safari etc +page_request = new XMLHttpRequest() +else if (window.ActiveXObject){ // if IE +try { +page_request = new ActiveXObject("Msxml2.XMLHTTP") +} +catch (e1){ +try{ +page_request = new ActiveXObject("Microsoft.XMLHTTP") +} +catch (e1){ page_request = null; alert('permission denied'); +} +} +} +else +return false +page_request.onreadystatechange=function(){ +loadpage(page_request, containerid) +} +// This is a fix made since IE doesn't refresh the page +var ajaxRightNow = new Date(); +var noCacheAjaxurl = url + ((/\?/.test(url)) ? "&" : "?") + "ajaxRandomTimestamp=" + ajaxRightNow.getTime(); +page_request.open('GET', noCacheAjaxurl, true) +page_request.send(null) +} + +function loadpage(page_request, containerid){ +var div = document.getElementById(containerid); +if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) + div.innerHTML=page_request.responseText; + var x = div.getElementsByTagName("script"); + for(var i=0;i=0) + eval(x[i].text); + } +} + +function resizeDivScrollbar(){ + var frame = document.getElementById("scrollableTableResult"); + var parentBody = window.parent.document.body; + var parentMenu = window.parent.document.getElementById("application"); + if(frame!=null) { + //alert(frame.clientHeight + " " + window.parent.document.body.clientHeight); + if (frame.clientHeight > window.parent.document.body.clientHeight) { + frame.style.height = window.parent.document.body.clientHeight-350; + } else + frame.style.height = window.parent.document.body.clientHeight; + parentMenu.style.width = frame.clientWidth+200; + } +} + + +function loadobjs(){ +if (!document.getElementById) +return +for (i=0; i35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(H(){J w=1b.4M,3m$=1b.$;J D=1b.4M=1b.$=H(a,b){I 2B D.17.5j(a,b)};J u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/,62=/^.[^:#\\[\\.]*$/,12;D.17=D.44={5j:H(d,b){d=d||S;G(d.16){7[0]=d;7.K=1;I 7}G(1j d=="23"){J c=u.2D(d);G(c&&(c[1]||!b)){G(c[1])d=D.4h([c[1]],b);N{J a=S.61(c[3]);G(a){G(a.2v!=c[3])I D().2q(d);I D(a)}d=[]}}N I D(b).2q(d)}N G(D.1D(d))I D(S)[D.17.27?"27":"43"](d);I 7.6Y(D.2d(d))},5w:"1.2.6",8G:H(){I 7.K},K:0,3p:H(a){I a==12?D.2d(7):7[a]},2I:H(b){J a=D(b);a.5n=7;I a},6Y:H(a){7.K=0;2p.44.1p.1w(7,a);I 7},P:H(a,b){I D.P(7,a,b)},5i:H(b){J a=-1;I D.2L(b&&b.5w?b[0]:b,7)},1K:H(c,a,b){J d=c;G(c.1q==56)G(a===12)I 7[0]&&D[b||"1K"](7[0],c);N{d={};d[c]=a}I 7.P(H(i){R(c 1n d)D.1K(b?7.V:7,c,D.1i(7,d[c],b,i,c))})},1g:H(b,a){G((b==\'2h\'||b==\'1Z\')&&3d(a)<0)a=12;I 7.1K(b,a,"2a")},1r:H(b){G(1j b!="49"&&b!=U)I 7.4E().3v((7[0]&&7[0].2z||S).5F(b));J a="";D.P(b||7,H(){D.P(7.3t,H(){G(7.16!=8)a+=7.16!=1?7.76:D.17.1r([7])})});I a},5z:H(b){G(7[0])D(b,7[0].2z).5y().39(7[0]).2l(H(){J a=7;1B(a.1x)a=a.1x;I a}).3v(7);I 7},8Y:H(a){I 7.P(H(){D(7).6Q().5z(a)})},8R:H(a){I 7.P(H(){D(7).5z(a)})},3v:H(){I 7.3W(19,M,Q,H(a){G(7.16==1)7.3U(a)})},6F:H(){I 7.3W(19,M,M,H(a){G(7.16==1)7.39(a,7.1x)})},6E:H(){I 7.3W(19,Q,Q,H(a){7.1d.39(a,7)})},5q:H(){I 7.3W(19,Q,M,H(a){7.1d.39(a,7.2H)})},3l:H(){I 7.5n||D([])},2q:H(b){J c=D.2l(7,H(a){I D.2q(b,a)});I 7.2I(/[^+>] [^+>]/.11(b)||b.1h("..")>-1?D.4r(c):c)},5y:H(e){J f=7.2l(H(){G(D.14.1f&&!D.4n(7)){J a=7.6o(M),5h=S.3h("1v");5h.3U(a);I D.4h([5h.4H])[0]}N I 7.6o(M)});J d=f.2q("*").5c().P(H(){G(7[E]!=12)7[E]=U});G(e===M)7.2q("*").5c().P(H(i){G(7.16==3)I;J c=D.L(7,"3w");R(J a 1n c)R(J b 1n c[a])D.W.1e(d[i],a,c[a][b],c[a][b].L)});I f},1E:H(b){I 7.2I(D.1D(b)&&D.3C(7,H(a,i){I b.1k(a,i)})||D.3g(b,7))},4Y:H(b){G(b.1q==56)G(62.11(b))I 7.2I(D.3g(b,7,M));N b=D.3g(b,7);J a=b.K&&b[b.K-1]!==12&&!b.16;I 7.1E(H(){I a?D.2L(7,b)<0:7!=b})},1e:H(a){I 7.2I(D.4r(D.2R(7.3p(),1j a==\'23\'?D(a):D.2d(a))))},3F:H(a){I!!a&&D.3g(a,7).K>0},7T:H(a){I 7.3F("."+a)},6e:H(b){G(b==12){G(7.K){J c=7[0];G(D.Y(c,"2A")){J e=c.64,63=[],15=c.15,2V=c.O=="2A-2V";G(e<0)I U;R(J i=2V?e:0,2f=2V?e+1:15.K;i<2f;i++){J d=15[i];G(d.2W){b=D.14.1f&&!d.at.2x.an?d.1r:d.2x;G(2V)I b;63.1p(b)}}I 63}N I(7[0].2x||"").1o(/\\r/g,"")}I 12}G(b.1q==4L)b+=\'\';I 7.P(H(){G(7.16!=1)I;G(b.1q==2p&&/5O|5L/.11(7.O))7.4J=(D.2L(7.2x,b)>=0||D.2L(7.34,b)>=0);N G(D.Y(7,"2A")){J a=D.2d(b);D("9R",7).P(H(){7.2W=(D.2L(7.2x,a)>=0||D.2L(7.1r,a)>=0)});G(!a.K)7.64=-1}N 7.2x=b})},2K:H(a){I a==12?(7[0]?7[0].4H:U):7.4E().3v(a)},7b:H(a){I 7.5q(a).21()},79:H(i){I 7.3s(i,i+1)},3s:H(){I 7.2I(2p.44.3s.1w(7,19))},2l:H(b){I 7.2I(D.2l(7,H(a,i){I b.1k(a,i,a)}))},5c:H(){I 7.1e(7.5n)},L:H(d,b){J a=d.1R(".");a[1]=a[1]?"."+a[1]:"";G(b===12){J c=7.5C("9z"+a[1]+"!",[a[0]]);G(c===12&&7.K)c=D.L(7[0],d);I c===12&&a[1]?7.L(a[0]):c}N I 7.1P("9u"+a[1]+"!",[a[0],b]).P(H(){D.L(7,d,b)})},3b:H(a){I 7.P(H(){D.3b(7,a)})},3W:H(g,f,h,d){J e=7.K>1,3x;I 7.P(H(){G(!3x){3x=D.4h(g,7.2z);G(h)3x.9o()}J b=7;G(f&&D.Y(7,"1T")&&D.Y(3x[0],"4F"))b=7.3H("22")[0]||7.3U(7.2z.3h("22"));J c=D([]);D.P(3x,H(){J a=e?D(7).5y(M)[0]:7;G(D.Y(a,"1m"))c=c.1e(a);N{G(a.16==1)c=c.1e(D("1m",a).21());d.1k(b,a)}});c.P(6T)})}};D.17.5j.44=D.17;H 6T(i,a){G(a.4d)D.3Y({1a:a.4d,31:Q,1O:"1m"});N D.5u(a.1r||a.6O||a.4H||"");G(a.1d)a.1d.37(a)}H 1z(){I+2B 8J}D.1l=D.17.1l=H(){J b=19[0]||{},i=1,K=19.K,4x=Q,15;G(b.1q==8I){4x=b;b=19[1]||{};i=2}G(1j b!="49"&&1j b!="H")b={};G(K==i){b=7;--i}R(;i-1}},6q:H(b,c,a){J e={};R(J d 1n c){e[d]=b.V[d];b.V[d]=c[d]}a.1k(b);R(J d 1n c)b.V[d]=e[d]},1g:H(d,e,c){G(e=="2h"||e=="1Z"){J b,3X={30:"5x",5g:"1G",18:"3I"},35=e=="2h"?["5e","6k"]:["5G","6i"];H 5b(){b=e=="2h"?d.8f:d.8c;J a=0,2C=0;D.P(35,H(){a+=3d(D.2a(d,"57"+7,M))||0;2C+=3d(D.2a(d,"2C"+7+"4b",M))||0});b-=29.83(a+2C)}G(D(d).3F(":4j"))5b();N D.6q(d,3X,5b);I 29.2f(0,b)}I D.2a(d,e,c)},2a:H(f,l,k){J e,V=f.V;H 3E(b){G(!D.14.2k)I Q;J a=3P.54(b,U);I!a||a.52("3E")==""}G(l=="1y"&&D.14.1f){e=D.1K(V,"1y");I e==""?"1":e}G(D.14.2G&&l=="18"){J d=V.50;V.50="0 7Y 7W";V.50=d}G(l.1I(/4i/i))l=y;G(!k&&V&&V[l])e=V[l];N G(3P.54){G(l.1I(/4i/i))l="4i";l=l.1o(/([A-Z])/g,"-$1").3y();J c=3P.54(f,U);G(c&&!3E(f))e=c.52(l);N{J g=[],2E=[],a=f,i=0;R(;a&&3E(a);a=a.1d)2E.6h(a);R(;i<2E.K;i++)G(3E(2E[i])){g[i]=2E[i].V.18;2E[i].V.18="3I"}e=l=="18"&&g[2E.K-1]!=U?"2F":(c&&c.52(l))||"";R(i=0;i]*?)\\/>/g,H(b,a,c){I c.1I(/^(aK|4f|7E|aG|4T|7A|aB|3n|az|ay|av)$/i)?b:a+">"});J f=D.3k(d).3y(),1v=h.3h("1v");J e=!f.1h("",""]||!f.1h("",""]||f.1I(/^<(aq|22|am|ak|ai)/)&&[1,"<1T>",""]||!f.1h("<4F")&&[2,"<1T><22>",""]||(!f.1h("<22><4F>",""]||!f.1h("<7E")&&[2,"<1T><22><7q>",""]||D.14.1f&&[1,"1v<1v>",""]||[0,"",""];1v.4H=e[1]+d+e[2];1B(e[0]--)1v=1v.5T;G(D.14.1f){J g=!f.1h("<1T")&&f.1h("<22")<0?1v.1x&&1v.1x.3t:e[1]=="<1T>"&&f.1h("<22")<0?1v.3t:[];R(J j=g.K-1;j>=0;--j)G(D.Y(g[j],"22")&&!g[j].3t.K)g[j].1d.37(g[j]);G(/^\\s/.11(d))1v.39(h.5F(d.1I(/^\\s*/)[0]),1v.1x)}d=D.2d(1v.3t)}G(d.K===0&&(!D.Y(d,"3V")&&!D.Y(d,"2A")))I;G(d[0]==12||D.Y(d,"3V")||d.15)k.1p(d);N k=D.2R(k,d)});I k},1K:H(d,f,c){G(!d||d.16==3||d.16==8)I 12;J e=!D.4n(d),40=c!==12,1f=D.14.1f;f=e&&D.3X[f]||f;G(d.2j){J g=/5Q|4d|V/.11(f);G(f=="2W"&&D.14.2k)d.1d.64;G(f 1n d&&e&&!g){G(40){G(f=="O"&&D.Y(d,"4T")&&d.1d)7p"O a3 a1\'t 9V 9U";d[f]=c}G(D.Y(d,"3V")&&d.7i(f))I d.7i(f).76;I d[f]}G(1f&&e&&f=="V")I D.1K(d.V,"9T",c);G(40)d.9Q(f,""+c);J h=1f&&e&&g?d.4G(f,2):d.4G(f);I h===U?12:h}G(1f&&f=="1y"){G(40){d.6B=1;d.1E=(d.1E||"").1o(/7f\\([^)]*\\)/,"")+(3r(c)+\'\'=="9L"?"":"7f(1y="+c*7a+")")}I d.1E&&d.1E.1h("1y=")>=0?(3d(d.1E.1I(/1y=([^)]*)/)[1])/7a)+\'\':""}f=f.1o(/-([a-z])/9H,H(a,b){I b.2r()});G(40)d[f]=c;I d[f]},3k:H(a){I(a||"").1o(/^\\s+|\\s+$/g,"")},2d:H(b){J a=[];G(b!=U){J i=b.K;G(i==U||b.1R||b.4I||b.1k)a[0]=b;N 1B(i)a[--i]=b[i]}I a},2L:H(b,a){R(J i=0,K=a.K;i*",7).21();1B(7.1x)7.37(7.1x)}},H(a,b){D.17[a]=H(){I 7.P(b,19)}});D.P(["6N","4b"],H(i,c){J b=c.3y();D.17[b]=H(a){I 7[0]==1b?D.14.2G&&S.1c["5t"+c]||D.14.2k&&1b["5s"+c]||S.70=="6Z"&&S.1C["5t"+c]||S.1c["5t"+c]:7[0]==S?29.2f(29.2f(S.1c["4y"+c],S.1C["4y"+c]),29.2f(S.1c["2i"+c],S.1C["2i"+c])):a==12?(7.K?D.1g(7[0],b):U):7.1g(b,a.1q==56?a:a+"2X")}});H 25(a,b){I a[0]&&3r(D.2a(a[0],b,M),10)||0}J C=D.14.2k&&3r(D.14.5B)<8H?"(?:[\\\\w*3m-]|\\\\\\\\.)":"(?:[\\\\w\\8F-\\8E*3m-]|\\\\\\\\.)",6L=2B 4v("^>\\\\s*("+C+"+)"),6J=2B 4v("^("+C+"+)(#)("+C+"+)"),6I=2B 4v("^([#.]?)("+C+"*)");D.1l({6H:{"":H(a,i,m){I m[2]=="*"||D.Y(a,m[2])},"#":H(a,i,m){I a.4G("2v")==m[2]},":":{8D:H(a,i,m){I im[3]-0},3a:H(a,i,m){I m[3]-0==i},79:H(a,i,m){I m[3]-0==i},3o:H(a,i){I i==0},3S:H(a,i,m,r){I i==r.K-1},6D:H(a,i){I i%2==0},6C:H(a,i){I i%2},"3o-4u":H(a){I a.1d.3H("*")[0]==a},"3S-4u":H(a){I D.3a(a.1d.5T,1,"4l")==a},"8z-4u":H(a){I!D.3a(a.1d.5T,2,"4l")},6W:H(a){I a.1x},4E:H(a){I!a.1x},8y:H(a,i,m){I(a.6O||a.8x||D(a).1r()||"").1h(m[3])>=0},4j:H(a){I"1G"!=a.O&&D.1g(a,"18")!="2F"&&D.1g(a,"5g")!="1G"},1G:H(a){I"1G"==a.O||D.1g(a,"18")=="2F"||D.1g(a,"5g")=="1G"},8w:H(a){I!a.3R},3R:H(a){I a.3R},4J:H(a){I a.4J},2W:H(a){I a.2W||D.1K(a,"2W")},1r:H(a){I"1r"==a.O},5O:H(a){I"5O"==a.O},5L:H(a){I"5L"==a.O},5p:H(a){I"5p"==a.O},3Q:H(a){I"3Q"==a.O},5o:H(a){I"5o"==a.O},6A:H(a){I"6A"==a.O},6z:H(a){I"6z"==a.O},2s:H(a){I"2s"==a.O||D.Y(a,"2s")},4T:H(a){I/4T|2A|6y|2s/i.11(a.Y)},3T:H(a,i,m){I D.2q(m[3],a).K},8t:H(a){I/h\\d/i.11(a.Y)},8s:H(a){I D.3C(D.3O,H(b){I a==b.T}).K}}},6x:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,2B 4v("^([:.#]*)("+C+"+)")],3g:H(a,c,b){J d,1t=[];1B(a&&a!=d){d=a;J f=D.1E(a,c,b);a=f.t.1o(/^\\s*,\\s*/,"");1t=b?c=f.r:D.2R(1t,f.r)}I 1t},2q:H(t,o){G(1j t!="23")I[t];G(o&&o.16!=1&&o.16!=9)I[];o=o||S;J d=[o],2o=[],3S,Y;1B(t&&3S!=t){J r=[];3S=t;t=D.3k(t);J l=Q,3j=6L,m=3j.2D(t);G(m){Y=m[1].2r();R(J i=0;d[i];i++)R(J c=d[i].1x;c;c=c.2H)G(c.16==1&&(Y=="*"||c.Y.2r()==Y))r.1p(c);d=r;t=t.1o(3j,"");G(t.1h(" ")==0)6M;l=M}N{3j=/^([>+~])\\s*(\\w*)/i;G((m=3j.2D(t))!=U){r=[];J k={};Y=m[2].2r();m=m[1];R(J j=0,3i=d.K;j<3i;j++){J n=m=="~"||m=="+"?d[j].2H:d[j].1x;R(;n;n=n.2H)G(n.16==1){J g=D.L(n);G(m=="~"&&k[g])1X;G(!Y||n.Y.2r()==Y){G(m=="~")k[g]=M;r.1p(n)}G(m=="+")1X}}d=r;t=D.3k(t.1o(3j,""));l=M}}G(t&&!l){G(!t.1h(",")){G(o==d[0])d.4s();2o=D.2R(2o,d);r=d=[o];t=" "+t.6v(1,t.K)}N{J h=6J;J m=h.2D(t);G(m){m=[0,m[2],m[3],m[1]]}N{h=6I;m=h.2D(t)}m[2]=m[2].1o(/\\\\/g,"");J f=d[d.K-1];G(m[1]=="#"&&f&&f.61&&!D.4n(f)){J p=f.61(m[2]);G((D.14.1f||D.14.2G)&&p&&1j p.2v=="23"&&p.2v!=m[2])p=D(\'[@2v="\'+m[2]+\'"]\',f)[0];d=r=p&&(!m[3]||D.Y(p,m[3]))?[p]:[]}N{R(J i=0;d[i];i++){J a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];G(a=="*"&&d[i].Y.3y()=="49")a="3n";r=D.2R(r,d[i].3H(a))}G(m[1]==".")r=D.5m(r,m[2]);G(m[1]=="#"){J e=[];R(J i=0;r[i];i++)G(r[i].4G("2v")==m[2]){e=[r[i]];1X}r=e}d=r}t=t.1o(h,"")}}G(t){J b=D.1E(t,r);d=r=b.r;t=D.3k(b.t)}}G(t)d=[];G(d&&o==d[0])d.4s();2o=D.2R(2o,d);I 2o},5m:H(r,m,a){m=" "+m+" ";J c=[];R(J i=0;r[i];i++){J b=(" "+r[i].1F+" ").1h(m)>=0;G(!a&&b||a&&!b)c.1p(r[i])}I c},1E:H(t,r,h){J d;1B(t&&t!=d){d=t;J p=D.6x,m;R(J i=0;p[i];i++){m=p[i].2D(t);G(m){t=t.8r(m[0].K);m[2]=m[2].1o(/\\\\/g,"");1X}}G(!m)1X;G(m[1]==":"&&m[2]=="4Y")r=62.11(m[3])?D.1E(m[3],r,M).r:D(r).4Y(m[3]);N G(m[1]==".")r=D.5m(r,m[2],h);N G(m[1]=="["){J g=[],O=m[3];R(J i=0,3i=r.K;i<3i;i++){J a=r[i],z=a[D.3X[m[2]]||m[2]];G(z==U||/5Q|4d|2W/.11(m[2]))z=D.1K(a,m[2])||\'\';G((O==""&&!!z||O=="="&&z==m[5]||O=="!="&&z!=m[5]||O=="^="&&z&&!z.1h(m[5])||O=="$="&&z.6v(z.K-m[5].K)==m[5]||(O=="*="||O=="~=")&&z.1h(m[5])>=0)^h)g.1p(a)}r=g}N G(m[1]==":"&&m[2]=="3a-4u"){J e={},g=[],11=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.2D(m[3]=="6D"&&"2n"||m[3]=="6C"&&"2n+1"||!/\\D/.11(m[3])&&"8q+"+m[3]||m[3]),3o=(11[1]+(11[2]||1))-0,d=11[3]-0;R(J i=0,3i=r.K;i<3i;i++){J j=r[i],1d=j.1d,2v=D.L(1d);G(!e[2v]){J c=1;R(J n=1d.1x;n;n=n.2H)G(n.16==1)n.4q=c++;e[2v]=M}J b=Q;G(3o==0){G(j.4q==d)b=M}N G((j.4q-d)%3o==0&&(j.4q-d)/3o>=0)b=M;G(b^h)g.1p(j)}r=g}N{J f=D.6H[m[1]];G(1j f=="49")f=f[m[2]];G(1j f=="23")f=6u("Q||H(a,i){I "+f+";}");r=D.3C(r,H(a,i){I f(a,i,m,r)},h)}}I{r:r,t:t}},4S:H(b,c){J a=[],1t=b[c];1B(1t&&1t!=S){G(1t.16==1)a.1p(1t);1t=1t[c]}I a},3a:H(a,e,c,b){e=e||1;J d=0;R(;a;a=a[c])G(a.16==1&&++d==e)1X;I a},5v:H(n,a){J r=[];R(;n;n=n.2H){G(n.16==1&&n!=a)r.1p(n)}I r}});D.W={1e:H(f,i,g,e){G(f.16==3||f.16==8)I;G(D.14.1f&&f.4I)f=1b;G(!g.24)g.24=7.24++;G(e!=12){J h=g;g=7.3M(h,H(){I h.1w(7,19)});g.L=e}J j=D.L(f,"3w")||D.L(f,"3w",{}),1H=D.L(f,"1H")||D.L(f,"1H",H(){G(1j D!="12"&&!D.W.5k)I D.W.1H.1w(19.3L.T,19)});1H.T=f;D.P(i.1R(/\\s+/),H(c,b){J a=b.1R(".");b=a[0];g.O=a[1];J d=j[b];G(!d){d=j[b]={};G(!D.W.2t[b]||D.W.2t[b].4p.1k(f)===Q){G(f.3K)f.3K(b,1H,Q);N G(f.6t)f.6t("4o"+b,1H)}}d[g.24]=g;D.W.26[b]=M});f=U},24:1,26:{},21:H(e,h,f){G(e.16==3||e.16==8)I;J i=D.L(e,"3w"),1L,5i;G(i){G(h==12||(1j h=="23"&&h.8p(0)=="."))R(J g 1n i)7.21(e,g+(h||""));N{G(h.O){f=h.2y;h=h.O}D.P(h.1R(/\\s+/),H(b,a){J c=a.1R(".");a=c[0];G(i[a]){G(f)2U i[a][f.24];N R(f 1n i[a])G(!c[1]||i[a][f].O==c[1])2U i[a][f];R(1L 1n i[a])1X;G(!1L){G(!D.W.2t[a]||D.W.2t[a].4A.1k(e)===Q){G(e.6p)e.6p(a,D.L(e,"1H"),Q);N G(e.6n)e.6n("4o"+a,D.L(e,"1H"))}1L=U;2U i[a]}}})}R(1L 1n i)1X;G(!1L){J d=D.L(e,"1H");G(d)d.T=U;D.3b(e,"3w");D.3b(e,"1H")}}},1P:H(h,c,f,g,i){c=D.2d(c);G(h.1h("!")>=0){h=h.3s(0,-1);J a=M}G(!f){G(7.26[h])D("*").1e([1b,S]).1P(h,c)}N{G(f.16==3||f.16==8)I 12;J b,1L,17=D.1D(f[h]||U),W=!c[0]||!c[0].32;G(W){c.6h({O:h,2J:f,32:H(){},3J:H(){},4C:1z()});c[0][E]=M}c[0].O=h;G(a)c[0].6m=M;J d=D.L(f,"1H");G(d)b=d.1w(f,c);G((!17||(D.Y(f,\'a\')&&h=="4V"))&&f["4o"+h]&&f["4o"+h].1w(f,c)===Q)b=Q;G(W)c.4s();G(i&&D.1D(i)){1L=i.1w(f,b==U?c:c.7d(b));G(1L!==12)b=1L}G(17&&g!==Q&&b!==Q&&!(D.Y(f,\'a\')&&h=="4V")){7.5k=M;1U{f[h]()}1V(e){}}7.5k=Q}I b},1H:H(b){J a,1L,38,5f,4m;b=19[0]=D.W.6l(b||1b.W);38=b.O.1R(".");b.O=38[0];38=38[1];5f=!38&&!b.6m;4m=(D.L(7,"3w")||{})[b.O];R(J j 1n 4m){J c=4m[j];G(5f||c.O==38){b.2y=c;b.L=c.L;1L=c.1w(7,19);G(a!==Q)a=1L;G(1L===Q){b.32();b.3J()}}}I a},6l:H(b){G(b[E]==M)I b;J d=b;b={8o:d};J c="8n 8m 8l 8k 2s 8j 47 5d 6j 5E 8i L 8h 8g 4K 2y 5a 59 8e 8b 58 6f 8a 88 4k 87 86 84 6d 2J 4C 6c O 82 81 35".1R(" ");R(J i=c.K;i;i--)b[c[i]]=d[c[i]];b[E]=M;b.32=H(){G(d.32)d.32();d.80=Q};b.3J=H(){G(d.3J)d.3J();d.7Z=M};b.4C=b.4C||1z();G(!b.2J)b.2J=b.6d||S;G(b.2J.16==3)b.2J=b.2J.1d;G(!b.4k&&b.4K)b.4k=b.4K==b.2J?b.6c:b.4K;G(b.58==U&&b.5d!=U){J a=S.1C,1c=S.1c;b.58=b.5d+(a&&a.2e||1c&&1c.2e||0)-(a.6b||0);b.6f=b.6j+(a&&a.2c||1c&&1c.2c||0)-(a.6a||0)}G(!b.35&&((b.47||b.47===0)?b.47:b.5a))b.35=b.47||b.5a;G(!b.59&&b.5E)b.59=b.5E;G(!b.35&&b.2s)b.35=(b.2s&1?1:(b.2s&2?3:(b.2s&4?2:0)));I b},3M:H(a,b){b.24=a.24=a.24||b.24||7.24++;I b},2t:{27:{4p:H(){55();I},4A:H(){I}},3D:{4p:H(){G(D.14.1f)I Q;D(7).2O("53",D.W.2t.3D.2y);I M},4A:H(){G(D.14.1f)I Q;D(7).4e("53",D.W.2t.3D.2y);I M},2y:H(a){G(F(a,7))I M;a.O="3D";I D.W.1H.1w(7,19)}},3N:{4p:H(){G(D.14.1f)I Q;D(7).2O("51",D.W.2t.3N.2y);I M},4A:H(){G(D.14.1f)I Q;D(7).4e("51",D.W.2t.3N.2y);I M},2y:H(a){G(F(a,7))I M;a.O="3N";I D.W.1H.1w(7,19)}}}};D.17.1l({2O:H(c,a,b){I c=="4X"?7.2V(c,a,b):7.P(H(){D.W.1e(7,c,b||a,b&&a)})},2V:H(d,b,c){J e=D.W.3M(c||b,H(a){D(7).4e(a,e);I(c||b).1w(7,19)});I 7.P(H(){D.W.1e(7,d,e,c&&b)})},4e:H(a,b){I 7.P(H(){D.W.21(7,a,b)})},1P:H(c,a,b){I 7.P(H(){D.W.1P(c,a,7,M,b)})},5C:H(c,a,b){I 7[0]&&D.W.1P(c,a,7[0],Q,b)},2m:H(b){J c=19,i=1;1B(i=0){J i=g.3s(e,g.K);g=g.3s(0,e)}c=c||H(){};J f="2P";G(d)G(D.1D(d)){c=d;d=U}N{d=D.3n(d);f="6g"}J h=7;D.3Y({1a:g,O:f,1O:"2K",L:d,1J:H(a,b){G(b=="1W"||b=="7J")h.2K(i?D("<1v/>").3v(a.4U.1o(/<1m(.|\\s)*?\\/1m>/g,"")).2q(i):a.4U);h.P(c,[a.4U,b,a])}});I 7},aL:H(){I D.3n(7.7I())},7I:H(){I 7.2l(H(){I D.Y(7,"3V")?D.2d(7.aH):7}).1E(H(){I 7.34&&!7.3R&&(7.4J||/2A|6y/i.11(7.Y)||/1r|1G|3Q/i.11(7.O))}).2l(H(i,c){J b=D(7).6e();I b==U?U:b.1q==2p?D.2l(b,H(a,i){I{34:c.34,2x:a}}):{34:c.34,2x:b}}).3p()}});D.P("7H,7G,7F,7D,7C,7B".1R(","),H(i,o){D.17[o]=H(f){I 7.2O(o,f)}});J B=1z();D.1l({3p:H(d,b,a,c){G(D.1D(b)){a=b;b=U}I D.3Y({O:"2P",1a:d,L:b,1W:a,1O:c})},aE:H(b,a){I D.3p(b,U,a,"1m")},aD:H(c,b,a){I D.3p(c,b,a,"3z")},aC:H(d,b,a,c){G(D.1D(b)){a=b;b={}}I D.3Y({O:"6g",1a:d,L:b,1W:a,1O:c})},aA:H(a){D.1l(D.60,a)},60:{1a:5Z.5Q,26:M,O:"2P",2T:0,7z:"4R/x-ax-3V-aw",7x:M,31:M,L:U,5Y:U,3Q:U,4Q:{2N:"4R/2N, 1r/2N",2K:"1r/2K",1m:"1r/4t, 4R/4t",3z:"4R/3z, 1r/4t",1r:"1r/as",4w:"*/*"}},4z:{},3Y:H(s){s=D.1l(M,s,D.1l(M,{},D.60,s));J g,2Z=/=\\?(&|$)/g,1u,L,O=s.O.2r();G(s.L&&s.7x&&1j s.L!="23")s.L=D.3n(s.L);G(s.1O=="4P"){G(O=="2P"){G(!s.1a.1I(2Z))s.1a+=(s.1a.1I(/\\?/)?"&":"?")+(s.4P||"7u")+"=?"}N G(!s.L||!s.L.1I(2Z))s.L=(s.L?s.L+"&":"")+(s.4P||"7u")+"=?";s.1O="3z"}G(s.1O=="3z"&&(s.L&&s.L.1I(2Z)||s.1a.1I(2Z))){g="4P"+B++;G(s.L)s.L=(s.L+"").1o(2Z,"="+g+"$1");s.1a=s.1a.1o(2Z,"="+g+"$1");s.1O="1m";1b[g]=H(a){L=a;1W();1J();1b[g]=12;1U{2U 1b[g]}1V(e){}G(i)i.37(h)}}G(s.1O=="1m"&&s.1Y==U)s.1Y=Q;G(s.1Y===Q&&O=="2P"){J j=1z();J k=s.1a.1o(/(\\?|&)3m=.*?(&|$)/,"$ap="+j+"$2");s.1a=k+((k==s.1a)?(s.1a.1I(/\\?/)?"&":"?")+"3m="+j:"")}G(s.L&&O=="2P"){s.1a+=(s.1a.1I(/\\?/)?"&":"?")+s.L;s.L=U}G(s.26&&!D.4O++)D.W.1P("7H");J n=/^(?:\\w+:)?\\/\\/([^\\/?#]+)/;G(s.1O=="1m"&&O=="2P"&&n.11(s.1a)&&n.2D(s.1a)[1]!=5Z.al){J i=S.3H("6w")[0];J h=S.3h("1m");h.4d=s.1a;G(s.7t)h.aj=s.7t;G(!g){J l=Q;h.ah=h.ag=H(){G(!l&&(!7.3f||7.3f=="68"||7.3f=="1J")){l=M;1W();1J();i.37(h)}}}i.3U(h);I 12}J m=Q;J c=1b.7s?2B 7s("ae.ac"):2B 7r();G(s.5Y)c.6R(O,s.1a,s.31,s.5Y,s.3Q);N c.6R(O,s.1a,s.31);1U{G(s.L)c.4B("ab-aa",s.7z);G(s.5S)c.4B("a9-5R-a8",D.4z[s.1a]||"a7, a6 a5 a4 5N:5N:5N a2");c.4B("X-9Z-9Y","7r");c.4B("9W",s.1O&&s.4Q[s.1O]?s.4Q[s.1O]+", */*":s.4Q.4w)}1V(e){}G(s.7m&&s.7m(c,s)===Q){s.26&&D.4O--;c.7l();I Q}G(s.26)D.W.1P("7B",[c,s]);J d=H(a){G(!m&&c&&(c.3f==4||a=="2T")){m=M;G(f){7k(f);f=U}1u=a=="2T"&&"2T"||!D.7j(c)&&"3e"||s.5S&&D.7h(c,s.1a)&&"7J"||"1W";G(1u=="1W"){1U{L=D.6X(c,s.1O,s.9S)}1V(e){1u="5J"}}G(1u=="1W"){J b;1U{b=c.5I("7g-5R")}1V(e){}G(s.5S&&b)D.4z[s.1a]=b;G(!g)1W()}N D.5H(s,c,1u);1J();G(s.31)c=U}};G(s.31){J f=4I(d,13);G(s.2T>0)3B(H(){G(c){c.7l();G(!m)d("2T")}},s.2T)}1U{c.9P(s.L)}1V(e){D.5H(s,c,U,e)}G(!s.31)d();H 1W(){G(s.1W)s.1W(L,1u);G(s.26)D.W.1P("7C",[c,s])}H 1J(){G(s.1J)s.1J(c,1u);G(s.26)D.W.1P("7F",[c,s]);G(s.26&&!--D.4O)D.W.1P("7G")}I c},5H:H(s,a,b,e){G(s.3e)s.3e(a,b,e);G(s.26)D.W.1P("7D",[a,s,e])},4O:0,7j:H(a){1U{I!a.1u&&5Z.9O=="5p:"||(a.1u>=7e&&a.1u<9N)||a.1u==7c||a.1u==9K||D.14.2k&&a.1u==12}1V(e){}I Q},7h:H(a,c){1U{J b=a.5I("7g-5R");I a.1u==7c||b==D.4z[c]||D.14.2k&&a.1u==12}1V(e){}I Q},6X:H(a,c,b){J d=a.5I("9J-O"),2N=c=="2N"||!c&&d&&d.1h("2N")>=0,L=2N?a.9I:a.4U;G(2N&&L.1C.2j=="5J")7p"5J";G(b)L=b(L,c);G(c=="1m")D.5u(L);G(c=="3z")L=6u("("+L+")");I L},3n:H(a){J s=[];G(a.1q==2p||a.5w)D.P(a,H(){s.1p(3u(7.34)+"="+3u(7.2x))});N R(J j 1n a)G(a[j]&&a[j].1q==2p)D.P(a[j],H(){s.1p(3u(j)+"="+3u(7))});N s.1p(3u(j)+"="+3u(D.1D(a[j])?a[j]():a[j]));I s.6s("&").1o(/%20/g,"+")}});D.17.1l({1N:H(c,b){I c?7.2g({1Z:"1N",2h:"1N",1y:"1N"},c,b):7.1E(":1G").P(H(){7.V.18=7.5D||"";G(D.1g(7,"18")=="2F"){J a=D("<"+7.2j+" />").6P("1c");7.V.18=a.1g("18");G(7.V.18=="2F")7.V.18="3I";a.21()}}).3l()},1M:H(b,a){I b?7.2g({1Z:"1M",2h:"1M",1y:"1M"},b,a):7.1E(":4j").P(H(){7.5D=7.5D||D.1g(7,"18");7.V.18="2F"}).3l()},78:D.17.2m,2m:H(a,b){I D.1D(a)&&D.1D(b)?7.78.1w(7,19):a?7.2g({1Z:"2m",2h:"2m",1y:"2m"},a,b):7.P(H(){D(7)[D(7).3F(":1G")?"1N":"1M"]()})},9G:H(b,a){I 7.2g({1Z:"1N"},b,a)},9F:H(b,a){I 7.2g({1Z:"1M"},b,a)},9E:H(b,a){I 7.2g({1Z:"2m"},b,a)},9D:H(b,a){I 7.2g({1y:"1N"},b,a)},9M:H(b,a){I 7.2g({1y:"1M"},b,a)},9C:H(c,a,b){I 7.2g({1y:a},c,b)},2g:H(k,j,i,g){J h=D.77(j,i,g);I 7[h.36===Q?"P":"36"](H(){G(7.16!=1)I Q;J f=D.1l({},h),p,1G=D(7).3F(":1G"),46=7;R(p 1n k){G(k[p]=="1M"&&1G||k[p]=="1N"&&!1G)I f.1J.1k(7);G(p=="1Z"||p=="2h"){f.18=D.1g(7,"18");f.33=7.V.33}}G(f.33!=U)7.V.33="1G";f.45=D.1l({},k);D.P(k,H(c,a){J e=2B D.28(46,f,c);G(/2m|1N|1M/.11(a))e[a=="2m"?1G?"1N":"1M":a](k);N{J b=a.6r().1I(/^([+-]=)?([\\d+-.]+)(.*)$/),2b=e.1t(M)||0;G(b){J d=3d(b[2]),2M=b[3]||"2X";G(2M!="2X"){46.V[c]=(d||1)+2M;2b=((d||1)/e.1t(M))*2b;46.V[c]=2b+2M}G(b[1])d=((b[1]=="-="?-1:1)*d)+2b;e.3G(2b,d,2M)}N e.3G(2b,a,"")}});I M})},36:H(a,b){G(D.1D(a)||(a&&a.1q==2p)){b=a;a="28"}G(!a||(1j a=="23"&&!b))I A(7[0],a);I 7.P(H(){G(b.1q==2p)A(7,a,b);N{A(7,a).1p(b);G(A(7,a).K==1)b.1k(7)}})},9X:H(b,c){J a=D.3O;G(b)7.36([]);7.P(H(){R(J i=a.K-1;i>=0;i--)G(a[i].T==7){G(c)a[i](M);a.7n(i,1)}});G(!c)7.5A();I 7}});J A=H(b,c,a){G(b){c=c||"28";J q=D.L(b,c+"36");G(!q||a)q=D.L(b,c+"36",D.2d(a))}I q};D.17.5A=H(a){a=a||"28";I 7.P(H(){J q=A(7,a);q.4s();G(q.K)q[0].1k(7)})};D.1l({77:H(b,a,c){J d=b&&b.1q==a0?b:{1J:c||!c&&a||D.1D(b)&&b,2u:b,41:c&&a||a&&a.1q!=9t&&a};d.2u=(d.2u&&d.2u.1q==4L?d.2u:D.28.5K[d.2u])||D.28.5K.74;d.5M=d.1J;d.1J=H(){G(d.36!==Q)D(7).5A();G(D.1D(d.5M))d.5M.1k(7)};I d},41:{73:H(p,n,b,a){I b+a*p},5P:H(p,n,b,a){I((-29.9r(p*29.9q)/2)+0.5)*a+b}},3O:[],48:U,28:H(b,c,a){7.15=c;7.T=b;7.1i=a;G(!c.3Z)c.3Z={}}});D.28.44={4D:H(){G(7.15.2Y)7.15.2Y.1k(7.T,7.1z,7);(D.28.2Y[7.1i]||D.28.2Y.4w)(7);G(7.1i=="1Z"||7.1i=="2h")7.T.V.18="3I"},1t:H(a){G(7.T[7.1i]!=U&&7.T.V[7.1i]==U)I 7.T[7.1i];J r=3d(D.1g(7.T,7.1i,a));I r&&r>-9p?r:3d(D.2a(7.T,7.1i))||0},3G:H(c,b,d){7.5V=1z();7.2b=c;7.3l=b;7.2M=d||7.2M||"2X";7.1z=7.2b;7.2S=7.4N=0;7.4D();J e=7;H t(a){I e.2Y(a)}t.T=7.T;D.3O.1p(t);G(D.48==U){D.48=4I(H(){J a=D.3O;R(J i=0;i7.15.2u+7.5V){7.1z=7.3l;7.2S=7.4N=1;7.4D();7.15.45[7.1i]=M;J b=M;R(J i 1n 7.15.45)G(7.15.45[i]!==M)b=Q;G(b){G(7.15.18!=U){7.T.V.33=7.15.33;7.T.V.18=7.15.18;G(D.1g(7.T,"18")=="2F")7.T.V.18="3I"}G(7.15.1M)7.T.V.18="2F";G(7.15.1M||7.15.1N)R(J p 1n 7.15.45)D.1K(7.T.V,p,7.15.3Z[p])}G(b)7.15.1J.1k(7.T);I Q}N{J n=t-7.5V;7.4N=n/7.15.2u;7.2S=D.41[7.15.41||(D.41.5P?"5P":"73")](7.4N,n,0,1,7.15.2u);7.1z=7.2b+((7.3l-7.2b)*7.2S);7.4D()}I M}};D.1l(D.28,{5K:{9l:9j,9i:7e,74:9g},2Y:{2e:H(a){a.T.2e=a.1z},2c:H(a){a.T.2c=a.1z},1y:H(a){D.1K(a.T.V,"1y",a.1z)},4w:H(a){a.T.V[a.1i]=a.1z+a.2M}}});D.17.2i=H(){J b=0,1S=0,T=7[0],3q;G(T)ao(D.14){J d=T.1d,4a=T,1s=T.1s,1Q=T.2z,5U=2k&&3r(5B)<9c&&!/9a/i.11(v),1g=D.2a,3c=1g(T,"30")=="3c";G(T.7y){J c=T.7y();1e(c.1A+29.2f(1Q.1C.2e,1Q.1c.2e),c.1S+29.2f(1Q.1C.2c,1Q.1c.2c));1e(-1Q.1C.6b,-1Q.1C.6a)}N{1e(T.5X,T.5W);1B(1s){1e(1s.5X,1s.5W);G(42&&!/^t(98|d|h)$/i.11(1s.2j)||2k&&!5U)2C(1s);G(!3c&&1g(1s,"30")=="3c")3c=M;4a=/^1c$/i.11(1s.2j)?4a:1s;1s=1s.1s}1B(d&&d.2j&&!/^1c|2K$/i.11(d.2j)){G(!/^96|1T.*$/i.11(1g(d,"18")))1e(-d.2e,-d.2c);G(42&&1g(d,"33")!="4j")2C(d);d=d.1d}G((5U&&(3c||1g(4a,"30")=="5x"))||(42&&1g(4a,"30")!="5x"))1e(-1Q.1c.5X,-1Q.1c.5W);G(3c)1e(29.2f(1Q.1C.2e,1Q.1c.2e),29.2f(1Q.1C.2c,1Q.1c.2c))}3q={1S:1S,1A:b}}H 2C(a){1e(D.2a(a,"6V",M),D.2a(a,"6U",M))}H 1e(l,t){b+=3r(l,10)||0;1S+=3r(t,10)||0}I 3q};D.17.1l({30:H(){J a=0,1S=0,3q;G(7[0]){J b=7.1s(),2i=7.2i(),4c=/^1c|2K$/i.11(b[0].2j)?{1S:0,1A:0}:b.2i();2i.1S-=25(7,\'94\');2i.1A-=25(7,\'aF\');4c.1S+=25(b,\'6U\');4c.1A+=25(b,\'6V\');3q={1S:2i.1S-4c.1S,1A:2i.1A-4c.1A}}I 3q},1s:H(){J a=7[0].1s;1B(a&&(!/^1c|2K$/i.11(a.2j)&&D.1g(a,\'30\')==\'93\'))a=a.1s;I D(a)}});D.P([\'5e\',\'5G\'],H(i,b){J c=\'4y\'+b;D.17[c]=H(a){G(!7[0])I;I a!=12?7.P(H(){7==1b||7==S?1b.92(!i?a:D(1b).2e(),i?a:D(1b).2c()):7[c]=a}):7[0]==1b||7[0]==S?46[i?\'aI\':\'aJ\']||D.71&&S.1C[c]||S.1c[c]:7[0][c]}});D.P(["6N","4b"],H(i,b){J c=i?"5e":"5G",4f=i?"6k":"6i";D.17["5s"+b]=H(){I 7[b.3y()]()+25(7,"57"+c)+25(7,"57"+4f)};D.17["90"+b]=H(a){I 7["5s"+b]()+25(7,"2C"+c+"4b")+25(7,"2C"+4f+"4b")+(a?25(7,"6S"+c)+25(7,"6S"+4f):0)}})})();',62,669,'|||||||this|||||||||||||||||||||||||||||||||||if|function|return|var|length|data|true|else|type|each|false|for|document|elem|null|style|event||nodeName|||test|undefined||browser|options|nodeType|fn|display|arguments|url|window|body|parentNode|add|msie|css|indexOf|prop|typeof|call|extend|script|in|replace|push|constructor|text|offsetParent|cur|status|div|apply|firstChild|opacity|now|left|while|documentElement|isFunction|filter|className|hidden|handle|match|complete|attr|ret|hide|show|dataType|trigger|doc|split|top|table|try|catch|success|break|cache|height||remove|tbody|string|guid|num|global|ready|fx|Math|curCSS|start|scrollTop|makeArray|scrollLeft|max|animate|width|offset|tagName|safari|map|toggle||done|Array|find|toUpperCase|button|special|duration|id|copy|value|handler|ownerDocument|select|new|border|exec|stack|none|opera|nextSibling|pushStack|target|html|inArray|unit|xml|bind|GET|isReady|merge|pos|timeout|delete|one|selected|px|step|jsre|position|async|preventDefault|overflow|name|which|queue|removeChild|namespace|insertBefore|nth|removeData|fixed|parseFloat|error|readyState|multiFilter|createElement|rl|re|trim|end|_|param|first|get|results|parseInt|slice|childNodes|encodeURIComponent|append|events|elems|toLowerCase|json|readyList|setTimeout|grep|mouseenter|color|is|custom|getElementsByTagName|block|stopPropagation|addEventListener|callee|proxy|mouseleave|timers|defaultView|password|disabled|last|has|appendChild|form|domManip|props|ajax|orig|set|easing|mozilla|load|prototype|curAnim|self|charCode|timerId|object|offsetChild|Width|parentOffset|src|unbind|br|currentStyle|clean|float|visible|relatedTarget|previousSibling|handlers|isXMLDoc|on|setup|nodeIndex|unique|shift|javascript|child|RegExp|_default|deep|scroll|lastModified|teardown|setRequestHeader|timeStamp|update|empty|tr|getAttribute|innerHTML|setInterval|checked|fromElement|Number|jQuery|state|active|jsonp|accepts|application|dir|input|responseText|click|styleSheets|unload|not|lastToggle|outline|mouseout|getPropertyValue|mouseover|getComputedStyle|bindReady|String|padding|pageX|metaKey|keyCode|getWH|andSelf|clientX|Left|all|visibility|container|index|init|triggered|removeAttribute|classFilter|prevObject|submit|file|after|windowData|inner|client|globalEval|sibling|jquery|absolute|clone|wrapAll|dequeue|version|triggerHandler|oldblock|ctrlKey|createTextNode|Top|handleError|getResponseHeader|parsererror|speeds|checkbox|old|00|radio|swing|href|Modified|ifModified|lastChild|safari2|startTime|offsetTop|offsetLeft|username|location|ajaxSettings|getElementById|isSimple|values|selectedIndex|runtimeStyle|rsLeft|_load|loaded|DOMContentLoaded|clientTop|clientLeft|toElement|srcElement|val|pageY|POST|unshift|Bottom|clientY|Right|fix|exclusive|detachEvent|cloneNode|removeEventListener|swap|toString|join|attachEvent|eval|substr|head|parse|textarea|reset|image|zoom|odd|even|before|prepend|exclude|expr|quickClass|quickID|uuid|quickChild|continue|Height|textContent|appendTo|contents|open|margin|evalScript|borderTopWidth|borderLeftWidth|parent|httpData|setArray|CSS1Compat|compatMode|boxModel|cssFloat|linear|def|webkit|nodeValue|speed|_toggle|eq|100|replaceWith|304|concat|200|alpha|Last|httpNotModified|getAttributeNode|httpSuccess|clearInterval|abort|beforeSend|splice|styleFloat|throw|colgroup|XMLHttpRequest|ActiveXObject|scriptCharset|callback|fieldset|multiple|processData|getBoundingClientRect|contentType|link|ajaxSend|ajaxSuccess|ajaxError|col|ajaxComplete|ajaxStop|ajaxStart|serializeArray|notmodified|keypress|keydown|change|mouseup|mousedown|dblclick|focus|blur|stylesheet|hasClass|rel|doScroll|black|hover|solid|cancelBubble|returnValue|wheelDelta|view|round|shiftKey|resize|screenY|screenX|relatedNode|mousemove|prevValue|originalTarget|offsetHeight|keyup|newValue|offsetWidth|eventPhase|detail|currentTarget|cancelable|bubbles|attrName|attrChange|altKey|originalEvent|charAt|0n|substring|animated|header|noConflict|line|enabled|innerText|contains|only|weight|font|gt|lt|uFFFF|u0128|size|417|Boolean|Date|toggleClass|removeClass|addClass|removeAttr|replaceAll|insertAfter|prependTo|wrap|contentWindow|contentDocument|iframe|children|siblings|prevAll|wrapInner|nextAll|outer|prev|scrollTo|static|marginTop|next|inline|parents|able|cellSpacing|adobeair|cellspacing|522|maxLength|maxlength|readOnly|400|readonly|fast|600|class|slow|1px|htmlFor|reverse|10000|PI|cos|compatible|Function|setData|ie|ra|it|rv|getData|userAgent|navigator|fadeTo|fadeIn|slideToggle|slideUp|slideDown|ig|responseXML|content|1223|NaN|fadeOut|300|protocol|send|setAttribute|option|dataFilter|cssText|changed|be|Accept|stop|With|Requested|Object|can|GMT|property|1970|Jan|01|Thu|Since|If|Type|Content|XMLHTTP|th|Microsoft|td|onreadystatechange|onload|cap|charset|colg|host|tfoot|specified|with|1_|thead|leg|plain|attributes|opt|embed|urlencoded|www|area|hr|ajaxSetup|meta|post|getJSON|getScript|marginLeft|img|elements|pageYOffset|pageXOffset|abbr|serialize|pixelLeft'.split('|'),0,{})); +// $Id: drupal.js,v 1.41.2.4 2009/07/21 08:59:10 goba Exp $ + +var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'themes': {}, 'locale': {} }; + +/** + * Set the variable that indicates if JavaScript behaviors should be applied + */ +Drupal.jsEnabled = document.getElementsByTagName && document.createElement && document.createTextNode && document.documentElement && document.getElementById; + +/** + * Attach all registered behaviors to a page element. + * + * Behaviors are event-triggered actions that attach to page elements, enhancing + * default non-Javascript UIs. Behaviors are registered in the Drupal.behaviors + * object as follows: + * @code + * Drupal.behaviors.behaviorName = function () { + * ... + * }; + * @endcode + * + * Drupal.attachBehaviors is added below to the jQuery ready event and so + * runs on initial page load. Developers implementing AHAH/AJAX in their + * solutions should also call this function after new page content has been + * loaded, feeding in an element to be processed, in order to attach all + * behaviors to the new content. + * + * Behaviors should use a class in the form behaviorName-processed to ensure + * the behavior is attached only once to a given element. (Doing so enables + * the reprocessing of given elements, which may be needed on occasion despite + * the ability to limit behavior attachment to a particular element.) + * + * @param context + * An element to attach behaviors to. If none is given, the document element + * is used. + */ +Drupal.attachBehaviors = function(context) { + context = context || document; + if (Drupal.jsEnabled) { + // Execute all of them. + jQuery.each(Drupal.behaviors, function() { + this(context); + }); + } +}; + +/** + * Encode special characters in a plain-text string for display as HTML. + */ +Drupal.checkPlain = function(str) { + str = String(str); + var replace = { '&': '&', '"': '"', '<': '<', '>': '>' }; + for (var character in replace) { + var regex = new RegExp(character, 'g'); + str = str.replace(regex, replace[character]); + } + return str; +}; + +/** + * Translate strings to the page language or a given language. + * + * See the documentation of the server-side t() function for further details. + * + * @param str + * A string containing the English string to translate. + * @param args + * An object of replacements pairs to make after translation. Incidences + * of any key in this array are replaced with the corresponding value. + * Based on the first character of the key, the value is escaped and/or themed: + * - !variable: inserted as is + * - @variable: escape plain text to HTML (Drupal.checkPlain) + * - %variable: escape text and theme as a placeholder for user-submitted + * content (checkPlain + Drupal.theme('placeholder')) + * @return + * The translated string. + */ +Drupal.t = function(str, args) { + // Fetch the localized version of the string. + if (Drupal.locale.strings && Drupal.locale.strings[str]) { + str = Drupal.locale.strings[str]; + } + + if (args) { + // Transform arguments before inserting them + for (var key in args) { + switch (key.charAt(0)) { + // Escaped only + case '@': + args[key] = Drupal.checkPlain(args[key]); + break; + // Pass-through + case '!': + break; + // Escaped and placeholder + case '%': + default: + args[key] = Drupal.theme('placeholder', args[key]); + break; + } + str = str.replace(key, args[key]); + } + } + return str; +}; + +/** + * Format a string containing a count of items. + * + * This function ensures that the string is pluralized correctly. Since Drupal.t() is + * called by this function, make sure not to pass already-localized strings to it. + * + * See the documentation of the server-side format_plural() function for further details. + * + * @param count + * The item count to display. + * @param singular + * The string for the singular case. Please make sure it is clear this is + * singular, to ease translation (e.g. use "1 new comment" instead of "1 new"). + * Do not use @count in the singular string. + * @param plural + * The string for the plural case. Please make sure it is clear this is plural, + * to ease translation. Use @count in place of the item count, as in "@count + * new comments". + * @param args + * An object of replacements pairs to make after translation. Incidences + * of any key in this array are replaced with the corresponding value. + * Based on the first character of the key, the value is escaped and/or themed: + * - !variable: inserted as is + * - @variable: escape plain text to HTML (Drupal.checkPlain) + * - %variable: escape text and theme as a placeholder for user-submitted + * content (checkPlain + Drupal.theme('placeholder')) + * Note that you do not need to include @count in this array. + * This replacement is done automatically for the plural case. + * @return + * A translated string. + */ +Drupal.formatPlural = function(count, singular, plural, args) { + var args = args || {}; + args['@count'] = count; + // Determine the index of the plural form. + var index = Drupal.locale.pluralFormula ? Drupal.locale.pluralFormula(args['@count']) : ((args['@count'] == 1) ? 0 : 1); + + if (index == 0) { + return Drupal.t(singular, args); + } + else if (index == 1) { + return Drupal.t(plural, args); + } + else { + args['@count['+ index +']'] = args['@count']; + delete args['@count']; + return Drupal.t(plural.replace('@count', '@count['+ index +']')); + } +}; + +/** + * Generate the themed representation of a Drupal object. + * + * All requests for themed output must go through this function. It examines + * the request and routes it to the appropriate theme function. If the current + * theme does not provide an override function, the generic theme function is + * called. + * + * For example, to retrieve the HTML that is output by theme_placeholder(text), + * call Drupal.theme('placeholder', text). + * + * @param func + * The name of the theme function to call. + * @param ... + * Additional arguments to pass along to the theme function. + * @return + * Any data the theme function returns. This could be a plain HTML string, + * but also a complex object. + */ +Drupal.theme = function(func) { + for (var i = 1, args = []; i < arguments.length; i++) { + args.push(arguments[i]); + } + + return (Drupal.theme[func] || Drupal.theme.prototype[func]).apply(this, args); +}; + +/** + * Parse a JSON response. + * + * The result is either the JSON object, or an object with 'status' 0 and 'data' an error message. + */ +Drupal.parseJson = function (data) { + if ((data.substring(0, 1) != '{') && (data.substring(0, 1) != '[')) { + return { status: 0, data: data.length ? data : Drupal.t('Unspecified error') }; + } + return eval('(' + data + ');'); +}; + +/** + * Freeze the current body height (as minimum height). Used to prevent + * unnecessary upwards scrolling when doing DOM manipulations. + */ +Drupal.freezeHeight = function () { + Drupal.unfreezeHeight(); + var div = document.createElement('div'); + $(div).css({ + position: 'absolute', + top: '0px', + left: '0px', + width: '1px', + height: $('body').css('height') + }).attr('id', 'freeze-height'); + $('body').append(div); +}; + +/** + * Unfreeze the body height + */ +Drupal.unfreezeHeight = function () { + $('#freeze-height').remove(); +}; + +/** + * Wrapper around encodeURIComponent() which avoids Apache quirks (equivalent of + * drupal_urlencode() in PHP). This function should only be used on paths, not + * on query string arguments. + */ +Drupal.encodeURIComponent = function (item, uri) { + uri = uri || location.href; + item = encodeURIComponent(item).replace(/%2F/g, '/'); + return (uri.indexOf('?q=') != -1) ? item : item.replace(/%26/g, '%2526').replace(/%23/g, '%2523').replace(/\/\//g, '/%252F'); +}; + +/** + * Get the text selection in a textarea. + */ +Drupal.getSelection = function (element) { + if (typeof(element.selectionStart) != 'number' && document.selection) { + // The current selection + var range1 = document.selection.createRange(); + var range2 = range1.duplicate(); + // Select all text. + range2.moveToElementText(element); + // Now move 'dummy' end point to end point of original range. + range2.setEndPoint('EndToEnd', range1); + // Now we can calculate start and end points. + var start = range2.text.length - range1.text.length; + var end = start + range1.text.length; + return { 'start': start, 'end': end }; + } + return { 'start': element.selectionStart, 'end': element.selectionEnd }; +}; + +/** + * Build an error message from ahah response. + */ +Drupal.ahahError = function(xmlhttp, uri) { + if (xmlhttp.status == 200) { + if (jQuery.trim($(xmlhttp.responseText).text())) { + var message = Drupal.t("An error occurred. \n@uri\n@text", {'@uri': uri, '@text': xmlhttp.responseText }); + } + else { + var message = Drupal.t("An error occurred. \n@uri\n(no information available).", {'@uri': uri, '@text': xmlhttp.responseText }); + } + } + else { + var message = Drupal.t("An HTTP error @status occurred. \n@uri", {'@uri': uri, '@status': xmlhttp.status }); + } + return message; +} + +// Global Killswitch on the element +if (Drupal.jsEnabled) { + // Global Killswitch on the element + $(document.documentElement).addClass('js'); + // 'js enabled' cookie + document.cookie = 'has_js=1; path=/'; + // Attach all behaviors. + $(document).ready(function() { + Drupal.attachBehaviors(this); + }); +} + +/** + * The default themes. + */ +Drupal.theme.prototype = { + + /** + * Formats text for emphasized display in a placeholder inside a sentence. + * + * @param str + * The text to format (plain-text). + * @return + * The formatted text (html). + */ + placeholder: function(str) { + return '' + Drupal.checkPlain(str) + ''; + } +}; +; +// $Id: googleanalytics.js,v 1.9.2.4 2010/09/19 11:39:20 hass Exp $ + +$(document).ready(function() { + + // Attach onclick event to document only and catch clicks on all elements. + $(document.body).click(function(event) { + // Catch only the first parent link of a clicked element. + $(event.target).parents("a:first,area:first").andSelf().filter("a,area").each(function() { + + var ga = Drupal.settings.googleanalytics; + // Expression to check for absolute internal links. + var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i"); + // Expression to check for special links like gotwo.module /go/* links. + var isInternalSpecial = new RegExp("(\/go\/.*)$", "i"); + // Expression to check for download links. + var isDownload = new RegExp("\\.(" + ga.trackDownloadExtensions + ")$", "i"); + + // Is the clicked URL internal? + if (isInternal.test(this.href)) { + // Is download tracking activated and the file extension configured for download tracking? + if (ga.trackDownload && isDownload.test(this.href)) { + // Download link clicked. + var extension = isDownload.exec(this.href); + _gaq.push(["_trackEvent", "Downloads", extension[1].toUpperCase(), this.href.replace(isInternal, '')]); + } + else if (isInternalSpecial.test(this.href)) { + // Keep the internal URL for Google Analytics website overlay intact. + _gaq.push(["_trackPageview", this.href.replace(isInternal, '')]); + } + } + else { + if (ga.trackMailto && $(this).is("a[href^=mailto:],area[href^=mailto:]")) { + // Mailto link clicked. + _gaq.push(["_trackEvent", "Mails", "Click", this.href.substring(7)]); + } + else if (ga.trackOutgoing && this.href) { + // External link clicked. + _gaq.push(["_trackEvent", "Outgoing links", "Click", this.href]); + } + } + + }); + }); +}); +; +(function () { + function latitudeToMercator(latitude) { + return Math.log(Math.tan(latitude * Math.PI / 180) + 1 / Math.cos(latitude * Math.PI / 180)); + } + + Drupal.html5UserGeolocationLongitudeToPx = function (longitude, leftLongitude, width) { + return (longitude - leftLongitude + 360) / 360 % 1 * width; + } + + Drupal.html5UserGeolocationLatitudeToPx = function (latitude, topLatitude, bottomLatitude, height) { + return (latitudeToMercator(latitude) - latitudeToMercator(bottomLatitude)) + / (latitudeToMercator(topLatitude) - latitudeToMercator(bottomLatitude)) + * height; + } + + function plot() { + var $map = $('#html5-user-geolocation-map'), + latitude = $('#edit-html5-user-geolocation-latitude').attr('value'), + longitude = $('#edit-html5-user-geolocation-longitude').attr('value'); + + if (latitude == 0 && longitude == 0) { + return; + } + + // Plot coords + $('#html5-user-geolocation-map .dot').css({ + left: '' + Drupal.html5UserGeolocationLongitudeToPx(longitude, -168, $map.width()) + 'px', + bottom: '' + Drupal.html5UserGeolocationLatitudeToPx(latitude, 78, -58, $map.height()) + 'px' + }).show(); + + // Show precision + $map.siblings('.description').find('span').html( + (Math.acos( + Math.sin(latitude * Math.PI / 180) + * Math.sin((latitude) * Math.PI / 180) + + Math.cos(latitude * Math.PI / 180) + * Math.cos((latitude) * Math.PI / 180) + * Math.cos(Math.pow(10, -1 * Drupal.settings.html5UserGeolocationPrecision) * Math.PI / 180) + ) * 6371).toPrecision(3) + ); + } + + function getLocation() { + if ($('#edit-html5-user-geolocation-save').attr('checked')) { + var $busy = $('#html5-user-geolocation-messages-wrapper .geolocating'); + $('#html5-user-geolocation-map-wrapper').slideDown('fast'); + + // Get position + $busy.show(); + navigator.geolocation.getCurrentPosition(function (position) { + // Save coords + $('#edit-html5-user-geolocation-latitude').attr('value', position.coords.latitude); + $('#edit-html5-user-geolocation-longitude').attr('value', position.coords.longitude); + + plot(); + $busy.hide(); + }, function () { // getCurrentPosition error callback + $('#edit-html5-user-geolocation-save').attr('checked', false).change(); + }, + { + maximumAge: Infinity + }); + } + else { // Location not checked + $('#html5-user-geolocation-map-wrapper').slideUp('fast'); + } + } + + Drupal.behaviors.html5UserGeolocation = function (context) { + if (navigator.geolocation) { + $('#user-profile-form #edit-html5-user-geolocation-save:not(.html5-user-geolocation-processed)', context) + .addClass('html5-user-geolocation-processed') + .change(function () { + getLocation(); + }) + .each(function () { + $('#html5-user-geolocation-messages-wrapper .not-supported').hide(); + if ($('#edit-html5-user-geolocation-save').attr('checked')) { + $('#html5-user-geolocation-map-wrapper').slideDown('fast'); + plot(); + } + getLocation(); + }); + } + else { // HTML5 Geolocation not supported + $('#edit-html5-user-geolocation-save').attr('disabled', true); + } + }; +}()); +; +Drupal.behaviors.drupalorgSetHome = function () { + $('#drupalorg-set-home:not(.drupalorg-set-home-processed)') + .addClass('drupalorg-set-home-processed') + .each(function () { + var $this = $(this); + // Click triggers form submit + $('a', $this).click(function () { + $('input[type=submit]', $this).click(); + return false; + }); + }); +}; + +Drupal.behaviors.drupalorgSearch = function () { + $('body.page-search #content-top-region form:not(.drupalorgSearch-processed)').addClass('drupalorgSearch-processed').each(function () { + var $this = $(this); + $this.find('select').change(function () { + $this.submit(); + }); + }); +}; +; +// $Id: base.js,v 1.11.2.1 2010/03/10 20:08:58 merlinofchaos Exp $ +/** + * @file base.js + * + * Some basic behaviors and utility functions for Views. + */ + +Drupal.Views = {}; + +/** + * jQuery UI tabs, Views integration component + */ +Drupal.behaviors.viewsTabs = function (context) { + $('#views-tabset:not(.views-processed)').addClass('views-processed').each(function() { + new Drupal.Views.Tabs($(this), {selectedClass: 'active'}); + }); + + $('a.views-remove-link') + .addClass('views-processed') + .click(function() { + var id = $(this).attr('id').replace('views-remove-link-', ''); + $('#views-row-' + id).hide(); + $('#views-removed-' + id).attr('checked', true); + return false; + }); +} + +/** + * For IE, attach some javascript so that our hovers do what they're supposed + * to do. + */ +Drupal.behaviors.viewsHoverlinks = function() { + if ($.browser.msie) { + // If IE, attach a hover event so we can see our admin links. + $("div.view:not(.views-hover-processed)").addClass('views-hover-processed').hover( + function() { + $('div.views-hide', this).addClass("views-hide-hover"); return true; + }, + function(){ + $('div.views-hide', this).removeClass("views-hide-hover"); return true; + } + ); + $("div.views-admin-links:not(.views-hover-processed)") + .addClass('views-hover-processed') + .hover( + function() { + $(this).addClass("views-admin-links-hover"); return true; + }, + function(){ + $(this).removeClass("views-admin-links-hover"); return true; + } + ); + } +} + +/** + * Helper function to parse a querystring. + */ +Drupal.Views.parseQueryString = function (query) { + var args = {}; + var pos = query.indexOf('?'); + if (pos != -1) { + query = query.substring(pos + 1); + } + var pairs = query.split('&'); + for(var i in pairs) { + var pair = pairs[i].split('='); + // Ignore the 'q' path argument, if present. + if (pair[0] != 'q' && pair[1]) { + args[pair[0]] = decodeURIComponent(pair[1].replace(/\+/g, ' ')); + } + } + return args; +}; + +/** + * Helper function to return a view's arguments based on a path. + */ +Drupal.Views.parseViewArgs = function (href, viewPath) { + var returnObj = {}; + var path = Drupal.Views.getPath(href); + // Ensure we have a correct path. + if (viewPath && path.substring(0, viewPath.length + 1) == viewPath + '/') { + var args = decodeURIComponent(path.substring(viewPath.length + 1, path.length)); + returnObj.view_args = args; + returnObj.view_path = path; + } + return returnObj; +}; + +/** + * Strip off the protocol plus domain from an href. + */ +Drupal.Views.pathPortion = function (href) { + // Remove e.g. http://example.com if present. + var protocol = window.location.protocol; + if (href.substring(0, protocol.length) == protocol) { + // 2 is the length of the '//' that normally follows the protocol + href = href.substring(href.indexOf('/', protocol.length + 2)); + } + return href; +}; + +/** + * Return the Drupal path portion of an href. + */ +Drupal.Views.getPath = function (href) { + href = Drupal.Views.pathPortion(href); + href = href.substring(Drupal.settings.basePath.length, href.length); + // 3 is the length of the '?q=' added to the url without clean urls. + if (href.substring(0, 3) == '?q=') { + href = href.substring(3, href.length); + } + var chars = ['#', '?', '&']; + for (i in chars) { + if (href.indexOf(chars[i]) > -1) { + href = href.substr(0, href.indexOf(chars[i])); + } + } + return href; +}; +; +// $Id: dependent.js,v 1.9.2.1 2009/11/18 02:43:47 merlinofchaos Exp $ +/** + * @file dependent.js + * + * Written by dmitrig01 (Dmitri Gaskin) for Views; this provides dependent + * visibility for form items in Views' ajax forms. + * + * To your $form item definition add: + * - '#process' => array('views_process_dependency'), + * - Add '#dependency' => array('id-of-form-item' => array(list, of, values, that, + make, this, item, show), + * + * Special considerations: + * - radios are harder. Because Drupal doesn't give radio groups individual ids, + * use 'radio:name-of-radio' + * + * - Checkboxes don't have their own id, so you need to add one in a div + * around the checkboxes via #prefix and #suffix. You actually need to add TWO + * divs because it's the parent that gets hidden. Also be sure to retain the + * 'expand_checkboxes' in the #process array, because the views process will + * override it. + */ + +Drupal.Views = Drupal.Views || {}; + +Drupal.Views.dependent = { bindings: {}, activeBindings: {}, activeTriggers: [] }; + +Drupal.Views.dependent.inArray = function(array, search_term) { + var i = array.length; + if (i > 0) { + do { + if (array[i] == search_term) { + return true; + } + } while (i--); + } + return false; +} + + +Drupal.Views.dependent.autoAttach = function() { + // Clear active bindings and triggers. + for (i in Drupal.Views.dependent.activeTriggers) { + jQuery(Drupal.Views.dependent.activeTriggers[i]).unbind('change'); + } + Drupal.Views.dependent.activeTriggers = []; + Drupal.Views.dependent.activeBindings = {}; + Drupal.Views.dependent.bindings = {}; + + if (!Drupal.settings.viewsAjax) { + return; + } + + // Iterate through all relationships + for (id in Drupal.settings.viewsAjax.formRelationships) { + + // Drupal.Views.dependent.activeBindings[id] is a boolean, + // whether the binding is active or not. Defaults to no. + Drupal.Views.dependent.activeBindings[id] = 0; + // Iterate through all possible values + for(bind_id in Drupal.settings.viewsAjax.formRelationships[id].values) { + // This creates a backward relationship. The bind_id is the ID + // of the element which needs to change in order for the id to hide or become shown. + // The id is the ID of the item which will be conditionally hidden or shown. + // Here we're setting the bindings for the bind + // id to be an empty array if it doesn't already have bindings to it + if (!Drupal.Views.dependent.bindings[bind_id]) { + Drupal.Views.dependent.bindings[bind_id] = []; + } + // Add this ID + Drupal.Views.dependent.bindings[bind_id].push(id); + // Big long if statement. + // Drupal.settings.viewsAjax.formRelationships[id].values[bind_id] holds the possible values + + if (bind_id.substring(0, 6) == 'radio:') { + var trigger_id = "input[name='" + bind_id.substring(6) + "']"; + } + else { + var trigger_id = '#' + bind_id; + } + + Drupal.Views.dependent.activeTriggers.push(trigger_id); + + if (jQuery(trigger_id).attr('type') == 'checkbox') { + $(trigger_id).parent().addClass('hidden-options'); + } + + var getValue = function(item, trigger) { + if (item.substring(0, 6) == 'radio:') { + var val = jQuery(trigger + ':checked').val(); + } + else { + switch (jQuery(trigger).attr('type')) { + case 'checkbox': + var val = jQuery(trigger).attr('checked') || 0; + + if (val) { + $(trigger).parent().removeClass('hidden-options').addClass('expanded-options'); + } + else { + $(trigger).parent().removeClass('expanded-options').addClass('hidden-options'); + } + + break; + default: + var val = jQuery(trigger).val(); + } + } + return val; + } + + var setChangeTrigger = function(trigger_id, bind_id) { + // Triggered when change() is clicked. + var changeTrigger = function() { + var val = getValue(bind_id, trigger_id); + + for (i in Drupal.Views.dependent.bindings[bind_id]) { + var id = Drupal.Views.dependent.bindings[bind_id][i]; + + // Fix numerous errors + if (typeof id != 'string') { + continue; + } + + // This bit had to be rewritten a bit because two properties on the + // same set caused the counter to go up and up and up. + if (!Drupal.Views.dependent.activeBindings[id]) { + Drupal.Views.dependent.activeBindings[id] = {}; + } + + if (Drupal.Views.dependent.inArray(Drupal.settings.viewsAjax.formRelationships[id].values[bind_id], val)) { + Drupal.Views.dependent.activeBindings[id][bind_id] = 'bind'; + } + else { + delete Drupal.Views.dependent.activeBindings[id][bind_id]; + } + + var len = 0; + for (i in Drupal.Views.dependent.activeBindings[id]) { + len++; + } + + var object = jQuery('#' + id + '-wrapper'); + if (!object.size()) { + object = jQuery('#' + id).parent(); + } + + var rel_num = Drupal.settings.viewsAjax.formRelationships[id].num; + if (typeof rel_num === 'object') { + rel_num = Drupal.settings.viewsAjax.formRelationships[id].num[0]; + } + + if (rel_num <= len) { + // Show if the element if criteria is matched + object.show(0); + object.addClass('dependent-options'); + } + else { + // Otherwise hide + object.hide(0); + } + } + } + + jQuery(trigger_id).change(function() { + // Trigger the internal change function + // the attr('id') is used because closures are more confusing + changeTrigger(trigger_id, bind_id); + }); + // Trigger initial reaction + changeTrigger(trigger_id, bind_id); + } + setChangeTrigger(trigger_id, bind_id); + } + } +} + +Drupal.behaviors.viewsDependent = function (context) { + Drupal.Views.dependent.autoAttach(); + + // Really large sets of fields are too slow with the above method, so this + // is a sort of hacked one that's faster but much less flexible. + $("select.views-master-dependent:not(.views-processed)") + .addClass('views-processed') + .change(function() { + var val = $(this).val(); + if (val == 'all') { + $('.views-dependent-all').show(0); + } + else { + $('.views-dependent-all').hide(0); + $('.views-dependent-' + val).show(0); + } + }) + .trigger('change'); +} +; +// $Id: tableheader.js,v 1.16.2.2 2009/03/30 12:48:09 goba Exp $ + +Drupal.tableHeaderDoScroll = function() { + if (typeof(Drupal.tableHeaderOnScroll)=='function') { + Drupal.tableHeaderOnScroll(); + } +}; + +Drupal.behaviors.tableHeader = function (context) { + // This breaks in anything less than IE 7. Prevent it from running. + if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 7) { + return; + } + + // Keep track of all cloned table headers. + var headers = []; + + $('table.sticky-enabled thead:not(.tableHeader-processed)', context).each(function () { + // Clone thead so it inherits original jQuery properties. + var headerClone = $(this).clone(true).insertBefore(this.parentNode).wrap('').parent().css({ + position: 'fixed', + top: '0px' + }); + + headerClone = $(headerClone)[0]; + headers.push(headerClone); + + // Store parent table. + var table = $(this).parent('table')[0]; + headerClone.table = table; + // Finish initialzing header positioning. + tracker(headerClone); + + $(table).addClass('sticky-table'); + $(this).addClass('tableHeader-processed'); + }); + + // Define the anchor holding var. + var prevAnchor = ''; + + // Track positioning and visibility. + function tracker(e) { + // Save positioning data. + var viewHeight = document.documentElement.scrollHeight || document.body.scrollHeight; + if (e.viewHeight != viewHeight) { + e.viewHeight = viewHeight; + e.vPosition = $(e.table).offset().top - 4; + e.hPosition = $(e.table).offset().left; + e.vLength = e.table.clientHeight - 100; + // Resize header and its cell widths. + var parentCell = $('th', e.table); + $('th', e).each(function(index) { + var cellWidth = parentCell.eq(index).css('width'); + // Exception for IE7. + if (cellWidth == 'auto') { + cellWidth = parentCell.get(index).clientWidth +'px'; + } + $(this).css('width', cellWidth); + }); + $(e).css('width', $(e.table).css('width')); + } + + // Track horizontal positioning relative to the viewport and set visibility. + var hScroll = document.documentElement.scrollLeft || document.body.scrollLeft; + var vOffset = (document.documentElement.scrollTop || document.body.scrollTop) - e.vPosition; + var visState = (vOffset > 0 && vOffset < e.vLength) ? 'visible' : 'hidden'; + $(e).css({left: -hScroll + e.hPosition +'px', visibility: visState}); + + // Check the previous anchor to see if we need to scroll to make room for the header. + // Get the height of the header table and scroll up that amount. + if (prevAnchor != location.hash) { + if (location.hash != '') { + var offset = $('td' + location.hash).offset(); + if (offset) { + var top = offset.top; + var scrollLocation = top - $(e).height(); + $('body, html').scrollTop(scrollLocation); + } + } + prevAnchor = location.hash; + } + } + + // Only attach to scrollbars once, even if Drupal.attachBehaviors is called + // multiple times. + if (!$('body').hasClass('tableHeader-processed')) { + $('body').addClass('tableHeader-processed'); + $(window).scroll(Drupal.tableHeaderDoScroll); + $(document.documentElement).scroll(Drupal.tableHeaderDoScroll); + } + + // Track scrolling. + Drupal.tableHeaderOnScroll = function() { + $(headers).each(function () { + tracker(this); + }); + }; + + // Track resizing. + var time = null; + var resize = function () { + // Ensure minimum time between adjustments. + if (time) { + return; + } + time = setTimeout(function () { + $('table.sticky-header').each(function () { + // Force cell width calculation. + this.viewHeight = 0; + tracker(this); + }); + // Reset timer + time = null; + }, 250); + }; + $(window).resize(resize); +}; +; +// $Id: collapse.js,v 1.17 2008/01/29 10:58:25 goba Exp $ + +/** + * Toggle the visibility of a fieldset using smooth animations + */ +Drupal.toggleFieldset = function(fieldset) { + if ($(fieldset).is('.collapsed')) { + // Action div containers are processed separately because of a IE bug + // that alters the default submit button behavior. + var content = $('> div:not(.action)', fieldset); + $(fieldset).removeClass('collapsed'); + content.hide(); + content.slideDown( { + duration: 'fast', + easing: 'linear', + complete: function() { + Drupal.collapseScrollIntoView(this.parentNode); + this.parentNode.animating = false; + $('div.action', fieldset).show(); + }, + step: function() { + // Scroll the fieldset into view + Drupal.collapseScrollIntoView(this.parentNode); + } + }); + } + else { + $('div.action', fieldset).hide(); + var content = $('> div:not(.action)', fieldset).slideUp('fast', function() { + $(this.parentNode).addClass('collapsed'); + this.parentNode.animating = false; + }); + } +}; + +/** + * Scroll a given fieldset into view as much as possible. + */ +Drupal.collapseScrollIntoView = function (node) { + var h = self.innerHeight || document.documentElement.clientHeight || $('body')[0].clientHeight || 0; + var offset = self.pageYOffset || document.documentElement.scrollTop || $('body')[0].scrollTop || 0; + var posY = $(node).offset().top; + var fudge = 55; + if (posY + node.offsetHeight + fudge > h + offset) { + if (node.offsetHeight > h) { + window.scrollTo(0, posY); + } else { + window.scrollTo(0, posY + node.offsetHeight - h + fudge); + } + } +}; + +Drupal.behaviors.collapse = function (context) { + $('fieldset.collapsible > legend:not(.collapse-processed)', context).each(function() { + var fieldset = $(this.parentNode); + // Expand if there are errors inside + if ($('input.error, textarea.error, select.error', fieldset).size() > 0) { + fieldset.removeClass('collapsed'); + } + + // Turn the legend into a clickable link and wrap the contents of the fieldset + // in a div for easier animation + var text = this.innerHTML; + $(this).empty().append($(''+ text +'').click(function() { + var fieldset = $(this).parents('fieldset:first')[0]; + // Don't animate multiple times + if (!fieldset.animating) { + fieldset.animating = true; + Drupal.toggleFieldset(fieldset); + } + return false; + })) + .after($('
        ') + .append(fieldset.children(':not(legend):not(.action)'))) + .addClass('collapse-processed'); + }); +}; +; +Drupal.behaviors.Drupalorg = function () { + var $element = $('body:not(.drupalorg-front) #edit-search-theme-form-1'), + value = Drupal.t('Search Drupal.org'); + + // Add focus/blur label behavior to search box. + $element.bind('focus', function () { + if ($element.val() === value) { + $element.val('').addClass('has-value'); + } + }); + $element.bind('blur', function () { + if ($element.val() === '' || $element.val() === value) { + $element.val(value).removeClass('has-value'); + } + else { + $element.addClass('has-value'); + } + }); + $element.trigger('blur'); + + // Move right column out of the way of wide tables used on API.drupal.org and + // forums. + if ($('#column-left.grid-8').length === 1) { + var delta = 0; + $('#column-left table').each(function() { + delta = Math.max(delta, $(this).width()); + }); + delta -= $('#column-left').width(); + if (delta > 0) { + $('#page-inner').width($('#page-inner').width() + delta); + $('#column-left').width($('#column-left').width() + delta); + } + } +}; +; diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/editabledropdown.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/editabledropdown.js new file mode 100644 index 0000000..6511d8a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/editabledropdown.js @@ -0,0 +1,363 @@ +//Common functions for all dropdowns + /*---------------------------------------------- + The Common function used for all dropdowns are: + ----------------------------------------------- + -- function fnKeyDownHandler(getdropdown, e) + -- function fnLeftToRight(getdropdown) + -- function fnRightToLeft(getdropdown) + -- function fnDelete(getdropdown) + -- function FindKeyCode(e) + -- function FindKeyChar(e) + -- function fnSanityCheck(getdropdown) + + --------------------------- */ + + function fnKeyDownHandler(getdropdown, e) { + + fnSanityCheck(getdropdown); + + // Press [ <- ] and [ -> ] arrow keys on the keyboard to change alignment/flow. + // ...go to Start : Press [ <- ] Arrow Key + // ...go to End : Press [ -> ] Arrow Key + // (this is useful when the edited-text content exceeds the ListBox-fixed-width) + // This works best on Internet Explorer, and not on Netscape + + var vEventKeyCode = FindKeyCode(e); + // Press left/right arrow keys + if(vEventKeyCode == 37) { + fnLeftToRight(getdropdown); + } + if(vEventKeyCode == 39) { + fnRightToLeft(getdropdown); + } + + // Delete key pressed + if(vEventKeyCode == 46) { + fnDelete(getdropdown); + } + + // backspace key pressed + if(vEventKeyCode == 8 || vEventKeyCode==127) { + if(e.which) { //Netscape + //e.which = ''; //this property has only a getter. + } else { //Internet Explorer + //To prevent backspace from activating the -Back- button of the browser + e.keyCode = ''; + if(window.event.keyCode) { + window.event.keyCode = ''; + } + } + return true; + } + // Tab key pressed, use code below to reorient to Left-To-Right flow, if needed + //if(vEventKeyCode == 9) + //{ + // fnLeftToRight(getdropdown); + //} + } // function fnKeyDownHandler + + function fnLeftToRight(getdropdown) { + getdropdown.style.direction = "ltr"; + } //function fnLeftToRight + + function fnRightToLeft(getdropdown) { + getdropdown.style.direction = "rtl"; + } //function fnRightToLeft + + function fnDelete(getdropdown) { + if(getdropdown.options.length != 0) { // if dropdown is not empty + if (getdropdown.options.selectedIndex == vEditableOptionIndex_A) { // if option the Editable field + getdropdown.options[getdropdown.options.selectedIndex].text = ''; + //getdropdown.options[getdropdown.options.selectedIndex].value = ''; //Use this line only if want to change the internal value too; else this line is not required. + } + } + } // function fnDelete + + + /* + Since Internet Explorer and Netscape have different + ways of returning the key code, displaying keys + browser-independently is a bit harder. + However, you can create a script that displays keys + for either browser. + The following function will display each key + in the status line: + + The "FindKey.." function receives the "event" object + from the event handler and stores it in the variable "e". + It checks whether the "e.which" property exists (for Netscape), + and stores it in the "keycode" variable if present. + Otherwise, it assumes the browser is Internet Explorer + and assigns to keycode the "e.keyCode" property. + */ + + function FindKeyCode(e) { + if(e.which) { + keycode=e.which; //Netscape + } else { + keycode=e.keyCode; //Internet Explorer + } + //alert("FindKeyCode"+ keycode); + return keycode; + } // function FindKeyCode + + function FindKeyChar(e) { + keycode = FindKeyCode(e); + if((keycode==8)||(keycode==127)) { + character="backspace" + } + else if((keycode==46)) { + character="delete" + } + else { + character=String.fromCharCode(keycode); + } + //alert("FindKey"+ character); + return character; + } // function FindKeyChar + + function fnSanityCheck(getdropdown) { + if(vEditableOptionIndex_A>(getdropdown.options.length-1)) { + alert("PROGRAMMING ERROR: The value of variable vEditableOptionIndex_... cannot be greater than (length of dropdown - 1)"); + return false; + } + } + + //Dropdown specific functions, which manipulate dropdown specific global variables + + /*---------------------------------------------- + Dropdown specific global variables are: + ----------------------------------------------- + 1) vEditableOptionIndex_A --> this needs to be set by Programmer!! See explanation. + 2) vEditableOptionText_A --> this needs to be set by Programmer!! See explanation. + 3) vPreviousSelectIndex_A + 4) vSelectIndex_A + 5) vSelectChange_A + + --------------------------- */ + + /*---------------------------------------------- + The dropdown specific functions + (which manipulate dropdown specific global variables) + used by all dropdowns are: + ----------------------------------------------- + 1) function fnChangeHandler_A(getdropdown) + 2) function fnKeyPressHandler_A(getdropdown, e) + 3) function fnKeyUpHandler_A(getdropdown, e) + + --------------------------- */ + + /*------------------------------------------------ + IMPORTANT: Global Variable required to be SET by programmer + -------------------------- */ + + var vEditableOptionIndex_A = 0; + + // Give Index of Editable option in the dropdown. + // For eg. + // if first option is editable then vEditableOptionIndex_A = 0; + // if second option is editable then vEditableOptionIndex_A = 1; + // if third option is editable then vEditableOptionIndex_A = 2; + // if last option is editable then vEditableOptionIndex_A = (length of dropdown - 1). + // Note: the value of vEditableOptionIndex_A cannot be greater than (length of dropdown - 1) + + var vEditableOptionText_A = "Custom"; + + // Give the default text of the Editable option in the dropdown. + // For eg. + // if the editable option is , + // then set vEditableOptionText_A = "--?--"; + + /*------------------------------------------------ + Global Variables required for + fnChangeHandler_A(), fnKeyPressHandler_A() and fnKeyUpHandler_A() + for Editable Dropdowns + -------------------------- */ + + var vPreviousSelectIndex_A = 0; + // Contains the Previously Selected Index, set to 0 by default + + var vSelectIndex_A = 0; + // Contains the Currently Selected Index, set to 0 by default + + var vSelectChange_A = 'MANUAL_CLICK'; + // Indicates whether Change in dropdown selected option + // was due to a Manual Click + // or due to System properties of dropdown. + + // vSelectChange_A = 'MANUAL_CLICK' indicates that + // the jump to a non-editable option in the dropdown was due + // to a Manual click (i.e.,changed on purpose by user). + + // vSelectChange_A = 'AUTO_SYSTEM' indicates that + // the jump to a non-editable option was due to System properties of dropdown + // (i.e.,user did not change the option in the dropdown; + // instead an automatic jump happened due to inbuilt + // dropdown properties of browser on typing of a character ) + + /*------------------------------------------------ + Functions required for Editable Dropdowns + -------------------------- */ + + function fnChangeHandler_A(getdropdown, e) { + fnSanityCheck(getdropdown); + + vPreviousSelectIndex_A = vSelectIndex_A; + // Contains the Previously Selected Index + + vSelectIndex_A = getdropdown.options.selectedIndex; + // Contains the Currently Selected Index + + if ((vPreviousSelectIndex_A == (vEditableOptionIndex_A)) && (vSelectIndex_A != (vEditableOptionIndex_A))&&(vSelectChange_A != 'MANUAL_CLICK')) { // To Set value of Index variables - + getdropdown[(vEditableOptionIndex_A)].selected=true; + vPreviousSelectIndex_A = vSelectIndex_A; + vSelectIndex_A = getdropdown.options.selectedIndex; + vSelectChange_A = 'MANUAL_CLICK'; + // Indicates that the Change in dropdown selected + // option was due to a Manual Click + } + } // function fnChangeHandler_A + + function fnKeyPressHandler_A(getdropdown, e) { + fnSanityCheck(getdropdown); + + keycode = FindKeyCode(e); + keychar = FindKeyChar(e); + + // Check for allowable Characters + // The various characters allowable for entry into Editable option.. + // may be customized by minor modifications in the code (if condition below) + // (you need to know the keycode/ASCII value of the character to be allowed/disallowed. + // - + + if ((keycode>47 && keycode<59)||(keycode>62 && keycode<127) ||(keycode==32)) { + var vAllowableCharacter = "yes"; + } + else { + var vAllowableCharacter = "no"; + } + + //alert(window); alert(window.event); + + if(getdropdown.options.length != 0) { + // if dropdown is not empty + if (getdropdown.options.selectedIndex == (vEditableOptionIndex_A)) { + // if selected option the Editable option of the dropdown + + var vEditString = getdropdown[vEditableOptionIndex_A].text; + + // make Editable option Null if it is being edited for the first time + if((vAllowableCharacter == "yes")||(keychar=="backspace")) { + if (vEditString == vEditableOptionText_A) + vEditString = ""; + } + if (keychar=="backspace") { + // To handle backspace - + vEditString = vEditString.substring(0,vEditString.length-1); + // Decrease length of string by one from right + + vSelectChange_A = 'MANUAL_CLICK'; + // Indicates that the Change in dropdown selected + // option was due to a Manual Click + + } + //alert("EditString2:"+vEditString); + + if (vAllowableCharacter == "yes") { + // To handle addition of a character - + vEditString+=String.fromCharCode(keycode); + // Concatenate Enter character to Editable string + + // The following portion handles the "automatic Jump" bug + // The "automatic Jump" bug (Description): + // If a alphabet is entered (while editing) + // ...which is contained as a first character in one of the read-only options + // ..the focus automatically "jumps" to the read-only option + // (-- this is a common property of normal dropdowns + // ..but..is undesirable while editing). + + var i=0; + var vEnteredChar = String.fromCharCode(keycode); + var vUpperCaseEnteredChar = vEnteredChar; + var vLowerCaseEnteredChar = vEnteredChar; + + + if(((keycode)>=97)&&((keycode)<=122)) + // if vEnteredChar lowercase + vUpperCaseEnteredChar = String.fromCharCode(keycode - 32); + // This is UpperCase + + + if(((keycode)>=65)&&((keycode)<=90)) + // if vEnteredChar is UpperCase + vLowerCaseEnteredChar = String.fromCharCode(keycode + 32); + // This is lowercase + + if(e.which) { //For Netscape + // Compare the typed character (into the editable option) + // with the first character of all the other + // options (non-editable). + + // To note if the jump to the non-editable option was due + // to a Manual click (i.e.,changed on purpose by user) + // or due to System properties of dropdown + // (i.e.,user did not change the option in the dropdown; + // instead an automatic jump happened due to inbuilt + // dropdown properties of browser on typing of a character ) + + for (i=0;i<=(getdropdown.options.length-1);i++) + { + if(i!=vEditableOptionIndex_A) + { + var vReadOnlyString = getdropdown[i].text; + var vFirstChar = vReadOnlyString.substring(0,1); + if((vFirstChar == vUpperCaseEnteredChar)||(vFirstChar == vLowerCaseEnteredChar)) + { + vSelectChange_A = 'AUTO_SYSTEM'; + // Indicates that the Change in dropdown selected + // option was due to System properties of dropdown + break; + } + else + { + vSelectChange_A = 'MANUAL_CLICK'; + // Indicates that the Change in dropdown selected + // option was due to a Manual Click + } + } + } + } + } + + // Set the new edited string into the Editable option + getdropdown.options[vEditableOptionIndex_A].text = vEditString; + //getdropdown.options[vEditableOptionIndex_A].value = vEditString; //Use this line only if want to change the internal value too; else this line is not required. + + return false; + } + } + return true; + } + + function fnKeyUpHandler_A(getdropdown, e) { + fnSanityCheck(getdropdown); + + if(e.which) { // Netscape + if(vSelectChange_A == 'AUTO_SYSTEM') { + // if editable dropdown option jumped while editing + // (due to typing of a character which is the first character of some other option) + // then go back to the editable option. + getdropdown[(vEditableOptionIndex_A)].selected=true; + } + + var vEventKeyCode = FindKeyCode(e); + // if [ <- ] or [ -> ] arrow keys are pressed, select the editable option + if((vEventKeyCode == 37)||(vEventKeyCode == 39)) { + getdropdown[vEditableOptionIndex_A].selected=true; + } + } + } + +/*-------------------------------------------------------------------------------------------- */ + + \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/form-field-tooltip.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/form-field-tooltip.js new file mode 100644 index 0000000..b499ca0 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/form-field-tooltip.js @@ -0,0 +1,715 @@ +/************************************************************************************************************ + + Form field tooltip + (C) www.dhtmlgoodies.com, September 2006 + + This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website. + + Terms of use: + Look at the terms of use at http://www.dhtmlgoodies.com/index.html?page=termsOfUse + + Thank you! + + www.dhtmlgoodies.com + Alf Magne Kalleland + +************************************************************************************************************/ + +var DHTMLgoodies_globalTooltipObj; + + +/** +Constructor +**/ +function DHTMLgoodies_formTooltip() +{ + var tooltipDiv; + var tooltipText; + var tooltipContentDiv; // Reference to inner div with tooltip content + var imagePath; // Relative path to images + var arrowImageFile; // Name of arrow image + var arrowImageFileRight; // Name of arrow image + var arrowRightWidth; + var arrowTopHeight; + var tooltipWidth; // Width of tooltip + var roundedCornerObj; // Reference to object of class DHTMLgoodies_roundedCorners + var tooltipBgColor; + var closeMessage; // Close message + var activeInput; // Reference to currently active input + var tooltipPosition; // Tooltip position, possible values: "below" or "right" + var tooltipCornerSize; // Size of rounded corners + var displayArrow; // Display arrow above or at the left of the tooltip? + var cookieName; // Name of cookie + var disableTooltipPossibility; // Possibility of disabling tooltip + var disableTooltipByCookie; // If tooltip has been disabled, save the settings in cookie, i.e. for other pages with the same cookie name. + var disableTooltipMessage; + var tooltipDisabled; + var isMSIE; + var tooltipIframeObj; + var pageBgColor; // Color of background - used in ie when applying iframe which covers select boxes + var currentTooltipObj; // Reference to form field which tooltip is currently showing for + + this.currentTooltipObj = false, + this.tooltipDiv = false, + this.tooltipText = false; + this.imagePath = 'static/fusion/raptor/images/'; + this.arrowImageFile = 'green-arrow.gif'; + this.arrowImageFileRight = 'green-arrow-right.gif'; + this.tooltipWidth = 200; + this.tooltipBgColor = '#317082'; + this.closeMessage = 'Close'; + this.disableTooltipMessage = 'Don\'t show this message again'; + this.activeInput = false; + this.tooltipPosition = 'right'; + this.arrowRightWidth = 16; // Default width of arrow when the tooltip is on the right side of the inputs. + this.arrowTopHeight = 13; // Default height of arrow at the top of tooltip + this.tooltipCornerSize = 10; + this.displayArrow = true; + this.cookieName = 'DHTMLgoodies_tooltipVisibility'; + this.disableTooltipByCookie = false; + this.tooltipDisabled = false; + this.disableTooltipPossibility = true; + this.tooltipIframeObj = false; + this.pageBgColor = '#FFFFFF'; + + DHTMLgoodies_globalTooltipObj = this; + + if(navigator.userAgent.indexOf('MSIE')>=0)this.isMSIE = true; else this.isMSIE = false; +} + + +DHTMLgoodies_formTooltip.prototype = { + // {{{ initFormFieldTooltip() + /** + * + * + * Initializes the tooltip script. Most set methods needs to be executed before you call this method. + * + * @public + */ + initFormFieldTooltip : function() + { + var formElements = new Array(); + var inputs = document.getElementsByTagName('IMG'); + for(var no=0;no'); + this.tooltipIframeObj.style.position = 'absolute'; + this.tooltipIframeObj.style.top = '0px'; + this.tooltipIframeObj.style.left = '0px'; + this.tooltipIframeObj.style.width = (this.tooltipWidth) + 'px'; + this.tooltipIframeObj.style.zIndex = 100; + this.tooltipIframeObj.background = this.pageBgColor; + this.tooltipIframeObj.style.backgroundColor= this.pageBgColor; + this.tooltipDiv.appendChild(this.tooltipIframeObj); + if(this.tooltipPosition!='below' && this.displayArrow){ + this.tooltipIframeObj.style.left = (this.arrowRightWidth) + 'px'; + }else{ + this.tooltipIframeObj.style.top = this.arrowTopHeight + 'px'; + } + + setTimeout("self.frames['tooltipIframeObj'].document.documentElement.style.backgroundColor='" + this.pageBgColor + "'",500); + + } + + this.tooltipContentDiv = document.createElement('DIV'); + this.tooltipContentDiv.style.position = 'relative'; + this.tooltipContentDiv.id = 'DHTMLgoodies_formTooltipContent'; + outerDiv.appendChild(this.tooltipContentDiv); + + var closeDiv = document.createElement('DIV'); + closeDiv.style.textAlign = 'center'; + + closeDiv.innerHTML = '' + this.closeMessage + ''; + + if(this.disableTooltipPossibility){ + var tmpHTML = closeDiv.innerHTML; + tmpHTML = tmpHTML + ' | ' + this.disableTooltipMessage + ''; + closeDiv.innerHTML = tmpHTML; + } + + outerDiv.appendChild(closeDiv); + + document.body.appendChild(this.tooltipDiv); + + + + if(this.tooltipCornerSize>0){ + this.roundedCornerObj = new DHTMLgoodies_roundedCorners(); + // (divId,xRadius,yRadius,color,backgroundColor,padding,heightOfContent,whichCorners) + this.roundedCornerObj.addTarget('DHTMLgoodies_formTooltipDiv',this.tooltipCornerSize,this.tooltipCornerSize,this.tooltipBgColor,this.pageBgColor,5); + this.roundedCornerObj.init(); + } + + + this.tooltipContentDiv = document.getElementById('DHTMLgoodies_formTooltipContent'); + } + // }}} + , + addEvent : function(whichObject,eventType,functionName) + { + if(whichObject.attachEvent){ + whichObject['e'+eventType+functionName] = functionName; + whichObject[eventType+functionName] = function(){whichObject['e'+eventType+functionName]( window.event );} + whichObject.attachEvent( 'on'+eventType, whichObject[eventType+functionName] ); + } else + whichObject.addEventListener(eventType,functionName,false); + } + // }}} + , + __positionCurrentToolTipObj : function() + { + if(DHTMLgoodies_globalTooltipObj.activeInput)this.__positionTooltip(DHTMLgoodies_globalTooltipObj.activeInput); + + } + // }}} + , + // {{{ __positionTooltip() + /** + * + * + * This function positions the tooltip + * + * @param Obj inputObj = Reference to text input + * + * @private + */ + __positionTooltip : function(inputObj) + { + var offset = 0; + if(!this.displayArrow)offset = 3; + if(this.tooltipPosition=='below'){ + this.tooltipDiv.style.left = this.getLeftPos(inputObj)+ 'px'; + this.tooltipDiv.style.top = (this.getTopPos(inputObj) + inputObj.offsetHeight + offset) + 'px'; + }else{ + + this.tooltipDiv.style.left = (this.getLeftPos(inputObj) + inputObj.offsetWidth + offset)+ 'px'; + this.tooltipDiv.style.top = this.getTopPos(inputObj) + 'px'; + } + this.tooltipDiv.style.width=this.tooltipWidth + 'px'; + + } + , + // {{{ getTopPos() + /** + * This method will return the top coordinate(pixel) of an object + * + * @param Object inputObj = Reference to HTML element + * @public + */ + getTopPos : function(inputObj) + { + var returnValue = inputObj.offsetTop; + while((inputObj = inputObj.offsetParent) != null){ + if(inputObj.tagName!='HTML'){ + returnValue += inputObj.offsetTop; + if(document.all)returnValue+=inputObj.clientTop; + } + } + return returnValue; + } + // }}} + + , + // {{{ getLeftPos() + /** + * This method will return the left coordinate(pixel) of an object + * + * @param Object inputObj = Reference to HTML element + * @public + */ + getLeftPos : function(inputObj) + { + var returnValue = inputObj.offsetLeft; + while((inputObj = inputObj.offsetParent) != null){ + if(inputObj.tagName!='HTML'){ + returnValue += inputObj.offsetLeft; + if(document.all)returnValue+=inputObj.clientLeft; + } + } + return returnValue; + } + + , + + // {{{ getCookie() + /** + * + * These cookie functions are downloaded from + * http://www.mach5.com/support/analyzer/manual/html/General/CookiesJavaScript.htm + * + * This function returns the value of a cookie + * + * @param String name = Name of cookie + * @param Object inputObj = Reference to HTML element + * @public + */ + getCookie : function(name) { + var start = document.cookie.indexOf(name+"="); + var len = start+name.length+1; + if ((!start) && (name != document.cookie.substring(0,name.length))) return null; + if (start == -1) return null; + var end = document.cookie.indexOf(";",len); + if (end == -1) end = document.cookie.length; + return unescape(document.cookie.substring(len,end)); + } + // }}} + , + + // {{{ setCookie() + /** + * + * These cookie functions are downloaded from + * http://www.mach5.com/support/analyzer/manual/html/General/CookiesJavaScript.htm + * + * This function creates a cookie. (This method has been slighhtly modified) + * + * @param String name = Name of cookie + * @param String value = Value of cookie + * @param Int expires = Timestamp - days + * @param String path = Path for cookie (Usually left empty) + * @param String domain = Cookie domain + * @param Boolean secure = Secure cookie(SSL) + * + * @public + */ + setCookie : function(name,value,expires,path,domain,secure) { + expires = expires * 60*60*24*1000; + var today = new Date(); + var expires_date = new Date( today.getTime() + (expires) ); + var cookieString = name + "=" +escape(value) + + ( (expires) ? ";expires=" + expires_date.toGMTString() : "") + + ( (path) ? ";path=" + path : "") + + ( (domain) ? ";domain=" + domain : "") + + ( (secure) ? ";secure" : ""); + document.cookie = cookieString; + } + // }}} + + +} \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/gmap.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/gmap.js new file mode 100644 index 0000000..ba214f6 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/gmap.js @@ -0,0 +1,634 @@ +var map; +var popupTable; +var networkOverlay; +var selectedNetworkOverlay; +var flashTimeout; +//var infoDiv; +var mainInfoDiv; +var locationInfoDiv; +var loadingAnimationDiv; +var geocoder; +var addressMarker; +var popupDiv; +//var novaButton; + +function novaMapInit() { + if (GBrowserIsCompatible()) { + var dmap = document.getElementById("map"); + map = new GMap2(dmap); + var defaultCenterLongitude = document.getElementById("defaultCenterLongitude").value; + var defaultCenterLatitude = document.getElementById("defaultCenterLatitude").value; + var defaultZoomLevel = document.getElementById("defaultZoomLevel").value * 1; + + map.setCenter(new GLatLng(defaultCenterLatitude, defaultCenterLongitude), defaultZoomLevel); + + map.enableScrollWheelZoom(); + map.enableContinuousZoom(); + map.addControl(new GLargeMapControl()); + map.addControl(new GMapTypeControl()); + + geocoder = new GClientGeocoder(); + + GEvent.addListener(map, "dragend", mapDragEnd); + GEvent.addListener(map, "zoomend", mapZoomChanged); + GEvent.addListener(map, "click", mapClicked); + GEvent.addListener(map, "moveend", mapMoveEnd) + GEvent.addListener(map, "singlerightclick", mapRightClicked); + GEvent.addListener(map, "mousemove", function(latlng) { + locationInfoDiv.innerHTML = latlng.lng().toFixed(3) + ", " + latlng.lat().toFixed(3); + }); + + var n = document.getElementById("popupmenudiv2"); + popupDiv = n.cloneNode(true); + map.getContainer().appendChild(popupDiv); + + popupTable = document.getElementById("popupmenudivtb"); + + // detail info div + /*infoDiv = document.createElement("div"); + infoDiv.style.display = "none"; + infoDiv.style.position = "absolute"; + infoDiv.style.overflow = "auto"; + infoDiv.style.top = "0px"; + infoDiv.style.left = "0px"; + infoDiv.style.zIndex = "1001"; + infoDiv.style.border = "1px outset #000"; + infoDiv.style.background = "#C6DEFF"; + infoDiv.style.height = "150px"; + infoDiv.style.width = "300px"; + infoDiv.align = "center";*/ + + mainInfoDiv = document.createElement("div"); + mainInfoDiv.style.display = "none"; + mainInfoDiv.style.position = "absolute"; + mainInfoDiv.style.overflow = "auto"; + mainInfoDiv.style.top = "0px"; + mainInfoDiv.style.left = "0px"; + mainInfoDiv.style.zIndex = "1001"; + mainInfoDiv.style.border = "1px outset #000"; + mainInfoDiv.style.background = "#C6DEFF"; + mainInfoDiv.style.height = "150px"; + mainInfoDiv.style.width = "300px"; + mainInfoDiv.align = "center"; + + //mainInfoDiv = infoDiv.appendChild(document.createElement("div")); + mainInfoDiv.style.overflow = "auto"; + mainInfoDiv.style.height = "150px"; + mainInfoDiv.style.width = "300px"; + //mainInfoDiv.align = "center"; + + /*var closeInfoDiv = infoDiv.appendChild(document.createElement("div")); + closeInfoDiv.appendChild(document.createTextNode("Close")); + + closeInfoDiv.style.background = "#FFFFF0"; + closeInfoDiv.style.color = "black"; + closeInfoDiv.style.fontFamily = "Verdana"; + closeInfoDiv.style.fontSize = "12px"; + closeInfoDiv.style.fontWeight= "bold"; + closeInfoDiv.style.border = "2px solid black"; + closeInfoDiv.style.padding = "0px"; + closeInfoDiv.style.marginBottom = "0px"; + closeInfoDiv.style.textAlign = "center"; + closeInfoDiv.style.width = "80px"; + closeInfoDiv.style.height = "15px"; + closeInfoDiv.style.cursor = "pointer"; + + GEvent.addDomListener(closeInfoDiv, "click", function() { + infoDiv.style.display = "none"; + }); */ + + // longitude latitude div + var locationInfoWidth = 200; + var locationInfoHeight = 15; + locationInfoDiv = document.createElement("div"); + locationInfoDiv.style.display = "inline"; + locationInfoDiv.style.position = "absolute"; + locationInfoDiv.style.zIndex = "1"; + locationInfoDiv.style.height = locationInfoHeight + "px"; + locationInfoDiv.style.width = locationInfoWidth + "px"; + locationInfoDiv.align = "center"; + locationInfoDiv.style.color = "#4CC417"; + locationInfoDiv.style.fontWeight = "bold"; + locationInfoDiv.appendChild(document.createTextNode("Longitude Latitude")); + + var mapWidth = map.getSize().width; + var mapHeight = map.getSize().height; + + locationInfoDiv.style.top = (mapHeight - locationInfoHeight - 5) + "px"; + locationInfoDiv.style.left = (mapWidth / 2 - locationInfoWidth / 2) + "px"; + + // loading image animation + loadingAnimationDiv = document.createElement("div"); + loadingAnimationDiv.style.position = "absolute"; + loadingAnimationDiv.style.zIndex = "100000"; + loadingAnimationDiv.style.display = "none"; + loadingAnimationDiv.style.width = "50px"; + loadingAnimationDiv.style.height = "50px"; + loadingAnimationDiv.style.top = (mapHeight / 2 - 50 / 2) + "px"; + loadingAnimationDiv.style.left = (mapWidth / 2 - 50 / 2) + "px"; + var imgDiv = loadingAnimationDiv.appendChild(document.createElement("img")); + imgDiv.src = document.getElementById("imgFolder").value + "loading.gif"; + + + //map.getContainer().appendChild(infoDiv); + map.getContainer().appendChild(mainInfoDiv); + map.getContainer().appendChild(locationInfoDiv); + map.getContainer().appendChild(loadingAnimationDiv); + updateImage(0); + } +} + +function mapRightClicked(point, src) { + var latlng = map.fromContainerPixelToLatLng(new GPoint(point.x , point.y)); + alert(latlng.lng() + ", " + latlng.lat()); +} +/* +function searchObject(searchInput, searchType, exactMatch, clickX, clickY) { + loadingAnimationDiv.style.display = "inline"; + var baseURL = document.getElementById("baseURL").value; + //var url = baseURL + "/gmap_controller.htm?action=searchObject"; + //var url = baseURL + "report.gmap.search_object"; + var url = baseURL + "/gmapservlet?action=searchObject&nextpage=report.gmap.search_object"; + url += "&search_input=" + searchInput; + url += "&search_type=" + searchType; + url += "&exact_match=" + exactMatch; + url += "&object_type=CELLSITE"; + + if (clickX == null || clickY == null) { + var mapWidth = map.getSize().width; + var mapHeight = map.getSize().height; + clickX = mapWidth / 2; + clickY = mapHeight / 2; + } + + url += "&client_x=" + clickX; + url += "&client_y=" + clickY; + + new Ajax.Request(url, { + method: 'get', + onSuccess: function(transport) { + loadingAnimationDiv.style.display = "none"; + var jsonData = transport.responseText.evalJSON(); + var list = jsonData.list; + + if (list == null) { + alert("Not found"); + } + else { + if (list.length == 1) { + var longitude = list[0].longitude; + var latitude = list[0].latitude; + map.setCenter(new GLatLng(latitude, longitude)); + updateImage(0); + } + else { + for (var i = popupTable.childNodes.length - 1; i >= 0; i--) { + popupTable.removeChild(popupTable.lastChild); + } + + for (var i = 0; i < list.length; i++) { + var tr = popupTable.appendChild(document.createElement("tr")); + var td = tr.appendChild(document.createElement("td")); + td.appendChild(document.createTextNode(list[i].type + "(" + list[i].numberOfT1 + + "): " + list[i].id)); + td.style.border = "solid"; + td.style.borderWidth = "thin"; + td.style.borderRight = "none"; + td.style.borderLeft = "none"; + + if (i == 0) { + td.style.borderTop = "none"; + } + + if (i == list.length - 1) { + td.style.borderBottom = "none"; + } + + td.style.color = "#0000FF"; + td.style.background = "#FFFFF0"; + td.style.fontSize = "12px"; + td.font = "Arial,Helvetica,sans-serif"; + td.id = list[i].latitude + ">>" + list[i].longitude; + + td.onmouseover = function(e) { + this.style.background = "#0000FF"; + this.style.color = "#FFFFF0"; + } + + td.onmouseout = function(e) { + this.style.background = "#FFFFF0"; + this.style.color = "#0000FF"; + } + + td.onclick = function(e) { + //var popupDiv = document.getElementById("popupmenudiv"); + popupDiv.style.display = "none"; + var latitudeLongitude = this.id.split(">>"); + var latlng = new GLatLng(latitudeLongitude[0], latitudeLongitude[1]); + map.setCenter(latlng); + updateImage(0); + } + } + + //var popupDiv = document.getElementById("popupmenudiv"); + popupDiv.style.display = ""; + + var textWidth = popupDiv.offsetWidth; + var textHeight = popupDiv.offsetHeight; + + if (textHeight >= 200) { + popupDiv.style.overflow = "auto"; + popupDiv.style.height = "200px"; + textHeight = 200; + } + + if (textWidth >= 250) { + popupDiv.style.width = "250px"; + //textWidth = 250; + } + + var clientX = jsonData.clientX; + var clientY = jsonData.clientY; + + if ((clientX * 1 + textWidth + 20) >= screen.availWidth) { + clientX = clientX - textWidth - 20; + } + + if ((clientY * 1 + textHeight) >= document.getElementById("map").offsetHeight) { + clientY = document.getElementById("map").offsetHeight - textHeight; + + } + + popupDiv.style.top = clientY + "px"; + popupDiv.style.left = clientX + "px"; + } + } + } + }); +} +*/ +function getInfo(info, x, y) { + var baseURL = document.getElementById("baseURL").value; + //var url = baseURL + "/gmap_controller.htm?action=getInfo"; + //var url = baseURL + "report.gmap.get_info"; + var url = baseURL + "/gmapservlet?action=getInfo&nextpage=report.gmap.get_info"; + url += "&info=" + info; + url += "&client_x=" + x; + url += "&client_y=" + y; + + new Ajax.Request(url, { + method: 'get', + onSuccess: function(transport) { + var jsonData = transport.responseText.evalJSON(); + var clientX = jsonData.clientX; + var clientY = jsonData.clientY; + var attributes = jsonData.attributes; + + for (var i = mainInfoDiv.childNodes.length - 1; i >= 0; i--) { + mainInfoDiv.removeChild(mainInfoDiv.lastChild); + } + + mainInfoDiv.align="left"; + var menuUL = mainInfoDiv.appendChild(document.createElement("ul")); + var menuItem = document.createElement("li"); + menuItem.appendChild(document.createTextNode("Row : " + jsonData.id)); + menuUL.appendChild(menuItem); + + menuItem = document.createElement("li"); + menuItem.appendChild(document.createTextNode("Longitude: " + jsonData.longitude)); + menuUL.appendChild(menuItem); + + menuItem = document.createElement("li"); + menuItem.appendChild(document.createTextNode("Latitude: " + jsonData.latitude)); + menuUL.appendChild(menuItem); + + var table = mainInfoDiv.appendChild(document.createElement("table")); + table.width="100%"; + table.align="left"; + var tbody = table.appendChild(document.createElement("tbody")); + //tbody.style.borderCollapse = "collapse"; + //var tr = tbody.appendChild(document.createElement("tr")); + var td; + for (var i = 0; i < attributes.length ; i++) { + tr = tbody.appendChild(document.createElement("tr")); + td = tr.appendChild(document.createElement("td")); + td.align="left"; + td.width="25%" + td.style.padding = "2px"; + td.appendChild(document.createTextNode(attributes[i].key)); + td = tr.appendChild(document.createElement("td")); + td.style.padding = "2px"; + td.appendChild(document.createTextNode(attributes[i].value)); + } + + var textWidth = 300; + var textHeight = 150 + 15; + + if ((clientX * 1 + textWidth + 20) >= screen.availWidth) { + clientX = clientX - textWidth - 20; + } + + if ((clientY * 1 + textHeight) >= document.getElementById("map").offsetHeight) { + clientY = document.getElementById("map").offsetHeight - textHeight; + } + + mainInfoDiv.style.top = clientY + "px"; + mainInfoDiv.style.left = clientX + "px"; + mainInfoDiv.style.display = "inline"; + } + }); +} + +function mapClicked(overlay, latlng, overlaylatlng) { + var baseURL = document.getElementById("baseURL").value; + //var url = baseURL + "/gmap_controller.htm?action=singleLeftClick"; + //var url = baseURL + "report.gmap.single_left_click"; + var url = baseURL + "/gmapservlet?action=singleLeftClick&nextpage=report.gmap.single_left_click"; + var mapSize = map.getSize(); + var mapBounds = map.getBounds(); + var pointSW = mapBounds.getSouthWest(); + var pointNE = mapBounds.getNorthEast(); + url += "&click_longitude=" + latlng.lng(); + url += "&click_latitude=" + latlng.lat(); + url += "&zoom_level=" + map.getZoom(); + url += "&map_size=" + mapSize.width + "," + mapSize.height; + url += "&map_bounds=" + pointSW.lng() + "," + pointSW.lat() + "," + pointNE.lng() + "," + pointNE.lat(); + var point = map.fromLatLngToContainerPixel(latlng); + var clickX = point.x; + var clickY = point.y; + url += "&client_x=" + clickX; + url += "&client_y=" + clickY; + + //document.getElementById("popupmenudiv").style.display = "none"; + popupDiv.style.display="none"; + mainInfoDiv.style.display="none"; + new Ajax.Request(url, { + method: 'get', + onSuccess: function(transport) { + var jsonData = transport.responseText.evalJSON(); + var list = jsonData.list; + var selectedImageURL = jsonData.selectedImageURL; + var legendImageURL = jsonData.legendImageURL; + //alert(legendImageURL); + if (legendImageURL != null) { + repaintLegend(legendImageURL); + } + + if (list != null) { + for (var i = popupTable.childNodes.length - 1; i >= 0; i--) { + popupTable.removeChild(popupTable.lastChild); + } + + for (var i = 0; i < list.length; i++) { + var tr = popupTable.appendChild(document.createElement("tr")); + var td = tr.appendChild(document.createElement("td")); + td.appendChild(document.createTextNode("Row : " + list[i].id)); + td.style.border = "solid"; + td.style.borderWidth = "thin"; + td.style.borderRight = "none"; + td.style.borderLeft = "none"; + + if (i == 0) { + td.style.borderTop = "none"; + } + + if (i == list.length - 1) { + td.style.borderBottom = "none"; + } + + td.style.color = "#0000FF"; + td.style.background = "#FFFFF0"; + td.style.fontSize = "12px"; + td.font = "Arial,Helvetica,sans-serif"; + td.id = jsonData.type + ">>" + list[i].id + ">>" + list[i].type; + + td.onmouseover = function(e) { + this.style.background = "#0000FF"; + this.style.color = "#FFFFF0"; + } + + td.onmouseout = function(e) { + this.style.background = "#FFFFF0"; + this.style.color = "#0000FF"; + } + + td.onclick = function(e) { + //var popupDiv = document.getElementById("popupmenudiv"); + getInfo(this.id, clickX, clickY); + + popupDiv.style.display = "none"; + } + } + + //var popupDiv = document.getElementById("popupmenudiv"); + popupDiv.style.display = ""; + + var textWidth = popupDiv.offsetWidth; + var textHeight = popupDiv.offsetHeight; + + if (textHeight >= 200) { + popupDiv.style.overflow = "auto"; + popupDiv.style.height = "200px"; + textHeight = 200; + } + + if (textWidth >= 250) { + popupDiv.style.width = "250px"; + //textWidth = 250; + } + + var clientX = jsonData.clientX; + var clientY = jsonData.clientY; + + if ((clientX * 1 + textWidth + 20) >= screen.availWidth) { + clientX = clientX - textWidth - 20; + } + + if ((clientY * 1 + textHeight) >= document.getElementById("map").offsetHeight) { + clientY = document.getElementById("map").offsetHeight - textHeight; + + } + + popupDiv.style.top = clientY + "px"; + popupDiv.style.left = clientX + "px"; + } + else if (selectedImageURL != null) { + repaintSelected(selectedImageURL); + } + } + }); +} + +//new changes + +function mapMoveEnd() { + if (networkOverlay != null) { + map.removeOverlay(networkOverlay); + networkOverlay = null; + } + + + updateImage(0); +} + +function mapDragEnd() { +} + +function mapZoomChanged(oldZoomLevel, newZoomLevel) { +} +/* +function updateSelectedImage() { + var baseURL = document.getElementById("baseURL").value; + var url = baseURL + "/gmap_controller.htm?action=nova.gmap.fetch.selected.image"; + var mapSize = map.getSize(); + var mapBounds = map.getBounds(); + var pointSW = mapBounds.getSouthWest(); + var pointNE = mapBounds.getNorthEast(); + url += "&zoomLevel=" + map.getZoom(); + url += "&mapSize=" + mapSize.width + "," + mapSize.height; + url += "&mapBounds=" + pointSW.lng() + "," + pointSW.lat() + "," + pointNE.lng() + "," + pointNE.lat(); + + new Ajax.Request(url, { + method: 'get', + asynchronous: false, + onSuccess: function(transport) { + var url = transport.responseXML.getElementsByTagName("image-url")[0].childNodes[0].nodeValue; + + if (url != null) { + repaintSelected(url); + } + } + }); +} +*/ + +function updateImage(incDecValue) { + //alert(); + loadingAnimationDiv.style.display = "inline"; + var baseURL = document.getElementById("baseURL").value; + //var url = baseURL + "/gmap_controller.htm?action=getImage"; + //var url = baseURL + "report.gmap.get_image"; + var url = baseURL + "/gmapservlet?action=getImage&nextpage=report.gmap.get_image"; + var mapSize = map.getSize(); + var mapBounds = map.getBounds(); + var pointSW = mapBounds.getSouthWest(); + var pointNE = mapBounds.getNorthEast(); + url += "&zoom_level=" + map.getZoom(); + url += "&map_size=" + mapSize.width + "," + mapSize.height; + url += "&map_bounds=" + pointSW.lng() + "," + pointSW.lat() + "," + pointNE.lng() + "," + pointNE.lat(); + url += "&increment_decrement_value=" + incDecValue; + url += "&selected_layer_list=" + document.getElementById("selectedLayerList").value; + url += "&color_list=" + document.getElementById("colorList").value; + var randomNumber = Math.floor(Math.random() * 5000000) + url += "&dummy=" + randomNumber; + + //disableUserInput(); + new Ajax.Request(url, { + method: 'get', + onSuccess: function(transport) { + + loadingAnimationDiv.style.display = "none"; + var jsonData = transport.responseText.evalJSON(); + var imageURL = jsonData.imageURL; + var legendImageURL = jsonData.legendImageURL; + var selectedImageURL = jsonData.selectedImageURL; + var currentMonth = jsonData.currentMonth; + var colorList = jsonData.colorList; + var selectedLayerList = jsonData.selectedLayerList; + + if (legendImageURL != null) { + repaintLegend(legendImageURL); + } + if (imageURL != null) { + repaint(imageURL); + } + + if (selectedImageURL != null) { + repaintSelected(selectedImageURL); + } + + if (currentMonth != null) { + document.getElementById("currentMonthDiv").innerHTML = currentMonth; + } + + if (colorList != null) { + document.getElementById("colorList").value = colorList; + document.getElementById("selectedLayerList").value = selectedLayerList; + NovaButton.prototype.initializeLayerDiv(NovaButton.globals.layerOptionContainer); + } + + + } + }); +} + + function repaintLegend(url) { + var mapLegend = document.getElementById("mapLegend"); + var legendImg = document.getElementById("legendImg"); + + mapLegend.removeChild(legendImg); + var newpic=document.createElement('img'); + newpic.src=url; + newpic.id="legendImg"; + //alert(url); + mapLegend.appendChild(newpic); + + } + + +function repaint(url) { + if (networkOverlay != null) { + map.removeOverlay(networkOverlay); + } + + networkOverlay = new ProjectedOverlay(url, map.getBounds()) ; + map.addOverlay(networkOverlay); +} + +function repaintSelected(url) { + var mapBounds = map.getBounds(); + var pointSW = mapBounds.getSouthWest(); + var pointNE = mapBounds.getNorthEast(); + + if (selectedNetworkOverlay != null) { + map.removeOverlay(selectedNetworkOverlay); + } + + selectedNetworkOverlay = new GGroundOverlay(url, new GLatLngBounds(pointSW, pointNE)) ; + map.addOverlay(selectedNetworkOverlay); + + if (flashTimeout != null) { + clearTimeout(flashTimeout); + } + + flashImage(); +} + +function flashImage() { + if (selectedNetworkOverlay.isHidden()) { + selectedNetworkOverlay.show(); + } + else { + selectedNetworkOverlay.hide(); + } + + flashTimeout = setTimeout(flashImage, 500); +} + +function disableUserInput() { + map.disableDragging(); + map.disableDoubleClickZoom(); + map.disableScrollWheelZoom(); + map.disableContinuousZoom(); +} + +function enableUserInput() { + map.enableDragging(); + map.enableDoubleClickZoom(); + map.enableScrollWheelZoom(); + map.enableContinuousZoom(); +} + +String.prototype.trim = function() { + return this.replace(/^\s+|\s+$/g, ""); +} \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/jquery.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/jquery.js new file mode 100644 index 0000000..462cde5 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/js/jquery.js @@ -0,0 +1,4376 @@ +/*! + * jQuery JavaScript Library v1.3.2 + * http://jquery.com/ + * + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(function(){ + +var + // Will speed up references to window, and allows munging its name. + window = this, + // Will speed up references to undefined, and allows munging its name. + undefined, + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + // Map over the $ in case of overwrite + _$ = window.$, + + jQuery = window.jQuery = window.$ = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context ); + }, + + // A simple way to check for HTML strings or ID strings + // (both of which we optimize for) + quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, + // Is it a simple selector + isSimple = /^.[^:#\[\.,]*$/; + +jQuery.fn = jQuery.prototype = { + init: function( selector, context ) { + // Make sure that a selection was provided + selector = selector || document; + + // Handle $(DOMElement) + if ( selector.nodeType ) { + this[0] = selector; + this.length = 1; + this.context = selector; + return this; + } + // Handle HTML strings + if ( typeof selector === "string" ) { + // Are we dealing with HTML string or an ID? + var match = quickExpr.exec( selector ); + + // Verify a match, and that no context was specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) + selector = jQuery.clean( [ match[1] ], context ); + + // HANDLE: $("#id") + else { + var elem = document.getElementById( match[3] ); + + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem && elem.id != match[3] ) + return jQuery().find( selector ); + + // Otherwise, we inject the element directly into the jQuery object + var ret = jQuery( elem || [] ); + ret.context = document; + ret.selector = selector; + return ret; + } + + // HANDLE: $(expr, [context]) + // (which is just equivalent to: $(content).find(expr) + } else + return jQuery( context ).find( selector ); + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) + return jQuery( document ).ready( selector ); + + // Make sure that old selector state is passed along + if ( selector.selector && selector.context ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return this.setArray(jQuery.isArray( selector ) ? + selector : + jQuery.makeArray(selector)); + }, + + // Start with an empty selector + selector: "", + + // The current version of jQuery being used + jquery: "1.3.2", + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num === undefined ? + + // Return a 'clean' array + Array.prototype.slice.call( this ) : + + // Return just the object + this[ num ]; + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems, name, selector ) { + // Build a new jQuery matched element set + var ret = jQuery( elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + ret.context = this.context; + + if ( name === "find" ) + ret.selector = this.selector + (this.selector ? " " : "") + selector; + else if ( name ) + ret.selector = this.selector + "." + name + "(" + selector + ")"; + + // Return the newly-formed element set + return ret; + }, + + // Force the current matched set of elements to become + // the specified array of elements (destroying the stack in the process) + // You should use pushStack() in order to do this, but maintain the stack + setArray: function( elems ) { + // Resetting the length to 0, then using the native Array push + // is a super-fast way to populate an object with array-like properties + this.length = 0; + Array.prototype.push.apply( this, elems ); + + return this; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem && elem.jquery ? elem[0] : elem + , this ); + }, + + attr: function( name, value, type ) { + var options = name; + + // Look for the case where we're accessing a style value + if ( typeof name === "string" ) + if ( value === undefined ) + return this[0] && jQuery[ type || "attr" ]( this[0], name ); + + else { + options = {}; + options[ name ] = value; + } + + // Check to see if we're setting style values + return this.each(function(i){ + // Set all the styles + for ( name in options ) + jQuery.attr( + type ? + this.style : + this, + name, jQuery.prop( this, options[ name ], type, i, name ) + ); + }); + }, + + css: function( key, value ) { + // ignore negative width and height values + if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) + value = undefined; + return this.attr( key, value, "curCSS" ); + }, + + text: function( text ) { + if ( typeof text !== "object" && text != null ) + return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); + + var ret = ""; + + jQuery.each( text || this, function(){ + jQuery.each( this.childNodes, function(){ + if ( this.nodeType != 8 ) + ret += this.nodeType != 1 ? + this.nodeValue : + jQuery.fn.text( [ this ] ); + }); + }); + + return ret; + }, + + wrapAll: function( html ) { + if ( this[0] ) { + // The elements to wrap the target around + var wrap = jQuery( html, this[0].ownerDocument ).clone(); + + if ( this[0].parentNode ) + wrap.insertBefore( this[0] ); + + wrap.map(function(){ + var elem = this; + + while ( elem.firstChild ) + elem = elem.firstChild; + + return elem; + }).append(this); + } + + return this; + }, + + wrapInner: function( html ) { + return this.each(function(){ + jQuery( this ).contents().wrapAll( html ); + }); + }, + + wrap: function( html ) { + return this.each(function(){ + jQuery( this ).wrapAll( html ); + }); + }, + + append: function() { + return this.domManip(arguments, true, function(elem){ + if (this.nodeType == 1) + this.appendChild( elem ); + }); + }, + + prepend: function() { + return this.domManip(arguments, true, function(elem){ + if (this.nodeType == 1) + this.insertBefore( elem, this.firstChild ); + }); + }, + + before: function() { + return this.domManip(arguments, false, function(elem){ + this.parentNode.insertBefore( elem, this ); + }); + }, + + after: function() { + return this.domManip(arguments, false, function(elem){ + this.parentNode.insertBefore( elem, this.nextSibling ); + }); + }, + + end: function() { + return this.prevObject || jQuery( [] ); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: [].push, + sort: [].sort, + splice: [].splice, + + find: function( selector ) { + if ( this.length === 1 ) { + var ret = this.pushStack( [], "find", selector ); + ret.length = 0; + jQuery.find( selector, this[0], ret ); + return ret; + } else { + return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){ + return jQuery.find( selector, elem ); + })), "find", selector ); + } + }, + + clone: function( events ) { + // Do the clone + var ret = this.map(function(){ + if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { + // IE copies events bound via attachEvent when + // using cloneNode. Calling detachEvent on the + // clone will also remove the events from the orignal + // In order to get around this, we use innerHTML. + // Unfortunately, this means some modifications to + // attributes in IE that are actually only stored + // as properties will not be copied (such as the + // the name attribute on an input). + var html = this.outerHTML; + if ( !html ) { + var div = this.ownerDocument.createElement("div"); + div.appendChild( this.cloneNode(true) ); + html = div.innerHTML; + } + + return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0]; + } else + return this.cloneNode(true); + }); + + // Copy the events from the original to the clone + if ( events === true ) { + var orig = this.find("*").andSelf(), i = 0; + + ret.find("*").andSelf().each(function(){ + if ( this.nodeName !== orig[i].nodeName ) + return; + + var events = jQuery.data( orig[i], "events" ); + + for ( var type in events ) { + for ( var handler in events[ type ] ) { + jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); + } + } + + i++; + }); + } + + // Return the cloned set + return ret; + }, + + filter: function( selector ) { + return this.pushStack( + jQuery.isFunction( selector ) && + jQuery.grep(this, function(elem, i){ + return selector.call( elem, i ); + }) || + + jQuery.multiFilter( selector, jQuery.grep(this, function(elem){ + return elem.nodeType === 1; + }) ), "filter", selector ); + }, + + closest: function( selector ) { + var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null, + closer = 0; + + return this.map(function(){ + var cur = this; + while ( cur && cur.ownerDocument ) { + if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) { + jQuery.data(cur, "closest", closer); + return cur; + } + cur = cur.parentNode; + closer++; + } + }); + }, + + not: function( selector ) { + if ( typeof selector === "string" ) + // test special case where just one selector is passed in + if ( isSimple.test( selector ) ) + return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector ); + else + selector = jQuery.multiFilter( selector, this ); + + var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; + return this.filter(function() { + return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; + }); + }, + + add: function( selector ) { + return this.pushStack( jQuery.unique( jQuery.merge( + this.get(), + typeof selector === "string" ? + jQuery( selector ) : + jQuery.makeArray( selector ) + ))); + }, + + is: function( selector ) { + return !!selector && jQuery.multiFilter( selector, this ).length > 0; + }, + + hasClass: function( selector ) { + return !!selector && this.is( "." + selector ); + }, + + val: function( value ) { + if ( value === undefined ) { + var elem = this[0]; + + if ( elem ) { + if( jQuery.nodeName( elem, 'option' ) ) + return (elem.attributes.value || {}).specified ? elem.value : elem.text; + + // We need to handle select boxes special + if ( jQuery.nodeName( elem, "select" ) ) { + var index = elem.selectedIndex, + values = [], + options = elem.options, + one = elem.type == "select-one"; + + // Nothing was selected + if ( index < 0 ) + return null; + + // Loop through all the selected options + for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { + var option = options[ i ]; + + if ( option.selected ) { + // Get the specifc value for the option + value = jQuery(option).val(); + + // We don't need an array for one selects + if ( one ) + return value; + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + } + + // Everything else, we just grab the value + return (elem.value || "").replace(/\r/g, ""); + + } + + return undefined; + } + + if ( typeof value === "number" ) + value += ''; + + return this.each(function(){ + if ( this.nodeType != 1 ) + return; + + if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) ) + this.checked = (jQuery.inArray(this.value, value) >= 0 || + jQuery.inArray(this.name, value) >= 0); + + else if ( jQuery.nodeName( this, "select" ) ) { + var values = jQuery.makeArray(value); + + jQuery( "option", this ).each(function(){ + this.selected = (jQuery.inArray( this.value, values ) >= 0 || + jQuery.inArray( this.text, values ) >= 0); + }); + + if ( !values.length ) + this.selectedIndex = -1; + + } else + this.value = value; + }); + }, + + html: function( value ) { + return value === undefined ? + (this[0] ? + this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") : + null) : + this.empty().append( value ); + }, + + replaceWith: function( value ) { + return this.after( value ).remove(); + }, + + eq: function( i ) { + return this.slice( i, +i + 1 ); + }, + + slice: function() { + return this.pushStack( Array.prototype.slice.apply( this, arguments ), + "slice", Array.prototype.slice.call(arguments).join(",") ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function(elem, i){ + return callback.call( elem, i, elem ); + })); + }, + + andSelf: function() { + return this.add( this.prevObject ); + }, + + domManip: function( args, table, callback ) { + if ( this[0] ) { + var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(), + scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ), + first = fragment.firstChild; + + if ( first ) + for ( var i = 0, l = this.length; i < l; i++ ) + callback.call( root(this[i], first), this.length > 1 || i > 0 ? + fragment.cloneNode(true) : fragment ); + + if ( scripts ) + jQuery.each( scripts, evalScript ); + } + + return this; + + function root( elem, cur ) { + return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ? + (elem.getElementsByTagName("tbody")[0] || + elem.appendChild(elem.ownerDocument.createElement("tbody"))) : + elem; + } + } +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +function evalScript( i, elem ) { + if ( elem.src ) + jQuery.ajax({ + url: elem.src, + async: false, + dataType: "script" + }); + + else + jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); + + if ( elem.parentNode ) + elem.parentNode.removeChild( elem ); +} + +function now(){ + return +new Date; +} + +jQuery.extend = jQuery.fn.extend = function() { + // copy reference to target object + var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) + target = {}; + + // extend jQuery itself if only one argument is passed + if ( length == i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) + // Extend the base object + for ( var name in options ) { + var src = target[ name ], copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) + continue; + + // Recurse if we're merging object values + if ( deep && copy && typeof copy === "object" && !copy.nodeType ) + target[ name ] = jQuery.extend( deep, + // Never move original objects, clone them + src || ( copy.length != null ? [ ] : { } ) + , copy ); + + // Don't bring in undefined values + else if ( copy !== undefined ) + target[ name ] = copy; + + } + + // Return the modified object + return target; +}; + +// exclude the following css properties to add px +var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, + // cache defaultView + defaultView = document.defaultView || {}, + toString = Object.prototype.toString; + +jQuery.extend({ + noConflict: function( deep ) { + window.$ = _$; + + if ( deep ) + window.jQuery = _jQuery; + + return jQuery; + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return toString.call(obj) === "[object Function]"; + }, + + isArray: function( obj ) { + return toString.call(obj) === "[object Array]"; + }, + + // check if an element is in a (or is an) XML document + isXMLDoc: function( elem ) { + return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || + !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument ); + }, + + // Evalulates a script in a global context + globalEval: function( data ) { + if ( data && /\S/.test(data) ) { + // Inspired by code by Andrea Giammarchi + // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html + var head = document.getElementsByTagName("head")[0] || document.documentElement, + script = document.createElement("script"); + + script.type = "text/javascript"; + if ( jQuery.support.scriptEval ) + script.appendChild( document.createTextNode( data ) ); + else + script.text = data; + + // Use insertBefore instead of appendChild to circumvent an IE6 bug. + // This arises when a base node is used (#2709). + head.insertBefore( script, head.firstChild ); + head.removeChild( script ); + } + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); + }, + + // args is for internal usage only + each: function( object, callback, args ) { + var name, i = 0, length = object.length; + + if ( args ) { + if ( length === undefined ) { + for ( name in object ) + if ( callback.apply( object[ name ], args ) === false ) + break; + } else + for ( ; i < length; ) + if ( callback.apply( object[ i++ ], args ) === false ) + break; + + // A special, fast, case for the most common use of each + } else { + if ( length === undefined ) { + for ( name in object ) + if ( callback.call( object[ name ], name, object[ name ] ) === false ) + break; + } else + for ( var value = object[0]; + i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} + } + + return object; + }, + + prop: function( elem, value, type, i, name ) { + // Handle executable functions + if ( jQuery.isFunction( value ) ) + value = value.call( elem, i ); + + // Handle passing in a number to a CSS property + return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ? + value + "px" : + value; + }, + + className: { + // internal only, use addClass("class") + add: function( elem, classNames ) { + jQuery.each((classNames || "").split(/\s+/), function(i, className){ + if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) + elem.className += (elem.className ? " " : "") + className; + }); + }, + + // internal only, use removeClass("class") + remove: function( elem, classNames ) { + if (elem.nodeType == 1) + elem.className = classNames !== undefined ? + jQuery.grep(elem.className.split(/\s+/), function(className){ + return !jQuery.className.has( classNames, className ); + }).join(" ") : + ""; + }, + + // internal only, use hasClass("class") + has: function( elem, className ) { + return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; + } + }, + + // A method for quickly swapping in/out CSS properties to get correct calculations + swap: function( elem, options, callback ) { + var old = {}; + // Remember the old values, and insert the new ones + for ( var name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + callback.call( elem ); + + // Revert the old values + for ( var name in options ) + elem.style[ name ] = old[ name ]; + }, + + css: function( elem, name, force, extra ) { + if ( name == "width" || name == "height" ) { + var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; + + function getWH() { + val = name == "width" ? elem.offsetWidth : elem.offsetHeight; + + if ( extra === "border" ) + return; + + jQuery.each( which, function() { + if ( !extra ) + val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; + if ( extra === "margin" ) + val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0; + else + val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; + }); + } + + if ( elem.offsetWidth !== 0 ) + getWH(); + else + jQuery.swap( elem, props, getWH ); + + return Math.max(0, Math.round(val)); + } + + return jQuery.curCSS( elem, name, force ); + }, + + curCSS: function( elem, name, force ) { + var ret, style = elem.style; + + // We need to handle opacity special in IE + if ( name == "opacity" && !jQuery.support.opacity ) { + ret = jQuery.attr( style, "opacity" ); + + return ret == "" ? + "1" : + ret; + } + + // Make sure we're using the right name for getting the float value + if ( name.match( /float/i ) ) + name = styleFloat; + + if ( !force && style && style[ name ] ) + ret = style[ name ]; + + else if ( defaultView.getComputedStyle ) { + + // Only "float" is needed here + if ( name.match( /float/i ) ) + name = "float"; + + name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); + + var computedStyle = defaultView.getComputedStyle( elem, null ); + + if ( computedStyle ) + ret = computedStyle.getPropertyValue( name ); + + // We should always get a number back from opacity + if ( name == "opacity" && ret == "" ) + ret = "1"; + + } else if ( elem.currentStyle ) { + var camelCase = name.replace(/\-(\w)/g, function(all, letter){ + return letter.toUpperCase(); + }); + + ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { + // Remember the original values + var left = style.left, rsLeft = elem.runtimeStyle.left; + + // Put in the new values to get a computed value out + elem.runtimeStyle.left = elem.currentStyle.left; + style.left = ret || 0; + ret = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + elem.runtimeStyle.left = rsLeft; + } + } + + return ret; + }, + + clean: function( elems, context, fragment ) { + context = context || document; + + // !context.createElement fails in IE with an error but returns typeof 'object' + if ( typeof context.createElement === "undefined" ) + context = context.ownerDocument || context[0] && context[0].ownerDocument || document; + + // If a single string is passed in and it's a single tag + // just do a createElement and skip the rest + if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) { + var match = /^<(\w+)\s*\/?>$/.exec(elems[0]); + if ( match ) + return [ context.createElement( match[1] ) ]; + } + + var ret = [], scripts = [], div = context.createElement("div"); + + jQuery.each(elems, function(i, elem){ + if ( typeof elem === "number" ) + elem += ''; + + if ( !elem ) + return; + + // Convert html string into DOM nodes + if ( typeof elem === "string" ) { + // Fix "XHTML"-style tags in all browsers + elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ + return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? + all : + front + ">"; + }); + + // Trim whitespace, otherwise indexOf won't work as expected + var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase(); + + var wrap = + // option or optgroup + !tags.indexOf("", "" ] || + + !tags.indexOf("", "" ] || + + tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && + [ 1, "", "
        " ] || + + !tags.indexOf("", "" ] || + + // matched above + (!tags.indexOf("", "" ] || + + !tags.indexOf("", "" ] || + + // IE can't serialize and + +
        +
        +
        + + + + + */ +angular.module('ui.grid') + +.directive('uiGridMenu', ['$compile', '$timeout', '$window', '$document', 'gridUtil', 'uiGridConstants', 'i18nService', +function ($compile, $timeout, $window, $document, gridUtil, uiGridConstants, i18nService) { + var uiGridMenu = { + priority: 0, + scope: { + // shown: '&', + menuItems: '=', + autoHide: '=?' + }, + require: '?^uiGrid', + templateUrl: 'ui-grid/uiGridMenu', + replace: false, + link: function ($scope, $elm, $attrs, uiGridCtrl) { + var self = this; + var menuMid; + var $animate; + + $scope.i18n = { + close: i18nService.getSafeText('columnMenu.close') + }; + + // *** Show/Hide functions ****** + self.showMenu = $scope.showMenu = function(event, args) { + if ( !$scope.shown ){ + + /* + * In order to animate cleanly we remove the ng-if, wait a digest cycle, then + * animate the removal of the ng-hide. We can't successfully (so far as I can tell) + * animate removal of the ng-if, as the menu items aren't there yet. And we don't want + * to rely on ng-show only, as that leaves elements in the DOM that are needlessly evaluated + * on scroll events. + * + * Note when testing animation that animations don't run on the tutorials. When debugging it looks + * like they do, but angular has a default $animate provider that is just a stub, and that's what's + * being called. ALso don't be fooled by the fact that your browser has actually loaded the + * angular-translate.js, it's not using it. You need to test animations in an external application. + */ + $scope.shown = true; + + $timeout( function() { + $scope.shownMid = true; + $scope.$emit('menu-shown'); + }); + } else if ( !$scope.shownMid ) { + // we're probably doing a hide then show, so we don't need to wait for ng-if + $scope.shownMid = true; + $scope.$emit('menu-shown'); + } + + var docEventType = 'click'; + if (args && args.originalEvent && args.originalEvent.type && args.originalEvent.type === 'touchstart') { + docEventType = args.originalEvent.type; + } + + // Turn off an existing document click handler + angular.element(document).off('click touchstart', applyHideMenu); + + // Turn on the document click handler, but in a timeout so it doesn't apply to THIS click if there is one + $timeout(function() { + angular.element(document).on(docEventType, applyHideMenu); + }); + //automatically set the focus to the first button element in the now open menu. + gridUtil.focus.bySelector($elm, 'button[type=button]', true); + }; + + + self.hideMenu = $scope.hideMenu = function(event, args) { + if ( $scope.shown ){ + /* + * In order to animate cleanly we animate the addition of ng-hide, then use a $timeout to + * set the ng-if (shown = false) after the animation runs. In theory we can cascade off the + * callback on the addClass method, but it is very unreliable with unit tests for no discernable reason. + * + * The user may have clicked on the menu again whilst + * we're waiting, so we check that the mid isn't shown before applying the ng-if. + */ + $scope.shownMid = false; + $timeout( function() { + if ( !$scope.shownMid ){ + $scope.shown = false; + $scope.$emit('menu-hidden'); + } + }, 200); + } + + angular.element(document).off('click touchstart', applyHideMenu); + }; + + $scope.$on('hide-menu', function (event, args) { + $scope.hideMenu(event, args); + }); + + $scope.$on('show-menu', function (event, args) { + $scope.showMenu(event, args); + }); + + + // *** Auto hide when click elsewhere ****** + var applyHideMenu = function(){ + if ($scope.shown) { + $scope.$apply(function () { + $scope.hideMenu(); + }); + } + }; + + if (typeof($scope.autoHide) === 'undefined' || $scope.autoHide === undefined) { + $scope.autoHide = true; + } + + if ($scope.autoHide) { + angular.element($window).on('resize', applyHideMenu); + } + + $scope.$on('$destroy', function () { + angular.element(document).off('click touchstart', applyHideMenu); + }); + + + $scope.$on('$destroy', function() { + angular.element($window).off('resize', applyHideMenu); + }); + + if (uiGridCtrl) { + $scope.$on('$destroy', uiGridCtrl.grid.api.core.on.scrollBegin($scope, applyHideMenu )); + } + + $scope.$on('$destroy', $scope.$on(uiGridConstants.events.ITEM_DRAGGING, applyHideMenu )); + }, + + + controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) { + var self = this; + }] + }; + + return uiGridMenu; +}]) + +.directive('uiGridMenuItem', ['gridUtil', '$compile', 'i18nService', function (gridUtil, $compile, i18nService) { + var uiGridMenuItem = { + priority: 0, + scope: { + name: '=', + active: '=', + action: '=', + icon: '=', + shown: '=', + context: '=', + templateUrl: '=', + leaveOpen: '=', + screenReaderOnly: '=' + }, + require: ['?^uiGrid', '^uiGridMenu'], + templateUrl: 'ui-grid/uiGridMenuItem', + replace: false, + compile: function($elm, $attrs) { + return { + pre: function ($scope, $elm, $attrs, controllers) { + var uiGridCtrl = controllers[0], + uiGridMenuCtrl = controllers[1]; + + if ($scope.templateUrl) { + gridUtil.getTemplate($scope.templateUrl) + .then(function (contents) { + var template = angular.element(contents); + + var newElm = $compile(template)($scope); + $elm.replaceWith(newElm); + }); + } + }, + post: function ($scope, $elm, $attrs, controllers) { + var uiGridCtrl = controllers[0], + uiGridMenuCtrl = controllers[1]; + + // TODO(c0bra): validate that shown and active are functions if they're defined. An exception is already thrown above this though + // if (typeof($scope.shown) !== 'undefined' && $scope.shown && typeof($scope.shown) !== 'function') { + // throw new TypeError("$scope.shown is defined but not a function"); + // } + if (typeof($scope.shown) === 'undefined' || $scope.shown === null) { + $scope.shown = function() { return true; }; + } + + $scope.itemShown = function () { + var context = {}; + if ($scope.context) { + context.context = $scope.context; + } + + if (typeof(uiGridCtrl) !== 'undefined' && uiGridCtrl) { + context.grid = uiGridCtrl.grid; + } + + return $scope.shown.call(context); + }; + + $scope.itemAction = function($event,title) { + gridUtil.logDebug('itemAction'); + $event.stopPropagation(); + + if (typeof($scope.action) === 'function') { + var context = {}; + + if ($scope.context) { + context.context = $scope.context; + } + + // Add the grid to the function call context if the uiGrid controller is present + if (typeof(uiGridCtrl) !== 'undefined' && uiGridCtrl) { + context.grid = uiGridCtrl.grid; + } + + $scope.action.call(context, $event, title); + + if ( !$scope.leaveOpen ){ + $scope.$emit('hide-menu'); + } else { + /* + * XXX: Fix after column refactor + * Ideally the focus would remain on the item. + * However, since there are two menu items that have their 'show' property toggled instead. This is a quick fix. + */ + gridUtil.focus.bySelector(angular.element(gridUtil.closestElm($elm, ".ui-grid-menu-items")), 'button[type=button]', true); + } + } + }; + + $scope.i18n = i18nService.get(); + } + }; + } + }; + + return uiGridMenuItem; +}]); + +})(); + +(function(){ + 'use strict'; + /** + * @ngdoc overview + * @name ui.grid.directive:uiGridOneBind + * @summary A group of directives that provide a one time bind to a dom element. + * @description A group of directives that provide a one time bind to a dom element. + * As one time bindings are not supported in Angular 1.2.* this directive provdes this capability. + * This is done to reduce the number of watchers on the dom. + *
        + *

        Short Example ({@link ui.grid.directive:uiGridOneBindSrc ui-grid-one-bind-src})

        + *
        +        
        + +
        +
        + * Will become: + *
        +       
        + +
        +
        +
        +

        Short Example ({@link ui.grid.directive:uiGridOneBindText ui-grid-one-bind-text})

        + *
        +        
        +
        + * Will become: + *
        +   
        Add this text
        +
        +
        + * Note: This behavior is slightly different for the {@link ui.grid.directive:uiGridOneBindIdGrid uiGridOneBindIdGrid} + * and {@link ui.grid.directive:uiGridOneBindAriaLabelledbyGrid uiGridOneBindAriaLabelledbyGrid} directives. + * + */ + //https://github.com/joshkurz/Black-Belt-AngularJS-Directives/blob/master/directives/Optimization/oneBind.js + var oneBinders = angular.module('ui.grid'); + angular.forEach([ + /** + * @ngdoc directive + * @name ui.grid.directive:uiGridOneBindSrc + * @memberof ui.grid.directive:uiGridOneBind + * @element img + * @restrict A + * @param {String} uiGridOneBindSrc The angular string you want to bind. Does not support interpolation. Don't use {{scopeElt}} instead use scopeElt. + * @description One time binding for the src dom tag. + * + */ + {tag: 'Src', method: 'attr'}, + /** + * @ngdoc directive + * @name ui.grid.directive:uiGridOneBindText + * @element div + * @restrict A + * @param {String} uiGridOneBindText The angular string you want to bind. Does not support interpolation. Don't use {{scopeElt}} instead use scopeElt. + * @description One time binding for the text dom tag. + */ + {tag: 'Text', method: 'text'}, + /** + * @ngdoc directive + * @name ui.grid.directive:uiGridOneBindHref + * @element div + * @restrict A + * @param {String} uiGridOneBindHref The angular string you want to bind. Does not support interpolation. Don't use {{scopeElt}} instead use scopeElt. + * @description One time binding for the href dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}. + */ + {tag: 'Href', method: 'attr'}, + /** + * @ngdoc directive + * @name ui.grid.directive:uiGridOneBindClass + * @element div + * @restrict A + * @param {String} uiGridOneBindClass The angular string you want to bind. Does not support interpolation. Don't use {{scopeElt}} instead use scopeElt. + * @param {Object} uiGridOneBindClass The object that you want to bind. At least one of the values in the object must be something other than null or undefined for the watcher to be removed. + * this is to prevent the watcher from being removed before the scope is initialized. + * @param {Array} uiGridOneBindClass An array of classes to bind to this element. + * @description One time binding for the class dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}. + */ + {tag: 'Class', method: 'addClass'}, + /** + * @ngdoc directive + * @name ui.grid.directive:uiGridOneBindHtml + * @element div + * @restrict A + * @param {String} uiGridOneBindHtml The angular string you want to bind. Does not support interpolation. Don't use {{scopeElt}} instead use scopeElt. + * @description One time binding for the html method on a dom element. For more information see {@link ui.grid.directive:uiGridOneBind}. + */ + {tag: 'Html', method: 'html'}, + /** + * @ngdoc directive + * @name ui.grid.directive:uiGridOneBindAlt + * @element div + * @restrict A + * @param {String} uiGridOneBindAlt The angular string you want to bind. Does not support interpolation. Don't use {{scopeElt}} instead use scopeElt. + * @description One time binding for the alt dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}. + */ + {tag: 'Alt', method: 'attr'}, + /** + * @ngdoc directive + * @name ui.grid.directive:uiGridOneBindStyle + * @element div + * @restrict A + * @param {String} uiGridOneBindStyle The angular string you want to bind. Does not support interpolation. Don't use {{scopeElt}} instead use scopeElt. + * @description One time binding for the style dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}. + */ + {tag: 'Style', method: 'css'}, + /** + * @ngdoc directive + * @name ui.grid.directive:uiGridOneBindValue + * @element div + * @restrict A + * @param {String} uiGridOneBindValue The angular string you want to bind. Does not support interpolation. Don't use {{scopeElt}} instead use scopeElt. + * @description One time binding for the value dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}. + */ + {tag: 'Value', method: 'attr'}, + /** + * @ngdoc directive + * @name ui.grid.directive:uiGridOneBindId + * @element div + * @restrict A + * @param {String} uiGridOneBindId The angular string you want to bind. Does not support interpolation. Don't use {{scopeElt}} instead use scopeElt. + * @description One time binding for the value dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}. + */ + {tag: 'Id', method: 'attr'}, + /** + * @ngdoc directive + * @name ui.grid.directive:uiGridOneBindIdGrid + * @element div + * @restrict A + * @param {String} uiGridOneBindIdGrid The angular string you want to bind. Does not support interpolation. Don't use {{scopeElt}} instead use scopeElt. + * @description One time binding for the id dom tag. + *

        Important Note!

        + * If the id tag passed as a parameter does not contain the grid id as a substring + * then the directive will search the scope and the parent controller (if it is a uiGridController) for the grid.id value. + * If this value is found then it is appended to the begining of the id tag. If the grid is not found then the directive throws an error. + * This is done in order to ensure uniqueness of id tags across the grid. + * This is to prevent two grids in the same document having duplicate id tags. + */ + {tag: 'Id', directiveName:'IdGrid', method: 'attr', appendGridId: true}, + /** + * @ngdoc directive + * @name ui.grid.directive:uiGridOneBindTitle + * @element div + * @restrict A + * @param {String} uiGridOneBindTitle The angular string you want to bind. Does not support interpolation. Don't use {{scopeElt}} instead use scopeElt. + * @description One time binding for the title dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}. + */ + {tag: 'Title', method: 'attr'}, + /** + * @ngdoc directive + * @name ui.grid.directive:uiGridOneBindAriaLabel + * @element div + * @restrict A + * @param {String} uiGridOneBindAriaLabel The angular string you want to bind. Does not support interpolation. Don't use {{scopeElt}} instead use scopeElt. + * @description One time binding for the aria-label dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}. + *
        + *
        +            
        +
        + * Will become: + *
        +            
        +
        + */ + {tag: 'Label', method: 'attr', aria:true}, + /** + * @ngdoc directive + * @name ui.grid.directive:uiGridOneBindAriaLabelledby + * @element div + * @restrict A + * @param {String} uiGridOneBindAriaLabelledby The angular string you want to bind. Does not support interpolation. Don't use {{scopeElt}} instead use scopeElt. + * @description One time binding for the aria-labelledby dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}. + *
        + *
        +            
        +
        + * Will become: + *
        +            
        +
        + */ + {tag: 'Labelledby', method: 'attr', aria:true}, + /** + * @ngdoc directive + * @name ui.grid.directive:uiGridOneBindAriaLabelledbyGrid + * @element div + * @restrict A + * @param {String} uiGridOneBindAriaLabelledbyGrid The angular string you want to bind. Does not support interpolation. Don't use {{scopeElt}} instead use scopeElt. + * @description One time binding for the aria-labelledby dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}. + * Works somewhat like {@link ui.grid.directive:uiGridOneBindIdGrid} however this one supports a list of ids (seperated by a space) and will dynamically add the + * grid id to each one. + *
        + *
        +            
        +
        + * Will become ([grid.id] will be replaced by the actual grid id): + *
        +            
        +
        + */ + {tag: 'Labelledby', directiveName:'LabelledbyGrid', appendGridId:true, method: 'attr', aria:true}, + /** + * @ngdoc directive + * @name ui.grid.directive:uiGridOneBindAriaDescribedby + * @element ANY + * @restrict A + * @param {String} uiGridOneBindAriaDescribedby The angular string you want to bind. Does not support interpolation. Don't use {{scopeElt}} instead use scopeElt. + * @description One time binding for the aria-describedby dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}. + *
        + *
        +            
        +
        + * Will become: + *
        +            
        +
        + */ + {tag: 'Describedby', method: 'attr', aria:true}, + /** + * @ngdoc directive + * @name ui.grid.directive:uiGridOneBindAriaDescribedbyGrid + * @element ANY + * @restrict A + * @param {String} uiGridOneBindAriaDescribedbyGrid The angular string you want to bind. Does not support interpolation. Don't use {{scopeElt}} instead use scopeElt. + * @description One time binding for the aria-labelledby dom tag. For more information see {@link ui.grid.directive:uiGridOneBind}. + * Works somewhat like {@link ui.grid.directive:uiGridOneBindIdGrid} however this one supports a list of ids (seperated by a space) and will dynamically add the + * grid id to each one. + *
        + *
        +            
        +
        + * Will become ([grid.id] will be replaced by the actual grid id): + *
        +            
        +
        + */ + {tag: 'Describedby', directiveName:'DescribedbyGrid', appendGridId:true, method: 'attr', aria:true}], + function(v){ + + var baseDirectiveName = 'uiGridOneBind'; + //If it is an aria tag then append the aria label seperately + //This is done because the aria tags are formatted aria-* and the directive name can't have a '-' character in it. + //If the diretiveName has to be overridden then it does so here. This is because the tag being modified and the directive sometimes don't match up. + var directiveName = (v.aria ? baseDirectiveName + 'Aria' : baseDirectiveName) + (v.directiveName ? v.directiveName : v.tag); + oneBinders.directive(directiveName, ['gridUtil', function(gridUtil){ + return { + restrict: 'A', + require: ['?uiGrid','?^uiGrid'], + link: function(scope, iElement, iAttrs, controllers){ + /* Appends the grid id to the beginnig of the value. */ + var appendGridId = function(val){ + var grid; //Get an instance of the grid if its available + //If its available in the scope then we don't need to try to find it elsewhere + if (scope.grid) { + grid = scope.grid; + } + //Another possible location to try to find the grid + else if (scope.col && scope.col.grid){ + grid = scope.col.grid; + } + //Last ditch effort: Search through the provided controllers. + else if (!controllers.some( //Go through the controllers till one has the element we need + function(controller){ + if (controller && controller.grid) { + grid = controller.grid; + return true; //We've found the grid + } + })){ + //We tried our best to find it for you + gridUtil.logError("["+directiveName+"] A valid grid could not be found to bind id. Are you using this directive " + + "within the correct scope? Trying to generate id: [gridID]-" + val); + throw new Error("No valid grid could be found"); + } + + if (grid){ + var idRegex = new RegExp(grid.id.toString()); + //If the grid id hasn't been appended already in the template declaration + if (!idRegex.test(val)){ + val = grid.id.toString() + '-' + val; + } + } + return val; + }; + + // The watch returns a function to remove itself. + var rmWatcher = scope.$watch(iAttrs[directiveName], function(newV){ + if (newV){ + //If we are trying to add an id element then we also apply the grid id if it isn't already there + if (v.appendGridId) { + var newIdString = null; + //Append the id to all of the new ids. + angular.forEach( newV.split(' '), function(s){ + newIdString = (newIdString ? (newIdString + ' ') : '') + appendGridId(s); + }); + newV = newIdString; + } + + // Append this newValue to the dom element. + switch (v.method) { + case 'attr': //The attr method takes two paraams the tag and the value + if (v.aria) { + //If it is an aria element then append the aria prefix + iElement[v.method]('aria-' + v.tag.toLowerCase(),newV); + } else { + iElement[v.method](v.tag.toLowerCase(),newV); + } + break; + case 'addClass': + //Pulled from https://github.com/Pasvaz/bindonce/blob/master/bindonce.js + if (angular.isObject(newV) && !angular.isArray(newV)) { + var results = []; + var nonNullFound = false; //We don't want to remove the binding unless the key is actually defined + angular.forEach(newV, function (value, index) { + if (value !== null && typeof(value) !== "undefined"){ + nonNullFound = true; //A non null value for a key was found so the object must have been initialized + if (value) {results.push(index);} + } + }); + //A non null value for a key wasn't found so assume that the scope values haven't been fully initialized + if (!nonNullFound){ + return; // If not initialized then the watcher should not be removed yet. + } + newV = results; + } + + if (newV) { + iElement.addClass(angular.isArray(newV) ? newV.join(' ') : newV); + } else { + return; + } + break; + default: + iElement[v.method](newV); + break; + } + + //Removes the watcher on itself after the bind + rmWatcher(); + } + // True ensures that equality is determined using angular.equals instead of === + }, true); //End rm watchers + } //End compile function + }; //End directive return + } // End directive function + ]); //End directive + }); // End angular foreach +})(); + +(function () { + 'use strict'; + + var module = angular.module('ui.grid'); + + module.directive('uiGridRenderContainer', ['$timeout', '$document', 'uiGridConstants', 'gridUtil', 'ScrollEvent', + function($timeout, $document, uiGridConstants, gridUtil, ScrollEvent) { + return { + replace: true, + transclude: true, + templateUrl: 'ui-grid/uiGridRenderContainer', + require: ['^uiGrid', 'uiGridRenderContainer'], + scope: { + containerId: '=', + rowContainerName: '=', + colContainerName: '=', + bindScrollHorizontal: '=', + bindScrollVertical: '=', + enableVerticalScrollbar: '=', + enableHorizontalScrollbar: '=' + }, + controller: 'uiGridRenderContainer as RenderContainer', + compile: function () { + return { + pre: function prelink($scope, $elm, $attrs, controllers) { + + var uiGridCtrl = controllers[0]; + var containerCtrl = controllers[1]; + var grid = $scope.grid = uiGridCtrl.grid; + + // Verify that the render container for this element exists + if (!$scope.rowContainerName) { + throw "No row render container name specified"; + } + if (!$scope.colContainerName) { + throw "No column render container name specified"; + } + + if (!grid.renderContainers[$scope.rowContainerName]) { + throw "Row render container '" + $scope.rowContainerName + "' is not registered."; + } + if (!grid.renderContainers[$scope.colContainerName]) { + throw "Column render container '" + $scope.colContainerName + "' is not registered."; + } + + var rowContainer = $scope.rowContainer = grid.renderContainers[$scope.rowContainerName]; + var colContainer = $scope.colContainer = grid.renderContainers[$scope.colContainerName]; + + containerCtrl.containerId = $scope.containerId; + containerCtrl.rowContainer = rowContainer; + containerCtrl.colContainer = colContainer; + }, + post: function postlink($scope, $elm, $attrs, controllers) { + + var uiGridCtrl = controllers[0]; + var containerCtrl = controllers[1]; + + var grid = uiGridCtrl.grid; + var rowContainer = containerCtrl.rowContainer; + var colContainer = containerCtrl.colContainer; + var scrollTop = null; + var scrollLeft = null; + + + var renderContainer = grid.renderContainers[$scope.containerId]; + + // Put the container name on this element as a class + $elm.addClass('ui-grid-render-container-' + $scope.containerId); + + // Scroll the render container viewport when the mousewheel is used + gridUtil.on.mousewheel($elm, function (event) { + var scrollEvent = new ScrollEvent(grid, rowContainer, colContainer, ScrollEvent.Sources.RenderContainerMouseWheel); + if (event.deltaY !== 0) { + var scrollYAmount = event.deltaY * -1 * event.deltaFactor; + + scrollTop = containerCtrl.viewport[0].scrollTop; + + // Get the scroll percentage + scrollEvent.verticalScrollLength = rowContainer.getVerticalScrollLength(); + var scrollYPercentage = (scrollTop + scrollYAmount) / scrollEvent.verticalScrollLength; + + // If we should be scrolled 100%, make sure the scrollTop matches the maximum scroll length + // Viewports that have "overflow: hidden" don't let the mousewheel scroll all the way to the bottom without this check + if (scrollYPercentage >= 1 && scrollTop < scrollEvent.verticalScrollLength) { + containerCtrl.viewport[0].scrollTop = scrollEvent.verticalScrollLength; + } + + // Keep scrollPercentage within the range 0-1. + if (scrollYPercentage < 0) { scrollYPercentage = 0; } + else if (scrollYPercentage > 1) { scrollYPercentage = 1; } + + scrollEvent.y = { percentage: scrollYPercentage, pixels: scrollYAmount }; + } + if (event.deltaX !== 0) { + var scrollXAmount = event.deltaX * event.deltaFactor; + + // Get the scroll percentage + scrollLeft = gridUtil.normalizeScrollLeft(containerCtrl.viewport, grid); + scrollEvent.horizontalScrollLength = (colContainer.getCanvasWidth() - colContainer.getViewportWidth()); + var scrollXPercentage = (scrollLeft + scrollXAmount) / scrollEvent.horizontalScrollLength; + + // Keep scrollPercentage within the range 0-1. + if (scrollXPercentage < 0) { scrollXPercentage = 0; } + else if (scrollXPercentage > 1) { scrollXPercentage = 1; } + + scrollEvent.x = { percentage: scrollXPercentage, pixels: scrollXAmount }; + } + + // Let the parent container scroll if the grid is already at the top/bottom + if ((event.deltaY !== 0 && (scrollEvent.atTop(scrollTop) || scrollEvent.atBottom(scrollTop))) || + (event.deltaX !== 0 && (scrollEvent.atLeft(scrollLeft) || scrollEvent.atRight(scrollLeft)))) { + //parent controller scrolls + } + else { + event.preventDefault(); + event.stopPropagation(); + scrollEvent.fireThrottledScrollingEvent('', scrollEvent); + } + + }); + + $elm.bind('$destroy', function() { + $elm.unbind('keydown'); + + ['touchstart', 'touchmove', 'touchend','keydown', 'wheel', 'mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'].forEach(function (eventName) { + $elm.unbind(eventName); + }); + }); + + // TODO(c0bra): Handle resizing the inner canvas based on the number of elements + function update() { + var ret = ''; + + var canvasWidth = colContainer.canvasWidth; + var viewportWidth = colContainer.getViewportWidth(); + + var canvasHeight = rowContainer.getCanvasHeight(); + + //add additional height for scrollbar on left and right container + //if ($scope.containerId !== 'body') { + // canvasHeight -= grid.scrollbarHeight; + //} + + var viewportHeight = rowContainer.getViewportHeight(); + //shorten the height to make room for a scrollbar placeholder + if (colContainer.needsHScrollbarPlaceholder()) { + viewportHeight -= grid.scrollbarHeight; + } + + var headerViewportWidth, + footerViewportWidth; + headerViewportWidth = footerViewportWidth = colContainer.getHeaderViewportWidth(); + + // Set canvas dimensions + ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-canvas { width: ' + canvasWidth + 'px; height: ' + canvasHeight + 'px; }'; + + ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-header-canvas { width: ' + (canvasWidth + grid.scrollbarWidth) + 'px; }'; + + if (renderContainer.explicitHeaderCanvasHeight) { + ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-header-canvas { height: ' + renderContainer.explicitHeaderCanvasHeight + 'px; }'; + } + else { + ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-header-canvas { height: inherit; }'; + } + + ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-viewport { width: ' + viewportWidth + 'px; height: ' + viewportHeight + 'px; }'; + ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-header-viewport { width: ' + headerViewportWidth + 'px; }'; + + ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-footer-canvas { width: ' + (canvasWidth + grid.scrollbarWidth) + 'px; }'; + ret += '\n .grid' + uiGridCtrl.grid.id + ' .ui-grid-render-container-' + $scope.containerId + ' .ui-grid-footer-viewport { width: ' + footerViewportWidth + 'px; }'; + + return ret; + } + + uiGridCtrl.grid.registerStyleComputation({ + priority: 6, + func: update + }); + } + }; + } + }; + + }]); + + module.controller('uiGridRenderContainer', ['$scope', 'gridUtil', function ($scope, gridUtil) { + + }]); + +})(); + +(function(){ + 'use strict'; + + angular.module('ui.grid').directive('uiGridRow', ['gridUtil', function(gridUtil) { + return { + replace: true, + // priority: 2001, + // templateUrl: 'ui-grid/ui-grid-row', + require: ['^uiGrid', '^uiGridRenderContainer'], + scope: { + row: '=uiGridRow', + //rowRenderIndex is added to scope to give the true visual index of the row to any directives that need it + rowRenderIndex: '=' + }, + compile: function() { + return { + pre: function($scope, $elm, $attrs, controllers) { + var uiGridCtrl = controllers[0]; + var containerCtrl = controllers[1]; + + var grid = uiGridCtrl.grid; + + $scope.grid = uiGridCtrl.grid; + $scope.colContainer = containerCtrl.colContainer; + + // Function for attaching the template to this scope + var clonedElement, cloneScope; + function compileTemplate() { + $scope.row.getRowTemplateFn.then(function (compiledElementFn) { + // var compiledElementFn = $scope.row.compiledElementFn; + + // Create a new scope for the contents of this row, so we can destroy it later if need be + var newScope = $scope.$new(); + + compiledElementFn(newScope, function (newElm, scope) { + // If we already have a cloned element, we need to remove it and destroy its scope + if (clonedElement) { + clonedElement.remove(); + cloneScope.$destroy(); + } + + // Empty the row and append the new element + $elm.empty().append(newElm); + + // Save the new cloned element and scope + clonedElement = newElm; + cloneScope = newScope; + }); + }); + } + + // Initially attach the compiled template to this scope + compileTemplate(); + + // If the row's compiled element function changes, we need to replace this element's contents with the new compiled template + $scope.$watch('row.getRowTemplateFn', function (newFunc, oldFunc) { + if (newFunc !== oldFunc) { + compileTemplate(); + } + }); + }, + post: function($scope, $elm, $attrs, controllers) { + + } + }; + } + }; + }]); + +})(); +(function(){ +// 'use strict'; + + /** + * @ngdoc directive + * @name ui.grid.directive:uiGridStyle + * @element style + * @restrict A + * + * @description + * Allows us to interpolate expressions in ` + I am in a box. +
        + + + it('should apply the right class to the element', function () { + element(by.css('.blah')).getCssValue('border-top-width') + .then(function(c) { + expect(c).toContain('1px'); + }); + }); + + + */ + + + angular.module('ui.grid').directive('uiGridStyle', ['gridUtil', '$interpolate', function(gridUtil, $interpolate) { + return { + // restrict: 'A', + // priority: 1000, + // require: '?^uiGrid', + link: function($scope, $elm, $attrs, uiGridCtrl) { + // gridUtil.logDebug('ui-grid-style link'); + // if (uiGridCtrl === undefined) { + // gridUtil.logWarn('[ui-grid-style link] uiGridCtrl is undefined!'); + // } + + var interpolateFn = $interpolate($elm.text(), true); + + if (interpolateFn) { + $scope.$watch(interpolateFn, function(value) { + $elm.text(value); + }); + } + + // uiGridCtrl.recalcRowStyles = function() { + // var offset = (scope.options.offsetTop || 0) - (scope.options.excessRows * scope.options.rowHeight); + // var rowHeight = scope.options.rowHeight; + + // var ret = ''; + // var rowStyleCount = uiGridCtrl.minRowsToRender() + (scope.options.excessRows * 2); + // for (var i = 1; i <= rowStyleCount; i++) { + // ret = ret + ' .grid' + scope.gridId + ' .ui-grid-row:nth-child(' + i + ') { top: ' + offset + 'px; }'; + // offset = offset + rowHeight; + // } + + // scope.rowStyles = ret; + // }; + + // uiGridCtrl.styleComputions.push(uiGridCtrl.recalcRowStyles); + + } + }; + }]); + +})(); + +(function(){ + 'use strict'; + + angular.module('ui.grid').directive('uiGridViewport', ['gridUtil','ScrollEvent','uiGridConstants', '$log', + function(gridUtil, ScrollEvent, uiGridConstants, $log) { + return { + replace: true, + scope: {}, + controllerAs: 'Viewport', + templateUrl: 'ui-grid/uiGridViewport', + require: ['^uiGrid', '^uiGridRenderContainer'], + link: function($scope, $elm, $attrs, controllers) { + // gridUtil.logDebug('viewport post-link'); + + var uiGridCtrl = controllers[0]; + var containerCtrl = controllers[1]; + + $scope.containerCtrl = containerCtrl; + + var rowContainer = containerCtrl.rowContainer; + var colContainer = containerCtrl.colContainer; + + var grid = uiGridCtrl.grid; + + $scope.grid = uiGridCtrl.grid; + + // Put the containers in scope so we can get rows and columns from them + $scope.rowContainer = containerCtrl.rowContainer; + $scope.colContainer = containerCtrl.colContainer; + + // Register this viewport with its container + containerCtrl.viewport = $elm; + + + $elm.on('scroll', scrollHandler); + + var ignoreScroll = false; + + function scrollHandler(evt) { + //Leaving in this commented code in case it can someday be used + //It does improve performance, but because the horizontal scroll is normalized, + // using this code will lead to the column header getting slightly out of line with columns + // + //if (ignoreScroll && (grid.isScrollingHorizontally || grid.isScrollingHorizontally)) { + // //don't ask for scrollTop if we just set it + // ignoreScroll = false; + // return; + //} + //ignoreScroll = true; + + var newScrollTop = $elm[0].scrollTop; + var newScrollLeft = gridUtil.normalizeScrollLeft($elm, grid); + + var vertScrollPercentage = rowContainer.scrollVertical(newScrollTop); + var horizScrollPercentage = colContainer.scrollHorizontal(newScrollLeft); + + var scrollEvent = new ScrollEvent(grid, rowContainer, colContainer, ScrollEvent.Sources.ViewPortScroll); + scrollEvent.newScrollLeft = newScrollLeft; + scrollEvent.newScrollTop = newScrollTop; + if ( horizScrollPercentage > -1 ){ + scrollEvent.x = { percentage: horizScrollPercentage }; + } + + if ( vertScrollPercentage > -1 ){ + scrollEvent.y = { percentage: vertScrollPercentage }; + } + + grid.scrollContainers($scope.$parent.containerId, scrollEvent); + } + + if ($scope.$parent.bindScrollVertical) { + grid.addVerticalScrollSync($scope.$parent.containerId, syncVerticalScroll); + } + + if ($scope.$parent.bindScrollHorizontal) { + grid.addHorizontalScrollSync($scope.$parent.containerId, syncHorizontalScroll); + grid.addHorizontalScrollSync($scope.$parent.containerId + 'header', syncHorizontalHeader); + grid.addHorizontalScrollSync($scope.$parent.containerId + 'footer', syncHorizontalFooter); + } + + function syncVerticalScroll(scrollEvent){ + containerCtrl.prevScrollArgs = scrollEvent; + var newScrollTop = scrollEvent.getNewScrollTop(rowContainer,containerCtrl.viewport); + $elm[0].scrollTop = newScrollTop; + + } + + function syncHorizontalScroll(scrollEvent){ + containerCtrl.prevScrollArgs = scrollEvent; + var newScrollLeft = scrollEvent.getNewScrollLeft(colContainer, containerCtrl.viewport); + $elm[0].scrollLeft = gridUtil.denormalizeScrollLeft(containerCtrl.viewport,newScrollLeft, grid); + } + + function syncHorizontalHeader(scrollEvent){ + var newScrollLeft = scrollEvent.getNewScrollLeft(colContainer, containerCtrl.viewport); + if (containerCtrl.headerViewport) { + containerCtrl.headerViewport.scrollLeft = gridUtil.denormalizeScrollLeft(containerCtrl.viewport,newScrollLeft, grid); + } + } + + function syncHorizontalFooter(scrollEvent){ + var newScrollLeft = scrollEvent.getNewScrollLeft(colContainer, containerCtrl.viewport); + if (containerCtrl.footerViewport) { + containerCtrl.footerViewport.scrollLeft = gridUtil.denormalizeScrollLeft(containerCtrl.viewport,newScrollLeft, grid); + } + } + + + }, + controller: ['$scope', function ($scope) { + this.rowStyle = function (index) { + var rowContainer = $scope.rowContainer; + var colContainer = $scope.colContainer; + + var styles = {}; + + if (index === 0 && rowContainer.currentTopRow !== 0) { + // The row offset-top is just the height of the rows above the current top-most row, which are no longer rendered + var hiddenRowWidth = (rowContainer.currentTopRow) * rowContainer.grid.options.rowHeight; + + // return { 'margin-top': hiddenRowWidth + 'px' }; + styles['margin-top'] = hiddenRowWidth + 'px'; + } + + if (colContainer.currentFirstColumn !== 0) { + if (colContainer.grid.isRTL()) { + styles['margin-right'] = colContainer.columnOffset + 'px'; + } + else { + styles['margin-left'] = colContainer.columnOffset + 'px'; + } + } + + return styles; + }; + }] + }; + } + ]); + +})(); + +(function() { + +angular.module('ui.grid') +.directive('uiGridVisible', function uiGridVisibleAction() { + return function ($scope, $elm, $attr) { + $scope.$watch($attr.uiGridVisible, function (visible) { + // $elm.css('visibility', visible ? 'visible' : 'hidden'); + $elm[visible ? 'removeClass' : 'addClass']('ui-grid-invisible'); + }); + }; +}); + +})(); +(function () { + 'use strict'; + + angular.module('ui.grid').controller('uiGridController', ['$scope', '$element', '$attrs', 'gridUtil', '$q', 'uiGridConstants', + '$templateCache', 'gridClassFactory', '$timeout', '$parse', '$compile', + function ($scope, $elm, $attrs, gridUtil, $q, uiGridConstants, + $templateCache, gridClassFactory, $timeout, $parse, $compile) { + // gridUtil.logDebug('ui-grid controller'); + + var self = this; + + self.grid = gridClassFactory.createGrid($scope.uiGrid); + + //assign $scope.$parent if appScope not already assigned + self.grid.appScope = self.grid.appScope || $scope.$parent; + + $elm.addClass('grid' + self.grid.id); + self.grid.rtl = gridUtil.getStyles($elm[0])['direction'] === 'rtl'; + + + // angular.extend(self.grid.options, ); + + //all properties of grid are available on scope + $scope.grid = self.grid; + + if ($attrs.uiGridColumns) { + $attrs.$observe('uiGridColumns', function(value) { + self.grid.options.columnDefs = value; + self.grid.buildColumns() + .then(function(){ + self.grid.preCompileCellTemplates(); + + self.grid.refreshCanvas(true); + }); + }); + } + + + // if fastWatch is set we watch only the length and the reference, not every individual object + var deregFunctions = []; + if (self.grid.options.fastWatch) { + self.uiGrid = $scope.uiGrid; + if (angular.isString($scope.uiGrid.data)) { + deregFunctions.push( $scope.$parent.$watch($scope.uiGrid.data, dataWatchFunction) ); + deregFunctions.push( $scope.$parent.$watch(function() { + if ( self.grid.appScope[$scope.uiGrid.data] ){ + return self.grid.appScope[$scope.uiGrid.data].length; + } else { + return undefined; + } + }, dataWatchFunction) ); + } else { + deregFunctions.push( $scope.$parent.$watch(function() { return $scope.uiGrid.data; }, dataWatchFunction) ); + deregFunctions.push( $scope.$parent.$watch(function() { return $scope.uiGrid.data.length; }, dataWatchFunction) ); + } + deregFunctions.push( $scope.$parent.$watch(function() { return $scope.uiGrid.columnDefs; }, columnDefsWatchFunction) ); + deregFunctions.push( $scope.$parent.$watch(function() { return $scope.uiGrid.columnDefs.length; }, columnDefsWatchFunction) ); + } else { + if (angular.isString($scope.uiGrid.data)) { + deregFunctions.push( $scope.$parent.$watchCollection($scope.uiGrid.data, dataWatchFunction) ); + } else { + deregFunctions.push( $scope.$parent.$watchCollection(function() { return $scope.uiGrid.data; }, dataWatchFunction) ); + } + deregFunctions.push( $scope.$parent.$watchCollection(function() { return $scope.uiGrid.columnDefs; }, columnDefsWatchFunction) ); + } + + + function columnDefsWatchFunction(n, o) { + if (n && n !== o) { + self.grid.options.columnDefs = n; + self.grid.buildColumns({ orderByColumnDefs: true }) + .then(function(){ + + self.grid.preCompileCellTemplates(); + + self.grid.callDataChangeCallbacks(uiGridConstants.dataChange.COLUMN); + }); + } + } + + function dataWatchFunction(newData) { + // gridUtil.logDebug('dataWatch fired'); + var promises = []; + + if ( self.grid.options.fastWatch ){ + if (angular.isString($scope.uiGrid.data)) { + newData = self.grid.appScope[$scope.uiGrid.data]; + } else { + newData = $scope.uiGrid.data; + } + } + + if (newData) { + // columns length is greater than the number of row header columns, which don't count because they're created automatically + var hasColumns = self.grid.columns.length > (self.grid.rowHeaderColumns ? self.grid.rowHeaderColumns.length : 0); + + if ( + // If we have no columns + !hasColumns && + // ... and we don't have a ui-grid-columns attribute, which would define columns for us + !$attrs.uiGridColumns && + // ... and we have no pre-defined columns + self.grid.options.columnDefs.length === 0 && + // ... but we DO have data + newData.length > 0 + ) { + // ... then build the column definitions from the data that we have + self.grid.buildColumnDefsFromData(newData); + } + + // If we haven't built columns before and either have some columns defined or some data defined + if (!hasColumns && (self.grid.options.columnDefs.length > 0 || newData.length > 0)) { + // Build the column set, then pre-compile the column cell templates + promises.push(self.grid.buildColumns() + .then(function() { + self.grid.preCompileCellTemplates(); + })); + } + + $q.all(promises).then(function() { + self.grid.modifyRows(newData) + .then(function () { + // if (self.viewport) { + self.grid.redrawInPlace(true); + // } + + $scope.$evalAsync(function() { + self.grid.refreshCanvas(true); + self.grid.callDataChangeCallbacks(uiGridConstants.dataChange.ROW); + }); + }); + }); + } + } + + var styleWatchDereg = $scope.$watch(function () { return self.grid.styleComputations; }, function() { + self.grid.refreshCanvas(true); + }); + + $scope.$on('$destroy', function() { + deregFunctions.forEach( function( deregFn ){ deregFn(); }); + styleWatchDereg(); + }); + + self.fireEvent = function(eventName, args) { + // Add the grid to the event arguments if it's not there + if (typeof(args) === 'undefined' || args === undefined) { + args = {}; + } + + if (typeof(args.grid) === 'undefined' || args.grid === undefined) { + args.grid = self.grid; + } + + $scope.$broadcast(eventName, args); + }; + + self.innerCompile = function innerCompile(elm) { + $compile(elm)($scope); + }; + + }]); + +/** + * @ngdoc directive + * @name ui.grid.directive:uiGrid + * @element div + * @restrict EA + * @param {Object} uiGrid Options for the grid to use + * + * @description Create a very basic grid. + * + * @example + + + var app = angular.module('app', ['ui.grid']); + + app.controller('MainCtrl', ['$scope', function ($scope) { + $scope.data = [ + { name: 'Bob', title: 'CEO' }, + { name: 'Frank', title: 'Lowly Developer' } + ]; + }]); + + +
        +
        +
        +
        +
        + */ +angular.module('ui.grid').directive('uiGrid', uiGridDirective); + +uiGridDirective.$inject = ['$compile', '$templateCache', '$timeout', '$window', 'gridUtil', 'uiGridConstants']; +function uiGridDirective($compile, $templateCache, $timeout, $window, gridUtil, uiGridConstants) { + return { + templateUrl: 'ui-grid/ui-grid', + scope: { + uiGrid: '=' + }, + replace: true, + transclude: true, + controller: 'uiGridController', + compile: function () { + return { + post: function ($scope, $elm, $attrs, uiGridCtrl) { + var grid = uiGridCtrl.grid; + // Initialize scrollbars (TODO: move to controller??) + uiGridCtrl.scrollbars = []; + grid.element = $elm; + + + // See if the grid has a rendered width, if not, wait a bit and try again + var sizeCheckInterval = 100; // ms + var maxSizeChecks = 20; // 2 seconds total + var sizeChecks = 0; + + // Setup (event listeners) the grid + setup(); + + // And initialize it + init(); + + // Mark rendering complete so API events can happen + grid.renderingComplete(); + + // If the grid doesn't have size currently, wait for a bit to see if it gets size + checkSize(); + + /*-- Methods --*/ + + function checkSize() { + // If the grid has no width and we haven't checked more than times, check again in milliseconds + if ($elm[0].offsetWidth <= 0 && sizeChecks < maxSizeChecks) { + setTimeout(checkSize, sizeCheckInterval); + sizeChecks++; + } + else { + $timeout(init); + } + } + + // Setup event listeners and watchers + function setup() { + // Bind to window resize events + angular.element($window).on('resize', gridResize); + + // Unbind from window resize events when the grid is destroyed + $elm.on('$destroy', function () { + angular.element($window).off('resize', gridResize); + }); + + // If we add a left container after render, we need to watch and react + $scope.$watch(function () { return grid.hasLeftContainer();}, function (newValue, oldValue) { + if (newValue === oldValue) { + return; + } + grid.refreshCanvas(true); + }); + + // If we add a right container after render, we need to watch and react + $scope.$watch(function () { return grid.hasRightContainer();}, function (newValue, oldValue) { + if (newValue === oldValue) { + return; + } + grid.refreshCanvas(true); + }); + } + + // Initialize the directive + function init() { + grid.gridWidth = $scope.gridWidth = gridUtil.elementWidth($elm); + + // Default canvasWidth to the grid width, in case we don't get any column definitions to calculate it from + grid.canvasWidth = uiGridCtrl.grid.gridWidth; + + grid.gridHeight = $scope.gridHeight = gridUtil.elementHeight($elm); + + // If the grid isn't tall enough to fit a single row, it's kind of useless. Resize it to fit a minimum number of rows + if (grid.gridHeight < grid.options.rowHeight && grid.options.enableMinHeightCheck) { + autoAdjustHeight(); + } + + // Run initial canvas refresh + grid.refreshCanvas(true); + } + + // Set the grid's height ourselves in the case that its height would be unusably small + function autoAdjustHeight() { + // Figure out the new height + var contentHeight = grid.options.minRowsToShow * grid.options.rowHeight; + var headerHeight = grid.options.showHeader ? grid.options.headerRowHeight : 0; + var footerHeight = grid.calcFooterHeight(); + + var scrollbarHeight = 0; + if (grid.options.enableHorizontalScrollbar === uiGridConstants.scrollbars.ALWAYS) { + scrollbarHeight = gridUtil.getScrollbarWidth(); + } + + var maxNumberOfFilters = 0; + // Calculates the maximum number of filters in the columns + angular.forEach(grid.options.columnDefs, function(col) { + if (col.hasOwnProperty('filter')) { + if (maxNumberOfFilters < 1) { + maxNumberOfFilters = 1; + } + } + else if (col.hasOwnProperty('filters')) { + if (maxNumberOfFilters < col.filters.length) { + maxNumberOfFilters = col.filters.length; + } + } + }); + + if (grid.options.enableFiltering) { + var allColumnsHaveFilteringTurnedOff = grid.options.columnDefs.every(function(col) { + return col.enableFiltering === false; + }); + + if (!allColumnsHaveFilteringTurnedOff) { + maxNumberOfFilters++; + } + } + + var filterHeight = maxNumberOfFilters * headerHeight; + + var newHeight = headerHeight + contentHeight + footerHeight + scrollbarHeight + filterHeight; + + $elm.css('height', newHeight + 'px'); + + grid.gridHeight = $scope.gridHeight = gridUtil.elementHeight($elm); + } + + // Resize the grid on window resize events + function gridResize($event) { + grid.gridWidth = $scope.gridWidth = gridUtil.elementWidth($elm); + grid.gridHeight = $scope.gridHeight = gridUtil.elementHeight($elm); + + grid.refreshCanvas(true); + } + } + }; + } + }; +} + +})(); + +(function(){ + 'use strict'; + + // TODO: rename this file to ui-grid-pinned-container.js + + angular.module('ui.grid').directive('uiGridPinnedContainer', ['gridUtil', function (gridUtil) { + return { + restrict: 'EA', + replace: true, + template: '
        ', + scope: { + side: '=uiGridPinnedContainer' + }, + require: '^uiGrid', + compile: function compile() { + return { + post: function ($scope, $elm, $attrs, uiGridCtrl) { + // gridUtil.logDebug('ui-grid-pinned-container ' + $scope.side + ' link'); + + var grid = uiGridCtrl.grid; + + var myWidth = 0; + + $elm.addClass('ui-grid-pinned-container-' + $scope.side); + + // Monkey-patch the viewport width function + if ($scope.side === 'left' || $scope.side === 'right') { + grid.renderContainers[$scope.side].getViewportWidth = monkeyPatchedGetViewportWidth; + } + + function monkeyPatchedGetViewportWidth() { + /*jshint validthis: true */ + var self = this; + + var viewportWidth = 0; + self.visibleColumnCache.forEach(function (column) { + viewportWidth += column.drawnWidth; + }); + + var adjustment = self.getViewportAdjustment(); + + viewportWidth = viewportWidth + adjustment.width; + + return viewportWidth; + } + + function updateContainerWidth() { + if ($scope.side === 'left' || $scope.side === 'right') { + var cols = grid.renderContainers[$scope.side].visibleColumnCache; + var width = 0; + for (var i = 0; i < cols.length; i++) { + var col = cols[i]; + width += col.drawnWidth || col.width || 0; + } + + return width; + } + } + + function updateContainerDimensions() { + var ret = ''; + + // Column containers + if ($scope.side === 'left' || $scope.side === 'right') { + myWidth = updateContainerWidth(); + + // gridUtil.logDebug('myWidth', myWidth); + + // TODO(c0bra): Subtract sum of col widths from grid viewport width and update it + $elm.attr('style', null); + + // var myHeight = grid.renderContainers.body.getViewportHeight(); // + grid.horizontalScrollbarHeight; + + ret += '.grid' + grid.id + ' .ui-grid-pinned-container-' + $scope.side + ', .grid' + grid.id + ' .ui-grid-pinned-container-' + $scope.side + ' .ui-grid-render-container-' + $scope.side + ' .ui-grid-viewport { width: ' + myWidth + 'px; } '; + } + + return ret; + } + + grid.renderContainers.body.registerViewportAdjuster(function (adjustment) { + myWidth = updateContainerWidth(); + + // Subtract our own width + adjustment.width -= myWidth; + adjustment.side = $scope.side; + + return adjustment; + }); + + // Register style computation to adjust for columns in `side`'s render container + grid.registerStyleComputation({ + priority: 15, + func: updateContainerDimensions + }); + } + }; + } + }; + }]); +})(); + +(function(){ + +angular.module('ui.grid') +.factory('Grid', ['$q', '$compile', '$parse', 'gridUtil', 'uiGridConstants', 'GridOptions', 'GridColumn', 'GridRow', 'GridApi', 'rowSorter', 'rowSearcher', 'GridRenderContainer', '$timeout','ScrollEvent', + function($q, $compile, $parse, gridUtil, uiGridConstants, GridOptions, GridColumn, GridRow, GridApi, rowSorter, rowSearcher, GridRenderContainer, $timeout, ScrollEvent) { + + /** + * @ngdoc object + * @name ui.grid.core.api:PublicApi + * @description Public Api for the core grid features + * + */ + + /** + * @ngdoc function + * @name ui.grid.class:Grid + * @description Grid is the main viewModel. Any properties or methods needed to maintain state are defined in + * this prototype. One instance of Grid is created per Grid directive instance. + * @param {object} options Object map of options to pass into the grid. An 'id' property is expected. + */ + var Grid = function Grid(options) { + var self = this; + // Get the id out of the options, then remove it + if (options !== undefined && typeof(options.id) !== 'undefined' && options.id) { + if (!/^[_a-zA-Z0-9-]+$/.test(options.id)) { + throw new Error("Grid id '" + options.id + '" is invalid. It must follow CSS selector syntax rules.'); + } + } + else { + throw new Error('No ID provided. An ID must be given when creating a grid.'); + } + + self.id = options.id; + delete options.id; + + // Get default options + self.options = GridOptions.initialize( options ); + + /** + * @ngdoc object + * @name appScope + * @propertyOf ui.grid.class:Grid + * @description reference to the application scope (the parent scope of the ui-grid element). Assigned in ui-grid controller + *
        + * use gridOptions.appScopeProvider to override the default assignment of $scope.$parent with any reference + */ + self.appScope = self.options.appScopeProvider; + + self.headerHeight = self.options.headerRowHeight; + + + /** + * @ngdoc object + * @name footerHeight + * @propertyOf ui.grid.class:Grid + * @description returns the total footer height gridFooter + columnFooter + */ + self.footerHeight = self.calcFooterHeight(); + + + /** + * @ngdoc object + * @name columnFooterHeight + * @propertyOf ui.grid.class:Grid + * @description returns the total column footer height + */ + self.columnFooterHeight = self.calcColumnFooterHeight(); + + self.rtl = false; + self.gridHeight = 0; + self.gridWidth = 0; + self.columnBuilders = []; + self.rowBuilders = []; + self.rowsProcessors = []; + self.columnsProcessors = []; + self.styleComputations = []; + self.viewportAdjusters = []; + self.rowHeaderColumns = []; + self.dataChangeCallbacks = {}; + self.verticalScrollSyncCallBackFns = {}; + self.horizontalScrollSyncCallBackFns = {}; + + // self.visibleRowCache = []; + + // Set of 'render' containers for self grid, which can render sets of rows + self.renderContainers = {}; + + // Create a + self.renderContainers.body = new GridRenderContainer('body', self); + + self.cellValueGetterCache = {}; + + // Cached function to use with custom row templates + self.getRowTemplateFn = null; + + + //representation of the rows on the grid. + //these are wrapped references to the actual data rows (options.data) + self.rows = []; + + //represents the columns on the grid + self.columns = []; + + /** + * @ngdoc boolean + * @name isScrollingVertically + * @propertyOf ui.grid.class:Grid + * @description set to true when Grid is scrolling vertically. Set to false via debounced method + */ + self.isScrollingVertically = false; + + /** + * @ngdoc boolean + * @name isScrollingHorizontally + * @propertyOf ui.grid.class:Grid + * @description set to true when Grid is scrolling horizontally. Set to false via debounced method + */ + self.isScrollingHorizontally = false; + + /** + * @ngdoc property + * @name scrollDirection + * @propertyOf ui.grid.class:Grid + * @description set one of the uiGridConstants.scrollDirection values (UP, DOWN, LEFT, RIGHT, NONE), which tells + * us which direction we are scrolling. Set to NONE via debounced method + */ + self.scrollDirection = uiGridConstants.scrollDirection.NONE; + + //if true, grid will not respond to any scroll events + self.disableScrolling = false; + + + function vertical (scrollEvent) { + self.isScrollingVertically = false; + self.api.core.raise.scrollEnd(scrollEvent); + self.scrollDirection = uiGridConstants.scrollDirection.NONE; + } + + var debouncedVertical = gridUtil.debounce(vertical, self.options.scrollDebounce); + var debouncedVerticalMinDelay = gridUtil.debounce(vertical, 0); + + function horizontal (scrollEvent) { + self.isScrollingHorizontally = false; + self.api.core.raise.scrollEnd(scrollEvent); + self.scrollDirection = uiGridConstants.scrollDirection.NONE; + } + + var debouncedHorizontal = gridUtil.debounce(horizontal, self.options.scrollDebounce); + var debouncedHorizontalMinDelay = gridUtil.debounce(horizontal, 0); + + + /** + * @ngdoc function + * @name flagScrollingVertically + * @methodOf ui.grid.class:Grid + * @description sets isScrollingVertically to true and sets it to false in a debounced function + */ + self.flagScrollingVertically = function(scrollEvent) { + if (!self.isScrollingVertically && !self.isScrollingHorizontally) { + self.api.core.raise.scrollBegin(scrollEvent); + } + self.isScrollingVertically = true; + if (self.options.scrollDebounce === 0 || !scrollEvent.withDelay) { + debouncedVerticalMinDelay(scrollEvent); + } + else { + debouncedVertical(scrollEvent); + } + }; + + /** + * @ngdoc function + * @name flagScrollingHorizontally + * @methodOf ui.grid.class:Grid + * @description sets isScrollingHorizontally to true and sets it to false in a debounced function + */ + self.flagScrollingHorizontally = function(scrollEvent) { + if (!self.isScrollingVertically && !self.isScrollingHorizontally) { + self.api.core.raise.scrollBegin(scrollEvent); + } + self.isScrollingHorizontally = true; + if (self.options.scrollDebounce === 0 || !scrollEvent.withDelay) { + debouncedHorizontalMinDelay(scrollEvent); + } + else { + debouncedHorizontal(scrollEvent); + } + }; + + self.scrollbarHeight = 0; + self.scrollbarWidth = 0; + if (self.options.enableHorizontalScrollbar === uiGridConstants.scrollbars.ALWAYS) { + self.scrollbarHeight = gridUtil.getScrollbarWidth(); + } + + if (self.options.enableVerticalScrollbar === uiGridConstants.scrollbars.ALWAYS) { + self.scrollbarWidth = gridUtil.getScrollbarWidth(); + } + + + + self.api = new GridApi(self); + + /** + * @ngdoc function + * @name refresh + * @methodOf ui.grid.core.api:PublicApi + * @description Refresh the rendered grid on screen. + * The refresh method re-runs both the columnProcessors and the + * rowProcessors, as well as calling refreshCanvas to update all + * the grid sizing. In general you should prefer to use queueGridRefresh + * instead, which is basically a debounced version of refresh. + * + * If you only want to resize the grid, not regenerate all the rows + * and columns, you should consider directly calling refreshCanvas instead. + * + */ + self.api.registerMethod( 'core', 'refresh', this.refresh ); + + /** + * @ngdoc function + * @name queueGridRefresh + * @methodOf ui.grid.core.api:PublicApi + * @description Request a refresh of the rendered grid on screen, if multiple + * calls to queueGridRefresh are made within a digest cycle only one will execute. + * The refresh method re-runs both the columnProcessors and the + * rowProcessors, as well as calling refreshCanvas to update all + * the grid sizing. In general you should prefer to use queueGridRefresh + * instead, which is basically a debounced version of refresh. + * + */ + self.api.registerMethod( 'core', 'queueGridRefresh', this.queueGridRefresh ); + + /** + * @ngdoc function + * @name refreshRows + * @methodOf ui.grid.core.api:PublicApi + * @description Runs only the rowProcessors, columns remain as they were. + * It then calls redrawInPlace and refreshCanvas, which adjust the grid sizing. + * @returns {promise} promise that is resolved when render completes? + * + */ + self.api.registerMethod( 'core', 'refreshRows', this.refreshRows ); + + /** + * @ngdoc function + * @name queueRefresh + * @methodOf ui.grid.core.api:PublicApi + * @description Requests execution of refreshCanvas, if multiple requests are made + * during a digest cycle only one will run. RefreshCanvas updates the grid sizing. + * @returns {promise} promise that is resolved when render completes? + * + */ + self.api.registerMethod( 'core', 'queueRefresh', this.queueRefresh ); + + /** + * @ngdoc function + * @name handleWindowResize + * @methodOf ui.grid.core.api:PublicApi + * @description Trigger a grid resize, normally this would be picked + * up by a watch on window size, but in some circumstances it is necessary + * to call this manually + * @returns {promise} promise that is resolved when render completes? + * + */ + self.api.registerMethod( 'core', 'handleWindowResize', this.handleWindowResize ); + + + /** + * @ngdoc function + * @name addRowHeaderColumn + * @methodOf ui.grid.core.api:PublicApi + * @description adds a row header column to the grid + * @param {object} column def + * + */ + self.api.registerMethod( 'core', 'addRowHeaderColumn', this.addRowHeaderColumn ); + + /** + * @ngdoc function + * @name scrollToIfNecessary + * @methodOf ui.grid.core.api:PublicApi + * @description Scrolls the grid to make a certain row and column combo visible, + * in the case that it is not completely visible on the screen already. + * @param {GridRow} gridRow row to make visible + * @param {GridCol} gridCol column to make visible + * @returns {promise} a promise that is resolved when scrolling is complete + * + */ + self.api.registerMethod( 'core', 'scrollToIfNecessary', function(gridRow, gridCol) { return self.scrollToIfNecessary(gridRow, gridCol);} ); + + /** + * @ngdoc function + * @name scrollTo + * @methodOf ui.grid.core.api:PublicApi + * @description Scroll the grid such that the specified + * row and column is in view + * @param {object} rowEntity gridOptions.data[] array instance to make visible + * @param {object} colDef to make visible + * @returns {promise} a promise that is resolved after any scrolling is finished + */ + self.api.registerMethod( 'core', 'scrollTo', function (rowEntity, colDef) { return self.scrollTo(rowEntity, colDef);} ); + + /** + * @ngdoc function + * @name registerRowsProcessor + * @methodOf ui.grid.core.api:PublicApi + * @description + * Register a "rows processor" function. When the rows are updated, + * the grid calls each registered "rows processor", which has a chance + * to alter the set of rows (sorting, etc) as long as the count is not + * modified. + * + * @param {function(renderedRowsToProcess, columns )} processorFunction rows processor function, which + * is run in the context of the grid (i.e. this for the function will be the grid), and must + * return the updated rows list, which is passed to the next processor in the chain + * @param {number} priority the priority of this processor. In general we try to do them in 100s to leave room + * for other people to inject rows processors at intermediate priorities. Lower priority rowsProcessors run earlier. + * + * At present allRowsVisible is running at 50, sort manipulations running at 60-65, filter is running at 100, + * sort is at 200, grouping and treeview at 400-410, selectable rows at 500, pagination at 900 (pagination will generally want to be last) + */ + self.api.registerMethod( 'core', 'registerRowsProcessor', this.registerRowsProcessor ); + + /** + * @ngdoc function + * @name registerColumnsProcessor + * @methodOf ui.grid.core.api:PublicApi + * @description + * Register a "columns processor" function. When the columns are updated, + * the grid calls each registered "columns processor", which has a chance + * to alter the set of columns as long as the count is not + * modified. + * + * @param {function(renderedColumnsToProcess, rows )} processorFunction columns processor function, which + * is run in the context of the grid (i.e. this for the function will be the grid), and must + * return the updated columns list, which is passed to the next processor in the chain + * @param {number} priority the priority of this processor. In general we try to do them in 100s to leave room + * for other people to inject columns processors at intermediate priorities. Lower priority columnsProcessors run earlier. + * + * At present allRowsVisible is running at 50, filter is running at 100, sort is at 200, grouping at 400, selectable rows at 500, pagination at 900 (pagination will generally want to be last) + */ + self.api.registerMethod( 'core', 'registerColumnsProcessor', this.registerColumnsProcessor ); + + + + /** + * @ngdoc function + * @name sortHandleNulls + * @methodOf ui.grid.core.api:PublicApi + * @description A null handling method that can be used when building custom sort + * functions + * @example + *
        +     *   mySortFn = function(a, b) {
        +     *   var nulls = $scope.gridApi.core.sortHandleNulls(a, b);
        +     *   if ( nulls !== null ){
        +     *     return nulls;
        +     *   } else {
        +     *     // your code for sorting here
        +     *   };
        +     * 
        + * @param {object} a sort value a + * @param {object} b sort value b + * @returns {number} null if there were no nulls/undefineds, otherwise returns + * a sort value that should be passed back from the sort function + * + */ + self.api.registerMethod( 'core', 'sortHandleNulls', rowSorter.handleNulls ); + + + /** + * @ngdoc function + * @name sortChanged + * @methodOf ui.grid.core.api:PublicApi + * @description The sort criteria on one or more columns has + * changed. Provides as parameters the grid and the output of + * getColumnSorting, which is an array of gridColumns + * that have sorting on them, sorted in priority order. + * + * @param {$scope} scope The scope of the controller. This is used to deregister this event when the scope is destroyed. + * @param {Function} callBack Will be called when the event is emited. The function passes back an array of columns with + * sorts on them, in priority order. + * + * @example + *
        +     *      gridApi.core.on.sortChanged( $scope, function(sortColumns){
        +     *        // do something
        +     *      });
        +     * 
        + */ + self.api.registerEvent( 'core', 'sortChanged' ); + + /** + * @ngdoc function + * @name columnVisibilityChanged + * @methodOf ui.grid.core.api:PublicApi + * @description The visibility of a column has changed, + * the column itself is passed out as a parameter of the event. + * + * @param {$scope} scope The scope of the controller. This is used to deregister this event when the scope is destroyed. + * @param {Function} callBack Will be called when the event is emited. The function passes back the GridCol that has changed. + * + * @example + *
        +     *      gridApi.core.on.columnVisibilityChanged( $scope, function (column) {
        +     *        // do something
        +     *      } );
        +     * 
        + */ + self.api.registerEvent( 'core', 'columnVisibilityChanged' ); + + /** + * @ngdoc method + * @name notifyDataChange + * @methodOf ui.grid.core.api:PublicApi + * @description Notify the grid that a data or config change has occurred, + * where that change isn't something the grid was otherwise noticing. This + * might be particularly relevant where you've changed values within the data + * and you'd like cell classes to be re-evaluated, or changed config within + * the columnDef and you'd like headerCellClasses to be re-evaluated. + * @param {string} type one of the + * uiGridConstants.dataChange values (ALL, ROW, EDIT, COLUMN), which tells + * us which refreshes to fire. + * + */ + self.api.registerMethod( 'core', 'notifyDataChange', this.notifyDataChange ); + + /** + * @ngdoc method + * @name clearAllFilters + * @methodOf ui.grid.core.api:PublicApi + * @description Clears all filters and optionally refreshes the visible rows. + * @param {object} refreshRows Defaults to true. + * @param {object} clearConditions Defaults to false. + * @param {object} clearFlags Defaults to false. + * @returns {promise} If `refreshRows` is true, returns a promise of the rows refreshing. + */ + self.api.registerMethod('core', 'clearAllFilters', this.clearAllFilters); + + self.registerDataChangeCallback( self.columnRefreshCallback, [uiGridConstants.dataChange.COLUMN]); + self.registerDataChangeCallback( self.processRowsCallback, [uiGridConstants.dataChange.EDIT]); + self.registerDataChangeCallback( self.updateFooterHeightCallback, [uiGridConstants.dataChange.OPTIONS]); + + self.registerStyleComputation({ + priority: 10, + func: self.getFooterStyles + }); + }; + + Grid.prototype.calcFooterHeight = function () { + if (!this.hasFooter()) { + return 0; + } + + var height = 0; + if (this.options.showGridFooter) { + height += this.options.gridFooterHeight; + } + + height += this.calcColumnFooterHeight(); + + return height; + }; + + Grid.prototype.calcColumnFooterHeight = function () { + var height = 0; + + if (this.options.showColumnFooter) { + height += this.options.columnFooterHeight; + } + + return height; + }; + + Grid.prototype.getFooterStyles = function () { + var style = '.grid' + this.id + ' .ui-grid-footer-aggregates-row { height: ' + this.options.columnFooterHeight + 'px; }'; + style += ' .grid' + this.id + ' .ui-grid-footer-info { height: ' + this.options.gridFooterHeight + 'px; }'; + return style; + }; + + Grid.prototype.hasFooter = function () { + return this.options.showGridFooter || this.options.showColumnFooter; + }; + + /** + * @ngdoc function + * @name isRTL + * @methodOf ui.grid.class:Grid + * @description Returns true if grid is RightToLeft + */ + Grid.prototype.isRTL = function () { + return this.rtl; + }; + + + /** + * @ngdoc function + * @name registerColumnBuilder + * @methodOf ui.grid.class:Grid + * @description When the build creates columns from column definitions, the columnbuilders will be called to add + * additional properties to the column. + * @param {function(colDef, col, gridOptions)} columnBuilder function to be called + */ + Grid.prototype.registerColumnBuilder = function registerColumnBuilder(columnBuilder) { + this.columnBuilders.push(columnBuilder); + }; + + /** + * @ngdoc function + * @name buildColumnDefsFromData + * @methodOf ui.grid.class:Grid + * @description Populates columnDefs from the provided data + * @param {function(colDef, col, gridOptions)} rowBuilder function to be called + */ + Grid.prototype.buildColumnDefsFromData = function (dataRows){ + this.options.columnDefs = gridUtil.getColumnsFromData(dataRows, this.options.excludeProperties); + }; + + /** + * @ngdoc function + * @name registerRowBuilder + * @methodOf ui.grid.class:Grid + * @description When the build creates rows from gridOptions.data, the rowBuilders will be called to add + * additional properties to the row. + * @param {function(row, gridOptions)} rowBuilder function to be called + */ + Grid.prototype.registerRowBuilder = function registerRowBuilder(rowBuilder) { + this.rowBuilders.push(rowBuilder); + }; + + + /** + * @ngdoc function + * @name registerDataChangeCallback + * @methodOf ui.grid.class:Grid + * @description When a data change occurs, the data change callbacks of the specified type + * will be called. The rules are: + * + * - when the data watch fires, that is considered a ROW change (the data watch only notices + * added or removed rows) + * - when the api is called to inform us of a change, the declared type of that change is used + * - when a cell edit completes, the EDIT callbacks are triggered + * - when the columnDef watch fires, the COLUMN callbacks are triggered + * - when the options watch fires, the OPTIONS callbacks are triggered + * + * For a given event: + * - ALL calls ROW, EDIT, COLUMN, OPTIONS and ALL callbacks + * - ROW calls ROW and ALL callbacks + * - EDIT calls EDIT and ALL callbacks + * - COLUMN calls COLUMN and ALL callbacks + * - OPTIONS calls OPTIONS and ALL callbacks + * + * @param {function(grid)} callback function to be called + * @param {array} types the types of data change you want to be informed of. Values from + * the uiGridConstants.dataChange values ( ALL, EDIT, ROW, COLUMN, OPTIONS ). Optional and defaults to + * ALL + * @returns {function} deregister function - a function that can be called to deregister this callback + */ + Grid.prototype.registerDataChangeCallback = function registerDataChangeCallback(callback, types, _this) { + var uid = gridUtil.nextUid(); + if ( !types ){ + types = [uiGridConstants.dataChange.ALL]; + } + if ( !Array.isArray(types)){ + gridUtil.logError("Expected types to be an array or null in registerDataChangeCallback, value passed was: " + types ); + } + this.dataChangeCallbacks[uid] = { callback: callback, types: types, _this:_this }; + + var self = this; + var deregisterFunction = function() { + delete self.dataChangeCallbacks[uid]; + }; + return deregisterFunction; + }; + + /** + * @ngdoc function + * @name callDataChangeCallbacks + * @methodOf ui.grid.class:Grid + * @description Calls the callbacks based on the type of data change that + * has occurred. Always calls the ALL callbacks, calls the ROW, EDIT, COLUMN and OPTIONS callbacks if the + * event type is matching, or if the type is ALL. + * @param {number} type the type of event that occurred - one of the + * uiGridConstants.dataChange values (ALL, ROW, EDIT, COLUMN, OPTIONS) + */ + Grid.prototype.callDataChangeCallbacks = function callDataChangeCallbacks(type, options) { + angular.forEach( this.dataChangeCallbacks, function( callback, uid ){ + if ( callback.types.indexOf( uiGridConstants.dataChange.ALL ) !== -1 || + callback.types.indexOf( type ) !== -1 || + type === uiGridConstants.dataChange.ALL ) { + if (callback._this) { + callback.callback.apply(callback._this,this); + } + else { + callback.callback( this ); + } + } + }, this); + }; + + /** + * @ngdoc function + * @name notifyDataChange + * @methodOf ui.grid.class:Grid + * @description Notifies us that a data change has occurred, used in the public + * api for users to tell us when they've changed data or some other event that + * our watches cannot pick up + * @param {string} type the type of event that occurred - one of the + * uiGridConstants.dataChange values (ALL, ROW, EDIT, COLUMN) + */ + Grid.prototype.notifyDataChange = function notifyDataChange(type) { + var constants = uiGridConstants.dataChange; + if ( type === constants.ALL || + type === constants.COLUMN || + type === constants.EDIT || + type === constants.ROW || + type === constants.OPTIONS ){ + this.callDataChangeCallbacks( type ); + } else { + gridUtil.logError("Notified of a data change, but the type was not recognised, so no action taken, type was: " + type); + } + }; + + + /** + * @ngdoc function + * @name columnRefreshCallback + * @methodOf ui.grid.class:Grid + * @description refreshes the grid when a column refresh + * is notified, which triggers handling of the visible flag. + * This is called on uiGridConstants.dataChange.COLUMN, and is + * registered as a dataChangeCallback in grid.js + * @param {string} name column name + */ + Grid.prototype.columnRefreshCallback = function columnRefreshCallback( grid ){ + grid.buildColumns(); + grid.queueGridRefresh(); + }; + + + /** + * @ngdoc function + * @name processRowsCallback + * @methodOf ui.grid.class:Grid + * @description calls the row processors, specifically + * intended to reset the sorting when an edit is called, + * registered as a dataChangeCallback on uiGridConstants.dataChange.EDIT + * @param {string} name column name + */ + Grid.prototype.processRowsCallback = function processRowsCallback( grid ){ + grid.queueGridRefresh(); + }; + + + /** + * @ngdoc function + * @name updateFooterHeightCallback + * @methodOf ui.grid.class:Grid + * @description recalculates the footer height, + * registered as a dataChangeCallback on uiGridConstants.dataChange.OPTIONS + * @param {string} name column name + */ + Grid.prototype.updateFooterHeightCallback = function updateFooterHeightCallback( grid ){ + grid.footerHeight = grid.calcFooterHeight(); + grid.columnFooterHeight = grid.calcColumnFooterHeight(); + }; + + + /** + * @ngdoc function + * @name getColumn + * @methodOf ui.grid.class:Grid + * @description returns a grid column for the column name + * @param {string} name column name + */ + Grid.prototype.getColumn = function getColumn(name) { + var columns = this.columns.filter(function (column) { + return column.colDef.name === name; + }); + return columns.length > 0 ? columns[0] : null; + }; + + /** + * @ngdoc function + * @name getColDef + * @methodOf ui.grid.class:Grid + * @description returns a grid colDef for the column name + * @param {string} name column.field + */ + Grid.prototype.getColDef = function getColDef(name) { + var colDefs = this.options.columnDefs.filter(function (colDef) { + return colDef.name === name; + }); + return colDefs.length > 0 ? colDefs[0] : null; + }; + + /** + * @ngdoc function + * @name assignTypes + * @methodOf ui.grid.class:Grid + * @description uses the first row of data to assign colDef.type for any types not defined. + */ + /** + * @ngdoc property + * @name type + * @propertyOf ui.grid.class:GridOptions.columnDef + * @description the type of the column, used in sorting. If not provided then the + * grid will guess the type. Add this only if the grid guessing is not to your + * satisfaction. One of: + * - 'string' + * - 'boolean' + * - 'number' + * - 'date' + * - 'object' + * - 'numberStr' + * Note that if you choose date, your dates should be in a javascript date type + * + */ + Grid.prototype.assignTypes = function(){ + var self = this; + self.options.columnDefs.forEach(function (colDef, index) { + + //Assign colDef type if not specified + if (!colDef.type) { + var col = new GridColumn(colDef, index, self); + var firstRow = self.rows.length > 0 ? self.rows[0] : null; + if (firstRow) { + colDef.type = gridUtil.guessType(self.getCellValue(firstRow, col)); + } + else { + colDef.type = 'string'; + } + } + }); + }; + + + /** + * @ngdoc function + * @name isRowHeaderColumn + * @methodOf ui.grid.class:Grid + * @description returns true if the column is a row Header + * @param {object} column column + */ + Grid.prototype.isRowHeaderColumn = function isRowHeaderColumn(column) { + return this.rowHeaderColumns.indexOf(column) !== -1; + }; + + /** + * @ngdoc function + * @name addRowHeaderColumn + * @methodOf ui.grid.class:Grid + * @description adds a row header column to the grid + * @param {object} column def + */ + Grid.prototype.addRowHeaderColumn = function addRowHeaderColumn(colDef) { + var self = this; + var rowHeaderCol = new GridColumn(colDef, gridUtil.nextUid(), self); + rowHeaderCol.isRowHeader = true; + if (self.isRTL()) { + self.createRightContainer(); + rowHeaderCol.renderContainer = 'right'; + } + else { + self.createLeftContainer(); + rowHeaderCol.renderContainer = 'left'; + } + + // relies on the default column builder being first in array, as it is instantiated + // as part of grid creation + self.columnBuilders[0](colDef,rowHeaderCol,self.options) + .then(function(){ + rowHeaderCol.enableFiltering = false; + rowHeaderCol.enableSorting = false; + rowHeaderCol.enableHiding = false; + self.rowHeaderColumns.push(rowHeaderCol); + self.buildColumns() + .then( function() { + self.preCompileCellTemplates(); + self.queueGridRefresh(); + }); + }); + }; + + /** + * @ngdoc function + * @name getOnlyDataColumns + * @methodOf ui.grid.class:Grid + * @description returns all columns except for rowHeader columns + */ + Grid.prototype.getOnlyDataColumns = function getOnlyDataColumns() { + var self = this; + var cols = []; + self.columns.forEach(function (col) { + if (self.rowHeaderColumns.indexOf(col) === -1) { + cols.push(col); + } + }); + return cols; + }; + + /** + * @ngdoc function + * @name buildColumns + * @methodOf ui.grid.class:Grid + * @description creates GridColumn objects from the columnDefinition. Calls each registered + * columnBuilder to further process the column + * @param {object} options An object contains options to use when building columns + * + * * **orderByColumnDefs**: defaults to **false**. When true, `buildColumns` will reorder existing columns according to the order within the column definitions. + * + * @returns {Promise} a promise to load any needed column resources + */ + Grid.prototype.buildColumns = function buildColumns(opts) { + var options = { + orderByColumnDefs: false + }; + + angular.extend(options, opts); + + // gridUtil.logDebug('buildColumns'); + var self = this; + var builderPromises = []; + var headerOffset = self.rowHeaderColumns.length; + var i; + + // Remove any columns for which a columnDef cannot be found + // Deliberately don't use forEach, as it doesn't like splice being called in the middle + // Also don't cache columns.length, as it will change during this operation + for (i = 0; i < self.columns.length; i++){ + if (!self.getColDef(self.columns[i].name)) { + self.columns.splice(i, 1); + i--; + } + } + + //add row header columns to the grid columns array _after_ columns without columnDefs have been removed + self.rowHeaderColumns.forEach(function (rowHeaderColumn) { + self.columns.unshift(rowHeaderColumn); + }); + + + // look at each column def, and update column properties to match. If the column def + // doesn't have a column, then splice in a new gridCol + self.options.columnDefs.forEach(function (colDef, index) { + self.preprocessColDef(colDef); + var col = self.getColumn(colDef.name); + + if (!col) { + col = new GridColumn(colDef, gridUtil.nextUid(), self); + self.columns.splice(index + headerOffset, 0, col); + } + else { + // tell updateColumnDef that the column was pre-existing + col.updateColumnDef(colDef, false); + } + + self.columnBuilders.forEach(function (builder) { + builderPromises.push(builder.call(self, colDef, col, self.options)); + }); + }); + + /*** Reorder columns if necessary ***/ + if (!!options.orderByColumnDefs) { + // Create a shallow copy of the columns as a cache + var columnCache = self.columns.slice(0); + + // We need to allow for the "row headers" when mapping from the column defs array to the columns array + // If we have a row header in columns[0] and don't account for it we'll overwrite it with the column in columnDefs[0] + + // Go through all the column defs, use the shorter of columns length and colDefs.length because if a user has given two columns the same name then + // columns will be shorter than columnDefs. In this situation we'll avoid an error, but the user will still get an unexpected result + var len = Math.min(self.options.columnDefs.length, self.columns.length); + for (i = 0; i < len; i++) { + // If the column at this index has a different name than the column at the same index in the column defs... + if (self.columns[i + headerOffset].name !== self.options.columnDefs[i].name) { + // Replace the one in the cache with the appropriate column + columnCache[i + headerOffset] = self.getColumn(self.options.columnDefs[i].name); + } + else { + // Otherwise just copy over the one from the initial columns + columnCache[i + headerOffset] = self.columns[i + headerOffset]; + } + } + + // Empty out the columns array, non-destructively + self.columns.length = 0; + + // And splice in the updated, ordered columns from the cache + Array.prototype.splice.apply(self.columns, [0, 0].concat(columnCache)); + } + + return $q.all(builderPromises).then(function(){ + if (self.rows.length > 0){ + self.assignTypes(); + } + }); + }; + +/** + * @ngdoc function + * @name preCompileCellTemplates + * @methodOf ui.grid.class:Grid + * @description precompiles all cell templates + */ + Grid.prototype.preCompileCellTemplates = function() { + var self = this; + + var preCompileTemplate = function( col ) { + var html = col.cellTemplate.replace(uiGridConstants.MODEL_COL_FIELD, self.getQualifiedColField(col)); + html = html.replace(uiGridConstants.COL_FIELD, 'grid.getCellValue(row, col)'); + + var compiledElementFn = $compile(html); + col.compiledElementFn = compiledElementFn; + + if (col.compiledElementFnDefer) { + col.compiledElementFnDefer.resolve(col.compiledElementFn); + } + }; + + this.columns.forEach(function (col) { + if ( col.cellTemplate ){ + preCompileTemplate( col ); + } else if ( col.cellTemplatePromise ){ + col.cellTemplatePromise.then( function() { + preCompileTemplate( col ); + }); + } + }); + }; + + /** + * @ngdoc function + * @name getGridQualifiedColField + * @methodOf ui.grid.class:Grid + * @description Returns the $parse-able accessor for a column within its $scope + * @param {GridColumn} col col object + */ + Grid.prototype.getQualifiedColField = function (col) { + return 'row.entity.' + gridUtil.preEval(col.field); + }; + + /** + * @ngdoc function + * @name createLeftContainer + * @methodOf ui.grid.class:Grid + * @description creates the left render container if it doesn't already exist + */ + Grid.prototype.createLeftContainer = function() { + if (!this.hasLeftContainer()) { + this.renderContainers.left = new GridRenderContainer('left', this, { disableColumnOffset: true }); + } + }; + + /** + * @ngdoc function + * @name createRightContainer + * @methodOf ui.grid.class:Grid + * @description creates the right render container if it doesn't already exist + */ + Grid.prototype.createRightContainer = function() { + if (!this.hasRightContainer()) { + this.renderContainers.right = new GridRenderContainer('right', this, { disableColumnOffset: true }); + } + }; + + /** + * @ngdoc function + * @name hasLeftContainer + * @methodOf ui.grid.class:Grid + * @description returns true if leftContainer exists + */ + Grid.prototype.hasLeftContainer = function() { + return this.renderContainers.left !== undefined; + }; + + /** + * @ngdoc function + * @name hasRightContainer + * @methodOf ui.grid.class:Grid + * @description returns true if rightContainer exists + */ + Grid.prototype.hasRightContainer = function() { + return this.renderContainers.right !== undefined; + }; + + + /** + * undocumented function + * @name preprocessColDef + * @methodOf ui.grid.class:Grid + * @description defaults the name property from field to maintain backwards compatibility with 2.x + * validates that name or field is present + */ + Grid.prototype.preprocessColDef = function preprocessColDef(colDef) { + var self = this; + + if (!colDef.field && !colDef.name) { + throw new Error('colDef.name or colDef.field property is required'); + } + + //maintain backwards compatibility with 2.x + //field was required in 2.x. now name is required + if (colDef.name === undefined && colDef.field !== undefined) { + // See if the column name already exists: + var newName = colDef.field, + counter = 2; + while (self.getColumn(newName)) { + newName = colDef.field + counter.toString(); + counter++; + } + colDef.name = newName; + } + }; + + // Return a list of items that exist in the `n` array but not the `o` array. Uses optional property accessors passed as third & fourth parameters + Grid.prototype.newInN = function newInN(o, n, oAccessor, nAccessor) { + var self = this; + + var t = []; + for (var i = 0; i < n.length; i++) { + var nV = nAccessor ? n[i][nAccessor] : n[i]; + + var found = false; + for (var j = 0; j < o.length; j++) { + var oV = oAccessor ? o[j][oAccessor] : o[j]; + if (self.options.rowEquality(nV, oV)) { + found = true; + break; + } + } + if (!found) { + t.push(nV); + } + } + + return t; + }; + + /** + * @ngdoc function + * @name getRow + * @methodOf ui.grid.class:Grid + * @description returns the GridRow that contains the rowEntity + * @param {object} rowEntity the gridOptions.data array element instance + * @param {array} rows [optional] the rows to look in - if not provided then + * looks in grid.rows + */ + Grid.prototype.getRow = function getRow(rowEntity, lookInRows) { + var self = this; + + lookInRows = typeof(lookInRows) === 'undefined' ? self.rows : lookInRows; + + var rows = lookInRows.filter(function (row) { + return self.options.rowEquality(row.entity, rowEntity); + }); + return rows.length > 0 ? rows[0] : null; + }; + + + /** + * @ngdoc function + * @name modifyRows + * @methodOf ui.grid.class:Grid + * @description creates or removes GridRow objects from the newRawData array. Calls each registered + * rowBuilder to further process the row + * @param {array} newRawData Modified set of data + * + * This method aims to achieve three things: + * 1. the resulting rows array is in the same order as the newRawData, we'll call + * rowsProcessors immediately after to sort the data anyway + * 2. if we have row hashing available, we try to use the rowHash to find the row + * 3. no memory leaks - rows that are no longer in newRawData need to be garbage collected + * + * The basic logic flow makes use of the newRawData, oldRows and oldHash, and creates + * the newRows and newHash + * + * ``` + * newRawData.forEach newEntity + * if (hashing enabled) + * check oldHash for newEntity + * else + * look for old row directly in oldRows + * if !oldRowFound // must be a new row + * create newRow + * append to the newRows and add to newHash + * run the processors + * ``` + * + * Rows are identified using the hashKey if configured. If not configured, then rows + * are identified using the gridOptions.rowEquality function + * + * This method is useful when trying to select rows immediately after loading data without + * using a $timeout/$interval, e.g.: + * + * $scope.gridOptions.data = someData; + * $scope.gridApi.grid.modifyRows($scope.gridOptions.data); + * $scope.gridApi.selection.selectRow($scope.gridOptions.data[0]); + * + * OR to persist row selection after data update (e.g. rows selected, new data loaded, want + * originally selected rows to be re-selected)) + */ + Grid.prototype.modifyRows = function modifyRows(newRawData) { + var self = this; + var oldRows = self.rows.slice(0); + var oldRowHash = self.rowHashMap || self.createRowHashMap(); + self.rowHashMap = self.createRowHashMap(); + self.rows.length = 0; + + newRawData.forEach( function( newEntity, i ) { + var newRow; + if ( self.options.enableRowHashing ){ + // if hashing is enabled, then this row will be in the hash if we already know about it + newRow = oldRowHash.get( newEntity ); + } else { + // otherwise, manually search the oldRows to see if we can find this row + newRow = self.getRow(newEntity, oldRows); + } + + // if we didn't find the row, it must be new, so create it + if ( !newRow ){ + newRow = self.processRowBuilders(new GridRow(newEntity, i, self)); + } + + self.rows.push( newRow ); + self.rowHashMap.put( newEntity, newRow ); + }); + + self.assignTypes(); + + var p1 = $q.when(self.processRowsProcessors(self.rows)) + .then(function (renderableRows) { + return self.setVisibleRows(renderableRows); + }); + + var p2 = $q.when(self.processColumnsProcessors(self.columns)) + .then(function (renderableColumns) { + return self.setVisibleColumns(renderableColumns); + }); + + return $q.all([p1, p2]); + }; + + + /** + * Private Undocumented Method + * @name addRows + * @methodOf ui.grid.class:Grid + * @description adds the newRawData array of rows to the grid and calls all registered + * rowBuilders. this keyword will reference the grid + */ + Grid.prototype.addRows = function addRows(newRawData) { + var self = this; + + var existingRowCount = self.rows.length; + for (var i = 0; i < newRawData.length; i++) { + var newRow = self.processRowBuilders(new GridRow(newRawData[i], i + existingRowCount, self)); + + if (self.options.enableRowHashing) { + var found = self.rowHashMap.get(newRow.entity); + if (found) { + found.row = newRow; + } + } + + self.rows.push(newRow); + } + }; + + /** + * @ngdoc function + * @name processRowBuilders + * @methodOf ui.grid.class:Grid + * @description processes all RowBuilders for the gridRow + * @param {GridRow} gridRow reference to gridRow + * @returns {GridRow} the gridRow with all additional behavior added + */ + Grid.prototype.processRowBuilders = function processRowBuilders(gridRow) { + var self = this; + + self.rowBuilders.forEach(function (builder) { + builder.call(self, gridRow, self.options); + }); + + return gridRow; + }; + + /** + * @ngdoc function + * @name registerStyleComputation + * @methodOf ui.grid.class:Grid + * @description registered a styleComputation function + * + * If the function returns a value it will be appended into the grid's `
        " + ); + + + $templateCache.put('ui-grid/uiGridCell', + "
        {{COL_FIELD CUSTOM_FILTERS}}
        " + ); + + + $templateCache.put('ui-grid/uiGridColumnMenu', + "
        " + ); + + + $templateCache.put('ui-grid/uiGridFooterCell', + "
        {{ col.getAggregationText() + ( col.getAggregationValue() CUSTOM_FILTERS ) }}
        " + ); + + + $templateCache.put('ui-grid/uiGridHeaderCell', + "
        {{ col.displayName CUSTOM_FILTERS }} {{col.sort.priority}}
         
        " + ); + + + $templateCache.put('ui-grid/uiGridMenu', + "
        " + ); + + + $templateCache.put('ui-grid/uiGridMenuItem', + "" + ); + + + $templateCache.put('ui-grid/uiGridRenderContainer', + "
        " + ); + + + $templateCache.put('ui-grid/uiGridViewport', + "
        " + ); + + + $templateCache.put('ui-grid/cellEditor', + "
        " + ); + + + $templateCache.put('ui-grid/dropdownEditor', + "
        " + ); + + + $templateCache.put('ui-grid/fileChooserEditor', + "
        " + ); + + + $templateCache.put('ui-grid/expandableRow', + "
        " + ); + + + $templateCache.put('ui-grid/expandableRowHeader', + "
        " + ); + + + $templateCache.put('ui-grid/expandableScrollFiller', + "
        " + ); + + + $templateCache.put('ui-grid/expandableTopRowHeader', + "
        " + ); + + + $templateCache.put('ui-grid/csvLink', + "LINK_LABEL" + ); + + + $templateCache.put('ui-grid/importerMenuItem', + "
      • " + ); + + + $templateCache.put('ui-grid/importerMenuItemContainer', + "
        " + ); + + + $templateCache.put('ui-grid/pagination', + "
        0\">/ {{ paginationApi.getTotalPages() }}
        1\"> {{sizesLabel}}
        {{grid.options.paginationPageSize}} {{sizesLabel}}
        0\">{{showingLow}} - {{showingHigh}} {{paginationOf}} {{grid.options.totalItems}} {{totalItemsLabel}}
        " + ); + + + $templateCache.put('ui-grid/columnResizer', + "
        " + ); + + + $templateCache.put('ui-grid/gridFooterSelectedItems', + "({{\"search.selectedItems\" | t}} {{grid.selection.selectedCount}})" + ); + + + $templateCache.put('ui-grid/selectionHeaderCell', + "
        " + ); + + + $templateCache.put('ui-grid/selectionRowHeader', + "
        " + ); + + + $templateCache.put('ui-grid/selectionRowHeaderButtons', + "
         
        " + ); + + + $templateCache.put('ui-grid/selectionSelectAllButtons', + "
        " + ); + + + $templateCache.put('ui-grid/treeBaseExpandAllButtons', + "
        0 && grid.treeBase.expandAll, 'ui-grid-icon-plus-squared': grid.treeBase.numberLevels > 0 && !grid.treeBase.expandAll}\" ng-click=\"headerButtonClick($event)\">
        " + ); + + + $templateCache.put('ui-grid/treeBaseHeaderCell', + "
        " + ); + + + $templateCache.put('ui-grid/treeBaseRowHeader', + "
        " + ); + + + $templateCache.put('ui-grid/treeBaseRowHeaderButtons', + "
        -1 }\" ng-click=\"treeButtonClick(row, $event)\"> -1 ) || ( row.treeNode.children && row.treeNode.children.length > 0 ) ) && row.treeNode.state === 'expanded', 'ui-grid-icon-plus-squared': ( ( grid.options.showTreeExpandNoChildren && row.treeLevel > -1 ) || ( row.treeNode.children && row.treeNode.children.length > 0 ) ) && row.treeNode.state === 'collapsed'}\" ng-style=\"{'padding-left': grid.options.treeIndent * row.treeLevel + 'px'}\">  
        " + ); + +}]); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.svg b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.svg new file mode 100644 index 0000000..3d675f6 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.svg @@ -0,0 +1,34 @@ + + + +Copyright (C) 2015 by original authors @ fontello.com + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.ttf b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.ttf new file mode 100644 index 0000000..dbf56e9 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.ttf differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.woff b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.woff new file mode 100644 index 0000000..fb19c43 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/ui-grid.woff differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/vfs_fonts.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/vfs_fonts.js new file mode 100644 index 0000000..f5fd30a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/raptor/uigrid/vfs_fonts.js @@ -0,0 +1 @@ +window.pdfMake = window.pdfMake || {}; window.pdfMake.vfs = {"LICENSE.txt":"DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBcGFjaGUgTGljZW5zZQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgVmVyc2lvbiAyLjAsIEphbnVhcnkgMjAwNA0KICAgICAgICAgICAgICAgICAgICAgICAgaHR0cDovL3d3dy5hcGFjaGUub3JnL2xpY2Vuc2VzLw0KDQogICBURVJNUyBBTkQgQ09ORElUSU9OUyBGT1IgVVNFLCBSRVBST0RVQ1RJT04sIEFORCBESVNUUklCVVRJT04NCg0KICAgMS4gRGVmaW5pdGlvbnMuDQoNCiAgICAgICJMaWNlbnNlIiBzaGFsbCBtZWFuIHRoZSB0ZXJtcyBhbmQgY29uZGl0aW9ucyBmb3IgdXNlLCByZXByb2R1Y3Rpb24sDQogICAgICBhbmQgZGlzdHJpYnV0aW9uIGFzIGRlZmluZWQgYnkgU2VjdGlvbnMgMSB0aHJvdWdoIDkgb2YgdGhpcyBkb2N1bWVudC4NCg0KICAgICAgIkxpY2Vuc29yIiBzaGFsbCBtZWFuIHRoZSBjb3B5cmlnaHQgb3duZXIgb3IgZW50aXR5IGF1dGhvcml6ZWQgYnkNCiAgICAgIHRoZSBjb3B5cmlnaHQgb3duZXIgdGhhdCBpcyBncmFudGluZyB0aGUgTGljZW5zZS4NCg0KICAgICAgIkxlZ2FsIEVudGl0eSIgc2hhbGwgbWVhbiB0aGUgdW5pb24gb2YgdGhlIGFjdGluZy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RgImACMAAAAHAJoBBgFd////1QAABNQHUQImACMAAAAHAKABJQFg////1QAABMwHDAImACMAAAAHAGgBBwFc////1QAABH8HiAImACMAAAAHAJ4BkgGo////1QAABMYHnwImACMAAAAHAdQBiQEs//8AYv5EBPgFxQAmACUAAAAHAHcBt//3//8AWAAABPIHIgImACcAAAAHAEIBNwFd//8AWAAABPIHHwImACcAAAAHAHMB4wFZ//8AWAAABPIHRgImACcAAAAHAJoA0gFd//8AWAAABPIHDAImACcAAAAHAGgA0wFc//8AYgAAAkQHIgImACsAAAAHAEL//AFd//8AYgAAA1MHHwImACsAAAAHAHMApwFZ//8AYgAAAx4HRgImACsAAAAHAJr/lwFd//8AYgAAA10HDAImACsAAAAHAGj/mAFc//8AWAAABXoHUQImADAAAAAHAKABTgFg//8AXv/rBTYHNwAmADEAAAAHAEIBjAFy//8AXv/rBTYHNAAmADEAAAAHAHMCOAFu//8AXv/rBTYHWwAmADEAAAAHAJoBJwFy//8AXv/rBTYHZgAmADEAAAAHAKABRgF1//8AXv/rBTYHIQAmADEAAAAHAGgBKAFx//8AZ//rBVcHIgImADcAAAAHAEIBdwFd//8AZ//rBVcHHwImADcAAAAHAHMCIwFZ//8AZ//rBVcHRgImADcAAAAHAJoBEgFd//8AZ//rBVcHDAImADcAAAAHAGgBEwFc//8A7gAABVMHHQImADsAAAAHAHMB6QFX//8AOv/sA/cF4AImAEMAAAAHAEIAswAb//8AOv/sBAsF3QImAEMAAAAHAHMBXwAX//8AOv/sA/cGBAImAEMAAAAGAJpOGwAA//8AOv/sBBwGDwImAEMAAAAGAKBtHgAA//8AOv/sBBQFygImAEMAAAAGAGhPGgAA//8AOv/sA/cGRgImAEMAAAAHAJ4A2gBm//8AOv/sBA4GXgImAEMAAAAHAdQA0f/r//8AR/5EA/sETgImAEUAAAAHAHcBOf/3//8AR//sA+sF4QImAEcAAAAHAEIAkQAc//8AR//sA+sF3gImAEcAAAAHAHMBPQAY//8AR//sA+sGBQImAEcAAAAGAJosHAAA//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D0FywImAEkAAAAHAJ0BFwAb//8AaP3lBQ8FxQImACkAAAAHAZEBRv62//8AN/5LBD0GbQImAEkAAAAHAaUBKABW//8AWAAABXkHRgImACoAAAAHAJoBKQFd//8ANQAABBkHRQImAEoAAAAHAJoAYwFc//8AYgAAA2UHUQImACsAAAAHAKD/tgFg//8APgAAAv4F+gImAIoAAAAHAKD/TwAJ//8AYgAAA28G+gImACsAAAAHAG7/twFK//8APgAAAwgFpAImAIoAAAAHAG7/UP/0//8AYgAAA0EHTAImACsAAAAHAJz/8gGc//8APgAAAtoF9QImAIoAAAAGAJyLRQAA////mv5YAjoFsAImACsAAAAGAJ/jCAAA////e/5QAjEGGAImAEsAAAAGAJ/EAAAA//8AYgAAAogHDQImACsAAAAHAJ0AVwFd//8AYv/rBnYFsAAmACsAAAAHACwCJAAA//8ARP5LBCEGGAAmAEsAAAAHAEwB6AAA//8AD//rBSwHOQImACwAAAAHAJoBpQFQ////G/5LAsQF3AImAJgAAAAHAJr/Pf/z//8APv31BTUFsAAmAC0AAAAHAZEBIP7G//8ANv33BCgGGAImAE0AAAAHAZEAxP7I//8AWAAAA60G4AImAC4AAAAHAHMAjwEa//8ARAAAA0MHXAImAE4AAAAHAHMAlwGW//8AWP33A60FsAImAC4AAAAHAZEBGv7I////qP33AjEGGAImAE4AAAAHAZH/wv7I//8AWAAAA9UFsQImAC4AAAAHAZECsgTF//8ARAAAA3IGGAAmAE4AAAAHAZECTwUs//8AWAAAA60FsAImAC4AAAAHAJ0BNP3F//8ARAAAAukGGAAmAE4AAAAHAJ0AuP23//8AWAAABXoHHwImADAAAAAHAHMCQAFZ//8ANQAABCEF3QImAFAAAAAHAHMBdQAX//8AWP33BXoFsAImADAAAAAHAZEBd/7I//8ANf33BBgETgImAFAAAAAHAZEA7P7I//8AWAAABXoHRwImADAAAAAHAJsBRQFe//8ANQAABCMGBQImAFAAAAAGAJt6HAAA//8ANQAABBgGGAImAFAAAAAHAZEAiwUs//8AXv/rBTYHDwAmADEAA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GDgImAaYAAAAHAKAAkwAd////1AAABDoFyQImAaYAAAAGAGh1GQAA////1AAAA+gGRQImAaYAAAAHAJ4BAABl////1AAABDQGXQImAaYAAAAHAdQA9//q//8ATf5HBEIEnQImAagAAAAHAHcBU//6//8APgAABB0F3wImAaoAAAAHAEIAqgAa//8APgAABB0F3AImAaoAAAAHAHMBVgAW//8APgAABB0GAwImAaoAAAAGAJpFGgAA//8APgAABB0FyQImAaoAAAAGAGhGGQAA//8APgAAAd8F3wImAa4AAAAGAEKXGgAA//8APgAAAu4F3AImAa4AAAAGAHNCFgAA//8APgAAArkGAwImAa4AAAAHAJr/MgAa//8APgAAAvgFyQImAa4AAAAHAGj/MwAZ//8APgAABL4GDgImAbMAAAAHAKAAsQAd//8ATf/vBG8F7wImAbQAAAAHAEIA3QAq//8ATf/vBG8F7AImAbQAAAAHAHMBiQAm//8ATf/vBG8GEwImAbQAAAAGAJp4KgAA//8ATf/vBG8GHgImAbQAAAAHAKAAlwAt//8ATf/vBG8F2QImAbQAAAAGAGh5KQAA//8AWP/vBLwF4AImAbkAAAAHAEIA9QAb//8AWP/vBLwF3QImAbkAAAAHAHMBoQAX//8AWP/vBLwGBAImAbkAAAAHAJoAkAAb//8AWP/vBLwFygImAbkAAAAHAGgAkQAa//8AtQAABIEF2wImAb0AAAAHAHMBWAAV////1AAABEwFtwImAaYAAAAHAG4AlAAH////1AAABB4GCQImAaYAAAAHAJwAzwBZAAL/1P5QA+gEjQAaAB4AAAETIw4BBwYWMzI2NwcOASMiJjc+ATcnIQMjAQMhAycDHcs3V2IJBhsoGTAXByBMMk9YDwtqZin+J5i8Ap74AXBRAwSN+3M+ZDwlJRELeBMZY1pMgDj//vAEjf0XAfsBAP//AE3/7wRCBewCJgGoAAAABwBzAXoAJv//AE3/7wRCBhMCJgGoAAAABgCaaSoAAP//AE3/7wRCBdoCJgGoAAAABwCdASoAKv//AE3/7wRCBhQCJgGoAAAABgCbfysAAP//AD4AAARJBgQCJgGpAAAABgCbLhsAAP//AD4AAAQdBbcCJgGqAAAABgBuZQcAAP//AD4AAAQdBgkCJgGqAAAABwCcAKAAWf//AD4AAAQdBcoCJgGqAAAABwCdAQYAGgABAD7+UAQdBI0AIAAAASEDIQcjDgEHBhYzMjY3Bw4BIyImNz4BNychEyEHIQMhA0/+EE0CPx1CV2IJBhsoGTAXByBMMk9YDwtaVAH99ukC9h79wUMB7wIV/n6TPmQ8JSURC3gTGWNaRngyAwSNlP6wAAAA//8APgAABB0GBAImAaoAAAAGAJtbGwAA//8ASv/vBF4GEwImAawAAAAGAJpzKgAA//8ASv/vBF4GGQImAawAAAAHAJwAzgBp//8ASv/vBF4F2gImAawAAAAHAJ0BNAAq//8ASv3nBF4EnQImAawAAAAHAZEA9/64//8APgAABKQGAwImAa0AAAAGAJp7GgAA//8APgAAAwAGDgImAa4AAAAHAKD/UQAd//8APgAAAwoFtwImAa4AAAAHAG7/UgAH//8APgAAAtwGCQImAa4AAAAGAJyNWQAA////c/5QAd0EjQImAa4AAAAGAJ+8AAAA//8APgAAAiQFygImAa4AAAAGAJ3zGgAA//8AC//vBKYF+QImAa8AAAAHAJoBHwAQ//8APv3zBHEEjQImAbAAAAAHAZEArP7E//8APgAAAvsFwQImAbEAAAAGAHND+wAA//8APv31AvsEjQImAbEAAAAHAZEAjP7G//8APgAAAxAEjgImAbEAAAAHAZEB7QOi//8APgAAAvsEjQImAbEAAAAHAJ0Aif0m//8APgAABL4F3AImAbMAAAAHAHMBowAW//8APv31BL4EjQImAbMAAAAHAZEBGv7G//8APgAABL4GBAImAbMAAAAHAJsAqAAb//8ATf/vBG8FxwImAbQAAAAHAG4AmAAX//8ATf/vBG8GGQImAbQAAAAHAJwA0wBp//8ATf/vBOoGGAImAbQAAAAHAKEA+wAq//8APgAABD8F3AImAbYAAAAHAHMBOQAW//8APv31BD8EjQImAbYAAAAHAZEAsP7G//8APgAABD8GBAImAbYAAAAGAJs+GwAA//8AI//vBDIF7AImAbcAAAAHAHMBZAAm//8AI//vBDI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gAAAV6B0wCJgDXAAAABwCcAY4BnP//AFgAAAazBbACBgAvAAD//wBYAAAFeQWwAgYAKgAA//8AXv/rBTYFxQAGADEAAP//AFgAAAV7BbACBgCxAAD//wBYAAAFGAWwAgYAMgAA//8AYv/rBPgFxQAGACUAAP//AOwAAAULBbACBgA2AAD////8AAAFHQWwAgYAOgAA//8AOv/sA/cETgIGAEMAAP//AEf/7APrBE4CBgBHAAD//wBAAAAERwX1AiYA6wAAAAcAnADIAEX//wBG/+wEHAROAgYAUQAA////4v5gBCYETgIGAFIAAAABAEf/7AP7BE4AGwAAJTI2NzMGBCMiAj8BNgAzMhYHIzYmIyIGDwEGFgHxWqAPrBn+8qbXuyUHJwER4a7BGqwQameNpBoHHFWBeFyazwEy6ir1ASfeqmyG4qQqsdYAAP///7z+SwQqBDoCBgBbAAD////pAAAD8QQ6AgYAWgAA//8AR//sA/IFywImAEcAAAAGAGgtGwAA//8APgAAA5UFyAImAOcAAAAHAHMA5wAC//8AO//sA8kETgIGAFUAAP//AEQAAAIxBhgCBgBLAAD//wA+AAAC9gW1AiYAigAAAAcAaP8xAAX///8d/ksCOQYYAgYATAAA//8AQAAABGEFxwImAOwAAAAHAHMBTQAB////vP5LBCoF9QImAFsAAAAGAJx/RQAA//8A7AAABuwHIgImADkAAAAHAEICAQFd//8AsgAABfoFywImAFkAAAAHAEIBegAG//8A7AAABuwHHwImADkAAAAHAHMCrQFZ//8AsgAABfoFyAImAFkAAAAHAHMCJgAC//8A7AAABuwHDAImADkAAAAHAGgBnQFc//8AsgAABfoFtQImAFkAAAAHAGgBFgAF//8A7gAABVMHIAImADsAAAAHAEIBPQFb////vP5LBCoFywImAFsAAAAHAEIAiQAG//8AxgQjAagGGAIGAAkAAP//AMUEFAK9BhgCBgAEAAD//wBPAAAEJQWwACYEHAAAAAcEHAH9AAD//wCKAAAEzAYtACYASAAAAAcATgKbAAD///8b/ksC/AXdAiYAmAAAAAcAm/9T//T//wCxA+cCIAYYAgYBZgAA//8AWAA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FEbAAD////KAAAHXQcMAiYA1QAAAAcAaAHyAVz////DAAAGAQW1AiYA6QAAAAcAaAFKAAX//wAg/+sEsAchAiYA1gAAAAcAaADCAXH//wAe/+0D8gXJAiYA6gAAAAYAaC0ZAAD//wBYAAAFegb6AiYA1wAAAAcAbgFTAUr//wBAAAAERwWkAiYA6wAAAAcAbgCN//T//wBYAAAFegcMAiYA1wAAAAcAaAE0AVz//wBAAAAERwW1AiYA6wAAAAYAaG4FAAD//wBe/+sFNgchACYAMQAAAAcAaAEoAXH//wBG/+wEHAXKAiYAUQAAAAYAaEMaAAD//wBd/+sFNwXFAgYBEgAA//8ARv/sBBwETgIGARMAAP//AF3/6wU3BwcCJgESAAAABwBoAScBV///AEb/7AQeBeYCJgETAAAABgBoWTYAAP//AIf/7AU0ByICJgDiAAAABwBoARQBcv//ADP/6wQNBcoCJgD6AAAABgBoSBoAAP//AKP/6wVFBvoCJgDZAAAABwBuAQMBSv///7z+SwQqBaQCJgBbAAAABgBuRPQAAP//AKP/6wVFBwwCJgDZAAAABwBoAOQBXP///7z+SwQqBbUCJgBbAAAABgBoJQUAAP//AKP/6wVVB0sCJgDZAAAABwChAWYBXf///7z+SwSWBfQCJgBbAAAABwChAKcABv//ANEAAAVIBwwCJgDcAAAABwBoAQsBXP//AH8AAAQGBbUCJgD0AAAABgBoLwUAAP//AFcAAAaiBwwAJgDhDwAAJwArBGgAAAAHAGgByAFc//8AQAAABasFtQAmAPkAAAAnAIoD3gAAAAcAaAEjAAX////8/ksFHQWwAiYAOgAAAAcBmgN+AAD////p/ksD8QQ6AiYAWgAAAAcBmgKWAAD//wBE/+sElQYYAgYARgAA////3v5LBXEFsAImANgAAAAHAZoD/AAA////1f5LBEkEOgImAO0AAAAHAZoDHwAA////1f6xBH8FsAImACMAAAAHAKgErAAA//8AOv6xA/cETgImAEMAAAAHAKgEBQAA////1QAABH8HxgImACMAAAAHAKYE5QFT//8AOv/sA/cGhAImAEMAAAAHAKYELQAR////1QAABg4HqAImACMAAAAHAaMA8AEW//8AOv/sBVYGZwImAEMAAAAGAaM41QAA////1QAABLcHpQImACMAAAAHAaIA+gEl//8AOv/sA/8GZAImAEMAAAAGAaJC5AAA////1QAABZ4H2wImACMAAAAHAaEA9QEN//8AOv/sBOYGmgImAEMAAAAGAaE9zAAA////1QAABLYH5QImACMAAAAHAaAA9gET//8AOv/sA/4GpAImAEMAAAAGAaA+0gAA////1f6xBI0HRgImACMAAAAnAJoBBgFdAAcAqASsAAD//wA6/rED9wYEAiYAQwAAACYAmk4bAAcAqAQFAAAAAP///9UAAASqB90CJgAjAAAABwGfASkBVP//ADr/7AP3BpsCJgBDAAAABgGfcRIAAP///9UAAATOB+ACJgAjAAAABwGkAS8BZ///ADr/7AQWBp4CJgBDAAAABgGkdyUAAP///9UAAASVCEsCJgAjAAAABwGeASkBSf//ADr/7AP3BwkCJgBDAAAABgGecQcAAP///9UAAATMCB8CJgAjAAAABwGdASsBUf//ADr/7AQUBt0CJgBDAAAABgGdcw8AAP///9X+sQSwB0wCJgAjAAAAJwCcAWEBnAAHAKgErAAA//8AOv6xA/gGCgImAEMAAAAnAJwAqQBaAAcAqAQFAAD//wBY/rsE8gWwAiYAJwAAAAcAqAR3AAr//wBH/rED6wROAiYARwAAAAcAqARRAAD//wBYAAAE8gfGAiYAJwAAAAcApgSxAVP//wBH/+wD6waFAiYARwAAAAcApgQLABL//wBYAAAE8gdRAiYAJwAAAAcAoADxAWD//wBH/+wD+gYQAiYARwAAAAYAoEsfAAD//wBYAAAF2geoAiYAJwAAAAcBowC8ARb//wBH/+wFNAZoAiYARwAAAAYBoxbWAAD//wBYAAAE8gelAiYAJwAAAAcBogDGASX//wBH/+wD6wZlAiYARwAAAAYBoiDlAAD//wBYAAAFagfbAiYAJwAAAAcBoQDBAQ3//wBH/+wExAabAiYARwAAAAYBoRvNAAD//wBYAAAE8gflAiYAJwAAAAcBoADCARP//wBH/+wD6walAiYARwAAAAYBoBzTAAD//wBY/rsE8gdGAiYAJwAAACc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gCWAAAABwBzAiIBWf//AFr/7AVXBcgCJgCXAAAABwBzAXIAAv//AGf/6walByICJgCWAAAABwBCAXYBXf//AFr/7AVXBcsCJgCXAAAABwBCAMYABv//AGf/6walB8YCJgCWAAAABwCmBPABU///AFr/7AVXBnACJgCXAAAABwCmBED//f//AGf/6walB1ECJgCWAAAABwCgATABYP//AFr/7AVXBfoCJgCXAAAABwCgAIAACf//AGf+qQalBg0CJgCWAAAABwCoBLH/+P//AFr+sQVXBJECJgCXAAAABwCoBAsAAP//AO7+uwVTBbACJgA7AAAABwCoBH0ACv///7z+FAQqBDoCJgBbAAAABwCoBKj/Y///AO4AAAVTB8QCJgA7AAAABwCmBLcBUf///7z+SwQqBnACJgBbAAAABwCmBAP//f//AO4AAAVTB08CJgA7AAAABwCgAPcBXv///7z+SwQqBfoCJgBbAAAABgCgQwkAAAACAET/6wUmBhgAGgAoAAABIwMjNycOASMiAj8BGgEzMhYXEyM3MzczBzMBBhYzMjY3Ey4BIyIGBwUItPedCQM8kFiwri8EOO7BWIcrN+oe6SS1JLX8AyRhiUx1M2Uba1R8nyYE0vsuaAI/QAE06hUBHAEUSEUBEZWxsfyis9FTTwH6RE/ZvQD//wAT/u4FJgYYACYARgAAACcB0wH8AkYABgBBfYMAAP//AD7+mQU1BbAAJgAtAAAABwGcA/QAAP//AED+mQRhBDoCJgDsAAAABwGcAxMAAP//AFj+mQV5BbACJgAqAAAABwGcBBwAAP//AED+mQRGBDoCJgDvAAAABwGcAzQAAP//AOz+mQULBbACJgA2AAAABwGcAggAAP//AJD+mQP3BDoCJgDxAAAABwGcAZgAAP////z+mQUdBbACJgA6AAAABwGcA5YAAP///+n+mQPxBDoCJgBaAAAABwGcAq4AAP//ANH+mQVIBbACJgDcAAAABwGcA+sAAP//AH/+mQQGBDsCJgD0AAAABwGcAvMAAP//ANH+mQVIBbACJgDcAAAABwGcAt8AAP//AH/+mQQGBDsCJgD0AAAABwGcAeYAAP//AFf+mQS5BbACJgCsAAAABwGcANMA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gFxQImACUAAAAHAZwB0/+k//8AUf4+A/cETgImAEUAAAAHAZwBS/+k//8AEwAABO8FsAIGADsAAP//ACD+XwP1BDoCBgC4AAD//wCtAAABoAWwAgYAKwAA//8AGAAAB4kHXAImANUAAAAHAJwCHAGs//8AFwAABl8GBQImAOkAAAAHAJwBpQBV//8ArQAAAaAFsAIGACsAAP//ABoAAAUoB1wCJgAjAAAABwCcAOoBrP//AF7/7AQBBhoCJgBDAAAABgCcb2oAAP//ABoAAAUoBw0CJgAjAAAABwBoAJMBXf//AF7/7AQBBcsCJgBDAAAABgBoGBsAAP////YAAAdXBbACBgB/AAD//wA0/+sGhAROAgYAhAAA//8AnwAABHUHXAImACcAAAAHAJwAsgGs//8AWf/sA/gGGwImAEcAAAAGAJxxawAA//8AU//qBRsG2gImAUEAAAAHAGgAcwEq//8AWf/sA/gEUAIGAJkAAP//AFn/7AP4BcwCJgCZAAAABgBoGhwAAP//ABgAAAeJBw0CJgDVAAAABwBoAcUBXf//ABcAAAZfBbYCJgDpAAAABwBoAU4ABv//AEr/6wR7ByICJgDWAAAABwBoAFgBcv//AE3/7APEBcoCJgDqAAAABgBoABoAAP//AJoAAAULBvYCJgDXAAAABwBuAOUBRv//AIYAAAQSBaACJgDrAAAABgBuXfAAAP//AJoAAAULBw0CJgDXAAAABwBoAMYBXf//AIYAAAQSBbYCJgDrAAAABgBoPgYAAP//AHT/6wUbByICJgAxAAAABwBoALoBcv//AFP/7AQ0BcsCJgBRAAAABgBoNRsAAP//AGr/6wURBcUCBgESAAD//wBS/+wEMwROAgYBEwAA//8Aav/rBREHCAImARIAAAAHAGgAxgFY//8AUv/sBDMF5wImARMAAAAGAGghNwAA//8AiP/sBNcHIwImAOIAAAAHAGgAjwFz//8AUf/rA+gFywImAPoAAAAGAGgPGwAA//8AP//rBNkG9gImANkAAAAHAG4AlwFG//8AEP5LA/wFoAImAFsAAAAGAG4X8AAA//8AP//rBNkHDQImANkAAAAHAGgAeAFd//8AEP5LA/wFtgImAF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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAYACgAAAAAAEgAAAAAAFAAAAAAAAAAAAAAABgAAAAAACgATAAAACgAWAAAACQAAAA0AAAAEAAAABQAAAAAADQAEAA0AAAAAAAAAAAAAAAAAHAAAAAAAEQASAAAAAAAAAAAAAAAAAAYAAAAAAAYADAATABsAFgAJAAQACQAWAAUAFwAWAAkAGAAAAAAAAAAJAAUADwAAAA8AAAAPAAAACgAFAAsACwAAAAAAAAALAAAACQASABsABgAAAAAAAAAAABYACQAAAAAABwAFABYABgAAAAAABgAWAAoABQAAABMAFwAAABIAGwASABsAAAAAAAAAFgAAABYAFgATABcAAAAAAAAACQAAAAkABgAEAAYAFgAGAAQAAAAAABEABQARAAUAEQAFAA4AAwAAAAkAEwAXABYAAgAQABIAGwASABsAEgAbABIAGwASABsAEgAbABIAGwASABsAEgAbABIAGwASABsAEgAbAAAAFgAAABYAAAAWAAAAFgAAABYAAAAWAAAAFgAAABYAAAAAAAAAAAAGAAQABgAEAAYABAAGAAQABgAEAAYABAAGAAQABgAWAAYAFgAGABYABgAEAAYAFgAIAA0ACAANAAAADQAAAA0AAAANAAAADQAAAA0ACgAFAAoABQAKAAUAAAAAAAAACQAAAAkADAAAABMAFwAOAAMADgADAAAACQATABcAAAAAAAAAAAAAAAAAAAAAAAAAAAAJAAAACQAAAAkAAgAQAAoAAAAAAAAAAAAAABkAAAABAAAACgAsAI4AAURGTFQACAAEAAAAAP//AAgAAAABAAIAAwAEAAUABgAHAAhsaWdhADJsbnVtADhzbWNwAD5zczAxAERzczAyAEpzczAzAFBzczA0AFZzczA1AFwAAAABAAEAAAABAAIAAAABAAAAAAABAAMAAAABAAQAAAABAAUAAAABAAYAAAABAAcACAASABoAIgAqADIAOgBCAEoAAQAAAAEAQAAE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GA5ACAkpSVgQ+AAADAFP/xAXjBewAFQAeACcAAAEzIAAREAAhIxUjNSMgABEQACEzNTMDIgYVFBY7AREzETMyNjU0JiMDeBsBAgFO/rL+/hu5Hf79/rQBTAEDHbnWxtHRxh25HcTS0sQFHv69/vv++f67xsYBQwEHAQUBRc7+nenMzucDavyW6c7L6AAAAAABALT+oQWSBbAACwAAEzMRIREzETMDIxEhtLkC17mVEqX72QWw+uUFG/rp/ggBXwABAJcAAATEBbAAEwAAAREjEQ4BIyImNREzERQWMzI2NxEExLlhsHv187qMomm8ZwWw+lACYR0azvIBxv46q38cHAK4AAEAtAAABtIFsAALAAABESERMxEhETMRIREBbgH6uQH4ufniBbD65QUb+uUFG/pQBbAAAAABALT+oQdrBbAADwAAAREhETMRIREzETMDIxEhEQFuAfq5Afi5mRKm+gEFsPrlBRv65QUb+uX+DAFfBbAAAAAAAgARAAAFuAWwAAwAFQAAEyERITIWFRQGIyERIQERITI2NTQmIxECVQFo7vz97f3f/mQCVQFonJSUnAWw/ajhx8joBRv9qP3Sn355mAAAAAADALUAAAY1BbAACgATABcAAAEhMhYVFAYjIREzGQEhMjY1NCYjASMRMwFuAWju/P3t/d+5AWiclJScA1+5uQNY4cfI6AWw/RP90p9+eZj9PQWwAAACAKYAAASxBbAACgATAAABITIWFRQGIyERMxkBITI2NTQmIwFfAWju/P3t/d+5AWiclJScA1jhx8joBbD9E/3Sn355mAAAAAABALH/7AT2BcYAHwAAEzQAMzIAGQEQACMiADUzFBYzMhI9ASE1ITU0AiMiBhWxAST2+wEw/tD7+/7hubWsq8f9uwJFx6ustQPf1QES/qb+7f7//uz+qAEB46CvAQjNOJU2zgEJsKEAAAIAw//rBt4FxQAVACMAAAEQACEgABE1IxEjETMRMzUQACEgABEnNAIjIgIVERQSMzISNQbe/rv+9v7+/sbXubnXAToBAgEKAUW52ry0z8+0vdkCV/70/qABYAEMKP2BBbD9ZEQBCwFi/p7+9QLJAQb++sn+/cv++gEFzAACAGMAAARnBbAADQAW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AAUiByICJgAjAAAABwBCARQBXf//ACcAAAUiBx8CJgAjAAAABwBzAc4BWf//ACcAAAUiB0YCJgAjAAAABwCaANABXf//ACcAAAUiB1ECJgAjAAAABwCgAMoBYP//ACcAAAUiBwwCJgAjAAAABwBoAKoBXP//ACcAAAUiB4gCJgAjAAAABwCeAVEBqP//ACcAAAUiB58CJgAjAAAABwHUAWEBLP//AIP+RATJBcUCJgAlAAAABwB3Adv/9///ALYAAAR1ByICJgAnAAAABwBCAOABXf//ALYAAAR1Bx8CJgAnAAAABwBzAZoBWf//ALYAAAR1B0YCJgAnAAAABwCaAJwBXf//ALYAAAR1BwwCJgAnAAAABwBoAHYBXP///9wAAAF8ByICJgArAAAABwBC/40BXf//AMMAAAJkBx8CJgArAAAABwBzAEYBWf////IAAAJPB0YCJgArAAAABwCa/0kBXf///8wAAAJ1BwwCJgArAAAABwBo/yMBXP//ALYAAAT+B1ECJgAwAAAABwCgAPsBYP//AIL/6wUNBzcCJgAxAAAABwBCATQBcv//AIL/6wUNBzQCJgAxAAAABwBzAe4Bbv//AIL/6wUNB1sCJgAxAAAABwCaAPABcv//AIL/6wUNB2YCJgAxAAAABwCgAOoBdf//AIL/6wUNByECJgAxAAAABwBoAMoBcf//AJb/6wTXByICJgA3AAAABwBCASYBXf//AJb/6wTXBx8CJgA3AAAABwBzAeABWf//AJb/6wTXB0YCJgA3AAAABwCaAOIBXf//AJb/6wTXBwwCJgA3AAAABwBoALwBXP//AB4AAATTBx0CJgA7AAAABwBzAaABV///AHL/7APsBeACJgBDAAAABwBCAJYAG///AHL/7APsBd0CJgBDAAAABwBzAVAAF///AHL/7APsBgQCJgBDAAAABgCaUhsAAP//AHL/7APsBg8CJgBDAAAABgCgTB4AAP//AHL/7APsBcoCJgBDAAAABgBoLBoAAP//AHL/7APsBkYCJgBDAAAABwCeANMAZv//AHL/7APsBl4CJgBDAAAABwHUAOP/6///AGH+RAPyBE4CJgBFAAAABwB3AUX/9///AGL/7APpBeECJgBHAAAABwB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Zv5MA/cFywImAEkAAAAHAJ0BLAAb//8Ahf3lBNsFxQImACkAAAAHAZEBq/62//8AZv5MA/cGbQImAEkAAAAHAaUBMwBW//8AtgAABP0HRgImACoAAAAHAJoA+gFd//8AkQAAA/oHRQImAEoAAAAHAJoAIwFc////xQAAAncHUQImACsAAAAHAKD/QwFg////ngAAAlAF+gImAIoAAAAHAKD/HAAJ////vwAAAokG+gImACsAAAAHAG7/RwFK////mAAAAmIFpAImAIoAAAAHAG7/IP/0////9QAAAkwHTAImACsAAAAHAJz/dAGc////zgAAAiUF9QImAIoAAAAHAJz/TQBF//8AIf5YAYEFsAImACsAAAAGAJ/vCAAA//8AAP5QAWAGGAImAEsAAAAGAJ/OAAAA//8AtwAAAYYHDQImACsAAAAHAJ0AFwFd//8Aw//rBf8FsAAmACsAAAAHACwCPwAA//8Aof5LA2MGGAAmAEsAAAAHAEwB/AAA//8AP//rBIsHOQImACwAAAAHAJoBhQFQ////tP5LAjkF3AImAJgAAAAHAJr/M//z//8Atv31BRwFsAImAC0AAAAHAZEBev7G//8Akv33BBQGGAImAE0AAAAHAZEBGP7I//8AtgAABCUG4AImAC4AAAAHAHMANwEa//8AoQAAAkMHXAImAE4AAAAHAHMAJQGW//8Atv33BCUFsAImAC4AAAAHAZEBdP7I//8AW/33AVoGGAImAE4AAAAHAZH///7I//8AtgAABCUFsQImAC4AAAAHAZEB2QTF//8AoQAAAq0GGAAmAE4AAAAHAZEBVgUs//8AtgAABCUFsAImAC4AAAAHAJ0Bxf3F//8AoQAAAq0GGAAmAE4AAAAHAJ0BPv23//8AtgAABP4HHwImADAAAAAHAHMB/wFZ//8AkQAAA/gF3QImAFAAAAAHAHMBaQAX//8Atv33BP4FsAImADAAAAAHAZEB2P7I//8Akf33A/gETgImAFAAAAAHAZEBQv7I//8AtgAABP4HRwImADAAAAAHAJsBFwFe//8AkQAAA/gGBQImAFAAAAAHAJsAgQAc////0gAAA/gGGAImAFAAAAAHAZH/dgUs//8Agv/rBQ0HDwIm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AcAcwKpAVn//wCQAAAGcgXdAiYATwAAAAcAcwK7ABf//wAn/ocFIgWwAiYAIwAAAAcAogFPAAD//wBy/ocD7AROAiYAQwAAAAcAogCeAAD///8+/+sFDQaiAiYAMQAAAAcB1f7PAMz//wBCAAAGiwYtACYASAAAAAcBkgK+AAD//wBCAAAG1gYtACYASAAAACcASAK+AAAABwBOBXwAAP//ALYAAAR1ByICJgAnAAAABwBCAOABXf//ALYAAAT+ByICJgDXAAAABwBCAUoBXf//AGL/7APpBeECJgBHAAAABwBCAJsAHP//AJwAAAQBBcsCJgDrAAAABwBCALsABv//AF0AAAUYBbACBgC0AAD//wBf/ikFQwQ6AgYAyAAA//8AFwAABNoHRwImARQAAAAHAKcENwFZ////+QAABAsGHwImARUAAAAHAKcD0gAx//8AYP5LCGwETgAmAFEAAAAHAFsEiAAA//8Agv5LCXQFxQAmADEAAAAHAFsFkAAA//8AUf5RBGcFxQImANYAAAAHAZwBnP+4//8AWP5SA6wETAImAOoAAAAHAZwBQ/+5//8Ag/5RBMkFxQImACUAAAAHAZwB7v+4//8AYf5RA/IETgImAEUAAAAHAZwBWP+4//8AHgAABNMFsAIGADsAAP//AC7+YAPfBDoCBgC4AAD//wDDAAABfAWwAgYAKwAA//8AGwAABygHTAImANUAAAAHAJwB+AGc//8AFQAABgQF9QImAOkAAAAHAJwBjQBF//8AwwAAAXwFsAIGACsAAP//ACcAAAUiB0wCJgAjAAAABwCcAPsBnP//AHL/7APsBgoCJgBDAAAABgCcfVoAAP//ACcAAAUiBwwCJgAjAAAABwBoAKoBXP//AHL/7APsBcoCJgBDAAAABgBoLBoAAP////IAAAdXBbACBgB/AAD//wA9/+sGfAROAgYAhAAA//8AtgAABHUHTAImACcAAAAHAJwAxwGc//8AYv/sA+kGCwImAEcAAAAHAJwAggBb//8AX//rBRAG3gImAUEAAAAHAGgAfQEu//8AYv/sA+kETwIGAJkAAP//AGL/7APpBcsCJgCZAAAABgBoMRsAAP//ABsAAAcoBwwCJgDVAAAAB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AAAVG9wIFVudEYjUmx0AAAAAAAAAAAAAAAAU2NsIFVudEYjUHJjQFkAAAAAAAA4QklNA+0AAAAAABAASAAAAAEAAgBIAAAAAQACOEJJTQQmAAAAAAAOAAAAAAAAAAAAAD+AAAA4QklNBA0AAAAAAAQAAAB4OEJJTQQZAAAAAAAEAAAAHjhCSU0D8wAAAAAACQAAAAAAAAAAAQA4QklNJxAAAAAAAAoAAQAAAAAAAAACOEJJTQP1AAAAAABIAC9mZgABAGxmZgAGAAAAAAABAC9mZgABAKGZmgAGAAAAAAABADIAAAABAFoAAAAGAAAAAAABADUAAAABAC0AAAAGAAAAAAABOEJJTQP4AAAAAABwAAD/////////////////////////////A+gAAAAA/////////////////////////////wPoAAAAAP////////////////////////////8D6AAAAAD/////////////////////////////A+gAADhCSU0EAAAAAAAAAgABOEJJTQQCAAAAAAAEAAAAADhCSU0EMAAAAAAAAgEBOEJJTQQtAAAAAAAGAAEAAAACOEJJTQQIAAAAAAAQAAAAAQAAAkAAAAJAAAAAADhCSU0EHgAAAAAABAAAAAA4QklNBBoAAAAAA0sAAAAGAAAAAAAAAAAAAAE2AAACtwAAAAsAQgBlAHoAIABuAGEAegB3AHkALQAxAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAK3AAABNgAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAABAAAAAAAAbnVsbAAAAAIAAAAGYm91bmRzT2JqYwAAAAEAAAAAAABSY3QxAAAABAAAAABUb3AgbG9uZwAAAAAAAAAATGVmdGxvbmcAAAAAAAAAAEJ0b21sb25nAAABNgAAAABSZ2h0bG9uZwAAArcAAAAGc2xpY2VzVmxMcwAAAAFPYmpjAAAAAQAAAAAABXNsaWNlAAAAEgAAAAdzbGljZUlEbG9uZwAAAAAAAAAHZ3JvdXBJRGxvbmcAAAAAAAAABm9yaWdpbmVudW0AAAAMRVNsaWNlT3JpZ2luAAAADWF1dG9HZW5lcmF0ZWQAAA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ni0yLjEiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjAxODAxMTc0MDcyMDY4MTE4NzFGODEzMUZCNkU2ODk4IiBzdEV2dDp3aGVuPSIyMDE0LTAzLTE5VDAzOjAyOjI2KzAxOjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgQ1M1LjEgTWFjaW50b3NoIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDowMjgwMTE3NDA3MjA2ODExODcxRjgxMzFGQjZFNjg5OCIgc3RFdnQ6d2hlbj0iMjAxNC0wMy0xOVQwMzowMjoyNiswMTowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPD94cGFja2V0IGVuZD0idyI/Pv/iDFhJQ0NfUFJPRklMRQABAQAADEhMaW5vAhAAAG1udHJSR0IgWFlaIAfOAAIACQAGADEAAGFjc3BNU0ZUAAAAAElFQyBzUkdCAAAAAAAAAAAAAAABAAD21gABAAAAANMtSFAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEWNwcnQAAAFQAAAAM2Rlc2MAAAGEAAAAbHd0cHQAAAHwAAAAFGJrcHQAAAIEAAAAFHJYWVoAAAIYAAAAFGdYWVoAAAIsAAAAFGJYWVoAAAJAAAAAFGRtbmQAAAJUAAAAcGRtZGQAAALEAAAAiHZ1ZWQAAANMAAAAhnZp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sDVqjpTBRZxvoqrzCMGo0ZBoRUUT4eXvg2tMTKlBfWHIR8CA9eRrU7bgDqMQDbA23HwEu+9UcjqFHWoG3XCQjdDKl0ySESemwIIVwzArT4gNulf9jgARu1YgCesBJJQ8lFaA16EkdMK7rrd9a9N+UY5LUL9kclr1O5pkiB3qOJDRtraFlCiR1ZjzrTnUjYA0Aof9jgqPej1ISZvMPq/vkHpAjkFK/F8VNiP+CyYEK5o9SZqLtZ3qeabGIioPTpTpkJBI4lCdL43C/GFkK/FzDGg79skFNqEolChWYNIKVdeVCe9BTbHZiqypKQtXoApKkh6Up0ag6fPAeagd7cf1urFKenQhweXTx33/AONsI5p3f//Z"}; \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/images/blank.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/images/blank.gif new file mode 100644 index 0000000..75b945d Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/images/blank.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/scribble.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/scribble.css new file mode 100644 index 0000000..9986f2a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/scribble.css @@ -0,0 +1,40 @@ +#scribble-pad { +/* margin-left:auto; + margin-right:auto; + height: 475px; + width: 475px;*/ + background:url(https://www.ibm.com/developerworks/mydeveloperworks/blogs/bobleah/resource/stickynote.jpg) no-repeat center center; + background-size: 110% 110%; +} + + + +#scribble { + white-space: pre-wrap; /* css-3 */ + white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ + max-width: 300px; + padding: 120px 100px 100px 75px; + color: #486891; + border-color: #ff0000 #0000ff; + border-color: transparent; + background-color:rgba(0, 0, 0, 0); + font-family: Arial,sans-serif; + font-size: 120%; + font-style: italic; + font-weight:bold; + line-height: 1.5em; +} + +#scribble:focus { +outline-width: 0; +} +.c-link { + color: #486891; + font-family: Arial,sans-serif; + font-size: 95%; + font-weight:bold; + text-decoration: none; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/slider.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/slider.css new file mode 100644 index 0000000..f609403 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/slider.css @@ -0,0 +1,142 @@ +div,span,p { margin:0; padding:0; border:0; outline:0; font-weight:inherit; font-style:inherit; font-size:100%; font-family:inherit; vertical-align:baseline; } + + +#container { + width:580px; + padding:10px; + margin:0 auto; + position:relative; + z-index:0; +} + +#example { + width:600px; + height:350px; + position:relative; +} + +#ribbon { + position:absolute; + top:-3px; + left:-15px; + z-index:500; +} + +#frame { + position:absolute; + z-index:0; + width:739px; + height:341px; + top:-3px; + left:-80px; +} + +/* + Slideshow +*/ + +#slides { + position:absolute; + top:15px; + left:4px; + z-index:100; +} + +/* + Slides container + Important: + Set the width of your slides container + Set to display none, prevents content flash +*/ + +.slides_container { + width:570px; + overflow:hidden; + position:relative; + display:none; +} + +/* + Each slide + Important: + Set the width of your slides + If height not specified height will be set by the slide content + Set to display block +*/ + +.slides_container div.slide { + width:570px; + height:270px; + display:block; +} + + +/* + Next/prev buttons +*/ + +#slides .next,#slides .prev { + position:absolute; + top:107px; + left:-39px; + width:24px; + height:43px; + display:block; + z-index:101; +} + +#slides .next { + left:585px; +} + +/* + Pagination +*/ + +.pagination { + margin:26px auto 0; + width:100px; +} + +.pagination li { + float:left; + margin:0 1px; + list-style:none; +} + +.pagination li a { + display:block; + width:12px; + height:0; + padding-top:12px; + background-image:url(../images/pagination.png); + background-position:0 0; + float:left; + overflow:hidden; +} + +.pagination li.current a { + background-position:0 -12px; +} + +/* + Caption +*/ + +.caption { + z-index:500; + position:absolute; + bottom:-35px; + left:0; + height:30px; + padding:5px 20px 0 20px; + background:#000; + background:rgba(0,0,0,.5); + width:540px; + font-size:1.3em; + line-height:1.33; + color:#fff; + border-top:1px solid #000; + text-shadow:none; +} + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/spacegallery.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/spacegallery.css new file mode 100644 index 0000000..ce4fd57 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/spacegallery.css @@ -0,0 +1,18 @@ +.spacegallery { + position: relative; + overflow: hidden; +} +.spacegallery img { + position: absolute; + left: 50%; +} +.spacegallery a { + position: absolute; + z-index: 1000; + display: block; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: url(images/blank.gif); +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/welcome.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/welcome.css new file mode 100644 index 0000000..559db70 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/css/welcome.css @@ -0,0 +1,169 @@ +/* Area Chart */ + +#areaChart { + overflow: hidden;} + +#lineChart { + overflow: hidden; +} + +#areaChart svg { + height: 200px; + width: 380px; + min-width: 100px; + min-height: 100px; +} + +#lineChart svg { + height: 200px; + width: 380px; + min-width: 100px; + min-height: 100px; +} + +#areaChart tr.z-row-over>td.z-row-inner, tr.z-row-over>.z-cell { + background-color: rgb(255, 255, 255); +} + +#lineChart tr.z-row-over>td.z-row-inner, tr.z-row-over>.z-cell { + background-color: rgb(255, 255, 255); +} + +#areaChart .nodatadiv { + display: table-cell; + width: 700px; + height: 370px; + text-align: center; + vertical-align: middle; +} + +#lineChart .nodatadiv { + display: table-cell; + width: 700px; + height: 370px; + text-align: center; + vertical-align: middle; +} + +#areaChart .nodatainner { + padding: 10px; +} + +#lineChart .nodatainner { + padding: 10px; +} + +/* Area Chart END */ + +.button--small, [class*=bg-] .button--small { + font-size: 14px; + }; + +/* Gridster (EBIZ) */ + +.gridster-item-container .gridster-item-body{ +bottom:0px; +} +.gridster-item-container{ +min-height:50px; +} +.att-accordion { + border-width: 0px; +} + +/* End Gridster */ + +#myGallery { + width: 100%; + height: 400px; +} + +#myGallery img { + border: 2px solid #52697E; +} + +a.loading { + background: #fff url(../images/ajax_small.gif) no-repeat center; +} + +.center { + margin-left: auto; + margin-right: auto; +} + + +#selectedTrafficDay ul { + list-style: none; + padding: 0; + margin: 0; +} + +#selectedTrafficDay li { + float: left; + border: 1px solid #000; + border-bottom-width: 0; + margin: 3px 3px 3px 3px; + padding: 5px 5px 5px 5px; + background-color: #F2F2F2; + color: #696969; +} + +#SelectedTrafficeDayView { + padding: 0 1em; +} + +#selectedTrafficDay .active1 { + background-color: #FFF; + color: #000; +} + +#BusyHourTraffic ul { + list-style: none; + padding: 0; + margin: 0; +} + +#BusyHourTraffic li { + float: left; + border: 1px solid #000; + border-bottom-width: 0; + margin: 3px 3px 3px 3px; + padding: 5px 5px 5px 5px; + background-color: #F2F2F2; + color: #696969; +} + +#BusyHourTrafficView { + padding: 0 1em; +} + +#BusyHourTraffic .active2 { + background-color: #FFF; + color: #000; +} + +#slider { + width: 600px; + margin: 0 auto; + clear: left; +} + +@media only screen and (device-width: 768px) { + #slider { + width: 400px; + } +} + +#container { + +} + +#title { + float:left; + width:100%; + height:30px; + margin:; + color:#222222; + text-shadow: 1px 1px 2px #A0A0A0; +} + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/area_chart.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/area_chart.html new file mode 100644 index 0000000..30ef201 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/area_chart.html @@ -0,0 +1,49 @@ + + + + + + + +

        + + + + + + \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/bar_chart.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/bar_chart.html new file mode 100644 index 0000000..0be16ec --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/bar_chart.html @@ -0,0 +1,95 @@ + + + + + + + +

        + + + + + + + \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/d3_gauges_demo.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/d3_gauges_demo.html new file mode 100644 index 0000000..94596e7 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/d3_gauges_demo.html @@ -0,0 +1,39 @@ + + + + + d3.js gauges + + + + + + + + + + + + + + +
        + + + + + \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/speedometer2.csv b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/speedometer2.csv new file mode 100644 index 0000000..406143e --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/speedometer2.csv @@ -0,0 +1,16 @@ +"YEARMONTH","Bedminster","Piscataway","Middletown","Paramus" +"201401",8.27,4.89,2.36,2.17 +"201402",10.02,4.57,3.15,3.01 +"201403",11.16,5.00,4.27,4.06 +"201404",13.31,5.00,5.35,5.11 +"201405",12.82,5.00,5.01,4.74 +"201406",14.01,6.09,9.17,8.98 +"201407",14.66,7.00,8.84,8.41 +"201408",16.95,7.02,12.22,11.84 +"201409",21.56,8.12,16.09,15.50 +"201410",25.35,9.00,19.04,18.37 +"201411",21.93,9.00,17.61,17.13 +"201412",24.00,9.00,19.00,18.00 +"201501",25.14,2.01,15.19,12.13 +"201502",26.30,2.67,16.95,13.47 +"201503",26.5833333333333,45.63333333333333,16.1166666666667,12.40 diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/speedometer3.csv b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/speedometer3.csv new file mode 100644 index 0000000..046383e --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/speedometer3.csv @@ -0,0 +1,2 @@ +"YEARMONTH","Bedminster","Piscataway","Middletown","Paramus" +"201401",8.27,4.89,2.36,2.17 \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/worddata.csv b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/worddata.csv new file mode 100644 index 0000000..6a74cde --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/data/worddata.csv @@ -0,0 +1,22 @@ +text,frequency +video,100 +Domain 2.0,75 +spectrum,60 +4GLTE,60 +research,50 +UVerse,60 +DirectTV,30 +Iusacell,89 +Gamma,79 +BigData,55 +RCloud,45 +Raptor,20 +SDN,50 +NFV,50 +ASC,70 +AVPN,40 +Web-RTC,68 +MIS,40 +UDNC,30 +3G,30 +2G,10 \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/donut_d3.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/donut_d3.html new file mode 100644 index 0000000..afcac35 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/donut_d3.html @@ -0,0 +1,43 @@ + + + + + + + + \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/area_chart.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/area_chart.min.js new file mode 100644 index 0000000..9b3decb --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/area_chart.min.js @@ -0,0 +1 @@ +function redrawAreaChart(){d3.select("#areaChart svg").datum(historicalBarChart).call(area_chart)}var area_chart;nv.addGraph(function(){return area_chart=nv.models.stackedAreaChart().showControls(!1).margin({top:30,right:60,bottom:50,left:100}).showLegend(!1).yAxisTooltipFormat(d3.format(",.1f")).x(function(a){return a.x}).y(function(a){return a.y}).color(d3.scale.category10().range()),area_chart.xAxis.axisLabel("").staggerLabels(!1).showMaxMin(!1).rotateLabels(90).tickFormat(function(a){return d3.time.format("%b %y")(new Date(a))}),area_chart.yAxis.axisLabel("").tickFormat(d3.format(",.1f")),d3.select("#areaChart svg").datum(historicalBarChart).call(area_chart),nv.utils.windowResize(area_chart.update),area_chart}),redrawAreaChart(),historicalBarChart.length<=0&&(document.getElementById("areaChart").innerHTML="
        No Data Available
        ",document.getElementById("areaChart").className="nodatadiv",document.getElementById("nodata").className="nodatainner"); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/donut.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/donut.min.js new file mode 100644 index 0000000..60c4fd4 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/donut.min.js @@ -0,0 +1 @@ +function angle(t){var e=90*(t.startAngle+t.endAngle)/Math.PI-90;return e>90?e-180:e}function arcTween(t,e){return function(){d3.select(this).transition().delay(e).attrTween("d",function(e){var r=d3.interpolate(e.outerRadius,t);return function(t){return e.outerRadius=r(t),arc(e)}})}}var arc=d3.svg.arc().padRadius(outerRadius).innerRadius(innerRadius),pie=d3.layout.pie().sort(null).padAngle(.02).value(function(t){return t.performance});d3.csv(dataURL,function(t,e){color.domain(d3.keys(e[0]).filter(function(t){return"YEARMONTH"!==t})),e.forEach(function(t){t.performance=color.domain().map(function(e){return{name:e,performance:+t[e]}})});var r=d3.select("body").append("svg").attr("class","legend").attr("width",radius).attr("height",2*radius).selectAll("g").data(color.domain().slice().reverse()).enter().append("g").attr("transform",function(t,e){return"translate(0,"+20*e+")"});r.append("rect").attr("width",18).attr("height",18).style("fill",color),r.append("text").attr("x",24).attr("y",9).attr("dy",".35em").text(function(t){return t});var a=d3.select("body").append("svg").attr("width",width).attr("height",height).data(e).append("g").attr("transform","translate("+radius+","+height/2+")"),n=a.selectAll("g.slice").data(function(t){return pie(t.performance)}).enter().append("g").attr("class","slice");n.append("path").each(function(t){t.outerRadius=outerRadius-10}).attr("class","arc").attr("d",arc).style("fill",function(t){return color(t.data.name)}).on("mouseover",arcTween(outerRadius,0)).on("mouseout",arcTween(outerRadius-10,150)),n.append("text").attr("dy",".35em").attr("transform",function(t){return t.outerRadius=outerRadius,t.innerRadius=outerRadius/2,"translate("+arc.centroid(t)+")rotate("+angle(t)+")"}).attr("text-anchor","middle").style("fill","white").style("font","bold 12px Arial").text(function(t){return t.value}),a.append("text").attr("dy",".35em").style("text-anchor","middle").text(function(t){return t.YEARMONTH})}); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/gauges.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/gauges.min.js new file mode 100644 index 0000000..c0fd748 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/gauges.min.js @@ -0,0 +1 @@ +function Gauge(t,i){this.placeholderName=t;var n=this;this.configure=function(t){this.config=t,this.config.size=.9*this.config.size,this.config.raduis=.97*this.config.size/2,this.config.cx=this.config.size/2,this.config.cy=this.config.size/2,this.config.min=void 0!=t.min?t.min:0,this.config.max=void 0!=t.max?t.max:100,this.config.range=this.config.max-this.config.min,this.config.majorTicks=t.majorTicks||5,this.config.minorTicks=t.minorTicks||2,this.config.greenColor=t.greenColor||"#109618",this.config.yellowColor=t.yellowColor||"#FF9900",this.config.redColor=t.redColor||"#DC3912",this.config.transitionDuration=t.transitionDuration||500},this.render=function(){this.body=d3.select("#"+this.placeholderName).append("svg:svg").attr("class","gauge").attr("width",this.config.size).attr("height",this.config.size),this.body.append("svg:circle").attr("cx",this.config.cx).attr("cy",this.config.cy).attr("r",this.config.raduis).style("fill","#ccc").style("stroke","#000").style("stroke-width","0.5px"),this.body.append("svg:circle").attr("cx",this.config.cx).attr("cy",this.config.cy).attr("r",.9*this.config.raduis).style("fill","#fff").style("stroke","#e0e0e0").style("stroke-width","2px");for(var t in this.config.greenZones)this.drawBand(this.config.greenZones[t].from,this.config.greenZones[t].to,n.config.greenColor);for(var t in this.config.yellowZones)this.drawBand(this.config.yellowZones[t].from,this.config.yellowZones[t].to,n.config.yellowColor);for(var t in this.config.redZones)this.drawBand(this.config.redZones[t].from,this.config.redZones[t].to,n.config.redColor);if(void 0!=this.config.label){var i=Math.round(this.config.size/12);this.body.append("svg:text").attr("x",this.config.cx).attr("y",this.config.cy/2+i/2).attr("dy",i/2).attr("text-anchor","middle").text(this.config.label).style("font-size",i+"px").style("fill","#333").style("stroke-width","0px")}for(var i=Math.round(this.config.size/16),e=this.config.range/(this.config.majorTicks-1),o=this.config.min;o<=this.config.max;o+=e){for(var a=e/this.config.minorTicks,r=o+a;r=i-t||this.body.append("svg:path").style("fill",e).attr("d",d3.svg.arc().startAngle(this.valueToRadians(t)).endAngle(this.valueToRadians(i)).innerRadius(.65*this.config.raduis).outerRadius(.85*this.config.raduis)).attr("transform",function(){return"translate("+n.config.cx+", "+n.config.cy+") rotate(270)"})},this.redraw=function(t,i,e){var o=this.body.select(".pointerContainer"),a=o.selectAll("text");y=a.attr("y"),dy=parseFloat(a.attr("dy")),a.selectAll("tspan").remove(),a.append("tspan").attr("x",45).attr("dy",0).text(Math.round(t)),a.append("tspan").attr("x",45).attr("dy",10).text(i),o.selectAll("text").style("fill",function(){var i=n.config.max-n.config.min;return Math.round(t)>.9*i?"#DC3912":Math.round(t)>.5*i&&Math.round(t)<.9*i?"#FF9900":"#000000"});var r=o.selectAll("path");r.transition().duration(void 0!=e?e:this.config.transitionDuration).attrTween("transform",function(){var i=t;t>n.config.max?i=n.config.max+.02*n.config.range:tNo Data Available
        ",document.getElementById("lineChart").className="nodatadiv",document.getElementById("nodata2").className="nodatainner"); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/pie_chart.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/pie_chart.min.js new file mode 100644 index 0000000..f78eec7 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/pie_chart.min.js @@ -0,0 +1 @@ +function redraw(){d3.select("#chart423 svg").datum(historicalBarChart).transition().duration(500).call(chart)}var chart;nv.addGraph(function(){return chart=nv.models.pieChart().margin({top:30,right:60,bottom:50,left:100}).x(function(t){return t.key}).y(function(t){return t.y}),chart.showLegend(!1),d3.select("#chart423 svg").datum(historicalBarChart).transition().duration(1200).call(chart),nv.utils.windowResize(chart.update),chart}),setInterval(function(){redraw()},1500),historicalBarChart.length<=0&&(document.getElementById("chart423").innerHTML="
        No Data Available
        ",document.getElementById("chart423").className="nodatadiv",document.getElementById("nodata").className="nodatainner"); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/worddata.min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/worddata.min.js new file mode 100644 index 0000000..6b82746 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/js/worddata.min.js @@ -0,0 +1 @@ +function dataViz(t){function e(t){var e=d3.select("svg").append("g").attr("id","wordCloudG").attr("transform","translate(210,175)");e.selectAll("text").data(t).enter().append("text").style("font-size",function(t){return 1*t.size+"px"}).style("fill",function(t){return keywords.indexOf(t.text)>-1?"red":"black"}).style("opacity",.75).attr("text-anchor","middle").attr("transform",function(t){return"translate("+[t.x,t.y]+")rotate("+t.rotate+")"}).text(function(t){return t.text})}d3.layout.cloud().size([420,350]).words(t).rotate(function(t){return t.text.length>5?0:90}).fontSize(function(t){return wordScale(t.frequency)}).on("end",e).start()}d3.csv(dataURL,function(t){dataViz(t)}),wordScale=d3.scale.linear().domain([0,100]).range([0,70]).clamp(!0); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/line_chart.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/line_chart.html new file mode 100644 index 0000000..d4ba57a --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/line_chart.html @@ -0,0 +1,49 @@ + + + + + + + +

        + + + + + + \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/pie_chart.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/pie_chart.html new file mode 100644 index 0000000..ebbdd9c --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/pie_chart.html @@ -0,0 +1,38 @@ + + + + + + + +
        + + + + + + + + + \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/wordcloud.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/wordcloud.html new file mode 100644 index 0000000..d9fc53f --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/html/wordcloud.html @@ -0,0 +1,37 @@ + + + Word Cloud Example + + + + + + + + + +
        + + +
        +
        + +
        + + + +
        + + \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/Calendar-16x16.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/Calendar-16x16.png new file mode 100644 index 0000000..ac970bd Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/Calendar-16x16.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/arrow-next.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/arrow-next.png new file mode 100644 index 0000000..1a4f72c Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/arrow-next.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/arrow-prev.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/arrow-prev.png new file mode 100644 index 0000000..8211eba Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/arrow-prev.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_drive_test_map.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_drive_test_map.png new file mode 100644 index 0000000..78a8873 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_drive_test_map.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_eppt_county.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_eppt_county.png new file mode 100644 index 0000000..df471d7 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_eppt_county.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_eppt_regression.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_eppt_regression.png new file mode 100644 index 0000000..e59fc18 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_eppt_regression.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_ios_throughput.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_ios_throughput.png new file mode 100644 index 0000000..76a2d2b Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_ios_throughput.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_lata_map.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_lata_map.png new file mode 100644 index 0000000..174ef9b Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_lata_map.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_lata_map_legend.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_lata_map_legend.png new file mode 100644 index 0000000..f7f2719 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_lata_map_legend.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_nova_sdn_map.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_nova_sdn_map.png new file mode 100644 index 0000000..ee0ddef Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/carousel/slide_b_nova_sdn_map.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/copyicon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/copyicon.png new file mode 100644 index 0000000..6c1c3c1 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/copyicon.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/deleteicon.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/deleteicon.gif new file mode 100644 index 0000000..4b07af8 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/deleteicon.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/example-frame.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/example-frame.png new file mode 100644 index 0000000..31f2fe1 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/example-frame.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/loading.gif b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/loading.gif new file mode 100644 index 0000000..cccb0fc Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/loading.gif differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/1_mon.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/1_mon.png new file mode 100644 index 0000000..d46eee5 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/1_mon.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/2_tue.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/2_tue.png new file mode 100644 index 0000000..ed82aad Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/2_tue.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/3_wed.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/3_wed.png new file mode 100644 index 0000000..8f8c032 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/3_wed.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/4_thu.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/4_thu.png new file mode 100644 index 0000000..750dca5 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/4_thu.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/5_fri.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/5_fri.png new file mode 100644 index 0000000..599e51f Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/5_fri.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/6_sat.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/6_sat.png new file mode 100644 index 0000000..70323ea Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/6_sat.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/7_sun.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/7_sun.png new file mode 100644 index 0000000..9d579d6 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/7_sun.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_DLSTX_IN.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_DLSTX_IN.png new file mode 100644 index 0000000..af1ac0a Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_DLSTX_IN.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_DLSTX_OUT.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_DLSTX_OUT.png new file mode 100644 index 0000000..935b538 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_DLSTX_OUT.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat.png new file mode 100644 index 0000000..916a655 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat_Def.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat_Def.png new file mode 100644 index 0000000..a8b516d Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat_Def.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat_Priority.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat_Priority.png new file mode 100644 index 0000000..2cf8141 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/images/tunnels/BH_Nat_Priority.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/FusionCharts.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/FusionCharts.js new file mode 100644 index 0000000..4c174df --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/FusionCharts.js @@ -0,0 +1,361 @@ +/** + * FusionCharts: Flash Player detection and Chart embedding. + * Version 1.2.3F ( 22 November 2008) - Specialized for FusionChartsFREE + * Checking Flash Version >=6 and added updateChartXML() for FREE Charts. + * Version: 1.2.3 (1st September, 2008) - Added Fix for % and & characters, scaled dimensions, fixes in to properly handling of double quotes and single quotes in setDataXML() function. + * Version: 1.2.2 (10th July, 2008) - Added Fix for % scaled dimensions, fixes in setDataXML() and setDataURL() functions + * Version: 1.2.1 (21st December, 2007) - Added setting up Transparent/opaque mode: setTransparent() function + * Version: 1.2 (1st November, 2007) - Added FORM fixes for IE + * Version: 1.1 (29th June, 2007) - Added Player detection, New conditional fixes for IE + * + * Morphed from SWFObject (http://blog.deconcept.com/swfobject/) under MIT License: + * http://www.opensource.org/licenses/mit-license.php + * + */ +if(typeof infosoftglobal == "undefined") var infosoftglobal = new Object(); +if(typeof infosoftglobal.FusionChartsUtil == "undefined") infosoftglobal.FusionChartsUtil = new Object(); +infosoftglobal.FusionCharts = function(swf, id, w, h, debugMode, registerWithJS, c, scaleMode, lang, detectFlashVersion, autoInstallRedirect){ + if (!document.getElementById) { return; } + + //Flag to see whether data has been set initially + this.initialDataSet = false; + + //Create container objects + this.params = new Object(); + this.variables = new Object(); + this.attributes = new Array(); + + //Set attributes for the SWF + if(swf) { this.setAttribute('swf', swf); } + if(id) { this.setAttribute('id', id); } + + w=w.toString().replace(/\%$/,"%25"); + if(w) { this.setAttribute('width', w); } + h=h.toString().replace(/\%$/,"%25"); + if(h) { this.setAttribute('height', h); } + + + //Set background color + if(c) { this.addParam('bgcolor', c); } + + //Set Quality + this.addParam('quality', 'high'); + + //Add scripting access parameter + this.addParam('allowScriptAccess', 'always'); + + //Pass width and height to be appended as chartWidth and chartHeight + this.addVariable('chartWidth', w); + this.addVariable('chartHeight', h); + + //Whether in debug mode + debugMode = debugMode ? debugMode : 0; + this.addVariable('debugMode', debugMode); + //Pass DOM ID to Chart + this.addVariable('DOMId', id); + //Whether to registed with JavaScript + registerWithJS = registerWithJS ? registerWithJS : 0; + this.addVariable('registerWithJS', registerWithJS); + + //Scale Mode of chart + scaleMode = scaleMode ? scaleMode : 'noScale'; + this.addVariable('scaleMode', scaleMode); + + //Application Message Language + lang = lang ? lang : 'EN'; + this.addVariable('lang', lang); + + //Whether to auto detect and re-direct to Flash Player installation + this.detectFlashVersion = detectFlashVersion?detectFlashVersion:1; + this.autoInstallRedirect = autoInstallRedirect?autoInstallRedirect:1; + + //Ger Flash Player version + this.installedVer = infosoftglobal.FusionChartsUtil.getPlayerVersion(); + + if (!window.opera && document.all && this.installedVer.major > 7) { + // Only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE + infosoftglobal.FusionCharts.doPrepUnload = true; + } +} + +infosoftglobal.FusionCharts.prototype = { + setAttribute: function(name, value){ + this.attributes[name] = value; + }, + getAttribute: function(name){ + return this.attributes[name]; + }, + addParam: function(name, value){ + this.params[name] = value; + }, + getParams: function(){ + return this.params; + }, + addVariable: function(name, value){ + this.variables[name] = value; + }, + getVariable: function(name){ + return this.variables[name]; + }, + getVariables: function(){ + return this.variables; + }, + getVariablePairs: function(){ + var variablePairs = new Array(); + var key; + var variables = this.getVariables(); + for(key in variables){ + variablePairs.push(key +"="+ variables[key]); + } + return variablePairs; + }, + getSWFHTML: function() { + var swfNode = ""; + if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { + // netscape plugin architecture + swfNode = ' 0){ swfNode += 'flashvars="'+ pairs +'"'; } + swfNode += '/>'; + } else { // PC IE + swfNode = ''; + swfNode += ''; + var params = this.getParams(); + for(var key in params) { + swfNode += ''; + } + var pairs = this.getVariablePairs().join("&"); + if(pairs.length > 0) {swfNode += '';} + swfNode += ""; + } + return swfNode; + }, + setDataURL: function(strDataURL){ + //This method sets the data URL for the chart. + //If being set initially + if (this.initialDataSet==false){ + this.addVariable('dataURL',strDataURL); + //Update flag + this.initialDataSet = true; + }else{ + //Else, we update the chart data using External Interface + //Get reference to chart object + var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id')); + + if (!chartObj.setDataURL) + { + __flash__addCallback(chartObj, "setDataURL"); + } + + chartObj.setDataURL(strDataURL); + } + }, + //This function : + //fixes the double quoted attributes to single quotes + //Encodes all quotes inside attribute values + //Encodes % to %25 and & to %26; + encodeDataXML: function(strDataXML){ + + var regExpReservedCharacters=["\\$","\\+"]; + var arrDQAtt=strDataXML.match(/=\s*\".*?\"/g); + if (arrDQAtt){ + for(var i=0;i compatibility + //Check if it's added in Mozilla embed array or if already exits + if(!document.embeds[this.getAttribute('id')] && !window[this.getAttribute('id')]) + window[this.getAttribute('id')]=document.getElementById(this.getAttribute('id')); + //or else document.forms[formName/formIndex][chartId] + return true; + } + } +} + +/* ---- detection functions ---- */ +infosoftglobal.FusionChartsUtil.getPlayerVersion = function(){ + var PlayerVersion = new infosoftglobal.PlayerVersion([0,0,0]); + if(navigator.plugins && navigator.mimeTypes.length){ + var x = navigator.plugins["Shockwave Flash"]; + if(x && x.description) { + PlayerVersion = new infosoftglobal.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".")); + } + }else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ + //If Windows CE + var axo = 1; + var counter = 3; + while(axo) { + try { + counter++; + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter); + PlayerVersion = new infosoftglobal.PlayerVersion([counter,0,0]); + } catch (e) { + axo = null; + } + } + } else { + // Win IE (non mobile) + // Do minor version lookup in IE, but avoid Flash Player 6 crashing issues + try{ + var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); + }catch(e){ + try { + var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); + PlayerVersion = new infosoftglobal.PlayerVersion([6,0,21]); + axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code) + } catch(e) { + if (PlayerVersion.major == 6) { + return PlayerVersion; + } + } + try { + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); + } catch(e) {} + } + if (axo != null) { + PlayerVersion = new infosoftglobal.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(",")); + } + } + return PlayerVersion; +} +infosoftglobal.PlayerVersion = function(arrVersion){ + this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0; + this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0; + this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0; +} +// ------------ Fix for Out of Memory Bug in IE in FP9 ---------------// +/* Fix for video streaming bug */ +infosoftglobal.FusionChartsUtil.cleanupSWFs = function() { + var objects = document.getElementsByTagName("OBJECT"); + for (var i = objects.length - 1; i >= 0; i--) { + objects[i].style.display = 'none'; + for (var x in objects[i]) { + if (typeof objects[i][x] == 'function') { + objects[i][x] = function(){}; + } + } + } +} +// Fixes bug in fp9 +if (infosoftglobal.FusionCharts.doPrepUnload) { + if (!infosoftglobal.unloadSet) { + infosoftglobal.FusionChartsUtil.prepUnload = function() { + __flash_unloadHandler = function(){}; + __flash_savedUnloadHandler = function(){}; + window.attachEvent("onunload", infosoftglobal.FusionChartsUtil.cleanupSWFs); + } + window.attachEvent("onbeforeunload", infosoftglobal.FusionChartsUtil.prepUnload); + infosoftglobal.unloadSet = true; + } +} +/* Add document.getElementById if needed (mobile IE < 5) */ +if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }} +/* Add Array.push if needed (ie5) */ +if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }} + +/* Function to return Flash Object from ID */ +infosoftglobal.FusionChartsUtil.getChartObject = function(id) +{ + var chartRef=null; + if (navigator.appName.indexOf("Microsoft Internet")==-1) { + if (document.embeds && document.embeds[id]) + chartRef = document.embeds[id]; + else + chartRef = window.document[id]; + } + else { + chartRef = window[id]; + } + if (!chartRef) + chartRef = document.getElementById(id); + + return chartRef; +} +/* + Function to update chart's data at client side (FOR FusionCharts vFREE and 2.x +*/ +infosoftglobal.FusionChartsUtil.updateChartXML = function(chartId, strXML){ + //Get reference to chart object + var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(chartId); + //Set dataURL to null + chartObj.SetVariable("_root.dataURL",""); + //Set the flag + chartObj.SetVariable("_root.isNewData","1"); + //Set the actual data + chartObj.SetVariable("_root.newData",strXML); + //Go to the required frame + chartObj.TGotoLabel("/", "JavaScriptHandler"); +} + + +/* Aliases for easy usage */ +var getChartFromId = infosoftglobal.FusionChartsUtil.getChartObject; +var updateChartXML = infosoftglobal.FusionChartsUtil.updateChartXML; +var FusionCharts = infosoftglobal.FusionCharts; \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/charts.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/charts.js new file mode 100644 index 0000000..4bebbd3 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/charts.js @@ -0,0 +1,132 @@ + +function drawSingleSeriesChart(tabId, chartId, chartWidth, chartHeight, chartType, chartData,mme,yyyyMo) { + // define, set the data for each chart, and render them (if indicated) + var myChart = new FusionCharts("static/fusion/inc/fusionchart/" + chartType, "myChartId" + chartId, chartWidth, chartHeight); + + var mmeLabel = "";//mme + ""; + + var chartCaptionId = tabId + "-chartdiv" + chartId + "-label"; + + document.getElementById(chartCaptionId).innerHTML = "Hosted Voice Usage in "+ yyyyMo; + + myChart.setDataXML("" + chartData + ""); + myChart.setTransparent(true); + myChart.render(tabId + "-"+ "chartdiv" + chartId); + + + } + + + // gauge charts + function drawGaugeChart(chartId, gaugeIndex, value) { + var myChart = new FusionCharts("static/fusion/inc/fusionchart/AngularGauge.swf", "myChartId" + chartId, "300", "300", "0", "0"); + //CPU for NYCMNYBWLT1 on 201301 : 12.63// + var chartData = + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + ""; + + myChart.setDataXML(chartData); + myChart.render("chartdiv" + chartId); + } + + + function updateGaugeChart(chartId, gaugeIndex, refreshCount) { + var myChart = getChartFromId("myChartId" + chartId); + var val = 0; + if (gaugeIndex == "10") val = 12; + else if (gaugeIndex == "20") val = 15; + else if (gaugeIndex == "30") val = 52; + else if (gaugeIndex == "40") val = 42; + myChart.setData(1, val); + myChart.setData(2, val+20); + } + + function updateGaugeChartWithMMEData(chartId, value) { + var myChart = getChartFromId("myChartId" + chartId); + myChart.setData(1, value); + } + + + function updateGaugeChartWithMMEData(chartId, value, yyyyMo, mme) { + var myChart = getChartFromId("myChartId" + chartId); + myChart.setData(1, value); + document.getElementById("cpuYyyyMm").innerHTML = "Hosted Voice Utilization in "+ yyyyMo; + + } + + function drawMultiSeriesChart(tabId,chartId, chartWidth, chartHeight, chartType) { + var myChart = new FusionCharts("static/fusion/inc/fusionchart/" + chartType, "myChartId" + chartId, chartWidth, chartHeight, "0", "0"); + + myChart.setTransparent(true); + + var chartData = + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + ""; + + myChart.setDataXML(chartData); + myChart.render(tabId + "-" + "chartdiv" + chartId); + } + diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/eye.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/eye.js new file mode 100644 index 0000000..8a281dc --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/eye.js @@ -0,0 +1,34 @@ +/** + * + * Zoomimage + * Author: Stefan Petre www.eyecon.ro + * + */ +(function($){ + var EYE = window.EYE = function() { + var _registered = { + init: [] + }; + return { + init: function() { + $.each(_registered.init, function(nr, fn){ + fn.call(); + }); + }, + extend: function(prop) { + for (var i in prop) { + if (prop[i] != undefined) { + this[i] = prop[i]; + } + } + }, + register: function(fn, type) { + if (!_registered[type]) { + _registered[type] = []; + } + _registered[type].push(fn); + } + }; + }(); + $(EYE.init); +})(jQuery); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/jquery.flexslider-min.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/jquery.flexslider-min.js new file mode 100644 index 0000000..5ad6c37 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/jquery.flexslider-min.js @@ -0,0 +1,5 @@ +/* + * jQuery FlexSlider v2.6.0 + * Copyright 2012 WooThemes + * Contributing Author: Tyler Smith + */!function($){var e=!0;$.flexslider=function(t,a){var n=$(t);n.vars=$.extend({},$.flexslider.defaults,a);var i=n.vars.namespace,s=window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture,r=("ontouchstart"in window||s||window.DocumentTouch&&document instanceof DocumentTouch)&&n.vars.touch,o="click touchend MSPointerUp keyup",l="",c,d="vertical"===n.vars.direction,u=n.vars.reverse,v=n.vars.itemWidth>0,p="fade"===n.vars.animation,m=""!==n.vars.asNavFor,f={};$.data(t,"flexslider",n),f={init:function(){n.animating=!1,n.currentSlide=parseInt(n.vars.startAt?n.vars.startAt:0,10),isNaN(n.currentSlide)&&(n.currentSlide=0),n.animatingTo=n.currentSlide,n.atEnd=0===n.currentSlide||n.currentSlide===n.last,n.containerSelector=n.vars.selector.substr(0,n.vars.selector.search(" ")),n.slides=$(n.vars.selector,n),n.container=$(n.containerSelector,n),n.count=n.slides.length,n.syncExists=$(n.vars.sync).length>0,"slide"===n.vars.animation&&(n.vars.animation="swing"),n.prop=d?"top":"marginLeft",n.args={},n.manualPause=!1,n.stopped=!1,n.started=!1,n.startTimeout=null,n.transitions=!n.vars.video&&!p&&n.vars.useCSS&&function(){var e=document.createElement("div"),t=["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var a in t)if(void 0!==e.style[t[a]])return n.pfx=t[a].replace("Perspective","").toLowerCase(),n.prop="-"+n.pfx+"-transform",!0;return!1}(),n.ensureAnimationEnd="",""!==n.vars.controlsContainer&&(n.controlsContainer=$(n.vars.controlsContainer).length>0&&$(n.vars.controlsContainer)),""!==n.vars.manualControls&&(n.manualControls=$(n.vars.manualControls).length>0&&$(n.vars.manualControls)),""!==n.vars.customDirectionNav&&(n.customDirectionNav=2===$(n.vars.customDirectionNav).length&&$(n.vars.customDirectionNav)),n.vars.randomize&&(n.slides.sort(function(){return Math.round(Math.random())-.5}),n.container.empty().append(n.slides)),n.doMath(),n.setup("init"),n.vars.controlNav&&f.controlNav.setup(),n.vars.directionNav&&f.directionNav.setup(),n.vars.keyboard&&(1===$(n.containerSelector).length||n.vars.multipleKeyboard)&&$(document).bind("keyup",function(e){var t=e.keyCode;if(!n.animating&&(39===t||37===t)){var a=39===t?n.getTarget("next"):37===t?n.getTarget("prev"):!1;n.flexAnimate(a,n.vars.pauseOnAction)}}),n.vars.mousewheel&&n.bind("mousewheel",function(e,t,a,i){e.preventDefault();var s=0>t?n.getTarget("next"):n.getTarget("prev");n.flexAnimate(s,n.vars.pauseOnAction)}),n.vars.pausePlay&&f.pausePlay.setup(),n.vars.slideshow&&n.vars.pauseInvisible&&f.pauseInvisible.init(),n.vars.slideshow&&(n.vars.pauseOnHover&&n.hover(function(){n.manualPlay||n.manualPause||n.pause()},function(){n.manualPause||n.manualPlay||n.stopped||n.play()}),n.vars.pauseInvisible&&f.pauseInvisible.isHidden()||(n.vars.initDelay>0?n.startTimeout=setTimeout(n.play,n.vars.initDelay):n.play())),m&&f.asNav.setup(),r&&n.vars.touch&&f.touch(),(!p||p&&n.vars.smoothHeight)&&$(window).bind("resize orientationchange focus",f.resize),n.find("img").attr("draggable","false"),setTimeout(function(){n.vars.start(n)},200)},asNav:{setup:function(){n.asNav=!0,n.animatingTo=Math.floor(n.currentSlide/n.move),n.currentItem=n.currentSlide,n.slides.removeClass(i+"active-slide").eq(n.currentItem).addClass(i+"active-slide"),s?(t._slider=n,n.slides.each(function(){var e=this;e._gesture=new MSGesture,e._gesture.target=e,e.addEventListener("MSPointerDown",function(e){e.preventDefault(),e.currentTarget._gesture&&e.currentTarget._gesture.addPointer(e.pointerId)},!1),e.addEventListener("MSGestureTap",function(e){e.preventDefault();var t=$(this),a=t.index();$(n.vars.asNavFor).data("flexslider").animating||t.hasClass("active")||(n.direction=n.currentItem=s&&t.hasClass(i+"active-slide")?n.flexAnimate(n.getTarget("prev"),!0):$(n.vars.asNavFor).data("flexslider").animating||t.hasClass(i+"active-slide")||(n.direction=n.currentItem'),n.pagingCount>1)for(var r=0;r":''+t+"","thumbnails"===n.vars.controlNav&&!0===n.vars.thumbCaptions){var c=s.attr("data-thumbcaption");""!==c&&void 0!==c&&(a+=''+c+"")}n.controlNavScaffold.append("
      • "+a+"
      • "),t++}n.controlsContainer?$(n.controlsContainer).append(n.controlNavScaffold):n.append(n.controlNavScaffold),f.controlNav.set(),f.controlNav.active(),n.controlNavScaffold.delegate("a, img",o,function(e){if(e.preventDefault(),""===l||l===e.type){var t=$(this),a=n.controlNav.index(t);t.hasClass(i+"active")||(n.direction=a>n.currentSlide?"next":"prev",n.flexAnimate(a,n.vars.pauseOnAction))}""===l&&(l=e.type),f.setToClearWatchedEvent()})},setupManual:function(){n.controlNav=n.manualControls,f.controlNav.active(),n.controlNav.bind(o,function(e){if(e.preventDefault(),""===l||l===e.type){var t=$(this),a=n.controlNav.index(t);t.hasClass(i+"active")||(a>n.currentSlide?n.direction="next":n.direction="prev",n.flexAnimate(a,n.vars.pauseOnAction))}""===l&&(l=e.type),f.setToClearWatchedEvent()})},set:function(){var e="thumbnails"===n.vars.controlNav?"img":"a";n.controlNav=$("."+i+"control-nav li "+e,n.controlsContainer?n.controlsContainer:n)},active:function(){n.controlNav.removeClass(i+"active").eq(n.animatingTo).addClass(i+"active")},update:function(e,t){n.pagingCount>1&&"add"===e?n.controlNavScaffold.append($('
      • '+n.count+"
      • ")):1===n.pagingCount?n.controlNavScaffold.find("li").remove():n.controlNav.eq(t).closest("li").remove(),f.controlNav.set(),n.pagingCount>1&&n.pagingCount!==n.controlNav.length?n.update(t,e):f.controlNav.active()}},directionNav:{setup:function(){var e=$('");n.customDirectionNav?n.directionNav=n.customDirectionNav:n.controlsContainer?($(n.controlsContainer).append(e),n.directionNav=$("."+i+"direction-nav li a",n.controlsContainer)):(n.append(e),n.directionNav=$("."+i+"direction-nav li a",n)),f.directionNav.update(),n.directionNav.bind(o,function(e){e.preventDefault();var t;(""===l||l===e.type)&&(t=$(this).hasClass(i+"next")?n.getTarget("next"):n.getTarget("prev"),n.flexAnimate(t,n.vars.pauseOnAction)),""===l&&(l=e.type),f.setToClearWatchedEvent()})},update:function(){var e=i+"disabled";1===n.pagingCount?n.directionNav.addClass(e).attr("tabindex","-1"):n.vars.animationLoop?n.directionNav.removeClass(e).removeAttr("tabindex"):0===n.animatingTo?n.directionNav.removeClass(e).filter("."+i+"prev").addClass(e).attr("tabindex","-1"):n.animatingTo===n.last?n.directionNav.removeClass(e).filter("."+i+"next").addClass(e).attr("tabindex","-1"):n.directionNav.removeClass(e).removeAttr("tabindex")}},pausePlay:{setup:function(){var e=$('
        ');n.controlsContainer?(n.controlsContainer.append(e),n.pausePlay=$("."+i+"pauseplay a",n.controlsContainer)):(n.append(e),n.pausePlay=$("."+i+"pauseplay a",n)),f.pausePlay.update(n.vars.slideshow?i+"pause":i+"play"),n.pausePlay.bind(o,function(e){e.preventDefault(),(""===l||l===e.type)&&($(this).hasClass(i+"pause")?(n.manualPause=!0,n.manualPlay=!1,n.pause()):(n.manualPause=!1,n.manualPlay=!0,n.play())),""===l&&(l=e.type),f.setToClearWatchedEvent()})},update:function(e){"play"===e?n.pausePlay.removeClass(i+"pause").addClass(i+"play").html(n.vars.playText):n.pausePlay.removeClass(i+"play").addClass(i+"pause").html(n.vars.pauseText)}},touch:function(){function e(e){e.stopPropagation(),n.animating?e.preventDefault():(n.pause(),t._gesture.addPointer(e.pointerId),T=0,c=d?n.h:n.w,f=Number(new Date),l=v&&u&&n.animatingTo===n.last?0:v&&u?n.limit-(n.itemW+n.vars.itemMargin)*n.move*n.animatingTo:v&&n.currentSlide===n.last?n.limit:v?(n.itemW+n.vars.itemMargin)*n.move*n.currentSlide:u?(n.last-n.currentSlide+n.cloneOffset)*c:(n.currentSlide+n.cloneOffset)*c)}function a(e){e.stopPropagation();var a=e.target._slider;if(a){var n=-e.translationX,i=-e.translationY;return T+=d?i:n,m=T,x=d?Math.abs(T)500)&&(e.preventDefault(),!p&&a.transitions&&(a.vars.animationLoop||(m=T/(0===a.currentSlide&&0>T||a.currentSlide===a.last&&T>0?Math.abs(T)/c+2:1)),a.setProps(l+m,"setTouch"))))}}function i(e){e.stopPropagation();var t=e.target._slider;if(t){if(t.animatingTo===t.currentSlide&&!x&&null!==m){var a=u?-m:m,n=a>0?t.getTarget("next"):t.getTarget("prev");t.canAdvance(n)&&(Number(new Date)-f<550&&Math.abs(a)>50||Math.abs(a)>c/2)?t.flexAnimate(n,t.vars.pauseOnAction):p||t.flexAnimate(t.currentSlide,t.vars.pauseOnAction,!0)}r=null,o=null,m=null,l=null,T=0}}var r,o,l,c,m,f,g,h,S,x=!1,y=0,b=0,T=0;s?(t.style.msTouchAction="none",t._gesture=new MSGesture,t._gesture.target=t,t.addEventListener("MSPointerDown",e,!1),t._slider=n,t.addEventListener("MSGestureChange",a,!1),t.addEventListener("MSGestureEnd",i,!1)):(g=function(e){n.animating?e.preventDefault():(window.navigator.msPointerEnabled||1===e.touches.length)&&(n.pause(),c=d?n.h:n.w,f=Number(new Date),y=e.touches[0].pageX,b=e.touches[0].pageY,l=v&&u&&n.animatingTo===n.last?0:v&&u?n.limit-(n.itemW+n.vars.itemMargin)*n.move*n.animatingTo:v&&n.currentSlide===n.last?n.limit:v?(n.itemW+n.vars.itemMargin)*n.move*n.currentSlide:u?(n.last-n.currentSlide+n.cloneOffset)*c:(n.currentSlide+n.cloneOffset)*c,r=d?b:y,o=d?y:b,t.addEventListener("touchmove",h,!1),t.addEventListener("touchend",S,!1))},h=function(e){y=e.touches[0].pageX,b=e.touches[0].pageY,m=d?r-b:r-y,x=d?Math.abs(m)t)&&(e.preventDefault(),!p&&n.transitions&&(n.vars.animationLoop||(m/=0===n.currentSlide&&0>m||n.currentSlide===n.last&&m>0?Math.abs(m)/c+2:1),n.setProps(l+m,"setTouch")))},S=function(e){if(t.removeEventListener("touchmove",h,!1),n.animatingTo===n.currentSlide&&!x&&null!==m){var a=u?-m:m,i=a>0?n.getTarget("next"):n.getTarget("prev");n.canAdvance(i)&&(Number(new Date)-f<550&&Math.abs(a)>50||Math.abs(a)>c/2)?n.flexAnimate(i,n.vars.pauseOnAction):p||n.flexAnimate(n.currentSlide,n.vars.pauseOnAction,!0)}t.removeEventListener("touchend",S,!1),r=null,o=null,m=null,l=null},t.addEventListener("touchstart",g,!1))},resize:function(){!n.animating&&n.is(":visible")&&(v||n.doMath(),p?f.smoothHeight():v?(n.slides.width(n.computedW),n.update(n.pagingCount),n.setProps()):d?(n.viewport.height(n.h),n.setProps(n.h,"setTotal")):(n.vars.smoothHeight&&f.smoothHeight(),n.newSlides.width(n.computedW),n.setProps(n.computedW,"setTotal")))},smoothHeight:function(e){if(!d||p){var t=p?n:n.viewport;e?t.animate({height:n.slides.eq(n.animatingTo).height()},e):t.height(n.slides.eq(n.animatingTo).height())}},sync:function(e){var t=$(n.vars.sync).data("flexslider"),a=n.animatingTo;switch(e){case"animate":t.flexAnimate(a,n.vars.pauseOnAction,!1,!0);break;case"play":t.playing||t.asNav||t.play();break;case"pause":t.pause()}},uniqueID:function(e){return e.filter("[id]").add(e.find("[id]")).each(function(){var e=$(this);e.attr("id",e.attr("id")+"_clone")}),e},pauseInvisible:{visProp:null,init:function(){var e=f.pauseInvisible.getHiddenProp();if(e){var t=e.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(t,function(){f.pauseInvisible.isHidden()?n.startTimeout?clearTimeout(n.startTimeout):n.pause():n.started?n.play():n.vars.initDelay>0?setTimeout(n.play,n.vars.initDelay):n.play()})}},isHidden:function(){var e=f.pauseInvisible.getHiddenProp();return e?document[e]:!1},getHiddenProp:function(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;tn.currentSlide?"next":"prev"),m&&1===n.pagingCount&&(n.direction=n.currentItemn.limit&&1!==n.visible?n.limit:S):h=0===n.currentSlide&&e===n.count-1&&n.vars.animationLoop&&"next"!==n.direction?u?(n.count+n.cloneOffset)*c:0:n.currentSlide===n.last&&0===e&&n.vars.animationLoop&&"prev"!==n.direction?u?0:(n.count+1)*c:u?(n.count-1-e+n.cloneOffset)*c:(e+n.cloneOffset)*c,n.setProps(h,"",n.vars.animationSpeed),n.transitions?(n.vars.animationLoop&&n.atEnd||(n.animating=!1,n.currentSlide=n.animatingTo),n.container.unbind("webkitTransitionEnd transitionend"),n.container.bind("webkitTransitionEnd transitionend",function(){clearTimeout(n.ensureAnimationEnd),n.wrapup(c)}),clearTimeout(n.ensureAnimationEnd),n.ensureAnimationEnd=setTimeout(function(){n.wrapup(c)},n.vars.animationSpeed+100)):n.container.animate(n.args,n.vars.animationSpeed,n.vars.easing,function(){n.wrapup(c)})}n.vars.smoothHeight&&f.smoothHeight(n.vars.animationSpeed)}},n.wrapup=function(e){p||v||(0===n.currentSlide&&n.animatingTo===n.last&&n.vars.animationLoop?n.setProps(e,"jumpEnd"):n.currentSlide===n.last&&0===n.animatingTo&&n.vars.animationLoop&&n.setProps(e,"jumpStart")),n.animating=!1,n.currentSlide=n.animatingTo,n.vars.after(n)},n.animateSlides=function(){!n.animating&&e&&n.flexAnimate(n.getTarget("next"))},n.pause=function(){clearInterval(n.animatedSlides),n.animatedSlides=null,n.playing=!1,n.vars.pausePlay&&f.pausePlay.update("play"),n.syncExists&&f.sync("pause")},n.play=function(){n.playing&&clearInterval(n.animatedSlides),n.animatedSlides=n.animatedSlides||setInterval(n.animateSlides,n.vars.slideshowSpeed),n.started=n.playing=!0,n.vars.pausePlay&&f.pausePlay.update("pause"),n.syncExists&&f.sync("play")},n.stop=function(){n.pause(),n.stopped=!0},n.canAdvance=function(e,t){var a=m?n.pagingCount-1:n.last;return t?!0:m&&n.currentItem===n.count-1&&0===e&&"prev"===n.direction?!0:m&&0===n.currentItem&&e===n.pagingCount-1&&"next"!==n.direction?!1:e!==n.currentSlide||m?n.vars.animationLoop?!0:n.atEnd&&0===n.currentSlide&&e===a&&"next"!==n.direction?!1:n.atEnd&&n.currentSlide===a&&0===e&&"next"===n.direction?!1:!0:!1},n.getTarget=function(e){return n.direction=e,"next"===e?n.currentSlide===n.last?0:n.currentSlide+1:0===n.currentSlide?n.last:n.currentSlide-1},n.setProps=function(e,t,a){var i=function(){var a=e?e:(n.itemW+n.vars.itemMargin)*n.move*n.animatingTo,i=function(){if(v)return"setTouch"===t?e:u&&n.animatingTo===n.last?0:u?n.limit-(n.itemW+n.vars.itemMargin)*n.move*n.animatingTo:n.animatingTo===n.last?n.limit:a;switch(t){case"setTotal":return u?(n.count-1-n.currentSlide+n.cloneOffset)*e:(n.currentSlide+n.cloneOffset)*e;case"setTouch":return u?e:e;case"jumpEnd":return u?e:n.count*e;case"jumpStart":return u?n.count*e:e;default:return e}}();return-1*i+"px"}();n.transitions&&(i=d?"translate3d(0,"+i+",0)":"translate3d("+i+",0,0)",a=void 0!==a?a/1e3+"s":"0s",n.container.css("-"+n.pfx+"-transition-duration",a),n.container.css("transition-duration",a)),n.args[n.prop]=i,(n.transitions||void 0===a)&&n.container.css(n.args),n.container.css("transform",i)},n.setup=function(e){if(p)n.slides.css({width:"100%","float":"left",marginRight:"-100%",position:"relative"}),"init"===e&&(r?n.slides.css({opacity:0,display:"block",webkitTransition:"opacity "+n.vars.animationSpeed/1e3+"s ease",zIndex:1}).eq(n.currentSlide).css({opacity:1,zIndex:2}):0==n.vars.fadeFirstSlide?n.slides.css({opacity:0,display:"block",zIndex:1}).eq(n.currentSlide).css({zIndex:2}).css({opacity:1}):n.slides.css({opacity:0,display:"block",zIndex:1}).eq(n.currentSlide).css({zIndex:2}).animate({opacity:1},n.vars.animationSpeed,n.vars.easing)),n.vars.smoothHeight&&f.smoothHeight();else{var t,a;"init"===e&&(n.viewport=$('
        ').css({overflow:"hidden",position:"relative"}).appendTo(n).append(n.container),n.cloneCount=0,n.cloneOffset=0,u&&(a=$.makeArray(n.slides).reverse(),n.slides=$(a),n.container.empty().append(n.slides))),n.vars.animationLoop&&!v&&(n.cloneCount=2,n.cloneOffset=1,"init"!==e&&n.container.find(".clone").remove(),n.container.append(f.uniqueID(n.slides.first().clone().addClass("clone")).attr("aria-hidden","true")).prepend(f.uniqueID(n.slides.last().clone().addClass("clone")).attr("aria-hidden","true"))),n.newSlides=$(n.vars.selector,n),t=u?n.count-1-n.currentSlide+n.cloneOffset:n.currentSlide+n.cloneOffset,d&&!v?(n.container.height(200*(n.count+n.cloneCount)+"%").css("position","absolute").width("100%"),setTimeout(function(){n.newSlides.css({display:"block"}),n.doMath(),n.viewport.height(n.h),n.setProps(t*n.h,"init")},"init"===e?100:0)):(n.container.width(200*(n.count+n.cloneCount)+"%"),n.setProps(t*n.computedW,"init"),setTimeout(function(){n.doMath(),n.newSlides.css({width:n.computedW,marginRight:n.computedM,"float":"left",display:"block"}),n.vars.smoothHeight&&f.smoothHeight()},"init"===e?100:0))}v||n.slides.removeClass(i+"active-slide").eq(n.currentSlide).addClass(i+"active-slide"),n.vars.init(n)},n.doMath=function(){var e=n.slides.first(),t=n.vars.itemMargin,a=n.vars.minItems,i=n.vars.maxItems;n.w=void 0===n.viewport?n.width():n.viewport.width(),n.h=e.height(),n.boxPadding=e.outerWidth()-e.width(),v?(n.itemT=n.vars.itemWidth+t,n.itemM=t,n.minW=a?a*n.itemT:n.w,n.maxW=i?i*n.itemT-t:n.w,n.itemW=n.minW>n.w?(n.w-t*(a-1))/a:n.maxWn.w?n.w:n.vars.itemWidth,n.visible=Math.floor(n.w/n.itemW),n.move=n.vars.move>0&&n.vars.moven.w?n.itemW*(n.count-1)+t*(n.count-1):(n.itemW+t)*n.count-n.w-t):(n.itemW=n.w,n.itemM=t,n.pagingCount=n.count,n.last=n.count-1),n.computedW=n.itemW-n.boxPadding,n.computedM=n.itemM},n.update=function(e,t){n.doMath(),v||(en.controlNav.length?f.controlNav.update("add"):("remove"===t&&!v||n.pagingCountn.last&&(n.currentSlide-=1,n.animatingTo-=1),f.controlNav.update("remove",n.last))),n.vars.directionNav&&f.directionNav.update()},n.addSlide=function(e,t){var a=$(e);n.count+=1,n.last=n.count-1,d&&u?void 0!==t?n.slides.eq(n.count-t).after(a):n.container.prepend(a):void 0!==t?n.slides.eq(t).before(a):n.container.append(a),n.update(t,"add"),n.slides=$(n.vars.selector+":not(.clone)",n),n.setup(),n.vars.added(n)},n.removeSlide=function(e){var t=isNaN(e)?n.slides.index($(e)):e;n.count-=1,n.last=n.count-1,isNaN(e)?$(e,n.slides).remove():d&&u?n.slides.eq(n.last).remove():n.slides.eq(e).remove(),n.doMath(),n.update(t,"remove"),n.slides=$(n.vars.selector+":not(.clone)",n),n.setup(),n.vars.removed(n)},f.init()},$(window).blur(function(t){e=!1}).focus(function(t){e=!0}),$.flexslider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:!1,fadeFirstSlide:!0,thumbCaptions:!1,pauseOnAction:!0,pauseOnHover:!1,pauseInvisible:!0,useCSS:!0,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",customDirectionNav:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:1,maxItems:0,move:0,allowOneSlide:!0,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){},init:function(){}},$.fn.flexslider=function(e){if(void 0===e&&(e={}),"object"==typeof e)return this.each(function(){var t=$(this),a=e.selector?e.selector:".slides > li",n=t.find(a);1===n.length&&e.allowOneSlide===!0||0===n.length?(n.fadeIn(400),e.start&&e.start(t)):void 0===t.data("flexslider")&&new $.flexslider(this,e)});var t=$(this).data("flexslider");switch(e){case"play":t.play();break;case"pause":t.pause();break;case"stop":t.stop();break;case"next":t.flexAnimate(t.getTarget("next"),!0);break;case"prev":case"previous":t.flexAnimate(t.getTarget("prev"),!0);break;default:"number"==typeof e&&t.flexAnimate(e,!0)}}}(jQuery); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/scribble.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/scribble.js new file mode 100644 index 0000000..5384b30 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/scribble.js @@ -0,0 +1,19 @@ + function storeUserScribble(id) { + var scribble = document.getElementById('scribble').innerHTML; + localStorage.setItem('userScribble',scribble); + } + + function getUserScribble() { + if ( localStorage.getItem('userScribble')) { + var scribble = localStorage.getItem('userScribble'); + } + else { + var scribble = 'You can scribble directly on this sticky... and I will also remember your message the next time you visit my blog!'; + } + document.getElementById('scribble').innerHTML = scribble; + } + + function clearLocal() { + clear: localStorage.clear(); + return false; + } diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/slides.min.jquery.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/slides.min.jquery.js new file mode 100644 index 0000000..1a1fcdd --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/slides.min.jquery.js @@ -0,0 +1,20 @@ +/* +* Slides, A Slideshow Plugin for jQuery +* Intructions: http://slidesjs.com +* By: Nathan Searles, http://nathansearles.com +* Version: 1.1.9 +* Updated: September 5th, 2011 +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +(function(a){a.fn.slides=function(b){return b=a.extend({},a.fn.slides.option,b),this.each(function(){function w(g,h,i){if(!p&&o){p=!0,b.animationStart(n+1);switch(g){case"next":l=n,k=n+1,k=e===k?0:k,r=f*2,g=-f*2,n=k;break;case"prev":l=n,k=n-1,k=k===-1?e-1:k,r=0,g=0,n=k;break;case"pagination":k=parseInt(i,10),l=a("."+b.paginationClass+" li."+b.currentClass+" a",c).attr("href").match("[^#/]+$"),k>l?(r=f*2,g=-f*2):(r=0,g=0),n=k}h==="fade"?b.crossfade?d.children(":eq("+k+")",c).css({zIndex:10}).fadeIn(b.fadeSpeed,b.fadeEasing,function(){b.autoHeight?d.animate({height:d.children(":eq("+k+")",c).outerHeight()},b.autoHeightSpeed,function(){d.children(":eq("+l+")",c).css({display:"none",zIndex:0}),d.children(":eq("+k+")",c).css({zIndex:0}),b.animationComplete(k+1),p=!1}):(d.children(":eq("+l+")",c).css({display:"none",zIndex:0}),d.children(":eq("+k+")",c).css({zIndex:0}),b.animationComplete(k+1),p=!1)}):d.children(":eq("+l+")",c).fadeOut(b.fadeSpeed,b.fadeEasing,function(){b.autoHeight?d.animate({height:d.children(":eq("+k+")",c).outerHeight()},b.autoHeightSpeed,function(){d.children(":eq("+k+")",c).fadeIn(b.fadeSpeed,b.fadeEasing)}):d.children(":eq("+k+")",c).fadeIn(b.fadeSpeed,b.fadeEasing,function(){a.browser.msie&&a(this).get(0).style.removeAttribute("filter")}),b.animationComplete(k+1),p=!1}):(d.children(":eq("+k+")").css({left:r,display:"block"}),b.autoHeight?d.animate({left:g,height:d.children(":eq("+k+")").outerHeight()},b.slideSpeed,b.slideEasing,function(){d.css({left:-f}),d.children(":eq("+k+")").css({left:f,zIndex:5}),d.children(":eq("+l+")").css({left:f,display:"none",zIndex:0}),b.animationComplete(k+1),p=!1}):d.animate({left:g},b.slideSpeed,b.slideEasing,function(){d.css({left:-f}),d.children(":eq("+k+")").css({left:f,zIndex:5}),d.children(":eq("+l+")").css({left:f,display:"none",zIndex:0}),b.animationComplete(k+1),p=!1})),b.pagination&&(a("."+b.paginationClass+" li."+b.currentClass,c).removeClass(b.currentClass),a("."+b.paginationClass+" li:eq("+k+")",c).addClass(b.currentClass))}}function x(){clearInterval(c.data("interval"))}function y(){b.pause?(clearTimeout(c.data("pause")),clearInterval(c.data("interval")),u=setTimeout(function(){clearTimeout(c.data("pause")),v=setInterval(function(){w("next",i)},b.play),c.data("interval",v)},b.pause),c.data("pause",u)):x()}a("."+b.container,a(this)).children().wrapAll('
        ');var c=a(this),d=a(".slides_control",c),e=d.children().size(),f=d.children().outerWidth(),g=d.children().outerHeight(),h=b.start-1,i=b.effect.indexOf(",")<0?b.effect:b.effect.replace(" ","").split(",")[0],j=b.effect.indexOf(",")<0?i:b.effect.replace(" ","").split(",")[1],k=0,l=0,m=0,n=0,o,p,q,r,s,t,u,v;if(e<2)return a("."+b.container,a(this)).fadeIn(b.fadeSpeed,b.fadeEasing,function(){o=!0,b.slidesLoaded()}),a("."+b.next+", ."+b.prev).fadeOut(0),!1;if(e<2)return;h<0&&(h=0),h>e&&(h=e-1),b.start&&(n=h),b.randomize&&d.randomize(),a("."+b.container,c).css({overflow:"hidden",position:"relative"}),d.children().css({position:"absolute",top:0,left:d.children().outerWidth(),zIndex:0,display:"none"}),d.css({position:"relative",width:f*3,height:g,left:-f}),a("."+b.container,c).css({display:"block"}),b.autoHeight&&(d.children().css({height:"auto"}),d.animate({height:d.children(":eq("+h+")").outerHeight()},b.autoHeightSpeed));if(b.preload&&d.find("img:eq("+h+")").length){a("."+b.container,c).css({background:"url("+b.preloadImage+") no-repeat 50% 50%"});var z=d.find("img:eq("+h+")").attr("src")+"?"+(new Date).getTime();a("img",c).parent().attr("class")!="slides_control"?t=d.children(":eq(0)")[0].tagName.toLowerCase():t=d.find("img:eq("+h+")"),d.find("img:eq("+h+")").attr("src",z).load(function(){d.find(t+":eq("+h+")").fadeIn(b.fadeSpeed,b.fadeEasing,function(){a(this).css({zIndex:5}),a("."+b.container,c).css({background:""}),o=!0,b.slidesLoaded()})})}else d.children(":eq("+h+")").fadeIn(b.fadeSpeed,b.fadeEasing,function(){o=!0,b.slidesLoaded()});b.bigTarget&&(d.children().css({cursor:"pointer"}),d.children().click(function(){return w("next",i),!1})),b.hoverPause&&b.play&&(d.bind("mouseover",function(){x()}),d.bind("mouseleave",function(){y()})),b.generateNextPrev&&(a("."+b.container,c).after('Prev'),a("."+b.prev,c).after('Next')),a("."+b.next,c).click(function(a){a.preventDefault(),b.play&&y(),w("next",i)}),a("."+b.prev,c).click(function(a){a.preventDefault(),b.play&&y(),w("prev",i)}),b.generatePagination?(b.prependPagination?c.prepend("
          "):c.append("
            "),d.children().each(function(){a("."+b.paginationClass,c).append('
          • '+(m+1)+"
          • "),m++})):a("."+b.paginationClass+" li a",c).each(function(){a(this).attr("href","#"+m),m++}),a("."+b.paginationClass+" li:eq("+h+")",c).addClass(b.currentClass),a("."+b.paginationClass+" li a",c).click(function(){return b.play&&y(),q=a(this).attr("href").match("[^#/]+$"),n!=q&&w("pagination",j,q),!1}),a("a.link",c).click(function(){return b.play&&y(),q=a(this).attr("href").match("[^#/]+$")-1,n!=q&&w("pagination",j,q),!1}),b.play&&(v=setInterval(function(){w("next",i)},b.play),c.data("interval",v))})},a.fn.slides.option={preload:!1,preloadImage:"/img/loading.gif",container:"slides_container",generateNextPrev:!1,next:"next",prev:"prev",pagination:!0,generatePagination:!0,prependPagination:!1,paginationClass:"pagination",currentClass:"current",fadeSpeed:350,fadeEasing:"",slideSpeed:350,slideEasing:"",start:1,effect:"slide",crossfade:!1,randomize:!1,play:0,pause:0,hoverPause:!1,autoHeight:!1,autoHeightSpeed:350,bigTarget:!1,animationStart:function(){},animationComplete:function(){},slidesLoaded:function(){}},a.fn.randomize=function(b){function c(){return Math.round(Math.random())-.5}return a(this).each(function(){var d=a(this),e=d.children(),f=e.length;if(f>1){e.hide();var g=[];for(i=0;i') + .appendTo(this) + .addClass(opt.loadingClass) + .bind('click', EYE.spacegallery.next); + el.spacegalleryCfg = opt; + el.spacegalleryCfg.images = el.getElementsByTagName('img').length; + el.spacegalleryCfg.loaded = 0; + el.spacegalleryCfg.asin = Math.asin(1); + el.spacegalleryCfg.asins = {}; + el.spacegalleryCfg.tops = {}; + el.spacegalleryCfg.increment = parseInt(el.spacegalleryCfg.perspective/el.spacegalleryCfg.images, 10); + var top = 0; + $('img', el) + .each(function(nr){ + var imgEl = new Image(); + var elImg = this; + el.spacegalleryCfg.asins[nr] = 1 - Math.asin((nr+1)/el.spacegalleryCfg.images)/el.spacegalleryCfg.asin; + top += el.spacegalleryCfg.increment - el.spacegalleryCfg.increment * el.spacegalleryCfg.asins[nr]; + el.spacegalleryCfg.tops[nr] = top; + elImg.spacegallery = {}; + imgEl.src = this.src; + if (imgEl.complete) { + el.spacegalleryCfg.loaded ++; + elImg.spacegallery.origWidth = imgEl.width; + elImg.spacegallery.origHeight = imgEl.height + } else { + imgEl.onload = function() { + el.spacegalleryCfg.loaded ++; + elImg.spacegallery.origWidth = imgEl.width; + elImg.spacegallery.origHeight = imgEl.height + if (el.spacegalleryCfg.loaded == el.spacegalleryCfg.images) { + + EYE.spacegallery.positionImages(el); + } + }; + } + }); + el.spacegalleryCfg.asins[el.spacegalleryCfg.images] = el.spacegalleryCfg.asins[el.spacegalleryCfg.images - 1] * 1.3; + el.spacegalleryCfg.tops[el.spacegalleryCfg.images] = el.spacegalleryCfg.tops[el.spacegalleryCfg.images - 1] * 1.3; + if (el.spacegalleryCfg.loaded == el.spacegalleryCfg.images) { + EYE.spacegallery.positionImages(el); + setInterval(function() { EYE.spacegallery.autoNext(el); }, 4000); + } + } + }); + } + } + }); + + $.fn.extend({ + + /** + * Create a space gallery + * @name spacegallery + * @description create a space gallery + * @option int border Images' border. Default: 6 + * @option int perspective Perpective height. Default: 140 + * @option float minScale Minimum scale for the image in the back. Default: 0.2 + * @option int duration Animation duration. Default: 800 + * @option string loadingClass CSS class applied to the element while looading images. Default: null + * @option function before Callback function triggered before going to the next image + * @option function after Callback function triggered after going to the next image + */ + spacegallery: EYE.spacegallery.init + }); + $.extend($.easing,{ + easeOut:function (x, t, b, c, d) { + return -c *(t/=d)*(t-2) + b; + } + }); +})(jQuery); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/utils.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/utils.js new file mode 100644 index 0000000..d9be853 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/js/utils.js @@ -0,0 +1,252 @@ +/** + * + * Utilities + * Author: Stefan Petre www.eyecon.ro + * + */ +(function($) { +EYE.extend({ + getPosition : function(e, forceIt) + { + var x = 0; + var y = 0; + var es = e.style; + var restoreStyles = false; + if (forceIt && jQuery.curCSS(e,'display') == 'none') { + var oldVisibility = es.visibility; + var oldPosition = es.position; + restoreStyles = true; + es.visibility = 'hidden'; + es.display = 'block'; + es.position = 'absolute'; + } + var el = e; + if (el.getBoundingClientRect) { // IE + var box = el.getBoundingClientRect(); + x = box.left + Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) - 2; + y = box.top + Math.max(document.documentElement.scrollTop, document.body.scrollTop) - 2; + } else { + x = el.offsetLeft; + y = el.offsetTop; + el = el.offsetParent; + if (e != el) { + while (el) { + x += el.offsetLeft; + y += el.offsetTop; + el = el.offsetParent; + } + } + if (jQuery.browser.safari && jQuery.curCSS(e, 'position') == 'absolute' ) { + x -= document.body.offsetLeft; + y -= document.body.offsetTop; + } + el = e.parentNode; + while (el && el.tagName.toUpperCase() != 'BODY' && el.tagName.toUpperCase() != 'HTML') + { + if (jQuery.curCSS(el, 'display') != 'inline') { + x -= el.scrollLeft; + y -= el.scrollTop; + } + el = el.parentNode; + } + } + if (restoreStyles == true) { + es.display = 'none'; + es.position = oldPosition; + es.visibility = oldVisibility; + } + return {x:x, y:y}; + }, + getSize : function(e) + { + var w = parseInt(jQuery.curCSS(e,'width'), 10); + var h = parseInt(jQuery.curCSS(e,'height'), 10); + var wb = 0; + var hb = 0; + if (jQuery.curCSS(e, 'display') != 'none') { + wb = e.offsetWidth; + hb = e.offsetHeight; + } else { + var es = e.style; + var oldVisibility = es.visibility; + var oldPosition = es.position; + es.visibility = 'hidden'; + es.display = 'block'; + es.position = 'absolute'; + wb = e.offsetWidth; + hb = e.offsetHeight; + es.display = 'none'; + es.position = oldPosition; + es.visibility = oldVisibility; + } + return {w:w, h:h, wb:wb, hb:hb}; + }, + getClient : function(e) + { + var h, w; + if (e) { + w = e.clientWidth; + h = e.clientHeight; + } else { + var de = document.documentElement; + w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; + h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; + } + return {w:w,h:h}; + }, + getScroll : function (e) + { + var t=0, l=0, w=0, h=0, iw=0, ih=0; + if (e && e.nodeName.toLowerCase() != 'body') { + t = e.scrollTop; + l = e.scrollLeft; + w = e.scrollWidth; + h = e.scrollHeight; + } else { + if (document.documentElement) { + t = document.documentElement.scrollTop; + l = document.documentElement.scrollLeft; + w = document.documentElement.scrollWidth; + h = document.documentElement.scrollHeight; + } else if (document.body) { + t = document.body.scrollTop; + l = document.body.scrollLeft; + w = document.body.scrollWidth; + h = document.body.scrollHeight; + } + if (typeof pageYOffset != 'undefined') { + t = pageYOffset; + l = pageXOffset; + } + iw = self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0; + ih = self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0; + } + return { t: t, l: l, w: w, h: h, iw: iw, ih: ih }; + }, + getMargins : function(e, toInteger) + { + var t = jQuery.curCSS(e,'marginTop') || ''; + var r = jQuery.curCSS(e,'marginRight') || ''; + var b = jQuery.curCSS(e,'marginBottom') || ''; + var l = jQuery.curCSS(e,'marginLeft') || ''; + if (toInteger) + return { + t: parseInt(t, 10)||0, + r: parseInt(r, 10)||0, + b: parseInt(b, 10)||0, + l: parseInt(l, 10) + }; + else + return {t: t, r: r, b: b, l: l}; + }, + getPadding : function(e, toInteger) + { + var t = jQuery.curCSS(e,'paddingTop') || ''; + var r = jQuery.curCSS(e,'paddingRight') || ''; + var b = jQuery.curCSS(e,'paddingBottom') || ''; + var l = jQuery.curCSS(e,'paddingLeft') || ''; + if (toInteger) + return { + t: parseInt(t, 10)||0, + r: parseInt(r, 10)||0, + b: parseInt(b, 10)||0, + l: parseInt(l, 10) + }; + else + return {t: t, r: r, b: b, l: l}; + }, + getBorder : function(e, toInteger) + { + var t = jQuery.curCSS(e,'borderTopWidth') || ''; + var r = jQuery.curCSS(e,'borderRightWidth') || ''; + var b = jQuery.curCSS(e,'borderBottomWidth') || ''; + var l = jQuery.curCSS(e,'borderLeftWidth') || ''; + if (toInteger) + return { + t: parseInt(t, 10)||0, + r: parseInt(r, 10)||0, + b: parseInt(b, 10)||0, + l: parseInt(l, 10)||0 + }; + else + return {t: t, r: r, b: b, l: l}; + }, + traverseDOM : function(nodeEl, func) + { + func(nodeEl); + nodeEl = nodeEl.firstChild; + while(nodeEl){ + EYE.traverseDOM(nodeEl, func); + nodeEl = nodeEl.nextSibling; + } + }, + getInnerWidth : function(el, scroll) { + var offsetW = el.offsetWidth; + return scroll ? Math.max(el.scrollWidth,offsetW) - offsetW + el.clientWidth:el.clientWidth; + }, + getInnerHeight : function(el, scroll) { + var offsetH = el.offsetHeight; + return scroll ? Math.max(el.scrollHeight,offsetH) - offsetH + el.clientHeight:el.clientHeight; + }, + getExtraWidth : function(el) { + if($.boxModel) + return (parseInt($.curCSS(el, 'paddingLeft'))||0) + + (parseInt($.curCSS(el, 'paddingRight'))||0) + + (parseInt($.curCSS(el, 'borderLeftWidth'))||0) + + (parseInt($.curCSS(el, 'borderRightWidth'))||0); + return 0; + }, + getExtraHeight : function(el) { + if($.boxModel) + return (parseInt($.curCSS(el, 'paddingTop'))||0) + + (parseInt($.curCSS(el, 'paddingBottom'))||0) + + (parseInt($.curCSS(el, 'borderTopWidth'))||0) + + (parseInt($.curCSS(el, 'borderBottomWidth'))||0); + return 0; + }, + isChildOf: function(parentEl, el, container) { + if (parentEl == el) { + return true; + } + if (!el || !el.nodeType || el.nodeType != 1) { + return false; + } + if (parentEl.contains && !$.browser.safari) { + return parentEl.contains(el); + } + if ( parentEl.compareDocumentPosition ) { + return !!(parentEl.compareDocumentPosition(el) & 16); + } + var prEl = el.parentNode; + while(prEl && prEl != container) { + if (prEl == parentEl) + return true; + prEl = prEl.parentNode; + } + return false; + }, + centerEl : function(el, axis) + { + var clientScroll = EYE.getScroll(); + var size = EYE.getSize(el); + if (!axis || axis == 'vertically') + $(el).css( + { + top: clientScroll.t + ((Math.min(clientScroll.h,clientScroll.ih) - size.hb)/2) + 'px' + } + ); + if (!axis || axis == 'horizontally') + $(el).css( + { + left: clientScroll.l + ((Math.min(clientScroll.w,clientScroll.iw) - size.wb)/2) + 'px' + } + ); + } +}); +if (!$.easing.easeout) { + $.easing.easeout = function(p, n, firstNum, delta, duration) { + return -delta * ((n=n/duration-1)*n*n*n - 1) + firstNum; + }; +} + +})(jQuery); \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/bootstrap.min.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/bootstrap.min.css new file mode 100644 index 0000000..3424a5f --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/bootstrap.min.css @@ -0,0 +1,351 @@ +html,body{margin:0;padding:0;} +h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,cite,code,del,dfn,em,img,q,s,samp,small,strike,strong,sub,sup,tt,var,dd,dl,dt,li,ol,ul,fieldset,form,label,legend,button,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;font-weight:normal;font-style:normal;font-size:100%;line-height:1;font-family:inherit;} +ol,ul{list-style:none;} +q:before,q:after,blockquote:before,blockquote:after{content:"";} +html{overflow-y:scroll;font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;} +a:focus{outline:thin dotted;} +a:hover,a:active{outline:0;} +article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block;} +audio,canvas,video{display:inline-block;*display:inline;*zoom:1;} +audio:not([controls]){display:none;} +sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;} +sup{top:-0.5em;} +sub{bottom:-0.25em;} +img{border:0;-ms-interpolation-mode:bicubic;} +button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle;} +button,input{line-height:normal;*overflow:visible;} +button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;} +button,input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button;} +input[type="search"]{-webkit-appearance:textfield;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;} +input[type="search"]::-webkit-search-decoration{-webkit-appearance:none;} +textarea{overflow:auto;vertical-align:top;} +body{background-color:#ffffff;margin:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;font-weight:normal;line-height:18px;color:#404040;} +.container{width:940px;margin-left:auto;margin-right:auto;zoom:1;}.container:before,.container:after{display:table;content:"";zoom:1;} +.container:after{clear:both;} +.container-fluid{position:relative;min-width:940px;padding-left:20px;padding-right:20px;zoom:1;}.container-fluid:before,.container-fluid:after{display:table;content:"";zoom:1;} +.container-fluid:after{clear:both;} +.container-fluid>.sidebar{position:absolute;top:0;left:20px;width:220px;} +.container-fluid>.content{margin-left:240px;} +a{color:#0069d6;text-decoration:none;line-height:inherit;font-weight:inherit;}a:hover{color:#00438a;text-decoration:underline;} +.pull-right{float:right;} +.pull-left{float:left;} +.hide{display:none;} +.show{display:block;} +.row{zoom:1;margin-left:-20px;}.row:before,.row:after{display:table;content:"";zoom:1;} +.row:after{clear:both;} +.row>[class*="span"]{display:inline;float:left;margin-left:20px;} +.span1{width:40px;} +.span2{width:100px;} +.span3{width:160px;} +.span4{width:220px;} +.span5{width:280px;} +.span6{width:340px;} +.span7{width:400px;} +.span8{width:460px;} +.span9{width:520px;} +.span10{width:580px;} +.span11{width:640px;} +.span12{width:700px;} +.span13{width:760px;} +.span14{width:820px;} +.span15{width:880px;} +.span16{width:940px;} +.span17{width:1000px;} +.span18{width:1060px;} +.span19{width:1120px;} +.span20{width:1180px;} +.span21{width:1240px;} +.span22{width:1300px;} +.span23{width:1360px;} +.span24{width:1420px;} +.row>.offset1{margin-left:80px;} +.row>.offset2{margin-left:140px;} +.row>.offset3{margin-left:200px;} +.row>.offset4{margin-left:260px;} +.row>.offset5{margin-left:320px;} +.row>.offset6{margin-left:380px;} +.row>.offset7{margin-left:440px;} +.row>.offset8{margin-left:500px;} +.row>.offset9{margin-left:560px;} +.row>.offset10{margin-left:620px;} +.row>.offset11{margin-left:680px;} +.row>.offset12{margin-left:740px;} +.span-one-third{width:300px;} +.span-two-thirds{width:620px;} +.offset-one-third{margin-left:340px;} +.offset-two-thirds{margin-left:660px;} +p{font-size:13px;font-weight:normal;line-height:18px;margin-bottom:9px;}p small{font-size:11px;color:#bfbfbf;} +h1,h2,h3,h4,h5,h6{font-weight:bold;color:#404040;}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{color:#bfbfbf;} +h1{margin-bottom:18px;font-size:30px;line-height:36px;}h1 small{font-size:18px;} +h2{font-size:24px;line-height:36px;}h2 small{font-size:14px;} +h3,h4,h5,h6{line-height:36px;} +h3{font-size:18px;}h3 small{font-size:14px;} +h4{font-size:16px;}h4 small{font-size:12px;} +h5{font-size:14px;} +h6{font-size:13px;color:#bfbfbf;text-transform:uppercase;} +ul,ol{margin:0 0 18px 25px;} +ul ul,ul ol,ol ol,ol ul{margin-bottom:0;} +ul{list-style:disc;} +ol{list-style:decimal;} +li{line-height:18px;color:#808080;} +ul.unstyled{list-style:none;margin-left:0;} +dl{margin-bottom:18px;}dl dt,dl dd{line-height:18px;} +dl dt{font-weight:bold;} +dl dd{margin-left:9px;} +hr{margin:20px 0 19px;border:0;border-bottom:1px solid #eee;} +strong{font-style:inherit;font-weight:bold;} +em{font-style:italic;font-weight:inherit;line-height:inherit;} +.muted{color:#bfbfbf;} +blockquote{margin-bottom:18px;border-left:5px solid #eee;padding-left:15px;}blockquote p{font-size:14px;font-weight:300;line-height:18px;margin-bottom:0;} +blockquote small{display:block;font-size:12px;font-weight:300;line-height:18px;color:#bfbfbf;}blockquote small:before{content:'\2014 \00A0';} +address{display:block;line-height:18px;margin-bottom:18px;} +code,pre{padding:0 3px 2px;font-family:Monaco, Andale Mono, Courier New, monospace;font-size:12px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} +code{background-color:#fee9cc;color:rgba(0, 0, 0, 0.75);padding:1px 3px;} +pre{background-color:#f5f5f5;display:block;padding:8.5px;margin:0 0 18px;line-height:18px;font-size:12px;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.15);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;white-space:pre;white-space:pre-wrap;word-wrap:break-word;} +form{margin-bottom:18px;} +fieldset{margin-bottom:18px;padding-top:18px;}fieldset legend{display:block;padding-left:150px;font-size:19.5px;line-height:1;color:#404040;*padding:0 0 5px 145px;*line-height:1.5;} +form .clearfix{margin-bottom:18px;zoom:1;}form .clearfix:before,form .clearfix:after{display:table;content:"";zoom:1;} +form .clearfix:after{clear:both;} +label,input,select,textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;font-weight:normal;line-height:normal;} +label{padding-top:6px;font-size:13px;line-height:18px;float:left;width:130px;text-align:right;color:#404040;} +form .input{margin-left:150px;} +input[type=checkbox],input[type=radio]{cursor:pointer;} +input,textarea,select,.uneditable-input{display:inline-block;width:210px;height:18px;padding:4px;font-size:13px;line-height:18px;color:#808080;border:1px solid #ccc;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} +select{padding:initial;} +input[type=checkbox],input[type=radio]{width:auto;height:auto;padding:0;margin:3px 0;*margin-top:0;line-height:normal;border:none;} +input[type=file]{background-color:#ffffff;padding:initial;border:initial;line-height:initial;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} +input[type=button],input[type=reset],input[type=submit]{width:auto;height:auto;} +select,input[type=file]{height:27px;*height:auto;line-height:27px;*margin-top:4px;} +select[multiple]{height:inherit;background-color:#ffffff;} +textarea{height:auto;} +.uneditable-input{background-color:#ffffff;display:block;border-color:#eee;-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);cursor:not-allowed;} +:-moz-placeholder{color:#bfbfbf;} +::-webkit-input-placeholder{color:#bfbfbf;} +input,textarea{-webkit-transition:border linear 0.2s,box-shadow linear 0.2s;-moz-transition:border linear 0.2s,box-shadow linear 0.2s;-ms-transition:border linear 0.2s,box-shadow linear 0.2s;-o-transition:border linear 0.2s,box-shadow linear 0.2s;transition:border linear 0.2s,box-shadow linear 0.2s;-webkit-box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1);-moz-box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1);box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1);} +input:focus,textarea:focus{outline:0;border-color:rgba(82, 168, 236, 0.8);-webkit-box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1),0 0 8px rgba(82, 168, 236, 0.6);-moz-box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1),0 0 8px rgba(82, 168, 236, 0.6);box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1),0 0 8px rgba(82, 168, 236, 0.6);} +input[type=file]:focus,input[type=checkbox]:focus,select:focus{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;outline:1px dotted #666;} +form .clearfix.error>label,form .clearfix.error .help-block,form .clearfix.error .help-inline{color:#b94a48;} +form .clearfix.error input,form .clearfix.error textarea{color:#b94a48;border-color:#ee5f5b;}form .clearfix.error input:focus,form .clearfix.error textarea:focus{border-color:#e9322d;-webkit-box-shadow:0 0 6px #f8b9b7;-moz-box-shadow:0 0 6px #f8b9b7;box-shadow:0 0 6px #f8b9b7;} +form .clearfix.error .input-prepend .add-on,form .clearfix.error .input-append .add-on{color:#b94a48;background-color:#fce6e6;border-color:#b94a48;} +form .clearfix.warning>label,form .clearfix.warning .help-block,form .clearfix.warning .help-inline{color:#c09853;} +form .clearfix.warning input,form .clearfix.warning textarea{color:#c09853;border-color:#ccae64;}form .clearfix.warning input:focus,form .clearfix.warning textarea:focus{border-color:#be9a3f;-webkit-box-shadow:0 0 6px #e5d6b1;-moz-box-shadow:0 0 6px #e5d6b1;box-shadow:0 0 6px #e5d6b1;} +form .clearfix.warning .input-prepend .add-on,form .clearfix.warning .input-append .add-on{color:#c09853;background-color:#d2b877;border-color:#c09853;} +form .clearfix.success>label,form .clearfix.success .help-block,form .clearfix.success .help-inline{color:#468847;} +form .clearfix.success input,form .clearfix.success textarea{color:#468847;border-color:#57a957;}form .clearfix.success input:focus,form .clearfix.success textarea:focus{border-color:#458845;-webkit-box-shadow:0 0 6px #9acc9a;-moz-box-shadow:0 0 6px #9acc9a;box-shadow:0 0 6px #9acc9a;} +form .clearfix.success .input-prepend .add-on,form .clearfix.success .input-append .add-on{color:#468847;background-color:#bcddbc;border-color:#468847;} +.input-mini,input.mini,textarea.mini,select.mini{width:60px;} +.input-small,input.small,textarea.small,select.small{width:90px;} +.input-medium,input.medium,textarea.medium,select.medium{width:150px;} +.input-large,input.large,textarea.large,select.large{width:210px;} +.input-xlarge,input.xlarge,textarea.xlarge,select.xlarge{width:270px;} +.input-xxlarge,input.xxlarge,textarea.xxlarge,select.xxlarge{width:530px;} +textarea.xxlarge{overflow-y:auto;} +input.span1,textarea.span1{display:inline-block;float:none;width:30px;margin-left:0;} +input.span2,textarea.span2{display:inline-block;float:none;width:90px;margin-left:0;} +input.span3,textarea.span3{display:inline-block;float:none;width:150px;margin-left:0;} +input.span4,textarea.span4{display:inline-block;float:none;width:210px;margin-left:0;} +input.span5,textarea.span5{display:inline-block;float:none;width:270px;margin-left:0;} +input.span6,textarea.span6{display:inline-block;float:none;width:330px;margin-left:0;} +input.span7,textarea.span7{display:inline-block;float:none;width:390px;margin-left:0;} +input.span8,textarea.span8{display:inline-block;float:none;width:450px;margin-left:0;} +input.span9,textarea.span9{display:inline-block;float:none;width:510px;margin-left:0;} +input.span10,textarea.span10{display:inline-block;float:none;width:570px;margin-left:0;} +input.span11,textarea.span11{display:inline-block;float:none;width:630px;margin-left:0;} +input.span12,textarea.span12{display:inline-block;float:none;width:690px;margin-left:0;} +input.span13,textarea.span13{display:inline-block;float:none;width:750px;margin-left:0;} +input.span14,textarea.span14{display:inline-block;float:none;width:810px;margin-left:0;} +input.span15,textarea.span15{display:inline-block;float:none;width:870px;margin-left:0;} +input.span16,textarea.span16{display:inline-block;float:none;width:930px;margin-left:0;} +input[disabled],select[disabled],textarea[disabled],input[readonly],select[readonly],textarea[readonly]{background-color:#f5f5f5;border-color:#ddd;cursor:not-allowed;} +.actions{background:#f5f5f5;margin-top:18px;margin-bottom:18px;padding:17px 20px 18px 150px;border-top:1px solid #ddd;-webkit-border-radius:0 0 3px 3px;-moz-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;}.actions .secondary-action{float:right;}.actions .secondary-action a{line-height:30px;}.actions .secondary-action a:hover{text-decoration:underline;} +.help-inline,.help-block{font-size:13px;line-height:18px;color:#bfbfbf;} +.help-inline{padding-left:5px;*position:relative;*top:-5px;} +.help-block{display:block;max-width:600px;} +.inline-inputs{color:#808080;}.inline-inputs span{padding:0 2px 0 1px;} +.input-prepend input,.input-append input{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0;} +.input-prepend .add-on,.input-append .add-on{position:relative;background:#f5f5f5;border:1px solid #ccc;z-index:2;float:left;display:block;width:auto;min-width:16px;height:18px;padding:4px 4px 4px 5px;margin-right:-1px;font-weight:normal;line-height:18px;color:#bfbfbf;text-align:center;text-shadow:0 1px 0 #ffffff;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;} +.input-prepend .active,.input-append .active{background:#a9dba9;border-color:#46a546;} +.input-prepend .add-on{*margin-top:1px;} +.input-append input{float:left;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;} +.input-append .add-on{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0;margin-right:0;margin-left:-1px;} +.inputs-list{margin:0 0 5px;width:100%;}.inputs-list li{display:block;padding:0;width:100%;} +.inputs-list label{display:block;float:none;width:auto;padding:0;margin-left:20px;line-height:18px;text-align:left;white-space:normal;}.inputs-list label strong{color:#808080;} +.inputs-list label small{font-size:11px;font-weight:normal;} +.inputs-list .inputs-list{margin-left:25px;margin-bottom:10px;padding-top:0;} +.inputs-list:first-child{padding-top:6px;} +.inputs-list li+li{padding-top:2px;} +.inputs-list input[type=radio],.inputs-list input[type=checkbox]{margin-bottom:0;margin-left:-20px;float:left;} +.form-stacked{padding-left:20px;}.form-stacked fieldset{padding-top:9px;} +.form-stacked legend{padding-left:0;} +.form-stacked label{display:block;float:none;width:auto;font-weight:bold;text-align:left;line-height:20px;padding-top:0;} +.form-stacked .clearfix{margin-bottom:9px;}.form-stacked .clearfix div.input{margin-left:0;} +.form-stacked .inputs-list{margin-bottom:0;}.form-stacked .inputs-list li{padding-top:0;}.form-stacked .inputs-list li label{font-weight:normal;padding-top:0;} +.form-stacked div.clearfix.error{padding-top:10px;padding-bottom:10px;padding-left:10px;margin-top:0;margin-left:-10px;} +.form-stacked .actions{margin-left:-20px;padding-left:20px;} +.condensed-table th,.condensed-table td{padding:5px 5px 4px;} +.bordered-table{border:1px solid #ddd;border-collapse:separate;*border-collapse:collapse;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}.bordered-table th+th,.bordered-table td+td,.bordered-table th+td{border-left:1px solid #ddd;} +.bordered-table thead tr:first-child th:first-child,.bordered-table tbody tr:first-child td:first-child{-webkit-border-radius:4px 0 0 0;-moz-border-radius:4px 0 0 0;border-radius:4px 0 0 0;} +.bordered-table thead tr:first-child th:last-child,.bordered-table tbody tr:first-child td:last-child{-webkit-border-radius:0 4px 0 0;-moz-border-radius:0 4px 0 0;border-radius:0 4px 0 0;} +.bordered-table tbody tr:last-child td:first-child{-webkit-border-radius:0 0 0 4px;-moz-border-radius:0 0 0 4px;border-radius:0 0 0 4px;} +.bordered-table tbody tr:last-child td:last-child{-webkit-border-radius:0 0 4px 0;-moz-border-radius:0 0 4px 0;border-radius:0 0 4px 0;} +table .span1{width:20px;} +table .span2{width:60px;} +table .span3{width:100px;} +table .span4{width:140px;} +table .span5{width:180px;} +table .span6{width:220px;} +table .span7{width:260px;} +table .span8{width:300px;} +table .span9{width:340px;} +table .span10{width:380px;} +table .span11{width:420px;} +table .span12{width:460px;} +table .span13{width:500px;} +table .span14{width:540px;} +table .span15{width:580px;} +table .span16{width:620px;} +.zebra-striped tbody tr:nth-child(odd) td,.zebra-striped tbody tr:nth-child(odd) th{background-color:#f9f9f9;} +.zebra-striped tbody tr:hover td,.zebra-striped tbody tr:hover th{background-color:#f5f5f5;} +table .header{cursor:pointer;}table .header:after{content:"";float:right;margin-top:7px;border-width:0 4px 4px;border-style:solid;border-color:#000 transparent;visibility:hidden;} +table .headerSortUp,table .headerSortDown{background-color:rgba(141, 192, 219, 0.25);text-shadow:0 1px 1px rgba(255, 255, 255, 0.75);} +table .header:hover:after{visibility:visible;} +table .headerSortDown:after,table .headerSortDown:hover:after{visibility:visible;filter:alpha(opacity=60);-khtml-opacity:0.6;-moz-opacity:0.6;opacity:0.6;} +table .headerSortUp:after{border-bottom:none;border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #000;visibility:visible;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:alpha(opacity=60);-khtml-opacity:0.6;-moz-opacity:0.6;opacity:0.6;} +table .blue{color:#049cdb;border-bottom-color:#049cdb;} +table .headerSortUp.blue,table .headerSortDown.blue{background-color:#ade6fe;} +table .green{color:#46a546;border-bottom-color:#46a546;} +table .headerSortUp.green,table .headerSortDown.green{background-color:#cdeacd;} +table .red{color:#9d261d;border-bottom-color:#9d261d;} +table .headerSortUp.red,table .headerSortDown.red{background-color:#f4c8c5;} +table .yellow{color:#ffc40d;border-bottom-color:#ffc40d;} +table .headerSortUp.yellow,table .headerSortDown.yellow{background-color:#fff6d9;} +table .orange{color:#f89406;border-bottom-color:#f89406;} +table .headerSortUp.orange,table .headerSortDown.orange{background-color:#fee9cc;} +table .purple{color:#7a43b6;border-bottom-color:#7a43b6;} +table .headerSortUp.purple,table .headerSortDown.purple{background-color:#e2d5f0;} +.topbar{height:40px;position:fixed;top:0;left:0;right:0;z-index:10000;overflow:visible;}.topbar a{color:#bfbfbf;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);} +.topbar h3 a:hover,.topbar .brand:hover,.topbar ul .active>a{background-color:#333;background-color:rgba(255, 255, 255, 0.05);color:#ffffff;text-decoration:none;} +.topbar h3{position:relative;} +.topbar h3 a,.topbar .brand{float:left;display:block;padding:8px 20px 12px;margin-left:-20px;color:#ffffff;font-size:20px;font-weight:200;line-height:1;} +.topbar p{margin:0;line-height:40px;}.topbar p a:hover{background-color:transparent;color:#ffffff;} +.topbar form{float:left;margin:5px 0 0 0;position:relative;filter:alpha(opacity=100);-khtml-opacity:1;-moz-opacity:1;opacity:1;} +.topbar form.pull-right{float:right;} +.topbar input{background-color:#444;background-color:rgba(255, 255, 255, 0.3);font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:normal;font-weight:13px;line-height:1;padding:4px 9px;color:#ffffff;color:rgba(255, 255, 255, 0.75);border:1px solid #111;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1),0 1px 0px rgba(255, 255, 255, 0.25);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1),0 1px 0px rgba(255, 255, 255, 0.25);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1),0 1px 0px rgba(255, 255, 255, 0.25);-webkit-transition:none;-moz-transition:none;-ms-transition:none;-o-transition:none;transition:none;}.topbar input:-moz-placeholder{color:#e6e6e6;} +.topbar input::-webkit-input-placeholder{color:#e6e6e6;} +.topbar input:hover{background-color:#bfbfbf;background-color:rgba(255, 255, 255, 0.5);color:#ffffff;} +.topbar input:focus,.topbar input.focused{outline:0;background-color:#ffffff;color:#404040;text-shadow:0 1px 0 #ffffff;border:0;padding:5px 10px;-webkit-box-shadow:0 0 3px rgba(0, 0, 0, 0.15);-moz-box-shadow:0 0 3px rgba(0, 0, 0, 0.15);box-shadow:0 0 3px rgba(0, 0, 0, 0.15);} +.topbar-inner,.topbar .fill{background-color:#222;background-color:#222222;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#333333), to(#222222));background-image:-moz-linear-gradient(top, #333333, #222222);background-image:-ms-linear-gradient(top, #333333, #222222);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #333333), color-stop(100%, #222222));background-image:-webkit-linear-gradient(top, #333333, #222222);background-image:-o-linear-gradient(top, #333333, #222222);background-image:linear-gradient(top, #333333, #222222);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);-webkit-box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);-moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);} +.topbar div>ul,.nav{display:block;float:left;margin:0 10px 0 0;position:relative;left:0;}.topbar div>ul>li,.nav>li{display:block;float:left;} +.topbar div>ul a,.nav a{display:block;float:none;padding:10px 10px 11px;line-height:19px;text-decoration:none;}.topbar div>ul a:hover,.nav a:hover{color:#ffffff;text-decoration:none;} +.topbar div>ul .active>a,.nav .active>a{background-color:#222;background-color:rgba(0, 0, 0, 0.5);} +.topbar div>ul.secondary-nav,.nav.secondary-nav{float:right;margin-left:10px;margin-right:0;}.topbar div>ul.secondary-nav .menu-dropdown,.nav.secondary-nav .menu-dropdown,.topbar div>ul.secondary-nav .dropdown-menu,.nav.secondary-nav .dropdown-menu{right:0;border:0;} +.topbar div>ul a.menu:hover,.nav a.menu:hover,.topbar div>ul li.open .menu,.nav li.open .menu,.topbar div>ul .dropdown-toggle:hover,.nav .dropdown-toggle:hover,.topbar div>ul .dropdown.open .dropdown-toggle,.nav .dropdown.open .dropdown-toggle{background:#444;background:rgba(255, 255, 255, 0.05);} +.topbar div>ul .menu-dropdown,.nav .menu-dropdown,.topbar div>ul .dropdown-menu,.nav .dropdown-menu{background-color:#333;}.topbar div>ul .menu-dropdown a.menu,.nav .menu-dropdown a.menu,.topbar div>ul .dropdown-menu a.menu,.nav .dropdown-menu a.menu,.topbar div>ul .menu-dropdown .dropdown-toggle,.nav .menu-dropdown .dropdown-toggle,.topbar div>ul .dropdown-menu .dropdown-toggle,.nav .dropdown-menu .dropdown-toggle{color:#ffffff;}.topbar div>ul .menu-dropdown a.menu.open,.nav .menu-dropdown a.menu.open,.topbar div>ul .dropdown-menu a.menu.open,.nav .dropdown-menu a.menu.open,.topbar div>ul .menu-dropdown .dropdown-toggle.open,.nav .menu-dropdown .dropdown-toggle.open,.topbar div>ul .dropdown-menu .dropdown-toggle.open,.nav .dropdown-menu .dropdown-toggle.open{background:#444;background:rgba(255, 255, 255, 0.05);} +.topbar div>ul .menu-dropdown li a,.nav .menu-dropdown li a,.topbar div>ul .dropdown-menu li a,.nav .dropdown-menu li a{color:#999;text-shadow:0 1px 0 rgba(0, 0, 0, 0.5);}.topbar div>ul .menu-dropdown li a:hover,.nav .menu-dropdown li a:hover,.topbar div>ul .dropdown-menu li a:hover,.nav .dropdown-menu li a:hover{background-color:#191919;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#292929), to(#191919));background-image:-moz-linear-gradient(top, #292929, #191919);background-image:-ms-linear-gradient(top, #292929, #191919);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #292929), color-stop(100%, #191919));background-image:-webkit-linear-gradient(top, #292929, #191919);background-image:-o-linear-gradient(top, #292929, #191919);background-image:linear-gradient(top, #292929, #191919);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#292929', endColorstr='#191919', GradientType=0);color:#ffffff;} +.topbar div>ul .menu-dropdown .active a,.nav .menu-dropdown .active a,.topbar div>ul .dropdown-menu .active a,.nav .dropdown-menu .active a{color:#ffffff;} +.topbar div>ul .menu-dropdown .divider,.nav .menu-dropdown .divider,.topbar div>ul .dropdown-menu .divider,.nav .dropdown-menu .divider{background-color:#222;border-color:#444;} +.topbar ul .menu-dropdown li a,.topbar ul .dropdown-menu li a{padding:4px 15px;} +li.menu,.dropdown{position:relative;} +a.menu:after,.dropdown-toggle:after{width:0;height:0;display:inline-block;content:"↓";text-indent:-99999px;vertical-align:top;margin-top:8px;margin-left:4px;border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #ffffff;filter:alpha(opacity=50);-khtml-opacity:0.5;-moz-opacity:0.5;opacity:0.5;} +.menu-dropdown,.dropdown-menu{background-color:#ffffff;float:left;display:none;position:absolute;top:40px;z-index:900;min-width:160px;max-width:220px;_width:160px;margin-left:0;margin-right:0;padding:6px 0;zoom:1;border-color:#999;border-color:rgba(0, 0, 0, 0.2);border-style:solid;border-width:0 1px 1px;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;-webkit-box-shadow:0 2px 4px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 2px 4px rgba(0, 0, 0, 0.2);box-shadow:0 2px 4px rgba(0, 0, 0, 0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;}.menu-dropdown li,.dropdown-menu li{float:none;display:block;background-color:none;} +.menu-dropdown .divider,.dropdown-menu .divider{height:1px;margin:5px 0;overflow:hidden;background-color:#eee;border-bottom:1px solid #ffffff;} +.topbar .dropdown-menu a,.dropdown-menu a{display:block;padding:4px 15px;clear:both;font-weight:normal;line-height:18px;color:#808080;text-shadow:0 1px 0 #ffffff;}.topbar .dropdown-menu a:hover,.dropdown-menu a:hover,.topbar .dropdown-menu a.hover,.dropdown-menu a.hover{background-color:#dddddd;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#eeeeee), to(#dddddd));background-image:-moz-linear-gradient(top, #eeeeee, #dddddd);background-image:-ms-linear-gradient(top, #eeeeee, #dddddd);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #eeeeee), color-stop(100%, #dddddd));background-image:-webkit-linear-gradient(top, #eeeeee, #dddddd);background-image:-o-linear-gradient(top, #eeeeee, #dddddd);background-image:linear-gradient(top, #eeeeee, #dddddd);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#dddddd', GradientType=0);color:#404040;text-decoration:none;-webkit-box-shadow:inset 0 1px 0 rgba(0, 0, 0, 0.025),inset 0 -1px rgba(0, 0, 0, 0.025);-moz-box-shadow:inset 0 1px 0 rgba(0, 0, 0, 0.025),inset 0 -1px rgba(0, 0, 0, 0.025);box-shadow:inset 0 1px 0 rgba(0, 0, 0, 0.025),inset 0 -1px rgba(0, 0, 0, 0.025);} +.open .menu,.dropdown.open .menu,.open .dropdown-toggle,.dropdown.open .dropdown-toggle{color:#ffffff;background:#ccc;background:rgba(0, 0, 0, 0.3);} +.open .menu-dropdown,.dropdown.open .menu-dropdown,.open .dropdown-menu,.dropdown.open .dropdown-menu{display:block;} +.tabs,.pills{margin:0 0 18px;padding:0;list-style:none;zoom:1;}.tabs:before,.pills:before,.tabs:after,.pills:after{display:table;content:"";zoom:1;} +.tabs:after,.pills:after{clear:both;} +.tabs>li,.pills>li{float:left;}.tabs>li>a,.pills>li>a{display:block;} +.tabs{border-color:#ddd;border-style:solid;border-width:0 0 1px;}.tabs>li{position:relative;margin-bottom:-1px;}.tabs>li>a{padding:0 15px;margin-right:2px;line-height:34px;border:1px solid transparent;-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0;}.tabs>li>a:hover{text-decoration:none;background-color:#eee;border-color:#eee #eee #ddd;} +.tabs .active>a,.tabs .active>a:hover{color:#808080;background-color:#ffffff;border:1px solid #ddd;border-bottom-color:transparent;cursor:default;} +.tabs .menu-dropdown,.tabs .dropdown-menu{top:35px;border-width:1px;-webkit-border-radius:0 6px 6px 6px;-moz-border-radius:0 6px 6px 6px;border-radius:0 6px 6px 6px;} +.tabs a.menu:after,.tabs .dropdown-toggle:after{border-top-color:#999;margin-top:15px;margin-left:5px;} +.tabs li.open.menu .menu,.tabs .open.dropdown .dropdown-toggle{border-color:#999;} +.tabs li.open a.menu:after,.tabs .dropdown.open .dropdown-toggle:after{border-top-color:#555;} +.pills a{margin:5px 3px 5px 0;padding:0 15px;line-height:30px;text-shadow:0 1px 1px #ffffff;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px;}.pills a:hover{color:#ffffff;text-decoration:none;text-shadow:0 1px 1px rgba(0, 0, 0, 0.25);background-color:#00438a;} +.pills .active a{color:#ffffff;text-shadow:0 1px 1px rgba(0, 0, 0, 0.25);background-color:#0069d6;} +.pills-vertical>li{float:none;} +.tab-content>.tab-pane,.pill-content>.pill-pane,.tab-content>div,.pill-content>div{display:none;} +.tab-content>.active,.pill-content>.active{display:block;} +.breadcrumb{padding:7px 14px;margin:0 0 18px;background-color:#f5f5f5;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#ffffff), to(#f5f5f5));background-image:-moz-linear-gradient(top, #ffffff, #f5f5f5);background-image:-ms-linear-gradient(top, #ffffff, #f5f5f5);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), color-stop(100%, #f5f5f5));background-image:-webkit-linear-gradient(top, #ffffff, #f5f5f5);background-image:-o-linear-gradient(top, #ffffff, #f5f5f5);background-image:linear-gradient(top, #ffffff, #f5f5f5);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f5f5f5', GradientType=0);border:1px solid #ddd;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 #ffffff;-moz-box-shadow:inset 0 1px 0 #ffffff;box-shadow:inset 0 1px 0 #ffffff;}.breadcrumb li{display:inline;text-shadow:0 1px 0 #ffffff;} +.breadcrumb .divider{padding:0 5px;color:#bfbfbf;} +.breadcrumb .active a{color:#404040;} +.hero-unit{background-color:#f5f5f5;margin-bottom:30px;padding:60px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;}.hero-unit h1{margin-bottom:0;font-size:60px;line-height:1;letter-spacing:-1px;} +.hero-unit p{font-size:18px;font-weight:200;line-height:27px;} +footer{margin-top:17px;padding-top:17px;border-top:1px solid #eee;} +.page-header{margin-bottom:17px;border-bottom:1px solid #ddd;-webkit-box-shadow:0 1px 0 rgba(255, 255, 255, 0.5);-moz-box-shadow:0 1px 0 rgba(255, 255, 255, 0.5);box-shadow:0 1px 0 rgba(255, 255, 255, 0.5);}.page-header h1{margin-bottom:8px;} +.btn.danger,.alert-message.danger,.btn.danger:hover,.alert-message.danger:hover,.btn.error,.alert-message.error,.btn.error:hover,.alert-message.error:hover,.btn.success,.alert-message.success,.btn.success:hover,.alert-message.success:hover,.btn.info,.alert-message.info,.btn.info:hover,.alert-message.info:hover{color:#ffffff;} +.btn .close,.alert-message .close{font-family:Arial,sans-serif;line-height:18px;} +.btn.danger,.alert-message.danger,.btn.error,.alert-message.error{background-color:#c43c35;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#ee5f5b), to(#c43c35));background-image:-moz-linear-gradient(top, #ee5f5b, #c43c35);background-image:-ms-linear-gradient(top, #ee5f5b, #c43c35);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #ee5f5b), color-stop(100%, #c43c35));background-image:-webkit-linear-gradient(top, #ee5f5b, #c43c35);background-image:-o-linear-gradient(top, #ee5f5b, #c43c35);background-image:linear-gradient(top, #ee5f5b, #c43c35);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0);text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);border-color:#c43c35 #c43c35 #882a25;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);} +.btn.success,.alert-message.success{background-color:#57a957;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#62c462), to(#57a957));background-image:-moz-linear-gradient(top, #62c462, #57a957);background-image:-ms-linear-gradient(top, #62c462, #57a957);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #62c462), color-stop(100%, #57a957));background-image:-webkit-linear-gradient(top, #62c462, #57a957);background-image:-o-linear-gradient(top, #62c462, #57a957);background-image:linear-gradient(top, #62c462, #57a957);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0);text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);border-color:#57a957 #57a957 #3d773d;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);} +.btn.info,.alert-message.info{background-color:#339bb9;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#5bc0de), to(#339bb9));background-image:-moz-linear-gradient(top, #5bc0de, #339bb9);background-image:-ms-linear-gradient(top, #5bc0de, #339bb9);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #5bc0de), color-stop(100%, #339bb9));background-image:-webkit-linear-gradient(top, #5bc0de, #339bb9);background-image:-o-linear-gradient(top, #5bc0de, #339bb9);background-image:linear-gradient(top, #5bc0de, #339bb9);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#339bb9', GradientType=0);text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);border-color:#339bb9 #339bb9 #22697d;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);} +.btn{cursor:pointer;display:inline-block;background-color:#e6e6e6;background-repeat:no-repeat;background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), color-stop(25%, #ffffff), to(#e6e6e6));background-image:-webkit-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);background-image:-moz-linear-gradient(top, #ffffff, #ffffff 25%, #e6e6e6);background-image:-ms-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);background-image:-o-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);background-image:linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0);padding:5px 14px 6px;text-shadow:0 1px 1px rgba(255, 255, 255, 0.75);color:#333;font-size:13px;line-height:normal;border:1px solid #ccc;border-bottom-color:#bbb;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);-webkit-transition:0.1s linear all;-moz-transition:0.1s linear all;-ms-transition:0.1s linear all;-o-transition:0.1s linear all;transition:0.1s linear all;}.btn:hover{background-position:0 -15px;color:#333;text-decoration:none;} +.btn:focus{outline:1px dotted #666;} +.btn.primary{color:#ffffff;background-color:#0064cd;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#049cdb), to(#0064cd));background-image:-moz-linear-gradient(top, #049cdb, #0064cd);background-image:-ms-linear-gradient(top, #049cdb, #0064cd);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #049cdb), color-stop(100%, #0064cd));background-image:-webkit-linear-gradient(top, #049cdb, #0064cd);background-image:-o-linear-gradient(top, #049cdb, #0064cd);background-image:linear-gradient(top, #049cdb, #0064cd);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#049cdb', endColorstr='#0064cd', GradientType=0);text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);border-color:#0064cd #0064cd #003f81;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);} +.btn.active,.btn :active{-webkit-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.25),0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.25),0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.25),0 1px 2px rgba(0, 0, 0, 0.05);} +.btn.disabled{cursor:default;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);filter:alpha(opacity=65);-khtml-opacity:0.65;-moz-opacity:0.65;opacity:0.65;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} +.btn[disabled]{cursor:default;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);filter:alpha(opacity=65);-khtml-opacity:0.65;-moz-opacity:0.65;opacity:0.65;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} +.btn.large{font-size:15px;line-height:normal;padding:9px 14px 9px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;} +.btn.small{padding:7px 9px 7px;font-size:11px;} +:root .alert-message,:root .btn{border-radius:0 \0;} +button.btn::-moz-focus-inner,input[type=submit].btn::-moz-focus-inner{padding:0;border:0;} +.close{float:right;color:#000000;font-size:20px;font-weight:bold;line-height:13.5px;text-shadow:0 1px 0 #ffffff;filter:alpha(opacity=25);-khtml-opacity:0.25;-moz-opacity:0.25;opacity:0.25;}.close:hover{color:#000000;text-decoration:none;filter:alpha(opacity=40);-khtml-opacity:0.4;-moz-opacity:0.4;opacity:0.4;} +.alert-message{position:relative;padding:7px 15px;margin-bottom:18px;color:#404040;background-color:#eedc94;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#fceec1), to(#eedc94));background-image:-moz-linear-gradient(top, #fceec1, #eedc94);background-image:-ms-linear-gradient(top, #fceec1, #eedc94);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #fceec1), color-stop(100%, #eedc94));background-image:-webkit-linear-gradient(top, #fceec1, #eedc94);background-image:-o-linear-gradient(top, #fceec1, #eedc94);background-image:linear-gradient(top, #fceec1, #eedc94);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fceec1', endColorstr='#eedc94', GradientType=0);text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);border-color:#eedc94 #eedc94 #e4c652;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);border-width:1px;border-style:solid;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.25);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.25);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.25);}.alert-message .close{margin-top:1px;*margin-top:0;} +.alert-message a{font-weight:bold;color:#404040;} +.alert-message.danger p a,.alert-message.error p a,.alert-message.success p a,.alert-message.info p a{color:#ffffff;} +.alert-message h5{line-height:18px;} +.alert-message p{margin-bottom:0;} +.alert-message div{margin-top:5px;margin-bottom:2px;line-height:28px;} +.alert-message .btn{-webkit-box-shadow:0 1px 0 rgba(255, 255, 255, 0.25);-moz-box-shadow:0 1px 0 rgba(255, 255, 255, 0.25);box-shadow:0 1px 0 rgba(255, 255, 255, 0.25);} +.alert-message.block-message{background-image:none;background-color:#fdf5d9;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);padding:14px;border-color:#fceec1;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;}.alert-message.block-message ul,.alert-message.block-message p{margin-right:30px;} +.alert-message.block-message ul{margin-bottom:0;} +.alert-message.block-message li{color:#404040;} +.alert-message.block-message .alert-actions{margin-top:5px;} +.alert-message.block-message.error,.alert-message.block-message.success,.alert-message.block-message.info{color:#404040;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);} +.alert-message.block-message.error{background-color:#fddfde;border-color:#fbc7c6;} +.alert-message.block-message.success{background-color:#d1eed1;border-color:#bfe7bf;} +.alert-message.block-message.info{background-color:#ddf4fb;border-color:#c6edf9;} +.alert-message.block-message.danger p a,.alert-message.block-message.error p a,.alert-message.block-message.success p a,.alert-message.block-message.info p a{color:#404040;} +.pagination{height:36px;margin:18px 0;}.pagination ul{float:left;margin:0;border:1px solid #ddd;border:1px solid rgba(0, 0, 0, 0.15);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);} +.pagination li{display:inline;} +.pagination a{float:left;padding:0 14px;line-height:34px;border-right:1px solid;border-right-color:#ddd;border-right-color:rgba(0, 0, 0, 0.15);*border-right-color:#ddd;text-decoration:none;} +.pagination a:hover,.pagination .active a{background-color:#c7eefe;} +.pagination .disabled a,.pagination .disabled a:hover{background-color:transparent;color:#bfbfbf;} +.pagination .next a{border:0;} +.well{background-color:#f5f5f5;margin-bottom:20px;padding:19px;min-height:20px;border:1px solid #eee;border:1px solid rgba(0, 0, 0, 0.05);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);}.well blockquote{border-color:#ddd;border-color:rgba(0, 0, 0, 0.15);} +.modal-backdrop{background-color:#000000;position:fixed;top:0;left:0;right:0;bottom:0;z-index:10000;}.modal-backdrop.fade{opacity:0;} +.modal-backdrop,.modal-backdrop.fade.in{filter:alpha(opacity=80);-khtml-opacity:0.8;-moz-opacity:0.8;opacity:0.8;} +.modal{position:fixed;top:50%;left:50%;z-index:11000;width:560px;margin:-250px 0 0 -280px;background-color:#ffffff;border:1px solid #999;border:1px solid rgba(0, 0, 0, 0.3);*border:1px solid #999;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;}.modal .close{margin-top:7px;} +.modal.fade{-webkit-transition:opacity .3s linear, top .3s ease-out;-moz-transition:opacity .3s linear, top .3s ease-out;-ms-transition:opacity .3s linear, top .3s ease-out;-o-transition:opacity .3s linear, top .3s ease-out;transition:opacity .3s linear, top .3s ease-out;top:-25%;} +.modal.fade.in{top:50%;} +.modal-header{border-bottom:1px solid #eee;padding:5px 15px;} +.modal-body{padding:15px;} +.modal-body form{margin-bottom:0;} +.modal-footer{background-color:#f5f5f5;padding:14px 15px 15px;border-top:1px solid #ddd;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;-webkit-box-shadow:inset 0 1px 0 #ffffff;-moz-box-shadow:inset 0 1px 0 #ffffff;box-shadow:inset 0 1px 0 #ffffff;zoom:1;margin-bottom:0;}.modal-footer:before,.modal-footer:after{display:table;content:"";zoom:1;} +.modal-footer:after{clear:both;} +.modal-footer .btn{float:right;margin-left:5px;} +.modal .popover,.modal .twipsy{z-index:12000;} +.twipsy{display:block;position:absolute;visibility:visible;padding:5px;font-size:11px;z-index:1000;filter:alpha(opacity=80);-khtml-opacity:0.8;-moz-opacity:0.8;opacity:0.8;}.twipsy.fade.in{filter:alpha(opacity=80);-khtml-opacity:0.8;-moz-opacity:0.8;opacity:0.8;} +.twipsy.above .twipsy-arrow{bottom:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #000000;} +.twipsy.left .twipsy-arrow{top:50%;right:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid #000000;} +.twipsy.below .twipsy-arrow{top:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #000000;} +.twipsy.right .twipsy-arrow{top:50%;left:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-right:5px solid #000000;} +.twipsy-inner{padding:3px 8px;background-color:#000000;color:white;text-align:center;max-width:200px;text-decoration:none;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.twipsy-arrow{position:absolute;width:0;height:0;} +.popover{position:absolute;top:0;left:0;z-index:1000;padding:5px;display:none;}.popover.above .arrow{bottom:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #000000;} +.popover.right .arrow{top:50%;left:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-right:5px solid #000000;} +.popover.below .arrow{top:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #000000;} +.popover.left .arrow{top:50%;right:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid #000000;} +.popover .arrow{position:absolute;width:0;height:0;} +.popover .inner{background:#000000;background:rgba(0, 0, 0, 0.8);padding:3px;overflow:hidden;width:280px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);} +.popover .title{background-color:#f5f5f5;padding:9px 15px;line-height:1;-webkit-border-radius:3px 3px 0 0;-moz-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0;border-bottom:1px solid #eee;} +.popover .content{background-color:#ffffff;padding:14px;-webkit-border-radius:0 0 3px 3px;-moz-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;}.popover .content p,.popover .content ul,.popover .content ol{margin-bottom:0;} +.fade{-webkit-transition:opacity 0.15s linear;-moz-transition:opacity 0.15s linear;-ms-transition:opacity 0.15s linear;-o-transition:opacity 0.15s linear;transition:opacity 0.15s linear;opacity:0;}.fade.in{opacity:1;} +.label{padding:1px 3px 2px;font-size:9.75px;font-weight:bold;color:#ffffff;text-transform:uppercase;white-space:nowrap;background-color:#bfbfbf;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}.label.important{background-color:#c43c35;} +.label.warning{background-color:#f89406;} +.label.success{background-color:#46a546;} +.label.notice{background-color:#62cffc;} +.media-grid{margin-left:-20px;margin-bottom:0;zoom:1;}.media-grid:before,.media-grid:after{display:table;content:"";zoom:1;} +.media-grid:after{clear:both;} +.media-grid li{display:inline;} +.media-grid a{float:left;padding:4px;margin:0 0 18px 20px;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);}.media-grid a img{display:block;} +.media-grid a:hover{border-color:#0069d6;-webkit-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);-moz-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);} \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/custom.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/custom.css new file mode 100644 index 0000000..b7df8c2 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/custom.css @@ -0,0 +1,97 @@ +body, html, div, p, span, a, h1, h2, h3, h4, h5{ + margin : 0; + padding : 0; +} + +body, html{ + width : 100%; +} + +body{ + color : white; + font-family : tahoma; + font-weight : lighter; + padding-top : 40px; +} + + body p{ + font-size : 14px; + } + + body p a{ + font-size : 16px; + } + +h1 { + color : #E05E00; + font-style : italic; +} + +a{ + color : #E05E00; + text-decoration : none; +} + +a:hover{ + text-decoration : underline; +} + +/* general */ +.clear { + clear: both; +} + +/* Header */ +.brand{ + color : #E05E00 !important; + font-family : georgia; + font-style : italic; +} + +/* list stuff */ +#org{ + background-color : white; + margin : 10px; + padding : 10px; +} + +#show-list{ + cursor : pointer; +} + +/* bootstrap overrides */ +.alert-message{ + margin: 2px 0; +} + +.topbar{ + position : absolute; +} + +/* Custom chart styling */ +.jOrgChart { + margin : 10px; + padding : 20px; +} + +/* Custom node styling */ +.jOrgChart .node { + font-weight : bold; + font-size : 14px; + background-color : #D5D6DB; + border-radius : 8px; + border : 5px solid gray; + color : #793a06; + -moz-border-radius : 8px; +} + .node p{ + font-family : tahoma; + font-size : 10px; + line-height : 11px; + padding : 2px; + } + +table { + margin-left: auto; + margin-right: auto; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/jquery.jOrgChart.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/jquery.jOrgChart.css new file mode 100644 index 0000000..ffabe27 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/jquery.jOrgChart.css @@ -0,0 +1,51 @@ +/* Basic styling */ +/* Draw the lines */ +.jOrgChart .line { + height : 20px; + width : 4px; +} + +.jOrgChart .down { + background-color : black; + margin : 0px auto; +} + +.jOrgChart .top { + border-top : 3px solid black; +} + +.jOrgChart .left { + border-right : 2px solid black; +} + +.jOrgChart .right { + border-left : 2px solid black; +} + +/* node cell */ +.jOrgChart td { + text-align : center; + vertical-align : top; + padding : 0; +} + +/* The node */ +.jOrgChart .node { + background-color : #35363B; + display : inline-block; + width : 120px; + height : 60px; + z-index : 10; + margin : 0 2px; +} + +/* jQuery drag 'n drop */ + +.drag-active { + border-style : dashed !important; +} + +.drop-hover { + border-style : solid !important; + border-color : #E05E00 !important; +} diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/prettify.css b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/prettify.css new file mode 100644 index 0000000..d44b3a2 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/css/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/example.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/example.html new file mode 100644 index 0000000..543b0f9 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/example.html @@ -0,0 +1,85 @@ + + + jOrgChart - A jQuery OrgChart Plugin + + + + + + + + + + + + + + + + + + + +
            + + + + \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/example_vsp.html b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/example_vsp.html new file mode 100644 index 0000000..a2e3703 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/example_vsp.html @@ -0,0 +1,88 @@ + + + jOrgChart - A jQuery OrgChart Plugin + + + + + + + + + + + + + + + + + + + +
            + + + + \ No newline at end of file diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/images/bkgd.png b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/images/bkgd.png new file mode 100644 index 0000000..3bbaf5e Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/images/bkgd.png differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/images/raspberry.jpg b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/images/raspberry.jpg new file mode 100644 index 0000000..e79a051 Binary files /dev/null and b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/images/raspberry.jpg differ diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/jquery.jOrgChart.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/jquery.jOrgChart.js new file mode 100644 index 0000000..89411b2 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/jquery.jOrgChart.js @@ -0,0 +1,267 @@ +/** + * jQuery org-chart/tree plugin. + * + * Author: Wes Nolte + * http://twitter.com/wesnolte + * + * Based on the work of Mark Lee + * http://www.capricasoftware.co.uk + * + * Copyright (c) 2011 Wesley Nolte + * Dual licensed under the MIT and GPL licenses. + * + */ +(function($) { + + $.fn.jOrgChart = function(options) { + var opts = $.extend({}, $.fn.jOrgChart.defaults, options); + var $appendTo = $(opts.chartElement); + + // build the tree + $this = $(this); + var $container = $("
            "); + if($this.is("ul")) { + buildNode($this.find("li:first"), $container, 0, opts); + } + else if($this.is("li")) { + buildNode($this, $container, 0, opts); + } + $appendTo.append($container); + + // add drag and drop if enabled + if(opts.dragAndDrop){ + $('div.node').draggable({ + cursor : 'move', + distance : 40, + helper : 'clone', + opacity : 0.8, + revert : true, + revertDuration : 100, + snap : 'div.node.expanded', + snapMode : 'inner', + stack : 'div.node' + }); + + $('div.node').droppable({ + accept : '.node', + activeClass : 'drag-active', + hoverClass : 'drop-hover' + }); + + // Drag start event handler for nodes + $('div.node').bind("dragstart", function handleDragStart( event, ui ){ + + var sourceNode = $(this); + sourceNode.parentsUntil('.node-container') + .find('*') + .filter('.node') + .droppable('disable'); + }); + + // Drag stop event handler for nodes + $('div.node').bind("dragstop", function handleDragStop( event, ui ){ + + /* reload the plugin */ + $(opts.chartElement).children().remove(); + $this.jOrgChart(opts); + }); + + // Drop event handler for nodes + $('div.node').bind("drop", function handleDropEvent( event, ui ) { + var sourceNode = ui.draggable; + var targetNode = $(this); + + // finding nodes based on plaintext and html + // content is hard! + var targetLi = $('li').filter(function(){ + + li = $(this).clone() + .children("ul,li") + .remove() + .end(); + var attr = li.attr('id'); + if (typeof attr !== 'undefined' && attr !== false) { + return li.attr("id") == targetNode.attr("id"); + } + else { + return li.html() == targetNode.html(); + } + + }); + + var sourceLi = $('li').filter(function(){ + + li = $(this).clone() + .children("ul,li") + .remove() + .end(); + var attr = li.attr('id'); + if (typeof attr !== 'undefined' && attr !== false) { + return li.attr("id") == sourceNode.attr("id"); + } + else { + return li.html() == sourceNode.html(); + } + + }); + + var sourceliClone = sourceLi.clone(); + var sourceUl = sourceLi.parent('ul'); + + if(sourceUl.children('li').size() > 1){ + sourceLi.remove(); + }else{ + sourceUl.remove(); + } + + var id = sourceLi.attr("id"); + + if(targetLi.children('ul').size() >0){ + if (typeof id !== 'undefined' && id !== false) { + targetLi.children('ul').append('
          • '+sourceliClone.html()+'
          • '); + }else{ + targetLi.children('ul').append('
          • '+sourceliClone.html()+'
          • '); + } + }else{ + if (typeof id !== 'undefined' && id !== false) { + targetLi.append('
            • '+sourceliClone.html()+'
            '); + }else{ + targetLi.append('
            • '+sourceliClone.html()+'
            '); + } + } + + }); // handleDropEvent + + } // Drag and drop + }; + + // Option defaults + $.fn.jOrgChart.defaults = { + chartElement : 'body', + depth : -1, + chartClass : "jOrgChart", + dragAndDrop: false + }; + + // Method that recursively builds the tree + function buildNode($node, $appendTo, level, opts) { + var $table = $(""); + var $tbody = $(""); + + // Construct the node container(s) + var $nodeRow = $("").addClass("node-cells"); + var $nodeCell = $(""); + var $downLineCell = $(""); + $childNodes.each(function() { + var $left = $("").addClass("line left top"); + var $right = $("").addClass("line right top"); + $linesRow.append($left).append($right); + }); + + // horizontal line shouldn't extend beyond the first and last child branches + $linesRow.find("td:first") + .removeClass("top") + .end() + .find("td:last") + .removeClass("top"); + + $tbody.append($linesRow); + var $childNodesRow = $(""); + $childNodes.each(function() { + var $td = $("\s*$/g, + + // We have to close these tags to support XHTML (#13200) + wrapMap = { + option: [ 1, "" ], + legend: [ 1, "
            ", "
            " ], + area: [ 1, "", "" ], + param: [ 1, "", "" ], + thead: [ 1, "
            ").addClass("node-cell").attr("colspan", 2); + var $childNodes = $node.children("ul:first").children("li"); + var $nodeDiv; + + if($childNodes.length > 1) { + $nodeCell.attr("colspan", $childNodes.length * 2); + } + // Draw the node + // Get the contents - any markup except li and ul allowed + var $nodeContent = $node.clone() + .children("ul,li") + .remove() + .end() + .html(); + + var new_node_id = $node.attr("id"); + if (typeof new_node_id !== 'undefined' && new_node_id !== false) { + $nodeDiv = $("
            ").addClass("node").attr("id", $node.attr("id")).append($nodeContent); + }else{ + $nodeDiv = $("
            ").addClass("node").append($nodeContent); + } + + // Expand and contract nodes + if ($childNodes.length > 0) { + $nodeDiv.click(function() { + var $this = $(this); + var $tr = $this.closest("tr"); + + if($tr.hasClass('contracted')){ + $this.css('cursor','n-resize'); + $tr.removeClass('contracted').addClass('expanded'); + $tr.nextAll("tr").css('visibility', ''); + }else{ + $this.css('cursor','s-resize'); + $tr.removeClass('expanded').addClass('contracted'); + $tr.nextAll("tr").css('visibility', 'hidden'); + } + }); + } + + $nodeCell.append($nodeDiv); + $nodeRow.append($nodeCell); + $tbody.append($nodeRow); + + if($childNodes.length > 0) { + // if it can be expanded then change the cursor + $nodeDiv.css('cursor','n-resize').addClass('expanded'); + + // recurse until leaves found (-1) or to the level specified + if(opts.depth == -1 || (level+1 < opts.depth)) { + var $downLineRow = $("
            ").attr("colspan", $childNodes.length*2); + $downLineRow.append($downLineCell); + + // draw the connecting line from the parent node to the horizontal line + $downLine = $("
            ").addClass("line down"); + $downLineCell.append($downLine); + $tbody.append($downLineRow); + + // Draw the horizontal lines + var $linesRow = $("
              
            "); + $td.attr("colspan", 2); + // recurse through children lists and items + buildNode($(this), $td, level+1, opts); + $childNodesRow.append($td); + }); + + } + $tbody.append($childNodesRow); + } + + // any classes on the LI element get copied to the relevant node in the tree + // apart from the special 'collapsed' class, which collapses the sub-tree at this point + if ($node.attr('class') != undefined) { + var classList = $node.attr('class').split(/\s+/); + $.each(classList, function(index,item) { + if (item == 'collapsed') { + $nodeRow.nextAll('tr').css('display', 'none'); + $nodeRow.removeClass('expanded'); + $nodeRow.addClass('contracted'); + $nodeDiv.css('cursor','s-resize'); + } else { + $nodeDiv.addClass(item); + } + }); + } + + $table.append($tbody); + $appendTo.append($table); + + /* Prevent trees collapsing if a link inside a node is clicked */ + $nodeDiv.children('a').click(function(e){ + console.log(e); + e.stopPropagation(); + }); + }; + +})(jQuery); diff --git a/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/prettify.js b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/prettify.js new file mode 100644 index 0000000..eef5ad7 --- /dev/null +++ b/ecomp-sdk/sdk-app/src/main/webapp/static/fusion/sample/org_chart/prettify.js @@ -0,0 +1,28 @@ +var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= +[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], +J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), +["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", +/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p type pairs + class2type = {}, + + // List of deleted data cache ids, so we can reuse them + core_deletedIds = [], + + core_version = "1.10.2", + + // Save a reference to some core methods + core_concat = core_deletedIds.concat, + core_push = core_deletedIds.push, + core_slice = core_deletedIds.slice, + core_indexOf = core_deletedIds.indexOf, + core_toString = class2type.toString, + core_hasOwn = class2type.hasOwnProperty, + core_trim = core_version.trim, + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context, rootjQuery ); + }, + + // Used for matching numbers + core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, + + // Used for splitting on whitespace + core_rnotwhite = /\S+/g, + + // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, + + // Match a standalone tag + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, + + // JSON RegExp + rvalidchars = /^[\],:{}\s]*$/, + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, + rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, + rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([\da-z])/gi, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }, + + // The ready event handler + completed = function( event ) { + + // readyState === "complete" is good enough for us to call the dom ready in oldIE + if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { + detach(); + jQuery.ready(); + } + }, + // Clean-up method for dom ready events + detach = function() { + if ( document.addEventListener ) { + document.removeEventListener( "DOMContentLoaded", completed, false ); + window.removeEventListener( "load", completed, false ); + + } else { + document.detachEvent( "onreadystatechange", completed ); + window.detachEvent( "onload", completed ); + } + }; + +jQuery.fn = jQuery.prototype = { + // The current version of jQuery being used + jquery: core_version, + + constructor: jQuery, + init: function( selector, context, rootjQuery ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + + // scripts is true for back-compat + jQuery.merge( this, jQuery.parseHTML( + match[1], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }, + + // Start with an empty selector + selector: "", + + // The default length of a jQuery object is 0 + length: 0, + + toArray: function() { + return core_slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + ret.context = this.context; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + ready: function( fn ) { + // Add the callback + jQuery.ready.promise().done( fn ); + + return this; + }, + + slice: function() { + return this.pushStack( core_slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: core_push, + sort: [].sort, + splice: [].splice +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +jQuery.extend = jQuery.fn.extend = function() { + var src, copyIsArray, copy, name, options, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + // Unique for each copy of jQuery on the page + // Non-digits removed to match rinlinejQuery + expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), + + noConflict: function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger("ready").off("ready"); + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + isWindow: function( obj ) { + /* jshint eqeqeq: false */ + return obj != null && obj == obj.window; + }, + + isNumeric: function( obj ) { + return !isNaN( parseFloat(obj) ) && isFinite( obj ); + }, + + type: function( obj ) { + if ( obj == null ) { + return String( obj ); + } + return typeof obj === "object" || typeof obj === "function" ? + class2type[ core_toString.call(obj) ] || "object" : + typeof obj; + }, + + isPlainObject: function( obj ) { + var key; + + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !core_hasOwn.call(obj, "constructor") && + !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Support: IE<9 + // Handle iteration over inherited properties before own properties. + if ( jQuery.support.ownLast ) { + for ( key in obj ) { + return core_hasOwn.call( obj, key ); + } + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + for ( key in obj ) {} + + return key === undefined || core_hasOwn.call( obj, key ); + }, + + isEmptyObject: function( obj ) { + var name; + for ( name in obj ) { + return false; + } + return true; + }, + + error: function( msg ) { + throw new Error( msg ); + }, + + // data: string of html + // context (optional): If specified, the fragment will be created in this context, defaults to document + // keepScripts (optional): If true, will include scripts passed in the html string + parseHTML: function( data, context, keepScripts ) { + if ( !data || typeof data !== "string" ) { + return null; + } + if ( typeof context === "boolean" ) { + keepScripts = context; + context = false; + } + context = context || document; + + var parsed = rsingleTag.exec( data ), + scripts = !keepScripts && []; + + // Single tag + if ( parsed ) { + return [ context.createElement( parsed[1] ) ]; + } + + parsed = jQuery.buildFragment( [ data ], context, scripts ); + if ( scripts ) { + jQuery( scripts ).remove(); + } + return jQuery.merge( [], parsed.childNodes ); + }, + + parseJSON: function( data ) { + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + return window.JSON.parse( data ); + } + + if ( data === null ) { + return data; + } + + if ( typeof data === "string" ) { + + // Make sure leading/trailing whitespace is removed (IE can't handle it) + data = jQuery.trim( data ); + + if ( data ) { + // Make sure the incoming data is actual JSON + // Logic borrowed from http://json.org/json2.js + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) + .replace( rvalidtokens, "]" ) + .replace( rvalidbraces, "")) ) { + + return ( new Function( "return " + data ) )(); + } + } + } + + jQuery.error( "Invalid JSON: " + data ); + }, + + // Cross-browser xml parsing + parseXML: function( data ) { + var xml, tmp; + if ( !data || typeof data !== "string" ) { + return null; + } + try { + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + } catch( e ) { + xml = undefined; + } + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; + }, + + noop: function() {}, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && jQuery.trim( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + // args is for internal usage only + each: function( obj, callback, args ) { + var value, + i = 0, + length = obj.length, + isArray = isArraylike( obj ); + + if ( args ) { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } + } + + return obj; + }, + + // Use native String.trim function wherever possible + trim: core_trim && !core_trim.call("\uFEFF\xA0") ? + function( text ) { + return text == null ? + "" : + core_trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArraylike( Object(arr) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + core_push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + var len; + + if ( arr ) { + if ( core_indexOf ) { + return core_indexOf.call( arr, elem, i ); + } + + len = arr.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in arr && arr[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var l = second.length, + i = first.length, + j = 0; + + if ( typeof l === "number" ) { + for ( ; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, inv ) { + var retVal, + ret = [], + i = 0, + length = elems.length; + inv = !!inv; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { + ret.push( elems[ i ] ); + } + } + + return ret; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, + i = 0, + length = elems.length, + isArray = isArraylike( elems ), + ret = []; + + // Go through the array, translating each of the items to their + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + } + + // Flatten any nested arrays + return core_concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var args, proxy, tmp; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = core_slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + // Multifunctional method to get and set values of a collection + // The value/s can optionally be executed if it's a function + access: function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + length = elems.length, + bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === "object" ) { + chainable = true; + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !jQuery.isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < length; i++ ) { + fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); + } + } + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + length ? fn( elems[0], key ) : emptyGet; + }, + + now: function() { + return ( new Date() ).getTime(); + }, + + // A method for quickly swapping in/out CSS properties to get correct calculations. + // Note: this method belongs to the css module but it's needed here for the support module. + // If support gets modularized, this method should be moved back to the css module. + swap: function( elem, options, callback, args ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.apply( elem, args || [] ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; + } +}); + +jQuery.ready.promise = function( obj ) { + if ( !readyList ) { + + readyList = jQuery.Deferred(); + + // Catch cases where $(document).ready() is called after the browser event has already occurred. + // we once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + setTimeout( jQuery.ready ); + + // Standards-based browsers support DOMContentLoaded + } else if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed, false ); + + // If IE event model is used + } else { + // Ensure firing before onload, maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", completed ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", completed ); + + // If IE and not a frame + // continually check to see if the document is ready + var top = false; + + try { + top = window.frameElement == null && document.documentElement; + } catch(e) {} + + if ( top && top.doScroll ) { + (function doScrollCheck() { + if ( !jQuery.isReady ) { + + try { + // Use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + top.doScroll("left"); + } catch(e) { + return setTimeout( doScrollCheck, 50 ); + } + + // detach all dom ready events + detach(); + + // and execute any waiting functions + jQuery.ready(); + } + })(); + } + } + } + return readyList.promise( obj ); +}; + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +function isArraylike( obj ) { + var length = obj.length, + type = jQuery.type( obj ); + + if ( jQuery.isWindow( obj ) ) { + return false; + } + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === "array" || type !== "function" && + ( length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj ); +} + +// All jQuery objects should point back to these +rootjQuery = jQuery(document); +/*! + * Sizzle CSS Selector Engine v1.10.2 + * http://sizzlejs.com/ + * + * Copyright 2013 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2013-07-03 + */ +(function( window, undefined ) { + +var i, + support, + cachedruns, + Expr, + getText, + isXML, + compile, + outermostContext, + sortInput, + + // Local document vars + setDocument, + document, + docElem, + documentIsHTML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + + // Instance-specific data + expando = "sizzle" + -(new Date()), + preferredDoc = window.document, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + hasDuplicate = false, + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + return 0; + } + return 0; + }, + + // General-purpose constants + strundefined = typeof undefined, + MAX_NEGATIVE = 1 << 31, + + // Instance methods + hasOwn = ({}).hasOwnProperty, + arr = [], + pop = arr.pop, + push_native = arr.push, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf if we can't use a native one + indexOf = arr.indexOf || function( elem ) { + var i = 0, + len = this.length; + for ( ; i < len; i++ ) { + if ( this[i] === elem ) { + return i; + } + } + return -1; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + // http://www.w3.org/TR/css3-syntax/#characters + characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", + + // Loosely modeled on CSS identifier characters + // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors + // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = characterEncoding.replace( "w", "w#" ), + + // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + + "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", + + // Prefer arguments quoted, + // then not containing pseudos/brackets, + // then attribute selectors/non-parenthetical expressions, + // then anything else + // These preferences are here to reduce the number of selectors + // needing tokenize in the PSEUDO preFilter + pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), + + rsibling = new RegExp( whitespace + "*[+~]" ), + rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + characterEncoding + ")" ), + "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), + "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rnative = /^[^{]+\{\s*\[native \w/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rescape = /'|\\/g, + + // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), + funescape = function( _, escaped, escapedWhitespace ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + // Support: Firefox + // Workaround erroneous numeric interpretation of +"0x" + return high !== high || escapedWhitespace ? + escaped : + // BMP codepoint + high < 0 ? + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }; + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + (arr = slice.call( preferredDoc.childNodes )), + preferredDoc.childNodes + ); + // Support: Android<4.0 + // Detect silently failing push.apply + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + push_native.apply( target, slice.call(els) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length, + i = 0; + // Can't trust NodeList.length + while ( (target[j++] = els[i++]) ) {} + target.length = j - 1; + } + }; +} + +function Sizzle( selector, context, results, seed ) { + var match, elem, m, nodeType, + // QSA vars + i, groups, old, nid, newContext, newSelector; + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + + context = context || document; + results = results || []; + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { + return []; + } + + if ( documentIsHTML && !seed ) { + + // Shortcuts + if ( (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + contains( context, elem ) && elem.id === m ) { + results.push( elem ); + return results; + } + } + + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // QSA path + if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { + nid = old = expando; + newContext = context; + newSelector = nodeType === 9 && selector; + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + groups = tokenize( selector ); + + if ( (old = context.getAttribute("id")) ) { + nid = old.replace( rescape, "\\$&" ); + } else { + context.setAttribute( "id", nid ); + } + nid = "[id='" + nid + "'] "; + + i = groups.length; + while ( i-- ) { + groups[i] = nid + toSelector( groups[i] ); + } + newContext = rsibling.test( selector ) && context.parentNode || context; + newSelector = groups.join(","); + } + + if ( newSelector ) { + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute("id"); + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Create key-value caches of limited size + * @returns {Function(string, Object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key += " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key ] = value); + } + return cache; +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created div and expects a boolean result + */ +function assert( fn ) { + var div = document.createElement("div"); + + try { + return !!fn( div ); + } catch (e) { + return false; + } finally { + // Remove from its parent by default + if ( div.parentNode ) { + div.parentNode.removeChild( div ); + } + // release memory in IE + div = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split("|"), + i = attrs.length; + + while ( i-- ) { + Expr.attrHandle[ arr[i] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + ( ~b.sourceIndex || MAX_NEGATIVE ) - + ( ~a.sourceIndex || MAX_NEGATIVE ); + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for positionals + * @param {Function} fn + */ +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Detect xml + * @param {Element|Object} elem An element or a document + */ +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +// Expose support vars for convenience +support = Sizzle.support = {}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var doc = node ? node.ownerDocument || node : preferredDoc, + parent = doc.defaultView; + + // If no document and documentElement is available, return + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Set our document + document = doc; + docElem = doc.documentElement; + + // Support tests + documentIsHTML = !isXML( doc ); + + // Support: IE>8 + // If iframe document is assigned to "document" variable and if iframe has been reloaded, + // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 + // IE6-8 do not support the defaultView property so parent will be undefined + if ( parent && parent.attachEvent && parent !== parent.top ) { + parent.attachEvent( "onbeforeunload", function() { + setDocument(); + }); + } + + /* Attributes + ---------------------------------------------------------------------- */ + + // Support: IE<8 + // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) + support.attributes = assert(function( div ) { + div.className = "i"; + return !div.getAttribute("className"); + }); + + /* getElement(s)By* + ---------------------------------------------------------------------- */ + + // Check if getElementsByTagName("*") returns only elements + support.getElementsByTagName = assert(function( div ) { + div.appendChild( doc.createComment("") ); + return !div.getElementsByTagName("*").length; + }); + + // Check if getElementsByClassName can be trusted + support.getElementsByClassName = assert(function( div ) { + div.innerHTML = "
            "; + + // Support: Safari<4 + // Catch class over-caching + div.firstChild.className = "i"; + // Support: Opera<10 + // Catch gEBCN failure to find non-leading classes + return div.getElementsByClassName("i").length === 2; + }); + + // Support: IE<10 + // Check if getElementById returns elements by name + // The broken getElementById methods don't pick up programatically-set names, + // so use a roundabout getElementsByName test + support.getById = assert(function( div ) { + docElem.appendChild( div ).id = expando; + return !doc.getElementsByName || !doc.getElementsByName( expando ).length; + }); + + // ID find and filter + if ( support.getById ) { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== strundefined && documentIsHTML ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute("id") === attrId; + }; + }; + } else { + // Support: IE6/7 + // getElementById is not reliable as a find shortcut + delete Expr.find["ID"]; + + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); + return node && node.value === attrId; + }; + }; + } + + // Tag + Expr.find["TAG"] = support.getElementsByTagName ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== strundefined ) { + return context.getElementsByTagName( tag ); + } + } : + function( tag, context ) { + var elem, + tmp = [], + i = 0, + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + while ( (elem = results[i++]) ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Class + Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { + if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { + return context.getElementsByClassName( className ); + } + }; + + /* QSA/matchesSelector + ---------------------------------------------------------------------- */ + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21) + // We allow this because of a bug in IE8/9 that throws an error + // whenever `document.activeElement` is accessed on an iframe + // So, we allow :focus to pass through QSA all the time to avoid the IE error + // See http://bugs.jquery.com/ticket/13378 + rbuggyQSA = []; + + if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explicitly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + div.innerHTML = ""; + + // Support: IE8 + // Boolean attributes and "value" are not treated correctly + if ( !div.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + }); + + assert(function( div ) { + + // Support: Opera 10-12/IE8 + // ^= $= *= and empty values + // Should not select anything + // Support: Windows 8 Native Apps + // The type attribute is restricted during .innerHTML assignment + var input = doc.createElement("input"); + input.setAttribute( "type", "hidden" ); + div.appendChild( input ).setAttribute( "t", "" ); + + if ( div.querySelectorAll("[t^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":enabled").length ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + div.querySelectorAll("*,:x"); + rbuggyQSA.push(",.*:"); + }); + } + + if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || + docElem.mozMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector) )) ) { + + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( div, "div" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( div, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + }); + } + + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); + rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); + + /* Contains + ---------------------------------------------------------------------- */ + + // Element contains another + // Purposefully does not implement inclusive descendent + // As in, an element does not contain itself + contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + /* Sorting + ---------------------------------------------------------------------- */ + + // Document order sorting + sortOrder = docElem.compareDocumentPosition ? + function( a, b ) { + + // Flag for duplicate removal + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b ); + + if ( compare ) { + // Disconnected nodes + if ( compare & 1 || + (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { + + // Choose the first element that is related to our preferred document + if ( a === doc || contains(preferredDoc, a) ) { + return -1; + } + if ( b === doc || contains(preferredDoc, b) ) { + return 1; + } + + // Maintain original order + return sortInput ? + ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + 0; + } + + return compare & 4 ? -1 : 1; + } + + // Not directly comparable, sort on existence of method + return a.compareDocumentPosition ? -1 : 1; + } : + function( a, b ) { + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + + // Parentless nodes are either documents or disconnected + } else if ( !aup || !bup ) { + return a === doc ? -1 : + b === doc ? 1 : + aup ? -1 : + bup ? 1 : + sortInput ? + ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + return doc; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + if ( support.matchesSelector && documentIsHTML && + ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { + + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch(e) {} + } + + return Sizzle( expr, document, null, [elem] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + var fn = Expr.attrHandle[ name.toLowerCase() ], + // Don't get fooled by Object.prototype properties (jQuery #13807) + val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? + fn( elem, name, !documentIsHTML ) : + undefined; + + return val === undefined ? + support.attributes || !documentIsHTML ? + elem.getAttribute( name ) : + (val = elem.getAttributeNode(name)) && val.specified ? + val.value : + null : + val; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Document sorting and removing duplicates + * @param {ArrayLike} results + */ +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + j = 0, + i = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + sortInput = !support.sortStable && results.slice( 0 ); + results.sort( sortOrder ); + + if ( hasDuplicate ) { + while ( (elem = results[i++]) ) { + if ( elem === results[ i ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + return results; +}; + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + for ( ; (node = elem[i]); i++ ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (see #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + attrHandle: {}, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1].slice( 0, 3 ) === "nth" ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[5] && match[2]; + + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[3] && match[4] !== undefined ) { + match[2] = match[4]; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeNameSelector ) { + var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + return nodeNameSelector === "*" ? + function() { return true; } : + function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.slice( -check.length ) === check : + operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache, outerCache, node, diff, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + // Seek `elem` from a previously-cached index + outerCache = parent[ expando ] || (parent[ expando ] = {}); + cache = outerCache[ type ] || []; + nodeIndex = cache[0] === dirruns && cache[1]; + diff = cache[0] === dirruns && cache[2]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + (diff = nodeIndex = 0) || start.pop()) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + outerCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + // Use previously-cached element index if available + } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { + diff = cache[1]; + + // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) + } else { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || + (diff = nodeIndex = 0) || start.pop()) ) { + + if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { + // Cache the index of each encountered element + if ( useCache ) { + (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf.call( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + // lang value must be a valid identifier + if ( !ridentifier.test(lang || "") ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsHTML ? + elem.lang : + elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), + // not comment, processing instructions, or others + // Thanks to Diego Perini for the nodeName shortcut + // Greater than "@" means alpha characters (specifically not starting with "#" or "?") + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) + // use getAttribute instead to test this case + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); + }, + + // Position-in-collection + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +// Easy API for creating new setFilters +function setFilters() {} +setFilters.prototype = Expr.filters = Expr.pseudos; +Expr.setFilters = new setFilters(); + +function tokenize( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( tokens = [] ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push({ + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, " " ) + }); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + matched = match.shift(); + tokens.push({ + value: matched, + type: type, + matches: match + }); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +} + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + checkNonElements = base && dir === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var data, cache, outerCache, + dirkey = dirruns + " " + doneName; + + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { + if ( (data = cache[1]) === true || data === cachedruns ) { + return data === true; + } + } else { + cache = outerCache[ dir ] = [ dirkey ]; + cache[1] = matcher( elem, context, xml ) || cachedruns; + if ( cache[1] === true ) { + return true; + } + } + } + } + } + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf.call( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) + ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + // A counter to specify which element is currently being matched + var matcherCachedRuns = 0, + bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, expandContext ) { + var elem, j, matcher, + setMatched = [], + matchedCount = 0, + i = "0", + unmatched = seed && [], + outermost = expandContext != null, + contextBackup = outermostContext, + // We must always have either seed elements or context + elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); + + if ( outermost ) { + outermostContext = context !== document && context; + cachedruns = matcherCachedRuns; + } + + // Add elements passing elementMatchers directly to results + // Keep `i` a string if there are no elements so `matchedCount` will be "00" below + for ( ; (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + while ( (matcher = elementMatchers[j++]) ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + cachedruns = ++matcherCachedRuns; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // Apply set filters to unmatched elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + j = 0; + while ( (matcher = setMatchers[j++]) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !group ) { + group = tokenize( selector ); + } + i = group.length; + while ( i-- ) { + cached = matcherFromTokens( group[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + } + return cached; +}; + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function select( selector, context, results, seed ) { + var i, tokens, token, type, find, + match = tokenize( selector ); + + if ( !seed ) { + // Try to minimize operations if there is only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + support.getById && context.nodeType === 9 && documentIsHTML && + Expr.relative[ tokens[1].type ] ) { + + context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; + if ( !context ) { + return results; + } + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && context.parentNode || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; + } + + break; + } + } + } + } + } + + // Compile and execute a filtering function + // Provide `match` to avoid retokenization if we modified the selector above + compile( selector, match )( + seed, + context, + !documentIsHTML, + results, + rsibling.test( selector ) + ); + return results; +} + +// One-time assignments + +// Sort stability +support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; + +// Support: Chrome<14 +// Always assume duplicates if they aren't passed to the comparison function +support.detectDuplicates = hasDuplicate; + +// Initialize against the default document +setDocument(); + +// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) +// Detached nodes confoundingly follow *each other* +support.sortDetached = assert(function( div1 ) { + // Should return 1, but returns 4 (following) + return div1.compareDocumentPosition( document.createElement("div") ) & 1; +}); + +// Support: IE<8 +// Prevent attribute/property "interpolation" +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !assert(function( div ) { + div.innerHTML = ""; + return div.firstChild.getAttribute("href") === "#" ; +}) ) { + addHandle( "type|href|height|width", function( elem, name, isXML ) { + if ( !isXML ) { + return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); + } + }); +} + +// Support: IE<9 +// Use defaultValue in place of getAttribute("value") +if ( !support.attributes || !assert(function( div ) { + div.innerHTML = ""; + div.firstChild.setAttribute( "value", "" ); + return div.firstChild.getAttribute( "value" ) === ""; +}) ) { + addHandle( "value", function( elem, name, isXML ) { + if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { + return elem.defaultValue; + } + }); +} + +// Support: IE<9 +// Use getAttributeNode to fetch booleans when getAttribute lies +if ( !assert(function( div ) { + return div.getAttribute("disabled") == null; +}) ) { + addHandle( booleans, function( elem, name, isXML ) { + var val; + if ( !isXML ) { + return (val = elem.getAttributeNode( name )) && val.specified ? + val.value : + elem[ name ] === true ? name.toLowerCase() : null; + } + }); +} + +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.pseudos; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + +})( window ); +// String to Object options format cache +var optionsCache = {}; + +// Convert String-formatted options into Object-formatted ones and store in cache +function createOptions( options ) { + var object = optionsCache[ options ] = {}; + jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { + object[ flag ] = true; + }); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + ( optionsCache[ options ] || createOptions( options ) ) : + jQuery.extend( {}, options ); + + var // Flag to know if list is currently firing + firing, + // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list was already fired + fired, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // First callback to fire (used internally by add and fireWith) + firingStart, + // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = !options.once && [], + // Fire callbacks + fire = function( data ) { + memory = options.memory && data; + fired = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + firing = true; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { + memory = false; // To prevent further calls using add + break; + } + } + firing = false; + if ( list ) { + if ( stack ) { + if ( stack.length ) { + fire( stack.shift() ); + } + } else if ( memory ) { + list = []; + } else { + self.disable(); + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + // First, we save the current length + var start = list.length; + (function add( args ) { + jQuery.each( args, function( _, arg ) { + var type = jQuery.type( arg ); + if ( type === "function" ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && type !== "string" ) { + // Inspect recursively + add( arg ); + } + }); + })( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away + } else if ( memory ) { + firingStart = start; + fire( memory ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + jQuery.each( arguments, function( _, arg ) { + var index; + while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + // Handle firing indexes + if ( firing ) { + if ( index <= firingLength ) { + firingLength--; + } + if ( index <= firingIndex ) { + firingIndex--; + } + } + } + }); + } + return this; + }, + // Check if a given callback is in the list. + // If no argument is given, return whether or not list has callbacks attached. + has: function( fn ) { + return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); + }, + // Remove all callbacks from the list + empty: function() { + list = []; + firingLength = 0; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( list && ( !fired || stack ) ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + if ( firing ) { + stack.push( args ); + } else { + fire( args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; +jQuery.extend({ + + Deferred: function( func ) { + var tuples = [ + // action, add listener, listener list, final state + [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], + [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], + [ "notify", "progress", jQuery.Callbacks("memory") ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + return jQuery.Deferred(function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + var action = tuple[ 0 ], + fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; + // deferred[ done | fail | progress ] for forwarding actions to newDefer + deferred[ tuple[1] ](function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); + } + }); + }); + fns = null; + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Keep pipe for back-compat + promise.pipe = promise.then; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 3 ]; + + // promise[ done | fail | progress ] = list.add + promise[ tuple[1] ] = list.add; + + // Handle state + if ( stateString ) { + list.add(function() { + // state = [ resolved | rejected ] + state = stateString; + + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + } + + // deferred[ resolve | reject | notify ] + deferred[ tuple[0] ] = function() { + deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); + return this; + }; + deferred[ tuple[0] + "With" ] = list.fireWith; + }); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0, + resolveValues = core_slice.call( arguments ), + length = resolveValues.length, + + // the count of uncompleted subordinates + remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, + + // the master Deferred. If resolveValues consist of only a single Deferred, just use that. + deferred = remaining === 1 ? subordinate : jQuery.Deferred(), + + // Update function for both resolve and progress values + updateFunc = function( i, contexts, values ) { + return function( value ) { + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; + if( values === progressValues ) { + deferred.notifyWith( contexts, values ); + } else if ( !( --remaining ) ) { + deferred.resolveWith( contexts, values ); + } + }; + }, + + progressValues, progressContexts, resolveContexts; + + // add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { + resolveValues[ i ].promise() + .done( updateFunc( i, resolveContexts, resolveValues ) ) + .fail( deferred.reject ) + .progress( updateFunc( i, progressContexts, progressValues ) ); + } else { + --remaining; + } + } + } + + // if we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); + } + + return deferred.promise(); + } +}); +jQuery.support = (function( support ) { + + var all, a, input, select, fragment, opt, eventName, isSupported, i, + div = document.createElement("div"); + + // Setup + div.setAttribute( "className", "t" ); + div.innerHTML = "
            a"; + + // Finish early in limited (non-browser) environments + all = div.getElementsByTagName("*") || []; + a = div.getElementsByTagName("a")[ 0 ]; + if ( !a || !a.style || !all.length ) { + return support; + } + + // First batch of tests + select = document.createElement("select"); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName("input")[ 0 ]; + + a.style.cssText = "top:1px;float:left;opacity:.5"; + + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + support.getSetAttribute = div.className !== "t"; + + // IE strips leading whitespace when .innerHTML is used + support.leadingWhitespace = div.firstChild.nodeType === 3; + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + support.tbody = !div.getElementsByTagName("tbody").length; + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + support.htmlSerialize = !!div.getElementsByTagName("link").length; + + // Get the style information from getAttribute + // (IE uses .cssText instead) + support.style = /top/.test( a.getAttribute("style") ); + + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + support.hrefNormalized = a.getAttribute("href") === "/a"; + + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + support.opacity = /^0.5/.test( a.style.opacity ); + + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + support.cssFloat = !!a.style.cssFloat; + + // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) + support.checkOn = !!input.value; + + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + support.optSelected = opt.selected; + + // Tests for enctype support on a form (#6743) + support.enctype = !!document.createElement("form").enctype; + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>"; + + // Will be defined later + support.inlineBlockNeedsLayout = false; + support.shrinkWrapBlocks = false; + support.pixelPosition = false; + support.deleteExpando = true; + support.noCloneEvent = true; + support.reliableMarginRight = true; + support.boxSizingReliable = true; + + // Make sure checked status is properly cloned + input.checked = true; + support.noCloneChecked = input.cloneNode( true ).checked; + + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as disabled) + select.disabled = true; + support.optDisabled = !opt.disabled; + + // Support: IE<9 + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + + // Check if we can trust getAttribute("value") + input = document.createElement("input"); + input.setAttribute( "value", "" ); + support.input = input.getAttribute( "value" ) === ""; + + // Check if an input maintains its value after becoming a radio + input.value = "t"; + input.setAttribute( "type", "radio" ); + support.radioValue = input.value === "t"; + + // #11217 - WebKit loses check when the name is after the checked attribute + input.setAttribute( "checked", "t" ); + input.setAttribute( "name", "t" ); + + fragment = document.createDocumentFragment(); + fragment.appendChild( input ); + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; + + // WebKit doesn't clone checked state correctly in fragments + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE<9 + // Opera does not clone events (and typeof div.attachEvent === undefined). + // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() + if ( div.attachEvent ) { + div.attachEvent( "onclick", function() { + support.noCloneEvent = false; + }); + + div.cloneNode( true ).click(); + } + + // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event) + // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) + for ( i in { submit: true, change: true, focusin: true }) { + div.setAttribute( eventName = "on" + i, "t" ); + + support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false; + } + + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; + + // Support: IE<9 + // Iteration over object's inherited properties before its own. + for ( i in jQuery( support ) ) { + break; + } + support.ownLast = i !== "0"; + + // Run tests that need a body at doc ready + jQuery(function() { + var container, marginDiv, tds, + divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", + body = document.getElementsByTagName("body")[0]; + + if ( !body ) { + // Return for frameset docs that don't have a body + return; + } + + container = document.createElement("div"); + container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; + + body.appendChild( container ).appendChild( div ); + + // Support: IE8 + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + div.innerHTML = "
            t
            "; + tds = div.getElementsByTagName("td"); + tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; + isSupported = ( tds[ 0 ].offsetHeight === 0 ); + + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; + + // Support: IE8 + // Check if empty table cells still have offsetWidth/Height + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); + + // Check box-sizing and margin behavior. + div.innerHTML = ""; + div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; + + // Workaround failing boxSizing test due to offsetWidth returning wrong value + // with some non-1 values of body zoom, ticket #13543 + jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() { + support.boxSizing = div.offsetWidth === 4; + }); + + // Use window.getComputedStyle because jsdom on node.js will break without it. + if ( window.getComputedStyle ) { + support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; + support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; + + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. (#3333) + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + marginDiv = div.appendChild( document.createElement("div") ); + marginDiv.style.cssText = div.style.cssText = divReset; + marginDiv.style.marginRight = marginDiv.style.width = "0"; + div.style.width = "1px"; + + support.reliableMarginRight = + !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); + } + + if ( typeof div.style.zoom !== core_strundefined ) { + // Support: IE<8 + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + div.innerHTML = ""; + div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; + support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); + + // Support: IE6 + // Check if elements with layout shrink-wrap their children + div.style.display = "block"; + div.innerHTML = "
            "; + div.firstChild.style.width = "5px"; + support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); + + if ( support.inlineBlockNeedsLayout ) { + // Prevent IE 6 from affecting layout for positioned elements #11048 + // Prevent IE from shrinking the body in IE 7 mode #12869 + // Support: IE<8 + body.style.zoom = 1; + } + } + + body.removeChild( container ); + + // Null elements to avoid leaks in IE + container = div = tds = marginDiv = null; + }); + + // Null elements to avoid leaks in IE + all = select = fragment = opt = a = input = null; + + return support; +})({}); + +var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, + rmultiDash = /([A-Z])/g; + +function internalData( elem, name, data, pvt /* Internal Use Only */ ){ + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var ret, thisCache, + internalKey = jQuery.expando, + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++; + } else { + id = internalKey; + } + } + + if ( !cache[ id ] ) { + // Avoid exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } + + thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } + + thisCache = thisCache.data; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( typeof name === "string" ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; +} + +function internalRemoveData( elem, name, pvt ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, i, + isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + id = isNode ? elem[ jQuery.expando ] : jQuery.expando; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + + thisCache = pvt ? cache[ id ] : cache[ id ].data; + + if ( thisCache ) { + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split(" "); + } + } + } else { + // If "name" is an array of keys... + // When data is initially created, via ("key", "val") signature, + // keys will be converted to camelCase. + // Since there is no way to tell _how_ a key was added, remove + // both plain key and camelCase key. #12786 + // This will only penalize the array argument path. + name = name.concat( jQuery.map( name, jQuery.camelCase ) ); + } + + i = name.length; + while ( i-- ) { + delete thisCache[ name[i] ]; + } + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject( cache[ id ] ) ) { + return; + } + } + + // Destroy the cache + if ( isNode ) { + jQuery.cleanData( [ elem ], true ); + + // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) + /* jshint eqeqeq: false */ + } else if ( jQuery.support.deleteExpando || cache != cache.window ) { + /* jshint eqeqeq: true */ + delete cache[ id ]; + + // When all else fails, null + } else { + cache[ id ] = null; + } +} + +jQuery.extend({ + cache: {}, + + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "applet": true, + "embed": true, + // Ban all objects except for Flash (which handle expandos) + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data ) { + return internalData( elem, name, data ); + }, + + removeData: function( elem, name ) { + return internalRemoveData( elem, name ); + }, + + // For internal use only. + _data: function( elem, name, data ) { + return internalData( elem, name, data, true ); + }, + + _removeData: function( elem, name ) { + return internalRemoveData( elem, name, true ); + }, + + // A method for determining if a DOM node can handle the data expando + acceptData: function( elem ) { + // Do not set data on non-element because it will not be cleared (#8335). + if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) { + return false; + } + + var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; + + // nodes accept data unless otherwise specified; rejection can be conditional + return !noData || noData !== true && elem.getAttribute("classid") === noData; + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var attrs, name, + data = null, + i = 0, + elem = this[0]; + + // Special expections of .data basically thwart jQuery.access, + // so implement the relevant behavior ourselves + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = jQuery.data( elem ); + + if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { + attrs = elem.attributes; + for ( ; i < attrs.length; i++ ) { + name = attrs[i].name; + + if ( name.indexOf("data-") === 0 ) { + name = jQuery.camelCase( name.slice(5) ); + + dataAttr( elem, name, data[ name ] ); + } + } + jQuery._data( elem, "parsedAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + return arguments.length > 1 ? + + // Sets one value + this.each(function() { + jQuery.data( this, key, value ); + }) : + + // Gets one value + // Try to fetch any internally stored data first + elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null; + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + +// checks a cache object for emptiness +function isEmptyDataObject( obj ) { + var name; + for ( name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } + + return true; +} +jQuery.extend({ + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || jQuery.isArray(data) ) { + queue = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // not intended for public consumption - generates a queueHooks object, or returns the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return jQuery._data( elem, key ) || jQuery._data( elem, key, { + empty: jQuery.Callbacks("once memory").add(function() { + jQuery._removeData( elem, type + "queue" ); + jQuery._removeData( elem, key ); + }) + }); + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } + + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); + + // ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = setTimeout( next, time ); + hooks.stop = function() { + clearTimeout( timeout ); + }; + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while( i-- ) { + tmp = jQuery._data( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +}); +var nodeHook, boolHook, + rclass = /[\t\r\n\f]/g, + rreturn = /\r/g, + rfocusable = /^(?:input|select|textarea|button|object)$/i, + rclickable = /^(?:a|area)$/i, + ruseDefault = /^(?:checked|selected)$/i, + getSetAttribute = jQuery.support.getSetAttribute, + getSetInput = jQuery.support.input; + +jQuery.fn.extend({ + attr: function( name, value ) { + return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each(function() { + jQuery.removeAttr( this, name ); + }); + }, + + prop: function( name, value ) { + return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} + }); + }, + + addClass: function( value ) { + var classes, elem, cur, clazz, j, + i = 0, + len = this.length, + proceed = typeof value === "string" && value; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call( this, j, this.className ) ); + }); + } + + if ( proceed ) { + // The disjunction here is for better compressibility (see removeClass) + classes = ( value || "" ).match( core_rnotwhite ) || []; + + for ( ; i < len; i++ ) { + elem = this[ i ]; + cur = elem.nodeType === 1 && ( elem.className ? + ( " " + elem.className + " " ).replace( rclass, " " ) : + " " + ); + + if ( cur ) { + j = 0; + while ( (clazz = classes[j++]) ) { + if ( cur.indexOf( " " + clazz + " " ) < 0 ) { + cur += clazz + " "; + } + } + elem.className = jQuery.trim( cur ); + + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classes, elem, cur, clazz, j, + i = 0, + len = this.length, + proceed = arguments.length === 0 || typeof value === "string" && value; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call( this, j, this.className ) ); + }); + } + if ( proceed ) { + classes = ( value || "" ).match( core_rnotwhite ) || []; + + for ( ; i < len; i++ ) { + elem = this[ i ]; + // This expression is here for better compressibility (see addClass) + cur = elem.nodeType === 1 && ( elem.className ? + ( " " + elem.className + " " ).replace( rclass, " " ) : + "" + ); + + if ( cur ) { + j = 0; + while ( (clazz = classes[j++]) ) { + // Remove *all* instances + while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { + cur = cur.replace( " " + clazz + " ", " " ); + } + } + elem.className = value ? jQuery.trim( cur ) : ""; + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value; + + if ( typeof stateVal === "boolean" && type === "string" ) { + return stateVal ? this.addClass( value ) : this.removeClass( value ); + } + + if ( jQuery.isFunction( value ) ) { + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + }); + } + + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, + i = 0, + self = jQuery( this ), + classNames = value.match( core_rnotwhite ) || []; + + while ( (className = classNames[ i++ ]) ) { + // check each className given, space separated list + if ( self.hasClass( className ) ) { + self.removeClass( className ); + } else { + self.addClass( className ); + } + } + + // Toggle whole class name + } else if ( type === core_strundefined || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery._data( this, "__className__", this.className ); + } + + // If the element has a class name or if we're passed "false", + // then remove the whole classname (if there was one, the above saved it). + // Otherwise bring back whatever was previously saved (if anything), + // falling back to the empty string if nothing was stored. + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; + } + }); + }, + + hasClass: function( selector ) { + var className = " " + selector + " ", + i = 0, + l = this.length; + for ( ; i < l; i++ ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { + return true; + } + } + + return false; + }, + + val: function( value ) { + var ret, hooks, isFunction, + elem = this[0]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; + } + + ret = elem.value; + + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each(function( i ) { + var val; + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, jQuery( this ).val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { + val += ""; + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map(val, function ( value ) { + return value == null ? "" : value + ""; + }); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + }); + } +}); + +jQuery.extend({ + valHooks: { + option: { + get: function( elem ) { + // Use proper attribute retrieval(#6932, #12072) + var val = jQuery.find.attr( elem, "value" ); + return val != null ? + val : + elem.text; + } + }, + select: { + get: function( elem ) { + var value, option, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one" || index < 0, + values = one ? null : [], + max = one ? index + 1 : options.length, + i = index < 0 ? + max : + one ? index : 0; + + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; + + // oldIE doesn't update selected after form reset (#2551) + if ( ( option.selected || i === index ) && + // Don't return options that are disabled or in a disabled optgroup + ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && + ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + }, + + set: function( elem, value ) { + var optionSet, option, + options = elem.options, + values = jQuery.makeArray( value ), + i = options.length; + + while ( i-- ) { + option = options[ i ]; + if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) { + optionSet = true; + } + } + + // force browsers to behave consistently when non-matching value is set + if ( !optionSet ) { + elem.selectedIndex = -1; + } + return values; + } + } + }, + + attr: function( elem, name, value ) { + var hooks, ret, + nType = elem.nodeType; + + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === core_strundefined ) { + return jQuery.prop( elem, name, value ); + } + + // All attributes are lowercase + // Grab necessary hook if one is defined + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + name = name.toLowerCase(); + hooks = jQuery.attrHooks[ name ] || + ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); + } + + if ( value !== undefined ) { + + if ( value === null ) { + jQuery.removeAttr( elem, name ); + + } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + elem.setAttribute( name, value + "" ); + return value; + } + + } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + ret = jQuery.find.attr( elem, name ); + + // Non-existent attributes return null, we normalize to undefined + return ret == null ? + undefined : + ret; + } + }, + + removeAttr: function( elem, value ) { + var name, propName, + i = 0, + attrNames = value && value.match( core_rnotwhite ); + + if ( attrNames && elem.nodeType === 1 ) { + while ( (name = attrNames[i++]) ) { + propName = jQuery.propFix[ name ] || name; + + // Boolean attributes get special treatment (#10870) + if ( jQuery.expr.match.bool.test( name ) ) { + // Set corresponding property to false + if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { + elem[ propName ] = false; + // Support: IE<9 + // Also clear defaultChecked/defaultSelected (if appropriate) + } else { + elem[ jQuery.camelCase( "default-" + name ) ] = + elem[ propName ] = false; + } + + // See #9699 for explanation of this approach (setting first, then removal) + } else { + jQuery.attr( elem, name, "" ); + } + + elem.removeAttribute( getSetAttribute ? name : propName ); + } + } + }, + + attrHooks: { + type: { + set: function( elem, value ) { + if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to default in case type is set after value during creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + } + }, + + propFix: { + "for": "htmlFor", + "class": "className" + }, + + prop: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? + ret : + ( elem[ name ] = value ); + + } else { + return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? + ret : + elem[ name ]; + } + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + // Use proper attribute retrieval(#12072) + var tabindex = jQuery.find.attr( elem, "tabindex" ); + + return tabindex ? + parseInt( tabindex, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + -1; + } + } + } +}); + +// Hooks for boolean attributes +boolHook = { + set: function( elem, value, name ) { + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { + // IE<8 needs the *property* name + elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); + + // Use defaultChecked and defaultSelected for oldIE + } else { + elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; + } + + return name; + } +}; +jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { + var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr; + + jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ? + function( elem, name, isXML ) { + var fn = jQuery.expr.attrHandle[ name ], + ret = isXML ? + undefined : + /* jshint eqeqeq: false */ + (jQuery.expr.attrHandle[ name ] = undefined) != + getter( elem, name, isXML ) ? + + name.toLowerCase() : + null; + jQuery.expr.attrHandle[ name ] = fn; + return ret; + } : + function( elem, name, isXML ) { + return isXML ? + undefined : + elem[ jQuery.camelCase( "default-" + name ) ] ? + name.toLowerCase() : + null; + }; +}); + +// fix oldIE attroperties +if ( !getSetInput || !getSetAttribute ) { + jQuery.attrHooks.value = { + set: function( elem, value, name ) { + if ( jQuery.nodeName( elem, "input" ) ) { + // Does not return so that setAttribute is also used + elem.defaultValue = value; + } else { + // Use nodeHook if defined (#1954); otherwise setAttribute is fine + return nodeHook && nodeHook.set( elem, value, name ); + } + } + }; +} + +// IE6/7 do not support getting/setting some attributes with get/setAttribute +if ( !getSetAttribute ) { + + // Use this for any attribute in IE6/7 + // This fixes almost every IE6/7 issue + nodeHook = { + set: function( elem, value, name ) { + // Set the existing or create a new attribute node + var ret = elem.getAttributeNode( name ); + if ( !ret ) { + elem.setAttributeNode( + (ret = elem.ownerDocument.createAttribute( name )) + ); + } + + ret.value = value += ""; + + // Break association with cloned elements by also using setAttribute (#9646) + return name === "value" || value === elem.getAttribute( name ) ? + value : + undefined; + } + }; + jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords = + // Some attributes are constructed with empty-string values when not defined + function( elem, name, isXML ) { + var ret; + return isXML ? + undefined : + (ret = elem.getAttributeNode( name )) && ret.value !== "" ? + ret.value : + null; + }; + jQuery.valHooks.button = { + get: function( elem, name ) { + var ret = elem.getAttributeNode( name ); + return ret && ret.specified ? + ret.value : + undefined; + }, + set: nodeHook.set + }; + + // Set contenteditable to false on removals(#10429) + // Setting to empty string throws an error as an invalid value + jQuery.attrHooks.contenteditable = { + set: function( elem, value, name ) { + nodeHook.set( elem, value === "" ? false : value, name ); + } + }; + + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } + } + }; + }); +} + + +// Some attributes require a special call on IE +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !jQuery.support.hrefNormalized ) { + // href/src property should get the full normalized URL (#10299/#12915) + jQuery.each([ "href", "src" ], function( i, name ) { + jQuery.propHooks[ name ] = { + get: function( elem ) { + return elem.getAttribute( name, 4 ); + } + }; + }); +} + +if ( !jQuery.support.style ) { + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Note: IE uppercases css property names, but if we were to .toLowerCase() + // .cssText, that would destroy case senstitivity in URL's, like in "background" + return elem.style.cssText || undefined; + }, + set: function( elem, value ) { + return ( elem.style.cssText = value + "" ); + } + }; +} + +// Safari mis-reports the default selected property of an option +// Accessing the parent's selectedIndex property fixes it +if ( !jQuery.support.optSelected ) { + jQuery.propHooks.selected = { + get: function( elem ) { + var parent = elem.parentNode; + + if ( parent ) { + parent.selectedIndex; + + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + return null; + } + }; +} + +jQuery.each([ + "tabIndex", + "readOnly", + "maxLength", + "cellSpacing", + "cellPadding", + "rowSpan", + "colSpan", + "useMap", + "frameBorder", + "contentEditable" +], function() { + jQuery.propFix[ this.toLowerCase() ] = this; +}); + +// IE6/7 call enctype encoding +if ( !jQuery.support.enctype ) { + jQuery.propFix.enctype = "encoding"; +} + +// Radios and checkboxes getter/setter +jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + } + } + }; + if ( !jQuery.support.checkOn ) { + jQuery.valHooks[ this ].get = function( elem ) { + // Support: Webkit + // "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + }; + } +}); +var rformElems = /^(?:input|select|textarea)$/i, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + var tmp, events, t, handleObjIn, + special, eventHandle, handleObj, + handlers, type, namespaces, origType, + elemData = jQuery._data( elem ); + + // Don't attach events to noData or text/comment nodes (but allow plain objects) + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !(events = elemData.events) ) { + events = elemData.events = {}; + } + if ( !(eventHandle = elemData.handle) ) { + eventHandle = elemData.handle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + types = ( types || "" ).match( core_rnotwhite ) || [""]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // There *must* be a type, no attaching namespace-only handlers + if ( !type ) { + continue; + } + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !(handlers = events[ type ]) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + var j, handleObj, tmp, + origCount, t, events, + special, handlers, type, + namespaces, origType, + elemData = jQuery.hasData( elem ) && jQuery._data( elem ); + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( core_rnotwhite ) || [""]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + delete elemData.handle; + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery._removeData( elem, "events" ); + } + }, + + trigger: function( event, data, elem, onlyHandlers ) { + var handle, ontype, cur, + bubbleType, special, tmp, i, + eventPath = [ elem || document ], + type = core_hasOwn.call( event, "type" ) ? event.type : event, + namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf(".") >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf(":") < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) + event.isTrigger = onlyHandlers ? 2 : 3; + event.namespace = namespaces.join("."); + event.namespace_re = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === (elem.ownerDocument || document) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { + event.preventDefault(); + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && + jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + try { + elem[ type ](); + } catch ( e ) { + // IE<9 dies on focus/blur to hidden element (#1486,#12518) + // only reproducible on winXP IE8 native, not IE9 in IE8 mode + } + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event ); + + var i, ret, handleObj, matched, j, + handlerQueue = [], + args = core_slice.call( arguments ), + handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( (event.result = ret) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var sel, handleObj, matches, i, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + // Black-hole SVG instance trees (#13180) + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { + + /* jshint eqeqeq: false */ + for ( ; cur != this; cur = cur.parentNode || this ) { + /* jshint eqeqeq: true */ + + // Don't check non-elements (#13208) + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matches[ sel ] === undefined ) { + matches[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) >= 0 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matches[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, handlers: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( delegateCount < handlers.length ) { + handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); + } + + return handlerQueue; + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, copy, + type = event.type, + originalEvent = event, + fixHook = this.fixHooks[ type ]; + + if ( !fixHook ) { + this.fixHooks[ type ] = fixHook = + rmouseEvent.test( type ) ? this.mouseHooks : + rkeyEvent.test( type ) ? this.keyHooks : + {}; + } + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = new jQuery.Event( originalEvent ); + + i = copy.length; + while ( i-- ) { + prop = copy[ i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Support: IE<9 + // Fix target property (#1925) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Support: Chrome 23+, Safari? + // Target should not be a text node (#504, #13143) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // Support: IE<9 + // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) + event.metaKey = !!event.metaKey; + + return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var body, eventDoc, doc, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + special: { + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + focus: { + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== safeActiveElement() && this.focus ) { + try { + this.focus(); + return false; + } catch ( e ) { + // Support: IE<9 + // If we error on focus to hidden element (#1486, #12518), + // let .trigger() run the handlers + } + } + }, + delegateType: "focusin" + }, + blur: { + trigger: function() { + if ( this === safeActiveElement() && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: "focusout" + }, + click: { + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { + this.click(); + return false; + } + }, + + // For cross-browser consistency, don't fire native .click() on links + _default: function( event ) { + return jQuery.nodeName( event.target, "a" ); + } + }, + + beforeunload: { + postDispatch: function( event ) { + + // Even when returnValue equals to undefined Firefox will still show alert + if ( event.result !== undefined ) { + event.originalEvent.returnValue = event.result; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { + type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + var name = "on" + type; + + if ( elem.detachEvent ) { + + // #8545, #7054, preventing memory leaks for custom events in IE6-8 + // detachEvent needed property on element, by name of that event, to properly expose it to GC + if ( typeof elem[ name ] === core_strundefined ) { + elem[ name ] = null; + } + + elem.detachEvent( name, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + if ( !e ) { + return; + } + + // If preventDefault exists, run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // Support: IE + // Otherwise set the returnValue property of the original event to false + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + if ( !e ) { + return; + } + // If stopPropagation exists, run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + + // Support: IE + // Set the cancelBubble property of the original event to true + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + } +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// IE submit delegation +if ( !jQuery.support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !jQuery._data( form, "submitBubbles" ) ) { + jQuery.event.add( form, "submit._submit", function( event ) { + event._submit_bubble = true; + }); + jQuery._data( form, "submitBubbles", true ); + } + }); + // return undefined since we don't need an event listener + }, + + postDispatch: function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( event._submit_bubble ) { + delete event._submit_bubble; + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + } + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !jQuery.support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + } + // Allow triggered, simulated change events (#11500) + jQuery.event.simulate( "change", this, event, true ); + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + jQuery._data( elem, "changeBubbles", true ); + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return !rformElems.test( this.nodeName ); + } + }; +} + +// Create "bubbling" focus and blur events +if ( !jQuery.support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler while someone wants focusin/focusout + var attaches = 0, + handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + if ( attaches++ === 0 ) { + document.addEventListener( orig, handler, true ); + } + }, + teardown: function() { + if ( --attaches === 0 ) { + document.removeEventListener( orig, handler, true ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var type, origFn; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + var elem = this[0]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +}); +var isSimple = /^.[^:#\[\.,]*$/, + rparentsprev = /^(?:parents|prev(?:Until|All))/, + rneedsContext = jQuery.expr.match.needsContext, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend({ + find: function( selector ) { + var i, + ret = [], + self = this, + len = self.length; + + if ( typeof selector !== "string" ) { + return this.pushStack( jQuery( selector ).filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }) ); + } + + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, self[ i ], ret ); + } + + // Needed because $( selector, context ) becomes $( context ).find( selector ) + ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); + ret.selector = this.selector ? this.selector + " " + selector : selector; + return ret; + }, + + has: function( target ) { + var i, + targets = jQuery( target, this ), + len = targets.length; + + return this.filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + not: function( selector ) { + return this.pushStack( winnow(this, selector || [], true) ); + }, + + filter: function( selector ) { + return this.pushStack( winnow(this, selector || [], false) ); + }, + + is: function( selector ) { + return !!winnow( + this, + + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + typeof selector === "string" && rneedsContext.test( selector ) ? + jQuery( selector ) : + selector || [], + false + ).length; + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + ret = [], + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( ; i < l; i++ ) { + for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { + // Always skip document fragments + if ( cur.nodeType < 11 && (pos ? + pos.index(cur) > -1 : + + // Don't pass non-elements to Sizzle + cur.nodeType === 1 && + jQuery.find.matchesSelector(cur, selectors)) ) { + + cur = ret.push( cur ); + break; + } + } + } + + return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + var set = typeof selector === "string" ? + jQuery( selector, context ) : + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), + all = jQuery.merge( this.get(), set ); + + return this.pushStack( jQuery.unique(all) ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter(selector) + ); + } +}); + +function sibling( cur, dir ) { + do { + cur = cur[ dir ]; + } while ( cur && cur.nodeType !== 1 ); + + return cur; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( name.slice( -5 ) !== "Until" ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + if ( this.length > 1 ) { + // Remove duplicates + if ( !guaranteedUnique[ name ] ) { + ret = jQuery.unique( ret ); + } + + // Reverse order for parents* and prev-derivatives + if ( rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + } + + return this.pushStack( ret ); + }; +}); + +jQuery.extend({ + filter: function( expr, elems, not ) { + var elem = elems[ 0 ]; + + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 && elem.nodeType === 1 ? + jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : + jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + })); + }, + + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, not ) { + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep( elements, function( elem, i ) { + /* jshint -W018 */ + return !!qualifier.call( elem, i, elem ) !== not; + }); + + } + + if ( qualifier.nodeType ) { + return jQuery.grep( elements, function( elem ) { + return ( elem === qualifier ) !== not; + }); + + } + + if ( typeof qualifier === "string" ) { + if ( isSimple.test( qualifier ) ) { + return jQuery.filter( qualifier, elements, not ); + } + + qualifier = jQuery.filter( qualifier, elements ); + } + + return jQuery.grep( elements, function( elem ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; + }); +} +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, + rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + rtagName = /<([\w:]+)/, + rtbody = /
            ", "
            " ], + tr: [ 2, "", "
            " ], + col: [ 2, "", "
            " ], + td: [ 3, "", "
            " ], + + // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, + // unless wrapped in a div with non-breaking characters in front of it. + _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
            ", "
            " ] + }, + safeFragment = createSafeFragment( document ), + fragmentDiv = safeFragment.appendChild( document.createElement("div") ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +jQuery.fn.extend({ + text: function( value ) { + return jQuery.access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); + }, null, value, arguments.length ); + }, + + append: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + }); + }, + + before: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + }); + }, + + after: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + }); + }, + + // keepData is for internal use only--do not document + remove: function( selector, keepData ) { + var elem, + elems = selector ? jQuery.filter( selector, this ) : this, + i = 0; + + for ( ; (elem = elems[i]) != null; i++ ) { + + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem ) ); + } + + if ( elem.parentNode ) { + if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { + setGlobalEval( getAll( elem, "script" ) ); + } + elem.parentNode.removeChild( elem ); + } + } + + return this; + }, + + empty: function() { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + } + + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + + // If this is a select, ensure that it displays empty (#12336) + // Support: IE<9 + if ( elem.options && jQuery.nodeName( elem, "select" ) ) { + elem.options.length = 0; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function () { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, + + html: function( value ) { + return jQuery.access( this, function( value ) { + var elem = this[0] || {}, + i = 0, + l = this.length; + + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, "" ) : + undefined; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && + ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && + !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, "<$1>" ); + + try { + for (; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + elem = this[i] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch(e) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function() { + var + // Snapshot the DOM in case .domManip sweeps something relevant into its fragment + args = jQuery.map( this, function( elem ) { + return [ elem.nextSibling, elem.parentNode ]; + }), + i = 0; + + // Make the changes, replacing each context element with the new content + this.domManip( arguments, function( elem ) { + var next = args[ i++ ], + parent = args[ i++ ]; + + if ( parent ) { + // Don't use the snapshot next if it has moved (#13810) + if ( next && next.parentNode !== parent ) { + next = this.nextSibling; + } + jQuery( this ).remove(); + parent.insertBefore( elem, next ); + } + // Allow new content to include elements from the context set + }, true ); + + // Force removal if there was no new content (e.g., from empty arguments) + return i ? this : this.remove(); + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, callback, allowIntersection ) { + + // Flatten any nested arrays + args = core_concat.apply( [], args ); + + var first, node, hasScripts, + scripts, doc, fragment, + i = 0, + l = this.length, + set = this, + iNoClone = l - 1, + value = args[0], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { + return this.each(function( index ) { + var self = set.eq( index ); + if ( isFunction ) { + args[0] = value.call( this, index, self.html() ); + } + self.domManip( args, callback, allowIntersection ); + }); + } + + if ( l ) { + fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + if ( first ) { + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( this[i], node, i ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { + + if ( node.src ) { + // Hope ajax is available... + jQuery._evalUrl( node.src ); + } else { + jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); + } + } + } + } + + // Fix #11809: Avoid leaking memory + fragment = first = null; + } + } + + return this; + } +}); + +// Support: IE<8 +// Manipulating tables requires a tbody +function manipulationTarget( elem, content ) { + return jQuery.nodeName( elem, "table" ) && + jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ? + + elem.getElementsByTagName("tbody")[0] || + elem.appendChild( elem.ownerDocument.createElement("tbody") ) : + elem; +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + if ( match ) { + elem.type = match[1]; + } else { + elem.removeAttribute("type"); + } + return elem; +} + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var elem, + i = 0; + for ( ; (elem = elems[i]) != null; i++ ) { + jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); + } +} + +function cloneCopyEvent( src, dest ) { + + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; + + if ( events ) { + delete curData.handle; + curData.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } +} + +function fixCloneNodeIssues( src, dest ) { + var nodeName, e, data; + + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + nodeName = dest.nodeName.toLowerCase(); + + // IE6-8 copies events bound via attachEvent when using cloneNode. + if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { + data = jQuery._data( dest ); + + for ( e in data.events ) { + jQuery.removeEvent( dest, e, data.handle ); + } + + // Event data gets referenced instead of copied if the expando gets copied too + dest.removeAttribute( jQuery.expando ); + } + + // IE blanks contents when cloning scripts, and tries to evaluate newly-set text + if ( nodeName === "script" && dest.text !== src.text ) { + disableScript( dest ).text = src.text; + restoreScript( dest ); + + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + } else if ( nodeName === "object" ) { + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; + } + + // This path appears unavoidable for IE9. When cloning an object + // element in IE9, the outerHTML strategy above is not sufficient. + // If the src has innerHTML and the destination does not, + // copy the src.innerHTML into the dest.innerHTML. #10324 + if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { + dest.innerHTML = src.innerHTML; + } + + } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set + + dest.defaultChecked = dest.checked = src.checked; + + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; + } + + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === "option" ) { + dest.defaultSelected = dest.selected = src.defaultSelected; + + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + i = 0, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone(true); + jQuery( insert[i] )[ original ]( elems ); + + // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() + core_push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +}); + +function getAll( context, tag ) { + var elems, elem, + i = 0, + found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) : + typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) : + undefined; + + if ( !found ) { + for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { + if ( !tag || jQuery.nodeName( elem, tag ) ) { + found.push( elem ); + } else { + jQuery.merge( found, getAll( elem, tag ) ); + } + } + } + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], found ) : + found; +} + +// Used in buildFragment, fixes the defaultChecked property +function fixDefaultChecked( elem ) { + if ( manipulation_rcheckableType.test( elem.type ) ) { + elem.defaultChecked = elem.checked; + } +} + +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var destElements, node, clone, i, srcElements, + inPage = jQuery.contains( elem.ownerDocument, elem ); + + if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { + clone = elem.cloneNode( true ); + + // IE<=8 does not properly clone detached, unknown element nodes + } else { + fragmentDiv.innerHTML = elem.outerHTML; + fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + } + + if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { + + // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + // Fix all IE cloning issues + for ( i = 0; (node = srcElements[i]) != null; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + fixCloneNodeIssues( node, destElements[i] ); + } + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0; (node = srcElements[i]) != null; i++ ) { + cloneCopyEvent( node, destElements[i] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + destElements = srcElements = node = null; + + // Return the cloned set + return clone; + }, + + buildFragment: function( elems, context, scripts, selection ) { + var j, elem, contains, + tmp, tag, tbody, wrap, + l = elems.length, + + // Ensure a safe fragment + safe = createSafeFragment( context ), + + nodes = [], + i = 0; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || safe.appendChild( context.createElement("div") ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + + tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; + + // Descend through wrappers to the right content + j = wrap[0]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Manually add leading whitespace removed by IE + if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); + } + + // Remove IE's autoinserted from table fragments + if ( !jQuery.support.tbody ) { + + // String was a , *may* have spurious + elem = tag === "table" && !rtbody.test( elem ) ? + tmp.firstChild : + + // String was a bare or + wrap[1] === "
            " && !rtbody.test( elem ) ? + tmp : + 0; + + j = elem && elem.childNodes.length; + while ( j-- ) { + if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { + elem.removeChild( tbody ); + } + } + } + + jQuery.merge( nodes, tmp.childNodes ); + + // Fix #12392 for WebKit and IE > 9 + tmp.textContent = ""; + + // Fix #12392 for oldIE + while ( tmp.firstChild ) { + tmp.removeChild( tmp.firstChild ); + } + + // Remember the top-level container for proper cleanup + tmp = safe.lastChild; + } + } + } + + // Fix #11356: Clear elements from fragment + if ( tmp ) { + safe.removeChild( tmp ); + } + + // Reset defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + if ( !jQuery.support.appendChecked ) { + jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); + } + + i = 0; + while ( (elem = nodes[ i++ ]) ) { + + // #4087 - If origin and destination elements are the same, and this is + // that element, do not do anything + if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( safe.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( (elem = tmp[ j++ ]) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + tmp = null; + + return safe; + }, + + cleanData: function( elems, /* internal */ acceptData ) { + var elem, type, id, data, + i = 0, + internalKey = jQuery.expando, + cache = jQuery.cache, + deleteExpando = jQuery.support.deleteExpando, + special = jQuery.event.special; + + for ( ; (elem = elems[i]) != null; i++ ) { + + if ( acceptData || jQuery.acceptData( elem ) ) { + + id = elem[ internalKey ]; + data = id && cache[ id ]; + + if ( data ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Remove cache only if it was not already removed by jQuery.event.remove + if ( cache[ id ] ) { + + delete cache[ id ]; + + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( deleteExpando ) { + delete elem[ internalKey ]; + + } else if ( typeof elem.removeAttribute !== core_strundefined ) { + elem.removeAttribute( internalKey ); + + } else { + elem[ internalKey ] = null; + } + + core_deletedIds.push( id ); + } + } + } + } + }, + + _evalUrl: function( url ) { + return jQuery.ajax({ + url: url, + type: "GET", + dataType: "script", + async: false, + global: false, + "throws": true + }); + } +}); +jQuery.fn.extend({ + wrapAll: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapAll( html.call(this, i) ); + }); + } + + if ( this[0] ) { + // The elements to wrap the target around + var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); + + if ( this[0].parentNode ) { + wrap.insertBefore( this[0] ); + } + + wrap.map(function() { + var elem = this; + + while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { + elem = elem.firstChild; + } + + return elem; + }).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapInner( html.call(this, i) ); + }); + } + + return this.each(function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + }); + }, + + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); + + return this.each(function(i) { + jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); + }); + }, + + unwrap: function() { + return this.parent().each(function() { + if ( !jQuery.nodeName( this, "body" ) ) { + jQuery( this ).replaceWith( this.childNodes ); + } + }).end(); + } +}); +var iframe, getStyles, curCSS, + ralpha = /alpha\([^)]*\)/i, + ropacity = /opacity\s*=\s*([^)]*)/, + rposition = /^(top|right|bottom|left)$/, + // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" + // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + rmargin = /^margin/, + rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), + rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), + rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), + elemdisplay = { BODY: "block" }, + + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: 0, + fontWeight: 400 + }, + + cssExpand = [ "Top", "Right", "Bottom", "Left" ], + cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; + +// return a css property mapped to a potentially vendor prefixed property +function vendorPropName( style, name ) { + + // shortcut for names that are not vendor prefixed + if ( name in style ) { + return name; + } + + // check for vendor prefixed names + var capName = name.charAt(0).toUpperCase() + name.slice(1), + origName = name, + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in style ) { + return name; + } + } + + return origName; +} + +function isHidden( elem, el ) { + // isHidden might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); +} + +function showHide( elements, show ) { + var display, elem, hidden, + values = [], + index = 0, + length = elements.length; + + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + + values[ index ] = jQuery._data( elem, "olddisplay" ); + display = elem.style.display; + if ( show ) { + // Reset the inline display of this element to learn if it is + // being hidden by cascaded rules or not + if ( !values[ index ] && display === "none" ) { + elem.style.display = ""; + } + + // Set elements which have been overridden with display: none + // in a stylesheet to whatever the default browser style is + // for such an element + if ( elem.style.display === "" && isHidden( elem ) ) { + values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); + } + } else { + + if ( !values[ index ] ) { + hidden = isHidden( elem ); + + if ( display && display !== "none" || !hidden ) { + jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); + } + } + } + } + + // Set the display of most of the elements in a second loop + // to avoid the constant reflow + for ( index = 0; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + if ( !show || elem.style.display === "none" || elem.style.display === "" ) { + elem.style.display = show ? values[ index ] || "" : "none"; + } + } + + return elements; +} + +jQuery.fn.extend({ + css: function( name, value ) { + return jQuery.access( this, function( elem, name, value ) { + var len, styles, + map = {}, + i = 0; + + if ( jQuery.isArray( name ) ) { + styles = getStyles( elem ); + len = name.length; + + for ( ; i < len; i++ ) { + map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); + } + + return map; + } + + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + }, + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state ) { + if ( typeof state === "boolean" ) { + return state ? this.show() : this.hide(); + } + + return this.each(function() { + if ( isHidden( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + }); + } +}); + +jQuery.extend({ + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + } + } + } + }, + + // Don't automatically add "px" to these possibly-unitless properties + cssNumber: { + "columnCount": true, + "fillOpacity": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "order": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + // normalize float css property + "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" + }, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, hooks, + origName = jQuery.camelCase( name ), + style = elem.style; + + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // convert relative number strings (+= or -=) to relative numbers. #7345 + if ( type === "string" && (ret = rrelNum.exec( value )) ) { + value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); + // Fixes bug #9237 + type = "number"; + } + + // Make sure that NaN and null values aren't set. See: #7116 + if ( value == null || type === "number" && isNaN( value ) ) { + return; + } + + // If a number was passed in, add 'px' to the (except for certain CSS properties) + if ( type === "number" && !jQuery.cssNumber[ origName ] ) { + value += "px"; + } + + // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, + // but it would mean to define eight (for every problematic property) identical functions + if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { + style[ name ] = "inherit"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { + + // Wrapped to prevent IE from throwing errors when 'invalid' values are provided + // Fixes bug #5509 + try { + style[ name ] = value; + } catch(e) {} + } + + } else { + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, extra, styles ) { + var num, val, hooks, + origName = jQuery.camelCase( name ); + + // Make sure that we're working with the right name + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name, styles ); + } + + //convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Return, converting to number if forced or a qualifier was provided and val looks numeric + if ( extra === "" || extra ) { + num = parseFloat( val ); + return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; + } + return val; + } +}); + +// NOTE: we've included the "window" in window.getComputedStyle +// because jsdom on node.js will break without it. +if ( window.getComputedStyle ) { + getStyles = function( elem ) { + return window.getComputedStyle( elem, null ); + }; + + curCSS = function( elem, name, _computed ) { + var width, minWidth, maxWidth, + computed = _computed || getStyles( elem ), + + // getPropertyValue is only needed for .css('filter') in IE9, see #12537 + ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, + style = elem.style; + + if ( computed ) { + + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right + // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels + // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values + if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { + + // Remember the original values + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + // Put in the new values to get a computed value out + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + // Revert the changed values + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret; + }; +} else if ( document.documentElement.currentStyle ) { + getStyles = function( elem ) { + return elem.currentStyle; + }; + + curCSS = function( elem, name, _computed ) { + var left, rs, rsLeft, + computed = _computed || getStyles( elem ), + ret = computed ? computed[ name ] : undefined, + style = elem.style; + + // Avoid setting ret to empty string here + // so we don't default to auto + if ( ret == null && style && style[ name ] ) { + ret = style[ name ]; + } + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + // but not position css attributes, as those are proportional to the parent element instead + // and we can't measure the parent instead because it might trigger a "stacking dolls" problem + if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { + + // Remember the original values + left = style.left; + rs = elem.runtimeStyle; + rsLeft = rs && rs.left; + + // Put in the new values to get a computed value out + if ( rsLeft ) { + rs.left = elem.currentStyle.left; + } + style.left = name === "fontSize" ? "1em" : ret; + ret = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + if ( rsLeft ) { + rs.left = rsLeft; + } + } + + return ret === "" ? "auto" : ret; + }; +} + +function setPositiveNumber( elem, value, subtract ) { + var matches = rnumsplit.exec( value ); + return matches ? + // Guard against undefined "subtract", e.g., when used as in cssHooks + Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : + value; +} + +function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { + var i = extra === ( isBorderBox ? "border" : "content" ) ? + // If we already have the right measurement, avoid augmentation + 4 : + // Otherwise initialize for horizontal or vertical properties + name === "width" ? 1 : 0, + + val = 0; + + for ( ; i < 4; i += 2 ) { + // both box models exclude margin, so add it if we want it + if ( extra === "margin" ) { + val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); + } + + if ( isBorderBox ) { + // border-box includes padding, so remove it if we want content + if ( extra === "content" ) { + val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + } + + // at this point, extra isn't border nor margin, so remove border + if ( extra !== "margin" ) { + val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } else { + // at this point, extra isn't content, so add padding + val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + + // at this point, extra isn't content nor padding, so add border + if ( extra !== "padding" ) { + val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } + } + + return val; +} + +function getWidthOrHeight( elem, name, extra ) { + + // Start with offset property, which is equivalent to the border-box value + var valueIsBorderBox = true, + val = name === "width" ? elem.offsetWidth : elem.offsetHeight, + styles = getStyles( elem ), + isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + + // some non-html elements return undefined for offsetWidth, so check for null/undefined + // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 + // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 + if ( val <= 0 || val == null ) { + // Fall back to computed then uncomputed css if necessary + val = curCSS( elem, name, styles ); + if ( val < 0 || val == null ) { + val = elem.style[ name ]; + } + + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test(val) ) { + return val; + } + + // we need the check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable elem.style + valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); + + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + } + + // use the active box-sizing model to add/subtract irrelevant styles + return ( val + + augmentWidthOrHeight( + elem, + name, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox, + styles + ) + ) + "px"; +} + +// Try to determine the default display value of an element +function css_defaultDisplay( nodeName ) { + var doc = document, + display = elemdisplay[ nodeName ]; + + if ( !display ) { + display = actualDisplay( nodeName, doc ); + + // If the simple way fails, read from inside an iframe + if ( display === "none" || !display ) { + // Use the already-created iframe if possible + iframe = ( iframe || + jQuery("